From ac71b3882315fbd28267c9abcf9b542d39f13a9c Mon Sep 17 00:00:00 2001 From: Richard Date: Fri, 31 Jul 2026 11:23:49 +0200 Subject: [PATCH] fix: Implement Network-First SW strategy, no-cache headers in Nginx for index.html/sw.js, and auto 401 token cleanup to fix post-redeploy stale cache issues --- .../{index-DKRQSjit.js => index-DXooeo1R.js} | 18 +++---- frontend/dist/index.html | 6 ++- frontend/dist/sw.js | 49 +++++++++---------- frontend/index.html | 4 +- frontend/nginx.conf | 18 +++++++ frontend/public/sw.js | 49 +++++++++---------- frontend/src/api/client.js | 3 ++ 7 files changed, 83 insertions(+), 64 deletions(-) rename frontend/dist/assets/{index-DKRQSjit.js => index-DXooeo1R.js} (90%) diff --git a/frontend/dist/assets/index-DKRQSjit.js b/frontend/dist/assets/index-DXooeo1R.js similarity index 90% rename from frontend/dist/assets/index-DKRQSjit.js rename to frontend/dist/assets/index-DXooeo1R.js index 3cf79f8..6cd3e83 100644 --- a/frontend/dist/assets/index-DKRQSjit.js +++ b/frontend/dist/assets/index-DXooeo1R.js @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var jr=Symbol.for("react.element"),Ud=Symbol.for("react.portal"),Hd=Symbol.for("react.fragment"),Qd=Symbol.for("react.strict_mode"),Wd=Symbol.for("react.profiler"),Kd=Symbol.for("react.provider"),Gd=Symbol.for("react.context"),qd=Symbol.for("react.forward_ref"),Yd=Symbol.for("react.suspense"),Zd=Symbol.for("react.memo"),Jd=Symbol.for("react.lazy"),Ho=Symbol.iterator;function Xd(e){return e===null||typeof e!="object"?null:(e=Ho&&e[Ho]||e["@@iterator"],typeof e=="function"?e:null)}var au={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},uu=Object.assign,cu={};function Mn(e,t,n){this.props=e,this.context=t,this.refs=cu,this.updater=n||au}Mn.prototype.isReactComponent={};Mn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Mn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function du(){}du.prototype=Mn.prototype;function Ei(e,t,n){this.props=e,this.context=t,this.refs=cu,this.updater=n||au}var Ci=Ei.prototype=new du;Ci.constructor=Ei;uu(Ci,Mn.prototype);Ci.isPureReactComponent=!0;var Qo=Array.isArray,fu=Object.prototype.hasOwnProperty,Ti={current:null},mu={key:!0,ref:!0,__self:!0,__source:!0};function pu(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)fu.call(t,r)&&!mu.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ml=Object.prototype.hasOwnProperty,pf=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Ko={},Go={};function hf(e){return Ml.call(Go,e)?!0:Ml.call(Ko,e)?!1:pf.test(e)?Go[e]=!0:(Ko[e]=!0,!1)}function xf(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function gf(e,t,n,r){if(t===null||typeof t>"u"||xf(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ee(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var xe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){xe[e]=new Ee(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];xe[t]=new Ee(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){xe[e]=new Ee(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){xe[e]=new Ee(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){xe[e]=new Ee(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){xe[e]=new Ee(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){xe[e]=new Ee(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){xe[e]=new Ee(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){xe[e]=new Ee(e,5,!1,e.toLowerCase(),null,!1,!1)});var Li=/[\-:]([a-z])/g;function zi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Li,zi);xe[t]=new Ee(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Li,zi);xe[t]=new Ee(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Li,zi);xe[t]=new Ee(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){xe[e]=new Ee(e,1,!1,e.toLowerCase(),null,!1,!1)});xe.xlinkHref=new Ee("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){xe[e]=new Ee(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mi(e,t,n,r){var s=xe.hasOwnProperty(t)?xe[t]:null;(s!==null?s.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ml=Object.prototype.hasOwnProperty,pf=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Ko={},Go={};function hf(e){return Ml.call(Go,e)?!0:Ml.call(Ko,e)?!1:pf.test(e)?Go[e]=!0:(Ko[e]=!0,!1)}function xf(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function gf(e,t,n,r){if(t===null||typeof t>"u"||xf(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ee(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var xe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){xe[e]=new Ee(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];xe[t]=new Ee(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){xe[e]=new Ee(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){xe[e]=new Ee(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){xe[e]=new Ee(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){xe[e]=new Ee(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){xe[e]=new Ee(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){xe[e]=new Ee(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){xe[e]=new Ee(e,5,!1,e.toLowerCase(),null,!1,!1)});var Li=/[\-:]([a-z])/g;function zi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Li,zi);xe[t]=new Ee(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Li,zi);xe[t]=new Ee(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Li,zi);xe[t]=new Ee(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){xe[e]=new Ee(e,1,!1,e.toLowerCase(),null,!1,!1)});xe.xlinkHref=new Ee("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){xe[e]=new Ee(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mi(e,t,n,r){var s=xe.hasOwnProperty(t)?xe[t]:null;(s!==null?s.type!==0:r||!(2a||s[o]!==i[a]){var u=` -`+s[o].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=o&&0<=a);break}}}finally{al=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Qn(e):""}function yf(e){switch(e.tag){case 5:return Qn(e.type);case 16:return Qn("Lazy");case 13:return Qn("Suspense");case 19:return Qn("SuspenseList");case 0:case 2:case 15:return e=ul(e.type,!1),e;case 11:return e=ul(e.type.render,!1),e;case 1:return e=ul(e.type,!0),e;default:return""}}function Ol(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case an:return"Fragment";case on:return"Portal";case Al:return"Profiler";case Ai:return"StrictMode";case Dl:return"Suspense";case Rl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Nu:return(e.displayName||"Context")+".Consumer";case ku:return(e._context.displayName||"Context")+".Provider";case Di:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ri:return t=e.displayName||null,t!==null?t:Ol(e.type)||"Memo";case St:t=e._payload,e=e._init;try{return Ol(e(t))}catch{}}return null}function vf(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ol(t);case 8:return t===Ai?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ot(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ju(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function wf(e){var t=ju(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Or(e){e._valueTracker||(e._valueTracker=wf(e))}function bu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ju(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ds(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Il(e,t){var n=t.checked;return le({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Yo(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ot(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function _u(e,t){t=t.checked,t!=null&&Mi(e,"checked",t,!1)}function $l(e,t){_u(e,t);var n=Ot(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Vl(e,t.type,n):t.hasOwnProperty("defaultValue")&&Vl(e,t.type,Ot(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Zo(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Vl(e,t,n){(t!=="number"||ds(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Wn=Array.isArray;function vn(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Ir.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ir(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},kf=["Webkit","ms","Moz","O"];Object.keys(qn).forEach(function(e){kf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),qn[t]=qn[e]})});function Pu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||qn.hasOwnProperty(e)&&qn[e]?(""+t).trim():t+"px"}function Lu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Pu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var Nf=le({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ul(e,t){if(t){if(Nf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(_(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(_(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(_(61))}if(t.style!=null&&typeof t.style!="object")throw Error(_(62))}}function Hl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ql=null;function Oi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wl=null,wn=null,kn=null;function ea(e){if(e=Er(e)){if(typeof Wl!="function")throw Error(_(280));var t=e.stateNode;t&&(t=Vs(t),Wl(e.stateNode,e.type,t))}}function zu(e){wn?kn?kn.push(e):kn=[e]:wn=e}function Mu(){if(wn){var e=wn,t=kn;if(kn=wn=null,ea(e),t)for(e=0;e>>=0,e===0?32:31-(Mf(e)/Af|0)|0}var $r=64,Vr=4194304;function Kn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function hs(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Kn(a):(i&=o,i!==0&&(r=Kn(i)))}else o=n&~s,o!==0?r=Kn(o):i!==0&&(r=Kn(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function br(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Je(t),e[t]=n}function If(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Zn),ua=" ",ca=!1;function Xu(e,t){switch(e){case"keyup":return fm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ec(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var un=!1;function pm(e,t){switch(e){case"compositionend":return ec(t);case"keypress":return t.which!==32?null:(ca=!0,ua);case"textInput":return e=t.data,e===ua&&ca?null:e;default:return null}}function hm(e,t){if(un)return e==="compositionend"||!Qi&&Xu(e,t)?(e=Zu(),ts=Bi=Et=null,un=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=pa(n)}}function sc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?sc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function lc(){for(var e=window,t=ds();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ds(e.document)}return t}function Wi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function jm(e){var t=lc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&sc(n.ownerDocument.documentElement,n)){if(r!==null&&Wi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=ha(n,i);var o=ha(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,cn=null,Jl=null,Xn=null,Xl=!1;function xa(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Xl||cn==null||cn!==ds(r)||(r=cn,"selectionStart"in r&&Wi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Xn&&fr(Xn,r)||(Xn=r,r=ys(Jl,"onSelect"),0mn||(e.current=li[mn],li[mn]=null,mn--)}function J(e,t){mn++,li[mn]=e.current,e.current=t}var It={},Ne=Vt(It),ze=Vt(!1),Jt=It;function _n(e,t){var n=e.type.contextTypes;if(!n)return It;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Me(e){return e=e.childContextTypes,e!=null}function ws(){te(ze),te(Ne)}function Sa(e,t,n){if(Ne.current!==It)throw Error(_(168));J(Ne,t),J(ze,n)}function pc(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(_(108,vf(e)||"Unknown",s));return le({},n,r)}function ks(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||It,Jt=Ne.current,J(Ne,e),J(ze,ze.current),!0}function ja(e,t,n){var r=e.stateNode;if(!r)throw Error(_(169));n?(e=pc(e,t,Jt),r.__reactInternalMemoizedMergedChildContext=e,te(ze),te(Ne),J(Ne,e)):te(ze),J(ze,n)}var ct=null,Fs=!1,Sl=!1;function hc(e){ct===null?ct=[e]:ct.push(e)}function Rm(e){Fs=!0,hc(e)}function Ft(){if(!Sl&&ct!==null){Sl=!0;var e=0,t=q;try{var n=ct;for(q=1;e>=o,s-=o,dt=1<<32-Je(t)+s|n<b?(U=P,P=null):U=P.sibling;var O=x(f,P,d[b],y);if(O===null){P===null&&(P=U);break}e&&P&&O.alternate===null&&t(f,P),c=i(O,c,b),E===null?j=O:E.sibling=O,E=O,P=U}if(b===d.length)return n(f,P),ne&&Qt(f,b),j;if(P===null){for(;bb?(U=P,P=null):U=P.sibling;var X=x(f,P,O.value,y);if(X===null){P===null&&(P=U);break}e&&P&&X.alternate===null&&t(f,P),c=i(X,c,b),E===null?j=X:E.sibling=X,E=X,P=U}if(O.done)return n(f,P),ne&&Qt(f,b),j;if(P===null){for(;!O.done;b++,O=d.next())O=v(f,O.value,y),O!==null&&(c=i(O,c,b),E===null?j=O:E.sibling=O,E=O);return ne&&Qt(f,b),j}for(P=r(f,P);!O.done;b++,O=d.next())O=S(P,f,b,O.value,y),O!==null&&(e&&O.alternate!==null&&P.delete(O.key===null?b:O.key),c=i(O,c,b),E===null?j=O:E.sibling=O,E=O);return e&&P.forEach(function(Y){return t(f,Y)}),ne&&Qt(f,b),j}function L(f,c,d,y){if(typeof d=="object"&&d!==null&&d.type===an&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case Rr:e:{for(var j=d.key,E=c;E!==null;){if(E.key===j){if(j=d.type,j===an){if(E.tag===7){n(f,E.sibling),c=s(E,d.props.children),c.return=f,f=c;break e}}else if(E.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===St&&Ea(j)===E.type){n(f,E.sibling),c=s(E,d.props),c.ref=Bn(f,E,d),c.return=f,f=c;break e}n(f,E);break}else t(f,E);E=E.sibling}d.type===an?(c=Zt(d.props.children,f.mode,y,d.key),c.return=f,f=c):(y=us(d.type,d.key,d.props,null,f.mode,y),y.ref=Bn(f,c,d),y.return=f,f=y)}return o(f);case on:e:{for(E=d.key;c!==null;){if(c.key===E)if(c.tag===4&&c.stateNode.containerInfo===d.containerInfo&&c.stateNode.implementation===d.implementation){n(f,c.sibling),c=s(c,d.children||[]),c.return=f,f=c;break e}else{n(f,c);break}else t(f,c);c=c.sibling}c=Ll(d,f.mode,y),c.return=f,f=c}return o(f);case St:return E=d._init,L(f,c,E(d._payload),y)}if(Wn(d))return N(f,c,d,y);if(On(d))return w(f,c,d,y);Kr(f,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,c!==null&&c.tag===6?(n(f,c.sibling),c=s(c,d),c.return=f,f=c):(n(f,c),c=Pl(d,f.mode,y),c.return=f,f=c),o(f)):n(f,c)}return L}var Cn=vc(!0),wc=vc(!1),js=Vt(null),bs=null,xn=null,Yi=null;function Zi(){Yi=xn=bs=null}function Ji(e){var t=js.current;te(js),e._currentValue=t}function ai(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Sn(e,t){bs=e,Yi=xn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Le=!0),e.firstContext=null)}function We(e){var t=e._currentValue;if(Yi!==e)if(e={context:e,memoizedValue:t,next:null},xn===null){if(bs===null)throw Error(_(308));xn=e,bs.dependencies={lanes:0,firstContext:e}}else xn=xn.next=e;return t}var Gt=null;function Xi(e){Gt===null?Gt=[e]:Gt.push(e)}function kc(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Xi(t)):(n.next=s.next,s.next=n),t.interleaved=n,xt(e,r)}function xt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var jt=!1;function eo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function mt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Mt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,W&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,xt(e,n)}return s=r.interleaved,s===null?(t.next=t,Xi(r)):(t.next=s.next,s.next=t),r.interleaved=t,xt(e,n)}function rs(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$i(e,n)}}function Ca(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function _s(e,t,n,r){var s=e.updateQueue;jt=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var u=a,m=u.next;u.next=null,o===null?i=m:o.next=m,o=u;var h=e.alternate;h!==null&&(h=h.updateQueue,a=h.lastBaseUpdate,a!==o&&(a===null?h.firstBaseUpdate=m:a.next=m,h.lastBaseUpdate=u))}if(i!==null){var v=s.baseState;o=0,h=m=u=null,a=i;do{var x=a.lane,S=a.eventTime;if((r&x)===x){h!==null&&(h=h.next={eventTime:S,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var N=e,w=a;switch(x=t,S=n,w.tag){case 1:if(N=w.payload,typeof N=="function"){v=N.call(S,v,x);break e}v=N;break e;case 3:N.flags=N.flags&-65537|128;case 0:if(N=w.payload,x=typeof N=="function"?N.call(S,v,x):N,x==null)break e;v=le({},v,x);break e;case 2:jt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,x=s.effects,x===null?s.effects=[a]:x.push(a))}else S={eventTime:S,lane:x,tag:a.tag,payload:a.payload,callback:a.callback,next:null},h===null?(m=h=S,u=v):h=h.next=S,o|=x;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;x=a,a=x.next,x.next=null,s.lastBaseUpdate=x,s.shared.pending=null}}while(!0);if(h===null&&(u=v),s.baseState=u,s.firstBaseUpdate=m,s.lastBaseUpdate=h,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);tn|=o,e.lanes=o,e.memoizedState=v}}function Ta(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=bl.transition;bl.transition={};try{e(!1),t()}finally{q=n,bl.transition=r}}function $c(){return Ke().memoizedState}function Vm(e,t,n){var r=Dt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Vc(e))Fc(t,n);else if(n=kc(e,t,n,r),n!==null){var s=be();Xe(n,e,r,s),Bc(n,t,r)}}function Fm(e,t,n){var r=Dt(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Vc(e))Fc(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,et(a,o)){var u=t.interleaved;u===null?(s.next=s,Xi(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}n=kc(e,t,s,r),n!==null&&(s=be(),Xe(n,e,r,s),Bc(n,t,r))}}function Vc(e){var t=e.alternate;return e===se||t!==null&&t===se}function Fc(e,t){er=Cs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$i(e,n)}}var Ts={readContext:We,useCallback:ve,useContext:ve,useEffect:ve,useImperativeHandle:ve,useInsertionEffect:ve,useLayoutEffect:ve,useMemo:ve,useReducer:ve,useRef:ve,useState:ve,useDebugValue:ve,useDeferredValue:ve,useTransition:ve,useMutableSource:ve,useSyncExternalStore:ve,useId:ve,unstable_isNewReconciler:!1},Bm={readContext:We,useCallback:function(e,t){return st().memoizedState=[e,t===void 0?null:t],e},useContext:We,useEffect:La,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ls(4194308,4,Ac.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ls(4194308,4,e,t)},useInsertionEffect:function(e,t){return ls(4,2,e,t)},useMemo:function(e,t){var n=st();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=st();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Vm.bind(null,se,e),[r.memoizedState,e]},useRef:function(e){var t=st();return e={current:e},t.memoizedState=e},useState:Pa,useDebugValue:ao,useDeferredValue:function(e){return st().memoizedState=e},useTransition:function(){var e=Pa(!1),t=e[0];return e=$m.bind(null,e[1]),st().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=se,s=st();if(ne){if(n===void 0)throw Error(_(407));n=n()}else{if(n=t(),me===null)throw Error(_(349));en&30||_c(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,La(Cc.bind(null,r,i,e),[e]),r.flags|=2048,wr(9,Ec.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=st(),t=me.identifierPrefix;if(ne){var n=ft,r=dt;n=(r&~(1<<32-Je(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=yr++,0")&&(u=u.replace("",e.displayName)),u}while(1<=o&&0<=a);break}}}finally{al=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Wn(e):""}function yf(e){switch(e.tag){case 5:return Wn(e.type);case 16:return Wn("Lazy");case 13:return Wn("Suspense");case 19:return Wn("SuspenseList");case 0:case 2:case 15:return e=ul(e.type,!1),e;case 11:return e=ul(e.type.render,!1),e;case 1:return e=ul(e.type,!0),e;default:return""}}function Ol(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case an:return"Fragment";case on:return"Portal";case Al:return"Profiler";case Ai:return"StrictMode";case Dl:return"Suspense";case Rl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Nu:return(e.displayName||"Context")+".Consumer";case ku:return(e._context.displayName||"Context")+".Provider";case Di:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ri:return t=e.displayName||null,t!==null?t:Ol(e.type)||"Memo";case St:t=e._payload,e=e._init;try{return Ol(e(t))}catch{}}return null}function vf(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ol(t);case 8:return t===Ai?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ot(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ju(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function wf(e){var t=ju(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Or(e){e._valueTracker||(e._valueTracker=wf(e))}function bu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ju(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ds(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Il(e,t){var n=t.checked;return le({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Yo(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ot(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function _u(e,t){t=t.checked,t!=null&&Mi(e,"checked",t,!1)}function $l(e,t){_u(e,t);var n=Ot(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Vl(e,t.type,n):t.hasOwnProperty("defaultValue")&&Vl(e,t.type,Ot(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Zo(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Vl(e,t,n){(t!=="number"||ds(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Kn=Array.isArray;function vn(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Ir.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ir(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},kf=["Webkit","ms","Moz","O"];Object.keys(Yn).forEach(function(e){kf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Yn[t]=Yn[e]})});function Pu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Yn.hasOwnProperty(e)&&Yn[e]?(""+t).trim():t+"px"}function Lu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Pu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var Nf=le({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ul(e,t){if(t){if(Nf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(_(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(_(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(_(61))}if(t.style!=null&&typeof t.style!="object")throw Error(_(62))}}function Hl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ql=null;function Oi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wl=null,wn=null,kn=null;function ea(e){if(e=Er(e)){if(typeof Wl!="function")throw Error(_(280));var t=e.stateNode;t&&(t=Vs(t),Wl(e.stateNode,e.type,t))}}function zu(e){wn?kn?kn.push(e):kn=[e]:wn=e}function Mu(){if(wn){var e=wn,t=kn;if(kn=wn=null,ea(e),t)for(e=0;e>>=0,e===0?32:31-(Mf(e)/Af|0)|0}var $r=64,Vr=4194304;function Gn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function hs(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Gn(a):(i&=o,i!==0&&(r=Gn(i)))}else o=n&~s,o!==0?r=Gn(o):i!==0&&(r=Gn(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function br(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Je(t),e[t]=n}function If(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Jn),ua=" ",ca=!1;function Xu(e,t){switch(e){case"keyup":return fm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ec(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var un=!1;function pm(e,t){switch(e){case"compositionend":return ec(t);case"keypress":return t.which!==32?null:(ca=!0,ua);case"textInput":return e=t.data,e===ua&&ca?null:e;default:return null}}function hm(e,t){if(un)return e==="compositionend"||!Qi&&Xu(e,t)?(e=Zu(),ts=Bi=Et=null,un=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=pa(n)}}function sc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?sc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function lc(){for(var e=window,t=ds();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ds(e.document)}return t}function Wi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function jm(e){var t=lc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&sc(n.ownerDocument.documentElement,n)){if(r!==null&&Wi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=ha(n,i);var o=ha(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,cn=null,Jl=null,er=null,Xl=!1;function xa(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Xl||cn==null||cn!==ds(r)||(r=cn,"selectionStart"in r&&Wi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),er&&fr(er,r)||(er=r,r=ys(Jl,"onSelect"),0mn||(e.current=li[mn],li[mn]=null,mn--)}function J(e,t){mn++,li[mn]=e.current,e.current=t}var It={},Ne=Vt(It),ze=Vt(!1),Jt=It;function En(e,t){var n=e.type.contextTypes;if(!n)return It;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Me(e){return e=e.childContextTypes,e!=null}function ws(){te(ze),te(Ne)}function Sa(e,t,n){if(Ne.current!==It)throw Error(_(168));J(Ne,t),J(ze,n)}function pc(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(_(108,vf(e)||"Unknown",s));return le({},n,r)}function ks(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||It,Jt=Ne.current,J(Ne,e),J(ze,ze.current),!0}function ja(e,t,n){var r=e.stateNode;if(!r)throw Error(_(169));n?(e=pc(e,t,Jt),r.__reactInternalMemoizedMergedChildContext=e,te(ze),te(Ne),J(Ne,e)):te(ze),J(ze,n)}var ct=null,Fs=!1,Sl=!1;function hc(e){ct===null?ct=[e]:ct.push(e)}function Rm(e){Fs=!0,hc(e)}function Ft(){if(!Sl&&ct!==null){Sl=!0;var e=0,t=q;try{var n=ct;for(q=1;e>=o,s-=o,dt=1<<32-Je(t)+s|n<b?(U=P,P=null):U=P.sibling;var O=x(f,P,d[b],y);if(O===null){P===null&&(P=U);break}e&&P&&O.alternate===null&&t(f,P),c=i(O,c,b),E===null?j=O:E.sibling=O,E=O,P=U}if(b===d.length)return n(f,P),ne&&Qt(f,b),j;if(P===null){for(;bb?(U=P,P=null):U=P.sibling;var X=x(f,P,O.value,y);if(X===null){P===null&&(P=U);break}e&&P&&X.alternate===null&&t(f,P),c=i(X,c,b),E===null?j=X:E.sibling=X,E=X,P=U}if(O.done)return n(f,P),ne&&Qt(f,b),j;if(P===null){for(;!O.done;b++,O=d.next())O=v(f,O.value,y),O!==null&&(c=i(O,c,b),E===null?j=O:E.sibling=O,E=O);return ne&&Qt(f,b),j}for(P=r(f,P);!O.done;b++,O=d.next())O=S(P,f,b,O.value,y),O!==null&&(e&&O.alternate!==null&&P.delete(O.key===null?b:O.key),c=i(O,c,b),E===null?j=O:E.sibling=O,E=O);return e&&P.forEach(function(Y){return t(f,Y)}),ne&&Qt(f,b),j}function L(f,c,d,y){if(typeof d=="object"&&d!==null&&d.type===an&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case Rr:e:{for(var j=d.key,E=c;E!==null;){if(E.key===j){if(j=d.type,j===an){if(E.tag===7){n(f,E.sibling),c=s(E,d.props.children),c.return=f,f=c;break e}}else if(E.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===St&&Ea(j)===E.type){n(f,E.sibling),c=s(E,d.props),c.ref=Un(f,E,d),c.return=f,f=c;break e}n(f,E);break}else t(f,E);E=E.sibling}d.type===an?(c=Zt(d.props.children,f.mode,y,d.key),c.return=f,f=c):(y=us(d.type,d.key,d.props,null,f.mode,y),y.ref=Un(f,c,d),y.return=f,f=y)}return o(f);case on:e:{for(E=d.key;c!==null;){if(c.key===E)if(c.tag===4&&c.stateNode.containerInfo===d.containerInfo&&c.stateNode.implementation===d.implementation){n(f,c.sibling),c=s(c,d.children||[]),c.return=f,f=c;break e}else{n(f,c);break}else t(f,c);c=c.sibling}c=Ll(d,f.mode,y),c.return=f,f=c}return o(f);case St:return E=d._init,L(f,c,E(d._payload),y)}if(Kn(d))return N(f,c,d,y);if(In(d))return w(f,c,d,y);Kr(f,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,c!==null&&c.tag===6?(n(f,c.sibling),c=s(c,d),c.return=f,f=c):(n(f,c),c=Pl(d,f.mode,y),c.return=f,f=c),o(f)):n(f,c)}return L}var Tn=vc(!0),wc=vc(!1),js=Vt(null),bs=null,xn=null,Yi=null;function Zi(){Yi=xn=bs=null}function Ji(e){var t=js.current;te(js),e._currentValue=t}function ai(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Sn(e,t){bs=e,Yi=xn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Le=!0),e.firstContext=null)}function We(e){var t=e._currentValue;if(Yi!==e)if(e={context:e,memoizedValue:t,next:null},xn===null){if(bs===null)throw Error(_(308));xn=e,bs.dependencies={lanes:0,firstContext:e}}else xn=xn.next=e;return t}var Gt=null;function Xi(e){Gt===null?Gt=[e]:Gt.push(e)}function kc(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Xi(t)):(n.next=s.next,s.next=n),t.interleaved=n,xt(e,r)}function xt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var jt=!1;function eo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function mt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Mt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,W&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,xt(e,n)}return s=r.interleaved,s===null?(t.next=t,Xi(r)):(t.next=s.next,s.next=t),r.interleaved=t,xt(e,n)}function rs(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$i(e,n)}}function Ca(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function _s(e,t,n,r){var s=e.updateQueue;jt=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var u=a,m=u.next;u.next=null,o===null?i=m:o.next=m,o=u;var h=e.alternate;h!==null&&(h=h.updateQueue,a=h.lastBaseUpdate,a!==o&&(a===null?h.firstBaseUpdate=m:a.next=m,h.lastBaseUpdate=u))}if(i!==null){var v=s.baseState;o=0,h=m=u=null,a=i;do{var x=a.lane,S=a.eventTime;if((r&x)===x){h!==null&&(h=h.next={eventTime:S,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var N=e,w=a;switch(x=t,S=n,w.tag){case 1:if(N=w.payload,typeof N=="function"){v=N.call(S,v,x);break e}v=N;break e;case 3:N.flags=N.flags&-65537|128;case 0:if(N=w.payload,x=typeof N=="function"?N.call(S,v,x):N,x==null)break e;v=le({},v,x);break e;case 2:jt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,x=s.effects,x===null?s.effects=[a]:x.push(a))}else S={eventTime:S,lane:x,tag:a.tag,payload:a.payload,callback:a.callback,next:null},h===null?(m=h=S,u=v):h=h.next=S,o|=x;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;x=a,a=x.next,x.next=null,s.lastBaseUpdate=x,s.shared.pending=null}}while(!0);if(h===null&&(u=v),s.baseState=u,s.firstBaseUpdate=m,s.lastBaseUpdate=h,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);tn|=o,e.lanes=o,e.memoizedState=v}}function Ta(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=bl.transition;bl.transition={};try{e(!1),t()}finally{q=n,bl.transition=r}}function $c(){return Ke().memoizedState}function Vm(e,t,n){var r=Dt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Vc(e))Fc(t,n);else if(n=kc(e,t,n,r),n!==null){var s=be();Xe(n,e,r,s),Bc(n,t,r)}}function Fm(e,t,n){var r=Dt(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Vc(e))Fc(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,et(a,o)){var u=t.interleaved;u===null?(s.next=s,Xi(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}n=kc(e,t,s,r),n!==null&&(s=be(),Xe(n,e,r,s),Bc(n,t,r))}}function Vc(e){var t=e.alternate;return e===se||t!==null&&t===se}function Fc(e,t){tr=Cs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$i(e,n)}}var Ts={readContext:We,useCallback:ve,useContext:ve,useEffect:ve,useImperativeHandle:ve,useInsertionEffect:ve,useLayoutEffect:ve,useMemo:ve,useReducer:ve,useRef:ve,useState:ve,useDebugValue:ve,useDeferredValue:ve,useTransition:ve,useMutableSource:ve,useSyncExternalStore:ve,useId:ve,unstable_isNewReconciler:!1},Bm={readContext:We,useCallback:function(e,t){return st().memoizedState=[e,t===void 0?null:t],e},useContext:We,useEffect:La,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ls(4194308,4,Ac.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ls(4194308,4,e,t)},useInsertionEffect:function(e,t){return ls(4,2,e,t)},useMemo:function(e,t){var n=st();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=st();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Vm.bind(null,se,e),[r.memoizedState,e]},useRef:function(e){var t=st();return e={current:e},t.memoizedState=e},useState:Pa,useDebugValue:ao,useDeferredValue:function(e){return st().memoizedState=e},useTransition:function(){var e=Pa(!1),t=e[0];return e=$m.bind(null,e[1]),st().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=se,s=st();if(ne){if(n===void 0)throw Error(_(407));n=n()}else{if(n=t(),me===null)throw Error(_(349));en&30||_c(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,La(Cc.bind(null,r,i,e),[e]),r.flags|=2048,wr(9,Ec.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=st(),t=me.identifierPrefix;if(ne){var n=ft,r=dt;n=(r&~(1<<32-Je(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=yr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[lt]=t,e[hr]=r,Jc(e,t,!1,!1),t.stateNode=e;e:{switch(o=Hl(n,r),n){case"dialog":ee("cancel",e),ee("close",e),s=r;break;case"iframe":case"object":case"embed":ee("load",e),s=r;break;case"video":case"audio":for(s=0;sLn&&(t.flags|=128,r=!0,Un(i,!1),t.lanes=4194304)}else{if(!r)if(e=Es(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Un(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ne)return we(t),null}else 2*oe()-i.renderingStartTime>Ln&&n!==1073741824&&(t.flags|=128,r=!0,Un(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=oe(),t.sibling=null,n=re.current,J(re,r?n&1|2:n&1),t):(we(t),null);case 22:case 23:return ho(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?De&1073741824&&(we(t),t.subtreeFlags&6&&(t.flags|=8192)):we(t),null;case 24:return null;case 25:return null}throw Error(_(156,t.tag))}function Ym(e,t){switch(Gi(t),t.tag){case 1:return Me(t.type)&&ws(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Tn(),te(ze),te(Ne),ro(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return no(t),null;case 13:if(te(re),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(_(340));En()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return te(re),null;case 4:return Tn(),null;case 10:return Ji(t.type._context),null;case 22:case 23:return ho(),null;case 24:return null;default:return null}}var qr=!1,ke=!1,Zm=typeof WeakSet=="function"?WeakSet:Set,A=null;function gn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ie(e,t,r)}else n.current=null}function gi(e,t,n){try{n()}catch(r){ie(e,t,r)}}var Ba=!1;function Jm(e,t){if(ei=xs,e=lc(),Wi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,u=-1,m=0,h=0,v=e,x=null;t:for(;;){for(var S;v!==n||s!==0&&v.nodeType!==3||(a=o+s),v!==i||r!==0&&v.nodeType!==3||(u=o+r),v.nodeType===3&&(o+=v.nodeValue.length),(S=v.firstChild)!==null;)x=v,v=S;for(;;){if(v===e)break t;if(x===n&&++m===s&&(a=o),x===i&&++h===r&&(u=o),(S=v.nextSibling)!==null)break;v=x,x=v.parentNode}v=S}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(ti={focusedElem:e,selectionRange:n},xs=!1,A=t;A!==null;)if(t=A,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,A=e;else for(;A!==null;){t=A;try{var N=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(N!==null){var w=N.memoizedProps,L=N.memoizedState,f=t.stateNode,c=f.getSnapshotBeforeUpdate(t.elementType===t.type?w:qe(t.type,w),L);f.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(_(163))}}catch(y){ie(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,A=e;break}A=t.return}return N=Ba,Ba=!1,N}function tr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&gi(t,n,i)}s=s.next}while(s!==r)}}function Hs(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function yi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function td(e){var t=e.alternate;t!==null&&(e.alternate=null,td(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[lt],delete t[hr],delete t[si],delete t[Am],delete t[Dm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function nd(e){return e.tag===5||e.tag===3||e.tag===4}function Ua(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||nd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function vi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=vs));else if(r!==4&&(e=e.child,e!==null))for(vi(e,t,n),e=e.sibling;e!==null;)vi(e,t,n),e=e.sibling}function wi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(wi(e,t,n),e=e.sibling;e!==null;)wi(e,t,n),e=e.sibling}var pe=null,Ye=!1;function Nt(e,t,n){for(n=n.child;n!==null;)rd(e,t,n),n=n.sibling}function rd(e,t,n){if(it&&typeof it.onCommitFiberUnmount=="function")try{it.onCommitFiberUnmount(Rs,n)}catch{}switch(n.tag){case 5:ke||gn(n,t);case 6:var r=pe,s=Ye;pe=null,Nt(e,t,n),pe=r,Ye=s,pe!==null&&(Ye?(e=pe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):pe.removeChild(n.stateNode));break;case 18:pe!==null&&(Ye?(e=pe,n=n.stateNode,e.nodeType===8?Nl(e.parentNode,n):e.nodeType===1&&Nl(e,n),cr(e)):Nl(pe,n.stateNode));break;case 4:r=pe,s=Ye,pe=n.stateNode.containerInfo,Ye=!0,Nt(e,t,n),pe=r,Ye=s;break;case 0:case 11:case 14:case 15:if(!ke&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&gi(n,t,o),s=s.next}while(s!==r)}Nt(e,t,n);break;case 1:if(!ke&&(gn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ie(n,t,a)}Nt(e,t,n);break;case 21:Nt(e,t,n);break;case 22:n.mode&1?(ke=(r=ke)||n.memoizedState!==null,Nt(e,t,n),ke=r):Nt(e,t,n);break;default:Nt(e,t,n)}}function Ha(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Zm),t.forEach(function(r){var s=op.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ge(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=oe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ep(r/1960))-r,10e?16:e,Ct===null)var r=!1;else{if(e=Ct,Ct=null,zs=0,W&6)throw Error(_(331));var s=W;for(W|=4,A=e.current;A!==null;){var i=A,o=i.child;if(A.flags&16){var a=i.deletions;if(a!==null){for(var u=0;uoe()-mo?Yt(e,0):fo|=n),Ae(e,t)}function dd(e,t){t===0&&(e.mode&1?(t=Vr,Vr<<=1,!(Vr&130023424)&&(Vr=4194304)):t=1);var n=be();e=xt(e,t),e!==null&&(br(e,t,n),Ae(e,n))}function ip(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),dd(e,n)}function op(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(_(314))}r!==null&&r.delete(t),dd(e,n)}var fd;fd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ze.current)Le=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Le=!1,Gm(e,t,n);Le=!!(e.flags&131072)}else Le=!1,ne&&t.flags&1048576&&xc(t,Ss,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;is(e,t),e=t.pendingProps;var s=_n(t,Ne.current);Sn(t,n),s=lo(null,t,r,e,s,n);var i=io();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Me(r)?(i=!0,ks(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,eo(t),s.updater=Us,t.stateNode=s,s._reactInternals=t,ci(t,r,e,n),t=mi(null,t,r,!0,i,n)):(t.tag=0,ne&&i&&Ki(t),je(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(is(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=up(r),e=qe(r,e),s){case 0:t=fi(null,t,r,e,n);break e;case 1:t=$a(null,t,r,e,n);break e;case 11:t=Oa(null,t,r,e,n);break e;case 14:t=Ia(null,t,r,qe(r.type,e),n);break e}throw Error(_(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:qe(r,s),fi(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:qe(r,s),$a(e,t,r,s,n);case 3:e:{if(qc(t),e===null)throw Error(_(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Nc(e,t),_s(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Pn(Error(_(423)),t),t=Va(e,t,r,n,s);break e}else if(r!==s){s=Pn(Error(_(424)),t),t=Va(e,t,r,n,s);break e}else for(Re=zt(t.stateNode.containerInfo.firstChild),Oe=t,ne=!0,Ze=null,n=wc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(En(),r===s){t=gt(e,t,n);break e}je(e,t,r,n)}t=t.child}return t;case 5:return Sc(t),e===null&&oi(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,ni(r,s)?o=null:i!==null&&ni(r,i)&&(t.flags|=32),Gc(e,t),je(e,t,o,n),t.child;case 6:return e===null&&oi(t),null;case 13:return Yc(e,t,n);case 4:return to(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Cn(t,null,r,n):je(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:qe(r,s),Oa(e,t,r,s,n);case 7:return je(e,t,t.pendingProps,n),t.child;case 8:return je(e,t,t.pendingProps.children,n),t.child;case 12:return je(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,J(js,r._currentValue),r._currentValue=o,i!==null)if(et(i.value,o)){if(i.children===s.children&&!ze.current){t=gt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=mt(-1,n&-n),u.tag=2;var m=i.updateQueue;if(m!==null){m=m.shared;var h=m.pending;h===null?u.next=u:(u.next=h.next,h.next=u),m.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),ai(i.return,n,t),a.lanes|=n;break}u=u.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(_(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),ai(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}je(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Sn(t,n),s=We(s),r=r(s),t.flags|=1,je(e,t,r,n),t.child;case 14:return r=t.type,s=qe(r,t.pendingProps),s=qe(r.type,s),Ia(e,t,r,s,n);case 15:return Wc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:qe(r,s),is(e,t),t.tag=1,Me(r)?(e=!0,ks(t)):e=!1,Sn(t,n),Uc(t,r,s),ci(t,r,s,n),mi(null,t,r,!0,e,n);case 19:return Zc(e,t,n);case 22:return Kc(e,t,n)}throw Error(_(156,t.tag))};function md(e,t){return Vu(e,t)}function ap(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function He(e,t,n,r){return new ap(e,t,n,r)}function go(e){return e=e.prototype,!(!e||!e.isReactComponent)}function up(e){if(typeof e=="function")return go(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Di)return 11;if(e===Ri)return 14}return 2}function Rt(e,t){var n=e.alternate;return n===null?(n=He(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function us(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")go(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case an:return Zt(n.children,s,i,t);case Ai:o=8,s|=8;break;case Al:return e=He(12,n,t,s|2),e.elementType=Al,e.lanes=i,e;case Dl:return e=He(13,n,t,s),e.elementType=Dl,e.lanes=i,e;case Rl:return e=He(19,n,t,s),e.elementType=Rl,e.lanes=i,e;case Su:return Ws(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ku:o=10;break e;case Nu:o=9;break e;case Di:o=11;break e;case Ri:o=14;break e;case St:o=16,r=null;break e}throw Error(_(130,e==null?e:typeof e,""))}return t=He(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Zt(e,t,n,r){return e=He(7,e,r,t),e.lanes=n,e}function Ws(e,t,n,r){return e=He(22,e,r,t),e.elementType=Su,e.lanes=n,e.stateNode={isHidden:!1},e}function Pl(e,t,n){return e=He(6,e,null,t),e.lanes=n,e}function Ll(e,t,n){return t=He(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cp(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=dl(0),this.expirationTimes=dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dl(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function yo(e,t,n,r,s,i,o,a,u){return e=new cp(e,t,n,a,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=He(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},eo(i),e}function dp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gd)}catch(e){console.error(e)}}gd(),gu.exports=$e;var xp=gu.exports,Ja=xp;zl.createRoot=Ja.createRoot,zl.hydrateRoot=Ja.hydrateRoot;/** +`+i.stack}return{value:e,source:t,stack:s,digest:null}}function Cl(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function di(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Qm=typeof WeakMap=="function"?WeakMap:Map;function Hc(e,t,n){n=mt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ls||(Ls=!0,ki=r),di(e,t)},n}function Qc(e,t,n){n=mt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){di(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){di(e,t),typeof r!="function"&&(At===null?At=new Set([this]):At.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Aa(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Qm;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=lp.bind(null,e,t,n),t.then(e,e))}function Da(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Ra(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=mt(-1,1),t.tag=2,Mt(n,t,1))),n.lanes|=1),e)}var Wm=vt.ReactCurrentOwner,Le=!1;function je(e,t,n,r){t.child=e===null?wc(t,null,n,r):Tn(t,e.child,n,r)}function Oa(e,t,n,r,s){n=n.render;var i=t.ref;return Sn(t,s),r=lo(e,t,n,r,i,s),n=io(),e!==null&&!Le?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,gt(e,t,s)):(ne&&n&&Ki(t),t.flags|=1,je(e,t,r,s),t.child)}function Ia(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!go(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Wc(e,t,i,r,s)):(e=us(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:fr,n(o,r)&&e.ref===t.ref)return gt(e,t,s)}return t.flags|=1,e=Rt(i,r),e.ref=t.ref,e.return=t,t.child=e}function Wc(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(fr(i,r)&&e.ref===t.ref)if(Le=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Le=!0);else return t.lanes=e.lanes,gt(e,t,s)}return fi(e,t,n,r,s)}function Kc(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},J(yn,De),De|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,J(yn,De),De|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,J(yn,De),De|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,J(yn,De),De|=r;return je(e,t,s,n),t.child}function Gc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function fi(e,t,n,r,s){var i=Me(n)?Jt:Ne.current;return i=En(t,i),Sn(t,s),n=lo(e,t,n,r,i,s),r=io(),e!==null&&!Le?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,gt(e,t,s)):(ne&&r&&Ki(t),t.flags|=1,je(e,t,n,s),t.child)}function $a(e,t,n,r,s){if(Me(n)){var i=!0;ks(t)}else i=!1;if(Sn(t,s),t.stateNode===null)is(e,t),Uc(t,n,r),ci(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var u=o.context,m=n.contextType;typeof m=="object"&&m!==null?m=We(m):(m=Me(n)?Jt:Ne.current,m=En(t,m));var h=n.getDerivedStateFromProps,v=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";v||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||u!==m)&&Ma(t,o,r,m),jt=!1;var x=t.memoizedState;o.state=x,_s(t,r,o,s),u=t.memoizedState,a!==r||x!==u||ze.current||jt?(typeof h=="function"&&(ui(t,n,h,r),u=t.memoizedState),(a=jt||za(t,n,a,r,x,u,m))?(v||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),o.props=r,o.state=u,o.context=m,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Nc(e,t),a=t.memoizedProps,m=t.type===t.elementType?a:qe(t.type,a),o.props=m,v=t.pendingProps,x=o.context,u=n.contextType,typeof u=="object"&&u!==null?u=We(u):(u=Me(n)?Jt:Ne.current,u=En(t,u));var S=n.getDerivedStateFromProps;(h=typeof S=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==v||x!==u)&&Ma(t,o,r,u),jt=!1,x=t.memoizedState,o.state=x,_s(t,r,o,s);var N=t.memoizedState;a!==v||x!==N||ze.current||jt?(typeof S=="function"&&(ui(t,n,S,r),N=t.memoizedState),(m=jt||za(t,n,m,r,x,N,u)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,N,u),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,N,u)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&x===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&x===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=N),o.props=r,o.state=N,o.context=u,r=m):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&x===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&x===e.memoizedState||(t.flags|=1024),r=!1)}return mi(e,t,n,r,i,s)}function mi(e,t,n,r,s,i){Gc(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&ja(t,n,!1),gt(e,t,i);r=t.stateNode,Wm.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Tn(t,e.child,null,i),t.child=Tn(t,null,a,i)):je(e,t,a,i),t.memoizedState=r.state,s&&ja(t,n,!0),t.child}function qc(e){var t=e.stateNode;t.pendingContext?Sa(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Sa(e,t.context,!1),to(e,t.containerInfo)}function Va(e,t,n,r,s){return Cn(),qi(s),t.flags|=256,je(e,t,n,r),t.child}var pi={dehydrated:null,treeContext:null,retryLane:0};function hi(e){return{baseLanes:e,cachePool:null,transitions:null}}function Yc(e,t,n){var r=t.pendingProps,s=re.current,i=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(s&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),J(re,s&1),e===null)return oi(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Ws(o,r,0,null),e=Zt(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=hi(n),t.memoizedState=pi,e):uo(t,o));if(s=e.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return Km(e,t,o,r,a,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,a=s.sibling;var u={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=Rt(s,u),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?i=Rt(a,i):(i=Zt(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?hi(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=pi,r}return i=e.child,e=i.sibling,r=Rt(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function uo(e,t){return t=Ws({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Gr(e,t,n,r){return r!==null&&qi(r),Tn(t,e.child,null,n),e=uo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Km(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=Cl(Error(_(422))),Gr(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Ws({mode:"visible",children:r.children},s,0,null),i=Zt(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Tn(t,e.child,null,o),t.child.memoizedState=hi(o),t.memoizedState=pi,i);if(!(t.mode&1))return Gr(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(_(419)),r=Cl(i,r,void 0),Gr(e,t,o,r)}if(a=(o&e.childLanes)!==0,Le||a){if(r=me,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,xt(e,s),Xe(r,e,s,-1))}return xo(),r=Cl(Error(_(421))),Gr(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=ip.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Re=zt(s.nextSibling),Oe=t,ne=!0,Ze=null,e!==null&&(Fe[Be++]=dt,Fe[Be++]=ft,Fe[Be++]=Xt,dt=e.id,ft=e.overflow,Xt=t),t=uo(t,r.children),t.flags|=4096,t)}function Fa(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ai(e.return,t,n)}function Tl(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function Zc(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(je(e,t,r.children,n),r=re.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fa(e,n,t);else if(e.tag===19)Fa(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(J(re,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&Es(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Tl(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Es(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Tl(t,!0,n,null,i);break;case"together":Tl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function is(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function gt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),tn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(_(153));if(t.child!==null){for(e=t.child,n=Rt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Rt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Gm(e,t,n){switch(t.tag){case 3:qc(t),Cn();break;case 5:Sc(t);break;case 1:Me(t.type)&&ks(t);break;case 4:to(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;J(js,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(J(re,re.current&1),t.flags|=128,null):n&t.child.childLanes?Yc(e,t,n):(J(re,re.current&1),e=gt(e,t,n),e!==null?e.sibling:null);J(re,re.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Zc(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),J(re,re.current),r)break;return null;case 22:case 23:return t.lanes=0,Kc(e,t,n)}return gt(e,t,n)}var Jc,xi,Xc,ed;Jc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};xi=function(){};Xc=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,qt(ot.current);var i=null;switch(n){case"input":s=Il(e,s),r=Il(e,r),i=[];break;case"select":s=le({},s,{value:void 0}),r=le({},r,{value:void 0}),i=[];break;case"textarea":s=Fl(e,s),r=Fl(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=vs)}Ul(n,r);var o;n=null;for(m in s)if(!r.hasOwnProperty(m)&&s.hasOwnProperty(m)&&s[m]!=null)if(m==="style"){var a=s[m];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else m!=="dangerouslySetInnerHTML"&&m!=="children"&&m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&m!=="autoFocus"&&(lr.hasOwnProperty(m)?i||(i=[]):(i=i||[]).push(m,null));for(m in r){var u=r[m];if(a=s!=null?s[m]:void 0,r.hasOwnProperty(m)&&u!==a&&(u!=null||a!=null))if(m==="style")if(a){for(o in a)!a.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in u)u.hasOwnProperty(o)&&a[o]!==u[o]&&(n||(n={}),n[o]=u[o])}else n||(i||(i=[]),i.push(m,n)),n=u;else m==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(i=i||[]).push(m,u)):m==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(m,""+u):m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&(lr.hasOwnProperty(m)?(u!=null&&m==="onScroll"&&ee("scroll",e),i||a===u||(i=[])):(i=i||[]).push(m,u))}n&&(i=i||[]).push("style",n);var m=i;(t.updateQueue=m)&&(t.flags|=4)}};ed=function(e,t,n,r){n!==r&&(t.flags|=4)};function Hn(e,t){if(!ne)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function we(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function qm(e,t,n){var r=t.pendingProps;switch(Gi(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return we(t),null;case 1:return Me(t.type)&&ws(),we(t),null;case 3:return r=t.stateNode,Pn(),te(ze),te(Ne),ro(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Wr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ze!==null&&(ji(Ze),Ze=null))),xi(e,t),we(t),null;case 5:no(t);var s=qt(gr.current);if(n=t.type,e!==null&&t.stateNode!=null)Xc(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(_(166));return we(t),null}if(e=qt(ot.current),Wr(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[lt]=t,r[hr]=i,e=(t.mode&1)!==0,n){case"dialog":ee("cancel",r),ee("close",r);break;case"iframe":case"object":case"embed":ee("load",r);break;case"video":case"audio":for(s=0;s<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[lt]=t,e[hr]=r,Jc(e,t,!1,!1),t.stateNode=e;e:{switch(o=Hl(n,r),n){case"dialog":ee("cancel",e),ee("close",e),s=r;break;case"iframe":case"object":case"embed":ee("load",e),s=r;break;case"video":case"audio":for(s=0;szn&&(t.flags|=128,r=!0,Hn(i,!1),t.lanes=4194304)}else{if(!r)if(e=Es(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Hn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ne)return we(t),null}else 2*oe()-i.renderingStartTime>zn&&n!==1073741824&&(t.flags|=128,r=!0,Hn(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=oe(),t.sibling=null,n=re.current,J(re,r?n&1|2:n&1),t):(we(t),null);case 22:case 23:return ho(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?De&1073741824&&(we(t),t.subtreeFlags&6&&(t.flags|=8192)):we(t),null;case 24:return null;case 25:return null}throw Error(_(156,t.tag))}function Ym(e,t){switch(Gi(t),t.tag){case 1:return Me(t.type)&&ws(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Pn(),te(ze),te(Ne),ro(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return no(t),null;case 13:if(te(re),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(_(340));Cn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return te(re),null;case 4:return Pn(),null;case 10:return Ji(t.type._context),null;case 22:case 23:return ho(),null;case 24:return null;default:return null}}var qr=!1,ke=!1,Zm=typeof WeakSet=="function"?WeakSet:Set,A=null;function gn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ie(e,t,r)}else n.current=null}function gi(e,t,n){try{n()}catch(r){ie(e,t,r)}}var Ba=!1;function Jm(e,t){if(ei=xs,e=lc(),Wi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,u=-1,m=0,h=0,v=e,x=null;t:for(;;){for(var S;v!==n||s!==0&&v.nodeType!==3||(a=o+s),v!==i||r!==0&&v.nodeType!==3||(u=o+r),v.nodeType===3&&(o+=v.nodeValue.length),(S=v.firstChild)!==null;)x=v,v=S;for(;;){if(v===e)break t;if(x===n&&++m===s&&(a=o),x===i&&++h===r&&(u=o),(S=v.nextSibling)!==null)break;v=x,x=v.parentNode}v=S}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(ti={focusedElem:e,selectionRange:n},xs=!1,A=t;A!==null;)if(t=A,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,A=e;else for(;A!==null;){t=A;try{var N=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(N!==null){var w=N.memoizedProps,L=N.memoizedState,f=t.stateNode,c=f.getSnapshotBeforeUpdate(t.elementType===t.type?w:qe(t.type,w),L);f.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(_(163))}}catch(y){ie(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,A=e;break}A=t.return}return N=Ba,Ba=!1,N}function nr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&gi(t,n,i)}s=s.next}while(s!==r)}}function Hs(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function yi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function td(e){var t=e.alternate;t!==null&&(e.alternate=null,td(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[lt],delete t[hr],delete t[si],delete t[Am],delete t[Dm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function nd(e){return e.tag===5||e.tag===3||e.tag===4}function Ua(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||nd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function vi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=vs));else if(r!==4&&(e=e.child,e!==null))for(vi(e,t,n),e=e.sibling;e!==null;)vi(e,t,n),e=e.sibling}function wi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(wi(e,t,n),e=e.sibling;e!==null;)wi(e,t,n),e=e.sibling}var pe=null,Ye=!1;function Nt(e,t,n){for(n=n.child;n!==null;)rd(e,t,n),n=n.sibling}function rd(e,t,n){if(it&&typeof it.onCommitFiberUnmount=="function")try{it.onCommitFiberUnmount(Rs,n)}catch{}switch(n.tag){case 5:ke||gn(n,t);case 6:var r=pe,s=Ye;pe=null,Nt(e,t,n),pe=r,Ye=s,pe!==null&&(Ye?(e=pe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):pe.removeChild(n.stateNode));break;case 18:pe!==null&&(Ye?(e=pe,n=n.stateNode,e.nodeType===8?Nl(e.parentNode,n):e.nodeType===1&&Nl(e,n),cr(e)):Nl(pe,n.stateNode));break;case 4:r=pe,s=Ye,pe=n.stateNode.containerInfo,Ye=!0,Nt(e,t,n),pe=r,Ye=s;break;case 0:case 11:case 14:case 15:if(!ke&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&gi(n,t,o),s=s.next}while(s!==r)}Nt(e,t,n);break;case 1:if(!ke&&(gn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ie(n,t,a)}Nt(e,t,n);break;case 21:Nt(e,t,n);break;case 22:n.mode&1?(ke=(r=ke)||n.memoizedState!==null,Nt(e,t,n),ke=r):Nt(e,t,n);break;default:Nt(e,t,n)}}function Ha(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Zm),t.forEach(function(r){var s=op.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ge(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=oe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ep(r/1960))-r,10e?16:e,Ct===null)var r=!1;else{if(e=Ct,Ct=null,zs=0,W&6)throw Error(_(331));var s=W;for(W|=4,A=e.current;A!==null;){var i=A,o=i.child;if(A.flags&16){var a=i.deletions;if(a!==null){for(var u=0;uoe()-mo?Yt(e,0):fo|=n),Ae(e,t)}function dd(e,t){t===0&&(e.mode&1?(t=Vr,Vr<<=1,!(Vr&130023424)&&(Vr=4194304)):t=1);var n=be();e=xt(e,t),e!==null&&(br(e,t,n),Ae(e,n))}function ip(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),dd(e,n)}function op(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(_(314))}r!==null&&r.delete(t),dd(e,n)}var fd;fd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ze.current)Le=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Le=!1,Gm(e,t,n);Le=!!(e.flags&131072)}else Le=!1,ne&&t.flags&1048576&&xc(t,Ss,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;is(e,t),e=t.pendingProps;var s=En(t,Ne.current);Sn(t,n),s=lo(null,t,r,e,s,n);var i=io();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Me(r)?(i=!0,ks(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,eo(t),s.updater=Us,t.stateNode=s,s._reactInternals=t,ci(t,r,e,n),t=mi(null,t,r,!0,i,n)):(t.tag=0,ne&&i&&Ki(t),je(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(is(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=up(r),e=qe(r,e),s){case 0:t=fi(null,t,r,e,n);break e;case 1:t=$a(null,t,r,e,n);break e;case 11:t=Oa(null,t,r,e,n);break e;case 14:t=Ia(null,t,r,qe(r.type,e),n);break e}throw Error(_(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:qe(r,s),fi(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:qe(r,s),$a(e,t,r,s,n);case 3:e:{if(qc(t),e===null)throw Error(_(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Nc(e,t),_s(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Ln(Error(_(423)),t),t=Va(e,t,r,n,s);break e}else if(r!==s){s=Ln(Error(_(424)),t),t=Va(e,t,r,n,s);break e}else for(Re=zt(t.stateNode.containerInfo.firstChild),Oe=t,ne=!0,Ze=null,n=wc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Cn(),r===s){t=gt(e,t,n);break e}je(e,t,r,n)}t=t.child}return t;case 5:return Sc(t),e===null&&oi(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,ni(r,s)?o=null:i!==null&&ni(r,i)&&(t.flags|=32),Gc(e,t),je(e,t,o,n),t.child;case 6:return e===null&&oi(t),null;case 13:return Yc(e,t,n);case 4:return to(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Tn(t,null,r,n):je(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:qe(r,s),Oa(e,t,r,s,n);case 7:return je(e,t,t.pendingProps,n),t.child;case 8:return je(e,t,t.pendingProps.children,n),t.child;case 12:return je(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,J(js,r._currentValue),r._currentValue=o,i!==null)if(et(i.value,o)){if(i.children===s.children&&!ze.current){t=gt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=mt(-1,n&-n),u.tag=2;var m=i.updateQueue;if(m!==null){m=m.shared;var h=m.pending;h===null?u.next=u:(u.next=h.next,h.next=u),m.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),ai(i.return,n,t),a.lanes|=n;break}u=u.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(_(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),ai(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}je(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Sn(t,n),s=We(s),r=r(s),t.flags|=1,je(e,t,r,n),t.child;case 14:return r=t.type,s=qe(r,t.pendingProps),s=qe(r.type,s),Ia(e,t,r,s,n);case 15:return Wc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:qe(r,s),is(e,t),t.tag=1,Me(r)?(e=!0,ks(t)):e=!1,Sn(t,n),Uc(t,r,s),ci(t,r,s,n),mi(null,t,r,!0,e,n);case 19:return Zc(e,t,n);case 22:return Kc(e,t,n)}throw Error(_(156,t.tag))};function md(e,t){return Vu(e,t)}function ap(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function He(e,t,n,r){return new ap(e,t,n,r)}function go(e){return e=e.prototype,!(!e||!e.isReactComponent)}function up(e){if(typeof e=="function")return go(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Di)return 11;if(e===Ri)return 14}return 2}function Rt(e,t){var n=e.alternate;return n===null?(n=He(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function us(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")go(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case an:return Zt(n.children,s,i,t);case Ai:o=8,s|=8;break;case Al:return e=He(12,n,t,s|2),e.elementType=Al,e.lanes=i,e;case Dl:return e=He(13,n,t,s),e.elementType=Dl,e.lanes=i,e;case Rl:return e=He(19,n,t,s),e.elementType=Rl,e.lanes=i,e;case Su:return Ws(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ku:o=10;break e;case Nu:o=9;break e;case Di:o=11;break e;case Ri:o=14;break e;case St:o=16,r=null;break e}throw Error(_(130,e==null?e:typeof e,""))}return t=He(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Zt(e,t,n,r){return e=He(7,e,r,t),e.lanes=n,e}function Ws(e,t,n,r){return e=He(22,e,r,t),e.elementType=Su,e.lanes=n,e.stateNode={isHidden:!1},e}function Pl(e,t,n){return e=He(6,e,null,t),e.lanes=n,e}function Ll(e,t,n){return t=He(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cp(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=dl(0),this.expirationTimes=dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dl(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function yo(e,t,n,r,s,i,o,a,u){return e=new cp(e,t,n,a,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=He(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},eo(i),e}function dp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gd)}catch(e){console.error(e)}}gd(),gu.exports=$e;var xp=gu.exports,Ja=xp;zl.createRoot=Ja.createRoot,zl.hydrateRoot=Ja.hydrateRoot;/** * @license lucide-react v0.424.0 - ISC * * This source code is licensed under the ISC license. @@ -97,7 +97,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zn=B("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + */const Mn=B("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.424.0 - ISC * * This source code is licensed under the ISC license. @@ -267,6 +267,6 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _d=B("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Op({branding:e,user:t,activeTab:n,onChangeTab:r,themeMode:s,onChangeThemeMode:i,onLogout:o,onOpenAuth:a,onOpenCreateEvent:u,onOpenTemplates:m,onOpenProfile:h,onOpenAdmin:v,pwaInstallPrompt:x,onInstallPwa:S}){const N=(e==null?void 0:e.primary_color)||"var(--brand-primary)",w=()=>{i(s==="dark"?"light":s==="light"?"auto":"dark")};return l.jsxs("header",{className:"bg-surface border-b border-grid sticky top-0 z-40",children:[l.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-16 flex items-center justify-between gap-4",children:[l.jsxs("div",{className:"flex items-center space-x-3 shrink-0",children:[l.jsx("div",{onClick:()=>r("home"),style:{backgroundColor:N},className:"w-8 h-8 rounded-sm flex items-center justify-center text-white font-bold cursor-pointer shadow-sm",children:e!=null&&e.logo_url?l.jsx("img",{src:e.logo_url,alt:"Logo",className:"w-4 h-4 object-contain"}):l.jsx(Tr,{className:"w-4 h-4"})}),l.jsxs("div",{onClick:()=>r("home"),className:"cursor-pointer",children:[l.jsx("h1",{className:"font-serif text-base font-bold tracking-tight text-main leading-none",children:(e==null?void 0:e.app_name)||"Schichtplaner"}),l.jsx("div",{className:"text-[10px] font-mono text-muted mt-1 uppercase tracking-wider flex items-center gap-1.5",children:t?l.jsxs("span",{className:"text-emerald-500 font-semibold",children:["[ ",t.display_name||t.username," ]"]}):l.jsx("span",{className:"text-amber-500 font-semibold",children:"[ GAST-MODUS ]"})})]})]}),l.jsxs("nav",{className:"hidden md:flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>r("home"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="home"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[l.jsx(eu,{className:"w-3.5 h-3.5"})," Startseite"]}),l.jsxs("button",{onClick:()=>r("calendar"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="calendar"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[l.jsx(Xa,{className:"w-3.5 h-3.5"})," Kalender"]}),((t==null?void 0:t.is_admin_user)||(t==null?void 0:t.is_staff)||(t==null?void 0:t.is_superuser))&&l.jsxs("button",{onClick:()=>r("admin"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="admin"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[l.jsx(nu,{className:"w-3.5 h-3.5 text-indigo-400"})," Admin"]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("button",{onClick:w,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5",title:`Design-Modus: ${s.toUpperCase()}`,children:s==="dark"?l.jsxs(l.Fragment,{children:[l.jsx(Cp,{className:"w-3.5 h-3.5 text-indigo-400"}),l.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"DARK"})]}):s==="light"?l.jsxs(l.Fragment,{children:[l.jsx(Ap,{className:"w-3.5 h-3.5 text-amber-500"}),l.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"LIGHT"})]}):l.jsxs(l.Fragment,{children:[l.jsx(Ep,{className:"w-3.5 h-3.5 text-blue-500"}),l.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"AUTO"})]})}),x&&l.jsxs("button",{onClick:S,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-emerald-500/10 text-emerald-500 border border-emerald-500/20 hover:bg-emerald-500/20 transition flex items-center gap-1",children:[l.jsx(jd,{className:"w-3 h-3"})," PWA"]}),t?l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:u,style:{backgroundColor:N},className:"h-8 px-3 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1 shadow-sm hover:brightness-110",children:[l.jsx(at,{className:"w-3.5 h-3.5"})," Event"]}),l.jsxs("button",{onClick:m,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition hidden sm:flex items-center gap-1",title:"Vorlagen",children:[l.jsx(Zs,{className:"w-3.5 h-3.5 text-muted"})," Vorlagen"]}),l.jsxs("button",{onClick:h,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1",title:"Profil & Namen ändern",children:[l.jsx(Sr,{className:"w-3.5 h-3.5 text-amber-500"})," Profil"]}),(t.is_admin_user||t.is_staff||t.is_superuser)&&l.jsxs("button",{onClick:()=>r("admin"),className:`h-8 px-2.5 rounded-sm text-xs font-mono transition flex items-center gap-1 border ${n==="admin"?"bg-indigo-500/20 text-indigo-300 border-indigo-500/40 font-bold":"bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border-indigo-500/30"}`,title:"Admin-Zentrale",children:[l.jsx(nu,{className:"w-3.5 h-3.5"})," Admin"]}),l.jsx("div",{className:"h-4 w-px bg-grid mx-1"}),l.jsx("button",{onClick:o,className:"h-8 w-8 rounded-sm text-muted hover:text-red-500 hover:bg-red-500/10 border border-transparent hover:border-red-500/20 transition flex items-center justify-center",title:"Abmelden",children:l.jsx(_p,{className:"w-3.5 h-3.5"})})]}):l.jsxs("button",{onClick:a,style:{backgroundColor:N},className:"h-8 px-3.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 flex items-center gap-1.5 shadow-sm",children:[l.jsx(cs,{className:"w-3.5 h-3.5"})," Anmelden"]})]})]}),l.jsxs("div",{className:"flex md:hidden items-center justify-around border-t border-grid py-2 bg-subtle text-xs font-mono",children:[l.jsxs("button",{onClick:()=>r("home"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="home"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[l.jsx(eu,{className:"w-3.5 h-3.5"})," Start"]}),l.jsxs("button",{onClick:()=>r("calendar"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="calendar"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[l.jsx(Xa,{className:"w-3.5 h-3.5"})," Termine"]}),l.jsxs("button",{onClick:()=>r("schedule"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="schedule"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[l.jsx(Dp,{className:"w-3.5 h-3.5"})," Schichtplan"]})]})]})}function Ip({event:e,user:t,onSignupClick:n,onCancelClick:r,onRemoveUserFromShift:s,onGenerateClaimLink:i,onExportPdf:o,onPrintView:a,onEditEvent:u,onDeleteEvent:m}){var S,N,w;if(!e||!e.task_areas||e.task_areas.length===0)return l.jsxs("div",{className:"hallmark-panel rounded-sm p-12 text-center border border-grid font-mono",children:[l.jsx(Nr,{className:"w-8 h-8 text-muted mx-auto mb-3"}),l.jsx("h3",{className:"font-serif text-xl font-bold text-main uppercase",children:"Keine Aufgabenfelder vorhanden"}),l.jsx("p",{className:"text-xs text-muted mt-1 mb-4",children:"[ Event hat noch keine definierten Aufgabenfelder oder Schichten ]"}),t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((S=e==null?void 0:e.created_by)==null?void 0:S.id)===t.id||(e==null?void 0:e.co_managers)&&e.co_managers.some(L=>typeof L=="object"?L.id===t.id:L===t.id))&&u&&l.jsxs("button",{onClick:()=>u(e),className:"px-4 py-2 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border border-indigo-500/30 font-bold text-xs inline-flex items-center gap-2",children:[l.jsx(Sr,{className:"w-4 h-4"})," SCHICHTEN & BEREICHE ANLEGEN"]})]});const h=!t,v=t&&(e==null?void 0:e.co_managers)&&e.co_managers.some(L=>typeof L=="object"?L.id===t.id:L===t.id),x=t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((N=e==null?void 0:e.created_by)==null?void 0:N.id)===t.id||v);return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid flex flex-col md:flex-row md:items-center justify-between gap-4",children:[l.jsxs("div",{className:"space-y-1 font-mono",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted mb-1",children:[l.jsxs("span",{className:"bg-subtle px-2.5 py-0.5 rounded-sm border border-grid font-bold text-main",children:[new Date(e.start_date).toLocaleDateString("de-DE")," — ",new Date(e.end_date).toLocaleDateString("de-DE")]}),e.location&&l.jsxs("span",{className:"flex items-center gap-1 text-muted",children:[l.jsx(No,{className:"w-3.5 h-3.5 shrink-0"}),e.location]}),e.is_active===!1&&l.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-amber-500/10 text-amber-500 border border-amber-500/20 font-bold",children:"[ DEAKTIVIERT ]"})]}),l.jsx("h2",{className:"font-serif text-3xl sm:text-4xl font-bold uppercase tracking-tight text-main",children:e.title}),e.description&&l.jsx("p",{className:"text-xs font-sans text-muted max-w-2xl mt-1",children:e.description})]}),l.jsxs("div",{className:"flex items-center gap-2 no-print font-mono text-xs shrink-0",children:[x&&u&&l.jsxs("button",{onClick:()=>u(e),className:"px-3.5 py-1.5 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border border-indigo-500/30 transition flex items-center gap-1.5 font-bold",title:"Schichten und Aufgabenbereiche für diese Veranstaltung bearbeiten",children:[l.jsx(Sr,{className:"w-3.5 h-3.5"})," SCHICHTEN BEARBEITEN"]}),t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((w=e==null?void 0:e.created_by)==null?void 0:w.id)===t.id)&&m&&l.jsxs("button",{onClick:()=>m(e),className:"px-3.5 py-1.5 rounded-sm bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/30 transition flex items-center gap-1.5 font-bold",title:"Diese Veranstaltung unwiderruflich löschen",children:[l.jsx(Ue,{className:"w-3.5 h-3.5"})," LÖSCHEN"]}),l.jsxs("button",{onClick:a,className:"px-3.5 py-1.5 rounded-sm bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 font-bold",children:[l.jsx(Pp,{className:"w-3.5 h-3.5"})," DRUCKEN"]}),l.jsxs("button",{onClick:o,className:"px-3.5 py-1.5 rounded-sm bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 font-bold",children:[l.jsx(Sp,{className:"w-3.5 h-3.5"})," PDF"]})]})]}),h&&l.jsxs("div",{className:"p-3.5 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs font-mono flex items-center gap-2",children:[l.jsx(Sd,{className:"w-4 h-4 shrink-0 text-amber-500"}),l.jsxs("span",{children:["[ GAST-DATENSCHUTZ ]: Belegungszahlen sichtbar, Namensanzeige aus Datenschutzgründen ",l.jsx("strong",{children:"anonymisiert"}),"."]})]}),l.jsx("div",{className:"hallmark-panel rounded-sm border border-grid overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-left border-collapse",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-subtle border-b border-grid text-[11px] font-mono text-muted uppercase tracking-wider",children:[l.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Aufgabenfeld"}),l.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Schicht & Zeitraum"}),l.jsx("th",{className:"py-3.5 px-4 w-1/6",children:"Qualifikation"}),l.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Belegung & Personen"}),l.jsx("th",{className:"py-3.5 px-4 w-1/6 text-right",children:"Aktion"})]})}),l.jsx("tbody",{className:"divide-y divide-grid text-xs font-sans",children:e.task_areas.map(L=>!L.shifts||L.shifts.length===0?l.jsxs("tr",{children:[l.jsx("td",{className:"py-3.5 px-4 font-serif text-lg font-bold text-main uppercase",children:L.name}),l.jsx("td",{colSpan:4,className:"py-3.5 px-4 text-muted font-mono text-[11px]",children:"[ Keine Schichten angelegt ]"})]},`area-${L.id}`):L.shifts.map((f,c)=>{const d=c===0,y=f.is_full,E=!!(t?f.signups.find(b=>!b.is_guest&&b.display_name===t.display_name):null),P=f.required_skills&&f.required_skills.length>0;return l.jsxs("tr",{className:"hover:bg-surface-hover/60 transition",children:[d?l.jsxs("td",{rowSpan:L.shifts.length,className:"py-3.5 px-4 font-serif text-lg font-bold text-main uppercase bg-subtle/80 align-top border-r border-grid",children:[l.jsx("div",{children:L.name}),L.description&&l.jsx("div",{className:"text-[11px] font-sans font-normal text-muted mt-0.5",children:L.description})]}):null,l.jsxs("td",{className:"py-3.5 px-4",children:[l.jsxs("div",{className:"font-semibold text-main flex items-center gap-2 flex-wrap",children:[l.jsx("span",{children:f.title}),f.date&&l.jsxs("span",{className:"text-[10px] font-mono font-bold text-indigo-400 bg-indigo-500/10 px-2 py-0.5 rounded-sm border border-indigo-500/20",children:["📅 ",new Date(f.date+"T00:00:00").toLocaleDateString("de-DE",{weekday:"short",day:"2-digit",month:"2-digit"})]})]}),l.jsxs("div",{className:"text-[11px] font-mono text-muted flex items-center gap-1 mt-0.5",children:[l.jsx(Nr,{className:"w-3 h-3 text-muted shrink-0"}),l.jsxs("span",{children:[f.start_time," — ",f.end_time," Uhr"]})]})]}),l.jsx("td",{className:"py-3.5 px-4 font-mono",children:P?l.jsx("div",{className:"flex flex-wrap gap-1",children:f.required_skills.map(b=>l.jsxs("span",{style:{backgroundColor:`${b.color}15`,borderColor:`${b.color}35`,color:b.color},className:"px-2 py-0.5 rounded-sm text-[10px] font-semibold border flex items-center gap-1",children:[l.jsx(wp,{className:"w-3 h-3 shrink-0"})," ",b.name]},b.id))}):l.jsx("span",{className:"text-[11px] text-muted",children:"—"})}),l.jsxs("td",{className:"py-3.5 px-4 font-mono",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs("span",{className:`px-2 py-0.5 rounded-sm text-[11px] font-bold border ${y?"bg-red-500/10 text-red-500 border-red-500/20":"bg-emerald-500/10 text-emerald-500 border-emerald-500/20"}`,children:["[ ",f.signups_count," / ",f.max_participants," BELEGT ]"]})}),l.jsx("div",{className:"mt-2 space-y-1 font-sans",children:f.signups.map(b=>l.jsxs("div",{className:"text-[11px] text-muted flex items-center justify-between gap-2 p-1.5 rounded-sm bg-subtle border border-grid",children:[l.jsxs("div",{className:"flex items-center gap-1.5 truncate",children:[l.jsx(So,{className:"w-3 h-3 text-muted shrink-0"}),l.jsx("span",{className:"truncate",children:b.display_name}),b.is_guest&&l.jsx("span",{className:"text-[9px] font-mono text-amber-500 px-1 rounded-sm bg-amber-500/10 border border-amber-500/20 font-bold",children:"GAST"})]}),l.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t&&b.is_guest&&i&&l.jsxs("button",{onClick:()=>i(b),className:"text-indigo-400 hover:text-indigo-300 transition p-1 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 border border-indigo-500/20 flex items-center gap-1 text-[10px] font-mono font-bold",title:"Konto-Einladungslink für diese Gast-Eintragung kopieren",children:[l.jsx(Rp,{className:"w-3 h-3"})," LINK"]}),x&&s&&l.jsx("button",{onClick:()=>s(f,b.id),className:"text-muted hover:text-red-500 transition p-1 rounded-sm hover:bg-red-500/10",title:"Person aus dieser Schicht entfernen",children:l.jsx(ru,{className:"w-3.5 h-3.5"})})]})]},b.id))})]}),l.jsx("td",{className:"py-3.5 px-4 text-right font-mono",children:E?l.jsxs("button",{onClick:()=>r(f),className:"px-3 py-1.5 rounded-sm text-xs font-semibold bg-red-500/10 hover:bg-red-500/20 text-red-500 border border-red-500/20 transition flex items-center gap-1 ml-auto",children:[l.jsx(ru,{className:"w-3.5 h-3.5"})," AUSTRAGEN"]}):y?l.jsx("span",{className:"text-xs text-muted font-bold",children:"[ VOLL ]"}):l.jsxs("button",{onClick:()=>n(f),style:{backgroundColor:"var(--brand-primary)"},className:"px-3.5 py-1.5 rounded-sm text-xs font-bold text-white transition hover:brightness-110 flex items-center gap-1 ml-auto shadow-sm",children:[l.jsx(yt,{className:"w-3.5 h-3.5"})," EINTRAGEN"]})})]},`shift-${f.id}`)}))})]})})})]})}function $p({shift:e,onClose:t,onSubmit:n}){const[r,s]=k.useState(""),[i,o]=k.useState(""),[a,u]=k.useState(!1),[m,h]=k.useState(""),[v,x]=k.useState(!1),S=k.useRef(null);k.useEffect(()=>{const w=localStorage.getItem("guest_display_name")||"";w&&s(w)},[]),k.useEffect(()=>{const w=S.current;if(!w)return;const L=c=>{var y;if(((y=c==null?void 0:c.detail)==null?void 0:y.verified)||w.isValid&&w.isValid()){u(!0);const j="acaptcha-verified-"+Math.random().toString(36).substring(2,10);o(j)}},f=()=>{u(!1),o("")};return w.addEventListener("verified",L),w.addEventListener("statuschange",L),w.addEventListener("reset",f),w.isValid&&w.isValid()&&L({detail:{verified:!0}}),()=>{w.removeEventListener("verified",L),w.removeEventListener("statuschange",L),w.removeEventListener("reset",f)}},[]);const N=async w=>{if(w.preventDefault(),h(""),!r.trim()){h("Bitte gib deinen Namen ein.");return}const L=S.current;if(!(a||L&&L.isValid&&L.isValid())){h("Bitte löse zuerst das Captcha.");return}const c=i||"acaptcha-verified-"+Math.random().toString(36).substring(2,10);localStorage.setItem("guest_display_name",r.trim()),x(!0);try{await n({guest_name:r.trim(),captcha_token:c}),t()}catch(d){h(d.message||"Eintragen fehlgeschlagen.")}finally{x(!1)}};return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/80 backdrop-blur-sm",children:l.jsxs("div",{className:"glass-panel w-full max-w-md rounded-2xl border border-slate-800 p-6 shadow-2xl relative animate-in fade-in zoom-in-95 duration-200",children:[l.jsx("button",{onClick:t,className:"absolute top-4 right-4 p-2 text-slate-400 hover:text-white rounded-lg transition",children:l.jsx(_d,{className:"w-5 h-5"})}),l.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[l.jsx("div",{className:"w-10 h-10 rounded-xl bg-blue-500/10 text-blue-400 border border-blue-500/20 flex items-center justify-center",children:l.jsx(So,{className:"w-5 h-5"})}),l.jsxs("div",{children:[l.jsx("h3",{className:"font-bold text-lg text-white",children:"Als Gast eintragen"}),l.jsxs("p",{className:"text-xs text-slate-400",children:["Schicht: ",e==null?void 0:e.title," (",e==null?void 0:e.start_time," - ",e==null?void 0:e.end_time,")"]})]})]}),m&&l.jsxs("div",{className:"mb-4 p-3 rounded-xl bg-red-500/10 border border-red-500/20 text-red-400 text-xs flex items-center gap-2",children:[l.jsx(zn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:m})]}),l.jsxs("form",{onSubmit:N,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1",children:"Dein Name / Anzeigename"}),l.jsx("input",{type:"text",required:!0,value:r,onChange:w=>s(w.target.value),placeholder:"z. B. Alex Muster",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900 border border-slate-800 text-white text-sm focus:outline-none focus:border-blue-500 transition"}),l.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"Dein Name wird in deiner Sitzung gespeichert. Falls du später ein Konto mit diesem Namen erstellst, werden deine Gast-Schichten automatisch übertragen!"})]}),l.jsxs("div",{className:"p-4 rounded-xl bg-slate-900/90 border border-slate-800 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-xs font-semibold text-slate-300 flex items-center gap-1.5 font-mono",children:[l.jsx(Mp,{className:"w-4 h-4 text-emerald-400"})," Security Check (aCAPTCHA)"]}),l.jsx("a",{href:"https://acaptcha.vercel.app/",target:"_blank",rel:"noreferrer",className:"text-[10px] text-blue-400 hover:underline font-mono",children:"aCAPTCHA v1.1"})]}),l.jsxs("div",{className:"border border-slate-700 rounded-lg p-3 bg-slate-950/80 flex flex-col items-center justify-center min-h-[100px]",children:[l.jsx("captcha-element",{ref:S,status:"null","sound-enabled":"true","dark-mode":"dark",type:"both",difficulty:"adaptive"}),a&&l.jsxs("div",{className:"mt-2 text-xs font-medium text-emerald-400 flex items-center gap-1 font-mono",children:[l.jsx(yt,{className:"w-4 h-4"})," Captcha verifiziert!"]})]})]}),l.jsxs("div",{className:"pt-2 flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-xl text-xs font-semibold text-slate-400 hover:bg-slate-800 transition",children:"Abbrechen"}),l.jsx("button",{type:"submit",disabled:v,className:"px-5 py-2 rounded-xl text-xs font-bold bg-blue-600 hover:bg-blue-500 text-white transition shadow-lg shadow-blue-600/30 disabled:opacity-50",children:v?"Eintragen...":"Jetzt eintragen"})]})]})]})})}const Vp="/api",_i=()=>localStorage.getItem("auth_token"),sr=e=>{e?localStorage.setItem("auth_token",e):localStorage.removeItem("auth_token")},V=async(e,t={})=>{const n=_i(),r={"Content-Type":"application/json",...n?{Authorization:`Token ${n}`}:{},...t.headers},s=await fetch(`${Vp}${e}`,{...t,headers:r}),i=s.headers.get("content-type");let o=null;if(i&&i.includes("application/json")&&(o=await s.json()),!s.ok){let a="Ein Fehler ist aufgetreten.";throw o&&(typeof o.error=="string"?a=o.error:typeof o.detail=="string"?a=o.detail:o.email?a=Array.isArray(o.email)?o.email[0]:o.email:o.username?a=Array.isArray(o.username)?o.username[0]:o.username:o.non_field_errors&&(a=o.non_field_errors[0])),new Error(a)}return o},su=["#E05A47","#3B82F6","#10B981","#8B5CF6","#F59E0B","#EC4899","#06B6D4","#6366F1","#14B8A6","#F97316","#D97706","#059669","#7C3AED","#DB2777","#2563EB"],lu=()=>su[Math.floor(Math.random()*su.length)];function Fp({onClose:e,onSuccess:t,claimToken:n,prefilledGuestName:r}){const[s,i]=k.useState(!!(n||r)),[o,a]=k.useState(""),[u,m]=k.useState(""),[h,v]=k.useState(""),[x,S]=k.useState(r||""),[N,w]=k.useState(null),[L,f]=k.useState(""),[c,d]=k.useState(!1);k.useEffect(()=>{y()},[]);const y=async()=>{try{const E=await V("/users/restriction-setting/");w(E)}catch{}},j=async E=>{E.preventDefault(),f(""),d(!0);try{if(s){const P={username:o,email:u,password:h,display_name:x||o};n&&(P.claim_token=n);const b=await V("/users/register/",{method:"POST",body:JSON.stringify(P)});if(b.requires_verification||b.requires_approval||!b.token){t(null,b.message||"Konto erfolgreich registriert! Bitte schau in deine E-Mail zur Bestätigung oder warte auf die Admin-Freischaltung."),e();return}sr(b.token),t(b.user,b.message)}else{const P=await V("/users/login/",{method:"POST",body:JSON.stringify({username:o,password:h})});sr(P.token),t(P.user,"Erfolgreich angemeldet!")}e()}catch(P){f(P.message||"Authentifizierung fehlgeschlagen.")}finally{d(!1)}};return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:l.jsxs("div",{className:"hallmark-panel w-full max-w-md rounded-sm border border-grid p-6 shadow-2xl relative animate-in fade-in zoom-in-95 duration-200",children:[l.jsx("button",{onClick:e,className:"absolute top-4 right-4 p-2 text-muted hover:text-main rounded-sm transition",children:l.jsx(_d,{className:"w-5 h-5"})}),l.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[l.jsx("div",{className:"w-10 h-10 rounded-sm bg-blue-500/10 text-blue-500 border border-blue-500/20 flex items-center justify-center",children:l.jsx(cs,{className:"w-5 h-5"})}),l.jsxs("div",{children:[l.jsx("h3",{className:"font-serif font-bold text-lg text-main",children:s?"Konto erstellen":"Anmelden"}),l.jsx("p",{className:"text-xs text-muted font-sans",children:s?"Erstelle einen Account für volle Funktionen & Schichteinsicht":"Melde dich an, um Events zu verwalten"})]})]}),r&&l.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs flex items-center gap-2 font-mono",children:[l.jsx(jd,{className:"w-4 h-4 shrink-0 text-amber-500"}),l.jsxs("span",{children:["Einladung für Gast: ",l.jsx("strong",{children:r}),". Die Schicht wird deinem neuen Konto zugewiesen!"]})]}),(N==null?void 0:N.is_restriction_enabled)&&s&&l.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-indigo-500/10 border border-indigo-500/20 text-indigo-400 text-xs flex items-center gap-2 font-mono",children:[l.jsx(zp,{className:"w-4 h-4 shrink-0 text-indigo-400"}),l.jsxs("span",{children:["Registrierungen beschränkt auf: ",l.jsx("strong",{children:N.active_domains.join(", ")})]})]}),L&&l.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs flex items-center gap-2 font-mono",children:[l.jsx(zn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:L})]}),!s&&!1,l.jsxs("form",{onSubmit:j,className:"space-y-4 font-sans",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Benutzername"}),l.jsxs("div",{className:"relative",children:[l.jsx(cs,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),l.jsx("input",{type:"text",required:!0,value:o,onChange:E=>a(E.target.value),placeholder:"z. B. max_muster",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),s&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"E-Mail-Adresse"}),l.jsxs("div",{className:"relative",children:[l.jsx(bi,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),l.jsx("input",{type:"email",required:!0,value:u,onChange:E=>m(E.target.value),placeholder:"max@beispiel.de",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Anzeigename (für Schichtlisten)"}),l.jsxs("div",{className:"relative",children:[l.jsx(cs,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),l.jsx("input",{type:"text",value:x,onChange:E=>S(E.target.value),placeholder:"z. B. Max M.",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Passwort"}),l.jsxs("div",{className:"relative",children:[l.jsx(bp,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),l.jsx("input",{type:"password",required:!0,value:h,onChange:E=>v(E.target.value),placeholder:"••••••••",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),l.jsx("button",{type:"submit",disabled:c,style:{backgroundColor:"var(--brand-primary)"},className:"w-full py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm",children:c?"Verarbeite...":s?"Registrieren":"Anmelden"})]}),l.jsx("div",{className:"mt-4 pt-4 border-t border-grid text-center",children:l.jsx("button",{type:"button",onClick:()=>{i(!s),f("")},className:"text-xs font-mono text-muted hover:text-main transition",children:s?"Bereits ein Konto? Hier anmelden":"Noch kein Konto? Jetzt registrieren"})})]})})}function Bp({events:e,user:t,onSelectEvent:n,onOpenCreateEvent:r,onToggleEventActive:s,onEditEvent:i,onDeleteEvent:o,branding:a}){const[u,m]=k.useState(""),[h,v]=k.useState("all"),x=new Date().toISOString().split("T")[0],S=e.filter(d=>d.title.toLowerCase().includes(u.toLowerCase())||d.description&&d.description.toLowerCase().includes(u.toLowerCase())||d.location&&d.location.toLowerCase().includes(u.toLowerCase())?h==="upcoming"?d.end_date>=x:!0:!1),N=(a==null?void 0:a.primary_color)||"var(--brand-primary)",w=(a==null?void 0:a.show_community_info_box)??!0,L=(a==null?void 0:a.show_support_box)??!0,f=w||L,c=t&&(t.is_admin_user||t.is_staff||t.is_superuser);return l.jsxs("div",{className:"space-y-8 animate-in fade-in duration-200",children:[l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-10 space-y-6 max-w-5xl mx-auto relative border border-grid",children:[l.jsxs("div",{className:"space-y-2 border-b border-grid pb-6",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-muted border border-grid px-2.5 py-1 rounded-sm inline-block",children:(a==null?void 0:a.app_name)||"SCHICHT- & EVENTPORTAL"}),(a==null?void 0:a.custom_banner_text)&&l.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-widest text-amber-500 bg-amber-500/10 border border-amber-500/20 px-2.5 py-1 rounded-sm inline-block font-bold",children:["📢 ",a.custom_banner_text]})]}),l.jsx("h2",{className:"font-serif text-3xl sm:text-5xl font-bold uppercase tracking-tight text-main leading-tight",children:"Veranstaltungen & Schichtkoordination"}),l.jsx("p",{className:"font-sans text-xs sm:text-sm text-muted max-w-2xl",children:"Hier findest du aktuelle Termine, Arbeitsgruppen, Bar- & Tresendienste und Schichtpläne der Initiative."})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx(Nd,{className:"w-4 h-4 absolute left-3.5 top-3 text-muted"}),l.jsx("input",{type:"text",value:u,onChange:d=>m(d.target.value),placeholder:"Veranstaltung, Ort oder Suchbegriff...",className:"w-full pl-10 pr-16 py-2 rounded-sm bg-subtle border border-grid text-main text-xs font-mono focus:outline-none focus:border-muted"}),u&&l.jsx("button",{onClick:()=>m(""),className:"absolute right-3 top-2.5 text-[10px] font-mono text-muted hover:text-main",children:"[ CLEAR ]"})]}),l.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs shrink-0",children:[l.jsxs("button",{onClick:()=>v("all"),className:`px-3.5 py-1.5 rounded-sm transition border ${h==="all"?"bg-surface-hover text-main border-grid font-bold shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:["ALLE PROGRAMME (",e.length,")"]}),l.jsxs("button",{onClick:()=>v("upcoming"),className:`px-3.5 py-1.5 rounded-sm transition border ${h==="upcoming"?"bg-surface-hover text-main border-grid font-bold shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:["ANSTEHEND (",e.filter(d=>d.end_date>=x).length,")"]})]})]})]}),l.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-1 lg:grid-cols-4 gap-6",children:[l.jsxs("div",{className:`${f?"lg:col-span-3":"lg:col-span-4"} space-y-4`,children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-3 font-mono",children:[l.jsxs("h3",{className:"font-serif text-xl font-bold uppercase tracking-wide text-main flex items-center gap-2",children:[l.jsx(Tr,{className:"w-4.5 h-4.5 text-muted"})," Termine & Schichten"]}),t&&l.jsxs("button",{onClick:r,style:{backgroundColor:N},className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1 hover:brightness-110 shadow-sm",children:[l.jsx(at,{className:"w-3.5 h-3.5"})," EVENT ANLEGEN"]})]}),S.length===0?l.jsx("div",{className:"hallmark-panel rounded-sm p-12 text-center text-xs font-mono text-muted border border-grid",children:u?`[ Keinen Eintrag für "${u}" gefunden ]`:"[ Keine Veranstaltungen vorhanden ]"}):l.jsx("div",{className:`grid grid-cols-1 sm:grid-cols-2 ${f?"":"lg:grid-cols-3"} gap-4`,children:S.map(d=>{var U,O,X,Y;const y=((U=d.task_areas)==null?void 0:U.length)||0,j=((O=d.task_areas)==null?void 0:O.reduce((G,ge)=>{var Se;return G+(((Se=ge.shifts)==null?void 0:Se.length)||0)},0))||0,E=t&&d.co_managers&&d.co_managers.some(G=>typeof G=="object"?G.id===t.id:G===t.id),P=t&&(d.created_by===t.id||((X=d.created_by)==null?void 0:X.id)===t.id||E),b=c||P;return l.jsxs("div",{className:`hallmark-card rounded-sm p-5 border transition flex flex-col justify-between space-y-4 group overflow-hidden ${d.is_active===!1?"border-amber-500/40 opacity-80 bg-subtle":"border-grid"}`,children:[l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between text-[11px] font-mono text-muted gap-2",children:[l.jsxs("span",{className:"flex items-center gap-1 bg-subtle px-2 py-0.5 rounded-sm border border-grid font-bold shrink-0",children:[l.jsx(Nr,{className:"w-3 h-3 text-muted"}),new Date(d.start_date).toLocaleDateString("de-DE")]}),d.is_active===!1?l.jsx("span",{className:"text-amber-500 font-bold px-1.5 py-0.5 rounded-sm bg-amber-500/10 border border-amber-500/20 shrink-0",children:"[ DEAKTIVIERT ]"}):d.location?l.jsxs("span",{className:"flex items-center gap-1 text-muted truncate max-w-[130px]",children:[l.jsx(No,{className:"w-3 h-3 shrink-0"}),l.jsx("span",{className:"truncate",children:d.location})]}):null]}),l.jsx("h4",{className:"font-serif text-lg font-bold uppercase text-main group-hover:text-amber-500 transition line-clamp-2",children:d.title}),d.description&&l.jsx("p",{className:"text-xs text-muted font-sans line-clamp-2",children:d.description}),l.jsxs("div",{className:"text-[10px] font-mono text-muted flex items-center gap-1.5 pt-1",children:[l.jsxs("span",{children:[y," Bereiche"]}),l.jsx("span",{children:"/"}),l.jsxs("span",{children:[j," Schichten"]})]})]}),l.jsx("div",{className:"pt-3 border-t border-grid space-y-2 font-mono",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsxs("button",{onClick:()=>n(d.id),className:"flex-1 min-w-[110px] py-1.5 px-3 rounded-sm text-xs font-mono font-bold bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center justify-center gap-1",children:["Schichtplan ",l.jsx(wd,{className:"w-3.5 h-3.5"})]}),b&&i&&l.jsxs("button",{onClick:()=>i(d),className:"py-1.5 px-2.5 rounded-sm text-[10px] font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1 shrink-0",title:"Veranstaltung & Schichten bearbeiten",children:[l.jsx(Sr,{className:"w-3.5 h-3.5"})," BEARBEITEN"]}),b&&s&&l.jsx("button",{onClick:()=>s(d),className:`py-1.5 px-2 rounded-sm text-[10px] font-mono font-bold transition flex items-center gap-1 border shrink-0 ${d.is_active!==!1?"bg-amber-500/10 text-amber-500 border-amber-500/20 hover:bg-amber-500/20":"bg-emerald-500/10 text-emerald-400 border-emerald-500/20 hover:bg-emerald-500/20"}`,title:d.is_active!==!1?"Deaktivieren":"Aktivieren",children:d.is_active!==!1?l.jsx(kd,{className:"w-3.5 h-3.5"}):l.jsx(yt,{className:"w-3.5 h-3.5"})}),(c||t&&(d.created_by===t.id||((Y=d.created_by)==null?void 0:Y.id)===t.id))&&o&&l.jsx("button",{onClick:()=>o(d),className:"py-1.5 px-2 rounded-sm text-[10px] font-mono font-bold bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 transition flex items-center gap-1 shrink-0",title:"Veranstaltung unwiderruflich löschen",children:l.jsx(Ue,{className:"w-3.5 h-3.5"})})]})})]},d.id)})})]}),f&&l.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[w&&l.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid space-y-3",children:[l.jsx("h4",{className:"font-serif text-sm font-bold uppercase tracking-wide text-main border-b border-grid pb-2",children:(a==null?void 0:a.community_info_title)||"📌 Verein & Infos"}),l.jsx("div",{className:"space-y-2 text-muted text-[11px] whitespace-pre-line",children:(a==null?void 0:a.community_info_text)||`Initiative e.V. Hausverein -Offene Angebote, DIY-Kultur & engagierte Schichten.`})]}),L&&l.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid space-y-3",children:[l.jsx("h4",{className:"font-serif text-sm font-bold uppercase tracking-wide text-main border-b border-grid pb-2",children:(a==null?void 0:a.support_box_title)||"❤️ Unterstützen"}),l.jsx("p",{className:"text-[11px] text-muted whitespace-pre-line",children:(a==null?void 0:a.support_box_text)||"Hilf mit als Helfer*in an der Bar, beim Essen kochen oder beim Auf- & Abbau."})]})]})]})]})}function Up({events:e,onSelectEvent:t,branding:n}){const[r,s]=k.useState(new Date),[i,o]=k.useState(null),a=r.getFullYear(),u=r.getMonth(),m=["JANUAR","FEBRUAR","MÄRZ","APRIL","MAI","JUNI","JULI","AUGUST","SEPTEMBER","OKTOBER","NOVEMBER","DEZEMBER"],h=()=>s(new Date(a,u-1,1)),v=()=>s(new Date(a,u+1,1)),x=()=>s(new Date),S=new Date(a,u,1).getDay(),N=S===0?6:S-1,w=new Date(a,u+1,0).getDate(),L=d=>{const y=String(u+1).padStart(2,"0"),j=String(d).padStart(2,"0");return`${a}-${y}-${j}`},f=d=>{const y=L(d);return e.filter(j=>y>=j.start_date&&y<=j.end_date)},c=(n==null?void 0:n.primary_color)||"var(--brand-primary)";return l.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto animate-in fade-in duration-200",children:[l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid flex flex-col sm:flex-row sm:items-center justify-between gap-4 font-mono",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded-sm bg-subtle text-main border border-grid flex items-center justify-center font-bold",children:l.jsx(Tr,{className:"w-4 h-4 text-amber-500"})}),l.jsxs("div",{children:[l.jsxs("h2",{className:"font-serif text-3xl sm:text-4xl font-bold uppercase tracking-tight text-main leading-none",children:[m[u]," ",a]}),l.jsx("p",{className:"text-[10px] text-muted uppercase tracking-widest mt-1",children:"— INITIATIVE E.V. TERMIN- & SCHICHTÜBERSICHT —"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:x,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-surface hover:bg-surface-hover text-main border border-grid transition",children:"[ HEUTE ]"}),l.jsx("button",{onClick:h,className:"p-1.5 rounded-sm text-muted hover:text-main bg-surface border border-grid transition",title:"Vorheriger Monat",children:l.jsx(kp,{className:"w-4 h-4"})}),l.jsx("button",{onClick:v,className:"p-1.5 rounded-sm text-muted hover:text-main bg-surface border border-grid transition",title:"Nächster Monat",children:l.jsx(Np,{className:"w-4 h-4"})})]})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm border border-grid overflow-hidden",children:[l.jsxs("div",{className:"grid grid-cols-7 bg-subtle border-b border-grid text-center text-xs font-mono text-muted font-bold py-3 uppercase",children:[l.jsx("div",{children:"MO"}),l.jsx("div",{children:"DI"}),l.jsx("div",{children:"MI"}),l.jsx("div",{children:"DO"}),l.jsx("div",{children:"FR"}),l.jsx("div",{children:"SA"}),l.jsx("div",{children:"SO"})]}),l.jsxs("div",{className:"grid grid-cols-7 auto-rows-fr divide-x divide-y divide-grid bg-surface text-xs font-mono",children:[Array.from({length:N}).map((d,y)=>l.jsx("div",{className:"min-h-[100px] sm:min-h-[110px] p-2 bg-subtle/50 text-muted opacity-30"},`offset-${y}`)),Array.from({length:w}).map((d,y)=>{const j=y+1,E=f(j),P=new Date().getFullYear()===a&&new Date().getMonth()===u&&new Date().getDate()===j;return l.jsxs("div",{className:`min-h-[100px] sm:min-h-[110px] p-2 flex flex-col justify-between transition ${P?"bg-surface-hover/80 font-bold":"hover:bg-surface-hover/50"}`,children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:`w-5 h-5 rounded-sm flex items-center justify-center font-mono text-xs ${P?"bg-main text-paper font-bold shadow-sm":"text-muted"}`,children:j}),E.length>0&&l.jsxs("span",{className:"text-[9px] font-mono text-muted",children:[E.length," ",E.length===1?"Event":"Events"]})]}),l.jsx("div",{className:"space-y-1.5 overflow-y-auto max-h-[70px] no-scrollbar",children:E.map(b=>{const U=(i==null?void 0:i.id)===b.id;return l.jsx("button",{onClick:()=>o(b),style:{backgroundColor:U?c:`${c}15`,borderColor:`${c}40`,color:U?"#ffffff":c},className:`w-full text-left px-2 py-1 rounded-sm text-[10px] font-mono font-bold border truncate block hover:brightness-110 transition shadow-sm ${b.is_active===!1?"opacity-50 line-through":""}`,children:b.title},`evt-${b.id}`)})})]},`day-${j}`)})]})]}),i&&l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid flex flex-col sm:flex-row sm:items-center justify-between gap-4 font-mono animate-in fade-in duration-200",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted",children:[l.jsxs("span",{className:"flex items-center gap-1 bg-subtle px-2 py-0.5 rounded-sm border border-grid font-bold text-main",children:[l.jsx(Nr,{className:"w-3 h-3 text-muted"}),new Date(i.start_date).toLocaleDateString("de-DE")," — ",new Date(i.end_date).toLocaleDateString("de-DE")]}),i.location&&l.jsxs("span",{className:"flex items-center gap-1 text-muted",children:[l.jsx(No,{className:"w-3 h-3"}),i.location]})]}),l.jsx("h3",{className:"font-serif text-2xl font-bold uppercase text-main",children:i.title}),i.description&&l.jsx("p",{className:"text-xs font-sans text-muted max-w-xl",children:i.description})]}),l.jsx("div",{className:"flex items-center gap-2 shrink-0",children:l.jsxs("button",{onClick:()=>t(i.id),style:{backgroundColor:c},className:"px-5 py-2 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1.5 hover:brightness-110 shadow-sm",children:["SCHICHTPLAN ÖFFNEN ",l.jsx(wd,{className:"w-4 h-4"})]})})]})]})}function Hp({branding:e,onRefreshBranding:t,onRefreshEvents:n,skills:r,onRefreshSkills:s}){const[i,o]=k.useState("users"),[a,u]=k.useState(!0),[m,h]=k.useState(""),[v,x]=k.useState(""),[S,N]=k.useState([]),[w,L]=k.useState(""),[f,c]=k.useState([]),[d,y]=k.useState(!1),[j,E]=k.useState(!1),[P,b]=k.useState(!0),[U,O]=k.useState([]),[X,Y]=k.useState(""),[G,ge]=k.useState([]),[Se,ye]=k.useState([]),[Ce,z]=k.useState(""),[I,g]=k.useState(""),[C,M]=k.useState(lu()),[$,D]=k.useState((e==null?void 0:e.app_name)||"Veranstaltungsschichtplaner"),[H,ae]=k.useState((e==null?void 0:e.logo_url)||""),[tt,Pr]=k.useState((e==null?void 0:e.primary_color)||"#E05A47"),[Lr,Js]=k.useState((e==null?void 0:e.custom_banner_text)||""),[Bt,Rn]=k.useState((e==null?void 0:e.show_community_info_box)??!0),[zr,Ut]=k.useState((e==null?void 0:e.community_info_title)||"📌 Verein & Infos"),[Mr,Xs]=k.useState((e==null?void 0:e.community_info_text)||`Initiative e.V. Hausverein -Offene Angebote, DIY-Kultur & engagierte Schichten.`),[Ht,el]=k.useState((e==null?void 0:e.show_support_box)??!0),[Ar,T]=k.useState((e==null?void 0:e.support_box_title)||"❤️ Unterstützen"),[R,Z]=k.useState((e==null?void 0:e.support_box_text)||"Hilf mit als Helfer*in an der Bar, beim Essen kochen oder beim Auf- & Abbau."),[nt,K]=k.useState(!1),[wt,jo]=k.useState(!1),[bo,_o]=k.useState("smtp.beispiel.de"),[Eo,Co]=k.useState(587),[To,Po]=k.useState(""),[Lo,zo]=k.useState(""),[Mo,tl]=k.useState(!0),[Ao,nl]=k.useState(!1),[Do,Ro]=k.useState("noreply@schichtplaner.de"),[Oo,Ed]=k.useState(""),[rl,Cd]=k.useState(!1),[Io,$o]=k.useState(!1),[Vo,Fo]=k.useState(!1);k.useEffect(()=>{Bo()},[]);const Bo=async()=>{u(!0);try{try{const p=await V("/users/manage-users/");N(p.results||p)}catch{}try{const p=await V("/users/pending/");c(p.results||p)}catch{}try{const p=await V("/users/restriction-setting/");y(p.is_restriction_enabled),E(p.require_admin_approval),b(p.require_email_verification??!0)}catch{}try{const p=await V("/users/domain-rules/");O(p.results||p)}catch{}try{const p=await V("/events/");ge(p.results||p)}catch{}try{const p=await V("/templates/");ye(p.results||p)}catch{}try{const p=await V("/users/smtp-setting/");p&&(jo(p.is_active??!1),_o(p.host||""),Co(p.port||587),Po(p.username||""),zo(p.password||""),tl(p.use_tls??!0),nl(p.use_ssl??!1),Ro(p.from_email||""))}catch{}}catch(p){h(p.message||"Laden der Admin-Daten fehlgeschlagen.")}finally{u(!1)}},Te=p=>{x(p),setTimeout(()=>x(""),4e3)},Td=async p=>{try{const F=await V(`/users/manage-users/${p.id}/`,{method:"PATCH",body:JSON.stringify({is_admin_user:!p.is_admin_user})});N(S.map(kt=>kt.id===p.id?F:kt)),Te(`Admin-Rechte für ${p.username} aktualisiert.`)}catch(F){h(F.message||"Fehler beim Aktualisieren.")}},Pd=async p=>{try{const F=await V(`/users/manage-users/${p.id}/`,{method:"PATCH",body:JSON.stringify({is_approved:!p.is_approved})});N(S.map(kt=>kt.id===p.id?F:kt)),Te(`Freischalt-Status für ${p.username} aktualisiert.`)}catch(F){h(F.message||"Fehler beim Aktualisieren.")}},Ld=async p=>{if(window.confirm(`Möchtest du das Benutzerkonto "${p.display_name||p.username}" (@${p.username}) wirklich dauerhaft löschen?`))try{await V(`/users/manage-users/${p.id}/`,{method:"DELETE"}),N(S.filter(F=>F.id!==p.id)),Te(`Benutzerkonto ${p.username} wurde gelöscht.`)}catch(F){h(F.message||"Fehler beim Löschen des Benutzers.")}},zd=async p=>{try{await V(`/users/${p}/approve/`,{method:"POST"}),c(f.filter(F=>F.id!==p)),Bo(),Te("Benutzer erfolgreich freigeschaltet.")}catch(F){h(F.message||"Freischalten fehlgeschlagen.")}},Md=async p=>{try{await V(`/users/${p}/approve/`,{method:"DELETE"}),c(f.filter(F=>F.id!==p)),Te("Benutzer abgelehnt und gelöscht.")}catch(F){h(F.message||"Ablehnen fehlgeschlagen.")}},sl=async(p,F)=>{try{const ll=await V("/users/restriction-setting/",{method:"POST",body:JSON.stringify({is_restriction_enabled:p==="restriction"?F:d,require_admin_approval:p==="approval"?F:j,require_email_verification:p==="email_verify"?F:P})});y(ll.is_restriction_enabled),E(ll.require_admin_approval),b(ll.require_email_verification),Te("Sicherheitseinstellungen aktualisiert.")}catch(kt){h(kt.message||"Aktualisierung fehlgeschlagen.")}},Ad=async p=>{if(p.preventDefault(),!!X.trim())try{const F=await V("/users/domain-rules/",{method:"POST",body:JSON.stringify({domain:X})});O([...U,F]),Y(""),Te(`Domain-Regel "${F.domain}" hinzugefügt.`)}catch(F){h(F.message||"Fehler beim Hinzufügen.")}},Dd=async p=>{try{await V(`/users/domain-rules/${p}/`,{method:"DELETE"}),O(U.filter(F=>F.id!==p)),Te("Domain-Regel entfernt.")}catch(F){h(F.message||"Fehler beim Löschen.")}},Rd=async p=>{if(p.preventDefault(),!!Ce.trim())try{await V("/skills/",{method:"POST",body:JSON.stringify({name:Ce,description:I,color:C})}),z(""),g(""),M(lu()),s(),Te("Qualifikation angelegt.")}catch(F){h(F.message||"Fehler beim Anlegen.")}},Od=async p=>{try{await V(`/skills/${p}/`,{method:"DELETE"}),s(),Te("Qualifikation gelöscht.")}catch(F){h(F.message||"Fehler beim Löschen.")}},Id=async p=>{try{await V(`/templates/${p}/`,{method:"DELETE"}),ye(Se.filter(F=>F.id!==p)),Te("Vorlage gelöscht.")}catch(F){h(F.message||"Fehler beim Löschen.")}},$d=async p=>{p.preventDefault(),K(!0);try{await V("/branding/",{method:"POST",body:JSON.stringify({app_name:$,logo_url:H,primary_color:tt,custom_banner_text:Lr,show_community_info_box:Bt,community_info_title:zr,community_info_text:Mr,show_support_box:Ht,support_box_title:Ar,support_box_text:R})}),t(),Te("Branding-Einstellungen erfolgreich gespeichert!")}catch(F){h(F.message||"Speichern des Brandings fehlgeschlagen.")}finally{K(!1)}},Vd=async p=>{p.preventDefault(),$o(!0);try{await V("/users/smtp-setting/",{method:"POST",body:JSON.stringify({is_active:wt,host:bo,port:parseInt(Eo)||587,username:To,password:Lo,use_tls:Mo,use_ssl:Ao,from_email:Do})}),Te("✅ SMTP-Einstellungen erfolgreich gespeichert!")}catch(F){h(F.message||"Speichern der SMTP-Einstellungen fehlgeschlagen.")}finally{$o(!1)}},Fd=async()=>{Fo(!0);try{const p=await V("/users/smtp-setting/test/",{method:"POST",body:JSON.stringify({email:Oo})});Te(`✅ ${p.message||"Test-E-Mail erfolgreich gesendet!"}`)}catch(p){h(p.message||"Test-E-Mail fehlgeschlagen.")}finally{Fo(!1)}},Uo=S.filter(p=>p.username.toLowerCase().includes(w.toLowerCase())||p.email.toLowerCase().includes(w.toLowerCase())||p.display_name&&p.display_name.toLowerCase().includes(w.toLowerCase()));return l.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto animate-in fade-in duration-200 font-sans",children:[l.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-2",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded-sm bg-indigo-500/10 text-indigo-500 border border-indigo-500/20 flex items-center justify-center font-bold",children:l.jsx(Sd,{className:"w-5 h-5"})}),l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:"System Administration"}),l.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Verwaltung von Benutzern, Freischaltungen, Events, Vorlagen, Branding & SMTP-Mailserver"})]})]})}),l.jsx("div",{className:"border-b border-grid pb-2",children:l.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs overflow-x-auto no-scrollbar",children:[l.jsxs("button",{onClick:()=>o("users"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${i==="users"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[l.jsx(bd,{className:"w-3.5 h-3.5 text-blue-400"})," [ 01: BENUTZER & SICHERHEIT (",S.length,") ]"]}),l.jsxs("button",{onClick:()=>o("events"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${i==="events"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[l.jsx(Tr,{className:"w-3.5 h-3.5 text-emerald-400"})," [ 02: VERANSTALTUNGEN (",G.length,") ]"]}),l.jsxs("button",{onClick:()=>o("templates"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${i==="templates"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[l.jsx(Zs,{className:"w-3.5 h-3.5 text-amber-400"})," [ 03: VORLAGEN & SKILLS ]"]}),l.jsxs("button",{onClick:()=>o("branding"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${i==="branding"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[l.jsx(tu,{className:"w-3.5 h-3.5 text-indigo-400"})," [ 04: BRANDING & SYSTEM ]"]}),l.jsxs("button",{onClick:()=>o("smtp"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${i==="smtp"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[l.jsx(bi,{className:"w-3.5 h-3.5 text-purple-400"})," [ 05: E-MAIL & SMTP ]"]})]})}),m&&l.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[l.jsx(zn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:m})]}),v&&l.jsxs("div",{className:"p-4 rounded-sm bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-xs font-mono flex items-center gap-2",children:[l.jsx(yt,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:v})]}),i==="users"&&l.jsxs("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:[f.length>0&&l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-amber-500/40 bg-amber-500/5 space-y-3",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-amber-500 flex items-center gap-2 border-b border-amber-500/20 pb-2",children:["⚠️ Ausstehende Registrierungen (",f.length,")"]}),l.jsx("div",{className:"space-y-2",children:f.map(p=>l.jsxs("div",{className:"p-3 rounded-sm bg-surface border border-grid flex items-center justify-between text-xs",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"font-bold text-main",children:[p.display_name," (@",p.username,")"]}),l.jsx("div",{className:"text-[11px] text-muted",children:p.email})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>zd(p.id),className:"px-3 py-1 rounded-sm bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs",children:"[ FREISCHALTEN ]"}),l.jsx("button",{onClick:()=>Md(p.id),className:"px-3 py-1 rounded-sm bg-red-600/20 text-red-400 hover:bg-red-600/30 border border-red-600/30 font-bold text-xs",children:"[ ABLEHNEN ]"})]})]},p.id))})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid flex items-center gap-3",children:[l.jsx(Nd,{className:"w-4 h-4 text-muted shrink-0"}),l.jsx("input",{type:"text",value:w,onChange:p=>L(p.target.value),placeholder:"Nutzer suchen nach Name, Username oder E-Mail...",className:"w-full bg-subtle border border-grid px-3 py-1.5 rounded-sm text-xs font-mono text-main focus:outline-none focus:border-muted"}),w&&l.jsx("button",{onClick:()=>L(""),className:"text-xs text-muted hover:text-main font-mono shrink-0",children:"[ CLEAR ]"})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Benutzerkonten & Rechtestatus (",Uo.length,")"]}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-left border-collapse text-xs",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-grid text-muted uppercase text-[10px]",children:[l.jsx("th",{className:"pb-2 font-bold",children:"Nutzer"}),l.jsx("th",{className:"pb-2 font-bold",children:"E-Mail"}),l.jsx("th",{className:"pb-2 font-bold",children:"Freigeschaltet"}),l.jsx("th",{className:"pb-2 font-bold",children:"E-Mail Bestätigt"}),l.jsx("th",{className:"pb-2 font-bold",children:"Admin-Rolle"}),l.jsx("th",{className:"pb-2 font-bold text-right",children:"Aktionen"})]})}),l.jsx("tbody",{className:"divide-y divide-grid",children:Uo.map(p=>l.jsxs("tr",{className:"hover:bg-subtle/50 transition",children:[l.jsxs("td",{className:"py-2.5 font-bold text-main",children:[p.display_name||p.username,l.jsxs("span",{className:"text-[10px] text-muted font-normal block",children:["@",p.username]})]}),l.jsx("td",{className:"py-2.5 text-muted",children:p.email}),l.jsx("td",{className:"py-2.5",children:l.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${p.is_approved?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:p.is_approved?"JA":"NEIN"})}),l.jsx("td",{className:"py-2.5",children:l.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${p.is_email_verified?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-subtle text-muted border-grid"}`,children:p.is_email_verified?"VERIFIZIERT":"AUSSTEHEND"})}),l.jsx("td",{className:"py-2.5",children:l.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${p.is_admin_user||p.is_superuser?"bg-indigo-500/10 text-indigo-400 border-indigo-500/20":"bg-subtle text-muted border-grid"}`,children:p.is_superuser?"SUPERUSER":p.is_admin_user?"ADMIN":"USER"})}),l.jsxs("td",{className:"py-2.5 text-right space-x-1",children:[l.jsx("button",{onClick:()=>Pd(p),className:"px-2 py-1 rounded-sm text-[10px] bg-subtle hover:bg-surface-hover border border-grid text-main transition",children:p.is_approved?"Sperren":"Freischalten"}),l.jsx("button",{onClick:()=>Td(p),className:"px-2 py-1 rounded-sm text-[10px] bg-subtle hover:bg-surface-hover border border-grid text-indigo-400 transition",children:p.is_admin_user?"Admin entziehen":"Zu Admin machen"}),l.jsxs("button",{onClick:()=>Ld(p),className:"px-2 py-1 rounded-sm text-[10px] bg-red-500/10 hover:bg-red-500/20 border border-red-500/20 text-red-400 font-bold transition inline-flex items-center gap-1",title:"Benutzerkonto dauerhaft löschen",children:[l.jsx(Ue,{className:"w-3 h-3"})," Löschen"]})]})]},p.id))})]})})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[l.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"Sicherheit & Registrierungs-Einschränkungen"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"font-bold text-main",children:"E-Mail Bestätigung (Opt-Out)"}),l.jsx("button",{onClick:()=>sl("email_verify",!P),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${P?"bg-emerald-600 text-white border-emerald-500":"bg-amber-500/10 text-amber-500 border-amber-500/20"}`,children:P?"[ PFLICHT ]":"[ DEAKTIVIERT ]"})]}),l.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Bei Pflicht muss die E-Mail vor der Anmeldung verifiziert werden. Bei Deaktivierung ist die Anmeldung direkt möglich."})]}),l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"font-bold text-main",children:"Domain-Einschränkung"}),l.jsx("button",{onClick:()=>sl("restriction",!d),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${d?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:d?"[ AKTIV ]":"[ INAKTIV ]"})]}),l.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Erlaubt nur Registrierungen von festgelegten E-Mail-Domains (z. B. `@verein.de`)."})]}),l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"font-bold text-main",children:"Admin-Freischaltpflicht"}),l.jsx("button",{onClick:()=>sl("approval",!j),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${j?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:j?"[ AKTIV ]":"[ INAKTIV ]"})]}),l.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Erfordert die manuelle Freischaltung durch einen Admin vor der ersten Anmeldung."})]})]}),d&&l.jsxs("div",{className:"space-y-3 pt-3 border-t border-grid",children:[l.jsx("h4",{className:"font-serif text-sm font-bold uppercase text-main",children:"Erlaubte E-Mail-Domains"}),l.jsxs("form",{onSubmit:Ad,className:"flex gap-2",children:[l.jsx("input",{type:"text",placeholder:"z. B. verein.de oder @beispiel.org",value:X,onChange:p=>Y(p.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),l.jsxs("button",{type:"submit",className:"px-4 py-1.5 rounded-sm bg-indigo-600 hover:bg-indigo-500 text-white font-bold text-xs",children:[l.jsx(at,{className:"w-3.5 h-3.5 inline"})," Domain Hinzufügen"]})]}),l.jsx("div",{className:"flex flex-wrap gap-2",children:U.map(p=>l.jsxs("span",{className:"px-2.5 py-1 rounded-sm bg-subtle border border-grid text-xs flex items-center gap-2",children:[l.jsx("strong",{className:"text-main",children:p.domain}),l.jsx("button",{onClick:()=>Dd(p.id),className:"text-muted hover:text-red-400",children:l.jsx(Ue,{className:"w-3.5 h-3.5"})})]},p.id))})]})]})]}),i==="events"&&l.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Alle Veranstaltungen (",G.length,")"]}),l.jsx("div",{className:"space-y-3",children:G.map(p=>l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-serif font-bold text-main text-sm",children:p.title}),l.jsxs("p",{className:"text-muted text-[11px]",children:[new Date(p.start_date).toLocaleDateString("de-DE")," — ",p.location||"Kein Ort"," | Erstellt von: ",p.created_by_name||"Admin"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${p.is_active!==!1?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:p.is_active!==!1?"AKTIV":"DEAKTIVIERT"}),l.jsxs("button",{onClick:async()=>{if(window.confirm(`Möchtest du "${p.title}" und alle Schichten wirklich unwiderruflich löschen?`))try{await V(`/events/${p.id}/`,{method:"DELETE"}),n()}catch(F){alert(F.message)}},className:"px-2.5 py-1 rounded-sm text-[10px] font-bold bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 transition flex items-center gap-1",title:"Veranstaltung löschen",children:[l.jsx(Ue,{className:"w-3 h-3"})," LÖSCHEN"]})]})]},p.id))})]})}),i==="templates"&&l.jsxs("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:[l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[l.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"Erforderliche Qualifikationen (Skills)"}),l.jsxs("form",{onSubmit:Rd,className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[l.jsx("input",{type:"text",placeholder:"Skill Name (z. B. Bar-Erfahrung)",required:!0,value:Ce,onChange:p=>z(p.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),l.jsx("input",{type:"text",placeholder:"Beschreibung (optional)",value:I,onChange:p=>g(p.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"color",value:C,onChange:p=>M(p.target.value),className:"w-8 h-8 rounded-sm border-0 cursor-pointer bg-subtle p-0.5"}),l.jsxs("button",{type:"submit",className:"flex-1 px-3 py-1.5 rounded-sm bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs",children:[l.jsx(at,{className:"w-3.5 h-3.5 inline"})," Anlegen"]})]})]}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pt-2",children:r.map(p=>l.jsxs("div",{className:"p-3 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{style:{color:p.color},className:"font-bold",children:p.name}),p.description&&l.jsx("p",{className:"text-[11px] text-muted",children:p.description})]}),l.jsx("button",{onClick:()=>Od(p.id),className:"text-muted hover:text-red-400",children:l.jsx(Ue,{className:"w-3.5 h-3.5"})})]},p.id))})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Gespeicherte Event-Vorlagen (",Se.length,")"]}),l.jsx("div",{className:"space-y-2",children:Se.map(p=>l.jsxs("div",{className:"p-3 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[l.jsxs("div",{children:[l.jsx("div",{className:"font-bold text-main",children:p.name}),l.jsx("div",{className:"text-[11px] text-muted",children:p.description||"Keine Beschreibung"})]}),l.jsx("button",{onClick:()=>Id(p.id),className:"text-muted hover:text-red-400",children:l.jsx(Ue,{className:"w-4 h-4"})})]},p.id))})]})]}),i==="branding"&&l.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:l.jsxs("form",{onSubmit:$d,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-6",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2 flex items-center gap-2",children:[l.jsx(tu,{className:"w-5 h-5 text-indigo-400"})," Portal Branding & Erscheinungsbild"]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-xs",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Anwendungs-Name"}),l.jsx("input",{type:"text",required:!0,value:$,onChange:p=>D(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field font-bold"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Primärfarbe (Brand Accent)"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"color",value:tt,onChange:p=>Pr(p.target.value),className:"w-9 h-9 rounded-sm border-0 cursor-pointer bg-subtle p-0.5"}),l.jsx("input",{type:"text",value:tt,onChange:p=>Pr(p.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field font-mono"})]})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-muted mb-1",children:"Logo Bild-URL (optional)"}),l.jsx("input",{type:"text",placeholder:"https://beispiel.de/logo.png",value:H,onChange:p=>ae(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-muted mb-1",children:"Ankündigung (Banner-Text)"}),l.jsx("textarea",{rows:2,placeholder:"z. B. Willkommen beim Sommerfest Schichtplaner!",value:Lr,onChange:p=>Js(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]}),l.jsx("h4",{className:"font-serif text-base font-bold uppercase text-main pt-4 border-t border-grid",children:"Startseiten Sidebar Boxen"}),l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[l.jsx("span",{className:"font-bold text-xs uppercase text-main",children:"📌 Verein & Infos Box"}),l.jsx("button",{type:"button",onClick:()=>Rn(!Bt),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${Bt?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:Bt?"[ AN ]":"[ AUS ]"})]}),Bt&&l.jsxs("div",{className:"space-y-3 text-xs",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Titel"}),l.jsx("input",{type:"text",value:zr,onChange:p=>Ut(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Inhalt"}),l.jsx("textarea",{rows:3,value:Mr,onChange:p=>Xs(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]})]}),l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[l.jsx("span",{className:"font-bold text-xs uppercase text-main",children:"❤️ Unterstützen Box"}),l.jsx("button",{type:"button",onClick:()=>el(!Ht),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${Ht?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:Ht?"[ AN ]":"[ AUS ]"})]}),Ht&&l.jsxs("div",{className:"space-y-3 text-xs",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Titel"}),l.jsx("input",{type:"text",value:Ar,onChange:p=>T(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Inhalt"}),l.jsx("textarea",{rows:3,value:R,onChange:p=>Z(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]})]}),l.jsx("div",{className:"pt-3 flex justify-end border-t border-grid",children:l.jsx("button",{type:"submit",disabled:nt,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm",children:nt?"Speichern...":"Einstellungen speichern"})})]})}),i==="smtp"&&l.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:l.jsxs("form",{onSubmit:Vd,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-3",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main flex items-center gap-2",children:[l.jsx(bi,{className:"w-5 h-5 text-indigo-400"})," SMTP Server & E-Mail-Versand"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-muted font-bold",children:"SMTP-Versand:"}),l.jsx("button",{type:"button",onClick:()=>jo(!wt),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${wt?"bg-emerald-600 text-white border-emerald-500 shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:wt?"[ AKTIV ]":"[ INAKTIV (Dev Mode) ]"})]})]}),!wt&&l.jsxs("div",{className:"p-3.5 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs flex items-center gap-2",children:[l.jsx(zn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:"Hinweis: Im inaktiven Modus werden Bestätigungs-Links in der Entwickler-Konsole / Logs ausgegeben."})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-xs",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Host / Server Adresse"}),l.jsx("input",{type:"text",placeholder:"z. B. smtp.domain.de oder mail.gmx.net",value:bo,onChange:p=>_o(p.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Port"}),l.jsx("input",{type:"number",placeholder:"587 oder 465",value:Eo,onChange:p=>Co(p.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Absender E-Mail-Adresse (From)"}),l.jsx("input",{type:"email",placeholder:"noreply@verein.de",value:Do,onChange:p=>Ro(p.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Benutzername / Login E-Mail"}),l.jsx("input",{type:"text",placeholder:"z. B. noreply@verein.de",value:To,onChange:p=>Po(p.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Passwort"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{type:rl?"text":"password",placeholder:"••••••••",value:Lo,onChange:p=>zo(p.target.value),className:"w-full pl-3.5 pr-10 py-2 rounded-sm input-field font-mono"}),l.jsx("button",{type:"button",onClick:()=>Cd(!rl),className:"absolute right-3 top-2.5 text-muted hover:text-main",children:rl?l.jsx(kd,{className:"w-4 h-4"}):l.jsx(jp,{className:"w-4 h-4"})})]})]}),l.jsxs("div",{className:"sm:col-span-2 flex items-center gap-6 pt-2",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-main font-bold",children:[l.jsx("input",{type:"checkbox",checked:Mo,onChange:p=>{tl(p.target.checked),p.target.checked&&nl(!1)},className:"rounded-sm"}),l.jsx("span",{children:"STARTTLS verwenden (Empfohlen für Port 587)"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-main font-bold",children:[l.jsx("input",{type:"checkbox",checked:Ao,onChange:p=>{nl(p.target.checked),p.target.checked&&tl(!1)},className:"rounded-sm"}),l.jsx("span",{children:"SSL/TLS verwenden (Empfohlen für Port 465)"})]})]})]}),l.jsxs("div",{className:"pt-4 border-t border-grid flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-[260px]",children:[l.jsx("input",{type:"email",placeholder:"Empfänger für Test-E-Mail...",value:Oo,onChange:p=>Ed(p.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs flex-1 font-mono"}),l.jsxs("button",{type:"button",disabled:Vo,onClick:Fd,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1.5 shrink-0",children:[l.jsx(Lp,{className:"w-3.5 h-3.5"}),Vo?"Sende...":"Test-Mail Senden"]})]}),l.jsxs("button",{type:"submit",disabled:Io,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[l.jsx(yt,{className:"w-4 h-4"}),Io?"Speichern...":"SMTP-Einstellungen Speichern"]})]})]})})]})}function Qp({eventToEdit:e,skills:t,user:n,onBack:r,onSubmit:s,onDeleteEvent:i}){var I;const[o,a]=k.useState((e==null?void 0:e.title)||""),[u,m]=k.useState((e==null?void 0:e.description)||""),[h,v]=k.useState((e==null?void 0:e.location)||""),[x,S]=k.useState((e==null?void 0:e.start_date)||new Date().toISOString().split("T")[0]),[N,w]=k.useState((e==null?void 0:e.end_date)||new Date().toISOString().split("T")[0]),[L,f]=k.useState(e!=null&&e.co_managers?e.co_managers.map(g=>g.id):[]),[c,d]=k.useState([]),[y,j]=k.useState([]),[E,P]=k.useState(!1),[b,U]=k.useState("");k.useEffect(()=>{if(O(),e&&e.task_areas&&e.task_areas.length>0){const g=e.task_areas.map(C=>({id:C.id,name:C.name,description:C.description||"",shifts:(C.shifts||[]).map(M=>({id:M.id,title:M.title,date:M.date||(e?e.start_date:new Date().toISOString().split("T")[0]),start_time:M.start_time,end_time:M.end_time,max_participants:M.max_participants||1,required_skill_ids:M.required_skills?M.required_skills.map($=>$.id):[]}))}));j(g)}else e||j([{name:"Tresendienst",description:"Getränke- und Barverkauf",shifts:[{title:"Schicht 1",start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]}]},{name:"Essen kochen",description:"Zubereitung von Speisen",shifts:[{title:"Frühschicht",start_time:"15:00",end_time:"19:00",max_participants:3,required_skill_ids:[]}]},{name:"Aufbau & Aufräumen",description:"Tische, Stühle & Technik",shifts:[{title:"Aufbau",start_time:"12:00",end_time:"15:00",max_participants:4,required_skill_ids:[]}]}])},[e]);const O=async()=>{try{const g=await V("/users/all/");d(g.results||g)}catch{}},X=()=>{j([...y,{name:"",description:"",shifts:[{title:"Schicht 1",start_time:"10:00",end_time:"14:00",max_participants:1,required_skill_ids:[]}]}])},Y=g=>{j(y.filter((C,M)=>M!==g))},G=(g,C,M)=>{const $=[...y];$[g][C]=M,j($)},ge=g=>{const C=[...y];C[g].shifts.push({title:`Schicht ${C[g].shifts.length+1}`,date:x,start_time:"14:00",end_time:"18:00",max_participants:1,required_skill_ids:[]}),j(C)},Se=(g,C)=>{const M=[...y];M[g].shifts=M[g].shifts.filter(($,D)=>D!==C),j(M)},ye=(g,C,M,$)=>{const D=[...y];D[g].shifts[C][M]=$,j(D)},Ce=(g,C,M)=>{const $=[...y],D=$[g].shifts[C].required_skill_ids||[];D.includes(M)?$[g].shifts[C].required_skill_ids=D.filter(H=>H!==M):$[g].shifts[C].required_skill_ids=[...D,M],j($)},z=async g=>{if(g.preventDefault(),U(""),!o.trim()){U("Bitte gib einen Veranstaltungstitel an.");return}P(!0);try{await s({id:e==null?void 0:e.id,title:o,description:u,location:h,start_date:x,end_date:N,co_manager_ids:L,task_areas:y})}catch(C){U(C.message||"Speichern der Veranstaltung fehlgeschlagen.")}finally{P(!1)}};return l.jsxs("div",{className:"space-y-6 max-w-4xl mx-auto animate-in fade-in duration-200 font-sans",children:[l.jsxs("div",{className:"flex items-center justify-between font-mono text-xs",children:[l.jsxs("button",{onClick:r,className:"px-3.5 py-1.5 rounded-sm bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-2 font-bold",children:[l.jsx(vd,{className:"w-4 h-4"})," [ ZURÜCK ZUR ÜBERSICHT ]"]}),l.jsxs("span",{className:"text-muted border border-grid px-2.5 py-0.5 rounded-sm",children:["MODE: ",e?"EVENT EDIT":"NEW EVENT"]})]}),l.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-2",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded-sm bg-blue-500/10 text-blue-500 border border-blue-500/20 flex items-center justify-center font-bold",children:e?l.jsx(Sr,{className:"w-5 h-5"}):l.jsx(Tr,{className:"w-5 h-5"})}),l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:e?"Veranstaltung & Schichten Bearbeiten":"Neue Veranstaltung Erstellen"}),l.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Konfiguriere Stammdaten, Co-Verwalter, Aufgabenfelder, Schichtzeiten & Qualifikationen"})]})]})}),b&&l.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[l.jsx(zn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:b})]}),l.jsxs("form",{onSubmit:z,className:"space-y-6",children:[l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs",children:[l.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"1. Stammdaten & Verwalter der Veranstaltung"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Titel der Veranstaltung"}),l.jsx("input",{type:"text",required:!0,value:o,onChange:g=>a(g.target.value),placeholder:"z. B. Sommerfest 2026",className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Startdatum"}),l.jsx("input",{type:"date",required:!0,value:x,onChange:g=>S(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Enddatum"}),l.jsx("input",{type:"date",required:!0,value:N,onChange:g=>w(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Ort (optional)"}),l.jsx("input",{type:"text",value:h,onChange:g=>v(g.target.value),placeholder:"z. B. Vereinsheim, Großer Saal",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Beschreibung (optional)"}),l.jsx("textarea",{rows:2,value:u,onChange:g=>m(g.target.value),placeholder:"Details zur Veranstaltung...",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs font-sans"})]}),c.length>0&&l.jsxs("div",{className:"sm:col-span-2 pt-3 border-t border-grid space-y-2",children:[l.jsxs("label",{className:"block text-main font-bold flex items-center gap-1.5",children:[l.jsx(bd,{className:"w-4 h-4 text-indigo-400"})," Co-Verwalter / Mit-Organisatoren (optional)"]}),l.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Wähle registrierte Benutzer aus, die dieses Event ebenfalls verwalten, bearbeiten und Gäste eintragen dürfen:"}),l.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:c.map(g=>{const C=L.includes(g.id);return l.jsxs("button",{type:"button",onClick:()=>{f(C?L.filter(M=>M!==g.id):[...L,g.id])},className:`px-3 py-1.5 rounded-sm text-xs font-mono font-bold transition flex items-center gap-1.5 border ${C?"bg-indigo-500/20 text-indigo-300 border-indigo-500/50 shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:[l.jsx(So,{className:`w-3.5 h-3.5 ${C?"text-indigo-400":"opacity-40"}`}),l.jsx("span",{children:g.display_name||g.username})]},g.id)})})]})]})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main flex items-center gap-2",children:[l.jsx(Zs,{className:"w-4 h-4 text-blue-500"})," 2. Aufgabenfelder & Schichten"]}),l.jsxs("button",{type:"button",onClick:X,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-blue-500/10 text-blue-500 border border-blue-500/20 hover:bg-blue-500/20 transition flex items-center gap-1",children:[l.jsx(at,{className:"w-3.5 h-3.5"})," BEREICH HINZUFÜGEN"]})]}),y.map((g,C)=>l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsx("input",{type:"text",required:!0,placeholder:"Name des Aufgabenfeldes (z. B. Tresendienst)",value:g.name,onChange:M=>G(C,"name",M.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field text-xs font-bold"}),l.jsx("button",{type:"button",onClick:()=>Y(C),className:"p-1.5 text-muted hover:text-red-400 transition",title:"Bereich entfernen",children:l.jsx(Ue,{className:"w-4 h-4"})})]}),l.jsxs("div",{className:"pl-3 border-l-2 border-grid space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between text-xs text-muted font-bold",children:[l.jsx("span",{children:"Schichten & Zeitfenster"}),l.jsxs("button",{type:"button",onClick:()=>ge(C),className:"text-blue-500 hover:underline flex items-center gap-1",children:[l.jsx(at,{className:"w-3 h-3"})," Schicht hinzufügen"]})]}),g.shifts.map((M,$)=>l.jsxs("div",{className:"p-3 rounded-sm bg-surface border border-grid space-y-2",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-2 items-center text-xs",children:[l.jsx("input",{type:"text",placeholder:"Titel",value:M.title,onChange:D=>ye(C,$,"title",D.target.value),className:"sm:col-span-3 px-2.5 py-1 rounded-sm input-field text-xs"}),l.jsx("input",{type:"date",title:"Schichtdatum",min:x,max:N,value:M.date||x,onChange:D=>ye(C,$,"date",D.target.value),className:"sm:col-span-3 px-2 py-1 rounded-sm input-field text-xs font-mono text-indigo-400 font-bold"}),l.jsx("input",{type:"text",placeholder:"Start (14:00)",value:M.start_time,onChange:D=>ye(C,$,"start_time",D.target.value),className:"sm:col-span-2 px-2.5 py-1 rounded-sm input-field text-xs"}),l.jsx("input",{type:"text",placeholder:"Ende (18:00)",value:M.end_time,onChange:D=>ye(C,$,"end_time",D.target.value),className:"sm:col-span-2 px-2.5 py-1 rounded-sm input-field text-xs"}),l.jsx("div",{className:"sm:col-span-1 flex items-center gap-1",children:l.jsx("input",{type:"number",min:"1",title:"Max. Plätze",value:M.max_participants,onChange:D=>ye(C,$,"max_participants",parseInt(D.target.value)||1),className:"w-full px-1.5 py-1 rounded-sm input-field text-xs font-bold text-center"})}),l.jsx("button",{type:"button",onClick:()=>Se(C,$),className:"sm:col-span-1 p-1 text-muted hover:text-red-400 text-center",title:"Schicht löschen",children:l.jsx(Ue,{className:"w-3.5 h-3.5 mx-auto"})})]}),t&&t.length>0&&l.jsxs("div",{className:"pt-2 border-t border-grid flex flex-wrap items-center gap-1.5",children:[l.jsx("span",{className:"text-[10px] text-muted font-bold mr-1",children:"Erforderlich:"}),t.map(D=>{const H=(M.required_skill_ids||[]).includes(D.id);return l.jsxs("button",{type:"button",onClick:()=>Ce(C,$,D.id),style:{backgroundColor:H?`${D.color}25`:"transparent",borderColor:H?D.color:"var(--color-border-grid)",color:H?D.color:"var(--color-text-muted)"},className:"px-2 py-0.5 rounded-sm text-[10px] border font-bold transition flex items-center gap-1",children:[l.jsx("span",{children:D.name}),H&&l.jsx(yt,{className:"w-3 h-3"})]},D.id)})]})]},$))]})]},C))]}),l.jsxs("div",{className:"flex items-center justify-between gap-3 pt-2 font-mono",children:[e&&i&&n&&(n.is_admin_user||n.is_staff||n.is_superuser||e.created_by===n.id||((I=e.created_by)==null?void 0:I.id)===n.id)?l.jsxs("button",{type:"button",onClick:()=>i(e),className:"px-4 py-2.5 rounded-sm text-xs font-bold bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 transition flex items-center gap-1.5",children:[l.jsx(Ue,{className:"w-4 h-4"})," VERANSTALTUNG LÖSCHEN"]}):l.jsx("div",{}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:r,className:"px-5 py-2.5 rounded-sm text-xs font-semibold text-muted hover:bg-surface-hover transition border border-grid",children:"Abbrechen"}),l.jsxs("button",{type:"submit",disabled:E,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[l.jsx(yt,{className:"w-4 h-4"}),E?"Speichern...":"Veranstaltung Speichern"]})]})]})]})]})}function Wp({onBack:e,onInstantiateTemplate:t,user:n,skills:r}){const[s,i]=k.useState([]),[o,a]=k.useState(!0),[u,m]=k.useState(""),[h,v]=k.useState(null),[x,S]=k.useState(""),[N,w]=k.useState(new Date().toISOString().split("T")[0]),[L,f]=k.useState(new Date().toISOString().split("T")[0]),[c,d]=k.useState(""),[y,j]=k.useState(!1),[E,P]=k.useState(!1),[b,U]=k.useState(""),[O,X]=k.useState(""),[Y,G]=k.useState([{name:"Tresendienst",description:"Getränkeausschank und Bar",shifts:[{title:"Frühschicht",start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]},{title:"Spätschicht",start_time:"22:00",end_time:"02:00",max_participants:3,required_skill_ids:[]}]}]);k.useEffect(()=>{ge()},[]);const ge=async()=>{a(!0);try{const g=await V("/templates/");i(g.results||g)}catch(g){m(g.message||"Laden der Vorlagen fehlgeschlagen.")}finally{a(!1)}},Se=g=>{v(g),S(g.name)},ye=async g=>{if(g.preventDefault(),!!h){j(!0);try{await t(h.id,{title:x,start_date:N,end_date:L,location:c})}catch(C){m(C.message||"Erstellen der Veranstaltung aus Vorlage fehlgeschlagen.")}finally{j(!1)}}},Ce=async g=>{if(g.preventDefault(),!b.trim()){m("Bitte gib einen Vorlagen-Namen an.");return}j(!0);try{const C={name:b,description:O,template_data:{task_areas:Y.map(M=>({name:M.name,description:M.description,shifts:(M.shifts||[]).map($=>({title:$.title,start_time:$.start_time,end_time:$.end_time,max_participants:$.max_participants,required_skill_ids:$.required_skill_ids}))}))}};await V("/templates/",{method:"POST",body:JSON.stringify(C)}),P(!1),U(""),X(""),ge()}catch(C){m(C.message||"Erstellen der Vorlage fehlgeschlagen.")}finally{j(!1)}},z=()=>{G([...Y,{name:"Neuer Bereich",description:"",shifts:[{title:"Schicht 1",start_time:"14:00",end_time:"18:00",max_participants:2,required_skill_ids:[]}]}])},I=g=>{const C=[...Y];C[g].shifts.push({title:`Schicht ${C[g].shifts.length+1}`,start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]}),G(C)};return l.jsxs("div",{className:"space-y-6 max-w-4xl mx-auto animate-in fade-in duration-200 font-sans",children:[l.jsxs("div",{className:"flex items-center justify-between font-mono text-xs",children:[l.jsxs("button",{onClick:e,className:"px-3.5 py-1.5 rounded-sm bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-2 font-bold",children:[l.jsx(vd,{className:"w-4 h-4"})," [ ZURÜCK ZUR ÜBERSICHT ]"]}),l.jsxs("span",{className:"text-muted border border-grid px-2.5 py-0.5 rounded-sm uppercase",children:["SYSTEM VORLAGEN (",s.length,")"]})]}),l.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-4",children:l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded-sm bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 flex items-center justify-center font-bold",children:l.jsx(Zs,{className:"w-5 h-5"})}),l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:"Veranstaltungs-Vorlagen Zentrale"}),l.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Erstelle neue Veranstaltungen mit voreingestellten Schichten und Aufgabenbereichen"})]})]}),n&&l.jsxs("button",{onClick:()=>P(!E),className:"px-3.5 py-2 rounded-sm text-xs font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1.5 shrink-0",children:[l.jsx(at,{className:"w-4 h-4"}),E?"Schließen":"Neue Vorlage Erstellen"]})]})}),u&&l.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[l.jsx(zn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:u})]}),E&&l.jsxs("form",{onSubmit:Ce,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs animate-in fade-in duration-200",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-indigo-400 border-b border-grid pb-2 flex items-center justify-between",children:[l.jsx("span",{children:"Neue Vorlage mit voreingestellten Schichten anlegen"}),l.jsxs("button",{type:"button",onClick:z,className:"text-xs font-mono font-bold bg-indigo-500/20 text-indigo-300 px-3 py-1 rounded-sm border border-indigo-500/30 flex items-center gap-1",children:[l.jsx(at,{className:"w-3.5 h-3.5"})," Bereich Hinzufügen"]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Vorlagen Name"}),l.jsx("input",{type:"text",required:!0,placeholder:"z. B. Standard Kneipenabend / Bar-Event",value:b,onChange:g=>U(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm font-bold"})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Beschreibung (optional)"}),l.jsx("input",{type:"text",placeholder:"z. B. Inklusive 2 Barschichten und Aufbau",value:O,onChange:g=>X(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]})]}),l.jsx("div",{className:"space-y-4 pt-2",children:Y.map((g,C)=>l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("input",{type:"text",required:!0,placeholder:"Bereichs-Name (z. B. Bar)",value:g.name,onChange:M=>{const $=[...Y];$[C].name=M.target.value,G($)},className:"flex-1 px-3 py-1 rounded-sm input-field text-xs font-bold"}),l.jsx("button",{type:"button",onClick:()=>{G(Y.filter((M,$)=>$!==C))},className:"text-muted hover:text-red-400 p-1",children:l.jsx(Ue,{className:"w-4 h-4"})})]}),l.jsxs("div",{className:"pl-3 border-l-2 border-grid space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between text-muted text-[11px] font-bold",children:[l.jsx("span",{children:"Voreingestellte Schichten"}),l.jsxs("button",{type:"button",onClick:()=>I(C),className:"text-indigo-400 hover:underline flex items-center gap-1",children:[l.jsx(at,{className:"w-3 h-3"})," Schicht hinzufügen"]})]}),g.shifts.map((M,$)=>l.jsxs("div",{className:"p-2.5 rounded-sm bg-surface border border-grid grid grid-cols-1 sm:grid-cols-12 gap-2 items-center text-xs",children:[l.jsx("input",{type:"text",placeholder:"Schichtname",value:M.title,onChange:D=>{const H=[...Y];H[C].shifts[$].title=D.target.value,G(H)},className:"sm:col-span-4 px-2 py-1 rounded-sm input-field text-xs"}),l.jsx("input",{type:"text",placeholder:"Start (18:00)",value:M.start_time,onChange:D=>{const H=[...Y];H[C].shifts[$].start_time=D.target.value,G(H)},className:"sm:col-span-2 px-2 py-1 rounded-sm input-field text-xs"}),l.jsx("input",{type:"text",placeholder:"Ende (22:00)",value:M.end_time,onChange:D=>{const H=[...Y];H[C].shifts[$].end_time=D.target.value,G(H)},className:"sm:col-span-2 px-2 py-1 rounded-sm input-field text-xs"}),l.jsxs("div",{className:"sm:col-span-3 flex items-center gap-1",children:[l.jsx("span",{className:"text-[10px] text-muted",children:"Plätze:"}),l.jsx("input",{type:"number",min:"1",value:M.max_participants,onChange:D=>{const H=[...Y];H[C].shifts[$].max_participants=parseInt(D.target.value)||1,G(H)},className:"w-full px-2 py-1 rounded-sm input-field text-xs font-bold"})]}),l.jsx("button",{type:"button",onClick:()=>{const D=[...Y];D[C].shifts=D[C].shifts.filter((H,ae)=>ae!==$),G(D)},className:"sm:col-span-1 p-1 text-muted hover:text-red-400 text-center",children:l.jsx(Ue,{className:"w-3.5 h-3.5 mx-auto"})})]},$))]})]},C))}),l.jsxs("div",{className:"pt-3 flex justify-end gap-2 border-t border-grid",children:[l.jsx("button",{type:"button",onClick:()=>P(!1),className:"px-4 py-2 rounded-sm text-xs font-semibold text-muted hover:bg-surface-hover transition border border-grid",children:"Abbrechen"}),l.jsxs("button",{type:"submit",disabled:y,style:{backgroundColor:"var(--brand-primary)"},className:"px-5 py-2 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-1.5",children:[l.jsx(yt,{className:"w-4 h-4"})," Vorlage Speichern"]})]})]}),l.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[l.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main",children:"Verfügbare Vorlagen"}),o?l.jsx("div",{className:"hallmark-panel p-8 text-center text-muted",children:"Lade Vorlagen..."}):s.length===0?l.jsx("div",{className:"hallmark-panel p-8 text-center text-muted italic",children:'[ Noch keine Vorlagen gespeichert. Klicke oben auf "Neue Vorlage Erstellen" um Vorlagen mit voreingestellten Schichten anzulegen. ]'}):l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:s.map(g=>{var C;return l.jsxs("div",{onClick:()=>Se(g),className:`hallmark-panel p-5 rounded-sm border cursor-pointer transition space-y-3 ${(h==null?void 0:h.id)===g.id?"bg-indigo-500/10 border-indigo-500 shadow-md":"bg-surface border-grid hover:border-muted"}`,children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h4",{className:"font-serif text-base font-bold text-main uppercase",children:g.name}),(h==null?void 0:h.id)===g.id&&l.jsx("span",{className:"text-[10px] font-mono text-indigo-400 bg-indigo-500/20 px-2 py-0.5 rounded-sm border border-indigo-500/30 font-bold",children:"[ AUSGEWÄHLT ]"})]}),g.description&&l.jsx("p",{className:"text-xs font-sans text-muted",children:g.description}),((C=g.template_data)==null?void 0:C.task_areas)&&g.template_data.task_areas.length>0&&l.jsxs("div",{className:"space-y-2 pt-2 border-t border-grid text-[11px]",children:[l.jsx("div",{className:"font-bold text-muted uppercase text-[10px]",children:"📌 Voreingestellte Schichten:"}),g.template_data.task_areas.map((M,$)=>{var D;return l.jsxs("div",{className:"bg-subtle p-2 rounded-sm border border-grid space-y-1",children:[l.jsxs("div",{className:"font-bold text-main flex items-center justify-between",children:[l.jsx("span",{children:M.name}),l.jsxs("span",{className:"text-[10px] text-muted font-normal",children:[((D=M.shifts)==null?void 0:D.length)||0," Schichten"]})]}),l.jsx("div",{className:"flex flex-wrap gap-1",children:(M.shifts||[]).map((H,ae)=>l.jsxs("span",{className:"px-2 py-0.5 rounded-sm bg-surface border border-grid text-[10px] flex items-center gap-1 font-mono",children:[l.jsx(Nr,{className:"w-3 h-3 text-muted shrink-0"}),l.jsx("strong",{className:"text-main",children:H.title}),l.jsxs("span",{className:"text-muted",children:["(",H.start_time,"-",H.end_time,", ",H.max_participants," Plätze)"]})]},ae))})]},$)})]}),l.jsxs("div",{className:"text-[10px] text-muted pt-2 border-t border-grid flex items-center justify-between",children:[l.jsxs("span",{children:["Erstellt von: ",l.jsx("strong",{children:g.created_by_name||"Admin"})]}),l.jsx("span",{className:"text-indigo-400 font-bold",children:"Klick zum Auswählen"})]})]},g.id)})})]}),h&&l.jsxs("form",{onSubmit:ye,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs animate-in fade-in duration-200",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-indigo-400 border-b border-grid pb-2",children:['Neue Veranstaltung aus Vorlage "',h.name,'" Erstellen']}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Titel der Veranstaltung"}),l.jsx("input",{type:"text",required:!0,value:x,onChange:g=>S(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm font-bold"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Startdatum"}),l.jsx("input",{type:"date",required:!0,value:N,onChange:g=>w(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Enddatum"}),l.jsx("input",{type:"date",required:!0,value:L,onChange:g=>f(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Ort (optional)"}),l.jsx("input",{type:"text",value:c,onChange:g=>d(g.target.value),placeholder:"z. B. Großer Saal",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]})]}),l.jsx("div",{className:"pt-3 flex justify-end border-t border-grid",children:l.jsxs("button",{type:"submit",disabled:y,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[l.jsx(Tp,{className:"w-4 h-4 fill-white"}),y?"Erstellen...":"Veranstaltung Jetzt Aus Vorlage Erstellen"]})})]})]})}function Kp(){const[e,t]=k.useState(null),[n,r]=k.useState(null),[s,i]=k.useState([]),[o,a]=k.useState([]),[u,m]=k.useState(null),[h,v]=k.useState(null),[x,S]=k.useState(!0),[N,w]=k.useState("home"),[L,f]=k.useState(!1),[c,d]=k.useState(!1),[y,j]=k.useState(null),[E,P]=k.useState(!1),[b,U]=k.useState(!1),[O,X]=k.useState(localStorage.getItem("theme_mode")||"auto"),[Y,G]=k.useState(null),[ge,Se]=k.useState(null);k.useEffect(()=>{window.addEventListener("beforeinstallprompt",T=>{T.preventDefault(),Se(T)}),C()},[]),k.useEffect(()=>{localStorage.setItem("theme_mode",O);const T=()=>{let R=O;O==="auto"&&(R=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),document.documentElement.setAttribute("data-theme",R)};if(T(),O==="auto"){const R=window.matchMedia("(prefers-color-scheme: dark)"),Z=()=>T();return R.addEventListener("change",Z),()=>R.removeEventListener("change",Z)}},[O]),k.useEffect(()=>{n!=null&&n.primary_color&&(document.documentElement.style.setProperty("--brand-primary",n.primary_color),document.documentElement.style.setProperty("--brand-secondary",n.secondary_color||n.primary_color))},[n]);const[ye,Ce]=k.useState(null),[z,I]=k.useState(null),g=T=>{G(T),setTimeout(()=>G(null),5e3)},C=async()=>{S(!0);try{try{const K=await V("/branding/");r(K)}catch{}if(_i())try{const K=await V("/users/me/");t(K),!K.is_admin_user&&!K.is_staff&&!K.is_superuser&&N==="admin"&&w("home")}catch{sr(null),t(null),w("home")}const T=new URLSearchParams(window.location.search),R=T.get("verify_email");if(R)try{const K=await V("/users/verify-email/",{method:"POST",body:JSON.stringify({token:R})});sr(K.token),t(K.user),g(K.message||"✅ E-Mail-Adresse erfolgreich bestätigt!"),window.history.replaceState({},document.title,window.location.pathname)}catch(K){g(`⚠️ E-Mail Bestätigung: ${K.message}`)}const Z=T.get("claim_token"),nt=T.get("guest_name");Z&&nt&&(Ce(Z),I(nt),_i()||f(!0)),await $(),await D()}catch(T){console.error(T)}finally{S(!1)}},M=async T=>{try{const R=await V(`/users/signups/${T.id}/generate-claim-link/`,{method:"POST"}),Z=`${window.location.origin}/?claim_token=${R.token}&guest_name=${encodeURIComponent(R.guest_name)}`;navigator.clipboard?(await navigator.clipboard.writeText(Z),g(`✅ Einladungs-Link für ${R.guest_name} in Zwischenablage kopiert!`)):prompt(`Einladungs-Link für ${R.guest_name} kopieren:`,Z)}catch(R){alert(R.message||"Fehler beim Erstellen des Links.")}},$=async()=>{try{const T=await V("/skills/");i(T.results||T)}catch{}},D=async()=>{try{const T=await V("/events/"),R=T.results||T;a(R),R.length>0&&!u?(m(R[0].id),H(R[0].id)):u&&H(u)}catch{}},H=async T=>{try{const R=await V(`/events/${T}/matrix/`);v(R)}catch{}},ae=T=>{m(T),H(T),w("schedule")},tt=()=>{sr(null),t(null),w("home"),g("Erfolgreich abgemeldet."),u&&H(u)},Pr=(T,R)=>{t(T),T&&!T.is_admin_user&&!T.is_staff&&!T.is_superuser&&N==="admin"&&w("home"),g(R||"Erfolgreich angemeldet!"),u&&H(u)},Lr=async T=>{if(!e)j(T),d(!0);else try{const R=await V(`/shifts/${T.id}/signup/`,{method:"POST"});g(R.message||"Erfolgreich für Schicht eingetragen!"),u&&H(u)}catch(R){g(`Fehler: ${R.message}`)}},Js=async T=>{if(!y)return;const R=await V(`/shifts/${y.id}/signup/`,{method:"POST",body:JSON.stringify(T)});g(R.message||"Als Gast eingetragen!"),u&&H(u)},Bt=async T=>{try{const R=await V(`/shifts/${T.id}/signup/`,{method:"DELETE"});g(R.message||"Eintragung storniert."),u&&H(u)}catch(R){g(`Fehler: ${R.message}`)}},Rn=async T=>{if(!(!T||!T.id)&&window.confirm(`Möchtest du die Veranstaltung "${T.title}" und alle zugehörigen Schichten wirklich unwiderruflich löschen?`))try{await V(`/events/${T.id}/`,{method:"DELETE"}),g(`Veranstaltung "${T.title}" wurde erfolgreich gelöscht.`),u===T.id&&m(null),N==="event-editor"&&w("home"),D()}catch(R){g(`Fehler beim Löschen: ${R.message}`)}},[zr,Ut]=k.useState(null),Mr=async T=>{let R=T.id;R?await V(`/events/${R}/`,{method:"PATCH",body:JSON.stringify({title:T.title,description:T.description,location:T.location,start_date:T.start_date,end_date:T.end_date,co_manager_ids:T.co_manager_ids||[]})}):R=(await V("/events/",{method:"POST",body:JSON.stringify({title:T.title,description:T.description,location:T.location,start_date:T.start_date,end_date:T.end_date,co_manager_ids:T.co_manager_ids||[]})})).id;for(let Z of T.task_areas){if(!Z.name)continue;let nt=Z.id;nt?await V(`/task-areas/${nt}/`,{method:"PATCH",body:JSON.stringify({name:Z.name,description:Z.description||""})}):nt=(await V("/task-areas/",{method:"POST",body:JSON.stringify({event:R,name:Z.name,description:Z.description||""})})).id;for(let K of Z.shifts){const wt=K.date||T.start_date;K.id?await V(`/shifts/${K.id}/`,{method:"PATCH",body:JSON.stringify({title:K.title,date:wt,start_time:K.start_time,end_time:K.end_time,max_participants:K.max_participants,required_skill_ids:K.required_skill_ids||[]})}):await V("/shifts/",{method:"POST",body:JSON.stringify({task_area:nt,title:K.title,date:wt,start_time:K.start_time,end_time:K.end_time,max_participants:K.max_participants,required_skill_ids:K.required_skill_ids||[]})})}}g(T.id?"Veranstaltung & Schichten aktualisiert!":"Veranstaltung erfolgreich erstellt!"),await D(),ae(R)},Xs=async(T,R)=>{const Z=await V(`/templates/${T}/instantiate/`,{method:"POST",body:JSON.stringify(R)});g("Veranstaltung aus Vorlage erstellt!"),await D(),Z.id&&ae(Z.id)},Ht=()=>{u&&window.open(`/api/events/${u}/export_pdf/`,"_blank")},el=()=>{window.print()},Ar=()=>{ge&&(ge.prompt(),ge.userChoice.then(T=>{T.outcome==="accepted"&&g("PWA Installation gestartet!"),Se(null)}))};return l.jsxs("div",{className:"min-h-screen bg-canvas text-main flex flex-col font-sans selection:bg-surface-hover transition-colors duration-200",children:[Y&&l.jsxs("div",{className:"fixed bottom-6 right-6 z-50 bg-emerald-600 text-white px-4 py-2.5 rounded-sm shadow-2xl font-mono text-xs flex items-center gap-2 border border-emerald-400 animate-in fade-in slide-in-from-bottom-3 duration-200",children:[l.jsx(yt,{className:"w-4 h-4"}),l.jsx("span",{children:Y})]}),l.jsx(Op,{branding:n,user:e,activeTab:N,onChangeTab:w,themeMode:O,onChangeThemeMode:X,onLogout:tt,onOpenAuth:()=>f(!0),onOpenCreateEvent:()=>{Ut(null),w("event-editor")},onOpenTemplates:()=>w("templates"),onOpenProfile:()=>U(!0),onOpenAdmin:()=>w("admin"),pwaInstallPrompt:!!ge,onInstallPwa:Ar}),l.jsx("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-8 space-y-6",children:x?l.jsx("div",{className:"hallmark-panel p-16 text-center text-xs text-muted font-mono border border-grid",children:"Lade Daten..."}):N==="home"?l.jsx(Bp,{events:o,user:e,onSelectEvent:ae,onOpenCreateEvent:()=>{Ut(null),w("event-editor")},onToggleEventActive:async T=>{try{await V(`/events/${T.id}/`,{method:"PATCH",body:JSON.stringify({is_active:T.is_active===!1})}),D()}catch(R){alert(R.message||"Aktion fehlgeschlagen.")}},onEditEvent:T=>{Ut(T),w("event-editor")},onDeleteEvent:Rn,branding:n}):N==="calendar"?l.jsx(Up,{events:o,onSelectEvent:ae,branding:n}):N==="admin"&&e&&(e.is_admin_user||e.is_staff||e.is_superuser)?l.jsx(Hp,{branding:n,onRefreshBranding:async()=>{const T=await V("/branding/");r(T)},onRefreshEvents:D,skills:s,onRefreshSkills:$}):N==="event-editor"?l.jsx(Qp,{eventToEdit:zr,skills:s,user:e,onBack:()=>w("schedule"),onSubmit:Mr,onDeleteEvent:Rn}):N==="templates"?l.jsx(Wp,{onBack:()=>w("schedule"),onInstantiateTemplate:Xs,user:e,skills:s}):l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between gap-4 overflow-x-auto pb-2 no-scrollbar font-mono",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-bold text-muted uppercase tracking-wider whitespace-nowrap",children:"Ausgewähltes Event:"}),o.map(T=>{const R=u===T.id;return l.jsx("button",{onClick:()=>ae(T.id),style:{backgroundColor:R?(n==null?void 0:n.primary_color)||"var(--brand-primary)":void 0,borderColor:R?(n==null?void 0:n.primary_color)||"var(--brand-primary)":void 0},className:`px-3.5 py-1.5 rounded-sm text-xs font-bold transition whitespace-nowrap border ${R?"text-white shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:T.title},T.id)})]}),e&&l.jsxs("button",{onClick:()=>{Ut(null),w("event-editor")},className:"px-3.5 py-1.5 rounded-sm text-xs font-bold bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 shrink-0",children:[l.jsx(at,{className:"w-4 h-4"})," Neues Event"]})]}),l.jsx(Ip,{event:h,user:e,onSignupClick:Lr,onCancelClick:Bt,onEditEvent:T=>{Ut(T),w("event-editor")},onDeleteEvent:Rn,onRemoveUserFromShift:async(T,R)=>{try{const Z=await V(`/shifts/${T.id}/signup/${R}/`,{method:"DELETE"});g(Z.message||"Eintragung entfernt."),D(),u&&ae(u)}catch(Z){alert(Z.message||"Entfernen der Person fehlgeschlagen.")}},onGenerateClaimLink:M,onExportPdf:Ht,onPrintView:el})]})}),l.jsx("footer",{className:"border-t border-grid py-6 text-center text-xs text-muted font-mono no-print",children:l.jsxs("p",{children:[(n==null?void 0:n.app_name)||"Veranstaltungsschichtplaner"," • PWA Enabled • PostgreSQL & Docker Ready"]})}),L&&l.jsx(Fp,{onClose:()=>{f(!1),Ce(null),I(null)},onSuccess:Pr,claimToken:ye,prefilledGuestName:z}),c&&l.jsx($p,{shift:y,onClose:()=>d(!1),onSubmit:Js})]})}zl.createRoot(document.getElementById("root")).render(l.jsx(sf.StrictMode,{children:l.jsx(Kp,{})})); + */const _d=B("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Op({branding:e,user:t,activeTab:n,onChangeTab:r,themeMode:s,onChangeThemeMode:i,onLogout:o,onOpenAuth:a,onOpenCreateEvent:u,onOpenTemplates:m,onOpenProfile:h,onOpenAdmin:v,pwaInstallPrompt:x,onInstallPwa:S}){const N=(e==null?void 0:e.primary_color)||"var(--brand-primary)",w=()=>{i(s==="dark"?"light":s==="light"?"auto":"dark")};return l.jsxs("header",{className:"bg-surface border-b border-grid sticky top-0 z-40",children:[l.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-16 flex items-center justify-between gap-4",children:[l.jsxs("div",{className:"flex items-center space-x-3 shrink-0",children:[l.jsx("div",{onClick:()=>r("home"),style:{backgroundColor:N},className:"w-8 h-8 rounded-sm flex items-center justify-center text-white font-bold cursor-pointer shadow-sm",children:e!=null&&e.logo_url?l.jsx("img",{src:e.logo_url,alt:"Logo",className:"w-4 h-4 object-contain"}):l.jsx(Tr,{className:"w-4 h-4"})}),l.jsxs("div",{onClick:()=>r("home"),className:"cursor-pointer",children:[l.jsx("h1",{className:"font-serif text-base font-bold tracking-tight text-main leading-none",children:(e==null?void 0:e.app_name)||"Schichtplaner"}),l.jsx("div",{className:"text-[10px] font-mono text-muted mt-1 uppercase tracking-wider flex items-center gap-1.5",children:t?l.jsxs("span",{className:"text-emerald-500 font-semibold",children:["[ ",t.display_name||t.username," ]"]}):l.jsx("span",{className:"text-amber-500 font-semibold",children:"[ GAST-MODUS ]"})})]})]}),l.jsxs("nav",{className:"hidden md:flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>r("home"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="home"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[l.jsx(eu,{className:"w-3.5 h-3.5"})," Startseite"]}),l.jsxs("button",{onClick:()=>r("calendar"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="calendar"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[l.jsx(Xa,{className:"w-3.5 h-3.5"})," Kalender"]}),((t==null?void 0:t.is_admin_user)||(t==null?void 0:t.is_staff)||(t==null?void 0:t.is_superuser))&&l.jsxs("button",{onClick:()=>r("admin"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="admin"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[l.jsx(nu,{className:"w-3.5 h-3.5 text-indigo-400"})," Admin"]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("button",{onClick:w,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5",title:`Design-Modus: ${s.toUpperCase()}`,children:s==="dark"?l.jsxs(l.Fragment,{children:[l.jsx(Cp,{className:"w-3.5 h-3.5 text-indigo-400"}),l.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"DARK"})]}):s==="light"?l.jsxs(l.Fragment,{children:[l.jsx(Ap,{className:"w-3.5 h-3.5 text-amber-500"}),l.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"LIGHT"})]}):l.jsxs(l.Fragment,{children:[l.jsx(Ep,{className:"w-3.5 h-3.5 text-blue-500"}),l.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"AUTO"})]})}),x&&l.jsxs("button",{onClick:S,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-emerald-500/10 text-emerald-500 border border-emerald-500/20 hover:bg-emerald-500/20 transition flex items-center gap-1",children:[l.jsx(jd,{className:"w-3 h-3"})," PWA"]}),t?l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:u,style:{backgroundColor:N},className:"h-8 px-3 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1 shadow-sm hover:brightness-110",children:[l.jsx(at,{className:"w-3.5 h-3.5"})," Event"]}),l.jsxs("button",{onClick:m,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition hidden sm:flex items-center gap-1",title:"Vorlagen",children:[l.jsx(Zs,{className:"w-3.5 h-3.5 text-muted"})," Vorlagen"]}),l.jsxs("button",{onClick:h,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1",title:"Profil & Namen ändern",children:[l.jsx(Sr,{className:"w-3.5 h-3.5 text-amber-500"})," Profil"]}),(t.is_admin_user||t.is_staff||t.is_superuser)&&l.jsxs("button",{onClick:()=>r("admin"),className:`h-8 px-2.5 rounded-sm text-xs font-mono transition flex items-center gap-1 border ${n==="admin"?"bg-indigo-500/20 text-indigo-300 border-indigo-500/40 font-bold":"bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border-indigo-500/30"}`,title:"Admin-Zentrale",children:[l.jsx(nu,{className:"w-3.5 h-3.5"})," Admin"]}),l.jsx("div",{className:"h-4 w-px bg-grid mx-1"}),l.jsx("button",{onClick:o,className:"h-8 w-8 rounded-sm text-muted hover:text-red-500 hover:bg-red-500/10 border border-transparent hover:border-red-500/20 transition flex items-center justify-center",title:"Abmelden",children:l.jsx(_p,{className:"w-3.5 h-3.5"})})]}):l.jsxs("button",{onClick:a,style:{backgroundColor:N},className:"h-8 px-3.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 flex items-center gap-1.5 shadow-sm",children:[l.jsx(cs,{className:"w-3.5 h-3.5"})," Anmelden"]})]})]}),l.jsxs("div",{className:"flex md:hidden items-center justify-around border-t border-grid py-2 bg-subtle text-xs font-mono",children:[l.jsxs("button",{onClick:()=>r("home"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="home"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[l.jsx(eu,{className:"w-3.5 h-3.5"})," Start"]}),l.jsxs("button",{onClick:()=>r("calendar"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="calendar"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[l.jsx(Xa,{className:"w-3.5 h-3.5"})," Termine"]}),l.jsxs("button",{onClick:()=>r("schedule"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="schedule"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[l.jsx(Dp,{className:"w-3.5 h-3.5"})," Schichtplan"]})]})]})}function Ip({event:e,user:t,onSignupClick:n,onCancelClick:r,onRemoveUserFromShift:s,onGenerateClaimLink:i,onExportPdf:o,onPrintView:a,onEditEvent:u,onDeleteEvent:m}){var S,N,w;if(!e||!e.task_areas||e.task_areas.length===0)return l.jsxs("div",{className:"hallmark-panel rounded-sm p-12 text-center border border-grid font-mono",children:[l.jsx(Nr,{className:"w-8 h-8 text-muted mx-auto mb-3"}),l.jsx("h3",{className:"font-serif text-xl font-bold text-main uppercase",children:"Keine Aufgabenfelder vorhanden"}),l.jsx("p",{className:"text-xs text-muted mt-1 mb-4",children:"[ Event hat noch keine definierten Aufgabenfelder oder Schichten ]"}),t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((S=e==null?void 0:e.created_by)==null?void 0:S.id)===t.id||(e==null?void 0:e.co_managers)&&e.co_managers.some(L=>typeof L=="object"?L.id===t.id:L===t.id))&&u&&l.jsxs("button",{onClick:()=>u(e),className:"px-4 py-2 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border border-indigo-500/30 font-bold text-xs inline-flex items-center gap-2",children:[l.jsx(Sr,{className:"w-4 h-4"})," SCHICHTEN & BEREICHE ANLEGEN"]})]});const h=!t,v=t&&(e==null?void 0:e.co_managers)&&e.co_managers.some(L=>typeof L=="object"?L.id===t.id:L===t.id),x=t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((N=e==null?void 0:e.created_by)==null?void 0:N.id)===t.id||v);return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid flex flex-col md:flex-row md:items-center justify-between gap-4",children:[l.jsxs("div",{className:"space-y-1 font-mono",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted mb-1",children:[l.jsxs("span",{className:"bg-subtle px-2.5 py-0.5 rounded-sm border border-grid font-bold text-main",children:[new Date(e.start_date).toLocaleDateString("de-DE")," — ",new Date(e.end_date).toLocaleDateString("de-DE")]}),e.location&&l.jsxs("span",{className:"flex items-center gap-1 text-muted",children:[l.jsx(No,{className:"w-3.5 h-3.5 shrink-0"}),e.location]}),e.is_active===!1&&l.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-amber-500/10 text-amber-500 border border-amber-500/20 font-bold",children:"[ DEAKTIVIERT ]"})]}),l.jsx("h2",{className:"font-serif text-3xl sm:text-4xl font-bold uppercase tracking-tight text-main",children:e.title}),e.description&&l.jsx("p",{className:"text-xs font-sans text-muted max-w-2xl mt-1",children:e.description})]}),l.jsxs("div",{className:"flex items-center gap-2 no-print font-mono text-xs shrink-0",children:[x&&u&&l.jsxs("button",{onClick:()=>u(e),className:"px-3.5 py-1.5 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border border-indigo-500/30 transition flex items-center gap-1.5 font-bold",title:"Schichten und Aufgabenbereiche für diese Veranstaltung bearbeiten",children:[l.jsx(Sr,{className:"w-3.5 h-3.5"})," SCHICHTEN BEARBEITEN"]}),t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((w=e==null?void 0:e.created_by)==null?void 0:w.id)===t.id)&&m&&l.jsxs("button",{onClick:()=>m(e),className:"px-3.5 py-1.5 rounded-sm bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/30 transition flex items-center gap-1.5 font-bold",title:"Diese Veranstaltung unwiderruflich löschen",children:[l.jsx(Ue,{className:"w-3.5 h-3.5"})," LÖSCHEN"]}),l.jsxs("button",{onClick:a,className:"px-3.5 py-1.5 rounded-sm bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 font-bold",children:[l.jsx(Pp,{className:"w-3.5 h-3.5"})," DRUCKEN"]}),l.jsxs("button",{onClick:o,className:"px-3.5 py-1.5 rounded-sm bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 font-bold",children:[l.jsx(Sp,{className:"w-3.5 h-3.5"})," PDF"]})]})]}),h&&l.jsxs("div",{className:"p-3.5 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs font-mono flex items-center gap-2",children:[l.jsx(Sd,{className:"w-4 h-4 shrink-0 text-amber-500"}),l.jsxs("span",{children:["[ GAST-DATENSCHUTZ ]: Belegungszahlen sichtbar, Namensanzeige aus Datenschutzgründen ",l.jsx("strong",{children:"anonymisiert"}),"."]})]}),l.jsx("div",{className:"hallmark-panel rounded-sm border border-grid overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-left border-collapse",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-subtle border-b border-grid text-[11px] font-mono text-muted uppercase tracking-wider",children:[l.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Aufgabenfeld"}),l.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Schicht & Zeitraum"}),l.jsx("th",{className:"py-3.5 px-4 w-1/6",children:"Qualifikation"}),l.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Belegung & Personen"}),l.jsx("th",{className:"py-3.5 px-4 w-1/6 text-right",children:"Aktion"})]})}),l.jsx("tbody",{className:"divide-y divide-grid text-xs font-sans",children:e.task_areas.map(L=>!L.shifts||L.shifts.length===0?l.jsxs("tr",{children:[l.jsx("td",{className:"py-3.5 px-4 font-serif text-lg font-bold text-main uppercase",children:L.name}),l.jsx("td",{colSpan:4,className:"py-3.5 px-4 text-muted font-mono text-[11px]",children:"[ Keine Schichten angelegt ]"})]},`area-${L.id}`):L.shifts.map((f,c)=>{const d=c===0,y=f.is_full,E=!!(t?f.signups.find(b=>!b.is_guest&&b.display_name===t.display_name):null),P=f.required_skills&&f.required_skills.length>0;return l.jsxs("tr",{className:"hover:bg-surface-hover/60 transition",children:[d?l.jsxs("td",{rowSpan:L.shifts.length,className:"py-3.5 px-4 font-serif text-lg font-bold text-main uppercase bg-subtle/80 align-top border-r border-grid",children:[l.jsx("div",{children:L.name}),L.description&&l.jsx("div",{className:"text-[11px] font-sans font-normal text-muted mt-0.5",children:L.description})]}):null,l.jsxs("td",{className:"py-3.5 px-4",children:[l.jsxs("div",{className:"font-semibold text-main flex items-center gap-2 flex-wrap",children:[l.jsx("span",{children:f.title}),f.date&&l.jsxs("span",{className:"text-[10px] font-mono font-bold text-indigo-400 bg-indigo-500/10 px-2 py-0.5 rounded-sm border border-indigo-500/20",children:["📅 ",new Date(f.date+"T00:00:00").toLocaleDateString("de-DE",{weekday:"short",day:"2-digit",month:"2-digit"})]})]}),l.jsxs("div",{className:"text-[11px] font-mono text-muted flex items-center gap-1 mt-0.5",children:[l.jsx(Nr,{className:"w-3 h-3 text-muted shrink-0"}),l.jsxs("span",{children:[f.start_time," — ",f.end_time," Uhr"]})]})]}),l.jsx("td",{className:"py-3.5 px-4 font-mono",children:P?l.jsx("div",{className:"flex flex-wrap gap-1",children:f.required_skills.map(b=>l.jsxs("span",{style:{backgroundColor:`${b.color}15`,borderColor:`${b.color}35`,color:b.color},className:"px-2 py-0.5 rounded-sm text-[10px] font-semibold border flex items-center gap-1",children:[l.jsx(wp,{className:"w-3 h-3 shrink-0"})," ",b.name]},b.id))}):l.jsx("span",{className:"text-[11px] text-muted",children:"—"})}),l.jsxs("td",{className:"py-3.5 px-4 font-mono",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs("span",{className:`px-2 py-0.5 rounded-sm text-[11px] font-bold border ${y?"bg-red-500/10 text-red-500 border-red-500/20":"bg-emerald-500/10 text-emerald-500 border-emerald-500/20"}`,children:["[ ",f.signups_count," / ",f.max_participants," BELEGT ]"]})}),l.jsx("div",{className:"mt-2 space-y-1 font-sans",children:f.signups.map(b=>l.jsxs("div",{className:"text-[11px] text-muted flex items-center justify-between gap-2 p-1.5 rounded-sm bg-subtle border border-grid",children:[l.jsxs("div",{className:"flex items-center gap-1.5 truncate",children:[l.jsx(So,{className:"w-3 h-3 text-muted shrink-0"}),l.jsx("span",{className:"truncate",children:b.display_name}),b.is_guest&&l.jsx("span",{className:"text-[9px] font-mono text-amber-500 px-1 rounded-sm bg-amber-500/10 border border-amber-500/20 font-bold",children:"GAST"})]}),l.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t&&b.is_guest&&i&&l.jsxs("button",{onClick:()=>i(b),className:"text-indigo-400 hover:text-indigo-300 transition p-1 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 border border-indigo-500/20 flex items-center gap-1 text-[10px] font-mono font-bold",title:"Konto-Einladungslink für diese Gast-Eintragung kopieren",children:[l.jsx(Rp,{className:"w-3 h-3"})," LINK"]}),x&&s&&l.jsx("button",{onClick:()=>s(f,b.id),className:"text-muted hover:text-red-500 transition p-1 rounded-sm hover:bg-red-500/10",title:"Person aus dieser Schicht entfernen",children:l.jsx(ru,{className:"w-3.5 h-3.5"})})]})]},b.id))})]}),l.jsx("td",{className:"py-3.5 px-4 text-right font-mono",children:E?l.jsxs("button",{onClick:()=>r(f),className:"px-3 py-1.5 rounded-sm text-xs font-semibold bg-red-500/10 hover:bg-red-500/20 text-red-500 border border-red-500/20 transition flex items-center gap-1 ml-auto",children:[l.jsx(ru,{className:"w-3.5 h-3.5"})," AUSTRAGEN"]}):y?l.jsx("span",{className:"text-xs text-muted font-bold",children:"[ VOLL ]"}):l.jsxs("button",{onClick:()=>n(f),style:{backgroundColor:"var(--brand-primary)"},className:"px-3.5 py-1.5 rounded-sm text-xs font-bold text-white transition hover:brightness-110 flex items-center gap-1 ml-auto shadow-sm",children:[l.jsx(yt,{className:"w-3.5 h-3.5"})," EINTRAGEN"]})})]},`shift-${f.id}`)}))})]})})})]})}function $p({shift:e,onClose:t,onSubmit:n}){const[r,s]=k.useState(""),[i,o]=k.useState(""),[a,u]=k.useState(!1),[m,h]=k.useState(""),[v,x]=k.useState(!1),S=k.useRef(null);k.useEffect(()=>{const w=localStorage.getItem("guest_display_name")||"";w&&s(w)},[]),k.useEffect(()=>{const w=S.current;if(!w)return;const L=c=>{var y;if(((y=c==null?void 0:c.detail)==null?void 0:y.verified)||w.isValid&&w.isValid()){u(!0);const j="acaptcha-verified-"+Math.random().toString(36).substring(2,10);o(j)}},f=()=>{u(!1),o("")};return w.addEventListener("verified",L),w.addEventListener("statuschange",L),w.addEventListener("reset",f),w.isValid&&w.isValid()&&L({detail:{verified:!0}}),()=>{w.removeEventListener("verified",L),w.removeEventListener("statuschange",L),w.removeEventListener("reset",f)}},[]);const N=async w=>{if(w.preventDefault(),h(""),!r.trim()){h("Bitte gib deinen Namen ein.");return}const L=S.current;if(!(a||L&&L.isValid&&L.isValid())){h("Bitte löse zuerst das Captcha.");return}const c=i||"acaptcha-verified-"+Math.random().toString(36).substring(2,10);localStorage.setItem("guest_display_name",r.trim()),x(!0);try{await n({guest_name:r.trim(),captcha_token:c}),t()}catch(d){h(d.message||"Eintragen fehlgeschlagen.")}finally{x(!1)}};return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/80 backdrop-blur-sm",children:l.jsxs("div",{className:"glass-panel w-full max-w-md rounded-2xl border border-slate-800 p-6 shadow-2xl relative animate-in fade-in zoom-in-95 duration-200",children:[l.jsx("button",{onClick:t,className:"absolute top-4 right-4 p-2 text-slate-400 hover:text-white rounded-lg transition",children:l.jsx(_d,{className:"w-5 h-5"})}),l.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[l.jsx("div",{className:"w-10 h-10 rounded-xl bg-blue-500/10 text-blue-400 border border-blue-500/20 flex items-center justify-center",children:l.jsx(So,{className:"w-5 h-5"})}),l.jsxs("div",{children:[l.jsx("h3",{className:"font-bold text-lg text-white",children:"Als Gast eintragen"}),l.jsxs("p",{className:"text-xs text-slate-400",children:["Schicht: ",e==null?void 0:e.title," (",e==null?void 0:e.start_time," - ",e==null?void 0:e.end_time,")"]})]})]}),m&&l.jsxs("div",{className:"mb-4 p-3 rounded-xl bg-red-500/10 border border-red-500/20 text-red-400 text-xs flex items-center gap-2",children:[l.jsx(Mn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:m})]}),l.jsxs("form",{onSubmit:N,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1",children:"Dein Name / Anzeigename"}),l.jsx("input",{type:"text",required:!0,value:r,onChange:w=>s(w.target.value),placeholder:"z. B. Alex Muster",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900 border border-slate-800 text-white text-sm focus:outline-none focus:border-blue-500 transition"}),l.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"Dein Name wird in deiner Sitzung gespeichert. Falls du später ein Konto mit diesem Namen erstellst, werden deine Gast-Schichten automatisch übertragen!"})]}),l.jsxs("div",{className:"p-4 rounded-xl bg-slate-900/90 border border-slate-800 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-xs font-semibold text-slate-300 flex items-center gap-1.5 font-mono",children:[l.jsx(Mp,{className:"w-4 h-4 text-emerald-400"})," Security Check (aCAPTCHA)"]}),l.jsx("a",{href:"https://acaptcha.vercel.app/",target:"_blank",rel:"noreferrer",className:"text-[10px] text-blue-400 hover:underline font-mono",children:"aCAPTCHA v1.1"})]}),l.jsxs("div",{className:"border border-slate-700 rounded-lg p-3 bg-slate-950/80 flex flex-col items-center justify-center min-h-[100px]",children:[l.jsx("captcha-element",{ref:S,status:"null","sound-enabled":"true","dark-mode":"dark",type:"both",difficulty:"adaptive"}),a&&l.jsxs("div",{className:"mt-2 text-xs font-medium text-emerald-400 flex items-center gap-1 font-mono",children:[l.jsx(yt,{className:"w-4 h-4"})," Captcha verifiziert!"]})]})]}),l.jsxs("div",{className:"pt-2 flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-xl text-xs font-semibold text-slate-400 hover:bg-slate-800 transition",children:"Abbrechen"}),l.jsx("button",{type:"submit",disabled:v,className:"px-5 py-2 rounded-xl text-xs font-bold bg-blue-600 hover:bg-blue-500 text-white transition shadow-lg shadow-blue-600/30 disabled:opacity-50",children:v?"Eintragen...":"Jetzt eintragen"})]})]})]})})}const Vp="/api",_i=()=>localStorage.getItem("auth_token"),bn=e=>{e?localStorage.setItem("auth_token",e):localStorage.removeItem("auth_token")},V=async(e,t={})=>{const n=_i(),r={"Content-Type":"application/json",...n?{Authorization:`Token ${n}`}:{},...t.headers},s=await fetch(`${Vp}${e}`,{...t,headers:r}),i=s.headers.get("content-type");let o=null;if(i&&i.includes("application/json")&&(o=await s.json()),!s.ok){s.status===401&&bn(null);let a="Ein Fehler ist aufgetreten.";throw o&&(typeof o.error=="string"?a=o.error:typeof o.detail=="string"?a=o.detail:o.email?a=Array.isArray(o.email)?o.email[0]:o.email:o.username?a=Array.isArray(o.username)?o.username[0]:o.username:o.non_field_errors&&(a=o.non_field_errors[0])),new Error(a)}return o},su=["#E05A47","#3B82F6","#10B981","#8B5CF6","#F59E0B","#EC4899","#06B6D4","#6366F1","#14B8A6","#F97316","#D97706","#059669","#7C3AED","#DB2777","#2563EB"],lu=()=>su[Math.floor(Math.random()*su.length)];function Fp({onClose:e,onSuccess:t,claimToken:n,prefilledGuestName:r}){const[s,i]=k.useState(!!(n||r)),[o,a]=k.useState(""),[u,m]=k.useState(""),[h,v]=k.useState(""),[x,S]=k.useState(r||""),[N,w]=k.useState(null),[L,f]=k.useState(""),[c,d]=k.useState(!1);k.useEffect(()=>{y()},[]);const y=async()=>{try{const E=await V("/users/restriction-setting/");w(E)}catch{}},j=async E=>{E.preventDefault(),f(""),d(!0);try{if(s){const P={username:o,email:u,password:h,display_name:x||o};n&&(P.claim_token=n);const b=await V("/users/register/",{method:"POST",body:JSON.stringify(P)});if(b.requires_verification||b.requires_approval||!b.token){t(null,b.message||"Konto erfolgreich registriert! Bitte schau in deine E-Mail zur Bestätigung oder warte auf die Admin-Freischaltung."),e();return}bn(b.token),t(b.user,b.message)}else{const P=await V("/users/login/",{method:"POST",body:JSON.stringify({username:o,password:h})});bn(P.token),t(P.user,"Erfolgreich angemeldet!")}e()}catch(P){f(P.message||"Authentifizierung fehlgeschlagen.")}finally{d(!1)}};return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:l.jsxs("div",{className:"hallmark-panel w-full max-w-md rounded-sm border border-grid p-6 shadow-2xl relative animate-in fade-in zoom-in-95 duration-200",children:[l.jsx("button",{onClick:e,className:"absolute top-4 right-4 p-2 text-muted hover:text-main rounded-sm transition",children:l.jsx(_d,{className:"w-5 h-5"})}),l.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[l.jsx("div",{className:"w-10 h-10 rounded-sm bg-blue-500/10 text-blue-500 border border-blue-500/20 flex items-center justify-center",children:l.jsx(cs,{className:"w-5 h-5"})}),l.jsxs("div",{children:[l.jsx("h3",{className:"font-serif font-bold text-lg text-main",children:s?"Konto erstellen":"Anmelden"}),l.jsx("p",{className:"text-xs text-muted font-sans",children:s?"Erstelle einen Account für volle Funktionen & Schichteinsicht":"Melde dich an, um Events zu verwalten"})]})]}),r&&l.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs flex items-center gap-2 font-mono",children:[l.jsx(jd,{className:"w-4 h-4 shrink-0 text-amber-500"}),l.jsxs("span",{children:["Einladung für Gast: ",l.jsx("strong",{children:r}),". Die Schicht wird deinem neuen Konto zugewiesen!"]})]}),(N==null?void 0:N.is_restriction_enabled)&&s&&l.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-indigo-500/10 border border-indigo-500/20 text-indigo-400 text-xs flex items-center gap-2 font-mono",children:[l.jsx(zp,{className:"w-4 h-4 shrink-0 text-indigo-400"}),l.jsxs("span",{children:["Registrierungen beschränkt auf: ",l.jsx("strong",{children:N.active_domains.join(", ")})]})]}),L&&l.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs flex items-center gap-2 font-mono",children:[l.jsx(Mn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:L})]}),!s&&!1,l.jsxs("form",{onSubmit:j,className:"space-y-4 font-sans",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Benutzername"}),l.jsxs("div",{className:"relative",children:[l.jsx(cs,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),l.jsx("input",{type:"text",required:!0,value:o,onChange:E=>a(E.target.value),placeholder:"z. B. max_muster",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),s&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"E-Mail-Adresse"}),l.jsxs("div",{className:"relative",children:[l.jsx(bi,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),l.jsx("input",{type:"email",required:!0,value:u,onChange:E=>m(E.target.value),placeholder:"max@beispiel.de",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Anzeigename (für Schichtlisten)"}),l.jsxs("div",{className:"relative",children:[l.jsx(cs,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),l.jsx("input",{type:"text",value:x,onChange:E=>S(E.target.value),placeholder:"z. B. Max M.",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Passwort"}),l.jsxs("div",{className:"relative",children:[l.jsx(bp,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),l.jsx("input",{type:"password",required:!0,value:h,onChange:E=>v(E.target.value),placeholder:"••••••••",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),l.jsx("button",{type:"submit",disabled:c,style:{backgroundColor:"var(--brand-primary)"},className:"w-full py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm",children:c?"Verarbeite...":s?"Registrieren":"Anmelden"})]}),l.jsx("div",{className:"mt-4 pt-4 border-t border-grid text-center",children:l.jsx("button",{type:"button",onClick:()=>{i(!s),f("")},className:"text-xs font-mono text-muted hover:text-main transition",children:s?"Bereits ein Konto? Hier anmelden":"Noch kein Konto? Jetzt registrieren"})})]})})}function Bp({events:e,user:t,onSelectEvent:n,onOpenCreateEvent:r,onToggleEventActive:s,onEditEvent:i,onDeleteEvent:o,branding:a}){const[u,m]=k.useState(""),[h,v]=k.useState("all"),x=new Date().toISOString().split("T")[0],S=e.filter(d=>d.title.toLowerCase().includes(u.toLowerCase())||d.description&&d.description.toLowerCase().includes(u.toLowerCase())||d.location&&d.location.toLowerCase().includes(u.toLowerCase())?h==="upcoming"?d.end_date>=x:!0:!1),N=(a==null?void 0:a.primary_color)||"var(--brand-primary)",w=(a==null?void 0:a.show_community_info_box)??!0,L=(a==null?void 0:a.show_support_box)??!0,f=w||L,c=t&&(t.is_admin_user||t.is_staff||t.is_superuser);return l.jsxs("div",{className:"space-y-8 animate-in fade-in duration-200",children:[l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-10 space-y-6 max-w-5xl mx-auto relative border border-grid",children:[l.jsxs("div",{className:"space-y-2 border-b border-grid pb-6",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-muted border border-grid px-2.5 py-1 rounded-sm inline-block",children:(a==null?void 0:a.app_name)||"SCHICHT- & EVENTPORTAL"}),(a==null?void 0:a.custom_banner_text)&&l.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-widest text-amber-500 bg-amber-500/10 border border-amber-500/20 px-2.5 py-1 rounded-sm inline-block font-bold",children:["📢 ",a.custom_banner_text]})]}),l.jsx("h2",{className:"font-serif text-3xl sm:text-5xl font-bold uppercase tracking-tight text-main leading-tight",children:"Veranstaltungen & Schichtkoordination"}),l.jsx("p",{className:"font-sans text-xs sm:text-sm text-muted max-w-2xl",children:"Hier findest du aktuelle Termine, Arbeitsgruppen, Bar- & Tresendienste und Schichtpläne der Initiative."})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx(Nd,{className:"w-4 h-4 absolute left-3.5 top-3 text-muted"}),l.jsx("input",{type:"text",value:u,onChange:d=>m(d.target.value),placeholder:"Veranstaltung, Ort oder Suchbegriff...",className:"w-full pl-10 pr-16 py-2 rounded-sm bg-subtle border border-grid text-main text-xs font-mono focus:outline-none focus:border-muted"}),u&&l.jsx("button",{onClick:()=>m(""),className:"absolute right-3 top-2.5 text-[10px] font-mono text-muted hover:text-main",children:"[ CLEAR ]"})]}),l.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs shrink-0",children:[l.jsxs("button",{onClick:()=>v("all"),className:`px-3.5 py-1.5 rounded-sm transition border ${h==="all"?"bg-surface-hover text-main border-grid font-bold shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:["ALLE PROGRAMME (",e.length,")"]}),l.jsxs("button",{onClick:()=>v("upcoming"),className:`px-3.5 py-1.5 rounded-sm transition border ${h==="upcoming"?"bg-surface-hover text-main border-grid font-bold shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:["ANSTEHEND (",e.filter(d=>d.end_date>=x).length,")"]})]})]})]}),l.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-1 lg:grid-cols-4 gap-6",children:[l.jsxs("div",{className:`${f?"lg:col-span-3":"lg:col-span-4"} space-y-4`,children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-3 font-mono",children:[l.jsxs("h3",{className:"font-serif text-xl font-bold uppercase tracking-wide text-main flex items-center gap-2",children:[l.jsx(Tr,{className:"w-4.5 h-4.5 text-muted"})," Termine & Schichten"]}),t&&l.jsxs("button",{onClick:r,style:{backgroundColor:N},className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1 hover:brightness-110 shadow-sm",children:[l.jsx(at,{className:"w-3.5 h-3.5"})," EVENT ANLEGEN"]})]}),S.length===0?l.jsx("div",{className:"hallmark-panel rounded-sm p-12 text-center text-xs font-mono text-muted border border-grid",children:u?`[ Keinen Eintrag für "${u}" gefunden ]`:"[ Keine Veranstaltungen vorhanden ]"}):l.jsx("div",{className:`grid grid-cols-1 sm:grid-cols-2 ${f?"":"lg:grid-cols-3"} gap-4`,children:S.map(d=>{var U,O,X,Y;const y=((U=d.task_areas)==null?void 0:U.length)||0,j=((O=d.task_areas)==null?void 0:O.reduce((G,ge)=>{var Se;return G+(((Se=ge.shifts)==null?void 0:Se.length)||0)},0))||0,E=t&&d.co_managers&&d.co_managers.some(G=>typeof G=="object"?G.id===t.id:G===t.id),P=t&&(d.created_by===t.id||((X=d.created_by)==null?void 0:X.id)===t.id||E),b=c||P;return l.jsxs("div",{className:`hallmark-card rounded-sm p-5 border transition flex flex-col justify-between space-y-4 group overflow-hidden ${d.is_active===!1?"border-amber-500/40 opacity-80 bg-subtle":"border-grid"}`,children:[l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between text-[11px] font-mono text-muted gap-2",children:[l.jsxs("span",{className:"flex items-center gap-1 bg-subtle px-2 py-0.5 rounded-sm border border-grid font-bold shrink-0",children:[l.jsx(Nr,{className:"w-3 h-3 text-muted"}),new Date(d.start_date).toLocaleDateString("de-DE")]}),d.is_active===!1?l.jsx("span",{className:"text-amber-500 font-bold px-1.5 py-0.5 rounded-sm bg-amber-500/10 border border-amber-500/20 shrink-0",children:"[ DEAKTIVIERT ]"}):d.location?l.jsxs("span",{className:"flex items-center gap-1 text-muted truncate max-w-[130px]",children:[l.jsx(No,{className:"w-3 h-3 shrink-0"}),l.jsx("span",{className:"truncate",children:d.location})]}):null]}),l.jsx("h4",{className:"font-serif text-lg font-bold uppercase text-main group-hover:text-amber-500 transition line-clamp-2",children:d.title}),d.description&&l.jsx("p",{className:"text-xs text-muted font-sans line-clamp-2",children:d.description}),l.jsxs("div",{className:"text-[10px] font-mono text-muted flex items-center gap-1.5 pt-1",children:[l.jsxs("span",{children:[y," Bereiche"]}),l.jsx("span",{children:"/"}),l.jsxs("span",{children:[j," Schichten"]})]})]}),l.jsx("div",{className:"pt-3 border-t border-grid space-y-2 font-mono",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsxs("button",{onClick:()=>n(d.id),className:"flex-1 min-w-[110px] py-1.5 px-3 rounded-sm text-xs font-mono font-bold bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center justify-center gap-1",children:["Schichtplan ",l.jsx(wd,{className:"w-3.5 h-3.5"})]}),b&&i&&l.jsxs("button",{onClick:()=>i(d),className:"py-1.5 px-2.5 rounded-sm text-[10px] font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1 shrink-0",title:"Veranstaltung & Schichten bearbeiten",children:[l.jsx(Sr,{className:"w-3.5 h-3.5"})," BEARBEITEN"]}),b&&s&&l.jsx("button",{onClick:()=>s(d),className:`py-1.5 px-2 rounded-sm text-[10px] font-mono font-bold transition flex items-center gap-1 border shrink-0 ${d.is_active!==!1?"bg-amber-500/10 text-amber-500 border-amber-500/20 hover:bg-amber-500/20":"bg-emerald-500/10 text-emerald-400 border-emerald-500/20 hover:bg-emerald-500/20"}`,title:d.is_active!==!1?"Deaktivieren":"Aktivieren",children:d.is_active!==!1?l.jsx(kd,{className:"w-3.5 h-3.5"}):l.jsx(yt,{className:"w-3.5 h-3.5"})}),(c||t&&(d.created_by===t.id||((Y=d.created_by)==null?void 0:Y.id)===t.id))&&o&&l.jsx("button",{onClick:()=>o(d),className:"py-1.5 px-2 rounded-sm text-[10px] font-mono font-bold bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 transition flex items-center gap-1 shrink-0",title:"Veranstaltung unwiderruflich löschen",children:l.jsx(Ue,{className:"w-3.5 h-3.5"})})]})})]},d.id)})})]}),f&&l.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[w&&l.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid space-y-3",children:[l.jsx("h4",{className:"font-serif text-sm font-bold uppercase tracking-wide text-main border-b border-grid pb-2",children:(a==null?void 0:a.community_info_title)||"📌 Verein & Infos"}),l.jsx("div",{className:"space-y-2 text-muted text-[11px] whitespace-pre-line",children:(a==null?void 0:a.community_info_text)||`Initiative e.V. Hausverein +Offene Angebote, DIY-Kultur & engagierte Schichten.`})]}),L&&l.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid space-y-3",children:[l.jsx("h4",{className:"font-serif text-sm font-bold uppercase tracking-wide text-main border-b border-grid pb-2",children:(a==null?void 0:a.support_box_title)||"❤️ Unterstützen"}),l.jsx("p",{className:"text-[11px] text-muted whitespace-pre-line",children:(a==null?void 0:a.support_box_text)||"Hilf mit als Helfer*in an der Bar, beim Essen kochen oder beim Auf- & Abbau."})]})]})]})]})}function Up({events:e,onSelectEvent:t,branding:n}){const[r,s]=k.useState(new Date),[i,o]=k.useState(null),a=r.getFullYear(),u=r.getMonth(),m=["JANUAR","FEBRUAR","MÄRZ","APRIL","MAI","JUNI","JULI","AUGUST","SEPTEMBER","OKTOBER","NOVEMBER","DEZEMBER"],h=()=>s(new Date(a,u-1,1)),v=()=>s(new Date(a,u+1,1)),x=()=>s(new Date),S=new Date(a,u,1).getDay(),N=S===0?6:S-1,w=new Date(a,u+1,0).getDate(),L=d=>{const y=String(u+1).padStart(2,"0"),j=String(d).padStart(2,"0");return`${a}-${y}-${j}`},f=d=>{const y=L(d);return e.filter(j=>y>=j.start_date&&y<=j.end_date)},c=(n==null?void 0:n.primary_color)||"var(--brand-primary)";return l.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto animate-in fade-in duration-200",children:[l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid flex flex-col sm:flex-row sm:items-center justify-between gap-4 font-mono",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded-sm bg-subtle text-main border border-grid flex items-center justify-center font-bold",children:l.jsx(Tr,{className:"w-4 h-4 text-amber-500"})}),l.jsxs("div",{children:[l.jsxs("h2",{className:"font-serif text-3xl sm:text-4xl font-bold uppercase tracking-tight text-main leading-none",children:[m[u]," ",a]}),l.jsx("p",{className:"text-[10px] text-muted uppercase tracking-widest mt-1",children:"— INITIATIVE E.V. TERMIN- & SCHICHTÜBERSICHT —"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:x,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-surface hover:bg-surface-hover text-main border border-grid transition",children:"[ HEUTE ]"}),l.jsx("button",{onClick:h,className:"p-1.5 rounded-sm text-muted hover:text-main bg-surface border border-grid transition",title:"Vorheriger Monat",children:l.jsx(kp,{className:"w-4 h-4"})}),l.jsx("button",{onClick:v,className:"p-1.5 rounded-sm text-muted hover:text-main bg-surface border border-grid transition",title:"Nächster Monat",children:l.jsx(Np,{className:"w-4 h-4"})})]})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm border border-grid overflow-hidden",children:[l.jsxs("div",{className:"grid grid-cols-7 bg-subtle border-b border-grid text-center text-xs font-mono text-muted font-bold py-3 uppercase",children:[l.jsx("div",{children:"MO"}),l.jsx("div",{children:"DI"}),l.jsx("div",{children:"MI"}),l.jsx("div",{children:"DO"}),l.jsx("div",{children:"FR"}),l.jsx("div",{children:"SA"}),l.jsx("div",{children:"SO"})]}),l.jsxs("div",{className:"grid grid-cols-7 auto-rows-fr divide-x divide-y divide-grid bg-surface text-xs font-mono",children:[Array.from({length:N}).map((d,y)=>l.jsx("div",{className:"min-h-[100px] sm:min-h-[110px] p-2 bg-subtle/50 text-muted opacity-30"},`offset-${y}`)),Array.from({length:w}).map((d,y)=>{const j=y+1,E=f(j),P=new Date().getFullYear()===a&&new Date().getMonth()===u&&new Date().getDate()===j;return l.jsxs("div",{className:`min-h-[100px] sm:min-h-[110px] p-2 flex flex-col justify-between transition ${P?"bg-surface-hover/80 font-bold":"hover:bg-surface-hover/50"}`,children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:`w-5 h-5 rounded-sm flex items-center justify-center font-mono text-xs ${P?"bg-main text-paper font-bold shadow-sm":"text-muted"}`,children:j}),E.length>0&&l.jsxs("span",{className:"text-[9px] font-mono text-muted",children:[E.length," ",E.length===1?"Event":"Events"]})]}),l.jsx("div",{className:"space-y-1.5 overflow-y-auto max-h-[70px] no-scrollbar",children:E.map(b=>{const U=(i==null?void 0:i.id)===b.id;return l.jsx("button",{onClick:()=>o(b),style:{backgroundColor:U?c:`${c}15`,borderColor:`${c}40`,color:U?"#ffffff":c},className:`w-full text-left px-2 py-1 rounded-sm text-[10px] font-mono font-bold border truncate block hover:brightness-110 transition shadow-sm ${b.is_active===!1?"opacity-50 line-through":""}`,children:b.title},`evt-${b.id}`)})})]},`day-${j}`)})]})]}),i&&l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid flex flex-col sm:flex-row sm:items-center justify-between gap-4 font-mono animate-in fade-in duration-200",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted",children:[l.jsxs("span",{className:"flex items-center gap-1 bg-subtle px-2 py-0.5 rounded-sm border border-grid font-bold text-main",children:[l.jsx(Nr,{className:"w-3 h-3 text-muted"}),new Date(i.start_date).toLocaleDateString("de-DE")," — ",new Date(i.end_date).toLocaleDateString("de-DE")]}),i.location&&l.jsxs("span",{className:"flex items-center gap-1 text-muted",children:[l.jsx(No,{className:"w-3 h-3"}),i.location]})]}),l.jsx("h3",{className:"font-serif text-2xl font-bold uppercase text-main",children:i.title}),i.description&&l.jsx("p",{className:"text-xs font-sans text-muted max-w-xl",children:i.description})]}),l.jsx("div",{className:"flex items-center gap-2 shrink-0",children:l.jsxs("button",{onClick:()=>t(i.id),style:{backgroundColor:c},className:"px-5 py-2 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1.5 hover:brightness-110 shadow-sm",children:["SCHICHTPLAN ÖFFNEN ",l.jsx(wd,{className:"w-4 h-4"})]})})]})]})}function Hp({branding:e,onRefreshBranding:t,onRefreshEvents:n,skills:r,onRefreshSkills:s}){const[i,o]=k.useState("users"),[a,u]=k.useState(!0),[m,h]=k.useState(""),[v,x]=k.useState(""),[S,N]=k.useState([]),[w,L]=k.useState(""),[f,c]=k.useState([]),[d,y]=k.useState(!1),[j,E]=k.useState(!1),[P,b]=k.useState(!0),[U,O]=k.useState([]),[X,Y]=k.useState(""),[G,ge]=k.useState([]),[Se,ye]=k.useState([]),[Ce,z]=k.useState(""),[I,g]=k.useState(""),[C,M]=k.useState(lu()),[$,D]=k.useState((e==null?void 0:e.app_name)||"Veranstaltungsschichtplaner"),[H,ae]=k.useState((e==null?void 0:e.logo_url)||""),[tt,Pr]=k.useState((e==null?void 0:e.primary_color)||"#E05A47"),[Lr,Js]=k.useState((e==null?void 0:e.custom_banner_text)||""),[Bt,On]=k.useState((e==null?void 0:e.show_community_info_box)??!0),[zr,Ut]=k.useState((e==null?void 0:e.community_info_title)||"📌 Verein & Infos"),[Mr,Xs]=k.useState((e==null?void 0:e.community_info_text)||`Initiative e.V. Hausverein +Offene Angebote, DIY-Kultur & engagierte Schichten.`),[Ht,el]=k.useState((e==null?void 0:e.show_support_box)??!0),[Ar,T]=k.useState((e==null?void 0:e.support_box_title)||"❤️ Unterstützen"),[R,Z]=k.useState((e==null?void 0:e.support_box_text)||"Hilf mit als Helfer*in an der Bar, beim Essen kochen oder beim Auf- & Abbau."),[nt,K]=k.useState(!1),[wt,jo]=k.useState(!1),[bo,_o]=k.useState("smtp.beispiel.de"),[Eo,Co]=k.useState(587),[To,Po]=k.useState(""),[Lo,zo]=k.useState(""),[Mo,tl]=k.useState(!0),[Ao,nl]=k.useState(!1),[Do,Ro]=k.useState("noreply@schichtplaner.de"),[Oo,Ed]=k.useState(""),[rl,Cd]=k.useState(!1),[Io,$o]=k.useState(!1),[Vo,Fo]=k.useState(!1);k.useEffect(()=>{Bo()},[]);const Bo=async()=>{u(!0);try{try{const p=await V("/users/manage-users/");N(p.results||p)}catch{}try{const p=await V("/users/pending/");c(p.results||p)}catch{}try{const p=await V("/users/restriction-setting/");y(p.is_restriction_enabled),E(p.require_admin_approval),b(p.require_email_verification??!0)}catch{}try{const p=await V("/users/domain-rules/");O(p.results||p)}catch{}try{const p=await V("/events/");ge(p.results||p)}catch{}try{const p=await V("/templates/");ye(p.results||p)}catch{}try{const p=await V("/users/smtp-setting/");p&&(jo(p.is_active??!1),_o(p.host||""),Co(p.port||587),Po(p.username||""),zo(p.password||""),tl(p.use_tls??!0),nl(p.use_ssl??!1),Ro(p.from_email||""))}catch{}}catch(p){h(p.message||"Laden der Admin-Daten fehlgeschlagen.")}finally{u(!1)}},Te=p=>{x(p),setTimeout(()=>x(""),4e3)},Td=async p=>{try{const F=await V(`/users/manage-users/${p.id}/`,{method:"PATCH",body:JSON.stringify({is_admin_user:!p.is_admin_user})});N(S.map(kt=>kt.id===p.id?F:kt)),Te(`Admin-Rechte für ${p.username} aktualisiert.`)}catch(F){h(F.message||"Fehler beim Aktualisieren.")}},Pd=async p=>{try{const F=await V(`/users/manage-users/${p.id}/`,{method:"PATCH",body:JSON.stringify({is_approved:!p.is_approved})});N(S.map(kt=>kt.id===p.id?F:kt)),Te(`Freischalt-Status für ${p.username} aktualisiert.`)}catch(F){h(F.message||"Fehler beim Aktualisieren.")}},Ld=async p=>{if(window.confirm(`Möchtest du das Benutzerkonto "${p.display_name||p.username}" (@${p.username}) wirklich dauerhaft löschen?`))try{await V(`/users/manage-users/${p.id}/`,{method:"DELETE"}),N(S.filter(F=>F.id!==p.id)),Te(`Benutzerkonto ${p.username} wurde gelöscht.`)}catch(F){h(F.message||"Fehler beim Löschen des Benutzers.")}},zd=async p=>{try{await V(`/users/${p}/approve/`,{method:"POST"}),c(f.filter(F=>F.id!==p)),Bo(),Te("Benutzer erfolgreich freigeschaltet.")}catch(F){h(F.message||"Freischalten fehlgeschlagen.")}},Md=async p=>{try{await V(`/users/${p}/approve/`,{method:"DELETE"}),c(f.filter(F=>F.id!==p)),Te("Benutzer abgelehnt und gelöscht.")}catch(F){h(F.message||"Ablehnen fehlgeschlagen.")}},sl=async(p,F)=>{try{const ll=await V("/users/restriction-setting/",{method:"POST",body:JSON.stringify({is_restriction_enabled:p==="restriction"?F:d,require_admin_approval:p==="approval"?F:j,require_email_verification:p==="email_verify"?F:P})});y(ll.is_restriction_enabled),E(ll.require_admin_approval),b(ll.require_email_verification),Te("Sicherheitseinstellungen aktualisiert.")}catch(kt){h(kt.message||"Aktualisierung fehlgeschlagen.")}},Ad=async p=>{if(p.preventDefault(),!!X.trim())try{const F=await V("/users/domain-rules/",{method:"POST",body:JSON.stringify({domain:X})});O([...U,F]),Y(""),Te(`Domain-Regel "${F.domain}" hinzugefügt.`)}catch(F){h(F.message||"Fehler beim Hinzufügen.")}},Dd=async p=>{try{await V(`/users/domain-rules/${p}/`,{method:"DELETE"}),O(U.filter(F=>F.id!==p)),Te("Domain-Regel entfernt.")}catch(F){h(F.message||"Fehler beim Löschen.")}},Rd=async p=>{if(p.preventDefault(),!!Ce.trim())try{await V("/skills/",{method:"POST",body:JSON.stringify({name:Ce,description:I,color:C})}),z(""),g(""),M(lu()),s(),Te("Qualifikation angelegt.")}catch(F){h(F.message||"Fehler beim Anlegen.")}},Od=async p=>{try{await V(`/skills/${p}/`,{method:"DELETE"}),s(),Te("Qualifikation gelöscht.")}catch(F){h(F.message||"Fehler beim Löschen.")}},Id=async p=>{try{await V(`/templates/${p}/`,{method:"DELETE"}),ye(Se.filter(F=>F.id!==p)),Te("Vorlage gelöscht.")}catch(F){h(F.message||"Fehler beim Löschen.")}},$d=async p=>{p.preventDefault(),K(!0);try{await V("/branding/",{method:"POST",body:JSON.stringify({app_name:$,logo_url:H,primary_color:tt,custom_banner_text:Lr,show_community_info_box:Bt,community_info_title:zr,community_info_text:Mr,show_support_box:Ht,support_box_title:Ar,support_box_text:R})}),t(),Te("Branding-Einstellungen erfolgreich gespeichert!")}catch(F){h(F.message||"Speichern des Brandings fehlgeschlagen.")}finally{K(!1)}},Vd=async p=>{p.preventDefault(),$o(!0);try{await V("/users/smtp-setting/",{method:"POST",body:JSON.stringify({is_active:wt,host:bo,port:parseInt(Eo)||587,username:To,password:Lo,use_tls:Mo,use_ssl:Ao,from_email:Do})}),Te("✅ SMTP-Einstellungen erfolgreich gespeichert!")}catch(F){h(F.message||"Speichern der SMTP-Einstellungen fehlgeschlagen.")}finally{$o(!1)}},Fd=async()=>{Fo(!0);try{const p=await V("/users/smtp-setting/test/",{method:"POST",body:JSON.stringify({email:Oo})});Te(`✅ ${p.message||"Test-E-Mail erfolgreich gesendet!"}`)}catch(p){h(p.message||"Test-E-Mail fehlgeschlagen.")}finally{Fo(!1)}},Uo=S.filter(p=>p.username.toLowerCase().includes(w.toLowerCase())||p.email.toLowerCase().includes(w.toLowerCase())||p.display_name&&p.display_name.toLowerCase().includes(w.toLowerCase()));return l.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto animate-in fade-in duration-200 font-sans",children:[l.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-2",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded-sm bg-indigo-500/10 text-indigo-500 border border-indigo-500/20 flex items-center justify-center font-bold",children:l.jsx(Sd,{className:"w-5 h-5"})}),l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:"System Administration"}),l.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Verwaltung von Benutzern, Freischaltungen, Events, Vorlagen, Branding & SMTP-Mailserver"})]})]})}),l.jsx("div",{className:"border-b border-grid pb-2",children:l.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs overflow-x-auto no-scrollbar",children:[l.jsxs("button",{onClick:()=>o("users"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${i==="users"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[l.jsx(bd,{className:"w-3.5 h-3.5 text-blue-400"})," [ 01: BENUTZER & SICHERHEIT (",S.length,") ]"]}),l.jsxs("button",{onClick:()=>o("events"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${i==="events"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[l.jsx(Tr,{className:"w-3.5 h-3.5 text-emerald-400"})," [ 02: VERANSTALTUNGEN (",G.length,") ]"]}),l.jsxs("button",{onClick:()=>o("templates"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${i==="templates"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[l.jsx(Zs,{className:"w-3.5 h-3.5 text-amber-400"})," [ 03: VORLAGEN & SKILLS ]"]}),l.jsxs("button",{onClick:()=>o("branding"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${i==="branding"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[l.jsx(tu,{className:"w-3.5 h-3.5 text-indigo-400"})," [ 04: BRANDING & SYSTEM ]"]}),l.jsxs("button",{onClick:()=>o("smtp"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${i==="smtp"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[l.jsx(bi,{className:"w-3.5 h-3.5 text-purple-400"})," [ 05: E-MAIL & SMTP ]"]})]})}),m&&l.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[l.jsx(Mn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:m})]}),v&&l.jsxs("div",{className:"p-4 rounded-sm bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-xs font-mono flex items-center gap-2",children:[l.jsx(yt,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:v})]}),i==="users"&&l.jsxs("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:[f.length>0&&l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-amber-500/40 bg-amber-500/5 space-y-3",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-amber-500 flex items-center gap-2 border-b border-amber-500/20 pb-2",children:["⚠️ Ausstehende Registrierungen (",f.length,")"]}),l.jsx("div",{className:"space-y-2",children:f.map(p=>l.jsxs("div",{className:"p-3 rounded-sm bg-surface border border-grid flex items-center justify-between text-xs",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"font-bold text-main",children:[p.display_name," (@",p.username,")"]}),l.jsx("div",{className:"text-[11px] text-muted",children:p.email})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>zd(p.id),className:"px-3 py-1 rounded-sm bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs",children:"[ FREISCHALTEN ]"}),l.jsx("button",{onClick:()=>Md(p.id),className:"px-3 py-1 rounded-sm bg-red-600/20 text-red-400 hover:bg-red-600/30 border border-red-600/30 font-bold text-xs",children:"[ ABLEHNEN ]"})]})]},p.id))})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid flex items-center gap-3",children:[l.jsx(Nd,{className:"w-4 h-4 text-muted shrink-0"}),l.jsx("input",{type:"text",value:w,onChange:p=>L(p.target.value),placeholder:"Nutzer suchen nach Name, Username oder E-Mail...",className:"w-full bg-subtle border border-grid px-3 py-1.5 rounded-sm text-xs font-mono text-main focus:outline-none focus:border-muted"}),w&&l.jsx("button",{onClick:()=>L(""),className:"text-xs text-muted hover:text-main font-mono shrink-0",children:"[ CLEAR ]"})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Benutzerkonten & Rechtestatus (",Uo.length,")"]}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-left border-collapse text-xs",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-grid text-muted uppercase text-[10px]",children:[l.jsx("th",{className:"pb-2 font-bold",children:"Nutzer"}),l.jsx("th",{className:"pb-2 font-bold",children:"E-Mail"}),l.jsx("th",{className:"pb-2 font-bold",children:"Freigeschaltet"}),l.jsx("th",{className:"pb-2 font-bold",children:"E-Mail Bestätigt"}),l.jsx("th",{className:"pb-2 font-bold",children:"Admin-Rolle"}),l.jsx("th",{className:"pb-2 font-bold text-right",children:"Aktionen"})]})}),l.jsx("tbody",{className:"divide-y divide-grid",children:Uo.map(p=>l.jsxs("tr",{className:"hover:bg-subtle/50 transition",children:[l.jsxs("td",{className:"py-2.5 font-bold text-main",children:[p.display_name||p.username,l.jsxs("span",{className:"text-[10px] text-muted font-normal block",children:["@",p.username]})]}),l.jsx("td",{className:"py-2.5 text-muted",children:p.email}),l.jsx("td",{className:"py-2.5",children:l.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${p.is_approved?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:p.is_approved?"JA":"NEIN"})}),l.jsx("td",{className:"py-2.5",children:l.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${p.is_email_verified?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-subtle text-muted border-grid"}`,children:p.is_email_verified?"VERIFIZIERT":"AUSSTEHEND"})}),l.jsx("td",{className:"py-2.5",children:l.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${p.is_admin_user||p.is_superuser?"bg-indigo-500/10 text-indigo-400 border-indigo-500/20":"bg-subtle text-muted border-grid"}`,children:p.is_superuser?"SUPERUSER":p.is_admin_user?"ADMIN":"USER"})}),l.jsxs("td",{className:"py-2.5 text-right space-x-1",children:[l.jsx("button",{onClick:()=>Pd(p),className:"px-2 py-1 rounded-sm text-[10px] bg-subtle hover:bg-surface-hover border border-grid text-main transition",children:p.is_approved?"Sperren":"Freischalten"}),l.jsx("button",{onClick:()=>Td(p),className:"px-2 py-1 rounded-sm text-[10px] bg-subtle hover:bg-surface-hover border border-grid text-indigo-400 transition",children:p.is_admin_user?"Admin entziehen":"Zu Admin machen"}),l.jsxs("button",{onClick:()=>Ld(p),className:"px-2 py-1 rounded-sm text-[10px] bg-red-500/10 hover:bg-red-500/20 border border-red-500/20 text-red-400 font-bold transition inline-flex items-center gap-1",title:"Benutzerkonto dauerhaft löschen",children:[l.jsx(Ue,{className:"w-3 h-3"})," Löschen"]})]})]},p.id))})]})})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[l.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"Sicherheit & Registrierungs-Einschränkungen"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"font-bold text-main",children:"E-Mail Bestätigung (Opt-Out)"}),l.jsx("button",{onClick:()=>sl("email_verify",!P),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${P?"bg-emerald-600 text-white border-emerald-500":"bg-amber-500/10 text-amber-500 border-amber-500/20"}`,children:P?"[ PFLICHT ]":"[ DEAKTIVIERT ]"})]}),l.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Bei Pflicht muss die E-Mail vor der Anmeldung verifiziert werden. Bei Deaktivierung ist die Anmeldung direkt möglich."})]}),l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"font-bold text-main",children:"Domain-Einschränkung"}),l.jsx("button",{onClick:()=>sl("restriction",!d),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${d?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:d?"[ AKTIV ]":"[ INAKTIV ]"})]}),l.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Erlaubt nur Registrierungen von festgelegten E-Mail-Domains (z. B. `@verein.de`)."})]}),l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"font-bold text-main",children:"Admin-Freischaltpflicht"}),l.jsx("button",{onClick:()=>sl("approval",!j),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${j?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:j?"[ AKTIV ]":"[ INAKTIV ]"})]}),l.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Erfordert die manuelle Freischaltung durch einen Admin vor der ersten Anmeldung."})]})]}),d&&l.jsxs("div",{className:"space-y-3 pt-3 border-t border-grid",children:[l.jsx("h4",{className:"font-serif text-sm font-bold uppercase text-main",children:"Erlaubte E-Mail-Domains"}),l.jsxs("form",{onSubmit:Ad,className:"flex gap-2",children:[l.jsx("input",{type:"text",placeholder:"z. B. verein.de oder @beispiel.org",value:X,onChange:p=>Y(p.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),l.jsxs("button",{type:"submit",className:"px-4 py-1.5 rounded-sm bg-indigo-600 hover:bg-indigo-500 text-white font-bold text-xs",children:[l.jsx(at,{className:"w-3.5 h-3.5 inline"})," Domain Hinzufügen"]})]}),l.jsx("div",{className:"flex flex-wrap gap-2",children:U.map(p=>l.jsxs("span",{className:"px-2.5 py-1 rounded-sm bg-subtle border border-grid text-xs flex items-center gap-2",children:[l.jsx("strong",{className:"text-main",children:p.domain}),l.jsx("button",{onClick:()=>Dd(p.id),className:"text-muted hover:text-red-400",children:l.jsx(Ue,{className:"w-3.5 h-3.5"})})]},p.id))})]})]})]}),i==="events"&&l.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Alle Veranstaltungen (",G.length,")"]}),l.jsx("div",{className:"space-y-3",children:G.map(p=>l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-serif font-bold text-main text-sm",children:p.title}),l.jsxs("p",{className:"text-muted text-[11px]",children:[new Date(p.start_date).toLocaleDateString("de-DE")," — ",p.location||"Kein Ort"," | Erstellt von: ",p.created_by_name||"Admin"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${p.is_active!==!1?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:p.is_active!==!1?"AKTIV":"DEAKTIVIERT"}),l.jsxs("button",{onClick:async()=>{if(window.confirm(`Möchtest du "${p.title}" und alle Schichten wirklich unwiderruflich löschen?`))try{await V(`/events/${p.id}/`,{method:"DELETE"}),n()}catch(F){alert(F.message)}},className:"px-2.5 py-1 rounded-sm text-[10px] font-bold bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 transition flex items-center gap-1",title:"Veranstaltung löschen",children:[l.jsx(Ue,{className:"w-3 h-3"})," LÖSCHEN"]})]})]},p.id))})]})}),i==="templates"&&l.jsxs("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:[l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[l.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"Erforderliche Qualifikationen (Skills)"}),l.jsxs("form",{onSubmit:Rd,className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[l.jsx("input",{type:"text",placeholder:"Skill Name (z. B. Bar-Erfahrung)",required:!0,value:Ce,onChange:p=>z(p.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),l.jsx("input",{type:"text",placeholder:"Beschreibung (optional)",value:I,onChange:p=>g(p.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"color",value:C,onChange:p=>M(p.target.value),className:"w-8 h-8 rounded-sm border-0 cursor-pointer bg-subtle p-0.5"}),l.jsxs("button",{type:"submit",className:"flex-1 px-3 py-1.5 rounded-sm bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs",children:[l.jsx(at,{className:"w-3.5 h-3.5 inline"})," Anlegen"]})]})]}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pt-2",children:r.map(p=>l.jsxs("div",{className:"p-3 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{style:{color:p.color},className:"font-bold",children:p.name}),p.description&&l.jsx("p",{className:"text-[11px] text-muted",children:p.description})]}),l.jsx("button",{onClick:()=>Od(p.id),className:"text-muted hover:text-red-400",children:l.jsx(Ue,{className:"w-3.5 h-3.5"})})]},p.id))})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Gespeicherte Event-Vorlagen (",Se.length,")"]}),l.jsx("div",{className:"space-y-2",children:Se.map(p=>l.jsxs("div",{className:"p-3 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[l.jsxs("div",{children:[l.jsx("div",{className:"font-bold text-main",children:p.name}),l.jsx("div",{className:"text-[11px] text-muted",children:p.description||"Keine Beschreibung"})]}),l.jsx("button",{onClick:()=>Id(p.id),className:"text-muted hover:text-red-400",children:l.jsx(Ue,{className:"w-4 h-4"})})]},p.id))})]})]}),i==="branding"&&l.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:l.jsxs("form",{onSubmit:$d,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-6",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2 flex items-center gap-2",children:[l.jsx(tu,{className:"w-5 h-5 text-indigo-400"})," Portal Branding & Erscheinungsbild"]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-xs",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Anwendungs-Name"}),l.jsx("input",{type:"text",required:!0,value:$,onChange:p=>D(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field font-bold"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Primärfarbe (Brand Accent)"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"color",value:tt,onChange:p=>Pr(p.target.value),className:"w-9 h-9 rounded-sm border-0 cursor-pointer bg-subtle p-0.5"}),l.jsx("input",{type:"text",value:tt,onChange:p=>Pr(p.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field font-mono"})]})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-muted mb-1",children:"Logo Bild-URL (optional)"}),l.jsx("input",{type:"text",placeholder:"https://beispiel.de/logo.png",value:H,onChange:p=>ae(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-muted mb-1",children:"Ankündigung (Banner-Text)"}),l.jsx("textarea",{rows:2,placeholder:"z. B. Willkommen beim Sommerfest Schichtplaner!",value:Lr,onChange:p=>Js(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]}),l.jsx("h4",{className:"font-serif text-base font-bold uppercase text-main pt-4 border-t border-grid",children:"Startseiten Sidebar Boxen"}),l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[l.jsx("span",{className:"font-bold text-xs uppercase text-main",children:"📌 Verein & Infos Box"}),l.jsx("button",{type:"button",onClick:()=>On(!Bt),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${Bt?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:Bt?"[ AN ]":"[ AUS ]"})]}),Bt&&l.jsxs("div",{className:"space-y-3 text-xs",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Titel"}),l.jsx("input",{type:"text",value:zr,onChange:p=>Ut(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Inhalt"}),l.jsx("textarea",{rows:3,value:Mr,onChange:p=>Xs(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]})]}),l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[l.jsx("span",{className:"font-bold text-xs uppercase text-main",children:"❤️ Unterstützen Box"}),l.jsx("button",{type:"button",onClick:()=>el(!Ht),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${Ht?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:Ht?"[ AN ]":"[ AUS ]"})]}),Ht&&l.jsxs("div",{className:"space-y-3 text-xs",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Titel"}),l.jsx("input",{type:"text",value:Ar,onChange:p=>T(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-muted mb-1",children:"Inhalt"}),l.jsx("textarea",{rows:3,value:R,onChange:p=>Z(p.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]})]}),l.jsx("div",{className:"pt-3 flex justify-end border-t border-grid",children:l.jsx("button",{type:"submit",disabled:nt,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm",children:nt?"Speichern...":"Einstellungen speichern"})})]})}),i==="smtp"&&l.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:l.jsxs("form",{onSubmit:Vd,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-3",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main flex items-center gap-2",children:[l.jsx(bi,{className:"w-5 h-5 text-indigo-400"})," SMTP Server & E-Mail-Versand"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-muted font-bold",children:"SMTP-Versand:"}),l.jsx("button",{type:"button",onClick:()=>jo(!wt),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${wt?"bg-emerald-600 text-white border-emerald-500 shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:wt?"[ AKTIV ]":"[ INAKTIV (Dev Mode) ]"})]})]}),!wt&&l.jsxs("div",{className:"p-3.5 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs flex items-center gap-2",children:[l.jsx(Mn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:"Hinweis: Im inaktiven Modus werden Bestätigungs-Links in der Entwickler-Konsole / Logs ausgegeben."})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-xs",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Host / Server Adresse"}),l.jsx("input",{type:"text",placeholder:"z. B. smtp.domain.de oder mail.gmx.net",value:bo,onChange:p=>_o(p.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Port"}),l.jsx("input",{type:"number",placeholder:"587 oder 465",value:Eo,onChange:p=>Co(p.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Absender E-Mail-Adresse (From)"}),l.jsx("input",{type:"email",placeholder:"noreply@verein.de",value:Do,onChange:p=>Ro(p.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Benutzername / Login E-Mail"}),l.jsx("input",{type:"text",placeholder:"z. B. noreply@verein.de",value:To,onChange:p=>Po(p.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Passwort"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{type:rl?"text":"password",placeholder:"••••••••",value:Lo,onChange:p=>zo(p.target.value),className:"w-full pl-3.5 pr-10 py-2 rounded-sm input-field font-mono"}),l.jsx("button",{type:"button",onClick:()=>Cd(!rl),className:"absolute right-3 top-2.5 text-muted hover:text-main",children:rl?l.jsx(kd,{className:"w-4 h-4"}):l.jsx(jp,{className:"w-4 h-4"})})]})]}),l.jsxs("div",{className:"sm:col-span-2 flex items-center gap-6 pt-2",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-main font-bold",children:[l.jsx("input",{type:"checkbox",checked:Mo,onChange:p=>{tl(p.target.checked),p.target.checked&&nl(!1)},className:"rounded-sm"}),l.jsx("span",{children:"STARTTLS verwenden (Empfohlen für Port 587)"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-main font-bold",children:[l.jsx("input",{type:"checkbox",checked:Ao,onChange:p=>{nl(p.target.checked),p.target.checked&&tl(!1)},className:"rounded-sm"}),l.jsx("span",{children:"SSL/TLS verwenden (Empfohlen für Port 465)"})]})]})]}),l.jsxs("div",{className:"pt-4 border-t border-grid flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-[260px]",children:[l.jsx("input",{type:"email",placeholder:"Empfänger für Test-E-Mail...",value:Oo,onChange:p=>Ed(p.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs flex-1 font-mono"}),l.jsxs("button",{type:"button",disabled:Vo,onClick:Fd,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1.5 shrink-0",children:[l.jsx(Lp,{className:"w-3.5 h-3.5"}),Vo?"Sende...":"Test-Mail Senden"]})]}),l.jsxs("button",{type:"submit",disabled:Io,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[l.jsx(yt,{className:"w-4 h-4"}),Io?"Speichern...":"SMTP-Einstellungen Speichern"]})]})]})})]})}function Qp({eventToEdit:e,skills:t,user:n,onBack:r,onSubmit:s,onDeleteEvent:i}){var I;const[o,a]=k.useState((e==null?void 0:e.title)||""),[u,m]=k.useState((e==null?void 0:e.description)||""),[h,v]=k.useState((e==null?void 0:e.location)||""),[x,S]=k.useState((e==null?void 0:e.start_date)||new Date().toISOString().split("T")[0]),[N,w]=k.useState((e==null?void 0:e.end_date)||new Date().toISOString().split("T")[0]),[L,f]=k.useState(e!=null&&e.co_managers?e.co_managers.map(g=>g.id):[]),[c,d]=k.useState([]),[y,j]=k.useState([]),[E,P]=k.useState(!1),[b,U]=k.useState("");k.useEffect(()=>{if(O(),e&&e.task_areas&&e.task_areas.length>0){const g=e.task_areas.map(C=>({id:C.id,name:C.name,description:C.description||"",shifts:(C.shifts||[]).map(M=>({id:M.id,title:M.title,date:M.date||(e?e.start_date:new Date().toISOString().split("T")[0]),start_time:M.start_time,end_time:M.end_time,max_participants:M.max_participants||1,required_skill_ids:M.required_skills?M.required_skills.map($=>$.id):[]}))}));j(g)}else e||j([{name:"Tresendienst",description:"Getränke- und Barverkauf",shifts:[{title:"Schicht 1",start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]}]},{name:"Essen kochen",description:"Zubereitung von Speisen",shifts:[{title:"Frühschicht",start_time:"15:00",end_time:"19:00",max_participants:3,required_skill_ids:[]}]},{name:"Aufbau & Aufräumen",description:"Tische, Stühle & Technik",shifts:[{title:"Aufbau",start_time:"12:00",end_time:"15:00",max_participants:4,required_skill_ids:[]}]}])},[e]);const O=async()=>{try{const g=await V("/users/all/");d(g.results||g)}catch{}},X=()=>{j([...y,{name:"",description:"",shifts:[{title:"Schicht 1",start_time:"10:00",end_time:"14:00",max_participants:1,required_skill_ids:[]}]}])},Y=g=>{j(y.filter((C,M)=>M!==g))},G=(g,C,M)=>{const $=[...y];$[g][C]=M,j($)},ge=g=>{const C=[...y];C[g].shifts.push({title:`Schicht ${C[g].shifts.length+1}`,date:x,start_time:"14:00",end_time:"18:00",max_participants:1,required_skill_ids:[]}),j(C)},Se=(g,C)=>{const M=[...y];M[g].shifts=M[g].shifts.filter(($,D)=>D!==C),j(M)},ye=(g,C,M,$)=>{const D=[...y];D[g].shifts[C][M]=$,j(D)},Ce=(g,C,M)=>{const $=[...y],D=$[g].shifts[C].required_skill_ids||[];D.includes(M)?$[g].shifts[C].required_skill_ids=D.filter(H=>H!==M):$[g].shifts[C].required_skill_ids=[...D,M],j($)},z=async g=>{if(g.preventDefault(),U(""),!o.trim()){U("Bitte gib einen Veranstaltungstitel an.");return}P(!0);try{await s({id:e==null?void 0:e.id,title:o,description:u,location:h,start_date:x,end_date:N,co_manager_ids:L,task_areas:y})}catch(C){U(C.message||"Speichern der Veranstaltung fehlgeschlagen.")}finally{P(!1)}};return l.jsxs("div",{className:"space-y-6 max-w-4xl mx-auto animate-in fade-in duration-200 font-sans",children:[l.jsxs("div",{className:"flex items-center justify-between font-mono text-xs",children:[l.jsxs("button",{onClick:r,className:"px-3.5 py-1.5 rounded-sm bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-2 font-bold",children:[l.jsx(vd,{className:"w-4 h-4"})," [ ZURÜCK ZUR ÜBERSICHT ]"]}),l.jsxs("span",{className:"text-muted border border-grid px-2.5 py-0.5 rounded-sm",children:["MODE: ",e?"EVENT EDIT":"NEW EVENT"]})]}),l.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-2",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded-sm bg-blue-500/10 text-blue-500 border border-blue-500/20 flex items-center justify-center font-bold",children:e?l.jsx(Sr,{className:"w-5 h-5"}):l.jsx(Tr,{className:"w-5 h-5"})}),l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:e?"Veranstaltung & Schichten Bearbeiten":"Neue Veranstaltung Erstellen"}),l.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Konfiguriere Stammdaten, Co-Verwalter, Aufgabenfelder, Schichtzeiten & Qualifikationen"})]})]})}),b&&l.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[l.jsx(Mn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:b})]}),l.jsxs("form",{onSubmit:z,className:"space-y-6",children:[l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs",children:[l.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"1. Stammdaten & Verwalter der Veranstaltung"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Titel der Veranstaltung"}),l.jsx("input",{type:"text",required:!0,value:o,onChange:g=>a(g.target.value),placeholder:"z. B. Sommerfest 2026",className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Startdatum"}),l.jsx("input",{type:"date",required:!0,value:x,onChange:g=>S(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Enddatum"}),l.jsx("input",{type:"date",required:!0,value:N,onChange:g=>w(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Ort (optional)"}),l.jsx("input",{type:"text",value:h,onChange:g=>v(g.target.value),placeholder:"z. B. Vereinsheim, Großer Saal",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Beschreibung (optional)"}),l.jsx("textarea",{rows:2,value:u,onChange:g=>m(g.target.value),placeholder:"Details zur Veranstaltung...",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs font-sans"})]}),c.length>0&&l.jsxs("div",{className:"sm:col-span-2 pt-3 border-t border-grid space-y-2",children:[l.jsxs("label",{className:"block text-main font-bold flex items-center gap-1.5",children:[l.jsx(bd,{className:"w-4 h-4 text-indigo-400"})," Co-Verwalter / Mit-Organisatoren (optional)"]}),l.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Wähle registrierte Benutzer aus, die dieses Event ebenfalls verwalten, bearbeiten und Gäste eintragen dürfen:"}),l.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:c.map(g=>{const C=L.includes(g.id);return l.jsxs("button",{type:"button",onClick:()=>{f(C?L.filter(M=>M!==g.id):[...L,g.id])},className:`px-3 py-1.5 rounded-sm text-xs font-mono font-bold transition flex items-center gap-1.5 border ${C?"bg-indigo-500/20 text-indigo-300 border-indigo-500/50 shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:[l.jsx(So,{className:`w-3.5 h-3.5 ${C?"text-indigo-400":"opacity-40"}`}),l.jsx("span",{children:g.display_name||g.username})]},g.id)})})]})]})]}),l.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main flex items-center gap-2",children:[l.jsx(Zs,{className:"w-4 h-4 text-blue-500"})," 2. Aufgabenfelder & Schichten"]}),l.jsxs("button",{type:"button",onClick:X,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-blue-500/10 text-blue-500 border border-blue-500/20 hover:bg-blue-500/20 transition flex items-center gap-1",children:[l.jsx(at,{className:"w-3.5 h-3.5"})," BEREICH HINZUFÜGEN"]})]}),y.map((g,C)=>l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsx("input",{type:"text",required:!0,placeholder:"Name des Aufgabenfeldes (z. B. Tresendienst)",value:g.name,onChange:M=>G(C,"name",M.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field text-xs font-bold"}),l.jsx("button",{type:"button",onClick:()=>Y(C),className:"p-1.5 text-muted hover:text-red-400 transition",title:"Bereich entfernen",children:l.jsx(Ue,{className:"w-4 h-4"})})]}),l.jsxs("div",{className:"pl-3 border-l-2 border-grid space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between text-xs text-muted font-bold",children:[l.jsx("span",{children:"Schichten & Zeitfenster"}),l.jsxs("button",{type:"button",onClick:()=>ge(C),className:"text-blue-500 hover:underline flex items-center gap-1",children:[l.jsx(at,{className:"w-3 h-3"})," Schicht hinzufügen"]})]}),g.shifts.map((M,$)=>l.jsxs("div",{className:"p-3 rounded-sm bg-surface border border-grid space-y-2",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-2 items-center text-xs",children:[l.jsx("input",{type:"text",placeholder:"Titel",value:M.title,onChange:D=>ye(C,$,"title",D.target.value),className:"sm:col-span-3 px-2.5 py-1 rounded-sm input-field text-xs"}),l.jsx("input",{type:"date",title:"Schichtdatum",min:x,max:N,value:M.date||x,onChange:D=>ye(C,$,"date",D.target.value),className:"sm:col-span-3 px-2 py-1 rounded-sm input-field text-xs font-mono text-indigo-400 font-bold"}),l.jsx("input",{type:"text",placeholder:"Start (14:00)",value:M.start_time,onChange:D=>ye(C,$,"start_time",D.target.value),className:"sm:col-span-2 px-2.5 py-1 rounded-sm input-field text-xs"}),l.jsx("input",{type:"text",placeholder:"Ende (18:00)",value:M.end_time,onChange:D=>ye(C,$,"end_time",D.target.value),className:"sm:col-span-2 px-2.5 py-1 rounded-sm input-field text-xs"}),l.jsx("div",{className:"sm:col-span-1 flex items-center gap-1",children:l.jsx("input",{type:"number",min:"1",title:"Max. Plätze",value:M.max_participants,onChange:D=>ye(C,$,"max_participants",parseInt(D.target.value)||1),className:"w-full px-1.5 py-1 rounded-sm input-field text-xs font-bold text-center"})}),l.jsx("button",{type:"button",onClick:()=>Se(C,$),className:"sm:col-span-1 p-1 text-muted hover:text-red-400 text-center",title:"Schicht löschen",children:l.jsx(Ue,{className:"w-3.5 h-3.5 mx-auto"})})]}),t&&t.length>0&&l.jsxs("div",{className:"pt-2 border-t border-grid flex flex-wrap items-center gap-1.5",children:[l.jsx("span",{className:"text-[10px] text-muted font-bold mr-1",children:"Erforderlich:"}),t.map(D=>{const H=(M.required_skill_ids||[]).includes(D.id);return l.jsxs("button",{type:"button",onClick:()=>Ce(C,$,D.id),style:{backgroundColor:H?`${D.color}25`:"transparent",borderColor:H?D.color:"var(--color-border-grid)",color:H?D.color:"var(--color-text-muted)"},className:"px-2 py-0.5 rounded-sm text-[10px] border font-bold transition flex items-center gap-1",children:[l.jsx("span",{children:D.name}),H&&l.jsx(yt,{className:"w-3 h-3"})]},D.id)})]})]},$))]})]},C))]}),l.jsxs("div",{className:"flex items-center justify-between gap-3 pt-2 font-mono",children:[e&&i&&n&&(n.is_admin_user||n.is_staff||n.is_superuser||e.created_by===n.id||((I=e.created_by)==null?void 0:I.id)===n.id)?l.jsxs("button",{type:"button",onClick:()=>i(e),className:"px-4 py-2.5 rounded-sm text-xs font-bold bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 transition flex items-center gap-1.5",children:[l.jsx(Ue,{className:"w-4 h-4"})," VERANSTALTUNG LÖSCHEN"]}):l.jsx("div",{}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:r,className:"px-5 py-2.5 rounded-sm text-xs font-semibold text-muted hover:bg-surface-hover transition border border-grid",children:"Abbrechen"}),l.jsxs("button",{type:"submit",disabled:E,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[l.jsx(yt,{className:"w-4 h-4"}),E?"Speichern...":"Veranstaltung Speichern"]})]})]})]})]})}function Wp({onBack:e,onInstantiateTemplate:t,user:n,skills:r}){const[s,i]=k.useState([]),[o,a]=k.useState(!0),[u,m]=k.useState(""),[h,v]=k.useState(null),[x,S]=k.useState(""),[N,w]=k.useState(new Date().toISOString().split("T")[0]),[L,f]=k.useState(new Date().toISOString().split("T")[0]),[c,d]=k.useState(""),[y,j]=k.useState(!1),[E,P]=k.useState(!1),[b,U]=k.useState(""),[O,X]=k.useState(""),[Y,G]=k.useState([{name:"Tresendienst",description:"Getränkeausschank und Bar",shifts:[{title:"Frühschicht",start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]},{title:"Spätschicht",start_time:"22:00",end_time:"02:00",max_participants:3,required_skill_ids:[]}]}]);k.useEffect(()=>{ge()},[]);const ge=async()=>{a(!0);try{const g=await V("/templates/");i(g.results||g)}catch(g){m(g.message||"Laden der Vorlagen fehlgeschlagen.")}finally{a(!1)}},Se=g=>{v(g),S(g.name)},ye=async g=>{if(g.preventDefault(),!!h){j(!0);try{await t(h.id,{title:x,start_date:N,end_date:L,location:c})}catch(C){m(C.message||"Erstellen der Veranstaltung aus Vorlage fehlgeschlagen.")}finally{j(!1)}}},Ce=async g=>{if(g.preventDefault(),!b.trim()){m("Bitte gib einen Vorlagen-Namen an.");return}j(!0);try{const C={name:b,description:O,template_data:{task_areas:Y.map(M=>({name:M.name,description:M.description,shifts:(M.shifts||[]).map($=>({title:$.title,start_time:$.start_time,end_time:$.end_time,max_participants:$.max_participants,required_skill_ids:$.required_skill_ids}))}))}};await V("/templates/",{method:"POST",body:JSON.stringify(C)}),P(!1),U(""),X(""),ge()}catch(C){m(C.message||"Erstellen der Vorlage fehlgeschlagen.")}finally{j(!1)}},z=()=>{G([...Y,{name:"Neuer Bereich",description:"",shifts:[{title:"Schicht 1",start_time:"14:00",end_time:"18:00",max_participants:2,required_skill_ids:[]}]}])},I=g=>{const C=[...Y];C[g].shifts.push({title:`Schicht ${C[g].shifts.length+1}`,start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]}),G(C)};return l.jsxs("div",{className:"space-y-6 max-w-4xl mx-auto animate-in fade-in duration-200 font-sans",children:[l.jsxs("div",{className:"flex items-center justify-between font-mono text-xs",children:[l.jsxs("button",{onClick:e,className:"px-3.5 py-1.5 rounded-sm bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-2 font-bold",children:[l.jsx(vd,{className:"w-4 h-4"})," [ ZURÜCK ZUR ÜBERSICHT ]"]}),l.jsxs("span",{className:"text-muted border border-grid px-2.5 py-0.5 rounded-sm uppercase",children:["SYSTEM VORLAGEN (",s.length,")"]})]}),l.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-4",children:l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded-sm bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 flex items-center justify-center font-bold",children:l.jsx(Zs,{className:"w-5 h-5"})}),l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:"Veranstaltungs-Vorlagen Zentrale"}),l.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Erstelle neue Veranstaltungen mit voreingestellten Schichten und Aufgabenbereichen"})]})]}),n&&l.jsxs("button",{onClick:()=>P(!E),className:"px-3.5 py-2 rounded-sm text-xs font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1.5 shrink-0",children:[l.jsx(at,{className:"w-4 h-4"}),E?"Schließen":"Neue Vorlage Erstellen"]})]})}),u&&l.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[l.jsx(Mn,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{children:u})]}),E&&l.jsxs("form",{onSubmit:Ce,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs animate-in fade-in duration-200",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-indigo-400 border-b border-grid pb-2 flex items-center justify-between",children:[l.jsx("span",{children:"Neue Vorlage mit voreingestellten Schichten anlegen"}),l.jsxs("button",{type:"button",onClick:z,className:"text-xs font-mono font-bold bg-indigo-500/20 text-indigo-300 px-3 py-1 rounded-sm border border-indigo-500/30 flex items-center gap-1",children:[l.jsx(at,{className:"w-3.5 h-3.5"})," Bereich Hinzufügen"]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Vorlagen Name"}),l.jsx("input",{type:"text",required:!0,placeholder:"z. B. Standard Kneipenabend / Bar-Event",value:b,onChange:g=>U(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm font-bold"})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Beschreibung (optional)"}),l.jsx("input",{type:"text",placeholder:"z. B. Inklusive 2 Barschichten und Aufbau",value:O,onChange:g=>X(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]})]}),l.jsx("div",{className:"space-y-4 pt-2",children:Y.map((g,C)=>l.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("input",{type:"text",required:!0,placeholder:"Bereichs-Name (z. B. Bar)",value:g.name,onChange:M=>{const $=[...Y];$[C].name=M.target.value,G($)},className:"flex-1 px-3 py-1 rounded-sm input-field text-xs font-bold"}),l.jsx("button",{type:"button",onClick:()=>{G(Y.filter((M,$)=>$!==C))},className:"text-muted hover:text-red-400 p-1",children:l.jsx(Ue,{className:"w-4 h-4"})})]}),l.jsxs("div",{className:"pl-3 border-l-2 border-grid space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between text-muted text-[11px] font-bold",children:[l.jsx("span",{children:"Voreingestellte Schichten"}),l.jsxs("button",{type:"button",onClick:()=>I(C),className:"text-indigo-400 hover:underline flex items-center gap-1",children:[l.jsx(at,{className:"w-3 h-3"})," Schicht hinzufügen"]})]}),g.shifts.map((M,$)=>l.jsxs("div",{className:"p-2.5 rounded-sm bg-surface border border-grid grid grid-cols-1 sm:grid-cols-12 gap-2 items-center text-xs",children:[l.jsx("input",{type:"text",placeholder:"Schichtname",value:M.title,onChange:D=>{const H=[...Y];H[C].shifts[$].title=D.target.value,G(H)},className:"sm:col-span-4 px-2 py-1 rounded-sm input-field text-xs"}),l.jsx("input",{type:"text",placeholder:"Start (18:00)",value:M.start_time,onChange:D=>{const H=[...Y];H[C].shifts[$].start_time=D.target.value,G(H)},className:"sm:col-span-2 px-2 py-1 rounded-sm input-field text-xs"}),l.jsx("input",{type:"text",placeholder:"Ende (22:00)",value:M.end_time,onChange:D=>{const H=[...Y];H[C].shifts[$].end_time=D.target.value,G(H)},className:"sm:col-span-2 px-2 py-1 rounded-sm input-field text-xs"}),l.jsxs("div",{className:"sm:col-span-3 flex items-center gap-1",children:[l.jsx("span",{className:"text-[10px] text-muted",children:"Plätze:"}),l.jsx("input",{type:"number",min:"1",value:M.max_participants,onChange:D=>{const H=[...Y];H[C].shifts[$].max_participants=parseInt(D.target.value)||1,G(H)},className:"w-full px-2 py-1 rounded-sm input-field text-xs font-bold"})]}),l.jsx("button",{type:"button",onClick:()=>{const D=[...Y];D[C].shifts=D[C].shifts.filter((H,ae)=>ae!==$),G(D)},className:"sm:col-span-1 p-1 text-muted hover:text-red-400 text-center",children:l.jsx(Ue,{className:"w-3.5 h-3.5 mx-auto"})})]},$))]})]},C))}),l.jsxs("div",{className:"pt-3 flex justify-end gap-2 border-t border-grid",children:[l.jsx("button",{type:"button",onClick:()=>P(!1),className:"px-4 py-2 rounded-sm text-xs font-semibold text-muted hover:bg-surface-hover transition border border-grid",children:"Abbrechen"}),l.jsxs("button",{type:"submit",disabled:y,style:{backgroundColor:"var(--brand-primary)"},className:"px-5 py-2 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-1.5",children:[l.jsx(yt,{className:"w-4 h-4"})," Vorlage Speichern"]})]})]}),l.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[l.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main",children:"Verfügbare Vorlagen"}),o?l.jsx("div",{className:"hallmark-panel p-8 text-center text-muted",children:"Lade Vorlagen..."}):s.length===0?l.jsx("div",{className:"hallmark-panel p-8 text-center text-muted italic",children:'[ Noch keine Vorlagen gespeichert. Klicke oben auf "Neue Vorlage Erstellen" um Vorlagen mit voreingestellten Schichten anzulegen. ]'}):l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:s.map(g=>{var C;return l.jsxs("div",{onClick:()=>Se(g),className:`hallmark-panel p-5 rounded-sm border cursor-pointer transition space-y-3 ${(h==null?void 0:h.id)===g.id?"bg-indigo-500/10 border-indigo-500 shadow-md":"bg-surface border-grid hover:border-muted"}`,children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h4",{className:"font-serif text-base font-bold text-main uppercase",children:g.name}),(h==null?void 0:h.id)===g.id&&l.jsx("span",{className:"text-[10px] font-mono text-indigo-400 bg-indigo-500/20 px-2 py-0.5 rounded-sm border border-indigo-500/30 font-bold",children:"[ AUSGEWÄHLT ]"})]}),g.description&&l.jsx("p",{className:"text-xs font-sans text-muted",children:g.description}),((C=g.template_data)==null?void 0:C.task_areas)&&g.template_data.task_areas.length>0&&l.jsxs("div",{className:"space-y-2 pt-2 border-t border-grid text-[11px]",children:[l.jsx("div",{className:"font-bold text-muted uppercase text-[10px]",children:"📌 Voreingestellte Schichten:"}),g.template_data.task_areas.map((M,$)=>{var D;return l.jsxs("div",{className:"bg-subtle p-2 rounded-sm border border-grid space-y-1",children:[l.jsxs("div",{className:"font-bold text-main flex items-center justify-between",children:[l.jsx("span",{children:M.name}),l.jsxs("span",{className:"text-[10px] text-muted font-normal",children:[((D=M.shifts)==null?void 0:D.length)||0," Schichten"]})]}),l.jsx("div",{className:"flex flex-wrap gap-1",children:(M.shifts||[]).map((H,ae)=>l.jsxs("span",{className:"px-2 py-0.5 rounded-sm bg-surface border border-grid text-[10px] flex items-center gap-1 font-mono",children:[l.jsx(Nr,{className:"w-3 h-3 text-muted shrink-0"}),l.jsx("strong",{className:"text-main",children:H.title}),l.jsxs("span",{className:"text-muted",children:["(",H.start_time,"-",H.end_time,", ",H.max_participants," Plätze)"]})]},ae))})]},$)})]}),l.jsxs("div",{className:"text-[10px] text-muted pt-2 border-t border-grid flex items-center justify-between",children:[l.jsxs("span",{children:["Erstellt von: ",l.jsx("strong",{children:g.created_by_name||"Admin"})]}),l.jsx("span",{className:"text-indigo-400 font-bold",children:"Klick zum Auswählen"})]})]},g.id)})})]}),h&&l.jsxs("form",{onSubmit:ye,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs animate-in fade-in duration-200",children:[l.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-indigo-400 border-b border-grid pb-2",children:['Neue Veranstaltung aus Vorlage "',h.name,'" Erstellen']}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Titel der Veranstaltung"}),l.jsx("input",{type:"text",required:!0,value:x,onChange:g=>S(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm font-bold"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Startdatum"}),l.jsx("input",{type:"date",required:!0,value:N,onChange:g=>w(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Enddatum"}),l.jsx("input",{type:"date",required:!0,value:L,onChange:g=>f(g.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("label",{className:"block text-main mb-1 font-bold",children:"Ort (optional)"}),l.jsx("input",{type:"text",value:c,onChange:g=>d(g.target.value),placeholder:"z. B. Großer Saal",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]})]}),l.jsx("div",{className:"pt-3 flex justify-end border-t border-grid",children:l.jsxs("button",{type:"submit",disabled:y,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[l.jsx(Tp,{className:"w-4 h-4 fill-white"}),y?"Erstellen...":"Veranstaltung Jetzt Aus Vorlage Erstellen"]})})]})]})}function Kp(){const[e,t]=k.useState(null),[n,r]=k.useState(null),[s,i]=k.useState([]),[o,a]=k.useState([]),[u,m]=k.useState(null),[h,v]=k.useState(null),[x,S]=k.useState(!0),[N,w]=k.useState("home"),[L,f]=k.useState(!1),[c,d]=k.useState(!1),[y,j]=k.useState(null),[E,P]=k.useState(!1),[b,U]=k.useState(!1),[O,X]=k.useState(localStorage.getItem("theme_mode")||"auto"),[Y,G]=k.useState(null),[ge,Se]=k.useState(null);k.useEffect(()=>{window.addEventListener("beforeinstallprompt",T=>{T.preventDefault(),Se(T)}),C()},[]),k.useEffect(()=>{localStorage.setItem("theme_mode",O);const T=()=>{let R=O;O==="auto"&&(R=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),document.documentElement.setAttribute("data-theme",R)};if(T(),O==="auto"){const R=window.matchMedia("(prefers-color-scheme: dark)"),Z=()=>T();return R.addEventListener("change",Z),()=>R.removeEventListener("change",Z)}},[O]),k.useEffect(()=>{n!=null&&n.primary_color&&(document.documentElement.style.setProperty("--brand-primary",n.primary_color),document.documentElement.style.setProperty("--brand-secondary",n.secondary_color||n.primary_color))},[n]);const[ye,Ce]=k.useState(null),[z,I]=k.useState(null),g=T=>{G(T),setTimeout(()=>G(null),5e3)},C=async()=>{S(!0);try{try{const K=await V("/branding/");r(K)}catch{}if(_i())try{const K=await V("/users/me/");t(K),!K.is_admin_user&&!K.is_staff&&!K.is_superuser&&N==="admin"&&w("home")}catch{bn(null),t(null),w("home")}const T=new URLSearchParams(window.location.search),R=T.get("verify_email");if(R)try{const K=await V("/users/verify-email/",{method:"POST",body:JSON.stringify({token:R})});bn(K.token),t(K.user),g(K.message||"✅ E-Mail-Adresse erfolgreich bestätigt!"),window.history.replaceState({},document.title,window.location.pathname)}catch(K){g(`⚠️ E-Mail Bestätigung: ${K.message}`)}const Z=T.get("claim_token"),nt=T.get("guest_name");Z&&nt&&(Ce(Z),I(nt),_i()||f(!0)),await $(),await D()}catch(T){console.error(T)}finally{S(!1)}},M=async T=>{try{const R=await V(`/users/signups/${T.id}/generate-claim-link/`,{method:"POST"}),Z=`${window.location.origin}/?claim_token=${R.token}&guest_name=${encodeURIComponent(R.guest_name)}`;navigator.clipboard?(await navigator.clipboard.writeText(Z),g(`✅ Einladungs-Link für ${R.guest_name} in Zwischenablage kopiert!`)):prompt(`Einladungs-Link für ${R.guest_name} kopieren:`,Z)}catch(R){alert(R.message||"Fehler beim Erstellen des Links.")}},$=async()=>{try{const T=await V("/skills/");i(T.results||T)}catch{}},D=async()=>{try{const T=await V("/events/"),R=T.results||T;a(R),R.length>0&&!u?(m(R[0].id),H(R[0].id)):u&&H(u)}catch{}},H=async T=>{try{const R=await V(`/events/${T}/matrix/`);v(R)}catch{}},ae=T=>{m(T),H(T),w("schedule")},tt=()=>{bn(null),t(null),w("home"),g("Erfolgreich abgemeldet."),u&&H(u)},Pr=(T,R)=>{t(T),T&&!T.is_admin_user&&!T.is_staff&&!T.is_superuser&&N==="admin"&&w("home"),g(R||"Erfolgreich angemeldet!"),u&&H(u)},Lr=async T=>{if(!e)j(T),d(!0);else try{const R=await V(`/shifts/${T.id}/signup/`,{method:"POST"});g(R.message||"Erfolgreich für Schicht eingetragen!"),u&&H(u)}catch(R){g(`Fehler: ${R.message}`)}},Js=async T=>{if(!y)return;const R=await V(`/shifts/${y.id}/signup/`,{method:"POST",body:JSON.stringify(T)});g(R.message||"Als Gast eingetragen!"),u&&H(u)},Bt=async T=>{try{const R=await V(`/shifts/${T.id}/signup/`,{method:"DELETE"});g(R.message||"Eintragung storniert."),u&&H(u)}catch(R){g(`Fehler: ${R.message}`)}},On=async T=>{if(!(!T||!T.id)&&window.confirm(`Möchtest du die Veranstaltung "${T.title}" und alle zugehörigen Schichten wirklich unwiderruflich löschen?`))try{await V(`/events/${T.id}/`,{method:"DELETE"}),g(`Veranstaltung "${T.title}" wurde erfolgreich gelöscht.`),u===T.id&&m(null),N==="event-editor"&&w("home"),D()}catch(R){g(`Fehler beim Löschen: ${R.message}`)}},[zr,Ut]=k.useState(null),Mr=async T=>{let R=T.id;R?await V(`/events/${R}/`,{method:"PATCH",body:JSON.stringify({title:T.title,description:T.description,location:T.location,start_date:T.start_date,end_date:T.end_date,co_manager_ids:T.co_manager_ids||[]})}):R=(await V("/events/",{method:"POST",body:JSON.stringify({title:T.title,description:T.description,location:T.location,start_date:T.start_date,end_date:T.end_date,co_manager_ids:T.co_manager_ids||[]})})).id;for(let Z of T.task_areas){if(!Z.name)continue;let nt=Z.id;nt?await V(`/task-areas/${nt}/`,{method:"PATCH",body:JSON.stringify({name:Z.name,description:Z.description||""})}):nt=(await V("/task-areas/",{method:"POST",body:JSON.stringify({event:R,name:Z.name,description:Z.description||""})})).id;for(let K of Z.shifts){const wt=K.date||T.start_date;K.id?await V(`/shifts/${K.id}/`,{method:"PATCH",body:JSON.stringify({title:K.title,date:wt,start_time:K.start_time,end_time:K.end_time,max_participants:K.max_participants,required_skill_ids:K.required_skill_ids||[]})}):await V("/shifts/",{method:"POST",body:JSON.stringify({task_area:nt,title:K.title,date:wt,start_time:K.start_time,end_time:K.end_time,max_participants:K.max_participants,required_skill_ids:K.required_skill_ids||[]})})}}g(T.id?"Veranstaltung & Schichten aktualisiert!":"Veranstaltung erfolgreich erstellt!"),await D(),ae(R)},Xs=async(T,R)=>{const Z=await V(`/templates/${T}/instantiate/`,{method:"POST",body:JSON.stringify(R)});g("Veranstaltung aus Vorlage erstellt!"),await D(),Z.id&&ae(Z.id)},Ht=()=>{u&&window.open(`/api/events/${u}/export_pdf/`,"_blank")},el=()=>{window.print()},Ar=()=>{ge&&(ge.prompt(),ge.userChoice.then(T=>{T.outcome==="accepted"&&g("PWA Installation gestartet!"),Se(null)}))};return l.jsxs("div",{className:"min-h-screen bg-canvas text-main flex flex-col font-sans selection:bg-surface-hover transition-colors duration-200",children:[Y&&l.jsxs("div",{className:"fixed bottom-6 right-6 z-50 bg-emerald-600 text-white px-4 py-2.5 rounded-sm shadow-2xl font-mono text-xs flex items-center gap-2 border border-emerald-400 animate-in fade-in slide-in-from-bottom-3 duration-200",children:[l.jsx(yt,{className:"w-4 h-4"}),l.jsx("span",{children:Y})]}),l.jsx(Op,{branding:n,user:e,activeTab:N,onChangeTab:w,themeMode:O,onChangeThemeMode:X,onLogout:tt,onOpenAuth:()=>f(!0),onOpenCreateEvent:()=>{Ut(null),w("event-editor")},onOpenTemplates:()=>w("templates"),onOpenProfile:()=>U(!0),onOpenAdmin:()=>w("admin"),pwaInstallPrompt:!!ge,onInstallPwa:Ar}),l.jsx("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-8 space-y-6",children:x?l.jsx("div",{className:"hallmark-panel p-16 text-center text-xs text-muted font-mono border border-grid",children:"Lade Daten..."}):N==="home"?l.jsx(Bp,{events:o,user:e,onSelectEvent:ae,onOpenCreateEvent:()=>{Ut(null),w("event-editor")},onToggleEventActive:async T=>{try{await V(`/events/${T.id}/`,{method:"PATCH",body:JSON.stringify({is_active:T.is_active===!1})}),D()}catch(R){alert(R.message||"Aktion fehlgeschlagen.")}},onEditEvent:T=>{Ut(T),w("event-editor")},onDeleteEvent:On,branding:n}):N==="calendar"?l.jsx(Up,{events:o,onSelectEvent:ae,branding:n}):N==="admin"&&e&&(e.is_admin_user||e.is_staff||e.is_superuser)?l.jsx(Hp,{branding:n,onRefreshBranding:async()=>{const T=await V("/branding/");r(T)},onRefreshEvents:D,skills:s,onRefreshSkills:$}):N==="event-editor"?l.jsx(Qp,{eventToEdit:zr,skills:s,user:e,onBack:()=>w("schedule"),onSubmit:Mr,onDeleteEvent:On}):N==="templates"?l.jsx(Wp,{onBack:()=>w("schedule"),onInstantiateTemplate:Xs,user:e,skills:s}):l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between gap-4 overflow-x-auto pb-2 no-scrollbar font-mono",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-bold text-muted uppercase tracking-wider whitespace-nowrap",children:"Ausgewähltes Event:"}),o.map(T=>{const R=u===T.id;return l.jsx("button",{onClick:()=>ae(T.id),style:{backgroundColor:R?(n==null?void 0:n.primary_color)||"var(--brand-primary)":void 0,borderColor:R?(n==null?void 0:n.primary_color)||"var(--brand-primary)":void 0},className:`px-3.5 py-1.5 rounded-sm text-xs font-bold transition whitespace-nowrap border ${R?"text-white shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:T.title},T.id)})]}),e&&l.jsxs("button",{onClick:()=>{Ut(null),w("event-editor")},className:"px-3.5 py-1.5 rounded-sm text-xs font-bold bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 shrink-0",children:[l.jsx(at,{className:"w-4 h-4"})," Neues Event"]})]}),l.jsx(Ip,{event:h,user:e,onSignupClick:Lr,onCancelClick:Bt,onEditEvent:T=>{Ut(T),w("event-editor")},onDeleteEvent:On,onRemoveUserFromShift:async(T,R)=>{try{const Z=await V(`/shifts/${T.id}/signup/${R}/`,{method:"DELETE"});g(Z.message||"Eintragung entfernt."),D(),u&&ae(u)}catch(Z){alert(Z.message||"Entfernen der Person fehlgeschlagen.")}},onGenerateClaimLink:M,onExportPdf:Ht,onPrintView:el})]})}),l.jsx("footer",{className:"border-t border-grid py-6 text-center text-xs text-muted font-mono no-print",children:l.jsxs("p",{children:[(n==null?void 0:n.app_name)||"Veranstaltungsschichtplaner"," • PWA Enabled • PostgreSQL & Docker Ready"]})}),L&&l.jsx(Fp,{onClose:()=>{f(!1),Ce(null),I(null)},onSuccess:Pr,claimToken:ye,prefilledGuestName:z}),c&&l.jsx($p,{shift:y,onClose:()=>d(!1),onSubmit:Js})]})}zl.createRoot(document.getElementById("root")).render(l.jsx(sf.StrictMode,{children:l.jsx(Kp,{})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index ba5e63e..a85426e 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -12,7 +12,7 @@ Schichtplaner — Veranstaltungsschichtpläne - + @@ -20,7 +20,9 @@ diff --git a/frontend/dist/sw.js b/frontend/dist/sw.js index 95a732c..6da6bec 100644 --- a/frontend/dist/sw.js +++ b/frontend/dist/sw.js @@ -1,16 +1,6 @@ -const CACHE_NAME = 'schichtplaner-v1'; -const ASSETS_TO_CACHE = [ - '/', - '/index.html', - '/manifest.json' -]; +const CACHE_NAME = 'schichtplaner-v2'; self.addEventListener('install', (event) => { - event.waitUntil( - caches.open(CACHE_NAME).then((cache) => { - return cache.addAll(ASSETS_TO_CACHE); - }) - ); self.skipWaiting(); }); @@ -18,29 +8,36 @@ self.addEventListener('activate', (event) => { event.waitUntil( caches.keys().then((keys) => { return Promise.all( - keys.map((key) => { - if (key !== CACHE_NAME) { - return caches.delete(key); - } - }) + keys.map((key) => caches.delete(key)) ); - }) + }).then(() => self.clients.claim()) ); - self.clients.claim(); }); +// Network-First Strategy for fresh deployments self.addEventListener('fetch', (event) => { if (event.request.method !== 'GET' || event.request.url.includes('/api/')) { return; } + event.respondWith( - caches.match(event.request).then((cachedResponse) => { - if (cachedResponse) { - return cachedResponse; - } - return fetch(event.request).catch(() => { - return caches.match('/index.html'); - }); - }) + fetch(event.request) + .then((networkResponse) => { + if (networkResponse && networkResponse.status === 200 && networkResponse.type === 'basic') { + const responseToCache = networkResponse.clone(); + caches.open(CACHE_NAME).then((cache) => { + cache.put(event.request, responseToCache); + }); + } + return networkResponse; + }) + .catch(() => { + return caches.match(event.request).then((cachedResponse) => { + if (cachedResponse) return cachedResponse; + if (event.request.mode === 'navigate') { + return caches.match('/index.html'); + } + }); + }) ); }); diff --git a/frontend/index.html b/frontend/index.html index 084a329..a552586 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -19,7 +19,9 @@ diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 41f178e..5eb76d9 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -9,8 +9,22 @@ server { gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + # Prevent caching of index.html and sw.js so redeploys fetch new assets immediately + location ~* (index\.html|sw\.js|manifest\.json)$ { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + add_header Pragma "no-cache"; + add_header Expires "0"; + } + + # Cache immutable static assets with hash (js, css, images) for performance + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2)$ { + expires 1y; + add_header Cache-Control "public, max-age=31536000, immutable"; + } + location / { try_files $uri $uri/ /index.html; + add_header Cache-Control "no-cache, no-store, must-revalidate"; } location /api/ { @@ -31,5 +45,9 @@ server { location /static/ { proxy_pass http://backend:8000/static/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } } diff --git a/frontend/public/sw.js b/frontend/public/sw.js index 95a732c..6da6bec 100644 --- a/frontend/public/sw.js +++ b/frontend/public/sw.js @@ -1,16 +1,6 @@ -const CACHE_NAME = 'schichtplaner-v1'; -const ASSETS_TO_CACHE = [ - '/', - '/index.html', - '/manifest.json' -]; +const CACHE_NAME = 'schichtplaner-v2'; self.addEventListener('install', (event) => { - event.waitUntil( - caches.open(CACHE_NAME).then((cache) => { - return cache.addAll(ASSETS_TO_CACHE); - }) - ); self.skipWaiting(); }); @@ -18,29 +8,36 @@ self.addEventListener('activate', (event) => { event.waitUntil( caches.keys().then((keys) => { return Promise.all( - keys.map((key) => { - if (key !== CACHE_NAME) { - return caches.delete(key); - } - }) + keys.map((key) => caches.delete(key)) ); - }) + }).then(() => self.clients.claim()) ); - self.clients.claim(); }); +// Network-First Strategy for fresh deployments self.addEventListener('fetch', (event) => { if (event.request.method !== 'GET' || event.request.url.includes('/api/')) { return; } + event.respondWith( - caches.match(event.request).then((cachedResponse) => { - if (cachedResponse) { - return cachedResponse; - } - return fetch(event.request).catch(() => { - return caches.match('/index.html'); - }); - }) + fetch(event.request) + .then((networkResponse) => { + if (networkResponse && networkResponse.status === 200 && networkResponse.type === 'basic') { + const responseToCache = networkResponse.clone(); + caches.open(CACHE_NAME).then((cache) => { + cache.put(event.request, responseToCache); + }); + } + return networkResponse; + }) + .catch(() => { + return caches.match(event.request).then((cachedResponse) => { + if (cachedResponse) return cachedResponse; + if (event.request.mode === 'navigate') { + return caches.match('/index.html'); + } + }); + }) ); }); diff --git a/frontend/src/api/client.js b/frontend/src/api/client.js index 0ca0387..3f3a995 100644 --- a/frontend/src/api/client.js +++ b/frontend/src/api/client.js @@ -30,6 +30,9 @@ export const apiFetch = async (endpoint, options = {}) => { } if (!response.ok) { + if (response.status === 401) { + setAuthToken(null); + } let errorMsg = 'Ein Fehler ist aufgetreten.'; if (data) { if (typeof data.error === 'string') errorMsg = data.error;