1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1692],{38900:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/galleries/edit/[id]",function(){return n(23730)}])},2407:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(85893),a=n(28309);function i(e){var t=e.className,n=e.error,i=e.icon,l=e.id,o=e.invalid,s=e.label,c=e.name,u=e.onChange,d=e.placeholder,f=e.type,m=e.value,p=e.disabled;return(0,r.jsxs)("div",{className:t,children:[s&&(0,r.jsx)("label",{htmlFor:"price",className:"block text-sm mb-1 font-medium text-gray-700",children:s}),(0,r.jsxs)("div",{className:"relative rounded-md shadow-sm",children:[i&&(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)(a.e,{icon:i,className:"w-6 h-6 text-gray-300",outline:!0})})}),(0,r.jsx)("input",{name:c,id:l,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(i&&"pl-10","\n ").concat(!!o&&"border-red-400","\n "),placeholder:d,onChange:u,type:f||"text",value:m||"",disabled:p||!1})]}),!!n&&(0,r.jsx)("p",{className:"text-xs text-red-600 ml-1",children:n})]})}},30103:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(85893),a=n(73933),i=n(20921);function l(e){var t=e.checked,n=e.loading,l=void 0!==n&&n,o=e.onChange,s=e.disabled,c=e.label;return(0,r.jsxs)(a.r,{checked:t,onChange:o,disabled:s,className:"".concat(t?"bg-boni-blue":"bg-gray-400","\n relative inline-flex h-[28px] w-[56px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 items-center\n ").concat(s?"opacity-50 cursor-not-allowed":""),children:[(0,r.jsx)("span",{className:"sr-only",children:c}),l?(0,r.jsx)(i.Z,{className:"h-[24px] w-[24px] absolute text-white"}):(0,r.jsx)("span",{"aria-hidden":"true",className:"".concat(t?"translate-x-7":"translate-x-0","\n pointer-events-none inline-block h-[24px] w-[24px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out")})]})}},23730:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return O},default:function(){return E}});var r=n(34051),a=n.n(r),i=n(85893),l=n(97568),o=n(67294),s=n(11163),c=n(52434),u=n(13560),d=n(92422),f=n(28309),m=n(2407),p=n(30103),h=n(20921),g=n(11927),v=n(33299),b=n(17283),x=n(37887),y=n(93054);function w(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 j(e,t,n,r,a,i,l){try{var o=e[i](l),s=o.value}catch(c){return void n(c)}o.done?t(s):Promise.resolve(s).then(r,a)}function k(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function l(e){j(i,r,a,l,o,"next",e)}function o(e){j(i,r,a,l,o,"throw",e)}l(void 0)}))}}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(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){N(e,t,n[t])}))}return e}function C(e){return function(e){if(Array.isArray(e))return w(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 w(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 w(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.")}()}function T(){var e,t,n=(e=['\nquery getContents {\n contents(where: {type: {_eq: "default"}}) {\n id\n title\n }\n}\n'],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return T=function(){return n},n}var P=(0,b.Ps)(T()),A=(0,u.Z)(c.L1,1e3),_=(0,u.Z)(c.Fn,1e3),O=!0;function E(e){var t=(0,l.$G)(["galleries"],{keyPrefix:"galleries"}).t,n=(0,s.useRouter)(),r=(0,v.useSession)().data,u=(0,o.useState)(e.gallery),b=u[0],w=u[1],j=(0,o.useState)(!1),N=j[0],T=j[1],O=(0,o.useState)(!1),E=O[0],I=O[1],Z=(0,o.useState)(),z=Z[0],D=(Z[1],(0,x.a)(P));(0,o.useEffect)((function(){k(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return T(!0),e.next=3,D.refetch();case 3:return e.t0=w,e.next=6,(0,c.fQ)(n.query.id);case 6:e.t1=e.sent,(0,e.t0)(e.t1),T(!1);case 9:case"end":return e.stop()}}),e)})))()}),[n.query.id]);var L,M,q=function(e){w(S({},b,e)),A(S({},b,{published:!!b.published,title:b.title,images:b.images},e))},U=function(){var e=k(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I(!0),e.next=3,(0,c.Ve)({image:"",uri:"",gallery_id:n.query.id});case 3:t=e.sent.id,w(S({},b,{images:C(b.images).concat([{id:t,title:"",gallery_id:n.query.id}])})),I(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),F=function(){var e=k(a().mark((function e(t){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.id,e.next=3,(0,c.Qz)({id:r});case 3:n.push("/galleries");case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),R=function(){var e=k(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I(!0),-1!==(n=b.images.findIndex((function(e){var n=e.id;return t.id===n})))){e.next=4;break}return e.abrupt("return");case 4:return(r=S({},b,{images:C(b.images)})).images.splice(n,1),w(r),e.next=9,(0,c.vX)(t);case 9:I(!1);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),G=function(){var e=k(a().mark((function e(t,n,r){var i,l,o,s,c,u,d,f,m,p;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=Array.from(t.files),l=0;case 2:if(!(l<i.length)){e.next=23;break}return o=i[l],a=o.name,s=a.replace(/[^.\w\d_-]/g,"_"),e.next=7,fetch("/api/s3-upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:s,contentType:o.type})});case 7:if((c=e.sent).ok){e.next=10;break}throw new Error("Upload fehlgeschlagen");case 10:return e.next=12,c.json();case 12:return u=e.sent,d=u.url,f=u.key,m=u.bucket,e.next=18,fetch(d,{method:"PUT",body:o,headers:{"Content-Type":o.type}});case 18:p="https://".concat(m,".s3.").concat("eu-central-1",".amazonaws.com/").concat(f),$({id:n,image:p,uri:r});case 20:l++,e.next=2;break;case 23:case"end":return e.stop()}var a}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),$=function(e){var t=b.images.findIndex((function(t){var n=t.id;return e.id===n}));if(-1!==t){var n=S({},b,{images:C(b.images)});n.images[t]=S({},n.images[t],e),w(n),_(S({},e,{gallery_id:b.id}))}};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"flex justify-start items-end gap-4 mb-4 px-4",children:[(0,i.jsx)("h1",{className:"text-xl font-semibold text-slate-900",children:t("edit_page_title")}),N&&(0,i.jsx)(h.Z,{className:"text-boni-blue w-6 h-6"})]}),(0,i.jsxs)("div",{className:"flex justify-between items-start gap-4 mr-4",children:[(0,i.jsxs)("div",{className:"flex flex-col gap-4 bg-gray-100 p-4 rounded w-full",children:[(0,i.jsx)(m.Z,{label:"Titel",icon:"QuestionMarkCircleIcon",placeholder:"Lorem ipsum dolor, sit amet consectetur adipisicing elit?",value:b.title,onChange:function(e){q({title:e.target.value})}}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{className:"text-sm font-semibold",children:"Auswahlm\xf6glichkeiten"}),b.images&&b.images.map((function(e){var t;return(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("div",{className:"flex-1 w-32",children:(0,i.jsx)("img",{src:e.image,width:50,height:50})}),(0,i.jsx)("div",{className:"flex-1",children:(0,i.jsx)("input",{type:"file",name:"test",value:z,id:"image-upload",className:"block w-full rounded-md border-gray-300 pr-12 focus:border-blue-500 focus:ring-blue-500 sm:text-sm placeholder-gray-400",onChange:function(t){G(t.target,e.id,e.uri||"")}})}),(0,i.jsx)("div",{className:"flex-1",children:(0,i.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,i.jsx)(f.e,{icon:"ArrowDownCircleIcon",className:"w-6 h-6"}),(0,i.jsx)(y.ZP,{className:"w-full",defaultValue:{value:null,label:"Alle Inhalte"},options:[{value:null,label:"Alle Inhalte"}].concat(C(D.data.contents.map((function(e){return{value:e.id,label:e.title}}
1)))),placeholder:"W\xe4hle einen Inhalt aus",value:{value:null!==(L=e.title)&&void 0!==L?L:"",label:null!==(M=null===(t=D.data.contents.find((function(t){return t.id==e.uri})))||void 0===t?void 0:t.title)&&void 0!==M?M:""},onChange:function(t){return function(e,t,n){console.log(e),e.value&&$({id:t,image:n,uri:e.value})}(t,e.id,e.image)}})]})}),(0,i.jsx)("div",{children:(0,g.C)(r,"gallery_delete")&&(0,i.jsx)(d.Z,{color:"secondary",onClick:function(){R({id:e.id})},children:(0,i.jsx)(f.e,{icon:"TrashIcon",className:"text-boni-red h-4 w-4"})})})]},e.id)})),(0,i.jsx)("div",{className:"mt-4 flex justify-center",children:(0,g.C)(r,"gallery_update")&&(0,i.jsx)(d.Z,{color:"primary",disabled:E,onClick:function(){U()},children:E?(0,i.jsx)(h.Z,{className:"h-6 w-6"}):(0,i.jsx)(f.e,{icon:"PlusCircleIcon",className:"text-white h-6 w-6"})})})]})]}),(0,i.jsxs)("div",{className:"flex flex-col gap-4 bg-gray-100 p-4 rounded w-full max-w-xs text-sm text-slate-600 font-semibold",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("div",{className:"w-auto",style:{transform:"scale(0.5) translate3d(-50%, 3px, 0)"},children:(0,i.jsx)(p.Z,{checked:!b.published,label:"Sichtbarkeit",onChange:function(){q({published:!b.published})}})}),(0,i.jsx)("span",{style:{transform:"translate3d(-25%, 0, 0)"},children:"Sichtbarkeit"})]}),(0,i.jsx)("div",{children:(0,g.C)(r,"gallery_delete")&&(0,i.jsxs)(d.Z,{className:"flex items-center gap-2",color:"primary",onClick:function(){F({id:b.id})},children:[(0,i.jsx)(f.e,{icon:"TrashIcon",className:"w-4 h-4 text-white"}),"Galerie l\xf6schen"]})})]})]})]})}},13560:function(e,t){"use strict";function n(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 r(e){return function(e){if(Array.isArray(e))return n(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 n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(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.")}()}t.Z=function(e,t){var n;return function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];clearTimeout(n),n=setTimeout((function(){e.apply(void 0,r(i))}),null!==t&&void 0!==t?t:200)}}},73933:function(e,t,n){"use strict";n.d(t,{r:function(){return C}});var r=n(67294),a=n(12351),i=n(19946),l=n(61363),o=n(64103),s=n(16723),c=n(23784),u=n(73781);let d=(0,r.createContext)(null);function f(){let e=(0,r.useContext)(d);if(null===e){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,f),e}return e}function m(){let[e,t]=(0,r.useState)([]);return[e.length>0?e.join(" "):void 0,(0,r.useMemo)((()=>function(e){let n=(0,u.z)((e=>(t((t=>[...t,e])),()=>t((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),a=(0,r.useMemo)((()=>({register:n,slot:e.slot,name:e.name,props:e.props})),[n,e.slot,e.name,e.props]);return r.createElement(d.Provider,{value:a},e.children)}),[t])]}let p=(0,a.yV)((function(e,t){let n=(0,i.M)(),{id:r=`headlessui-label-${n}`,passive:l=!1,...o}=e,u=f(),d=(0,c.T)(t);(0,s.e)((()=>u.register(r)),[r,u.register]);let m={ref:d,...u.props,id:r};return l&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in o&&delete o.onClick),(0,a.sY)({ourProps:m,theirProps:o,slot:u.slot||{},defaultTag:"label",name:u.name||"Label"})})),h=Object.assign(p,{});var g=n(39516),v=n(14157),b=n(46045),x=n(18689),y=n(31147),w=n(94192);let j=(0,r.createContext)(null);j.displayName="GroupContext";let k=r.Fragment;let N=(0,a.yV)((function(e,t){let n=(0,i.M)(),{id:s=`headlessui-switch-${n}`,checked:d,defaultChecked:f=!1,onChange:m,name:p,value:h,form:g,...k}=e,N=(0,r.useContext)(j),S=(0,r.useRef)(null),C=(0,c.T)(S,t,null===N?null:N.setSwitch),[T,P]=(0,y.q)(d,m,f),A=(0,u.z)((()=>null==P?void 0:P(!T))),_=(0,u.z)((e=>{if((0,o.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),A()})),O=(0,u.z)((e=>{e.key===l.R.Space?(e.preventDefault(),A()):e.key===l.R.Enter&&(0,x.g)(e.currentTarget)})),E=(0,u.z)((e=>e.preventDefault())),I=(0,r.useMemo)((()=>({checked:T})),[T]),Z={id:s,ref:C,role:"switch",type:(0,v.f)(e,S),tabIndex:0,"aria-checked":T,"aria-labelledby":null==N?void 0:N.labelledby,"aria-describedby":null==N?void 0:N.describedby,onClick:_,onKeyUp:O,onKeyPress:E},z=(0,w.G)();return(0,r.useEffect)((()=>{var e;let t=null==(e=S.current)?void 0:e.closest("form");t&&void 0!==f&&z.addEventListener(t,"reset",(()=>{P(f)}))}),[S,P]),r.createElement(r.Fragment,null,null!=p&&T&&r.createElement(b._,{features:b.A.Hidden,...(0,a.oA)({as:"input",type:"checkbox",hidden:!0,readOnly:!0,form:g,checked:T,name:p,value:h})}),(0,a.sY)({ourProps:Z,theirProps:k,slot:I,defaultTag:"button",name:"Switch"}))})),S=function(e){var t;let[n,i]=(0,r.useState)(null),[l,o]=m(),[s,c]=(0,g.f)(),u=(0,r.useMemo)((()=>({switch:n,setSwitch:i,labelledby:l,describedby:s})),[n,i,l,s]),d=e;return r.createElement(c,{name:"Switch.Description"},r.createElement(o,{name:"Switch.Label",props:{htmlFor:null==(t=u.switch)?void 0:t.id,onClick(e){n&&("LABEL"===e.currentTarget.tagName&&e.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},r.createElement(j.Provider,{value:u},(0,a.sY)({ourProps:{},theirProps:d,defaultTag:k,name:"Switch.Group"}))))},C=Object.assign(N,{Group:S,Label:h,Description:g.d})},31147:function(e,t,n){"use strict";n.d(t,{q:function(){return i}});var r=n(67294),a=n(73781);function i(e,t,n){let[i,l]=(0,r.useState)(n),o=void 0!==e,s=(0,r.useRef)(o),c=(0,r.useRef)(!1),u=(0,r.useRef)(!1);return!o||s.current||c.current?!o&&s.current&&!u.current&&(u.current=!0,s.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(c.current=!0,s.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[o?e:i,(0,a.z)((e=>(o||l(e),null==t?void 0:t(e))))]}},18689:function(e,t,n){"use strict";function r(e={},t=null,n=[]){for(let[r,l]of Object.entries(e))i(n,a(t,r),l);return n}function a(e,t){return e?e+"["+t+"]":t}function i(e,t,n){if(Array.isArray(n))for(let[r,l]of n.entries())i(e,a(t,r.toString()),l);else n instanceof Date?e.push([t,n.toISOString()]):"boolean"==typeof n?e.push([t,n?"1":"0"]):"string"==typeof n?e.push([t,n]):"number"==typeof n?e.push([t,`${n}`]):null==n?e.push([t,""]):r(n,t,e)}function l(e){var t;let n=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(n)for(let r of n.elements)if("INPUT"===r.tagName&&"submit"===r.type||"BUTTON"===r.tagName&&"submit"===r.type||"INPUT"===r.nodeName&&"image"===r.type)return void r.click()}n.d(t,{g:function(){return l},t:function(){return r}})}},function(e){e.O(0,[3054,7887,2696,9774,2888,179],(function(){return t=38900,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.