1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1055],{15746:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/blogs",function(){return n(95271)}])},65154:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(85893);function i(e){var t=e.value,n=e.id,i=e.onChange;return(0,r.jsx)("input",{id:n,type:"checkbox",className:"focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded",checked:t,onChange:function(e){return i(e.target.checked)}})}},12174:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(85893),i=n(67294),o=function(e){var t=e.children,n=e.collapsed,o=(0,i.useRef)(),a=(0,i.useState)(0),s=a[0],l=a[1],u=(0,i.useState)(0),c=u[0],d=u[1];return(0,i.useEffect)((function(){var e=null===o||void 0===o?void 0:o.current;e&&l(e.scrollHeight)}),[]),(0,i.useEffect)((function(){d(s*Number(!n))}),[s,n]),(0,r.jsx)("div",{ref:o,style:{height:"".concat(c,"px")},className:" duration-200 ease-out overflow-hidden transition-[height] ",children:t})}},37156:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(85893),i=n(67294),o=n(66628),a={blue:{bg:"bg-boni-blue",text:"text-white"},green:{bg:"bg-green-500",text:"text-white"},red:{bg:"bg-boni-red",text:"text-white"},slate:{bg:"bg-slate-500",text:"text-white"}};function s(e){var t,n=(0,i.useState)(!1),s=n[0],l=n[1];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{open:s,onClose:function(){l(!1)},onConfirm:function(){"function"===typeof e.onClick&&e.onClick(),l(!1)},title:e.confirmationTitle,body:e.confirmationBody}),(0,r.jsx)("button",{className:"\n px-2 py-1 rounded font-semibold\n ".concat(a[e.color]?Object.values(a[e.color]).join(" "):"bg-slate-500 text-white","\n ").concat(e.className,"\n disabled:bg-slate-200 disabled:text-slate-100\n "),disabled:!!e.disabled,onClick:function(){return l(!0)},type:null!==(t=e.type)&&void 0!==t?t:"button",children:e.children})]})}},22045:function(e,t,n){"use strict";var r=n(85893),i=n(67294),o=n(17283),a=n(37887),s=n(93054),l=n(33299),u=n(25295);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){c(e,t,n[t])}))}return e}function f(){var e,t,n=(e=["\n query getGroupsForSelect($condition: groups_bool_exp!) {\n groups(where: $condition) {\n id\n name\n }\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return f=function(){return n},n}var p=(0,o.Ps)(f());t.Z=function(e){var t,n,o,c,f=(0,l.useSession)(),h=(0,a.a)(p,{variables:{condition:(0,u.M9)(null===(t=f.data)||void 0===t?void 0:t.user,e.isAdmin)}}),b=function(e,t){return t.filter((function(t){return null===e||void 0===e?void 0:e.includes(null===t||void 0===t?void 0:t.id)})).map((function(e){return{value:e.id,label:e.name}}))},v=(0,i.useState)(b(e.value,(null===(n=h.data)||void 0===n?void 0:n.groups)||[])),m=v[0],x=v[1];(0,i.useEffect)((function(){var t,n;if(null===h||void 0===h||null===(t=h.data)||void 0===t||null===(n=t.groups)||void 0===n?void 0:n.length){var r=e.value;x(b(r,h.data.groups)),r!==e.value&&e.onChange(r)}}),[null===(o=h.data)||void 0===o?void 0:o.groups,e]);return(0,r.jsxs)("div",{children:[(0,r.jsx)(s.ZP,{menuPortalTarget:document.body,styles:{menuPortal:function(e){return d({},e,{zIndex:9999})},control:function(t){return d({},t,{borderColor:e.error?"rgb(220, 38, 38)":"hsl(0, 0%, 80%)"})}},isMulti:!!e.isMulti,isDisabled:!!e.isDisabled,options:null===(c=h.data)||void 0===c?void 0:c.groups.map((function(e){return{label:e.name,value:e.id}})),placeholder:e.placeholder,value:m,onChange:function(t){var n=Array.isArray(t)?t:[t];x(n),"function"===typeof e.onChange&&e.onChange(n.filter(Boolean).map((function(e){return e.value})))}}),!!e.error&&(0,r.jsx)("p",{className:"text-xs text-red-600 ml-1",children:e.error})]})}},69149:function(e,t,n){"use strict";n.d(t,{t:function(){return f}});var r=n(85893),i=n(82183),o=n(20013),a=n(17524),s=n(30347),l=n(67294),u=n(93054),c=[5,10,20,50,100].map((function(e){return{value:e,label:e.toString()}})),d=function(e){return(0,r.jsx)("button",{className:"\n text-xs font-semibold\n px-2 py-1\n rounded\n transition-colors\n flex justify-center basis-8 flex-shrink-0\n hover:bg-boni-blue/25\n disabled:text-slate-200 disabled:bg-slate-50 disabled:hover:bg-slate-50\n ".concat(e.active?"bg-boni-blue text-white":"bg-slate-100","\n "),disabled:e.disabled,onClick:e.onClick,type:"button",children:e.children})},f=function(e){var t=function(){return e.pageIndex==h},n=function(){var t=h+f-1;return e.pageIndex==t},f=Math.ceil(e.itemsCount/e.itemsPerPage),p=(0,l.useState)(0),h=p[0],b=p[1],v=(0,l.useState)(0),m=v[0],x=v[1],g=(0,l.useState)(e.itemsPerPage||20),y=g[0],j=g[1],w=(0,l.useCallback)((function(e){var t=Math.max(0,e-Math.floor(2.5)),n=Math.min(t+5,f),r=n-t;r<5&&(t=Math.max(0,t-(5-r))),b(t),x(n)}),[f]);return(0,l.useEffect)((function(){w(e.pageIndex)}),[e.pageIndex,w]),(0,r.jsxs)("div",{className:"flex gap-2 justify-between py-2 text-slate-600",children:[(0,r.jsx)("div",{className:"w-32"}),(0,r.jsxs)("div",{className:"flex overflow-hidden flex-1 gap-2 justify-center items-center",children:[(0,r.jsx)(d,{onClick:function(){w(0)},disabled:t(),children:(0,r.jsx)(i.Z,{className:"h-4"})}),(0,r.jsx)(d,{onClick:function(){w(h-5)},disabled:t(),children:(0,r.jsx)(o.Z,{className:"h-4"})}),function(e){for(var t=[],n=e;n<m;n++)t.push(n);return t}(h).map((function(t,n){return(0,r.jsx)(d,{active:e.pageIndex==t,onClick:function(){e.onClickPage(t)},children:t+1},n)})),(0,r.jsx)(d,{onClick:function(){w(m)},disabled:n(),children:(0,r.jsx)(a.Z,{className:"h-4"})}),(0,r.jsx)(d,{onClick:function(){w(f-5)},disabled:n(),children:(0,r.jsx)(s.Z,{className:"h-4"})})]}),(0,r.jsx)("div",{className:"w-32",children:(0,r.jsx)(u.ZP,{options:c,value:{value:y,label:y.toString()},onChange:function(t){return function(t){j(t),e.onClickPage(0),e.onItemsPerPageChange(t)}
1(t.value)},isSearchable:!1,menuPlacement:"auto"})})]})}},2407:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(85893),i=n(28309);function o(e){var t=e.className,n=e.error,o=e.icon,a=e.id,s=e.invalid,l=e.label,u=e.name,c=e.onChange,d=e.placeholder,f=e.type,p=e.value,h=e.disabled;return(0,r.jsxs)("div",{className:t,children:[l&&(0,r.jsx)("label",{htmlFor:"price",className:"block text-sm mb-1 font-medium text-gray-700",children:l}),(0,r.jsxs)("div",{className:"relative rounded-md shadow-sm",children:[o&&(0,r.jsx)("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3",children:(0,r.jsx)("span",{className:"text-gray-500 sm:text-sm",children:(0,r.jsx)(i.e,{icon:o,className:"w-6 h-6 text-gray-300",outline:!0})})}),(0,r.jsx)("input",{name:u,id:a,className:"\n block w-full rounded-md border-gray-300 pr-12 focus:border-blue-500 focus:ring-blue-500 sm:text-sm placeholder-gray-400\n ".concat(o&&"pl-10","\n ").concat(!!s&&"border-red-400","\n "),placeholder:d,onChange:c,type:f||"text",value:p||"",disabled:h||!1})]}),!!n&&(0,r.jsx)("p",{className:"text-xs text-red-600 ml-1",children:n})]})}},82944:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(85893);n(67294);function i(e){var t=e.currentLength,n=e.maxLength,i=e.className;return(0,r.jsxs)("span",{className:i||"text-xs text-slate-400",children:[t," / ",n," Zeichen"]})}},87561:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(85893),i=n(67294),o=n(92422),a=n(35390);function s(e){var t=e.title,n=e.body,s=e.onClose,l=e.open,u=e.icon;return(0,i.useEffect)((function(){}),[]),(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(a.Z,{title:t,icon:null!==u&&void 0!==u?u:"ExclamationCircleIcon",iconColor:"red",open:l,onClose:s,children:(0,r.jsxs)("form",{onSubmit:function(e){e.preventDefault(),s()},children:[(0,r.jsx)("div",{className:"isolate -space-y-px rounded-md shadow-sm mb-2",dangerouslySetInnerHTML:{__html:n}}),(0,r.jsx)("div",{className:"mt-5 flex",children:(0,r.jsx)(o.Z,{color:"primary",type:"submit",label:"Ok",onClick:function(){}})})]})})})}},81719:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(85893),i=n(44080),o=n(71272),a=n(67294),s=n(92422),l=n(25935),u={overflow:"hidden",position:"relative"},c={padding:"0 20px 20px 20px",textAlign:"left",overflow:"scroll",height:"560px",width:"440px",position:"absolute",top:"295px"},d={fontFamily:"sans-serif",fontSize:"23px",color:"#4a4742",fontWeight:"bold"};function f(e){var t=e.title,n=e.content,f=e.open,p=e.onClose,h=(e.icon,e.iconColor,e.style);return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(i.u.Root,{show:f,as:a.Fragment,children:(0,r.jsx)(o.V,{as:"div",className:"fixed z-10
1inset-0 overflow-y-auto",onClose:p,children:(0,r.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,r.jsx)(i.u.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,r.jsx)(o.V.Overlay,{className:"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"})}),(0,r.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"\u200b"}),(0,r.jsx)(i.u.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,r.jsxs)("div",{className:"relative inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6",style:h,children:[(0,r.jsx)("div",{children:(0,r.jsxs)("div",{className:"mt-0 text-center sm:mt-0",style:u,children:[(0,r.jsx)("div",{className:"mt-0 sm:mx-auto sm:w-full h-previewHeight w-previewWidth sm:max-w-md bg-[url('/images/FirmAppContentPreview.png')] bg-cover bg-no-repeat",children:(0,r.jsxs)("div",{style:c,children:[(0,r.jsx)("h1",{style:d,children:t}),(0,r.jsx)("div",{className:"preview-content",children:(0,l.ZP)(n)})]})}),(0,r.jsx)("div",{className:"mt-2"})]})}),(0,r.jsx)(s.Z,{color:"secondary",type:"button",label:"Schlie\xdfen",onClick:p,className:"mr-2"})]})})]})})})})}},31445:function(e,t,n){"use strict";n.d(t,{E:function(){return x},B:function(){return y}});var r=n(34051),i=n.n(r),o=n(17283),a=n(43170),s=n(57976),l=n(8819),u=n(37865);function c(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){return void n(u)}s.done?t(l):Promise.resolve(l).then(r,i)}function d(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){c(o,r,i,a,s,"next",e)}function s(e){c(o,r,i,a,s,"throw",e)}a(void 0)}))}}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){f(e,t,n[t])}))}return e}function h(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function b(){var e=h(["\n query sendPushNotification($title: String, $body: String, $groupID: String, $uriType: String, $uri: String, $extraData: String) {\n sendPushNotification(title: $title, body: $body, groupID: $groupID, uriType: $uriType, uri: $uri, extraData: $extraData){\n responses {\n success\n messageId\n },\n successCount,\n failureCount\n }\n }"]);return b=function(){return e},e}function v(){var e=h(["\n query sendPushNotification($title: String, $body: String, $userIDs: [String], $uriType: String, $uri: String){\n sendPushNotification(title: $title, body: $body, userIDs: $userIDs, uriType: $uriType, uri: $uri){\n responses {\n success\n messageId\n },\n successCount,\n failureCount\n }\n }"]);return v=function(){return e},e}function m(){var e=localStorage.getItem("hjwt");if(!e&&document.cookie){var t=document.cookie.split(";").find((function(e){return e.trim().startsWith("__Secure-next-auth.session-token=")||e.trim().startsWith("next-auth.session-token=")}));t&&(e=t.split("=")[1])}return e}function x(e,t,n,r,i,o){return g.apply(this,arguments)}function g(){return(g=d(i().mark((function e(t,n,r,c,d,f){var h,v,x,g,y;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h=(0,o.Ps)(b()),v=(0,a.L)({uri:"https://firmapp-backend.netlify.app/.netlify/functions/graphql"}
1),x=(0,u.v)((function(e,t){var n=t.headers,r=m();return{headers:p({},n,r&&{authorization:"Bearer ".concat(r)})}})),g=new s.f({cache:new l.h,link:x.concat(v)}),e.prev=4,e.next=7,g.query({query:h,variables:{title:t,body:n,groupID:r,uriType:c,uri:d,extraData:f?JSON.stringify(f):void 0}});case 7:return y=e.sent,e.abrupt("return",y.data.sendPushNotification);case 11:throw e.prev=11,e.t0=e.catch(4),console.error("Error sending push notification to group:",e.t0),e.t0;case 15:case"end":return e.stop()}}),e,null,[[4,11]])})))).apply(this,arguments)}function y(e,t,n,r,i){return j.apply(this,arguments)}function j(){return(j=d(i().mark((function e(t,n,r,c,d){var f,h,b,x,g;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f=(0,o.Ps)(v()),h=(0,a.L)({uri:"https://firmapp-backend.netlify.app/.netlify/functions/graphql"}),b=(0,u.v)((function(e,t){var n=t.headers,r=m();return{headers:p({},n,r&&{authorization:"Bearer ".concat(r)})}})),x=new s.f({cache:new l.h,link:b.concat(h)}),e.prev=4,e.next=7,x.query({query:f,variables:{title:t,body:n,userIDs:r,uriType:c,uri:d}});case 7:return g=e.sent,e.abrupt("return",g.data.sendPushNotification);case 11:throw e.prev=11,e.t0=e.catch(4),console.error("Error sending push notification to users:",e.t0),e.t0;case 15:case"end":return e.stop()}}),e,null,[[4,11]])})))).apply(this,arguments)}},95271:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return de},default:function(){return fe}});var r=n(85893),i=n(34051),o=n.n(i),a=n(67294),s=n(33299),l=n(97568),u=n(73359),c=n(50319),d=n(17283),f=n(37887),p=n(30381),h=n.n(p),b=n(12174),v=n(28309),m=n(69149);function x(e){var t=e.data,n=e.onCheckboxChange,i=e.onClick,o=e.selected,a=e.withCheckbox;(0,l.$G)("blogs").t;return(0,r.jsx)("div",{className:"\n flex gap-2 cursor-pointer rounded-lg p-2\n ".concat(o?"bg-boni-blue/10 odd:bg-boni-blue/15":"odd:bg-slate-100","\n "),onClick:function(e){"function"===typeof i&&i(t,e)},style:{userSelect:"none"},children:(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsxs)("div",{className:"text-base flex gap-2 items-center",children:[!!a&&(0,r.jsx)("div",{className:"flex",children:(0,r.jsx)("input",{className:"rounded-sm checked:bg-boni-red checked:hover:bg-boni-red",type:"checkbox",defaultChecked:o,onChange:function(){"function"===typeof n&&n(t.id)}},Math.random())}),(0,r.jsx)("span",{className:"font-semibold",children:t.title})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(v.e,{className:"w-4 h-4 text-slate-400",icon:"UserIcon"}),t.created_by.first_name," ",t.created_by.last_name]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(v.e,{className:"w-4 h-4 text-slate-400",icon:"CalendarIcon"}),h()(t.created_at).format("DD.MM.YYYY")]})]})]})})}var g=n(87536),y=n(37156),j=n(22045),w=n(55802),_=n(2407),N=n(82944),k=n(47153),S=n(81719),C=n(65154);function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function P(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){return void n(u)}s.done?t(l):Promise.resolve(l).then(r,i)}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){I(e,t,n[t])}))}return e}function E(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function M(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"===typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var T=function(e){return(0,r.jsx)("input",D({},e,{className:"rounded-md border-slate-300 text-slate-600 shadow-sm h-[36px]",type:"datetime-local",value:e.value?h()(e.value).format("YYYY-MM-DDTHH:mm"):""}))},Z=["delete"],$=[],A=M(Z).concat(M($));function F(e){var t,n,i=e.data,u=e.isBulk,c=e.siblingGroupNames,d=e.onChange,f
1=e.onDelete,p=e.onDeleteRevision,b=e.onRestoreRevision,m=(0,l.$G)("blogs").t,x=(0,g.cI)({values:D({},i)}),O=x.control,I=x.handleSubmit,M=x.reset,F=x.watch,B=x.formState.dirtyFields,R=(0,s.useSession)().data,q=!i.id,Y=(0,a.useState)(Number(u)*(Number(!Z.length)+Number(!$.length)-1)),z=Y[0],U=Y[1],L=(0,a.useState)(!1),G=L[0],H=L[1],Q=(0,a.useState)(!1),W=Q[0],J=Q[1],K=F();(0,a.useEffect)((function(){J(!i.id||!!i.scheduled_push_event_id)}),[i]),(0,a.useEffect)((function(){K.published||J(!1)}),[K.published]);var V=function(){var e,t=(e=o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"function"===typeof d&&d(t,{checkedPushToGroups:W});case 1:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){P(o,r,i,a,s,"next",e)}function s(e){P(o,r,i,a,s,"throw",e)}a(void 0)}))});return function(e){return t.apply(this,arguments)}}();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("form",{className:"blog-editor flex flex-col h-full overflow-hidden gap-4 bg-slate-50 p-4 rounded-lg",onSubmit:I(V),children:[(0,r.jsxs)("div",{className:"h-[40px] border-b-2 border-boni-blue bg-slate-200 rounded flex gap-2",children:[(0,r.jsx)("button",{className:"px-2 py-1 h-[40px] min-w-[120px] font-semibold rounded-t ".concat(0===z&&"bg-boni-blue text-white"," disabled:text-slate-300"),disabled:u&&!Z.length,type:"button",onClick:function(){return U(0)},children:m("blogs.editor.content_tab_label")}),(0,r.jsx)("button",{className:"px-2 py-1 h-[40px] min-w-[120px] font-semibold rounded-t ".concat(1===z&&"bg-boni-blue text-white"," disabled:text-slate-300"),disabled:u&&!$.length||!(null===(t=i.revisions)||void 0===t?void 0:t.length),type:"button",onClick:function(){return U(1)},children:m("blogs.editor.metadata_tab_label")}),(0,r.jsx)("button",{className:"px-2 py-1 h-[40px] min-w-[120px] font-semibold rounded-t ".concat(2===z&&"bg-boni-blue text-white"," disabled:text-slate-300"),disabled:u,type:"button",onClick:function(){H(!0)},children:m("blogs.editor.preview_tab_label")})]}),(0,r.jsx)("div",{className:"flex-1 overflow-hidden w-full relative min-h-0",children:(0,r.jsxs)("div",{className:"w-[200%] h-full flex flex-row transition-transform",style:{transform:"translateX(-".concat(50*z,"%)")},children:[(0,r.jsxs)("div",{className:"flex-none flex flex-col gap-4 overflow-auto w-[50%] min-h-0",children:[(0,r.jsxs)("div",{className:"flex gap-2 items-stretch justify-between",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("span",{className:"block mb-1 text-gray-700 font-medium",children:m("blogs.input.group.label")}),(0,r.jsx)(g.Qr,{control:O,name:q?"group_ids":"group_id",render:function(e){e.field.ref;var t,n=E(e.field,["ref"]);return(0,r.jsx)(j.Z,D({},n,{isMulti:q,isAdmin:"admin"===(null===(t=R.user)||void 0===t?void 0:t.roleObj.name),onChange:function(e){q?n.onChange(e):n.onChange(e[0]||null)}}))},rules:{required:{value:!u,message:m("blogs.input.group.error")}}})]}),(0,r.jsxs)("div",{className:"min-w-[100px]",children:[(0,r.jsx)("span",{className:"block mb-1 text-gray-700 font-medium",children:m("blogs.input.published.label")}),(0,r.jsx)(g.Qr,{control:O,name:"published",render:function(e){var t=e.field;return(0,r.jsx)("button",{className:"h-[36px] w-full px-2 py-1 font-semibold text-white rounded ".concat(t.value?"bg-boni-blue":"bg-slate-500"),onClick:function(){t.onChange(!t.value),J(!1)},type:"button",children:t.value?m("blogs.input.published.value.true"):m("blogs.input.published.value.false")})}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"block mb-1 text-gray-700 font-medium",children:m("blogs.input.published_at.label")}),(0,r.jsx)(g.Qr,{control:O,name:"published_at",render:function(e){e.field.ref;var t=E(e.field,["ref"]);return(0,r.jsx)(T,{value:t.value,onChange:function(e){return t.onChange(h()(e.target.value).toISOString())}})}})]})]}),!q&&c&&c.length>0&&(0,r.jsxs)("div",{className:"flex gap-2 items-start p-3 text-xs rounded-md border bg-boni-blue/5 border-boni-blue/20 text-slate-600",children:[(0,r.jsx)(v.e,{icon:"UsersIcon",className:"w-4 h-4 flex-none mt-[2px] text-boni-blue"}),(0,r.jsx)("span",{children:m("blogs.input.batch_siblings.label",{groups:c.join(", ")})})]}),(!u||A.includes("title"))&&(0,r.jsx)(g.Qr,{control:O,name:"title",render:function(e){e.field.ref;
1var t=e.fieldState,n=t.invalid,i=t.error,o=E(e.field,["ref"]);return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-1",children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700",children:m("blogs.input.title.label")}),(0,r.jsx)(N.Z,{currentLength:(o.value||"").length,maxLength:k.wN})]}),(0,r.jsx)(_.Z,D({placeholder:m("blogs.input.title.placeholder"),invalid:n,error:null===i||void 0===i?void 0:i.message},o,{onChange:function(e){var t,n="string"===typeof e?e:null===e||void 0===e||null===(t=e.target)||void 0===t?void 0:t.value,r=o.value||"",i=(0,k.ho)(r,n);o.onChange(i)}}))]})},rules:{required:{value:!0,message:m("blogs.input.title.error")}}}),(!u||A.includes("text"))&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)(g.Qr,{control:O,name:"text",render:function(e){e.field.ref;var t=e.fieldState,n=(t.invalid,t.error,E(e.field,["ref"]));return(0,r.jsx)(w.Z,D({},n))},rules:{required:{value:!0,message:m("blogs.input.text.error")}}})})})]}),(0,r.jsx)("div",{className:"w-[50%] overflow-auto",children:(0,r.jsx)("ul",{className:"flex flex-col gap-2 whitespace-nowrap p-2",children:null===i||void 0===i||null===(n=i.revisions)||void 0===n?void 0:n.map((function(e,t){var n,o;return(0,r.jsxs)("li",{className:"even:bg-slate-100 flex gap-2 items-stretch p-2 rounded",children:[(0,r.jsx)("span",{className:"border-r-[1px] border-slate-200 w-8 text-right pr-2",children:i.revisions.length-t}),(0,r.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis font-semibold",children:[null===(n=e.created_by)||void 0===n?void 0:n.first_name," ",null===(o=e.created_by)||void 0===o?void 0:o.last_name]}),(0,r.jsx)("span",{className:"flex-none px-2 py-1 bg-slate-200 rounded font-semibold text-xs min-w-36 text-center",children:h()(e.created_at).format("YYYY-MM-DD HH:mm:ss")}),(0,r.jsx)(y.Z,{className:"bg-boni-blue",color:"blue",confirmationBody:m("blogs.input.revision_restore.confirmation_body"),confirmationTitle:m("blogs.input.revision_restore.confirmation_title"),onClick:function(){return"function"===typeof b?b(e.id):function(){}},children:(0,r.jsx)(v.e,{className:"h-4 w-4 text-white",icon:"ArrowPathIcon"})}),(0,r.jsx)(y.Z,{color:"red",confirmationBody:m("blogs.input.revision_delete.confirmation_body"),confirmationTitle:m("blogs.input.revision_delete.confirmation_title"),onClick:function(){return"function"===typeof p?p(e.id):function(){}},children:(0,r.jsx)(v.e,{className:"h-4 w-4 text-white",icon:"TrashIcon"})})]},"revision-".concat(t))}))})})]})}),(0,r.jsx)("div",{className:"flex gap-1",children:K.published&&(0,r.jsxs)("div",{children:[(0,r.jsx)(C.Z,{id:"blogs_checkbox_push_to_groups",value:W,onChange:function(e){return J(e)}}),(0,r.jsxs)("label",{htmlFor:"blogs_checkbox_push_to_groups",className:"ml-2 text-sm text-slate-500",children:[m("blogs.input.push_to_groups.label"),W&&K.published_at&&h()(K.published_at).isAfter(h()())&&(0,r.jsxs)("span",{className:"ml-1 text-xs text-slate-400",children:["(",m("blogs.input.push_to_groups.scheduled_hint",{datetime:h()(K.published_at).format("DD.MM.YYYY HH:mm")}),")"]})]})]})}),(0,r.jsxs)("div",{className:"flex-none h-[40px] flex items-center justify-between gap-1",children:[(!!(null===i||void 0===i?void 0:i.id)||u&&A.includes("delete"))&&(0,r.jsx)(y.Z,{className:"px-2 py-1 h-[36px] min-w-[150px] font-semibold bg-boni-red text-white rounded",confirmationBody:m("blogs.input.delete.confirmation_body"),confirmationTitle:m("blogs.input.delete.confirmation_title"),color:"red",onClick:function(){"function"===typeof f&&f(F())},children:m("blogs.input.delete.label")}),(0,r.jsx)("div",{className:"flex-1"}),(0,r.jsx)("button",{className:"px-2 py-1 h-[36px] min-w-[150px] font-semibold bg-slate-200 rounded",type:"reset",onClick:function(){return M()},children:m("blogs.input.reset.label")}),(0,r.jsx)("button",{className:"px-2 py-1 h-[36px] min-w-[150px] font-semibold bg-boni-blue text-white rounded order-1 disabled:opacity-50",type:"submit",disabled:!Object.keys(B).length,children:m("blogs.input.submit.label")})]})]}),(0,r.jsx)(S.Z,{title:F("title"),content:F("text")||"",onClose:function(){return H(!1)},open:G,icon:"PencilIcon"})]})}var B=n(67801),R=n(31445);function q(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){return void n(u)}s.done?t(l):Promise.resolve(l).then(r,i)}function Y(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){q(o,r,i,a,s,"next",e)}function s(e){q(o,r,i,a,s,"throw",e)}a(void 0)}))}}var z="/api/scheduled-events/blog-push";function U(e){return L.apply(this,arguments)}function L(){return(L=Y(o().mark((function e(t){var n,r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(z,{method:"POST",headers:{"content-type":"application/json"}
1,credentials:"include",body:JSON.stringify({schedule_at:t.scheduleAt.toISOString(),payload:t.payload})});case 2:if((n=e.sent).ok){e.next=8;break}return e.next=6,n.text().catch((function(){return""}));case 6:throw r=e.sent,new Error("Failed to create scheduled event: ".concat(n.status," ").concat(r));case 8:return e.next=10,n.json();case 10:if((i=e.sent).event_id){e.next=13;break}throw new Error("Scheduled event created but no event_id returned");case 13:return e.abrupt("return",i.event_id);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function G(e){return H.apply(this,arguments)}function H(){return(H=Y(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,fetch("".concat(z,"?eventId=").concat(encodeURIComponent(t)),{method:"DELETE",credentials:"include"});case 4:if((n=e.sent).ok){e.next=10;break}return e.next=8,n.text().catch((function(){return""}));case 8:throw r=e.sent,new Error("Failed to delete scheduled event: ".concat(n.status," ").concat(r));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;return!!(null===e||void 0===e?void 0:e.published)&&!!e.published_at&&new Date(e.published_at).getTime()<=t.getTime()}var W=n(41696),J=n(87561),K=n(41883),V=n(61283);function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ee(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){return void n(u)}s.done?t(l):Promise.resolve(l).then(r,i)}function te(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){ee(o,r,i,a,s,"next",e)}function s(e){ee(o,r,i,a,s,"throw",e)}a(void 0)}))}}function ne(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function re(e,t){return null!=t&&"undefined"!==typeof Symbol&&t[Symbol.hasInstance]?t[Symbol.hasInstance](e):e instanceof t}function ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ne(e,t,n[t])}))}return e}function oe(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ae(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(l){s=!0,i=l}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}}(e,t)||le(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function se(e){return function(e){if(Array.isArray(e))return X(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||le(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function le(e,t){if(e){if("string"===typeof e)return X(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?X(e,t):void 0}}function ue(){var e,t,n=(e=["\n mutation setScheduledPushEventId($id: uuid!, $eventId: uuid) {\n update_contents_by_pk(pk_columns: { id: $id }, _set: { scheduled_push_event_id: $eventId }) {\n id\n scheduled_push_event_id\n }\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return ue=function(){return n},n}var ce=function(){var e,t,n,i,p,g,y,j,w,_,N,S,C,O,P,I=function(e,t,n){Te(e),Ae(t),Re(n)},D=function(e,t){var n=t.range,r=t.addOne;if(n||r||Qe([e]),r){var i=He.indexOf(e);if(i>=0){var o=se(He);return o.splice(i,1),void Qe(o)}Qe(se(He).concat([e]))}if(n){document.getSelection().removeAllRanges();var a=function(e){return Ue.findIndex((function(t){return e===t}))},s=a(e),l=a(He[0]);if([s,l].some((function(e){return e<0})))return;for(var u=Math.min(s,l),c=Math.max(s,l),d=[],f=u;f<=c;f+=1)d.push(Ue[f]);Qe(d)}},E=function(e){if(!e)return{};
1e.__typename,e.created_at,e.created_by,e.id,e.revisions,e.updated_at,e.group_ids;return oe(e,["__typename","created_at","created_by","id","revisions","updated_at","group_ids"])},M=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if((0,W.WL)({actions:["create"],resource:"blogs"})){Qe([null]);var n,r,i,o,a=Z.user,s=null!==(n=null===a||void 0===a?void 0:a.id)&&void 0!==n?n:null,l=ae((null!==(r=null===a||void 0===a?void 0:a.name)&&void 0!==r?r:"").split(" "),2),u=l[0],c=l[1],d=null!==(i=null===a||void 0===a||null===(e=a.group)||void 0===e?void 0:e.id)&&void 0!==i?i:null;o=null===a||void 0===a?void 0:a.parish_id;Ke(ie({type:"blog",created_by_id:s,published_at:(new Date).toISOString(),created_by:{id:s,first_name:u,last_name:c},group_id:d},t))}else Ce(!0)},T=(0,l.$G)("blogs").t,Z=(0,s.useSession)().data,$=(0,a.useState)(0),A=$[0],q=$[1],Y=(0,a.useState)({}),z=Y[0],L=Y[1],H=ae((0,u.t)(B.Ko),1)[0],X=ae((0,c.D)(B.NK),1)[0],ee=ae((0,c.D)(B.Cj),1)[0],le=ae((0,c.D)(B.S6),1)[0],ce=ae((0,c.D)(B.Ho),1)[0],de=(0,d.Ps)(ue()),fe=ae((0,c.D)(de),1)[0],pe=(0,a.useState)(20),he=pe[0],be=pe[1],ve=(0,a.useState)(0),me=ve[0],xe=ve[1],ge=(0,a.useState)({}),ye=ge[0],je=ge[1],we=(0,a.useState)({type:{_eq:"blog"}}),_e=we[0],Ne=(we[1],(0,f.a)(B.Vr,{variables:{groups_condition:ye,contents_condition:_e,offset:me*he,limit:he}})),ke=(0,a.useState)(!1),Se=ke[0],Ce=ke[1],Oe=("moderator"==(null===(e=Z.user)||void 0===e?void 0:e.roleObj.name)||"group_leader"==(null===(t=Z.user)||void 0===t?void 0:t.roleObj.name))&&0==(null===(n=Z.user)||void 0===n||null===(i=n.groups)||void 0===i?void 0:i.length),Pe=(0,a.useState)(!1),Ie=Pe[0],De=Pe[1],Ee=(0,a.useState)(""),Me=Ee[0],Te=Ee[1],Ze=(0,a.useState)(""),$e=Ze[0],Ae=Ze[1],Fe=(0,a.useState)("success"),Be=Fe[0],Re=Fe[1];(0,a.useEffect)((function(){var e,t,n={_and:[]};"admin"!==(null===(e=Z.user)||void 0===e?void 0:e.roleObj.name)&&n._and.push({parish_id:{_eq:null===(t=Z.user)||void 0===t?void 0:t.parish_id}}),xe(0),Qe([]),je(n)}),[null===(p=Z.user)||void 0===p?void 0:p.roleObj.name,null===(g=Z.user)||void 0===g||null===(y=g.groups)||void 0===y?void 0:y.length]);var qe=(0,a.useCallback)((function(e){var t,n;return null===(t=Ne.data)||void 0===t||null===(n=t.groups)||void 0===n?void 0:n.reduce((function(t,n){return n.contents.find((function(t){return t.id===e}))||t}),null)}),[null===(j=Ne.data)||void 0===j?void 0:j.groups]),Ye=(0,a.useCallback)((function(e){var t,n,r,i=null===(t=e)||void 0===t?void 0:t.batch_id;if(!i||!(null===e||void 0===e?void 0:e.id))return[];var o=null!==(r=null===(n=Ne.data)||void 0===n?void 0:n.groups)&&void 0!==r?r:[],a=[],s=!0,l=!1,u=void 0;try{for(var c,d=o[Symbol.iterator]();!(s=(c=d.next()).done);s=!0){var f=c.value;f.contents.some((function(t){return t.batch_id===i&&t.id!==e.id}))&&a.push(f.name)}}catch(p){l=!0,u=p}finally{try{s||null==d.return||d.return()}finally{if(l)throw u}}return a}),[null===(w=Ne.data)||void 0===w?void 0:w.groups]),ze=(0,a.useState)([]),Ue=ze[0],Le=ze[1];(0,a.useEffect)((function(){var e,t;Le(null===(e=Ne.data)||void 0===e||null===(t=e.groups)||void 0===t?void 0:t.reduce((function(e,t){return se(e).concat(se(t.contents.map((function(e){return e.id}))))}),[]))}),[null===(_=Ne.data)||void 0===_?void 0:_.groups]);var Ge=(0,a.useState)([]),He=Ge[0],Qe=Ge[1],We=(0,a.useState)({}),Je=We[0],Ke=We[1];function Ve(){return Ve=te(o().mark((function e(t,n){var r,i,a,s,l,u,c,d,f,p,b,v,m,x,g,y;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.group_id?[t.group_id]:[],(0,W.WL)({actions:["edit"],createdBy:t.created_by_id,contentGroups:r,resource:"blogs"})){e.next=4;break}return Ce(!0),e.abrupt("return");case 4:return e.prev=4,l=E(t),u=!He[0],c=!u&&Q(qe(He[0])),d=[],u?(f=Array.isArray(t.group_ids)&&t.group_ids.length?t.group_ids:l.group_id?[l.group_id]:[],p=f.length>1&&"undefined"!==typeof crypto&&crypto.randomUUID?crypto.randomUUID():null,d=f.map((function(e){return ie({},l,{group_id:e,batch_id:p,type:"blog"})}))):(b=E(qe(He[0])),d=[ie({},b,l,{type:"blog",id:He[0]})]),e.next=13,le({variables:{data:d.map((function(e){var t;return ie({},e,{parish_id:null===(t=Z.user)||void 0===t?void 0:t.parish_id})}))}});case 13:return v=e.sent,m=v.data,x=(null===m||void 0===m||null===(i=m.insert_contents)||void 0===i||null===(a=i.returning)||void 0===a?void 0:a.map((function(e){return e.id})))||[],e.next=18,Ne.refetch();case 18:if(q((function(e){return e+1})),x.length>0&&Qe([x[0]]),!(x.length>0)){e.next=23;break}return e.next=23,ce({variables:{data:x.map((function(e){var t;return{created_by_id:l.created_by_id,parent_id:e,text:l.text,title:l.title,version:"1",parish_id:null===(t=Z.user)||void 0===t?void 0:t.parish_id}}))}});case 23:return y=u?null:null!==(g=null===(s=qe(He[0]))||void 0===s?void 0:s.scheduled_push_event_id)&&void 0!==g?g:null,e.next=27,Promise.all(x.map(function(){var e=te(o().mark((function e(t,r){var i,a,s,u,f,p,b,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=function(){var e=te(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fe({variables:{id:t,eventId:null}});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),null===l||void 0===l?void 0:l.published){e.next=9;break}if(!y){e.next=8;break}return e.next=6,G(y);case 6:return e.next=8,u();case 8:case 15:return e.abrupt("return");case 9:if(n.checkedPushToGroups){e.next=16;break}if(!y){e.next=15;break}return e.next=13,G(y);case 13:return e.next=15,u();case 16:if(p=null!==(f=null===(i=d[r])||void 0===i?void 0:i.group_id)&&void 0!==f?f:null===(a=Z.user)||void 0===a||null===(s=a.group)||void 0===s?void 0:s.id,b=l.published_at?h()(l.published_at):h()(),!(b.diff(h().now())<=0)){e.next=30;break}return e.next=23,(0,R.E)(c?(0,k.zr)("blog"):(0,k.zf)("blog"),l.title,p,"internal",t);case 23:if(!y){e.next=28;break}return e.next=26,G(y);case 26:return e.next=28,u();case 28:e.next=38;break;case 30:return e.next=32,U({scheduleAt:b.toDate(),payload:{content_id:t,group_id:p,title:l.title,is_update:c}});case 32:return v=e.sent,e.next=35,fe({variables:{id:t,eventId:v}});case 35:if(!y||y===v){e.next=38;break}return e.next=38,G(y);case 38:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()));case 27:I("Erfolgreich","Blog-Post erfolgreich gespeichert","success"),De(!0),e.next=35;break;case 31:e.prev=31,e.t0=e.catch(4),I("Fehler","Beim speichern des Blog-Post ist etwas schief gegangen: ".concat(re(e.t0,Error)?e.t0.message:"Unbekannter Fehler"),"error"),De(!0);case 35:case"end":return e.stop()}}),e,null,[[4,31]])}))),Ve.apply(this,arguments)}function Xe(){return(Xe=te(o().mark((function e(t){var n,r,i,a,s,l,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.group_id?[t.group_id]:[],(0,W.WL)({actions:["delete"],createdBy:t.created_by_id,contentGroups:n,resource:"blogs"})){e.next=4;break}return Ce(!0),e.abrupt("return");case 4:return e.prev=4,a=He.map((function(e){var t;return null===(t=qe(e))||void 0===t?void 0:t.scheduled_push_event_id})).filter((function(e){return"string"===typeof e&&!!e})),e.next=9,Promise.all(a.map((function(e){return G(e)})));case 9:return e.next=11,X({variables:{ids:He}});case 11:if(s=e.sent,l=s.data,!(u=(null===l||void 0===l||null===(r=l.delete_contents)||void 0===r||null===(i=r.returning)||void 0===i?void 0:i.map((function(e){return e.id})))||[]).length){e.next=17;break}return e.next=17,ee({variables:{ids:[],parent_ids:u}});case 17:Ne.refetch(),I("Erfolgreich","Blog-Post erfolgreich gel\xf6scht","success"),De(!0),e.next=26;break;case 22:e.prev=22,e.t0=e.catch(4),I("Fehler","Beim l\xf6schen des Blog-Post ist etwas schief gegangen: ".concat(re(e.t0,Error)?e.t0.message:"Unbekannter Fehler"),"error"),De(!0);case 26:case"end":return e.stop()}}),e,null,[[4,22]])})))).apply(this,arguments)}function et(){return(et=te(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ee({variables:{ids:[t],parent_ids:[]}});case 2:Ne.refetch();case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tt(){return(tt=te(o().mark((function e(t){var n,r,i,a,s,l,u,c,d,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(He[0]){e.next=3;break}return e.abrupt("return");case 3:return i=E(qe(He[0])),e.next=6,H({variables:{id:t}});case 6:if(a=e.sent,s=a.data.content_revisions,l=ae(s,1),u=l[0]){e.next=11;break}return e.abrupt("return");case 11:return e.next=13,le({variables:{data:[ie({},i,{text:u.text,title:u.title})]}});case 13:return c=e.sent,d=c.data,f=null===d||void 0===d||null===(n=d.insert_contents)||void 0===n||null===(r=n.returning)||void 0===r?void 0:r.map((function(e){return e.id})),e.next=18,Ne.refetch();case 18:Qe(f);case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return(0,a.useEffect)((function(){var e=qe(He[0])||{type:"blog"};He.length>1&&Ke({type:"blog"}),1===He.length&&He[0]&&Ke(e)}),[qe,null===(N=Ne.data)||void 0===N?void 0:N.groups,He]),(0,r.jsxs)("div",{className:"flex flex-col justify-between h-full text-sm text-slate-600",children:[(0,r.jsxs)("div",{className:"flex flex-none justify-between items-center p-2 mb-2 h-14 roun
1ded-lg bg-slate-50",children:[He.length>1&&(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("span",{className:"text-slate-400",children:[T("blogs.header.selected_count"),":"]}),(0,r.jsx)("span",{className:"font-semibold",children:He.length})]}),(0,r.jsxs)("div",{children:[Oe?(0,r.jsx)("a",{className:"my-anchor-element inline-flex justify-center items-center py-2 px-4 text-sm font-medium rounded-md border border-transparent shadow-sm sm:w-auto focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 focus:outline-none bg-gray-200 text-gray-400 cursor-not-allowed",children:T("blogs.input.create.label")}):(0,r.jsx)("button",{className:"order-1 py-1 px-2 font-semibold text-white rounded h-[36px] min-w-[150px] bg-boni-blue",type:"button",onClick:function(){return M()},children:T("blogs.input.create.label")}),(0,r.jsx)(K.u,{anchorSelect:".my-anchor-element",place:"bottom",children:T("blogs.input.create.no_group_tooltip")})]})]}),Ne.error&&(0,r.jsxs)("div",{role:"alert",className:"flex gap-2 items-start p-3 mb-2 text-sm rounded-md border border-boni-red/30 bg-boni-red/5 text-boni-red",children:[(0,r.jsx)(v.e,{icon:"ExclamationTriangleIcon",className:"w-5 h-5 flex-none mt-[2px] text-boni-red"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("div",{className:"font-semibold",children:T("blogs.errors.fetch.title")}),(0,r.jsx)("div",{className:"text-xs opacity-80 break-all",children:Ne.error.message})]})]}),(0,r.jsxs)("div",{className:"flex flex-row justify-between items-stretch gap-4 h-[calc(100%_-_128px)]",children:[(0,r.jsx)("div",{className:"overflow-auto basis-96",children:(0,r.jsx)("ul",{className:"flex flex-col gap-4",children:null===(S=Ne.data)||void 0===S?void 0:S.groups.map((function(e){return(0,r.jsxs)("li",{className:"p-2 rounded-lg bg-slate-50",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center py-1 px-2 font-semibold rounded cursor-pointer bg-boni-blue/10 text-boni-blue",onClick:function(){return L(ie({},z,ne({},e.id,!z[e.id])))},children:[(0,r.jsx)(v.e,{className:"w-6 h-6 text-boni-blue",icon:"UsersIcon"}),e.name,(0,r.jsx)(v.e,{className:"w-6 h-6 text-boni-blue",icon:z[e.id]?"ChevronDownIcon":"ChevronUpIcon"})]}),(0,r.jsx)(b.Z,{collapsed:!!z[e.id],children:(0,r.jsxs)("ul",{className:"flex flex-col gap-2 mt-2",children:[(0,r.jsx)("li",{className:"flex justify-center",children:(0,r.jsx)("button",{className:"order-1 py-1 px-2 w-full text-xs font-semibold rounded h-[24px] bg-slate-200 text-slate-600",type:"button",onClick:function(){return M({group_id:e.id})},children:T("blogs.input.create.label")})}),e.contents.map((function(e){return(0,r.jsx)("li",{children:(0,r.jsx)(x,{data:e,onCheckboxChange:function(e){D(e,{range:!1,addOne:!0})},onClick:function(e,t){t.preventDefault(),D(e.id,{range:t.shiftKey,addOne:t.ctrlKey||t.metaKey})},selected:He.includes(e.id),withCheckbox:!0})},e.id)}))]})})]},e.id)}))})},A),!!He.length&&(0,r.jsx)("div",{className:"flex-1 max-w-[60%]",children:(0,r.jsx)(F,{data:Je,isBulk:He.length>1,siblingGroupNames:Ye(Je),onChange:function(e,t){return Ve.apply(this,arguments)},onDelete:function(e){return Xe.apply(this,arguments)},onDeleteRevision:function(e){return et.apply(this,arguments)},onRestoreRevision:function(e){return tt.apply(this,arguments)}},"".concat(Je.id).concat(Je.group_id))}),!He.length&&(0,r.jsxs)("div",{className:"flex flex-col flex-1 gap-4 justify-center items-center",children:[(0,r.jsx)(v.e,{icon:"DocumentTextIcon",className:"w-16 h-16 text-boni-blue/10"}),(0,r.jsx)("span",{className:"w-64 text-center text-slate-400",children:T("blogs.editor.please_select_blog")})]})]}),(0,r.jsx)("div",{className:"flex-none p-2 mt-2 h-14 rounded-lg bg-slate-50",children:(0,r.jsx)(m.t,{itemsCount:(null===(C=Ne.data)||void 0===C||null===(O=C.groups_aggregate)||void 0===O||null===(P=O.aggregate)||void 0===P?void 0:P.count)||0,itemsPerPage:he,pageIndex:me,onClickPage:function(e){Qe([]),xe(e)},onItemsPerPageChange:be})}),(0,r.jsx)(J.Z,{title:"Zugriff nicht gestattet",body:"Ihre Benutzer Rolle l\xe4sst dies nicht zu.",onClose:function(){return Ce(!1)},open:Se}),(0,r.jsx)(V.Z,{show:Ie,title:Me,text:$e,state:Be,onClose:function(){return De(!1)}})]})},de=!0;function fe(){return(0,r.jsx)("div",{className:"h-[calc(100vh_-_96px)]",children:(0,r.jsx)(ce,{})})}},73359:function(e,t,n){"use strict";n.d(t,{t:function(){return u}});var r=n(97582),i=n(67294),o=n(14012),a=n(37887),s=n(66252),l=["refetch","reobserve","fetchMore","updateQuery","startPolling","subscribeToMore"];function u(e,t){var n,u=(0,i.useRef)(),c=(0,i.useRef)(),d=(0,i.useRef)(),f=u.current?(0,o.J)(t,u.current):t,p=null!==(n=null===f||void 0===f?void 0:f.query)&&void 0!==n?n:e;c.current=f,d.current=p;var h=(0,a.A)((0,s.x)(t&&t.client),p),b=h.useQuery((0,r.pi)((0,r.pi)({},f),{skip:!u.current})),v=b.observable.options.initialFetchPolicy||h.getDefaultFetchPolicy(),m=Object.assign(b,{called:!!u.current}),x=(0,i.useMemo)((function(){for(var e={},t=function(t){var n=m[t];e[t]=function(){return u.current||(u.current=Object.create(null),h.forceUpdate()),n.apply(this,arguments)}},n=0,r=l;n<r.length;n++){t(r[n])}return e}),[]);Object.assign(m,x);var g=(0,i.useCallback)((function(e){u.current=e?(0,r.pi)((0,r.pi)({},e),{fetchPolicy:e.fetchPolicy||v}):{fetchPolicy:v};var t=(0,o.J)(c.current,(0,r.pi)({query:d.current},u.current)),n=h.executeQuery((0,r.pi)((0,r.pi)({},t),{skip:!1})).then((function(e){return Object.assign(e,x)}));return n.catch((function(){})),n}),[]);return[g,m]}},50319:function(e,t,n){"use strict";n.d(t,{D:function(){return c}});var r=n(97582),i=n(67294),o=n(14012),a=n(30020),s=n(14692),l=n(30990),u=n(66252);function c(e,t){var n=(0,u.x)(null===t||void 0===t?void 0:t.client);(0,s.Vp)(e,s.n_.Mutation);var c=(0,i.useState)({called:!1,loading:!1,client:n}),d=c[0],f=c[1],p=(0,i.useRef)({result:d,mutationId:0,isMounted:!0,client:n,mutation:e,options:t});Object.assign(p.current,{client:n,options:t,mutation:e});var h=(0,i.useCallback)((function(e){void 0===e&&(e={});var t=p.current,n=t.options,i=t.mutation,s=(0,r.pi)((0,r.pi)({},n),{mutation:i}),u=e.client||p.current.client;p.current.result.loading||s.ignoreResults||!p.current.isMounted||f(p.current.result={loading:!0,error:void 0,data:void 0,called:!0,client:u});var c=++p.current.mutationId,d=(0,o.J)(s,e);return u.mutate(d).then((function(t){var n,r=t.data,i=t.errors,o=i&&i.length>0?new l.cA({graphQLErrors:i}):void 0;if(c===p.current.mutationId&&!d.ignoreResults){var s={called:!0,loading:!1,data:r,error:o,client:u};p.current.isMounted&&!(0,a.D)(p.current.result,s)&&f(p.current.result=s)}var h=e.onCompleted||(null===(n=p.current.options)||void 0===n?void 0:n.onCompleted);return null===h||void 0===h||h(t.data,d),t})).catch((function(t){var n;if(c===p.current.mutationId&&p.current.isMounted){var r={loading:!1,error:t,data:void 0,called:!0,client:u};(0,a.D)(p.current.result,r)||f(p.current.result=r)}var i=e.onError||(null===(n=p.current.options)||void 0===n?void 0:n.onError);if(i)return i(t,d),{data:void 0,errors:t};throw t}))}),[]),b=(0,i.useCallback)((function(){p.current.isMounted&&f({called:!1,loading:!1,client:n})}),[]);return(0,i.useEffect)((function(){return p.current.isMounted=!0,function(){p.current.isMounted=!1}}),[]),[h,(0,r.pi)({reset:b},d)]}}},function(e){e.O(0,[4885,3054,7887,2183,5935,2018,7536,1883,7153,1926,6239,5295,9774,2888,179],(function(){return t=15746,e(e.s=t);var t}));var t=e.O();_N_E=t}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.