function Xf(i,u){for(var a=0;ad[p]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const u=document.createElement("link").relList;if(u&&u.supports&&u.supports("modulepreload"))return;for(const p of document.querySelectorAll('link[rel="modulepreload"]'))d(p);new MutationObserver(p=>{for(const m of p)if(m.type==="childList")for(const g of m.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&d(g)}).observe(document,{childList:!0,subtree:!0});function a(p){const m={};return p.integrity&&(m.integrity=p.integrity),p.referrerPolicy&&(m.referrerPolicy=p.referrerPolicy),p.crossOrigin==="use-credentials"?m.credentials="include":p.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function d(p){if(p.ep)return;p.ep=!0;const m=a(p);fetch(p.href,m)}})();function Zf(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var cs={exports:{}},Gr={},ds={exports:{}},ae={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var hc;function qf(){if(hc)return ae;hc=1;var i=Symbol.for("react.element"),u=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),g=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),N=Symbol.iterator;function M(y){return y===null||typeof y!="object"?null:(y=N&&y[N]||y["@@iterator"],typeof y=="function"?y:null)}var H={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},K=Object.assign,R={};function C(y,T,ne){this.props=y,this.context=T,this.refs=R,this.updater=ne||H}C.prototype.isReactComponent={},C.prototype.setState=function(y,T){if(typeof y!="object"&&typeof y!="function"&&y!=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,y,T,"setState")},C.prototype.forceUpdate=function(y){this.updater.enqueueForceUpdate(this,y,"forceUpdate")};function A(){}A.prototype=C.prototype;function $(y,T,ne){this.props=y,this.context=T,this.refs=R,this.updater=ne||H}var G=$.prototype=new A;G.constructor=$,K(G,C.prototype),G.isPureReactComponent=!0;var B=Array.isArray,ue=Object.prototype.hasOwnProperty,de={current:null},je={key:!0,ref:!0,__self:!0,__source:!0};function xe(y,T,ne){var le,oe={},ie=null,ce=null;if(T!=null)for(le in T.ref!==void 0&&(ce=T.ref),T.key!==void 0&&(ie=""+T.key),T)ue.call(T,le)&&!je.hasOwnProperty(le)&&(oe[le]=T[le]);var se=arguments.length-2;if(se===1)oe.children=ne;else if(1>>1,T=F[y];if(0>>1;yp(oe,W))iep(ce,oe)?(F[y]=ce,F[ie]=W,y=ie):(F[y]=oe,F[le]=W,y=le);else if(iep(ce,W))F[y]=ce,F[ie]=W,y=ie;else break e}}return X}function p(F,X){var W=F.sortIndex-X.sortIndex;return W!==0?W:F.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var m=performance;i.unstable_now=function(){return m.now()}}else{var g=Date,w=g.now();i.unstable_now=function(){return g.now()-w}}var k=[],_=[],P=1,N=null,M=3,H=!1,K=!1,R=!1,C=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(F){for(var X=a(_);X!==null;){if(X.callback===null)d(_);else if(X.startTime<=F)d(_),X.sortIndex=X.expirationTime,u(k,X);else break;X=a(_)}}function B(F){if(R=!1,G(F),!K)if(a(k)!==null)K=!0,Le(ue);else{var X=a(_);X!==null&&me(B,X.startTime-F)}}function ue(F,X){K=!1,R&&(R=!1,A(xe),xe=-1),H=!0;var W=M;try{for(G(X),N=a(k);N!==null&&(!(N.expirationTime>X)||F&&!He());){var y=N.callback;if(typeof y=="function"){N.callback=null,M=N.priorityLevel;var T=y(N.expirationTime<=X);X=i.unstable_now(),typeof T=="function"?N.callback=T:N===a(k)&&d(k),G(X)}else d(k);N=a(k)}if(N!==null)var ne=!0;else{var le=a(_);le!==null&&me(B,le.startTime-X),ne=!1}return ne}finally{N=null,M=W,H=!1}}var de=!1,je=null,xe=-1,Je=5,Me=-1;function He(){return!(i.unstable_now()-MeF||125y?(F.sortIndex=W,u(_,F),a(k)===null&&F===a(_)&&(R?(A(xe),xe=-1):R=!0,me(B,W-y))):(F.sortIndex=T,u(k,F),K||H||(K=!0,Le(ue))),F},i.unstable_shouldYield=He,i.unstable_wrapCallback=function(F){var X=M;return function(){var W=M;M=X;try{return F.apply(this,arguments)}finally{M=W}}}})(hs)),hs}var xc;function lp(){return xc||(xc=1,ps.exports=rp()),ps.exports}/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var kc;function op(){if(kc)return at;kc=1;var i=_s(),u=lp();function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),k=Object.prototype.hasOwnProperty,_=/^[: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]*$/,P={},N={};function M(e){return k.call(N,e)?!0:k.call(P,e)?!1:_.test(e)?N[e]=!0:(P[e]=!0,!1)}function H(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 K(e,t,n,r){if(t===null||typeof t>"u"||H(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 R(e,t,n,r,l,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){C[e]=new R(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];C[t]=new R(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){C[e]=new R(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){C[e]=new R(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){C[e]=new R(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){C[e]=new R(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){C[e]=new R(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){C[e]=new R(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){C[e]=new R(e,5,!1,e.toLowerCase(),null,!1,!1)});var A=/[\-:]([a-z])/g;function $(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(A,$);C[t]=new R(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(A,$);C[t]=new R(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(A,$);C[t]=new R(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){C[e]=new R(e,1,!1,e.toLowerCase(),null,!1,!1)}),C.xlinkHref=new R("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){C[e]=new R(e,1,!1,e.toLowerCase(),null,!0,!0)});function G(e,t,n,r){var l=C.hasOwnProperty(t)?C[t]:null;(l!==null?l.type!==0:r||!(2f||l[s]!==o[f]){var h=` `+l[s].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),h}while(1<=s&&0<=f);break}}}finally{ne=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?T(e):""}function oe(e){switch(e.tag){case 5:return T(e.type);case 16:return T("Lazy");case 13:return T("Suspense");case 19:return T("SuspenseList");case 0:case 2:case 15:return e=le(e.type,!1),e;case 11:return e=le(e.type.render,!1),e;case 1:return e=le(e.type,!0),e;default:return""}}function ie(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 je:return"Fragment";case de:return"Portal";case Je:return"Profiler";case xe:return"StrictMode";case Pe:return"Suspense";case We:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case He:return(e.displayName||"Context")+".Consumer";case Me:return(e._context.displayName||"Context")+".Provider";case Ce:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ge:return t=e.displayName||null,t!==null?t:ie(e.type)||"Memo";case Le:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}function ce(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 ie(t);case 8:return t===xe?"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 se(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function fe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ue(e){var t=fe(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 l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function $t(e){e._valueTracker||(e._valueTracker=Ue(e))}function Mn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=fe(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Vt(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 Ht(e,t){var n=t.checked;return W({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function In(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=se(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 yn(e,t){t=t.checked,t!=null&&G(e,"checked",t,!1)}function xn(e,t){yn(e,t);var n=se(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")?I(e,t.type,n):t.hasOwnProperty("defaultValue")&&I(e,t.type,se(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function kn(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 I(e,t,n){(t!=="number"||Vt(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ee=Array.isArray;function re(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=ct.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Sn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yt={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},nl=["Webkit","ms","Moz","O"];Object.keys(Yt).forEach(function(e){nl.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Yt[t]=Yt[e]})});function rl(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Yt.hasOwnProperty(e)&&Yt[e]?(""+t).trim():t+"px"}function Ts(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=rl(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var ed=W({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 wo(e,t){if(t){if(ed[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(a(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(a(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(t.style!=null&&typeof t.style!="object")throw Error(a(62))}}function jo(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 Co=null;function Eo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _o=null,Fn=null,Wn=null;function zs(e){if(e=Dr(e)){if(typeof _o!="function")throw Error(a(280));var t=e.stateNode;t&&(t=_l(t),_o(e.stateNode,e.type,t))}}function Ls(e){Fn?Wn?Wn.push(e):Wn=[e]:Fn=e}function Os(){if(Fn){var e=Fn,t=Wn;if(Wn=Fn=null,zs(e),t)for(e=0;e>>=0,e===0?32:31-(dd(e)/fd|0)|0}var al=64,ul=4194304;function vr(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 cl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var f=s&~l;f!==0?r=vr(f):(o&=s,o!==0&&(r=vr(o)))}else s=n&~l,s!==0?r=vr(s):o!==0&&(r=vr(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function gr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-St(t),e[t]=n}function vd(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=Er),sa=" ",aa=!1;function ua(e,t){switch(e){case"keyup":return Hd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ca(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var An=!1;function Kd(e,t){switch(e){case"compositionend":return ca(t);case"keypress":return t.which!==32?null:(aa=!0,sa);case"textInput":return e=t.data,e===sa&&aa?null:e;default:return null}}function Yd(e,t){if(An)return e==="compositionend"||!Ho&&ua(e,t)?(e=ta(),ml=Wo=qt=null,An=!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=ga(n)}}function xa(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xa(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ka(){for(var e=window,t=Vt();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Vt(e.document)}return t}function Yo(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 nf(e){var t=ka(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&xa(n.ownerDocument.documentElement,n)){if(r!==null&&Yo(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 l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=ya(n,o);var s=ya(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.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,$n=null,Jo=null,Rr=null,Go=!1;function Sa(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Go||$n==null||$n!==Vt(r)||(r=$n,"selectionStart"in r&&Yo(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}),Rr&&Pr(Rr,r)||(Rr=r,r=jl(Jo,"onSelect"),0Yn||(e.current=si[Yn],si[Yn]=null,Yn--)}function ye(e,t){Yn++,si[Yn]=e.current,e.current=t}var nn={},Xe=tn(nn),rt=tn(!1),Cn=nn;function Jn(e,t){var n=e.type.contextTypes;if(!n)return nn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function lt(e){return e=e.childContextTypes,e!=null}function Nl(){Se(rt),Se(Xe)}function Ia(e,t,n){if(Xe.current!==nn)throw Error(a(168));ye(Xe,t),ye(rt,n)}function Fa(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(a(108,ce(e)||"Unknown",l));return W({},n,r)}function Pl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||nn,Cn=Xe.current,ye(Xe,e),ye(rt,rt.current),!0}function Wa(e,t,n){var r=e.stateNode;if(!r)throw Error(a(169));n?(e=Fa(e,t,Cn),r.__reactInternalMemoizedMergedChildContext=e,Se(rt),Se(Xe),ye(Xe,e)):Se(rt),ye(rt,n)}var Dt=null,Rl=!1,ai=!1;function Ua(e){Dt===null?Dt=[e]:Dt.push(e)}function mf(e){Rl=!0,Ua(e)}function rn(){if(!ai&&Dt!==null){ai=!0;var e=0,t=ge;try{var n=Dt;for(ge=1;e>=s,l-=s,Mt=1<<32-St(t)+l|n<te?(Ve=q,q=null):Ve=q.sibling;var he=z(x,q,S[te],D);if(he===null){q===null&&(q=Ve);break}e&&q&&he.alternate===null&&t(x,q),v=o(he,v,te),Z===null?J=he:Z.sibling=he,Z=he,q=Ve}if(te===S.length)return n(x,q),we&&_n(x,te),J;if(q===null){for(;tete?(Ve=q,q=null):Ve=q.sibling;var pn=z(x,q,he.value,D);if(pn===null){q===null&&(q=Ve);break}e&&q&&pn.alternate===null&&t(x,q),v=o(pn,v,te),Z===null?J=pn:Z.sibling=pn,Z=pn,q=Ve}if(he.done)return n(x,q),we&&_n(x,te),J;if(q===null){for(;!he.done;te++,he=S.next())he=O(x,he.value,D),he!==null&&(v=o(he,v,te),Z===null?J=he:Z.sibling=he,Z=he);return we&&_n(x,te),J}for(q=r(x,q);!he.done;te++,he=S.next())he=U(q,x,te,he.value,D),he!==null&&(e&&he.alternate!==null&&q.delete(he.key===null?te:he.key),v=o(he,v,te),Z===null?J=he:Z.sibling=he,Z=he);return e&&q.forEach(function(Gf){return t(x,Gf)}),we&&_n(x,te),J}function ze(x,v,S,D){if(typeof S=="object"&&S!==null&&S.type===je&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case ue:e:{for(var J=S.key,Z=v;Z!==null;){if(Z.key===J){if(J=S.type,J===je){if(Z.tag===7){n(x,Z.sibling),v=l(Z,S.props.children),v.return=x,x=v;break e}}else if(Z.elementType===J||typeof J=="object"&&J!==null&&J.$$typeof===Le&&Qa(J)===Z.type){n(x,Z.sibling),v=l(Z,S.props),v.ref=Mr(x,Z,S),v.return=x,x=v;break e}n(x,Z);break}else t(x,Z);Z=Z.sibling}S.type===je?(v=Dn(S.props.children,x.mode,D,S.key),v.return=x,x=v):(D=ro(S.type,S.key,S.props,null,x.mode,D),D.ref=Mr(x,v,S),D.return=x,x=D)}return s(x);case de:e:{for(Z=S.key;v!==null;){if(v.key===Z)if(v.tag===4&&v.stateNode.containerInfo===S.containerInfo&&v.stateNode.implementation===S.implementation){n(x,v.sibling),v=l(v,S.children||[]),v.return=x,x=v;break e}else{n(x,v);break}else t(x,v);v=v.sibling}v=os(S,x.mode,D),v.return=x,x=v}return s(x);case Le:return Z=S._init,ze(x,v,Z(S._payload),D)}if(ee(S))return Q(x,v,S,D);if(X(S))return Y(x,v,S,D);Ol(x,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,v!==null&&v.tag===6?(n(x,v.sibling),v=l(v,S),v.return=x,x=v):(n(x,v),v=ls(S,x.mode,D),v.return=x,x=v),s(x)):n(x,v)}return ze}var qn=Ka(!0),Ya=Ka(!1),Dl=tn(null),Ml=null,bn=null,hi=null;function mi(){hi=bn=Ml=null}function vi(e){var t=Dl.current;Se(Dl),e._currentValue=t}function gi(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 er(e,t){Ml=e,hi=bn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ot=!0),e.firstContext=null)}function gt(e){var t=e._currentValue;if(hi!==e)if(e={context:e,memoizedValue:t,next:null},bn===null){if(Ml===null)throw Error(a(308));bn=e,Ml.dependencies={lanes:0,firstContext:e}}else bn=bn.next=e;return t}var Nn=null;function yi(e){Nn===null?Nn=[e]:Nn.push(e)}function Ja(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,yi(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ft(e,r)}function Ft(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 ln=!1;function xi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ga(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 Wt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function on(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(pe&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ft(e,n)}return l=r.interleaved,l===null?(t.next=t,yi(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ft(e,n)}function Il(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,Oo(e,n)}}function Xa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,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 Fl(e,t,n,r){var l=e.updateQueue;ln=!1;var o=l.firstBaseUpdate,s=l.lastBaseUpdate,f=l.shared.pending;if(f!==null){l.shared.pending=null;var h=f,j=h.next;h.next=null,s===null?o=j:s.next=j,s=h;var L=e.alternate;L!==null&&(L=L.updateQueue,f=L.lastBaseUpdate,f!==s&&(f===null?L.firstBaseUpdate=j:f.next=j,L.lastBaseUpdate=h))}if(o!==null){var O=l.baseState;s=0,L=j=h=null,f=o;do{var z=f.lane,U=f.eventTime;if((r&z)===z){L!==null&&(L=L.next={eventTime:U,lane:0,tag:f.tag,payload:f.payload,callback:f.callback,next:null});e:{var Q=e,Y=f;switch(z=t,U=n,Y.tag){case 1:if(Q=Y.payload,typeof Q=="function"){O=Q.call(U,O,z);break e}O=Q;break e;case 3:Q.flags=Q.flags&-65537|128;case 0:if(Q=Y.payload,z=typeof Q=="function"?Q.call(U,O,z):Q,z==null)break e;O=W({},O,z);break e;case 2:ln=!0}}f.callback!==null&&f.lane!==0&&(e.flags|=64,z=l.effects,z===null?l.effects=[f]:z.push(f))}else U={eventTime:U,lane:z,tag:f.tag,payload:f.payload,callback:f.callback,next:null},L===null?(j=L=U,h=O):L=L.next=U,s|=z;if(f=f.next,f===null){if(f=l.shared.pending,f===null)break;z=f,f=z.next,z.next=null,l.lastBaseUpdate=z,l.shared.pending=null}}while(!0);if(L===null&&(h=O),l.baseState=h,l.firstBaseUpdate=j,l.lastBaseUpdate=L,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);Tn|=s,e.lanes=s,e.memoizedState=O}}function Za(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ci.transition;Ci.transition={};try{e(!1),t()}finally{ge=n,Ci.transition=r}}function vu(){return yt().memoizedState}function xf(e,t,n){var r=cn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},gu(e))yu(t,n);else if(n=Ja(e,t,n,r),n!==null){var l=tt();Nt(n,e,r,l),xu(n,t,r)}}function kf(e,t,n){var r=cn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(gu(e))yu(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,f=o(s,n);if(l.hasEagerState=!0,l.eagerState=f,wt(f,s)){var h=t.interleaved;h===null?(l.next=l,yi(t)):(l.next=h.next,h.next=l),t.interleaved=l;return}}catch{}finally{}n=Ja(e,t,l,r),n!==null&&(l=tt(),Nt(n,e,r,l),xu(n,t,r))}}function gu(e){var t=e.alternate;return e===_e||t!==null&&t===_e}function yu(e,t){Ur=Bl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xu(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Oo(e,n)}}var Vl={readContext:gt,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useInsertionEffect:Ze,useLayoutEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useMutableSource:Ze,useSyncExternalStore:Ze,useId:Ze,unstable_isNewReconciler:!1},Sf={readContext:gt,useCallback:function(e,t){return zt().memoizedState=[e,t===void 0?null:t],e},useContext:gt,useEffect:au,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Al(4194308,4,du.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Al(4194308,4,e,t)},useInsertionEffect:function(e,t){return Al(4,2,e,t)},useMemo:function(e,t){var n=zt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=zt();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=xf.bind(null,_e,e),[r.memoizedState,e]},useRef:function(e){var t=zt();return e={current:e},t.memoizedState=e},useState:iu,useDebugValue:zi,useDeferredValue:function(e){return zt().memoizedState=e},useTransition:function(){var e=iu(!1),t=e[0];return e=yf.bind(null,e[1]),zt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=_e,l=zt();if(we){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),$e===null)throw Error(a(349));(Rn&30)!==0||tu(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,au(ru.bind(null,r,o,e),[e]),r.flags|=2048,$r(9,nu.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=zt(),t=$e.identifierPrefix;if(we){var n=It,r=Mt;n=(r&~(1<<32-St(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Br++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Rt]=t,e[Or]=r,Uu(e,t,!1,!1),t.stateNode=e;e:{switch(s=jo(n,r),n){case"dialog":ke("cancel",e),ke("close",e),l=r;break;case"iframe":case"object":case"embed":ke("load",e),l=r;break;case"video":case"audio":for(l=0;lor&&(t.flags|=128,r=!0,Vr(o,!1),t.lanes=4194304)}else{if(!r)if(e=Wl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Vr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!we)return qe(t),null}else 2*Te()-o.renderingStartTime>or&&n!==1073741824&&(t.flags|=128,r=!0,Vr(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Te(),t.sibling=null,n=Ee.current,ye(Ee,r?n&1|2:n&1),t):(qe(t),null);case 22:case 23:return ts(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(ht&1073741824)!==0&&(qe(t),t.subtreeFlags&6&&(t.flags|=8192)):qe(t),null;case 24:return null;case 25:return null}throw Error(a(156,t.tag))}function Rf(e,t){switch(ci(t),t.tag){case 1:return lt(t.type)&&Nl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return tr(),Se(rt),Se(Xe),ji(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Si(t),null;case 13:if(Se(Ee),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Zn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Se(Ee),null;case 4:return tr(),null;case 10:return vi(t.type._context),null;case 22:case 23:return ts(),null;case 24:return null;default:return null}}var Yl=!1,be=!1,Tf=typeof WeakSet=="function"?WeakSet:Set,V=null;function rr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Re(e,t,r)}else n.current=null}function Vi(e,t,n){try{n()}catch(r){Re(e,t,r)}}var $u=!1;function zf(e,t){if(ti=pl,e=ka(),Yo(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 l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,f=-1,h=-1,j=0,L=0,O=e,z=null;t:for(;;){for(var U;O!==n||l!==0&&O.nodeType!==3||(f=s+l),O!==o||r!==0&&O.nodeType!==3||(h=s+r),O.nodeType===3&&(s+=O.nodeValue.length),(U=O.firstChild)!==null;)z=O,O=U;for(;;){if(O===e)break t;if(z===n&&++j===l&&(f=s),z===o&&++L===r&&(h=s),(U=O.nextSibling)!==null)break;O=z,z=O.parentNode}O=U}n=f===-1||h===-1?null:{start:f,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(ni={focusedElem:e,selectionRange:n},pl=!1,V=t;V!==null;)if(t=V,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,V=e;else for(;V!==null;){t=V;try{var Q=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(Q!==null){var Y=Q.memoizedProps,ze=Q.memoizedState,x=t.stateNode,v=x.getSnapshotBeforeUpdate(t.elementType===t.type?Y:Ct(t.type,Y),ze);x.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(D){Re(t,t.return,D)}if(e=t.sibling,e!==null){e.return=t.return,V=e;break}V=t.return}return Q=$u,$u=!1,Q}function Hr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&Vi(t,n,o)}l=l.next}while(l!==r)}}function Jl(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 Hi(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 Vu(e){var t=e.alternate;t!==null&&(e.alternate=null,Vu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Rt],delete t[Or],delete t[ii],delete t[pf],delete t[hf])),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 Hu(e){return e.tag===5||e.tag===3||e.tag===4}function Qu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Hu(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 Qi(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=El));else if(r!==4&&(e=e.child,e!==null))for(Qi(e,t,n),e=e.sibling;e!==null;)Qi(e,t,n),e=e.sibling}function Ki(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(Ki(e,t,n),e=e.sibling;e!==null;)Ki(e,t,n),e=e.sibling}var Qe=null,Et=!1;function sn(e,t,n){for(n=n.child;n!==null;)Ku(e,t,n),n=n.sibling}function Ku(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(sl,n)}catch{}switch(n.tag){case 5:be||rr(n,t);case 6:var r=Qe,l=Et;Qe=null,sn(e,t,n),Qe=r,Et=l,Qe!==null&&(Et?(e=Qe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Qe.removeChild(n.stateNode));break;case 18:Qe!==null&&(Et?(e=Qe,n=n.stateNode,e.nodeType===8?oi(e.parentNode,n):e.nodeType===1&&oi(e,n),wr(e)):oi(Qe,n.stateNode));break;case 4:r=Qe,l=Et,Qe=n.stateNode.containerInfo,Et=!0,sn(e,t,n),Qe=r,Et=l;break;case 0:case 11:case 14:case 15:if(!be&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,s=o.destroy;o=o.tag,s!==void 0&&((o&2)!==0||(o&4)!==0)&&Vi(n,t,s),l=l.next}while(l!==r)}sn(e,t,n);break;case 1:if(!be&&(rr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(f){Re(n,t,f)}sn(e,t,n);break;case 21:sn(e,t,n);break;case 22:n.mode&1?(be=(r=be)||n.memoizedState!==null,sn(e,t,n),be=r):sn(e,t,n);break;default:sn(e,t,n)}}function Yu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Tf),t.forEach(function(r){var l=Bf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function _t(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~o}if(r=l,r=Te()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Of(r/1960))-r,10e?16:e,un===null)var r=!1;else{if(e=un,un=null,bl=0,(pe&6)!==0)throw Error(a(331));var l=pe;for(pe|=4,V=e.current;V!==null;){var o=V,s=o.child;if((V.flags&16)!==0){var f=o.deletions;if(f!==null){for(var h=0;hTe()-Gi?Ln(e,0):Ji|=n),st(e,t)}function ic(e,t){t===0&&((e.mode&1)===0?t=1:(t=ul,ul<<=1,(ul&130023424)===0&&(ul=4194304)));var n=tt();e=Ft(e,t),e!==null&&(gr(e,t,n),st(e,n))}function Uf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ic(e,n)}function Bf(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(a(314))}r!==null&&r.delete(t),ic(e,n)}var sc;sc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||rt.current)ot=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return ot=!1,Nf(e,t,n);ot=(e.flags&131072)!==0}else ot=!1,we&&(t.flags&1048576)!==0&&Ba(t,zl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Kl(e,t),e=t.pendingProps;var l=Jn(t,Xe.current);er(t,n),l=_i(null,t,r,e,l,n);var o=Ni();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,lt(r)?(o=!0,Pl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,xi(t),l.updater=Hl,t.stateNode=l,l._reactInternals=t,Oi(t,r,e,n),t=Fi(null,t,r,!0,o,n)):(t.tag=0,we&&o&&ui(t),et(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Kl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=$f(r),e=Ct(r,e),l){case 0:t=Ii(null,t,r,e,n);break e;case 1:t=Ou(null,t,r,e,n);break e;case 11:t=Pu(null,t,r,e,n);break e;case 14:t=Ru(null,t,r,Ct(r.type,e),n);break e}throw Error(a(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Ii(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Ou(e,t,r,l,n);case 3:e:{if(Du(t),e===null)throw Error(a(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Ga(e,t),Fl(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=nr(Error(a(423)),t),t=Mu(e,t,r,n,l);break e}else if(r!==l){l=nr(Error(a(424)),t),t=Mu(e,t,r,n,l);break e}else for(pt=en(t.stateNode.containerInfo.firstChild),ft=t,we=!0,jt=null,n=Ya(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Zn(),r===l){t=Ut(e,t,n);break e}et(e,t,r,n)}t=t.child}return t;case 5:return qa(t),e===null&&fi(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,s=l.children,ri(r,l)?s=null:o!==null&&ri(r,o)&&(t.flags|=32),Lu(e,t),et(e,t,s,n),t.child;case 6:return e===null&&fi(t),null;case 13:return Iu(e,t,n);case 4:return ki(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=qn(t,null,r,n):et(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Pu(e,t,r,l,n);case 7:return et(e,t,t.pendingProps,n),t.child;case 8:return et(e,t,t.pendingProps.children,n),t.child;case 12:return et(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,s=l.value,ye(Dl,r._currentValue),r._currentValue=s,o!==null)if(wt(o.value,s)){if(o.children===l.children&&!rt.current){t=Ut(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var f=o.dependencies;if(f!==null){s=o.child;for(var h=f.firstContext;h!==null;){if(h.context===r){if(o.tag===1){h=Wt(-1,n&-n),h.tag=2;var j=o.updateQueue;if(j!==null){j=j.shared;var L=j.pending;L===null?h.next=h:(h.next=L.next,L.next=h),j.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),gi(o.return,n,t),f.lanes|=n;break}h=h.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(a(341));s.lanes|=n,f=s.alternate,f!==null&&(f.lanes|=n),gi(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}et(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,er(t,n),l=gt(l),r=r(l),t.flags|=1,et(e,t,r,n),t.child;case 14:return r=t.type,l=Ct(r,t.pendingProps),l=Ct(r.type,l),Ru(e,t,r,l,n);case 15:return Tu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Kl(e,t),t.tag=1,lt(r)?(e=!0,Pl(t)):e=!1,er(t,n),Su(t,r,l),Oi(t,r,l,n),Fi(null,t,r,!0,e,n);case 19:return Wu(e,t,n);case 22:return zu(e,t,n)}throw Error(a(156,t.tag))};function ac(e,t){return As(e,t)}function Af(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 kt(e,t,n,r){return new Af(e,t,n,r)}function rs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $f(e){if(typeof e=="function")return rs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ce)return 11;if(e===Ge)return 14}return 2}function fn(e,t){var n=e.alternate;return n===null?(n=kt(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 ro(e,t,n,r,l,o){var s=2;if(r=e,typeof e=="function")rs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case je:return Dn(n.children,l,o,t);case xe:s=8,l|=8;break;case Je:return e=kt(12,n,t,l|2),e.elementType=Je,e.lanes=o,e;case Pe:return e=kt(13,n,t,l),e.elementType=Pe,e.lanes=o,e;case We:return e=kt(19,n,t,l),e.elementType=We,e.lanes=o,e;case me:return lo(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Me:s=10;break e;case He:s=9;break e;case Ce:s=11;break e;case Ge:s=14;break e;case Le:s=16,r=null;break e}throw Error(a(130,e==null?e:typeof e,""))}return t=kt(s,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Dn(e,t,n,r){return e=kt(7,e,r,t),e.lanes=n,e}function lo(e,t,n,r){return e=kt(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function ls(e,t,n){return e=kt(6,e,null,t),e.lanes=n,e}function os(e,t,n){return t=kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Vf(e,t,n,r,l){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=Lo(0),this.expirationTimes=Lo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lo(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function is(e,t,n,r,l,o,s,f,h){return e=new Vf(e,t,n,f,h),t===1?(t=1,o===!0&&(t|=8)):t=0,o=kt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},xi(o),e}function Hf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(u){console.error(u)}}return i(),fs.exports=op(),fs.exports}var wc;function ip(){if(wc)return fo;wc=1;var i=Wc();return fo.createRoot=i.createRoot,fo.hydrateRoot=i.hydrateRoot,fo}var sp=ip();Wc();/** * @remix-run/router v1.23.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function br(){return br=Object.assign?Object.assign.bind():function(i){for(var u=1;u"u")throw new Error(u)}function Ns(i,u){if(!i){typeof console<"u"&&console.warn(u);try{throw new Error(u)}catch{}}}function up(){return Math.random().toString(36).substr(2,8)}function Cc(i,u){return{usr:i.state,key:i.key,idx:u}}function Ss(i,u,a,d){return a===void 0&&(a=null),br({pathname:typeof i=="string"?i:i.pathname,search:"",hash:""},typeof u=="string"?cr(u):u,{state:a,key:u&&u.key||d||up()})}function vo(i){let{pathname:u="/",search:a="",hash:d=""}=i;return a&&a!=="?"&&(u+=a.charAt(0)==="?"?a:"?"+a),d&&d!=="#"&&(u+=d.charAt(0)==="#"?d:"#"+d),u}function cr(i){let u={};if(i){let a=i.indexOf("#");a>=0&&(u.hash=i.substr(a),i=i.substr(0,a));let d=i.indexOf("?");d>=0&&(u.search=i.substr(d),i=i.substr(0,d)),i&&(u.pathname=i)}return u}function cp(i,u,a,d){d===void 0&&(d={});let{window:p=document.defaultView,v5Compat:m=!1}=d,g=p.history,w=mn.Pop,k=null,_=P();_==null&&(_=0,g.replaceState(br({},g.state,{idx:_}),""));function P(){return(g.state||{idx:null}).idx}function N(){w=mn.Pop;let C=P(),A=C==null?null:C-_;_=C,k&&k({action:w,location:R.location,delta:A})}function M(C,A){w=mn.Push;let $=Ss(R.location,C,A);_=P()+1;let G=Cc($,_),B=R.createHref($);try{g.pushState(G,"",B)}catch(ue){if(ue instanceof DOMException&&ue.name==="DataCloneError")throw ue;p.location.assign(B)}m&&k&&k({action:w,location:R.location,delta:1})}function H(C,A){w=mn.Replace;let $=Ss(R.location,C,A);_=P();let G=Cc($,_),B=R.createHref($);g.replaceState(G,"",B),m&&k&&k({action:w,location:R.location,delta:0})}function K(C){let A=p.location.origin!=="null"?p.location.origin:p.location.href,$=typeof C=="string"?C:vo(C);return $=$.replace(/ $/,"%20"),Ne(A,"No window.location.(origin|href) available to create URL for href: "+$),new URL($,A)}let R={get action(){return w},get location(){return i(p,g)},listen(C){if(k)throw new Error("A history only accepts one active listener");return p.addEventListener(jc,N),k=C,()=>{p.removeEventListener(jc,N),k=null}},createHref(C){return u(p,C)},createURL:K,encodeLocation(C){let A=K(C);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:M,replace:H,go(C){return g.go(C)}};return R}var Ec;(function(i){i.data="data",i.deferred="deferred",i.redirect="redirect",i.error="error"})(Ec||(Ec={}));function dp(i,u,a){return a===void 0&&(a="/"),fp(i,u,a)}function fp(i,u,a,d){let p=typeof u=="string"?cr(u):u,m=ar(p.pathname||"/",a);if(m==null)return null;let g=Uc(i);pp(g);let w=null,k=Cp(m);for(let _=0;w==null&&_{let k={relativePath:w===void 0?m.path||"":w,caseSensitive:m.caseSensitive===!0,childrenIndex:g,route:m};k.relativePath.startsWith("/")&&(Ne(k.relativePath.startsWith(d),'Absolute route path "'+k.relativePath+'" nested under path '+('"'+d+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),k.relativePath=k.relativePath.slice(d.length));let _=vn([d,k.relativePath]),P=a.concat(k);m.children&&m.children.length>0&&(Ne(m.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+_+'".')),Uc(m.children,u,P,_)),!(m.path==null&&!m.index)&&u.push({path:_,score:kp(_,m.index),routesMeta:P})};return i.forEach((m,g)=>{var w;if(m.path===""||!((w=m.path)!=null&&w.includes("?")))p(m,g);else for(let k of Bc(m.path))p(m,g,k)}),u}function Bc(i){let u=i.split("/");if(u.length===0)return[];let[a,...d]=u,p=a.endsWith("?"),m=a.replace(/\?$/,"");if(d.length===0)return p?[m,""]:[m];let g=Bc(d.join("/")),w=[];return w.push(...g.map(k=>k===""?m:[m,k].join("/"))),p&&w.push(...g),w.map(k=>i.startsWith("/")&&k===""?"/":k)}function pp(i){i.sort((u,a)=>u.score!==a.score?a.score-u.score:Sp(u.routesMeta.map(d=>d.childrenIndex),a.routesMeta.map(d=>d.childrenIndex)))}const hp=/^:[\w-]+$/,mp=3,vp=2,gp=1,yp=10,xp=-2,_c=i=>i==="*";function kp(i,u){let a=i.split("/"),d=a.length;return a.some(_c)&&(d+=xp),u&&(d+=vp),a.filter(p=>!_c(p)).reduce((p,m)=>p+(hp.test(m)?mp:m===""?gp:yp),d)}function Sp(i,u){return i.length===u.length&&i.slice(0,-1).every((d,p)=>d===u[p])?i[i.length-1]-u[u.length-1]:0}function wp(i,u,a){let{routesMeta:d}=i,p={},m="/",g=[];for(let w=0;w{let{paramName:M,isOptional:H}=P;if(M==="*"){let R=w[N]||"";g=m.slice(0,m.length-R.length).replace(/(.)\/+$/,"$1")}const K=w[N];return H&&!K?_[M]=void 0:_[M]=(K||"").replace(/%2F/g,"/"),_},{}),pathname:m,pathnameBase:g,pattern:i}}function jp(i,u,a){u===void 0&&(u=!1),a===void 0&&(a=!0),Ns(i==="*"||!i.endsWith("*")||i.endsWith("/*"),'Route path "'+i+'" will be treated as if it were '+('"'+i.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+i.replace(/\*$/,"/*")+'".'));let d=[],p="^"+i.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(g,w,k)=>(d.push({paramName:w,isOptional:k!=null}),k?"/?([^\\/]+)?":"/([^\\/]+)"));return i.endsWith("*")?(d.push({paramName:"*"}),p+=i==="*"||i==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?p+="\\/*$":i!==""&&i!=="/"&&(p+="(?:(?=\\/|$))"),[new RegExp(p,u?void 0:"i"),d]}function Cp(i){try{return i.split("/").map(u=>decodeURIComponent(u).replace(/\//g,"%2F")).join("/")}catch(u){return Ns(!1,'The URL path "'+i+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+u+").")),i}}function ar(i,u){if(u==="/")return i;if(!i.toLowerCase().startsWith(u.toLowerCase()))return null;let a=u.endsWith("/")?u.length-1:u.length,d=i.charAt(a);return d&&d!=="/"?null:i.slice(a)||"/"}const Ep=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_p=i=>Ep.test(i);function Np(i,u){u===void 0&&(u="/");let{pathname:a,search:d="",hash:p=""}=typeof i=="string"?cr(i):i,m;if(a)if(_p(a))m=a;else{if(a.includes("//")){let g=a;a=Ac(a),Ns(!1,"Pathnames cannot have embedded double slashes - normalizing "+(g+" -> "+a))}a.startsWith("/")?m=Nc(a.substring(1),"/"):m=Nc(a,u)}else m=u;return{pathname:m,search:Tp(d),hash:zp(p)}}function Nc(i,u){let a=u.replace(/\/+$/,"").split("/");return i.split("/").forEach(p=>{p===".."?a.length>1&&a.pop():p!=="."&&a.push(p)}),a.length>1?a.join("/"):"/"}function ms(i,u,a,d){return"Cannot include a '"+i+"' character in a manually specified "+("`to."+u+"` field ["+JSON.stringify(d)+"]. Please separate it out to the ")+("`to."+a+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Pp(i){return i.filter((u,a)=>a===0||u.route.path&&u.route.path.length>0)}function Ps(i,u){let a=Pp(i);return u?a.map((d,p)=>p===a.length-1?d.pathname:d.pathnameBase):a.map(d=>d.pathnameBase)}function Rs(i,u,a,d){d===void 0&&(d=!1);let p;typeof i=="string"?p=cr(i):(p=br({},i),Ne(!p.pathname||!p.pathname.includes("?"),ms("?","pathname","search",p)),Ne(!p.pathname||!p.pathname.includes("#"),ms("#","pathname","hash",p)),Ne(!p.search||!p.search.includes("#"),ms("#","search","hash",p)));let m=i===""||p.pathname==="",g=m?"/":p.pathname,w;if(g==null)w=a;else{let N=u.length-1;if(!d&&g.startsWith("..")){let M=g.split("/");for(;M[0]==="..";)M.shift(),N-=1;p.pathname=M.join("/")}w=N>=0?u[N]:"/"}let k=Np(p,w),_=g&&g!=="/"&&g.endsWith("/"),P=(m||g===".")&&a.endsWith("/");return!k.pathname.endsWith("/")&&(_||P)&&(k.pathname+="/"),k}const Ac=i=>i.replace(/\/\/+/g,"/"),vn=i=>Ac(i.join("/")),Rp=i=>i.replace(/\/+$/,"").replace(/^\/*/,"/"),Tp=i=>!i||i==="?"?"":i.startsWith("?")?i:"?"+i,zp=i=>!i||i==="#"?"":i.startsWith("#")?i:"#"+i;function Lp(i){return i!=null&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.internal=="boolean"&&"data"in i}const $c=["post","put","patch","delete"];new Set($c);const Op=["get",...$c];new Set(Op);/** * React Router v6.30.4 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function el(){return el=Object.assign?Object.assign.bind():function(i){for(var u=1;u{w.current=!0}),E.useCallback(function(_,P){if(P===void 0&&(P={}),!w.current)return;if(typeof _=="number"){d.go(_);return}let N=Rs(_,JSON.parse(g),m,P.relative==="path");i==null&&u!=="/"&&(N.pathname=N.pathname==="/"?u:vn([u,N.pathname])),(P.replace?d.replace:d.push)(N,P.state,P)},[u,d,g,m,i])}function ko(i,u){let{relative:a}=u===void 0?{}:u,{future:d}=E.useContext(At),{matches:p}=E.useContext(gn),{pathname:m}=fr(),g=JSON.stringify(Ps(p,d.v7_relativeSplatPath));return E.useMemo(()=>Rs(i,JSON.parse(g),m,a==="path"),[i,g,m,a])}function Ip(i,u){return Fp(i,u)}function Fp(i,u,a,d){dr()||Ne(!1);let{navigator:p}=E.useContext(At),{matches:m}=E.useContext(gn),g=m[m.length-1],w=g?g.params:{};g&&g.pathname;let k=g?g.pathnameBase:"/";g&&g.route;let _=fr(),P;if(u){var N;let C=typeof u=="string"?cr(u):u;k==="/"||(N=C.pathname)!=null&&N.startsWith(k)||Ne(!1),P=C}else P=_;let M=P.pathname||"/",H=M;if(k!=="/"){let C=k.replace(/^\//,"").split("/");H="/"+M.replace(/^\//,"").split("/").slice(C.length).join("/")}let K=dp(i,{pathname:H}),R=$p(K&&K.map(C=>Object.assign({},C,{params:Object.assign({},w,C.params),pathname:vn([k,p.encodeLocation?p.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?k:vn([k,p.encodeLocation?p.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),m,a,d);return u&&R?E.createElement(xo.Provider,{value:{location:el({pathname:"/",search:"",hash:"",state:null,key:"default"},P),navigationType:mn.Pop}},R):R}function Wp(){let i=Kp(),u=Lp(i)?i.status+" "+i.statusText:i instanceof Error?i.message:JSON.stringify(i),a=i instanceof Error?i.stack:null,p={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},u),a?E.createElement("pre",{style:p},a):null,null)}const Up=E.createElement(Wp,null);class Bp extends E.Component{constructor(u){super(u),this.state={location:u.location,revalidation:u.revalidation,error:u.error}}static getDerivedStateFromError(u){return{error:u}}static getDerivedStateFromProps(u,a){return a.location!==u.location||a.revalidation!=="idle"&&u.revalidation==="idle"?{error:u.error,location:u.location,revalidation:u.revalidation}:{error:u.error!==void 0?u.error:a.error,location:a.location,revalidation:u.revalidation||a.revalidation}}componentDidCatch(u,a){console.error("React Router caught the following error during render",u,a)}render(){return this.state.error!==void 0?E.createElement(gn.Provider,{value:this.props.routeContext},E.createElement(Hc.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Ap(i){let{routeContext:u,match:a,children:d}=i,p=E.useContext(yo);return p&&p.static&&p.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(p.staticContext._deepestRenderedBoundaryId=a.route.id),E.createElement(gn.Provider,{value:u},d)}function $p(i,u,a,d){var p;if(u===void 0&&(u=[]),a===void 0&&(a=null),d===void 0&&(d=null),i==null){var m;if(!a)return null;if(a.errors)i=a.matches;else if((m=d)!=null&&m.v7_partialHydration&&u.length===0&&!a.initialized&&a.matches.length>0)i=a.matches;else return null}let g=i,w=(p=a)==null?void 0:p.errors;if(w!=null){let P=g.findIndex(N=>N.route.id&&(w==null?void 0:w[N.route.id])!==void 0);P>=0||Ne(!1),g=g.slice(0,Math.min(g.length,P+1))}let k=!1,_=-1;if(a&&d&&d.v7_partialHydration)for(let P=0;P=0?g=g.slice(0,_+1):g=[g[0]];break}}}return g.reduceRight((P,N,M)=>{let H,K=!1,R=null,C=null;a&&(H=w&&N.route.id?w[N.route.id]:void 0,R=N.route.errorElement||Up,k&&(_<0&&M===0?(Jp("route-fallback"),K=!0,C=null):_===M&&(K=!0,C=N.route.hydrateFallbackElement||null)));let A=u.concat(g.slice(0,M+1)),$=()=>{let G;return H?G=R:K?G=C:N.route.Component?G=E.createElement(N.route.Component,null):N.route.element?G=N.route.element:G=P,E.createElement(Ap,{match:N,routeContext:{outlet:P,matches:A,isDataRoute:a!=null},children:G})};return a&&(N.route.ErrorBoundary||N.route.errorElement||M===0)?E.createElement(Bp,{location:a.location,revalidation:a.revalidation,component:R,error:H,children:$(),routeContext:{outlet:null,matches:A,isDataRoute:!0}}):$()},null)}var Yc=(function(i){return i.UseBlocker="useBlocker",i.UseRevalidator="useRevalidator",i.UseNavigateStable="useNavigate",i})(Yc||{}),Jc=(function(i){return i.UseBlocker="useBlocker",i.UseLoaderData="useLoaderData",i.UseActionData="useActionData",i.UseRouteError="useRouteError",i.UseNavigation="useNavigation",i.UseRouteLoaderData="useRouteLoaderData",i.UseMatches="useMatches",i.UseRevalidator="useRevalidator",i.UseNavigateStable="useNavigate",i.UseRouteId="useRouteId",i})(Jc||{});function Vp(i){let u=E.useContext(yo);return u||Ne(!1),u}function Hp(i){let u=E.useContext(Vc);return u||Ne(!1),u}function Qp(i){let u=E.useContext(gn);return u||Ne(!1),u}function Gc(i){let u=Qp(),a=u.matches[u.matches.length-1];return a.route.id||Ne(!1),a.route.id}function Kp(){var i;let u=E.useContext(Hc),a=Hp(),d=Gc();return u!==void 0?u:(i=a.errors)==null?void 0:i[d]}function Yp(){let{router:i}=Vp(Yc.UseNavigateStable),u=Gc(Jc.UseNavigateStable),a=E.useRef(!1);return Qc(()=>{a.current=!0}),E.useCallback(function(p,m){m===void 0&&(m={}),a.current&&(typeof p=="number"?i.navigate(p):i.navigate(p,el({fromRouteId:u},m)))},[i,u])}const Pc={};function Jp(i,u,a){Pc[i]||(Pc[i]=!0)}function Gp(i,u){i==null||i.v7_startTransition,i==null||i.v7_relativeSplatPath}function vs(i){let{to:u,replace:a,state:d,relative:p}=i;dr()||Ne(!1);let{future:m,static:g}=E.useContext(At),{matches:w}=E.useContext(gn),{pathname:k}=fr(),_=Kc(),P=Rs(u,Ps(w,m.v7_relativeSplatPath),k,p==="path"),N=JSON.stringify(P);return E.useEffect(()=>_(JSON.parse(N),{replace:a,state:d,relative:p}),[_,N,p,a,d]),null}function Zr(i){Ne(!1)}function Xp(i){let{basename:u="/",children:a=null,location:d,navigationType:p=mn.Pop,navigator:m,static:g=!1,future:w}=i;dr()&&Ne(!1);let k=u.replace(/^\/*/,"/"),_=E.useMemo(()=>({basename:k,navigator:m,static:g,future:el({v7_relativeSplatPath:!1},w)}),[k,w,m,g]);typeof d=="string"&&(d=cr(d));let{pathname:P="/",search:N="",hash:M="",state:H=null,key:K="default"}=d,R=E.useMemo(()=>{let C=ar(P,k);return C==null?null:{location:{pathname:C,search:N,hash:M,state:H,key:K},navigationType:p}},[k,P,N,M,H,K,p]);return R==null?null:E.createElement(At.Provider,{value:_},E.createElement(xo.Provider,{children:a,value:R}))}function Zp(i){let{children:u,location:a}=i;return Ip(js(u),a)}new Promise(()=>{});function js(i,u){u===void 0&&(u=[]);let a=[];return E.Children.forEach(i,(d,p)=>{if(!E.isValidElement(d))return;let m=[...u,p];if(d.type===E.Fragment){a.push.apply(a,js(d.props.children,m));return}d.type!==Zr&&Ne(!1),!d.props.index||!d.props.children||Ne(!1);let g={id:d.props.id||m.join("-"),caseSensitive:d.props.caseSensitive,element:d.props.element,Component:d.props.Component,index:d.props.index,path:d.props.path,loader:d.props.loader,action:d.props.action,errorElement:d.props.errorElement,ErrorBoundary:d.props.ErrorBoundary,hasErrorBoundary:d.props.ErrorBoundary!=null||d.props.errorElement!=null,shouldRevalidate:d.props.shouldRevalidate,handle:d.props.handle,lazy:d.props.lazy};d.props.children&&(g.children=js(d.props.children,m)),a.push(g)}),a}/** * React Router DOM v6.30.4 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function go(){return go=Object.assign?Object.assign.bind():function(i){for(var u=1;u{_&&Rc?Rc(()=>k(N)):k(N)},[k,_]);return E.useLayoutEffect(()=>g.listen(P),[g,P]),E.useEffect(()=>Gp(d),[d]),E.createElement(Xp,{basename:u,children:a,location:w.location,navigationType:w.action,navigator:g,future:d})}const ih=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ah=E.forwardRef(function(u,a){let{onClick:d,relative:p,reloadDocument:m,replace:g,state:w,target:k,to:_,preventScrollReset:P,viewTransition:N}=u,M=Xc(u,eh),{basename:H}=E.useContext(At),K,R=!1;if(typeof _=="string"&&sh.test(_)&&(K=_,ih))try{let G=new URL(window.location.href),B=_.startsWith("//")?new URL(G.protocol+_):new URL(_),ue=ar(B.pathname,H);B.origin===G.origin&&ue!=null?_=ue+B.search+B.hash:R=!0}catch{}let C=Dp(_,{relative:p}),A=dh(_,{replace:g,state:w,target:k,preventScrollReset:P,relative:p,viewTransition:N});function $(G){d&&d(G),G.defaultPrevented||A(G)}return E.createElement("a",go({},M,{href:K||C,onClick:R||m?d:$,ref:a,target:k}))}),uh=E.forwardRef(function(u,a){let{"aria-current":d="page",caseSensitive:p=!1,className:m="",end:g=!1,style:w,to:k,viewTransition:_,children:P}=u,N=Xc(u,th),M=ko(k,{relative:N.relative}),H=fr(),K=E.useContext(Vc),{navigator:R,basename:C}=E.useContext(At),A=K!=null&&fh(M)&&_===!0,$=R.encodeLocation?R.encodeLocation(M).pathname:M.pathname,G=H.pathname,B=K&&K.navigation&&K.navigation.location?K.navigation.location.pathname:null;p||(G=G.toLowerCase(),B=B?B.toLowerCase():null,$=$.toLowerCase()),B&&C&&(B=ar(B,C)||B);const ue=$!=="/"&&$.endsWith("/")?$.length-1:$.length;let de=G===$||!g&&G.startsWith($)&&G.charAt(ue)==="/",je=B!=null&&(B===$||!g&&B.startsWith($)&&B.charAt($.length)==="/"),xe={isActive:de,isPending:je,isTransitioning:A},Je=de?d:void 0,Me;typeof m=="function"?Me=m(xe):Me=[m,de?"active":null,je?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let He=typeof w=="function"?w(xe):w;return E.createElement(ah,go({},N,{"aria-current":Je,className:Me,ref:a,style:He,to:k,viewTransition:_}),typeof P=="function"?P(xe):P)});var Cs;(function(i){i.UseScrollRestoration="useScrollRestoration",i.UseSubmit="useSubmit",i.UseSubmitFetcher="useSubmitFetcher",i.UseFetcher="useFetcher",i.useViewTransitionState="useViewTransitionState"})(Cs||(Cs={}));var Tc;(function(i){i.UseFetcher="useFetcher",i.UseFetchers="useFetchers",i.UseScrollRestoration="useScrollRestoration"})(Tc||(Tc={}));function ch(i){let u=E.useContext(yo);return u||Ne(!1),u}function dh(i,u){let{target:a,replace:d,state:p,preventScrollReset:m,relative:g,viewTransition:w}=u===void 0?{}:u,k=Kc(),_=fr(),P=ko(i,{relative:g});return E.useCallback(N=>{if(bp(N,a)){N.preventDefault();let M=d!==void 0?d:vo(_)===vo(P);k(i,{replace:M,state:p,preventScrollReset:m,relative:g,viewTransition:w})}},[_,k,P,d,p,a,i,m,g,w])}function fh(i,u){u===void 0&&(u={});let a=E.useContext(rh);a==null&&Ne(!1);let{basename:d}=ch(Cs.useViewTransitionState),p=ko(i,{relative:u.relative});if(!a.isTransitioning)return!1;let m=ar(a.currentLocation.pathname,d)||a.currentLocation.pathname,g=ar(a.nextLocation.pathname,d)||a.nextLocation.pathname;return ws(p.pathname,g)!=null||ws(p.pathname,m)!=null}function ph(){if(window.matchMedia("(display-mode: standalone)").matches)return;const i=document.cookie.split(";").map(a=>a.trim()).find(a=>a.startsWith("hnf_inactivity_mins="));if(!i)return;const u=parseInt(i.split("=")[1]);return isNaN(u)||u<=0?void 0:u*60*1e3}const zc={background:"var(--navy-dark)",border:"1px solid var(--surface-2)",borderRadius:"6px",color:"var(--text)",padding:"0.625rem 0.75rem",fontSize:"1rem",width:"100%",outline:"none"},hh={background:"var(--hk-green)",color:"#fff",border:"none",borderRadius:"6px",padding:"0.625rem",fontSize:"1rem",fontWeight:600,marginTop:"0.25rem",width:"100%"};function mh({children:i}){const[u,a]=E.useState("checking"),[d,p]=E.useState(null),[m,g]=E.useState(""),[w,k]=E.useState(""),[_,P]=E.useState(""),[N,M]=E.useState(!1),H=E.useRef(null);E.useEffect(()=>{fetch("/api/auth/verify?app=hk-planner",{credentials:"include"}).then(async R=>{R.ok?(p(await R.json()),a("authed")):a("login")}).catch(()=>a("login"))},[]),E.useEffect(()=>{const R=ph();if(u!=="authed"||!R)return;async function C(){await fetch("/api/auth/logout",{method:"POST",credentials:"include"}).catch(()=>{}),p(null),a("login")}function A(){H.current&&clearTimeout(H.current),H.current=setTimeout(C,R)}const $=["mousemove","keydown","click","touchstart"];return $.forEach(G=>window.addEventListener(G,A,{passive:!0})),A(),()=>{H.current&&clearTimeout(H.current),$.forEach(G=>window.removeEventListener(G,A))}},[u]);async function K(R){R.preventDefault(),M(!0),P("");try{if(!(await fetch("/api/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:m,password:w})})).ok){P("Invalid email or password");return}const A=await fetch("/api/auth/verify?app=hk-planner",{credentials:"include"});A.ok?(p(await A.json()),a("authed")):P("You don't have access to this app.")}catch{P("Connection error — please try again")}finally{M(!1)}}return u==="checking"?c.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100dvh"},children:c.jsx("div",{style:{color:"var(--text-muted)"},children:"Loading…"})}):u==="login"?c.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100dvh",padding:"1.5rem",background:"var(--navy-dark)"},children:c.jsxs("div",{style:{background:"var(--navy)",borderRadius:"var(--radius)",padding:"2rem",width:"100%",maxWidth:"360px",border:"1px solid var(--surface-2)"},children:[c.jsx("h1",{style:{fontSize:"1.4rem",marginBottom:"0.25rem",color:"#74c69d"},children:"HK Planner"}),c.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.875rem",marginBottom:"1.5rem"},children:void 0}),c.jsxs("form",{onSubmit:K,style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[c.jsx("input",{type:"email",value:m,onChange:R=>g(R.target.value),placeholder:"Email",required:!0,autoComplete:"email",style:zc}),c.jsx("input",{type:"password",value:w,onChange:R=>k(R.target.value),placeholder:"Password",required:!0,autoComplete:"current-password",style:zc}),_&&c.jsx("p",{style:{color:"#f87171",fontSize:"0.875rem"},children:_}),c.jsx("button",{type:"submit",disabled:N,style:hh,children:N?"Signing in…":"Sign in"})]})]})}):c.jsx(c.Fragment,{children:i(d)})}/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zc=(...i)=>i.filter((u,a,d)=>!!u&&u.trim()!==""&&d.indexOf(u)===a).join(" ").trim();/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vh=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gh=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(u,a,d)=>d?d.toUpperCase():a.toLowerCase());/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lc=i=>{const u=gh(i);return u.charAt(0).toUpperCase()+u.slice(1)};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var gs={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yh=i=>{for(const u in i)if(u.startsWith("aria-")||u==="role"||u==="title")return!0;return!1},xh=E.createContext({}),kh=()=>E.useContext(xh),Sh=E.forwardRef(({color:i,size:u,strokeWidth:a,absoluteStrokeWidth:d,className:p="",children:m,iconNode:g,...w},k)=>{const{size:_=24,strokeWidth:P=2,absoluteStrokeWidth:N=!1,color:M="currentColor",className:H=""}=kh()??{},K=d??N?Number(a??P)*24/Number(u??_):a??P;return E.createElement("svg",{ref:k,...gs,width:u??_??gs.width,height:u??_??gs.height,stroke:i??M,strokeWidth:K,className:Zc("lucide",H,p),...!m&&!yh(w)&&{"aria-hidden":"true"},...w},[...g.map(([R,C])=>E.createElement(R,C)),...Array.isArray(m)?m:[m]])});/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tl=(i,u)=>{const a=E.forwardRef(({className:d,...p},m)=>E.createElement(Sh,{ref:m,iconNode:u,className:Zc(`lucide-${vh(Lc(i))}`,`lucide-${i}`,d),...p}));return a.displayName=Lc(i),a};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wh=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],Oc=tl("calendar-clock",wh);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jh=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Ch=tl("grip-vertical",jh);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eh=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],_h=tl("log-out",Eh);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nh=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Es=tl("refresh-cw",Nh);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ph=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Rh=tl("settings",Ph);function Th({visible:i}){return i?c.jsxs("div",{style:{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,background:"var(--sidebar)",color:"var(--text-light)",display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",padding:"10px 16px",fontSize:"14px",boxShadow:"0 -2px 8px rgba(0,0,0,0.3)"},children:[c.jsx("span",{children:"A new version is available."}),c.jsxs("button",{onClick:()=>window.location.reload(),style:{display:"flex",alignItems:"center",gap:"6px",background:"var(--accent)",color:"var(--sidebar)",border:"none",borderRadius:"4px",padding:"6px 14px",fontWeight:600,cursor:"pointer",fontSize:"13px"},children:[c.jsx(Es,{size:14,strokeWidth:1.75}),"Reload"]})]}):null}const zh=120*1e3;function Lh(i){const[u,a]=E.useState(!1);return E.useEffect(()=>{let d=null;async function p(){try{const w=await fetch(i,{cache:"no-store"});if(!w.ok)return;const _=(await w.json()).version;if(!_)return;d===null?d=_:_!==d&&a(!0)}catch{}}p();const m=setInterval(p,zh);function g(){document.visibilityState==="visible"&&p()}return document.addEventListener("visibilitychange",g),()=>{clearInterval(m),document.removeEventListener("visibilitychange",g)}},[i]),u}function qc(i,u){return i.is_admin||i.caps.includes(u)}const Oh="width=1280",Dh="width=device-width, initial-scale=1.0";function Dc(i){const u=document.querySelector('meta[name="viewport"]');u&&(u.content=i)}function Mh(i){E.useEffect(()=>(Dc(Oh),window.parent.postMessage({type:"hnf:viewport",mode:i},"*"),()=>{Dc(Dh),window.parent.postMessage({type:"hnf:viewport",mode:"responsive"},"*")}),[i])}function Ih({user:i,children:u}){Mh("desktop");async function a(){await fetch("/hk-planner/api/auth/logout",{method:"POST",credentials:"include"}),window.location.reload()}return c.jsxs("div",{style:{display:"flex",height:"100dvh",overflow:"hidden"},children:[c.jsxs("nav",{style:{width:"200px",flexShrink:0,background:"var(--navy)",display:"flex",flexDirection:"column",padding:"1rem 0",borderRight:"1px solid var(--surface-2)"},children:[c.jsx("div",{style:{padding:"0 1rem 1rem",borderBottom:"1px solid var(--surface-2)"},children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[c.jsx(Oc,{size:20,strokeWidth:1.75,color:"#74c69d"}),c.jsx("span",{style:{color:"#74c69d",fontWeight:700,fontSize:"0.95rem"},children:"HK Planner"})]})}),c.jsxs("div",{className:"nav-scroll",style:{flex:1,padding:"0.5rem 0",overflowY:"auto"},children:[c.jsx(Mc,{to:"/planner",icon:Oc,label:"Planner"}),qc(i,"settings")&&c.jsx(Mc,{to:"/settings",icon:Rh,label:"Settings"})]}),c.jsxs("div",{style:{padding:"0.75rem 1rem",borderTop:"1px solid var(--surface-2)"},children:[c.jsxs("div",{style:{marginBottom:"0.5rem"},children:[c.jsx("div",{style:{color:"var(--text)",fontSize:"0.8rem",fontWeight:600},children:i.name}),c.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.72rem"},children:i.email})]}),c.jsxs("button",{onClick:a,style:{display:"flex",alignItems:"center",gap:"0.5rem",background:"none",border:"none",color:"var(--text-muted)",fontSize:"0.8rem",padding:"0.375rem 0",width:"100%",cursor:"pointer"},children:[c.jsx(_h,{size:14,strokeWidth:1.75}),"Sign out"]})]})]}),c.jsx("main",{style:{flex:1,overflow:"auto",background:"var(--body-bg)"},children:u})]})}function Mc({to:i,icon:u,label:a}){return c.jsxs(uh,{to:i,style:({isActive:d})=>({display:"flex",alignItems:"center",gap:"0.625rem",padding:"0.625rem 1rem",textDecoration:"none",color:d?"#74c69d":"var(--text)",background:d?"var(--surface)":"transparent",borderLeft:d?"2px solid #74c69d":"2px solid transparent",fontSize:"0.875rem",transition:"background 0.15s"}),children:[c.jsx(u,{size:15,strokeWidth:1.75}),a]})}const Fh="/hk-planner/api";async function nt(i,u){const a=await fetch(Fh+i,{credentials:"include",...u});if(a.status===401)throw(window.top??window).location.href="/login",new Error("Unauthenticated");if(!a.ok){const d=await a.json().catch(()=>({}));throw new Error(d.error||`HTTP ${a.status}`)}return a.json()}function Wh(i,u,a=!1){const d=new URLSearchParams;return i&&d.set("week_start",i),u&&d.set("last_viewed",u),a&&d.set("force_refresh","1"),nt(`/bookings?${d}`)}function bc(){return nt("/config")}function Uh(i,u,a){return nt("/config/time-requirements",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cat:i,action:u,value:a})})}function Bh(i){return nt("/config/staff",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({staff_data:i})})}function Ah(i){return nt("/config/pickup",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pickup_data:i})})}function $h(i){return nt("/config/general-tasks",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({general_tasks:i})})}function Vh(i){return nt("/config/last-reviewed",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({date:i})})}function Hh(){return nt("/categories")}function Qh(i,u){return nt("/categories",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:i,excluded:u})})}function Kh(){return nt("/newbook/test",{method:"POST"})}function Yh(){return nt("/workforce/departments")}function Jh(i){return nt("/config/workforce-departments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dept_ids:i})})}function Gh(i,u){return nt(`/workforce/sync?start=${i}&end=${u}`,{method:"POST"})}function Xh(){return nt("/workforce/staff")}function Zh(i){return nt("/config/adjustments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({adjustments:i})})}function po(){const i=new Date;return`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function ys(i,u){const[a,d,p]=i.split("-").map(Number),m=new Date(a,d-1,p);return m.setDate(m.getDate()+u),`${m.getFullYear()}-${String(m.getMonth()+1).padStart(2,"0")}-${String(m.getDate()).padStart(2,"0")}`}function So(i){const u=new Date(i+"T00:00:00");return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][u.getDay()]+" "+u.getDate()+" "+["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][u.getMonth()]}function qh(i){const u=new Date(i+"T00:00:00");return["Mon","Tue","Wed","Thu","Fri","Sat","Sun"][(u.getDay()+6)%7]}function bh(i){const u=new Date(i+"T00:00:00");return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][u.getDay()]}function qr(i){const u=new Date(i+"T00:00:00").getDay();return u===0||u===6}function em(i,u){const a=u.pickup_hint??0,d=u.pickup_lead??0,p=a>0?`${a} room${a===1?"":"s"} picked up within ${d} day${d===1?"":"s"} of arrival`:"no late pickups";return`Last ${bh(i)}: ${u.prior_occ} occ (${u.prior_vac} vac) — ${p}`}function Ic(i){return new Date(i+"T00:00:00").toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"})}function Ye(i){return i.toFixed(2)+"h"}function ur(i,u,a,d,p){var _;const m=Math.max(0,p-d),g=(_=i[u])==null?void 0:_[a];if(!g||!g.count)return 0;const w=g.total-g.count,k=d>w?Math.max(0,g.total-d):g.count;return Math.min(k,m)}function tm(i,u,a,d,p){const m={};for(const g of i.dates){const w=qh(g),k=d.reduce((P,N)=>P+(N.hours[w]||0)/60,0),_=p.reduce((P,N)=>P+(N.hours[g]||0),0);m[g]={booked:0,pickup:0,general:k,adjustments:_,total:k+_,by_cat:{},pickup_by_cat:{}}}for(const g of i.categories){const w=u[g.id]||{depart:0,stay:0,arrive:0};i.dates.forEach((k,_)=>{const P=g.days[k],N=P.stays+P.arrivals,M=ur(a,g.id,k,N,g.total_rooms),H=(P.departs*(w.depart||0)+P.stays*(w.stay||0)+P.arrivals*(w.arrive||0))/60,K=M*(w.arrive||0)/60;m[k].by_cat[g.id]=H,m[k].pickup_by_cat[g.id]=(m[k].pickup_by_cat[g.id]||0)+K,m[k].booked+=H,m[k].pickup+=K,m[k].total+=H+K;const R=i.dates[_+1];if(R&&M>0){const C=M*(w.depart||0)/60;m[R].pickup_by_cat[g.id]=(m[R].pickup_by_cat[g.id]||0)+C,m[R].pickup+=C,m[R].total+=C}})}return m}function nm(){const[i,u]=E.useState(null),[a,d]=E.useState({}),[p,m]=E.useState([]),[g,w]=E.useState({}),[k,_]=E.useState([]),[P,N]=E.useState([]),[M,H]=E.useState(4),[K,R]=E.useState(1),[C,A]=E.useState(1),[$,G]=E.useState(2),[B,ue]=E.useState(null),[de,je]=E.useState([]),[xe,Je]=E.useState(!1),[Me,He]=E.useState(null),[Ce,Pe]=E.useState(""),[We,Ge]=E.useState(""),[Le,me]=E.useState(!0),[F,X]=E.useState(""),[W,y]=E.useState(null),T=E.useRef({}),ne=E.useRef(null),le=E.useRef(!1),oe=E.useRef(null);oe.current=Me;function ie(b,ve,ut=400){clearTimeout(T.current[b]),T.current[b]=setTimeout(ve,ut)}function ce(b,ve=!1){ne.current&&clearTimeout(ne.current),y({text:b,err:ve}),ne.current=setTimeout(()=>y(null),ve?5e3:2500)}function se(){const b=po();b!==We&&(Ge(b),Vh(b).catch(()=>{}))}const fe=E.useCallback(async(b=!1,ve)=>{me(!0),X("");const ut=po(),Qt=oe.current||ut,Kt=ve!==void 0?ve||ys(ut,-1):Ce||We||ys(ut,-1);try{const[ct,Be]=await Promise.all([Wh(Qt,Kt,b),bc()]);u(ct),d(Be.time_requirements||{}),m(Be.staff_data||[]),w(Be.pickup_data||{}),_(Be.general_tasks||[]),N(Be.adjustments||[]),H(Be.warn_over_red_hrs??4),R(Be.warn_over_amber_hrs??1),A(Be.warn_under_amber_hrs??1),G(Be.warn_under_red_hrs??2),ue(Be.workforce_rota||null),Be.last_reviewed&&(Ge(Be.last_reviewed),Ce||Pe(Be.last_reviewed))}catch(ct){X(ct instanceof Error?ct.message:"Failed to load data")}finally{me(!1)}},[Ce,We]);E.useEffect(()=>{fe(!1)},[]),E.useEffect(()=>{B&&!le.current&&(le.current=!0,Xh().then(je).catch(()=>{}))},[B]),E.useEffect(()=>{function b(){p.length&&navigator.sendBeacon("/hk-planner/api/config/staff",JSON.stringify({staff_data:p})),Object.keys(g).length&&navigator.sendBeacon("/hk-planner/api/config/pickup",JSON.stringify({pickup_data:g})),P.length&&navigator.sendBeacon("/hk-planner/api/config/adjustments",JSON.stringify({adjustments:P}))}return window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[p,g,P]);function Ue(b){const ve=po(),ut=ys(oe.current||ve,b);oe.current=ut,He(ut),se(),fe(!0)}function $t(){oe.current=null,He(null),se(),fe(!0)}function Mn(){se(),fe(!0)}function Vt(b,ve,ut,Qt){const Kt=Qt.days[ve],ct=Kt.stays+Kt.arrivals,Be=Math.max(0,Qt.total_rooms-ct),Sn=ur(g,b,ve,ct,Qt.total_rooms),Yt=Math.max(0,Math.min(Sn+ut,Be)),nl={...g,[b]:{...g[b]||{},[ve]:{count:Yt,total:ct+Yt}}};w(nl),se(),ie("pickup",()=>Ah(nl).then(()=>ce("Pickup saved")).catch(rl=>ce(rl.message,!0)))}function Ht(b){N(b),ie("adjustments",()=>Zh(b).then(()=>ce("Adjustments saved")).catch(ve=>ce(ve.message,!0)))}function In(){Ht([...P,{label:"",hours:{}}])}function yn(b){m(b),se(),ie("staff",()=>Bh(b).then(()=>ce("Staff hours saved")).catch(ve=>ce(ve.message,!0)))}function xn(){yn([...p,{name:"",hours:{}}])}async function kn(){if(i){Je(!0);try{const b=await Gh(i.dates[0],i.dates[i.dates.length-1]);ue(b),ce("Rota synced from Workforce")}catch(b){ce(b instanceof Error?b.message:"Sync failed",!0)}finally{Je(!1)}}}function I(){if(!B)return"Never synced";const b=new Date(B.last_sync).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"});return i&&B.dates[0]===i.dates[0]&&B.dates[1]===i.dates[i.dates.length-1]?`Synced ${b}`:`Synced ${b} — different week`}const ee=i?tm(i,a,g,k,P):null,re=po(),Oe=Me||re;return c.jsxs("div",{style:{padding:"1.5rem",maxWidth:"1600px"},children:[c.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.75rem",marginBottom:"1.25rem"},children:[c.jsxs("div",{children:[c.jsx("h1",{style:{fontSize:"1.15rem",fontWeight:700,color:"var(--text-dark)"},children:"Housekeeping Planner"}),i&&c.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-mid)",marginTop:"0.1rem"},children:[Ic(i.dates[0])," – ",Ic(i.dates[i.dates.length-1])]})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",marginLeft:"auto",flexWrap:"wrap"},children:[c.jsx(sr,{onClick:()=>Ue(-7),children:"‹ Prev"}),c.jsx(sr,{onClick:$t,primary:!0,children:"Today"}),c.jsx(sr,{onClick:()=>Ue(7),children:"Next ›"}),c.jsx("input",{type:"date",value:Oe,onChange:b=>{if(b.target.value){const ve=b.target.value;oe.current=ve,He(ve),se(),ie("weekStart",()=>fe(!0),600)}},style:{border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.35rem 0.5rem",fontSize:"0.82rem",color:"var(--text-dark)"}}),c.jsx("div",{style:{width:"1px",height:"24px",background:"var(--card-border)"}}),c.jsxs("label",{style:{fontSize:"0.78rem",color:"var(--text-mid)",display:"flex",alignItems:"center",gap:"0.3rem"},children:[c.jsx("span",{children:"Since"}),c.jsx("input",{type:"date",value:Ce,onChange:b=>{if(b.target.value){const ve=b.target.value;Pe(ve),ie("lastViewed",()=>fe(!0,ve),600)}},style:{border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.3rem 0.5rem",fontSize:"0.78rem",color:"var(--text-dark)"}})]}),c.jsx(sr,{onClick:()=>{se(),fe(!0)},children:"Update to now"}),c.jsx("div",{style:{width:"1px",height:"24px",background:"var(--card-border)"}}),c.jsx("button",{onClick:Mn,title:"Refresh",style:{background:"var(--card-bg)",border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.35rem 0.5rem",display:"flex",alignItems:"center",gap:"0.3rem",fontSize:"0.82rem",color:"var(--text-dark)"},children:c.jsx(Es,{size:13,strokeWidth:1.75,style:{animation:Le?"spin 1s linear infinite":"none"}})})]})]}),c.jsx("style",{children:"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }"}),W&&c.jsx("div",{style:{display:"inline-block",marginBottom:"0.75rem",padding:"0.35rem 0.75rem",borderRadius:"6px",fontSize:"0.8rem",fontWeight:500,background:W.err?"#fee2e2":"#dcfce7",color:W.err?"var(--danger)":"var(--success)"},children:W.text}),F&&c.jsxs("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",borderRadius:"8px",background:"#fee2e2",color:"var(--danger)",fontSize:"0.875rem"},children:["Error: ",F]}),Le&&!i&&c.jsx("div",{style:{color:"var(--text-mid)",padding:"2rem 0",textAlign:"center"},children:"Loading bookings…"}),i&&ee&&c.jsxs(c.Fragment,{children:[c.jsx(ho,{title:"7-Day Occupancy",children:c.jsx("div",{className:"table-scroll",children:c.jsx(rm,{bookings:i,pickup:g,onPickupChange:Vt})})}),c.jsx(ho,{title:"Required Hours",children:c.jsx("div",{className:"table-scroll",children:c.jsx(im,{bookings:i,required:ee})})}),c.jsx(ho,{title:"Adjustments",action:c.jsx(sr,{onClick:In,children:"+ Add adjustment"}),children:c.jsx("div",{className:"table-scroll",children:c.jsx(um,{bookings:i,adjustments:P,onChange:Ht})})}),c.jsx(ho,{title:"Staff Rota",action:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",flexWrap:"wrap"},children:[c.jsxs("button",{onClick:kn,disabled:xe,style:{display:"flex",alignItems:"center",gap:"0.3rem",background:"var(--card-bg)",color:"var(--text-dark)",border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.3rem 0.65rem",fontSize:"0.78rem",fontWeight:600},children:[c.jsx(Es,{size:11,strokeWidth:1.75,style:{animation:xe?"spin 1s linear infinite":"none"}}),xe?"Syncing…":"Sync from Workforce"]}),c.jsx("span",{style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:I()}),c.jsx(sr,{onClick:xn,children:"+ Add staff"})]}),children:c.jsx("div",{className:"table-scroll",children:c.jsx(sm,{bookings:i,staff:p,required:ee,warnOverRed:M,warnOverAmber:K,warnUnderAmber:C,warnUnderRed:$,onChange:yn,workforceRota:B,wfStaff:de})})})]})]})}function ho({title:i,children:u,action:a}){return c.jsxs("div",{style:{marginBottom:"1.5rem"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"0.5rem"},children:[c.jsx("h2",{style:{fontSize:"0.72rem",fontWeight:700,color:"var(--text-mid)",textTransform:"uppercase",letterSpacing:"0.08em"},children:i}),a]}),u]})}function sr({children:i,onClick:u,primary:a}){return c.jsx("button",{onClick:u,style:{background:a?"var(--hk-green)":"var(--card-bg)",color:a?"#fff":"var(--text-dark)",border:`1px solid ${a?"var(--hk-green)":"var(--card-border)"}`,borderRadius:"6px",padding:"0.35rem 0.75rem",fontSize:"0.82rem",fontWeight:600},children:i})}function rm({bookings:i,pickup:u,onPickupChange:a}){const{dates:d,categories:p}=i;return c.jsxs("table",{className:"hk-table",children:[c.jsxs("thead",{children:[c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",rowSpan:2,children:"Category"}),d.map(m=>c.jsx("th",{colSpan:2,style:{borderLeft:"2px solid rgba(255,255,255,0.3)",...qr(m)?{background:"#253555"}:{}},children:So(m)},m))]}),c.jsx("tr",{children:d.map(m=>c.jsxs(c.Fragment,{children:[c.jsx("th",{style:{fontSize:"0.72rem",fontWeight:400,minWidth:"72px",background:qr(m)?"#2a3d5e":"#1e2d42",borderLeft:"2px solid rgba(255,255,255,0.3)"},children:"Rooms"},m+"-r"),c.jsx("th",{style:{fontSize:"0.72rem",fontWeight:400,minWidth:"56px",textAlign:"center",background:qr(m)?"#2a3d5e":"#1e2d42",borderLeft:"1px solid rgba(255,255,255,0.1)"},children:"D / S / A"},m+"-d")]}))})]}),c.jsx("tbody",{children:p.map((m,g)=>{const w=g===p.length-1;return c.jsx(lm,{cat:m,dates:d,pickup:u,onPickupChange:(k,_)=>a(m.id,k,_,m),isLast:w},m.id)})}),c.jsx("tfoot",{children:c.jsx(om,{dates:d,cats:p,pickup:u})})]})}function lm({cat:i,dates:u,pickup:a,onPickupChange:d,isLast:p}){const m=p?"2px solid var(--card-border)":void 0;return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{borderBottom:m},children:i.name}),u.map((g,w)=>{var ue;const k=i.days[g],_=k.stays+k.arrivals,P=Math.max(0,i.total_rooms-_),N=ur(a,i.id,g,_,i.total_rooms),M=u[w-1],H=M?i.days[M].stays+i.days[M].arrivals:0,K=M?ur(a,i.id,M,H,i.total_rooms):0,R=k.delta_new||0,C=k.delta_cancelled||0,A=qr(g),$=(ue=a[i.id])==null?void 0:ue[g],G=em(g,k);let B="";if($&&$.count){const de=$.total-$.count,je=_>de?"changed":"unchanged",xe=_>de?"decreased":"remains";B=`+${$.count} pickup set when booked was ${de} (target ${$.total}). Booked ${je}, so pickup ${xe}.`}return B=(B?B+" | ":"")+G,c.jsxs(c.Fragment,{children:[c.jsxs("td",{style:{textAlign:"center",verticalAlign:"middle",borderBottom:m,padding:"0.4rem 0.3rem",borderLeft:"2px solid var(--card-border)",...A?{background:"rgba(100,120,160,0.07)"}:{}},children:[(R>0||C>0)&&c.jsxs("div",{style:{marginBottom:"2px",fontSize:"0.72rem"},children:[R>0&&c.jsxs("span",{className:"delta-new",children:["▲",R]}),C>0&&c.jsxs("span",{className:"delta-canc",children:[" ▼",C]})]}),c.jsxs("div",{style:{fontWeight:700,fontSize:"1.1rem"},title:B,children:[_,N>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",N]})]}),c.jsxs("div",{style:{fontSize:"0.72rem",color:"var(--text-mid)",marginBottom:"4px"},children:[P," vac",N>0&&c.jsxs("span",{className:"pickup-tag",children:[" (",P-N,")"]})]}),c.jsxs("div",{className:"pickup-ctrl",children:[c.jsx("button",{className:"pickup-btn",disabled:N<=0,onClick:()=>d(g,-1),children:"−"}),c.jsx("span",{className:"pickup-num",children:N}),c.jsx("button",{className:"pickup-btn",disabled:N>=P,title:G,onClick:()=>d(g,1),children:"+"})]})]},g+"-r"),c.jsxs("td",{style:{verticalAlign:"middle",borderLeft:"1px solid var(--card-border)",borderBottom:m,padding:"0.4rem 0.3rem",textAlign:"center",...A?{background:"rgba(100,120,160,0.07)"}:{}},children:[c.jsxs("div",{style:{fontSize:"0.8rem",color:"#c2502e",fontWeight:600},children:[k.departs,"d",K>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",K]})]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1d6fb8",fontWeight:600},children:[k.stays,"s"]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1a7a4a",fontWeight:600},children:[k.arrivals,"a",N>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",N]})]})]},g+"-dsa")]})})]})}function om({dates:i,cats:u,pickup:a}){return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontStyle:"italic"},children:"Total"}),i.map((d,p)=>{let m=0,g=0,w=0,k=0,_=0,P=0,N=0,M=0,H=0;for(const R of u){const C=R.days[d],A=C.stays+C.arrivals,$=Math.max(0,R.total_rooms-A),G=ur(a,R.id,d,A,R.total_rooms),B=i[p-1],ue=B?R.days[B].stays+R.days[B].arrivals:0,de=B?ur(a,R.id,B,ue,R.total_rooms):0;m+=A,g+=$,w+=G,k+=de,_+=C.departs,P+=C.stays,N+=C.arrivals,M+=C.delta_new||0,H+=C.delta_cancelled||0}const K=qr(d);return c.jsxs(c.Fragment,{children:[c.jsxs("td",{style:{textAlign:"center",verticalAlign:"middle",padding:"0.4rem 0.3rem",borderLeft:"2px solid var(--card-border)",...K?{background:"rgba(100,120,160,0.07)"}:{}},children:[(M>0||H>0)&&c.jsxs("div",{style:{marginBottom:"2px",fontSize:"0.72rem"},children:[M>0&&c.jsxs("span",{className:"delta-new",children:["▲",M]}),H>0&&c.jsxs("span",{className:"delta-canc",children:[" ▼",H]})]}),c.jsxs("div",{style:{fontWeight:700,fontSize:"1.1rem"},children:[m,w>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",w]})]}),c.jsxs("div",{style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:[g," vac",w>0&&c.jsxs("span",{className:"pickup-tag",children:[" (",g-w,")"]})]})]},d+"-r"),c.jsxs("td",{style:{verticalAlign:"middle",borderLeft:"1px solid var(--card-border)",padding:"0.4rem 0.3rem",textAlign:"center",...K?{background:"rgba(100,120,160,0.07)"}:{}},children:[c.jsxs("div",{style:{fontSize:"0.8rem",color:"#c2502e",fontWeight:600},children:[_,"d",k>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",k]})]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1d6fb8",fontWeight:600},children:[P,"s"]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1a7a4a",fontWeight:600},children:[N,"a",w>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",w]})]})]},d+"-dsa")]})})]})}function im({bookings:i,required:u}){const{dates:a,categories:d}=i;return c.jsxs("table",{className:"hk-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Category"}),a.map(p=>c.jsx("th",{children:So(p)},p))]})}),c.jsx("tbody",{children:d.map(p=>c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",children:p.name}),a.map(m=>{const g=u[m].by_cat[p.id]||0,w=u[m].pickup_by_cat[p.id]||0;return c.jsxs("td",{children:[g===0&&w===0?"—":Ye(g),w>.001&&c.jsxs("span",{className:"pickup-tag",children:[" (+",Ye(w),")"]})]},m)})]},p.id))}),c.jsxs("tfoot",{children:[c.jsxs("tr",{style:{background:"#f1f5f9"},children:[c.jsx("td",{className:"col-label",style:{color:"var(--text-mid)",fontSize:"0.78rem"},children:"Booked hrs"}),a.map(p=>c.jsx("td",{children:Ye(u[p].booked)},p))]}),c.jsxs("tr",{style:{background:"#f1f5f9"},children:[c.jsx("td",{className:"col-label",style:{color:"var(--text-mid)",fontSize:"0.78rem"},children:"Pickup hrs"}),a.map(p=>c.jsx("td",{children:u[p].pickup>.001?Ye(u[p].pickup):"—"},p))]}),c.jsxs("tr",{style:{background:"#f1f5f9"},children:[c.jsx("td",{className:"col-label",style:{color:"var(--text-mid)",fontSize:"0.78rem"},children:"Recurring tasks"}),a.map(p=>c.jsx("td",{children:u[p].general>.001?Ye(u[p].general):"—"},p))]}),a.some(p=>u[p].adjustments!==0)&&c.jsxs("tr",{style:{background:"#f1f5f9"},children:[c.jsx("td",{className:"col-label",style:{color:"var(--text-mid)",fontSize:"0.78rem"},children:"Adjustments"}),a.map(p=>{const m=u[p].adjustments;return c.jsx("td",{style:{color:m<0?"var(--danger)":m>0?"#1a7a4a":"var(--text-mid)"},children:m===0?"—":(m>0?"+":"")+Ye(m)},p)})]}),c.jsxs("tr",{style:{background:"#e2e8f0"},children:[c.jsx("td",{className:"col-label",children:"Total Required"}),a.map(p=>c.jsxs("td",{style:{fontWeight:700},children:[Ye(u[p].total),u[p].pickup>.001&&c.jsxs("span",{className:"pickup-tag",style:{display:"block",fontSize:"0.7rem"},children:["inc ",Ye(u[p].pickup)," pickup"]})]},p))]})]})]})}function sm({bookings:i,staff:u,required:a,warnOverRed:d,warnOverAmber:p,warnUnderAmber:m,warnUnderRed:g,onChange:w,workforceRota:k,wfStaff:_}){const{dates:P}=i;function N(R,C){const A=u.map(($,G)=>G===R?{...$,name:C}:$);w(A)}function M(R,C,A){const $=parseFloat(A),G=u.map((B,ue)=>{if(ue!==R)return B;const de={...B.hours};return!isNaN($)&&$>=0?de[C]=$:delete de[C],{...B,hours:de}});w(G)}function H(R){w(u.filter((C,A)=>A!==R))}const K=(k==null?void 0:k.staff)??[];return c.jsxs("table",{className:"hk-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Staff Member"}),P.map(R=>c.jsx("th",{children:So(R)},R)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsxs("tbody",{children:[K.map(R=>c.jsxs("tr",{style:{background:"rgba(42,100,72,0.05)"},children:[c.jsxs("td",{className:"col-label",children:[c.jsx("span",{style:{display:"inline-block",fontSize:"0.67rem",fontWeight:700,background:"rgba(42,100,72,0.18)",color:"#1a7a4a",borderRadius:"3px",padding:"0 4px",marginRight:"0.4rem",lineHeight:"1.5"},children:"WF"}),R.name]}),P.map(C=>{const A=R.days[C];return c.jsx("td",{style:{textAlign:"center",padding:"0.3rem 0.4rem",verticalAlign:"middle"},children:A?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{fontSize:"0.68rem",color:"var(--text-mid)",lineHeight:1.25},children:A.times}),c.jsx("div",{style:{fontWeight:600},children:Ye(A.hours)})]}):c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"})},C)}),c.jsx("td",{})]},"wf-"+R.id)),_.length>0&&c.jsx("datalist",{id:"wf-staff-datalist",children:_.map(R=>c.jsx("option",{value:R.name},R.id))}),u.map((R,C)=>c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{padding:"0.3rem 0.5rem"},children:c.jsx("input",{className:"hk-text-input",value:R.name,placeholder:"Staff name",list:_.length>0?"wf-staff-datalist":void 0,onChange:A=>N(C,A.target.value)})}),P.map(A=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:24,step:.5,value:R.hours[A]??"",placeholder:"0",onChange:$=>M(C,A,$.target.value)})},A)),c.jsx("td",{children:c.jsx("button",{onClick:()=>H(C),style:{background:"none",border:"none",color:"var(--text-mid)",fontSize:"1rem",padding:"0.2rem 0.4rem"},children:"×"})})]},C))]}),c.jsx("tfoot",{children:(()=>{const R={};for(const C of P){const A=K.reduce((G,B)=>{var ue;return G+(((ue=B.days[C])==null?void 0:ue.hours)||0)},0),$=u.reduce((G,B)=>G+(B.hours[C]||0),0);R[C]=A+$}return c.jsxs(c.Fragment,{children:[c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.78rem",color:"var(--text-mid)"},children:"Total Available"}),P.map(C=>c.jsx("td",{children:Ye(R[C])},C)),c.jsx("td",{})]}),c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:"vs Booked"}),P.map(C=>c.jsx("td",{children:c.jsx(xs,{available:R[C],required:a[C].booked})},C)),c.jsx("td",{})]}),c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:"with Recurring Tasks"}),P.map(C=>c.jsx("td",{children:c.jsx(xs,{available:R[C],required:a[C].booked+a[C].general})},C)),c.jsx("td",{})]}),c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:"with Pickup"}),P.map(C=>c.jsx("td",{children:c.jsx(xs,{available:R[C],required:a[C].booked+a[C].general+a[C].pickup})},C)),c.jsx("td",{})]}),c.jsxs("tr",{style:{background:"#e2e8f0"},children:[c.jsx("td",{className:"col-label",style:{fontWeight:700},children:"with Adjustments"}),P.map(C=>c.jsx("td",{children:c.jsx(am,{available:R[C],required:a[C].total,warnOverRed:d,warnOverAmber:p,warnUnderAmber:m,warnUnderRed:g})},C)),c.jsx("td",{})]})]})})()})]})}function xs({available:i,required:u}){if(i===0&&u===0)return c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"});const a=i-u;return c.jsxs("span",{style:{color:"var(--text-mid)",fontSize:"0.82rem"},children:[a>=0?"+":"",Ye(a)]})}function am({available:i,required:u,warnOverRed:a,warnOverAmber:d,warnUnderAmber:p,warnUnderRed:m}){if(i===0&&u===0)return c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"});const g=i-u;return g>a?c.jsxs("span",{className:"diff-over-red",children:["⚠ ",Ye(g)," spare"]}):g>d?c.jsxs("span",{className:"diff-over",children:["⚠ ",Ye(g)," spare"]}):g<-m?c.jsxs("span",{className:"diff-under",children:["✗ ",Ye(Math.abs(g))," short"]}):g<-p?c.jsxs("span",{className:"diff-under-amber",children:["✗ ",Ye(Math.abs(g))," short"]}):c.jsxs("span",{className:"diff-ok",children:["✓ ",g>=0?"+":"",Ye(g)]})}function um({bookings:i,adjustments:u,onChange:a}){const{dates:d}=i;function p(w,k){a(u.map((_,P)=>P===w?{..._,label:k}:_))}function m(w,k,_){const P=parseFloat(_);a(u.map((N,M)=>{if(M!==w)return N;const H={...N.hours};return isNaN(P)?delete H[k]:H[k]=P,{...N,hours:H}}))}function g(w){a(u.filter((k,_)=>_!==w))}return u.length===0?c.jsx("p",{style:{color:"var(--text-mid)",fontSize:"0.82rem",padding:"0.5rem 0"},children:'No adjustments — use "+ Add adjustment" above to add a one-off hour offset for a specific date.'}):c.jsxs("table",{className:"hk-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Label"}),d.map(w=>c.jsx("th",{children:So(w)},w)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsx("tbody",{children:u.map((w,k)=>c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{padding:"0.3rem 0.5rem"},children:c.jsx("input",{className:"hk-text-input",value:w.label,placeholder:"e.g. Rooms from Sunday",onChange:_=>p(k,_.target.value)})}),d.map(_=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",step:.25,value:w.hours[_]??"",placeholder:"0",onChange:P=>m(k,_,P.target.value)})},_)),c.jsx("td",{children:c.jsx("button",{onClick:()=>g(k),style:{background:"none",border:"none",color:"var(--text-mid)",fontSize:"1rem",padding:"0.2rem 0.4rem"},children:"×"})})]},k))}),c.jsx("tfoot",{children:c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.78rem",color:"var(--text-mid)"},children:"Total"}),d.map(w=>{const k=u.reduce((_,P)=>_+(P.hours[w]||0),0);return c.jsx("td",{style:{color:k<0?"var(--danger)":k>0?"#1a7a4a":"var(--text-mid)",fontWeight:k!==0?600:void 0},children:k===0?"—":(k>0?"+":"")+Ye(k)},w)}),c.jsx("td",{})]})})]})}const Fc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function cm(){const[i,u]=E.useState([]),[a,d]=E.useState(!0),[p,m]=E.useState(!1),[g,w]=E.useState(!1),[k,_]=E.useState(""),[P,N]=E.useState(""),[M,H]=E.useState(null),[K,R]=E.useState([]),[C,A]=E.useState([]),[$,G]=E.useState(!0),[B,ue]=E.useState(""),[de,je]=E.useState(!1),[xe,Je]=E.useState(!1),[Me,He]=E.useState(""),[Ce,Pe]=E.useState([]),[We,Ge]=E.useState(!1),[Le,me]=E.useState(""),[F,X]=E.useState(""),[W,y]=E.useState({}),[T,ne]=E.useState(""),[le,oe]=E.useState("");E.useEffect(()=>{Promise.all([Hh(),bc(),Yh().catch(I=>(I.message.includes("503")||I.message.toLowerCase().includes("not configured")?je(!0):ue(I.message),null))]).then(([I,ee,re])=>{u(I.categories),Pe(ee.general_tasks||[]),y(ee.time_requirements||{}),A(ee.workforce_departments||[]),re&&R(re),d(!1),G(!1)}).catch(I=>{_(I.message),d(!1),G(!1)})},[]);function ie(I){u(i.map((ee,re)=>re===I?{...ee,excluded:!ee.excluded}:ee))}function ce(I,ee){H(ee),I.dataTransfer.effectAllowed="move"}function se(I,ee){if(I.preventDefault(),M===null||M===ee)return;const re=[...i],[Oe]=re.splice(M,1);re.splice(ee,0,Oe),u(re),H(ee)}function fe(){H(null)}async function Ue(){m(!0),_(""),N("");try{await Qh(i.map(I=>I.id),i.filter(I=>I.excluded).map(I=>I.id)),N("Saved"),setTimeout(()=>N(""),2500)}catch(I){_(I instanceof Error?I.message:"Save failed")}finally{m(!1)}}async function $t(){w(!0),_(""),N("");try{const I=await Kh();N(I.ok?`Connection OK: ${I.message||""}`:`Failed: ${I.error||"unknown"}`)}catch(I){_(I instanceof Error?I.message:"Test failed")}finally{w(!1)}}function Mn(I){A(ee=>ee.includes(I)?ee.filter(re=>re!==I):[...ee,I])}async function Vt(){Je(!0),ue(""),He("");try{await Jh(C),He("Departments saved"),setTimeout(()=>He(""),2500)}catch(I){ue(I instanceof Error?I.message:"Save failed")}finally{Je(!1)}}function Ht(I,ee){Pe(Ce.map((re,Oe)=>Oe===I?{...re,name:ee}:re))}function In(I,ee,re){const Oe=parseInt(re,10);Pe(Ce.map((b,ve)=>ve!==I?b:{...b,hours:{...b.hours,[ee]:isNaN(Oe)?0:Math.max(0,Oe)}}))}function yn(I){Pe(Ce.filter((ee,re)=>re!==I))}async function xn(){Ge(!0),X(""),me("");try{await $h(Ce),me("Saved"),setTimeout(()=>me(""),2500)}catch(I){X(I instanceof Error?I.message:"Save failed")}finally{Ge(!1)}}async function kn(I,ee,re){const Oe={...W,[I]:{...W[I]||{depart:0,stay:0,arrive:0},[ee]:re}};y(Oe);try{await Uh(I,ee,re),ne("Saved"),setTimeout(()=>ne(""),1500)}catch(b){oe(b instanceof Error?b.message:"Save failed")}}return a?c.jsx("div",{style:{padding:"2rem",color:"var(--text-mid)"},children:"Loading…"}):c.jsxs("div",{style:{padding:"1.5rem",maxWidth:"680px"},children:[c.jsx("h1",{style:{fontSize:"1.1rem",fontWeight:700,color:"var(--text-dark)",marginBottom:"1.5rem"},children:"Settings"}),c.jsx(mo,{title:"Room Categories"}),c.jsx("p",{style:{fontSize:"0.82rem",color:"var(--text-mid)",marginBottom:"1rem"},children:"Drag to reorder. Toggle to exclude categories from the planner."}),k&&c.jsx(hn,{type:"error",children:k}),P&&c.jsx(hn,{type:"ok",children:P}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",marginBottom:"1rem"},children:i.map((I,ee)=>c.jsxs("div",{draggable:!0,onDragStart:re=>ce(re,ee),onDragOver:re=>se(re,ee),onDragEnd:fe,style:{display:"flex",alignItems:"center",gap:"0.75rem",padding:"0.625rem 0.875rem",border:"1px solid var(--card-border)",borderRadius:"8px",background:I.excluded?"#f8fafc":"var(--card-bg)",opacity:M===ee?.5:1},children:[c.jsx(Ch,{size:16,color:"var(--text-mid)",style:{cursor:"grab",flexShrink:0}}),c.jsx("span",{style:{flex:1,fontSize:"0.9rem",color:I.excluded?"var(--text-mid)":"var(--text-dark)",textDecoration:I.excluded?"line-through":"none"},children:I.name}),c.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--text-mid)",marginRight:"0.5rem"},children:[I.room_count," rooms"]}),c.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.375rem",fontSize:"0.8rem",color:"var(--text-mid)"},children:[c.jsx("input",{type:"checkbox",checked:!I.excluded,onChange:()=>ie(ee)}),"Active"]})]},I.id))}),c.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginBottom:"2.5rem"},children:[c.jsx(Xr,{onClick:Ue,disabled:p,primary:!0,children:p?"Saving…":"Save Order & Visibility"}),c.jsx(Xr,{onClick:$t,disabled:g,children:g?"Testing…":"Test Newbook Connection"})]}),c.jsx(ks,{}),c.jsx(mo,{title:"Workforce Departments"}),c.jsx("p",{style:{fontSize:"0.82rem",color:"var(--text-mid)",marginBottom:"1rem"},children:"Select the department(s) whose shifts should appear in the HK staff rota."}),de&&c.jsxs("div",{style:{padding:"0.75rem",borderRadius:"8px",background:"#f8fafc",border:"1px solid var(--card-border)",color:"var(--text-mid)",fontSize:"0.85rem",marginBottom:"2rem"},children:["Workforce integration not configured — add the bearer token in ",c.jsx("strong",{children:"Settings → Integrations → Workforce"}),"."]}),!de&&$&&c.jsx("div",{style:{color:"var(--text-mid)",fontSize:"0.85rem",marginBottom:"2rem"},children:"Loading departments…"}),!de&&!$&&c.jsxs("div",{style:{marginBottom:"2.5rem"},children:[B&&c.jsx(hn,{type:"error",children:B}),Me&&c.jsx(hn,{type:"ok",children:Me}),K.length===0?c.jsx("div",{style:{color:"var(--text-mid)",fontSize:"0.85rem",marginBottom:"1rem"},children:"No departments found for this location."}):c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem",marginBottom:"1rem"},children:K.map(I=>c.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.625rem",padding:"0.5rem 0.75rem",border:"1px solid var(--card-border)",borderRadius:"7px",background:C.includes(I.id)?"rgba(42,100,72,0.05)":"var(--card-bg)",cursor:"pointer",fontSize:"0.9rem",color:"var(--text-dark)"},children:[c.jsx("input",{type:"checkbox",checked:C.includes(I.id),onChange:()=>Mn(I.id)}),I.name]},I.id))}),C.length===0&&K.length>0&&c.jsx("div",{style:{marginBottom:"0.75rem",fontSize:"0.8rem",color:"#b45309"},children:"Select at least one department to enable Workforce sync."}),c.jsx(Xr,{onClick:Vt,disabled:xe,primary:!0,children:xe?"Saving…":"Save Departments"})]}),c.jsx(ks,{}),c.jsx(mo,{title:"Recurring General Tasks"}),c.jsx("p",{style:{fontSize:"0.82rem",color:"var(--text-mid)",marginBottom:"1rem"},children:"Tasks that recur every week. Enter minutes per day. These add to the total required hours every week."}),F&&c.jsx(hn,{type:"error",children:F}),Le&&c.jsx(hn,{type:"ok",children:Le}),c.jsx("div",{style:{overflowX:"auto",marginBottom:"1rem"},children:c.jsxs("table",{className:"hk-table",style:{minWidth:"560px"},children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Task"}),Fc.map(I=>c.jsx("th",{children:I},I)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsxs("tbody",{children:[Ce.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:9,style:{color:"var(--text-mid)",textAlign:"center",padding:"1rem"},children:"No tasks yet"})}),Ce.map((I,ee)=>c.jsxs("tr",{children:[c.jsx("td",{style:{padding:"0.3rem 0.5rem"},children:c.jsx("input",{className:"hk-text-input",value:I.name,placeholder:"Task name",onChange:re=>Ht(ee,re.target.value)})}),Fc.map(re=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:999,value:I.hours[re]||"",placeholder:"0",onChange:Oe=>In(ee,re,Oe.target.value)})},re)),c.jsx("td",{children:c.jsx("button",{onClick:()=>yn(ee),style:{background:"none",border:"none",color:"var(--text-mid)",fontSize:"1rem",padding:"0.2rem 0.4rem"},children:"×"})})]},ee))]})]})}),c.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginBottom:"2.5rem"},children:[c.jsx(Xr,{onClick:()=>Pe([...Ce,{name:"",hours:{}}]),children:"+ Add task"}),c.jsx(Xr,{onClick:xn,disabled:We,primary:!0,children:We?"Saving…":"Save Tasks"})]}),c.jsx(ks,{}),c.jsx(mo,{title:"Time Requirements (minutes per room)"}),c.jsx("p",{style:{fontSize:"0.82rem",color:"var(--text-mid)",marginBottom:"1rem"},children:"How many minutes each room type takes depending on guest status."}),le&&c.jsx(hn,{type:"error",children:le}),T&&c.jsx(hn,{type:"ok",children:T}),c.jsx("div",{style:{overflowX:"auto",marginBottom:"2rem"},children:c.jsxs("table",{className:"hk-table",style:{maxWidth:"500px"},children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Category"}),c.jsx("th",{children:"Depart (mins)"}),c.jsx("th",{children:"Stay (mins)"}),c.jsx("th",{children:"Arrive (mins)"})]})}),c.jsx("tbody",{children:i.filter(I=>!I.excluded).map(I=>{const ee=W[I.id]||{depart:0,stay:0,arrive:0};return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",children:I.name}),["depart","stay","arrive"].map(re=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:999,value:ee[re]||"",placeholder:"0",onChange:Oe=>kn(I.id,re,parseInt(Oe.target.value,10)||0),onBlur:Oe=>kn(I.id,re,parseInt(Oe.target.value,10)||0)})},re))]},I.id)})})]})})]})}function mo({title:i}){return c.jsx("h2",{style:{fontSize:"0.95rem",fontWeight:700,color:"var(--text-dark)",marginBottom:"0.25rem"},children:i})}function ks(){return c.jsx("div",{style:{height:"1px",background:"var(--card-border)",margin:"0.5rem 0 2rem"}})}function hn({type:i,children:u}){return c.jsx("div",{style:{marginBottom:"0.75rem",padding:"0.75rem",borderRadius:"8px",fontSize:"0.875rem",background:i==="ok"?"#dcfce7":"#fee2e2",color:i==="ok"?"var(--success)":"var(--danger)"},children:u})}function Xr({children:i,onClick:u,disabled:a,primary:d}){return c.jsx("button",{onClick:u,disabled:a,style:{background:d?"var(--hk-green)":"var(--card-bg)",color:d?"#fff":"var(--text-dark)",border:`1px solid ${d?"var(--hk-green)":"var(--card-border)"}`,borderRadius:"6px",padding:"0.5rem 1.25rem",fontSize:"0.875rem",fontWeight:600},children:i})}function dm({user:i}){return c.jsx(Ih,{user:i,children:c.jsxs(Zp,{children:[c.jsx(Zr,{path:"/",element:c.jsx(vs,{to:"/planner",replace:!0})}),c.jsx(Zr,{path:"/planner",element:c.jsx(nm,{})}),c.jsx(Zr,{path:"/settings",element:qc(i,"settings")?c.jsx(cm,{}):c.jsx(vs,{to:"/planner",replace:!0})}),c.jsx(Zr,{path:"*",element:c.jsx(vs,{to:"/planner",replace:!0})})]})})}function fm(){const i=Lh("/hk-planner/health");return c.jsxs(c.Fragment,{children:[c.jsx(oh,{basename:"/hk-planner",children:c.jsx(mh,{children:u=>c.jsx(dm,{user:u})})}),c.jsx(Th,{visible:i})]})}new URLSearchParams(window.location.search).has("install")&&window.addEventListener("beforeinstallprompt",i=>{i.preventDefault(),i.prompt()},{once:!0});sp.createRoot(document.getElementById("root")).render(c.jsx(E.StrictMode,{children:c.jsx(fm,{})}));