1668 lines
1.4 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var yk=Object.defineProperty,bk=Object.defineProperties;var vk=Object.getOwnPropertyDescriptors;var I0=Object.getOwnPropertySymbols;var L1=Object.prototype.hasOwnProperty,M1=Object.prototype.propertyIsEnumerable;var Yl=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_k=e=>{throw TypeError(e)};var Zm=(e,t,a)=>t in e?yk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,ie=(e,t)=>{for(var a in t||(t={}))L1.call(t,a)&&Zm(e,a,t[a]);if(I0)for(var a of I0(t))M1.call(t,a)&&Zm(e,a,t[a]);return e},Le=(e,t)=>bk(e,vk(t));var tn=(e,t)=>{var a={};for(var s in e)L1.call(e,s)&&t.indexOf(s)<0&&(a[s]=e[s]);if(e!=null&&I0)for(var s of I0(e))t.indexOf(s)<0&&M1.call(e,s)&&(a[s]=e[s]);return a};var wk=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Os=(e,t,a)=>Zm(e,typeof t!="symbol"?t+"":t,a);var ge=(e,t,a)=>new Promise((s,o)=>{var u=p=>{try{f(a.next(p))}catch(g){o(g)}},c=p=>{try{f(a.throw(p))}catch(g){o(g)}},f=p=>p.done?s(p.value):Promise.resolve(p.value).then(u,c);f((a=a.apply(e,t)).next())}),Bo=function(e,t){this[0]=e,this[1]=t},qm=(e,t,a)=>{var s=(c,f,p,g)=>{try{var x=a[c](f),v=(f=x.value)instanceof Bo,_=x.done;Promise.resolve(v?f[0]:f).then(k=>v?s(c==="return"?c:"next",f[1]?{done:k.done,value:k.value}:k,p,g):p({value:k,done:_})).catch(k=>s("throw",k,p,g))}catch(k){g(k)}},o=c=>u[c]=f=>new Promise((p,g)=>s(c,f,p,g)),u={};return a=a.apply(e,t),u[Yl("asyncIterator")]=()=>u,o("next"),o("throw"),o("return"),u},Ym=e=>{var t=e[Yl("asyncIterator")],a=!1,s,o={};return t==null?(t=e[Yl("iterator")](),s=u=>o[u]=c=>t[u](c)):(t=t.call(e),s=u=>o[u]=c=>{if(a){if(a=!1,u==="throw")throw c;return c}return a=!0,{done:!1,value:new Bo(new Promise(f=>{var p=t[u](c);p instanceof Object||_k("Object expected"),f(p)}),1)}}),o[Yl("iterator")]=()=>o,s("next"),"throw"in t?s("throw"):o.throw=u=>{throw u},"return"in t&&s("return"),o},D1=(e,t,a)=>(t=e[Yl("asyncIterator")])?t.call(e):(e=e[Yl("iterator")](),t={},a=(s,o)=>(o=e[s])&&(t[s]=u=>new Promise((c,f,p)=>(u=o.call(e,u),p=u.done,Promise.resolve(u.value).then(g=>c({value:g,done:p}),f)))),a("next"),a("return"),t);var jM=wk(dt=>{(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function a(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(o){if(o.ep)return;o.ep=!0;const u=a(o);fetch(o.href,u)}})();function Iv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xm={exports:{}},Ed={};var R1;function kk(){if(R1)return Ed;R1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(s,o,u){var c=null;if(u!==void 0&&(c=""+u),o.key!==void 0&&(c=""+o.key),"key"in o){u={};for(var f in o)f!=="key"&&(u[f]=o[f])}else u=o;return o=u.ref,{$$typeof:e,type:s,key:c,ref:o!==void 0?o:null,props:u}}return Ed.Fragment=t,Ed.jsx=a,Ed.jsxs=a,Ed}var P1;function Nk(){return P1||(P1=1,Xm.exports=kk()),Xm.exports}var r=Nk(),Km={exports:{}},It={};var F1;function Sk(){if(F1)return It;F1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),_=Symbol.iterator;function k(z){return z===null||typeof z!="object"?null:(z=_&&z[_]||z["@@iterator"],typeof z=="function"?z:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,j={};function P(z,D,G){this.props=z,this.context=D,this.refs=j,this.updater=G||T}P.prototype.isReactComponent={},P.prototype.setState=function(z,D){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,D,"setState")},P.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function C(){}C.prototype=P.prototype;function O(z,D,G){this.props=z,this.context=D,this.refs=j,this.updater=G||T}var R=O.prototype=new C;R.constructor=O,N(R,P.prototype),R.isPureReactComponent=!0;var U=Array.isArray;function H(){}var B={H:null,A:null,T:null,S:null},oe=Object.prototype.hasOwnProperty;function se(z,D,G){var q=G.ref;return{$$typeof:e,type:z,key:D,ref:q!==void 0?q:null,props:G}}function pe(z,D){return se(z.type,D,z.props)}function le(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function re(z){var D={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(G){return D[G]})}var de=/\/+/g;function ye(z,D){return typeof z=="object"&&z!==null&&z.key!=null?re(""+z.key):D.toString(36)}function ue(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(H,H):(z.status="pending",z.then(function(D){z.status==="pending"&&(z.status="fulfilled",z.value=D)},function(D){z.status==="pending"&&(z.status="rejected",z.reason=D)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function te(z,D,G,q,K){var fe=typeof z;(fe==="undefined"||fe==="boolean")&&(z=null);var Pe=!1;if(z===null)Pe=!0;else switch(fe){case"bigint":case"string":case"number":Pe=!0;break;case"object":switch(z.$$typeof){case e:case t:Pe=!0;break;case x:return Pe=z._init,te(Pe(z._payload),D,G,q,K)}}if(Pe)return K=K(z),Pe=q===""?"."+ye(z,0):q,U(K)?(G="",Pe!=null&&(G=Pe.replace(de,"$&/")+"/"),te(K,D,G,"",function(He){return He})):K!=null&&(le(K)&&(K=pe(K,G+(K.key==null||z&&z.key===K.key?"":(""+K.key).replace(de,"$&/")+"/")+Pe)),D.push(K)),1;Pe=0;var We=q===""?".":q+":";if(U(z))for(var Fe=0;Fe<z.length;Fe++)q=z[Fe],fe=We+ye(q,Fe),Pe+=te(q,D,G,fe,K);else if(Fe=k(z),typeof Fe=="function")for(z=Fe.call(z),Fe=0;!(q=z.next()).done;)q=q.value,fe=We+ye(q,Fe++),Pe+=te(q,D,G,fe,K);else if(fe==="object"){if(typeof z.then=="function")return te(ue(z),D,G,q,K);throw D=String(z),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.")}return Pe}function V(z,D,G){if(z==null)return z;var q=[],K=0;return te(z,q,"","",function(fe){return D.call(G,fe,K++)}),q}function J(z){if(z._status===-1){var D=z._result;D=D(),D.then(function(G){(z._status===0||z._status===-1)&&(z._status=1,z._result=G)},function(G){(z._status===0||z._status===-1)&&(z._status=2,z._result=G)}),z._status===-1&&(z._status=0,z._result=D)}if(z._status===1)return z._result.default;throw z._result}var ne=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var D=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(D))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},ae={map:V,forEach:function(z,D,G){V(z,function(){D.apply(this,arguments)},G)},count:function(z){var D=0;return V(z,function(){D++}),D},toArray:function(z){return V(z,function(D){return D})||[]},only:function(z){if(!le(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return It.Activity=v,It.Children=ae,It.Component=P,It.Fragment=a,It.Profiler=o,It.PureComponent=O,It.StrictMode=s,It.Suspense=p,It.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,It.__COMPILER_RUNTIME={__proto__:null,c:function(z){return B.H.useMemoCache(z)}},It.cache=function(z){return function(){return z.apply(null,arguments)}},It.cacheSignal=function(){return null},It.cloneElement=function(z,D,G){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var q=N({},z.props),K=z.key;if(D!=null)for(fe in D.key!==void 0&&(K=""+D.key),D)!oe.call(D,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&D.ref===void 0||(q[fe]=D[fe]);var fe=arguments.length-2;if(fe===1)q.children=G;else if(1<fe){for(var Pe=Array(fe),We=0;We<fe;We++)Pe[We]=arguments[We+2];q.children=Pe}return se(z.type,K,q)},It.createContext=function(z){return z={$$typeof:c,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:u,_context:z},z},It.createElement=function(z,D,G){var q,K={},fe=null;if(D!=null)for(q in D.key!==void 0&&(fe=""+D.key),D)oe.call(D,q)&&q!=="key"&&q!=="__self"&&q!=="__source"&&(K[q]=D[q]);var Pe=arguments.length-2;if(Pe===1)K.children=G;else if(1<Pe){for(var We=Array(Pe),Fe=0;Fe<Pe;Fe++)We[Fe]=arguments[Fe+2];K.children=We}if(z&&z.defaultProps)for(q in Pe=z.defaultProps,Pe)K[q]===void 0&&(K[q]=Pe[q]);return se(z,fe,K)},It.createRef=function(){return{current:null}},It.forwardRef=function(z){return{$$typeof:f,render:z}},It.isValidElement=le,It.lazy=function(z){return{$$typeof:x,_payload:{_status:-1,_result:z},_init:J}},It.memo=function(z,D){return{$$typeof:g,type:z,compare:D===void 0?null:D}},It.startTransition=function(z){var D=B.T,G={};B.T=G;try{var q=z(),K=B.S;K!==null&&K(G,q),typeof q=="object"&&q!==null&&typeof q.then=="function"&&q.then(H,ne)}catch(fe){ne(fe)}finally{D!==null&&G.types!==null&&(D.types=G.types),B.T=D}},It.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},It.use=function(z){return B.H.use(z)},It.useActionState=function(z,D,G){return B.H.useActionState(z,D,G)},It.useCallback=function(z,D){return B.H.useCallback(z,D)},It.useContext=function(z){return B.H.useContext(z)},It.useDebugValue=function(){},It.useDeferredValue=function(z,D){return B.H.useDeferredValue(z,D)},It.useEffect=function(z,D){return B.H.useEffect(z,D)},It.useEffectEvent=function(z){return B.H.useEffectEvent(z)},It.useId=function(){return B.H.useId()},It.useImperativeHandle=function(z,D,G){return B.H.useImperativeHandle(z,D,G)},It.useInsertionEffect=function(z,D){return B.H.useInsertionEffect(z,D)},It.useLayoutEffect=function(z,D){return B.H.useLayoutEffect(z,D)},It.useMemo=function(z,D){return B.H.useMemo(z,D)},It.useOptimistic=function(z,D){return B.H.useOptimistic(z,D)},It.useReducer=function(z,D,G){return B.H.useReducer(z,D,G)},It.useRef=function(z){return B.H.useRef(z)},It.useState=function(z){return B.H.useState(z)},It.useSyncExternalStore=function(z,D,G){return B.H.useSyncExternalStore(z,D,G)},It.useTransition=function(){return B.H.useTransition()},It.version="19.2.1",It}var I1;function Of(){return I1||(I1=1,Km.exports=Sk()),Km.exports}var E=Of();const ea=Iv(E);var Jm={exports:{}},Cd={},Qm={exports:{}},eg={};var B1;function jk(){return B1||(B1=1,(function(e){function t(te,V){var J=te.length;te.push(V);e:for(;0<J;){var ne=J-1>>>1,ae=te[ne];if(0<o(ae,V))te[ne]=V,te[J]=ae,J=ne;else break e}}function a(te){return te.length===0?null:te[0]}function s(te){if(te.length===0)return null;var V=te[0],J=te.pop();if(J!==V){te[0]=J;e:for(var ne=0,ae=te.length,z=ae>>>1;ne<z;){var D=2*(ne+1)-1,G=te[D],q=D+1,K=te[q];if(0>o(G,J))q<ae&&0>o(K,G)?(te[ne]=K,te[q]=J,ne=q):(te[ne]=G,te[D]=J,ne=D);else if(q<ae&&0>o(K,J))te[ne]=K,te[q]=J,ne=q;else break e}}return V}function o(te,V){var J=te.sortIndex-V.sortIndex;return J!==0?J:te.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var p=[],g=[],x=1,v=null,_=3,k=!1,T=!1,N=!1,j=!1,P=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate!="undefined"?setImmediate:null;function R(te){for(var V=a(g);V!==null;){if(V.callback===null)s(g);else if(V.startTime<=te)s(g),V.sortIndex=V.expirationTime,t(p,V);else break;V=a(g)}}function U(te){if(N=!1,R(te),!T)if(a(p)!==null)T=!0,H||(H=!0,re());else{var V=a(g);V!==null&&ue(U,V.startTime-te)}}var H=!1,B=-1,oe=5,se=-1;function pe(){return j?!0:!(e.unstable_now()-se<oe)}function le(){if(j=!1,H){var te=e.unstable_now();se=te;var V=!0;try{e:{T=!1,N&&(N=!1,C(B),B=-1),k=!0;var J=_;try{t:{for(R(te),v=a(p);v!==null&&!(v.expirationTime>te&&pe());){var ne=v.callback;if(typeof ne=="function"){v.callback=null,_=v.priorityLevel;var ae=ne(v.expirationTime<=te);if(te=e.unstable_now(),typeof ae=="function"){v.callback=ae,R(te),V=!0;break t}v===a(p)&&s(p),R(te)}else s(p);v=a(p)}if(v!==null)V=!0;else{var z=a(g);z!==null&&ue(U,z.startTime-te),V=!1}}break e}finally{v=null,_=J,k=!1}V=void 0}}finally{V?re():H=!1}}}var re;if(typeof O=="function")re=function(){O(le)};else if(typeof MessageChannel!="undefined"){var de=new MessageChannel,ye=de.port2;de.port1.onmessage=le,re=function(){ye.postMessage(null)}}else re=function(){P(le,0)};function ue(te,V){B=P(function(){te(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(te){te.callback=null},e.unstable_forceFrameRate=function(te){0>te||125<te?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):oe=0<te?Math.floor(1e3/te):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(te){switch(_){case 1:case 2:case 3:var V=3;break;default:V=_}var J=_;_=V;try{return te()}finally{_=J}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(te,V){switch(te){case 1:case 2:case 3:case 4:case 5:break;default:te=3}var J=_;_=te;try{return V()}finally{_=J}},e.unstable_scheduleCallback=function(te,V,J){var ne=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?ne+J:ne):J=ne,te){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=J+ae,te={id:x++,callback:V,priorityLevel:te,startTime:J,expirationTime:ae,sortIndex:-1},J>ne?(te.sortIndex=J,t(g,te),a(p)===null&&te===a(g)&&(N?(C(B),B=-1):N=!0,ue(U,J-ne))):(te.sortIndex=ae,t(p,te),T||k||(T=!0,H||(H=!0,re()))),te},e.unstable_shouldYield=pe,e.unstable_wrapCallback=function(te){var V=_;return function(){var J=_;_=V;try{return te.apply(this,arguments)}finally{_=J}}}})(eg)),eg}var z1;function Tk(){return z1||(z1=1,Qm.exports=jk()),Qm.exports}var tg={exports:{}},Ar={};var U1;function Ek(){if(U1)return Ar;U1=1;var e=Of();function t(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)g+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var s={d:{f:a,r:function(){throw Error(t(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(p,g,x){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:v==null?null:""+v,children:p,containerInfo:g,implementation:x}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Ar.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Ar.createPortal=function(p,g){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(t(299));return u(p,g,null,x)},Ar.flushSync=function(p){var g=c.T,x=s.p;try{if(c.T=null,s.p=2,p)return p()}finally{c.T=g,s.p=x,s.d.f()}},Ar.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,s.d.C(p,g))},Ar.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},Ar.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var x=g.as,v=f(x,g.crossOrigin),_=typeof g.integrity=="string"?g.integrity:void 0,k=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;x==="style"?s.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:v,integrity:_,fetchPriority:k}):x==="script"&&s.d.X(p,{crossOrigin:v,integrity:_,fetchPriority:k,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Ar.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var x=f(g.as,g.crossOrigin);s.d.M(p,{crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&s.d.M(p)},Ar.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var x=g.as,v=f(x,g.crossOrigin);s.d.L(p,x,{crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Ar.preloadModule=function(p,g){if(typeof p=="string")if(g){var x=f(g.as,g.crossOrigin);s.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else s.d.m(p)},Ar.requestFormReset=function(p){s.d.r(p)},Ar.unstable_batchedUpdates=function(p,g){return p(g)},Ar.useFormState=function(p,g,x){return c.H.useFormState(p,g,x)},Ar.useFormStatus=function(){return c.H.useHostTransitionStatus()},Ar.version="19.2.1",Ar}var H1;function Bv(){if(H1)return tg.exports;H1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),tg.exports=Ek(),tg.exports}var $1;function Ck(){if($1)return Cd;$1=1;var e=Tk(),t=Of(),a=Bv();function s(n){var i="https://react.dev/errors/"+n;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)i+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+n+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function u(n){var i=n,d=n;if(n.alternate)for(;i.return;)i=i.return;else{n=i;do i=n,(i.flags&4098)!==0&&(d=i.return),n=i.return;while(n)}return i.tag===3?d:null}function c(n){if(n.tag===13){var i=n.memoizedState;if(i===null&&(n=n.alternate,n!==null&&(i=n.memoizedState)),i!==null)return i.dehydrated}return null}function f(n){if(n.tag===31){var i=n.memoizedState;if(i===null&&(n=n.alternate,n!==null&&(i=n.memoizedState)),i!==null)return i.dehydrated}return null}function p(n){if(u(n)!==n)throw Error(s(188))}function g(n){var i=n.alternate;if(!i){if(i=u(n),i===null)throw Error(s(188));return i!==n?null:n}for(var d=n,m=i;;){var b=d.return;if(b===null)break;var w=b.alternate;if(w===null){if(m=b.return,m!==null){d=m;continue}break}if(b.child===w.child){for(w=b.child;w;){if(w===d)return p(b),n;if(w===m)return p(b),i;w=w.sibling}throw Error(s(188))}if(d.return!==m.return)d=b,m=w;else{for(var M=!1,Z=b.child;Z;){if(Z===d){M=!0,d=b,m=w;break}if(Z===m){M=!0,m=b,d=w;break}Z=Z.sibling}if(!M){for(Z=w.child;Z;){if(Z===d){M=!0,d=w,m=b;break}if(Z===m){M=!0,m=w,d=b;break}Z=Z.sibling}if(!M)throw Error(s(189))}}if(d.alternate!==m)throw Error(s(190))}if(d.tag!==3)throw Error(s(188));return d.stateNode.current===d?n:i}function x(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n;for(n=n.child;n!==null;){if(i=x(n),i!==null)return i;n=n.sibling}return null}var v=Object.assign,_=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),O=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),pe=Symbol.for("react.memo_cache_sentinel"),le=Symbol.iterator;function re(n){return n===null||typeof n!="object"?null:(n=le&&n[le]||n["@@iterator"],typeof n=="function"?n:null)}var de=Symbol.for("react.client.reference");function ye(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===de?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case N:return"Fragment";case P:return"Profiler";case j:return"StrictMode";case U:return"Suspense";case H:return"SuspenseList";case se:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case T:return"Portal";case O:return n.displayName||"Context";case C:return(n._context.displayName||"Context")+".Consumer";case R:var i=n.render;return n=n.displayName,n||(n=i.displayName||i.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case B:return i=n.displayName||null,i!==null?i:ye(n.type)||"Memo";case oe:i=n._payload,n=n._init;try{return ye(n(i))}catch(d){}}return null}var ue=Array.isArray,te=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},ne=[],ae=-1;function z(n){return{current:n}}function D(n){0>ae||(n.current=ne[ae],ne[ae]=null,ae--)}function G(n,i){ae++,ne[ae]=n.current,n.current=i}var q=z(null),K=z(null),fe=z(null),Pe=z(null);function We(n,i){switch(G(fe,i),G(K,n),G(q,null),i.nodeType){case 9:case 11:n=(n=i.documentElement)&&(n=n.namespaceURI)?t1(n):0;break;default:if(n=i.tagName,i=i.namespaceURI)i=t1(i),n=a1(i,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}D(q),G(q,n)}function Fe(){D(q),D(K),D(fe)}function He(n){n.memoizedState!==null&&G(Pe,n);var i=q.current,d=a1(i,n.type);i!==d&&(G(K,n),G(q,d))}function it(n){K.current===n&&(D(q),D(K)),Pe.current===n&&(D(Pe),Nd._currentValue=J)}var ht,Vt;function _t(n){if(ht===void 0)try{throw Error()}catch(d){var i=d.stack.trim().match(/\n( *(at )?)/);ht=i&&i[1]||"",Vt=-1<d.stack.indexOf(`
at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
`+ht+n+Vt}var ia=!1;function Lt(n,i){if(!n||ia)return"";ia=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(i){var Ze=function(){throw Error()};if(Object.defineProperty(Ze.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ze,[])}catch(Re){var Oe=Re}Reflect.construct(n,[],Ze)}else{try{Ze.call()}catch(Re){Oe=Re}n.call(Ze.prototype)}}else{try{throw Error()}catch(Re){Oe=Re}(Ze=n())&&typeof Ze.catch=="function"&&Ze.catch(function(){})}}catch(Re){if(Re&&Oe&&typeof Re.stack=="string")return[Re.stack,Oe.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=m.DetermineComponentFrameRoot(),M=w[0],Z=w[1];if(M&&Z){var me=M.split(`
`),Ce=Z.split(`
`);for(b=m=0;m<me.length&&!me[m].includes("DetermineComponentFrameRoot");)m++;for(;b<Ce.length&&!Ce[b].includes("DetermineComponentFrameRoot");)b++;if(m===me.length||b===Ce.length)for(m=me.length-1,b=Ce.length-1;1<=m&&0<=b&&me[m]!==Ce[b];)b--;for(;1<=m&&0<=b;m--,b--)if(me[m]!==Ce[b]){if(m!==1||b!==1)do if(m--,b--,0>b||me[m]!==Ce[b]){var Ue=`
`+me[m].replace(" at new "," at ");return n.displayName&&Ue.includes("<anonymous>")&&(Ue=Ue.replace("<anonymous>",n.displayName)),Ue}while(1<=m&&0<=b);break}}}finally{ia=!1,Error.prepareStackTrace=d}return(d=n?n.displayName||n.name:"")?_t(d):""}function Be(n,i){switch(n.tag){case 26:case 27:case 5:return _t(n.type);case 16:return _t("Lazy");case 13:return n.child!==i&&i!==null?_t("Suspense Fallback"):_t("Suspense");case 19:return _t("SuspenseList");case 0:case 15:return Lt(n.type,!1);case 11:return Lt(n.type.render,!1);case 1:return Lt(n.type,!0);case 31:return _t("Activity");default:return""}}function yt(n){try{var i="",d=null;do i+=Be(n,d),d=n,n=n.return;while(n);return i}catch(m){return`
Error generating stack: `+m.message+`
`+m.stack}}var ke=Object.prototype.hasOwnProperty,ze=e.unstable_scheduleCallback,Je=e.unstable_cancelCallback,nt=e.unstable_shouldYield,ut=e.unstable_requestPaint,ft=e.unstable_now,bt=e.unstable_getCurrentPriorityLevel,Ut=e.unstable_ImmediatePriority,Rt=e.unstable_UserBlockingPriority,Pt=e.unstable_NormalPriority,qe=e.unstable_LowPriority,at=e.unstable_IdlePriority,wt=e.log,kt=e.unstable_setDisableYieldValue,da=null,xe=null;function De(n){if(typeof wt=="function"&&kt(n),xe&&typeof xe.setStrictMode=="function")try{xe.setStrictMode(da,n)}catch(i){}}var $e=Math.clz32?Math.clz32:Sa,Et=Math.log,Gt=Math.LN2;function Sa(n){return n>>>=0,n===0?32:31-(Et(n)/Gt|0)|0}var tt=256,Zt=262144,Ia=4194304;function Ba(n){var i=n&42;if(i!==0)return i;switch(n&-n){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Dr(n,i,d){var m=n.pendingLanes;if(m===0)return 0;var b=0,w=n.suspendedLanes,M=n.pingedLanes;n=n.warmLanes;var Z=m&134217727;return Z!==0?(m=Z&~w,m!==0?b=Ba(m):(M&=Z,M!==0?b=Ba(M):d||(d=Z&~n,d!==0&&(b=Ba(d))))):(Z=m&~w,Z!==0?b=Ba(Z):M!==0?b=Ba(M):d||(d=m&~n,d!==0&&(b=Ba(d)))),b===0?0:i!==0&&i!==b&&(i&w)===0&&(w=b&-b,d=i&-i,w>=d||w===32&&(d&4194048)!==0)?i:b}function cn(n,i){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&i)===0}function gs(n,i){switch(n){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32: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 i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ps(){var n=Ia;return Ia<<=1,(Ia&62914560)===0&&(Ia=4194304),n}function Zn(n){for(var i=[],d=0;31>d;d++)i.push(n);return i}function Rr(n,i){n.pendingLanes|=i,i!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function qn(n,i,d,m,b,w){var M=n.pendingLanes;n.pendingLanes=d,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=d,n.entangledLanes&=d,n.errorRecoveryDisabledLanes&=d,n.shellSuspendCounter=0;var Z=n.entanglements,me=n.expirationTimes,Ce=n.hiddenUpdates;for(d=M&~d;0<d;){var Ue=31-$e(d),Ze=1<<Ue;Z[Ue]=0,me[Ue]=-1;var Oe=Ce[Ue];if(Oe!==null)for(Ce[Ue]=null,Ue=0;Ue<Oe.length;Ue++){var Re=Oe[Ue];Re!==null&&(Re.lane&=-536870913)}d&=~Ze}m!==0&&dn(n,m,0),w!==0&&b===0&&n.tag!==0&&(n.suspendedLanes|=w&~(M&~i))}function dn(n,i,d){n.pendingLanes|=i,n.suspendedLanes&=~i;var m=31-$e(i);n.entangledLanes|=i,n.entanglements[m]=n.entanglements[m]|1073741824|d&261930}function Cn(n,i){var d=n.entangledLanes|=i;for(n=n.entanglements;d;){var m=31-$e(d),b=1<<m;b&i|n[m]&i&&(n[m]|=i),d&=~b}}function xs(n,i){var d=i&-i;return d=(d&42)!==0?1:Za(d),(d&(n.suspendedLanes|i))!==0?0:d}function Za(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function be(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function I(){var n=V.p;return n!==0?n:(n=window.event,n===void 0?32:S1(n.type))}function ee(n,i){var d=V.p;try{return V.p=n,i()}finally{V.p=d}}var Y=Math.random().toString(36).slice(2),X="__reactFiber$"+Y,Q="__reactProps$"+Y,F="__reactContainer$"+Y,he="__reactEvents$"+Y,Ee="__reactListeners$"+Y,_e="__reactHandles$"+Y,je="__reactResources$"+Y,Se="__reactMarker$"+Y;function Ye(n){delete n[X],delete n[Q],delete n[he],delete n[Ee],delete n[_e]}function et(n){var i=n[X];if(i)return i;for(var d=n.parentNode;d;){if(i=d[F]||d[X]){if(d=i.alternate,i.child!==null||d!==null&&d.child!==null)for(n=c1(n);n!==null;){if(d=n[X])return d;n=c1(n)}return i}n=d,d=n.parentNode}return null}function ot(n){if(n=n[X]||n[F]){var i=n.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return n}return null}function Qe(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n.stateNode;throw Error(s(33))}function lt(n){var i=n[je];return i||(i=n[je]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function mt(n){n[Se]=!0}var ya=new Set,ba={};function Ea(n,i){Tr(n,i),Tr(n+"Capture",i)}function Tr(n,i){for(ba[n]=i,n=0;n<i.length;n++)ya.add(i[n])}var un=RegExp("^[: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]*$"),Yn={},fn={};function Xn(n){return ke.call(fn,n)?!0:ke.call(Yn,n)?!1:un.test(n)?fn[n]=!0:(Yn[n]=!0,!1)}function Mt(n,i,d){if(Xn(i))if(d===null)n.removeAttribute(i);else{switch(typeof d){case"undefined":case"function":case"symbol":n.removeAttribute(i);return;case"boolean":var m=i.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){n.removeAttribute(i);return}}n.setAttribute(i,""+d)}}function va(n,i,d){if(d===null)n.removeAttribute(i);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttribute(i,""+d)}}function Wr(n,i,d,m){if(m===null)n.removeAttribute(d);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(d);return}n.setAttributeNS(i,d,""+m)}}function sr(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Bs(n){var i=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Lc(n,i,d){var m=Object.getOwnPropertyDescriptor(n.constructor.prototype,i);if(!n.hasOwnProperty(i)&&typeof m!="undefined"&&typeof m.get=="function"&&typeof m.set=="function"){var b=m.get,w=m.set;return Object.defineProperty(n,i,{configurable:!0,get:function(){return b.call(this)},set:function(M){d=""+M,w.call(this,M)}}),Object.defineProperty(n,i,{enumerable:m.enumerable}),{getValue:function(){return d},setValue:function(M){d=""+M},stopTracking:function(){n._valueTracker=null,delete n[i]}}}}function Ft(n){if(!n._valueTracker){var i=Bs(n)?"checked":"value";n._valueTracker=Lc(n,i,""+n[i])}}function Ra(n){if(!n)return!1;var i=n._valueTracker;if(!i)return!0;var d=i.getValue(),m="";return n&&(m=Bs(n)?n.checked?"true":"false":n.value),n=m,n!==d?(i.setValue(n),!0):!1}function xi(n){if(n=n||(typeof document!="undefined"?document:void 0),typeof n=="undefined")return null;try{return n.activeElement||n.body}catch(i){return n.body}}var cl=/[\n"\\]/g;function Ca(n){return n.replace(cl,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Mc(n,i,d,m,b,w,M,Z){n.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?n.type=M:n.removeAttribute("type"),i!=null?M==="number"?(i===0&&n.value===""||n.value!=i)&&(n.value=""+sr(i)):n.value!==""+sr(i)&&(n.value=""+sr(i)):M!=="submit"&&M!=="reset"||n.removeAttribute("value"),i!=null?Kn(n,M,sr(i)):d!=null?Kn(n,M,sr(d)):m!=null&&n.removeAttribute("value"),b==null&&w!=null&&(n.defaultChecked=!!w),b!=null&&(n.checked=b&&typeof b!="function"&&typeof b!="symbol"),Z!=null&&typeof Z!="function"&&typeof Z!="symbol"&&typeof Z!="boolean"?n.name=""+sr(Z):n.removeAttribute("name")}function io(n,i,d,m,b,w,M,Z){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.type=w),i!=null||d!=null){if(!(w!=="submit"&&w!=="reset"||i!=null)){Ft(n);return}d=d!=null?""+sr(d):"",i=i!=null?""+sr(i):d,Z||i===n.value||(n.value=i),n.defaultValue=i}m=m!=null?m:b,m=typeof m!="function"&&typeof m!="symbol"&&!!m,n.checked=Z?n.checked:!!m,n.defaultChecked=!!m,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(n.name=M),Ft(n)}function Kn(n,i,d){i==="number"&&xi(n.ownerDocument)===n||n.defaultValue===""+d||(n.defaultValue=""+d)}function ja(n,i,d,m){if(n=n.options,i){i={};for(var b=0;b<d.length;b++)i["$"+d[b]]=!0;for(d=0;d<n.length;d++)b=i.hasOwnProperty("$"+n[d].value),n[d].selected!==b&&(n[d].selected=b),b&&m&&(n[d].defaultSelected=!0)}else{for(d=""+sr(d),i=null,b=0;b<n.length;b++){if(n[b].value===d){n[b].selected=!0,m&&(n[b].defaultSelected=!0);return}i!==null||n[b].disabled||(i=n[b])}i!==null&&(i.selected=!0)}}function ys(n,i,d){if(i!=null&&(i=""+sr(i),i!==n.value&&(n.value=i),d==null)){n.defaultValue!==i&&(n.defaultValue=i);return}n.defaultValue=d!=null?""+sr(d):""}function yi(n,i,d,m){if(i==null){if(m!=null){if(d!=null)throw Error(s(92));if(ue(m)){if(1<m.length)throw Error(s(93));m=m[0]}d=m}d==null&&(d=""),i=d}d=sr(i),n.defaultValue=d,m=n.textContent,m===d&&m!==""&&m!==null&&(n.value=m),Ft(n)}function An(n,i){if(i){var d=n.firstChild;if(d&&d===n.lastChild&&d.nodeType===3){d.nodeValue=i;return}}n.textContent=i}var Dc=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function bi(n,i,d){var m=i.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?m?n.setProperty(i,""):i==="float"?n.cssFloat="":n[i]="":m?n.setProperty(i,d):typeof d!="number"||d===0||Dc.has(i)?i==="float"?n.cssFloat=d:n[i]=(""+d).trim():n[i]=d+"px"}function dl(n,i,d){if(i!=null&&typeof i!="object")throw Error(s(62));if(n=n.style,d!=null){for(var m in d)!d.hasOwnProperty(m)||i!=null&&i.hasOwnProperty(m)||(m.indexOf("--")===0?n.setProperty(m,""):m==="float"?n.cssFloat="":n[m]="");for(var b in i)m=i[b],i.hasOwnProperty(b)&&d[b]!==m&&bi(n,b,m)}else for(var w in i)i.hasOwnProperty(w)&&bi(n,w,i[w])}function oo(n){if(n.indexOf("-")===-1)return!1;switch(n){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 ul=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Rc=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function vi(n){return Rc.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Vr(){}var fl=null;function lo(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var _i=null,Ct=null;function hn(n){var i=ot(n);if(i&&(n=i.stateNode)){var d=n[Q]||null;e:switch(n=i.stateNode,i.type){case"input":if(Mc(n,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),i=d.name,d.type==="radio"&&i!=null){for(d=n;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Ca(""+i)+'"][type="radio"]'),i=0;i<d.length;i++){var m=d[i];if(m!==n&&m.form===n.form){var b=m[Q]||null;if(!b)throw Error(s(90));Mc(m,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(i=0;i<d.length;i++)m=d[i],m.form===n.form&&Ra(m)}break e;case"textarea":ys(n,d.value,d.defaultValue);break e;case"select":i=d.value,i!=null&&ja(n,!!d.multiple,i,!1)}}}var ca=!1;function Pc(n,i,d){if(ca)return n(i,d);ca=!0;try{var m=n(i);return m}finally{if(ca=!1,(_i!==null||Ct!==null)&&(p0(),_i&&(i=_i,n=Ct,Ct=_i=null,hn(i),n)))for(i=0;i<n.length;i++)hn(n[i])}}function zs(n,i){var d=n.stateNode;if(d===null)return null;var m=d[Q]||null;if(m===null)return null;d=m[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(n=n.type,m=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!m;break e;default:n=!1}if(n)return null;if(d&&typeof d!="function")throw Error(s(231,i,typeof d));return d}var mn=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),co=!1;if(mn)try{var gn={};Object.defineProperty(gn,"passive",{get:function(){co=!0}}),window.addEventListener("test",gn,gn),window.removeEventListener("test",gn,gn)}catch(n){co=!1}var On=null,Us=null,Ua=null;function bs(){if(Ua)return Ua;var n,i=Us,d=i.length,m,b="value"in On?On.value:On.textContent,w=b.length;for(n=0;n<d&&i[n]===b[n];n++);var M=d-n;for(m=1;m<=M&&i[d-m]===b[w-m];m++);return Ua=b.slice(n,1<m?1-m:void 0)}function uo(n){var i=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&i===13&&(n=13)):n=i,n===10&&(n=13),32<=n||n===13?n:0}function fo(){return!0}function _u(){return!1}function xr(n){function i(d,m,b,w,M){this._reactName=d,this._targetInst=b,this.type=m,this.nativeEvent=w,this.target=M,this.currentTarget=null;for(var Z in n)n.hasOwnProperty(Z)&&(d=n[Z],this[Z]=d?d(w):w[Z]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?fo:_u,this.isPropagationStopped=_u,this}return v(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=fo)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=fo)},persist:function(){},isPersistent:fo}),i}var Jn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hl=xr(Jn),wi=v({},Jn,{view:0,detail:0}),Kt=xr(wi),Fc,Pr,Qn,ho=v({},wi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$c,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Qn&&(Qn&&n.type==="mousemove"?(Fc=n.screenX-Qn.screenX,Pr=n.screenY-Qn.screenY):Pr=Fc=0,Qn=n),Fc)},movementY:function(n){return"movementY"in n?n.movementY:Pr}}),wu=xr(ho),Ic=v({},ho,{dataTransfer:0}),rh=xr(Ic),ku=v({},wi,{relatedTarget:0}),Bc=xr(ku),nh=v({},Jn,{animationName:0,elapsedTime:0,pseudoElement:0}),zc=xr(nh),sh=v({},Jn,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Ln=xr(sh),ih=v({},Jn,{data:0}),Uc=xr(ih),vs={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nu={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Su={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hc(n){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(n):(n=Su[n])?!!i[n]:!1}function $c(){return Hc}var ju=v({},wi,{key:function(n){if(n.key){var i=vs[n.key]||n.key;if(i!=="Unidentified")return i}return n.type==="keypress"?(n=uo(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Nu[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$c,charCode:function(n){return n.type==="keypress"?uo(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?uo(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Tu=xr(ju),oh=v({},ho,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Eu=xr(oh),Wc=v({},wi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$c}),lh=xr(Wc),Cu=v({},Jn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Au=xr(Cu),ml=v({},ho,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Hs=xr(ml),ch=v({},Jn,{newState:0,oldState:0}),mo=xr(ch),Gr=[9,13,27,32],gl=mn&&"CompositionEvent"in window,ki=null;mn&&"documentMode"in document&&(ki=document.documentMode);var dh=mn&&"TextEvent"in window&&!ki,pl=mn&&(!gl||ki&&8<ki&&11>=ki),xl=" ",Ou=!1;function Lu(n,i){switch(n){case"keyup":return Gr.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vc(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ni=!1;function pn(n,i){switch(n){case"compositionend":return Vc(i);case"keypress":return i.which!==32?null:(Ou=!0,xl);case"textInput":return n=i.data,n===xl&&Ou?null:n;default:return null}}function Si(n,i){if(Ni)return n==="compositionend"||!gl&&Lu(n,i)?(n=bs(),Ua=Us=On=null,Ni=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return pl&&i.locale!=="ko"?null:i.data;default:return null}}var uh={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Mn(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i==="input"?!!uh[n.type]:i==="textarea"}function Mu(n,i,d,m){_i?Ct?Ct.push(m):Ct=[m]:_i=m,i=k0(i,"onChange"),0<i.length&&(d=new hl("onChange","change",null,d,m),n.push({event:d,listeners:i}))}var Dn=null,go=null;function po(n){Yy(n,0)}function xo(n){var i=Qe(n);if(Ra(i))return n}function yo(n,i){if(n==="change")return i}var Du=!1;if(mn){var Rn;if(mn){var ji="oninput"in document;if(!ji){var Ru=document.createElement("div");Ru.setAttribute("oninput","return;"),ji=typeof Ru.oninput=="function"}Rn=ji}else Rn=!1;Du=Rn&&(!document.documentMode||9<document.documentMode)}function yl(){Dn&&(Dn.detachEvent("onpropertychange",Pu),go=Dn=null)}function Pu(n){if(n.propertyName==="value"&&xo(go)){var i=[];Mu(i,go,n,lo(n)),Pc(po,i)}}function es(n,i,d){n==="focusin"?(yl(),Dn=i,go=d,Dn.attachEvent("onpropertychange",Pu)):n==="focusout"&&yl()}function fh(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return xo(go)}function Ti(n,i){if(n==="click")return xo(i)}function hh(n,i){if(n==="input"||n==="change")return xo(i)}function ts(n,i){return n===i&&(n!==0||1/n===1/i)||n!==n&&i!==i}var cr=typeof Object.is=="function"?Object.is:ts;function Ei(n,i){if(cr(n,i))return!0;if(typeof n!="object"||n===null||typeof i!="object"||i===null)return!1;var d=Object.keys(n),m=Object.keys(i);if(d.length!==m.length)return!1;for(m=0;m<d.length;m++){var b=d[m];if(!ke.call(i,b)||!cr(n[b],i[b]))return!1}return!0}function bl(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function bo(n,i){var d=bl(n);n=0;for(var m;d;){if(d.nodeType===3){if(m=n+d.textContent.length,n<=i&&m>=i)return{node:d,offset:i-n};n=m}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=bl(d)}}function vl(n,i){return n&&i?n===i?!0:n&&n.nodeType===3?!1:i&&i.nodeType===3?vl(n,i.parentNode):"contains"in n?n.contains(i):n.compareDocumentPosition?!!(n.compareDocumentPosition(i)&16):!1:!1}function vo(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var i=xi(n.document);i instanceof n.HTMLIFrameElement;){try{var d=typeof i.contentWindow.location.href=="string"}catch(m){d=!1}if(d)n=i.contentWindow;else break;i=xi(n.document)}return i}function _s(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i&&(i==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||i==="textarea"||n.contentEditable==="true")}var _l=mn&&"documentMode"in document&&11>=document.documentMode,ws=null,wl=null,_o=null,Ci=!1;function Fu(n,i,d){var m=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Ci||ws==null||ws!==xi(m)||(m=ws,"selectionStart"in m&&_s(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),_o&&Ei(_o,m)||(_o=m,m=k0(wl,"onSelect"),0<m.length&&(i=new hl("onSelect","select",null,i,d),n.push({event:i,listeners:m}),i.target=ws)))}function ks(n,i){var d={};return d[n.toLowerCase()]=i.toLowerCase(),d["Webkit"+n]="webkit"+i,d["Moz"+n]="moz"+i,d}var Ai={animationend:ks("Animation","AnimationEnd"),animationiteration:ks("Animation","AnimationIteration"),animationstart:ks("Animation","AnimationStart"),transitionrun:ks("Transition","TransitionRun"),transitionstart:ks("Transition","TransitionStart"),transitioncancel:ks("Transition","TransitionCancel"),transitionend:ks("Transition","TransitionEnd")},kl={},Iu={};mn&&(Iu=document.createElement("div").style,"AnimationEvent"in window||(delete Ai.animationend.animation,delete Ai.animationiteration.animation,delete Ai.animationstart.animation),"TransitionEvent"in window||delete Ai.transitionend.transition);function dr(n){if(kl[n])return kl[n];if(!Ai[n])return n;var i=Ai[n],d;for(d in i)if(i.hasOwnProperty(d)&&d in Iu)return kl[n]=i[d];return n}var wo=dr("animationend"),Bu=dr("animationiteration"),ko=dr("animationstart"),mh=dr("transitionrun"),zu=dr("transitionstart"),gh=dr("transitioncancel"),Oi=dr("transitionend"),Uu=new Map,Ns="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Ns.push("scrollEnd");function Zr(n,i){Uu.set(n,i),Ea(i,[n])}var No=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},qr=[],Er=0,Nl=0;function So(){for(var n=Er,i=Nl=Er=0;i<n;){var d=qr[i];qr[i++]=null;var m=qr[i];qr[i++]=null;var b=qr[i];qr[i++]=null;var w=qr[i];if(qr[i++]=null,m!==null&&b!==null){var M=m.pending;M===null?b.next=b:(b.next=M.next,M.next=b),m.pending=b}w!==0&&Li(d,b,w)}}function Ss(n,i,d,m){qr[Er++]=n,qr[Er++]=i,qr[Er++]=d,qr[Er++]=m,Nl|=m,n.lanes|=m,n=n.alternate,n!==null&&(n.lanes|=m)}function Gc(n,i,d,m){return Ss(n,i,d,m),jo(n)}function Pn(n,i){return Ss(n,null,null,i),jo(n)}function Li(n,i,d){n.lanes|=d;var m=n.alternate;m!==null&&(m.lanes|=d);for(var b=!1,w=n.return;w!==null;)w.childLanes|=d,m=w.alternate,m!==null&&(m.childLanes|=d),w.tag===22&&(n=w.stateNode,n===null||n._visibility&1||(b=!0)),n=w,w=w.return;return n.tag===3?(w=n.stateNode,b&&i!==null&&(b=31-$e(d),n=w.hiddenUpdates,m=n[b],m===null?n[b]=[i]:m.push(i),i.lane=d|536870912),w):null}function jo(n){if(50<xd)throw xd=0,xm=null,Error(s(185));for(var i=n.return;i!==null;)n=i,i=n.return;return n.tag===3?n.stateNode:null}var $s={};function ph(n,i,d,m){this.tag=n,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cr(n,i,d,m){return new ph(n,i,d,m)}function Sl(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Fn(n,i){var d=n.alternate;return d===null?(d=Cr(n.tag,i,n.key,n.mode),d.elementType=n.elementType,d.type=n.type,d.stateNode=n.stateNode,d.alternate=n,n.alternate=d):(d.pendingProps=i,d.type=n.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=n.flags&65011712,d.childLanes=n.childLanes,d.lanes=n.lanes,d.child=n.child,d.memoizedProps=n.memoizedProps,d.memoizedState=n.memoizedState,d.updateQueue=n.updateQueue,i=n.dependencies,d.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},d.sibling=n.sibling,d.index=n.index,d.ref=n.ref,d.refCleanup=n.refCleanup,d}function Zc(n,i){n.flags&=65011714;var d=n.alternate;return d===null?(n.childLanes=0,n.lanes=i,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=d.childLanes,n.lanes=d.lanes,n.child=d.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=d.memoizedProps,n.memoizedState=d.memoizedState,n.updateQueue=d.updateQueue,n.type=d.type,i=d.dependencies,n.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),n}function To(n,i,d,m,b,w){var M=0;if(m=n,typeof n=="function")Sl(n)&&(M=1);else if(typeof n=="string")M=ik(n,d,q.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case se:return n=Cr(31,d,i,b),n.elementType=se,n.lanes=w,n;case N:return Ws(d.children,b,w,i);case j:M=8,b|=24;break;case P:return n=Cr(12,d,i,b|2),n.elementType=P,n.lanes=w,n;case U:return n=Cr(13,d,i,b),n.elementType=U,n.lanes=w,n;case H:return n=Cr(19,d,i,b),n.elementType=H,n.lanes=w,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case O:M=10;break e;case C:M=9;break e;case R:M=11;break e;case B:M=14;break e;case oe:M=16,m=null;break e}M=29,d=Error(s(130,n===null?"null":typeof n,"")),m=null}return i=Cr(M,d,i,b),i.elementType=n,i.type=m,i.lanes=w,i}function Ws(n,i,d,m){return n=Cr(7,n,m,i),n.lanes=d,n}function jl(n,i,d){return n=Cr(6,n,null,i),n.lanes=d,n}function qc(n){var i=Cr(18,null,null,0);return i.stateNode=n,i}function Yc(n,i,d){return i=Cr(4,n.children!==null?n.children:[],n.key,i),i.lanes=d,i.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},i}var l=new WeakMap;function h(n,i){if(typeof n=="object"&&n!==null){var d=l.get(n);return d!==void 0?d:(i={value:n,source:i,stack:yt(i)},l.set(n,i),i)}return{value:n,source:i,stack:yt(i)}}var y=[],S=0,A=null,W=0,ce=[],Ne=0,Ae=null,Ge=1,ct="";function vt(n,i){y[S++]=W,y[S++]=A,A=n,W=i}function Ht(n,i,d){ce[Ne++]=Ge,ce[Ne++]=ct,ce[Ne++]=Ae,Ae=n;var m=Ge;n=ct;var b=32-$e(m)-1;m&=~(1<<b),d+=1;var w=32-$e(i)+b;if(30<w){var M=b-b%5;w=(m&(1<<M)-1).toString(32),m>>=M,b-=M,Ge=1<<32-$e(i)+b|d<<b|m,ct=w+n}else Ge=1<<w|d<<b|m,ct=n}function ir(n){n.return!==null&&(vt(n,1),Ht(n,1,0))}function Ha(n){for(;n===A;)A=y[--S],y[S]=null,W=y[--S],y[S]=null;for(;n===Ae;)Ae=ce[--Ne],ce[Ne]=null,ct=ce[--Ne],ce[Ne]=null,Ge=ce[--Ne],ce[Ne]=null}function Fr(n,i){ce[Ne++]=Ge,ce[Ne++]=ct,ce[Ne++]=Ae,Ge=i.id,ct=i.overflow,Ae=n}var ta=null,aa=null,qt=!1,js=null,Yr=!1,Tl=Error(s(519));function Ts(n){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Eo(h(i,n)),Tl}function Xc(n){var i=n.stateNode,d=n.type,m=n.memoizedProps;switch(i[X]=n,i[Q]=m,d){case"dialog":Xt("cancel",i),Xt("close",i);break;case"iframe":case"object":case"embed":Xt("load",i);break;case"video":case"audio":for(d=0;d<bd.length;d++)Xt(bd[d],i);break;case"source":Xt("error",i);break;case"img":case"image":case"link":Xt("error",i),Xt("load",i);break;case"details":Xt("toggle",i);break;case"input":Xt("invalid",i),io(i,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":Xt("invalid",i);break;case"textarea":Xt("invalid",i),yi(i,m.value,m.defaultValue,m.children)}d=m.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||i.textContent===""+d||m.suppressHydrationWarning===!0||Qy(i.textContent,d)?(m.popover!=null&&(Xt("beforetoggle",i),Xt("toggle",i)),m.onScroll!=null&&Xt("scroll",i),m.onScrollEnd!=null&&Xt("scrollend",i),m.onClick!=null&&(i.onclick=Vr),i=!0):i=!1,i||Ts(n,!0)}function za(n){for(ta=n.return;ta;)switch(ta.tag){case 5:case 31:case 13:Yr=!1;return;case 27:case 3:Yr=!0;return;default:ta=ta.return}}function as(n){if(n!==ta)return!1;if(!qt)return za(n),qt=!0,!1;var i=n.tag,d;if((d=i!==3&&i!==27)&&((d=i===5)&&(d=n.type,d=!(d!=="form"&&d!=="button")||Lm(n.type,n.memoizedProps)),d=!d),d&&aa&&Ts(n),za(n),i===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));aa=l1(n)}else if(i===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));aa=l1(n)}else i===27?(i=aa,Gi(n.type)?(n=Fm,Fm=null,aa=n):aa=i):aa=ta?Bn(n.stateNode.nextSibling):null;return!0}function Vs(){aa=ta=null,qt=!1}function Kc(){var n=js;return n!==null&&(Qr===null?Qr=n:Qr.push.apply(Qr,n),js=null),n}function Eo(n){js===null?js=[n]:js.push(n)}var Co=z(null),Es=null,rs=null;function Mi(n,i,d){G(Co,i._currentValue),i._currentValue=d}function Gs(n){n._currentValue=Co.current,D(Co)}function xh(n,i,d){for(;n!==null;){var m=n.alternate;if((n.childLanes&i)!==i?(n.childLanes|=i,m!==null&&(m.childLanes|=i)):m!==null&&(m.childLanes&i)!==i&&(m.childLanes|=i),n===d)break;n=n.return}}function yh(n,i,d,m){var b=n.child;for(b!==null&&(b.return=n);b!==null;){var w=b.dependencies;if(w!==null){var M=b.child;w=w.firstContext;e:for(;w!==null;){var Z=w;w=b;for(var me=0;me<i.length;me++)if(Z.context===i[me]){w.lanes|=d,Z=w.alternate,Z!==null&&(Z.lanes|=d),xh(w.return,d,n),m||(M=null);break e}w=Z.next}}else if(b.tag===18){if(M=b.return,M===null)throw Error(s(341));M.lanes|=d,w=M.alternate,w!==null&&(w.lanes|=d),xh(M,d,n),M=null}else M=b.child;if(M!==null)M.return=b;else for(M=b;M!==null;){if(M===n){M=null;break}if(b=M.sibling,b!==null){b.return=M.return,M=b;break}M=M.return}b=M}}function El(n,i,d,m){n=null;for(var b=i,w=!1;b!==null;){if(!w){if((b.flags&524288)!==0)w=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var M=b.alternate;if(M===null)throw Error(s(387));if(M=M.memoizedProps,M!==null){var Z=b.type;cr(b.pendingProps.value,M.value)||(n!==null?n.push(Z):n=[Z])}}else if(b===Pe.current){if(M=b.alternate,M===null)throw Error(s(387));M.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(n!==null?n.push(Nd):n=[Nd])}b=b.return}n!==null&&yh(i,n,d,m),i.flags|=262144}function Hu(n){for(n=n.firstContext;n!==null;){if(!cr(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Ao(n){Es=n,rs=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function yr(n){return Ip(Es,n)}function $u(n,i){return Es===null&&Ao(n),Ip(n,i)}function Ip(n,i){var d=i._currentValue;if(i={context:i,memoizedValue:d,next:null},rs===null){if(n===null)throw Error(s(308));rs=i,n.dependencies={lanes:0,firstContext:i},n.flags|=524288}else rs=rs.next=i;return d}var a4=typeof AbortController!="undefined"?AbortController:function(){var n=[],i=this.signal={aborted:!1,addEventListener:function(d,m){n.push(m)}};this.abort=function(){i.aborted=!0,n.forEach(function(d){return d()})}},r4=e.unstable_scheduleCallback,n4=e.unstable_NormalPriority,Ja={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bh(){return{controller:new a4,data:new Map,refCount:0}}function Jc(n){n.refCount--,n.refCount===0&&r4(n4,function(){n.controller.abort()})}var Qc=null,vh=0,Cl=0,Al=null;function s4(n,i){if(Qc===null){var d=Qc=[];vh=0,Cl=km(),Al={status:"pending",value:void 0,then:function(m){d.push(m)}}}return vh++,i.then(Bp,Bp),i}function Bp(){if(--vh===0&&Qc!==null){Al!==null&&(Al.status="fulfilled");var n=Qc;Qc=null,Cl=0,Al=null;for(var i=0;i<n.length;i++)(0,n[i])()}}function i4(n,i){var d=[],m={status:"pending",value:null,reason:null,then:function(b){d.push(b)}};return n.then(function(){m.status="fulfilled",m.value=i;for(var b=0;b<d.length;b++)(0,d[b])(i)},function(b){for(m.status="rejected",m.reason=b,b=0;b<d.length;b++)(0,d[b])(void 0)}),m}var zp=te.S;te.S=function(n,i){ky=ft(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&s4(n,i),zp!==null&&zp(n,i)};var Oo=z(null);function _h(){var n=Oo.current;return n!==null?n:Ta.pooledCache}function Wu(n,i){i===null?G(Oo,Oo.current):G(Oo,i.pool)}function Up(){var n=_h();return n===null?null:{parent:Ja._currentValue,pool:n}}var Ol=Error(s(460)),wh=Error(s(474)),Vu=Error(s(542)),Gu={then:function(){}};function Hp(n){return n=n.status,n==="fulfilled"||n==="rejected"}function $p(n,i,d){switch(d=n[d],d===void 0?n.push(i):d!==i&&(i.then(Vr,Vr),i=d),i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,Vp(n),n;default:if(typeof i.status=="string")i.then(Vr,Vr);else{if(n=Ta,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=i,n.status="pending",n.then(function(m){if(i.status==="pending"){var b=i;b.status="fulfilled",b.value=m}},function(m){if(i.status==="pending"){var b=i;b.status="rejected",b.reason=m}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,Vp(n),n}throw Mo=i,Ol}}function Lo(n){try{var i=n._init;return i(n._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(Mo=d,Ol):d}}var Mo=null;function Wp(){if(Mo===null)throw Error(s(459));var n=Mo;return Mo=null,n}function Vp(n){if(n===Ol||n===Vu)throw Error(s(483))}var Ll=null,ed=0;function Zu(n){var i=ed;return ed+=1,Ll===null&&(Ll=[]),$p(Ll,n,i)}function td(n,i){i=i.props.ref,n.ref=i!==void 0?i:null}function qu(n,i){throw i.$$typeof===_?Error(s(525)):(n=Object.prototype.toString.call(i),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":n)))}function Gp(n){function i(we,ve){if(n){var Te=we.deletions;Te===null?(we.deletions=[ve],we.flags|=16):Te.push(ve)}}function d(we,ve){if(!n)return null;for(;ve!==null;)i(we,ve),ve=ve.sibling;return null}function m(we){for(var ve=new Map;we!==null;)we.key!==null?ve.set(we.key,we):ve.set(we.index,we),we=we.sibling;return ve}function b(we,ve){return we=Fn(we,ve),we.index=0,we.sibling=null,we}function w(we,ve,Te){return we.index=Te,n?(Te=we.alternate,Te!==null?(Te=Te.index,Te<ve?(we.flags|=67108866,ve):Te):(we.flags|=67108866,ve)):(we.flags|=1048576,ve)}function M(we){return n&&we.alternate===null&&(we.flags|=67108866),we}function Z(we,ve,Te,Ve){return ve===null||ve.tag!==6?(ve=jl(Te,we.mode,Ve),ve.return=we,ve):(ve=b(ve,Te),ve.return=we,ve)}function me(we,ve,Te,Ve){var Nt=Te.type;return Nt===N?Ue(we,ve,Te.props.children,Ve,Te.key):ve!==null&&(ve.elementType===Nt||typeof Nt=="object"&&Nt!==null&&Nt.$$typeof===oe&&Lo(Nt)===ve.type)?(ve=b(ve,Te.props),td(ve,Te),ve.return=we,ve):(ve=To(Te.type,Te.key,Te.props,null,we.mode,Ve),td(ve,Te),ve.return=we,ve)}function Ce(we,ve,Te,Ve){return ve===null||ve.tag!==4||ve.stateNode.containerInfo!==Te.containerInfo||ve.stateNode.implementation!==Te.implementation?(ve=Yc(Te,we.mode,Ve),ve.return=we,ve):(ve=b(ve,Te.children||[]),ve.return=we,ve)}function Ue(we,ve,Te,Ve,Nt){return ve===null||ve.tag!==7?(ve=Ws(Te,we.mode,Ve,Nt),ve.return=we,ve):(ve=b(ve,Te),ve.return=we,ve)}function Ze(we,ve,Te){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return ve=jl(""+ve,we.mode,Te),ve.return=we,ve;if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case k:return Te=To(ve.type,ve.key,ve.props,null,we.mode,Te),td(Te,ve),Te.return=we,Te;case T:return ve=Yc(ve,we.mode,Te),ve.return=we,ve;case oe:return ve=Lo(ve),Ze(we,ve,Te)}if(ue(ve)||re(ve))return ve=Ws(ve,we.mode,Te,null),ve.return=we,ve;if(typeof ve.then=="function")return Ze(we,Zu(ve),Te);if(ve.$$typeof===O)return Ze(we,$u(we,ve),Te);qu(we,ve)}return null}function Oe(we,ve,Te,Ve){var Nt=ve!==null?ve.key:null;if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return Nt!==null?null:Z(we,ve,""+Te,Ve);if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case k:return Te.key===Nt?me(we,ve,Te,Ve):null;case T:return Te.key===Nt?Ce(we,ve,Te,Ve):null;case oe:return Te=Lo(Te),Oe(we,ve,Te,Ve)}if(ue(Te)||re(Te))return Nt!==null?null:Ue(we,ve,Te,Ve,null);if(typeof Te.then=="function")return Oe(we,ve,Zu(Te),Ve);if(Te.$$typeof===O)return Oe(we,ve,$u(we,Te),Ve);qu(we,Te)}return null}function Re(we,ve,Te,Ve,Nt){if(typeof Ve=="string"&&Ve!==""||typeof Ve=="number"||typeof Ve=="bigint")return we=we.get(Te)||null,Z(ve,we,""+Ve,Nt);if(typeof Ve=="object"&&Ve!==null){switch(Ve.$$typeof){case k:return we=we.get(Ve.key===null?Te:Ve.key)||null,me(ve,we,Ve,Nt);case T:return we=we.get(Ve.key===null?Te:Ve.key)||null,Ce(ve,we,Ve,Nt);case oe:return Ve=Lo(Ve),Re(we,ve,Te,Ve,Nt)}if(ue(Ve)||re(Ve))return we=we.get(Te)||null,Ue(ve,we,Ve,Nt,null);if(typeof Ve.then=="function")return Re(we,ve,Te,Zu(Ve),Nt);if(Ve.$$typeof===O)return Re(we,ve,Te,$u(ve,Ve),Nt);qu(ve,Ve)}return null}function gt(we,ve,Te,Ve){for(var Nt=null,ra=null,xt=ve,$t=ve=0,Qt=null;xt!==null&&$t<Te.length;$t++){xt.index>$t?(Qt=xt,xt=null):Qt=xt.sibling;var na=Oe(we,xt,Te[$t],Ve);if(na===null){xt===null&&(xt=Qt);break}n&&xt&&na.alternate===null&&i(we,xt),ve=w(na,ve,$t),ra===null?Nt=na:ra.sibling=na,ra=na,xt=Qt}if($t===Te.length)return d(we,xt),qt&&vt(we,$t),Nt;if(xt===null){for(;$t<Te.length;$t++)xt=Ze(we,Te[$t],Ve),xt!==null&&(ve=w(xt,ve,$t),ra===null?Nt=xt:ra.sibling=xt,ra=xt);return qt&&vt(we,$t),Nt}for(xt=m(xt);$t<Te.length;$t++)Qt=Re(xt,we,$t,Te[$t],Ve),Qt!==null&&(n&&Qt.alternate!==null&&xt.delete(Qt.key===null?$t:Qt.key),ve=w(Qt,ve,$t),ra===null?Nt=Qt:ra.sibling=Qt,ra=Qt);return n&&xt.forEach(function(Ki){return i(we,Ki)}),qt&&vt(we,$t),Nt}function Tt(we,ve,Te,Ve){if(Te==null)throw Error(s(151));for(var Nt=null,ra=null,xt=ve,$t=ve=0,Qt=null,na=Te.next();xt!==null&&!na.done;$t++,na=Te.next()){xt.index>$t?(Qt=xt,xt=null):Qt=xt.sibling;var Ki=Oe(we,xt,na.value,Ve);if(Ki===null){xt===null&&(xt=Qt);break}n&&xt&&Ki.alternate===null&&i(we,xt),ve=w(Ki,ve,$t),ra===null?Nt=Ki:ra.sibling=Ki,ra=Ki,xt=Qt}if(na.done)return d(we,xt),qt&&vt(we,$t),Nt;if(xt===null){for(;!na.done;$t++,na=Te.next())na=Ze(we,na.value,Ve),na!==null&&(ve=w(na,ve,$t),ra===null?Nt=na:ra.sibling=na,ra=na);return qt&&vt(we,$t),Nt}for(xt=m(xt);!na.done;$t++,na=Te.next())na=Re(xt,we,$t,na.value,Ve),na!==null&&(n&&na.alternate!==null&&xt.delete(na.key===null?$t:na.key),ve=w(na,ve,$t),ra===null?Nt=na:ra.sibling=na,ra=na);return n&&xt.forEach(function(xk){return i(we,xk)}),qt&&vt(we,$t),Nt}function ka(we,ve,Te,Ve){if(typeof Te=="object"&&Te!==null&&Te.type===N&&Te.key===null&&(Te=Te.props.children),typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case k:e:{for(var Nt=Te.key;ve!==null;){if(ve.key===Nt){if(Nt=Te.type,Nt===N){if(ve.tag===7){d(we,ve.sibling),Ve=b(ve,Te.props.children),Ve.return=we,we=Ve;break e}}else if(ve.elementType===Nt||typeof Nt=="object"&&Nt!==null&&Nt.$$typeof===oe&&Lo(Nt)===ve.type){d(we,ve.sibling),Ve=b(ve,Te.props),td(Ve,Te),Ve.return=we,we=Ve;break e}d(we,ve);break}else i(we,ve);ve=ve.sibling}Te.type===N?(Ve=Ws(Te.props.children,we.mode,Ve,Te.key),Ve.return=we,we=Ve):(Ve=To(Te.type,Te.key,Te.props,null,we.mode,Ve),td(Ve,Te),Ve.return=we,we=Ve)}return M(we);case T:e:{for(Nt=Te.key;ve!==null;){if(ve.key===Nt)if(ve.tag===4&&ve.stateNode.containerInfo===Te.containerInfo&&ve.stateNode.implementation===Te.implementation){d(we,ve.sibling),Ve=b(ve,Te.children||[]),Ve.return=we,we=Ve;break e}else{d(we,ve);break}else i(we,ve);ve=ve.sibling}Ve=Yc(Te,we.mode,Ve),Ve.return=we,we=Ve}return M(we);case oe:return Te=Lo(Te),ka(we,ve,Te,Ve)}if(ue(Te))return gt(we,ve,Te,Ve);if(re(Te)){if(Nt=re(Te),typeof Nt!="function")throw Error(s(150));return Te=Nt.call(Te),Tt(we,ve,Te,Ve)}if(typeof Te.then=="function")return ka(we,ve,Zu(Te),Ve);if(Te.$$typeof===O)return ka(we,ve,$u(we,Te),Ve);qu(we,Te)}return typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint"?(Te=""+Te,ve!==null&&ve.tag===6?(d(we,ve.sibling),Ve=b(ve,Te),Ve.return=we,we=Ve):(d(we,ve),Ve=jl(Te,we.mode,Ve),Ve.return=we,we=Ve),M(we)):d(we,ve)}return function(we,ve,Te,Ve){try{ed=0;var Nt=ka(we,ve,Te,Ve);return Ll=null,Nt}catch(xt){if(xt===Ol||xt===Vu)throw xt;var ra=Cr(29,xt,null,we.mode);return ra.lanes=Ve,ra.return=we,ra}finally{}}}var Do=Gp(!0),Zp=Gp(!1),Di=!1;function kh(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Nh(n,i){n=n.updateQueue,i.updateQueue===n&&(i.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Ri(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Pi(n,i,d){var m=n.updateQueue;if(m===null)return null;if(m=m.shared,(oa&2)!==0){var b=m.pending;return b===null?i.next=i:(i.next=b.next,b.next=i),m.pending=i,i=jo(n),Li(n,null,d),i}return Ss(n,m,i,d),jo(n)}function ad(n,i,d){if(i=i.updateQueue,i!==null&&(i=i.shared,(d&4194048)!==0)){var m=i.lanes;m&=n.pendingLanes,d|=m,i.lanes=d,Cn(n,d)}}function Sh(n,i){var d=n.updateQueue,m=n.alternate;if(m!==null&&(m=m.updateQueue,d===m)){var b=null,w=null;if(d=d.firstBaseUpdate,d!==null){do{var M={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};w===null?b=w=M:w=w.next=M,d=d.next}while(d!==null);w===null?b=w=i:w=w.next=i}else b=w=i;d={baseState:m.baseState,firstBaseUpdate:b,lastBaseUpdate:w,shared:m.shared,callbacks:m.callbacks},n.updateQueue=d;return}n=d.lastBaseUpdate,n===null?d.firstBaseUpdate=i:n.next=i,d.lastBaseUpdate=i}var jh=!1;function rd(){if(jh){var n=Al;if(n!==null)throw n}}function nd(n,i,d,m){jh=!1;var b=n.updateQueue;Di=!1;var w=b.firstBaseUpdate,M=b.lastBaseUpdate,Z=b.shared.pending;if(Z!==null){b.shared.pending=null;var me=Z,Ce=me.next;me.next=null,M===null?w=Ce:M.next=Ce,M=me;var Ue=n.alternate;Ue!==null&&(Ue=Ue.updateQueue,Z=Ue.lastBaseUpdate,Z!==M&&(Z===null?Ue.firstBaseUpdate=Ce:Z.next=Ce,Ue.lastBaseUpdate=me))}if(w!==null){var Ze=b.baseState;M=0,Ue=Ce=me=null,Z=w;do{var Oe=Z.lane&-536870913,Re=Oe!==Z.lane;if(Re?(Jt&Oe)===Oe:(m&Oe)===Oe){Oe!==0&&Oe===Cl&&(jh=!0),Ue!==null&&(Ue=Ue.next={lane:0,tag:Z.tag,payload:Z.payload,callback:null,next:null});e:{var gt=n,Tt=Z;Oe=i;var ka=d;switch(Tt.tag){case 1:if(gt=Tt.payload,typeof gt=="function"){Ze=gt.call(ka,Ze,Oe);break e}Ze=gt;break e;case 3:gt.flags=gt.flags&-65537|128;case 0:if(gt=Tt.payload,Oe=typeof gt=="function"?gt.call(ka,Ze,Oe):gt,Oe==null)break e;Ze=v({},Ze,Oe);break e;case 2:Di=!0}}Oe=Z.callback,Oe!==null&&(n.flags|=64,Re&&(n.flags|=8192),Re=b.callbacks,Re===null?b.callbacks=[Oe]:Re.push(Oe))}else Re={lane:Oe,tag:Z.tag,payload:Z.payload,callback:Z.callback,next:null},Ue===null?(Ce=Ue=Re,me=Ze):Ue=Ue.next=Re,M|=Oe;if(Z=Z.next,Z===null){if(Z=b.shared.pending,Z===null)break;Re=Z,Z=Re.next,Re.next=null,b.lastBaseUpdate=Re,b.shared.pending=null}}while(!0);Ue===null&&(me=Ze),b.baseState=me,b.firstBaseUpdate=Ce,b.lastBaseUpdate=Ue,w===null&&(b.shared.lanes=0),Ui|=M,n.lanes=M,n.memoizedState=Ze}}function qp(n,i){if(typeof n!="function")throw Error(s(191,n));n.call(i)}function Yp(n,i){var d=n.callbacks;if(d!==null)for(n.callbacks=null,n=0;n<d.length;n++)qp(d[n],i)}var Ml=z(null),Yu=z(0);function Xp(n,i){n=ti,G(Yu,n),G(Ml,i),ti=n|i.baseLanes}function Th(){G(Yu,ti),G(Ml,Ml.current)}function Eh(){ti=Yu.current,D(Ml),D(Yu)}var xn=z(null),In=null;function Fi(n){var i=n.alternate;G(qa,qa.current&1),G(xn,n),In===null&&(i===null||Ml.current!==null||i.memoizedState!==null)&&(In=n)}function Ch(n){G(qa,qa.current),G(xn,n),In===null&&(In=n)}function Kp(n){n.tag===22?(G(qa,qa.current),G(xn,n),In===null&&(In=n)):Ii()}function Ii(){G(qa,qa.current),G(xn,xn.current)}function yn(n){D(xn),In===n&&(In=null),D(qa)}var qa=z(0);function Xu(n){for(var i=n;i!==null;){if(i.tag===13){var d=i.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Rm(d)||Pm(d)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Zs=0,Bt=null,_a=null,Qa=null,Ku=!1,Dl=!1,Ro=!1,Ju=0,sd=0,Rl=null,o4=0;function $a(){throw Error(s(321))}function Ah(n,i){if(i===null)return!1;for(var d=0;d<i.length&&d<n.length;d++)if(!cr(n[d],i[d]))return!1;return!0}function Oh(n,i,d,m,b,w){return Zs=w,Bt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,te.H=n===null||n.memoizedState===null?Dx:Gh,Ro=!1,w=d(m,b),Ro=!1,Dl&&(w=Qp(i,d,m,b)),Jp(n),w}function Jp(n){te.H=ld;var i=_a!==null&&_a.next!==null;if(Zs=0,Qa=_a=Bt=null,Ku=!1,sd=0,Rl=null,i)throw Error(s(300));n===null||er||(n=n.dependencies,n!==null&&Hu(n)&&(er=!0))}function Qp(n,i,d,m){Bt=n;var b=0;do{if(Dl&&(Rl=null),sd=0,Dl=!1,25<=b)throw Error(s(301));if(b+=1,Qa=_a=null,n.updateQueue!=null){var w=n.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}te.H=Rx,w=i(d,m)}while(Dl);return w}function l4(){var n=te.H,i=n.useState()[0];return i=typeof i.then=="function"?id(i):i,n=n.useState()[0],(_a!==null?_a.memoizedState:null)!==n&&(Bt.flags|=1024),i}function Lh(){var n=Ju!==0;return Ju=0,n}function Mh(n,i,d){i.updateQueue=n.updateQueue,i.flags&=-2053,n.lanes&=~d}function Dh(n){if(Ku){for(n=n.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}Ku=!1}Zs=0,Qa=_a=Bt=null,Dl=!1,sd=Ju=0,Rl=null}function Ir(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qa===null?Bt.memoizedState=Qa=n:Qa=Qa.next=n,Qa}function Ya(){if(_a===null){var n=Bt.alternate;n=n!==null?n.memoizedState:null}else n=_a.next;var i=Qa===null?Bt.memoizedState:Qa.next;if(i!==null)Qa=i,_a=n;else{if(n===null)throw Bt.alternate===null?Error(s(467)):Error(s(310));_a=n,n={memoizedState:_a.memoizedState,baseState:_a.baseState,baseQueue:_a.baseQueue,queue:_a.queue,next:null},Qa===null?Bt.memoizedState=Qa=n:Qa=Qa.next=n}return Qa}function Qu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function id(n){var i=sd;return sd+=1,Rl===null&&(Rl=[]),n=$p(Rl,n,i),i=Bt,(Qa===null?i.memoizedState:Qa.next)===null&&(i=i.alternate,te.H=i===null||i.memoizedState===null?Dx:Gh),n}function e0(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return id(n);if(n.$$typeof===O)return yr(n)}throw Error(s(438,String(n)))}function Rh(n){var i=null,d=Bt.updateQueue;if(d!==null&&(i=d.memoCache),i==null){var m=Bt.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(i={data:m.data.map(function(b){return b.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),d===null&&(d=Qu(),Bt.updateQueue=d),d.memoCache=i,d=i.data[i.index],d===void 0)for(d=i.data[i.index]=Array(n),m=0;m<n;m++)d[m]=pe;return i.index++,d}function qs(n,i){return typeof i=="function"?i(n):i}function t0(n){var i=Ya();return Ph(i,_a,n)}function Ph(n,i,d){var m=n.queue;if(m===null)throw Error(s(311));m.lastRenderedReducer=d;var b=n.baseQueue,w=m.pending;if(w!==null){if(b!==null){var M=b.next;b.next=w.next,w.next=M}i.baseQueue=b=w,m.pending=null}if(w=n.baseState,b===null)n.memoizedState=w;else{i=b.next;var Z=M=null,me=null,Ce=i,Ue=!1;do{var Ze=Ce.lane&-536870913;if(Ze!==Ce.lane?(Jt&Ze)===Ze:(Zs&Ze)===Ze){var Oe=Ce.revertLane;if(Oe===0)me!==null&&(me=me.next={lane:0,revertLane:0,gesture:null,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null}),Ze===Cl&&(Ue=!0);else if((Zs&Oe)===Oe){Ce=Ce.next,Oe===Cl&&(Ue=!0);continue}else Ze={lane:0,revertLane:Ce.revertLane,gesture:null,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null},me===null?(Z=me=Ze,M=w):me=me.next=Ze,Bt.lanes|=Oe,Ui|=Oe;Ze=Ce.action,Ro&&d(w,Ze),w=Ce.hasEagerState?Ce.eagerState:d(w,Ze)}else Oe={lane:Ze,revertLane:Ce.revertLane,gesture:Ce.gesture,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null},me===null?(Z=me=Oe,M=w):me=me.next=Oe,Bt.lanes|=Ze,Ui|=Ze;Ce=Ce.next}while(Ce!==null&&Ce!==i);if(me===null?M=w:me.next=Z,!cr(w,n.memoizedState)&&(er=!0,Ue&&(d=Al,d!==null)))throw d;n.memoizedState=w,n.baseState=M,n.baseQueue=me,m.lastRenderedState=w}return b===null&&(m.lanes=0),[n.memoizedState,m.dispatch]}function Fh(n){var i=Ya(),d=i.queue;if(d===null)throw Error(s(311));d.lastRenderedReducer=n;var m=d.dispatch,b=d.pending,w=i.memoizedState;if(b!==null){d.pending=null;var M=b=b.next;do w=n(w,M.action),M=M.next;while(M!==b);cr(w,i.memoizedState)||(er=!0),i.memoizedState=w,i.baseQueue===null&&(i.baseState=w),d.lastRenderedState=w}return[w,m]}function ex(n,i,d){var m=Bt,b=Ya(),w=qt;if(w){if(d===void 0)throw Error(s(407));d=d()}else d=i();var M=!cr((_a||b).memoizedState,d);if(M&&(b.memoizedState=d,er=!0),b=b.queue,zh(rx.bind(null,m,b,n),[n]),b.getSnapshot!==i||M||Qa!==null&&Qa.memoizedState.tag&1){if(m.flags|=2048,Pl(9,{destroy:void 0},ax.bind(null,m,b,d,i),null),Ta===null)throw Error(s(349));w||(Zs&127)!==0||tx(m,i,d)}return d}function tx(n,i,d){n.flags|=16384,n={getSnapshot:i,value:d},i=Bt.updateQueue,i===null?(i=Qu(),Bt.updateQueue=i,i.stores=[n]):(d=i.stores,d===null?i.stores=[n]:d.push(n))}function ax(n,i,d,m){i.value=d,i.getSnapshot=m,nx(i)&&sx(n)}function rx(n,i,d){return d(function(){nx(i)&&sx(n)})}function nx(n){var i=n.getSnapshot;n=n.value;try{var d=i();return!cr(n,d)}catch(m){return!0}}function sx(n){var i=Pn(n,2);i!==null&&en(i,n,2)}function Ih(n){var i=Ir();if(typeof n=="function"){var d=n;if(n=d(),Ro){De(!0);try{d()}finally{De(!1)}}}return i.memoizedState=i.baseState=n,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qs,lastRenderedState:n},i}function ix(n,i,d,m){return n.baseState=d,Ph(n,_a,typeof m=="function"?m:qs)}function c4(n,i,d,m,b){if(n0(n))throw Error(s(485));if(n=i.action,n!==null){var w={payload:b,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){w.listeners.push(M)}};te.T!==null?d(!0):w.isTransition=!1,m(w),d=i.pending,d===null?(w.next=i.pending=w,ox(i,w)):(w.next=d.next,i.pending=d.next=w)}}function ox(n,i){var d=i.action,m=i.payload,b=n.state;if(i.isTransition){var w=te.T,M={};te.T=M;try{var Z=d(b,m),me=te.S;me!==null&&me(M,Z),lx(n,i,Z)}catch(Ce){Bh(n,i,Ce)}finally{w!==null&&M.types!==null&&(w.types=M.types),te.T=w}}else try{w=d(b,m),lx(n,i,w)}catch(Ce){Bh(n,i,Ce)}}function lx(n,i,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(m){cx(n,i,m)},function(m){return Bh(n,i,m)}):cx(n,i,d)}function cx(n,i,d){i.status="fulfilled",i.value=d,dx(i),n.state=d,i=n.pending,i!==null&&(d=i.next,d===i?n.pending=null:(d=d.next,i.next=d,ox(n,d)))}function Bh(n,i,d){var m=n.pending;if(n.pending=null,m!==null){m=m.next;do i.status="rejected",i.reason=d,dx(i),i=i.next;while(i!==m)}n.action=null}function dx(n){n=n.listeners;for(var i=0;i<n.length;i++)(0,n[i])()}function ux(n,i){return i}function fx(n,i){if(qt){var d=Ta.formState;if(d!==null){e:{var m=Bt;if(qt){if(aa){t:{for(var b=aa,w=Yr;b.nodeType!==8;){if(!w){b=null;break t}if(b=Bn(b.nextSibling),b===null){b=null;break t}}w=b.data,b=w==="F!"||w==="F"?b:null}if(b){aa=Bn(b.nextSibling),m=b.data==="F!";break e}}Ts(m)}m=!1}m&&(i=d[0])}}return d=Ir(),d.memoizedState=d.baseState=i,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ux,lastRenderedState:i},d.queue=m,d=Ox.bind(null,Bt,m),m.dispatch=d,m=Ih(!1),w=Vh.bind(null,Bt,!1,m.queue),m=Ir(),b={state:i,dispatch:null,action:n,pending:null},m.queue=b,d=c4.bind(null,Bt,b,w,d),b.dispatch=d,m.memoizedState=n,[i,d,!1]}function hx(n){var i=Ya();return mx(i,_a,n)}function mx(n,i,d){if(i=Ph(n,i,ux)[0],n=t0(qs)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var m=id(i)}catch(M){throw M===Ol?Vu:M}else m=i;i=Ya();var b=i.queue,w=b.dispatch;return d!==i.memoizedState&&(Bt.flags|=2048,Pl(9,{destroy:void 0},d4.bind(null,b,d),null)),[m,w,n]}function d4(n,i){n.action=i}function gx(n){var i=Ya(),d=_a;if(d!==null)return mx(i,d,n);Ya(),i=i.memoizedState,d=Ya();var m=d.queue.dispatch;return d.memoizedState=n,[i,m,!1]}function Pl(n,i,d,m){return n={tag:n,create:d,deps:m,inst:i,next:null},i=Bt.updateQueue,i===null&&(i=Qu(),Bt.updateQueue=i),d=i.lastEffect,d===null?i.lastEffect=n.next=n:(m=d.next,d.next=n,n.next=m,i.lastEffect=n),n}function px(){return Ya().memoizedState}function a0(n,i,d,m){var b=Ir();Bt.flags|=n,b.memoizedState=Pl(1|i,{destroy:void 0},d,m===void 0?null:m)}function r0(n,i,d,m){var b=Ya();m=m===void 0?null:m;var w=b.memoizedState.inst;_a!==null&&m!==null&&Ah(m,_a.memoizedState.deps)?b.memoizedState=Pl(i,w,d,m):(Bt.flags|=n,b.memoizedState=Pl(1|i,w,d,m))}function xx(n,i){a0(8390656,8,n,i)}function zh(n,i){r0(2048,8,n,i)}function u4(n){Bt.flags|=4;var i=Bt.updateQueue;if(i===null)i=Qu(),Bt.updateQueue=i,i.events=[n];else{var d=i.events;d===null?i.events=[n]:d.push(n)}}function yx(n){var i=Ya().memoizedState;return u4({ref:i,nextImpl:n}),function(){if((oa&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function bx(n,i){return r0(4,2,n,i)}function vx(n,i){return r0(4,4,n,i)}function _x(n,i){if(typeof i=="function"){n=n();var d=i(n);return function(){typeof d=="function"?d():i(null)}}if(i!=null)return n=n(),i.current=n,function(){i.current=null}}function wx(n,i,d){d=d!=null?d.concat([n]):null,r0(4,4,_x.bind(null,i,n),d)}function Uh(){}function kx(n,i){var d=Ya();i=i===void 0?null:i;var m=d.memoizedState;return i!==null&&Ah(i,m[1])?m[0]:(d.memoizedState=[n,i],n)}function Nx(n,i){var d=Ya();i=i===void 0?null:i;var m=d.memoizedState;if(i!==null&&Ah(i,m[1]))return m[0];if(m=n(),Ro){De(!0);try{n()}finally{De(!1)}}return d.memoizedState=[m,i],m}function Hh(n,i,d){return d===void 0||(Zs&1073741824)!==0&&(Jt&261930)===0?n.memoizedState=i:(n.memoizedState=d,n=Sy(),Bt.lanes|=n,Ui|=n,d)}function Sx(n,i,d,m){return cr(d,i)?d:Ml.current!==null?(n=Hh(n,d,m),cr(n,i)||(er=!0),n):(Zs&42)===0||(Zs&1073741824)!==0&&(Jt&261930)===0?(er=!0,n.memoizedState=d):(n=Sy(),Bt.lanes|=n,Ui|=n,i)}function jx(n,i,d,m,b){var w=V.p;V.p=w!==0&&8>w?w:8;var M=te.T,Z={};te.T=Z,Vh(n,!1,i,d);try{var me=b(),Ce=te.S;if(Ce!==null&&Ce(Z,me),me!==null&&typeof me=="object"&&typeof me.then=="function"){var Ue=i4(me,m);od(n,i,Ue,_n(n))}else od(n,i,m,_n(n))}catch(Ze){od(n,i,{then:function(){},status:"rejected",reason:Ze},_n())}finally{V.p=w,M!==null&&Z.types!==null&&(M.types=Z.types),te.T=M}}function f4(){}function $h(n,i,d,m){if(n.tag!==5)throw Error(s(476));var b=Tx(n).queue;jx(n,b,i,J,d===null?f4:function(){return Ex(n),d(m)})}function Tx(n){var i=n.memoizedState;if(i!==null)return i;i={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qs,lastRenderedState:J},next:null};var d={};return i.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qs,lastRenderedState:d},next:null},n.memoizedState=i,n=n.alternate,n!==null&&(n.memoizedState=i),i}function Ex(n){var i=Tx(n);i.next===null&&(i=n.alternate.memoizedState),od(n,i.next.queue,{},_n())}function Wh(){return yr(Nd)}function Cx(){return Ya().memoizedState}function Ax(){return Ya().memoizedState}function h4(n){for(var i=n.return;i!==null;){switch(i.tag){case 24:case 3:var d=_n();n=Ri(d);var m=Pi(i,n,d);m!==null&&(en(m,i,d),ad(m,i,d)),i={cache:bh()},n.payload=i;return}i=i.return}}function m4(n,i,d){var m=_n();d={lane:m,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},n0(n)?Lx(i,d):(d=Gc(n,i,d,m),d!==null&&(en(d,n,m),Mx(d,i,m)))}function Ox(n,i,d){var m=_n();od(n,i,d,m)}function od(n,i,d,m){var b={lane:m,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(n0(n))Lx(i,b);else{var w=n.alternate;if(n.lanes===0&&(w===null||w.lanes===0)&&(w=i.lastRenderedReducer,w!==null))try{var M=i.lastRenderedState,Z=w(M,d);if(b.hasEagerState=!0,b.eagerState=Z,cr(Z,M))return Ss(n,i,b,0),Ta===null&&So(),!1}catch(me){}finally{}if(d=Gc(n,i,b,m),d!==null)return en(d,n,m),Mx(d,i,m),!0}return!1}function Vh(n,i,d,m){if(m={lane:2,revertLane:km(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},n0(n)){if(i)throw Error(s(479))}else i=Gc(n,d,m,2),i!==null&&en(i,n,2)}function n0(n){var i=n.alternate;return n===Bt||i!==null&&i===Bt}function Lx(n,i){Dl=Ku=!0;var d=n.pending;d===null?i.next=i:(i.next=d.next,d.next=i),n.pending=i}function Mx(n,i,d){if((d&4194048)!==0){var m=i.lanes;m&=n.pendingLanes,d|=m,i.lanes=d,Cn(n,d)}}var ld={readContext:yr,use:e0,useCallback:$a,useContext:$a,useEffect:$a,useImperativeHandle:$a,useLayoutEffect:$a,useInsertionEffect:$a,useMemo:$a,useReducer:$a,useRef:$a,useState:$a,useDebugValue:$a,useDeferredValue:$a,useTransition:$a,useSyncExternalStore:$a,useId:$a,useHostTransitionStatus:$a,useFormState:$a,useActionState:$a,useOptimistic:$a,useMemoCache:$a,useCacheRefresh:$a};ld.useEffectEvent=$a;var Dx={readContext:yr,use:e0,useCallback:function(n,i){return Ir().memoizedState=[n,i===void 0?null:i],n},useContext:yr,useEffect:xx,useImperativeHandle:function(n,i,d){d=d!=null?d.concat([n]):null,a0(4194308,4,_x.bind(null,i,n),d)},useLayoutEffect:function(n,i){return a0(4194308,4,n,i)},useInsertionEffect:function(n,i){a0(4,2,n,i)},useMemo:function(n,i){var d=Ir();i=i===void 0?null:i;var m=n();if(Ro){De(!0);try{n()}finally{De(!1)}}return d.memoizedState=[m,i],m},useReducer:function(n,i,d){var m=Ir();if(d!==void 0){var b=d(i);if(Ro){De(!0);try{d(i)}finally{De(!1)}}}else b=i;return m.memoizedState=m.baseState=b,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:b},m.queue=n,n=n.dispatch=m4.bind(null,Bt,n),[m.memoizedState,n]},useRef:function(n){var i=Ir();return n={current:n},i.memoizedState=n},useState:function(n){n=Ih(n);var i=n.queue,d=Ox.bind(null,Bt,i);return i.dispatch=d,[n.memoizedState,d]},useDebugValue:Uh,useDeferredValue:function(n,i){var d=Ir();return Hh(d,n,i)},useTransition:function(){var n=Ih(!1);return n=jx.bind(null,Bt,n.queue,!0,!1),Ir().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,i,d){var m=Bt,b=Ir();if(qt){if(d===void 0)throw Error(s(407));d=d()}else{if(d=i(),Ta===null)throw Error(s(349));(Jt&127)!==0||tx(m,i,d)}b.memoizedState=d;var w={value:d,getSnapshot:i};return b.queue=w,xx(rx.bind(null,m,w,n),[n]),m.flags|=2048,Pl(9,{destroy:void 0},ax.bind(null,m,w,d,i),null),d},useId:function(){var n=Ir(),i=Ta.identifierPrefix;if(qt){var d=ct,m=Ge;d=(m&~(1<<32-$e(m)-1)).toString(32)+d,i="_"+i+"R_"+d,d=Ju++,0<d&&(i+="H"+d.toString(32)),i+="_"}else d=o4++,i="_"+i+"r_"+d.toString(32)+"_";return n.memoizedState=i},useHostTransitionStatus:Wh,useFormState:fx,useActionState:fx,useOptimistic:function(n){var i=Ir();i.memoizedState=i.baseState=n;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=d,i=Vh.bind(null,Bt,!0,d),d.dispatch=i,[n,i]},useMemoCache:Rh,useCacheRefresh:function(){return Ir().memoizedState=h4.bind(null,Bt)},useEffectEvent:function(n){var i=Ir(),d={impl:n};return i.memoizedState=d,function(){if((oa&2)!==0)throw Error(s(440));return d.impl.apply(void 0,arguments)}}},Gh={readContext:yr,use:e0,useCallback:kx,useContext:yr,useEffect:zh,useImperativeHandle:wx,useInsertionEffect:bx,useLayoutEffect:vx,useMemo:Nx,useReducer:t0,useRef:px,useState:function(){return t0(qs)},useDebugValue:Uh,useDeferredValue:function(n,i){var d=Ya();return Sx(d,_a.memoizedState,n,i)},useTransition:function(){var n=t0(qs)[0],i=Ya().memoizedState;return[typeof n=="boolean"?n:id(n),i]},useSyncExternalStore:ex,useId:Cx,useHostTransitionStatus:Wh,useFormState:hx,useActionState:hx,useOptimistic:function(n,i){var d=Ya();return ix(d,_a,n,i)},useMemoCache:Rh,useCacheRefresh:Ax};Gh.useEffectEvent=yx;var Rx={readContext:yr,use:e0,useCallback:kx,useContext:yr,useEffect:zh,useImperativeHandle:wx,useInsertionEffect:bx,useLayoutEffect:vx,useMemo:Nx,useReducer:Fh,useRef:px,useState:function(){return Fh(qs)},useDebugValue:Uh,useDeferredValue:function(n,i){var d=Ya();return _a===null?Hh(d,n,i):Sx(d,_a.memoizedState,n,i)},useTransition:function(){var n=Fh(qs)[0],i=Ya().memoizedState;return[typeof n=="boolean"?n:id(n),i]},useSyncExternalStore:ex,useId:Cx,useHostTransitionStatus:Wh,useFormState:gx,useActionState:gx,useOptimistic:function(n,i){var d=Ya();return _a!==null?ix(d,_a,n,i):(d.baseState=n,[n,d.queue.dispatch])},useMemoCache:Rh,useCacheRefresh:Ax};Rx.useEffectEvent=yx;function Zh(n,i,d,m){i=n.memoizedState,d=d(m,i),d=d==null?i:v({},i,d),n.memoizedState=d,n.lanes===0&&(n.updateQueue.baseState=d)}var qh={enqueueSetState:function(n,i,d){n=n._reactInternals;var m=_n(),b=Ri(m);b.payload=i,d!=null&&(b.callback=d),i=Pi(n,b,m),i!==null&&(en(i,n,m),ad(i,n,m))},enqueueReplaceState:function(n,i,d){n=n._reactInternals;var m=_n(),b=Ri(m);b.tag=1,b.payload=i,d!=null&&(b.callback=d),i=Pi(n,b,m),i!==null&&(en(i,n,m),ad(i,n,m))},enqueueForceUpdate:function(n,i){n=n._reactInternals;var d=_n(),m=Ri(d);m.tag=2,i!=null&&(m.callback=i),i=Pi(n,m,d),i!==null&&(en(i,n,d),ad(i,n,d))}};function Px(n,i,d,m,b,w,M){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(m,w,M):i.prototype&&i.prototype.isPureReactComponent?!Ei(d,m)||!Ei(b,w):!0}function Fx(n,i,d,m){n=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(d,m),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(d,m),i.state!==n&&qh.enqueueReplaceState(i,i.state,null)}function Po(n,i){var d=i;if("ref"in i){d={};for(var m in i)m!=="ref"&&(d[m]=i[m])}if(n=n.defaultProps){d===i&&(d=v({},d));for(var b in n)d[b]===void 0&&(d[b]=n[b])}return d}function Ix(n){No(n)}function Bx(n){console.error(n)}function zx(n){No(n)}function s0(n,i){try{var d=n.onUncaughtError;d(i.value,{componentStack:i.stack})}catch(m){setTimeout(function(){throw m})}}function Ux(n,i,d){try{var m=n.onCaughtError;m(d.value,{componentStack:d.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Yh(n,i,d){return d=Ri(d),d.tag=3,d.payload={element:null},d.callback=function(){s0(n,i)},d}function Hx(n){return n=Ri(n),n.tag=3,n}function $x(n,i,d,m){var b=d.type.getDerivedStateFromError;if(typeof b=="function"){var w=m.value;n.payload=function(){return b(w)},n.callback=function(){Ux(i,d,m)}}var M=d.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(n.callback=function(){Ux(i,d,m),typeof b!="function"&&(Hi===null?Hi=new Set([this]):Hi.add(this));var Z=m.stack;this.componentDidCatch(m.value,{componentStack:Z!==null?Z:""})})}function g4(n,i,d,m,b){if(d.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(i=d.alternate,i!==null&&El(i,d,b,!0),d=xn.current,d!==null){switch(d.tag){case 31:case 13:return In===null?x0():d.alternate===null&&Wa===0&&(Wa=3),d.flags&=-257,d.flags|=65536,d.lanes=b,m===Gu?d.flags|=16384:(i=d.updateQueue,i===null?d.updateQueue=new Set([m]):i.add(m),vm(n,m,b)),!1;case 22:return d.flags|=65536,m===Gu?d.flags|=16384:(i=d.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([m])},d.updateQueue=i):(d=i.retryQueue,d===null?i.retryQueue=new Set([m]):d.add(m)),vm(n,m,b)),!1}throw Error(s(435,d.tag))}return vm(n,m,b),x0(),!1}if(qt)return i=xn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=b,m!==Tl&&(n=Error(s(422),{cause:m}),Eo(h(n,d)))):(m!==Tl&&(i=Error(s(423),{cause:m}),Eo(h(i,d))),n=n.current.alternate,n.flags|=65536,b&=-b,n.lanes|=b,m=h(m,d),b=Yh(n.stateNode,m,b),Sh(n,b),Wa!==4&&(Wa=2)),!1;var w=Error(s(520),{cause:m});if(w=h(w,d),pd===null?pd=[w]:pd.push(w),Wa!==4&&(Wa=2),i===null)return!0;m=h(m,d),d=i;do{switch(d.tag){case 3:return d.flags|=65536,n=b&-b,d.lanes|=n,n=Yh(d.stateNode,m,n),Sh(d,n),!1;case 1:if(i=d.type,w=d.stateNode,(d.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Hi===null||!Hi.has(w))))return d.flags|=65536,b&=-b,d.lanes|=b,b=Hx(b),$x(b,n,d,m),Sh(d,b),!1}d=d.return}while(d!==null);return!1}var Xh=Error(s(461)),er=!1;function br(n,i,d,m){i.child=n===null?Zp(i,null,d,m):Do(i,n.child,d,m)}function Wx(n,i,d,m,b){d=d.render;var w=i.ref;if("ref"in m){var M={};for(var Z in m)Z!=="ref"&&(M[Z]=m[Z])}else M=m;return Ao(i),m=Oh(n,i,d,M,w,b),Z=Lh(),n!==null&&!er?(Mh(n,i,b),Ys(n,i,b)):(qt&&Z&&ir(i),i.flags|=1,br(n,i,m,b),i.child)}function Vx(n,i,d,m,b){if(n===null){var w=d.type;return typeof w=="function"&&!Sl(w)&&w.defaultProps===void 0&&d.compare===null?(i.tag=15,i.type=w,Gx(n,i,w,m,b)):(n=To(d.type,null,m,i,i.mode,b),n.ref=i.ref,n.return=i,i.child=n)}if(w=n.child,!nm(n,b)){var M=w.memoizedProps;if(d=d.compare,d=d!==null?d:Ei,d(M,m)&&n.ref===i.ref)return Ys(n,i,b)}return i.flags|=1,n=Fn(w,m),n.ref=i.ref,n.return=i,i.child=n}function Gx(n,i,d,m,b){if(n!==null){var w=n.memoizedProps;if(Ei(w,m)&&n.ref===i.ref)if(er=!1,i.pendingProps=m=w,nm(n,b))(n.flags&131072)!==0&&(er=!0);else return i.lanes=n.lanes,Ys(n,i,b)}return Kh(n,i,d,m,b)}function Zx(n,i,d,m){var b=m.children,w=n!==null?n.memoizedState:null;if(n===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((i.flags&128)!==0){if(w=w!==null?w.baseLanes|d:d,n!==null){for(m=i.child=n.child,b=0;m!==null;)b=b|m.lanes|m.childLanes,m=m.sibling;m=b&~w}else m=0,i.child=null;return qx(n,i,w,d,m)}if((d&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},n!==null&&Wu(i,w!==null?w.cachePool:null),w!==null?Xp(i,w):Th(),Kp(i);else return m=i.lanes=536870912,qx(n,i,w!==null?w.baseLanes|d:d,d,m)}else w!==null?(Wu(i,w.cachePool),Xp(i,w),Ii(),i.memoizedState=null):(n!==null&&Wu(i,null),Th(),Ii());return br(n,i,b,d),i.child}function cd(n,i){return n!==null&&n.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function qx(n,i,d,m,b){var w=_h();return w=w===null?null:{parent:Ja._currentValue,pool:w},i.memoizedState={baseLanes:d,cachePool:w},n!==null&&Wu(i,null),Th(),Kp(i),n!==null&&El(n,i,m,!0),i.childLanes=b,null}function i0(n,i){return i=l0({mode:i.mode,children:i.children},n.mode),i.ref=n.ref,n.child=i,i.return=n,i}function Yx(n,i,d){return Do(i,n.child,null,d),n=i0(i,i.pendingProps),n.flags|=2,yn(i),i.memoizedState=null,n}function p4(n,i,d){var m=i.pendingProps,b=(i.flags&128)!==0;if(i.flags&=-129,n===null){if(qt){if(m.mode==="hidden")return n=i0(i,m),i.lanes=536870912,cd(null,n);if(Ch(i),(n=aa)?(n=o1(n,Yr),n=n!==null&&n.data==="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:Ae!==null?{id:Ge,overflow:ct}:null,retryLane:536870912,hydrationErrors:null},d=qc(n),d.return=i,i.child=d,ta=i,aa=null)):n=null,n===null)throw Ts(i);return i.lanes=536870912,null}return i0(i,m)}var w=n.memoizedState;if(w!==null){var M=w.dehydrated;if(Ch(i),b)if(i.flags&256)i.flags&=-257,i=Yx(n,i,d);else if(i.memoizedState!==null)i.child=n.child,i.flags|=128,i=null;else throw Error(s(558));else if(er||El(n,i,d,!1),b=(d&n.childLanes)!==0,er||b){if(m=Ta,m!==null&&(M=xs(m,d),M!==0&&M!==w.retryLane))throw w.retryLane=M,Pn(n,M),en(m,n,M),Xh;x0(),i=Yx(n,i,d)}else n=w.treeContext,aa=Bn(M.nextSibling),ta=i,qt=!0,js=null,Yr=!1,n!==null&&Fr(i,n),i=i0(i,m),i.flags|=4096;return i}return n=Fn(n.child,{mode:m.mode,children:m.children}),n.ref=i.ref,i.child=n,n.return=i,n}function o0(n,i){var d=i.ref;if(d===null)n!==null&&n.ref!==null&&(i.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(s(284));(n===null||n.ref!==d)&&(i.flags|=4194816)}}function Kh(n,i,d,m,b){return Ao(i),d=Oh(n,i,d,m,void 0,b),m=Lh(),n!==null&&!er?(Mh(n,i,b),Ys(n,i,b)):(qt&&m&&ir(i),i.flags|=1,br(n,i,d,b),i.child)}function Xx(n,i,d,m,b,w){return Ao(i),i.updateQueue=null,d=Qp(i,m,d,b),Jp(n),m=Lh(),n!==null&&!er?(Mh(n,i,w),Ys(n,i,w)):(qt&&m&&ir(i),i.flags|=1,br(n,i,d,w),i.child)}function Kx(n,i,d,m,b){if(Ao(i),i.stateNode===null){var w=$s,M=d.contextType;typeof M=="object"&&M!==null&&(w=yr(M)),w=new d(m,w),i.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=qh,i.stateNode=w,w._reactInternals=i,w=i.stateNode,w.props=m,w.state=i.memoizedState,w.refs={},kh(i),M=d.contextType,w.context=typeof M=="object"&&M!==null?yr(M):$s,w.state=i.memoizedState,M=d.getDerivedStateFromProps,typeof M=="function"&&(Zh(i,d,M,m),w.state=i.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(M=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),M!==w.state&&qh.enqueueReplaceState(w,w.state,null),nd(i,m,w,b),rd(),w.state=i.memoizedState),typeof w.componentDidMount=="function"&&(i.flags|=4194308),m=!0}else if(n===null){w=i.stateNode;var Z=i.memoizedProps,me=Po(d,Z);w.props=me;var Ce=w.context,Ue=d.contextType;M=$s,typeof Ue=="object"&&Ue!==null&&(M=yr(Ue));var Ze=d.getDerivedStateFromProps;Ue=typeof Ze=="function"||typeof w.getSnapshotBeforeUpdate=="function",Z=i.pendingProps!==Z,Ue||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(Z||Ce!==M)&&Fx(i,w,m,M),Di=!1;var Oe=i.memoizedState;w.state=Oe,nd(i,m,w,b),rd(),Ce=i.memoizedState,Z||Oe!==Ce||Di?(typeof Ze=="function"&&(Zh(i,d,Ze,m),Ce=i.memoizedState),(me=Di||Px(i,d,me,m,Oe,Ce,M))?(Ue||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(i.flags|=4194308)):(typeof w.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=m,i.memoizedState=Ce),w.props=m,w.state=Ce,w.context=M,m=me):(typeof w.componentDidMount=="function"&&(i.flags|=4194308),m=!1)}else{w=i.stateNode,Nh(n,i),M=i.memoizedProps,Ue=Po(d,M),w.props=Ue,Ze=i.pendingProps,Oe=w.context,Ce=d.contextType,me=$s,typeof Ce=="object"&&Ce!==null&&(me=yr(Ce)),Z=d.getDerivedStateFromProps,(Ce=typeof Z=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(M!==Ze||Oe!==me)&&Fx(i,w,m,me),Di=!1,Oe=i.memoizedState,w.state=Oe,nd(i,m,w,b),rd();var Re=i.memoizedState;M!==Ze||Oe!==Re||Di||n!==null&&n.dependencies!==null&&Hu(n.dependencies)?(typeof Z=="function"&&(Zh(i,d,Z,m),Re=i.memoizedState),(Ue=Di||Px(i,d,Ue,m,Oe,Re,me)||n!==null&&n.dependencies!==null&&Hu(n.dependencies))?(Ce||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(m,Re,me),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(m,Re,me)),typeof w.componentDidUpdate=="function"&&(i.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof w.componentDidUpdate!="function"||M===n.memoizedProps&&Oe===n.memoizedState||(i.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||M===n.memoizedProps&&Oe===n.memoizedState||(i.flags|=1024),i.memoizedProps=m,i.memoizedState=Re),w.props=m,w.state=Re,w.context=me,m=Ue):(typeof w.componentDidUpdate!="function"||M===n.memoizedProps&&Oe===n.memoizedState||(i.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||M===n.memoizedProps&&Oe===n.memoizedState||(i.flags|=1024),m=!1)}return w=m,o0(n,i),m=(i.flags&128)!==0,w||m?(w=i.stateNode,d=m&&typeof d.getDerivedStateFromError!="function"?null:w.render(),i.flags|=1,n!==null&&m?(i.child=Do(i,n.child,null,b),i.child=Do(i,null,d,b)):br(n,i,d,b),i.memoizedState=w.state,n=i.child):n=Ys(n,i,b),n}function Jx(n,i,d,m){return Vs(),i.flags|=256,br(n,i,d,m),i.child}var Jh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qh(n){return{baseLanes:n,cachePool:Up()}}function em(n,i,d){return n=n!==null?n.childLanes&~d:0,i&&(n|=vn),n}function Qx(n,i,d){var m=i.pendingProps,b=!1,w=(i.flags&128)!==0,M;if((M=w)||(M=n!==null&&n.memoizedState===null?!1:(qa.current&2)!==0),M&&(b=!0,i.flags&=-129),M=(i.flags&32)!==0,i.flags&=-33,n===null){if(qt){if(b?Fi(i):Ii(),(n=aa)?(n=o1(n,Yr),n=n!==null&&n.data!=="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:Ae!==null?{id:Ge,overflow:ct}:null,retryLane:536870912,hydrationErrors:null},d=qc(n),d.return=i,i.child=d,ta=i,aa=null)):n=null,n===null)throw Ts(i);return Pm(n)?i.lanes=32:i.lanes=536870912,null}var Z=m.children;return m=m.fallback,b?(Ii(),b=i.mode,Z=l0({mode:"hidden",children:Z},b),m=Ws(m,b,d,null),Z.return=i,m.return=i,Z.sibling=m,i.child=Z,m=i.child,m.memoizedState=Qh(d),m.childLanes=em(n,M,d),i.memoizedState=Jh,cd(null,m)):(Fi(i),tm(i,Z))}var me=n.memoizedState;if(me!==null&&(Z=me.dehydrated,Z!==null)){if(w)i.flags&256?(Fi(i),i.flags&=-257,i=am(n,i,d)):i.memoizedState!==null?(Ii(),i.child=n.child,i.flags|=128,i=null):(Ii(),Z=m.fallback,b=i.mode,m=l0({mode:"visible",children:m.children},b),Z=Ws(Z,b,d,null),Z.flags|=2,m.return=i,Z.return=i,m.sibling=Z,i.child=m,Do(i,n.child,null,d),m=i.child,m.memoizedState=Qh(d),m.childLanes=em(n,M,d),i.memoizedState=Jh,i=cd(null,m));else if(Fi(i),Pm(Z)){if(M=Z.nextSibling&&Z.nextSibling.dataset,M)var Ce=M.dgst;M=Ce,m=Error(s(419)),m.stack="",m.digest=M,Eo({value:m,source:null,stack:null}),i=am(n,i,d)}else if(er||El(n,i,d,!1),M=(d&n.childLanes)!==0,er||M){if(M=Ta,M!==null&&(m=xs(M,d),m!==0&&m!==me.retryLane))throw me.retryLane=m,Pn(n,m),en(M,n,m),Xh;Rm(Z)||x0(),i=am(n,i,d)}else Rm(Z)?(i.flags|=192,i.child=n.child,i=null):(n=me.treeContext,aa=Bn(Z.nextSibling),ta=i,qt=!0,js=null,Yr=!1,n!==null&&Fr(i,n),i=tm(i,m.children),i.flags|=4096);return i}return b?(Ii(),Z=m.fallback,b=i.mode,me=n.child,Ce=me.sibling,m=Fn(me,{mode:"hidden",children:m.children}),m.subtreeFlags=me.subtreeFlags&65011712,Ce!==null?Z=Fn(Ce,Z):(Z=Ws(Z,b,d,null),Z.flags|=2),Z.return=i,m.return=i,m.sibling=Z,i.child=m,cd(null,m),m=i.child,Z=n.child.memoizedState,Z===null?Z=Qh(d):(b=Z.cachePool,b!==null?(me=Ja._currentValue,b=b.parent!==me?{parent:me,pool:me}:b):b=Up(),Z={baseLanes:Z.baseLanes|d,cachePool:b}),m.memoizedState=Z,m.childLanes=em(n,M,d),i.memoizedState=Jh,cd(n.child,m)):(Fi(i),d=n.child,n=d.sibling,d=Fn(d,{mode:"visible",children:m.children}),d.return=i,d.sibling=null,n!==null&&(M=i.deletions,M===null?(i.deletions=[n],i.flags|=16):M.push(n)),i.child=d,i.memoizedState=null,d)}function tm(n,i){return i=l0({mode:"visible",children:i},n.mode),i.return=n,n.child=i}function l0(n,i){return n=Cr(22,n,null,i),n.lanes=0,n}function am(n,i,d){return Do(i,n.child,null,d),n=tm(i,i.pendingProps.children),n.flags|=2,i.memoizedState=null,n}function ey(n,i,d){n.lanes|=i;var m=n.alternate;m!==null&&(m.lanes|=i),xh(n.return,i,d)}function rm(n,i,d,m,b,w){var M=n.memoizedState;M===null?n.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:m,tail:d,tailMode:b,treeForkCount:w}:(M.isBackwards=i,M.rendering=null,M.renderingStartTime=0,M.last=m,M.tail=d,M.tailMode=b,M.treeForkCount=w)}function ty(n,i,d){var m=i.pendingProps,b=m.revealOrder,w=m.tail;m=m.children;var M=qa.current,Z=(M&2)!==0;if(Z?(M=M&1|2,i.flags|=128):M&=1,G(qa,M),br(n,i,m,d),m=qt?W:0,!Z&&n!==null&&(n.flags&128)!==0)e:for(n=i.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&ey(n,d,i);else if(n.tag===19)ey(n,d,i);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break e;for(;n.sibling===null;){if(n.return===null||n.return===i)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(b){case"forwards":for(d=i.child,b=null;d!==null;)n=d.alternate,n!==null&&Xu(n)===null&&(b=d),d=d.sibling;d=b,d===null?(b=i.child,i.child=null):(b=d.sibling,d.sibling=null),rm(i,!1,b,d,w,m);break;case"backwards":case"unstable_legacy-backwards":for(d=null,b=i.child,i.child=null;b!==null;){if(n=b.alternate,n!==null&&Xu(n)===null){i.child=b;break}n=b.sibling,b.sibling=d,d=b,b=n}rm(i,!0,d,null,w,m);break;case"together":rm(i,!1,null,null,void 0,m);break;default:i.memoizedState=null}return i.child}function Ys(n,i,d){if(n!==null&&(i.dependencies=n.dependencies),Ui|=i.lanes,(d&i.childLanes)===0)if(n!==null){if(El(n,i,d,!1),(d&i.childLanes)===0)return null}else return null;if(n!==null&&i.child!==n.child)throw Error(s(153));if(i.child!==null){for(n=i.child,d=Fn(n,n.pendingProps),i.child=d,d.return=i;n.sibling!==null;)n=n.sibling,d=d.sibling=Fn(n,n.pendingProps),d.return=i;d.sibling=null}return i.child}function nm(n,i){return(n.lanes&i)!==0?!0:(n=n.dependencies,!!(n!==null&&Hu(n)))}function x4(n,i,d){switch(i.tag){case 3:We(i,i.stateNode.containerInfo),Mi(i,Ja,n.memoizedState.cache),Vs();break;case 27:case 5:He(i);break;case 4:We(i,i.stateNode.containerInfo);break;case 10:Mi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Ch(i),null;break;case 13:var m=i.memoizedState;if(m!==null)return m.dehydrated!==null?(Fi(i),i.flags|=128,null):(d&i.child.childLanes)!==0?Qx(n,i,d):(Fi(i),n=Ys(n,i,d),n!==null?n.sibling:null);Fi(i);break;case 19:var b=(n.flags&128)!==0;if(m=(d&i.childLanes)!==0,m||(El(n,i,d,!1),m=(d&i.childLanes)!==0),b){if(m)return ty(n,i,d);i.flags|=128}if(b=i.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),G(qa,qa.current),m)break;return null;case 22:return i.lanes=0,Zx(n,i,d,i.pendingProps);case 24:Mi(i,Ja,n.memoizedState.cache)}return Ys(n,i,d)}function ay(n,i,d){if(n!==null)if(n.memoizedProps!==i.pendingProps)er=!0;else{if(!nm(n,d)&&(i.flags&128)===0)return er=!1,x4(n,i,d);er=(n.flags&131072)!==0}else er=!1,qt&&(i.flags&1048576)!==0&&Ht(i,W,i.index);switch(i.lanes=0,i.tag){case 16:e:{var m=i.pendingProps;if(n=Lo(i.elementType),i.type=n,typeof n=="function")Sl(n)?(m=Po(n,m),i.tag=1,i=Kx(null,i,n,m,d)):(i.tag=0,i=Kh(null,i,n,m,d));else{if(n!=null){var b=n.$$typeof;if(b===R){i.tag=11,i=Wx(null,i,n,m,d);break e}else if(b===B){i.tag=14,i=Vx(null,i,n,m,d);break e}}throw i=ye(n)||n,Error(s(306,i,""))}}return i;case 0:return Kh(n,i,i.type,i.pendingProps,d);case 1:return m=i.type,b=Po(m,i.pendingProps),Kx(n,i,m,b,d);case 3:e:{if(We(i,i.stateNode.containerInfo),n===null)throw Error(s(387));m=i.pendingProps;var w=i.memoizedState;b=w.element,Nh(n,i),nd(i,m,null,d);var M=i.memoizedState;if(m=M.cache,Mi(i,Ja,m),m!==w.cache&&yh(i,[Ja],d,!0),rd(),m=M.element,w.isDehydrated)if(w={element:m,isDehydrated:!1,cache:M.cache},i.updateQueue.baseState=w,i.memoizedState=w,i.flags&256){i=Jx(n,i,m,d);break e}else if(m!==b){b=h(Error(s(424)),i),Eo(b),i=Jx(n,i,m,d);break e}else{switch(n=i.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(aa=Bn(n.firstChild),ta=i,qt=!0,js=null,Yr=!0,d=Zp(i,null,m,d),i.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling}else{if(Vs(),m===b){i=Ys(n,i,d);break e}br(n,i,m,d)}i=i.child}return i;case 26:return o0(n,i),n===null?(d=h1(i.type,null,i.pendingProps,null))?i.memoizedState=d:qt||(d=i.type,n=i.pendingProps,m=N0(fe.current).createElement(d),m[X]=i,m[Q]=n,vr(m,d,n),mt(m),i.stateNode=m):i.memoizedState=h1(i.type,n.memoizedProps,i.pendingProps,n.memoizedState),null;case 27:return He(i),n===null&&qt&&(m=i.stateNode=d1(i.type,i.pendingProps,fe.current),ta=i,Yr=!0,b=aa,Gi(i.type)?(Fm=b,aa=Bn(m.firstChild)):aa=b),br(n,i,i.pendingProps.children,d),o0(n,i),n===null&&(i.flags|=4194304),i.child;case 5:return n===null&&qt&&((b=m=aa)&&(m=Z4(m,i.type,i.pendingProps,Yr),m!==null?(i.stateNode=m,ta=i,aa=Bn(m.firstChild),Yr=!1,b=!0):b=!1),b||Ts(i)),He(i),b=i.type,w=i.pendingProps,M=n!==null?n.memoizedProps:null,m=w.children,Lm(b,w)?m=null:M!==null&&Lm(b,M)&&(i.flags|=32),i.memoizedState!==null&&(b=Oh(n,i,l4,null,null,d),Nd._currentValue=b),o0(n,i),br(n,i,m,d),i.child;case 6:return n===null&&qt&&((n=d=aa)&&(d=q4(d,i.pendingProps,Yr),d!==null?(i.stateNode=d,ta=i,aa=null,n=!0):n=!1),n||Ts(i)),null;case 13:return Qx(n,i,d);case 4:return We(i,i.stateNode.containerInfo),m=i.pendingProps,n===null?i.child=Do(i,null,m,d):br(n,i,m,d),i.child;case 11:return Wx(n,i,i.type,i.pendingProps,d);case 7:return br(n,i,i.pendingProps,d),i.child;case 8:return br(n,i,i.pendingProps.children,d),i.child;case 12:return br(n,i,i.pendingProps.children,d),i.child;case 10:return m=i.pendingProps,Mi(i,i.type,m.value),br(n,i,m.children,d),i.child;case 9:return b=i.type._context,m=i.pendingProps.children,Ao(i),b=yr(b),m=m(b),i.flags|=1,br(n,i,m,d),i.child;case 14:return Vx(n,i,i.type,i.pendingProps,d);case 15:return Gx(n,i,i.type,i.pendingProps,d);case 19:return ty(n,i,d);case 31:return p4(n,i,d);case 22:return Zx(n,i,d,i.pendingProps);case 24:return Ao(i),m=yr(Ja),n===null?(b=_h(),b===null&&(b=Ta,w=bh(),b.pooledCache=w,w.refCount++,w!==null&&(b.pooledCacheLanes|=d),b=w),i.memoizedState={parent:m,cache:b},kh(i),Mi(i,Ja,b)):((n.lanes&d)!==0&&(Nh(n,i),nd(i,null,null,d),rd()),b=n.memoizedState,w=i.memoizedState,b.parent!==m?(b={parent:m,cache:m},i.memoizedState=b,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=b),Mi(i,Ja,m)):(m=w.cache,Mi(i,Ja,m),m!==b.cache&&yh(i,[Ja],d,!0))),br(n,i,i.pendingProps.children,d),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function Xs(n){n.flags|=4}function sm(n,i,d,m,b){if((i=(n.mode&32)!==0)&&(i=!1),i){if(n.flags|=16777216,(b&335544128)===b)if(n.stateNode.complete)n.flags|=8192;else if(Cy())n.flags|=8192;else throw Mo=Gu,wh}else n.flags&=-16777217}function ry(n,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!y1(i))if(Cy())n.flags|=8192;else throw Mo=Gu,wh}function c0(n,i){i!==null&&(n.flags|=4),n.flags&16384&&(i=n.tag!==22?ps():536870912,n.lanes|=i,zl|=i)}function dd(n,i){if(!qt)switch(n.tailMode){case"hidden":i=n.tail;for(var d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?n.tail=null:d.sibling=null;break;case"collapsed":d=n.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?i||n.tail===null?n.tail=null:n.tail.sibling=null:m.sibling=null}}function Aa(n){var i=n.alternate!==null&&n.alternate.child===n.child,d=0,m=0;if(i)for(var b=n.child;b!==null;)d|=b.lanes|b.childLanes,m|=b.subtreeFlags&65011712,m|=b.flags&65011712,b.return=n,b=b.sibling;else for(b=n.child;b!==null;)d|=b.lanes|b.childLanes,m|=b.subtreeFlags,m|=b.flags,b.return=n,b=b.sibling;return n.subtreeFlags|=m,n.childLanes=d,i}function y4(n,i,d){var m=i.pendingProps;switch(Ha(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Aa(i),null;case 1:return Aa(i),null;case 3:return d=i.stateNode,m=null,n!==null&&(m=n.memoizedState.cache),i.memoizedState.cache!==m&&(i.flags|=2048),Gs(Ja),Fe(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(n===null||n.child===null)&&(as(i)?Xs(i):n===null||n.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Kc())),Aa(i),null;case 26:var b=i.type,w=i.memoizedState;return n===null?(Xs(i),w!==null?(Aa(i),ry(i,w)):(Aa(i),sm(i,b,null,m,d))):w?w!==n.memoizedState?(Xs(i),Aa(i),ry(i,w)):(Aa(i),i.flags&=-16777217):(n=n.memoizedProps,n!==m&&Xs(i),Aa(i),sm(i,b,n,m,d)),null;case 27:if(it(i),d=fe.current,b=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==m&&Xs(i);else{if(!m){if(i.stateNode===null)throw Error(s(166));return Aa(i),null}n=q.current,as(i)?Xc(i):(n=d1(b,m,d),i.stateNode=n,Xs(i))}return Aa(i),null;case 5:if(it(i),b=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==m&&Xs(i);else{if(!m){if(i.stateNode===null)throw Error(s(166));return Aa(i),null}if(w=q.current,as(i))Xc(i);else{var M=N0(fe.current);switch(w){case 1:w=M.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:w=M.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":w=M.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":w=M.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":w=M.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof m.is=="string"?M.createElement("select",{is:m.is}):M.createElement("select"),m.multiple?w.multiple=!0:m.size&&(w.size=m.size);break;default:w=typeof m.is=="string"?M.createElement(b,{is:m.is}):M.createElement(b)}}w[X]=i,w[Q]=m;e:for(M=i.child;M!==null;){if(M.tag===5||M.tag===6)w.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===i)break e;for(;M.sibling===null;){if(M.return===null||M.return===i)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}i.stateNode=w;e:switch(vr(w,b,m),b){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&Xs(i)}}return Aa(i),sm(i,i.type,n===null?null:n.memoizedProps,i.pendingProps,d),null;case 6:if(n&&i.stateNode!=null)n.memoizedProps!==m&&Xs(i);else{if(typeof m!="string"&&i.stateNode===null)throw Error(s(166));if(n=fe.current,as(i)){if(n=i.stateNode,d=i.memoizedProps,m=null,b=ta,b!==null)switch(b.tag){case 27:case 5:m=b.memoizedProps}n[X]=i,n=!!(n.nodeValue===d||m!==null&&m.suppressHydrationWarning===!0||Qy(n.nodeValue,d)),n||Ts(i,!0)}else n=N0(n).createTextNode(m),n[X]=i,i.stateNode=n}return Aa(i),null;case 31:if(d=i.memoizedState,n===null||n.memoizedState!==null){if(m=as(i),d!==null){if(n===null){if(!m)throw Error(s(318));if(n=i.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[X]=i}else Vs(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Aa(i),n=!1}else d=Kc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=d),n=!0;if(!n)return i.flags&256?(yn(i),i):(yn(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Aa(i),null;case 13:if(m=i.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(b=as(i),m!==null&&m.dehydrated!==null){if(n===null){if(!b)throw Error(s(318));if(b=i.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(s(317));b[X]=i}else Vs(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Aa(i),b=!1}else b=Kc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=b),b=!0;if(!b)return i.flags&256?(yn(i),i):(yn(i),null)}return yn(i),(i.flags&128)!==0?(i.lanes=d,i):(d=m!==null,n=n!==null&&n.memoizedState!==null,d&&(m=i.child,b=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(b=m.alternate.memoizedState.cachePool.pool),w=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(w=m.memoizedState.cachePool.pool),w!==b&&(m.flags|=2048)),d!==n&&d&&(i.child.flags|=8192),c0(i,i.updateQueue),Aa(i),null);case 4:return Fe(),n===null&&Tm(i.stateNode.containerInfo),Aa(i),null;case 10:return Gs(i.type),Aa(i),null;case 19:if(D(qa),m=i.memoizedState,m===null)return Aa(i),null;if(b=(i.flags&128)!==0,w=m.rendering,w===null)if(b)dd(m,!1);else{if(Wa!==0||n!==null&&(n.flags&128)!==0)for(n=i.child;n!==null;){if(w=Xu(n),w!==null){for(i.flags|=128,dd(m,!1),n=w.updateQueue,i.updateQueue=n,c0(i,n),i.subtreeFlags=0,n=d,d=i.child;d!==null;)Zc(d,n),d=d.sibling;return G(qa,qa.current&1|2),qt&&vt(i,m.treeForkCount),i.child}n=n.sibling}m.tail!==null&&ft()>m0&&(i.flags|=128,b=!0,dd(m,!1),i.lanes=4194304)}else{if(!b)if(n=Xu(w),n!==null){if(i.flags|=128,b=!0,n=n.updateQueue,i.updateQueue=n,c0(i,n),dd(m,!0),m.tail===null&&m.tailMode==="hidden"&&!w.alternate&&!qt)return Aa(i),null}else 2*ft()-m.renderingStartTime>m0&&d!==536870912&&(i.flags|=128,b=!0,dd(m,!1),i.lanes=4194304);m.isBackwards?(w.sibling=i.child,i.child=w):(n=m.last,n!==null?n.sibling=w:i.child=w,m.last=w)}return m.tail!==null?(n=m.tail,m.rendering=n,m.tail=n.sibling,m.renderingStartTime=ft(),n.sibling=null,d=qa.current,G(qa,b?d&1|2:d&1),qt&&vt(i,m.treeForkCount),n):(Aa(i),null);case 22:case 23:return yn(i),Eh(),m=i.memoizedState!==null,n!==null?n.memoizedState!==null!==m&&(i.flags|=8192):m&&(i.flags|=8192),m?(d&536870912)!==0&&(i.flags&128)===0&&(Aa(i),i.subtreeFlags&6&&(i.flags|=8192)):Aa(i),d=i.updateQueue,d!==null&&c0(i,d.retryQueue),d=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(d=n.memoizedState.cachePool.pool),m=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(m=i.memoizedState.cachePool.pool),m!==d&&(i.flags|=2048),n!==null&&D(Oo),null;case 24:return d=null,n!==null&&(d=n.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Gs(Ja),Aa(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function b4(n,i){switch(Ha(i),i.tag){case 1:return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 3:return Gs(Ja),Fe(),n=i.flags,(n&65536)!==0&&(n&128)===0?(i.flags=n&-65537|128,i):null;case 26:case 27:case 5:return it(i),null;case 31:if(i.memoizedState!==null){if(yn(i),i.alternate===null)throw Error(s(340));Vs()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 13:if(yn(i),n=i.memoizedState,n!==null&&n.dehydrated!==null){if(i.alternate===null)throw Error(s(340));Vs()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 19:return D(qa),null;case 4:return Fe(),null;case 10:return Gs(i.type),null;case 22:case 23:return yn(i),Eh(),n!==null&&D(Oo),n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 24:return Gs(Ja),null;case 25:return null;default:return null}}function ny(n,i){switch(Ha(i),i.tag){case 3:Gs(Ja),Fe();break;case 26:case 27:case 5:it(i);break;case 4:Fe();break;case 31:i.memoizedState!==null&&yn(i);break;case 13:yn(i);break;case 19:D(qa);break;case 10:Gs(i.type);break;case 22:case 23:yn(i),Eh(),n!==null&&D(Oo);break;case 24:Gs(Ja)}}function ud(n,i){try{var d=i.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var b=m.next;d=b;do{if((d.tag&n)===n){m=void 0;var w=d.create,M=d.inst;m=w(),M.destroy=m}d=d.next}while(d!==b)}}catch(Z){fa(i,i.return,Z)}}function Bi(n,i,d){try{var m=i.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var w=b.next;m=w;do{if((m.tag&n)===n){var M=m.inst,Z=M.destroy;if(Z!==void 0){M.destroy=void 0,b=i;var me=d,Ce=Z;try{Ce()}catch(Ue){fa(b,me,Ue)}}}m=m.next}while(m!==w)}}catch(Ue){fa(i,i.return,Ue)}}function sy(n){var i=n.updateQueue;if(i!==null){var d=n.stateNode;try{Yp(i,d)}catch(m){fa(n,n.return,m)}}}function iy(n,i,d){d.props=Po(n.type,n.memoizedProps),d.state=n.memoizedState;try{d.componentWillUnmount()}catch(m){fa(n,i,m)}}function fd(n,i){try{var d=n.ref;if(d!==null){switch(n.tag){case 26:case 27:case 5:var m=n.stateNode;break;case 30:m=n.stateNode;break;default:m=n.stateNode}typeof d=="function"?n.refCleanup=d(m):d.current=m}}catch(b){fa(n,i,b)}}function Cs(n,i){var d=n.ref,m=n.refCleanup;if(d!==null)if(typeof m=="function")try{m()}catch(b){fa(n,i,b)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(b){fa(n,i,b)}else d.current=null}function oy(n){var i=n.type,d=n.memoizedProps,m=n.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":d.autoFocus&&m.focus();break e;case"img":d.src?m.src=d.src:d.srcSet&&(m.srcset=d.srcSet)}}catch(b){fa(n,n.return,b)}}function im(n,i,d){try{var m=n.stateNode;U4(m,n.type,d,i),m[Q]=i}catch(b){fa(n,n.return,b)}}function ly(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Gi(n.type)||n.tag===4}function om(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||ly(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Gi(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function lm(n,i,d){var m=n.tag;if(m===5||m===6)n=n.stateNode,i?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(n,i):(i=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,i.appendChild(n),d=d._reactRootContainer,d!=null||i.onclick!==null||(i.onclick=Vr));else if(m!==4&&(m===27&&Gi(n.type)&&(d=n.stateNode,i=null),n=n.child,n!==null))for(lm(n,i,d),n=n.sibling;n!==null;)lm(n,i,d),n=n.sibling}function d0(n,i,d){var m=n.tag;if(m===5||m===6)n=n.stateNode,i?d.insertBefore(n,i):d.appendChild(n);else if(m!==4&&(m===27&&Gi(n.type)&&(d=n.stateNode),n=n.child,n!==null))for(d0(n,i,d),n=n.sibling;n!==null;)d0(n,i,d),n=n.sibling}function cy(n){var i=n.stateNode,d=n.memoizedProps;try{for(var m=n.type,b=i.attributes;b.length;)i.removeAttributeNode(b[0]);vr(i,m,d),i[X]=n,i[Q]=d}catch(w){fa(n,n.return,w)}}var Ks=!1,tr=!1,cm=!1,dy=typeof WeakSet=="function"?WeakSet:Set,ur=null;function v4(n,i){if(n=n.containerInfo,Am=O0,n=vo(n),_s(n)){if("selectionStart"in n)var d={start:n.selectionStart,end:n.selectionEnd};else e:{d=(d=n.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var b=m.anchorOffset,w=m.focusNode;m=m.focusOffset;try{d.nodeType,w.nodeType}catch(Tt){d=null;break e}var M=0,Z=-1,me=-1,Ce=0,Ue=0,Ze=n,Oe=null;t:for(;;){for(var Re;Ze!==d||b!==0&&Ze.nodeType!==3||(Z=M+b),Ze!==w||m!==0&&Ze.nodeType!==3||(me=M+m),Ze.nodeType===3&&(M+=Ze.nodeValue.length),(Re=Ze.firstChild)!==null;)Oe=Ze,Ze=Re;for(;;){if(Ze===n)break t;if(Oe===d&&++Ce===b&&(Z=M),Oe===w&&++Ue===m&&(me=M),(Re=Ze.nextSibling)!==null)break;Ze=Oe,Oe=Ze.parentNode}Ze=Re}d=Z===-1||me===-1?null:{start:Z,end:me}}else d=null}d=d||{start:0,end:0}}else d=null;for(Om={focusedElem:n,selectionRange:d},O0=!1,ur=i;ur!==null;)if(i=ur,n=i.child,(i.subtreeFlags&1028)!==0&&n!==null)n.return=i,ur=n;else for(;ur!==null;){switch(i=ur,w=i.alternate,n=i.flags,i.tag){case 0:if((n&4)!==0&&(n=i.updateQueue,n=n!==null?n.events:null,n!==null))for(d=0;d<n.length;d++)b=n[d],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&w!==null){n=void 0,d=i,b=w.memoizedProps,w=w.memoizedState,m=d.stateNode;try{var gt=Po(d.type,b);n=m.getSnapshotBeforeUpdate(gt,w),m.__reactInternalSnapshotBeforeUpdate=n}catch(Tt){fa(d,d.return,Tt)}}break;case 3:if((n&1024)!==0){if(n=i.stateNode.containerInfo,d=n.nodeType,d===9)Dm(n);else if(d===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Dm(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=i.sibling,n!==null){n.return=i.return,ur=n;break}ur=i.return}}function uy(n,i,d){var m=d.flags;switch(d.tag){case 0:case 11:case 15:Qs(n,d),m&4&&ud(5,d);break;case 1:if(Qs(n,d),m&4)if(n=d.stateNode,i===null)try{n.componentDidMount()}catch(M){fa(d,d.return,M)}else{var b=Po(d.type,i.memoizedProps);i=i.memoizedState;try{n.componentDidUpdate(b,i,n.__reactInternalSnapshotBeforeUpdate)}catch(M){fa(d,d.return,M)}}m&64&&sy(d),m&512&&fd(d,d.return);break;case 3:if(Qs(n,d),m&64&&(n=d.updateQueue,n!==null)){if(i=null,d.child!==null)switch(d.child.tag){case 27:case 5:i=d.child.stateNode;break;case 1:i=d.child.stateNode}try{Yp(n,i)}catch(M){fa(d,d.return,M)}}break;case 27:i===null&&m&4&&cy(d);case 26:case 5:Qs(n,d),i===null&&m&4&&oy(d),m&512&&fd(d,d.return);break;case 12:Qs(n,d);break;case 31:Qs(n,d),m&4&&my(n,d);break;case 13:Qs(n,d),m&4&&gy(n,d),m&64&&(n=d.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(d=C4.bind(null,d),Y4(n,d))));break;case 22:if(m=d.memoizedState!==null||Ks,!m){i=i!==null&&i.memoizedState!==null||tr,b=Ks;var w=tr;Ks=m,(tr=i)&&!w?ei(n,d,(d.subtreeFlags&8772)!==0):Qs(n,d),Ks=b,tr=w}break;case 30:break;default:Qs(n,d)}}function fy(n){var i=n.alternate;i!==null&&(n.alternate=null,fy(i)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(i=n.stateNode,i!==null&&Ye(i)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Pa=null,Xr=!1;function Js(n,i,d){for(d=d.child;d!==null;)hy(n,i,d),d=d.sibling}function hy(n,i,d){if(xe&&typeof xe.onCommitFiberUnmount=="function")try{xe.onCommitFiberUnmount(da,d)}catch(w){}switch(d.tag){case 26:tr||Cs(d,i),Js(n,i,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:tr||Cs(d,i);var m=Pa,b=Xr;Gi(d.type)&&(Pa=d.stateNode,Xr=!1),Js(n,i,d),_d(d.stateNode),Pa=m,Xr=b;break;case 5:tr||Cs(d,i);case 6:if(m=Pa,b=Xr,Pa=null,Js(n,i,d),Pa=m,Xr=b,Pa!==null)if(Xr)try{(Pa.nodeType===9?Pa.body:Pa.nodeName==="HTML"?Pa.ownerDocument.body:Pa).removeChild(d.stateNode)}catch(w){fa(d,i,w)}else try{Pa.removeChild(d.stateNode)}catch(w){fa(d,i,w)}break;case 18:Pa!==null&&(Xr?(n=Pa,s1(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,d.stateNode),ql(n)):s1(Pa,d.stateNode));break;case 4:m=Pa,b=Xr,Pa=d.stateNode.containerInfo,Xr=!0,Js(n,i,d),Pa=m,Xr=b;break;case 0:case 11:case 14:case 15:Bi(2,d,i),tr||Bi(4,d,i),Js(n,i,d);break;case 1:tr||(Cs(d,i),m=d.stateNode,typeof m.componentWillUnmount=="function"&&iy(d,i,m)),Js(n,i,d);break;case 21:Js(n,i,d);break;case 22:tr=(m=tr)||d.memoizedState!==null,Js(n,i,d),tr=m;break;default:Js(n,i,d)}}function my(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{ql(n)}catch(d){fa(i,i.return,d)}}}function gy(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{ql(n)}catch(d){fa(i,i.return,d)}}function _4(n){switch(n.tag){case 31:case 13:case 19:var i=n.stateNode;return i===null&&(i=n.stateNode=new dy),i;case 22:return n=n.stateNode,i=n._retryCache,i===null&&(i=n._retryCache=new dy),i;default:throw Error(s(435,n.tag))}}function u0(n,i){var d=_4(n);i.forEach(function(m){if(!d.has(m)){d.add(m);var b=A4.bind(null,n,m);m.then(b,b)}})}function Kr(n,i){var d=i.deletions;if(d!==null)for(var m=0;m<d.length;m++){var b=d[m],w=n,M=i,Z=M;e:for(;Z!==null;){switch(Z.tag){case 27:if(Gi(Z.type)){Pa=Z.stateNode,Xr=!1;break e}break;case 5:Pa=Z.stateNode,Xr=!1;break e;case 3:case 4:Pa=Z.stateNode.containerInfo,Xr=!0;break e}Z=Z.return}if(Pa===null)throw Error(s(160));hy(w,M,b),Pa=null,Xr=!1,w=b.alternate,w!==null&&(w.return=null),b.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)py(i,n),i=i.sibling}var ns=null;function py(n,i){var d=n.alternate,m=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Kr(i,n),Jr(n),m&4&&(Bi(3,n,n.return),ud(3,n),Bi(5,n,n.return));break;case 1:Kr(i,n),Jr(n),m&512&&(tr||d===null||Cs(d,d.return)),m&64&&Ks&&(n=n.updateQueue,n!==null&&(m=n.callbacks,m!==null&&(d=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=d===null?m:d.concat(m))));break;case 26:var b=ns;if(Kr(i,n),Jr(n),m&512&&(tr||d===null||Cs(d,d.return)),m&4){var w=d!==null?d.memoizedState:null;if(m=n.memoizedState,d===null)if(m===null)if(n.stateNode===null){e:{m=n.type,d=n.memoizedProps,b=b.ownerDocument||b;t:switch(m){case"title":w=b.getElementsByTagName("title")[0],(!w||w[Se]||w[X]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=b.createElement(m),b.head.insertBefore(w,b.querySelector("head > title"))),vr(w,m,d),w[X]=n,mt(w),m=w;break e;case"link":var M=p1("link","href",b).get(m+(d.href||""));if(M){for(var Z=0;Z<M.length;Z++)if(w=M[Z],w.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&w.getAttribute("rel")===(d.rel==null?null:d.rel)&&w.getAttribute("title")===(d.title==null?null:d.title)&&w.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){M.splice(Z,1);break t}}w=b.createElement(m),vr(w,m,d),b.head.appendChild(w);break;case"meta":if(M=p1("meta","content",b).get(m+(d.content||""))){for(Z=0;Z<M.length;Z++)if(w=M[Z],w.getAttribute("content")===(d.content==null?null:""+d.content)&&w.getAttribute("name")===(d.name==null?null:d.name)&&w.getAttribute("property")===(d.property==null?null:d.property)&&w.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&w.getAttribute("charset")===(d.charSet==null?null:d.charSet)){M.splice(Z,1);break t}}w=b.createElement(m),vr(w,m,d),b.head.appendChild(w);break;default:throw Error(s(468,m))}w[X]=n,mt(w),m=w}n.stateNode=m}else x1(b,n.type,n.stateNode);else n.stateNode=g1(b,m,n.memoizedProps);else w!==m?(w===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):w.count--,m===null?x1(b,n.type,n.stateNode):g1(b,m,n.memoizedProps)):m===null&&n.stateNode!==null&&im(n,n.memoizedProps,d.memoizedProps)}break;case 27:Kr(i,n),Jr(n),m&512&&(tr||d===null||Cs(d,d.return)),d!==null&&m&4&&im(n,n.memoizedProps,d.memoizedProps);break;case 5:if(Kr(i,n),Jr(n),m&512&&(tr||d===null||Cs(d,d.return)),n.flags&32){b=n.stateNode;try{An(b,"")}catch(gt){fa(n,n.return,gt)}}m&4&&n.stateNode!=null&&(b=n.memoizedProps,im(n,b,d!==null?d.memoizedProps:b)),m&1024&&(cm=!0);break;case 6:if(Kr(i,n),Jr(n),m&4){if(n.stateNode===null)throw Error(s(162));m=n.memoizedProps,d=n.stateNode;try{d.nodeValue=m}catch(gt){fa(n,n.return,gt)}}break;case 3:if(T0=null,b=ns,ns=S0(i.containerInfo),Kr(i,n),ns=b,Jr(n),m&4&&d!==null&&d.memoizedState.isDehydrated)try{ql(i.containerInfo)}catch(gt){fa(n,n.return,gt)}cm&&(cm=!1,xy(n));break;case 4:m=ns,ns=S0(n.stateNode.containerInfo),Kr(i,n),Jr(n),ns=m;break;case 12:Kr(i,n),Jr(n);break;case 31:Kr(i,n),Jr(n),m&4&&(m=n.updateQueue,m!==null&&(n.updateQueue=null,u0(n,m)));break;case 13:Kr(i,n),Jr(n),n.child.flags&8192&&n.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(h0=ft()),m&4&&(m=n.updateQueue,m!==null&&(n.updateQueue=null,u0(n,m)));break;case 22:b=n.memoizedState!==null;var me=d!==null&&d.memoizedState!==null,Ce=Ks,Ue=tr;if(Ks=Ce||b,tr=Ue||me,Kr(i,n),tr=Ue,Ks=Ce,Jr(n),m&8192)e:for(i=n.stateNode,i._visibility=b?i._visibility&-2:i._visibility|1,b&&(d===null||me||Ks||tr||Fo(n)),d=null,i=n;;){if(i.tag===5||i.tag===26){if(d===null){me=d=i;try{if(w=me.stateNode,b)M=w.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{Z=me.stateNode;var Ze=me.memoizedProps.style,Oe=Ze!=null&&Ze.hasOwnProperty("display")?Ze.display:null;Z.style.display=Oe==null||typeof Oe=="boolean"?"":(""+Oe).trim()}}catch(gt){fa(me,me.return,gt)}}}else if(i.tag===6){if(d===null){me=i;try{me.stateNode.nodeValue=b?"":me.memoizedProps}catch(gt){fa(me,me.return,gt)}}}else if(i.tag===18){if(d===null){me=i;try{var Re=me.stateNode;b?i1(Re,!0):i1(me.stateNode,!1)}catch(gt){fa(me,me.return,gt)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===n)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break e;for(;i.sibling===null;){if(i.return===null||i.return===n)break e;d===i&&(d=null),i=i.return}d===i&&(d=null),i.sibling.return=i.return,i=i.sibling}m&4&&(m=n.updateQueue,m!==null&&(d=m.retryQueue,d!==null&&(m.retryQueue=null,u0(n,d))));break;case 19:Kr(i,n),Jr(n),m&4&&(m=n.updateQueue,m!==null&&(n.updateQueue=null,u0(n,m)));break;case 30:break;case 21:break;default:Kr(i,n),Jr(n)}}function Jr(n){var i=n.flags;if(i&2){try{for(var d,m=n.return;m!==null;){if(ly(m)){d=m;break}m=m.return}if(d==null)throw Error(s(160));switch(d.tag){case 27:var b=d.stateNode,w=om(n);d0(n,w,b);break;case 5:var M=d.stateNode;d.flags&32&&(An(M,""),d.flags&=-33);var Z=om(n);d0(n,Z,M);break;case 3:case 4:var me=d.stateNode.containerInfo,Ce=om(n);lm(n,Ce,me);break;default:throw Error(s(161))}}catch(Ue){fa(n,n.return,Ue)}n.flags&=-3}i&4096&&(n.flags&=-4097)}function xy(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var i=n;xy(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),n=n.sibling}}function Qs(n,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)uy(n,i.alternate,i),i=i.sibling}function Fo(n){for(n=n.child;n!==null;){var i=n;switch(i.tag){case 0:case 11:case 14:case 15:Bi(4,i,i.return),Fo(i);break;case 1:Cs(i,i.return);var d=i.stateNode;typeof d.componentWillUnmount=="function"&&iy(i,i.return,d),Fo(i);break;case 27:_d(i.stateNode);case 26:case 5:Cs(i,i.return),Fo(i);break;case 22:i.memoizedState===null&&Fo(i);break;case 30:Fo(i);break;default:Fo(i)}n=n.sibling}}function ei(n,i,d){for(d=d&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var m=i.alternate,b=n,w=i,M=w.flags;switch(w.tag){case 0:case 11:case 15:ei(b,w,d),ud(4,w);break;case 1:if(ei(b,w,d),m=w,b=m.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(Ce){fa(m,m.return,Ce)}if(m=w,b=m.updateQueue,b!==null){var Z=m.stateNode;try{var me=b.shared.hiddenCallbacks;if(me!==null)for(b.shared.hiddenCallbacks=null,b=0;b<me.length;b++)qp(me[b],Z)}catch(Ce){fa(m,m.return,Ce)}}d&&M&64&&sy(w),fd(w,w.return);break;case 27:cy(w);case 26:case 5:ei(b,w,d),d&&m===null&&M&4&&oy(w),fd(w,w.return);break;case 12:ei(b,w,d);break;case 31:ei(b,w,d),d&&M&4&&my(b,w);break;case 13:ei(b,w,d),d&&M&4&&gy(b,w);break;case 22:w.memoizedState===null&&ei(b,w,d),fd(w,w.return);break;case 30:break;default:ei(b,w,d)}i=i.sibling}}function dm(n,i){var d=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(d=n.memoizedState.cachePool.pool),n=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(n=i.memoizedState.cachePool.pool),n!==d&&(n!=null&&n.refCount++,d!=null&&Jc(d))}function um(n,i){n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Jc(n))}function ss(n,i,d,m){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)yy(n,i,d,m),i=i.sibling}function yy(n,i,d,m){var b=i.flags;switch(i.tag){case 0:case 11:case 15:ss(n,i,d,m),b&2048&&ud(9,i);break;case 1:ss(n,i,d,m);break;case 3:ss(n,i,d,m),b&2048&&(n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Jc(n)));break;case 12:if(b&2048){ss(n,i,d,m),n=i.stateNode;try{var w=i.memoizedProps,M=w.id,Z=w.onPostCommit;typeof Z=="function"&&Z(M,i.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(me){fa(i,i.return,me)}}else ss(n,i,d,m);break;case 31:ss(n,i,d,m);break;case 13:ss(n,i,d,m);break;case 23:break;case 22:w=i.stateNode,M=i.alternate,i.memoizedState!==null?w._visibility&2?ss(n,i,d,m):hd(n,i):w._visibility&2?ss(n,i,d,m):(w._visibility|=2,Fl(n,i,d,m,(i.subtreeFlags&10256)!==0||!1)),b&2048&&dm(M,i);break;case 24:ss(n,i,d,m),b&2048&&um(i.alternate,i);break;default:ss(n,i,d,m)}}function Fl(n,i,d,m,b){for(b=b&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var w=n,M=i,Z=d,me=m,Ce=M.flags;switch(M.tag){case 0:case 11:case 15:Fl(w,M,Z,me,b),ud(8,M);break;case 23:break;case 22:var Ue=M.stateNode;M.memoizedState!==null?Ue._visibility&2?Fl(w,M,Z,me,b):hd(w,M):(Ue._visibility|=2,Fl(w,M,Z,me,b)),b&&Ce&2048&&dm(M.alternate,M);break;case 24:Fl(w,M,Z,me,b),b&&Ce&2048&&um(M.alternate,M);break;default:Fl(w,M,Z,me,b)}i=i.sibling}}function hd(n,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var d=n,m=i,b=m.flags;switch(m.tag){case 22:hd(d,m),b&2048&&dm(m.alternate,m);break;case 24:hd(d,m),b&2048&&um(m.alternate,m);break;default:hd(d,m)}i=i.sibling}}var md=8192;function Il(n,i,d){if(n.subtreeFlags&md)for(n=n.child;n!==null;)by(n,i,d),n=n.sibling}function by(n,i,d){switch(n.tag){case 26:Il(n,i,d),n.flags&md&&n.memoizedState!==null&&ok(d,ns,n.memoizedState,n.memoizedProps);break;case 5:Il(n,i,d);break;case 3:case 4:var m=ns;ns=S0(n.stateNode.containerInfo),Il(n,i,d),ns=m;break;case 22:n.memoizedState===null&&(m=n.alternate,m!==null&&m.memoizedState!==null?(m=md,md=16777216,Il(n,i,d),md=m):Il(n,i,d));break;default:Il(n,i,d)}}function vy(n){var i=n.alternate;if(i!==null&&(n=i.child,n!==null)){i.child=null;do i=n.sibling,n.sibling=null,n=i;while(n!==null)}}function gd(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var d=0;d<i.length;d++){var m=i[d];ur=m,wy(m,n)}vy(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)_y(n),n=n.sibling}function _y(n){switch(n.tag){case 0:case 11:case 15:gd(n),n.flags&2048&&Bi(9,n,n.return);break;case 3:gd(n);break;case 12:gd(n);break;case 22:var i=n.stateNode;n.memoizedState!==null&&i._visibility&2&&(n.return===null||n.return.tag!==13)?(i._visibility&=-3,f0(n)):gd(n);break;default:gd(n)}}function f0(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var d=0;d<i.length;d++){var m=i[d];ur=m,wy(m,n)}vy(n)}for(n=n.child;n!==null;){switch(i=n,i.tag){case 0:case 11:case 15:Bi(8,i,i.return),f0(i);break;case 22:d=i.stateNode,d._visibility&2&&(d._visibility&=-3,f0(i));break;default:f0(i)}n=n.sibling}}function wy(n,i){for(;ur!==null;){var d=ur;switch(d.tag){case 0:case 11:case 15:Bi(8,d,i);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var m=d.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Jc(d.memoizedState.cache)}if(m=d.child,m!==null)m.return=d,ur=m;else e:for(d=n;ur!==null;){m=ur;var b=m.sibling,w=m.return;if(fy(m),m===d){ur=null;break e}if(b!==null){b.return=w,ur=b;break e}ur=w}}}var w4={getCacheForType:function(n){var i=yr(Ja),d=i.data.get(n);return d===void 0&&(d=n(),i.data.set(n,d)),d},cacheSignal:function(){return yr(Ja).controller.signal}},k4=typeof WeakMap=="function"?WeakMap:Map,oa=0,Ta=null,Yt=null,Jt=0,ua=0,bn=null,zi=!1,Bl=!1,fm=!1,ti=0,Wa=0,Ui=0,Io=0,hm=0,vn=0,zl=0,pd=null,Qr=null,mm=!1,h0=0,ky=0,m0=1/0,g0=null,Hi=null,or=0,$i=null,Ul=null,ai=0,gm=0,pm=null,Ny=null,xd=0,xm=null;function _n(){return(oa&2)!==0&&Jt!==0?Jt&-Jt:te.T!==null?km():I()}function Sy(){if(vn===0)if((Jt&536870912)===0||qt){var n=Zt;Zt<<=1,(Zt&3932160)===0&&(Zt=262144),vn=n}else vn=536870912;return n=xn.current,n!==null&&(n.flags|=32),vn}function en(n,i,d){(n===Ta&&(ua===2||ua===9)||n.cancelPendingCommit!==null)&&(Hl(n,0),Wi(n,Jt,vn,!1)),Rr(n,d),((oa&2)===0||n!==Ta)&&(n===Ta&&((oa&2)===0&&(Io|=d),Wa===4&&Wi(n,Jt,vn,!1)),As(n))}function jy(n,i,d){if((oa&6)!==0)throw Error(s(327));var m=!d&&(i&127)===0&&(i&n.expiredLanes)===0||cn(n,i),b=m?j4(n,i):bm(n,i,!0),w=m;do{if(b===0){Bl&&!m&&Wi(n,i,0,!1);break}else{if(d=n.current.alternate,w&&!N4(d)){b=bm(n,i,!1),w=!1;continue}if(b===2){if(w=i,n.errorRecoveryDisabledLanes&w)var M=0;else M=n.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){i=M;e:{var Z=n;b=pd;var me=Z.current.memoizedState.isDehydrated;if(me&&(Hl(Z,M).flags|=256),M=bm(Z,M,!1),M!==2){if(fm&&!me){Z.errorRecoveryDisabledLanes|=w,Io|=w,b=4;break e}w=Qr,Qr=b,w!==null&&(Qr===null?Qr=w:Qr.push.apply(Qr,w))}b=M}if(w=!1,b!==2)continue}}if(b===1){Hl(n,0),Wi(n,i,0,!0);break}e:{switch(m=n,w=b,w){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:Wi(m,i,vn,!zi);break e;case 2:Qr=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(b=h0+300-ft(),10<b)){if(Wi(m,i,vn,!zi),Dr(m,0,!0)!==0)break e;ai=i,m.timeoutHandle=r1(Ty.bind(null,m,d,Qr,g0,mm,i,vn,Io,zl,zi,w,"Throttled",-0,0),b);break e}Ty(m,d,Qr,g0,mm,i,vn,Io,zl,zi,w,null,-0,0)}}break}while(!0);As(n)}function Ty(n,i,d,m,b,w,M,Z,me,Ce,Ue,Ze,Oe,Re){if(n.timeoutHandle=-1,Ze=i.subtreeFlags,Ze&8192||(Ze&16785408)===16785408){Ze={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Vr},by(i,w,Ze);var gt=(w&62914560)===w?h0-ft():(w&4194048)===w?ky-ft():0;if(gt=lk(Ze,gt),gt!==null){ai=w,n.cancelPendingCommit=gt(Ry.bind(null,n,i,w,d,m,b,M,Z,me,Ue,Ze,null,Oe,Re)),Wi(n,w,M,!Ce);return}}Ry(n,i,w,d,m,b,M,Z,me)}function N4(n){for(var i=n;;){var d=i.tag;if((d===0||d===11||d===15)&&i.flags&16384&&(d=i.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var m=0;m<d.length;m++){var b=d[m],w=b.getSnapshot;b=b.value;try{if(!cr(w(),b))return!1}catch(M){return!1}}if(d=i.child,i.subtreeFlags&16384&&d!==null)d.return=i,i=d;else{if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Wi(n,i,d,m){i&=~hm,i&=~Io,n.suspendedLanes|=i,n.pingedLanes&=~i,m&&(n.warmLanes|=i),m=n.expirationTimes;for(var b=i;0<b;){var w=31-$e(b),M=1<<w;m[w]=-1,b&=~M}d!==0&&dn(n,d,i)}function p0(){return(oa&6)===0?(yd(0),!1):!0}function ym(){if(Yt!==null){if(ua===0)var n=Yt.return;else n=Yt,rs=Es=null,Dh(n),Ll=null,ed=0,n=Yt;for(;n!==null;)ny(n.alternate,n),n=n.return;Yt=null}}function Hl(n,i){var d=n.timeoutHandle;d!==-1&&(n.timeoutHandle=-1,W4(d)),d=n.cancelPendingCommit,d!==null&&(n.cancelPendingCommit=null,d()),ai=0,ym(),Ta=n,Yt=d=Fn(n.current,null),Jt=i,ua=0,bn=null,zi=!1,Bl=cn(n,i),fm=!1,zl=vn=hm=Io=Ui=Wa=0,Qr=pd=null,mm=!1,(i&8)!==0&&(i|=i&32);var m=n.entangledLanes;if(m!==0)for(n=n.entanglements,m&=i;0<m;){var b=31-$e(m),w=1<<b;i|=n[b],m&=~w}return ti=i,So(),d}function Ey(n,i){Bt=null,te.H=ld,i===Ol||i===Vu?(i=Wp(),ua=3):i===wh?(i=Wp(),ua=4):ua=i===Xh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,bn=i,Yt===null&&(Wa=1,s0(n,h(i,n.current)))}function Cy(){var n=xn.current;return n===null?!0:(Jt&4194048)===Jt?In===null:(Jt&62914560)===Jt||(Jt&536870912)!==0?n===In:!1}function Ay(){var n=te.H;return te.H=ld,n===null?ld:n}function Oy(){var n=te.A;return te.A=w4,n}function x0(){Wa=4,zi||(Jt&4194048)!==Jt&&xn.current!==null||(Bl=!0),(Ui&134217727)===0&&(Io&134217727)===0||Ta===null||Wi(Ta,Jt,vn,!1)}function bm(n,i,d){var m=oa;oa|=2;var b=Ay(),w=Oy();(Ta!==n||Jt!==i)&&(g0=null,Hl(n,i)),i=!1;var M=Wa;e:do try{if(ua!==0&&Yt!==null){var Z=Yt,me=bn;switch(ua){case 8:ym(),M=6;break e;case 3:case 2:case 9:case 6:xn.current===null&&(i=!0);var Ce=ua;if(ua=0,bn=null,$l(n,Z,me,Ce),d&&Bl){M=0;break e}break;default:Ce=ua,ua=0,bn=null,$l(n,Z,me,Ce)}}S4(),M=Wa;break}catch(Ue){Ey(n,Ue)}while(!0);return i&&n.shellSuspendCounter++,rs=Es=null,oa=m,te.H=b,te.A=w,Yt===null&&(Ta=null,Jt=0,So()),M}function S4(){for(;Yt!==null;)Ly(Yt)}function j4(n,i){var d=oa;oa|=2;var m=Ay(),b=Oy();Ta!==n||Jt!==i?(g0=null,m0=ft()+500,Hl(n,i)):Bl=cn(n,i);e:do try{if(ua!==0&&Yt!==null){i=Yt;var w=bn;t:switch(ua){case 1:ua=0,bn=null,$l(n,i,w,1);break;case 2:case 9:if(Hp(w)){ua=0,bn=null,My(i);break}i=function(){ua!==2&&ua!==9||Ta!==n||(ua=7),As(n)},w.then(i,i);break e;case 3:ua=7;break e;case 4:ua=5;break e;case 7:Hp(w)?(ua=0,bn=null,My(i)):(ua=0,bn=null,$l(n,i,w,7));break;case 5:var M=null;switch(Yt.tag){case 26:M=Yt.memoizedState;case 5:case 27:var Z=Yt;if(M?y1(M):Z.stateNode.complete){ua=0,bn=null;var me=Z.sibling;if(me!==null)Yt=me;else{var Ce=Z.return;Ce!==null?(Yt=Ce,y0(Ce)):Yt=null}break t}}ua=0,bn=null,$l(n,i,w,5);break;case 6:ua=0,bn=null,$l(n,i,w,6);break;case 8:ym(),Wa=6;break e;default:throw Error(s(462))}}T4();break}catch(Ue){Ey(n,Ue)}while(!0);return rs=Es=null,te.H=m,te.A=b,oa=d,Yt!==null?0:(Ta=null,Jt=0,So(),Wa)}function T4(){for(;Yt!==null&&!nt();)Ly(Yt)}function Ly(n){var i=ay(n.alternate,n,ti);n.memoizedProps=n.pendingProps,i===null?y0(n):Yt=i}function My(n){var i=n,d=i.alternate;switch(i.tag){case 15:case 0:i=Xx(d,i,i.pendingProps,i.type,void 0,Jt);break;case 11:i=Xx(d,i,i.pendingProps,i.type.render,i.ref,Jt);break;case 5:Dh(i);default:ny(d,i),i=Yt=Zc(i,ti),i=ay(d,i,ti)}n.memoizedProps=n.pendingProps,i===null?y0(n):Yt=i}function $l(n,i,d,m){rs=Es=null,Dh(i),Ll=null,ed=0;var b=i.return;try{if(g4(n,b,i,d,Jt)){Wa=1,s0(n,h(d,n.current)),Yt=null;return}}catch(w){if(b!==null)throw Yt=b,w;Wa=1,s0(n,h(d,n.current)),Yt=null;return}i.flags&32768?(qt||m===1?n=!0:Bl||(Jt&536870912)!==0?n=!1:(zi=n=!0,(m===2||m===9||m===3||m===6)&&(m=xn.current,m!==null&&m.tag===13&&(m.flags|=16384))),Dy(i,n)):y0(i)}function y0(n){var i=n;do{if((i.flags&32768)!==0){Dy(i,zi);return}n=i.return;var d=y4(i.alternate,i,ti);if(d!==null){Yt=d;return}if(i=i.sibling,i!==null){Yt=i;return}Yt=i=n}while(i!==null);Wa===0&&(Wa=5)}function Dy(n,i){do{var d=b4(n.alternate,n);if(d!==null){d.flags&=32767,Yt=d;return}if(d=n.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!i&&(n=n.sibling,n!==null)){Yt=n;return}Yt=n=d}while(n!==null);Wa=6,Yt=null}function Ry(n,i,d,m,b,w,M,Z,me){n.cancelPendingCommit=null;do b0();while(or!==0);if((oa&6)!==0)throw Error(s(327));if(i!==null){if(i===n.current)throw Error(s(177));if(w=i.lanes|i.childLanes,w|=Nl,qn(n,d,w,M,Z,me),n===Ta&&(Yt=Ta=null,Jt=0),Ul=i,$i=n,ai=d,gm=w,pm=b,Ny=m,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,O4(Pt,function(){return zy(),null})):(n.callbackNode=null,n.callbackPriority=0),m=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||m){m=te.T,te.T=null,b=V.p,V.p=2,M=oa,oa|=4;try{v4(n,i,d)}finally{oa=M,V.p=b,te.T=m}}or=1,Py(),Fy(),Iy()}}function Py(){if(or===1){or=0;var n=$i,i=Ul,d=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||d){d=te.T,te.T=null;var m=V.p;V.p=2;var b=oa;oa|=4;try{py(i,n);var w=Om,M=vo(n.containerInfo),Z=w.focusedElem,me=w.selectionRange;if(M!==Z&&Z&&Z.ownerDocument&&vl(Z.ownerDocument.documentElement,Z)){if(me!==null&&_s(Z)){var Ce=me.start,Ue=me.end;if(Ue===void 0&&(Ue=Ce),"selectionStart"in Z)Z.selectionStart=Ce,Z.selectionEnd=Math.min(Ue,Z.value.length);else{var Ze=Z.ownerDocument||document,Oe=Ze&&Ze.defaultView||window;if(Oe.getSelection){var Re=Oe.getSelection(),gt=Z.textContent.length,Tt=Math.min(me.start,gt),ka=me.end===void 0?Tt:Math.min(me.end,gt);!Re.extend&&Tt>ka&&(M=ka,ka=Tt,Tt=M);var we=bo(Z,Tt),ve=bo(Z,ka);if(we&&ve&&(Re.rangeCount!==1||Re.anchorNode!==we.node||Re.anchorOffset!==we.offset||Re.focusNode!==ve.node||Re.focusOffset!==ve.offset)){var Te=Ze.createRange();Te.setStart(we.node,we.offset),Re.removeAllRanges(),Tt>ka?(Re.addRange(Te),Re.extend(ve.node,ve.offset)):(Te.setEnd(ve.node,ve.offset),Re.addRange(Te))}}}}for(Ze=[],Re=Z;Re=Re.parentNode;)Re.nodeType===1&&Ze.push({element:Re,left:Re.scrollLeft,top:Re.scrollTop});for(typeof Z.focus=="function"&&Z.focus(),Z=0;Z<Ze.length;Z++){var Ve=Ze[Z];Ve.element.scrollLeft=Ve.left,Ve.element.scrollTop=Ve.top}}O0=!!Am,Om=Am=null}finally{oa=b,V.p=m,te.T=d}}n.current=i,or=2}}function Fy(){if(or===2){or=0;var n=$i,i=Ul,d=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||d){d=te.T,te.T=null;var m=V.p;V.p=2;var b=oa;oa|=4;try{uy(n,i.alternate,i)}finally{oa=b,V.p=m,te.T=d}}or=3}}function Iy(){if(or===4||or===3){or=0,ut();var n=$i,i=Ul,d=ai,m=Ny;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?or=5:(or=0,Ul=$i=null,By(n,n.pendingLanes));var b=n.pendingLanes;if(b===0&&(Hi=null),be(d),i=i.stateNode,xe&&typeof xe.onCommitFiberRoot=="function")try{xe.onCommitFiberRoot(da,i,void 0,(i.current.flags&128)===128)}catch(me){}if(m!==null){i=te.T,b=V.p,V.p=2,te.T=null;try{for(var w=n.onRecoverableError,M=0;M<m.length;M++){var Z=m[M];w(Z.value,{componentStack:Z.stack})}}finally{te.T=i,V.p=b}}(ai&3)!==0&&b0(),As(n),b=n.pendingLanes,(d&261930)!==0&&(b&42)!==0?n===xm?xd++:(xd=0,xm=n):xd=0,yd(0)}}function By(n,i){(n.pooledCacheLanes&=i)===0&&(i=n.pooledCache,i!=null&&(n.pooledCache=null,Jc(i)))}function b0(){return Py(),Fy(),Iy(),zy()}function zy(){if(or!==5)return!1;var n=$i,i=gm;gm=0;var d=be(ai),m=te.T,b=V.p;try{V.p=32>d?32:d,te.T=null,d=pm,pm=null;var w=$i,M=ai;if(or=0,Ul=$i=null,ai=0,(oa&6)!==0)throw Error(s(331));var Z=oa;if(oa|=4,_y(w.current),yy(w,w.current,M,d),oa=Z,yd(0,!1),xe&&typeof xe.onPostCommitFiberRoot=="function")try{xe.onPostCommitFiberRoot(da,w)}catch(me){}return!0}finally{V.p=b,te.T=m,By(n,i)}}function Uy(n,i,d){i=h(d,i),i=Yh(n.stateNode,i,2),n=Pi(n,i,2),n!==null&&(Rr(n,2),As(n))}function fa(n,i,d){if(n.tag===3)Uy(n,n,d);else for(;i!==null;){if(i.tag===3){Uy(i,n,d);break}else if(i.tag===1){var m=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Hi===null||!Hi.has(m))){n=h(d,n),d=Hx(2),m=Pi(i,d,2),m!==null&&($x(d,m,i,n),Rr(m,2),As(m));break}}i=i.return}}function vm(n,i,d){var m=n.pingCache;if(m===null){m=n.pingCache=new k4;var b=new Set;m.set(i,b)}else b=m.get(i),b===void 0&&(b=new Set,m.set(i,b));b.has(d)||(fm=!0,b.add(d),n=E4.bind(null,n,i,d),i.then(n,n))}function E4(n,i,d){var m=n.pingCache;m!==null&&m.delete(i),n.pingedLanes|=n.suspendedLanes&d,n.warmLanes&=~d,Ta===n&&(Jt&d)===d&&(Wa===4||Wa===3&&(Jt&62914560)===Jt&&300>ft()-h0?(oa&2)===0&&Hl(n,0):hm|=d,zl===Jt&&(zl=0)),As(n)}function Hy(n,i){i===0&&(i=ps()),n=Pn(n,i),n!==null&&(Rr(n,i),As(n))}function C4(n){var i=n.memoizedState,d=0;i!==null&&(d=i.retryLane),Hy(n,d)}function A4(n,i){var d=0;switch(n.tag){case 31:case 13:var m=n.stateNode,b=n.memoizedState;b!==null&&(d=b.retryLane);break;case 19:m=n.stateNode;break;case 22:m=n.stateNode._retryCache;break;default:throw Error(s(314))}m!==null&&m.delete(i),Hy(n,d)}function O4(n,i){return ze(n,i)}var v0=null,Wl=null,_m=!1,_0=!1,wm=!1,Vi=0;function As(n){n!==Wl&&n.next===null&&(Wl===null?v0=Wl=n:Wl=Wl.next=n),_0=!0,_m||(_m=!0,M4())}function yd(n,i){if(!wm&&_0){wm=!0;do for(var d=!1,m=v0;m!==null;){if(n!==0){var b=m.pendingLanes;if(b===0)var w=0;else{var M=m.suspendedLanes,Z=m.pingedLanes;w=(1<<31-$e(42|n)+1)-1,w&=b&~(M&~Z),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(d=!0,Gy(m,w))}else w=Jt,w=Dr(m,m===Ta?w:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(w&3)===0||cn(m,w)||(d=!0,Gy(m,w));m=m.next}while(d);wm=!1}}function L4(){$y()}function $y(){_0=_m=!1;var n=0;Vi!==0&&$4()&&(n=Vi);for(var i=ft(),d=null,m=v0;m!==null;){var b=m.next,w=Wy(m,i);w===0?(m.next=null,d===null?v0=b:d.next=b,b===null&&(Wl=d)):(d=m,(n!==0||(w&3)!==0)&&(_0=!0)),m=b}or!==0&&or!==5||yd(n),Vi!==0&&(Vi=0)}function Wy(n,i){for(var d=n.suspendedLanes,m=n.pingedLanes,b=n.expirationTimes,w=n.pendingLanes&-62914561;0<w;){var M=31-$e(w),Z=1<<M,me=b[M];me===-1?((Z&d)===0||(Z&m)!==0)&&(b[M]=gs(Z,i)):me<=i&&(n.expiredLanes|=Z),w&=~Z}if(i=Ta,d=Jt,d=Dr(n,n===i?d:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),m=n.callbackNode,d===0||n===i&&(ua===2||ua===9)||n.cancelPendingCommit!==null)return m!==null&&m!==null&&Je(m),n.callbackNode=null,n.callbackPriority=0;if((d&3)===0||cn(n,d)){if(i=d&-d,i===n.callbackPriority)return i;switch(m!==null&&Je(m),be(d)){case 2:case 8:d=Rt;break;case 32:d=Pt;break;case 268435456:d=at;break;default:d=Pt}return m=Vy.bind(null,n),d=ze(d,m),n.callbackPriority=i,n.callbackNode=d,i}return m!==null&&m!==null&&Je(m),n.callbackPriority=2,n.callbackNode=null,2}function Vy(n,i){if(or!==0&&or!==5)return n.callbackNode=null,n.callbackPriority=0,null;var d=n.callbackNode;if(b0()&&n.callbackNode!==d)return null;var m=Jt;return m=Dr(n,n===Ta?m:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),m===0?null:(jy(n,m,i),Wy(n,ft()),n.callbackNode!=null&&n.callbackNode===d?Vy.bind(null,n):null)}function Gy(n,i){if(b0())return null;jy(n,i,!0)}function M4(){V4(function(){(oa&6)!==0?ze(Ut,L4):$y()})}function km(){if(Vi===0){var n=Cl;n===0&&(n=tt,tt<<=1,(tt&261888)===0&&(tt=256)),Vi=n}return Vi}function Zy(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:vi(""+n)}function qy(n,i){var d=i.ownerDocument.createElement("input");return d.name=i.name,d.value=i.value,n.id&&d.setAttribute("form",n.id),i.parentNode.insertBefore(d,i),n=new FormData(n),d.parentNode.removeChild(d),n}function D4(n,i,d,m,b){if(i==="submit"&&d&&d.stateNode===b){var w=Zy((b[Q]||null).action),M=m.submitter;M&&(i=(i=M[Q]||null)?Zy(i.formAction):M.getAttribute("formAction"),i!==null&&(w=i,M=null));var Z=new hl("action","action",null,m,b);n.push({event:Z,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(Vi!==0){var me=M?qy(b,M):new FormData(b);$h(d,{pending:!0,data:me,method:b.method,action:w},null,me)}}else typeof w=="function"&&(Z.preventDefault(),me=M?qy(b,M):new FormData(b),$h(d,{pending:!0,data:me,method:b.method,action:w},w,me))},currentTarget:b}]})}}for(var Nm=0;Nm<Ns.length;Nm++){var Sm=Ns[Nm],R4=Sm.toLowerCase(),P4=Sm[0].toUpperCase()+Sm.slice(1);Zr(R4,"on"+P4)}Zr(wo,"onAnimationEnd"),Zr(Bu,"onAnimationIteration"),Zr(ko,"onAnimationStart"),Zr("dblclick","onDoubleClick"),Zr("focusin","onFocus"),Zr("focusout","onBlur"),Zr(mh,"onTransitionRun"),Zr(zu,"onTransitionStart"),Zr(gh,"onTransitionCancel"),Zr(Oi,"onTransitionEnd"),Tr("onMouseEnter",["mouseout","mouseover"]),Tr("onMouseLeave",["mouseout","mouseover"]),Tr("onPointerEnter",["pointerout","pointerover"]),Tr("onPointerLeave",["pointerout","pointerover"]),Ea("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ea("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ea("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ea("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ea("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ea("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bd="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),F4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bd));function Yy(n,i){i=(i&4)!==0;for(var d=0;d<n.length;d++){var m=n[d],b=m.event;m=m.listeners;e:{var w=void 0;if(i)for(var M=m.length-1;0<=M;M--){var Z=m[M],me=Z.instance,Ce=Z.currentTarget;if(Z=Z.listener,me!==w&&b.isPropagationStopped())break e;w=Z,b.currentTarget=Ce;try{w(b)}catch(Ue){No(Ue)}b.currentTarget=null,w=me}else for(M=0;M<m.length;M++){if(Z=m[M],me=Z.instance,Ce=Z.currentTarget,Z=Z.listener,me!==w&&b.isPropagationStopped())break e;w=Z,b.currentTarget=Ce;try{w(b)}catch(Ue){No(Ue)}b.currentTarget=null,w=me}}}}function Xt(n,i){var d=i[he];d===void 0&&(d=i[he]=new Set);var m=n+"__bubble";d.has(m)||(Xy(i,n,2,!1),d.add(m))}function jm(n,i,d){var m=0;i&&(m|=4),Xy(d,n,m,i)}var w0="_reactListening"+Math.random().toString(36).slice(2);function Tm(n){if(!n[w0]){n[w0]=!0,ya.forEach(function(d){d!=="selectionchange"&&(F4.has(d)||jm(d,!1,n),jm(d,!0,n))});var i=n.nodeType===9?n:n.ownerDocument;i===null||i[w0]||(i[w0]=!0,jm("selectionchange",!1,i))}}function Xy(n,i,d,m){switch(S1(i)){case 2:var b=uk;break;case 8:b=fk;break;default:b=Hm}d=b.bind(null,i,d,n),b=void 0,!co||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(b=!0),m?b!==void 0?n.addEventListener(i,d,{capture:!0,passive:b}):n.addEventListener(i,d,!0):b!==void 0?n.addEventListener(i,d,{passive:b}):n.addEventListener(i,d,!1)}function Em(n,i,d,m,b){var w=m;if((i&1)===0&&(i&2)===0&&m!==null)e:for(;;){if(m===null)return;var M=m.tag;if(M===3||M===4){var Z=m.stateNode.containerInfo;if(Z===b)break;if(M===4)for(M=m.return;M!==null;){var me=M.tag;if((me===3||me===4)&&M.stateNode.containerInfo===b)return;M=M.return}for(;Z!==null;){if(M=et(Z),M===null)return;if(me=M.tag,me===5||me===6||me===26||me===27){m=w=M;continue e}Z=Z.parentNode}}m=m.return}Pc(function(){var Ce=w,Ue=lo(d),Ze=[];e:{var Oe=Uu.get(n);if(Oe!==void 0){var Re=hl,gt=n;switch(n){case"keypress":if(uo(d)===0)break e;case"keydown":case"keyup":Re=Tu;break;case"focusin":gt="focus",Re=Bc;break;case"focusout":gt="blur",Re=Bc;break;case"beforeblur":case"afterblur":Re=Bc;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Re=wu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Re=rh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Re=lh;break;case wo:case Bu:case ko:Re=zc;break;case Oi:Re=Au;break;case"scroll":case"scrollend":Re=Kt;break;case"wheel":Re=Hs;break;case"copy":case"cut":case"paste":Re=Ln;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Re=Eu;break;case"toggle":case"beforetoggle":Re=mo}var Tt=(i&4)!==0,ka=!Tt&&(n==="scroll"||n==="scrollend"),we=Tt?Oe!==null?Oe+"Capture":null:Oe;Tt=[];for(var ve=Ce,Te;ve!==null;){var Ve=ve;if(Te=Ve.stateNode,Ve=Ve.tag,Ve!==5&&Ve!==26&&Ve!==27||Te===null||we===null||(Ve=zs(ve,we),Ve!=null&&Tt.push(vd(ve,Ve,Te))),ka)break;ve=ve.return}0<Tt.length&&(Oe=new Re(Oe,gt,null,d,Ue),Ze.push({event:Oe,listeners:Tt}))}}if((i&7)===0){e:{if(Oe=n==="mouseover"||n==="pointerover",Re=n==="mouseout"||n==="pointerout",Oe&&d!==fl&&(gt=d.relatedTarget||d.fromElement)&&(et(gt)||gt[F]))break e;if((Re||Oe)&&(Oe=Ue.window===Ue?Ue:(Oe=Ue.ownerDocument)?Oe.defaultView||Oe.parentWindow:window,Re?(gt=d.relatedTarget||d.toElement,Re=Ce,gt=gt?et(gt):null,gt!==null&&(ka=u(gt),Tt=gt.tag,gt!==ka||Tt!==5&&Tt!==27&&Tt!==6)&&(gt=null)):(Re=null,gt=Ce),Re!==gt)){if(Tt=wu,Ve="onMouseLeave",we="onMouseEnter",ve="mouse",(n==="pointerout"||n==="pointerover")&&(Tt=Eu,Ve="onPointerLeave",we="onPointerEnter",ve="pointer"),ka=Re==null?Oe:Qe(Re),Te=gt==null?Oe:Qe(gt),Oe=new Tt(Ve,ve+"leave",Re,d,Ue),Oe.target=ka,Oe.relatedTarget=Te,Ve=null,et(Ue)===Ce&&(Tt=new Tt(we,ve+"enter",gt,d,Ue),Tt.target=Te,Tt.relatedTarget=ka,Ve=Tt),ka=Ve,Re&&gt)t:{for(Tt=I4,we=Re,ve=gt,Te=0,Ve=we;Ve;Ve=Tt(Ve))Te++;Ve=0;for(var Nt=ve;Nt;Nt=Tt(Nt))Ve++;for(;0<Te-Ve;)we=Tt(we),Te--;for(;0<Ve-Te;)ve=Tt(ve),Ve--;for(;Te--;){if(we===ve||ve!==null&&we===ve.alternate){Tt=we;break t}we=Tt(we),ve=Tt(ve)}Tt=null}else Tt=null;Re!==null&&Ky(Ze,Oe,Re,Tt,!1),gt!==null&&ka!==null&&Ky(Ze,ka,gt,Tt,!0)}}e:{if(Oe=Ce?Qe(Ce):window,Re=Oe.nodeName&&Oe.nodeName.toLowerCase(),Re==="select"||Re==="input"&&Oe.type==="file")var ra=yo;else if(Mn(Oe))if(Du)ra=hh;else{ra=fh;var xt=es}else Re=Oe.nodeName,!Re||Re.toLowerCase()!=="input"||Oe.type!=="checkbox"&&Oe.type!=="radio"?Ce&&oo(Ce.elementType)&&(ra=yo):ra=Ti;if(ra&&(ra=ra(n,Ce))){Mu(Ze,ra,d,Ue);break e}xt&&xt(n,Oe,Ce),n==="focusout"&&Ce&&Oe.type==="number"&&Ce.memoizedProps.value!=null&&Kn(Oe,"number",Oe.value)}switch(xt=Ce?Qe(Ce):window,n){case"focusin":(Mn(xt)||xt.contentEditable==="true")&&(ws=xt,wl=Ce,_o=null);break;case"focusout":_o=wl=ws=null;break;case"mousedown":Ci=!0;break;case"contextmenu":case"mouseup":case"dragend":Ci=!1,Fu(Ze,d,Ue);break;case"selectionchange":if(_l)break;case"keydown":case"keyup":Fu(Ze,d,Ue)}var $t;if(gl)e:{switch(n){case"compositionstart":var Qt="onCompositionStart";break e;case"compositionend":Qt="onCompositionEnd";break e;case"compositionupdate":Qt="onCompositionUpdate";break e}Qt=void 0}else Ni?Lu(n,d)&&(Qt="onCompositionEnd"):n==="keydown"&&d.keyCode===229&&(Qt="onCompositionStart");Qt&&(pl&&d.locale!=="ko"&&(Ni||Qt!=="onCompositionStart"?Qt==="onCompositionEnd"&&Ni&&($t=bs()):(On=Ue,Us="value"in On?On.value:On.textContent,Ni=!0)),xt=k0(Ce,Qt),0<xt.length&&(Qt=new Uc(Qt,n,null,d,Ue),Ze.push({event:Qt,listeners:xt}),$t?Qt.data=$t:($t=Vc(d),$t!==null&&(Qt.data=$t)))),($t=dh?pn(n,d):Si(n,d))&&(Qt=k0(Ce,"onBeforeInput"),0<Qt.length&&(xt=new Uc("onBeforeInput","beforeinput",null,d,Ue),Ze.push({event:xt,listeners:Qt}),xt.data=$t)),D4(Ze,n,Ce,d,Ue)}Yy(Ze,i)})}function vd(n,i,d){return{instance:n,listener:i,currentTarget:d}}function k0(n,i){for(var d=i+"Capture",m=[];n!==null;){var b=n,w=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||w===null||(b=zs(n,d),b!=null&&m.unshift(vd(n,b,w)),b=zs(n,i),b!=null&&m.push(vd(n,b,w))),n.tag===3)return m;n=n.return}return[]}function I4(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Ky(n,i,d,m,b){for(var w=i._reactName,M=[];d!==null&&d!==m;){var Z=d,me=Z.alternate,Ce=Z.stateNode;if(Z=Z.tag,me!==null&&me===m)break;Z!==5&&Z!==26&&Z!==27||Ce===null||(me=Ce,b?(Ce=zs(d,w),Ce!=null&&M.unshift(vd(d,Ce,me))):b||(Ce=zs(d,w),Ce!=null&&M.push(vd(d,Ce,me)))),d=d.return}M.length!==0&&n.push({event:i,listeners:M})}var B4=/\r\n?/g,z4=/\u0000|\uFFFD/g;function Jy(n){return(typeof n=="string"?n:""+n).replace(B4,`
`).replace(z4,"")}function Qy(n,i){return i=Jy(i),Jy(n)===i}function wa(n,i,d,m,b,w){switch(d){case"children":typeof m=="string"?i==="body"||i==="textarea"&&m===""||An(n,m):(typeof m=="number"||typeof m=="bigint")&&i!=="body"&&An(n,""+m);break;case"className":va(n,"class",m);break;case"tabIndex":va(n,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":va(n,d,m);break;case"style":dl(n,m,w);break;case"data":if(i!=="object"){va(n,"data",m);break}case"src":case"href":if(m===""&&(i!=="a"||d!=="href")){n.removeAttribute(d);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){n.removeAttribute(d);break}m=vi(""+m),n.setAttribute(d,m);break;case"action":case"formAction":if(typeof m=="function"){n.setAttribute(d,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof w=="function"&&(d==="formAction"?(i!=="input"&&wa(n,i,"name",b.name,b,null),wa(n,i,"formEncType",b.formEncType,b,null),wa(n,i,"formMethod",b.formMethod,b,null),wa(n,i,"formTarget",b.formTarget,b,null)):(wa(n,i,"encType",b.encType,b,null),wa(n,i,"method",b.method,b,null),wa(n,i,"target",b.target,b,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){n.removeAttribute(d);break}m=vi(""+m),n.setAttribute(d,m);break;case"onClick":m!=null&&(n.onclick=Vr);break;case"onScroll":m!=null&&Xt("scroll",n);break;case"onScrollEnd":m!=null&&Xt("scrollend",n);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(s(61));if(d=m.__html,d!=null){if(b.children!=null)throw Error(s(60));n.innerHTML=d}}break;case"multiple":n.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":n.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){n.removeAttribute("xlink:href");break}d=vi(""+m),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?n.setAttribute(d,""+m):n.removeAttribute(d);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?n.setAttribute(d,""):n.removeAttribute(d);break;case"capture":case"download":m===!0?n.setAttribute(d,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?n.setAttribute(d,m):n.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?n.setAttribute(d,m):n.removeAttribute(d);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?n.removeAttribute(d):n.setAttribute(d,m);break;case"popover":Xt("beforetoggle",n),Xt("toggle",n),Mt(n,"popover",m);break;case"xlinkActuate":Wr(n,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":Wr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":Wr(n,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":Wr(n,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":Wr(n,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":Wr(n,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":Wr(n,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":Wr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":Wr(n,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":Mt(n,"is",m);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=ul.get(d)||d,Mt(n,d,m))}}function Cm(n,i,d,m,b,w){switch(d){case"style":dl(n,m,w);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(s(61));if(d=m.__html,d!=null){if(b.children!=null)throw Error(s(60));n.innerHTML=d}}break;case"children":typeof m=="string"?An(n,m):(typeof m=="number"||typeof m=="bigint")&&An(n,""+m);break;case"onScroll":m!=null&&Xt("scroll",n);break;case"onScrollEnd":m!=null&&Xt("scrollend",n);break;case"onClick":m!=null&&(n.onclick=Vr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ba.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(b=d.endsWith("Capture"),i=d.slice(2,b?d.length-7:void 0),w=n[Q]||null,w=w!=null?w[d]:null,typeof w=="function"&&n.removeEventListener(i,w,b),typeof m=="function")){typeof w!="function"&&w!==null&&(d in n?n[d]=null:n.hasAttribute(d)&&n.removeAttribute(d)),n.addEventListener(i,m,b);break e}d in n?n[d]=m:m===!0?n.setAttribute(d,""):Mt(n,d,m)}}}function vr(n,i,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Xt("error",n),Xt("load",n);var m=!1,b=!1,w;for(w in d)if(d.hasOwnProperty(w)){var M=d[w];if(M!=null)switch(w){case"src":m=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:wa(n,i,w,M,d,null)}}b&&wa(n,i,"srcSet",d.srcSet,d,null),m&&wa(n,i,"src",d.src,d,null);return;case"input":Xt("invalid",n);var Z=w=M=b=null,me=null,Ce=null;for(m in d)if(d.hasOwnProperty(m)){var Ue=d[m];if(Ue!=null)switch(m){case"name":b=Ue;break;case"type":M=Ue;break;case"checked":me=Ue;break;case"defaultChecked":Ce=Ue;break;case"value":w=Ue;break;case"defaultValue":Z=Ue;break;case"children":case"dangerouslySetInnerHTML":if(Ue!=null)throw Error(s(137,i));break;default:wa(n,i,m,Ue,d,null)}}io(n,w,Z,me,Ce,M,b,!1);return;case"select":Xt("invalid",n),m=M=w=null;for(b in d)if(d.hasOwnProperty(b)&&(Z=d[b],Z!=null))switch(b){case"value":w=Z;break;case"defaultValue":M=Z;break;case"multiple":m=Z;default:wa(n,i,b,Z,d,null)}i=w,d=M,n.multiple=!!m,i!=null?ja(n,!!m,i,!1):d!=null&&ja(n,!!m,d,!0);return;case"textarea":Xt("invalid",n),w=b=m=null;for(M in d)if(d.hasOwnProperty(M)&&(Z=d[M],Z!=null))switch(M){case"value":m=Z;break;case"defaultValue":b=Z;break;case"children":w=Z;break;case"dangerouslySetInnerHTML":if(Z!=null)throw Error(s(91));break;default:wa(n,i,M,Z,d,null)}yi(n,m,b,w);return;case"option":for(me in d)if(d.hasOwnProperty(me)&&(m=d[me],m!=null))switch(me){case"selected":n.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:wa(n,i,me,m,d,null)}return;case"dialog":Xt("beforetoggle",n),Xt("toggle",n),Xt("cancel",n),Xt("close",n);break;case"iframe":case"object":Xt("load",n);break;case"video":case"audio":for(m=0;m<bd.length;m++)Xt(bd[m],n);break;case"image":Xt("error",n),Xt("load",n);break;case"details":Xt("toggle",n);break;case"embed":case"source":case"link":Xt("error",n),Xt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Ce in d)if(d.hasOwnProperty(Ce)&&(m=d[Ce],m!=null))switch(Ce){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:wa(n,i,Ce,m,d,null)}return;default:if(oo(i)){for(Ue in d)d.hasOwnProperty(Ue)&&(m=d[Ue],m!==void 0&&Cm(n,i,Ue,m,d,void 0));return}}for(Z in d)d.hasOwnProperty(Z)&&(m=d[Z],m!=null&&wa(n,i,Z,m,d,null))}function U4(n,i,d,m){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,w=null,M=null,Z=null,me=null,Ce=null,Ue=null;for(Re in d){var Ze=d[Re];if(d.hasOwnProperty(Re)&&Ze!=null)switch(Re){case"checked":break;case"value":break;case"defaultValue":me=Ze;default:m.hasOwnProperty(Re)||wa(n,i,Re,null,m,Ze)}}for(var Oe in m){var Re=m[Oe];if(Ze=d[Oe],m.hasOwnProperty(Oe)&&(Re!=null||Ze!=null))switch(Oe){case"type":w=Re;break;case"name":b=Re;break;case"checked":Ce=Re;break;case"defaultChecked":Ue=Re;break;case"value":M=Re;break;case"defaultValue":Z=Re;break;case"children":case"dangerouslySetInnerHTML":if(Re!=null)throw Error(s(137,i));break;default:Re!==Ze&&wa(n,i,Oe,Re,m,Ze)}}Mc(n,M,Z,me,Ce,Ue,w,b);return;case"select":Re=M=Z=Oe=null;for(w in d)if(me=d[w],d.hasOwnProperty(w)&&me!=null)switch(w){case"value":break;case"multiple":Re=me;default:m.hasOwnProperty(w)||wa(n,i,w,null,m,me)}for(b in m)if(w=m[b],me=d[b],m.hasOwnProperty(b)&&(w!=null||me!=null))switch(b){case"value":Oe=w;break;case"defaultValue":Z=w;break;case"multiple":M=w;default:w!==me&&wa(n,i,b,w,m,me)}i=Z,d=M,m=Re,Oe!=null?ja(n,!!d,Oe,!1):!!m!=!!d&&(i!=null?ja(n,!!d,i,!0):ja(n,!!d,d?[]:"",!1));return;case"textarea":Re=Oe=null;for(Z in d)if(b=d[Z],d.hasOwnProperty(Z)&&b!=null&&!m.hasOwnProperty(Z))switch(Z){case"value":break;case"children":break;default:wa(n,i,Z,null,m,b)}for(M in m)if(b=m[M],w=d[M],m.hasOwnProperty(M)&&(b!=null||w!=null))switch(M){case"value":Oe=b;break;case"defaultValue":Re=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(s(91));break;default:b!==w&&wa(n,i,M,b,m,w)}ys(n,Oe,Re);return;case"option":for(var gt in d)if(Oe=d[gt],d.hasOwnProperty(gt)&&Oe!=null&&!m.hasOwnProperty(gt))switch(gt){case"selected":n.selected=!1;break;default:wa(n,i,gt,null,m,Oe)}for(me in m)if(Oe=m[me],Re=d[me],m.hasOwnProperty(me)&&Oe!==Re&&(Oe!=null||Re!=null))switch(me){case"selected":n.selected=Oe&&typeof Oe!="function"&&typeof Oe!="symbol";break;default:wa(n,i,me,Oe,m,Re)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Tt in d)Oe=d[Tt],d.hasOwnProperty(Tt)&&Oe!=null&&!m.hasOwnProperty(Tt)&&wa(n,i,Tt,null,m,Oe);for(Ce in m)if(Oe=m[Ce],Re=d[Ce],m.hasOwnProperty(Ce)&&Oe!==Re&&(Oe!=null||Re!=null))switch(Ce){case"children":case"dangerouslySetInnerHTML":if(Oe!=null)throw Error(s(137,i));break;default:wa(n,i,Ce,Oe,m,Re)}return;default:if(oo(i)){for(var ka in d)Oe=d[ka],d.hasOwnProperty(ka)&&Oe!==void 0&&!m.hasOwnProperty(ka)&&Cm(n,i,ka,void 0,m,Oe);for(Ue in m)Oe=m[Ue],Re=d[Ue],!m.hasOwnProperty(Ue)||Oe===Re||Oe===void 0&&Re===void 0||Cm(n,i,Ue,Oe,m,Re);return}}for(var we in d)Oe=d[we],d.hasOwnProperty(we)&&Oe!=null&&!m.hasOwnProperty(we)&&wa(n,i,we,null,m,Oe);for(Ze in m)Oe=m[Ze],Re=d[Ze],!m.hasOwnProperty(Ze)||Oe===Re||Oe==null&&Re==null||wa(n,i,Ze,Oe,m,Re)}function e1(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function H4(){if(typeof performance.getEntriesByType=="function"){for(var n=0,i=0,d=performance.getEntriesByType("resource"),m=0;m<d.length;m++){var b=d[m],w=b.transferSize,M=b.initiatorType,Z=b.duration;if(w&&Z&&e1(M)){for(M=0,Z=b.responseEnd,m+=1;m<d.length;m++){var me=d[m],Ce=me.startTime;if(Ce>Z)break;var Ue=me.transferSize,Ze=me.initiatorType;Ue&&e1(Ze)&&(me=me.responseEnd,M+=Ue*(me<Z?1:(Z-Ce)/(me-Ce)))}if(--m,i+=8*(w+M)/(b.duration/1e3),n++,10<n)break}}if(0<n)return i/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Am=null,Om=null;function N0(n){return n.nodeType===9?n:n.ownerDocument}function t1(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function a1(n,i){if(n===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&i==="foreignObject"?0:n}function Lm(n,i){return n==="textarea"||n==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Mm=null;function $4(){var n=window.event;return n&&n.type==="popstate"?n===Mm?!1:(Mm=n,!0):(Mm=null,!1)}var r1=typeof setTimeout=="function"?setTimeout:void 0,W4=typeof clearTimeout=="function"?clearTimeout:void 0,n1=typeof Promise=="function"?Promise:void 0,V4=typeof queueMicrotask=="function"?queueMicrotask:typeof n1!="undefined"?function(n){return n1.resolve(null).then(n).catch(G4)}:r1;function G4(n){setTimeout(function(){throw n})}function Gi(n){return n==="head"}function s1(n,i){var d=i,m=0;do{var b=d.nextSibling;if(n.removeChild(d),b&&b.nodeType===8)if(d=b.data,d==="/$"||d==="/&"){if(m===0){n.removeChild(b),ql(i);return}m--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")m++;else if(d==="html")_d(n.ownerDocument.documentElement);else if(d==="head"){d=n.ownerDocument.head,_d(d);for(var w=d.firstChild;w;){var M=w.nextSibling,Z=w.nodeName;w[Se]||Z==="SCRIPT"||Z==="STYLE"||Z==="LINK"&&w.rel.toLowerCase()==="stylesheet"||d.removeChild(w),w=M}}else d==="body"&&_d(n.ownerDocument.body);d=b}while(d);ql(i)}function i1(n,i){var d=n;n=0;do{var m=d.nextSibling;if(d.nodeType===1?i?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(i?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),m&&m.nodeType===8)if(d=m.data,d==="/$"){if(n===0)break;n--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||n++;d=m}while(d)}function Dm(n){var i=n.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var d=i;switch(i=i.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":Dm(d),Ye(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}n.removeChild(d)}}function Z4(n,i,d,m){for(;n.nodeType===1;){var b=d;if(n.nodeName.toLowerCase()!==i.toLowerCase()){if(!m&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(m){if(!n[Se])switch(i){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(w=n.getAttribute("rel"),w==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(w!==b.rel||n.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||n.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||n.getAttribute("title")!==(b.title==null?null:b.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(w=n.getAttribute("src"),(w!==(b.src==null?null:b.src)||n.getAttribute("type")!==(b.type==null?null:b.type)||n.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&w&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(i==="input"&&n.type==="hidden"){var w=b.name==null?null:""+b.name;if(b.type==="hidden"&&n.getAttribute("name")===w)return n}else return n;if(n=Bn(n.nextSibling),n===null)break}return null}function q4(n,i,d){if(i==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!d||(n=Bn(n.nextSibling),n===null))return null;return n}function o1(n,i){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Bn(n.nextSibling),n===null))return null;return n}function Rm(n){return n.data==="$?"||n.data==="$~"}function Pm(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Y4(n,i){var d=n.ownerDocument;if(n.data==="$~")n._reactRetry=i;else if(n.data!=="$?"||d.readyState!=="loading")i();else{var m=function(){i(),d.removeEventListener("DOMContentLoaded",m)};d.addEventListener("DOMContentLoaded",m),n._reactRetry=m}}function Bn(n){for(;n!=null;n=n.nextSibling){var i=n.nodeType;if(i===1||i===3)break;if(i===8){if(i=n.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return n}var Fm=null;function l1(n){n=n.nextSibling;for(var i=0;n;){if(n.nodeType===8){var d=n.data;if(d==="/$"||d==="/&"){if(i===0)return Bn(n.nextSibling);i--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||i++}n=n.nextSibling}return null}function c1(n){n=n.previousSibling;for(var i=0;n;){if(n.nodeType===8){var d=n.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(i===0)return n;i--}else d!=="/$"&&d!=="/&"||i++}n=n.previousSibling}return null}function d1(n,i,d){switch(i=N0(d),n){case"html":if(n=i.documentElement,!n)throw Error(s(452));return n;case"head":if(n=i.head,!n)throw Error(s(453));return n;case"body":if(n=i.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function _d(n){for(var i=n.attributes;i.length;)n.removeAttributeNode(i[0]);Ye(n)}var zn=new Map,u1=new Set;function S0(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var ri=V.d;V.d={f:X4,r:K4,D:J4,C:Q4,L:ek,m:tk,X:rk,S:ak,M:nk};function X4(){var n=ri.f(),i=p0();return n||i}function K4(n){var i=ot(n);i!==null&&i.tag===5&&i.type==="form"?Ex(i):ri.r(n)}var Vl=typeof document=="undefined"?null:document;function f1(n,i,d){var m=Vl;if(m&&typeof i=="string"&&i){var b=Ca(i);b='link[rel="'+n+'"][href="'+b+'"]',typeof d=="string"&&(b+='[crossorigin="'+d+'"]'),u1.has(b)||(u1.add(b),n={rel:n,crossOrigin:d,href:i},m.querySelector(b)===null&&(i=m.createElement("link"),vr(i,"link",n),mt(i),m.head.appendChild(i)))}}function J4(n){ri.D(n),f1("dns-prefetch",n,null)}function Q4(n,i){ri.C(n,i),f1("preconnect",n,i)}function ek(n,i,d){ri.L(n,i,d);var m=Vl;if(m&&n&&i){var b='link[rel="preload"][as="'+Ca(i)+'"]';i==="image"&&d&&d.imageSrcSet?(b+='[imagesrcset="'+Ca(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(b+='[imagesizes="'+Ca(d.imageSizes)+'"]')):b+='[href="'+Ca(n)+'"]';var w=b;switch(i){case"style":w=Gl(n);break;case"script":w=Zl(n)}zn.has(w)||(n=v({rel:"preload",href:i==="image"&&d&&d.imageSrcSet?void 0:n,as:i},d),zn.set(w,n),m.querySelector(b)!==null||i==="style"&&m.querySelector(wd(w))||i==="script"&&m.querySelector(kd(w))||(i=m.createElement("link"),vr(i,"link",n),mt(i),m.head.appendChild(i)))}}function tk(n,i){ri.m(n,i);var d=Vl;if(d&&n){var m=i&&typeof i.as=="string"?i.as:"script",b='link[rel="modulepreload"][as="'+Ca(m)+'"][href="'+Ca(n)+'"]',w=b;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=Zl(n)}if(!zn.has(w)&&(n=v({rel:"modulepreload",href:n},i),zn.set(w,n),d.querySelector(b)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(kd(w)))return}m=d.createElement("link"),vr(m,"link",n),mt(m),d.head.appendChild(m)}}}function ak(n,i,d){ri.S(n,i,d);var m=Vl;if(m&&n){var b=lt(m).hoistableStyles,w=Gl(n);i=i||"default";var M=b.get(w);if(!M){var Z={loading:0,preload:null};if(M=m.querySelector(wd(w)))Z.loading=5;else{n=v({rel:"stylesheet",href:n,"data-precedence":i},d),(d=zn.get(w))&&Im(n,d);var me=M=m.createElement("link");mt(me),vr(me,"link",n),me._p=new Promise(function(Ce,Ue){me.onload=Ce,me.onerror=Ue}),me.addEventListener("load",function(){Z.loading|=1}),me.addEventListener("error",function(){Z.loading|=2}),Z.loading|=4,j0(M,i,m)}M={type:"stylesheet",instance:M,count:1,state:Z},b.set(w,M)}}}function rk(n,i){ri.X(n,i);var d=Vl;if(d&&n){var m=lt(d).hoistableScripts,b=Zl(n),w=m.get(b);w||(w=d.querySelector(kd(b)),w||(n=v({src:n,async:!0},i),(i=zn.get(b))&&Bm(n,i),w=d.createElement("script"),mt(w),vr(w,"link",n),d.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(b,w))}}function nk(n,i){ri.M(n,i);var d=Vl;if(d&&n){var m=lt(d).hoistableScripts,b=Zl(n),w=m.get(b);w||(w=d.querySelector(kd(b)),w||(n=v({src:n,async:!0,type:"module"},i),(i=zn.get(b))&&Bm(n,i),w=d.createElement("script"),mt(w),vr(w,"link",n),d.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(b,w))}}function h1(n,i,d,m){var b=(b=fe.current)?S0(b):null;if(!b)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(i=Gl(d.href),d=lt(b).hoistableStyles,m=d.get(i),m||(m={type:"style",instance:null,count:0,state:null},d.set(i,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){n=Gl(d.href);var w=lt(b).hoistableStyles,M=w.get(n);if(M||(b=b.ownerDocument||b,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(n,M),(w=b.querySelector(wd(n)))&&!w._p&&(M.instance=w,M.state.loading=5),zn.has(n)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},zn.set(n,d),w||sk(b,n,d,M.state))),i&&m===null)throw Error(s(528,""));return M}if(i&&m!==null)throw Error(s(529,""));return null;case"script":return i=d.async,d=d.src,typeof d=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Zl(d),d=lt(b).hoistableScripts,m=d.get(i),m||(m={type:"script",instance:null,count:0,state:null},d.set(i,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function Gl(n){return'href="'+Ca(n)+'"'}function wd(n){return'link[rel="stylesheet"]['+n+"]"}function m1(n){return v({},n,{"data-precedence":n.precedence,precedence:null})}function sk(n,i,d,m){n.querySelector('link[rel="preload"][as="style"]['+i+"]")?m.loading=1:(i=n.createElement("link"),m.preload=i,i.addEventListener("load",function(){return m.loading|=1}),i.addEventListener("error",function(){return m.loading|=2}),vr(i,"link",d),mt(i),n.head.appendChild(i))}function Zl(n){return'[src="'+Ca(n)+'"]'}function kd(n){return"script[async]"+n}function g1(n,i,d){if(i.count++,i.instance===null)switch(i.type){case"style":var m=n.querySelector('style[data-href~="'+Ca(d.href)+'"]');if(m)return i.instance=m,mt(m),m;var b=v({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return m=(n.ownerDocument||n).createElement("style"),mt(m),vr(m,"style",b),j0(m,d.precedence,n),i.instance=m;case"stylesheet":b=Gl(d.href);var w=n.querySelector(wd(b));if(w)return i.state.loading|=4,i.instance=w,mt(w),w;m=m1(d),(b=zn.get(b))&&Im(m,b),w=(n.ownerDocument||n).createElement("link"),mt(w);var M=w;return M._p=new Promise(function(Z,me){M.onload=Z,M.onerror=me}),vr(w,"link",m),i.state.loading|=4,j0(w,d.precedence,n),i.instance=w;case"script":return w=Zl(d.src),(b=n.querySelector(kd(w)))?(i.instance=b,mt(b),b):(m=d,(b=zn.get(w))&&(m=v({},d),Bm(m,b)),n=n.ownerDocument||n,b=n.createElement("script"),mt(b),vr(b,"link",m),n.head.appendChild(b),i.instance=b);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(m=i.instance,i.state.loading|=4,j0(m,d.precedence,n));return i.instance}function j0(n,i,d){for(var m=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=m.length?m[m.length-1]:null,w=b,M=0;M<m.length;M++){var Z=m[M];if(Z.dataset.precedence===i)w=Z;else if(w!==b)break}w?w.parentNode.insertBefore(n,w.nextSibling):(i=d.nodeType===9?d.head:d,i.insertBefore(n,i.firstChild))}function Im(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.title==null&&(n.title=i.title)}function Bm(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.integrity==null&&(n.integrity=i.integrity)}var T0=null;function p1(n,i,d){if(T0===null){var m=new Map,b=T0=new Map;b.set(d,m)}else b=T0,m=b.get(d),m||(m=new Map,b.set(d,m));if(m.has(n))return m;for(m.set(n,null),d=d.getElementsByTagName(n),b=0;b<d.length;b++){var w=d[b];if(!(w[Se]||w[X]||n==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var M=w.getAttribute(i)||"";M=n+M;var Z=m.get(M);Z?Z.push(w):m.set(M,[w])}}return m}function x1(n,i,d){n=n.ownerDocument||n,n.head.insertBefore(d,i==="title"?n.querySelector("head > title"):null)}function ik(n,i,d){if(d===1||i.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return n=i.disabled,typeof i.precedence=="string"&&n==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function y1(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function ok(n,i,d,m){if(d.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var b=Gl(m.href),w=i.querySelector(wd(b));if(w){i=w._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(n.count++,n=E0.bind(n),i.then(n,n)),d.state.loading|=4,d.instance=w,mt(w);return}w=i.ownerDocument||i,m=m1(m),(b=zn.get(b))&&Im(m,b),w=w.createElement("link"),mt(w);var M=w;M._p=new Promise(function(Z,me){M.onload=Z,M.onerror=me}),vr(w,"link",m),d.instance=w}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(d,i),(i=d.state.preload)&&(d.state.loading&3)===0&&(n.count++,d=E0.bind(n),i.addEventListener("load",d),i.addEventListener("error",d))}}var zm=0;function lk(n,i){return n.stylesheets&&n.count===0&&A0(n,n.stylesheets),0<n.count||0<n.imgCount?function(d){var m=setTimeout(function(){if(n.stylesheets&&A0(n,n.stylesheets),n.unsuspend){var w=n.unsuspend;n.unsuspend=null,w()}},6e4+i);0<n.imgBytes&&zm===0&&(zm=62500*H4());var b=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&A0(n,n.stylesheets),n.unsuspend)){var w=n.unsuspend;n.unsuspend=null,w()}},(n.imgBytes>zm?50:800)+i);return n.unsuspend=d,function(){n.unsuspend=null,clearTimeout(m),clearTimeout(b)}}:null}function E0(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)A0(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var C0=null;function A0(n,i){n.stylesheets=null,n.unsuspend!==null&&(n.count++,C0=new Map,i.forEach(ck,n),C0=null,E0.call(n))}function ck(n,i){if(!(i.state.loading&4)){var d=C0.get(n);if(d)var m=d.get(null);else{d=new Map,C0.set(n,d);for(var b=n.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<b.length;w++){var M=b[w];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(d.set(M.dataset.precedence,M),m=M)}m&&d.set(null,m)}b=i.instance,M=b.getAttribute("data-precedence"),w=d.get(M)||m,w===m&&d.set(null,b),d.set(M,b),this.count++,m=E0.bind(this),b.addEventListener("load",m),b.addEventListener("error",m),w?w.parentNode.insertBefore(b,w.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(b,n.firstChild)),i.state.loading|=4}}var Nd={$$typeof:O,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function dk(n,i,d,m,b,w,M,Z,me){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Zn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zn(0),this.hiddenUpdates=Zn(null),this.identifierPrefix=m,this.onUncaughtError=b,this.onCaughtError=w,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=me,this.incompleteTransitions=new Map}function b1(n,i,d,m,b,w,M,Z,me,Ce,Ue,Ze){return n=new dk(n,i,d,M,me,Ce,Ue,Ze,Z),i=1,w===!0&&(i|=24),w=Cr(3,null,null,i),n.current=w,w.stateNode=n,i=bh(),i.refCount++,n.pooledCache=i,i.refCount++,w.memoizedState={element:m,isDehydrated:d,cache:i},kh(w),n}function v1(n){return n?(n=$s,n):$s}function _1(n,i,d,m,b,w){b=v1(b),m.context===null?m.context=b:m.pendingContext=b,m=Ri(i),m.payload={element:d},w=w===void 0?null:w,w!==null&&(m.callback=w),d=Pi(n,m,i),d!==null&&(en(d,n,i),ad(d,n,i))}function w1(n,i){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var d=n.retryLane;n.retryLane=d!==0&&d<i?d:i}}function Um(n,i){w1(n,i),(n=n.alternate)&&w1(n,i)}function k1(n){if(n.tag===13||n.tag===31){var i=Pn(n,67108864);i!==null&&en(i,n,67108864),Um(n,67108864)}}function N1(n){if(n.tag===13||n.tag===31){var i=_n();i=Za(i);var d=Pn(n,i);d!==null&&en(d,n,i),Um(n,i)}}var O0=!0;function uk(n,i,d,m){var b=te.T;te.T=null;var w=V.p;try{V.p=2,Hm(n,i,d,m)}finally{V.p=w,te.T=b}}function fk(n,i,d,m){var b=te.T;te.T=null;var w=V.p;try{V.p=8,Hm(n,i,d,m)}finally{V.p=w,te.T=b}}function Hm(n,i,d,m){if(O0){var b=$m(m);if(b===null)Em(n,i,m,L0,d),j1(n,m);else if(mk(b,n,i,d,m))m.stopPropagation();else if(j1(n,m),i&4&&-1<hk.indexOf(n)){for(;b!==null;){var w=ot(b);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var M=Ba(w.pendingLanes);if(M!==0){var Z=w;for(Z.pendingLanes|=2,Z.entangledLanes|=2;M;){var me=1<<31-$e(M);Z.entanglements[1]|=me,M&=~me}As(w),(oa&6)===0&&(m0=ft()+500,yd(0))}}break;case 31:case 13:Z=Pn(w,2),Z!==null&&en(Z,w,2),p0(),Um(w,2)}if(w=$m(m),w===null&&Em(n,i,m,L0,d),w===b)break;b=w}b!==null&&m.stopPropagation()}else Em(n,i,m,null,d)}}function $m(n){return n=lo(n),Wm(n)}var L0=null;function Wm(n){if(L0=null,n=et(n),n!==null){var i=u(n);if(i===null)n=null;else{var d=i.tag;if(d===13){if(n=c(i),n!==null)return n;n=null}else if(d===31){if(n=f(i),n!==null)return n;n=null}else if(d===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;n=null}else i!==n&&(n=null)}}return L0=n,null}function S1(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(bt()){case Ut:return 2;case Rt:return 8;case Pt:case qe:return 32;case at:return 268435456;default:return 32}default:return 32}}var Vm=!1,Zi=null,qi=null,Yi=null,Sd=new Map,jd=new Map,Xi=[],hk="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function j1(n,i){switch(n){case"focusin":case"focusout":Zi=null;break;case"dragenter":case"dragleave":qi=null;break;case"mouseover":case"mouseout":Yi=null;break;case"pointerover":case"pointerout":Sd.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":jd.delete(i.pointerId)}}function Td(n,i,d,m,b,w){return n===null||n.nativeEvent!==w?(n={blockedOn:i,domEventName:d,eventSystemFlags:m,nativeEvent:w,targetContainers:[b]},i!==null&&(i=ot(i),i!==null&&k1(i)),n):(n.eventSystemFlags|=m,i=n.targetContainers,b!==null&&i.indexOf(b)===-1&&i.push(b),n)}function mk(n,i,d,m,b){switch(i){case"focusin":return Zi=Td(Zi,n,i,d,m,b),!0;case"dragenter":return qi=Td(qi,n,i,d,m,b),!0;case"mouseover":return Yi=Td(Yi,n,i,d,m,b),!0;case"pointerover":var w=b.pointerId;return Sd.set(w,Td(Sd.get(w)||null,n,i,d,m,b)),!0;case"gotpointercapture":return w=b.pointerId,jd.set(w,Td(jd.get(w)||null,n,i,d,m,b)),!0}return!1}function T1(n){var i=et(n.target);if(i!==null){var d=u(i);if(d!==null){if(i=d.tag,i===13){if(i=c(d),i!==null){n.blockedOn=i,ee(n.priority,function(){N1(d)});return}}else if(i===31){if(i=f(d),i!==null){n.blockedOn=i,ee(n.priority,function(){N1(d)});return}}else if(i===3&&d.stateNode.current.memoizedState.isDehydrated){n.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}n.blockedOn=null}function M0(n){if(n.blockedOn!==null)return!1;for(var i=n.targetContainers;0<i.length;){var d=$m(n.nativeEvent);if(d===null){d=n.nativeEvent;var m=new d.constructor(d.type,d);fl=m,d.target.dispatchEvent(m),fl=null}else return i=ot(d),i!==null&&k1(i),n.blockedOn=d,!1;i.shift()}return!0}function E1(n,i,d){M0(n)&&d.delete(i)}function gk(){Vm=!1,Zi!==null&&M0(Zi)&&(Zi=null),qi!==null&&M0(qi)&&(qi=null),Yi!==null&&M0(Yi)&&(Yi=null),Sd.forEach(E1),jd.forEach(E1)}function D0(n,i){n.blockedOn===i&&(n.blockedOn=null,Vm||(Vm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,gk)))}var R0=null;function C1(n){R0!==n&&(R0=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){R0===n&&(R0=null);for(var i=0;i<n.length;i+=3){var d=n[i],m=n[i+1],b=n[i+2];if(typeof m!="function"){if(Wm(m||d)===null)continue;break}var w=ot(d);w!==null&&(n.splice(i,3),i-=3,$h(w,{pending:!0,data:b,method:d.method,action:m},m,b))}}))}function ql(n){function i(me){return D0(me,n)}Zi!==null&&D0(Zi,n),qi!==null&&D0(qi,n),Yi!==null&&D0(Yi,n),Sd.forEach(i),jd.forEach(i);for(var d=0;d<Xi.length;d++){var m=Xi[d];m.blockedOn===n&&(m.blockedOn=null)}for(;0<Xi.length&&(d=Xi[0],d.blockedOn===null);)T1(d),d.blockedOn===null&&Xi.shift();if(d=(n.ownerDocument||n).$$reactFormReplay,d!=null)for(m=0;m<d.length;m+=3){var b=d[m],w=d[m+1],M=b[Q]||null;if(typeof w=="function")M||C1(d);else if(M){var Z=null;if(w&&w.hasAttribute("formAction")){if(b=w,M=w[Q]||null)Z=M.formAction;else if(Wm(b)!==null)continue}else Z=M.action;typeof Z=="function"?d[m+1]=Z:(d.splice(m,3),m-=3),C1(d)}}}function A1(){function n(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(M){return b=M})},focusReset:"manual",scroll:"manual"})}function i(){b!==null&&(b(),b=null),m||setTimeout(d,20)}function d(){if(!m&&!navigation.transition){var w=navigation.currentEntry;w&&w.url!=null&&navigation.navigate(w.url,{state:w.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,b=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(d,100),function(){m=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),b!==null&&(b(),b=null)}}}function Gm(n){this._internalRoot=n}P0.prototype.render=Gm.prototype.render=function(n){var i=this._internalRoot;if(i===null)throw Error(s(409));var d=i.current,m=_n();_1(d,m,n,i,null,null)},P0.prototype.unmount=Gm.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var i=n.containerInfo;_1(n.current,2,null,n,null,null),p0(),i[F]=null}};function P0(n){this._internalRoot=n}P0.prototype.unstable_scheduleHydration=function(n){if(n){var i=I();n={blockedOn:null,target:n,priority:i};for(var d=0;d<Xi.length&&i!==0&&i<Xi[d].priority;d++);Xi.splice(d,0,n),d===0&&T1(n)}};var O1=t.version;if(O1!=="19.2.1")throw Error(s(527,O1,"19.2.1"));V.findDOMNode=function(n){var i=n._reactInternals;if(i===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=g(i),n=n!==null?x(n):null,n=n===null?null:n.stateNode,n};var pk={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:te,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var F0=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!F0.isDisabled&&F0.supportsFiber)try{da=F0.inject(pk),xe=F0}catch(n){}}return Cd.createRoot=function(n,i){if(!o(n))throw Error(s(299));var d=!1,m="",b=Ix,w=Bx,M=zx;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(m=i.identifierPrefix),i.onUncaughtError!==void 0&&(b=i.onUncaughtError),i.onCaughtError!==void 0&&(w=i.onCaughtError),i.onRecoverableError!==void 0&&(M=i.onRecoverableError)),i=b1(n,1,!1,null,null,d,m,null,b,w,M,A1),n[F]=i.current,Tm(n),new Gm(i)},Cd.hydrateRoot=function(n,i,d){if(!o(n))throw Error(s(299));var m=!1,b="",w=Ix,M=Bx,Z=zx,me=null;return d!=null&&(d.unstable_strictMode===!0&&(m=!0),d.identifierPrefix!==void 0&&(b=d.identifierPrefix),d.onUncaughtError!==void 0&&(w=d.onUncaughtError),d.onCaughtError!==void 0&&(M=d.onCaughtError),d.onRecoverableError!==void 0&&(Z=d.onRecoverableError),d.formState!==void 0&&(me=d.formState)),i=b1(n,1,!0,i,d!=null?d:null,m,b,me,w,M,Z,A1),i.context=v1(null),d=i.current,m=_n(),m=Za(m),b=Ri(m),b.callback=null,Pi(d,b,m),d=m,i.current.lanes=d,Rr(i,d),As(i),n[F]=i.current,Tm(n),new P0(i)},Cd.version="19.2.1",Cd}var W1;function Ak(){if(W1)return Jm.exports;W1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Jm.exports=Ck(),Jm.exports}var Ok=Ak();const Dt=e=>typeof e=="string",Ad=()=>{let e,t;const a=new Promise((s,o)=>{e=s,t=o});return a.resolve=e,a.reject=t,a},V1=e=>e==null?"":""+e,Lk=(e,t,a)=>{e.forEach(s=>{t[s]&&(a[s]=t[s])})},Mk=/###/g,G1=e=>e&&e.indexOf("###")>-1?e.replace(Mk,"."):e,Z1=e=>!e||Dt(e),Id=(e,t,a)=>{const s=Dt(t)?t.split("."):t;let o=0;for(;o<s.length-1;){if(Z1(e))return{};const u=G1(s[o]);!e[u]&&a&&(e[u]=new a),Object.prototype.hasOwnProperty.call(e,u)?e=e[u]:e={},++o}return Z1(e)?{}:{obj:e,k:G1(s[o])}},q1=(e,t,a)=>{const{obj:s,k:o}=Id(e,t,Object);if(s!==void 0||t.length===1){s[o]=a;return}let u=t[t.length-1],c=t.slice(0,t.length-1),f=Id(e,c,Object);for(;f.obj===void 0&&c.length;)u=`${c[c.length-1]}.${u}`,c=c.slice(0,c.length-1),f=Id(e,c,Object),f!=null&&f.obj&&typeof f.obj[`${f.k}.${u}`]!="undefined"&&(f.obj=void 0);f.obj[`${f.k}.${u}`]=a},Dk=(e,t,a,s)=>{const{obj:o,k:u}=Id(e,t,Object);o[u]=o[u]||[],o[u].push(a)},of=(e,t)=>{const{obj:a,k:s}=Id(e,t);if(a&&Object.prototype.hasOwnProperty.call(a,s))return a[s]},Rk=(e,t,a)=>{const s=of(e,a);return s!==void 0?s:of(t,a)},zv=(e,t,a)=>{for(const s in t)s!=="__proto__"&&s!=="constructor"&&(s in e?Dt(e[s])||e[s]instanceof String||Dt(t[s])||t[s]instanceof String?a&&(e[s]=t[s]):zv(e[s],t[s],a):e[s]=t[s]);return e},Xl=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Pk={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Fk=e=>Dt(e)?e.replace(/[&<>"'\/]/g,t=>Pk[t]):e;class Ik{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const a=this.regExpMap.get(t);if(a!==void 0)return a;const s=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,s),this.regExpQueue.push(t),s}}const Bk=[" ",",","?","!",";"],zk=new Ik(20),Uk=(e,t,a)=>{t=t||"",a=a||"";const s=Bk.filter(c=>t.indexOf(c)<0&&a.indexOf(c)<0);if(s.length===0)return!0;const o=zk.getRegExp(`(${s.map(c=>c==="?"?"\\?":c).join("|")})`);let u=!o.test(e);if(!u){const c=e.indexOf(a);c>0&&!o.test(e.substring(0,c))&&(u=!0)}return u},Ng=(e,t,a=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const s=t.split(a);let o=e;for(let u=0;u<s.length;){if(!o||typeof o!="object")return;let c,f="";for(let p=u;p<s.length;++p)if(p!==u&&(f+=a),f+=s[p],c=o[f],c!==void 0){if(["string","number","boolean"].indexOf(typeof c)>-1&&p<s.length-1)continue;u+=p-u+1;break}o=c}return o},Zd=e=>e==null?void 0:e.replace("_","-"),Hk={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){var a,s;(s=(a=console==null?void 0:console[e])==null?void 0:a.apply)==null||s.call(a,console,t)}};class lf{constructor(t,a={}){this.init(t,a)}init(t,a={}){this.prefix=a.prefix||"i18next:",this.logger=t||Hk,this.options=a,this.debug=a.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,a,s,o){return o&&!this.debug?null:(Dt(t[0])&&(t[0]=`${s}${this.prefix} ${t[0]}`),this.logger[a](t))}create(t){return new lf(this.logger,ie({prefix:`${this.prefix}:${t}:`},this.options))}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new lf(this.logger,t)}}var Rs=new lf;class Lf{constructor(){this.observers={}}on(t,a){return t.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const o=this.observers[s].get(a)||0;this.observers[s].set(a,o+1)}),this}off(t,a){if(this.observers[t]){if(!a){delete this.observers[t];return}this.observers[t].delete(a)}}emit(t,...a){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([o,u])=>{for(let c=0;c<u;c++)o(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,u])=>{for(let c=0;c<u;c++)o.apply(o,[t,...a])})}}class Y1 extends Lf{constructor(t,a={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const a=this.options.ns.indexOf(t);a>-1&&this.options.ns.splice(a,1)}getResource(t,a,s,o={}){var g,x;const u=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,c=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let f;t.indexOf(".")>-1?f=t.split("."):(f=[t,a],s&&(Array.isArray(s)?f.push(...s):Dt(s)&&u?f.push(...s.split(u)):f.push(s)));const p=of(this.data,f);return!p&&!a&&!s&&t.indexOf(".")>-1&&(t=f[0],a=f[1],s=f.slice(2).join(".")),p||!c||!Dt(s)?p:Ng((x=(g=this.data)==null?void 0:g[t])==null?void 0:x[a],s,u)}addResource(t,a,s,o,u={silent:!1}){const c=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator;let f=[t,a];s&&(f=f.concat(c?s.split(c):s)),t.indexOf(".")>-1&&(f=t.split("."),o=a,a=f[1]),this.addNamespaces(a),q1(this.data,f,o),u.silent||this.emit("added",t,a,s,o)}addResources(t,a,s,o={silent:!1}){for(const u in s)(Dt(s[u])||Array.isArray(s[u]))&&this.addResource(t,a,u,s[u],{silent:!0});o.silent||this.emit("added",t,a,s)}addResourceBundle(t,a,s,o,u,c={silent:!1,skipCopy:!1}){let f=[t,a];t.indexOf(".")>-1&&(f=t.split("."),o=s,s=a,a=f[1]),this.addNamespaces(a);let p=of(this.data,f)||{};c.skipCopy||(s=JSON.parse(JSON.stringify(s))),o?zv(p,s,u):p=ie(ie({},p),s),q1(this.data,f,p),c.silent||this.emit("added",t,a,s)}removeResourceBundle(t,a){this.hasResourceBundle(t,a)&&delete this.data[t][a],this.removeNamespaces(a),this.emit("removed",t,a)}hasResourceBundle(t,a){return this.getResource(t,a)!==void 0}getResourceBundle(t,a){return a||(a=this.options.defaultNS),this.getResource(t,a)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const a=this.getDataByLanguage(t);return!!(a&&Object.keys(a)||[]).find(o=>a[o]&&Object.keys(a[o]).length>0)}toJSON(){return this.data}}var Uv={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,a,s,o){return e.forEach(u=>{var c,f;t=(f=(c=this.processors[u])==null?void 0:c.process(t,a,s,o))!=null?f:t}),t}};const Hv=Symbol("i18next/PATH_KEY");function $k(){const e=[],t=Object.create(null);let a;return t.get=(s,o)=>{var u;return(u=a==null?void 0:a.revoke)==null||u.call(a),o===Hv?e:(e.push(o),a=Proxy.revocable(s,t),a.proxy)},Proxy.revocable(Object.create(null),t).proxy}function Sg(e,t){var s;const{[Hv]:a}=e($k());return a.join((s=t==null?void 0:t.keySeparator)!=null?s:".")}const X1={},ag=e=>!Dt(e)&&typeof e!="boolean"&&typeof e!="number";class cf extends Lf{constructor(t,a={}){super(),Lk(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Rs.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,a={interpolation:{}}){const s=ie({},a);if(t==null)return!1;const o=this.resolve(t,s);if((o==null?void 0:o.res)===void 0)return!1;const u=ag(o.res);return!(s.returnObjects===!1&&u)}extractFromKey(t,a){let s=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let u=a.ns||this.options.defaultNS||[];const c=s&&t.indexOf(s)>-1,f=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!Uk(t,s,o);if(c&&!f){const p=t.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:t,namespaces:Dt(u)?[u]:u};const g=t.split(s);(s!==o||s===o&&this.options.ns.indexOf(g[0])>-1)&&(u=g.shift()),t=g.join(o)}return{key:t,namespaces:Dt(u)?[u]:u}}translate(t,a,s){let o=typeof a=="object"?ie({},a):a;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof o=="object"&&(o=ie({},o)),o||(o={}),t==null)return"";typeof t=="function"&&(t=Sg(t,ie(ie({},this.options),o))),Array.isArray(t)||(t=[String(t)]);const u=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:f,namespaces:p}=this.extractFromKey(t[t.length-1],o),g=p[p.length-1];let x=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;x===void 0&&(x=":");const v=o.lng||this.language,_=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((v==null?void 0:v.toLowerCase())==="cimode")return _?u?{res:`${g}${x}${f}`,usedKey:f,exactUsedKey:f,usedLng:v,usedNS:g,usedParams:this.getUsedParamsDetails(o)}:`${g}${x}${f}`:u?{res:f,usedKey:f,exactUsedKey:f,usedLng:v,usedNS:g,usedParams:this.getUsedParamsDetails(o)}:f;const k=this.resolve(t,o);let T=k==null?void 0:k.res;const N=(k==null?void 0:k.usedKey)||f,j=(k==null?void 0:k.exactUsedKey)||f,P=["[object Number]","[object Function]","[object RegExp]"],C=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject,R=o.count!==void 0&&!Dt(o.count),U=cf.hasDefaultValue(o),H=R?this.pluralResolver.getSuffix(v,o.count,o):"",B=o.ordinal&&R?this.pluralResolver.getSuffix(v,o.count,{ordinal:!1}):"",oe=R&&!o.ordinal&&o.count===0,se=oe&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${H}`]||o[`defaultValue${B}`]||o.defaultValue;let pe=T;O&&!T&&U&&(pe=se);const le=ag(pe),re=Object.prototype.toString.apply(pe);if(O&&pe&&le&&P.indexOf(re)<0&&!(Dt(C)&&Array.isArray(pe))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const de=this.options.returnedObjectHandler?this.options.returnedObjectHandler(N,pe,Le(ie({},o),{ns:p})):`key '${f} (${this.language})' returned an object instead of string.`;return u?(k.res=de,k.usedParams=this.getUsedParamsDetails(o),k):de}if(c){const de=Array.isArray(pe),ye=de?[]:{},ue=de?j:N;for(const te in pe)if(Object.prototype.hasOwnProperty.call(pe,te)){const V=`${ue}${c}${te}`;U&&!T?ye[te]=this.translate(V,Le(ie({},o),{defaultValue:ag(se)?se[te]:void 0,joinArrays:!1,ns:p})):ye[te]=this.translate(V,Le(ie({},o),{joinArrays:!1,ns:p})),ye[te]===V&&(ye[te]=pe[te])}T=ye}}else if(O&&Dt(C)&&Array.isArray(T))T=T.join(C),T&&(T=this.extendTranslation(T,t,o,s));else{let de=!1,ye=!1;!this.isValidLookup(T)&&U&&(de=!0,T=se),this.isValidLookup(T)||(ye=!0,T=f);const te=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&ye?void 0:T,V=U&&se!==T&&this.options.updateMissing;if(ye||de||V){if(this.logger.log(V?"updateKey":"missingKey",v,g,f,V?se:T),c){const z=this.resolve(f,Le(ie({},o),{keySeparator:!1}));z&&z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let J=[];const ne=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ne&&ne[0])for(let z=0;z<ne.length;z++)J.push(ne[z]);else this.options.saveMissingTo==="all"?J=this.languageUtils.toResolveHierarchy(o.lng||this.language):J.push(o.lng||this.language);const ae=(z,D,G)=>{var K;const q=U&&G!==T?G:te;this.options.missingKeyHandler?this.options.missingKeyHandler(z,g,D,q,V,o):(K=this.backendConnector)!=null&&K.saveMissing&&this.backendConnector.saveMissing(z,g,D,q,V,o),this.emit("missingKey",z,g,D,T)};this.options.saveMissing&&(this.options.saveMissingPlurals&&R?J.forEach(z=>{const D=this.pluralResolver.getSuffixes(z,o);oe&&o[`defaultValue${this.options.pluralSeparator}zero`]&&D.indexOf(`${this.options.pluralSeparator}zero`)<0&&D.push(`${this.options.pluralSeparator}zero`),D.forEach(G=>{ae([z],f+G,o[`defaultValue${G}`]||se)})}):ae(J,f,se))}T=this.extendTranslation(T,t,o,k,s),ye&&T===f&&this.options.appendNamespaceToMissingKey&&(T=`${g}${x}${f}`),(ye||de)&&this.options.parseMissingKeyHandler&&(T=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${g}${x}${f}`:f,de?T:void 0,o))}return u?(k.res=T,k.usedParams=this.getUsedParamsDetails(o),k):T}extendTranslation(t,a,s,o,u){var p,g;if((p=this.i18nFormat)!=null&&p.parse)t=this.i18nFormat.parse(t,ie(ie({},this.options.interpolation.defaultVariables),s),s.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init(Le(ie({},s),{interpolation:ie(ie({},this.options.interpolation),s.interpolation)}));const x=Dt(t)&&(((g=s==null?void 0:s.interpolation)==null?void 0:g.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let v;if(x){const k=t.match(this.interpolator.nestingRegexp);v=k&&k.length}let _=s.replace&&!Dt(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(_=ie(ie({},this.options.interpolation.defaultVariables),_)),t=this.interpolator.interpolate(t,_,s.lng||this.language||o.usedLng,s),x){const k=t.match(this.interpolator.nestingRegexp),T=k&&k.length;v<T&&(s.nest=!1)}!s.lng&&o&&o.res&&(s.lng=this.language||o.usedLng),s.nest!==!1&&(t=this.interpolator.nest(t,(...k)=>(u==null?void 0:u[0])===k[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${k[0]} in key: ${a[0]}`),null):this.translate(...k,a),s)),s.interpolation&&this.interpolator.reset()}const c=s.postProcess||this.options.postProcess,f=Dt(c)?[c]:c;return t!=null&&(f!=null&&f.length)&&s.applyPostProcessor!==!1&&(t=Uv.handle(f,t,a,this.options&&this.options.postProcessPassResolved?ie({i18nResolved:Le(ie({},o),{usedParams:this.getUsedParamsDetails(s)})},s):s,this)),t}resolve(t,a={}){let s,o,u,c,f;return Dt(t)&&(t=[t]),t.forEach(p=>{if(this.isValidLookup(s))return;const g=this.extractFromKey(p,a),x=g.key;o=x;let v=g.namespaces;this.options.fallbackNS&&(v=v.concat(this.options.fallbackNS));const _=a.count!==void 0&&!Dt(a.count),k=_&&!a.ordinal&&a.count===0,T=a.context!==void 0&&(Dt(a.context)||typeof a.context=="number")&&a.context!=="",N=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);v.forEach(j=>{var P,C;this.isValidLookup(s)||(f=j,!X1[`${N[0]}-${j}`]&&((P=this.utils)!=null&&P.hasLoadedNamespace)&&!((C=this.utils)!=null&&C.hasLoadedNamespace(f))&&(X1[`${N[0]}-${j}`]=!0,this.logger.warn(`key "${o}" for languages "${N.join(", ")}" won't get resolved as namespace "${f}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),N.forEach(O=>{var H;if(this.isValidLookup(s))return;c=O;const R=[x];if((H=this.i18nFormat)!=null&&H.addLookupKeys)this.i18nFormat.addLookupKeys(R,x,O,j,a);else{let B;_&&(B=this.pluralResolver.getSuffix(O,a.count,a));const oe=`${this.options.pluralSeparator}zero`,se=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(_&&(a.ordinal&&B.indexOf(se)===0&&R.push(x+B.replace(se,this.options.pluralSeparator)),R.push(x+B),k&&R.push(x+oe)),T){const pe=`${x}${this.options.contextSeparator||"_"}${a.context}`;R.push(pe),_&&(a.ordinal&&B.indexOf(se)===0&&R.push(pe+B.replace(se,this.options.pluralSeparator)),R.push(pe+B),k&&R.push(pe+oe))}}let U;for(;U=R.pop();)this.isValidLookup(s)||(u=U,s=this.getResource(O,j,U,a))}))})}),{res:s,usedKey:o,exactUsedKey:u,usedLng:c,usedNS:f}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,a,s,o={}){var u;return(u=this.i18nFormat)!=null&&u.getResource?this.i18nFormat.getResource(t,a,s,o):this.resourceStore.getResource(t,a,s,o)}getUsedParamsDetails(t={}){const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=t.replace&&!Dt(t.replace);let o=s?t.replace:t;if(s&&typeof t.count!="undefined"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o=ie(ie({},this.options.interpolation.defaultVariables),o)),!s){o=ie({},o);for(const u of a)delete o[u]}return o}static hasDefaultValue(t){const a="defaultValue";for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&a===s.substring(0,a.length)&&t[s]!==void 0)return!0;return!1}}class K1{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Rs.create("languageUtils")}getScriptPartFromCode(t){if(t=Zd(t),!t||t.indexOf("-")<0)return null;const a=t.split("-");return a.length===2||(a.pop(),a[a.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(a.join("-"))}getLanguagePartFromCode(t){if(t=Zd(t),!t||t.indexOf("-")<0)return t;const a=t.split("-");return this.formatLanguageCode(a[0])}formatLanguageCode(t){if(Dt(t)&&t.indexOf("-")>-1){let a;try{a=Intl.getCanonicalLocales(t)[0]}catch(s){}return a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let a;return t.forEach(s=>{if(a)return;const o=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(o))&&(a=o)}),!a&&this.options.supportedLngs&&t.forEach(s=>{if(a)return;const o=this.getScriptPartFromCode(s);if(this.isSupportedCode(o))return a=o;const u=this.getLanguagePartFromCode(s);if(this.isSupportedCode(u))return a=u;a=this.options.supportedLngs.find(c=>{if(c===u)return c;if(!(c.indexOf("-")<0&&u.indexOf("-")<0)&&(c.indexOf("-")>0&&u.indexOf("-")<0&&c.substring(0,c.indexOf("-"))===u||c.indexOf(u)===0&&u.length>1))return c})}),a||(a=this.getFallbackCodes(this.options.fallbackLng)[0]),a}getFallbackCodes(t,a){if(!t)return[];if(typeof t=="function"&&(t=t(a)),Dt(t)&&(t=[t]),Array.isArray(t))return t;if(!a)return t.default||[];let s=t[a];return s||(s=t[this.getScriptPartFromCode(a)]),s||(s=t[this.formatLanguageCode(a)]),s||(s=t[this.getLanguagePartFromCode(a)]),s||(s=t.default),s||[]}toResolveHierarchy(t,a){const s=this.getFallbackCodes((a===!1?[]:a)||this.options.fallbackLng||[],t),o=[],u=c=>{c&&(this.isSupportedCode(c)?o.push(c):this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`))};return Dt(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&u(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&u(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&u(this.getLanguagePartFromCode(t))):Dt(t)&&u(this.formatLanguageCode(t)),s.forEach(c=>{o.indexOf(c)<0&&u(this.formatLanguageCode(c))}),o}}const J1={zero:0,one:1,two:2,few:3,many:4,other:5},Q1={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Wk{constructor(t,a={}){this.languageUtils=t,this.options=a,this.logger=Rs.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,a){this.rules[t]=a}clearCache(){this.pluralRulesCache={}}getRule(t,a={}){const s=Zd(t==="dev"?"en":t),o=a.ordinal?"ordinal":"cardinal",u=JSON.stringify({cleanedCode:s,type:o});if(u in this.pluralRulesCache)return this.pluralRulesCache[u];let c;try{c=new Intl.PluralRules(s,{type:o})}catch(f){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Q1;if(!t.match(/-|_/))return Q1;const p=this.languageUtils.getLanguagePartFromCode(t);c=this.getRule(p,a)}return this.pluralRulesCache[u]=c,c}needsPlural(t,a={}){let s=this.getRule(t,a);return s||(s=this.getRule("dev",a)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,a,s={}){return this.getSuffixes(t,s).map(o=>`${a}${o}`)}getSuffixes(t,a={}){let s=this.getRule(t,a);return s||(s=this.getRule("dev",a)),s?s.resolvedOptions().pluralCategories.sort((o,u)=>J1[o]-J1[u]).map(o=>`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,a,s={}){const o=this.getRule(t,s);return o?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${o.select(a)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",a,s))}}const eb=(e,t,a,s=".",o=!0)=>{let u=Rk(e,t,a);return!u&&o&&Dt(a)&&(u=Ng(e,a,s),u===void 0&&(u=Ng(t,a,s))),u},rg=e=>e.replace(/\$/g,"$$$$");class tb{constructor(t={}){var a;this.logger=Rs.create("interpolator"),this.options=t,this.format=((a=t==null?void 0:t.interpolation)==null?void 0:a.format)||(s=>s),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:a,escapeValue:s,useRawValueToEscape:o,prefix:u,prefixEscaped:c,suffix:f,suffixEscaped:p,formatSeparator:g,unescapeSuffix:x,unescapePrefix:v,nestingPrefix:_,nestingPrefixEscaped:k,nestingSuffix:T,nestingSuffixEscaped:N,nestingOptionsSeparator:j,maxReplaces:P,alwaysFormat:C}=t.interpolation;this.escape=a!==void 0?a:Fk,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=u?Xl(u):c||"{{",this.suffix=f?Xl(f):p||"}}",this.formatSeparator=g||",",this.unescapePrefix=x?"":v||"-",this.unescapeSuffix=this.unescapePrefix?"":x||"",this.nestingPrefix=_?Xl(_):k||Xl("$t("),this.nestingSuffix=T?Xl(T):N||Xl(")"),this.nestingOptionsSeparator=j||",",this.maxReplaces=P||1e3,this.alwaysFormat=C!==void 0?C:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(a,s)=>(a==null?void 0:a.source)===s?(a.lastIndex=0,a):new RegExp(s,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,a,s,o){var k;let u,c,f;const p=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},g=T=>{if(T.indexOf(this.formatSeparator)<0){const C=eb(a,p,T,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,s,Le(ie(ie({},o),a),{interpolationkey:T})):C}const N=T.split(this.formatSeparator),j=N.shift().trim(),P=N.join(this.formatSeparator).trim();return this.format(eb(a,p,j,this.options.keySeparator,this.options.ignoreJSONStructure),P,s,Le(ie(ie({},o),a),{interpolationkey:j}))};this.resetRegExp();const x=(o==null?void 0:o.missingInterpolationHandler)||this.options.missingInterpolationHandler,v=((k=o==null?void 0:o.interpolation)==null?void 0:k.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:T=>rg(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?rg(this.escape(T)):rg(T)}].forEach(T=>{for(f=0;u=T.regex.exec(t);){const N=u[1].trim();if(c=g(N),c===void 0)if(typeof x=="function"){const P=x(t,u,o);c=Dt(P)?P:""}else if(o&&Object.prototype.hasOwnProperty.call(o,N))c="";else if(v){c=u[0];continue}else this.logger.warn(`missed to pass in variable ${N} for interpolating ${t}`),c="";else!Dt(c)&&!this.useRawValueToEscape&&(c=V1(c));const j=T.safeValue(c);if(t=t.replace(u[0],j),v?(T.regex.lastIndex+=c.length,T.regex.lastIndex-=u[0].length):T.regex.lastIndex=0,f++,f>=this.maxReplaces)break}}),t}nest(t,a,s={}){let o,u,c;const f=(p,g)=>{var N;const x=this.nestingOptionsSeparator;if(p.indexOf(x)<0)return p;const v=p.split(new RegExp(`${x}[ ]*{`));let _=`{${v[1]}`;p=v[0],_=this.interpolate(_,c);const k=_.match(/'/g),T=_.match(/"/g);(((N=k==null?void 0:k.length)!=null?N:0)%2===0&&!T||T.length%2!==0)&&(_=_.replace(/'/g,'"'));try{c=JSON.parse(_),g&&(c=ie(ie({},g),c))}catch(j){return this.logger.warn(`failed parsing options string in nesting for key ${p}`,j),`${p}${x}${_}`}return c.defaultValue&&c.defaultValue.indexOf(this.prefix)>-1&&delete c.defaultValue,p};for(;o=this.nestingRegexp.exec(t);){let p=[];c=ie({},s),c=c.replace&&!Dt(c.replace)?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;const g=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(g!==-1&&(p=o[1].slice(g).split(this.formatSeparator).map(x=>x.trim()).filter(Boolean),o[1]=o[1].slice(0,g)),u=a(f.call(this,o[1].trim(),c),c),u&&o[0]===t&&!Dt(u))return u;Dt(u)||(u=V1(u)),u||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),u=""),p.length&&(u=p.reduce((x,v)=>this.format(x,v,s.lng,Le(ie({},s),{interpolationkey:o[1].trim()})),u.trim())),t=t.replace(o[0],u),this.regexp.lastIndex=0}return t}}const Vk=e=>{let t=e.toLowerCase().trim();const a={};if(e.indexOf("(")>-1){const s=e.split("(");t=s[0].toLowerCase().trim();const o=s[1].substring(0,s[1].length-1);t==="currency"&&o.indexOf(":")<0?a.currency||(a.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?a.range||(a.range=o.trim()):o.split(";").forEach(c=>{if(c){const[f,...p]=c.split(":"),g=p.join(":").trim().replace(/^'+|'+$/g,""),x=f.trim();a[x]||(a[x]=g),g==="false"&&(a[x]=!1),g==="true"&&(a[x]=!0),isNaN(g)||(a[x]=parseInt(g,10))}})}return{formatName:t,formatOptions:a}},ab=e=>{const t={};return(a,s,o)=>{let u=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(u=Le(ie({},u),{[o.interpolationkey]:void 0}));const c=s+JSON.stringify(u);let f=t[c];return f||(f=e(Zd(s),o),t[c]=f),f(a)}},Gk=e=>(t,a,s)=>e(Zd(a),s)(t);class Zk{constructor(t={}){this.logger=Rs.create("formatter"),this.options=t,this.init(t)}init(t,a={interpolation:{}}){this.formatSeparator=a.interpolation.formatSeparator||",";const s=a.cacheInBuiltFormats?ab:Gk;this.formats={number:s((o,u)=>{const c=new Intl.NumberFormat(o,ie({},u));return f=>c.format(f)}),currency:s((o,u)=>{const c=new Intl.NumberFormat(o,Le(ie({},u),{style:"currency"}));return f=>c.format(f)}),datetime:s((o,u)=>{const c=new Intl.DateTimeFormat(o,ie({},u));return f=>c.format(f)}),relativetime:s((o,u)=>{const c=new Intl.RelativeTimeFormat(o,ie({},u));return f=>c.format(f,u.range||"day")}),list:s((o,u)=>{const c=new Intl.ListFormat(o,ie({},u));return f=>c.format(f)})}}add(t,a){this.formats[t.toLowerCase().trim()]=a}addCached(t,a){this.formats[t.toLowerCase().trim()]=ab(a)}format(t,a,s,o={}){const u=a.split(this.formatSeparator);if(u.length>1&&u[0].indexOf("(")>1&&u[0].indexOf(")")<0&&u.find(f=>f.indexOf(")")>-1)){const f=u.findIndex(p=>p.indexOf(")")>-1);u[0]=[u[0],...u.splice(1,f)].join(this.formatSeparator)}return u.reduce((f,p)=>{var v;const{formatName:g,formatOptions:x}=Vk(p);if(this.formats[g]){let _=f;try{const k=((v=o==null?void 0:o.formatParams)==null?void 0:v[o.interpolationkey])||{},T=k.locale||k.lng||o.locale||o.lng||s;_=this.formats[g](f,T,ie(ie(ie({},x),o),k))}catch(k){this.logger.warn(k)}return _}else this.logger.warn(`there was no format function for ${g}`);return f},t)}}const qk=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class Yk extends Lf{constructor(t,a,s,o={}){var u,c;super(),this.backend=t,this.store=a,this.services=s,this.languageUtils=s.languageUtils,this.options=o,this.logger=Rs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],(c=(u=this.backend)==null?void 0:u.init)==null||c.call(u,s,o.backend,o)}queueLoad(t,a,s,o){const u={},c={},f={},p={};return t.forEach(g=>{let x=!0;a.forEach(v=>{const _=`${g}|${v}`;!s.reload&&this.store.hasResourceBundle(g,v)?this.state[_]=2:this.state[_]<0||(this.state[_]===1?c[_]===void 0&&(c[_]=!0):(this.state[_]=1,x=!1,c[_]===void 0&&(c[_]=!0),u[_]===void 0&&(u[_]=!0),p[v]===void 0&&(p[v]=!0)))}),x||(f[g]=!0)}),(Object.keys(u).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(u),pending:Object.keys(c),toLoadLanguages:Object.keys(f),toLoadNamespaces:Object.keys(p)}}loaded(t,a,s){const o=t.split("|"),u=o[0],c=o[1];a&&this.emit("failedLoading",u,c,a),!a&&s&&this.store.addResourceBundle(u,c,s,void 0,void 0,{skipCopy:!0}),this.state[t]=a?-1:2,a&&s&&(this.state[t]=0);const f={};this.queue.forEach(p=>{Dk(p.loaded,[u],c),qk(p,t),a&&p.errors.push(a),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(g=>{f[g]||(f[g]={});const x=p.loaded[g];x.length&&x.forEach(v=>{f[g][v]===void 0&&(f[g][v]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",f),this.queue=this.queue.filter(p=>!p.done)}read(t,a,s,o=0,u=this.retryTimeout,c){if(!t.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:a,fcName:s,tried:o,wait:u,callback:c});return}this.readingCalls++;const f=(g,x)=>{if(this.readingCalls--,this.waitingReads.length>0){const v=this.waitingReads.shift();this.read(v.lng,v.ns,v.fcName,v.tried,v.wait,v.callback)}if(g&&x&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,a,s,o+1,u*2,c)},u);return}c(g,x)},p=this.backend[s].bind(this.backend);if(p.length===2){try{const g=p(t,a);g&&typeof g.then=="function"?g.then(x=>f(null,x)).catch(f):f(null,g)}catch(g){f(g)}return}return p(t,a,f)}prepareLoading(t,a,s={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();Dt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),Dt(a)&&(a=[a]);const u=this.queueLoad(t,a,s,o);if(!u.toLoad.length)return u.pending.length||o(),null;u.toLoad.forEach(c=>{this.loadOne(c)})}load(t,a,s){this.prepareLoading(t,a,{},s)}reload(t,a,s){this.prepareLoading(t,a,{reload:!0},s)}loadOne(t,a=""){const s=t.split("|"),o=s[0],u=s[1];this.read(o,u,"read",void 0,void 0,(c,f)=>{c&&this.logger.warn(`${a}loading namespace ${u} for language ${o} failed`,c),!c&&f&&this.logger.log(`${a}loaded namespace ${u} for language ${o}`,f),this.loaded(t,c,f)})}saveMissing(t,a,s,o,u,c={},f=()=>{}){var p,g,x,v,_;if((g=(p=this.services)==null?void 0:p.utils)!=null&&g.hasLoadedNamespace&&!((v=(x=this.services)==null?void 0:x.utils)!=null&&v.hasLoadedNamespace(a))){this.logger.warn(`did not save key "${s}" as the namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if((_=this.backend)!=null&&_.create){const k=Le(ie({},c),{isUpdate:u}),T=this.backend.create.bind(this.backend);if(T.length<6)try{let N;T.length===5?N=T(t,a,s,o,k):N=T(t,a,s,o),N&&typeof N.then=="function"?N.then(j=>f(null,j)).catch(f):f(null,N)}catch(N){f(N)}else T(t,a,s,o,f,k)}!t||!t[0]||this.store.addResource(t[0],a,s,o)}}}const rb=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),Dt(e[1])&&(t.defaultValue=e[1]),Dt(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const a=e[3]||e[2];Object.keys(a).forEach(s=>{t[s]=a[s]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),nb=e=>{var t,a;return Dt(e.ns)&&(e.ns=[e.ns]),Dt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Dt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),((a=(t=e.supportedLngs)==null?void 0:t.indexOf)==null?void 0:a.call(t,"cimode"))<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e},B0=()=>{},Xk=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(a=>{typeof e[a]=="function"&&(e[a]=e[a].bind(e))})};class Bd extends Lf{constructor(t={},a){if(super(),this.options=nb(t),this.services={},this.logger=Rs,this.modules={external:[]},Xk(this),a&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,a),this;setTimeout(()=>{this.init(t,a)},0)}}init(t={},a){this.isInitializing=!0,typeof t=="function"&&(a=t,t={}),t.defaultNS==null&&t.ns&&(Dt(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const s=rb();this.options=ie(ie(ie({},s),this.options),nb(t)),this.options.interpolation=ie(ie({},s.interpolation),this.options.interpolation),t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler);const o=g=>g?typeof g=="function"?new g:g:null;if(!this.options.isClone){this.modules.logger?Rs.init(o(this.modules.logger),this.options):Rs.init(null,this.options);let g;this.modules.formatter?g=this.modules.formatter:g=Zk;const x=new K1(this.options);this.store=new Y1(this.options.resources,this.options);const v=this.services;v.logger=Rs,v.resourceStore=this.store,v.languageUtils=x,v.pluralResolver=new Wk(x,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==s.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),g&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(v.formatter=o(g),v.formatter.init&&v.formatter.init(v,this.options),this.options.interpolation.format=v.formatter.format.bind(v.formatter)),v.interpolator=new tb(this.options),v.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},v.backendConnector=new Yk(o(this.modules.backend),v.resourceStore,v,this.options),v.backendConnector.on("*",(k,...T)=>{this.emit(k,...T)}),this.modules.languageDetector&&(v.languageDetector=o(this.modules.languageDetector),v.languageDetector.init&&v.languageDetector.init(v,this.options.detection,this.options)),this.modules.i18nFormat&&(v.i18nFormat=o(this.modules.i18nFormat),v.i18nFormat.init&&v.i18nFormat.init(this)),this.translator=new cf(this.services,this.options),this.translator.on("*",(k,...T)=>{this.emit(k,...T)}),this.modules.external.forEach(k=>{k.init&&k.init(this)})}if(this.format=this.options.interpolation.format,a||(a=B0),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const g=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);g.length>0&&g[0]!=="dev"&&(this.options.lng=g[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(g=>{this[g]=(...x)=>this.store[g](...x)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(g=>{this[g]=(...x)=>(this.store[g](...x),this)});const f=Ad(),p=()=>{const g=(x,v)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),f.resolve(v),a(x,v)};if(this.languages&&!this.isInitialized)return g(null,this.t.bind(this));this.changeLanguage(this.options.lng,g)};return this.options.resources||!this.options.initAsync?p():setTimeout(p,0),f}loadResources(t,a=B0){var u,c;let s=a;const o=Dt(t)?t:this.language;if(typeof t=="function"&&(s=t),!this.options.resources||this.options.partialBundledLanguages){if((o==null?void 0:o.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const f=[],p=g=>{if(!g||g==="cimode")return;this.services.languageUtils.toResolveHierarchy(g).forEach(v=>{v!=="cimode"&&f.indexOf(v)<0&&f.push(v)})};o?p(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(x=>p(x)),(c=(u=this.options.preload)==null?void 0:u.forEach)==null||c.call(u,g=>p(g)),this.services.backendConnector.load(f,this.options.ns,g=>{!g&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(g)})}else s(null)}reloadResources(t,a,s){const o=Ad();return typeof t=="function"&&(s=t,t=void 0),typeof a=="function"&&(s=a,a=void 0),t||(t=this.languages),a||(a=this.options.ns),s||(s=B0),this.services.backendConnector.reload(t,a,u=>{o.resolve(),s(u)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Uv.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let a=0;a<this.languages.length;a++){const s=this.languages[a];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,a){this.isLanguageChangingTo=t;const s=Ad();this.emit("languageChanging",t);const o=f=>{this.language=f,this.languages=this.services.languageUtils.toResolveHierarchy(f),this.resolvedLanguage=void 0,this.setResolvedLanguage(f)},u=(f,p)=>{p?this.isLanguageChangingTo===t&&(o(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,s.resolve((...g)=>this.t(...g)),a&&a(f,(...g)=>this.t(...g))},c=f=>{var x,v;!t&&!f&&this.services.languageDetector&&(f=[]);const p=Dt(f)?f:f&&f[0],g=this.store.hasLanguageSomeTranslations(p)?p:this.services.languageUtils.getBestMatchFromCodes(Dt(f)?[f]:f);g&&(this.language||o(g),this.translator.language||this.translator.changeLanguage(g),(v=(x=this.services.languageDetector)==null?void 0:x.cacheUserLanguage)==null||v.call(x,g)),this.loadResources(g,_=>{u(_,g)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(t),s}getFixedT(t,a,s){const o=(u,c,...f)=>{let p;typeof c!="object"?p=this.options.overloadTranslationOptionHandler([u,c].concat(f)):p=ie({},c),p.lng=p.lng||o.lng,p.lngs=p.lngs||o.lngs,p.ns=p.ns||o.ns,p.keyPrefix!==""&&(p.keyPrefix=p.keyPrefix||s||o.keyPrefix);const g=this.options.keySeparator||".";let x;return p.keyPrefix&&Array.isArray(u)?x=u.map(v=>(typeof v=="function"&&(v=Sg(v,ie(ie({},this.options),c))),`${p.keyPrefix}${g}${v}`)):(typeof u=="function"&&(u=Sg(u,ie(ie({},this.options),c))),x=p.keyPrefix?`${p.keyPrefix}${g}${u}`:u),this.t(x,p)};return Dt(t)?o.lng=t:o.lngs=t,o.ns=a,o.keyPrefix=s,o}t(...t){var a;return(a=this.translator)==null?void 0:a.translate(...t)}exists(...t){var a;return(a=this.translator)==null?void 0:a.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,a={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=a.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,u=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const c=(f,p)=>{const g=this.services.backendConnector.state[`${f}|${p}`];return g===-1||g===0||g===2};if(a.precheck){const f=a.precheck(this,c);if(f!==void 0)return f}return!!(this.hasResourceBundle(s,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(s,t)&&(!o||c(u,t)))}loadNamespaces(t,a){const s=Ad();return this.options.ns?(Dt(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{s.resolve(),a&&a(o)}),s):(a&&a(),Promise.resolve())}loadLanguages(t,a){const s=Ad();Dt(t)&&(t=[t]);const o=this.options.preload||[],u=t.filter(c=>o.indexOf(c)<0&&this.services.languageUtils.isSupportedCode(c));return u.length?(this.options.preload=o.concat(u),this.loadResources(c=>{s.resolve(),a&&a(c)}),s):(a&&a(),Promise.resolve())}dir(t){var o,u;if(t||(t=this.resolvedLanguage||(((o=this.languages)==null?void 0:o.length)>0?this.languages[0]:this.language)),!t)return"rtl";try{const c=new Intl.Locale(t);if(c&&c.getTextInfo){const f=c.getTextInfo();if(f&&f.direction)return f.direction}}catch(c){}const a=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=((u=this.services)==null?void 0:u.languageUtils)||new K1(rb());return t.toLowerCase().indexOf("-latn")>1?"ltr":a.indexOf(s.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},a){const s=new Bd(t,a);return s.createInstance=Bd.createInstance,s}cloneInstance(t={},a=B0){const s=t.forkResourceStore;s&&delete t.forkResourceStore;const o=Le(ie(ie({},this.options),t),{isClone:!0}),u=new Bd(o);if((t.debug!==void 0||t.prefix!==void 0)&&(u.logger=u.logger.clone(t)),["store","services","language"].forEach(f=>{u[f]=this[f]}),u.services=ie({},this.services),u.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},s){const f=Object.keys(this.store.data).reduce((p,g)=>(p[g]=ie({},this.store.data[g]),p[g]=Object.keys(p[g]).reduce((x,v)=>(x[v]=ie({},p[g][v]),x),p[g]),p),{});u.store=new Y1(f,o),u.services.resourceStore=u.store}return t.interpolation&&(u.services.interpolator=new tb(o)),u.translator=new cf(u.services,o),u.translator.on("*",(f,...p)=>{u.emit(f,...p)}),u.init(o,a),u.translator.options=o,u.translator.backendConnector.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},u}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const gr=Bd.createInstance();gr.createInstance;gr.dir;gr.init;gr.loadResources;gr.reloadResources;gr.use;gr.changeLanguage;gr.getFixedT;gr.t;gr.exists;gr.setDefaultNamespace;gr.hasLoadedNamespace;gr.loadNamespaces;gr.loadLanguages;const Kk=(e,t,a,s)=>{var u,c,f,p;const o=[a,ie({code:t},s||{})];if((c=(u=e==null?void 0:e.services)==null?void 0:u.logger)!=null&&c.forward)return e.services.logger.forward(o,"warn","react-i18next::",!0);Yo(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),(p=(f=e==null?void 0:e.services)==null?void 0:f.logger)!=null&&p.warn?e.services.logger.warn(...o):console!=null&&console.warn&&console.warn(...o)},sb={},$v=(e,t,a,s)=>{Yo(a)&&sb[a]||(Yo(a)&&(sb[a]=new Date),Kk(e,t,a,s))},Wv=(e,t)=>()=>{if(e.isInitialized)t();else{const a=()=>{setTimeout(()=>{e.off("initialized",a)},0),t()};e.on("initialized",a)}},jg=(e,t,a)=>{e.loadNamespaces(t,Wv(e,a))},ib=(e,t,a,s)=>{if(Yo(a)&&(a=[a]),e.options.preload&&e.options.preload.indexOf(t)>-1)return jg(e,a,s);a.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,Wv(e,s))},Jk=(e,t,a={})=>!t.languages||!t.languages.length?($v(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:a.lng,precheck:(s,o)=>{if(a.bindI18n&&a.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!o(s.isLanguageChangingTo,e))return!1}}),Yo=e=>typeof e=="string",Qk=e=>typeof e=="object"&&e!==null,e3=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,t3={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},a3=e=>t3[e],r3=e=>e.replace(e3,a3);let Tg={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:r3};const n3=(e={})=>{Tg=ie(ie({},Tg),e)},s3=()=>Tg;let Vv;const i3=e=>{Vv=e},o3=()=>Vv,l3={type:"3rdParty",init(e){n3(e.options.react),i3(e)}},c3=E.createContext();class d3{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(a=>{this.usedNamespaces[a]||(this.usedNamespaces[a]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var ng={exports:{}},sg={};var ob;function u3(){if(ob)return sg;ob=1;var e=Of();function t(v,_){return v===_&&(v!==0||1/v===1/_)||v!==v&&_!==_}var a=typeof Object.is=="function"?Object.is:t,s=e.useState,o=e.useEffect,u=e.useLayoutEffect,c=e.useDebugValue;function f(v,_){var k=_(),T=s({inst:{value:k,getSnapshot:_}}),N=T[0].inst,j=T[1];return u(function(){N.value=k,N.getSnapshot=_,p(N)&&j({inst:N})},[v,k,_]),o(function(){return p(N)&&j({inst:N}),v(function(){p(N)&&j({inst:N})})},[v]),c(k),k}function p(v){var _=v.getSnapshot;v=v.value;try{var k=_();return!a(v,k)}catch(T){return!0}}function g(v,_){return _()}var x=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?g:f;return sg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,sg}var lb;function f3(){return lb||(lb=1,ng.exports=u3()),ng.exports}var h3=f3();const m3=(e,t)=>Yo(t)?t:Qk(t)&&Yo(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,g3={t:m3,ready:!1},p3=()=>()=>{},ln=(e,t={})=>{var se,pe,le;const{i18n:a}=t,{i18n:s,defaultNS:o}=E.useContext(c3)||{},u=a||s||o3();u&&!u.reportNamespaces&&(u.reportNamespaces=new d3),u||$v(u,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const c=E.useMemo(()=>{var re;return ie(ie(ie({},s3()),(re=u==null?void 0:u.options)==null?void 0:re.react),t)},[u,t]),{useSuspense:f,keyPrefix:p}=c,g=o||((se=u==null?void 0:u.options)==null?void 0:se.defaultNS),x=Yo(g)?[g]:g||["translation"],v=E.useMemo(()=>x,x);(le=(pe=u==null?void 0:u.reportNamespaces)==null?void 0:pe.addUsedNamespaces)==null||le.call(pe,v);const _=E.useRef(0),k=E.useCallback(re=>{if(!u)return p3;const{bindI18n:de,bindI18nStore:ye}=c,ue=()=>{_.current+=1,re()};return de&&u.on(de,ue),ye&&u.store.on(ye,ue),()=>{de&&de.split(" ").forEach(te=>u.off(te,ue)),ye&&ye.split(" ").forEach(te=>u.store.off(te,ue))}},[u,c]),T=E.useRef(),N=E.useCallback(()=>{if(!u)return g3;const re=!!(u.isInitialized||u.initializedStoreOnce)&&v.every(J=>Jk(J,u,c)),de=t.lng||u.language,ye=_.current,ue=T.current;if(ue&&ue.ready===re&&ue.lng===de&&ue.keyPrefix===p&&ue.revision===ye)return ue;const V={t:u.getFixedT(de,c.nsMode==="fallback"?v:v[0],p),ready:re,lng:de,keyPrefix:p,revision:ye};return T.current=V,V},[u,v,p,c,t.lng]),[j,P]=E.useState(0),{t:C,ready:O}=h3.useSyncExternalStore(k,N,N);E.useEffect(()=>{if(u&&!O&&!f){const re=()=>P(de=>de+1);t.lng?ib(u,t.lng,v,re):jg(u,v,re)}},[u,t.lng,v,O,f,j]);const R=u||{},U=E.useRef(null),H=E.useRef(),B=re=>{const de=Object.getOwnPropertyDescriptors(re);de.__original&&delete de.__original;const ye=Object.create(Object.getPrototypeOf(re),de);if(!Object.prototype.hasOwnProperty.call(ye,"__original"))try{Object.defineProperty(ye,"__original",{value:re,writable:!1,enumerable:!1,configurable:!1})}catch(ue){}return ye},oe=E.useMemo(()=>{const re=R,de=re==null?void 0:re.language;let ye=re;re&&(U.current&&U.current.__original===re?H.current!==de?(ye=B(re),U.current=ye,H.current=de):ye=U.current:(ye=B(re),U.current=ye,H.current=de));const ue=[C,ye,O];return ue.t=C,ue.i18n=ye,ue.ready=O,ue},[C,R,O,R.resolvedLanguage,R.language,R.languages]);if(u&&f&&!O)throw new Promise(re=>{const de=()=>re();t.lng?ib(u,t.lng,v,de):jg(u,v,de)});return oe},{slice:x3,forEach:y3}=[];function b3(e){return y3.call(x3.call(arguments,1),t=>{if(t)for(const a in t)e[a]===void 0&&(e[a]=t[a])}),e}function v3(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(a=>a.test(e))}const cb=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,_3=function(e,t){const s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},o=encodeURIComponent(t);let u=`${e}=${o}`;if(s.maxAge>0){const c=s.maxAge-0;if(Number.isNaN(c))throw new Error("maxAge should be a Number");u+=`; Max-Age=${Math.floor(c)}`}if(s.domain){if(!cb.test(s.domain))throw new TypeError("option domain is invalid");u+=`; Domain=${s.domain}`}if(s.path){if(!cb.test(s.path))throw new TypeError("option path is invalid");u+=`; Path=${s.path}`}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");u+=`; Expires=${s.expires.toUTCString()}`}if(s.httpOnly&&(u+="; HttpOnly"),s.secure&&(u+="; Secure"),s.sameSite)switch(typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite){case!0:u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"strict":u+="; SameSite=Strict";break;case"none":u+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return s.partitioned&&(u+="; Partitioned"),u},db={create(e,t,a,s){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};a&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+a*60*1e3)),s&&(o.domain=s),document.cookie=_3(e,t,o)},read(e){const t=`${e}=`,a=document.cookie.split(";");for(let s=0;s<a.length;s++){let o=a[s];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return o.substring(t.length,o.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var w3={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document!="undefined")return db.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:a,cookieMinutes:s,cookieDomain:o,cookieOptions:u}=t;a&&typeof document!="undefined"&&db.create(a,e,s,o,u)}},k3={name:"querystring",lookup(e){var s;let{lookupQuerystring:t}=e,a;if(typeof window!="undefined"){let{search:o}=window.location;!window.location.search&&((s=window.location.hash)==null?void 0:s.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const c=o.substring(1).split("&");for(let f=0;f<c.length;f++){const p=c[f].indexOf("=");p>0&&c[f].substring(0,p)===t&&(a=c[f].substring(p+1))}}return a}},N3={name:"hash",lookup(e){var o;let{lookupHash:t,lookupFromHashIndex:a}=e,s;if(typeof window!="undefined"){const{hash:u}=window.location;if(u&&u.length>2){const c=u.substring(1);if(t){const f=c.split("&");for(let p=0;p<f.length;p++){const g=f[p].indexOf("=");g>0&&f[p].substring(0,g)===t&&(s=f[p].substring(g+1))}}if(s)return s;if(!s&&a>-1){const f=u.match(/\/([a-zA-Z-]*)/g);return Array.isArray(f)?(o=f[typeof a=="number"?a:0])==null?void 0:o.replace("/",""):void 0}}}return s}};let Kl=null;const ub=()=>{if(Kl!==null)return Kl;try{if(Kl=typeof window!="undefined"&&window.localStorage!==null,!Kl)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(e){Kl=!1}return Kl};var S3={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&ub())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:a}=t;a&&ub()&&window.localStorage.setItem(a,e)}};let Jl=null;const fb=()=>{if(Jl!==null)return Jl;try{if(Jl=typeof window!="undefined"&&window.sessionStorage!==null,!Jl)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(e){Jl=!1}return Jl};var j3={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&fb())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:a}=t;a&&fb()&&window.sessionStorage.setItem(a,e)}},T3={name:"navigator",lookup(e){const t=[];if(typeof navigator!="undefined"){const{languages:a,userLanguage:s,language:o}=navigator;if(a)for(let u=0;u<a.length;u++)t.push(a[u]);s&&t.push(s),o&&t.push(o)}return t.length>0?t:void 0}},E3={name:"htmlTag",lookup(e){let{htmlTag:t}=e,a;const s=t||(typeof document!="undefined"?document.documentElement:null);return s&&typeof s.getAttribute=="function"&&(a=s.getAttribute("lang")),a}},C3={name:"path",lookup(e){var o;let{lookupFromPathIndex:t}=e;if(typeof window=="undefined")return;const a=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(a)?(o=a[typeof t=="number"?t:0])==null?void 0:o.replace("/",""):void 0}},A3={name:"subdomain",lookup(e){var o,u;let{lookupFromSubdomainIndex:t}=e;const a=typeof t=="number"?t+1:1,s=typeof window!="undefined"&&((u=(o=window.location)==null?void 0:o.hostname)==null?void 0:u.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(s)return s[a]}};let Gv=!1;try{document.cookie,Gv=!0}catch(e){}const Zv=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Gv||Zv.splice(1,1);const O3=()=>({order:Zv,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class qv{constructor(t){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,a)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=b3(a,this.options||{},O3()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(w3),this.addDetector(k3),this.addDetector(S3),this.addDetector(j3),this.addDetector(T3),this.addDetector(E3),this.addDetector(C3),this.addDetector(A3),this.addDetector(N3)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,a=[];return t.forEach(s=>{if(this.detectors[s]){let o=this.detectors[s].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(a=a.concat(o))}}),a=a.filter(s=>s!=null&&!v3(s)).map(s=>this.options.convertDetectedLanguage(s)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?a:a.length>0?a[0]:null}cacheUserLanguage(t){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;a&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||a.forEach(s=>{this.detectors[s]&&this.detectors[s].cacheUserLanguage(t,this.options)}))}}qv.type="languageDetector";const L3={dashboard:"Dashboard",assets:"Assets",workOrders:"Work Orders",maintenance:"Asset Maintenance",ppm:"PPM",logout:"Logout",login:"Login",email:"Email",password:"Password",submit:"Submit",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",create:"Create",search:"Search",filter:"Filter",export:"Export",import:"Import",loading:"Loading...",noData:"No data available",error:"Error",success:"Success",darkMode:"Dark Mode",lightMode:"Light Mode",language:"Language",english:"English",arabic:"Arabic"},M3={title:"Seera-ASM",loggedInAs:"Logged in as:",version:"Seera-ASM v1.0"},D3={title:"Seera-ASM",subtitle:"Asset Management System",signIn:"Sign in to continue",emailPlaceholder:"Enter your email",passwordPlaceholder:"Enter your password",loginFailed:"Login failed. Please check your credentials.",demoLogin:"Demo Login"},R3={title:"Dashboard",loading:"Loading dashboard...",totalAssets:"TOTAL NO. OF ASSETS",openWorkOrders:"OPEN WORK ORDERS",workOrdersInProgress:"WORK ORDERS IN PROGRESS",completedWorkOrders:"COMPLETED WORK ORDERS",totalWorkOrders:"TOTAL WORK ORDERS",overdueWorkOrders:"OVERDUE WORK ORDERS",upTime:"Up Time",downTime:"Down Time",workOrderStatus:"Work Order Status",workOrderByType:"Work Order by Type",maintenanceByAsset:"Maintenance by Asset",assigneesStatus:"Assignees Status",maintenanceFrequency:"Maintenance Frequency",maintenanceLogs:"MAINTENANCE LOGS",assetUptime:"Asset Uptime",avgResponseTime:"Avg Response Time",maintenanceEfficiency:"Maintenance Efficiency",overdueMaintenance:"Overdue Maintenance",upDownTimeChart:"Up & Down Time Chart",ppmStatus:"PPM Status"},P3={assetId:"Asset ID",assetName:"Asset Name",serialNumber:"Serial Number",company:"Company/Hospital",location:"Location",department:"Department",deviceStatus:"Device Status",modality:"Modality",manufacturer:"Manufacturer",supplier:"Supplier",assetCategory:"Asset Category",purchaseDate:"Purchase Date",purchaseAmount:"Purchase Amount",availableForUseDate:"Available For Use Date",createdOn:"Created On",modifiedOn:"Modified On",createdBy:"Created By",modifiedBy:"Modified By",workOrderId:"Work Order ID",workOrderType:"Type",status:"Status",priority:"Priority",description:"Description",assignedTo:"Assigned To",scheduledDate:"Scheduled Date",completedDate:"Completed Date"},F3={addNew:"Add New",searchPlaceholder:"Search...",noResults:"No results found",showing:"Showing",of:"of",results:"results",selectAll:"Select All",deselectAll:"Deselect All",selected:"selected",actions:"Actions",view:"View",edit:"Edit",delete:"Delete",duplicate:"Duplicate",export:"Export",print:"Print",filters:"Filters",clearFilters:"Clear Filters",applyFilters:"Apply Filters",columns:"Columns",exportSelected:"Export Selected",exportAllOnPage:"Export All on Page",exportAllWithFilters:"Export All with Filters",exportFormat:"Export Format",csv:"CSV",excel:"Excel",exporting:"Exporting...",exportComplete:"Export Complete",close:"Close",loading:"Loading...",refresh:"Refresh"},I3={title:"Assets",addAsset:"Add New Asset",assetDetails:"Asset Details"},B3={title:"Work Orders",addWorkOrder:"Add New Work Order",workOrderDetails:"Work Order Details",newWorkOrder:"New Work Order",duplicateWorkOrder:"Duplicate Work Order",createFromAsset:"Create Work Order from Asset"},z3={title:"Asset Maintenance",maintenanceLogs:"Maintenance Logs",maintenanceDetails:"Maintenance Details",addMaintenance:"Add New Maintenance"},U3={title:"PPM",ppmDetails:"PPM Details",addPPM:"Add New PPM"},H3={title:"Export",whatToExport:"What to Export",selectedRows:"Selected Rows",currentPage:"Current Page",allWithFilters:"All with Filters",exportSelected:"Export {count} selected",exportPage:"Export {count} on current page",exportAll:"Export all {count}",columnsToExport:"Columns to Export",selectAll:"Select All",selectDefault:"Select Default",exporting:"Exporting...",exportingSelected:"Exporting {count} selected row(s)",exportingPage:"Exporting {count} row(s) from current page",exportingAll:"Exporting all {count} row(s)",selected:"selected",rows:"rows"},$3={common:L3,sidebar:M3,login:D3,dashboard:R3,commonFields:P3,listPages:F3,assets:I3,workOrders:B3,maintenance:z3,ppm:U3,exportModal:H3},W3={dashboard:"لوحة التحكم",assets:"الأصول",workOrders:"أوامر العمل",maintenance:"صيانة الأصول",ppm:"الصيانة الوقائية",logout:"تسجيل الخروج",login:"تسجيل الدخول",email:"البريد الإلكتروني",password:"كلمة المرور",submit:"إرسال",cancel:"إلغاء",save:"حفظ",delete:"حذف",edit:"تعديل",create:"إنشاء",search:"بحث",filter:"تصفية",export:"تصدير",import:"استيراد",loading:"جاري التحميل...",noData:"لا توجد بيانات",error:"خطأ",success:"نجح",darkMode:"الوضع الداكن",lightMode:"الوضع الفاتح",language:"اللغة",english:"الإنجليزية",arabic:"العربية"},V3={title:"أصول سيرا",loggedInAs:"تم تسجيل الدخول كـ:",version:"أصول سيرا نظام إدارة الأصول الإصدار 1.0"},G3={title:"أصول سيرا",subtitle:"نظام إدارة الأصول",signIn:"قم بتسجيل الدخول للمتابعة",emailPlaceholder:"أدخل بريدك الإلكتروني",passwordPlaceholder:"أدخل كلمة المرور",loginFailed:"فشل تسجيل الدخول. يرجى التحقق من بيانات الاعتماد الخاصة بك.",demoLogin:"تسجيل دخول تجريبي"},Z3={title:"لوحة التحكم",loading:"جاري تحميل لوحة التحكم...",totalAssets:"إجمالي عدد الأصول",openWorkOrders:"أوامر العمل المفتوحة",workOrdersInProgress:"أوامر العمل قيد التنفيذ",completedWorkOrders:"أوامر العمل المكتملة",totalWorkOrders:"إجمالي أوامر العمل",overdueWorkOrders:"أوامر العمل المتأخرة",upTime:"وقت التشغيل",downTime:"وقت التوقف",workOrderStatus:"حالة أمر العمل",workOrderByType:"أمر العمل حسب النوع",maintenanceByAsset:"الصيانة حسب الأصل",assigneesStatus:"حالة المكلفين",maintenanceFrequency:"تكرار الصيانة",maintenanceLogs:"سجلات الصيانة",assetUptime:"وقت تشغيل الأصل",avgResponseTime:"متوسط وقت الاستجابة",maintenanceEfficiency:"كفاءة الصيانة",overdueMaintenance:"صيانة متأخرة",upDownTimeChart:"مخطط وقت التشغيل والتوقف",ppmStatus:"حالة الصيانة الوقائية"},q3={assetId:"معرف الأصل",assetName:"اسم الأصل",serialNumber:"الرقم التسلسلي",company:"الشركة/المستشفى",location:"الموقع",department:"القسم",deviceStatus:"حالة الجهاز",modality:"الطريقة",manufacturer:"الشركة المصنعة",supplier:"المورد",assetCategory:"فئة الأصل",purchaseDate:"تاريخ الشراء",purchaseAmount:"مبلغ الشراء",availableForUseDate:"تاريخ التوفر للاستخدام",createdOn:"تم الإنشاء في",modifiedOn:"تم التعديل في",createdBy:"تم الإنشاء بواسطة",modifiedBy:"تم التعديل بواسطة",workOrderId:"معرف أمر العمل",workOrderType:"النوع",status:"الحالة",priority:"الأولوية",description:"الوصف",assignedTo:"مكلف إلى",scheduledDate:"التاريخ المجدول",completedDate:"تاريخ الإكمال"},Y3={addNew:"إضافة جديد",searchPlaceholder:"بحث...",noResults:"لم يتم العثور على نتائج",showing:"عرض",of:"من",results:"نتائج",selectAll:"تحديد الكل",deselectAll:"إلغاء تحديد الكل",selected:"محدد",actions:"الإجراءات",view:"عرض",edit:"تعديل",delete:"حذف",duplicate:"نسخ",export:"تصدير",print:"طباعة",filters:"المرشحات",clearFilters:"مسح المرشحات",applyFilters:"تطبيق المرشحات",columns:"الأعمدة",exportSelected:"تصدير المحدد",exportAllOnPage:"تصدير الكل في الصفحة",exportAllWithFilters:"تصدير الكل مع المرشحات",exportFormat:"تنسيق التصدير",csv:"CSV",excel:"Excel",exporting:"جاري التصدير...",exportComplete:"اكتمل التصدير",close:"إغلاق",loading:"جاري التحميل...",refresh:"تحديث"},X3={title:"الأصول",addAsset:"إضافة أصل جديد",assetDetails:"تفاصيل الأصل"},K3={title:"أوامر العمل",addWorkOrder:"إضافة أمر عمل جديد",workOrderDetails:"تفاصيل أمر العمل",newWorkOrder:"أمر عمل جديد",duplicateWorkOrder:"نسخ أمر العمل",createFromAsset:"إنشاء أمر عمل من الأصل"},J3={title:"صيانة الأصول",maintenanceLogs:"سجلات الصيانة",maintenanceDetails:"تفاصيل الصيانة",addMaintenance:"إضافة صيانة جديدة"},Q3={title:"الصيانة الوقائية",ppmDetails:"تفاصيل الصيانة الوقائية",addPPM:"إضافة صيانة وقائية جديدة"},eN={title:"تصدير",whatToExport:"ما الذي سيتم تصديره",selectedRows:"الصفوف المحددة",currentPage:"الصفحة الحالية",allWithFilters:"الكل مع المرشحات",exportSelected:"تصدير {count} محدد",exportPage:"تصدير {count} في الصفحة الحالية",exportAll:"تصدير الكل {count}",columnsToExport:"الأعمدة للتصدير",selectAll:"تحديد الكل",selectDefault:"تحديد الافتراضي",exporting:"جاري التصدير...",exportingSelected:"جاري تصدير {count} صف(وف) محدد(ة)",exportingPage:"جاري تصدير {count} صف(وف) من الصفحة الحالية",exportingAll:"جاري تصدير جميع {count} صف(وف)",selected:"محدد",rows:"صفوف"},tN={common:W3,sidebar:V3,login:G3,dashboard:Z3,commonFields:q3,listPages:Y3,assets:X3,workOrders:K3,maintenance:J3,ppm:Q3,exportModal:eN},Ot={BASE_URL:"https://imanrdh-seeraasm.seeraarabia.com",ENDPOINTS:{USER_DETAILS:"/api/method/asset_lite.api.custom_api.get_user_details",DOCTYPE_RECORDS:"/api/method/asset_lite.api.custom_api.get_doctype_records",DASHBOARD_STATS:"/api/method/asset_lite.api.custom_api.get_dashboard_stats",DASHBOARD_NUMBER_CARDS:"/api/method/asset_lite.api.dashboard_api.get_number_cards",DASHBOARD_LIST_CHARTS:"/api/method/asset_lite.api.dashboard_api.list_dashboard_charts",DASHBOARD_CHART_DATA:"/api/method/asset_lite.api.dashboard_api.get_dashboard_chart_data",DASHBOARD_REPAIR_COST:"/api/method/asset_lite.api.dashboard_api.get_repair_cost_by_item",KYC_DETAILS:"/api/method/asset_lite.api.custom_api.get_kyc_details",GET_ASSETS:"/api/method/asset_lite.api.asset_api.get_assets",GET_ASSET_DETAILS:"/api/method/asset_lite.api.asset_api.get_asset_details",CREATE_ASSET:"/api/method/asset_lite.api.asset_api.create_asset",UPDATE_ASSET:"/api/method/asset_lite.api.asset_api.update_asset",DELETE_ASSET:"/api/method/asset_lite.api.asset_api.delete_asset",GET_ASSET_FILTERS:"/api/method/asset_lite.api.asset_api.get_asset_filters",GET_ASSET_STATS:"/api/method/asset_lite.api.asset_api.get_asset_stats",SEARCH_ASSETS:"/api/method/asset_lite.api.asset_api.search_assets",SUBMIT_ASSET:"/api/method/asset_lite.api.asset_api.submit_asset",CANCEL_ASSET:"/api/method/asset_lite.api.asset_api.cancel_asset",GET_WORK_ORDERS:"/api/method/asset_lite.api.work_order_api.get_work_orders",GET_WORK_ORDER_DETAILS:"/api/method/asset_lite.api.work_order_api.get_work_order_details",CREATE_WORK_ORDER:"/api/method/asset_lite.api.work_order_api.create_work_order",UPDATE_WORK_ORDER:"/api/method/asset_lite.api.work_order_api.update_work_order",DELETE_WORK_ORDER:"/api/method/asset_lite.api.work_order_api.delete_work_order",UPDATE_WORK_ORDER_STATUS:"/api/method/asset_lite.api.work_order_api.update_work_order_status",GET_ASSET_MAINTENANCE_LOGS:"/api/method/asset_lite.api.asset_maintenance_api.get_asset_maintenance_logs",GET_ASSET_MAINTENANCE_LOG_DETAILS:"/api/method/asset_lite.api.asset_maintenance_api.get_asset_maintenance_log_details",CREATE_ASSET_MAINTENANCE_LOG:"/api/method/asset_lite.api.asset_maintenance_api.create_asset_maintenance_log",UPDATE_ASSET_MAINTENANCE_LOG:"/api/method/asset_lite.api.asset_maintenance_api.update_asset_maintenance_log",DELETE_ASSET_MAINTENANCE_LOG:"/api/method/asset_lite.api.asset_maintenance_api.delete_asset_maintenance_log",UPDATE_MAINTENANCE_STATUS:"/api/method/asset_lite.api.asset_maintenance_api.update_maintenance_status",GET_MAINTENANCE_LOGS_BY_ASSET:"/api/method/asset_lite.api.asset_maintenance_api.get_maintenance_logs_by_asset",GET_OVERDUE_MAINTENANCE_LOGS:"/api/method/asset_lite.api.asset_maintenance_api.get_overdue_maintenance_logs",GET_ASSET_MAINTENANCES:"/api/method/asset_lite.api.ppm_api.get_asset_maintenances",GET_ASSET_MAINTENANCE_DETAILS:"/api/method/asset_lite.api.ppm_api.get_asset_maintenance_details",CREATE_ASSET_MAINTENANCE:"/api/method/asset_lite.api.ppm_api.create_asset_maintenance",UPDATE_ASSET_MAINTENANCE:"/api/method/asset_lite.api.ppm_api.update_asset_maintenance",DELETE_ASSET_MAINTENANCE:"/api/method/asset_lite.api.ppm_api.delete_asset_maintenance",GET_MAINTENANCE_TASKS:"/api/method/asset_lite.api.ppm_api.get_maintenance_tasks",GET_SERVICE_COVERAGE:"/api/method/asset_lite.api.ppm_api.get_service_coverage",GET_MAINTENANCES_BY_ASSET:"/api/method/asset_lite.api.ppm_api.get_maintenances_by_asset",GET_ACTIVE_SERVICE_CONTRACTS:"/api/method/asset_lite.api.ppm_api.get_active_service_contracts",LOGIN:"/api/method/login",LOGOUT:"/api/method/logout",CSRF_TOKEN:"/api/method/frappe.sessions.get_csrf_token",UPLOAD_FILE:"/api/method/upload_file",GET_USER_PERMISSIONS:"/api/method/asset_lite.api.userperm_api.get_user_permissions",GET_PERMISSION_FILTERS:"/api/method/asset_lite.api.userperm_api.get_permission_filters",GET_ALLOWED_VALUES:"/api/method/asset_lite.api.userperm_api.get_allowed_values",CHECK_DOCUMENT_ACCESS:"/api/method/asset_lite.api.userperm_api.check_document_access",GET_CONFIGURED_DOCTYPES:"/api/method/asset_lite.api.userperm_api.get_configured_doctypes",GET_USER_DEFAULTS:"/api/method/asset_lite.api.userperm_api.get_user_defaults"},DEFAULT_HEADERS:{"Content-Type":"application/json",Accept:"application/json"},TIMEOUT:parseInt("60000")};class aN{constructor(){Os(this,"baseURL");Os(this,"endpoints");Os(this,"defaultHeaders");Os(this,"timeout");this.baseURL=Ot.BASE_URL,this.endpoints=Ot.ENDPOINTS,this.defaultHeaders=Ot.DEFAULT_HEADERS,this.timeout=Ot.TIMEOUT}getCSRFToken(){return ge(this,null,function*(){try{if(typeof window!="undefined"&&window.csrf_token)return window.csrf_token;if(!localStorage.getItem("user"))return null;const a=yield fetch(`${this.baseURL}${this.endpoints.CSRF_TOKEN}`,{method:"GET",headers:{Accept:"application/json"},credentials:"include"});return a.ok&&(yield a.json()).message||null}catch(t){return null}})}apiCall(s){return ge(this,arguments,function*(t,a={}){const o=`${this.baseURL}${t}`,u=ie({method:"GET",headers:ie(ie({},this.defaultHeaders),a.headers)},a),c=yield this.getCSRFToken();c&&(u.headers["X-Frappe-CSRF-Token"]=c);try{const f=new AbortController,p=setTimeout(()=>f.abort(),this.timeout),g=yield fetch(o,Le(ie({},u),{signal:f.signal}));if(clearTimeout(p),!g.ok){const v=yield g.json().catch(()=>({}));throw new Wo(v.error||`HTTP error! status: ${g.status}`,g.status)}const x=yield g.json();return x.message!==void 0?x.message:x}catch(f){throw f instanceof Error?(console.error("API call failed:",f),new Wo(f.message)):f}})}login(t){return ge(this,null,function*(){const a=new FormData;a.append("usr",t.email),a.append("pwd",t.password);const s=`${this.baseURL}${this.endpoints.LOGIN}`;try{const o=new AbortController,u=setTimeout(()=>o.abort(),this.timeout),c=yield fetch(s,{method:"POST",headers:{Accept:"application/json"},body:a,credentials:"include",signal:o.signal});if(clearTimeout(u),!c.ok){const p=yield c.json().catch(()=>({})),g="Invalid credentials. Please try again.";throw new Wo(g,c.status)}const f=yield c.json();return typeof f.message=="string"&&f.message==="Logged In"?{message:{full_name:f.full_name,user_id:f.user||f.email,home_page:f.home_page,sid:f.sid}}:f.message&&typeof f.message=="object"?{message:f.message}:f.full_name||f.user?{message:f}:{message:f}}catch(o){throw o instanceof Error?new Wo("Login failed. Please try again."):o}})}logout(){return ge(this,null,function*(){yield this.apiCall(this.endpoints.LOGOUT,{method:"POST"})})}getUserDetails(t){return ge(this,null,function*(){const a=t?`?user_id=${t}`:"";return this.apiCall(`${this.endpoints.USER_DETAILS}${a}`)})}getDoctypeRecords(t,a,s,o=20,u=0){return ge(this,null,function*(){const c=new URLSearchParams({doctype:t,limit:o.toString(),offset:u.toString()});return a&&c.append("filters",JSON.stringify(a)),s&&c.append("fields",JSON.stringify(s)),this.apiCall(`${this.endpoints.DOCTYPE_RECORDS}?${c}`)})}getDashboardStats(){return ge(this,null,function*(){return this.apiCall(this.endpoints.DASHBOARD_STATS)})}getNumberCards(){return ge(this,null,function*(){return this.apiCall(this.endpoints.DASHBOARD_NUMBER_CARDS)})}listDashboardCharts(t=!0){return ge(this,null,function*(){const a=new URLSearchParams({public_only:t?"1":"0"});return this.apiCall(`${this.endpoints.DASHBOARD_LIST_CHARTS}?${a}`)})}getDashboardChartData(t,a){return ge(this,null,function*(){const s=new URLSearchParams({chart_name:t});return a&&s.append("report_filters",JSON.stringify(a)),this.apiCall(`${this.endpoints.DASHBOARD_CHART_DATA}?${s}`)})}getKycDetails(){return ge(this,null,function*(){return this.apiCall(this.endpoints.KYC_DETAILS)})}uploadFile(t){return ge(this,null,function*(){const a=new FormData;return a.append("file",t.file),a.append("doctype",t.doctype),a.append("docname",t.docname),a.append("fieldname",t.fieldname),this.apiCall(this.endpoints.UPLOAD_FILE,{method:"POST",headers:{},body:a})})}getUserPermissions(t){return ge(this,null,function*(){const a=t?`?user=${encodeURIComponent(t)}`:"";return this.apiCall(`${this.endpoints.GET_USER_PERMISSIONS}${a}`)})}getPermissionFilters(t,a){return ge(this,null,function*(){const s=new URLSearchParams({target_doctype:t});return a&&s.append("user",a),this.apiCall(`${this.endpoints.GET_PERMISSION_FILTERS}?${s}`)})}getAllowedValues(t,a){return ge(this,null,function*(){const s=new URLSearchParams({allow_doctype:t});return a&&s.append("user",a),this.apiCall(`${this.endpoints.GET_ALLOWED_VALUES}?${s}`)})}checkDocumentAccess(t,a,s){return ge(this,null,function*(){const o=new URLSearchParams({doctype:t,docname:a});return s&&o.append("user",s),this.apiCall(`${this.endpoints.CHECK_DOCUMENT_ACCESS}?${o}`)})}getConfiguredDoctypes(){return ge(this,null,function*(){return this.apiCall(this.endpoints.GET_CONFIGURED_DOCTYPES)})}getUserDefaults(t){return ge(this,null,function*(){const a=t?`?user=${encodeURIComponent(t)}`:"";return this.apiCall(`${this.endpoints.GET_USER_DEFAULTS}${a}`)})}isAuthenticated(){return!!localStorage.getItem("frappe_session_id")}getSessionId(){return localStorage.getItem("frappe_session_id")}setSessionId(t){localStorage.setItem("frappe_session_id",t)}}class Wo extends Error{constructor(a,s,o){super(a);Os(this,"status");Os(this,"code");this.name="ApiError",this.status=s,this.code=o}}const Ke=new aN,rN=Object.freeze(Object.defineProperty({__proto__:null,ApiError:Wo,default:Ke},Symbol.toStringTag,{value:"Module"}));function nN(e){return ge(this,null,function*(){try{const t=yield Ke.getDoctypeRecords("Translation",{language:e},["source_text","translated_text","context"],1e4,0),a={};return t.records&&t.records.length>0&&t.records.forEach(s=>{const o=s.source_text,u=s.translated_text||o;if(s.context){const c=`${s.context}.${o}`;a[c]=u}else o.includes("."),a[o]=u}),a}catch(t){return console.error("Error fetching translations from Frappe:",t),{}}})}function sN(e){const t={};return Object.keys(e).forEach(a=>{if(a.includes(".")){const s=a.split(".");let o=t;for(let u=0;u<s.length-1;u++){const c=s[u];o[c]||(o[c]={}),o=o[c]}o[s[s.length-1]]=e[a]}else t[a]=e[a]}),t}function hb(e){return ge(this,null,function*(){const t=yield nN(e);return sN(t)})}gr.use(qv).use(l3).init({resources:{en:{translation:$3},ar:{translation:tN}},fallbackLng:"en",defaultNS:"translation",interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});function df(){return ge(this,null,function*(){try{if(!localStorage.getItem("user"))return;const t=yield hb("en");Object.keys(t).length>0&&gr.addResourceBundle("en","translation",t,!0,!0);const a=yield hb("ar");Object.keys(a).length>0&&gr.addResourceBundle("ar","translation",a,!0,!0),console.log("✓ Translations loaded from Frappe")}catch(e){console.warn("⚠ Could not load translations from Frappe, using static translations:",e)}})}gr.on("initialized",()=>{df()});var mb="popstate";function iN(e={}){function t(s,o){let{pathname:u,search:c,hash:f}=s.location;return Eg("",{pathname:u,search:c,hash:f},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function a(s,o){return typeof o=="string"?o:qd(o)}return lN(t,a,null,e)}function Fa(e,t){if(e===!1||e===null||typeof e=="undefined")throw new Error(t)}function jn(e,t){if(!e){typeof console!="undefined"&&console.warn(t);try{throw new Error(t)}catch(a){}}}function oN(){return Math.random().toString(36).substring(2,10)}function gb(e,t){return{usr:e.state,key:e.key,idx:t}}function Eg(e,t,a=null,s){return Le(ie({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?yc(t):t),{state:a,key:t&&t.key||s||oN()})}function qd({pathname:e="/",search:t="",hash:a=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function yc(e){let t={};if(e){let a=e.indexOf("#");a>=0&&(t.hash=e.substring(a),e=e.substring(0,a));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function lN(e,t,a,s={}){let{window:o=document.defaultView,v5Compat:u=!1}=s,c=o.history,f="POP",p=null,g=x();g==null&&(g=0,c.replaceState(Le(ie({},c.state),{idx:g}),""));function x(){return(c.state||{idx:null}).idx}function v(){f="POP";let j=x(),P=j==null?null:j-g;g=j,p&&p({action:f,location:N.location,delta:P})}function _(j,P){f="PUSH";let C=Eg(N.location,j,P);g=x()+1;let O=gb(C,g),R=N.createHref(C);try{c.pushState(O,"",R)}catch(U){if(U instanceof DOMException&&U.name==="DataCloneError")throw U;o.location.assign(R)}u&&p&&p({action:f,location:N.location,delta:1})}function k(j,P){f="REPLACE";let C=Eg(N.location,j,P);g=x();let O=gb(C,g),R=N.createHref(C);c.replaceState(O,"",R),u&&p&&p({action:f,location:N.location,delta:0})}function T(j){return cN(j)}let N={get action(){return f},get location(){return e(o,c)},listen(j){if(p)throw new Error("A history only accepts one active listener");return o.addEventListener(mb,v),p=j,()=>{o.removeEventListener(mb,v),p=null}},createHref(j){return t(o,j)},createURL:T,encodeLocation(j){let P=T(j);return{pathname:P.pathname,search:P.search,hash:P.hash}},push:_,replace:k,go(j){return c.go(j)}};return N}function cN(e,t=!1){let a="http://localhost";typeof window!="undefined"&&(a=window.location.origin!=="null"?window.location.origin:window.location.href),Fa(a,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:qd(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=a+s),new URL(s,a)}function Yv(e,t,a="/"){return dN(e,t,a,!1)}function dN(e,t,a,s){let o=typeof t=="string"?yc(t):t,u=di(o.pathname||"/",a);if(u==null)return null;let c=Xv(e);uN(c);let f=null;for(let p=0;f==null&&p<c.length;++p){let g=wN(u);f=vN(c[p],g,s)}return f}function Xv(e,t=[],a=[],s="",o=!1){let u=(c,f,p=o,g)=>{let x={relativePath:g===void 0?c.path||"":g,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(s)&&p)return;Fa(x.relativePath.startsWith(s),`Absolute route path "${x.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),x.relativePath=x.relativePath.slice(s.length)}let v=ni([s,x.relativePath]),_=a.concat(x);c.children&&c.children.length>0&&(Fa(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),Xv(c.children,t,_,v,p)),!(c.path==null&&!c.index)&&t.push({path:v,score:yN(v,c.index),routesMeta:_})};return e.forEach((c,f)=>{var p;if(c.path===""||!((p=c.path)!=null&&p.includes("?")))u(c,f);else for(let g of Kv(c.path))u(c,f,!0,g)}),t}function Kv(e){let t=e.split("/");if(t.length===0)return[];let[a,...s]=t,o=a.endsWith("?"),u=a.replace(/\?$/,"");if(s.length===0)return o?[u,""]:[u];let c=Kv(s.join("/")),f=[];return f.push(...c.map(p=>p===""?u:[u,p].join("/"))),o&&f.push(...c),f.map(p=>e.startsWith("/")&&p===""?"/":p)}function uN(e){e.sort((t,a)=>t.score!==a.score?a.score-t.score:bN(t.routesMeta.map(s=>s.childrenIndex),a.routesMeta.map(s=>s.childrenIndex)))}var fN=/^:[\w-]+$/,hN=3,mN=2,gN=1,pN=10,xN=-2,pb=e=>e==="*";function yN(e,t){let a=e.split("/"),s=a.length;return a.some(pb)&&(s+=xN),t&&(s+=mN),a.filter(o=>!pb(o)).reduce((o,u)=>o+(fN.test(u)?hN:u===""?gN:pN),s)}function bN(e,t){return e.length===t.length&&e.slice(0,-1).every((s,o)=>s===t[o])?e[e.length-1]-t[t.length-1]:0}function vN(e,t,a=!1){let{routesMeta:s}=e,o={},u="/",c=[];for(let f=0;f<s.length;++f){let p=s[f],g=f===s.length-1,x=u==="/"?t:t.slice(u.length)||"/",v=uf({path:p.relativePath,caseSensitive:p.caseSensitive,end:g},x),_=p.route;if(!v&&g&&a&&!s[s.length-1].route.index&&(v=uf({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},x)),!v)return null;Object.assign(o,v.params),c.push({params:o,pathname:ni([u,v.pathname]),pathnameBase:TN(ni([u,v.pathnameBase])),route:_}),v.pathnameBase!=="/"&&(u=ni([u,v.pathnameBase]))}return c}function uf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,s]=_N(e.path,e.caseSensitive,e.end),o=t.match(a);if(!o)return null;let u=o[0],c=u.replace(/(.)\/+$/,"$1"),f=o.slice(1);return{params:s.reduce((g,{paramName:x,isOptional:v},_)=>{if(x==="*"){let T=f[_]||"";c=u.slice(0,u.length-T.length).replace(/(.)\/+$/,"$1")}const k=f[_];return v&&!k?g[x]=void 0:g[x]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:c,pattern:e}}function _N(e,t=!1,a=!0){jn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,p)=>(s.push({paramName:f,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),s]}function wN(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return jn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function di(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let a=t.endsWith("/")?t.length-1:t.length,s=e.charAt(a);return s&&s!=="/"?null:e.slice(a)||"/"}var kN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,NN=e=>kN.test(e);function SN(e,t="/"){let{pathname:a,search:s="",hash:o=""}=typeof e=="string"?yc(e):e,u;if(a)if(NN(a))u=a;else{if(a.includes("//")){let c=a;a=a.replace(/\/\/+/g,"/"),jn(!1,`Pathnames cannot have embedded double slashes - normalizing ${c} -> ${a}`)}a.startsWith("/")?u=xb(a.substring(1),"/"):u=xb(a,t)}else u=t;return{pathname:u,search:EN(s),hash:CN(o)}}function xb(e,t){let a=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?a.length>1&&a.pop():o!=="."&&a.push(o)}),a.length>1?a.join("/"):"/"}function ig(e,t,a,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function jN(e){return e.filter((t,a)=>a===0||t.route.path&&t.route.path.length>0)}function Vg(e){let t=jN(e);return t.map((a,s)=>s===t.length-1?a.pathname:a.pathnameBase)}function Gg(e,t,a,s=!1){let o;typeof e=="string"?o=yc(e):(o=ie({},e),Fa(!o.pathname||!o.pathname.includes("?"),ig("?","pathname","search",o)),Fa(!o.pathname||!o.pathname.includes("#"),ig("#","pathname","hash",o)),Fa(!o.search||!o.search.includes("#"),ig("#","search","hash",o)));let u=e===""||o.pathname==="",c=u?"/":o.pathname,f;if(c==null)f=a;else{let v=t.length-1;if(!s&&c.startsWith("..")){let _=c.split("/");for(;_[0]==="..";)_.shift(),v-=1;o.pathname=_.join("/")}f=v>=0?t[v]:"/"}let p=SN(o,f),g=c&&c!=="/"&&c.endsWith("/"),x=(u||c===".")&&a.endsWith("/");return!p.pathname.endsWith("/")&&(g||x)&&(p.pathname+="/"),p}var ni=e=>e.join("/").replace(/\/\/+/g,"/"),TN=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),EN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,CN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function AN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ON(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Jv=["POST","PUT","PATCH","DELETE"];new Set(Jv);var LN=["GET",...Jv];new Set(LN);var bc=E.createContext(null);bc.displayName="DataRouter";var Mf=E.createContext(null);Mf.displayName="DataRouterState";E.createContext(!1);var Qv=E.createContext({isTransitioning:!1});Qv.displayName="ViewTransition";var MN=E.createContext(new Map);MN.displayName="Fetchers";var DN=E.createContext(null);DN.displayName="Await";var Vn=E.createContext(null);Vn.displayName="Navigation";var ru=E.createContext(null);ru.displayName="Location";var hs=E.createContext({outlet:null,matches:[],isDataRoute:!1});hs.displayName="Route";var Zg=E.createContext(null);Zg.displayName="RouteError";function RN(e,{relative:t}={}){Fa(vc(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:s}=E.useContext(Vn),{hash:o,pathname:u,search:c}=nu(e,{relative:t}),f=u;return a!=="/"&&(f=u==="/"?a:ni([a,u])),s.createHref({pathname:f,search:c,hash:o})}function vc(){return E.useContext(ru)!=null}function Is(){return Fa(vc(),"useLocation() may be used only in the context of a <Router> component."),E.useContext(ru).location}var e_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function t_(e){E.useContext(Vn).static||E.useLayoutEffect(e)}function Da(){let{isDataRoute:e}=E.useContext(hs);return e?qN():PN()}function PN(){Fa(vc(),"useNavigate() may be used only in the context of a <Router> component.");let e=E.useContext(bc),{basename:t,navigator:a}=E.useContext(Vn),{matches:s}=E.useContext(hs),{pathname:o}=Is(),u=JSON.stringify(Vg(s)),c=E.useRef(!1);return t_(()=>{c.current=!0}),E.useCallback((p,g={})=>{if(jn(c.current,e_),!c.current)return;if(typeof p=="number"){a.go(p);return}let x=Gg(p,JSON.parse(u),o,g.relative==="path");e==null&&t!=="/"&&(x.pathname=x.pathname==="/"?t:ni([t,x.pathname])),(g.replace?a.replace:a.push)(x,g.state,g)},[t,a,u,o,e])}E.createContext(null);function _c(){let{matches:e}=E.useContext(hs),t=e[e.length-1];return t?t.params:{}}function nu(e,{relative:t}={}){let{matches:a}=E.useContext(hs),{pathname:s}=Is(),o=JSON.stringify(Vg(a));return E.useMemo(()=>Gg(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function FN(e,t){return a_(e,t)}function a_(e,t,a,s,o){var C;Fa(vc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:u}=E.useContext(Vn),{matches:c}=E.useContext(hs),f=c[c.length-1],p=f?f.params:{},g=f?f.pathname:"/",x=f?f.pathnameBase:"/",v=f&&f.route;{let O=v&&v.path||"";r_(g,!v||O.endsWith("*")||O.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${g}" (under <Route path="${O}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
Please change the parent <Route path="${O}"> to <Route path="${O==="/"?"*":`${O}/*`}">.`)}let _=Is(),k;if(t){let O=typeof t=="string"?yc(t):t;Fa(x==="/"||((C=O.pathname)==null?void 0:C.startsWith(x)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${x}" but pathname "${O.pathname}" was given in the \`location\` prop.`),k=O}else k=_;let T=k.pathname||"/",N=T;if(x!=="/"){let O=x.replace(/^\//,"").split("/");N="/"+T.replace(/^\//,"").split("/").slice(O.length).join("/")}let j=Yv(e,{pathname:N});jn(v||j!=null,`No routes matched location "${k.pathname}${k.search}${k.hash}" `),jn(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${k.pathname}${k.search}${k.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let P=HN(j&&j.map(O=>Object.assign({},O,{params:Object.assign({},p,O.params),pathname:ni([x,u.encodeLocation?u.encodeLocation(O.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathname]),pathnameBase:O.pathnameBase==="/"?x:ni([x,u.encodeLocation?u.encodeLocation(O.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathnameBase])})),c,a,s,o);return t&&P?E.createElement(ru.Provider,{value:{location:ie({pathname:"/",search:"",hash:"",state:null,key:"default"},k),navigationType:"POP"}},P):P}function IN(){let e=ZN(),t=AN(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),a=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},u={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=E.createElement(E.Fragment,null,E.createElement("p",null,"💿 Hey developer 👋"),E.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",E.createElement("code",{style:u},"ErrorBoundary")," or"," ",E.createElement("code",{style:u},"errorElement")," prop on your route.")),E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},t),a?E.createElement("pre",{style:o},a):null,c)}var BN=E.createElement(IN,null),zN=class extends E.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?E.createElement(hs.Provider,{value:this.props.routeContext},E.createElement(Zg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function UN({routeContext:e,match:t,children:a}){let s=E.useContext(bc);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),E.createElement(hs.Provider,{value:e},a)}function HN(e,t=[],a=null,s=null,o=null){if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let u=e,c=a==null?void 0:a.errors;if(c!=null){let x=u.findIndex(v=>v.route.id&&(c==null?void 0:c[v.route.id])!==void 0);Fa(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),u=u.slice(0,Math.min(u.length,x+1))}let f=!1,p=-1;if(a)for(let x=0;x<u.length;x++){let v=u[x];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(p=x),v.route.id){let{loaderData:_,errors:k}=a,T=v.route.loader&&!_.hasOwnProperty(v.route.id)&&(!k||k[v.route.id]===void 0);if(v.route.lazy||T){f=!0,p>=0?u=u.slice(0,p+1):u=[u[0]];break}}}let g=a&&s?(x,v)=>{var _,k,T;s(x,{location:a.location,params:(T=(k=(_=a.matches)==null?void 0:_[0])==null?void 0:k.params)!=null?T:{},unstable_pattern:ON(a.matches),errorInfo:v})}:void 0;return u.reduceRight((x,v,_)=>{let k,T=!1,N=null,j=null;a&&(k=c&&v.route.id?c[v.route.id]:void 0,N=v.route.errorElement||BN,f&&(p<0&&_===0?(r_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,j=null):p===_&&(T=!0,j=v.route.hydrateFallbackElement||null)));let P=t.concat(u.slice(0,_+1)),C=()=>{let O;return k?O=N:T?O=j:v.route.Component?O=E.createElement(v.route.Component,null):v.route.element?O=v.route.element:O=x,E.createElement(UN,{match:v,routeContext:{outlet:x,matches:P,isDataRoute:a!=null},children:O})};return a&&(v.route.ErrorBoundary||v.route.errorElement||_===0)?E.createElement(zN,{location:a.location,revalidation:a.revalidation,component:N,error:k,children:C(),routeContext:{outlet:null,matches:P,isDataRoute:!0},onError:g}):C()},null)}function qg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $N(e){let t=E.useContext(bc);return Fa(t,qg(e)),t}function WN(e){let t=E.useContext(Mf);return Fa(t,qg(e)),t}function VN(e){let t=E.useContext(hs);return Fa(t,qg(e)),t}function Yg(e){let t=VN(e),a=t.matches[t.matches.length-1];return Fa(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function GN(){return Yg("useRouteId")}function ZN(){var s;let e=E.useContext(Zg),t=WN("useRouteError"),a=Yg("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[a]}function qN(){let{router:e}=$N("useNavigate"),t=Yg("useNavigate"),a=E.useRef(!1);return t_(()=>{a.current=!0}),E.useCallback((c,...f)=>ge(null,[c,...f],function*(o,u={}){jn(a.current,e_),a.current&&(typeof o=="number"?yield e.navigate(o):yield e.navigate(o,ie({fromRouteId:t},u)))}),[e,t])}var yb={};function r_(e,t,a){!t&&!yb[e]&&(yb[e]=!0,jn(!1,a))}E.memo(YN);function YN({routes:e,future:t,state:a,unstable_onError:s}){return a_(e,void 0,a,s,t)}function Cg({to:e,replace:t,state:a,relative:s}){Fa(vc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=E.useContext(Vn);jn(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:u}=E.useContext(hs),{pathname:c}=Is(),f=Da(),p=Gg(e,Vg(u),c,s==="path"),g=JSON.stringify(p);return E.useEffect(()=>{f(JSON.parse(g),{replace:t,state:a,relative:s})},[f,g,s,t,a]),null}function ha(e){Fa(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function XN({basename:e="/",children:t=null,location:a,navigationType:s="POP",navigator:o,static:u=!1,unstable_useTransitions:c}){Fa(!vc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),p=E.useMemo(()=>({basename:f,navigator:o,static:u,unstable_useTransitions:c,future:{}}),[f,o,u,c]);typeof a=="string"&&(a=yc(a));let{pathname:g="/",search:x="",hash:v="",state:_=null,key:k="default"}=a,T=E.useMemo(()=>{let N=di(g,f);return N==null?null:{location:{pathname:N,search:x,hash:v,state:_,key:k},navigationType:s}},[f,g,x,v,_,k,s]);return jn(T!=null,`<Router basename="${f}"> is not able to match the URL "${g}${x}${v}" because it does not start with the basename, so the <Router> won't render anything.`),T==null?null:E.createElement(Vn.Provider,{value:p},E.createElement(ru.Provider,{children:t,value:T}))}function KN({children:e,location:t}){return FN(Ag(e),t)}function Ag(e,t=[]){let a=[];return E.Children.forEach(e,(s,o)=>{if(!E.isValidElement(s))return;let u=[...t,o];if(s.type===E.Fragment){a.push.apply(a,Ag(s.props.children,u));return}Fa(s.type===ha,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Fa(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||u.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=Ag(s.props.children,u)),a.push(c)}),a}var ef="get",tf="application/x-www-form-urlencoded";function Df(e){return typeof HTMLElement!="undefined"&&e instanceof HTMLElement}function JN(e){return Df(e)&&e.tagName.toLowerCase()==="button"}function QN(e){return Df(e)&&e.tagName.toLowerCase()==="form"}function eS(e){return Df(e)&&e.tagName.toLowerCase()==="input"}function tS(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function aS(e,t){return e.button===0&&(!t||t==="_self")&&!tS(e)}function Og(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,a)=>{let s=e[a];return t.concat(Array.isArray(s)?s.map(o=>[a,o]):[[a,s]])},[]))}function rS(e,t){let a=Og(e);return t&&t.forEach((s,o)=>{a.has(o)||t.getAll(o).forEach(u=>{a.append(o,u)})}),a}var z0=null;function nS(){if(z0===null)try{new FormData(document.createElement("form"),0),z0=!1}catch(e){z0=!0}return z0}var sS=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function og(e){return e!=null&&!sS.has(e)?(jn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${tf}"`),null):e}function iS(e,t){let a,s,o,u,c;if(QN(e)){let f=e.getAttribute("action");s=f?di(f,t):null,a=e.getAttribute("method")||ef,o=og(e.getAttribute("enctype"))||tf,u=new FormData(e)}else if(JN(e)||eS(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||f.getAttribute("action");if(s=p?di(p,t):null,a=e.getAttribute("formmethod")||f.getAttribute("method")||ef,o=og(e.getAttribute("formenctype"))||og(f.getAttribute("enctype"))||tf,u=new FormData(f,e),!nS()){let{name:g,type:x,value:v}=e;if(x==="image"){let _=g?`${g}.`:"";u.append(`${_}x`,"0"),u.append(`${_}y`,"0")}else g&&u.append(g,v)}}else{if(Df(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=ef,s=null,o=tf,c=e}return u&&o==="text/plain"&&(c=u,u=void 0),{action:s,method:a.toLowerCase(),encType:o,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Xg(e,t){if(e===!1||e===null||typeof e=="undefined")throw new Error(t)}function oS(e,t,a){let s=typeof e=="string"?new URL(e,typeof window=="undefined"?"server://singlefetch/":window.location.origin):e;return s.pathname==="/"?s.pathname=`_root.${a}`:t&&di(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}function lS(e,t){return ge(this,null,function*(){if(e.id in t)return t[e.id];try{let a=yield import(e.module);return t[e.id]=a,a}catch(a){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}})}function cS(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}function dS(e,t,a){return ge(this,null,function*(){let s=yield Promise.all(e.map(o=>ge(null,null,function*(){let u=t.routes[o.route.id];if(u){let c=yield lS(u,a);return c.links?c.links():[]}return[]})));return mS(s.flat(1).filter(cS).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?Le(ie({},o),{rel:"prefetch",as:"style"}):Le(ie({},o),{rel:"prefetch"})))})}function bb(e,t,a,s,o,u){let c=(p,g)=>a[g]?p.route.id!==a[g].route.id:!0,f=(p,g)=>{var x;return a[g].pathname!==p.pathname||((x=a[g].route.path)==null?void 0:x.endsWith("*"))&&a[g].params["*"]!==p.params["*"]};return u==="assets"?t.filter((p,g)=>c(p,g)||f(p,g)):u==="data"?t.filter((p,g)=>{var v;let x=s.routes[p.route.id];if(!x||!x.hasLoader)return!1;if(c(p,g)||f(p,g))return!0;if(p.route.shouldRevalidate){let _=p.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((v=a[0])==null?void 0:v.params)||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function uS(e,t,{includeHydrateFallback:a}={}){return fS(e.map(s=>{let o=t.routes[s.route.id];if(!o)return[];let u=[o.module];return o.clientActionModule&&(u=u.concat(o.clientActionModule)),o.clientLoaderModule&&(u=u.concat(o.clientLoaderModule)),a&&o.hydrateFallbackModule&&(u=u.concat(o.hydrateFallbackModule)),o.imports&&(u=u.concat(o.imports)),u}).flat(1))}function fS(e){return[...new Set(e)]}function hS(e){let t={},a=Object.keys(e).sort();for(let s of a)t[s]=e[s];return t}function mS(e,t){let a=new Set;return new Set(t),e.reduce((s,o)=>{let u=JSON.stringify(hS(o));return a.has(u)||(a.add(u),s.push({key:u,link:o})),s},[])}function n_(){let e=E.useContext(bc);return Xg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function gS(){let e=E.useContext(Mf);return Xg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Kg=E.createContext(void 0);Kg.displayName="FrameworkContext";function s_(){let e=E.useContext(Kg);return Xg(e,"You must render this element inside a <HydratedRouter> element"),e}function pS(e,t){let a=E.useContext(Kg),[s,o]=E.useState(!1),[u,c]=E.useState(!1),{onFocus:f,onBlur:p,onMouseEnter:g,onMouseLeave:x,onTouchStart:v}=t,_=E.useRef(null);E.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let N=P=>{P.forEach(C=>{c(C.isIntersecting)})},j=new IntersectionObserver(N,{threshold:.5});return _.current&&j.observe(_.current),()=>{j.disconnect()}}},[e]),E.useEffect(()=>{if(s){let N=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(N)}}},[s]);let k=()=>{o(!0)},T=()=>{o(!1),c(!1)};return a?e!=="intent"?[u,_,{}]:[u,_,{onFocus:Od(f,k),onBlur:Od(p,T),onMouseEnter:Od(g,k),onMouseLeave:Od(x,T),onTouchStart:Od(v,k)}]:[!1,_,{}]}function Od(e,t){return a=>{e&&e(a),a.defaultPrevented||t(a)}}function xS(a){var s=a,{page:e}=s,t=tn(s,["page"]);let{router:o}=n_(),u=E.useMemo(()=>Yv(o.routes,e,o.basename),[o.routes,e,o.basename]);return u?E.createElement(bS,ie({page:e,matches:u},t)):null}function yS(e){let{manifest:t,routeModules:a}=s_(),[s,o]=E.useState([]);return E.useEffect(()=>{let u=!1;return dS(e,t,a).then(c=>{u||o(c)}),()=>{u=!0}},[e,t,a]),s}function bS(s){var o=s,{page:e,matches:t}=o,a=tn(o,["page","matches"]);let u=Is(),{manifest:c,routeModules:f}=s_(),{basename:p}=n_(),{loaderData:g,matches:x}=gS(),v=E.useMemo(()=>bb(e,t,x,c,u,"data"),[e,t,x,c,u]),_=E.useMemo(()=>bb(e,t,x,c,u,"assets"),[e,t,x,c,u]),k=E.useMemo(()=>{if(e===u.pathname+u.search+u.hash)return[];let j=new Set,P=!1;if(t.forEach(O=>{var U;let R=c.routes[O.route.id];!R||!R.hasLoader||(!v.some(H=>H.route.id===O.route.id)&&O.route.id in g&&((U=f[O.route.id])!=null&&U.shouldRevalidate)||R.hasClientLoader?P=!0:j.add(O.route.id))}),j.size===0)return[];let C=oS(e,p,"data");return P&&j.size>0&&C.searchParams.set("_routes",t.filter(O=>j.has(O.route.id)).map(O=>O.route.id).join(",")),[C.pathname+C.search]},[p,g,u,c,v,t,e,f]),T=E.useMemo(()=>uS(_,c),[_,c]),N=yS(_);return E.createElement(E.Fragment,null,k.map(j=>E.createElement("link",ie({key:j,rel:"prefetch",as:"fetch",href:j},a))),T.map(j=>E.createElement("link",ie({key:j,rel:"modulepreload",href:j},a))),N.map(({key:j,link:P})=>E.createElement("link",ie({key:j,nonce:a.nonce},P))))}function vS(...e){return t=>{e.forEach(a=>{typeof a=="function"?a(t):a!=null&&(a.current=t)})}}var i_=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined";try{i_&&(window.__reactRouterVersion="7.10.0")}catch(e){}function _S({basename:e,children:t,unstable_useTransitions:a,window:s}){let o=E.useRef();o.current==null&&(o.current=iN({window:s,v5Compat:!0}));let u=o.current,[c,f]=E.useState({action:u.action,location:u.location}),p=E.useCallback(g=>{a===!1?f(g):E.startTransition(()=>f(g))},[a]);return E.useLayoutEffect(()=>u.listen(p),[u,p]),E.createElement(XN,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:a===!0})}var o_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Jg=E.forwardRef(function(T,k){var N=T,{onClick:t,discover:a="render",prefetch:s="none",relative:o,reloadDocument:u,replace:c,state:f,target:p,to:g,preventScrollReset:x,viewTransition:v}=N,_=tn(N,["onClick","discover","prefetch","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"]);let{basename:j,unstable_useTransitions:P}=E.useContext(Vn),C=typeof g=="string"&&o_.test(g),O,R=!1;if(typeof g=="string"&&C&&(O=g,i_))try{let re=new URL(window.location.href),de=g.startsWith("//")?new URL(re.protocol+g):new URL(g),ye=di(de.pathname,j);de.origin===re.origin&&ye!=null?g=ye+de.search+de.hash:R=!0}catch(re){jn(!1,`<Link to="${g}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let U=RN(g,{relative:o}),[H,B,oe]=pS(s,_),se=SS(g,{replace:c,state:f,target:p,preventScrollReset:x,relative:o,viewTransition:v,unstable_useTransitions:P});function pe(re){t&&t(re),re.defaultPrevented||se(re)}let le=E.createElement("a",Le(ie(ie({},_),oe),{href:O||U,onClick:R||u?t:pe,ref:vS(k,B),target:p,"data-discover":!C&&a==="render"?"true":void 0}));return H&&!C?E.createElement(E.Fragment,null,le,E.createElement(xS,{page:U})):le});Jg.displayName="Link";var wS=E.forwardRef(function(v,x){var _=v,{"aria-current":t="page",caseSensitive:a=!1,className:s="",end:o=!1,style:u,to:c,viewTransition:f,children:p}=_,g=tn(_,["aria-current","caseSensitive","className","end","style","to","viewTransition","children"]);let k=nu(c,{relative:g.relative}),T=Is(),N=E.useContext(Mf),{navigator:j,basename:P}=E.useContext(Vn),C=N!=null&&AS(k)&&f===!0,O=j.encodeLocation?j.encodeLocation(k).pathname:k.pathname,R=T.pathname,U=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;a||(R=R.toLowerCase(),U=U?U.toLowerCase():null,O=O.toLowerCase()),U&&P&&(U=di(U,P)||U);const H=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let B=R===O||!o&&R.startsWith(O)&&R.charAt(H)==="/",oe=U!=null&&(U===O||!o&&U.startsWith(O)&&U.charAt(O.length)==="/"),se={isActive:B,isPending:oe,isTransitioning:C},pe=B?t:void 0,le;typeof s=="function"?le=s(se):le=[s,B?"active":null,oe?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let re=typeof u=="function"?u(se):u;return E.createElement(Jg,Le(ie({},g),{"aria-current":pe,className:le,ref:x,style:re,to:c,viewTransition:f}),typeof p=="function"?p(se):p)});wS.displayName="NavLink";var kS=E.forwardRef((T,k)=>{var N=T,{discover:e="render",fetcherKey:t,navigate:a,reloadDocument:s,replace:o,state:u,method:c=ef,action:f,onSubmit:p,relative:g,preventScrollReset:x,viewTransition:v}=N,_=tn(N,["discover","fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition"]);let{unstable_useTransitions:j}=E.useContext(Vn),P=ES(),C=CS(f,{relative:g}),O=c.toLowerCase()==="get"?"get":"post",R=typeof f=="string"&&o_.test(f),U=H=>{if(p&&p(H),H.defaultPrevented)return;H.preventDefault();let B=H.nativeEvent.submitter,oe=(B==null?void 0:B.getAttribute("formmethod"))||c,se=()=>P(B||H.currentTarget,{fetcherKey:t,method:oe,navigate:a,replace:o,state:u,relative:g,preventScrollReset:x,viewTransition:v});j&&a!==!1?E.startTransition(()=>se()):se()};return E.createElement("form",Le(ie({ref:k,method:O,action:C,onSubmit:s?p:U},_),{"data-discover":!R&&e==="render"?"true":void 0}))});kS.displayName="Form";function NS(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function l_(e){let t=E.useContext(bc);return Fa(t,NS(e)),t}function SS(e,{target:t,replace:a,state:s,preventScrollReset:o,relative:u,viewTransition:c,unstable_useTransitions:f}={}){let p=Da(),g=Is(),x=nu(e,{relative:u});return E.useCallback(v=>{if(aS(v,t)){v.preventDefault();let _=a!==void 0?a:qd(g)===qd(x),k=()=>p(e,{replace:_,state:s,preventScrollReset:o,relative:u,viewTransition:c});f?E.startTransition(()=>k()):k()}},[g,p,x,a,s,t,e,o,u,c,f])}function rl(e){jn(typeof URLSearchParams!="undefined","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=E.useRef(Og(e)),a=E.useRef(!1),s=Is(),o=E.useMemo(()=>rS(s.search,a.current?null:t.current),[s.search]),u=Da(),c=E.useCallback((f,p)=>{const g=Og(typeof f=="function"?f(new URLSearchParams(o)):f);a.current=!0,u("?"+g,p)},[u,o]);return[o,c]}var jS=0,TS=()=>`__${String(++jS)}__`;function ES(){let{router:e}=l_("useSubmit"),{basename:t}=E.useContext(Vn),a=GN(),s=e.fetch,o=e.navigate;return E.useCallback((f,...p)=>ge(null,[f,...p],function*(u,c={}){let{action:g,method:x,encType:v,formData:_,body:k}=iS(u,t);if(c.navigate===!1){let T=c.fetcherKey||TS();yield s(T,a,c.action||g,{preventScrollReset:c.preventScrollReset,formData:_,body:k,formMethod:c.method||x,formEncType:c.encType||v,flushSync:c.flushSync})}else yield o(c.action||g,{preventScrollReset:c.preventScrollReset,formData:_,body:k,formMethod:c.method||x,formEncType:c.encType||v,replace:c.replace,state:c.state,fromRouteId:a,flushSync:c.flushSync,viewTransition:c.viewTransition})}),[s,o,t,a])}function CS(e,{relative:t}={}){let{basename:a}=E.useContext(Vn),s=E.useContext(hs);Fa(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),u=ie({},nu(e||".",{relative:t})),c=Is();if(e==null){u.search=c.search;let f=new URLSearchParams(u.search),p=f.getAll("index");if(p.some(x=>x==="")){f.delete("index"),p.filter(v=>v).forEach(v=>f.append("index",v));let x=f.toString();u.search=x?`?${x}`:""}}return(!e||e===".")&&o.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(u.pathname=u.pathname==="/"?a:ni([a,u.pathname])),qd(u)}function AS(e,{relative:t}={}){let a=E.useContext(Qv);Fa(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=l_("useViewTransitionState"),o=nu(e,{relative:t});if(!a.isTransitioning)return!1;let u=di(a.currentLocation.pathname,s)||a.currentLocation.pathname,c=di(a.nextLocation.pathname,s)||a.nextLocation.pathname;return uf(o.pathname,c)!=null||uf(o.pathname,u)!=null}var c_=Bv();const OS="modulepreload",LS=function(e){return"/assets/asm_ui_app/asm_app/"+e},vb={},_b=function(t,a,s){let o=Promise.resolve();if(a&&a.length>0){let g=function(x){return Promise.all(x.map(v=>Promise.resolve(v).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};var c=g;document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),p=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=g(a.map(x=>{if(x=LS(x),x in vb)return;vb[x]=!0;const v=x.endsWith(".css"),_=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${x}"]${_}`))return;const k=document.createElement("link");if(k.rel=v?"stylesheet":OS,v||(k.as="script"),k.crossOrigin="",k.href=x,p&&k.setAttribute("nonce",p),document.head.appendChild(k),v)return new Promise((T,N)=>{k.addEventListener("load",T),k.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${x}`)))})}))}function u(f){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=f,window.dispatchEvent(p),!p.defaultPrevented)throw f}return o.then(f=>{for(const p of f||[])p.status==="rejected"&&u(p.reason);return t().catch(u)})},d_=E.createContext(void 0),MS=({children:e})=>{const{i18n:t}=ln(),[a,s]=E.useState(()=>localStorage.getItem("i18nextLng")==="ar"?"ar":"en"),o=a==="ar";E.useEffect(()=>{const c=document.documentElement,f=document.documentElement;t.changeLanguage(a),f.setAttribute("lang",a),o?(f.setAttribute("dir","rtl"),c.classList.add("rtl"),c.classList.remove("ltr")):(f.setAttribute("dir","ltr"),c.classList.add("ltr"),c.classList.remove("rtl"))},[a,t,o]);const u=c=>ge(null,null,function*(){s(c),localStorage.setItem("i18nextLng",c),yield df()});return r.jsx(d_.Provider,{value:{language:a,changeLanguage:u,isRTL:o},children:e})},Qg=()=>{const e=E.useContext(d_);if(!e)throw new Error("useLanguage must be used within LanguageProvider");return e},DS=()=>{const[e,t]=E.useState({email:"",password:""}),[a,s]=E.useState(!1),[o,u]=E.useState(null),c=Da(),{t:f}=ln(),{isRTL:p}=Qg(),g="/assets/asm_ui_app/asm_app/",x="?v=1765198405",v=T=>{const{name:N,value:j}=T.target;t(P=>Le(ie({},P),{[N]:j})),u(null)},_=T=>ge(null,null,function*(){T.preventDefault(),s(!0),u(null);try{const{useAuth:N}=yield _b(()=>ge(null,null,function*(){const{useAuth:C}=yield Promise.resolve().then(()=>RS);return{useAuth:C}}),[]),j=(yield _b(()=>ge(null,null,function*(){const{default:C}=yield Promise.resolve().then(()=>rN);return{default:C}}),void 0)).default,P=yield j.login(e);if(P&&P.message){const C=Le(ie({},P.message),{email:e.email});localStorage.setItem("user",JSON.stringify(C)),P.message.sid&&j.setSessionId(P.message.sid);try{yield df()}catch(O){console.warn("Could not load translations after login:",O)}c("/dashboard")}else u(f("login.loginFailed"))}catch(N){console.error("Login error:",N),u(N.message||f("login.loginFailed"))}finally{s(!1)}}),k=()=>ge(null,null,function*(){const T={full_name:"Demo User",email:"demo@seeraarabia.com",user_image:"",roles:["System Manager","Administrator"]};localStorage.setItem("user",JSON.stringify(T));try{yield df()}catch(N){console.warn("Could not load translations after demo login:",N)}c("/dashboard")});return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-md w-full space-y-8",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex justify-center mb-6",children:r.jsxs("div",{className:"w-32 h-32 flex items-center justify-center bg-white dark:bg-gray-800 rounded-2xl shadow-2xl p-4",children:[r.jsx("img",{src:`${g}${g.endsWith("/")?"":"/"}seera-logo.png${x}`,alt:"Seera Arabia",className:"w-full h-full object-contain",onError:T=>{const N=T.currentTarget.parentElement;N&&N.classList.add("bg-gradient-to-br","from-indigo-600","to-purple-600"),T.currentTarget.style.display="none";const j=T.currentTarget.nextElementSibling;j&&j.classList.remove("hidden")}}),r.jsxs("svg",{className:"w-20 h-20 hidden",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"white",fillOpacity:"0.9"}),r.jsx("path",{d:"M2 17L12 22L22 17V12L12 17L2 12V17Z",fill:"white",fillOpacity:"0.7"}),r.jsx("path",{d:"M12 12V17",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]})]})}),r.jsx("h2",{className:"text-center text-3xl font-semibold text-gray-900 dark:text-white",children:f("login.title")}),r.jsx("p",{className:"mt-2 text-center text-sm font-medium text-indigo-600 dark:text-indigo-400",children:f("login.subtitle")}),r.jsx("p",{className:"mt-1 text-center text-xs text-gray-600 dark:text-gray-400",children:f("login.signIn")})]}),r.jsxs("form",{className:"mt-8 space-y-6",onSubmit:_,children:[r.jsxs("div",{className:"rounded-md shadow-sm -space-y-px",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"email",className:"sr-only",children:f("common.email")}),r.jsx("input",{id:"email",name:"email",type:"email",required:!0,className:"appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 placeholder-gray-500 dark:placeholder-gray-400 text-gray-900 dark:text-white bg-white dark:bg-gray-800 rounded-t-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm",placeholder:f("login.emailPlaceholder"),value:e.email,onChange:v})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"password",className:"sr-only",children:f("common.password")}),r.jsx("input",{id:"password",name:"password",type:"password",required:!0,className:"appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 placeholder-gray-500 dark:placeholder-gray-400 text-gray-900 dark:text-white bg-white dark:bg-gray-800 rounded-b-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm",placeholder:f("login.passwordPlaceholder"),value:e.password,onChange:v})]})]}),o&&r.jsx("div",{className:"rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:r.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:o})}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("button",{type:"submit",disabled:a,className:"group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed",children:a?r.jsxs("div",{className:"flex items-center",children:[r.jsxs("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),f("common.loading")]}):f("common.login")}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("div",{className:"w-full border-t border-gray-300 dark:border-gray-600"})}),r.jsx("div",{className:"relative flex justify-center text-sm",children:r.jsx("span",{className:"px-2 bg-gray-50 dark:bg-gray-900 text-gray-500 dark:text-gray-400",children:"or"})})]}),r.jsxs("button",{type:"button",onClick:k,className:"w-full flex justify-center py-2 px-4 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:["🚀 ",f("login.demoLogin")]})]})]})]})})};function su(e,t=[]){const[a,s]=E.useState(null),[o,u]=E.useState(!0),[c,f]=E.useState(null),p=E.useCallback(()=>ge(null,null,function*(){try{u(!0),f(null);const x=yield e();s(x)}catch(x){x instanceof Wo?f(x.message):f(x instanceof Error?x.message:"Unknown error")}finally{u(!1)}}),t);E.useEffect(()=>{p()},[p]);const g=E.useCallback(()=>{p()},[p]);return{data:a,loading:o,error:c,refetch:g}}function u_(e){return su(()=>Ke.getUserDetails(e),[e])}function f_(){return su(()=>Ke.getDashboardStats())}function ep(){return su(()=>Ke.getNumberCards())}function Uo(e,t){return su(()=>Ke.getDashboardChartData(e,t),[e,JSON.stringify(t||{})])}function h_(){const[e,t]=E.useState(Ke.isAuthenticated());return{isAuthenticated:e,login:o=>ge(null,null,function*(){try{const u=yield Ke.login(o);if(u&&u.message)return u.message.sid&&Ke.setSessionId(u.message.sid),t(!0),u;throw new Error("Login failed")}catch(u){throw t(!1),u}}),logout:()=>ge(null,null,function*(){try{yield Ke.logout()}finally{Ke.setSessionId(""),t(!1)}})}}const RS=Object.freeze(Object.defineProperty({__proto__:null,useApi:su,useAuth:h_,useDashboardChart:Uo,useDashboardStats:f_,useNumberCards:ep,useUserDetails:u_},Symbol.toStringTag,{value:"Module"})),PS=()=>{const[e,t]=E.useState({}),[a,s]=E.useState(!1),o=()=>ge(null,null,function*(){s(!0);const u={};try{console.log("Testing basic connectivity...");try{const c=yield fetch("/api/method/frappe.desk.doctype.event.event.get_events",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({start:new Date().toISOString().split("T")[0],end:new Date(Date.now()+2592e6).toISOString().split("T")[0]}),signal:AbortSignal.timeout(1e4)});c.ok?u.csrfToken="✅ Basic Connectivity: SUCCESS":u.csrfToken=`❌ Basic Connectivity: HTTP ${c.status}`}catch(c){u.csrfToken=`❌ Basic Connectivity: ${c instanceof Error?c.message:"Unknown error"}`}console.log("Testing Frappe system endpoint...");try{yield Ke.apiCall("/api/method/frappe.auth.get_logged_user",{method:"GET",headers:{"Content-Type":"application/json"}}),u.dashboardStats="✅ Frappe System API: SUCCESS"}catch(c){const f=c instanceof Error?c.message:"Unknown";f.includes("403")||f.includes("401")?u.dashboardStats="✅ Frappe System API: SUCCESS (auth required)":u.dashboardStats=`❌ Frappe System API: ${f}`}console.log("Testing Custom User Details...");try{const c=yield Ke.getUserDetails();u.userDetails=c?"✅ Custom API: SUCCESS":"❌ Custom API: Failed"}catch(c){u.userDetails=`❌ Custom API (Expected): ${c instanceof Error?c.message:"Unknown"}`}console.log("Testing Custom Dashboard Stats...");try{const c=yield Ke.getDashboardStats();u.doctypeRecords=c?"✅ Custom Stats: SUCCESS":"❌ Custom Stats: Failed"}catch(c){u.doctypeRecords=`❌ Custom Stats (Expected): ${c instanceof Error?c.message:"Unknown"}`}}catch(c){console.error("API Test Error:",c),c instanceof Wo?u.error=`${c.message} (Status: ${c.status})`:u.error=c instanceof Error?c.message:"Unknown error"}t(u),s(!1)});return r.jsxs("div",{style:{padding:"20px",border:"1px solid #ccc",margin:"20px"},children:[r.jsx("h2",{children:"API Connection Test"}),r.jsx("button",{onClick:o,disabled:a,style:{padding:"10px 20px",marginBottom:"20px",backgroundColor:a?"#ccc":"#007bff",color:"white",border:"none",borderRadius:"4px",cursor:a?"not-allowed":"pointer"},children:a?"Testing...":"Test API Connection"}),r.jsxs("div",{children:[r.jsx("h3",{children:"Test Results:"}),r.jsxs("div",{style:{background:"#f5f5f5",padding:"15px",borderRadius:"5px",fontSize:"14px"},children:[r.jsxs("div",{children:[r.jsx("strong",{children:"1. Basic Connectivity:"})," ",e.csrfToken||"Not tested"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"2. Frappe System API:"})," ",e.dashboardStats||"Not tested"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"3. Custom User API:"})," ",e.userDetails||"Not tested"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"4. Custom Stats API:"})," ",e.doctypeRecords||"Not tested"]}),e.error&&r.jsxs("div",{style:{color:"red"},children:[r.jsx("strong",{children:"Error:"})," ",e.error]})]}),r.jsxs("div",{style:{marginTop:"10px",fontSize:"12px",color:"#666"},children:[r.jsx("p",{children:r.jsx("strong",{children:"Expected Results:"})}),r.jsxs("ul",{children:[r.jsx("li",{children:"✅ Basic Connectivity should succeed (tests proxy connection)"}),r.jsx("li",{children:"✅ Frappe System API should succeed (tests Frappe API)"}),r.jsx("li",{children:"❌ Custom APIs will fail until you deploy the API file to your server"})]}),r.jsxs("p",{children:[r.jsx("strong",{children:"If Basic Connectivity fails:"})," Check your Frappe server is running and accessible"]})]})]})]})},lg=e=>Number.isFinite(e)?Math.max(0,e):0;function FS({type:e,labels:t,datasets:a,height:s=220}){if(!(t!=null&&t.length)||!(a!=null&&a.length))return r.jsx("div",{className:"text-sm text-gray-500",children:"No data"});if(e.toLowerCase()==="pie"){const g=a[0].values.map(lg),x=g.reduce((j,P)=>j+P,0)||1,v=Math.min(100,s/2-10),_=v+10,k=v+10;let T=0;const N=a[0].values.map((j,P)=>a[0].color||wb(P));return r.jsx("svg",{width:_*2,height:k*2,viewBox:`0 0 ${_*2} ${k*2}`,children:g.map((j,P)=>{const C=T/x*2*Math.PI;T+=j;const O=T/x*2*Math.PI,R=O-C>Math.PI?1:0,U=_+v*Math.cos(C),H=k+v*Math.sin(C),B=_+v*Math.cos(O),oe=k+v*Math.sin(O),se=`M ${_} ${k} L ${U} ${H} A ${v} ${v} 0 ${R} 1 ${B} ${oe} Z`;return r.jsx("path",{d:se,fill:N[P]},P)})})}const o=a,u=Math.max(...o.flatMap(g=>g.values.map(lg)),1),c=Math.max(t.length*60,300),f=s-40,p=Math.max(20,(c-40)/t.length-10);return r.jsxs("svg",{width:c,height:s,viewBox:`0 0 ${c} ${s}`,children:[r.jsx("line",{x1:30,y1:10,x2:30,y2:f,stroke:"#e5e7eb"}),r.jsx("line",{x1:30,y1:f,x2:c-10,y2:f,stroke:"#e5e7eb"}),t.map((g,x)=>{const v=40+x*(p+10);let _=0;return r.jsxs("g",{children:[o.map((k,T)=>{const j=lg(k.values[x]||0)/u*(f-20),P=f-j-_,C=k.color||wb(T);return _+=j,r.jsx("rect",{x:v,y:P,width:p,height:j,fill:C,rx:2},T)}),r.jsx("text",{x:v+p/2,y:s-5,textAnchor:"middle",fontSize:"10",fill:"#6b7280",children:IS(g,8)})]},x)})]})}function wb(e){const t=["#4F46E5","#10B981","#F59E0B","#EF4444","#6366F1","#22C55E","#E11D48"];return t[e%t.length]}function IS(e,t){return e.length>t?e.slice(0,t-1)+"…":e}const BS=({chartName:e,filters:t})=>{const{data:a,loading:s,error:o}=Uo(e,t);return r.jsxs("div",{className:"bg-white rounded-lg shadow p-4 overflow-auto",children:[r.jsx("div",{className:"flex items-center justify-between mb-3",children:r.jsx("h4",{className:"text-sm font-semibold text-gray-800",children:e})}),s&&r.jsx("div",{className:"text-sm text-gray-500",children:"Loading…"}),o&&r.jsx("div",{className:"text-sm text-red-600",children:o}),!s&&!o&&a&&r.jsx(FS,{type:a.type,labels:a.labels,datasets:a.datasets})]})},zS=()=>{var k,T,N,j;const[e,t]=E.useState(null),[a,s]=E.useState([]),o=Da(),{logout:u}=h_(),{loading:c,error:f}=f_(),{data:p}=ep(),{data:g,loading:x,error:v}=u_();E.useEffect(()=>{const P=localStorage.getItem("user");P?t(JSON.parse(P)):g&&t(g);const C=[{name:"USER001",full_name:"John Doe",email:"john.doe@seeraarabia.com",creation:new Date().toISOString(),modified:new Date().toISOString(),modified_by:"system",owner:"system",docstatus:0},{name:"USER002",full_name:"Jane Smith",email:"jane.smith@seeraarabia.com",creation:new Date(Date.now()-864e5).toISOString(),modified:new Date().toISOString(),modified_by:"system",owner:"system",docstatus:0},{name:"USER003",full_name:"Ahmed Al-Rashid",email:"ahmed.alrashid@seeraarabia.com",creation:new Date(Date.now()-1728e5).toISOString(),modified:new Date().toISOString(),modified_by:"system",owner:"system",docstatus:0},{name:"USER004",full_name:"Sarah Johnson",email:"sarah.johnson@seeraarabia.com",creation:new Date(Date.now()-2592e5).toISOString(),modified:new Date().toISOString(),modified_by:"system",owner:"system",docstatus:0},{name:"USER005",full_name:"Mohammed Hassan",email:"mohammed.hassan@seeraarabia.com",creation:new Date(Date.now()-3456e5).toISOString(),modified:new Date().toISOString(),modified_by:"system",owner:"system",docstatus:0}];s(C)},[g]);const _=()=>ge(null,null,function*(){try{yield u(),localStorage.removeItem("user"),o("/login")}catch(P){console.error("Logout error:",P),localStorage.removeItem("user"),o("/login")}});return c||x?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:r.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-indigo-600"})}):r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[r.jsx("header",{className:"bg-white dark:bg-gray-800 shadow",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"flex justify-between items-center py-6",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:"Dashboard"})}),r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Welcome, ",(e==null?void 0:e.full_name)||"User"]}),r.jsx("button",{onClick:_,className:"bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-md text-sm font-medium",children:"Logout"})]})]})})}),r.jsxs("main",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[(f||v)&&r.jsx("div",{className:"mb-6 rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:r.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:f||v||"Failed to load dashboard data"})}),r.jsxs("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-4 mb-8",children:[r.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:r.jsx("div",{className:"p-5",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-indigo-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})})}),r.jsx("div",{className:"ml-5 w-0 flex-1",children:r.jsxs("dl",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"Total Assets"}),r.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(k=p==null?void 0:p.total_assets)!=null?k:"-"})]})})]})})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:r.jsx("div",{className:"p-5",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})}),r.jsx("div",{className:"ml-5 w-0 flex-1",children:r.jsxs("dl",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"Open Work Orders"}),r.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(T=p==null?void 0:p.work_orders_open)!=null?T:"-"})]})})]})})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:r.jsx("div",{className:"p-5",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-yellow-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})})}),r.jsx("div",{className:"ml-5 w-0 flex-1",children:r.jsxs("dl",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"In Progress"}),r.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(N=p==null?void 0:p.work_orders_in_progress)!=null?N:"-"})]})})]})})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:r.jsx("div",{className:"p-5",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-purple-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M3 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z",clipRule:"evenodd"})})})}),r.jsx("div",{className:"ml-5 w-0 flex-1",children:r.jsxs("dl",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"Completed Work Orders"}),r.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(j=p==null?void 0:p.work_orders_completed)!=null?j:"-"})]})})]})})})]}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-6 mb-8",children:["Up & Down Time Chart","Work Order Status Chart","Maintenance - Asset wise Count","Asset Maintenance Assignees Status Count","Asset Maintenance Frequency Chart","PPM Status","PPM Template Counts","Repair Cost"].map(P=>r.jsx(BS,{chartName:P},P))}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow overflow-hidden sm:rounded-md",children:[r.jsxs("div",{className:"px-4 py-5 sm:px-6",children:[r.jsx("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white",children:"Recent Records"}),r.jsx("p",{className:"mt-1 max-w-2xl text-sm text-gray-500 dark:text-gray-400",children:"Latest entries from your Frappe backend"})]}),r.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:a.map(P=>{var C;return r.jsx("li",{children:r.jsxs("div",{className:"px-4 py-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0 h-10 w-10",children:r.jsx("div",{className:"h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center",children:r.jsx("span",{className:"text-sm font-medium text-indigo-600",children:((C=P.full_name)==null?void 0:C.charAt(0))||P.name.charAt(0)})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:P.full_name||P.name}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:P.email||"No email"})]})]}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(P.creation).toLocaleDateString()})]})},P.name)})})]}),r.jsxs("div",{className:"mt-8",children:[r.jsx("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white mb-4",children:"Quick Actions"}),r.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[r.jsx("button",{onClick:()=>o("/users"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-blue-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{d:"M9 6a3 3 0 11-6 0 3 3 0 016 0zM17 6a3 3 0 11-6 0 3 3 0 016 0zM12.93 17c.046-.327.07-.66.07-1a6.97 6.97 0 00-1.5-4.33A5 5 0 0119 16v1h-6.07zM6 11a5 5 0 015 5v1H1v-1a5 5 0 015-5z"})})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"View Users"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Manage user accounts"})]})]})}),r.jsx("button",{onClick:()=>o("/settings"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-gray-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Settings"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Configure your preferences"})]})]})}),r.jsx("button",{onClick:()=>o("/events"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-purple-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Events"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"View calendar events"})]})]})}),r.jsx("button",{onClick:()=>o("/reports"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Reports"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"View analytics and reports"})]})]})})]})]}),r.jsx("div",{className:"mt-8",children:r.jsx(PS,{})})]})]})};class US{getWorkOrders(t,a,s=20,o=0,u){return ge(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),a&&a.length>0&&c.append("fields",JSON.stringify(a)),c.append("limit",s.toString()),c.append("offset",o.toString()),u&&c.append("order_by",u);const f=`${Ot.ENDPOINTS.GET_WORK_ORDERS}?${c.toString()}`;return Ke.apiCall(f)})}getWorkOrderDetails(t){return ge(this,null,function*(){const a=`${Ot.ENDPOINTS.GET_WORK_ORDER_DETAILS}?work_order_name=${encodeURIComponent(t)}`;return Ke.apiCall(a)})}createWorkOrder(t){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.CREATE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_data:t})})})}updateWorkOrder(t,a){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.UPDATE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:t,work_order_data:a})})})}deleteWorkOrder(t){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.DELETE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:t})})})}updateWorkOrderStatus(t,a,s){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.UPDATE_WORK_ORDER_STATUS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:t,repair_status:a,workflow_state:s})})})}getWorkOrderFilters(){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.GET_WORK_ORDER_FILTERS)})}getWorkOrderStats(){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.GET_WORK_ORDER_STATS)})}searchWorkOrders(t,a=10){return ge(this,null,function*(){const s=`${Ot.ENDPOINTS.SEARCH_WORK_ORDERS}?search_term=${encodeURIComponent(t)}&limit=${a}`;return Ke.apiCall(s)})}submitWorkOrder(t){return ge(this,null,function*(){return Ke.apiCall("/api/method/frappe.client.submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doc:{doctype:"Asset Repair",name:t}})})})}cancelWorkOrder(t){return ge(this,null,function*(){return Ke.apiCall("/api/method/frappe.client.cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doc:{doctype:"Asset Repair",name:t}})})})}getWorkOrdersByAsset(t,a=50){return ge(this,null,function*(){const s={asset:t};return(yield this.getWorkOrders(s,void 0,a,0,"creation desc")).work_orders})}getOpenWorkOrders(t=50){return ge(this,null,function*(){const a={repair_status:["not in",["Completed","Cancelled"]]};return(yield this.getWorkOrders(a,void 0,t,0,"creation desc")).work_orders})}getWorkOrdersByPriority(t,a=50){return ge(this,null,function*(){const s={custom_priority_:t};return(yield this.getWorkOrders(s,void 0,a,0,"creation desc")).work_orders})}}const Ho=new US,HS=(e,t)=>{const a=ie({},e||{});for(const[s,o]of Object.entries(t))if(!a[s])a[s]=o;else if(Array.isArray(o)&&o[0]==="in"){const u=o[1],c=a[s];if(typeof c=="string")u.includes(c)||(a[s]=["in",[]]);else if(Array.isArray(c)&&c[0]==="in"){const p=c[1].filter(g=>u.includes(g));a[s]=["in",p]}else a[s]=o}return a};function m_(e,t=20,a=0,s,o={}){const[u,c]=E.useState([]),[f,p]=E.useState(0),[g,x]=E.useState(!1),[v,_]=E.useState(!0),[k,T]=E.useState(null),[N,j]=E.useState(0),P=E.useRef(!1),C=JSON.stringify(e),O=JSON.stringify(o);E.useEffect(()=>{if(P.current&&k)return;let U=!1;return P.current=!0,ge(null,null,function*(){try{_(!0);const B=HS(e,o);console.log("[useWorkOrders] User filters:",e),console.log("[useWorkOrders] Permission filters:",o),console.log("[useWorkOrders] Merged filters:",B);const oe=yield Ho.getWorkOrders(B,void 0,t,a,s);U||(c(oe.work_orders),p(oe.total_count),x(oe.has_more),T(null))}catch(B){if(!U){const oe=B instanceof Error?B.message:"Failed to fetch work orders";oe.includes("417")||oe.includes("Expectation Failed")||oe.includes("has no attribute")?T("API endpoint not deployed or misconfigured. Please check FIX_417_ERROR.md for solutions."):T(oe),c([]),p(0),x(!1)}}finally{U||_(!1)}}),()=>{U=!0}},[C,O,t,a,s,N]);const R=E.useCallback(()=>{P.current=!1,j(U=>U+1)},[]);return{workOrders:u,totalCount:f,hasMore:g,loading:v,error:k,refetch:R}}function $S(e){const[t,a]=E.useState(null),[s,o]=E.useState(!0),[u,c]=E.useState(null),f=E.useCallback(()=>ge(null,null,function*(){if(!e){a(null),o(!1);return}try{o(!0),c(null);const g=yield Ho.getWorkOrderDetails(e);a(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch work order details")}finally{o(!1)}}),[e]);E.useEffect(()=>{f()},[f]);const p=E.useCallback(()=>{f()},[f]);return{workOrder:t,loading:s,error:u,refetch:p}}function g_(){const[e,t]=E.useState(!1),[a,s]=E.useState(null);return{createWorkOrder:g=>ge(null,null,function*(){try{t(!0),s(null),console.log("[useWorkOrderMutations] Creating work order with data:",g);const x=yield Ho.createWorkOrder(g);if(console.log("[useWorkOrderMutations] Create work order response:",x),x.success)return x.work_order;{const v=x.error||"Failed to create work order";throw new Error(v)}}catch(x){console.error("[useWorkOrderMutations] Create work order error:",x);const v=x instanceof Error?x.message:"Failed to create work order";throw s(v),x}finally{t(!1)}}),updateWorkOrder:(g,x)=>ge(null,null,function*(){try{t(!0),s(null),console.log("[useWorkOrderMutations] Updating work order:",g,"with data:",x);const v=yield Ho.updateWorkOrder(g,x);if(console.log("[useWorkOrderMutations] Update work order response:",v),v.success)return v.work_order;{const _=v.error||"Failed to update work order";throw new Error(_)}}catch(v){console.error("[useWorkOrderMutations] Update work order error:",v);const _=v instanceof Error?v.message:"Failed to update work order";throw s(_),v}finally{t(!1)}}),deleteWorkOrder:g=>ge(null,null,function*(){try{t(!0),s(null);const x=yield Ho.deleteWorkOrder(g);if(!x.success)throw new Error("Failed to delete work order");return x}catch(x){const v=x instanceof Error?x.message:"Failed to delete work order";throw s(v),x}finally{t(!1)}}),submitWorkOrder:g=>ge(null,null,function*(){try{t(!0),s(null),console.log("[useWorkOrderMutations] Submitting work order:",g);const x=yield Ho.submitWorkOrder(g);return console.log("[useWorkOrderMutations] Submit work order response:",x),x}catch(x){console.error("[useWorkOrderMutations] Submit work order error:",x);const v=x instanceof Error?x.message:"Failed to submit work order";throw s(v),x}finally{t(!1)}}),updateStatus:(g,x,v)=>ge(null,null,function*(){try{t(!0),s(null);const _=yield Ho.updateWorkOrderStatus(g,x,v);if(_.success)return _.work_order;throw new Error("Failed to update work order status")}catch(_){const k=_ instanceof Error?_.message:"Failed to update status";throw s(k),_}finally{t(!1)}}),loading:e,error:a}}const is=Ke;class WS{getMaintenanceLogs(t,a,s=20,o=0,u){return ge(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),a&&a.length>0&&c.append("fields",JSON.stringify(a)),c.append("limit",s.toString()),c.append("offset",o.toString()),u&&c.append("order_by",u),c.append("include_child_tables","true");const f=`${Ot.ENDPOINTS.GET_ASSET_MAINTENANCE_LOGS}?${c.toString()}`;return is.apiCall(f)})}getMaintenanceLogDetails(t){return ge(this,null,function*(){const a=new URLSearchParams;a.append("log_name",t),a.append("include_child_tables","true");const s=`${Ot.ENDPOINTS.GET_ASSET_MAINTENANCE_LOG_DETAILS}?${a.toString()}`;return is.apiCall(s)})}createMaintenanceLog(t){return ge(this,null,function*(){const a=this.prepareLogData(t);return is.apiCall(Ot.ENDPOINTS.CREATE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_data:a})})})}updateMaintenanceLog(t,a){return ge(this,null,function*(){const s=this.prepareLogData(a);return is.apiCall(Ot.ENDPOINTS.UPDATE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,log_data:s})})})}deleteMaintenanceLog(t){return ge(this,null,function*(){return is.apiCall(Ot.ENDPOINTS.DELETE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t})})})}updateMaintenanceStatus(t,a,s){return ge(this,null,function*(){return is.apiCall(Ot.ENDPOINTS.UPDATE_MAINTENANCE_STATUS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,maintenance_status:a,workflow_state:s})})})}getMaintenanceLogsByAsset(t,a,s=20,o=0){return ge(this,null,function*(){const u=new URLSearchParams;u.append("asset_name",t),a&&u.append("filters",JSON.stringify(a)),u.append("limit",s.toString()),u.append("offset",o.toString()),u.append("include_child_tables","true");const c=`${Ot.ENDPOINTS.GET_MAINTENANCE_LOGS_BY_ASSET}?${u.toString()}`;return is.apiCall(c)})}getOverdueMaintenanceLogs(t,a=20,s=0){return ge(this,null,function*(){const o=new URLSearchParams;t&&o.append("filters",JSON.stringify(t)),o.append("limit",a.toString()),o.append("offset",s.toString()),o.append("include_child_tables","true");const u=`${Ot.ENDPOINTS.GET_OVERDUE_MAINTENANCE_LOGS}?${o.toString()}`;return is.apiCall(u)})}addPPMTableRow(t,a){return ge(this,null,function*(){return is.apiCall(Ot.ENDPOINTS.ADD_PPM_TABLE_ROW||"/api/method/asset_lite.api.asset_maintenance_api.add_ppm_table_row",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,row_data:this.cleanPPMRow(a)})})})}removePPMTableRow(t,a){return ge(this,null,function*(){return is.apiCall(Ot.ENDPOINTS.REMOVE_PPM_TABLE_ROW||"/api/method/asset_lite.api.asset_maintenance_api.remove_ppm_table_row",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,row_name:a})})})}updatePPMTableRow(t,a,s){return ge(this,null,function*(){return is.apiCall(Ot.ENDPOINTS.UPDATE_PPM_TABLE_ROW||"/api/method/asset_lite.api.asset_maintenance_api.update_ppm_table_row",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,row_name:a,row_data:this.cleanPPMRow(s)})})})}cleanPPMRow(t){return Le(ie({},t.name&&!t.name.startsWith("new-")?{name:t.name}:{}),{maintenance_name:t.maintenance_name||"",working:typeof t.working=="boolean"?t.working?1:0:t.working||0,defect_found:typeof t.defect_found=="boolean"?t.defect_found?1:0:t.defect_found||0,not_working:typeof t.not_working=="boolean"?t.not_working?1:0:t.not_working||0})}prepareLogData(t){const a={},s=["asset_name","custom_asset_type","item_code","item_name","custom_asset_names","custom_hospital_name","task","task_name","maintenance_type","periodicity","custom_template","maintenance_status","due_date","completion_date","assign_to_name","has_certificate","custom_early_completion","custom_early_completion_reason","custom_accepted_by_moh","custom_accepted_by_moh_","custom_pm_overdue_reason","description","custom_table"];for(const o of s)t[o]!==void 0&&t[o]!==null&&t[o]!==""&&(a[o]=t[o]);return typeof a.has_certificate=="boolean"&&(a.has_certificate=a.has_certificate?1:0),typeof a.custom_accepted_by_moh=="boolean"&&(a.custom_accepted_by_moh=a.custom_accepted_by_moh?1:0),typeof a.custom_accepted_by_moh_=="boolean"&&(a.custom_accepted_by_moh_=a.custom_accepted_by_moh_?1:0),a.custom_table&&Array.isArray(a.custom_table)&&(a.custom_table=a.custom_table.map(o=>this.cleanPPMRow(o))),a}}const nc=new WS;function Rf(e,t=20,a=0,s){const[o,u]=E.useState([]),[c,f]=E.useState(0),[p,g]=E.useState(!1),[x,v]=E.useState(!0),[_,k]=E.useState(null),[T,N]=E.useState(0),j=E.useRef(!1),P=JSON.stringify(e);E.useEffect(()=>{if(j.current&&_)return;let O=!1;return j.current=!0,ge(null,null,function*(){try{v(!0);const U=yield nc.getMaintenanceLogs(e,void 0,t,a,s);O||(u(U.asset_maintenance_logs),f(U.total_count),g(U.has_more),k(null))}catch(U){if(!O){const H=U instanceof Error?U.message:"Failed to fetch maintenance logs";H.includes("417")||H.includes("Expectation Failed")||H.includes("has no attribute")?k("API endpoint not deployed. Please deploy asset_maintenance_api.py to your Frappe server."):k(H),u([]),f(0),g(!1)}}finally{O||v(!1)}}),()=>{O=!0}},[P,t,a,s,T]);const C=E.useCallback(()=>{j.current=!1,N(O=>O+1)},[]);return{logs:o,totalCount:c,hasMore:p,loading:x,error:_,refetch:C}}function VS(e){const[t,a]=E.useState(null),[s,o]=E.useState(!0),[u,c]=E.useState(null),f=E.useCallback(()=>ge(null,null,function*(){if(!e){a(null),o(!1);return}try{o(!0),c(null);const g=yield nc.getMaintenanceLogDetails(e);a(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch maintenance log details")}finally{o(!1)}}),[e]);E.useEffect(()=>{f()},[f]);const p=E.useCallback(()=>{f()},[f]);return{log:t,loading:s,error:u,refetch:p}}function p_(){const[e,t]=E.useState(!1),[a,s]=E.useState(null);return{createLog:p=>ge(null,null,function*(){try{t(!0),s(null),console.log("[useMaintenanceMutations] Creating maintenance log:",p);const g=yield nc.createMaintenanceLog(p);if(console.log("[useMaintenanceMutations] Create response:",g),g.success)return g.asset_maintenance_log;{const x=g.error||"Failed to create maintenance log";throw new Error(x)}}catch(g){console.error("[useMaintenanceMutations] Create error:",g);const x=g instanceof Error?g.message:"Failed to create maintenance log";throw s(x),g}finally{t(!1)}}),updateLog:(p,g)=>ge(null,null,function*(){try{t(!0),s(null),console.log("[useMaintenanceMutations] Updating maintenance log:",p,g);const x=yield nc.updateMaintenanceLog(p,g);if(console.log("[useMaintenanceMutations] Update response:",x),x.success)return x.asset_maintenance_log;{const v=x.error||"Failed to update maintenance log";throw new Error(v)}}catch(x){console.error("[useMaintenanceMutations] Update error:",x);const v=x instanceof Error?x.message:"Failed to update maintenance log";throw s(v),x}finally{t(!1)}}),deleteLog:p=>ge(null,null,function*(){try{t(!0),s(null);const g=yield nc.deleteMaintenanceLog(p);if(!g.success)throw new Error("Failed to delete maintenance log");return g}catch(g){const x=g instanceof Error?g.message:"Failed to delete maintenance log";throw s(x),g}finally{t(!1)}}),updateStatus:(p,g,x)=>ge(null,null,function*(){try{t(!0),s(null);const v=yield nc.updateMaintenanceStatus(p,g,x);if(v.success)return v.asset_maintenance_log;throw new Error("Failed to update maintenance status")}catch(v){const _=v instanceof Error?v.message:"Failed to update status";throw s(_),v}finally{t(!1)}}),loading:e,error:a}}class GS{getAssets(t,a,s=20,o=0,u){return ge(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),a&&a.length>0&&c.append("fields",JSON.stringify(a)),c.append("limit",s.toString()),c.append("offset",o.toString()),u&&c.append("order_by",u);const f=`${Ot.ENDPOINTS.GET_ASSETS}?${c.toString()}`;return Ke.apiCall(f)})}getAssetDetails(t){return ge(this,null,function*(){const a=`${Ot.ENDPOINTS.GET_ASSET_DETAILS}?asset_name=${encodeURIComponent(t)}`;return Ke.apiCall(a)})}createAsset(t){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.CREATE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_data:t})})})}updateAsset(t,a){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.UPDATE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_name:t,asset_data:a})})})}deleteAsset(t){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.DELETE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_name:t})})})}getAssetFilters(){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.GET_ASSET_FILTERS)})}getAssetStats(){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.GET_ASSET_STATS)})}searchAssets(t,a=10){return ge(this,null,function*(){const s=`${Ot.ENDPOINTS.SEARCH_ASSETS}?search_term=${encodeURIComponent(t)}&limit=${a}`;return Ke.apiCall(s)})}submitAsset(t){return ge(this,null,function*(){return Ke.apiCall(Ot.ENDPOINTS.SUBMIT_ASSET||"/api/method/asset_lite.api.asset_api.submit_asset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_name:t})})})}}const sc=new GS,ZS=(e,t)=>{const a=ie({},e||{});for(const[s,o]of Object.entries(t))if(!a[s])a[s]=o;else if(Array.isArray(o)&&o[0]==="in"){const u=o[1],c=a[s];if(typeof c=="string")u.includes(c)||(a[s]=["in",[]]);else if(Array.isArray(c)&&c[0]==="in"){const p=c[1].filter(g=>u.includes(g));a[s]=["in",p]}else a[s]=o}return a};function x_(e,t=20,a=0,s,o={}){const[u,c]=E.useState([]),[f,p]=E.useState(0),[g,x]=E.useState(!1),[v,_]=E.useState(!0),[k,T]=E.useState(null),[N,j]=E.useState(0),P=E.useRef(!1),C=JSON.stringify(e),O=JSON.stringify(o);E.useEffect(()=>{if(P.current&&k)return;let U=!1;return P.current=!0,ge(null,null,function*(){try{_(!0);const B=ZS(e,o);console.log("[useAssets] User filters:",e),console.log("[useAssets] Permission filters:",o),console.log("[useAssets] Merged filters:",B);const oe=yield sc.getAssets(B,void 0,t,a,s);U||(c(oe.assets),p(oe.total_count),x(oe.has_more),T(null))}catch(B){if(!U){const oe=B instanceof Error?B.message:"Failed to fetch assets";oe.includes("417")||oe.includes("Expectation Failed")||oe.includes("has no attribute")?T("API endpoint not deployed or misconfigured. Please check FIX_417_ERROR.md for solutions."):T(oe),c([]),p(0),x(!1)}}finally{U||_(!1)}}),()=>{U=!0}},[C,O,t,a,s,N]);const R=E.useCallback(()=>{P.current=!1,j(U=>U+1)},[]);return{assets:u,totalCount:f,hasMore:g,loading:v,error:k,refetch:R}}function qS(e){const[t,a]=E.useState(null),[s,o]=E.useState(!0),[u,c]=E.useState(null),f=E.useCallback(()=>ge(null,null,function*(){if(!e){a(null),o(!1);return}try{o(!0),c(null);const g=yield sc.getAssetDetails(e);a(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch asset details")}finally{o(!1)}}),[e]);E.useEffect(()=>{f()},[f]);const p=E.useCallback(()=>{f()},[f]);return{asset:t,loading:s,error:u,refetch:p}}function y_(){const[e,t]=E.useState(!1),[a,s]=E.useState(null);return{createAsset:p=>ge(null,null,function*(){try{t(!0),s(null),console.log("[useAssetMutations] Creating asset with data:",p);const g=yield sc.createAsset(p);if(console.log("[useAssetMutations] Create asset response:",g),g.success)return g.asset;{const x=g.error||"Failed to create asset";throw new Error(x)}}catch(g){console.error("[useAssetMutations] Create asset error:",g);const x=g instanceof Error?g.message:"Failed to create asset";throw s(x),g}finally{t(!1)}}),updateAsset:(p,g)=>ge(null,null,function*(){try{t(!0),s(null),console.log("[useAssetMutations] Updating asset:",p,"with data:",g);const x=yield sc.updateAsset(p,g);if(console.log("[useAssetMutations] Update asset response:",x),x.success)return x.asset;{const v=x.error||"Failed to update asset";throw new Error(v)}}catch(x){console.error("[useAssetMutations] Update asset error:",x);const v=x instanceof Error?x.message:"Failed to update asset";throw s(v),x}finally{t(!1)}}),deleteAsset:p=>ge(null,null,function*(){try{t(!0),s(null);const g=yield sc.deleteAsset(p);if(!g.success)throw new Error("Failed to delete asset");return g}catch(g){const x=g instanceof Error?g.message:"Failed to delete asset";throw s(x),g}finally{t(!1)}}),submitAsset:p=>ge(null,null,function*(){try{t(!0),s(null),console.log("[useAssetMutations] Submitting asset:",p);const g=yield sc.submitAsset(p);return console.log("[useAssetMutations] Submit asset response:",g),g}catch(g){console.error("[useAssetMutations] Submit asset error:",g);const x=g instanceof Error?g.message:"Failed to submit asset";throw s(x),g}finally{t(!1)}}),loading:e,error:a}}var b_={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},kb=ea.createContext&&ea.createContext(b_),YS=["attr","size","title"];function XS(e,t){if(e==null)return{};var a=KS(e,t),s,o;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(o=0;o<u.length;o++)s=u[o],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function KS(e,t){if(e==null)return{};var a={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;a[s]=e[s]}return a}function ff(){return ff=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},ff.apply(this,arguments)}function Nb(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),a.push.apply(a,s)}return a}function hf(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?Nb(Object(a),!0).forEach(function(s){JS(e,s,a[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Nb(Object(a)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(a,s))})}return e}function JS(e,t,a){return t=QS(t),t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function QS(e){var t=e6(e,"string");return typeof t=="symbol"?t:t+""}function e6(e,t){if(typeof e!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var s=a.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function v_(e){return e&&e.map((t,a)=>ea.createElement(t.tag,hf({key:a},t.attr),v_(t.child)))}function jt(e){return t=>ea.createElement(t6,ff({attr:hf({},e.attr)},t),v_(e.child))}function t6(e){var t=a=>{var{attr:s,size:o,title:u}=e,c=XS(e,YS),f=o||a.size||"1em",p;return a.className&&(p=a.className),e.className&&(p=(p?p+" ":"")+e.className),ea.createElement("svg",ff({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,s,c,{className:p,style:hf(hf({color:e.color||a.color},a.style),e.style),height:f,width:f,xmlns:"http://www.w3.org/2000/svg"}),u&&ea.createElement("title",null,u),e.children)};return kb!==void 0?ea.createElement(kb.Consumer,null,a=>t(a)):t(b_)}function a6(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"},child:[]}]})(e)}function no(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(e)}function r6(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"},child:[]}]})(e)}function Sb(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 512c35.32 0 63.97-28.65 63.97-64H160.03c0 35.35 28.65 64 63.97 64zm215.39-149.71c-19.32-20.76-55.47-51.99-55.47-154.29 0-77.7-54.48-139.9-127.94-155.16V32c0-17.67-14.32-32-31.98-32s-31.98 14.33-31.98 32v20.84C118.56 68.1 64.08 130.3 64.08 208c0 102.3-36.15 133.53-55.47 154.29-6 6.45-8.66 14.16-8.61 21.71.11 16.4 12.98 32 32.1 32h383.8c19.12 0 32-15.6 32.1-32 .05-7.55-2.61-15.27-8.61-21.71z"},child:[]}]})(e)}function n6(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M509.5 184.6L458.9 32.8C452.4 13.2 434.1 0 413.4 0H272v192h238.7c-.4-2.5-.4-5-1.2-7.4zM240 0H98.6c-20.7 0-39 13.2-45.5 32.8L2.5 184.6c-.8 2.4-.8 4.9-1.2 7.4H240V0zM0 224v240c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V224H0z"},child:[]}]})(e)}function s6(e){return jt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M560 288h-80v96l-32-21.3-32 21.3v-96h-80c-8.8 0-16 7.2-16 16v192c0 8.8 7.2 16 16 16h224c8.8 0 16-7.2 16-16V304c0-8.8-7.2-16-16-16zm-384-64h224c8.8 0 16-7.2 16-16V16c0-8.8-7.2-16-16-16h-80v96l-32-21.3L256 96V0h-80c-8.8 0-16 7.2-16 16v192c0 8.8 7.2 16 16 16zm64 64h-80v96l-32-21.3L96 384v-96H16c-8.8 0-16 7.2-16 16v192c0 8.8 7.2 16 16 16h224c8.8 0 16-7.2 16-16V304c0-8.8-7.2-16-16-16z"},child:[]}]})(e)}function i6(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M436 480h-20V24c0-13.255-10.745-24-24-24H56C42.745 0 32 10.745 32 24v456H12c-6.627 0-12 5.373-12 12v20h448v-20c0-6.627-5.373-12-12-12zM128 76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76zm0 96c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40zm52 148h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12zm76 160h-64v-84c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v84zm64-172c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40z"},child:[]}]})(e)}function Xo(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V192H0v272zm320-196c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM192 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM64 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zM400 64h-48V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H160V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H48C21.5 64 0 85.5 0 112v48h448v-48c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}function __(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M436 160H12c-6.627 0-12-5.373-12-12v-36c0-26.51 21.49-48 48-48h48V12c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v52h128V12c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v52h48c26.51 0 48 21.49 48 48v36c0 6.627-5.373 12-12 12zM12 192h424c6.627 0 12 5.373 12 12v260c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V204c0-6.627 5.373-12 12-12zm333.296 95.947l-28.169-28.398c-4.667-4.705-12.265-4.736-16.97-.068L194.12 364.665l-45.98-46.352c-4.667-4.705-12.266-4.736-16.971-.068l-28.397 28.17c-4.705 4.667-4.736 12.265-.068 16.97l82.601 83.269c4.667 4.705 12.265 4.736 16.97.068l142.953-141.805c4.705-4.667 4.736-12.265.068-16.97z"},child:[]}]})(e)}function af(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z"},child:[]}]})(e)}function o6(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H64V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-32c0-8.84-7.16-16-16-16zM464 96H345.94c-21.38 0-32.09 25.85-16.97 40.97l32.4 32.4L288 242.75l-73.37-73.37c-12.5-12.5-32.76-12.5-45.25 0l-68.69 68.69c-6.25 6.25-6.25 16.38 0 22.63l22.62 22.62c6.25 6.25 16.38 6.25 22.63 0L192 237.25l73.37 73.37c12.5 12.5 32.76 12.5 45.25 0l96-96 32.4 32.4c15.12 15.12 40.97 4.41 40.97-16.97V112c.01-8.84-7.15-16-15.99-16z"},child:[]}]})(e)}function $n(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"},child:[]}]})(e)}function mc(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 480H48c-26.51 0-48-21.49-48-48V80c0-26.51 21.49-48 48-48h352c26.51 0 48 21.49 48 48v352c0 26.51-21.49 48-48 48zm-204.686-98.059l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.248-16.379-6.249-22.628 0L184 302.745l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.25 16.379 6.25 22.628.001z"},child:[]}]})(e)}function w_(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"},child:[]}]})(e)}function wc(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(e)}function k_(e){return jt({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(e)}function N_(e){return jt({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(e)}function iu(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(e)}function jb(e){return jt({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M336 64h-80c0-35.3-28.7-64-64-64s-64 28.7-64 64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM96 424c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm0-96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm0-96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm96-192c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm128 368c0 4.4-3.6 8-8 8H168c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16zm0-96c0 4.4-3.6 8-8 8H168c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16zm0-96c0 4.4-3.6 8-8 8H168c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16z"},child:[]}]})(e)}function gc(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm92.49,313h0l-20,25a16,16,0,0,1-22.49,2.5h0l-67-49.72a40,40,0,0,1-15-31.23V112a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16V256l58,42.5A16,16,0,0,1,348.49,321Z"},child:[]}]})(e)}function ou(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"},child:[]}]})(e)}function kc(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(e)}function Tn(e){return jt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M402.6 83.2l90.2 90.2c3.8 3.8 3.8 10 0 13.8L274.4 405.6l-92.8 10.3c-12.4 1.4-22.9-9.1-21.5-21.5l10.3-92.8L388.8 83.2c3.8-3.8 10-3.8 13.8 0zm162-22.9l-48.8-48.8c-15.2-15.2-39.9-15.2-55.2 0l-35.4 35.4c-3.8 3.8-3.8 10 0 13.8l90.2 90.2c3.8 3.8 10 3.8 13.8 0l35.4-35.4c15.2-15.3 15.2-40 0-55.2zM384 346.2V448H64V128h229.8c3.2 0 6.2-1.3 8.5-3.5l40-40c7.6-7.6 2.2-20.5-8.5-20.5H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V306.2c0-10.7-12.9-16-20.5-8.5l-40 40c-2.2 2.3-3.5 5.3-3.5 8.5z"},child:[]}]})(e)}function lu(e){return jt({attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M96 184c39.8 0 72 32.2 72 72s-32.2 72-72 72-72-32.2-72-72 32.2-72 72-72zM24 80c0 39.8 32.2 72 72 72s72-32.2 72-72S135.8 8 96 8 24 40.2 24 80zm0 352c0 39.8 32.2 72 72 72s72-32.2 72-72-32.2-72-72-72-72 32.2-72 72z"},child:[]}]})(e)}function Br(e){return jt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"},child:[]}]})(e)}function Nc(e){return jt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"},child:[]}]})(e)}function l6(e){return jt({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm64 236c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-64c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-72v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm96-114.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"},child:[]}]})(e)}function tp(e){return jt({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm-96 144c0 4.42-3.58 8-8 8h-8c-8.84 0-16 7.16-16 16v32c0 8.84 7.16 16 16 16h8c4.42 0 8 3.58 8 8v16c0 4.42-3.58 8-8 8h-8c-26.51 0-48-21.49-48-48v-32c0-26.51 21.49-48 48-48h8c4.42 0 8 3.58 8 8v16zm44.27 104H160c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h12.27c5.95 0 10.41-3.5 10.41-6.62 0-1.3-.75-2.66-2.12-3.84l-21.89-18.77c-8.47-7.22-13.33-17.48-13.33-28.14 0-21.3 19.02-38.62 42.41-38.62H200c4.42 0 8 3.58 8 8v16c0 4.42-3.58 8-8 8h-12.27c-5.95 0-10.41 3.5-10.41 6.62 0 1.3.75 2.66 2.12 3.84l21.89 18.77c8.47 7.22 13.33 17.48 13.33 28.14.01 21.29-19 38.62-42.39 38.62zM256 264v20.8c0 20.27 5.7 40.17 16 56.88 10.3-16.7 16-36.61 16-56.88V264c0-4.42 3.58-8 8-8h16c4.42 0 8 3.58 8 8v20.8c0 35.48-12.88 68.89-36.28 94.09-3.02 3.25-7.27 5.11-11.72 5.11s-8.7-1.86-11.72-5.11c-23.4-25.2-36.28-58.61-36.28-94.09V264c0-4.42 3.58-8 8-8h16c4.42 0 8 3.58 8 8zm121-159L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128v-6.1c0-6.3-2.5-12.4-7-16.9z"},child:[]}]})(e)}function ap(e){return jt({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm60.1 106.5L224 336l60.1 93.5c5.1 8-.6 18.5-10.1 18.5h-34.9c-4.4 0-8.5-2.4-10.6-6.3C208.9 405.5 192 373 192 373c-6.4 14.8-10 20-36.6 68.8-2.1 3.9-6.1 6.3-10.5 6.3H110c-9.5 0-15.2-10.5-10.1-18.5l60.3-93.5-60.3-93.5c-5.2-8 .6-18.5 10.1-18.5h34.8c4.4 0 8.5 2.4 10.6 6.3 26.1 48.8 20 33.6 36.6 68.5 0 0 6.1-11.7 36.6-68.5 2.1-3.9 6.2-6.3 10.6-6.3H274c9.5-.1 15.2 10.4 10.1 18.4zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"},child:[]}]})(e)}function ui(e){return jt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M384 121.9c0-6.3-2.5-12.4-7-16.9L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128zM571 308l-95.7-96.4c-10.1-10.1-27.4-3-27.4 11.3V288h-64v64h64v65.2c0 14.3 17.3 21.4 27.4 11.3L571 332c6.6-6.6 6.6-17.4 0-24zm-379 28v-32c0-8.8 7.2-16 16-16h176V160H248c-13.2 0-24-10.8-24-24V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V352H208c-8.8 0-16-7.2-16-16z"},child:[]}]})(e)}function Ko(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.976 0H24.028C2.71 0-8.047 25.866 7.058 40.971L192 225.941V432c0 7.831 3.821 15.17 10.237 19.662l80 55.98C298.02 518.69 320 507.493 320 487.98V225.941l184.947-184.97C520.021 25.896 509.338 0 487.976 0z"},child:[]}]})(e)}function c6(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M504 255.531c.253 136.64-111.18 248.372-247.82 248.468-59.015.042-113.223-20.53-155.822-54.911-11.077-8.94-11.905-25.541-1.839-35.607l11.267-11.267c8.609-8.609 22.353-9.551 31.891-1.984C173.062 425.135 212.781 440 256 440c101.705 0 184-82.311 184-184 0-101.705-82.311-184-184-184-48.814 0-93.149 18.969-126.068 49.932l50.754 50.754c10.08 10.08 2.941 27.314-11.313 27.314H24c-8.837 0-16-7.163-16-16V38.627c0-14.254 17.234-21.393 27.314-11.314l49.372 49.372C129.209 34.136 189.552 8 256 8c136.81 0 247.747 110.78 248 247.531zm-180.912 78.784l9.823-12.63c8.138-10.463 6.253-25.542-4.21-33.679L288 256.349V152c0-13.255-10.745-24-24-24h-16c-13.255 0-24 10.745-24 24v135.651l65.409 50.874c10.463 8.137 25.541 6.253 33.679-4.21z"},child:[]}]})(e)}function Rd(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"},child:[]}]})(e)}function cg(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"},child:[]}]})(e)}function d6(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(e)}function u6(e){return jt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M0 117.66v346.32c0 11.32 11.43 19.06 21.94 14.86L160 416V32L20.12 87.95A32.006 32.006 0 0 0 0 117.66zM192 416l192 64V96L192 32v384zM554.06 33.16L416 96v384l139.88-55.95A31.996 31.996 0 0 0 576 394.34V48.02c0-11.32-11.43-19.06-21.94-14.86z"},child:[]}]})(e)}function fi(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(e)}function Pf(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M448 192V77.25c0-8.49-3.37-16.62-9.37-22.63L393.37 9.37c-6-6-14.14-9.37-22.63-9.37H96C78.33 0 64 14.33 64 32v160c-35.35 0-64 28.65-64 64v112c0 8.84 7.16 16 16 16h48v96c0 17.67 14.33 32 32 32h320c17.67 0 32-14.33 32-32v-96h48c8.84 0 16-7.16 16-16V256c0-35.35-28.65-64-64-64zm-64 256H128v-96h256v96zm0-224H128V64h192v48c0 8.84 7.16 16 16 16h48v96zm48 72c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"},child:[]}]})(e)}function U0(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 224h192V32H0v192zM64 96h64v64H64V96zm192-64v192h192V32H256zm128 128h-64V96h64v64zM0 480h192V288H0v192zm64-128h64v64H64v-64zm352-64h32v128h-96v-32h-32v96h-64V288h96v32h64v-32zm0 160h32v32h-32v-32zm-64 0h32v32h-32v-32z"},child:[]}]})(e)}function Wn(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"},child:[]}]})(e)}function Ps(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(e)}function f6(e){return jt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M528.12 301.319l47.273-208C578.806 78.301 567.391 64 551.99 64H159.208l-9.166-44.81C147.758 8.021 137.93 0 126.529 0H24C10.745 0 0 10.745 0 24v16c0 13.255 10.745 24 24 24h69.883l70.248 343.435C147.325 417.1 136 435.222 136 456c0 30.928 25.072 56 56 56s56-25.072 56-56c0-15.674-6.447-29.835-16.824-40h209.647C430.447 426.165 424 440.326 424 456c0 30.928 25.072 56 56 56s56-25.072 56-56c0-22.172-12.888-41.332-31.579-50.405l5.517-24.276c3.413-15.018-8.002-29.319-23.403-29.319H218.117l-6.545-32h293.145c11.206 0 20.92-7.754 23.403-18.681z"},child:[]}]})(e)}function ds(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"},child:[]}]})(e)}function si(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}function rp(e){return jt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"},child:[]}]})(e)}function h6(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M440.65 12.57l4 82.77A247.16 247.16 0 0 0 255.83 8C134.73 8 33.91 94.92 12.29 209.82A12 12 0 0 0 24.09 224h49.05a12 12 0 0 0 11.67-9.26 175.91 175.91 0 0 1 317-56.94l-101.46-4.86a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12H500a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12h-47.37a12 12 0 0 0-11.98 12.57zM255.83 432a175.61 175.61 0 0 1-146-77.8l101.8 4.87a12 12 0 0 0 12.57-12v-47.4a12 12 0 0 0-12-12H12a12 12 0 0 0-12 12V500a12 12 0 0 0 12 12h47.35a12 12 0 0 0 12-12.6l-4.15-82.57A247.17 247.17 0 0 0 255.83 504c121.11 0 221.93-86.92 243.55-201.82a12 12 0 0 0-11.8-14.18h-49.05a12 12 0 0 0-11.67 9.26A175.86 175.86 0 0 1 255.83 432z"},child:[]}]})(e)}function Ld(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"},child:[]}]})(e)}function pt(e){return jt({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(e)}function Lg(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M501.1 395.7L384 278.6c-23.1-23.1-57.6-27.6-85.4-13.9L192 158.1V96L64 0 0 64l96 128h62.1l106.6 106.6c-13.6 27.8-9.2 62.3 13.9 85.4l117.1 117.1c14.6 14.6 38.2 14.6 52.7 0l52.7-52.7c14.5-14.6 14.5-38.2 0-52.7zM331.7 225c28.3 0 54.9 11 74.9 31l19.4 19.4c15.8-6.9 30.8-16.5 43.8-29.5 37.1-37.1 49.7-89.3 37.9-136.7-2.2-9-13.5-12.1-20.1-5.5l-74.4 74.4-67.9-11.3L334 98.9l74.4-74.4c6.6-6.6 3.4-17.9-5.7-20.2-47.4-11.7-99.6.9-136.6 37.9-28.5 28.5-41.9 66.1-41.2 103.6l82.1 82.1c8.1-1.9 16.5-2.9 24.7-2.9zm-103.9 82l-56.7-56.7L18.7 402.8c-25 25-25 65.5 0 90.5s65.5 25 90.5 0l123.6-123.6c-7.6-19.9-9.9-41.6-5-62.7zM64 472c-13.2 0-24-10.8-24-24 0-13.3 10.7-24 24-24s24 10.7 24 24c0 13.2-10.7 24-24 24z"},child:[]}]})(e)}function m6(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"},child:[]}]})(e)}function Xa(e){return jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"},child:[]}]})(e)}function Tb(e){return jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"},child:[]}]})(e)}const g6=()=>{var le,re,de,ye;const{t:e}=ln(),{data:t,loading:a}=ep(),{workOrders:s}=m_({},1e3,0),{logs:o}=Rf({},1e3,0),{assets:u}=x_({},1e3,0),[c,f]=E.useState(null),[p,g]=E.useState(null),[x,v]=E.useState(null),[_,k]=E.useState(null),[T,N]=E.useState(null),[j,P]=E.useState(null),[C,O]=E.useState({open:0,inProgress:0,completed:0,total:0}),[R,U]=E.useState({assetUptime:0,avgResponseTime:0,maintenanceEfficiency:0,overdueTasks:0,plannedMaintenance:0}),{data:H}=Uo("Up & Down Time Chart"),{data:B}=Uo("Work Order Status Chart"),{data:oe}=Uo("Maintenance - Asset wise Count"),{data:se}=Uo("Asset Maintenance Assignees Status Count"),{data:pe}=Uo("Asset Maintenance Frequency Chart");return E.useEffect(()=>{if(u&&u.length>0){let ue=0,te=0;u.forEach(ne=>{const ae=ne.custom_up_time||0,z=ne.custom_down_time||0;ue+=typeof ae=="number"?ae:0,te+=typeof z=="number"?z:0});const V=[],J=[];if(ue>0&&(V.push(e("dashboard.upTime")),J.push(ue)),te>0&&(V.push(e("dashboard.downTime")),J.push(te)),V.length>0&&J.length>0){const ne=[];ue>0&&ne.push("#6366F1"),te>0&&ne.push("#8B5CF6"),k({labels:V,datasets:[{name:"Time",values:J,colors:ne}],type:"Pie"})}else k(null)}else k(null)},[u]),E.useEffect(()=>{if(s&&s.length>0){const ue={};let te=0,V=0,J=0;s.forEach(He=>{const it=He.repair_status||"Unknown";ue[it]=(ue[it]||0)+1,it.toLowerCase()==="open"&&te++,it.toLowerCase()==="in progress"&&V++,it.toLowerCase()==="completed"&&J++});const ne=Object.keys(ue),ae=Object.values(ue),z={Open:"#F59E0B","In Progress":"#3B82F6",Pending:"#8B5CF6",Completed:"#10B981",Cancelled:"#EC4899",Unknown:"#6B7280"},D=ne.map(He=>z[He]||"#6366F1");f({labels:ne,datasets:[{name:"Work Orders",values:ae,colors:D}],type:"bar"}),O({open:te,inProgress:V,completed:J,total:s.length});const G={},q=new Set,K=He=>{const it=He.toLowerCase().trim();return it.includes("open")?"Open":it.includes("work in progress")||it.includes("in progress")||it.includes("wip")?"Work In Progress":it.includes("pending review")||it.includes("pending")?"Pending Review":it.includes("completed")||it.includes("complete")?"Completed":it.includes("closed")?"Closed":He};s.forEach(He=>{const it=He.work_order_type||"null",ht=K(He.repair_status||"Unknown");q.add(ht),G[it]||(G[it]={}),G[it][ht]||(G[it][ht]=0),G[it][ht]++});const fe=Object.keys(G),Pe=["Open","Work In Progress","Pending Review","Completed","Closed"],Fe=Array.from(q).sort((He,it)=>{const ht=Pe.indexOf(He),Vt=Pe.indexOf(it);return ht!==-1&&Vt!==-1?ht-Vt:ht!==-1?-1:Vt!==-1?1:He.localeCompare(it)}).map(He=>{const it=fe.map(ht=>G[ht][He]||0);return{name:He,values:it}});g({labels:fe,datasets:Fe,type:"Bar"})}else g(null)},[s]),E.useEffect(()=>{if(o&&o.length>0){const ue={};let te=0,V=0,J=0;const ne=new Date;o.forEach(Be=>{var ke,ze;const yt=Be.asset_name||"Unknown";ue[yt]=(ue[yt]||0)+1,((ke=Be.maintenance_status)==null?void 0:ke.toLowerCase())==="completed"&&te++,((ze=Be.maintenance_status)==null?void 0:ze.toLowerCase())==="planned"&&V++,Be.due_date&&new Date(Be.due_date)<ne&&Be.maintenance_status!=="Completed"&&J++});const ae=Object.entries(ue).sort(([,Be],[,yt])=>yt-Be).slice(0,10),z=ae.map(([Be])=>Be),D=ae.map(([,Be])=>Be),G=mf(z.length);v({labels:z,datasets:[{name:"Maintenance Count",values:D,colors:G}],type:"bar"});const q=o.length>0?te/o.length*100:0;U(Be=>Le(ie({},Be),{maintenanceEfficiency:q,overdueTasks:J,plannedMaintenance:V}));const K={},fe=new Set,Pe=(Be,yt)=>{const ke=Be.toLowerCase().trim(),ze=new Date,Je=yt.due_date?new Date(yt.due_date):null;return Je&&Je<ze&&ke!=="completed"&&ke!=="cancelled"?"Overdue":ke.includes("completed on time")||ke==="completed on time"?"Completed On Time":ke.includes("completed within")||ke.includes("within sla")||ke==="completed"?"Completed Within SLA":ke.includes("delay")||ke.includes("late")?"Delay In Completion":ke.includes("pending")||ke==="planned"?"Pending":ke.includes("overdue")?"Overdue":ke.includes("cancelled")||ke==="cancelled"?"Cancelled":Be};o.forEach(Be=>{const yt=Be.assign_to_name||"null",ke=Be.maintenance_status||"Unknown",ze=Pe(ke,Be);fe.add(ze),K[yt]||(K[yt]={}),K[yt][ze]||(K[yt][ze]=0),K[yt][ze]++});const We=Object.keys(K),Fe=["Completed On Time","Completed Within SLA","Delay In Completion","Pending","Overdue","Cancelled"],it=Array.from(fe).sort((Be,yt)=>{const ke=Fe.indexOf(Be),ze=Fe.indexOf(yt);return ke!==-1&&ze!==-1?ke-ze:ke!==-1?-1:ze!==-1?1:Be.localeCompare(yt)}).map(Be=>{const yt=We.map(ke=>K[ke][Be]||0);return{name:Be,values:yt}});N({labels:We,datasets:it,type:"Bar"});const ht={};o.forEach(Be=>{const yt=Be.periodicity||Be.maintenance_type||"Other";ht[yt]=(ht[yt]||0)+1});const Vt=Object.entries(ht).sort(([,Be],[,yt])=>yt-Be),_t=Vt.map(([Be])=>Be),ia=Vt.map(([,Be])=>Be),Lt=mf(_t.length);P({labels:_t,datasets:[{name:"Frequency",values:ia,colors:Lt}],type:"bar"})}else N(null),P(null)},[o]),E.useEffect(()=>{if(s&&s.length>0){let ue=0,te=0;s.forEach(ae=>{if(ae.creation&&ae.first_responded_on){const z=new Date(ae.creation),G=(new Date(ae.first_responded_on).getTime()-z.getTime())/(1e3*60*60);G>=0&&(ue+=G,te++)}});const V=te>0?ue/te:0,J=s.filter(ae=>{var z;return((z=ae.repair_status)==null?void 0:z.toLowerCase())==="completed"}).length,ne=s.length>0?J/s.length*100:0;U(ae=>Le(ie({},ae),{assetUptime:ne,avgResponseTime:V}))}},[s]),a?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600 mx-auto mb-4"}),r.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:e("dashboard.loading")})]})}):r.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:r.jsxs("div",{className:"max-w-[1600px] mx-auto",children:[r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-3 mb-6",children:[r.jsxs("div",{className:"lg:col-span-7 space-y-2",children:[r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow border border-gray-200 dark:border-gray-700 px-4 py-4",children:r.jsxs("div",{className:"grid grid-cols-12 gap-0 w-full",children:[r.jsx("div",{className:"col-span-2",children:r.jsx(Ql,{icon:r.jsx(s6,{className:"text-indigo-600"}),value:(le=t==null?void 0:t.total_assets)!=null?le:0,label:e("dashboard.totalAssets"),bgColor:"bg-indigo-50 dark:bg-indigo-900/20"})}),r.jsx("div",{className:"col-span-2",children:r.jsx(Ql,{icon:r.jsx(f6,{className:"text-purple-600"}),value:C.open||((re=t==null?void 0:t.work_orders_open)!=null?re:0),label:e("dashboard.openWorkOrders"),bgColor:"bg-purple-50 dark:bg-purple-900/20"})}),r.jsx("div",{className:"col-span-2",children:r.jsx(Ql,{icon:r.jsx(gc,{className:"text-blue-600"}),value:C.inProgress||((de=t==null?void 0:t.work_orders_in_progress)!=null?de:0),label:e("dashboard.workOrdersInProgress"),bgColor:"bg-blue-50 dark:bg-blue-900/20"})}),r.jsx("div",{className:"col-span-2",children:r.jsx(Ql,{icon:r.jsx($n,{className:"text-pink-600"}),value:C.completed||((ye=t==null?void 0:t.work_orders_completed)!=null?ye:0),label:e("dashboard.completedWorkOrders"),bgColor:"bg-pink-50 dark:bg-pink-900/20"})}),r.jsx("div",{className:"col-span-2",children:r.jsx(Ql,{icon:r.jsx(Lg,{className:"text-cyan-600"}),value:(o==null?void 0:o.length)||0,label:e("dashboard.maintenanceLogs"),bgColor:"bg-cyan-50 dark:bg-cyan-900/20"})}),r.jsx("div",{className:"col-span-2",children:r.jsx(Ql,{icon:r.jsx(o6,{className:"text-purple-600"}),value:C.total,label:e("dashboard.totalWorkOrders"),bgColor:"bg-purple-50 dark:bg-purple-900/20"})})]})}),r.jsx(p6,{totalWorkOrders:C.total,completedWorkOrders:C.completed,inProgressWorkOrders:C.inProgress})]}),r.jsx("div",{className:"lg:col-span-5",children:r.jsx(Eb,{title:e("dashboard.assigneesStatus"),data:T||se})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[r.jsx(H0,{icon:r.jsx($n,{className:"text-green-500"}),title:e("dashboard.assetUptime"),value:`${R.assetUptime.toFixed(1)}%`,trend:R.assetUptime>=90?"Excellent":R.assetUptime>=75?"Good":"Needs Attention",trendUp:R.assetUptime>=75,bgColor:"bg-green-50 dark:bg-green-900/20"}),r.jsx(H0,{icon:r.jsx(gc,{className:"text-blue-500"}),title:e("dashboard.avgResponseTime"),value:R.avgResponseTime>0?`${R.avgResponseTime.toFixed(1)} hrs`:"N/A",trend:R.avgResponseTime>0&&R.avgResponseTime<4?"Fast Response":"Monitor",trendUp:R.avgResponseTime>0&&R.avgResponseTime<4,bgColor:"bg-blue-50 dark:bg-blue-900/20"}),r.jsx(H0,{icon:r.jsx(Lg,{className:"text-orange-500"}),title:e("dashboard.maintenanceEfficiency"),value:`${R.maintenanceEfficiency.toFixed(1)}%`,trend:R.maintenanceEfficiency>=70?"On Track":"Needs Attention",trendUp:R.maintenanceEfficiency>=70,bgColor:"bg-orange-50 dark:bg-orange-900/20"}),r.jsx(H0,{icon:r.jsx(Br,{className:"text-red-500"}),title:e("dashboard.overdueMaintenance"),value:R.overdueTasks,trend:R.overdueTasks===0?"All Clear":R.overdueTasks<=3?"Low":"High Priority",trendUp:R.overdueTasks<=3,bgColor:"bg-red-50 dark:bg-red-900/20"})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 mb-6",children:[r.jsx("div",{className:"w-full",children:r.jsx(y6,{data:_||H,title:e("dashboard.upDownTimeChart"),description:"Asset uptime and downtime distribution for tracking availability."})}),r.jsx("div",{className:"md:col-span-2"})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 ",children:[r.jsx(Cb,{title:e("dashboard.maintenanceByAsset"),data:x||oe,type:"bar"}),r.jsx(Cb,{title:e("dashboard.maintenanceFrequency"),data:j||pe,type:"bar"}),r.jsx(x6,{data:c||B,totalWorkOrders:C.total,completedWorkOrders:C.completed}),r.jsx(Eb,{title:e("dashboard.workOrderStatus"),data:p||B})]})]})})},Ql=({icon:e,value:t,label:a,bgColor:s})=>r.jsxs("div",{className:"text-center py-2 px-1 border-r border-gray-200 dark:border-gray-700 last:border-r-0",children:[r.jsx("div",{className:`w-10 h-10 ${s} rounded-lg flex items-center justify-center text-base mx-auto mb-1.5`,children:e}),r.jsx("div",{className:"text-lg font-semibold text-gray-900 dark:text-white leading-none mb-1",children:t}),r.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide leading-tight px-1",children:a})]}),H0=({icon:e,title:t,value:a,trend:s,trendUp:o,bgColor:u})=>r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all p-4 border border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsx("div",{className:`w-10 h-10 ${u} rounded-lg flex items-center justify-center text-lg`,children:e}),r.jsxs("div",{className:`flex items-center gap-1 text-xs font-medium ${o?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:[o?r.jsx(r6,{className:"text-[10px]"}):r.jsx(a6,{className:"text-[10px]"}),s]})]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-1",children:a}),r.jsx("div",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:t})]}),p6=({totalWorkOrders:e,completedWorkOrders:t,inProgressWorkOrders:a})=>{const s=e>0?(t/e*100).toFixed(2):"0.00";return r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all px-5 border border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"mb-3",children:[r.jsxs("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-2",children:[s,"%"]}),r.jsx("div",{className:"text-sm font-medium text-indigo-600 dark:text-indigo-400 mb-1",children:"Completion Rate"})]}),r.jsx("div",{className:"mt-1",children:r.jsx(b6,{})}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-2 pt-2 mb-2 pb-2 border-t border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-lg font-semibold text-indigo-600 dark:text-indigo-400",children:e}),r.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase",children:"Total"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-lg font-semibold text-blue-600 dark:text-blue-400",children:a}),r.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase",children:"In Progress"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-lg font-semibold text-green-600 dark:text-green-400",children:t}),r.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase",children:"Completed"})]})]})]})},x6=({data:e,totalWorkOrders:t,completedWorkOrders:a})=>r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all px-5 py-5 border border-gray-200 dark:border-gray-700 flex flex-col",style:{minHeight:"100%"},children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Work Order Status Distribution"}),r.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[r.jsxs("div",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:[t," Total"]}),r.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:[r.jsxs("span",{className:"font-medium",children:[a," Completed"]}),r.jsxs("span",{className:"ml-1",children:["(",t>0?(a/t*100).toFixed(1):0,"%)"]})]})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("button",{className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:r.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{d:"M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"})})})})]}),r.jsx("div",{className:"flex-1",children:r.jsx(S_,{data:e})})]}),y6=({data:e,title:t,description:a})=>r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all p-5 border border-gray-200 dark:border-gray-700",children:[r.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-white mb-1",children:t}),r.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-4",children:a}),e?r.jsx(j_,{data:e}):r.jsx("div",{className:"h-64 flex items-center justify-center text-gray-400",children:"No data available"})]}),b6=()=>{const e=[10,15,13,17,14,18,16],t=Math.max(...e),a=400,s=80,o=e.map((c,f)=>{const p=f/(e.length-1)*a,g=s-c/t*s;return`${p},${g}`}).join(" "),u=`0,${s} ${o} ${a},${s}`;return r.jsxs("svg",{width:"100%",height:s,viewBox:`0 0 ${a} ${s}`,className:"w-full",children:[r.jsx("defs",{children:r.jsxs("linearGradient",{id:"areaGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[r.jsx("stop",{offset:"0%",style:{stopColor:"#8B5CF6",stopOpacity:.3}}),r.jsx("stop",{offset:"100%",style:{stopColor:"#8B5CF6",stopOpacity:.05}})]})}),r.jsx("polygon",{points:u,fill:"url(#areaGradient)"}),r.jsx("polyline",{points:o,fill:"none",stroke:"#8B5CF6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})},v6=({data:e})=>{const t=(e==null?void 0:e.labels)||[],a=(e==null?void 0:e.datasets)||[];if(!a.length)return r.jsx("div",{className:"text-center text-gray-400 py-4 text-sm",children:"No data available"});const s=a.flatMap(k=>k.values||[]),o=Math.max(...s,1),u=240,c=Math.max(800,t.length*100),f=Math.min(120,(c-100)/t.length),p=4,g=a.length,x=Math.max(12,(f-p*(g+1))/g),v={"Completed On Time":"#6366F1","Completed Within SLA":"#3B82F6","Delay In Completion":"#8B5CF6",Pending:"#A855F7",Overdue:"#EC4899",Cancelled:"#0EA5E9",Open:"#6366F1","Work In Progress":"#3B82F6","Pending Review":"#8B5CF6",Completed:"#6366F1",Closed:"#A855F7"},_=(k,T)=>{for(const[N,j]of Object.entries(v))if(k.toLowerCase().includes(N.toLowerCase()))return j;return mf(g)[T]};return r.jsxs("div",{className:"relative w-full overflow-x-auto",children:[r.jsxs("svg",{width:"100%",height:u+40,viewBox:`0 0 ${c} ${u+40}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[r.jsx("defs",{children:a.map((k,T)=>{const N=_(k.name||"",T);return r.jsxs("linearGradient",{id:`groupedBarGradient${T}`,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[r.jsx("stop",{offset:"0%",style:{stopColor:N,stopOpacity:.9}}),r.jsx("stop",{offset:"100%",style:{stopColor:N,stopOpacity:.7}})]},T)})}),[0,.25,.5,.75,1].map((k,T)=>r.jsx("line",{x1:"60",y1:u-k*u,x2:c-20,y2:u-k*u,stroke:"#E5E7EB",strokeWidth:"1",className:"dark:stroke-gray-700"},T)),[0,.25,.5,.75,1].map((k,T)=>r.jsx("text",{x:"45",y:u-k*u+4,textAnchor:"end",className:"text-xs fill-gray-400 dark:fill-gray-500",children:(o*k).toFixed(k===0?0:o<5?1:0)},T)),r.jsx("text",{x:"15",y:u/2,textAnchor:"middle",transform:`rotate(-90, 15, ${u/2})`,className:"text-xs fill-gray-600 dark:fill-gray-400 font-medium",children:"Count"}),t.map((k,T)=>{const N=80+T*f;return r.jsxs("g",{children:[a.map((j,P)=>{var B;const O=(((B=j.values)==null?void 0:B[T])||0)/o*u,R=N+p+P*(x+p),U=u-O,H=_(j.name||"",P);return r.jsx("g",{children:r.jsx("rect",{x:R,y:U,width:x,height:O,fill:H,rx:"4",ry:"4",className:"hover:opacity-80 cursor-pointer transition-opacity"})},P)}),r.jsx("text",{x:N+f/2,y:u+15,textAnchor:"middle",className:"text-xs fill-gray-600 dark:fill-gray-400",children:k&&k.length>12?k.substring(0,10)+"...":k||"null"})]},T)})]}),r.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2 mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:a.map((k,T)=>{const N=_(k.name||"",T);return r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-2.5 h-2.5 rounded",style:{backgroundColor:N}}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:k.name&&k.name.length>20?k.name.substring(0,18)+"...":k.name||`Series ${T+1}`})]},T)})})]})},S_=({data:e})=>{var x;const t=(e==null?void 0:e.labels)||[],a=(e==null?void 0:e.datasets)||[];if(!a.length)return r.jsx("div",{className:"text-center text-gray-400 py-8",children:"No data available"});const s=a.flatMap(v=>v.values||[]),o=Math.max(...s,1),u=250,p=Math.max(800,t.length*60+100),g=((x=a[0])==null?void 0:x.values)||[];return r.jsxs("div",{className:"relative w-full overflow-x-auto",children:[r.jsxs("svg",{width:"100%",height:"320",viewBox:`0 0 ${p} ${u+70}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[r.jsx("defs",{children:r.jsxs("linearGradient",{id:"barGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[r.jsx("stop",{offset:"0%",style:{stopColor:"#8B5CF6",stopOpacity:.8}}),r.jsx("stop",{offset:"100%",style:{stopColor:"#8B5CF6",stopOpacity:.6}})]})}),[0,.25,.5,.75,1].map((v,_)=>r.jsx("line",{x1:"60",y1:u-v*u,x2:p-20,y2:u-v*u,stroke:"#E5E7EB",strokeWidth:"1",className:"dark:stroke-gray-700"},_)),[0,.25,.5,.75,1].map((v,_)=>r.jsx("text",{x:"45",y:u-v*u+4,textAnchor:"end",className:"text-xs fill-gray-400 dark:fill-gray-500",children:(o*v).toFixed(0)},_)),t.map((v,_)=>{var P,C;const T=(((C=(P=a[0])==null?void 0:P.values)==null?void 0:C[_])||0)/o*u,N=Math.min(40,(p-100)/t.length-10),j=80+_*((p-100)/t.length);return r.jsx("g",{children:r.jsx("rect",{x:j,y:u-T,width:N,height:T,fill:"url(#barGradient)",rx:"4",ry:"4",className:"hover:opacity-80 cursor-pointer transition-opacity"})},_)}),g.length>0&&r.jsx("polyline",{points:g.map((v,_)=>{const k=80+_*((p-100)/t.length)+20,T=u-v/o*u;return`${k},${T}`}).join(" "),fill:"none",stroke:"#60A5FA",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"drop-shadow-md"}),g.map((v,_)=>{const k=80+_*((p-100)/t.length)+20,T=u-v/o*u;return r.jsx("circle",{cx:k,cy:T,r:"4",fill:"#3B82F6",className:"hover:r-6 cursor-pointer transition-all"},_)}),t.map((v,_)=>{const k=(p-100)/t.length,T=80+_*k+k/2,N=v&&v.length>15?v.substring(0,13)+"...":v||"null";return r.jsx("text",{x:T,y:u+50,transform:`rotate(-45, ${T}, ${u+50})`,textAnchor:"middle",className:"text-xs fill-gray-600 dark:fill-gray-400",children:N},_)})]}),r.jsxs("div",{className:"flex items-center justify-center gap-3 mt-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-3 h-3 rounded",style:{background:"#8B5CF6"}}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Total Sales"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Average"})]})]})]})},j_=({data:e})=>{var v,_,k,T;const t=(e==null?void 0:e.labels)||[],a=((_=(v=e==null?void 0:e.datasets)==null?void 0:v[0])==null?void 0:_.values)||[],s=t.some(N=>N.toLowerCase().includes("up time")||N.toLowerCase().includes("down time")||N.toLowerCase().includes("uptime")||N.toLowerCase().includes("downtime"));let o=[];if(s&&t.length>=1)o=t.map(N=>{const j=N.toLowerCase();return j.includes("up time")||j.includes("uptime")?"#6366F1":j.includes("down time")||j.includes("downtime")?"#8B5CF6":t.indexOf(N)===0?"#6366F1":"#8B5CF6"});else{const N=(T=(k=e==null?void 0:e.datasets)==null?void 0:k[0])==null?void 0:T.colors;o=N&&N.length===a.length?N:mf(a.length)}const u=a.reduce((N,j)=>N+j,0),c=100,f=c+10,p=c+10;let g=0;const x=a.map((N,j)=>{const P=g/u*2*Math.PI-Math.PI/2;g+=N;const C=g/u*2*Math.PI-Math.PI/2,O=C-P>Math.PI?1:0,R=f+c*Math.cos(P),U=p+c*Math.sin(P),H=f+c*Math.cos(C),B=p+c*Math.sin(C);return{path:`M ${f} ${p} L ${R} ${U} A ${c} ${c} 0 ${O} 1 ${H} ${B} Z`,color:o[j],label:t[j],value:N,percentage:(N/u*100).toFixed(1)}});return r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-around",children:[r.jsx("svg",{width:f*2,height:p*2,viewBox:`0 0 ${f*2} ${p*2}`,className:"max-w-xs",children:x.map((N,j)=>r.jsx("path",{d:N.path,fill:N.color,className:"hover:opacity-80 transition-opacity cursor-pointer drop-shadow-lg"},j))}),r.jsx("div",{className:"flex flex-col gap-3 mt-4 md:mt-0",children:x.map((N,j)=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),r.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:N.label}),r.jsx("span",{className:"text-sm font-bold text-gray-900 dark:text-white",children:N.value})]},j))})]})},Eb=({title:e,data:t})=>r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all p-3 border border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h3",{className:"text-sm font-semibold text-gray-800 dark:text-white",children:e}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{className:"p-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:r.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})})}),r.jsx("button",{className:"p-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:r.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{d:"M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"})})})]})]}),!t||!t.datasets||!t.datasets.length?r.jsx("div",{className:"h-48 flex items-center justify-center text-gray-400",children:r.jsx("div",{className:"text-center",children:r.jsx("div",{className:"text-xs",children:"No chart data available"})})}):r.jsx(v6,{data:t})]}),Cb=({title:e,data:t,type:a})=>r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all p-5 border border-gray-200 dark:border-gray-700",children:[r.jsx("h3",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4",children:e}),!t||!t.datasets||!t.datasets.length?r.jsx("div",{className:"h-64 flex items-center justify-center text-gray-400",children:r.jsx("div",{className:"text-center",children:r.jsx("div",{className:"text-sm",children:"No chart data available"})})}):a==="pie"?r.jsx(j_,{data:t}):r.jsx(S_,{data:t})]});function mf(e){const t=["#8B5CF6","#6366F1","#3B82F6","#06B6D4","#14B8A6","#EC4899","#A855F7","#0EA5E9","#10B981","#F472B6","#7C3AED","#2DD4BF"];return Array.from({length:e},(a,s)=>t[s%t.length])}function T_(e,t){return function(){return e.apply(t,arguments)}}const{toString:_6}=Object.prototype,{getPrototypeOf:np}=Object,{iterator:Ff,toStringTag:E_}=Symbol,If=(e=>t=>{const a=_6.call(t);return e[a]||(e[a]=a.slice(8,-1).toLowerCase())})(Object.create(null)),ms=e=>(e=e.toLowerCase(),t=>If(t)===e),Bf=e=>t=>typeof t===e,{isArray:Sc}=Array,pc=Bf("undefined");function cu(e){return e!==null&&!pc(e)&&e.constructor!==null&&!pc(e.constructor)&&an(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const C_=ms("ArrayBuffer");function w6(e){let t;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&C_(e.buffer),t}const k6=Bf("string"),an=Bf("function"),A_=Bf("number"),du=e=>e!==null&&typeof e=="object",N6=e=>e===!0||e===!1,rf=e=>{if(If(e)!=="object")return!1;const t=np(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(E_ in e)&&!(Ff in e)},S6=e=>{if(!du(e)||cu(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},j6=ms("Date"),T6=ms("File"),E6=ms("Blob"),C6=ms("FileList"),A6=e=>du(e)&&an(e.pipe),O6=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||an(e.append)&&((t=If(e))==="formdata"||t==="object"&&an(e.toString)&&e.toString()==="[object FormData]"))},L6=ms("URLSearchParams"),[M6,D6,R6,P6]=["ReadableStream","Request","Response","Headers"].map(ms),F6=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function uu(e,t,{allOwnKeys:a=!1}={}){if(e===null||typeof e=="undefined")return;let s,o;if(typeof e!="object"&&(e=[e]),Sc(e))for(s=0,o=e.length;s<o;s++)t.call(null,e[s],s,e);else{if(cu(e))return;const u=a?Object.getOwnPropertyNames(e):Object.keys(e),c=u.length;let f;for(s=0;s<c;s++)f=u[s],t.call(null,e[f],f,e)}}function O_(e,t){if(cu(e))return null;t=t.toLowerCase();const a=Object.keys(e);let s=a.length,o;for(;s-- >0;)if(o=a[s],t===o.toLowerCase())return o;return null}const Vo=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,L_=e=>!pc(e)&&e!==Vo;function Mg(){const{caseless:e,skipUndefined:t}=L_(this)&&this||{},a={},s=(o,u)=>{const c=e&&O_(a,u)||u;rf(a[c])&&rf(o)?a[c]=Mg(a[c],o):rf(o)?a[c]=Mg({},o):Sc(o)?a[c]=o.slice():(!t||!pc(o))&&(a[c]=o)};for(let o=0,u=arguments.length;o<u;o++)arguments[o]&&uu(arguments[o],s);return a}const I6=(e,t,a,{allOwnKeys:s}={})=>(uu(t,(o,u)=>{a&&an(o)?e[u]=T_(o,a):e[u]=o},{allOwnKeys:s}),e),B6=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),z6=(e,t,a,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),a&&Object.assign(e.prototype,a)},U6=(e,t,a,s)=>{let o,u,c;const f={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),u=o.length;u-- >0;)c=o[u],(!s||s(c,e,t))&&!f[c]&&(t[c]=e[c],f[c]=!0);e=a!==!1&&np(e)}while(e&&(!a||a(e,t))&&e!==Object.prototype);return t},H6=(e,t,a)=>{e=String(e),(a===void 0||a>e.length)&&(a=e.length),a-=t.length;const s=e.indexOf(t,a);return s!==-1&&s===a},$6=e=>{if(!e)return null;if(Sc(e))return e;let t=e.length;if(!A_(t))return null;const a=new Array(t);for(;t-- >0;)a[t]=e[t];return a},W6=(e=>t=>e&&t instanceof e)(typeof Uint8Array!="undefined"&&np(Uint8Array)),V6=(e,t)=>{const s=(e&&e[Ff]).call(e);let o;for(;(o=s.next())&&!o.done;){const u=o.value;t.call(e,u[0],u[1])}},G6=(e,t)=>{let a;const s=[];for(;(a=e.exec(t))!==null;)s.push(a);return s},Z6=ms("HTMLFormElement"),q6=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(a,s,o){return s.toUpperCase()+o}),Ab=(({hasOwnProperty:e})=>(t,a)=>e.call(t,a))(Object.prototype),Y6=ms("RegExp"),M_=(e,t)=>{const a=Object.getOwnPropertyDescriptors(e),s={};uu(a,(o,u)=>{let c;(c=t(o,u,e))!==!1&&(s[u]=c||o)}),Object.defineProperties(e,s)},X6=e=>{M_(e,(t,a)=>{if(an(e)&&["arguments","caller","callee"].indexOf(a)!==-1)return!1;const s=e[a];if(an(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+a+"'")})}})},K6=(e,t)=>{const a={},s=o=>{o.forEach(u=>{a[u]=!0})};return Sc(e)?s(e):s(String(e).split(t)),a},J6=()=>{},Q6=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ej(e){return!!(e&&an(e.append)&&e[E_]==="FormData"&&e[Ff])}const tj=e=>{const t=new Array(10),a=(s,o)=>{if(du(s)){if(t.indexOf(s)>=0)return;if(cu(s))return s;if(!("toJSON"in s)){t[o]=s;const u=Sc(s)?[]:{};return uu(s,(c,f)=>{const p=a(c,o+1);!pc(p)&&(u[f]=p)}),t[o]=void 0,u}}return s};return a(e,0)},aj=ms("AsyncFunction"),rj=e=>e&&(du(e)||an(e))&&an(e.then)&&an(e.catch),D_=((e,t)=>e?setImmediate:t?((a,s)=>(Vo.addEventListener("message",({source:o,data:u})=>{o===Vo&&u===a&&s.length&&s.shift()()},!1),o=>{s.push(o),Vo.postMessage(a,"*")}))(`axios@${Math.random()}`,[]):a=>setTimeout(a))(typeof setImmediate=="function",an(Vo.postMessage)),nj=typeof queueMicrotask!="undefined"?queueMicrotask.bind(Vo):typeof process!="undefined"&&process.nextTick||D_,sj=e=>e!=null&&an(e[Ff]),Me={isArray:Sc,isArrayBuffer:C_,isBuffer:cu,isFormData:O6,isArrayBufferView:w6,isString:k6,isNumber:A_,isBoolean:N6,isObject:du,isPlainObject:rf,isEmptyObject:S6,isReadableStream:M6,isRequest:D6,isResponse:R6,isHeaders:P6,isUndefined:pc,isDate:j6,isFile:T6,isBlob:E6,isRegExp:Y6,isFunction:an,isStream:A6,isURLSearchParams:L6,isTypedArray:W6,isFileList:C6,forEach:uu,merge:Mg,extend:I6,trim:F6,stripBOM:B6,inherits:z6,toFlatObject:U6,kindOf:If,kindOfTest:ms,endsWith:H6,toArray:$6,forEachEntry:V6,matchAll:G6,isHTMLForm:Z6,hasOwnProperty:Ab,hasOwnProp:Ab,reduceDescriptors:M_,freezeMethods:X6,toObjectSet:K6,toCamelCase:q6,noop:J6,toFiniteNumber:Q6,findKey:O_,global:Vo,isContextDefined:L_,isSpecCompliantForm:ej,toJSONObject:tj,isAsyncFn:aj,isThenable:rj,setImmediate:D_,asap:nj,isIterable:sj};function zt(e,t,a,s,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),a&&(this.config=a),s&&(this.request=s),o&&(this.response=o,this.status=o.status?o.status:null)}Me.inherits(zt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Me.toJSONObject(this.config),code:this.code,status:this.status}}});const R_=zt.prototype,P_={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{P_[e]={value:e}});Object.defineProperties(zt,P_);Object.defineProperty(R_,"isAxiosError",{value:!0});zt.from=(e,t,a,s,o,u)=>{const c=Object.create(R_);Me.toFlatObject(e,c,function(x){return x!==Error.prototype},g=>g!=="isAxiosError");const f=e&&e.message?e.message:"Error",p=t==null&&e?e.code:t;return zt.call(c,f,p,a,s,o),e&&c.cause==null&&Object.defineProperty(c,"cause",{value:e,configurable:!0}),c.name=e&&e.name||"Error",u&&Object.assign(c,u),c};const ij=null;function Dg(e){return Me.isPlainObject(e)||Me.isArray(e)}function F_(e){return Me.endsWith(e,"[]")?e.slice(0,-2):e}function Ob(e,t,a){return e?e.concat(t).map(function(o,u){return o=F_(o),!a&&u?"["+o+"]":o}).join(a?".":""):t}function oj(e){return Me.isArray(e)&&!e.some(Dg)}const lj=Me.toFlatObject(Me,{},null,function(t){return/^is[A-Z]/.test(t)});function zf(e,t,a){if(!Me.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,a=Me.toFlatObject(a,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,j){return!Me.isUndefined(j[N])});const s=a.metaTokens,o=a.visitor||x,u=a.dots,c=a.indexes,p=(a.Blob||typeof Blob!="undefined"&&Blob)&&Me.isSpecCompliantForm(t);if(!Me.isFunction(o))throw new TypeError("visitor must be a function");function g(T){if(T===null)return"";if(Me.isDate(T))return T.toISOString();if(Me.isBoolean(T))return T.toString();if(!p&&Me.isBlob(T))throw new zt("Blob is not supported. Use a Buffer instead.");return Me.isArrayBuffer(T)||Me.isTypedArray(T)?p&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function x(T,N,j){let P=T;if(T&&!j&&typeof T=="object"){if(Me.endsWith(N,"{}"))N=s?N:N.slice(0,-2),T=JSON.stringify(T);else if(Me.isArray(T)&&oj(T)||(Me.isFileList(T)||Me.endsWith(N,"[]"))&&(P=Me.toArray(T)))return N=F_(N),P.forEach(function(O,R){!(Me.isUndefined(O)||O===null)&&t.append(c===!0?Ob([N],R,u):c===null?N:N+"[]",g(O))}),!1}return Dg(T)?!0:(t.append(Ob(j,N,u),g(T)),!1)}const v=[],_=Object.assign(lj,{defaultVisitor:x,convertValue:g,isVisitable:Dg});function k(T,N){if(!Me.isUndefined(T)){if(v.indexOf(T)!==-1)throw Error("Circular reference detected in "+N.join("."));v.push(T),Me.forEach(T,function(P,C){(!(Me.isUndefined(P)||P===null)&&o.call(t,P,Me.isString(C)?C.trim():C,N,_))===!0&&k(P,N?N.concat(C):[C])}),v.pop()}}if(!Me.isObject(e))throw new TypeError("data must be an object");return k(e),t}function Lb(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function sp(e,t){this._pairs=[],e&&zf(e,this,t)}const I_=sp.prototype;I_.append=function(t,a){this._pairs.push([t,a])};I_.toString=function(t){const a=t?function(s){return t.call(this,s,Lb)}:Lb;return this._pairs.map(function(o){return a(o[0])+"="+a(o[1])},"").join("&")};function cj(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function B_(e,t,a){if(!t)return e;const s=a&&a.encode||cj;Me.isFunction(a)&&(a={serialize:a});const o=a&&a.serialize;let u;if(o?u=o(t,a):u=Me.isURLSearchParams(t)?t.toString():new sp(t,a).toString(s),u){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+u}return e}class Mb{constructor(){this.handlers=[]}use(t,a,s){return this.handlers.push({fulfilled:t,rejected:a,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Me.forEach(this.handlers,function(s){s!==null&&t(s)})}}const z_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},dj=typeof URLSearchParams!="undefined"?URLSearchParams:sp,uj=typeof FormData!="undefined"?FormData:null,fj=typeof Blob!="undefined"?Blob:null,hj={isBrowser:!0,classes:{URLSearchParams:dj,FormData:uj,Blob:fj},protocols:["http","https","file","blob","url","data"]},ip=typeof window!="undefined"&&typeof document!="undefined",Rg=typeof navigator=="object"&&navigator||void 0,mj=ip&&(!Rg||["ReactNative","NativeScript","NS"].indexOf(Rg.product)<0),gj=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",pj=ip&&window.location.href||"http://localhost",xj=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ip,hasStandardBrowserEnv:mj,hasStandardBrowserWebWorkerEnv:gj,navigator:Rg,origin:pj},Symbol.toStringTag,{value:"Module"})),Or=ie(ie({},xj),hj);function yj(e,t){return zf(e,new Or.classes.URLSearchParams,ie({visitor:function(a,s,o,u){return Or.isNode&&Me.isBuffer(a)?(this.append(s,a.toString("base64")),!1):u.defaultVisitor.apply(this,arguments)}},t))}function bj(e){return Me.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function vj(e){const t={},a=Object.keys(e);let s;const o=a.length;let u;for(s=0;s<o;s++)u=a[s],t[u]=e[u];return t}function U_(e){function t(a,s,o,u){let c=a[u++];if(c==="__proto__")return!0;const f=Number.isFinite(+c),p=u>=a.length;return c=!c&&Me.isArray(o)?o.length:c,p?(Me.hasOwnProp(o,c)?o[c]=[o[c],s]:o[c]=s,!f):((!o[c]||!Me.isObject(o[c]))&&(o[c]=[]),t(a,s,o[c],u)&&Me.isArray(o[c])&&(o[c]=vj(o[c])),!f)}if(Me.isFormData(e)&&Me.isFunction(e.entries)){const a={};return Me.forEachEntry(e,(s,o)=>{t(bj(s),o,a,0)}),a}return null}function _j(e,t,a){if(Me.isString(e))try{return(t||JSON.parse)(e),Me.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(a||JSON.stringify)(e)}const fu={transitional:z_,adapter:["xhr","http","fetch"],transformRequest:[function(t,a){const s=a.getContentType()||"",o=s.indexOf("application/json")>-1,u=Me.isObject(t);if(u&&Me.isHTMLForm(t)&&(t=new FormData(t)),Me.isFormData(t))return o?JSON.stringify(U_(t)):t;if(Me.isArrayBuffer(t)||Me.isBuffer(t)||Me.isStream(t)||Me.isFile(t)||Me.isBlob(t)||Me.isReadableStream(t))return t;if(Me.isArrayBufferView(t))return t.buffer;if(Me.isURLSearchParams(t))return a.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let f;if(u){if(s.indexOf("application/x-www-form-urlencoded")>-1)return yj(t,this.formSerializer).toString();if((f=Me.isFileList(t))||s.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return zf(f?{"files[]":t}:t,p&&new p,this.formSerializer)}}return u||o?(a.setContentType("application/json",!1),_j(t)):t}],transformResponse:[function(t){const a=this.transitional||fu.transitional,s=a&&a.forcedJSONParsing,o=this.responseType==="json";if(Me.isResponse(t)||Me.isReadableStream(t))return t;if(t&&Me.isString(t)&&(s&&!this.responseType||o)){const c=!(a&&a.silentJSONParsing)&&o;try{return JSON.parse(t,this.parseReviver)}catch(f){if(c)throw f.name==="SyntaxError"?zt.from(f,zt.ERR_BAD_RESPONSE,this,null,this.response):f}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Or.classes.FormData,Blob:Or.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Me.forEach(["delete","get","head","post","put","patch"],e=>{fu.headers[e]={}});const wj=Me.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),kj=e=>{const t={};let a,s,o;return e&&e.split(`
`).forEach(function(c){o=c.indexOf(":"),a=c.substring(0,o).trim().toLowerCase(),s=c.substring(o+1).trim(),!(!a||t[a]&&wj[a])&&(a==="set-cookie"?t[a]?t[a].push(s):t[a]=[s]:t[a]=t[a]?t[a]+", "+s:s)}),t},Db=Symbol("internals");function Md(e){return e&&String(e).trim().toLowerCase()}function nf(e){return e===!1||e==null?e:Me.isArray(e)?e.map(nf):String(e)}function Nj(e){const t=Object.create(null),a=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=a.exec(e);)t[s[1]]=s[2];return t}const Sj=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function dg(e,t,a,s,o){if(Me.isFunction(s))return s.call(this,t,a);if(o&&(t=a),!!Me.isString(t)){if(Me.isString(s))return t.indexOf(s)!==-1;if(Me.isRegExp(s))return s.test(t)}}function jj(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,a,s)=>a.toUpperCase()+s)}function Tj(e,t){const a=Me.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+a,{value:function(o,u,c){return this[s].call(this,t,o,u,c)},configurable:!0})})}let rn=class{constructor(t){t&&this.set(t)}set(t,a,s){const o=this;function u(f,p,g){const x=Md(p);if(!x)throw new Error("header name must be a non-empty string");const v=Me.findKey(o,x);(!v||o[v]===void 0||g===!0||g===void 0&&o[v]!==!1)&&(o[v||p]=nf(f))}const c=(f,p)=>Me.forEach(f,(g,x)=>u(g,x,p));if(Me.isPlainObject(t)||t instanceof this.constructor)c(t,a);else if(Me.isString(t)&&(t=t.trim())&&!Sj(t))c(kj(t),a);else if(Me.isObject(t)&&Me.isIterable(t)){let f={},p,g;for(const x of t){if(!Me.isArray(x))throw TypeError("Object iterator must return a key-value pair");f[g=x[0]]=(p=f[g])?Me.isArray(p)?[...p,x[1]]:[p,x[1]]:x[1]}c(f,a)}else t!=null&&u(a,t,s);return this}get(t,a){if(t=Md(t),t){const s=Me.findKey(this,t);if(s){const o=this[s];if(!a)return o;if(a===!0)return Nj(o);if(Me.isFunction(a))return a.call(this,o,s);if(Me.isRegExp(a))return a.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,a){if(t=Md(t),t){const s=Me.findKey(this,t);return!!(s&&this[s]!==void 0&&(!a||dg(this,this[s],s,a)))}return!1}delete(t,a){const s=this;let o=!1;function u(c){if(c=Md(c),c){const f=Me.findKey(s,c);f&&(!a||dg(s,s[f],f,a))&&(delete s[f],o=!0)}}return Me.isArray(t)?t.forEach(u):u(t),o}clear(t){const a=Object.keys(this);let s=a.length,o=!1;for(;s--;){const u=a[s];(!t||dg(this,this[u],u,t,!0))&&(delete this[u],o=!0)}return o}normalize(t){const a=this,s={};return Me.forEach(this,(o,u)=>{const c=Me.findKey(s,u);if(c){a[c]=nf(o),delete a[u];return}const f=t?jj(u):String(u).trim();f!==u&&delete a[u],a[f]=nf(o),s[f]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const a=Object.create(null);return Me.forEach(this,(s,o)=>{s!=null&&s!==!1&&(a[o]=t&&Me.isArray(s)?s.join(", "):s)}),a}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,a])=>t+": "+a).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...a){const s=new this(t);return a.forEach(o=>s.set(o)),s}static accessor(t){const s=(this[Db]=this[Db]={accessors:{}}).accessors,o=this.prototype;function u(c){const f=Md(c);s[f]||(Tj(o,c),s[f]=!0)}return Me.isArray(t)?t.forEach(u):u(t),this}};rn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Me.reduceDescriptors(rn.prototype,({value:e},t)=>{let a=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[a]=s}}});Me.freezeMethods(rn);function ug(e,t){const a=this||fu,s=t||a,o=rn.from(s.headers);let u=s.data;return Me.forEach(e,function(f){u=f.call(a,u,o.normalize(),t?t.status:void 0)}),o.normalize(),u}function H_(e){return!!(e&&e.__CANCEL__)}function jc(e,t,a){zt.call(this,e==null?"canceled":e,zt.ERR_CANCELED,t,a),this.name="CanceledError"}Me.inherits(jc,zt,{__CANCEL__:!0});function $_(e,t,a){const s=a.config.validateStatus;!a.status||!s||s(a.status)?e(a):t(new zt("Request failed with status code "+a.status,[zt.ERR_BAD_REQUEST,zt.ERR_BAD_RESPONSE][Math.floor(a.status/100)-4],a.config,a.request,a))}function Ej(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Cj(e,t){e=e||10;const a=new Array(e),s=new Array(e);let o=0,u=0,c;return t=t!==void 0?t:1e3,function(p){const g=Date.now(),x=s[u];c||(c=g),a[o]=p,s[o]=g;let v=u,_=0;for(;v!==o;)_+=a[v++],v=v%e;if(o=(o+1)%e,o===u&&(u=(u+1)%e),g-c<t)return;const k=x&&g-x;return k?Math.round(_*1e3/k):void 0}}function Aj(e,t){let a=0,s=1e3/t,o,u;const c=(g,x=Date.now())=>{a=x,o=null,u&&(clearTimeout(u),u=null),e(...g)};return[(...g)=>{const x=Date.now(),v=x-a;v>=s?c(g,x):(o=g,u||(u=setTimeout(()=>{u=null,c(o)},s-v)))},()=>o&&c(o)]}const gf=(e,t,a=3)=>{let s=0;const o=Cj(50,250);return Aj(u=>{const c=u.loaded,f=u.lengthComputable?u.total:void 0,p=c-s,g=o(p),x=c<=f;s=c;const v={loaded:c,total:f,progress:f?c/f:void 0,bytes:p,rate:g||void 0,estimated:g&&f&&x?(f-c)/g:void 0,event:u,lengthComputable:f!=null,[t?"download":"upload"]:!0};e(v)},a)},Rb=(e,t)=>{const a=e!=null;return[s=>t[0]({lengthComputable:a,total:e,loaded:s}),t[1]]},Pb=e=>(...t)=>Me.asap(()=>e(...t)),Oj=Or.hasStandardBrowserEnv?((e,t)=>a=>(a=new URL(a,Or.origin),e.protocol===a.protocol&&e.host===a.host&&(t||e.port===a.port)))(new URL(Or.origin),Or.navigator&&/(msie|trident)/i.test(Or.navigator.userAgent)):()=>!0,Lj=Or.hasStandardBrowserEnv?{write(e,t,a,s,o,u,c){if(typeof document=="undefined")return;const f=[`${e}=${encodeURIComponent(t)}`];Me.isNumber(a)&&f.push(`expires=${new Date(a).toUTCString()}`),Me.isString(s)&&f.push(`path=${s}`),Me.isString(o)&&f.push(`domain=${o}`),u===!0&&f.push("secure"),Me.isString(c)&&f.push(`SameSite=${c}`),document.cookie=f.join("; ")},read(e){if(typeof document=="undefined")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Mj(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Dj(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function W_(e,t,a){let s=!Mj(t);return e&&(s||a==!1)?Dj(e,t):t}const Fb=e=>e instanceof rn?ie({},e):e;function Jo(e,t){t=t||{};const a={};function s(g,x,v,_){return Me.isPlainObject(g)&&Me.isPlainObject(x)?Me.merge.call({caseless:_},g,x):Me.isPlainObject(x)?Me.merge({},x):Me.isArray(x)?x.slice():x}function o(g,x,v,_){if(Me.isUndefined(x)){if(!Me.isUndefined(g))return s(void 0,g,v,_)}else return s(g,x,v,_)}function u(g,x){if(!Me.isUndefined(x))return s(void 0,x)}function c(g,x){if(Me.isUndefined(x)){if(!Me.isUndefined(g))return s(void 0,g)}else return s(void 0,x)}function f(g,x,v){if(v in t)return s(g,x);if(v in e)return s(void 0,g)}const p={url:u,method:u,data:u,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:f,headers:(g,x,v)=>o(Fb(g),Fb(x),v,!0)};return Me.forEach(Object.keys(ie(ie({},e),t)),function(x){const v=p[x]||o,_=v(e[x],t[x],x);Me.isUndefined(_)&&v!==f||(a[x]=_)}),a}const V_=e=>{const t=Jo({},e);let{data:a,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:u,headers:c,auth:f}=t;if(t.headers=c=rn.from(c),t.url=B_(W_(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),f&&c.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):""))),Me.isFormData(a)){if(Or.hasStandardBrowserEnv||Or.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(Me.isFunction(a.getHeaders)){const p=a.getHeaders(),g=["content-type","content-length"];Object.entries(p).forEach(([x,v])=>{g.includes(x.toLowerCase())&&c.set(x,v)})}}if(Or.hasStandardBrowserEnv&&(s&&Me.isFunction(s)&&(s=s(t)),s||s!==!1&&Oj(t.url))){const p=o&&u&&Lj.read(u);p&&c.set(o,p)}return t},Rj=typeof XMLHttpRequest!="undefined",Pj=Rj&&function(e){return new Promise(function(a,s){const o=V_(e);let u=o.data;const c=rn.from(o.headers).normalize();let{responseType:f,onUploadProgress:p,onDownloadProgress:g}=o,x,v,_,k,T;function N(){k&&k(),T&&T(),o.cancelToken&&o.cancelToken.unsubscribe(x),o.signal&&o.signal.removeEventListener("abort",x)}let j=new XMLHttpRequest;j.open(o.method.toUpperCase(),o.url,!0),j.timeout=o.timeout;function P(){if(!j)return;const O=rn.from("getAllResponseHeaders"in j&&j.getAllResponseHeaders()),U={data:!f||f==="text"||f==="json"?j.responseText:j.response,status:j.status,statusText:j.statusText,headers:O,config:e,request:j};$_(function(B){a(B),N()},function(B){s(B),N()},U),j=null}"onloadend"in j?j.onloadend=P:j.onreadystatechange=function(){!j||j.readyState!==4||j.status===0&&!(j.responseURL&&j.responseURL.indexOf("file:")===0)||setTimeout(P)},j.onabort=function(){j&&(s(new zt("Request aborted",zt.ECONNABORTED,e,j)),j=null)},j.onerror=function(R){const U=R&&R.message?R.message:"Network Error",H=new zt(U,zt.ERR_NETWORK,e,j);H.event=R||null,s(H),j=null},j.ontimeout=function(){let R=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const U=o.transitional||z_;o.timeoutErrorMessage&&(R=o.timeoutErrorMessage),s(new zt(R,U.clarifyTimeoutError?zt.ETIMEDOUT:zt.ECONNABORTED,e,j)),j=null},u===void 0&&c.setContentType(null),"setRequestHeader"in j&&Me.forEach(c.toJSON(),function(R,U){j.setRequestHeader(U,R)}),Me.isUndefined(o.withCredentials)||(j.withCredentials=!!o.withCredentials),f&&f!=="json"&&(j.responseType=o.responseType),g&&([_,T]=gf(g,!0),j.addEventListener("progress",_)),p&&j.upload&&([v,k]=gf(p),j.upload.addEventListener("progress",v),j.upload.addEventListener("loadend",k)),(o.cancelToken||o.signal)&&(x=O=>{j&&(s(!O||O.type?new jc(null,e,j):O),j.abort(),j=null)},o.cancelToken&&o.cancelToken.subscribe(x),o.signal&&(o.signal.aborted?x():o.signal.addEventListener("abort",x)));const C=Ej(o.url);if(C&&Or.protocols.indexOf(C)===-1){s(new zt("Unsupported protocol "+C+":",zt.ERR_BAD_REQUEST,e));return}j.send(u||null)})},Fj=(e,t)=>{const{length:a}=e=e?e.filter(Boolean):[];if(t||a){let s=new AbortController,o;const u=function(g){if(!o){o=!0,f();const x=g instanceof Error?g:this.reason;s.abort(x instanceof zt?x:new jc(x instanceof Error?x.message:x))}};let c=t&&setTimeout(()=>{c=null,u(new zt(`timeout ${t} of ms exceeded`,zt.ETIMEDOUT))},t);const f=()=>{e&&(c&&clearTimeout(c),c=null,e.forEach(g=>{g.unsubscribe?g.unsubscribe(u):g.removeEventListener("abort",u)}),e=null)};e.forEach(g=>g.addEventListener("abort",u));const{signal:p}=s;return p.unsubscribe=()=>Me.asap(f),p}},Ij=function*(e,t){let a=e.byteLength;if(a<t){yield e;return}let s=0,o;for(;s<a;)o=s+t,yield e.slice(s,o),s=o},Bj=function(e,t){return qm(this,null,function*(){try{for(var a=D1(zj(e)),s,o,u;s=!(o=yield new Bo(a.next())).done;s=!1){const c=o.value;yield*Ym(Ij(c,t))}}catch(o){u=[o]}finally{try{s&&(o=a.return)&&(yield new Bo(o.call(a)))}finally{if(u)throw u[0]}}})},zj=function(e){return qm(this,null,function*(){if(e[Symbol.asyncIterator]){yield*Ym(e);return}const t=e.getReader();try{for(;;){const{done:a,value:s}=yield new Bo(t.read());if(a)break;yield s}}finally{yield new Bo(t.cancel())}})},Ib=(e,t,a,s)=>{const o=Bj(e,t);let u=0,c,f=g=>{c||(c=!0,s&&s(g))};return new ReadableStream({pull(g){return ge(this,null,function*(){try{const{done:x,value:v}=yield o.next();if(x){f(),g.close();return}let _=v.byteLength;if(a){let k=u+=_;a(k)}g.enqueue(new Uint8Array(v))}catch(x){throw f(x),x}})},cancel(g){return f(g),o.return()}},{highWaterMark:2})},Bb=64*1024,{isFunction:$0}=Me,Uj=(({Request:e,Response:t})=>({Request:e,Response:t}))(Me.global),{ReadableStream:zb,TextEncoder:Ub}=Me.global,Hb=(e,...t)=>{try{return!!e(...t)}catch(a){return!1}},Hj=e=>{e=Me.merge.call({skipUndefined:!0},Uj,e);const{fetch:t,Request:a,Response:s}=e,o=t?$0(t):typeof fetch=="function",u=$0(a),c=$0(s);if(!o)return!1;const f=o&&$0(zb),p=o&&(typeof Ub=="function"?(T=>N=>T.encode(N))(new Ub):T=>ge(null,null,function*(){return new Uint8Array(yield new a(T).arrayBuffer())})),g=u&&f&&Hb(()=>{let T=!1;const N=new a(Or.origin,{body:new zb,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!N}),x=c&&f&&Hb(()=>Me.isReadableStream(new s("").body)),v={stream:x&&(T=>T.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!v[T]&&(v[T]=(N,j)=>{let P=N&&N[T];if(P)return P.call(N);throw new zt(`Response type '${T}' is not supported`,zt.ERR_NOT_SUPPORT,j)})});const _=T=>ge(null,null,function*(){if(T==null)return 0;if(Me.isBlob(T))return T.size;if(Me.isSpecCompliantForm(T))return(yield new a(Or.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(Me.isArrayBufferView(T)||Me.isArrayBuffer(T))return T.byteLength;if(Me.isURLSearchParams(T)&&(T=T+""),Me.isString(T))return(yield p(T)).byteLength}),k=(T,N)=>ge(null,null,function*(){const j=Me.toFiniteNumber(T.getContentLength());return j==null?_(N):j});return T=>ge(null,null,function*(){let{url:N,method:j,data:P,signal:C,cancelToken:O,timeout:R,onDownloadProgress:U,onUploadProgress:H,responseType:B,headers:oe,withCredentials:se="same-origin",fetchOptions:pe}=V_(T),le=t||fetch;B=B?(B+"").toLowerCase():"text";let re=Fj([C,O&&O.toAbortSignal()],R),de=null;const ye=re&&re.unsubscribe&&(()=>{re.unsubscribe()});let ue;try{if(H&&g&&j!=="get"&&j!=="head"&&(ue=yield k(oe,P))!==0){let z=new a(N,{method:"POST",body:P,duplex:"half"}),D;if(Me.isFormData(P)&&(D=z.headers.get("content-type"))&&oe.setContentType(D),z.body){const[G,q]=Rb(ue,gf(Pb(H)));P=Ib(z.body,Bb,G,q)}}Me.isString(se)||(se=se?"include":"omit");const te=u&&"credentials"in a.prototype,V=Le(ie({},pe),{signal:re,method:j.toUpperCase(),headers:oe.normalize().toJSON(),body:P,duplex:"half",credentials:te?se:void 0});de=u&&new a(N,V);let J=yield u?le(de,pe):le(N,V);const ne=x&&(B==="stream"||B==="response");if(x&&(U||ne&&ye)){const z={};["status","statusText","headers"].forEach(K=>{z[K]=J[K]});const D=Me.toFiniteNumber(J.headers.get("content-length")),[G,q]=U&&Rb(D,gf(Pb(U),!0))||[];J=new s(Ib(J.body,Bb,G,()=>{q&&q(),ye&&ye()}),z)}B=B||"text";let ae=yield v[Me.findKey(v,B)||"text"](J,T);return!ne&&ye&&ye(),yield new Promise((z,D)=>{$_(z,D,{data:ae,headers:rn.from(J.headers),status:J.status,statusText:J.statusText,config:T,request:de})})}catch(te){throw ye&&ye(),te&&te.name==="TypeError"&&/Load failed|fetch/i.test(te.message)?Object.assign(new zt("Network Error",zt.ERR_NETWORK,T,de),{cause:te.cause||te}):zt.from(te,te&&te.code,T,de)}})},$j=new Map,G_=e=>{let t=e&&e.env||{};const{fetch:a,Request:s,Response:o}=t,u=[s,o,a];let c=u.length,f=c,p,g,x=$j;for(;f--;)p=u[f],g=x.get(p),g===void 0&&x.set(p,g=f?new Map:Hj(t)),x=g;return g};G_();const op={http:ij,xhr:Pj,fetch:{get:G_}};Me.forEach(op,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(a){}Object.defineProperty(e,"adapterName",{value:t})}});const $b=e=>`- ${e}`,Wj=e=>Me.isFunction(e)||e===null||e===!1;function Vj(e,t){e=Me.isArray(e)?e:[e];const{length:a}=e;let s,o;const u={};for(let c=0;c<a;c++){s=e[c];let f;if(o=s,!Wj(s)&&(o=op[(f=String(s)).toLowerCase()],o===void 0))throw new zt(`Unknown adapter '${f}'`);if(o&&(Me.isFunction(o)||(o=o.get(t))))break;u[f||"#"+c]=o}if(!o){const c=Object.entries(u).map(([p,g])=>`adapter ${p} `+(g===!1?"is not supported by the environment":"is not available in the build"));let f=a?c.length>1?`since :
`+c.map($b).join(`
`):" "+$b(c[0]):"as no adapter specified";throw new zt("There is no suitable adapter to dispatch the request "+f,"ERR_NOT_SUPPORT")}return o}const Z_={getAdapter:Vj,adapters:op};function fg(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new jc(null,e)}function Wb(e){return fg(e),e.headers=rn.from(e.headers),e.data=ug.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Z_.getAdapter(e.adapter||fu.adapter,e)(e).then(function(s){return fg(e),s.data=ug.call(e,e.transformResponse,s),s.headers=rn.from(s.headers),s},function(s){return H_(s)||(fg(e),s&&s.response&&(s.response.data=ug.call(e,e.transformResponse,s.response),s.response.headers=rn.from(s.response.headers))),Promise.reject(s)})}const q_="1.13.2",Uf={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Uf[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Vb={};Uf.transitional=function(t,a,s){function o(u,c){return"[Axios v"+q_+"] Transitional option '"+u+"'"+c+(s?". "+s:"")}return(u,c,f)=>{if(t===!1)throw new zt(o(c," has been removed"+(a?" in "+a:"")),zt.ERR_DEPRECATED);return a&&!Vb[c]&&(Vb[c]=!0,console.warn(o(c," has been deprecated since v"+a+" and will be removed in the near future"))),t?t(u,c,f):!0}};Uf.spelling=function(t){return(a,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function Gj(e,t,a){if(typeof e!="object")throw new zt("options must be an object",zt.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let o=s.length;for(;o-- >0;){const u=s[o],c=t[u];if(c){const f=e[u],p=f===void 0||c(f,u,e);if(p!==!0)throw new zt("option "+u+" must be "+p,zt.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new zt("Unknown option "+u,zt.ERR_BAD_OPTION)}}const sf={assertOptions:Gj,validators:Uf},Ls=sf.validators;let Go=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Mb,response:new Mb}}request(t,a){return ge(this,null,function*(){try{return yield this._request(t,a)}catch(s){if(s instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const u=o.stack?o.stack.replace(/^.+\n/,""):"";try{s.stack?u&&!String(s.stack).endsWith(u.replace(/^.+\n.+\n/,""))&&(s.stack+=`
`+u):s.stack=u}catch(c){}}throw s}})}_request(t,a){typeof t=="string"?(a=a||{},a.url=t):a=t||{},a=Jo(this.defaults,a);const{transitional:s,paramsSerializer:o,headers:u}=a;s!==void 0&&sf.assertOptions(s,{silentJSONParsing:Ls.transitional(Ls.boolean),forcedJSONParsing:Ls.transitional(Ls.boolean),clarifyTimeoutError:Ls.transitional(Ls.boolean)},!1),o!=null&&(Me.isFunction(o)?a.paramsSerializer={serialize:o}:sf.assertOptions(o,{encode:Ls.function,serialize:Ls.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),sf.assertOptions(a,{baseUrl:Ls.spelling("baseURL"),withXsrfToken:Ls.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let c=u&&Me.merge(u.common,u[a.method]);u&&Me.forEach(["delete","get","head","post","put","patch","common"],T=>{delete u[T]}),a.headers=rn.concat(c,u);const f=[];let p=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(a)===!1||(p=p&&N.synchronous,f.unshift(N.fulfilled,N.rejected))});const g=[];this.interceptors.response.forEach(function(N){g.push(N.fulfilled,N.rejected)});let x,v=0,_;if(!p){const T=[Wb.bind(this),void 0];for(T.unshift(...f),T.push(...g),_=T.length,x=Promise.resolve(a);v<_;)x=x.then(T[v++],T[v++]);return x}_=f.length;let k=a;for(;v<_;){const T=f[v++],N=f[v++];try{k=T(k)}catch(j){N.call(this,j);break}}try{x=Wb.call(this,k)}catch(T){return Promise.reject(T)}for(v=0,_=g.length;v<_;)x=x.then(g[v++],g[v++]);return x}getUri(t){t=Jo(this.defaults,t);const a=W_(t.baseURL,t.url,t.allowAbsoluteUrls);return B_(a,t.params,t.paramsSerializer)}};Me.forEach(["delete","get","head","options"],function(t){Go.prototype[t]=function(a,s){return this.request(Jo(s||{},{method:t,url:a,data:(s||{}).data}))}});Me.forEach(["post","put","patch"],function(t){function a(s){return function(u,c,f){return this.request(Jo(f||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:u,data:c}))}}Go.prototype[t]=a(),Go.prototype[t+"Form"]=a(!0)});let Zj=class Y_{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(u){a=u});const s=this;this.promise.then(o=>{if(!s._listeners)return;let u=s._listeners.length;for(;u-- >0;)s._listeners[u](o);s._listeners=null}),this.promise.then=o=>{let u;const c=new Promise(f=>{s.subscribe(f),u=f}).then(o);return c.cancel=function(){s.unsubscribe(u)},c},t(function(u,c,f){s.reason||(s.reason=new jc(u,c,f),a(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const a=this._listeners.indexOf(t);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const t=new AbortController,a=s=>{t.abort(s)};return this.subscribe(a),t.signal.unsubscribe=()=>this.unsubscribe(a),t.signal}static source(){let t;return{token:new Y_(function(o){t=o}),cancel:t}}};function qj(e){return function(a){return e.apply(null,a)}}function Yj(e){return Me.isObject(e)&&e.isAxiosError===!0}const Pg={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Pg).forEach(([e,t])=>{Pg[t]=e});function X_(e){const t=new Go(e),a=T_(Go.prototype.request,t);return Me.extend(a,Go.prototype,t,{allOwnKeys:!0}),Me.extend(a,t,null,{allOwnKeys:!0}),a.create=function(o){return X_(Jo(e,o))},a}const Ka=X_(fu);Ka.Axios=Go;Ka.CanceledError=jc;Ka.CancelToken=Zj;Ka.isCancel=H_;Ka.VERSION=q_;Ka.toFormData=zf;Ka.AxiosError=zt;Ka.Cancel=Ka.CanceledError;Ka.all=function(t){return Promise.all(t)};Ka.spread=qj;Ka.isAxiosError=Yj;Ka.mergeConfig=Jo;Ka.AxiosHeaders=rn;Ka.formToJSON=e=>U_(Me.isHTMLForm(e)?new FormData(e):e);Ka.getAdapter=Z_.getAdapter;Ka.HttpStatusCode=Pg;Ka.default=Ka;const{Axios:AM,AxiosError:OM,CanceledError:LM,isCancel:MM,CancelToken:DM,VERSION:RM,all:PM,Cancel:FM,isAxiosError:IM,spread:BM,toFormData:zM,AxiosHeaders:UM,HttpStatusCode:HM,formToJSON:$M,getAdapter:WM,mergeConfig:VM}=Ka;class Xj{constructor(){Os(this,"client");Os(this,"baseURL");Os(this,"siteName");this.baseURL="http://localhost:8000",this.siteName="seeraasm-med.seeraarabia.com",this.client=Ka.create({baseURL:this.baseURL,timeout:parseInt("10000"),withCredentials:!0,headers:{"Content-Type":"application/json",Accept:"application/json"}}),this.client.interceptors.request.use(t=>{var a;return(a=t.url)!=null&&a.includes("/api/")&&(t.url=`/${this.siteName}${t.url}`),t}),this.client.interceptors.response.use(t=>t,t=>{var a;return((a=t.response)==null?void 0:a.status)===401&&(window.location.href="/login"),Promise.reject(t)})}login(t){return ge(this,null,function*(){return(yield this.client.post("/api/method/login",t)).data})}logout(){return ge(this,null,function*(){return(yield this.client.post("/api/method/logout")).data})}getCurrentUser(){return ge(this,null,function*(){return(yield this.client.get("/api/method/frappe.auth.get_logged_user")).data})}callMethod(s){return ge(this,arguments,function*(t,a={}){return(yield this.client.post(`/api/method/${t}`,a)).data})}frappeGet(s){return ge(this,arguments,function*(t,a={}){return this.callMethod(t,a)})}getDocTypeRecords(o){return ge(this,arguments,function*(t,a={},s=[]){const u=new URLSearchParams;return Object.keys(a).length>0&&u.append("filters",JSON.stringify(a)),s.length>0&&u.append("fields",JSON.stringify(s)),(yield this.client.get(`/api/resource/${t}?${u.toString()}`)).data})}getDocTypeRecord(t,a){return ge(this,null,function*(){return(yield this.client.get(`/api/resource/${t}/${a}`)).data})}createDocTypeRecord(t,a){return ge(this,null,function*(){return(yield this.client.post(`/api/resource/${t}`,a)).data})}updateDocTypeRecord(t,a,s){return ge(this,null,function*(){return(yield this.client.put(`/api/resource/${t}/${a}`,s)).data})}deleteDocTypeRecord(t,a){return ge(this,null,function*(){return(yield this.client.delete(`/api/resource/${t}/${a}`)).data})}uploadFile(t,a="Home"){return ge(this,null,function*(){const s=new FormData;return s.append("file",t),s.append("folder",a),s.append("is_private","0"),(yield this.client.post("/api/method/upload_file",s,{headers:{"Content-Type":"multipart/form-data"}})).data})}}const K_=new Xj,Kj=()=>{const[e,t]=E.useState([]),[a,s]=E.useState(!0),[o,u]=E.useState(null),[c,f]=E.useState(""),p=Da();E.useEffect(()=>{g()},[]);const g=()=>ge(null,null,function*(){var _,k;try{s(!0);const T=yield K_.getDocTypeRecords("User",{},["name","full_name","email","enabled","creation","modified"]);t(T.message||[])}catch(T){u(((k=(_=T.response)==null?void 0:_.data)==null?void 0:k.message)||"Failed to load users")}finally{s(!1)}}),x=e.filter(_=>{var k,T,N;return((k=_.full_name)==null?void 0:k.toLowerCase().includes(c.toLowerCase()))||((T=_.email)==null?void 0:T.toLowerCase().includes(c.toLowerCase()))||((N=_.name)==null?void 0:N.toLowerCase().includes(c.toLowerCase()))}),v=_=>{p(`/users/${_.name}`)};return a?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:r.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-indigo-600"})}):r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[r.jsx("header",{className:"bg-white dark:bg-gray-800 shadow",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"flex justify-between items-center py-6",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("button",{onClick:()=>p("/dashboard"),className:"mr-4 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300",children:r.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),r.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:"Users"})]}),r.jsx("div",{className:"flex items-center space-x-4",children:r.jsx("button",{onClick:()=>p("/dashboard"),className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-md text-sm font-medium",children:"Back to Dashboard"})})]})})}),r.jsxs("main",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[o&&r.jsx("div",{className:"mb-6 rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:r.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:o})}),r.jsxs("div",{className:"mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:r.jsx("svg",{className:"h-5 w-5 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),r.jsx("input",{type:"text",placeholder:"Search users...",value:c,onChange:_=>f(_.target.value),className:"block w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md leading-5 bg-white dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 text-gray-900 dark:text-white focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"})]})}),r.jsx("div",{className:"mt-4 sm:mt-0 sm:ml-4",children:r.jsxs("button",{onClick:g,className:"inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:[r.jsx("svg",{className:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]})})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow overflow-hidden sm:rounded-md",children:[r.jsxs("div",{className:"px-4 py-5 sm:px-6",children:[r.jsxs("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white",children:["Users (",x.length,")"]}),r.jsx("p",{className:"mt-1 max-w-2xl text-sm text-gray-500 dark:text-gray-400",children:"Manage user accounts and permissions"})]}),x.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m13.5-9a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z"})}),r.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-white",children:"No users found"}),r.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:c?"Try adjusting your search terms.":"No users available."})]}):r.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:x.map(_=>{var k;return r.jsx("li",{children:r.jsxs("div",{className:"px-4 py-4 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer",onClick:()=>v(_),children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0 h-10 w-10",children:r.jsx("div",{className:"h-10 w-10 rounded-full bg-indigo-100 dark:bg-indigo-900 flex items-center justify-center",children:r.jsx("span",{className:"text-sm font-medium text-indigo-600 dark:text-indigo-300",children:((k=_.full_name)==null?void 0:k.charAt(0))||_.name.charAt(0)})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:_.full_name||_.name}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:_.email||"No email"})]})]}),r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:`w-2 h-2 rounded-full mr-2 ${_.enabled?"bg-green-400":"bg-red-400"}`}),_.enabled?"Active":"Inactive"]})}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Created: ",new Date(_.creation).toLocaleDateString()]}),r.jsx("svg",{className:"w-5 h-5 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})},_.name)})})]})]})]})},Jj=()=>{const[e,t]=E.useState([]),[a,s]=E.useState(!0),[o,u]=E.useState(null);E.useEffect(()=>{c()},[]);const c=()=>ge(null,null,function*(){try{s(!0);const x=yield K_.frappeGet("frappe.desk.doctype.event.event.get_events");t(x.message||[])}catch(x){console.log("API call failed, using demo events:",x);const v=[{name:"EVT001",subject:"Team Meeting - Asset Management Review",starts_on:new Date().toISOString(),ends_on:new Date(Date.now()+36e5).toISOString(),status:"Open",event_type:"Meeting",description:"Monthly review of asset management processes"},{name:"EVT002",subject:"System Maintenance Window",starts_on:new Date(Date.now()+864e5).toISOString(),ends_on:new Date(Date.now()+864e5+72e5).toISOString(),status:"Scheduled",event_type:"Maintenance",description:"Scheduled maintenance for Seera Arabia AMS"},{name:"EVT003",subject:"User Training Session",starts_on:new Date(Date.now()+1728e5).toISOString(),ends_on:new Date(Date.now()+1728e5+108e5).toISOString(),status:"Open",event_type:"Training",description:"Training session for new users on AMS features"}];t(v),u(null)}finally{s(!1)}}),f=x=>new Date(x).toLocaleString(),p=x=>{switch(x.toLowerCase()){case"open":return"bg-green-100 text-green-800";case"scheduled":return"bg-blue-100 text-blue-800";case"completed":return"bg-gray-100 text-gray-800";case"cancelled":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},g=x=>{switch(x.toLowerCase()){case"meeting":return"bg-purple-100 text-purple-800";case"training":return"bg-yellow-100 text-yellow-800";case"maintenance":return"bg-orange-100 text-orange-800";default:return"bg-gray-100 text-gray-800"}};return a?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:r.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-indigo-600"})}):r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[r.jsx("header",{className:"bg-white dark:bg-gray-800 shadow",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"flex justify-between items-center py-6",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:"Events"})}),r.jsx("div",{className:"flex items-center space-x-4",children:r.jsx("button",{onClick:c,className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-md text-sm font-medium",children:"Refresh Events"})})]})})}),r.jsxs("main",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[o&&r.jsx("div",{className:"mb-6 rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:r.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:o})}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow overflow-hidden sm:rounded-md",children:[r.jsxs("div",{className:"px-4 py-5 sm:px-6",children:[r.jsxs("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white",children:["Upcoming Events (",e.length,")"]}),r.jsx("p",{className:"mt-1 max-w-2xl text-sm text-gray-500 dark:text-gray-400",children:"Events from your Frappe backend"})]}),e.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),r.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-white",children:"No events found"}),r.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"No events are currently scheduled."})]}):r.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:e.map(x=>r.jsx("li",{children:r.jsx("div",{className:"px-4 py-4 hover:bg-gray-50 dark:hover:bg-gray-700",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h4",{className:"text-lg font-medium text-gray-900 dark:text-white",children:x.subject}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${p(x.status)}`,children:x.status}),r.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${g(x.event_type)}`,children:x.event_type})]})]}),x.description&&r.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:x.description}),r.jsxs("div",{className:"mt-2 flex items-center text-sm text-gray-500 dark:text-gray-400",children:[r.jsx("svg",{className:"flex-shrink-0 mr-1.5 h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),r.jsxs("span",{children:[f(x.starts_on)," - ",f(x.ends_on)]})]})]})})})},x.name))})]}),r.jsx("div",{className:"mt-8 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-md p-4",children:r.jsxs("div",{className:"flex",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("svg",{className:"h-5 w-5 text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),r.jsxs("div",{className:"ml-3",children:[r.jsx("h3",{className:"text-sm font-medium text-blue-800 dark:text-blue-300",children:"API Endpoint Information"}),r.jsxs("div",{className:"mt-2 text-sm text-blue-700 dark:text-blue-400",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Endpoint:"})," ",r.jsx("code",{children:"frappe.desk.doctype.event.event.get_events"})]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Full URL:"})," ",r.jsx("code",{children:"https://seeraasm-med.seeraarabia.com/api/method/frappe.desk.doctype.event.event.get_events"})]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Method:"})," POST (Frappe API standard)"]})]})]})]})})]})]})};var pf={};pf.version="0.18.5";var J_=1252,Qj=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],Q_=function(e){Qj.indexOf(e)!=-1&&(J_=e)};function e5(){Q_(1252)}var Yd=function(e){Q_(e)};function t5(){Yd(1200),e5()}var W0=function(t){return String.fromCharCode(t)},Gb=function(t){return String.fromCharCode(t)},xf,Qi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Xd(e){for(var t="",a=0,s=0,o=0,u=0,c=0,f=0,p=0,g=0;g<e.length;)a=e.charCodeAt(g++),u=a>>2,s=e.charCodeAt(g++),c=(a&3)<<4|s>>4,o=e.charCodeAt(g++),f=(s&15)<<2|o>>6,p=o&63,isNaN(s)?f=p=64:isNaN(o)&&(p=64),t+=Qi.charAt(u)+Qi.charAt(c)+Qi.charAt(f)+Qi.charAt(p);return t}function hi(e){var t="",a=0,s=0,o=0,u=0,c=0,f=0,p=0;e=e.replace(/[^\w\+\/\=]/g,"");for(var g=0;g<e.length;)u=Qi.indexOf(e.charAt(g++)),c=Qi.indexOf(e.charAt(g++)),a=u<<2|c>>4,t+=String.fromCharCode(a),f=Qi.indexOf(e.charAt(g++)),s=(c&15)<<4|f>>2,f!==64&&(t+=String.fromCharCode(s)),p=Qi.indexOf(e.charAt(g++)),o=(f&3)<<6|p,p!==64&&(t+=String.fromCharCode(o));return t}var la=(function(){return typeof Buffer!="undefined"&&typeof process!="undefined"&&typeof process.versions!="undefined"&&!!process.versions.node})(),pi=(function(){if(typeof Buffer!="undefined"){var e=!Buffer.from;if(!e)try{Buffer.from("foo","utf8")}catch(t){e=!0}return e?function(t,a){return a?new Buffer(t,a):new Buffer(t)}:Buffer.from.bind(Buffer)}return function(){}})();function Qo(e){return la?Buffer.alloc?Buffer.alloc(e):new Buffer(e):typeof Uint8Array!="undefined"?new Uint8Array(e):new Array(e)}function Zb(e){return la?Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e):typeof Uint8Array!="undefined"?new Uint8Array(e):new Array(e)}var cs=function(t){return la?pi(t,"binary"):t.split("").map(function(a){return a.charCodeAt(0)&255})};function Hf(e){if(typeof ArrayBuffer=="undefined")return cs(e);for(var t=new ArrayBuffer(e.length),a=new Uint8Array(t),s=0;s!=e.length;++s)a[s]=e.charCodeAt(s)&255;return t}function hu(e){if(Array.isArray(e))return e.map(function(s){return String.fromCharCode(s)}).join("");for(var t=[],a=0;a<e.length;++a)t[a]=String.fromCharCode(e[a]);return t.join("")}function a5(e){if(typeof Uint8Array=="undefined")throw new Error("Unsupported");return new Uint8Array(e)}var kr=la?function(e){return Buffer.concat(e.map(function(t){return Buffer.isBuffer(t)?t:pi(t)}))}:function(e){if(typeof Uint8Array!="undefined"){var t=0,a=0;for(t=0;t<e.length;++t)a+=e[t].length;var s=new Uint8Array(a),o=0;for(t=0,a=0;t<e.length;a+=o,++t)if(o=e[t].length,e[t]instanceof Uint8Array)s.set(e[t],a);else{if(typeof e[t]=="string")throw"wtf";s.set(new Uint8Array(e[t]),a)}return s}return[].concat.apply([],e.map(function(u){return Array.isArray(u)?u:[].slice.call(u)}))};function r5(e){for(var t=[],a=0,s=e.length+250,o=Qo(e.length+255),u=0;u<e.length;++u){var c=e.charCodeAt(u);if(c<128)o[a++]=c;else if(c<2048)o[a++]=192|c>>6&31,o[a++]=128|c&63;else if(c>=55296&&c<57344){c=(c&1023)+64;var f=e.charCodeAt(++u)&1023;o[a++]=240|c>>8&7,o[a++]=128|c>>2&63,o[a++]=128|f>>6&15|(c&3)<<4,o[a++]=128|f&63}else o[a++]=224|c>>12&15,o[a++]=128|c>>6&63,o[a++]=128|c&63;a>s&&(t.push(o.slice(0,a)),a=0,o=Qo(65535),s=65530)}return t.push(o.slice(0,a)),kr(t)}var zd=/\u0000/g,V0=/[\u0001-\u0006]/g;function dc(e){for(var t="",a=e.length-1;a>=0;)t+=e.charAt(a--);return t}function us(e,t){var a=""+e;return a.length>=t?a:Va("0",t-a.length)+a}function lp(e,t){var a=""+e;return a.length>=t?a:Va(" ",t-a.length)+a}function yf(e,t){var a=""+e;return a.length>=t?a:a+Va(" ",t-a.length)}function n5(e,t){var a=""+Math.round(e);return a.length>=t?a:Va("0",t-a.length)+a}function s5(e,t){var a=""+e;return a.length>=t?a:Va("0",t-a.length)+a}var qb=Math.pow(2,32);function ec(e,t){if(e>qb||e<-qb)return n5(e,t);var a=Math.round(e);return s5(a,t)}function bf(e,t){return t=t||0,e.length>=7+t&&(e.charCodeAt(t)|32)===103&&(e.charCodeAt(t+1)|32)===101&&(e.charCodeAt(t+2)|32)===110&&(e.charCodeAt(t+3)|32)===101&&(e.charCodeAt(t+4)|32)===114&&(e.charCodeAt(t+5)|32)===97&&(e.charCodeAt(t+6)|32)===108}var Yb=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],hg=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function i5(e){return e||(e={}),e[0]="General",e[1]="0",e[2]="0.00",e[3]="#,##0",e[4]="#,##0.00",e[9]="0%",e[10]="0.00%",e[11]="0.00E+00",e[12]="# ?/?",e[13]="# ??/??",e[14]="m/d/yy",e[15]="d-mmm-yy",e[16]="d-mmm",e[17]="mmm-yy",e[18]="h:mm AM/PM",e[19]="h:mm:ss AM/PM",e[20]="h:mm",e[21]="h:mm:ss",e[22]="m/d/yy h:mm",e[37]="#,##0 ;(#,##0)",e[38]="#,##0 ;[Red](#,##0)",e[39]="#,##0.00;(#,##0.00)",e[40]="#,##0.00;[Red](#,##0.00)",e[45]="mm:ss",e[46]="[h]:mm:ss",e[47]="mmss.0",e[48]="##0.0E+0",e[49]="@",e[56]='"上午/下午 "hh"時"mm"分"ss"秒 "',e}var Ga={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@",56:'"上午/下午 "hh"時"mm"分"ss"秒 "'},Xb={5:37,6:38,7:39,8:40,23:0,24:0,25:0,26:0,27:14,28:14,29:14,30:14,31:14,50:14,51:14,52:14,53:14,54:14,55:14,56:14,57:14,58:14,59:1,60:2,61:3,62:4,67:9,68:10,69:12,70:13,71:14,72:14,73:15,74:16,75:17,76:20,77:21,78:22,79:45,80:46,81:47,82:0},o5={5:'"$"#,##0_);\\("$"#,##0\\)',63:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',41:'_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'};function vf(e,t,a){for(var s=e<0?-1:1,o=e*s,u=0,c=1,f=0,p=1,g=0,x=0,v=Math.floor(o);g<t&&(v=Math.floor(o),f=v*c+u,x=v*g+p,!(o-v<5e-8));)o=1/(o-v),u=c,c=f,p=g,g=x;if(x>t&&(g>t?(x=p,f=u):(x=g,f=c)),!a)return[0,s*f,x];var _=Math.floor(s*f/x);return[_,s*f-_*x,x]}function G0(e,t,a){if(e>2958465||e<0)return null;var s=e|0,o=Math.floor(86400*(e-s)),u=0,c=[],f={D:s,T:o,u:86400*(e-s)-o,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(f.u)<1e-6&&(f.u=0),t&&t.date1904&&(s+=1462),f.u>.9999&&(f.u=0,++o==86400&&(f.T=o=0,++s,++f.D)),s===60)c=a?[1317,10,29]:[1900,2,29],u=3;else if(s===0)c=a?[1317,8,29]:[1900,1,0],u=6;else{s>60&&--s;var p=new Date(1900,0,1);p.setDate(p.getDate()+s-1),c=[p.getFullYear(),p.getMonth()+1,p.getDate()],u=p.getDay(),s<60&&(u=(u+6)%7),a&&(u=m5(p,c))}return f.y=c[0],f.m=c[1],f.d=c[2],f.S=o%60,o=Math.floor(o/60),f.M=o%60,o=Math.floor(o/60),f.H=o,f.q=u,f}var e2=new Date(1899,11,31,0,0,0),l5=e2.getTime(),c5=new Date(1900,2,1,0,0,0);function t2(e,t){var a=e.getTime();return t?a-=1461*24*60*60*1e3:e>=c5&&(a+=1440*60*1e3),(a-(l5+(e.getTimezoneOffset()-e2.getTimezoneOffset())*6e4))/(1440*60*1e3)}function cp(e){return e.indexOf(".")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function d5(e){return e.indexOf("E")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}function u5(e){var t=e<0?12:11,a=cp(e.toFixed(12));return a.length<=t||(a=e.toPrecision(10),a.length<=t)?a:e.toExponential(5)}function f5(e){var t=cp(e.toFixed(11));return t.length>(e<0?12:11)||t==="0"||t==="-0"?e.toPrecision(6):t}function h5(e){var t=Math.floor(Math.log(Math.abs(e))*Math.LOG10E),a;return t>=-4&&t<=-1?a=e.toPrecision(10+t):Math.abs(t)<=9?a=u5(e):t===10?a=e.toFixed(10).substr(0,12):a=f5(e),cp(d5(a.toUpperCase()))}function Fg(e,t){switch(typeof e){case"string":return e;case"boolean":return e?"TRUE":"FALSE";case"number":return(e|0)===e?e.toString(10):h5(e);case"undefined":return"";case"object":if(e==null)return"";if(e instanceof Date)return to(14,t2(e,t&&t.date1904),t)}throw new Error("unsupported value in General format: "+e)}function m5(e,t){t[0]-=581;var a=e.getDay();return e<60&&(a=(a+6)%7),a}function g5(e,t,a,s){var o="",u=0,c=0,f=a.y,p,g=0;switch(e){case 98:f=a.y+543;case 121:switch(t.length){case 1:case 2:p=f%100,g=2;break;default:p=f%1e4,g=4;break}break;case 109:switch(t.length){case 1:case 2:p=a.m,g=t.length;break;case 3:return hg[a.m-1][1];case 5:return hg[a.m-1][0];default:return hg[a.m-1][2]}break;case 100:switch(t.length){case 1:case 2:p=a.d,g=t.length;break;case 3:return Yb[a.q][0];default:return Yb[a.q][1]}break;case 104:switch(t.length){case 1:case 2:p=1+(a.H+11)%12,g=t.length;break;default:throw"bad hour format: "+t}break;case 72:switch(t.length){case 1:case 2:p=a.H,g=t.length;break;default:throw"bad hour format: "+t}break;case 77:switch(t.length){case 1:case 2:p=a.M,g=t.length;break;default:throw"bad minute format: "+t}break;case 115:if(t!="s"&&t!="ss"&&t!=".0"&&t!=".00"&&t!=".000")throw"bad second format: "+t;return a.u===0&&(t=="s"||t=="ss")?us(a.S,t.length):(s>=2?c=s===3?1e3:100:c=s===1?10:1,u=Math.round(c*(a.S+a.u)),u>=60*c&&(u=0),t==="s"?u===0?"0":""+u/c:(o=us(u,2+s),t==="ss"?o.substr(0,2):"."+o.substr(2,t.length-1)));case 90:switch(t){case"[h]":case"[hh]":p=a.D*24+a.H;break;case"[m]":case"[mm]":p=(a.D*24+a.H)*60+a.M;break;case"[s]":case"[ss]":p=((a.D*24+a.H)*60+a.M)*60+Math.round(a.S+a.u);break;default:throw"bad abstime format: "+t}g=t.length===3?1:2;break;case 101:p=f,g=1;break}var x=g>0?us(p,g):"";return x}function eo(e){var t=3;if(e.length<=t)return e;for(var a=e.length%t,s=e.substr(0,a);a!=e.length;a+=t)s+=(s.length>0?",":"")+e.substr(a,t);return s}var a2=/%/g;function p5(e,t,a){var s=t.replace(a2,""),o=t.length-s.length;return ii(e,s,a*Math.pow(10,2*o))+Va("%",o)}function x5(e,t,a){for(var s=t.length-1;t.charCodeAt(s-1)===44;)--s;return ii(e,t.substr(0,s),a/Math.pow(10,3*(t.length-s)))}function r2(e,t){var a,s=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(t==0)return"0.0E+0";if(t<0)return"-"+r2(e,-t);var o=e.indexOf(".");o===-1&&(o=e.indexOf("E"));var u=Math.floor(Math.log(t)*Math.LOG10E)%o;if(u<0&&(u+=o),a=(t/Math.pow(10,u)).toPrecision(s+1+(o+u)%o),a.indexOf("e")===-1){var c=Math.floor(Math.log(t)*Math.LOG10E);for(a.indexOf(".")===-1?a=a.charAt(0)+"."+a.substr(1)+"E+"+(c-a.length+u):a+="E+"+(c-u);a.substr(0,2)==="0.";)a=a.charAt(0)+a.substr(2,o)+"."+a.substr(2+o),a=a.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");a=a.replace(/\+-/,"-")}a=a.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(f,p,g,x){return p+g+x.substr(0,(o+u)%o)+"."+x.substr(u)+"E"})}else a=t.toExponential(s);return e.match(/E\+00$/)&&a.match(/e[+-]\d$/)&&(a=a.substr(0,a.length-1)+"0"+a.charAt(a.length-1)),e.match(/E\-/)&&a.match(/e\+/)&&(a=a.replace(/e\+/,"e")),a.replace("e","E")}var n2=/# (\?+)( ?)\/( ?)(\d+)/;function y5(e,t,a){var s=parseInt(e[4],10),o=Math.round(t*s),u=Math.floor(o/s),c=o-u*s,f=s;return a+(u===0?"":""+u)+" "+(c===0?Va(" ",e[1].length+1+e[4].length):lp(c,e[1].length)+e[2]+"/"+e[3]+us(f,e[4].length))}function b5(e,t,a){return a+(t===0?"":""+t)+Va(" ",e[1].length+2+e[4].length)}var s2=/^#*0*\.([0#]+)/,i2=/\).*[0#]/,o2=/\(###\) ###\\?-####/;function zr(e){for(var t="",a,s=0;s!=e.length;++s)switch(a=e.charCodeAt(s)){case 35:break;case 63:t+=" ";break;case 48:t+="0";break;default:t+=String.fromCharCode(a)}return t}function Kb(e,t){var a=Math.pow(10,t);return""+Math.round(e*a)/a}function Jb(e,t){var a=e-Math.floor(e),s=Math.pow(10,t);return t<(""+Math.round(a*s)).length?0:Math.round(a*s)}function v5(e,t){return t<(""+Math.round((e-Math.floor(e))*Math.pow(10,t))).length?1:0}function _5(e){return e<2147483647&&e>-2147483648?""+(e>=0?e|0:e-1|0):""+Math.floor(e)}function Un(e,t,a){if(e.charCodeAt(0)===40&&!t.match(i2)){var s=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return a>=0?Un("n",s,a):"("+Un("n",s,-a)+")"}if(t.charCodeAt(t.length-1)===44)return x5(e,t,a);if(t.indexOf("%")!==-1)return p5(e,t,a);if(t.indexOf("E")!==-1)return r2(t,a);if(t.charCodeAt(0)===36)return"$"+Un(e,t.substr(t.charAt(1)==" "?2:1),a);var o,u,c,f,p=Math.abs(a),g=a<0?"-":"";if(t.match(/^00+$/))return g+ec(p,t.length);if(t.match(/^[#?]+$/))return o=ec(a,0),o==="0"&&(o=""),o.length>t.length?o:zr(t.substr(0,t.length-o.length))+o;if(u=t.match(n2))return y5(u,p,g);if(t.match(/^#+0+$/))return g+ec(p,t.length-t.indexOf("0"));if(u=t.match(s2))return o=Kb(a,u[1].length).replace(/^([^\.]+)$/,"$1."+zr(u[1])).replace(/\.$/,"."+zr(u[1])).replace(/\.(\d*)$/,function(T,N){return"."+N+Va("0",zr(u[1]).length-N.length)}),t.indexOf("0.")!==-1?o:o.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),u=t.match(/^(0*)\.(#*)$/))return g+Kb(p,u[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,u[1].length?"0.":".");if(u=t.match(/^#{1,3},##0(\.?)$/))return g+eo(ec(p,0));if(u=t.match(/^#,##0\.([#0]*0)$/))return a<0?"-"+Un(e,t,-a):eo(""+(Math.floor(a)+v5(a,u[1].length)))+"."+us(Jb(a,u[1].length),u[1].length);if(u=t.match(/^#,#*,#0/))return Un(e,t.replace(/^#,#*,/,""),a);if(u=t.match(/^([0#]+)(\\?-([0#]+))+$/))return o=dc(Un(e,t.replace(/[\\-]/g,""),a)),c=0,dc(dc(t.replace(/\\/g,"")).replace(/[0#]/g,function(T){return c<o.length?o.charAt(c++):T==="0"?"0":""}));if(t.match(o2))return o=Un(e,"##########",a),"("+o.substr(0,3)+") "+o.substr(3,3)+"-"+o.substr(6);var x="";if(u=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(u[4].length,7),f=vf(p,Math.pow(10,c)-1,!1),o=""+g,x=ii("n",u[1],f[1]),x.charAt(x.length-1)==" "&&(x=x.substr(0,x.length-1)+"0"),o+=x+u[2]+"/"+u[3],x=yf(f[2],c),x.length<u[4].length&&(x=zr(u[4].substr(u[4].length-x.length))+x),o+=x,o;if(u=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(Math.max(u[1].length,u[4].length),7),f=vf(p,Math.pow(10,c)-1,!0),g+(f[0]||(f[1]?"":"0"))+" "+(f[1]?lp(f[1],c)+u[2]+"/"+u[3]+yf(f[2],c):Va(" ",2*c+1+u[2].length+u[3].length));if(u=t.match(/^[#0?]+$/))return o=ec(a,0),t.length<=o.length?o:zr(t.substr(0,t.length-o.length))+o;if(u=t.match(/^([#0?]+)\.([#0]+)$/)){o=""+a.toFixed(Math.min(u[2].length,10)).replace(/([^0])0+$/,"$1"),c=o.indexOf(".");var v=t.indexOf(".")-c,_=t.length-o.length-v;return zr(t.substr(0,v)+o+t.substr(t.length-_))}if(u=t.match(/^00,000\.([#0]*0)$/))return c=Jb(a,u[1].length),a<0?"-"+Un(e,t,-a):eo(_5(a)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(T){return"00,"+(T.length<3?us(0,3-T.length):"")+T})+"."+us(c,u[1].length);switch(t){case"###,##0.00":return Un(e,"#,##0.00",a);case"###,###":case"##,###":case"#,###":var k=eo(ec(p,0));return k!=="0"?g+k:"";case"###,###.00":return Un(e,"###,##0.00",a).replace(/^0\./,".");case"#,###.00":return Un(e,"#,##0.00",a).replace(/^0\./,".")}throw new Error("unsupported format |"+t+"|")}function w5(e,t,a){for(var s=t.length-1;t.charCodeAt(s-1)===44;)--s;return ii(e,t.substr(0,s),a/Math.pow(10,3*(t.length-s)))}function k5(e,t,a){var s=t.replace(a2,""),o=t.length-s.length;return ii(e,s,a*Math.pow(10,2*o))+Va("%",o)}function l2(e,t){var a,s=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(t==0)return"0.0E+0";if(t<0)return"-"+l2(e,-t);var o=e.indexOf(".");o===-1&&(o=e.indexOf("E"));var u=Math.floor(Math.log(t)*Math.LOG10E)%o;if(u<0&&(u+=o),a=(t/Math.pow(10,u)).toPrecision(s+1+(o+u)%o),!a.match(/[Ee]/)){var c=Math.floor(Math.log(t)*Math.LOG10E);a.indexOf(".")===-1?a=a.charAt(0)+"."+a.substr(1)+"E+"+(c-a.length+u):a+="E+"+(c-u),a=a.replace(/\+-/,"-")}a=a.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(f,p,g,x){return p+g+x.substr(0,(o+u)%o)+"."+x.substr(u)+"E"})}else a=t.toExponential(s);return e.match(/E\+00$/)&&a.match(/e[+-]\d$/)&&(a=a.substr(0,a.length-1)+"0"+a.charAt(a.length-1)),e.match(/E\-/)&&a.match(/e\+/)&&(a=a.replace(/e\+/,"e")),a.replace("e","E")}function Ms(e,t,a){if(e.charCodeAt(0)===40&&!t.match(i2)){var s=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return a>=0?Ms("n",s,a):"("+Ms("n",s,-a)+")"}if(t.charCodeAt(t.length-1)===44)return w5(e,t,a);if(t.indexOf("%")!==-1)return k5(e,t,a);if(t.indexOf("E")!==-1)return l2(t,a);if(t.charCodeAt(0)===36)return"$"+Ms(e,t.substr(t.charAt(1)==" "?2:1),a);var o,u,c,f,p=Math.abs(a),g=a<0?"-":"";if(t.match(/^00+$/))return g+us(p,t.length);if(t.match(/^[#?]+$/))return o=""+a,a===0&&(o=""),o.length>t.length?o:zr(t.substr(0,t.length-o.length))+o;if(u=t.match(n2))return b5(u,p,g);if(t.match(/^#+0+$/))return g+us(p,t.length-t.indexOf("0"));if(u=t.match(s2))return o=(""+a).replace(/^([^\.]+)$/,"$1."+zr(u[1])).replace(/\.$/,"."+zr(u[1])),o=o.replace(/\.(\d*)$/,function(T,N){return"."+N+Va("0",zr(u[1]).length-N.length)}),t.indexOf("0.")!==-1?o:o.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),u=t.match(/^(0*)\.(#*)$/))return g+(""+p).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,u[1].length?"0.":".");if(u=t.match(/^#{1,3},##0(\.?)$/))return g+eo(""+p);if(u=t.match(/^#,##0\.([#0]*0)$/))return a<0?"-"+Ms(e,t,-a):eo(""+a)+"."+Va("0",u[1].length);if(u=t.match(/^#,#*,#0/))return Ms(e,t.replace(/^#,#*,/,""),a);if(u=t.match(/^([0#]+)(\\?-([0#]+))+$/))return o=dc(Ms(e,t.replace(/[\\-]/g,""),a)),c=0,dc(dc(t.replace(/\\/g,"")).replace(/[0#]/g,function(T){return c<o.length?o.charAt(c++):T==="0"?"0":""}));if(t.match(o2))return o=Ms(e,"##########",a),"("+o.substr(0,3)+") "+o.substr(3,3)+"-"+o.substr(6);var x="";if(u=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(u[4].length,7),f=vf(p,Math.pow(10,c)-1,!1),o=""+g,x=ii("n",u[1],f[1]),x.charAt(x.length-1)==" "&&(x=x.substr(0,x.length-1)+"0"),o+=x+u[2]+"/"+u[3],x=yf(f[2],c),x.length<u[4].length&&(x=zr(u[4].substr(u[4].length-x.length))+x),o+=x,o;if(u=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(Math.max(u[1].length,u[4].length),7),f=vf(p,Math.pow(10,c)-1,!0),g+(f[0]||(f[1]?"":"0"))+" "+(f[1]?lp(f[1],c)+u[2]+"/"+u[3]+yf(f[2],c):Va(" ",2*c+1+u[2].length+u[3].length));if(u=t.match(/^[#0?]+$/))return o=""+a,t.length<=o.length?o:zr(t.substr(0,t.length-o.length))+o;if(u=t.match(/^([#0]+)\.([#0]+)$/)){o=""+a.toFixed(Math.min(u[2].length,10)).replace(/([^0])0+$/,"$1"),c=o.indexOf(".");var v=t.indexOf(".")-c,_=t.length-o.length-v;return zr(t.substr(0,v)+o+t.substr(t.length-_))}if(u=t.match(/^00,000\.([#0]*0)$/))return a<0?"-"+Ms(e,t,-a):eo(""+a).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(T){return"00,"+(T.length<3?us(0,3-T.length):"")+T})+"."+us(0,u[1].length);switch(t){case"###,###":case"##,###":case"#,###":var k=eo(""+p);return k!=="0"?g+k:"";default:if(t.match(/\.[0#?]*$/))return Ms(e,t.slice(0,t.lastIndexOf(".")),a)+zr(t.slice(t.lastIndexOf(".")))}throw new Error("unsupported format |"+t+"|")}function ii(e,t,a){return(a|0)===a?Ms(e,t,a):Un(e,t,a)}function N5(e){for(var t=[],a=!1,s=0,o=0;s<e.length;++s)switch(e.charCodeAt(s)){case 34:a=!a;break;case 95:case 42:case 92:++s;break;case 59:t[t.length]=e.substr(o,s-o),o=s+1}if(t[t.length]=e.substr(o),a===!0)throw new Error("Format |"+e+"| unterminated string ");return t}var c2=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function d2(e){for(var t=0,a="",s="";t<e.length;)switch(a=e.charAt(t)){case"G":bf(e,t)&&(t+=6),t++;break;case'"':for(;e.charCodeAt(++t)!==34&&t<e.length;);++t;break;case"\\":t+=2;break;case"_":t+=2;break;case"@":++t;break;case"B":case"b":if(e.charAt(t+1)==="1"||e.charAt(t+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"上":if(e.substr(t,3).toUpperCase()==="A/P"||e.substr(t,5).toUpperCase()==="AM/PM"||e.substr(t,5).toUpperCase()==="上午/下午")return!0;++t;break;case"[":for(s=a;e.charAt(t++)!=="]"&&t<e.length;)s+=e.charAt(t);if(s.match(c2))return!0;break;case".":case"0":case"#":for(;t<e.length&&("0#?.,E+-%".indexOf(a=e.charAt(++t))>-1||a=="\\"&&e.charAt(t+1)=="-"&&"0#".indexOf(e.charAt(t+2))>-1););break;case"?":for(;e.charAt(++t)===a;);break;case"*":++t,(e.charAt(t)==" "||e.charAt(t)=="*")&&++t;break;case"(":case")":++t;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;t<e.length&&"0123456789".indexOf(e.charAt(++t))>-1;);break;case" ":++t;break;default:++t;break}return!1}function S5(e,t,a,s){for(var o=[],u="",c=0,f="",p="t",g,x,v,_="H";c<e.length;)switch(f=e.charAt(c)){case"G":if(!bf(e,c))throw new Error("unrecognized character "+f+" in "+e);o[o.length]={t:"G",v:"General"},c+=7;break;case'"':for(u="";(v=e.charCodeAt(++c))!==34&&c<e.length;)u+=String.fromCharCode(v);o[o.length]={t:"t",v:u},++c;break;case"\\":var k=e.charAt(++c),T=k==="("||k===")"?k:"t";o[o.length]={t:T,v:k},++c;break;case"_":o[o.length]={t:"t",v:" "},c+=2;break;case"@":o[o.length]={t:"T",v:t},++c;break;case"B":case"b":if(e.charAt(c+1)==="1"||e.charAt(c+1)==="2"){if(g==null&&(g=G0(t,a,e.charAt(c+1)==="2"),g==null))return"";o[o.length]={t:"X",v:e.substr(c,2)},p=f,c+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":f=f.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if(t<0||g==null&&(g=G0(t,a),g==null))return"";for(u=f;++c<e.length&&e.charAt(c).toLowerCase()===f;)u+=f;f==="m"&&p.toLowerCase()==="h"&&(f="M"),f==="h"&&(f=_),o[o.length]={t:f,v:u},p=f;break;case"A":case"a":case"上":var N={t:f,v:f};if(g==null&&(g=G0(t,a)),e.substr(c,3).toUpperCase()==="A/P"?(g!=null&&(N.v=g.H>=12?"P":"A"),N.t="T",_="h",c+=3):e.substr(c,5).toUpperCase()==="AM/PM"?(g!=null&&(N.v=g.H>=12?"PM":"AM"),N.t="T",c+=5,_="h"):e.substr(c,5).toUpperCase()==="上午/下午"?(g!=null&&(N.v=g.H>=12?"下午":"上午"),N.t="T",c+=5,_="h"):(N.t="t",++c),g==null&&N.t==="T")return"";o[o.length]=N,p=f;break;case"[":for(u=f;e.charAt(c++)!=="]"&&c<e.length;)u+=e.charAt(c);if(u.slice(-1)!=="]")throw'unterminated "[" block: |'+u+"|";if(u.match(c2)){if(g==null&&(g=G0(t,a),g==null))return"";o[o.length]={t:"Z",v:u.toLowerCase()},p=u.charAt(1)}else u.indexOf("$")>-1&&(u=(u.match(/\$([^-\[\]]*)/)||[])[1]||"$",d2(e)||(o[o.length]={t:"t",v:u}));break;case".":if(g!=null){for(u=f;++c<e.length&&(f=e.charAt(c))==="0";)u+=f;o[o.length]={t:"s",v:u};break}case"0":case"#":for(u=f;++c<e.length&&"0#?.,E+-%".indexOf(f=e.charAt(c))>-1;)u+=f;o[o.length]={t:"n",v:u};break;case"?":for(u=f;e.charAt(++c)===f;)u+=f;o[o.length]={t:f,v:u},p=f;break;case"*":++c,(e.charAt(c)==" "||e.charAt(c)=="*")&&++c;break;case"(":case")":o[o.length]={t:s===1?"t":f,v:f},++c;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(u=f;c<e.length&&"0123456789".indexOf(e.charAt(++c))>-1;)u+=e.charAt(c);o[o.length]={t:"D",v:u};break;case" ":o[o.length]={t:f,v:f},++c;break;case"$":o[o.length]={t:"t",v:"$"},++c;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(f)===-1)throw new Error("unrecognized character "+f+" in "+e);o[o.length]={t:"t",v:f},++c;break}var j=0,P=0,C;for(c=o.length-1,p="t";c>=0;--c)switch(o[c].t){case"h":case"H":o[c].t=_,p="h",j<1&&(j=1);break;case"s":(C=o[c].v.match(/\.0+$/))&&(P=Math.max(P,C[0].length-1)),j<3&&(j=3);case"d":case"y":case"M":case"e":p=o[c].t;break;case"m":p==="s"&&(o[c].t="M",j<2&&(j=2));break;case"X":break;case"Z":j<1&&o[c].v.match(/[Hh]/)&&(j=1),j<2&&o[c].v.match(/[Mm]/)&&(j=2),j<3&&o[c].v.match(/[Ss]/)&&(j=3)}switch(j){case 0:break;case 1:g.u>=.5&&(g.u=0,++g.S),g.S>=60&&(g.S=0,++g.M),g.M>=60&&(g.M=0,++g.H);break;case 2:g.u>=.5&&(g.u=0,++g.S),g.S>=60&&(g.S=0,++g.M);break}var O="",R;for(c=0;c<o.length;++c)switch(o[c].t){case"t":case"T":case" ":case"D":break;case"X":o[c].v="",o[c].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":o[c].v=g5(o[c].t.charCodeAt(0),o[c].v,g,P),o[c].t="t";break;case"n":case"?":for(R=c+1;o[R]!=null&&((f=o[R].t)==="?"||f==="D"||(f===" "||f==="t")&&o[R+1]!=null&&(o[R+1].t==="?"||o[R+1].t==="t"&&o[R+1].v==="/")||o[c].t==="("&&(f===" "||f==="n"||f===")")||f==="t"&&(o[R].v==="/"||o[R].v===" "&&o[R+1]!=null&&o[R+1].t=="?"));)o[c].v+=o[R].v,o[R]={v:"",t:";"},++R;O+=o[c].v,c=R-1;break;case"G":o[c].t="t",o[c].v=Fg(t,a);break}var U="",H,B;if(O.length>0){O.charCodeAt(0)==40?(H=t<0&&O.charCodeAt(0)===45?-t:t,B=ii("n",O,H)):(H=t<0&&s>1?-t:t,B=ii("n",O,H),H<0&&o[0]&&o[0].t=="t"&&(B=B.substr(1),o[0].v="-"+o[0].v)),R=B.length-1;var oe=o.length;for(c=0;c<o.length;++c)if(o[c]!=null&&o[c].t!="t"&&o[c].v.indexOf(".")>-1){oe=c;break}var se=o.length;if(oe===o.length&&B.indexOf("E")===-1){for(c=o.length-1;c>=0;--c)o[c]==null||"n?".indexOf(o[c].t)===-1||(R>=o[c].v.length-1?(R-=o[c].v.length,o[c].v=B.substr(R+1,o[c].v.length)):R<0?o[c].v="":(o[c].v=B.substr(0,R+1),R=-1),o[c].t="t",se=c);R>=0&&se<o.length&&(o[se].v=B.substr(0,R+1)+o[se].v)}else if(oe!==o.length&&B.indexOf("E")===-1){for(R=B.indexOf(".")-1,c=oe;c>=0;--c)if(!(o[c]==null||"n?".indexOf(o[c].t)===-1)){for(x=o[c].v.indexOf(".")>-1&&c===oe?o[c].v.indexOf(".")-1:o[c].v.length-1,U=o[c].v.substr(x+1);x>=0;--x)R>=0&&(o[c].v.charAt(x)==="0"||o[c].v.charAt(x)==="#")&&(U=B.charAt(R--)+U);o[c].v=U,o[c].t="t",se=c}for(R>=0&&se<o.length&&(o[se].v=B.substr(0,R+1)+o[se].v),R=B.indexOf(".")+1,c=oe;c<o.length;++c)if(!(o[c]==null||"n?(".indexOf(o[c].t)===-1&&c!==oe)){for(x=o[c].v.indexOf(".")>-1&&c===oe?o[c].v.indexOf(".")+1:0,U=o[c].v.substr(0,x);x<o[c].v.length;++x)R<B.length&&(U+=B.charAt(R++));o[c].v=U,o[c].t="t",se=c}}}for(c=0;c<o.length;++c)o[c]!=null&&"n?".indexOf(o[c].t)>-1&&(H=s>1&&t<0&&c>0&&o[c-1].v==="-"?-t:t,o[c].v=ii(o[c].t,o[c].v,H),o[c].t="t");var pe="";for(c=0;c!==o.length;++c)o[c]!=null&&(pe+=o[c].v);return pe}var Qb=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function ev(e,t){if(t==null)return!1;var a=parseFloat(t[2]);switch(t[1]){case"=":if(e==a)return!0;break;case">":if(e>a)return!0;break;case"<":if(e<a)return!0;break;case"<>":if(e!=a)return!0;break;case">=":if(e>=a)return!0;break;case"<=":if(e<=a)return!0;break}return!1}function j5(e,t){var a=N5(e),s=a.length,o=a[s-1].indexOf("@");if(s<4&&o>-1&&--s,a.length>4)throw new Error("cannot find right format for |"+a.join("|")+"|");if(typeof t!="number")return[4,a.length===4||o>-1?a[a.length-1]:"@"];switch(a.length){case 1:a=o>-1?["General","General","General",a[0]]:[a[0],a[0],a[0],"@"];break;case 2:a=o>-1?[a[0],a[0],a[0],a[1]]:[a[0],a[1],a[0],"@"];break;case 3:a=o>-1?[a[0],a[1],a[0],a[2]]:[a[0],a[1],a[2],"@"];break}var u=t>0?a[0]:t<0?a[1]:a[2];if(a[0].indexOf("[")===-1&&a[1].indexOf("[")===-1)return[s,u];if(a[0].match(/\[[=<>]/)!=null||a[1].match(/\[[=<>]/)!=null){var c=a[0].match(Qb),f=a[1].match(Qb);return ev(t,c)?[s,a[0]]:ev(t,f)?[s,a[1]]:[s,a[c!=null&&f!=null?2:1]]}return[s,u]}function to(e,t,a){a==null&&(a={});var s="";switch(typeof e){case"string":e=="m/d/yy"&&a.dateNF?s=a.dateNF:s=e;break;case"number":e==14&&a.dateNF?s=a.dateNF:s=(a.table!=null?a.table:Ga)[e],s==null&&(s=a.table&&a.table[Xb[e]]||Ga[Xb[e]]),s==null&&(s=o5[e]||"General");break}if(bf(s,0))return Fg(t,a);t instanceof Date&&(t=t2(t,a.date1904));var o=j5(s,t);if(bf(o[1]))return Fg(t,a);if(t===!0)t="TRUE";else if(t===!1)t="FALSE";else if(t===""||t==null)return"";return S5(o[1],t,a,o[0])}function u2(e,t){if(typeof t!="number"){t=+t||-1;for(var a=0;a<392;++a){if(Ga[a]==null){t<0&&(t=a);continue}if(Ga[a]==e){t=a;break}}t<0&&(t=391)}return Ga[t]=e,t}function $f(e){for(var t=0;t!=392;++t)e[t]!==void 0&&u2(e[t],t)}function Wf(){Ga=i5()}var f2=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function T5(e){var t=typeof e=="number"?Ga[e]:e;return t=t.replace(f2,"(\\d+)"),new RegExp("^"+t+"$")}function E5(e,t,a){var s=-1,o=-1,u=-1,c=-1,f=-1,p=-1;(t.match(f2)||[]).forEach(function(v,_){var k=parseInt(a[_+1],10);switch(v.toLowerCase().charAt(0)){case"y":s=k;break;case"d":u=k;break;case"h":c=k;break;case"s":p=k;break;case"m":c>=0?f=k:o=k;break}}),p>=0&&f==-1&&o>=0&&(f=o,o=-1);var g=(""+(s>=0?s:new Date().getFullYear())).slice(-4)+"-"+("00"+(o>=1?o:1)).slice(-2)+"-"+("00"+(u>=1?u:1)).slice(-2);g.length==7&&(g="0"+g),g.length==8&&(g="20"+g);var x=("00"+(c>=0?c:0)).slice(-2)+":"+("00"+(f>=0?f:0)).slice(-2)+":"+("00"+(p>=0?p:0)).slice(-2);return c==-1&&f==-1&&p==-1?g:s==-1&&o==-1&&u==-1?x:g+"T"+x}var C5=(function(){var e={};e.version="1.2.0";function t(){for(var B=0,oe=new Array(256),se=0;se!=256;++se)B=se,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,oe[se]=B;return typeof Int32Array!="undefined"?new Int32Array(oe):oe}var a=t();function s(B){var oe=0,se=0,pe=0,le=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(pe=0;pe!=256;++pe)le[pe]=B[pe];for(pe=0;pe!=256;++pe)for(se=B[pe],oe=256+pe;oe<4096;oe+=256)se=le[oe]=se>>>8^B[se&255];var re=[];for(pe=1;pe!=16;++pe)re[pe-1]=typeof Int32Array!="undefined"?le.subarray(pe*256,pe*256+256):le.slice(pe*256,pe*256+256);return re}var o=s(a),u=o[0],c=o[1],f=o[2],p=o[3],g=o[4],x=o[5],v=o[6],_=o[7],k=o[8],T=o[9],N=o[10],j=o[11],P=o[12],C=o[13],O=o[14];function R(B,oe){for(var se=oe^-1,pe=0,le=B.length;pe<le;)se=se>>>8^a[(se^B.charCodeAt(pe++))&255];return~se}function U(B,oe){for(var se=oe^-1,pe=B.length-15,le=0;le<pe;)se=O[B[le++]^se&255]^C[B[le++]^se>>8&255]^P[B[le++]^se>>16&255]^j[B[le++]^se>>>24]^N[B[le++]]^T[B[le++]]^k[B[le++]]^_[B[le++]]^v[B[le++]]^x[B[le++]]^g[B[le++]]^p[B[le++]]^f[B[le++]]^c[B[le++]]^u[B[le++]]^a[B[le++]];for(pe+=15;le<pe;)se=se>>>8^a[(se^B[le++])&255];return~se}function H(B,oe){for(var se=oe^-1,pe=0,le=B.length,re=0,de=0;pe<le;)re=B.charCodeAt(pe++),re<128?se=se>>>8^a[(se^re)&255]:re<2048?(se=se>>>8^a[(se^(192|re>>6&31))&255],se=se>>>8^a[(se^(128|re&63))&255]):re>=55296&&re<57344?(re=(re&1023)+64,de=B.charCodeAt(pe++)&1023,se=se>>>8^a[(se^(240|re>>8&7))&255],se=se>>>8^a[(se^(128|re>>2&63))&255],se=se>>>8^a[(se^(128|de>>6&15|(re&3)<<4))&255],se=se>>>8^a[(se^(128|de&63))&255]):(se=se>>>8^a[(se^(224|re>>12&15))&255],se=se>>>8^a[(se^(128|re>>6&63))&255],se=se>>>8^a[(se^(128|re&63))&255]);return~se}return e.table=a,e.bstr=R,e.buf=U,e.str=H,e})(),Na=(function(){var t={};t.version="1.2.1";function a(I,ee){for(var Y=I.split("/"),X=ee.split("/"),Q=0,F=0,he=Math.min(Y.length,X.length);Q<he;++Q){if(F=Y[Q].length-X[Q].length)return F;if(Y[Q]!=X[Q])return Y[Q]<X[Q]?-1:1}return Y.length-X.length}function s(I){if(I.charAt(I.length-1)=="/")return I.slice(0,-1).indexOf("/")===-1?I:s(I.slice(0,-1));var ee=I.lastIndexOf("/");return ee===-1?I:I.slice(0,ee+1)}function o(I){if(I.charAt(I.length-1)=="/")return o(I.slice(0,-1));var ee=I.lastIndexOf("/");return ee===-1?I:I.slice(ee+1)}function u(I,ee){typeof ee=="string"&&(ee=new Date(ee));var Y=ee.getHours();Y=Y<<6|ee.getMinutes(),Y=Y<<5|ee.getSeconds()>>>1,I.write_shift(2,Y);var X=ee.getFullYear()-1980;X=X<<4|ee.getMonth()+1,X=X<<5|ee.getDate(),I.write_shift(2,X)}function c(I){var ee=I.read_shift(2)&65535,Y=I.read_shift(2)&65535,X=new Date,Q=Y&31;Y>>>=5;var F=Y&15;Y>>>=4,X.setMilliseconds(0),X.setFullYear(Y+1980),X.setMonth(F-1),X.setDate(Q);var he=ee&31;ee>>>=5;var Ee=ee&63;return ee>>>=6,X.setHours(ee),X.setMinutes(Ee),X.setSeconds(he<<1),X}function f(I){kn(I,0);for(var ee={},Y=0;I.l<=I.length-4;){var X=I.read_shift(2),Q=I.read_shift(2),F=I.l+Q,he={};switch(X){case 21589:Y=I.read_shift(1),Y&1&&(he.mtime=I.read_shift(4)),Q>5&&(Y&2&&(he.atime=I.read_shift(4)),Y&4&&(he.ctime=I.read_shift(4))),he.mtime&&(he.mt=new Date(he.mtime*1e3));break}I.l=F,ee[X]=he}return ee}var p;function g(){return p||(p={})}function x(I,ee){if(I[0]==80&&I[1]==75)return tt(I,ee);if((I[0]|32)==109&&(I[1]|32)==105)return Rr(I,ee);if(I.length<512)throw new Error("CFB file size "+I.length+" < 512");var Y=3,X=512,Q=0,F=0,he=0,Ee=0,_e=0,je=[],Se=I.slice(0,512);kn(Se,0);var Ye=v(Se);switch(Y=Ye[0],Y){case 3:X=512;break;case 4:X=4096;break;case 0:if(Ye[1]==0)return tt(I,ee);default:throw new Error("Major Version: Expected 3 or 4 saw "+Y)}X!==512&&(Se=I.slice(0,X),kn(Se,28));var et=I.slice(0,X);_(Se,Y);var ot=Se.read_shift(4,"i");if(Y===3&&ot!==0)throw new Error("# Directory Sectors: Expected 0 saw "+ot);Se.l+=4,he=Se.read_shift(4,"i"),Se.l+=4,Se.chk("00100000","Mini Stream Cutoff Size: "),Ee=Se.read_shift(4,"i"),Q=Se.read_shift(4,"i"),_e=Se.read_shift(4,"i"),F=Se.read_shift(4,"i");for(var Qe=-1,lt=0;lt<109&&(Qe=Se.read_shift(4,"i"),!(Qe<0));++lt)je[lt]=Qe;var mt=k(I,X);j(_e,F,mt,X,je);var ya=C(mt,he,je,X);ya[he].name="!Directory",Q>0&&Ee!==de&&(ya[Ee].name="!MiniFAT"),ya[je[0]].name="!FAT",ya.fat_addrs=je,ya.ssz=X;var ba={},Ea=[],Tr=[],un=[];O(he,ya,mt,Ea,Q,ba,Tr,Ee),T(Tr,un,Ea),Ea.shift();var Yn={FileIndex:Tr,FullPaths:un};return ee&&ee.raw&&(Yn.raw={header:et,sectors:mt}),Yn}function v(I){if(I[I.l]==80&&I[I.l+1]==75)return[0,0];I.chk(ye,"Header Signature: "),I.l+=16;var ee=I.read_shift(2,"u");return[I.read_shift(2,"u"),ee]}function _(I,ee){var Y=9;switch(I.l+=2,Y=I.read_shift(2)){case 9:if(ee!=3)throw new Error("Sector Shift: Expected 9 saw "+Y);break;case 12:if(ee!=4)throw new Error("Sector Shift: Expected 12 saw "+Y);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+Y)}I.chk("0600","Mini Sector Shift: "),I.chk("000000000000","Reserved: ")}function k(I,ee){for(var Y=Math.ceil(I.length/ee)-1,X=[],Q=1;Q<Y;++Q)X[Q-1]=I.slice(Q*ee,(Q+1)*ee);return X[Y-1]=I.slice(Y*ee),X}function T(I,ee,Y){for(var X=0,Q=0,F=0,he=0,Ee=0,_e=Y.length,je=[],Se=[];X<_e;++X)je[X]=Se[X]=X,ee[X]=Y[X];for(;Ee<Se.length;++Ee)X=Se[Ee],Q=I[X].L,F=I[X].R,he=I[X].C,je[X]===X&&(Q!==-1&&je[Q]!==Q&&(je[X]=je[Q]),F!==-1&&je[F]!==F&&(je[X]=je[F])),he!==-1&&(je[he]=X),Q!==-1&&X!=je[X]&&(je[Q]=je[X],Se.lastIndexOf(Q)<Ee&&Se.push(Q)),F!==-1&&X!=je[X]&&(je[F]=je[X],Se.lastIndexOf(F)<Ee&&Se.push(F));for(X=1;X<_e;++X)je[X]===X&&(F!==-1&&je[F]!==F?je[X]=je[F]:Q!==-1&&je[Q]!==Q&&(je[X]=je[Q]));for(X=1;X<_e;++X)if(I[X].type!==0){if(Ee=X,Ee!=je[Ee])do Ee=je[Ee],ee[X]=ee[Ee]+"/"+ee[X];while(Ee!==0&&je[Ee]!==-1&&Ee!=je[Ee]);je[X]=-1}for(ee[0]+="/",X=1;X<_e;++X)I[X].type!==2&&(ee[X]+="/")}function N(I,ee,Y){for(var X=I.start,Q=I.size,F=[],he=X;Y&&Q>0&&he>=0;)F.push(ee.slice(he*re,he*re+re)),Q-=re,he=$o(Y,he*4);return F.length===0?Ie(0):kr(F).slice(0,I.size)}function j(I,ee,Y,X,Q){var F=de;if(I===de){if(ee!==0)throw new Error("DIFAT chain shorter than expected")}else if(I!==-1){var he=Y[I],Ee=(X>>>2)-1;if(!he)return;for(var _e=0;_e<Ee&&(F=$o(he,_e*4))!==de;++_e)Q.push(F);j($o(he,X-4),ee-1,Y,X,Q)}}function P(I,ee,Y,X,Q){var F=[],he=[];Q||(Q=[]);var Ee=X-1,_e=0,je=0;for(_e=ee;_e>=0;){Q[_e]=!0,F[F.length]=_e,he.push(I[_e]);var Se=Y[Math.floor(_e*4/X)];if(je=_e*4&Ee,X<4+je)throw new Error("FAT boundary crossed: "+_e+" 4 "+X);if(!I[Se])break;_e=$o(I[Se],je)}return{nodes:F,data:lv([he])}}function C(I,ee,Y,X){var Q=I.length,F=[],he=[],Ee=[],_e=[],je=X-1,Se=0,Ye=0,et=0,ot=0;for(Se=0;Se<Q;++Se)if(Ee=[],et=Se+ee,et>=Q&&(et-=Q),!he[et]){_e=[];var Qe=[];for(Ye=et;Ye>=0;){Qe[Ye]=!0,he[Ye]=!0,Ee[Ee.length]=Ye,_e.push(I[Ye]);var lt=Y[Math.floor(Ye*4/X)];if(ot=Ye*4&je,X<4+ot)throw new Error("FAT boundary crossed: "+Ye+" 4 "+X);if(!I[lt]||(Ye=$o(I[lt],ot),Qe[Ye]))break}F[et]={nodes:Ee,data:lv([_e])}}return F}function O(I,ee,Y,X,Q,F,he,Ee){for(var _e=0,je=X.length?2:0,Se=ee[I].data,Ye=0,et=0,ot;Ye<Se.length;Ye+=128){var Qe=Se.slice(Ye,Ye+128);kn(Qe,64),et=Qe.read_shift(2),ot=mp(Qe,0,et-je),X.push(ot);var lt={name:ot,type:Qe.read_shift(1),color:Qe.read_shift(1),L:Qe.read_shift(4,"i"),R:Qe.read_shift(4,"i"),C:Qe.read_shift(4,"i"),clsid:Qe.read_shift(16),state:Qe.read_shift(4,"i"),start:0,size:0},mt=Qe.read_shift(2)+Qe.read_shift(2)+Qe.read_shift(2)+Qe.read_shift(2);mt!==0&&(lt.ct=R(Qe,Qe.l-8));var ya=Qe.read_shift(2)+Qe.read_shift(2)+Qe.read_shift(2)+Qe.read_shift(2);ya!==0&&(lt.mt=R(Qe,Qe.l-8)),lt.start=Qe.read_shift(4,"i"),lt.size=Qe.read_shift(4,"i"),lt.size<0&&lt.start<0&&(lt.size=lt.type=0,lt.start=de,lt.name=""),lt.type===5?(_e=lt.start,Q>0&&_e!==de&&(ee[_e].name="!StreamData")):lt.size>=4096?(lt.storage="fat",ee[lt.start]===void 0&&(ee[lt.start]=P(Y,lt.start,ee.fat_addrs,ee.ssz)),ee[lt.start].name=lt.name,lt.content=ee[lt.start].data.slice(0,lt.size)):(lt.storage="minifat",lt.size<0?lt.size=0:_e!==de&&lt.start!==de&&ee[_e]&&(lt.content=N(lt,ee[_e].data,(ee[Ee]||{}).data))),lt.content&&kn(lt.content,0),F[ot]=lt,he.push(lt)}}function R(I,ee){return new Date((Sn(I,ee+4)/1e7*Math.pow(2,32)+Sn(I,ee)/1e7-11644473600)*1e3)}function U(I,ee){return g(),x(p.readFileSync(I),ee)}function H(I,ee){var Y=ee&&ee.type;switch(Y||la&&Buffer.isBuffer(I)&&(Y="buffer"),Y||"base64"){case"file":return U(I,ee);case"base64":return x(cs(hi(I)),ee);case"binary":return x(cs(I),ee)}return x(I,ee)}function B(I,ee){var Y=ee||{},X=Y.root||"Root Entry";if(I.FullPaths||(I.FullPaths=[]),I.FileIndex||(I.FileIndex=[]),I.FullPaths.length!==I.FileIndex.length)throw new Error("inconsistent CFB structure");I.FullPaths.length===0&&(I.FullPaths[0]=X+"/",I.FileIndex[0]={name:X,type:5}),Y.CLSID&&(I.FileIndex[0].clsid=Y.CLSID),oe(I)}function oe(I){var ee="Sh33tJ5";if(!Na.find(I,"/"+ee)){var Y=Ie(4);Y[0]=55,Y[1]=Y[3]=50,Y[2]=54,I.FileIndex.push({name:ee,type:2,content:Y,size:4,L:69,R:69,C:69}),I.FullPaths.push(I.FullPaths[0]+ee),se(I)}}function se(I,ee){B(I);for(var Y=!1,X=!1,Q=I.FullPaths.length-1;Q>=0;--Q){var F=I.FileIndex[Q];switch(F.type){case 0:X?Y=!0:(I.FileIndex.pop(),I.FullPaths.pop());break;case 1:case 2:case 5:X=!0,isNaN(F.R*F.L*F.C)&&(Y=!0),F.R>-1&&F.L>-1&&F.R==F.L&&(Y=!0);break;default:Y=!0;break}}if(!(!Y&&!ee)){var he=new Date(1987,1,19),Ee=0,_e=Object.create?Object.create(null):{},je=[];for(Q=0;Q<I.FullPaths.length;++Q)_e[I.FullPaths[Q]]=!0,I.FileIndex[Q].type!==0&&je.push([I.FullPaths[Q],I.FileIndex[Q]]);for(Q=0;Q<je.length;++Q){var Se=s(je[Q][0]);X=_e[Se],X||(je.push([Se,{name:o(Se).replace("/",""),type:1,clsid:te,ct:he,mt:he,content:null}]),_e[Se]=!0)}for(je.sort(function(ot,Qe){return a(ot[0],Qe[0])}),I.FullPaths=[],I.FileIndex=[],Q=0;Q<je.length;++Q)I.FullPaths[Q]=je[Q][0],I.FileIndex[Q]=je[Q][1];for(Q=0;Q<je.length;++Q){var Ye=I.FileIndex[Q],et=I.FullPaths[Q];if(Ye.name=o(et).replace("/",""),Ye.L=Ye.R=Ye.C=-(Ye.color=1),Ye.size=Ye.content?Ye.content.length:0,Ye.start=0,Ye.clsid=Ye.clsid||te,Q===0)Ye.C=je.length>1?1:-1,Ye.size=0,Ye.type=5;else if(et.slice(-1)=="/"){for(Ee=Q+1;Ee<je.length&&s(I.FullPaths[Ee])!=et;++Ee);for(Ye.C=Ee>=je.length?-1:Ee,Ee=Q+1;Ee<je.length&&s(I.FullPaths[Ee])!=s(et);++Ee);Ye.R=Ee>=je.length?-1:Ee,Ye.type=1}else s(I.FullPaths[Q+1]||"")==s(et)&&(Ye.R=Q+1),Ye.type=2}}}function pe(I,ee){var Y=ee||{};if(Y.fileType=="mad")return qn(I,Y);switch(se(I),Y.fileType){case"zip":return Ia(I,Y)}var X=(function(ot){for(var Qe=0,lt=0,mt=0;mt<ot.FileIndex.length;++mt){var ya=ot.FileIndex[mt];if(ya.content){var ba=ya.content.length;ba>0&&(ba<4096?Qe+=ba+63>>6:lt+=ba+511>>9)}}for(var Ea=ot.FullPaths.length+3>>2,Tr=Qe+7>>3,un=Qe+127>>7,Yn=Tr+lt+Ea+un,fn=Yn+127>>7,Xn=fn<=109?0:Math.ceil((fn-109)/127);Yn+fn+Xn+127>>7>fn;)Xn=++fn<=109?0:Math.ceil((fn-109)/127);var Mt=[1,Xn,fn,un,Ea,lt,Qe,0];return ot.FileIndex[0].size=Qe<<6,Mt[7]=(ot.FileIndex[0].start=Mt[0]+Mt[1]+Mt[2]+Mt[3]+Mt[4]+Mt[5])+(Mt[6]+7>>3),Mt})(I),Q=Ie(X[7]<<9),F=0,he=0;{for(F=0;F<8;++F)Q.write_shift(1,ue[F]);for(F=0;F<8;++F)Q.write_shift(2,0);for(Q.write_shift(2,62),Q.write_shift(2,3),Q.write_shift(2,65534),Q.write_shift(2,9),Q.write_shift(2,6),F=0;F<3;++F)Q.write_shift(2,0);for(Q.write_shift(4,0),Q.write_shift(4,X[2]),Q.write_shift(4,X[0]+X[1]+X[2]+X[3]-1),Q.write_shift(4,0),Q.write_shift(4,4096),Q.write_shift(4,X[3]?X[0]+X[1]+X[2]-1:de),Q.write_shift(4,X[3]),Q.write_shift(-4,X[1]?X[0]-1:de),Q.write_shift(4,X[1]),F=0;F<109;++F)Q.write_shift(-4,F<X[2]?X[1]+F:-1)}if(X[1])for(he=0;he<X[1];++he){for(;F<236+he*127;++F)Q.write_shift(-4,F<X[2]?X[1]+F:-1);Q.write_shift(-4,he===X[1]-1?de:he+1)}var Ee=function(ot){for(he+=ot;F<he-1;++F)Q.write_shift(-4,F+1);ot&&(++F,Q.write_shift(-4,de))};for(he=F=0,he+=X[1];F<he;++F)Q.write_shift(-4,V.DIFSECT);for(he+=X[2];F<he;++F)Q.write_shift(-4,V.FATSECT);Ee(X[3]),Ee(X[4]);for(var _e=0,je=0,Se=I.FileIndex[0];_e<I.FileIndex.length;++_e)Se=I.FileIndex[_e],Se.content&&(je=Se.content.length,!(je<4096)&&(Se.start=he,Ee(je+511>>9)));for(Ee(X[6]+7>>3);Q.l&511;)Q.write_shift(-4,V.ENDOFCHAIN);for(he=F=0,_e=0;_e<I.FileIndex.length;++_e)Se=I.FileIndex[_e],Se.content&&(je=Se.content.length,!(!je||je>=4096)&&(Se.start=he,Ee(je+63>>6)));for(;Q.l&511;)Q.write_shift(-4,V.ENDOFCHAIN);for(F=0;F<X[4]<<2;++F){var Ye=I.FullPaths[F];if(!Ye||Ye.length===0){for(_e=0;_e<17;++_e)Q.write_shift(4,0);for(_e=0;_e<3;++_e)Q.write_shift(4,-1);for(_e=0;_e<12;++_e)Q.write_shift(4,0);continue}Se=I.FileIndex[F],F===0&&(Se.start=Se.size?Se.start-1:de);var et=F===0&&Y.root||Se.name;if(je=2*(et.length+1),Q.write_shift(64,et,"utf16le"),Q.write_shift(2,je),Q.write_shift(1,Se.type),Q.write_shift(1,Se.color),Q.write_shift(-4,Se.L),Q.write_shift(-4,Se.R),Q.write_shift(-4,Se.C),Se.clsid)Q.write_shift(16,Se.clsid,"hex");else for(_e=0;_e<4;++_e)Q.write_shift(4,0);Q.write_shift(4,Se.state||0),Q.write_shift(4,0),Q.write_shift(4,0),Q.write_shift(4,0),Q.write_shift(4,0),Q.write_shift(4,Se.start),Q.write_shift(4,Se.size),Q.write_shift(4,0)}for(F=1;F<I.FileIndex.length;++F)if(Se=I.FileIndex[F],Se.size>=4096)if(Q.l=Se.start+1<<9,la&&Buffer.isBuffer(Se.content))Se.content.copy(Q,Q.l,0,Se.size),Q.l+=Se.size+511&-512;else{for(_e=0;_e<Se.size;++_e)Q.write_shift(1,Se.content[_e]);for(;_e&511;++_e)Q.write_shift(1,0)}for(F=1;F<I.FileIndex.length;++F)if(Se=I.FileIndex[F],Se.size>0&&Se.size<4096)if(la&&Buffer.isBuffer(Se.content))Se.content.copy(Q,Q.l,0,Se.size),Q.l+=Se.size+63&-64;else{for(_e=0;_e<Se.size;++_e)Q.write_shift(1,Se.content[_e]);for(;_e&63;++_e)Q.write_shift(1,0)}if(la)Q.l=Q.length;else for(;Q.l<Q.length;)Q.write_shift(1,0);return Q}function le(I,ee){var Y=I.FullPaths.map(function(_e){return _e.toUpperCase()}),X=Y.map(function(_e){var je=_e.split("/");return je[je.length-(_e.slice(-1)=="/"?2:1)]}),Q=!1;ee.charCodeAt(0)===47?(Q=!0,ee=Y[0].slice(0,-1)+ee):Q=ee.indexOf("/")!==-1;var F=ee.toUpperCase(),he=Q===!0?Y.indexOf(F):X.indexOf(F);if(he!==-1)return I.FileIndex[he];var Ee=!F.match(V0);for(F=F.replace(zd,""),Ee&&(F=F.replace(V0,"!")),he=0;he<Y.length;++he)if((Ee?Y[he].replace(V0,"!"):Y[he]).replace(zd,"")==F||(Ee?X[he].replace(V0,"!"):X[he]).replace(zd,"")==F)return I.FileIndex[he];return null}var re=64,de=-2,ye="d0cf11e0a1b11ae1",ue=[208,207,17,224,161,177,26,225],te="00000000000000000000000000000000",V={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:de,FREESECT:-1,HEADER_SIGNATURE:ye,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:te,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function J(I,ee,Y){g();var X=pe(I,Y);p.writeFileSync(ee,X)}function ne(I){for(var ee=new Array(I.length),Y=0;Y<I.length;++Y)ee[Y]=String.fromCharCode(I[Y]);return ee.join("")}function ae(I,ee){var Y=pe(I,ee);switch(ee&&ee.type||"buffer"){case"file":return g(),p.writeFileSync(ee.filename,Y),Y;case"binary":return typeof Y=="string"?Y:ne(Y);case"base64":return Xd(typeof Y=="string"?Y:ne(Y));case"buffer":if(la)return Buffer.isBuffer(Y)?Y:pi(Y);case"array":return typeof Y=="string"?cs(Y):Y}return Y}var z;function D(I){try{var ee=I.InflateRaw,Y=new ee;if(Y._processChunk(new Uint8Array([3,0]),Y._finishFlushFlag),Y.bytesRead)z=I;else throw new Error("zlib does not expose bytesRead")}catch(X){console.error("cannot use native zlib: "+(X.message||X))}}function G(I,ee){if(!z)return Gt(I,ee);var Y=z.InflateRaw,X=new Y,Q=X._processChunk(I.slice(I.l),X._finishFlushFlag);return I.l+=X.bytesRead,Q}function q(I){return z?z.deflateRawSync(I):at(I)}var K=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],fe=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],Pe=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];function We(I){var ee=(I<<1|I<<11)&139536|(I<<5|I<<15)&558144;return(ee>>16|ee>>8|ee)&255}for(var Fe=typeof Uint8Array!="undefined",He=Fe?new Uint8Array(256):[],it=0;it<256;++it)He[it]=We(it);function ht(I,ee){var Y=He[I&255];return ee<=8?Y>>>8-ee:(Y=Y<<8|He[I>>8&255],ee<=16?Y>>>16-ee:(Y=Y<<8|He[I>>16&255],Y>>>24-ee))}function Vt(I,ee){var Y=ee&7,X=ee>>>3;return(I[X]|(Y<=6?0:I[X+1]<<8))>>>Y&3}function _t(I,ee){var Y=ee&7,X=ee>>>3;return(I[X]|(Y<=5?0:I[X+1]<<8))>>>Y&7}function ia(I,ee){var Y=ee&7,X=ee>>>3;return(I[X]|(Y<=4?0:I[X+1]<<8))>>>Y&15}function Lt(I,ee){var Y=ee&7,X=ee>>>3;return(I[X]|(Y<=3?0:I[X+1]<<8))>>>Y&31}function Be(I,ee){var Y=ee&7,X=ee>>>3;return(I[X]|(Y<=1?0:I[X+1]<<8))>>>Y&127}function yt(I,ee,Y){var X=ee&7,Q=ee>>>3,F=(1<<Y)-1,he=I[Q]>>>X;return Y<8-X||(he|=I[Q+1]<<8-X,Y<16-X)||(he|=I[Q+2]<<16-X,Y<24-X)||(he|=I[Q+3]<<24-X),he&F}function ke(I,ee,Y){var X=ee&7,Q=ee>>>3;return X<=5?I[Q]|=(Y&7)<<X:(I[Q]|=Y<<X&255,I[Q+1]=(Y&7)>>8-X),ee+3}function ze(I,ee,Y){var X=ee&7,Q=ee>>>3;return Y=(Y&1)<<X,I[Q]|=Y,ee+1}function Je(I,ee,Y){var X=ee&7,Q=ee>>>3;return Y<<=X,I[Q]|=Y&255,Y>>>=8,I[Q+1]=Y,ee+8}function nt(I,ee,Y){var X=ee&7,Q=ee>>>3;return Y<<=X,I[Q]|=Y&255,Y>>>=8,I[Q+1]=Y&255,I[Q+2]=Y>>>8,ee+16}function ut(I,ee){var Y=I.length,X=2*Y>ee?2*Y:ee+5,Q=0;if(Y>=ee)return I;if(la){var F=Zb(X);if(I.copy)I.copy(F);else for(;Q<I.length;++Q)F[Q]=I[Q];return F}else if(Fe){var he=new Uint8Array(X);if(he.set)he.set(I);else for(;Q<Y;++Q)he[Q]=I[Q];return he}return I.length=X,I}function ft(I){for(var ee=new Array(I),Y=0;Y<I;++Y)ee[Y]=0;return ee}function bt(I,ee,Y){var X=1,Q=0,F=0,he=0,Ee=0,_e=I.length,je=Fe?new Uint16Array(32):ft(32);for(F=0;F<32;++F)je[F]=0;for(F=_e;F<Y;++F)I[F]=0;_e=I.length;var Se=Fe?new Uint16Array(_e):ft(_e);for(F=0;F<_e;++F)je[Q=I[F]]++,X<Q&&(X=Q),Se[F]=0;for(je[0]=0,F=1;F<=X;++F)je[F+16]=Ee=Ee+je[F-1]<<1;for(F=0;F<_e;++F)Ee=I[F],Ee!=0&&(Se[F]=je[Ee+16]++);var Ye=0;for(F=0;F<_e;++F)if(Ye=I[F],Ye!=0)for(Ee=ht(Se[F],X)>>X-Ye,he=(1<<X+4-Ye)-1;he>=0;--he)ee[Ee|he<<Ye]=Ye&15|F<<4;return X}var Ut=Fe?new Uint16Array(512):ft(512),Rt=Fe?new Uint16Array(32):ft(32);if(!Fe){for(var Pt=0;Pt<512;++Pt)Ut[Pt]=0;for(Pt=0;Pt<32;++Pt)Rt[Pt]=0}(function(){for(var I=[],ee=0;ee<32;ee++)I.push(5);bt(I,Rt,32);var Y=[];for(ee=0;ee<=143;ee++)Y.push(8);for(;ee<=255;ee++)Y.push(9);for(;ee<=279;ee++)Y.push(7);for(;ee<=287;ee++)Y.push(8);bt(Y,Ut,288)})();var qe=(function(){for(var ee=Fe?new Uint8Array(32768):[],Y=0,X=0;Y<Pe.length-1;++Y)for(;X<Pe[Y+1];++X)ee[X]=Y;for(;X<32768;++X)ee[X]=29;var Q=Fe?new Uint8Array(259):[];for(Y=0,X=0;Y<fe.length-1;++Y)for(;X<fe[Y+1];++X)Q[X]=Y;function F(Ee,_e){for(var je=0;je<Ee.length;){var Se=Math.min(65535,Ee.length-je),Ye=je+Se==Ee.length;for(_e.write_shift(1,+Ye),_e.write_shift(2,Se),_e.write_shift(2,~Se&65535);Se-- >0;)_e[_e.l++]=Ee[je++]}return _e.l}function he(Ee,_e){for(var je=0,Se=0,Ye=Fe?new Uint16Array(32768):[];Se<Ee.length;){var et=Math.min(65535,Ee.length-Se);if(et<10){for(je=ke(_e,je,+(Se+et==Ee.length)),je&7&&(je+=8-(je&7)),_e.l=je/8|0,_e.write_shift(2,et),_e.write_shift(2,~et&65535);et-- >0;)_e[_e.l++]=Ee[Se++];je=_e.l*8;continue}je=ke(_e,je,+(Se+et==Ee.length)+2);for(var ot=0;et-- >0;){var Qe=Ee[Se];ot=(ot<<5^Qe)&32767;var lt=-1,mt=0;if((lt=Ye[ot])&&(lt|=Se&-32768,lt>Se&&(lt-=32768),lt<Se))for(;Ee[lt+mt]==Ee[Se+mt]&&mt<250;)++mt;if(mt>2){Qe=Q[mt],Qe<=22?je=Je(_e,je,He[Qe+1]>>1)-1:(Je(_e,je,3),je+=5,Je(_e,je,He[Qe-23]>>5),je+=3);var ya=Qe<8?0:Qe-4>>2;ya>0&&(nt(_e,je,mt-fe[Qe]),je+=ya),Qe=ee[Se-lt],je=Je(_e,je,He[Qe]>>3),je-=3;var ba=Qe<4?0:Qe-2>>1;ba>0&&(nt(_e,je,Se-lt-Pe[Qe]),je+=ba);for(var Ea=0;Ea<mt;++Ea)Ye[ot]=Se&32767,ot=(ot<<5^Ee[Se])&32767,++Se;et-=mt-1}else Qe<=143?Qe=Qe+48:je=ze(_e,je,1),je=Je(_e,je,He[Qe]),Ye[ot]=Se&32767,++Se}je=Je(_e,je,0)-1}return _e.l=(je+7)/8|0,_e.l}return function(_e,je){return _e.length<8?F(_e,je):he(_e,je)}})();function at(I){var ee=Ie(50+Math.floor(I.length*1.1)),Y=qe(I,ee);return ee.slice(0,Y)}var wt=Fe?new Uint16Array(32768):ft(32768),kt=Fe?new Uint16Array(32768):ft(32768),da=Fe?new Uint16Array(128):ft(128),xe=1,De=1;function $e(I,ee){var Y=Lt(I,ee)+257;ee+=5;var X=Lt(I,ee)+1;ee+=5;var Q=ia(I,ee)+4;ee+=4;for(var F=0,he=Fe?new Uint8Array(19):ft(19),Ee=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],_e=1,je=Fe?new Uint8Array(8):ft(8),Se=Fe?new Uint8Array(8):ft(8),Ye=he.length,et=0;et<Q;++et)he[K[et]]=F=_t(I,ee),_e<F&&(_e=F),je[F]++,ee+=3;var ot=0;for(je[0]=0,et=1;et<=_e;++et)Se[et]=ot=ot+je[et-1]<<1;for(et=0;et<Ye;++et)(ot=he[et])!=0&&(Ee[et]=Se[ot]++);var Qe=0;for(et=0;et<Ye;++et)if(Qe=he[et],Qe!=0){ot=He[Ee[et]]>>8-Qe;for(var lt=(1<<7-Qe)-1;lt>=0;--lt)da[ot|lt<<Qe]=Qe&7|et<<3}var mt=[];for(_e=1;mt.length<Y+X;)switch(ot=da[Be(I,ee)],ee+=ot&7,ot>>>=3){case 16:for(F=3+Vt(I,ee),ee+=2,ot=mt[mt.length-1];F-- >0;)mt.push(ot);break;case 17:for(F=3+_t(I,ee),ee+=3;F-- >0;)mt.push(0);break;case 18:for(F=11+Be(I,ee),ee+=7;F-- >0;)mt.push(0);break;default:mt.push(ot),_e<ot&&(_e=ot);break}var ya=mt.slice(0,Y),ba=mt.slice(Y);for(et=Y;et<286;++et)ya[et]=0;for(et=X;et<30;++et)ba[et]=0;return xe=bt(ya,wt,286),De=bt(ba,kt,30),ee}function Et(I,ee){if(I[0]==3&&!(I[1]&3))return[Qo(ee),2];for(var Y=0,X=0,Q=Zb(ee||1<<18),F=0,he=Q.length>>>0,Ee=0,_e=0;(X&1)==0;){if(X=_t(I,Y),Y+=3,X>>>1)X>>1==1?(Ee=9,_e=5):(Y=$e(I,Y),Ee=xe,_e=De);else{Y&7&&(Y+=8-(Y&7));var je=I[Y>>>3]|I[(Y>>>3)+1]<<8;if(Y+=32,je>0)for(!ee&&he<F+je&&(Q=ut(Q,F+je),he=Q.length);je-- >0;)Q[F++]=I[Y>>>3],Y+=8;continue}for(;;){!ee&&he<F+32767&&(Q=ut(Q,F+32767),he=Q.length);var Se=yt(I,Y,Ee),Ye=X>>>1==1?Ut[Se]:wt[Se];if(Y+=Ye&15,Ye>>>=4,(Ye>>>8&255)===0)Q[F++]=Ye;else{if(Ye==256)break;Ye-=257;var et=Ye<8?0:Ye-4>>2;et>5&&(et=0);var ot=F+fe[Ye];et>0&&(ot+=yt(I,Y,et),Y+=et),Se=yt(I,Y,_e),Ye=X>>>1==1?Rt[Se]:kt[Se],Y+=Ye&15,Ye>>>=4;var Qe=Ye<4?0:Ye-2>>1,lt=Pe[Ye];for(Qe>0&&(lt+=yt(I,Y,Qe),Y+=Qe),!ee&&he<ot&&(Q=ut(Q,ot+100),he=Q.length);F<ot;)Q[F]=Q[F-lt],++F}}}return ee?[Q,Y+7>>>3]:[Q.slice(0,F),Y+7>>>3]}function Gt(I,ee){var Y=I.slice(I.l||0),X=Et(Y,ee);return I.l+=X[1],X[0]}function Sa(I,ee){if(I)typeof console!="undefined"&&console.error(ee);else throw new Error(ee)}function tt(I,ee){var Y=I;kn(Y,0);var X=[],Q=[],F={FileIndex:X,FullPaths:Q};B(F,{root:ee.root});for(var he=Y.length-4;(Y[he]!=80||Y[he+1]!=75||Y[he+2]!=5||Y[he+3]!=6)&&he>=0;)--he;Y.l=he+4,Y.l+=4;var Ee=Y.read_shift(2);Y.l+=6;var _e=Y.read_shift(4);for(Y.l=_e,he=0;he<Ee;++he){Y.l+=20;var je=Y.read_shift(4),Se=Y.read_shift(4),Ye=Y.read_shift(2),et=Y.read_shift(2),ot=Y.read_shift(2);Y.l+=8;var Qe=Y.read_shift(4),lt=f(Y.slice(Y.l+Ye,Y.l+Ye+et));Y.l+=Ye+et+ot;var mt=Y.l;Y.l=Qe+4,Zt(Y,je,Se,F,lt),Y.l=mt}return F}function Zt(I,ee,Y,X,Q){I.l+=2;var F=I.read_shift(2),he=I.read_shift(2),Ee=c(I);if(F&8257)throw new Error("Unsupported ZIP encryption");for(var _e=I.read_shift(4),je=I.read_shift(4),Se=I.read_shift(4),Ye=I.read_shift(2),et=I.read_shift(2),ot="",Qe=0;Qe<Ye;++Qe)ot+=String.fromCharCode(I[I.l++]);if(et){var lt=f(I.slice(I.l,I.l+et));(lt[21589]||{}).mt&&(Ee=lt[21589].mt),((Q||{})[21589]||{}).mt&&(Ee=Q[21589].mt)}I.l+=et;var mt=I.slice(I.l,I.l+je);switch(he){case 8:mt=G(I,Se);break;case 0:break;default:throw new Error("Unsupported ZIP Compression method "+he)}var ya=!1;F&8&&(_e=I.read_shift(4),_e==134695760&&(_e=I.read_shift(4),ya=!0),je=I.read_shift(4),Se=I.read_shift(4)),je!=ee&&Sa(ya,"Bad compressed size: "+ee+" != "+je),Se!=Y&&Sa(ya,"Bad uncompressed size: "+Y+" != "+Se),Cn(X,ot,mt,{unsafe:!0,mt:Ee})}function Ia(I,ee){var Y=ee||{},X=[],Q=[],F=Ie(1),he=Y.compression?8:0,Ee=0,_e=0,je=0,Se=0,Ye=0,et=I.FullPaths[0],ot=et,Qe=I.FileIndex[0],lt=[],mt=0;for(_e=1;_e<I.FullPaths.length;++_e)if(ot=I.FullPaths[_e].slice(et.length),Qe=I.FileIndex[_e],!(!Qe.size||!Qe.content||ot=="Sh33tJ5")){var ya=Se,ba=Ie(ot.length);for(je=0;je<ot.length;++je)ba.write_shift(1,ot.charCodeAt(je)&127);ba=ba.slice(0,ba.l),lt[Ye]=C5.buf(Qe.content,0);var Ea=Qe.content;he==8&&(Ea=q(Ea)),F=Ie(30),F.write_shift(4,67324752),F.write_shift(2,20),F.write_shift(2,Ee),F.write_shift(2,he),Qe.mt?u(F,Qe.mt):F.write_shift(4,0),F.write_shift(-4,lt[Ye]),F.write_shift(4,Ea.length),F.write_shift(4,Qe.content.length),F.write_shift(2,ba.length),F.write_shift(2,0),Se+=F.length,X.push(F),Se+=ba.length,X.push(ba),Se+=Ea.length,X.push(Ea),F=Ie(46),F.write_shift(4,33639248),F.write_shift(2,0),F.write_shift(2,20),F.write_shift(2,Ee),F.write_shift(2,he),F.write_shift(4,0),F.write_shift(-4,lt[Ye]),F.write_shift(4,Ea.length),F.write_shift(4,Qe.content.length),F.write_shift(2,ba.length),F.write_shift(2,0),F.write_shift(2,0),F.write_shift(2,0),F.write_shift(2,0),F.write_shift(4,0),F.write_shift(4,ya),mt+=F.l,Q.push(F),mt+=ba.length,Q.push(ba),++Ye}return F=Ie(22),F.write_shift(4,101010256),F.write_shift(2,0),F.write_shift(2,0),F.write_shift(2,Ye),F.write_shift(2,Ye),F.write_shift(4,mt),F.write_shift(4,Se),F.write_shift(2,0),kr([kr(X),kr(Q),F])}var Ba={htm:"text/html",xml:"text/xml",gif:"image/gif",jpg:"image/jpeg",png:"image/png",mso:"application/x-mso",thmx:"application/vnd.ms-officetheme",sh33tj5:"application/octet-stream"};function Dr(I,ee){if(I.ctype)return I.ctype;var Y=I.name||"",X=Y.match(/\.([^\.]+)$/);return X&&Ba[X[1]]||ee&&(X=(Y=ee).match(/[\.\\]([^\.\\])+$/),X&&Ba[X[1]])?Ba[X[1]]:"application/octet-stream"}function cn(I){for(var ee=Xd(I),Y=[],X=0;X<ee.length;X+=76)Y.push(ee.slice(X,X+76));return Y.join(`\r
`)+`\r
`}function gs(I){var ee=I.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g,function(je){var Se=je.charCodeAt(0).toString(16).toUpperCase();return"="+(Se.length==1?"0"+Se:Se)});ee=ee.replace(/ $/mg,"=20").replace(/\t$/mg,"=09"),ee.charAt(0)==`
`&&(ee="=0D"+ee.slice(1)),ee=ee.replace(/\r(?!\n)/mg,"=0D").replace(/\n\n/mg,`
=0A`).replace(/([^\r\n])\n/mg,"$1=0A");for(var Y=[],X=ee.split(`\r
`),Q=0;Q<X.length;++Q){var F=X[Q];if(F.length==0){Y.push("");continue}for(var he=0;he<F.length;){var Ee=76,_e=F.slice(he,he+Ee);_e.charAt(Ee-1)=="="?Ee--:_e.charAt(Ee-2)=="="?Ee-=2:_e.charAt(Ee-3)=="="&&(Ee-=3),_e=F.slice(he,he+Ee),he+=Ee,he<F.length&&(_e+="="),Y.push(_e)}}return Y.join(`\r
`)}function ps(I){for(var ee=[],Y=0;Y<I.length;++Y){for(var X=I[Y];Y<=I.length&&X.charAt(X.length-1)=="=";)X=X.slice(0,X.length-1)+I[++Y];ee.push(X)}for(var Q=0;Q<ee.length;++Q)ee[Q]=ee[Q].replace(/[=][0-9A-Fa-f]{2}/g,function(F){return String.fromCharCode(parseInt(F.slice(1),16))});return cs(ee.join(`\r
`))}function Zn(I,ee,Y){for(var X="",Q="",F="",he,Ee=0;Ee<10;++Ee){var _e=ee[Ee];if(!_e||_e.match(/^\s*$/))break;var je=_e.match(/^(.*?):\s*([^\s].*)$/);if(je)switch(je[1].toLowerCase()){case"content-location":X=je[2].trim();break;case"content-type":F=je[2].trim();break;case"content-transfer-encoding":Q=je[2].trim();break}}switch(++Ee,Q.toLowerCase()){case"base64":he=cs(hi(ee.slice(Ee).join("")));break;case"quoted-printable":he=ps(ee.slice(Ee));break;default:throw new Error("Unsupported Content-Transfer-Encoding "+Q)}var Se=Cn(I,X.slice(Y.length),he,{unsafe:!0});F&&(Se.ctype=F)}function Rr(I,ee){if(ne(I.slice(0,13)).toLowerCase()!="mime-version:")throw new Error("Unsupported MAD header");var Y=ee&&ee.root||"",X=(la&&Buffer.isBuffer(I)?I.toString("binary"):ne(I)).split(`\r
`),Q=0,F="";for(Q=0;Q<X.length;++Q)if(F=X[Q],!!/^Content-Location:/i.test(F)&&(F=F.slice(F.indexOf("file")),Y||(Y=F.slice(0,F.lastIndexOf("/")+1)),F.slice(0,Y.length)!=Y))for(;Y.length>0&&(Y=Y.slice(0,Y.length-1),Y=Y.slice(0,Y.lastIndexOf("/")+1),F.slice(0,Y.length)!=Y););var he=(X[1]||"").match(/boundary="(.*?)"/);if(!he)throw new Error("MAD cannot find boundary");var Ee="--"+(he[1]||""),_e=[],je=[],Se={FileIndex:_e,FullPaths:je};B(Se);var Ye,et=0;for(Q=0;Q<X.length;++Q){var ot=X[Q];ot!==Ee&&ot!==Ee+"--"||(et++&&Zn(Se,X.slice(Ye,Q),Y),Ye=Q)}return Se}function qn(I,ee){var Y=ee||{},X=Y.boundary||"SheetJS";X="------="+X;for(var Q=["MIME-Version: 1.0",'Content-Type: multipart/related; boundary="'+X.slice(2)+'"',"","",""],F=I.FullPaths[0],he=F,Ee=I.FileIndex[0],_e=1;_e<I.FullPaths.length;++_e)if(he=I.FullPaths[_e].slice(F.length),Ee=I.FileIndex[_e],!(!Ee.size||!Ee.content||he=="Sh33tJ5")){he=he.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g,function(mt){return"_x"+mt.charCodeAt(0).toString(16)+"_"}).replace(/[\u0080-\uFFFF]/g,function(mt){return"_u"+mt.charCodeAt(0).toString(16)+"_"});for(var je=Ee.content,Se=la&&Buffer.isBuffer(je)?je.toString("binary"):ne(je),Ye=0,et=Math.min(1024,Se.length),ot=0,Qe=0;Qe<=et;++Qe)(ot=Se.charCodeAt(Qe))>=32&&ot<128&&++Ye;var lt=Ye>=et*4/5;Q.push(X),Q.push("Content-Location: "+(Y.root||"file:///C:/SheetJS/")+he),Q.push("Content-Transfer-Encoding: "+(lt?"quoted-printable":"base64")),Q.push("Content-Type: "+Dr(Ee,he)),Q.push(""),Q.push(lt?gs(Se):cn(Se))}return Q.push(X+`--\r
`),Q.join(`\r
`)}function dn(I){var ee={};return B(ee,I),ee}function Cn(I,ee,Y,X){var Q=X&&X.unsafe;Q||B(I);var F=!Q&&Na.find(I,ee);if(!F){var he=I.FullPaths[0];ee.slice(0,he.length)==he?he=ee:(he.slice(-1)!="/"&&(he+="/"),he=(he+ee).replace("//","/")),F={name:o(ee),type:2},I.FileIndex.push(F),I.FullPaths.push(he),Q||Na.utils.cfb_gc(I)}return F.content=Y,F.size=Y?Y.length:0,X&&(X.CLSID&&(F.clsid=X.CLSID),X.mt&&(F.mt=X.mt),X.ct&&(F.ct=X.ct)),F}function xs(I,ee){B(I);var Y=Na.find(I,ee);if(Y){for(var X=0;X<I.FileIndex.length;++X)if(I.FileIndex[X]==Y)return I.FileIndex.splice(X,1),I.FullPaths.splice(X,1),!0}return!1}function Za(I,ee,Y){B(I);var X=Na.find(I,ee);if(X){for(var Q=0;Q<I.FileIndex.length;++Q)if(I.FileIndex[Q]==X)return I.FileIndex[Q].name=o(Y),I.FullPaths[Q]=Y,!0}return!1}function be(I){se(I,!0)}return t.find=le,t.read=H,t.parse=x,t.write=ae,t.writeFile=J,t.utils={cfb_new:dn,cfb_add:Cn,cfb_del:xs,cfb_mov:Za,cfb_gc:be,ReadShift:Hd,CheckField:A2,prep_blob:kn,bconcat:kr,use_zlib:D,_deflateRaw:at,_inflateRaw:Gt,consts:V},t})();function A5(e){return typeof e=="string"?Hf(e):Array.isArray(e)?a5(e):e}function mu(e,t,a){if(typeof Deno!="undefined"){if(a&&typeof t=="string")switch(a){case"utf8":t=new TextEncoder(a).encode(t);break;case"binary":t=Hf(t);break;default:throw new Error("Unsupported encoding "+a)}return Deno.writeFileSync(e,t)}var s=a=="utf8"?Jd(t):t;if(typeof IE_SaveFile!="undefined")return IE_SaveFile(s,e);if(typeof Blob!="undefined"){var o=new Blob([A5(s)],{type:"application/octet-stream"});if(typeof navigator!="undefined"&&navigator.msSaveBlob)return navigator.msSaveBlob(o,e);if(typeof saveAs!="undefined")return saveAs(o,e);if(typeof URL!="undefined"&&typeof document!="undefined"&&document.createElement&&URL.createObjectURL){var u=URL.createObjectURL(o);if(typeof chrome=="object"&&typeof(chrome.downloads||{}).download=="function")return URL.revokeObjectURL&&typeof setTimeout!="undefined"&&setTimeout(function(){URL.revokeObjectURL(u)},6e4),chrome.downloads.download({url:u,filename:e,saveAs:!0});var c=document.createElement("a");if(c.download!=null)return c.download=e,c.href=u,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL&&typeof setTimeout!="undefined"&&setTimeout(function(){URL.revokeObjectURL(u)},6e4),u}}if(typeof $!="undefined"&&typeof File!="undefined"&&typeof Folder!="undefined")try{var f=File(e);return f.open("w"),f.encoding="binary",Array.isArray(t)&&(t=hu(t)),f.write(t),f.close(),t}catch(p){if(!p.message||!p.message.match(/onstruct/))throw p}throw new Error("cannot save file "+e)}function jr(e){for(var t=Object.keys(e),a=[],s=0;s<t.length;++s)Object.prototype.hasOwnProperty.call(e,t[s])&&a.push(t[s]);return a}function tv(e,t){for(var a=[],s=jr(e),o=0;o!==s.length;++o)a[e[s[o]][t]]==null&&(a[e[s[o]][t]]=s[o]);return a}function dp(e){for(var t=[],a=jr(e),s=0;s!==a.length;++s)t[e[a[s]]]=a[s];return t}function Vf(e){for(var t=[],a=jr(e),s=0;s!==a.length;++s)t[e[a[s]]]=parseInt(a[s],10);return t}function O5(e){for(var t=[],a=jr(e),s=0;s!==a.length;++s)t[e[a[s]]]==null&&(t[e[a[s]]]=[]),t[e[a[s]]].push(a[s]);return t}var _f=new Date(1899,11,30,0,0,0);function sn(e,t){var a=e.getTime(),s=_f.getTime()+(e.getTimezoneOffset()-_f.getTimezoneOffset())*6e4;return(a-s)/(1440*60*1e3)}var h2=new Date,L5=_f.getTime()+(h2.getTimezoneOffset()-_f.getTimezoneOffset())*6e4,av=h2.getTimezoneOffset();function m2(e){var t=new Date;return t.setTime(e*24*60*60*1e3+L5),t.getTimezoneOffset()!==av&&t.setTime(t.getTime()+(t.getTimezoneOffset()-av)*6e4),t}var rv=new Date("2017-02-19T19:06:09.000Z"),g2=isNaN(rv.getFullYear())?new Date("2/19/17"):rv,M5=g2.getFullYear()==2017;function $r(e,t){var a=new Date(e);if(M5)return t>0?a.setTime(a.getTime()+a.getTimezoneOffset()*60*1e3):t<0&&a.setTime(a.getTime()-a.getTimezoneOffset()*60*1e3),a;if(e instanceof Date)return e;if(g2.getFullYear()==1917&&!isNaN(a.getFullYear())){var s=a.getFullYear();return e.indexOf(""+s)>-1||a.setFullYear(a.getFullYear()+100),a}var o=e.match(/\d+/g)||["2017","2","19","0","0","0"],u=new Date(+o[0],+o[1]-1,+o[2],+o[3]||0,+o[4]||0,+o[5]||0);return e.indexOf("Z")>-1&&(u=new Date(u.getTime()-u.getTimezoneOffset()*60*1e3)),u}function Gf(e,t){if(la&&Buffer.isBuffer(e))return e.toString("binary");if(typeof TextDecoder!="undefined")try{var a={"€":"€","":"‚",ƒ:"ƒ","„":"„","…":"…","†":"†","‡":"‡","ˆ":"ˆ","‰":"‰",Š:"Š","":"‹",Œ:"Œ",Ž:"Ž","":"‘","":"’","“":"“","”":"”","•":"•","":"–","—":"—","˜":"˜","™":"™",š:"š","":"›",œ:"œ",ž:"ž",Ÿ:"Ÿ"};return Array.isArray(e)&&(e=new Uint8Array(e)),new TextDecoder("latin1").decode(e).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g,function(u){return a[u]||u})}catch(u){}for(var s=[],o=0;o!=e.length;++o)s.push(String.fromCharCode(e[o]));return s.join("")}function on(e){if(typeof JSON!="undefined"&&!Array.isArray(e))return JSON.parse(JSON.stringify(e));if(typeof e!="object"||e==null)return e;if(e instanceof Date)return new Date(e.getTime());var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=on(e[a]));return t}function Va(e,t){for(var a="";a.length<t;)a+=e;return a}function oi(e){var t=Number(e);if(!isNaN(t))return isFinite(t)?t:NaN;if(!/\d/.test(e))return t;var a=1,s=e.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){return a*=100,""});return!isNaN(t=Number(s))||(s=s.replace(/[(](.*)[)]/,function(o,u){return a=-a,u}),!isNaN(t=Number(s)))?t/a:t}var D5=["january","february","march","april","may","june","july","august","september","october","november","december"];function Kd(e){var t=new Date(e),a=new Date(NaN),s=t.getYear(),o=t.getMonth(),u=t.getDate();if(isNaN(u))return a;var c=e.toLowerCase();if(c.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)){if(c=c.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,""),c.length>3&&D5.indexOf(c)==-1)return a}else if(c.match(/[a-z]/))return a;return s<0||s>8099?a:(o>0||u>1)&&s!=101?t:e.match(/[^-0-9:,\/\\]/)?a:t}function Wt(e,t,a){if(e.FullPaths){if(typeof a=="string"){var s;return la?s=pi(a):s=r5(a),Na.utils.cfb_add(e,t,s)}Na.utils.cfb_add(e,t,a)}else e.file(t,a)}function up(){return Na.utils.cfb_new()}var nr=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
`,R5={"&quot;":'"',"&apos;":"'","&gt;":">","&lt;":"<","&amp;":"&"},fp=dp(R5),hp=/[&<>'"]/g,P5=/[\u0000-\u0008\u000b-\u001f]/g;function pa(e){var t=e+"";return t.replace(hp,function(a){return fp[a]}).replace(P5,function(a){return"_x"+("000"+a.charCodeAt(0).toString(16)).slice(-4)+"_"})}function nv(e){return pa(e).replace(/ /g,"_x0020_")}var p2=/[\u0000-\u001f]/g;function F5(e){var t=e+"";return t.replace(hp,function(a){return fp[a]}).replace(/\n/g,"<br/>").replace(p2,function(a){return"&#x"+("000"+a.charCodeAt(0).toString(16)).slice(-4)+";"})}function I5(e){var t=e+"";return t.replace(hp,function(a){return fp[a]}).replace(p2,function(a){return"&#x"+a.charCodeAt(0).toString(16).toUpperCase()+";"})}function B5(e){return e.replace(/(\r\n|[\r\n])/g,"&#10;")}function z5(e){switch(e){case 1:case!0:case"1":case"true":case"TRUE":return!0;default:return!1}}function mg(e){for(var t="",a=0,s=0,o=0,u=0,c=0,f=0;a<e.length;){if(s=e.charCodeAt(a++),s<128){t+=String.fromCharCode(s);continue}if(o=e.charCodeAt(a++),s>191&&s<224){c=(s&31)<<6,c|=o&63,t+=String.fromCharCode(c);continue}if(u=e.charCodeAt(a++),s<240){t+=String.fromCharCode((s&15)<<12|(o&63)<<6|u&63);continue}c=e.charCodeAt(a++),f=((s&7)<<18|(o&63)<<12|(u&63)<<6|c&63)-65536,t+=String.fromCharCode(55296+(f>>>10&1023)),t+=String.fromCharCode(56320+(f&1023))}return t}function sv(e){var t=Qo(2*e.length),a,s,o=1,u=0,c=0,f;for(s=0;s<e.length;s+=o)o=1,(f=e.charCodeAt(s))<128?a=f:f<224?(a=(f&31)*64+(e.charCodeAt(s+1)&63),o=2):f<240?(a=(f&15)*4096+(e.charCodeAt(s+1)&63)*64+(e.charCodeAt(s+2)&63),o=3):(o=4,a=(f&7)*262144+(e.charCodeAt(s+1)&63)*4096+(e.charCodeAt(s+2)&63)*64+(e.charCodeAt(s+3)&63),a-=65536,c=55296+(a>>>10&1023),a=56320+(a&1023)),c!==0&&(t[u++]=c&255,t[u++]=c>>>8,c=0),t[u++]=a%256,t[u++]=a>>>8;return t.slice(0,u).toString("ucs2")}function iv(e){return pi(e,"binary").toString("utf8")}var Z0="foo bar baz☃🍣",Ud=la&&(iv(Z0)==mg(Z0)&&iv||sv(Z0)==mg(Z0)&&sv)||mg,Jd=la?function(e){return pi(e,"utf8").toString("binary")}:function(e){for(var t=[],a=0,s=0,o=0;a<e.length;)switch(s=e.charCodeAt(a++),!0){case s<128:t.push(String.fromCharCode(s));break;case s<2048:t.push(String.fromCharCode(192+(s>>6))),t.push(String.fromCharCode(128+(s&63)));break;case(s>=55296&&s<57344):s-=55296,o=e.charCodeAt(a++)-56320+(s<<10),t.push(String.fromCharCode(240+(o>>18&7))),t.push(String.fromCharCode(144+(o>>12&63))),t.push(String.fromCharCode(128+(o>>6&63))),t.push(String.fromCharCode(128+(o&63)));break;default:t.push(String.fromCharCode(224+(s>>12))),t.push(String.fromCharCode(128+(s>>6&63))),t.push(String.fromCharCode(128+(s&63)))}return t.join("")},U5=(function(){var e=[["nbsp"," "],["middot","·"],["quot",'"'],["apos","'"],["gt",">"],["lt","<"],["amp","&"]].map(function(t){return[new RegExp("&"+t[0]+";","ig"),t[1]]});return function(a){for(var s=a.replace(/^[\t\n\r ]+/,"").replace(/[\t\n\r ]+$/,"").replace(/>\s+/g,">").replace(/\s+</g,"<").replace(/[\t\n\r ]+/g," ").replace(/<\s*[bB][rR]\s*\/?>/g,`
`).replace(/<[^>]*>/g,""),o=0;o<e.length;++o)s=s.replace(e[o][0],e[o][1]);return s}})(),x2=/(^\s|\s$|\n)/;function Nr(e,t){return"<"+e+(t.match(x2)?' xml:space="preserve"':"")+">"+t+"</"+e+">"}function Qd(e){return jr(e).map(function(t){return" "+t+'="'+e[t]+'"'}).join("")}function rt(e,t,a){return"<"+e+(a!=null?Qd(a):"")+(t!=null?(t.match(x2)?' xml:space="preserve"':"")+">"+t+"</"+e:"/")+">"}function Ig(e,t){try{return e.toISOString().replace(/\.\d*/,"")}catch(a){if(t)throw a}return""}function H5(e,t){switch(typeof e){case"string":var a=rt("vt:lpwstr",pa(e));return a=a.replace(/&quot;/g,"_x0022_"),a;case"number":return rt((e|0)==e?"vt:i4":"vt:r8",pa(String(e)));case"boolean":return rt("vt:bool",e?"true":"false")}if(e instanceof Date)return rt("vt:filetime",Ig(e));throw new Error("Unable to serialize "+e)}var fr={CORE_PROPS:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",CUST_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",EXT_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",CT:"http://schemas.openxmlformats.org/package/2006/content-types",RELS:"http://schemas.openxmlformats.org/package/2006/relationships",TCMNT:"http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",xsi:"http://www.w3.org/2001/XMLSchema-instance",xsd:"http://www.w3.org/2001/XMLSchema"},Tc=["http://schemas.openxmlformats.org/spreadsheetml/2006/main","http://purl.oclc.org/ooxml/spreadsheetml/main","http://schemas.microsoft.com/office/excel/2006/main","http://schemas.microsoft.com/office/excel/2006/2"],Nn={o:"urn:schemas-microsoft-com:office:office",x:"urn:schemas-microsoft-com:office:excel",ss:"urn:schemas-microsoft-com:office:spreadsheet",dt:"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882",mv:"http://macVmlSchemaUri",v:"urn:schemas-microsoft-com:vml",html:"http://www.w3.org/TR/REC-html40"};function $5(e,t){for(var a=1-2*(e[t+7]>>>7),s=((e[t+7]&127)<<4)+(e[t+6]>>>4&15),o=e[t+6]&15,u=5;u>=0;--u)o=o*256+e[t+u];return s==2047?o==0?a*(1/0):NaN:(s==0?s=-1022:(s-=1023,o+=Math.pow(2,52)),a*Math.pow(2,s-52)*o)}function W5(e,t,a){var s=(t<0||1/t==-1/0?1:0)<<7,o=0,u=0,c=s?-t:t;isFinite(c)?c==0?o=u=0:(o=Math.floor(Math.log(c)/Math.LN2),u=c*Math.pow(2,52-o),o<=-1023&&(!isFinite(u)||u<Math.pow(2,52))?o=-1022:(u-=Math.pow(2,52),o+=1023)):(o=2047,u=isNaN(t)?26985:0);for(var f=0;f<=5;++f,u/=256)e[a+f]=u&255;e[a+6]=(o&15)<<4|u&15,e[a+7]=o>>4|s}var ov=function(e){for(var t=[],a=10240,s=0;s<e[0].length;++s)if(e[0][s])for(var o=0,u=e[0][s].length;o<u;o+=a)t.push.apply(t,e[0][s].slice(o,o+a));return t},lv=la?function(e){return e[0].length>0&&Buffer.isBuffer(e[0][0])?Buffer.concat(e[0].map(function(t){return Buffer.isBuffer(t)?t:pi(t)})):ov(e)}:ov,cv=function(e,t,a){for(var s=[],o=t;o<a;o+=2)s.push(String.fromCharCode(Pd(e,o)));return s.join("").replace(zd,"")},mp=la?function(e,t,a){return Buffer.isBuffer(e)?e.toString("utf16le",t,a).replace(zd,""):cv(e,t,a)}:cv,dv=function(e,t,a){for(var s=[],o=t;o<t+a;++o)s.push(("0"+e[o].toString(16)).slice(-2));return s.join("")},y2=la?function(e,t,a){return Buffer.isBuffer(e)?e.toString("hex",t,t+a):dv(e,t,a)}:dv,uv=function(e,t,a){for(var s=[],o=t;o<a;o++)s.push(String.fromCharCode(rc(e,o)));return s.join("")},gu=la?function(t,a,s){return Buffer.isBuffer(t)?t.toString("utf8",a,s):uv(t,a,s)}:uv,b2=function(e,t){var a=Sn(e,t);return a>0?gu(e,t+4,t+4+a-1):""},v2=b2,_2=function(e,t){var a=Sn(e,t);return a>0?gu(e,t+4,t+4+a-1):""},w2=_2,k2=function(e,t){var a=2*Sn(e,t);return a>0?gu(e,t+4,t+4+a-1):""},N2=k2,S2=function(t,a){var s=Sn(t,a);return s>0?mp(t,a+4,a+4+s):""},j2=S2,T2=function(e,t){var a=Sn(e,t);return a>0?gu(e,t+4,t+4+a):""},E2=T2,C2=function(e,t){return $5(e,t)},wf=C2,gp=function(t){return Array.isArray(t)||typeof Uint8Array!="undefined"&&t instanceof Uint8Array};la&&(v2=function(t,a){if(!Buffer.isBuffer(t))return b2(t,a);var s=t.readUInt32LE(a);return s>0?t.toString("utf8",a+4,a+4+s-1):""},w2=function(t,a){if(!Buffer.isBuffer(t))return _2(t,a);var s=t.readUInt32LE(a);return s>0?t.toString("utf8",a+4,a+4+s-1):""},N2=function(t,a){if(!Buffer.isBuffer(t))return k2(t,a);var s=2*t.readUInt32LE(a);return t.toString("utf16le",a+4,a+4+s-1)},j2=function(t,a){if(!Buffer.isBuffer(t))return S2(t,a);var s=t.readUInt32LE(a);return t.toString("utf16le",a+4,a+4+s)},E2=function(t,a){if(!Buffer.isBuffer(t))return T2(t,a);var s=t.readUInt32LE(a);return t.toString("utf8",a+4,a+4+s)},wf=function(t,a){return Buffer.isBuffer(t)?t.readDoubleLE(a):C2(t,a)},gp=function(t){return Buffer.isBuffer(t)||Array.isArray(t)||typeof Uint8Array!="undefined"&&t instanceof Uint8Array});var rc=function(e,t){return e[t]},Pd=function(e,t){return e[t+1]*256+e[t]},V5=function(e,t){var a=e[t+1]*256+e[t];return a<32768?a:(65535-a+1)*-1},Sn=function(e,t){return e[t+3]*(1<<24)+(e[t+2]<<16)+(e[t+1]<<8)+e[t]},$o=function(e,t){return e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]},G5=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};function Hd(e,t){var a="",s,o,u=[],c,f,p,g;switch(t){case"dbcs":if(g=this.l,la&&Buffer.isBuffer(this))a=this.slice(this.l,this.l+2*e).toString("utf16le");else for(p=0;p<e;++p)a+=String.fromCharCode(Pd(this,g)),g+=2;e*=2;break;case"utf8":a=gu(this,this.l,this.l+e);break;case"utf16le":e*=2,a=mp(this,this.l,this.l+e);break;case"wstr":return Hd.call(this,e,"dbcs");case"lpstr-ansi":a=v2(this,this.l),e=4+Sn(this,this.l);break;case"lpstr-cp":a=w2(this,this.l),e=4+Sn(this,this.l);break;case"lpwstr":a=N2(this,this.l),e=4+2*Sn(this,this.l);break;case"lpp4":e=4+Sn(this,this.l),a=j2(this,this.l),e&2&&(e+=2);break;case"8lpp4":e=4+Sn(this,this.l),a=E2(this,this.l),e&3&&(e+=4-(e&3));break;case"cstr":for(e=0,a="";(c=rc(this,this.l+e++))!==0;)u.push(W0(c));a=u.join("");break;case"_wstr":for(e=0,a="";(c=Pd(this,this.l+e))!==0;)u.push(W0(c)),e+=2;e+=2,a=u.join("");break;case"dbcs-cont":for(a="",g=this.l,p=0;p<e;++p){if(this.lens&&this.lens.indexOf(g)!==-1)return c=rc(this,g),this.l=g+1,f=Hd.call(this,e-p,c?"dbcs-cont":"sbcs-cont"),u.join("")+f;u.push(W0(Pd(this,g))),g+=2}a=u.join(""),e*=2;break;case"cpstr":case"sbcs-cont":for(a="",g=this.l,p=0;p!=e;++p){if(this.lens&&this.lens.indexOf(g)!==-1)return c=rc(this,g),this.l=g+1,f=Hd.call(this,e-p,c?"dbcs-cont":"sbcs-cont"),u.join("")+f;u.push(W0(rc(this,g))),g+=1}a=u.join("");break;default:switch(e){case 1:return s=rc(this,this.l),this.l++,s;case 2:return s=(t==="i"?V5:Pd)(this,this.l),this.l+=2,s;case 4:case-4:return t==="i"||(this[this.l+3]&128)===0?(s=(e>0?$o:G5)(this,this.l),this.l+=4,s):(o=Sn(this,this.l),this.l+=4,o);case 8:case-8:if(t==="f")return e==8?o=wf(this,this.l):o=wf([this[this.l+7],this[this.l+6],this[this.l+5],this[this.l+4],this[this.l+3],this[this.l+2],this[this.l+1],this[this.l+0]],0),this.l+=8,o;e=8;case 16:a=y2(this,this.l,e);break}}return this.l+=e,a}var Z5=function(e,t,a){e[a]=t&255,e[a+1]=t>>>8&255,e[a+2]=t>>>16&255,e[a+3]=t>>>24&255},q5=function(e,t,a){e[a]=t&255,e[a+1]=t>>8&255,e[a+2]=t>>16&255,e[a+3]=t>>24&255},Y5=function(e,t,a){e[a]=t&255,e[a+1]=t>>>8&255};function X5(e,t,a){var s=0,o=0;if(a==="dbcs"){for(o=0;o!=t.length;++o)Y5(this,t.charCodeAt(o),this.l+2*o);s=2*t.length}else if(a==="sbcs"){for(t=t.replace(/[^\x00-\x7F]/g,"_"),o=0;o!=t.length;++o)this[this.l+o]=t.charCodeAt(o)&255;s=t.length}else if(a==="hex"){for(;o<e;++o)this[this.l++]=parseInt(t.slice(2*o,2*o+2),16)||0;return this}else if(a==="utf16le"){var u=Math.min(this.l+e,this.length);for(o=0;o<Math.min(t.length,e);++o){var c=t.charCodeAt(o);this[this.l++]=c&255,this[this.l++]=c>>8}for(;this.l<u;)this[this.l++]=0;return this}else switch(e){case 1:s=1,this[this.l]=t&255;break;case 2:s=2,this[this.l]=t&255,t>>>=8,this[this.l+1]=t&255;break;case 3:s=3,this[this.l]=t&255,t>>>=8,this[this.l+1]=t&255,t>>>=8,this[this.l+2]=t&255;break;case 4:s=4,Z5(this,t,this.l);break;case 8:if(s=8,a==="f"){W5(this,t,this.l);break}case 16:break;case-4:s=4,q5(this,t,this.l);break}return this.l+=s,this}function A2(e,t){var a=y2(this,this.l,e.length>>1);if(a!==e)throw new Error(t+"Expected "+e+" saw "+a);this.l+=e.length>>1}function kn(e,t){e.l=t,e.read_shift=Hd,e.chk=A2,e.write_shift=X5}function Fs(e,t){e.l+=t}function Ie(e){var t=Qo(e);return kn(t,0),t}function nn(){var e=[],t=la?256:2048,a=function(g){var x=Ie(g);return kn(x,0),x},s=a(t),o=function(){s&&(s.length>s.l&&(s=s.slice(0,s.l),s.l=s.length),s.length>0&&e.push(s),s=null)},u=function(g){return s&&g<s.length-s.l?s:(o(),s=a(Math.max(g+1,t)))},c=function(){return o(),kr(e)},f=function(g){o(),s=g,s.l==null&&(s.l=s.length),u(t)};return{next:u,push:f,end:c,_bufs:e}}function Xe(e,t,a,s){var o=+t,u;if(!isNaN(o)){s||(s=$A[o].p||(a||[]).length||0),u=1+(o>=128?1:0)+1,s>=128&&++u,s>=16384&&++u,s>=2097152&&++u;var c=e.next(u);o<=127?c.write_shift(1,o):(c.write_shift(1,(o&127)+128),c.write_shift(1,o>>7));for(var f=0;f!=4;++f)if(s>=128)c.write_shift(1,(s&127)+128),s>>=7;else{c.write_shift(1,s);break}s>0&&gp(a)&&e.push(a)}}function $d(e,t,a){var s=on(e);if(t.s?(s.cRel&&(s.c+=t.s.c),s.rRel&&(s.r+=t.s.r)):(s.cRel&&(s.c+=t.c),s.rRel&&(s.r+=t.r)),!a||a.biff<12){for(;s.c>=256;)s.c-=256;for(;s.r>=65536;)s.r-=65536}return s}function fv(e,t,a){var s=on(e);return s.s=$d(s.s,t.s,a),s.e=$d(s.e,t.s,a),s}function Wd(e,t){if(e.cRel&&e.c<0)for(e=on(e);e.c<0;)e.c+=t>8?16384:256;if(e.rRel&&e.r<0)for(e=on(e);e.r<0;)e.r+=t>8?1048576:t>5?65536:16384;var a=xa(e);return!e.cRel&&e.cRel!=null&&(a=Q5(a)),!e.rRel&&e.rRel!=null&&(a=K5(a)),a}function gg(e,t){return e.s.r==0&&!e.s.rRel&&e.e.r==(t.biff>=12?1048575:t.biff>=8?65536:16384)&&!e.e.rRel?(e.s.cRel?"":"$")+Lr(e.s.c)+":"+(e.e.cRel?"":"$")+Lr(e.e.c):e.s.c==0&&!e.s.cRel&&e.e.c==(t.biff>=12?16383:255)&&!e.e.cRel?(e.s.rRel?"":"$")+Sr(e.s.r)+":"+(e.e.rRel?"":"$")+Sr(e.e.r):Wd(e.s,t.biff)+":"+Wd(e.e,t.biff)}function pp(e){return parseInt(J5(e),10)-1}function Sr(e){return""+(e+1)}function K5(e){return e.replace(/([A-Z]|^)(\d+)$/,"$1$$$2")}function J5(e){return e.replace(/\$(\d+)$/,"$1")}function xp(e){for(var t=eT(e),a=0,s=0;s!==t.length;++s)a=26*a+t.charCodeAt(s)-64;return a-1}function Lr(e){if(e<0)throw new Error("invalid column "+e);var t="";for(++e;e;e=Math.floor((e-1)/26))t=String.fromCharCode((e-1)%26+65)+t;return t}function Q5(e){return e.replace(/^([A-Z])/,"$$$1")}function eT(e){return e.replace(/^\$([A-Z])/,"$1")}function tT(e){return e.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")}function hr(e){for(var t=0,a=0,s=0;s<e.length;++s){var o=e.charCodeAt(s);o>=48&&o<=57?t=10*t+(o-48):o>=65&&o<=90&&(a=26*a+(o-64))}return{c:a-1,r:t-1}}function xa(e){for(var t=e.c+1,a="";t;t=(t-1)/26|0)a=String.fromCharCode((t-1)%26+65)+a;return a+(e.r+1)}function En(e){var t=e.indexOf(":");return t==-1?{s:hr(e),e:hr(e)}:{s:hr(e.slice(0,t)),e:hr(e.slice(t+1))}}function rr(e,t){return typeof t=="undefined"||typeof t=="number"?rr(e.s,e.e):(typeof e!="string"&&(e=xa(e)),typeof t!="string"&&(t=xa(t)),e==t?e:e+":"+t)}function Ma(e){var t={s:{c:0,r:0},e:{c:0,r:0}},a=0,s=0,o=0,u=e.length;for(a=0;s<u&&!((o=e.charCodeAt(s)-64)<1||o>26);++s)a=26*a+o;for(t.s.c=--a,a=0;s<u&&!((o=e.charCodeAt(s)-48)<0||o>9);++s)a=10*a+o;if(t.s.r=--a,s===u||o!=10)return t.e.c=t.s.c,t.e.r=t.s.r,t;for(++s,a=0;s!=u&&!((o=e.charCodeAt(s)-64)<1||o>26);++s)a=26*a+o;for(t.e.c=--a,a=0;s!=u&&!((o=e.charCodeAt(s)-48)<0||o>9);++s)a=10*a+o;return t.e.r=--a,t}function hv(e,t){var a=e.t=="d"&&t instanceof Date;if(e.z!=null)try{return e.w=to(e.z,a?sn(t):t)}catch(s){}try{return e.w=to((e.XF||{}).numFmtId||(a?14:0),a?sn(t):t)}catch(s){return""+t}}function mi(e,t,a){return e==null||e.t==null||e.t=="z"?"":e.w!==void 0?e.w:(e.t=="d"&&!e.z&&a&&a.dateNF&&(e.z=a.dateNF),e.t=="e"?pu[e.v]||e.v:t==null?hv(e,e.v):hv(e,t))}function nl(e,t){var a=t&&t.sheet?t.sheet:"Sheet1",s={};return s[a]=e,{SheetNames:[a],Sheets:s}}function O2(e,t,a){var s=a||{},o=e?Array.isArray(e):s.dense,u=e||(o?[]:{}),c=0,f=0;if(u&&s.origin!=null){if(typeof s.origin=="number")c=s.origin;else{var p=typeof s.origin=="string"?hr(s.origin):s.origin;c=p.r,f=p.c}u["!ref"]||(u["!ref"]="A1:A1")}var g={s:{c:1e7,r:1e7},e:{c:0,r:0}};if(u["!ref"]){var x=Ma(u["!ref"]);g.s.c=x.s.c,g.s.r=x.s.r,g.e.c=Math.max(g.e.c,x.e.c),g.e.r=Math.max(g.e.r,x.e.r),c==-1&&(g.e.r=c=x.e.r+1)}for(var v=0;v!=t.length;++v)if(t[v]){if(!Array.isArray(t[v]))throw new Error("aoa_to_sheet expects an array of arrays");for(var _=0;_!=t[v].length;++_)if(typeof t[v][_]!="undefined"){var k={v:t[v][_]},T=c+v,N=f+_;if(g.s.r>T&&(g.s.r=T),g.s.c>N&&(g.s.c=N),g.e.r<T&&(g.e.r=T),g.e.c<N&&(g.e.c=N),t[v][_]&&typeof t[v][_]=="object"&&!Array.isArray(t[v][_])&&!(t[v][_]instanceof Date))k=t[v][_];else if(Array.isArray(k.v)&&(k.f=t[v][_][1],k.v=k.v[0]),k.v===null)if(k.f)k.t="n";else if(s.nullError)k.t="e",k.v=0;else if(s.sheetStubs)k.t="z";else continue;else typeof k.v=="number"?k.t="n":typeof k.v=="boolean"?k.t="b":k.v instanceof Date?(k.z=s.dateNF||Ga[14],s.cellDates?(k.t="d",k.w=to(k.z,sn(k.v))):(k.t="n",k.v=sn(k.v),k.w=to(k.z,k.v))):k.t="s";if(o)u[T]||(u[T]=[]),u[T][N]&&u[T][N].z&&(k.z=u[T][N].z),u[T][N]=k;else{var j=xa({c:N,r:T});u[j]&&u[j].z&&(k.z=u[j].z),u[j]=k}}}return g.s.c<1e7&&(u["!ref"]=rr(g)),u}function Ec(e,t){return O2(null,e,t)}function aT(e){return e.read_shift(4,"i")}function fs(e,t){return t||(t=Ie(4)),t.write_shift(4,e),t}function Mr(e){var t=e.read_shift(4);return t===0?"":e.read_shift(t,"dbcs")}function mr(e,t){var a=!1;return t==null&&(a=!0,t=Ie(4+2*e.length)),t.write_shift(4,e.length),e.length>0&&t.write_shift(0,e,"dbcs"),a?t.slice(0,t.l):t}function rT(e){return{ich:e.read_shift(2),ifnt:e.read_shift(2)}}function nT(e,t){return t||(t=Ie(4)),t.write_shift(2,0),t.write_shift(2,0),t}function yp(e,t){var a=e.l,s=e.read_shift(1),o=Mr(e),u=[],c={t:o,h:o};if((s&1)!==0){for(var f=e.read_shift(4),p=0;p!=f;++p)u.push(rT(e));c.r=u}else c.r=[{ich:0,ifnt:0}];return e.l=a+t,c}function sT(e,t){var a=!1;return t==null&&(a=!0,t=Ie(15+4*e.t.length)),t.write_shift(1,0),mr(e.t,t),a?t.slice(0,t.l):t}var iT=yp;function oT(e,t){var a=!1;return t==null&&(a=!0,t=Ie(23+4*e.t.length)),t.write_shift(1,1),mr(e.t,t),t.write_shift(4,1),nT({},t),a?t.slice(0,t.l):t}function Gn(e){var t=e.read_shift(4),a=e.read_shift(2);return a+=e.read_shift(1)<<16,e.l++,{c:t,iStyleRef:a}}function sl(e,t){return t==null&&(t=Ie(8)),t.write_shift(-4,e.c),t.write_shift(3,e.iStyleRef||e.s),t.write_shift(1,0),t}function il(e){var t=e.read_shift(2);return t+=e.read_shift(1)<<16,e.l++,{c:-1,iStyleRef:t}}function ol(e,t){return t==null&&(t=Ie(4)),t.write_shift(3,e.iStyleRef||e.s),t.write_shift(1,0),t}var lT=Mr,L2=mr;function bp(e){var t=e.read_shift(4);return t===0||t===4294967295?"":e.read_shift(t,"dbcs")}function kf(e,t){var a=!1;return t==null&&(a=!0,t=Ie(127)),t.write_shift(4,e.length>0?e.length:4294967295),e.length>0&&t.write_shift(0,e,"dbcs"),a?t.slice(0,t.l):t}var cT=Mr,Bg=bp,vp=kf;function M2(e){var t=e.slice(e.l,e.l+4),a=t[0]&1,s=t[0]&2;e.l+=4;var o=s===0?wf([0,0,0,0,t[0]&252,t[1],t[2],t[3]],0):$o(t,0)>>2;return a?o/100:o}function D2(e,t){t==null&&(t=Ie(4));var a=0,s=0,o=e*100;if(e==(e|0)&&e>=-536870912&&e<1<<29?s=1:o==(o|0)&&o>=-536870912&&o<1<<29&&(s=1,a=1),s)t.write_shift(-4,((a?o:e)<<2)+(a+2));else throw new Error("unsupported RkNumber "+e)}function R2(e){var t={s:{},e:{}};return t.s.r=e.read_shift(4),t.e.r=e.read_shift(4),t.s.c=e.read_shift(4),t.e.c=e.read_shift(4),t}function dT(e,t){return t||(t=Ie(16)),t.write_shift(4,e.s.r),t.write_shift(4,e.e.r),t.write_shift(4,e.s.c),t.write_shift(4,e.e.c),t}var ll=R2,Cc=dT;function Ac(e){if(e.length-e.l<8)throw"XLS Xnum Buffer underflow";return e.read_shift(8,"f")}function el(e,t){return(t||Ie(8)).write_shift(8,e,"f")}function uT(e){var t={},a=e.read_shift(1),s=a>>>1,o=e.read_shift(1),u=e.read_shift(2,"i"),c=e.read_shift(1),f=e.read_shift(1),p=e.read_shift(1);switch(e.l++,s){case 0:t.auto=1;break;case 1:t.index=o;var g=vT[o];g&&(t.rgb=Nv(g));break;case 2:t.rgb=Nv([c,f,p]);break;case 3:t.theme=o;break}return u!=0&&(t.tint=u>0?u/32767:u/32768),t}function Nf(e,t){if(t||(t=Ie(8)),!e||e.auto)return t.write_shift(4,0),t.write_shift(4,0),t;e.index!=null?(t.write_shift(1,2),t.write_shift(1,e.index)):e.theme!=null?(t.write_shift(1,6),t.write_shift(1,e.theme)):(t.write_shift(1,5),t.write_shift(1,0));var a=e.tint||0;if(a>0?a*=32767:a<0&&(a*=32768),t.write_shift(2,a),!e.rgb||e.theme!=null)t.write_shift(2,0),t.write_shift(1,0),t.write_shift(1,0);else{var s=e.rgb||"FFFFFF";typeof s=="number"&&(s=("000000"+s.toString(16)).slice(-6)),t.write_shift(1,parseInt(s.slice(0,2),16)),t.write_shift(1,parseInt(s.slice(2,4),16)),t.write_shift(1,parseInt(s.slice(4,6),16)),t.write_shift(1,255)}return t}function fT(e){var t=e.read_shift(1);e.l++;var a={fBold:t&1,fItalic:t&2,fUnderline:t&4,fStrikeout:t&8,fOutline:t&16,fShadow:t&32,fCondense:t&64,fExtend:t&128};return a}function hT(e,t){t||(t=Ie(2));var a=(e.italic?2:0)|(e.strike?8:0)|(e.outline?16:0)|(e.shadow?32:0)|(e.condense?64:0)|(e.extend?128:0);return t.write_shift(1,a),t.write_shift(1,0),t}var P2=2,wn=3,q0=11,Sf=19,Y0=64,mT=65,gT=71,pT=4108,xT=4126,wr=80,mv={1:{n:"CodePage",t:P2},2:{n:"Category",t:wr},3:{n:"PresentationFormat",t:wr},4:{n:"ByteCount",t:wn},5:{n:"LineCount",t:wn},6:{n:"ParagraphCount",t:wn},7:{n:"SlideCount",t:wn},8:{n:"NoteCount",t:wn},9:{n:"HiddenCount",t:wn},10:{n:"MultimediaClipCount",t:wn},11:{n:"ScaleCrop",t:q0},12:{n:"HeadingPairs",t:pT},13:{n:"TitlesOfParts",t:xT},14:{n:"Manager",t:wr},15:{n:"Company",t:wr},16:{n:"LinksUpToDate",t:q0},17:{n:"CharacterCount",t:wn},19:{n:"SharedDoc",t:q0},22:{n:"HyperlinksChanged",t:q0},23:{n:"AppVersion",t:wn,p:"version"},24:{n:"DigSig",t:mT},26:{n:"ContentType",t:wr},27:{n:"ContentStatus",t:wr},28:{n:"Language",t:wr},29:{n:"Version",t:wr},255:{},2147483648:{n:"Locale",t:Sf},2147483651:{n:"Behavior",t:Sf},1919054434:{}},gv={1:{n:"CodePage",t:P2},2:{n:"Title",t:wr},3:{n:"Subject",t:wr},4:{n:"Author",t:wr},5:{n:"Keywords",t:wr},6:{n:"Comments",t:wr},7:{n:"Template",t:wr},8:{n:"LastAuthor",t:wr},9:{n:"RevNumber",t:wr},10:{n:"EditTime",t:Y0},11:{n:"LastPrinted",t:Y0},12:{n:"CreatedDate",t:Y0},13:{n:"ModifiedDate",t:Y0},14:{n:"PageCount",t:wn},15:{n:"WordCount",t:wn},16:{n:"CharCount",t:wn},17:{n:"Thumbnail",t:gT},18:{n:"Application",t:wr},19:{n:"DocSecurity",t:wn},255:{},2147483648:{n:"Locale",t:Sf},2147483651:{n:"Behavior",t:Sf},1919054434:{}};function yT(e){return e.map(function(t){return[t>>16&255,t>>8&255,t&255]})}var bT=yT([0,16777215,16711680,65280,255,16776960,16711935,65535,0,16777215,16711680,65280,255,16776960,16711935,65535,8388608,32768,128,8421376,8388736,32896,12632256,8421504,10066431,10040166,16777164,13434879,6684774,16744576,26316,13421823,128,16711935,16776960,65535,8388736,8388608,32896,255,52479,13434879,13434828,16777113,10079487,16751052,13408767,16764057,3368703,3394764,10079232,16763904,16750848,16737792,6710937,9868950,13158,3381606,13056,3355392,10040064,10040166,3355545,3355443,16777215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),vT=on(bT),pu={0:"#NULL!",7:"#DIV/0!",15:"#VALUE!",23:"#REF!",29:"#NAME?",36:"#NUM!",42:"#N/A",43:"#GETTING_DATA",255:"#WTF?"},_T={"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":"workbooks","application/vnd.ms-excel.sheet.macroEnabled.main+xml":"workbooks","application/vnd.ms-excel.sheet.binary.macroEnabled.main":"workbooks","application/vnd.ms-excel.addin.macroEnabled.main+xml":"workbooks","application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":"workbooks","application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":"sheets","application/vnd.ms-excel.worksheet":"sheets","application/vnd.ms-excel.binIndexWs":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":"charts","application/vnd.ms-excel.chartsheet":"charts","application/vnd.ms-excel.macrosheet+xml":"macros","application/vnd.ms-excel.macrosheet":"macros","application/vnd.ms-excel.intlmacrosheet":"TODO","application/vnd.ms-excel.binIndexMs":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":"dialogs","application/vnd.ms-excel.dialogsheet":"dialogs","application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml":"strs","application/vnd.ms-excel.sharedStrings":"strs","application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":"styles","application/vnd.ms-excel.styles":"styles","application/vnd.openxmlformats-package.core-properties+xml":"coreprops","application/vnd.openxmlformats-officedocument.custom-properties+xml":"custprops","application/vnd.openxmlformats-officedocument.extended-properties+xml":"extprops","application/vnd.openxmlformats-officedocument.customXmlProperties+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":"comments","application/vnd.ms-excel.comments":"comments","application/vnd.ms-excel.threadedcomments+xml":"threadedcomments","application/vnd.ms-excel.person+xml":"people","application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml":"metadata","application/vnd.ms-excel.sheetMetadata":"metadata","application/vnd.ms-excel.pivotTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.chart+xml":"TODO","application/vnd.ms-office.chartcolorstyle+xml":"TODO","application/vnd.ms-office.chartstyle+xml":"TODO","application/vnd.ms-office.chartex+xml":"TODO","application/vnd.ms-excel.calcChain":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings":"TODO","application/vnd.ms-office.activeX":"TODO","application/vnd.ms-office.activeX+xml":"TODO","application/vnd.ms-excel.attachedToolbars":"TODO","application/vnd.ms-excel.connections":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":"TODO","application/vnd.ms-excel.externalLink":"links","application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml":"links","application/vnd.ms-excel.pivotCacheDefinition":"TODO","application/vnd.ms-excel.pivotCacheRecords":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml":"TODO","application/vnd.ms-excel.queryTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml":"TODO","application/vnd.ms-excel.userNames":"TODO","application/vnd.ms-excel.revisionHeaders":"TODO","application/vnd.ms-excel.revisionLog":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml":"TODO","application/vnd.ms-excel.tableSingleCells":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml":"TODO","application/vnd.ms-excel.slicer":"TODO","application/vnd.ms-excel.slicerCache":"TODO","application/vnd.ms-excel.slicer+xml":"TODO","application/vnd.ms-excel.slicerCache+xml":"TODO","application/vnd.ms-excel.wsSortMap":"TODO","application/vnd.ms-excel.table":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":"TODO","application/vnd.openxmlformats-officedocument.theme+xml":"themes","application/vnd.openxmlformats-officedocument.themeOverride+xml":"TODO","application/vnd.ms-excel.Timeline+xml":"TODO","application/vnd.ms-excel.TimelineCache+xml":"TODO","application/vnd.ms-office.vbaProject":"vba","application/vnd.ms-office.vbaProjectSignature":"TODO","application/vnd.ms-office.volatileDependencies":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml":"TODO","application/vnd.ms-excel.controlproperties+xml":"TODO","application/vnd.openxmlformats-officedocument.model+data":"TODO","application/vnd.ms-excel.Survey+xml":"TODO","application/vnd.openxmlformats-officedocument.drawing+xml":"drawings","application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml":"TODO","application/vnd.openxmlformats-officedocument.vmlDrawing":"TODO","application/vnd.openxmlformats-package.relationships+xml":"rels","application/vnd.openxmlformats-officedocument.oleObject":"TODO","image/png":"TODO",sheet:"js"},X0={workbooks:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",xlsm:"application/vnd.ms-excel.sheet.macroEnabled.main+xml",xlsb:"application/vnd.ms-excel.sheet.binary.macroEnabled.main",xlam:"application/vnd.ms-excel.addin.macroEnabled.main+xml",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"},strs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",xlsb:"application/vnd.ms-excel.sharedStrings"},comments:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",xlsb:"application/vnd.ms-excel.comments"},sheets:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",xlsb:"application/vnd.ms-excel.worksheet"},charts:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",xlsb:"application/vnd.ms-excel.chartsheet"},dialogs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",xlsb:"application/vnd.ms-excel.dialogsheet"},macros:{xlsx:"application/vnd.ms-excel.macrosheet+xml",xlsb:"application/vnd.ms-excel.macrosheet"},metadata:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",xlsb:"application/vnd.ms-excel.sheetMetadata"},styles:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",xlsb:"application/vnd.ms-excel.styles"}};function F2(){return{workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],rels:[],strs:[],comments:[],threadedcomments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],metadata:[],people:[],TODO:[],xmlns:""}}function I2(e,t){var a=O5(_T),s=[],o;s[s.length]=nr,s[s.length]=rt("Types",null,{xmlns:fr.CT,"xmlns:xsd":fr.xsd,"xmlns:xsi":fr.xsi}),s=s.concat([["xml","application/xml"],["bin","application/vnd.ms-excel.sheet.binary.macroEnabled.main"],["vml","application/vnd.openxmlformats-officedocument.vmlDrawing"],["data","application/vnd.openxmlformats-officedocument.model+data"],["bmp","image/bmp"],["png","image/png"],["gif","image/gif"],["emf","image/x-emf"],["wmf","image/x-wmf"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["tif","image/tiff"],["tiff","image/tiff"],["pdf","application/pdf"],["rels","application/vnd.openxmlformats-package.relationships+xml"]].map(function(p){return rt("Default",null,{Extension:p[0],ContentType:p[1]})}));var u=function(p){e[p]&&e[p].length>0&&(o=e[p][0],s[s.length]=rt("Override",null,{PartName:(o[0]=="/"?"":"/")+o,ContentType:X0[p][t.bookType]||X0[p].xlsx}))},c=function(p){(e[p]||[]).forEach(function(g){s[s.length]=rt("Override",null,{PartName:(g[0]=="/"?"":"/")+g,ContentType:X0[p][t.bookType]||X0[p].xlsx})})},f=function(p){(e[p]||[]).forEach(function(g){s[s.length]=rt("Override",null,{PartName:(g[0]=="/"?"":"/")+g,ContentType:a[p][0]})})};return u("workbooks"),c("sheets"),c("charts"),f("themes"),["strs","styles"].forEach(u),["coreprops","extprops","custprops"].forEach(f),f("vba"),f("comments"),f("threadedcomments"),f("drawings"),c("metadata"),f("people"),s.length>2&&(s[s.length]="</Types>",s[1]=s[1].replace("/>",">")),s.join("")}var sa={WB:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",HLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",VML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",XPATH:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",XMISS:"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",CMNT:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",CORE_PROPS:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",EXT_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",CUST_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",SST:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",STY:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",THEME:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",WS:["http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet","http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet"],DRAW:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",XLMETA:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",TCMNT:"http://schemas.microsoft.com/office/2017/10/relationships/threadedComment",PEOPLE:"http://schemas.microsoft.com/office/2017/10/relationships/person",VBA:"http://schemas.microsoft.com/office/2006/relationships/vbaProject"};function B2(e){var t=e.lastIndexOf("/");return e.slice(0,t+1)+"_rels/"+e.slice(t+1)+".rels"}function uc(e){var t=[nr,rt("Relationships",null,{xmlns:fr.RELS})];return jr(e["!id"]).forEach(function(a){t[t.length]=rt("Relationship",null,e["!id"][a])}),t.length>2&&(t[t.length]="</Relationships>",t[1]=t[1].replace("/>",">")),t.join("")}function ga(e,t,a,s,o,u){if(o||(o={}),e["!id"]||(e["!id"]={}),e["!idx"]||(e["!idx"]=1),t<0)for(t=e["!idx"];e["!id"]["rId"+t];++t);if(e["!idx"]=t+1,o.Id="rId"+t,o.Type=s,o.Target=a,[sa.HLINK,sa.XPATH,sa.XMISS].indexOf(o.Type)>-1&&(o.TargetMode="External"),e["!id"][o.Id])throw new Error("Cannot rewrite rId "+t);return e["!id"][o.Id]=o,e[("/"+o.Target).replace("//","/")]=o,t}function wT(e){var t=[nr];t.push(`<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2">
`),t.push(` <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.spreadsheet"/>
`);for(var a=0;a<e.length;++a)t.push(' <manifest:file-entry manifest:full-path="'+e[a][0]+'" manifest:media-type="'+e[a][1]+`"/>
`);return t.push("</manifest:manifest>"),t.join("")}function pv(e,t,a){return[' <rdf:Description rdf:about="'+e+`">
`,' <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/'+(a||"odf")+"#"+t+`"/>
`,` </rdf:Description>
`].join("")}function kT(e,t){return[' <rdf:Description rdf:about="'+e+`">
`,' <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="'+t+`"/>
`,` </rdf:Description>
`].join("")}function NT(e){var t=[nr];t.push(`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
`);for(var a=0;a!=e.length;++a)t.push(pv(e[a][0],e[a][1])),t.push(kT("",e[a][0]));return t.push(pv("","Document","pkg")),t.push("</rdf:RDF>"),t.join("")}function z2(){return'<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xlink="http://www.w3.org/1999/xlink" office:version="1.2"><office:meta><meta:generator>SheetJS '+pf.version+"</meta:generator></office:meta></office:document-meta>"}var Zo=[["cp:category","Category"],["cp:contentStatus","ContentStatus"],["cp:keywords","Keywords"],["cp:lastModifiedBy","LastAuthor"],["cp:lastPrinted","LastPrinted"],["cp:revision","RevNumber"],["cp:version","Version"],["dc:creator","Author"],["dc:description","Comments"],["dc:identifier","Identifier"],["dc:language","Language"],["dc:subject","Subject"],["dc:title","Title"],["dcterms:created","CreatedDate","date"],["dcterms:modified","ModifiedDate","date"]];function pg(e,t,a,s,o){o[e]!=null||t==null||t===""||(o[e]=t,t=pa(t),s[s.length]=a?rt(e,t,a):Nr(e,t))}function U2(e,t){var a=t||{},s=[nr,rt("cp:coreProperties",null,{"xmlns:cp":fr.CORE_PROPS,"xmlns:dc":fr.dc,"xmlns:dcterms":fr.dcterms,"xmlns:dcmitype":fr.dcmitype,"xmlns:xsi":fr.xsi})],o={};if(!e&&!a.Props)return s.join("");e&&(e.CreatedDate!=null&&pg("dcterms:created",typeof e.CreatedDate=="string"?e.CreatedDate:Ig(e.CreatedDate,a.WTF),{"xsi:type":"dcterms:W3CDTF"},s,o),e.ModifiedDate!=null&&pg("dcterms:modified",typeof e.ModifiedDate=="string"?e.ModifiedDate:Ig(e.ModifiedDate,a.WTF),{"xsi:type":"dcterms:W3CDTF"},s,o));for(var u=0;u!=Zo.length;++u){var c=Zo[u],f=a.Props&&a.Props[c[1]]!=null?a.Props[c[1]]:e?e[c[1]]:null;f===!0?f="1":f===!1?f="0":typeof f=="number"&&(f=String(f)),f!=null&&pg(c[0],f,null,s,o)}return s.length>2&&(s[s.length]="</cp:coreProperties>",s[1]=s[1].replace("/>",">")),s.join("")}var fc=[["Application","Application","string"],["AppVersion","AppVersion","string"],["Company","Company","string"],["DocSecurity","DocSecurity","string"],["Manager","Manager","string"],["HyperlinksChanged","HyperlinksChanged","bool"],["SharedDoc","SharedDoc","bool"],["LinksUpToDate","LinksUpToDate","bool"],["ScaleCrop","ScaleCrop","bool"],["HeadingPairs","HeadingPairs","raw"],["TitlesOfParts","TitlesOfParts","raw"]],H2=["Worksheets","SheetNames","NamedRanges","DefinedNames","Chartsheets","ChartNames"];function $2(e){var t=[],a=rt;return e||(e={}),e.Application="SheetJS",t[t.length]=nr,t[t.length]=rt("Properties",null,{xmlns:fr.EXT_PROPS,"xmlns:vt":fr.vt}),fc.forEach(function(s){if(e[s[1]]!==void 0){var o;switch(s[2]){case"string":o=pa(String(e[s[1]]));break;case"bool":o=e[s[1]]?"true":"false";break}o!==void 0&&(t[t.length]=a(s[0],o))}}),t[t.length]=a("HeadingPairs",a("vt:vector",a("vt:variant","<vt:lpstr>Worksheets</vt:lpstr>")+a("vt:variant",a("vt:i4",String(e.Worksheets))),{size:2,baseType:"variant"})),t[t.length]=a("TitlesOfParts",a("vt:vector",e.SheetNames.map(function(s){return"<vt:lpstr>"+pa(s)+"</vt:lpstr>"}).join(""),{size:e.Worksheets,baseType:"lpstr"})),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}function W2(e){var t=[nr,rt("Properties",null,{xmlns:fr.CUST_PROPS,"xmlns:vt":fr.vt})];if(!e)return t.join("");var a=1;return jr(e).forEach(function(o){++a,t[t.length]=rt("property",H5(e[o]),{fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:a,name:pa(o)})}),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}var xv={Title:"Title",Subject:"Subject",Author:"Author",Keywords:"Keywords",Comments:"Description",LastAuthor:"LastAuthor",RevNumber:"Revision",Application:"AppName",LastPrinted:"LastPrinted",CreatedDate:"Created",ModifiedDate:"LastSaved",Category:"Category",Manager:"Manager",Company:"Company",AppVersion:"Version",ContentStatus:"ContentStatus",Identifier:"Identifier",Language:"Language"};function ST(e,t){var a=[];return jr(xv).map(function(s){for(var o=0;o<Zo.length;++o)if(Zo[o][1]==s)return Zo[o];for(o=0;o<fc.length;++o)if(fc[o][1]==s)return fc[o];throw s}).forEach(function(s){if(e[s[1]]!=null){var o=t&&t.Props&&t.Props[s[1]]!=null?t.Props[s[1]]:e[s[1]];switch(s[2]){case"date":o=new Date(o).toISOString().replace(/\.\d*Z/,"Z");break}typeof o=="number"?o=String(o):o===!0||o===!1?o=o?"1":"0":o instanceof Date&&(o=new Date(o).toISOString().replace(/\.\d*Z/,"")),a.push(Nr(xv[s[1]]||s[1],o))}}),rt("DocumentProperties",a.join(""),{xmlns:Nn.o})}function jT(e,t){var a=["Worksheets","SheetNames"],s="CustomDocumentProperties",o=[];return e&&jr(e).forEach(function(u){if(Object.prototype.hasOwnProperty.call(e,u)){for(var c=0;c<Zo.length;++c)if(u==Zo[c][1])return;for(c=0;c<fc.length;++c)if(u==fc[c][1])return;for(c=0;c<a.length;++c)if(u==a[c])return;var f=e[u],p="string";typeof f=="number"?(p="float",f=String(f)):f===!0||f===!1?(p="boolean",f=f?"1":"0"):f=String(f),o.push(rt(nv(u),f,{"dt:dt":p}))}}),t&&jr(t).forEach(function(u){if(Object.prototype.hasOwnProperty.call(t,u)&&!(e&&Object.prototype.hasOwnProperty.call(e,u))){var c=t[u],f="string";typeof c=="number"?(f="float",c=String(c)):c===!0||c===!1?(f="boolean",c=c?"1":"0"):c instanceof Date?(f="dateTime.tz",c=c.toISOString()):c=String(c),o.push(rt(nv(u),c,{"dt:dt":f}))}}),"<"+s+' xmlns="'+Nn.o+'">'+o.join("")+"</"+s+">"}function TT(e){var t=typeof e=="string"?new Date(Date.parse(e)):e,a=t.getTime()/1e3+11644473600,s=a%Math.pow(2,32),o=(a-s)/Math.pow(2,32);s*=1e7,o*=1e7;var u=s/Math.pow(2,32)|0;u>0&&(s=s%Math.pow(2,32),o+=u);var c=Ie(8);return c.write_shift(4,s),c.write_shift(4,o),c}function yv(e,t){var a=Ie(4),s=Ie(4);switch(a.write_shift(4,e==80?31:e),e){case 3:s.write_shift(-4,t);break;case 5:s=Ie(8),s.write_shift(8,t,"f");break;case 11:s.write_shift(4,t?1:0);break;case 64:s=TT(t);break;case 31:case 80:for(s=Ie(4+2*(t.length+1)+(t.length%2?0:2)),s.write_shift(4,t.length+1),s.write_shift(0,t,"dbcs");s.l!=s.length;)s.write_shift(1,0);break;default:throw new Error("TypedPropertyValue unrecognized type "+e+" "+t)}return kr([a,s])}var V2=["CodePage","Thumbnail","_PID_LINKBASE","_PID_HLINKS","SystemIdentifier","FMTID"];function ET(e){switch(typeof e){case"boolean":return 11;case"number":return(e|0)==e?3:5;case"string":return 31;case"object":if(e instanceof Date)return 64;break}return-1}function bv(e,t,a){var s=Ie(8),o=[],u=[],c=8,f=0,p=Ie(8),g=Ie(8);if(p.write_shift(4,2),p.write_shift(4,1200),g.write_shift(4,1),u.push(p),o.push(g),c+=8+p.length,!t){g=Ie(8),g.write_shift(4,0),o.unshift(g);var x=[Ie(4)];for(x[0].write_shift(4,e.length),f=0;f<e.length;++f){var v=e[f][0];for(p=Ie(8+2*(v.length+1)+(v.length%2?0:2)),p.write_shift(4,f+2),p.write_shift(4,v.length+1),p.write_shift(0,v,"dbcs");p.l!=p.length;)p.write_shift(1,0);x.push(p)}p=kr(x),u.unshift(p),c+=8+p.length}for(f=0;f<e.length;++f)if(!(t&&!t[e[f][0]])&&!(V2.indexOf(e[f][0])>-1||H2.indexOf(e[f][0])>-1)&&e[f][1]!=null){var _=e[f][1],k=0;if(t){k=+t[e[f][0]];var T=a[k];if(T.p=="version"&&typeof _=="string"){var N=_.split(".");_=(+N[0]<<16)+(+N[1]||0)}p=yv(T.t,_)}else{var j=ET(_);j==-1&&(j=31,_=String(_)),p=yv(j,_)}u.push(p),g=Ie(8),g.write_shift(4,t?k:2+f),o.push(g),c+=8+p.length}var P=8*(u.length+1);for(f=0;f<u.length;++f)o[f].write_shift(4,P),P+=u[f].length;return s.write_shift(4,c),s.write_shift(4,u.length),kr([s].concat(o).concat(u))}function vv(e,t,a,s,o,u){var c=Ie(o?68:48),f=[c];c.write_shift(2,65534),c.write_shift(2,0),c.write_shift(4,842412599),c.write_shift(16,Na.utils.consts.HEADER_CLSID,"hex"),c.write_shift(4,o?2:1),c.write_shift(16,t,"hex"),c.write_shift(4,o?68:48);var p=bv(e,a,s);if(f.push(p),o){var g=bv(o,null,null);c.write_shift(16,u,"hex"),c.write_shift(4,68+p.length),f.push(g)}return kr(f)}function CT(e,t){t||(t=Ie(e));for(var a=0;a<e;++a)t.write_shift(1,0);return t}function AT(e,t){return e.read_shift(t)===1}function Ur(e,t){return t||(t=Ie(2)),t.write_shift(2,+!!e),t}function G2(e){return e.read_shift(2,"u")}function Hn(e,t){return t||(t=Ie(2)),t.write_shift(2,e),t}function Z2(e,t,a){return a||(a=Ie(2)),a.write_shift(1,t=="e"?+e:+!!e),a.write_shift(1,t=="e"?1:0),a}function q2(e,t,a){var s=e.read_shift(a&&a.biff>=12?2:1),o="sbcs-cont";if(a&&a.biff>=8,!a||a.biff==8){var u=e.read_shift(1);u&&(o="dbcs-cont")}else a.biff==12&&(o="wstr");a.biff>=2&&a.biff<=5&&(o="cpstr");var c=s?e.read_shift(s,o):"";return c}function OT(e){var t=e.t||"",a=Ie(3);a.write_shift(2,t.length),a.write_shift(1,1);var s=Ie(2*t.length);s.write_shift(2*t.length,t,"utf16le");var o=[a,s];return kr(o)}function LT(e,t,a){var s;if(a){if(a.biff>=2&&a.biff<=5)return e.read_shift(t,"cpstr");if(a.biff>=12)return e.read_shift(t,"dbcs-cont")}var o=e.read_shift(1);return o===0?s=e.read_shift(t,"sbcs-cont"):s=e.read_shift(t,"dbcs-cont"),s}function MT(e,t,a){var s=e.read_shift(a&&a.biff==2?1:2);return s===0?(e.l++,""):LT(e,s,a)}function DT(e,t,a){if(a.biff>5)return MT(e,t,a);var s=e.read_shift(1);return s===0?(e.l++,""):e.read_shift(s,a.biff<=4||!e.lens?"cpstr":"sbcs-cont")}function Y2(e,t,a){return a||(a=Ie(3+2*e.length)),a.write_shift(2,e.length),a.write_shift(1,1),a.write_shift(31,e,"utf16le"),a}function _v(e,t){t||(t=Ie(6+e.length*2)),t.write_shift(4,1+e.length);for(var a=0;a<e.length;++a)t.write_shift(2,e.charCodeAt(a));return t.write_shift(2,0),t}function RT(e){var t=Ie(512),a=0,s=e.Target;s.slice(0,7)=="file://"&&(s=s.slice(7));var o=s.indexOf("#"),u=o>-1?31:23;switch(s.charAt(0)){case"#":u=28;break;case".":u&=-3;break}t.write_shift(4,2),t.write_shift(4,u);var c=[8,6815827,6619237,4849780,83];for(a=0;a<c.length;++a)t.write_shift(4,c[a]);if(u==28)s=s.slice(1),_v(s,t);else if(u&2){for(c="e0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),a=0;a<c.length;++a)t.write_shift(1,parseInt(c[a],16));var f=o>-1?s.slice(0,o):s;for(t.write_shift(4,2*(f.length+1)),a=0;a<f.length;++a)t.write_shift(2,f.charCodeAt(a));t.write_shift(2,0),u&8&&_v(o>-1?s.slice(o+1):"",t)}else{for(c="03 03 00 00 00 00 00 00 c0 00 00 00 00 00 00 46".split(" "),a=0;a<c.length;++a)t.write_shift(1,parseInt(c[a],16));for(var p=0;s.slice(p*3,p*3+3)=="../"||s.slice(p*3,p*3+3)=="..\\";)++p;for(t.write_shift(2,p),t.write_shift(4,s.length-3*p+1),a=0;a<s.length-3*p;++a)t.write_shift(1,s.charCodeAt(a+3*p)&255);for(t.write_shift(1,0),t.write_shift(2,65535),t.write_shift(2,57005),a=0;a<6;++a)t.write_shift(4,0)}return t.slice(0,t.l)}function tl(e,t,a,s){return s||(s=Ie(6)),s.write_shift(2,e),s.write_shift(2,t),s.write_shift(2,a||0),s}function PT(e,t,a){var s=a.biff>8?4:2,o=e.read_shift(s),u=e.read_shift(s,"i"),c=e.read_shift(s,"i");return[o,u,c]}function FT(e){var t=e.read_shift(2),a=e.read_shift(2),s=e.read_shift(2),o=e.read_shift(2);return{s:{c:s,r:t},e:{c:o,r:a}}}function X2(e,t){return t||(t=Ie(8)),t.write_shift(2,e.s.r),t.write_shift(2,e.e.r),t.write_shift(2,e.s.c),t.write_shift(2,e.e.c),t}function _p(e,t,a){var s=1536,o=16;switch(a.bookType){case"biff8":break;case"biff5":s=1280,o=8;break;case"biff4":s=4,o=6;break;case"biff3":s=3,o=6;break;case"biff2":s=2,o=4;break;case"xla":break;default:throw new Error("unsupported BIFF version")}var u=Ie(o);return u.write_shift(2,s),u.write_shift(2,t),o>4&&u.write_shift(2,29282),o>6&&u.write_shift(2,1997),o>8&&(u.write_shift(2,49161),u.write_shift(2,1),u.write_shift(2,1798),u.write_shift(2,0)),u}function IT(e,t){var a=!t||t.biff==8,s=Ie(a?112:54);for(s.write_shift(t.biff==8?2:1,7),a&&s.write_shift(1,0),s.write_shift(4,859007059),s.write_shift(4,5458548|(a?0:536870912));s.l<s.length;)s.write_shift(1,a?0:32);return s}function BT(e,t){var a=!t||t.biff>=8?2:1,s=Ie(8+a*e.name.length);s.write_shift(4,e.pos),s.write_shift(1,e.hs||0),s.write_shift(1,e.dt),s.write_shift(1,e.name.length),t.biff>=8&&s.write_shift(1,1),s.write_shift(a*e.name.length,e.name,t.biff<8?"sbcs":"utf16le");var o=s.slice(0,s.l);return o.l=s.l,o}function zT(e,t){var a=Ie(8);a.write_shift(4,e.Count),a.write_shift(4,e.Unique);for(var s=[],o=0;o<e.length;++o)s[o]=OT(e[o]);var u=kr([a].concat(s));return u.parts=[a.length].concat(s.map(function(c){return c.length})),u}function UT(){var e=Ie(18);return e.write_shift(2,0),e.write_shift(2,0),e.write_shift(2,29280),e.write_shift(2,17600),e.write_shift(2,56),e.write_shift(2,0),e.write_shift(2,0),e.write_shift(2,1),e.write_shift(2,500),e}function HT(e){var t=Ie(18),a=1718;return e&&e.RTL&&(a|=64),t.write_shift(2,a),t.write_shift(4,0),t.write_shift(4,64),t.write_shift(4,0),t.write_shift(4,0),t}function $T(e,t){var a=e.name||"Arial",s=t&&t.biff==5,o=s?15+a.length:16+2*a.length,u=Ie(o);return u.write_shift(2,e.sz*20),u.write_shift(4,0),u.write_shift(2,400),u.write_shift(4,0),u.write_shift(2,0),u.write_shift(1,a.length),s||u.write_shift(1,1),u.write_shift((s?1:2)*a.length,a,s?"sbcs":"utf16le"),u}function WT(e,t,a,s){var o=Ie(10);return tl(e,t,s,o),o.write_shift(4,a),o}function VT(e,t,a,s,o){var u=!o||o.biff==8,c=Ie(8+ +u+(1+u)*a.length);return tl(e,t,s,c),c.write_shift(2,a.length),u&&c.write_shift(1,1),c.write_shift((1+u)*a.length,a,u?"utf16le":"sbcs"),c}function GT(e,t,a,s){var o=a&&a.biff==5;s||(s=Ie(o?3+t.length:5+2*t.length)),s.write_shift(2,e),s.write_shift(o?1:2,t.length),o||s.write_shift(1,1),s.write_shift((o?1:2)*t.length,t,o?"sbcs":"utf16le");var u=s.length>s.l?s.slice(0,s.l):s;return u.l==null&&(u.l=u.length),u}function ZT(e,t){var a=t.biff==8||!t.biff?4:2,s=Ie(2*a+6);return s.write_shift(a,e.s.r),s.write_shift(a,e.e.r+1),s.write_shift(2,e.s.c),s.write_shift(2,e.e.c+1),s.write_shift(2,0),s}function wv(e,t,a,s){var o=a&&a.biff==5;s||(s=Ie(o?16:20)),s.write_shift(2,0),e.style?(s.write_shift(2,e.numFmtId||0),s.write_shift(2,65524)):(s.write_shift(2,e.numFmtId||0),s.write_shift(2,t<<4));var u=0;return e.numFmtId>0&&o&&(u|=1024),s.write_shift(4,u),s.write_shift(4,0),o||s.write_shift(4,0),s.write_shift(2,0),s}function qT(e){var t=Ie(8);return t.write_shift(4,0),t.write_shift(2,0),t.write_shift(2,0),t}function YT(e,t,a,s,o,u){var c=Ie(8);return tl(e,t,s,c),Z2(a,u,c),c}function XT(e,t,a,s){var o=Ie(14);return tl(e,t,s,o),el(a,o),o}function KT(e,t,a){if(a.biff<8)return JT(e,t,a);for(var s=[],o=e.l+t,u=e.read_shift(a.biff>8?4:2);u--!==0;)s.push(PT(e,a.biff>8?12:6,a));if(e.l!=o)throw new Error("Bad ExternSheet: "+e.l+" != "+o);return s}function JT(e,t,a){e[e.l+1]==3&&e[e.l]++;var s=q2(e,t,a);return s.charCodeAt(0)==3?s.slice(1):s}function QT(e){var t=Ie(2+e.length*8);t.write_shift(2,e.length);for(var a=0;a<e.length;++a)X2(e[a],t);return t}function eE(e){var t=Ie(24),a=hr(e[0]);t.write_shift(2,a.r),t.write_shift(2,a.r),t.write_shift(2,a.c),t.write_shift(2,a.c);for(var s="d0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),o=0;o<16;++o)t.write_shift(1,parseInt(s[o],16));return kr([t,RT(e[1])])}function tE(e){var t=e[1].Tooltip,a=Ie(10+2*(t.length+1));a.write_shift(2,2048);var s=hr(e[0]);a.write_shift(2,s.r),a.write_shift(2,s.r),a.write_shift(2,s.c),a.write_shift(2,s.c);for(var o=0;o<t.length;++o)a.write_shift(2,t.charCodeAt(o));return a.write_shift(2,0),a}function aE(e){return e||(e=Ie(4)),e.write_shift(2,1),e.write_shift(2,1),e}function rE(e,t,a){if(!a.cellStyles)return Fs(e,t);var s=a&&a.biff>=12?4:2,o=e.read_shift(s),u=e.read_shift(s),c=e.read_shift(s),f=e.read_shift(s),p=e.read_shift(2);s==2&&(e.l+=2);var g={s:o,e:u,w:c,ixfe:f,flags:p};return(a.biff>=5||!a.biff)&&(g.level=p>>8&7),g}function nE(e,t){var a=Ie(12);a.write_shift(2,t),a.write_shift(2,t),a.write_shift(2,e.width*256),a.write_shift(2,0);var s=0;return e.hidden&&(s|=1),a.write_shift(1,s),s=e.level||0,a.write_shift(1,s),a.write_shift(2,0),a}function sE(e){for(var t=Ie(2*e),a=0;a<e;++a)t.write_shift(2,a+1);return t}function iE(e,t,a){var s=Ie(15);return yu(s,e,t),s.write_shift(8,a,"f"),s}function oE(e,t,a){var s=Ie(9);return yu(s,e,t),s.write_shift(2,a),s}var lE=(function(){var e={1:437,2:850,3:1252,4:1e4,100:852,101:866,102:865,103:861,104:895,105:620,106:737,107:857,120:950,121:949,122:936,123:932,124:874,125:1255,126:1256,150:10007,151:10029,152:10006,200:1250,201:1251,202:1254,203:1253,0:20127,8:865,9:437,10:850,11:437,13:437,14:850,15:437,16:850,17:437,18:850,19:932,20:850,21:437,22:850,23:865,24:437,25:437,26:850,27:437,28:863,29:850,31:852,34:852,35:852,36:860,37:850,38:866,55:850,64:852,77:936,78:949,79:950,80:874,87:1252,88:1252,89:1252,108:863,134:737,135:852,136:857,204:1257,255:16969},t=dp({1:437,2:850,3:1252,4:1e4,100:852,101:866,102:865,103:861,104:895,105:620,106:737,107:857,120:950,121:949,122:936,123:932,124:874,125:1255,126:1256,150:10007,151:10029,152:10006,200:1250,201:1251,202:1254,203:1253,0:20127});function a(f,p){var g=[],x=Qo(1);switch(p.type){case"base64":x=cs(hi(f));break;case"binary":x=cs(f);break;case"buffer":case"array":x=f;break}kn(x,0);var v=x.read_shift(1),_=!!(v&136),k=!1,T=!1;switch(v){case 2:break;case 3:break;case 48:k=!0,_=!0;break;case 49:k=!0,_=!0;break;case 131:break;case 139:break;case 140:T=!0;break;case 245:break;default:throw new Error("DBF Unsupported Version: "+v.toString(16))}var N=0,j=521;v==2&&(N=x.read_shift(2)),x.l+=3,v!=2&&(N=x.read_shift(4)),N>1048576&&(N=1e6),v!=2&&(j=x.read_shift(2));var P=x.read_shift(2),C=p.codepage||1252;v!=2&&(x.l+=16,x.read_shift(1),x[x.l]!==0&&(C=e[x[x.l]]),x.l+=1,x.l+=2),T&&(x.l+=36);for(var O=[],R={},U=Math.min(x.length,v==2?521:j-10-(k?264:0)),H=T?32:11;x.l<U&&x[x.l]!=13;)switch(R={},R.name=xf.utils.decode(C,x.slice(x.l,x.l+H)).replace(/[\u0000\r\n].*$/g,""),x.l+=H,R.type=String.fromCharCode(x.read_shift(1)),v!=2&&!T&&(R.offset=x.read_shift(4)),R.len=x.read_shift(1),v==2&&(R.offset=x.read_shift(2)),R.dec=x.read_shift(1),R.name.length&&O.push(R),v!=2&&(x.l+=T?13:14),R.type){case"B":(!k||R.len!=8)&&p.WTF&&console.log("Skipping "+R.name+":"+R.type);break;case"G":case"P":p.WTF&&console.log("Skipping "+R.name+":"+R.type);break;case"+":case"0":case"@":case"C":case"D":case"F":case"I":case"L":case"M":case"N":case"O":case"T":case"Y":break;default:throw new Error("Unknown Field Type: "+R.type)}if(x[x.l]!==13&&(x.l=j-1),x.read_shift(1)!==13)throw new Error("DBF Terminator not found "+x.l+" "+x[x.l]);x.l=j;var B=0,oe=0;for(g[0]=[],oe=0;oe!=O.length;++oe)g[0][oe]=O[oe].name;for(;N-- >0;){if(x[x.l]===42){x.l+=P;continue}for(++x.l,g[++B]=[],oe=0,oe=0;oe!=O.length;++oe){var se=x.slice(x.l,x.l+O[oe].len);x.l+=O[oe].len,kn(se,0);var pe=xf.utils.decode(C,se);switch(O[oe].type){case"C":pe.trim().length&&(g[B][oe]=pe.replace(/\s+$/,""));break;case"D":pe.length===8?g[B][oe]=new Date(+pe.slice(0,4),+pe.slice(4,6)-1,+pe.slice(6,8)):g[B][oe]=pe;break;case"F":g[B][oe]=parseFloat(pe.trim());break;case"+":case"I":g[B][oe]=T?se.read_shift(-4,"i")^2147483648:se.read_shift(4,"i");break;case"L":switch(pe.trim().toUpperCase()){case"Y":case"T":g[B][oe]=!0;break;case"N":case"F":g[B][oe]=!1;break;case"":case"?":break;default:throw new Error("DBF Unrecognized L:|"+pe+"|")}break;case"M":if(!_)throw new Error("DBF Unexpected MEMO for type "+v.toString(16));g[B][oe]="##MEMO##"+(T?parseInt(pe.trim(),10):se.read_shift(4));break;case"N":pe=pe.replace(/\u0000/g,"").trim(),pe&&pe!="."&&(g[B][oe]=+pe||0);break;case"@":g[B][oe]=new Date(se.read_shift(-8,"f")-621356832e5);break;case"T":g[B][oe]=new Date((se.read_shift(4)-2440588)*864e5+se.read_shift(4));break;case"Y":g[B][oe]=se.read_shift(4,"i")/1e4+se.read_shift(4,"i")/1e4*Math.pow(2,32);break;case"O":g[B][oe]=-se.read_shift(-8,"f");break;case"B":if(k&&O[oe].len==8){g[B][oe]=se.read_shift(8,"f");break}case"G":case"P":se.l+=O[oe].len;break;case"0":if(O[oe].name==="_NullFlags")break;default:throw new Error("DBF Unsupported data type "+O[oe].type)}}}if(v!=2&&x.l<x.length&&x[x.l++]!=26)throw new Error("DBF EOF Marker missing "+(x.l-1)+" of "+x.length+" "+x[x.l-1].toString(16));return p&&p.sheetRows&&(g=g.slice(0,p.sheetRows)),p.DBF=O,g}function s(f,p){var g=p||{};g.dateNF||(g.dateNF="yyyymmdd");var x=Ec(a(f,g),g);return x["!cols"]=g.DBF.map(function(v){return{wch:v.len,DBF:v}}),delete g.DBF,x}function o(f,p){try{return nl(s(f,p),p)}catch(g){if(p&&p.WTF)throw g}return{SheetNames:[],Sheets:{}}}var u={B:8,C:250,L:1,D:8,"?":0,"":0};function c(f,p){var g=p||{};if(+g.codepage>=0&&Yd(+g.codepage),g.type=="string")throw new Error("Cannot write DBF to JS string");var x=nn(),v=Af(f,{header:1,raw:!0,cellDates:!0}),_=v[0],k=v.slice(1),T=f["!cols"]||[],N=0,j=0,P=0,C=1;for(N=0;N<_.length;++N){if(((T[N]||{}).DBF||{}).name){_[N]=T[N].DBF.name,++P;continue}if(_[N]!=null){if(++P,typeof _[N]=="number"&&(_[N]=_[N].toString(10)),typeof _[N]!="string")throw new Error("DBF Invalid column name "+_[N]+" |"+typeof _[N]+"|");if(_.indexOf(_[N])!==N){for(j=0;j<1024;++j)if(_.indexOf(_[N]+"_"+j)==-1){_[N]+="_"+j;break}}}}var O=Ma(f["!ref"]),R=[],U=[],H=[];for(N=0;N<=O.e.c-O.s.c;++N){var B="",oe="",se=0,pe=[];for(j=0;j<k.length;++j)k[j][N]!=null&&pe.push(k[j][N]);if(pe.length==0||_[N]==null){R[N]="?";continue}for(j=0;j<pe.length;++j){switch(typeof pe[j]){case"number":oe="B";break;case"string":oe="C";break;case"boolean":oe="L";break;case"object":oe=pe[j]instanceof Date?"D":"C";break;default:oe="C"}se=Math.max(se,String(pe[j]).length),B=B&&B!=oe?"C":oe}se>250&&(se=250),oe=((T[N]||{}).DBF||{}).type,oe=="C"&&T[N].DBF.len>se&&(se=T[N].DBF.len),B=="B"&&oe=="N"&&(B="N",H[N]=T[N].DBF.dec,se=T[N].DBF.len),U[N]=B=="C"||oe=="N"?se:u[B]||0,C+=U[N],R[N]=B}var le=x.next(32);for(le.write_shift(4,318902576),le.write_shift(4,k.length),le.write_shift(2,296+32*P),le.write_shift(2,C),N=0;N<4;++N)le.write_shift(4,0);for(le.write_shift(4,0|(+t[J_]||3)<<8),N=0,j=0;N<_.length;++N)if(_[N]!=null){var re=x.next(32),de=(_[N].slice(-10)+"\0\0\0\0\0\0\0\0\0\0\0").slice(0,11);re.write_shift(1,de,"sbcs"),re.write_shift(1,R[N]=="?"?"C":R[N],"sbcs"),re.write_shift(4,j),re.write_shift(1,U[N]||u[R[N]]||0),re.write_shift(1,H[N]||0),re.write_shift(1,2),re.write_shift(4,0),re.write_shift(1,0),re.write_shift(4,0),re.write_shift(4,0),j+=U[N]||u[R[N]]||0}var ye=x.next(264);for(ye.write_shift(4,13),N=0;N<65;++N)ye.write_shift(4,0);for(N=0;N<k.length;++N){var ue=x.next(C);for(ue.write_shift(1,0),j=0;j<_.length;++j)if(_[j]!=null)switch(R[j]){case"L":ue.write_shift(1,k[N][j]==null?63:k[N][j]?84:70);break;case"B":ue.write_shift(8,k[N][j]||0,"f");break;case"N":var te="0";for(typeof k[N][j]=="number"&&(te=k[N][j].toFixed(H[j]||0)),P=0;P<U[j]-te.length;++P)ue.write_shift(1,32);ue.write_shift(1,te,"sbcs");break;case"D":k[N][j]?(ue.write_shift(4,("0000"+k[N][j].getFullYear()).slice(-4),"sbcs"),ue.write_shift(2,("00"+(k[N][j].getMonth()+1)).slice(-2),"sbcs"),ue.write_shift(2,("00"+k[N][j].getDate()).slice(-2),"sbcs")):ue.write_shift(8,"00000000","sbcs");break;case"C":var V=String(k[N][j]!=null?k[N][j]:"").slice(0,U[j]);for(ue.write_shift(1,V,"sbcs"),P=0;P<U[j]-V.length;++P)ue.write_shift(1,32);break}}return x.next(1).write_shift(1,26),x.end()}return{to_workbook:o,to_sheet:s,from_sheet:c}})(),cE=(function(){var e={AA:"À",BA:"Á",CA:"Â",DA:195,HA:"Ä",JA:197,AE:"È",BE:"É",CE:"Ê",HE:"Ë",AI:"Ì",BI:"Í",CI:"Î",HI:"Ï",AO:"Ò",BO:"Ó",CO:"Ô",DO:213,HO:"Ö",AU:"Ù",BU:"Ú",CU:"Û",HU:"Ü",Aa:"à",Ba:"á",Ca:"â",Da:227,Ha:"ä",Ja:229,Ae:"è",Be:"é",Ce:"ê",He:"ë",Ai:"ì",Bi:"í",Ci:"î",Hi:"ï",Ao:"ò",Bo:"ó",Co:"ô",Do:245,Ho:"ö",Au:"ù",Bu:"ú",Cu:"û",Hu:"ü",KC:"Ç",Kc:"ç",q:"æ",z:"œ",a:"Æ",j:"Œ",DN:209,Dn:241,Hy:255,S:169,c:170,R:174,"B ":180,0:176,1:177,2:178,3:179,5:181,6:182,7:183,Q:185,k:186,b:208,i:216,l:222,s:240,y:248,"!":161,'"':162,"#":163,"(":164,"%":165,"'":167,"H ":168,"+":171,";":187,"<":188,"=":189,">":190,"?":191,"{":223},t=new RegExp("\x1BN("+jr(e).join("|").replace(/\|\|\|/,"|\\||").replace(/([?()+])/g,"\\$1")+"|\\|)","gm"),a=function(_,k){var T=e[k];return typeof T=="number"?Gb(T):T},s=function(_,k,T){var N=k.charCodeAt(0)-32<<4|T.charCodeAt(0)-48;return N==59?_:Gb(N)};e["|"]=254;function o(_,k){switch(k.type){case"base64":return u(hi(_),k);case"binary":return u(_,k);case"buffer":return u(la&&Buffer.isBuffer(_)?_.toString("binary"):hu(_),k);case"array":return u(Gf(_),k)}throw new Error("Unrecognized type "+k.type)}function u(_,k){var T=_.split(/[\n\r]+/),N=-1,j=-1,P=0,C=0,O=[],R=[],U=null,H={},B=[],oe=[],se=[],pe=0,le;for(+k.codepage>=0&&Yd(+k.codepage);P!==T.length;++P){pe=0;var re=T[P].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g,s).replace(t,a),de=re.replace(/;;/g,"\0").split(";").map(function(K){return K.replace(/\u0000/g,";")}),ye=de[0],ue;if(re.length>0)switch(ye){case"ID":break;case"E":break;case"B":break;case"O":break;case"W":break;case"P":de[1].charAt(0)=="P"&&R.push(re.slice(3).replace(/;;/g,";"));break;case"C":var te=!1,V=!1,J=!1,ne=!1,ae=-1,z=-1;for(C=1;C<de.length;++C)switch(de[C].charAt(0)){case"A":break;case"X":j=parseInt(de[C].slice(1))-1,V=!0;break;case"Y":for(N=parseInt(de[C].slice(1))-1,V||(j=0),le=O.length;le<=N;++le)O[le]=[];break;case"K":ue=de[C].slice(1),ue.charAt(0)==='"'?ue=ue.slice(1,ue.length-1):ue==="TRUE"?ue=!0:ue==="FALSE"?ue=!1:isNaN(oi(ue))?isNaN(Kd(ue).getDate())||(ue=$r(ue)):(ue=oi(ue),U!==null&&d2(U)&&(ue=m2(ue))),te=!0;break;case"E":ne=!0;var D=oC(de[C].slice(1),{r:N,c:j});O[N][j]=[O[N][j],D];break;case"S":J=!0,O[N][j]=[O[N][j],"S5S"];break;case"G":break;case"R":ae=parseInt(de[C].slice(1))-1;break;case"C":z=parseInt(de[C].slice(1))-1;break;default:if(k&&k.WTF)throw new Error("SYLK bad record "+re)}if(te&&(O[N][j]&&O[N][j].length==2?O[N][j][0]=ue:O[N][j]=ue,U=null),J){if(ne)throw new Error("SYLK shared formula cannot have own formula");var G=ae>-1&&O[ae][z];if(!G||!G[1])throw new Error("SYLK shared formula cannot find base");O[N][j][1]=lC(G[1],{r:N-ae,c:j-z})}break;case"F":var q=0;for(C=1;C<de.length;++C)switch(de[C].charAt(0)){case"X":j=parseInt(de[C].slice(1))-1,++q;break;case"Y":for(N=parseInt(de[C].slice(1))-1,le=O.length;le<=N;++le)O[le]=[];break;case"M":pe=parseInt(de[C].slice(1))/20;break;case"F":break;case"G":break;case"P":U=R[parseInt(de[C].slice(1))];break;case"S":break;case"D":break;case"N":break;case"W":for(se=de[C].slice(1).split(" "),le=parseInt(se[0],10);le<=parseInt(se[1],10);++le)pe=parseInt(se[2],10),oe[le-1]=pe===0?{hidden:!0}:{wch:pe},wp(oe[le-1]);break;case"C":j=parseInt(de[C].slice(1))-1,oe[j]||(oe[j]={});break;case"R":N=parseInt(de[C].slice(1))-1,B[N]||(B[N]={}),pe>0?(B[N].hpt=pe,B[N].hpx=tw(pe)):pe===0&&(B[N].hidden=!0);break;default:if(k&&k.WTF)throw new Error("SYLK bad record "+re)}q<1&&(U=null);break;default:if(k&&k.WTF)throw new Error("SYLK bad record "+re)}}return B.length>0&&(H["!rows"]=B),oe.length>0&&(H["!cols"]=oe),k&&k.sheetRows&&(O=O.slice(0,k.sheetRows)),[O,H]}function c(_,k){var T=o(_,k),N=T[0],j=T[1],P=Ec(N,k);return jr(j).forEach(function(C){P[C]=j[C]}),P}function f(_,k){return nl(c(_,k),k)}function p(_,k,T,N){var j="C;Y"+(T+1)+";X"+(N+1)+";K";switch(_.t){case"n":j+=_.v||0,_.f&&!_.F&&(j+=";E"+Np(_.f,{r:T,c:N}));break;case"b":j+=_.v?"TRUE":"FALSE";break;case"e":j+=_.w||_.v;break;case"d":j+='"'+(_.w||_.v)+'"';break;case"s":j+='"'+_.v.replace(/"/g,"").replace(/;/g,";;")+'"';break}return j}function g(_,k){k.forEach(function(T,N){var j="F;W"+(N+1)+" "+(N+1)+" ";T.hidden?j+="0":(typeof T.width=="number"&&!T.wpx&&(T.wpx=jf(T.width)),typeof T.wpx=="number"&&!T.wch&&(T.wch=Tf(T.wpx)),typeof T.wch=="number"&&(j+=Math.round(T.wch))),j.charAt(j.length-1)!=" "&&_.push(j)})}function x(_,k){k.forEach(function(T,N){var j="F;";T.hidden?j+="M0;":T.hpt?j+="M"+20*T.hpt+";":T.hpx&&(j+="M"+20*Ef(T.hpx)+";"),j.length>2&&_.push(j+"R"+(N+1))})}function v(_,k){var T=["ID;PWXL;N;E"],N=[],j=Ma(_["!ref"]),P,C=Array.isArray(_),O=`\r
`;T.push("P;PGeneral"),T.push("F;P0;DG0G8;M255"),_["!cols"]&&g(T,_["!cols"]),_["!rows"]&&x(T,_["!rows"]),T.push("B;Y"+(j.e.r-j.s.r+1)+";X"+(j.e.c-j.s.c+1)+";D"+[j.s.c,j.s.r,j.e.c,j.e.r].join(" "));for(var R=j.s.r;R<=j.e.r;++R)for(var U=j.s.c;U<=j.e.c;++U){var H=xa({r:R,c:U});P=C?(_[R]||[])[U]:_[H],!(!P||P.v==null&&(!P.f||P.F))&&N.push(p(P,_,R,U))}return T.join(O)+O+N.join(O)+O+"E"+O}return{to_workbook:f,to_sheet:c,from_sheet:v}})(),dE=(function(){function e(u,c){switch(c.type){case"base64":return t(hi(u),c);case"binary":return t(u,c);case"buffer":return t(la&&Buffer.isBuffer(u)?u.toString("binary"):hu(u),c);case"array":return t(Gf(u),c)}throw new Error("Unrecognized type "+c.type)}function t(u,c){for(var f=u.split(`
`),p=-1,g=-1,x=0,v=[];x!==f.length;++x){if(f[x].trim()==="BOT"){v[++p]=[],g=0;continue}if(!(p<0)){var _=f[x].trim().split(","),k=_[0],T=_[1];++x;for(var N=f[x]||"";(N.match(/["]/g)||[]).length&1&&x<f.length-1;)N+=`
`+f[++x];switch(N=N.trim(),+k){case-1:if(N==="BOT"){v[++p]=[],g=0;continue}else if(N!=="EOD")throw new Error("Unrecognized DIF special command "+N);break;case 0:N==="TRUE"?v[p][g]=!0:N==="FALSE"?v[p][g]=!1:isNaN(oi(T))?isNaN(Kd(T).getDate())?v[p][g]=T:v[p][g]=$r(T):v[p][g]=oi(T),++g;break;case 1:N=N.slice(1,N.length-1),N=N.replace(/""/g,'"'),N&&N.match(/^=".*"$/)&&(N=N.slice(2,-1)),v[p][g++]=N!==""?N:null;break}if(N==="EOD")break}}return c&&c.sheetRows&&(v=v.slice(0,c.sheetRows)),v}function a(u,c){return Ec(e(u,c),c)}function s(u,c){return nl(a(u,c),c)}var o=(function(){var u=function(p,g,x,v,_){p.push(g),p.push(x+","+v),p.push('"'+_.replace(/"/g,'""')+'"')},c=function(p,g,x,v){p.push(g+","+x),p.push(g==1?'"'+v.replace(/"/g,'""')+'"':v)};return function(p){var g=[],x=Ma(p["!ref"]),v,_=Array.isArray(p);u(g,"TABLE",0,1,"sheetjs"),u(g,"VECTORS",0,x.e.r-x.s.r+1,""),u(g,"TUPLES",0,x.e.c-x.s.c+1,""),u(g,"DATA",0,0,"");for(var k=x.s.r;k<=x.e.r;++k){c(g,-1,0,"BOT");for(var T=x.s.c;T<=x.e.c;++T){var N=xa({r:k,c:T});if(v=_?(p[k]||[])[T]:p[N],!v){c(g,1,0,"");continue}switch(v.t){case"n":var j=v.w;!j&&v.v!=null&&(j=v.v),j==null?v.f&&!v.F?c(g,1,0,"="+v.f):c(g,1,0,""):c(g,0,j,"V");break;case"b":c(g,0,v.v?1:0,v.v?"TRUE":"FALSE");break;case"s":c(g,1,0,isNaN(v.v)?v.v:'="'+v.v+'"');break;case"d":v.w||(v.w=to(v.z||Ga[14],sn($r(v.v)))),c(g,0,v.w,"V");break;default:c(g,1,0,"")}}}c(g,-1,0,"EOD");var P=`\r
`,C=g.join(P);return C}})();return{to_workbook:s,to_sheet:a,from_sheet:o}})(),K2=(function(){function e(v){return v.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n/g,`
`)}function t(v){return v.replace(/\\/g,"\\b").replace(/:/g,"\\c").replace(/\n/g,"\\n")}function a(v,_){for(var k=v.split(`
`),T=-1,N=-1,j=0,P=[];j!==k.length;++j){var C=k[j].trim().split(":");if(C[0]==="cell"){var O=hr(C[1]);if(P.length<=O.r)for(T=P.length;T<=O.r;++T)P[T]||(P[T]=[]);switch(T=O.r,N=O.c,C[2]){case"t":P[T][N]=e(C[3]);break;case"v":P[T][N]=+C[3];break;case"vtf":var R=C[C.length-1];case"vtc":switch(C[3]){case"nl":P[T][N]=!!+C[4];break;default:P[T][N]=+C[4];break}C[2]=="vtf"&&(P[T][N]=[P[T][N],R])}}}return _&&_.sheetRows&&(P=P.slice(0,_.sheetRows)),P}function s(v,_){return Ec(a(v,_),_)}function o(v,_){return nl(s(v,_),_)}var u=["socialcalc:version:1.5","MIME-Version: 1.0","Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave"].join(`
`),c=["--SocialCalcSpreadsheetControlSave","Content-type: text/plain; charset=UTF-8"].join(`
`)+`
`,f=["# SocialCalc Spreadsheet Control Save","part:sheet"].join(`
`),p="--SocialCalcSpreadsheetControlSave--";function g(v){if(!v||!v["!ref"])return"";for(var _=[],k=[],T,N="",j=En(v["!ref"]),P=Array.isArray(v),C=j.s.r;C<=j.e.r;++C)for(var O=j.s.c;O<=j.e.c;++O)if(N=xa({r:C,c:O}),T=P?(v[C]||[])[O]:v[N],!(!T||T.v==null||T.t==="z")){switch(k=["cell",N,"t"],T.t){case"s":case"str":k.push(t(T.v));break;case"n":T.f?(k[2]="vtf",k[3]="n",k[4]=T.v,k[5]=t(T.f)):(k[2]="v",k[3]=T.v);break;case"b":k[2]="vt"+(T.f?"f":"c"),k[3]="nl",k[4]=T.v?"1":"0",k[5]=t(T.f||(T.v?"TRUE":"FALSE"));break;case"d":var R=sn($r(T.v));k[2]="vtc",k[3]="nd",k[4]=""+R,k[5]=T.w||to(T.z||Ga[14],R);break;case"e":continue}_.push(k.join(":"))}return _.push("sheet:c:"+(j.e.c-j.s.c+1)+":r:"+(j.e.r-j.s.r+1)+":tvf:1"),_.push("valueformat:1:text-wiki"),_.join(`
`)}function x(v){return[u,c,f,c,g(v),p].join(`
`)}return{to_workbook:o,to_sheet:s,from_sheet:x}})(),uE=(function(){function e(x,v,_,k,T){T.raw?v[_][k]=x:x===""||(x==="TRUE"?v[_][k]=!0:x==="FALSE"?v[_][k]=!1:isNaN(oi(x))?isNaN(Kd(x).getDate())?v[_][k]=x:v[_][k]=$r(x):v[_][k]=oi(x))}function t(x,v){var _=v||{},k=[];if(!x||x.length===0)return k;for(var T=x.split(/[\r\n]/),N=T.length-1;N>=0&&T[N].length===0;)--N;for(var j=10,P=0,C=0;C<=N;++C)P=T[C].indexOf(" "),P==-1?P=T[C].length:P++,j=Math.max(j,P);for(C=0;C<=N;++C){k[C]=[];var O=0;for(e(T[C].slice(0,j).trim(),k,C,O,_),O=1;O<=(T[C].length-j)/10+1;++O)e(T[C].slice(j+(O-1)*10,j+O*10).trim(),k,C,O,_)}return _.sheetRows&&(k=k.slice(0,_.sheetRows)),k}var a={44:",",9:" ",59:";",124:"|"},s={44:3,9:2,59:1,124:0};function o(x){for(var v={},_=!1,k=0,T=0;k<x.length;++k)(T=x.charCodeAt(k))==34?_=!_:!_&&T in a&&(v[T]=(v[T]||0)+1);T=[];for(k in v)Object.prototype.hasOwnProperty.call(v,k)&&T.push([v[k],k]);if(!T.length){v=s;for(k in v)Object.prototype.hasOwnProperty.call(v,k)&&T.push([v[k],k])}return T.sort(function(N,j){return N[0]-j[0]||s[N[1]]-s[j[1]]}),a[T.pop()[1]]||44}function u(x,v){var _=v||{},k="",T=_.dense?[]:{},N={s:{c:0,r:0},e:{c:0,r:0}};x.slice(0,4)=="sep="?x.charCodeAt(5)==13&&x.charCodeAt(6)==10?(k=x.charAt(4),x=x.slice(7)):x.charCodeAt(5)==13||x.charCodeAt(5)==10?(k=x.charAt(4),x=x.slice(6)):k=o(x.slice(0,1024)):_&&_.FS?k=_.FS:k=o(x.slice(0,1024));var j=0,P=0,C=0,O=0,R=0,U=k.charCodeAt(0),H=!1,B=0,oe=x.charCodeAt(0);x=x.replace(/\r\n/mg,`
`);var se=_.dateNF!=null?T5(_.dateNF):null;function pe(){var le=x.slice(O,R),re={};if(le.charAt(0)=='"'&&le.charAt(le.length-1)=='"'&&(le=le.slice(1,-1).replace(/""/g,'"')),le.length===0)re.t="z";else if(_.raw)re.t="s",re.v=le;else if(le.trim().length===0)re.t="s",re.v=le;else if(le.charCodeAt(0)==61)le.charCodeAt(1)==34&&le.charCodeAt(le.length-1)==34?(re.t="s",re.v=le.slice(2,-1).replace(/""/g,'"')):cC(le)?(re.t="n",re.f=le.slice(1)):(re.t="s",re.v=le);else if(le=="TRUE")re.t="b",re.v=!0;else if(le=="FALSE")re.t="b",re.v=!1;else if(!isNaN(C=oi(le)))re.t="n",_.cellText!==!1&&(re.w=le),re.v=C;else if(!isNaN(Kd(le).getDate())||se&&le.match(se)){re.z=_.dateNF||Ga[14];var de=0;se&&le.match(se)&&(le=E5(le,_.dateNF,le.match(se)||[]),de=1),_.cellDates?(re.t="d",re.v=$r(le,de)):(re.t="n",re.v=sn($r(le,de))),_.cellText!==!1&&(re.w=to(re.z,re.v instanceof Date?sn(re.v):re.v)),_.cellNF||delete re.z}else re.t="s",re.v=le;if(re.t=="z"||(_.dense?(T[j]||(T[j]=[]),T[j][P]=re):T[xa({c:P,r:j})]=re),O=R+1,oe=x.charCodeAt(O),N.e.c<P&&(N.e.c=P),N.e.r<j&&(N.e.r=j),B==U)++P;else if(P=0,++j,_.sheetRows&&_.sheetRows<=j)return!0}e:for(;R<x.length;++R)switch(B=x.charCodeAt(R)){case 34:oe===34&&(H=!H);break;case U:case 10:case 13:if(!H&&pe())break e;break}return R-O>0&&pe(),T["!ref"]=rr(N),T}function c(x,v){return!(v&&v.PRN)||v.FS||x.slice(0,4)=="sep="||x.indexOf(" ")>=0||x.indexOf(",")>=0||x.indexOf(";")>=0?u(x,v):Ec(t(x,v),v)}function f(x,v){var _="",k=v.type=="string"?[0,0,0,0]:kO(x,v);switch(v.type){case"base64":_=hi(x);break;case"binary":_=x;break;case"buffer":v.codepage==65001?_=x.toString("utf8"):v.codepage&&typeof xf!="undefined"||(_=la&&Buffer.isBuffer(x)?x.toString("binary"):hu(x));break;case"array":_=Gf(x);break;case"string":_=x;break;default:throw new Error("Unrecognized type "+v.type)}return k[0]==239&&k[1]==187&&k[2]==191?_=Ud(_.slice(3)):v.type!="string"&&v.type!="buffer"&&v.codepage==65001?_=Ud(_):v.type=="binary",_.slice(0,19)=="socialcalc:version:"?K2.to_sheet(v.type=="string"?_:Ud(_),v):c(_,v)}function p(x,v){return nl(f(x,v),v)}function g(x){for(var v=[],_=Ma(x["!ref"]),k,T=Array.isArray(x),N=_.s.r;N<=_.e.r;++N){for(var j=[],P=_.s.c;P<=_.e.c;++P){var C=xa({r:N,c:P});if(k=T?(x[N]||[])[P]:x[C],!k||k.v==null){j.push(" ");continue}for(var O=(k.w||(mi(k),k.w)||"").slice(0,10);O.length<10;)O+=" ";j.push(O+(P===0?" ":""))}v.push(j.join(""))}return v.join(`
`)}return{to_workbook:p,to_sheet:f,from_sheet:g}})(),kv=(function(){function e(D,G,q){if(D){kn(D,D.l||0);for(var K=q.Enum||ae;D.l<D.length;){var fe=D.read_shift(2),Pe=K[fe]||K[65535],We=D.read_shift(2),Fe=D.l+We,He=Pe.f&&Pe.f(D,We,q);if(D.l=Fe,G(He,Pe,fe))return}}}function t(D,G){switch(G.type){case"base64":return a(cs(hi(D)),G);case"binary":return a(cs(D),G);case"buffer":case"array":return a(D,G)}throw"Unsupported type "+G.type}function a(D,G){if(!D)return D;var q=G||{},K=q.dense?[]:{},fe="Sheet1",Pe="",We=0,Fe={},He=[],it=[],ht={s:{r:0,c:0},e:{r:0,c:0}},Vt=q.sheetRows||0;if(D[2]==0&&(D[3]==8||D[3]==9)&&D.length>=16&&D[14]==5&&D[15]===108)throw new Error("Unsupported Works 3 for Mac file");if(D[2]==2)q.Enum=ae,e(D,function(Be,yt,ke){switch(ke){case 0:q.vers=Be,Be>=4096&&(q.qpro=!0);break;case 6:ht=Be;break;case 204:Be&&(Pe=Be);break;case 222:Pe=Be;break;case 15:case 51:q.qpro||(Be[1].v=Be[1].v.slice(1));case 13:case 14:case 16:ke==14&&(Be[2]&112)==112&&(Be[2]&15)>1&&(Be[2]&15)<15&&(Be[1].z=q.dateNF||Ga[14],q.cellDates&&(Be[1].t="d",Be[1].v=m2(Be[1].v))),q.qpro&&Be[3]>We&&(K["!ref"]=rr(ht),Fe[fe]=K,He.push(fe),K=q.dense?[]:{},ht={s:{r:0,c:0},e:{r:0,c:0}},We=Be[3],fe=Pe||"Sheet"+(We+1),Pe="");var ze=q.dense?(K[Be[0].r]||[])[Be[0].c]:K[xa(Be[0])];if(ze){ze.t=Be[1].t,ze.v=Be[1].v,Be[1].z!=null&&(ze.z=Be[1].z),Be[1].f!=null&&(ze.f=Be[1].f);break}q.dense?(K[Be[0].r]||(K[Be[0].r]=[]),K[Be[0].r][Be[0].c]=Be[1]):K[xa(Be[0])]=Be[1];break}},q);else if(D[2]==26||D[2]==14)q.Enum=z,D[2]==14&&(q.qpro=!0,D.l=0),e(D,function(Be,yt,ke){switch(ke){case 204:fe=Be;break;case 22:Be[1].v=Be[1].v.slice(1);case 23:case 24:case 25:case 37:case 39:case 40:if(Be[3]>We&&(K["!ref"]=rr(ht),Fe[fe]=K,He.push(fe),K=q.dense?[]:{},ht={s:{r:0,c:0},e:{r:0,c:0}},We=Be[3],fe="Sheet"+(We+1)),Vt>0&&Be[0].r>=Vt)break;q.dense?(K[Be[0].r]||(K[Be[0].r]=[]),K[Be[0].r][Be[0].c]=Be[1]):K[xa(Be[0])]=Be[1],ht.e.c<Be[0].c&&(ht.e.c=Be[0].c),ht.e.r<Be[0].r&&(ht.e.r=Be[0].r);break;case 27:Be[14e3]&&(it[Be[14e3][0]]=Be[14e3][1]);break;case 1537:it[Be[0]]=Be[1],Be[0]==We&&(fe=Be[1]);break}},q);else throw new Error("Unrecognized LOTUS BOF "+D[2]);if(K["!ref"]=rr(ht),Fe[Pe||fe]=K,He.push(Pe||fe),!it.length)return{SheetNames:He,Sheets:Fe};for(var _t={},ia=[],Lt=0;Lt<it.length;++Lt)Fe[He[Lt]]?(ia.push(it[Lt]||He[Lt]),_t[it[Lt]]=Fe[it[Lt]]||Fe[He[Lt]]):(ia.push(it[Lt]),_t[it[Lt]]={"!ref":"A1"});return{SheetNames:ia,Sheets:_t}}function s(D,G){var q=G||{};if(+q.codepage>=0&&Yd(+q.codepage),q.type=="string")throw new Error("Cannot write WK1 to JS string");var K=nn(),fe=Ma(D["!ref"]),Pe=Array.isArray(D),We=[];st(K,0,u(1030)),st(K,6,p(fe));for(var Fe=Math.min(fe.e.r,8191),He=fe.s.r;He<=Fe;++He)for(var it=Sr(He),ht=fe.s.c;ht<=fe.e.c;++ht){He===fe.s.r&&(We[ht]=Lr(ht));var Vt=We[ht]+it,_t=Pe?(D[He]||[])[ht]:D[Vt];if(!(!_t||_t.t=="z"))if(_t.t=="n")(_t.v|0)==_t.v&&_t.v>=-32768&&_t.v<=32767?st(K,13,k(He,ht,_t.v)):st(K,14,N(He,ht,_t.v));else{var ia=mi(_t);st(K,15,v(He,ht,ia.slice(0,239)))}}return st(K,1),K.end()}function o(D,G){var q=G||{};if(+q.codepage>=0&&Yd(+q.codepage),q.type=="string")throw new Error("Cannot write WK3 to JS string");var K=nn();st(K,0,c(D));for(var fe=0,Pe=0;fe<D.SheetNames.length;++fe)(D.Sheets[D.SheetNames[fe]]||{})["!ref"]&&st(K,27,ne(D.SheetNames[fe],Pe++));var We=0;for(fe=0;fe<D.SheetNames.length;++fe){var Fe=D.Sheets[D.SheetNames[fe]];if(!(!Fe||!Fe["!ref"])){for(var He=Ma(Fe["!ref"]),it=Array.isArray(Fe),ht=[],Vt=Math.min(He.e.r,8191),_t=He.s.r;_t<=Vt;++_t)for(var ia=Sr(_t),Lt=He.s.c;Lt<=He.e.c;++Lt){_t===He.s.r&&(ht[Lt]=Lr(Lt));var Be=ht[Lt]+ia,yt=it?(Fe[_t]||[])[Lt]:Fe[Be];if(!(!yt||yt.t=="z"))if(yt.t=="n")st(K,23,pe(_t,Lt,We,yt.v));else{var ke=mi(yt);st(K,22,B(_t,Lt,We,ke.slice(0,239)))}}++We}}return st(K,1),K.end()}function u(D){var G=Ie(2);return G.write_shift(2,D),G}function c(D){var G=Ie(26);G.write_shift(2,4096),G.write_shift(2,4),G.write_shift(4,0);for(var q=0,K=0,fe=0,Pe=0;Pe<D.SheetNames.length;++Pe){var We=D.SheetNames[Pe],Fe=D.Sheets[We];if(!(!Fe||!Fe["!ref"])){++fe;var He=En(Fe["!ref"]);q<He.e.r&&(q=He.e.r),K<He.e.c&&(K=He.e.c)}}return q>8191&&(q=8191),G.write_shift(2,q),G.write_shift(1,fe),G.write_shift(1,K),G.write_shift(2,0),G.write_shift(2,0),G.write_shift(1,1),G.write_shift(1,2),G.write_shift(4,0),G.write_shift(4,0),G}function f(D,G,q){var K={s:{c:0,r:0},e:{c:0,r:0}};return G==8&&q.qpro?(K.s.c=D.read_shift(1),D.l++,K.s.r=D.read_shift(2),K.e.c=D.read_shift(1),D.l++,K.e.r=D.read_shift(2),K):(K.s.c=D.read_shift(2),K.s.r=D.read_shift(2),G==12&&q.qpro&&(D.l+=2),K.e.c=D.read_shift(2),K.e.r=D.read_shift(2),G==12&&q.qpro&&(D.l+=2),K.s.c==65535&&(K.s.c=K.e.c=K.s.r=K.e.r=0),K)}function p(D){var G=Ie(8);return G.write_shift(2,D.s.c),G.write_shift(2,D.s.r),G.write_shift(2,D.e.c),G.write_shift(2,D.e.r),G}function g(D,G,q){var K=[{c:0,r:0},{t:"n",v:0},0,0];return q.qpro&&q.vers!=20768?(K[0].c=D.read_shift(1),K[3]=D.read_shift(1),K[0].r=D.read_shift(2),D.l+=2):(K[2]=D.read_shift(1),K[0].c=D.read_shift(2),K[0].r=D.read_shift(2)),K}function x(D,G,q){var K=D.l+G,fe=g(D,G,q);if(fe[1].t="s",q.vers==20768){D.l++;var Pe=D.read_shift(1);return fe[1].v=D.read_shift(Pe,"utf8"),fe}return q.qpro&&D.l++,fe[1].v=D.read_shift(K-D.l,"cstr"),fe}function v(D,G,q){var K=Ie(7+q.length);K.write_shift(1,255),K.write_shift(2,G),K.write_shift(2,D),K.write_shift(1,39);for(var fe=0;fe<K.length;++fe){var Pe=q.charCodeAt(fe);K.write_shift(1,Pe>=128?95:Pe)}return K.write_shift(1,0),K}function _(D,G,q){var K=g(D,G,q);return K[1].v=D.read_shift(2,"i"),K}function k(D,G,q){var K=Ie(7);return K.write_shift(1,255),K.write_shift(2,G),K.write_shift(2,D),K.write_shift(2,q,"i"),K}function T(D,G,q){var K=g(D,G,q);return K[1].v=D.read_shift(8,"f"),K}function N(D,G,q){var K=Ie(13);return K.write_shift(1,255),K.write_shift(2,G),K.write_shift(2,D),K.write_shift(8,q,"f"),K}function j(D,G,q){var K=D.l+G,fe=g(D,G,q);if(fe[1].v=D.read_shift(8,"f"),q.qpro)D.l=K;else{var Pe=D.read_shift(2);R(D.slice(D.l,D.l+Pe),fe),D.l+=Pe}return fe}function P(D,G,q){var K=G&32768;return G&=-32769,G=(K?D:0)+(G>=8192?G-16384:G),(K?"":"$")+(q?Lr(G):Sr(G))}var C={51:["FALSE",0],52:["TRUE",0],70:["LEN",1],80:["SUM",69],81:["AVERAGEA",69],82:["COUNTA",69],83:["MINA",69],84:["MAXA",69],111:["T",1]},O=["","","","","","","","","","+","-","*","/","^","=","<>","<=",">=","<",">","","","","","&","","","","","","",""];function R(D,G){kn(D,0);for(var q=[],K=0,fe="",Pe="",We="",Fe="";D.l<D.length;){var He=D[D.l++];switch(He){case 0:q.push(D.read_shift(8,"f"));break;case 1:Pe=P(G[0].c,D.read_shift(2),!0),fe=P(G[0].r,D.read_shift(2),!1),q.push(Pe+fe);break;case 2:{var it=P(G[0].c,D.read_shift(2),!0),ht=P(G[0].r,D.read_shift(2),!1);Pe=P(G[0].c,D.read_shift(2),!0),fe=P(G[0].r,D.read_shift(2),!1),q.push(it+ht+":"+Pe+fe)}break;case 3:if(D.l<D.length){console.error("WK1 premature formula end");return}break;case 4:q.push("("+q.pop()+")");break;case 5:q.push(D.read_shift(2));break;case 6:{for(var Vt="";He=D[D.l++];)Vt+=String.fromCharCode(He);q.push('"'+Vt.replace(/"/g,'""')+'"')}break;case 8:q.push("-"+q.pop());break;case 23:q.push("+"+q.pop());break;case 22:q.push("NOT("+q.pop()+")");break;case 20:case 21:Fe=q.pop(),We=q.pop(),q.push(["AND","OR"][He-20]+"("+We+","+Fe+")");break;default:if(He<32&&O[He])Fe=q.pop(),We=q.pop(),q.push(We+O[He]+Fe);else if(C[He]){if(K=C[He][1],K==69&&(K=D[D.l++]),K>q.length){console.error("WK1 bad formula parse 0x"+He.toString(16)+":|"+q.join("|")+"|");return}var _t=q.slice(-K);q.length-=K,q.push(C[He][0]+"("+_t.join(",")+")")}else return He<=7?console.error("WK1 invalid opcode "+He.toString(16)):He<=24?console.error("WK1 unsupported op "+He.toString(16)):He<=30?console.error("WK1 invalid opcode "+He.toString(16)):He<=115?console.error("WK1 unsupported function opcode "+He.toString(16)):console.error("WK1 unrecognized opcode "+He.toString(16))}}q.length==1?G[1].f=""+q[0]:console.error("WK1 bad formula parse |"+q.join("|")+"|")}function U(D){var G=[{c:0,r:0},{t:"n",v:0},0];return G[0].r=D.read_shift(2),G[3]=D[D.l++],G[0].c=D[D.l++],G}function H(D,G){var q=U(D);return q[1].t="s",q[1].v=D.read_shift(G-4,"cstr"),q}function B(D,G,q,K){var fe=Ie(6+K.length);fe.write_shift(2,D),fe.write_shift(1,q),fe.write_shift(1,G),fe.write_shift(1,39);for(var Pe=0;Pe<K.length;++Pe){var We=K.charCodeAt(Pe);fe.write_shift(1,We>=128?95:We)}return fe.write_shift(1,0),fe}function oe(D,G){var q=U(D);q[1].v=D.read_shift(2);var K=q[1].v>>1;if(q[1].v&1)switch(K&7){case 0:K=(K>>3)*5e3;break;case 1:K=(K>>3)*500;break;case 2:K=(K>>3)/20;break;case 3:K=(K>>3)/200;break;case 4:K=(K>>3)/2e3;break;case 5:K=(K>>3)/2e4;break;case 6:K=(K>>3)/16;break;case 7:K=(K>>3)/64;break}return q[1].v=K,q}function se(D,G){var q=U(D),K=D.read_shift(4),fe=D.read_shift(4),Pe=D.read_shift(2);if(Pe==65535)return K===0&&fe===3221225472?(q[1].t="e",q[1].v=15):K===0&&fe===3489660928?(q[1].t="e",q[1].v=42):q[1].v=0,q;var We=Pe&32768;return Pe=(Pe&32767)-16446,q[1].v=(1-We*2)*(fe*Math.pow(2,Pe+32)+K*Math.pow(2,Pe)),q}function pe(D,G,q,K){var fe=Ie(14);if(fe.write_shift(2,D),fe.write_shift(1,q),fe.write_shift(1,G),K==0)return fe.write_shift(4,0),fe.write_shift(4,0),fe.write_shift(2,65535),fe;var Pe=0,We=0,Fe=0,He=0;return K<0&&(Pe=1,K=-K),We=Math.log2(K)|0,K/=Math.pow(2,We-31),He=K>>>0,(He&2147483648)==0&&(K/=2,++We,He=K>>>0),K-=He,He|=2147483648,He>>>=0,K*=Math.pow(2,32),Fe=K>>>0,fe.write_shift(4,Fe),fe.write_shift(4,He),We+=16383+(Pe?32768:0),fe.write_shift(2,We),fe}function le(D,G){var q=se(D);return D.l+=G-14,q}function re(D,G){var q=U(D),K=D.read_shift(4);return q[1].v=K>>6,q}function de(D,G){var q=U(D),K=D.read_shift(8,"f");return q[1].v=K,q}function ye(D,G){var q=de(D);return D.l+=G-10,q}function ue(D,G){return D[D.l+G-1]==0?D.read_shift(G,"cstr"):""}function te(D,G){var q=D[D.l++];q>G-1&&(q=G-1);for(var K="";K.length<q;)K+=String.fromCharCode(D[D.l++]);return K}function V(D,G,q){if(!(!q.qpro||G<21)){var K=D.read_shift(1);D.l+=17,D.l+=1,D.l+=2;var fe=D.read_shift(G-21,"cstr");return[K,fe]}}function J(D,G){for(var q={},K=D.l+G;D.l<K;){var fe=D.read_shift(2);if(fe==14e3){for(q[fe]=[0,""],q[fe][0]=D.read_shift(2);D[D.l];)q[fe][1]+=String.fromCharCode(D[D.l]),D.l++;D.l++}}return q}function ne(D,G){var q=Ie(5+D.length);q.write_shift(2,14e3),q.write_shift(2,G);for(var K=0;K<D.length;++K){var fe=D.charCodeAt(K);q[q.l++]=fe>127?95:fe}return q[q.l++]=0,q}var ae={0:{n:"BOF",f:G2},1:{n:"EOF"},2:{n:"CALCMODE"},3:{n:"CALCORDER"},4:{n:"SPLIT"},5:{n:"SYNC"},6:{n:"RANGE",f},7:{n:"WINDOW1"},8:{n:"COLW1"},9:{n:"WINTWO"},10:{n:"COLW2"},11:{n:"NAME"},12:{n:"BLANK"},13:{n:"INTEGER",f:_},14:{n:"NUMBER",f:T},15:{n:"LABEL",f:x},16:{n:"FORMULA",f:j},24:{n:"TABLE"},25:{n:"ORANGE"},26:{n:"PRANGE"},27:{n:"SRANGE"},28:{n:"FRANGE"},29:{n:"KRANGE1"},32:{n:"HRANGE"},35:{n:"KRANGE2"},36:{n:"PROTEC"},37:{n:"FOOTER"},38:{n:"HEADER"},39:{n:"SETUP"},40:{n:"MARGINS"},41:{n:"LABELFMT"},42:{n:"TITLES"},43:{n:"SHEETJS"},45:{n:"GRAPH"},46:{n:"NGRAPH"},47:{n:"CALCCOUNT"},48:{n:"UNFORMATTED"},49:{n:"CURSORW12"},50:{n:"WINDOW"},51:{n:"STRING",f:x},55:{n:"PASSWORD"},56:{n:"LOCKED"},60:{n:"QUERY"},61:{n:"QUERYNAME"},62:{n:"PRINT"},63:{n:"PRINTNAME"},64:{n:"GRAPH2"},65:{n:"GRAPHNAME"},66:{n:"ZOOM"},67:{n:"SYMSPLIT"},68:{n:"NSROWS"},69:{n:"NSCOLS"},70:{n:"RULER"},71:{n:"NNAME"},72:{n:"ACOMM"},73:{n:"AMACRO"},74:{n:"PARSE"},102:{n:"PRANGES??"},103:{n:"RRANGES??"},104:{n:"FNAME??"},105:{n:"MRANGES??"},204:{n:"SHEETNAMECS",f:ue},222:{n:"SHEETNAMELP",f:te},65535:{n:""}},z={0:{n:"BOF"},1:{n:"EOF"},2:{n:"PASSWORD"},3:{n:"CALCSET"},4:{n:"WINDOWSET"},5:{n:"SHEETCELLPTR"},6:{n:"SHEETLAYOUT"},7:{n:"COLUMNWIDTH"},8:{n:"HIDDENCOLUMN"},9:{n:"USERRANGE"},10:{n:"SYSTEMRANGE"},11:{n:"ZEROFORCE"},12:{n:"SORTKEYDIR"},13:{n:"FILESEAL"},14:{n:"DATAFILLNUMS"},15:{n:"PRINTMAIN"},16:{n:"PRINTSTRING"},17:{n:"GRAPHMAIN"},18:{n:"GRAPHSTRING"},19:{n:"??"},20:{n:"ERRCELL"},21:{n:"NACELL"},22:{n:"LABEL16",f:H},23:{n:"NUMBER17",f:se},24:{n:"NUMBER18",f:oe},25:{n:"FORMULA19",f:le},26:{n:"FORMULA1A"},27:{n:"XFORMAT",f:J},28:{n:"DTLABELMISC"},29:{n:"DTLABELCELL"},30:{n:"GRAPHWINDOW"},31:{n:"CPA"},32:{n:"LPLAUTO"},33:{n:"QUERY"},34:{n:"HIDDENSHEET"},35:{n:"??"},37:{n:"NUMBER25",f:re},38:{n:"??"},39:{n:"NUMBER27",f:de},40:{n:"FORMULA28",f:ye},142:{n:"??"},147:{n:"??"},150:{n:"??"},151:{n:"??"},152:{n:"??"},153:{n:"??"},154:{n:"??"},155:{n:"??"},156:{n:"??"},163:{n:"??"},174:{n:"??"},175:{n:"??"},176:{n:"??"},177:{n:"??"},184:{n:"??"},185:{n:"??"},186:{n:"??"},187:{n:"??"},188:{n:"??"},195:{n:"??"},201:{n:"??"},204:{n:"SHEETNAMECS",f:ue},205:{n:"??"},206:{n:"??"},207:{n:"??"},208:{n:"??"},256:{n:"??"},259:{n:"??"},260:{n:"??"},261:{n:"??"},262:{n:"??"},263:{n:"??"},265:{n:"??"},266:{n:"??"},267:{n:"??"},268:{n:"??"},270:{n:"??"},271:{n:"??"},384:{n:"??"},389:{n:"??"},390:{n:"??"},393:{n:"??"},396:{n:"??"},512:{n:"??"},514:{n:"??"},513:{n:"??"},516:{n:"??"},517:{n:"??"},640:{n:"??"},641:{n:"??"},642:{n:"??"},643:{n:"??"},644:{n:"??"},645:{n:"??"},646:{n:"??"},647:{n:"??"},648:{n:"??"},658:{n:"??"},659:{n:"??"},660:{n:"??"},661:{n:"??"},662:{n:"??"},665:{n:"??"},666:{n:"??"},768:{n:"??"},772:{n:"??"},1537:{n:"SHEETINFOQP",f:V},1600:{n:"??"},1602:{n:"??"},1793:{n:"??"},1794:{n:"??"},1795:{n:"??"},1796:{n:"??"},1920:{n:"??"},2048:{n:"??"},2049:{n:"??"},2052:{n:"??"},2688:{n:"??"},10998:{n:"??"},12849:{n:"??"},28233:{n:"??"},28484:{n:"??"},65535:{n:""}};return{sheet_to_wk1:s,book_to_wk3:o,to_workbook:t}})(),fE=/^\s|\s$|[\t\n\r]/;function J2(e,t){if(!t.bookSST)return"";var a=[nr];a[a.length]=rt("sst",null,{xmlns:Tc[0],count:e.Count,uniqueCount:e.Unique});for(var s=0;s!=e.length;++s)if(e[s]!=null){var o=e[s],u="<si>";o.r?u+=o.r:(u+="<t",o.t||(o.t=""),o.t.match(fE)&&(u+=' xml:space="preserve"'),u+=">"+pa(o.t)+"</t>"),u+="</si>",a[a.length]=u}return a.length>2&&(a[a.length]="</sst>",a[1]=a[1].replace("/>",">")),a.join("")}function hE(e){return[e.read_shift(4),e.read_shift(4)]}function mE(e,t){return t||(t=Ie(8)),t.write_shift(4,e.Count),t.write_shift(4,e.Unique),t}var gE=sT;function pE(e){var t=nn();Xe(t,159,mE(e));for(var a=0;a<e.length;++a)Xe(t,19,gE(e[a]));return Xe(t,160),t.end()}function xE(e){for(var t=[],a=e.split(""),s=0;s<a.length;++s)t[s]=a[s].charCodeAt(0);return t}function Q2(e){var t=0,a,s=xE(e),o=s.length+1,u,c,f,p,g;for(a=Qo(o),a[0]=s.length,u=1;u!=o;++u)a[u]=s[u-1];for(u=o-1;u>=0;--u)c=a[u],f=(t&16384)===0?0:1,p=t<<1&32767,g=f|p,t=g^c;return t^52811}var yE=(function(){function e(o,u){switch(u.type){case"base64":return t(hi(o),u);case"binary":return t(o,u);case"buffer":return t(la&&Buffer.isBuffer(o)?o.toString("binary"):hu(o),u);case"array":return t(Gf(o),u)}throw new Error("Unrecognized type "+u.type)}function t(o,u){var c=u||{},f=c.dense?[]:{},p=o.match(/\\trowd.*?\\row\b/g);if(!p.length)throw new Error("RTF missing table");var g={s:{c:0,r:0},e:{c:0,r:p.length-1}};return p.forEach(function(x,v){Array.isArray(f)&&(f[v]=[]);for(var _=/\\\w+\b/g,k=0,T,N=-1;T=_.exec(x);){switch(T[0]){case"\\cell":var j=x.slice(k,_.lastIndex-T[0].length);if(j[0]==" "&&(j=j.slice(1)),++N,j.length){var P={v:j,t:"s"};Array.isArray(f)?f[v][N]=P:f[xa({r:v,c:N})]=P}break}k=_.lastIndex}N>g.e.c&&(g.e.c=N)}),f["!ref"]=rr(g),f}function a(o,u){return nl(e(o,u),u)}function s(o){for(var u=["{\\rtf1\\ansi"],c=Ma(o["!ref"]),f,p=Array.isArray(o),g=c.s.r;g<=c.e.r;++g){u.push("\\trowd\\trautofit1");for(var x=c.s.c;x<=c.e.c;++x)u.push("\\cellx"+(x+1));for(u.push("\\pard\\intbl"),x=c.s.c;x<=c.e.c;++x){var v=xa({r:g,c:x});f=p?(o[g]||[])[x]:o[v],!(!f||f.v==null&&(!f.f||f.F))&&(u.push(" "+(f.w||(mi(f),f.w))),u.push("\\cell"))}u.push("\\pard\\intbl\\row")}return u.join("")+"}"}return{to_workbook:a,to_sheet:e,from_sheet:s}})();function Nv(e){for(var t=0,a=1;t!=3;++t)a=a*256+(e[t]>255?255:e[t]<0?0:e[t]);return a.toString(16).toUpperCase().slice(1)}var bE=6,li=bE;function jf(e){return Math.floor((e+Math.round(128/li)/256)*li)}function Tf(e){return Math.floor((e-5)/li*100+.5)/100}function zg(e){return Math.round((e*li+5)/li*256)/256}function wp(e){e.width?(e.wpx=jf(e.width),e.wch=Tf(e.wpx),e.MDW=li):e.wpx?(e.wch=Tf(e.wpx),e.width=zg(e.wch),e.MDW=li):typeof e.wch=="number"&&(e.width=zg(e.wch),e.wpx=jf(e.width),e.MDW=li),e.customWidth&&delete e.customWidth}var vE=96,ew=vE;function Ef(e){return e*96/ew}function tw(e){return e*ew/96}function _E(e){var t=["<numFmts>"];return[[5,8],[23,26],[41,44],[50,392]].forEach(function(a){for(var s=a[0];s<=a[1];++s)e[s]!=null&&(t[t.length]=rt("numFmt",null,{numFmtId:s,formatCode:pa(e[s])}))}),t.length===1?"":(t[t.length]="</numFmts>",t[0]=rt("numFmts",null,{count:t.length-2}).replace("/>",">"),t.join(""))}function wE(e){var t=[];return t[t.length]=rt("cellXfs",null),e.forEach(function(a){t[t.length]=rt("xf",null,a)}),t[t.length]="</cellXfs>",t.length===2?"":(t[0]=rt("cellXfs",null,{count:t.length-2}).replace("/>",">"),t.join(""))}function aw(e,t){var a=[nr,rt("styleSheet",null,{xmlns:Tc[0],"xmlns:vt":fr.vt})],s;return e.SSF&&(s=_E(e.SSF))!=null&&(a[a.length]=s),a[a.length]='<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>',a[a.length]='<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>',a[a.length]='<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>',a[a.length]='<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>',(s=wE(t.cellXfs))&&(a[a.length]=s),a[a.length]='<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>',a[a.length]='<dxfs count="0"/>',a[a.length]='<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4"/>',a.length>2&&(a[a.length]="</styleSheet>",a[1]=a[1].replace("/>",">")),a.join("")}function kE(e,t){var a=e.read_shift(2),s=Mr(e);return[a,s]}function NE(e,t,a){a||(a=Ie(6+4*t.length)),a.write_shift(2,e),mr(t,a);var s=a.length>a.l?a.slice(0,a.l):a;return a.l==null&&(a.l=a.length),s}function SE(e,t,a){var s={};s.sz=e.read_shift(2)/20;var o=fT(e);o.fItalic&&(s.italic=1),o.fCondense&&(s.condense=1),o.fExtend&&(s.extend=1),o.fShadow&&(s.shadow=1),o.fOutline&&(s.outline=1),o.fStrikeout&&(s.strike=1);var u=e.read_shift(2);switch(u===700&&(s.bold=1),e.read_shift(2)){case 1:s.vertAlign="superscript";break;case 2:s.vertAlign="subscript";break}var c=e.read_shift(1);c!=0&&(s.underline=c);var f=e.read_shift(1);f>0&&(s.family=f);var p=e.read_shift(1);switch(p>0&&(s.charset=p),e.l++,s.color=uT(e),e.read_shift(1)){case 1:s.scheme="major";break;case 2:s.scheme="minor";break}return s.name=Mr(e),s}function jE(e,t){t||(t=Ie(153)),t.write_shift(2,e.sz*20),hT(e,t),t.write_shift(2,e.bold?700:400);var a=0;e.vertAlign=="superscript"?a=1:e.vertAlign=="subscript"&&(a=2),t.write_shift(2,a),t.write_shift(1,e.underline||0),t.write_shift(1,e.family||0),t.write_shift(1,e.charset||0),t.write_shift(1,0),Nf(e.color,t);var s=0;return s=2,t.write_shift(1,s),mr(e.name,t),t.length>t.l?t.slice(0,t.l):t}var TE=["none","solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"],xg,EE=Fs;function Sv(e,t){t||(t=Ie(84)),xg||(xg=dp(TE));var a=xg[e.patternType];a==null&&(a=40),t.write_shift(4,a);var s=0;if(a!=40)for(Nf({auto:1},t),Nf({auto:1},t);s<12;++s)t.write_shift(4,0);else{for(;s<4;++s)t.write_shift(4,0);for(;s<12;++s)t.write_shift(4,0)}return t.length>t.l?t.slice(0,t.l):t}function CE(e,t){var a=e.l+t,s=e.read_shift(2),o=e.read_shift(2);return e.l=a,{ixfe:s,numFmtId:o}}function rw(e,t,a){a||(a=Ie(16)),a.write_shift(2,t||0),a.write_shift(2,e.numFmtId||0),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(1,0),a.write_shift(1,0);var s=0;return a.write_shift(1,s),a.write_shift(1,0),a.write_shift(1,0),a.write_shift(1,0),a}function Dd(e,t){return t||(t=Ie(10)),t.write_shift(1,0),t.write_shift(1,0),t.write_shift(4,0),t.write_shift(4,0),t}var AE=Fs;function OE(e,t){return t||(t=Ie(51)),t.write_shift(1,0),Dd(null,t),Dd(null,t),Dd(null,t),Dd(null,t),Dd(null,t),t.length>t.l?t.slice(0,t.l):t}function LE(e,t){return t||(t=Ie(52)),t.write_shift(4,e.xfId),t.write_shift(2,1),t.write_shift(1,0),t.write_shift(1,0),kf(e.name||"",t),t.length>t.l?t.slice(0,t.l):t}function ME(e,t,a){var s=Ie(2052);return s.write_shift(4,e),kf(t,s),kf(a,s),s.length>s.l?s.slice(0,s.l):s}function DE(e,t){if(t){var a=0;[[5,8],[23,26],[41,44],[50,392]].forEach(function(s){for(var o=s[0];o<=s[1];++o)t[o]!=null&&++a}),a!=0&&(Xe(e,615,fs(a)),[[5,8],[23,26],[41,44],[50,392]].forEach(function(s){for(var o=s[0];o<=s[1];++o)t[o]!=null&&Xe(e,44,NE(o,t[o]))}),Xe(e,616))}}function RE(e){var t=1;Xe(e,611,fs(t)),Xe(e,43,jE({sz:12,color:{theme:1},name:"Calibri",family:2})),Xe(e,612)}function PE(e){var t=2;Xe(e,603,fs(t)),Xe(e,45,Sv({patternType:"none"})),Xe(e,45,Sv({patternType:"gray125"})),Xe(e,604)}function FE(e){var t=1;Xe(e,613,fs(t)),Xe(e,46,OE()),Xe(e,614)}function IE(e){var t=1;Xe(e,626,fs(t)),Xe(e,47,rw({numFmtId:0},65535)),Xe(e,627)}function BE(e,t){Xe(e,617,fs(t.length)),t.forEach(function(a){Xe(e,47,rw(a,0))}),Xe(e,618)}function zE(e){var t=1;Xe(e,619,fs(t)),Xe(e,48,LE({xfId:0,name:"Normal"})),Xe(e,620)}function UE(e){var t=0;Xe(e,505,fs(t)),Xe(e,506)}function HE(e){var t=0;Xe(e,508,ME(t,"TableStyleMedium9","PivotStyleMedium4")),Xe(e,509)}function $E(e,t){var a=nn();return Xe(a,278),DE(a,e.SSF),RE(a),PE(a),FE(a),IE(a),BE(a,t.cellXfs),zE(a),UE(a),HE(a),Xe(a,279),a.end()}function nw(e,t){if(t&&t.themeXLSX)return t.themeXLSX;if(e&&typeof e.raw=="string")return e.raw;var a=[nr];return a[a.length]='<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">',a[a.length]="<a:themeElements>",a[a.length]='<a:clrScheme name="Office">',a[a.length]='<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1>',a[a.length]='<a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>',a[a.length]='<a:dk2><a:srgbClr val="1F497D"/></a:dk2>',a[a.length]='<a:lt2><a:srgbClr val="EEECE1"/></a:lt2>',a[a.length]='<a:accent1><a:srgbClr val="4F81BD"/></a:accent1>',a[a.length]='<a:accent2><a:srgbClr val="C0504D"/></a:accent2>',a[a.length]='<a:accent3><a:srgbClr val="9BBB59"/></a:accent3>',a[a.length]='<a:accent4><a:srgbClr val="8064A2"/></a:accent4>',a[a.length]='<a:accent5><a:srgbClr val="4BACC6"/></a:accent5>',a[a.length]='<a:accent6><a:srgbClr val="F79646"/></a:accent6>',a[a.length]='<a:hlink><a:srgbClr val="0000FF"/></a:hlink>',a[a.length]='<a:folHlink><a:srgbClr val="800080"/></a:folHlink>',a[a.length]="</a:clrScheme>",a[a.length]='<a:fontScheme name="Office">',a[a.length]="<a:majorFont>",a[a.length]='<a:latin typeface="Cambria"/>',a[a.length]='<a:ea typeface=""/>',a[a.length]='<a:cs typeface=""/>',a[a.length]='<a:font script="Jpan" typeface=" Pゴシック"/>',a[a.length]='<a:font script="Hang" typeface="맑은 고딕"/>',a[a.length]='<a:font script="Hans" typeface="宋体"/>',a[a.length]='<a:font script="Hant" typeface="新細明體"/>',a[a.length]='<a:font script="Arab" typeface="Times New Roman"/>',a[a.length]='<a:font script="Hebr" typeface="Times New Roman"/>',a[a.length]='<a:font script="Thai" typeface="Tahoma"/>',a[a.length]='<a:font script="Ethi" typeface="Nyala"/>',a[a.length]='<a:font script="Beng" typeface="Vrinda"/>',a[a.length]='<a:font script="Gujr" typeface="Shruti"/>',a[a.length]='<a:font script="Khmr" typeface="MoolBoran"/>',a[a.length]='<a:font script="Knda" typeface="Tunga"/>',a[a.length]='<a:font script="Guru" typeface="Raavi"/>',a[a.length]='<a:font script="Cans" typeface="Euphemia"/>',a[a.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',a[a.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',a[a.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',a[a.length]='<a:font script="Thaa" typeface="MV Boli"/>',a[a.length]='<a:font script="Deva" typeface="Mangal"/>',a[a.length]='<a:font script="Telu" typeface="Gautami"/>',a[a.length]='<a:font script="Taml" typeface="Latha"/>',a[a.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',a[a.length]='<a:font script="Orya" typeface="Kalinga"/>',a[a.length]='<a:font script="Mlym" typeface="Kartika"/>',a[a.length]='<a:font script="Laoo" typeface="DokChampa"/>',a[a.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',a[a.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',a[a.length]='<a:font script="Viet" typeface="Times New Roman"/>',a[a.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',a[a.length]='<a:font script="Geor" typeface="Sylfaen"/>',a[a.length]="</a:majorFont>",a[a.length]="<a:minorFont>",a[a.length]='<a:latin typeface="Calibri"/>',a[a.length]='<a:ea typeface=""/>',a[a.length]='<a:cs typeface=""/>',a[a.length]='<a:font script="Jpan" typeface=" Pゴシック"/>',a[a.length]='<a:font script="Hang" typeface="맑은 고딕"/>',a[a.length]='<a:font script="Hans" typeface="宋体"/>',a[a.length]='<a:font script="Hant" typeface="新細明體"/>',a[a.length]='<a:font script="Arab" typeface="Arial"/>',a[a.length]='<a:font script="Hebr" typeface="Arial"/>',a[a.length]='<a:font script="Thai" typeface="Tahoma"/>',a[a.length]='<a:font script="Ethi" typeface="Nyala"/>',a[a.length]='<a:font script="Beng" typeface="Vrinda"/>',a[a.length]='<a:font script="Gujr" typeface="Shruti"/>',a[a.length]='<a:font script="Khmr" typeface="DaunPenh"/>',a[a.length]='<a:font script="Knda" typeface="Tunga"/>',a[a.length]='<a:font script="Guru" typeface="Raavi"/>',a[a.length]='<a:font script="Cans" typeface="Euphemia"/>',a[a.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',a[a.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',a[a.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',a[a.length]='<a:font script="Thaa" typeface="MV Boli"/>',a[a.length]='<a:font script="Deva" typeface="Mangal"/>',a[a.length]='<a:font script="Telu" typeface="Gautami"/>',a[a.length]='<a:font script="Taml" typeface="Latha"/>',a[a.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',a[a.length]='<a:font script="Orya" typeface="Kalinga"/>',a[a.length]='<a:font script="Mlym" typeface="Kartika"/>',a[a.length]='<a:font script="Laoo" typeface="DokChampa"/>',a[a.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',a[a.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',a[a.length]='<a:font script="Viet" typeface="Arial"/>',a[a.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',a[a.length]='<a:font script="Geor" typeface="Sylfaen"/>',a[a.length]="</a:minorFont>",a[a.length]="</a:fontScheme>",a[a.length]='<a:fmtScheme name="Office">',a[a.length]="<a:fillStyleLst>",a[a.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:lin ang="16200000" scaled="1"/>',a[a.length]="</a:gradFill>",a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="100000"/><a:shade val="100000"/><a:satMod val="130000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="50000"/><a:shade val="100000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:lin ang="16200000" scaled="0"/>',a[a.length]="</a:gradFill>",a[a.length]="</a:fillStyleLst>",a[a.length]="<a:lnStyleLst>",a[a.length]='<a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln>',a[a.length]='<a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>',a[a.length]='<a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>',a[a.length]="</a:lnStyleLst>",a[a.length]="<a:effectStyleLst>",a[a.length]="<a:effectStyle>",a[a.length]="<a:effectLst>",a[a.length]='<a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw>',a[a.length]="</a:effectLst>",a[a.length]="</a:effectStyle>",a[a.length]="<a:effectStyle>",a[a.length]="<a:effectLst>",a[a.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',a[a.length]="</a:effectLst>",a[a.length]="</a:effectStyle>",a[a.length]="<a:effectStyle>",a[a.length]="<a:effectLst>",a[a.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',a[a.length]="</a:effectLst>",a[a.length]='<a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0"/></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000"/></a:lightRig></a:scene3d>',a[a.length]='<a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d>',a[a.length]="</a:effectStyle>",a[a.length]="</a:effectStyleLst>",a[a.length]="<a:bgFillStyleLst>",a[a.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path>',a[a.length]="</a:gradFill>",a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>',a[a.length]="</a:gradFill>",a[a.length]="</a:bgFillStyleLst>",a[a.length]="</a:fmtScheme>",a[a.length]="</a:themeElements>",a[a.length]="<a:objectDefaults>",a[a.length]="<a:spDef>",a[a.length]='<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="1"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="3"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="2"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1"/></a:fontRef></a:style>',a[a.length]="</a:spDef>",a[a.length]="<a:lnDef>",a[a.length]='<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="2"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1"/></a:fontRef></a:style>',a[a.length]="</a:lnDef>",a[a.length]="</a:objectDefaults>",a[a.length]="<a:extraClrSchemeLst/>",a[a.length]="</a:theme>",a.join("")}function WE(e,t){return{flags:e.read_shift(4),version:e.read_shift(4),name:Mr(e)}}function VE(e){var t=Ie(12+2*e.name.length);return t.write_shift(4,e.flags),t.write_shift(4,e.version),mr(e.name,t),t.slice(0,t.l)}function GE(e){for(var t=[],a=e.read_shift(4);a-- >0;)t.push([e.read_shift(4),e.read_shift(4)]);return t}function ZE(e){var t=Ie(4+8*e.length);t.write_shift(4,e.length);for(var a=0;a<e.length;++a)t.write_shift(4,e[a][0]),t.write_shift(4,e[a][1]);return t}function qE(e,t){var a=Ie(8+2*t.length);return a.write_shift(4,e),mr(t,a),a.slice(0,a.l)}function YE(e){return e.l+=4,e.read_shift(4)!=0}function XE(e,t){var a=Ie(8);return a.write_shift(4,e),a.write_shift(4,1),a}function KE(){var e=nn();return Xe(e,332),Xe(e,334,fs(1)),Xe(e,335,VE({name:"XLDAPR",version:12e4,flags:3496657072})),Xe(e,336),Xe(e,339,qE(1,"XLDAPR")),Xe(e,52),Xe(e,35,fs(514)),Xe(e,4096,fs(0)),Xe(e,4097,Hn(1)),Xe(e,36),Xe(e,53),Xe(e,340),Xe(e,337,XE(1)),Xe(e,51,ZE([[1,0]])),Xe(e,338),Xe(e,333),e.end()}function sw(){var e=[nr];return e.push(`<metadata xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xlrd="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata" xmlns:xda="http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray">
<metadataTypes count="1">
<metadataType name="XLDAPR" minSupportedVersion="120000" copy="1" pasteAll="1" pasteValues="1" merge="1" splitFirst="1" rowColShift="1" clearFormats="1" clearComments="1" assign="1" coerce="1" cellMeta="1"/>
</metadataTypes>
<futureMetadata name="XLDAPR" count="1">
<bk>
<extLst>
<ext uri="{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}">
<xda:dynamicArrayProperties fDynamic="1" fCollapsed="0"/>
</ext>
</extLst>
</bk>
</futureMetadata>
<cellMetadata count="1">
<bk>
<rc t="1" v="0"/>
</bk>
</cellMetadata>
</metadata>`),e.join("")}function JE(e){var t={};t.i=e.read_shift(4);var a={};a.r=e.read_shift(4),a.c=e.read_shift(4),t.r=xa(a);var s=e.read_shift(1);return s&2&&(t.l="1"),s&8&&(t.a="1"),t}var ic=1024;function iw(e,t){for(var a=[21600,21600],s=["m0,0l0",a[1],a[0],a[1],a[0],"0xe"].join(","),o=[rt("xml",null,{"xmlns:v":Nn.v,"xmlns:o":Nn.o,"xmlns:x":Nn.x,"xmlns:mv":Nn.mv}).replace(/\/>/,">"),rt("o:shapelayout",rt("o:idmap",null,{"v:ext":"edit",data:e}),{"v:ext":"edit"}),rt("v:shapetype",[rt("v:stroke",null,{joinstyle:"miter"}),rt("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:a.join(","),path:s})];ic<e*1e3;)ic+=1e3;return t.forEach(function(u){var c=hr(u[0]),f={color2:"#BEFF82",type:"gradient"};f.type=="gradient"&&(f.angle="-180");var p=f.type=="gradient"?rt("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}):null,g=rt("v:fill",p,f),x={on:"t",obscured:"t"};++ic,o=o.concat(["<v:shape"+Qd({id:"_x0000_s"+ic,type:"#_x0000_t202",style:"position:absolute; margin-left:80pt;margin-top:5pt;width:104pt;height:64pt;z-index:10"+(u[1].hidden?";visibility:hidden":""),fillcolor:"#ECFAD4",strokecolor:"#edeaa1"})+">",g,rt("v:shadow",null,x),rt("v:path",null,{"o:connecttype":"none"}),'<v:textbox><div style="text-align:left"></div></v:textbox>','<x:ClientData ObjectType="Note">',"<x:MoveWithCells/>","<x:SizeWithCells/>",Nr("x:Anchor",[c.c+1,0,c.r+1,0,c.c+3,20,c.r+5,20].join(",")),Nr("x:AutoFill","False"),Nr("x:Row",String(c.r)),Nr("x:Column",String(c.c)),u[1].hidden?"":"<x:Visible/>","</x:ClientData>","</v:shape>"])}),o.push("</xml>"),o.join("")}function ow(e){var t=[nr,rt("comments",null,{xmlns:Tc[0]})],a=[];return t.push("<authors>"),e.forEach(function(s){s[1].forEach(function(o){var u=pa(o.a);a.indexOf(u)==-1&&(a.push(u),t.push("<author>"+u+"</author>")),o.T&&o.ID&&a.indexOf("tc="+o.ID)==-1&&(a.push("tc="+o.ID),t.push("<author>tc="+o.ID+"</author>"))})}),a.length==0&&(a.push("SheetJ5"),t.push("<author>SheetJ5</author>")),t.push("</authors>"),t.push("<commentList>"),e.forEach(function(s){var o=0,u=[];if(s[1][0]&&s[1][0].T&&s[1][0].ID?o=a.indexOf("tc="+s[1][0].ID):s[1].forEach(function(p){p.a&&(o=a.indexOf(pa(p.a))),u.push(p.t||"")}),t.push('<comment ref="'+s[0]+'" authorId="'+o+'"><text>'),u.length<=1)t.push(Nr("t",pa(u[0]||"")));else{for(var c=`Comment:
`+u[0]+`
`,f=1;f<u.length;++f)c+=`Reply:
`+u[f]+`
`;t.push(Nr("t",pa(c)))}t.push("</text></comment>")}),t.push("</commentList>"),t.length>2&&(t[t.length]="</comments>",t[1]=t[1].replace("/>",">")),t.join("")}function QE(e,t,a){var s=[nr,rt("ThreadedComments",null,{xmlns:fr.TCMNT}).replace(/[\/]>/,">")];return e.forEach(function(o){var u="";(o[1]||[]).forEach(function(c,f){if(!c.T){delete c.ID;return}c.a&&t.indexOf(c.a)==-1&&t.push(c.a);var p={ref:o[0],id:"{54EE7951-7262-4200-6969-"+("000000000000"+a.tcid++).slice(-12)+"}"};f==0?u=p.id:p.parentId=u,c.ID=p.id,c.a&&(p.personId="{54EE7950-7262-4200-6969-"+("000000000000"+t.indexOf(c.a)).slice(-12)+"}"),s.push(rt("threadedComment",Nr("text",c.t||""),p))})}),s.push("</ThreadedComments>"),s.join("")}function eC(e){var t=[nr,rt("personList",null,{xmlns:fr.TCMNT,"xmlns:x":Tc[0]}).replace(/[\/]>/,">")];return e.forEach(function(a,s){t.push(rt("person",null,{displayName:a,id:"{54EE7950-7262-4200-6969-"+("000000000000"+s).slice(-12)+"}",userId:a,providerId:"None"}))}),t.push("</personList>"),t.join("")}function tC(e){var t={};t.iauthor=e.read_shift(4);var a=ll(e);return t.rfx=a.s,t.ref=xa(a.s),e.l+=16,t}function aC(e,t){return t==null&&(t=Ie(36)),t.write_shift(4,e[1].iauthor),Cc(e[0],t),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(4,0),t}var rC=Mr;function nC(e){return mr(e.slice(0,54))}function sC(e){var t=nn(),a=[];return Xe(t,628),Xe(t,630),e.forEach(function(s){s[1].forEach(function(o){a.indexOf(o.a)>-1||(a.push(o.a.slice(0,54)),Xe(t,632,nC(o.a)))})}),Xe(t,631),Xe(t,633),e.forEach(function(s){s[1].forEach(function(o){o.iauthor=a.indexOf(o.a);var u={s:hr(s[0]),e:hr(s[0])};Xe(t,635,aC([u,o])),o.t&&o.t.length>0&&Xe(t,637,oT(o)),Xe(t,636),delete o.iauthor})}),Xe(t,634),Xe(t,629),t.end()}function iC(e,t){t.FullPaths.forEach(function(a,s){if(s!=0){var o=a.replace(/[^\/]*[\/]/,"/_VBA_PROJECT_CUR/");o.slice(-1)!=="/"&&Na.utils.cfb_add(e,o,t.FileIndex[s].content)}})}var lw=["xlsb","xlsm","xlam","biff8","xla"],oC=(function(){var e=/(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g,t={r:0,c:0};function a(s,o,u,c){var f=!1,p=!1;u.length==0?p=!0:u.charAt(0)=="["&&(p=!0,u=u.slice(1,-1)),c.length==0?f=!0:c.charAt(0)=="["&&(f=!0,c=c.slice(1,-1));var g=u.length>0?parseInt(u,10)|0:0,x=c.length>0?parseInt(c,10)|0:0;return f?x+=t.c:--x,p?g+=t.r:--g,o+(f?"":"$")+Lr(x)+(p?"":"$")+Sr(g)}return function(o,u){return t=u,o.replace(e,a)}})(),kp=/(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g,Np=(function(){return function(t,a){return t.replace(kp,function(s,o,u,c,f,p){var g=xp(c)-(u?0:a.c),x=pp(p)-(f?0:a.r),v=x==0?"":f?x+1:"["+x+"]",_=g==0?"":u?g+1:"["+g+"]";return o+"R"+v+"C"+_})}})();function lC(e,t){return e.replace(kp,function(a,s,o,u,c,f){return s+(o=="$"?o+u:Lr(xp(u)+t.c))+(c=="$"?c+f:Sr(pp(f)+t.r))})}function cC(e){return e.length!=1}function ar(e){e.l+=1}function ao(e,t){var a=e.read_shift(2);return[a&16383,a>>14&1,a>>15&1]}function cw(e,t,a){var s=2;if(a){if(a.biff>=2&&a.biff<=5)return dw(e);a.biff==12&&(s=4)}var o=e.read_shift(s),u=e.read_shift(s),c=ao(e),f=ao(e);return{s:{r:o,c:c[0],cRel:c[1],rRel:c[2]},e:{r:u,c:f[0],cRel:f[1],rRel:f[2]}}}function dw(e){var t=ao(e),a=ao(e),s=e.read_shift(1),o=e.read_shift(1);return{s:{r:t[0],c:s,cRel:t[1],rRel:t[2]},e:{r:a[0],c:o,cRel:a[1],rRel:a[2]}}}function dC(e,t,a){if(a.biff<8)return dw(e);var s=e.read_shift(a.biff==12?4:2),o=e.read_shift(a.biff==12?4:2),u=ao(e),c=ao(e);return{s:{r:s,c:u[0],cRel:u[1],rRel:u[2]},e:{r:o,c:c[0],cRel:c[1],rRel:c[2]}}}function uw(e,t,a){if(a&&a.biff>=2&&a.biff<=5)return uC(e);var s=e.read_shift(a&&a.biff==12?4:2),o=ao(e);return{r:s,c:o[0],cRel:o[1],rRel:o[2]}}function uC(e){var t=ao(e),a=e.read_shift(1);return{r:t[0],c:a,cRel:t[1],rRel:t[2]}}function fC(e){var t=e.read_shift(2),a=e.read_shift(2);return{r:t,c:a&255,fQuoted:!!(a&16384),cRel:a>>15,rRel:a>>15}}function hC(e,t,a){var s=a&&a.biff?a.biff:8;if(s>=2&&s<=5)return mC(e);var o=e.read_shift(s>=12?4:2),u=e.read_shift(2),c=(u&16384)>>14,f=(u&32768)>>15;if(u&=16383,f==1)for(;o>524287;)o-=1048576;if(c==1)for(;u>8191;)u=u-16384;return{r:o,c:u,cRel:c,rRel:f}}function mC(e){var t=e.read_shift(2),a=e.read_shift(1),s=(t&32768)>>15,o=(t&16384)>>14;return t&=16383,s==1&&t>=8192&&(t=t-16384),o==1&&a>=128&&(a=a-256),{r:t,c:a,cRel:o,rRel:s}}function gC(e,t,a){var s=(e[e.l++]&96)>>5,o=cw(e,a.biff>=2&&a.biff<=5?6:8,a);return[s,o]}function pC(e,t,a){var s=(e[e.l++]&96)>>5,o=e.read_shift(2,"i"),u=8;if(a)switch(a.biff){case 5:e.l+=12,u=6;break;case 12:u=12;break}var c=cw(e,u,a);return[s,o,c]}function xC(e,t,a){var s=(e[e.l++]&96)>>5;return e.l+=a&&a.biff>8?12:a.biff<8?6:8,[s]}function yC(e,t,a){var s=(e[e.l++]&96)>>5,o=e.read_shift(2),u=8;if(a)switch(a.biff){case 5:e.l+=12,u=6;break;case 12:u=12;break}return e.l+=u,[s,o]}function bC(e,t,a){var s=(e[e.l++]&96)>>5,o=dC(e,t-1,a);return[s,o]}function vC(e,t,a){var s=(e[e.l++]&96)>>5;return e.l+=a.biff==2?6:a.biff==12?14:7,[s]}function jv(e){var t=e[e.l+1]&1,a=1;return e.l+=4,[t,a]}function _C(e,t,a){e.l+=2;for(var s=e.read_shift(a&&a.biff==2?1:2),o=[],u=0;u<=s;++u)o.push(e.read_shift(a&&a.biff==2?1:2));return o}function wC(e,t,a){var s=e[e.l+1]&255?1:0;return e.l+=2,[s,e.read_shift(a&&a.biff==2?1:2)]}function kC(e,t,a){var s=e[e.l+1]&255?1:0;return e.l+=2,[s,e.read_shift(a&&a.biff==2?1:2)]}function NC(e){var t=e[e.l+1]&255?1:0;return e.l+=2,[t,e.read_shift(2)]}function SC(e,t,a){var s=e[e.l+1]&255?1:0;return e.l+=a&&a.biff==2?3:4,[s]}function fw(e){var t=e.read_shift(1),a=e.read_shift(1);return[t,a]}function jC(e){return e.read_shift(2),fw(e)}function TC(e){return e.read_shift(2),fw(e)}function EC(e,t,a){var s=(e[e.l]&96)>>5;e.l+=1;var o=uw(e,0,a);return[s,o]}function CC(e,t,a){var s=(e[e.l]&96)>>5;e.l+=1;var o=hC(e,0,a);return[s,o]}function AC(e,t,a){var s=(e[e.l]&96)>>5;e.l+=1;var o=e.read_shift(2);a&&a.biff==5&&(e.l+=12);var u=uw(e,0,a);return[s,o,u]}function OC(e,t,a){var s=(e[e.l]&96)>>5;e.l+=1;var o=e.read_shift(a&&a.biff<=3?1:2);return[O8[o],gw[o],s]}function LC(e,t,a){var s=e[e.l++],o=e.read_shift(1),u=a&&a.biff<=3?[s==88?-1:0,e.read_shift(1)]:MC(e);return[o,(u[0]===0?gw:A8)[u[1]]]}function MC(e){return[e[e.l+1]>>7,e.read_shift(2)&32767]}function DC(e,t,a){e.l+=a&&a.biff==2?3:4}function RC(e,t,a){if(e.l++,a&&a.biff==12)return[e.read_shift(4,"i"),0];var s=e.read_shift(2),o=e.read_shift(a&&a.biff==2?1:2);return[s,o]}function PC(e){return e.l++,pu[e.read_shift(1)]}function FC(e){return e.l++,e.read_shift(2)}function IC(e){return e.l++,e.read_shift(1)!==0}function BC(e){return e.l++,Ac(e)}function zC(e,t,a){return e.l++,q2(e,t-1,a)}function UC(e,t){var a=[e.read_shift(1)];if(t==12)switch(a[0]){case 2:a[0]=4;break;case 4:a[0]=16;break;case 0:a[0]=1;break;case 1:a[0]=2;break}switch(a[0]){case 4:a[1]=AT(e,1)?"TRUE":"FALSE",t!=12&&(e.l+=7);break;case 37:case 16:a[1]=pu[e[e.l]],e.l+=t==12?4:8;break;case 0:e.l+=8;break;case 1:a[1]=Ac(e);break;case 2:a[1]=DT(e,0,{biff:t>0&&t<8?2:t});break;default:throw new Error("Bad SerAr: "+a[0])}return a}function HC(e,t,a){for(var s=e.read_shift(a.biff==12?4:2),o=[],u=0;u!=s;++u)o.push((a.biff==12?ll:FT)(e));return o}function $C(e,t,a){var s=0,o=0;a.biff==12?(s=e.read_shift(4),o=e.read_shift(4)):(o=1+e.read_shift(1),s=1+e.read_shift(2)),a.biff>=2&&a.biff<8&&(--s,--o==0&&(o=256));for(var u=0,c=[];u!=s&&(c[u]=[]);++u)for(var f=0;f!=o;++f)c[u][f]=UC(e,a.biff);return c}function WC(e,t,a){var s=e.read_shift(1)>>>5&3,o=!a||a.biff>=8?4:2,u=e.read_shift(o);switch(a.biff){case 2:e.l+=5;break;case 3:case 4:e.l+=8;break;case 5:e.l+=12;break}return[s,0,u]}function VC(e,t,a){if(a.biff==5)return GC(e);var s=e.read_shift(1)>>>5&3,o=e.read_shift(2),u=e.read_shift(4);return[s,o,u]}function GC(e){var t=e.read_shift(1)>>>5&3,a=e.read_shift(2,"i");e.l+=8;var s=e.read_shift(2);return e.l+=12,[t,a,s]}function ZC(e,t,a){var s=e.read_shift(1)>>>5&3;e.l+=a&&a.biff==2?3:4;var o=e.read_shift(a&&a.biff==2?1:2);return[s,o]}function qC(e,t,a){var s=e.read_shift(1)>>>5&3,o=e.read_shift(a&&a.biff==2?1:2);return[s,o]}function YC(e,t,a){var s=e.read_shift(1)>>>5&3;return e.l+=4,a.biff<8&&e.l--,a.biff==12&&(e.l+=2),[s]}function XC(e,t,a){var s=(e[e.l++]&96)>>5,o=e.read_shift(2),u=4;if(a)switch(a.biff){case 5:u=15;break;case 12:u=6;break}return e.l+=u,[s,o]}var KC=Fs,JC=Fs,QC=Fs;function xu(e,t,a){return e.l+=2,[fC(e)]}function Sp(e){return e.l+=6,[]}var e8=xu,t8=Sp,a8=Sp,r8=xu;function hw(e){return e.l+=2,[G2(e),e.read_shift(2)&1]}var n8=xu,s8=hw,i8=Sp,o8=xu,l8=xu,c8=["Data","All","Headers","??","?Data2","??","?DataHeaders","??","Totals","??","??","??","?DataTotals","??","??","??","?Current"];function d8(e){e.l+=2;var t=e.read_shift(2),a=e.read_shift(2),s=e.read_shift(4),o=e.read_shift(2),u=e.read_shift(2),c=c8[a>>2&31];return{ixti:t,coltype:a&3,rt:c,idx:s,c:o,C:u}}function u8(e){return e.l+=2,[e.read_shift(4)]}function f8(e,t,a){return e.l+=5,e.l+=2,e.l+=a.biff==2?1:4,["PTGSHEET"]}function h8(e,t,a){return e.l+=a.biff==2?4:5,["PTGENDSHEET"]}function m8(e){var t=e.read_shift(1)>>>5&3,a=e.read_shift(2);return[t,a]}function g8(e){var t=e.read_shift(1)>>>5&3,a=e.read_shift(2);return[t,a]}function p8(e){return e.l+=4,[0,0]}var Tv={1:{n:"PtgExp",f:RC},2:{n:"PtgTbl",f:QC},3:{n:"PtgAdd",f:ar},4:{n:"PtgSub",f:ar},5:{n:"PtgMul",f:ar},6:{n:"PtgDiv",f:ar},7:{n:"PtgPower",f:ar},8:{n:"PtgConcat",f:ar},9:{n:"PtgLt",f:ar},10:{n:"PtgLe",f:ar},11:{n:"PtgEq",f:ar},12:{n:"PtgGe",f:ar},13:{n:"PtgGt",f:ar},14:{n:"PtgNe",f:ar},15:{n:"PtgIsect",f:ar},16:{n:"PtgUnion",f:ar},17:{n:"PtgRange",f:ar},18:{n:"PtgUplus",f:ar},19:{n:"PtgUminus",f:ar},20:{n:"PtgPercent",f:ar},21:{n:"PtgParen",f:ar},22:{n:"PtgMissArg",f:ar},23:{n:"PtgStr",f:zC},26:{n:"PtgSheet",f:f8},27:{n:"PtgEndSheet",f:h8},28:{n:"PtgErr",f:PC},29:{n:"PtgBool",f:IC},30:{n:"PtgInt",f:FC},31:{n:"PtgNum",f:BC},32:{n:"PtgArray",f:vC},33:{n:"PtgFunc",f:OC},34:{n:"PtgFuncVar",f:LC},35:{n:"PtgName",f:WC},36:{n:"PtgRef",f:EC},37:{n:"PtgArea",f:gC},38:{n:"PtgMemArea",f:ZC},39:{n:"PtgMemErr",f:KC},40:{n:"PtgMemNoMem",f:JC},41:{n:"PtgMemFunc",f:qC},42:{n:"PtgRefErr",f:YC},43:{n:"PtgAreaErr",f:xC},44:{n:"PtgRefN",f:CC},45:{n:"PtgAreaN",f:bC},46:{n:"PtgMemAreaN",f:m8},47:{n:"PtgMemNoMemN",f:g8},57:{n:"PtgNameX",f:VC},58:{n:"PtgRef3d",f:AC},59:{n:"PtgArea3d",f:pC},60:{n:"PtgRefErr3d",f:XC},61:{n:"PtgAreaErr3d",f:yC},255:{}},x8={64:32,96:32,65:33,97:33,66:34,98:34,67:35,99:35,68:36,100:36,69:37,101:37,70:38,102:38,71:39,103:39,72:40,104:40,73:41,105:41,74:42,106:42,75:43,107:43,76:44,108:44,77:45,109:45,78:46,110:46,79:47,111:47,88:34,120:34,89:57,121:57,90:58,122:58,91:59,123:59,92:60,124:60,93:61,125:61},y8={1:{n:"PtgElfLel",f:hw},2:{n:"PtgElfRw",f:o8},3:{n:"PtgElfCol",f:e8},6:{n:"PtgElfRwV",f:l8},7:{n:"PtgElfColV",f:r8},10:{n:"PtgElfRadical",f:n8},11:{n:"PtgElfRadicalS",f:i8},13:{n:"PtgElfColS",f:t8},15:{n:"PtgElfColSV",f:a8},16:{n:"PtgElfRadicalLel",f:s8},25:{n:"PtgList",f:d8},29:{n:"PtgSxName",f:u8},255:{}},b8={0:{n:"PtgAttrNoop",f:p8},1:{n:"PtgAttrSemi",f:SC},2:{n:"PtgAttrIf",f:kC},4:{n:"PtgAttrChoose",f:_C},8:{n:"PtgAttrGoto",f:wC},16:{n:"PtgAttrSum",f:DC},32:{n:"PtgAttrBaxcel",f:jv},33:{n:"PtgAttrBaxcel",f:jv},64:{n:"PtgAttrSpace",f:jC},65:{n:"PtgAttrSpaceSemi",f:TC},128:{n:"PtgAttrIfError",f:NC},255:{}};function v8(e,t,a,s){if(s.biff<8)return Fs(e,t);for(var o=e.l+t,u=[],c=0;c!==a.length;++c)switch(a[c][0]){case"PtgArray":a[c][1]=$C(e,0,s),u.push(a[c][1]);break;case"PtgMemArea":a[c][2]=HC(e,a[c][1],s),u.push(a[c][2]);break;case"PtgExp":s&&s.biff==12&&(a[c][1][1]=e.read_shift(4),u.push(a[c][1]));break;case"PtgList":case"PtgElfRadicalS":case"PtgElfColS":case"PtgElfColSV":throw"Unsupported "+a[c][0]}return t=o-e.l,t!==0&&u.push(Fs(e,t)),u}function _8(e,t,a){for(var s=e.l+t,o,u,c=[];s!=e.l;)t=s-e.l,u=e[e.l],o=Tv[u]||Tv[x8[u]],(u===24||u===25)&&(o=(u===24?y8:b8)[e[e.l+1]]),!o||!o.f?Fs(e,t):c.push([o.n,o.f(e,t,a)]);return c}function w8(e){for(var t=[],a=0;a<e.length;++a){for(var s=e[a],o=[],u=0;u<s.length;++u){var c=s[u];if(c)switch(c[0]){case 2:o.push('"'+c[1].replace(/"/g,'""')+'"');break;default:o.push(c[1])}else o.push("")}t.push(o.join(","))}return t.join(";")}var k8={PtgAdd:"+",PtgConcat:"&",PtgDiv:"/",PtgEq:"=",PtgGe:">=",PtgGt:">",PtgLe:"<=",PtgLt:"<",PtgMul:"*",PtgNe:"<>",PtgPower:"^",PtgSub:"-"};function N8(e,t){if(!e&&!(t&&t.biff<=5&&t.biff>=2))throw new Error("empty sheet name");return/[^\w\u4E00-\u9FFF\u3040-\u30FF]/.test(e)?"'"+e+"'":e}function mw(e,t,a){if(!e)return"SH33TJSERR0";if(a.biff>8&&(!e.XTI||!e.XTI[t]))return e.SheetNames[t];if(!e.XTI)return"SH33TJSERR6";var s=e.XTI[t];if(a.biff<8)return t>1e4&&(t-=65536),t<0&&(t=-t),t==0?"":e.XTI[t-1];if(!s)return"SH33TJSERR1";var o="";if(a.biff>8)switch(e[s[0]][0]){case 357:return o=s[1]==-1?"#REF":e.SheetNames[s[1]],s[1]==s[2]?o:o+":"+e.SheetNames[s[2]];case 358:return a.SID!=null?e.SheetNames[a.SID]:"SH33TJSSAME"+e[s[0]][0];case 355:default:return"SH33TJSSRC"+e[s[0]][0]}switch(e[s[0]][0][0]){case 1025:return o=s[1]==-1?"#REF":e.SheetNames[s[1]]||"SH33TJSERR3",s[1]==s[2]?o:o+":"+e.SheetNames[s[2]];case 14849:return e[s[0]].slice(1).map(function(u){return u.Name}).join(";;");default:return e[s[0]][0][3]?(o=s[1]==-1?"#REF":e[s[0]][0][3][s[1]]||"SH33TJSERR4",s[1]==s[2]?o:o+":"+e[s[0]][0][3][s[2]]):"SH33TJSERR2"}}function Ev(e,t,a){var s=mw(e,t,a);return s=="#REF"?s:N8(s,a)}function xc(e,t,a,s,o){var u=o&&o.biff||8,c={s:{c:0,r:0}},f=[],p,g,x,v=0,_=0,k,T="";if(!e[0]||!e[0][0])return"";for(var N=-1,j="",P=0,C=e[0].length;P<C;++P){var O=e[0][P];switch(O[0]){case"PtgUminus":f.push("-"+f.pop());break;case"PtgUplus":f.push("+"+f.pop());break;case"PtgPercent":f.push(f.pop()+"%");break;case"PtgAdd":case"PtgConcat":case"PtgDiv":case"PtgEq":case"PtgGe":case"PtgGt":case"PtgLe":case"PtgLt":case"PtgMul":case"PtgNe":case"PtgPower":case"PtgSub":if(p=f.pop(),g=f.pop(),N>=0){switch(e[0][N][1][0]){case 0:j=Va(" ",e[0][N][1][1]);break;case 1:j=Va("\r",e[0][N][1][1]);break;default:if(j="",o.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][N][1][0])}g=g+j,N=-1}f.push(g+k8[O[0]]+p);break;case"PtgIsect":p=f.pop(),g=f.pop(),f.push(g+" "+p);break;case"PtgUnion":p=f.pop(),g=f.pop(),f.push(g+","+p);break;case"PtgRange":p=f.pop(),g=f.pop(),f.push(g+":"+p);break;case"PtgAttrChoose":break;case"PtgAttrGoto":break;case"PtgAttrIf":break;case"PtgAttrIfError":break;case"PtgRef":x=$d(O[1][1],c,o),f.push(Wd(x,u));break;case"PtgRefN":x=a?$d(O[1][1],a,o):O[1][1],f.push(Wd(x,u));break;case"PtgRef3d":v=O[1][1],x=$d(O[1][2],c,o),T=Ev(s,v,o),f.push(T+"!"+Wd(x,u));break;case"PtgFunc":case"PtgFuncVar":var R=O[1][0],U=O[1][1];R||(R=0),R&=127;var H=R==0?[]:f.slice(-R);f.length-=R,U==="User"&&(U=H.shift()),f.push(U+"("+H.join(",")+")");break;case"PtgBool":f.push(O[1]?"TRUE":"FALSE");break;case"PtgInt":f.push(O[1]);break;case"PtgNum":f.push(String(O[1]));break;case"PtgStr":f.push('"'+O[1].replace(/"/g,'""')+'"');break;case"PtgErr":f.push(O[1]);break;case"PtgAreaN":k=fv(O[1][1],a?{s:a}:c,o),f.push(gg(k,o));break;case"PtgArea":k=fv(O[1][1],c,o),f.push(gg(k,o));break;case"PtgArea3d":v=O[1][1],k=O[1][2],T=Ev(s,v,o),f.push(T+"!"+gg(k,o));break;case"PtgAttrSum":f.push("SUM("+f.pop()+")");break;case"PtgAttrBaxcel":case"PtgAttrSemi":break;case"PtgName":_=O[1][2];var B=(s.names||[])[_-1]||(s[0]||[])[_],oe=B?B.Name:"SH33TJSNAME"+String(_);oe&&oe.slice(0,6)=="_xlfn."&&!o.xlfn&&(oe=oe.slice(6)),f.push(oe);break;case"PtgNameX":var se=O[1][1];_=O[1][2];var pe;if(o.biff<=5)se<0&&(se=-se),s[se]&&(pe=s[se][_]);else{var le="";if(((s[se]||[])[0]||[])[0]==14849||(((s[se]||[])[0]||[])[0]==1025?s[se][_]&&s[se][_].itab>0&&(le=s.SheetNames[s[se][_].itab-1]+"!"):le=s.SheetNames[_-1]+"!"),s[se]&&s[se][_])le+=s[se][_].Name;else if(s[0]&&s[0][_])le+=s[0][_].Name;else{var re=(mw(s,se,o)||"").split(";;");re[_-1]?le=re[_-1]:le+="SH33TJSERRX"}f.push(le);break}pe||(pe={Name:"SH33TJSERRY"}),f.push(pe.Name);break;case"PtgParen":var de="(",ye=")";if(N>=0){switch(j="",e[0][N][1][0]){case 2:de=Va(" ",e[0][N][1][1])+de;break;case 3:de=Va("\r",e[0][N][1][1])+de;break;case 4:ye=Va(" ",e[0][N][1][1])+ye;break;case 5:ye=Va("\r",e[0][N][1][1])+ye;break;default:if(o.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][N][1][0])}N=-1}f.push(de+f.pop()+ye);break;case"PtgRefErr":f.push("#REF!");break;case"PtgRefErr3d":f.push("#REF!");break;case"PtgExp":x={c:O[1][1],r:O[1][0]};var ue={c:a.c,r:a.r};if(s.sharedf[xa(x)]){var te=s.sharedf[xa(x)];f.push(xc(te,c,ue,s,o))}else{var V=!1;for(p=0;p!=s.arrayf.length;++p)if(g=s.arrayf[p],!(x.c<g[0].s.c||x.c>g[0].e.c)&&!(x.r<g[0].s.r||x.r>g[0].e.r)){f.push(xc(g[1],c,ue,s,o)),V=!0;break}V||f.push(O[1])}break;case"PtgArray":f.push("{"+w8(O[1])+"}");break;case"PtgMemArea":break;case"PtgAttrSpace":case"PtgAttrSpaceSemi":N=P;break;case"PtgTbl":break;case"PtgMemErr":break;case"PtgMissArg":f.push("");break;case"PtgAreaErr":f.push("#REF!");break;case"PtgAreaErr3d":f.push("#REF!");break;case"PtgList":f.push("Table"+O[1].idx+"[#"+O[1].rt+"]");break;case"PtgMemAreaN":case"PtgMemNoMemN":case"PtgAttrNoop":case"PtgSheet":case"PtgEndSheet":break;case"PtgMemFunc":break;case"PtgMemNoMem":break;case"PtgElfCol":case"PtgElfColS":case"PtgElfColSV":case"PtgElfColV":case"PtgElfLel":case"PtgElfRadical":case"PtgElfRadicalLel":case"PtgElfRadicalS":case"PtgElfRw":case"PtgElfRwV":throw new Error("Unsupported ELFs");case"PtgSxName":throw new Error("Unrecognized Formula Token: "+String(O));default:throw new Error("Unrecognized Formula Token: "+String(O))}var J=["PtgAttrSpace","PtgAttrSpaceSemi","PtgAttrGoto"];if(o.biff!=3&&N>=0&&J.indexOf(e[0][P][0])==-1){O=e[0][N];var ne=!0;switch(O[1][0]){case 4:ne=!1;case 0:j=Va(" ",O[1][1]);break;case 5:ne=!1;case 1:j=Va("\r",O[1][1]);break;default:if(j="",o.WTF)throw new Error("Unexpected PtgAttrSpaceType "+O[1][0])}f.push((ne?j:"")+f.pop()+(ne?"":j)),N=-1}}if(f.length>1&&o.WTF)throw new Error("bad formula stack");return f[0]}function S8(e){if(e==null){var t=Ie(8);return t.write_shift(1,3),t.write_shift(1,0),t.write_shift(2,0),t.write_shift(2,0),t.write_shift(2,65535),t}else if(typeof e=="number")return el(e);return el(0)}function j8(e,t,a,s,o){var u=tl(t,a,o),c=S8(e.v),f=Ie(6),p=33;f.write_shift(2,p),f.write_shift(4,0);for(var g=Ie(e.bf.length),x=0;x<e.bf.length;++x)g[x]=e.bf[x];var v=kr([u,c,f,g]);return v}function Zf(e,t,a){var s=e.read_shift(4),o=_8(e,s,a),u=e.read_shift(4),c=u>0?v8(e,u,o,a):null;return[o,c]}var T8=Zf,qf=Zf,E8=Zf,C8=Zf,A8={0:"BEEP",1:"OPEN",2:"OPEN.LINKS",3:"CLOSE.ALL",4:"SAVE",5:"SAVE.AS",6:"FILE.DELETE",7:"PAGE.SETUP",8:"PRINT",9:"PRINTER.SETUP",10:"QUIT",11:"NEW.WINDOW",12:"ARRANGE.ALL",13:"WINDOW.SIZE",14:"WINDOW.MOVE",15:"FULL",16:"CLOSE",17:"RUN",22:"SET.PRINT.AREA",23:"SET.PRINT.TITLES",24:"SET.PAGE.BREAK",25:"REMOVE.PAGE.BREAK",26:"FONT",27:"DISPLAY",28:"PROTECT.DOCUMENT",29:"PRECISION",30:"A1.R1C1",31:"CALCULATE.NOW",32:"CALCULATION",34:"DATA.FIND",35:"EXTRACT",36:"DATA.DELETE",37:"SET.DATABASE",38:"SET.CRITERIA",39:"SORT",40:"DATA.SERIES",41:"TABLE",42:"FORMAT.NUMBER",43:"ALIGNMENT",44:"STYLE",45:"BORDER",46:"CELL.PROTECTION",47:"COLUMN.WIDTH",48:"UNDO",49:"CUT",50:"COPY",51:"PASTE",52:"CLEAR",53:"PASTE.SPECIAL",54:"EDIT.DELETE",55:"INSERT",56:"FILL.RIGHT",57:"FILL.DOWN",61:"DEFINE.NAME",62:"CREATE.NAMES",63:"FORMULA.GOTO",64:"FORMULA.FIND",65:"SELECT.LAST.CELL",66:"SHOW.ACTIVE.CELL",67:"GALLERY.AREA",68:"GALLERY.BAR",69:"GALLERY.COLUMN",70:"GALLERY.LINE",71:"GALLERY.PIE",72:"GALLERY.SCATTER",73:"COMBINATION",74:"PREFERRED",75:"ADD.OVERLAY",76:"GRIDLINES",77:"SET.PREFERRED",78:"AXES",79:"LEGEND",80:"ATTACH.TEXT",81:"ADD.ARROW",82:"SELECT.CHART",83:"SELECT.PLOT.AREA",84:"PATTERNS",85:"MAIN.CHART",86:"OVERLAY",87:"SCALE",88:"FORMAT.LEGEND",89:"FORMAT.TEXT",90:"EDIT.REPEAT",91:"PARSE",92:"JUSTIFY",93:"HIDE",94:"UNHIDE",95:"WORKSPACE",96:"FORMULA",97:"FORMULA.FILL",98:"FORMULA.ARRAY",99:"DATA.FIND.NEXT",100:"DATA.FIND.PREV",101:"FORMULA.FIND.NEXT",102:"FORMULA.FIND.PREV",103:"ACTIVATE",104:"ACTIVATE.NEXT",105:"ACTIVATE.PREV",106:"UNLOCKED.NEXT",107:"UNLOCKED.PREV",108:"COPY.PICTURE",109:"SELECT",110:"DELETE.NAME",111:"DELETE.FORMAT",112:"VLINE",113:"HLINE",114:"VPAGE",115:"HPAGE",116:"VSCROLL",117:"HSCROLL",118:"ALERT",119:"NEW",120:"CANCEL.COPY",121:"SHOW.CLIPBOARD",122:"MESSAGE",124:"PASTE.LINK",125:"APP.ACTIVATE",126:"DELETE.ARROW",127:"ROW.HEIGHT",128:"FORMAT.MOVE",129:"FORMAT.SIZE",130:"FORMULA.REPLACE",131:"SEND.KEYS",132:"SELECT.SPECIAL",133:"APPLY.NAMES",134:"REPLACE.FONT",135:"FREEZE.PANES",136:"SHOW.INFO",137:"SPLIT",138:"ON.WINDOW",139:"ON.DATA",140:"DISABLE.INPUT",142:"OUTLINE",143:"LIST.NAMES",144:"FILE.CLOSE",145:"SAVE.WORKBOOK",146:"DATA.FORM",147:"COPY.CHART",148:"ON.TIME",149:"WAIT",150:"FORMAT.FONT",151:"FILL.UP",152:"FILL.LEFT",153:"DELETE.OVERLAY",155:"SHORT.MENUS",159:"SET.UPDATE.STATUS",161:"COLOR.PALETTE",162:"DELETE.STYLE",163:"WINDOW.RESTORE",164:"WINDOW.MAXIMIZE",166:"CHANGE.LINK",167:"CALCULATE.DOCUMENT",168:"ON.KEY",169:"APP.RESTORE",170:"APP.MOVE",171:"APP.SIZE",172:"APP.MINIMIZE",173:"APP.MAXIMIZE",174:"BRING.TO.FRONT",175:"SEND.TO.BACK",185:"MAIN.CHART.TYPE",186:"OVERLAY.CHART.TYPE",187:"SELECT.END",188:"OPEN.MAIL",189:"SEND.MAIL",190:"STANDARD.FONT",191:"CONSOLIDATE",192:"SORT.SPECIAL",193:"GALLERY.3D.AREA",194:"GALLERY.3D.COLUMN",195:"GALLERY.3D.LINE",196:"GALLERY.3D.PIE",197:"VIEW.3D",198:"GOAL.SEEK",199:"WORKGROUP",200:"FILL.GROUP",201:"UPDATE.LINK",202:"PROMOTE",203:"DEMOTE",204:"SHOW.DETAIL",206:"UNGROUP",207:"OBJECT.PROPERTIES",208:"SAVE.NEW.OBJECT",209:"SHARE",210:"SHARE.NAME",211:"DUPLICATE",212:"APPLY.STYLE",213:"ASSIGN.TO.OBJECT",214:"OBJECT.PROTECTION",215:"HIDE.OBJECT",216:"SET.EXTRACT",217:"CREATE.PUBLISHER",218:"SUBSCRIBE.TO",219:"ATTRIBUTES",220:"SHOW.TOOLBAR",222:"PRINT.PREVIEW",223:"EDIT.COLOR",224:"SHOW.LEVELS",225:"FORMAT.MAIN",226:"FORMAT.OVERLAY",227:"ON.RECALC",228:"EDIT.SERIES",229:"DEFINE.STYLE",240:"LINE.PRINT",243:"ENTER.DATA",249:"GALLERY.RADAR",250:"MERGE.STYLES",251:"EDITION.OPTIONS",252:"PASTE.PICTURE",253:"PASTE.PICTURE.LINK",254:"SPELLING",256:"ZOOM",259:"INSERT.OBJECT",260:"WINDOW.MINIMIZE",265:"SOUND.NOTE",266:"SOUND.PLAY",267:"FORMAT.SHAPE",268:"EXTEND.POLYGON",269:"FORMAT.AUTO",272:"GALLERY.3D.BAR",273:"GALLERY.3D.SURFACE",274:"FILL.AUTO",276:"CUSTOMIZE.TOOLBAR",277:"ADD.TOOL",278:"EDIT.OBJECT",279:"ON.DOUBLECLICK",280:"ON.ENTRY",281:"WORKBOOK.ADD",282:"WORKBOOK.MOVE",283:"WORKBOOK.COPY",284:"WORKBOOK.OPTIONS",285:"SAVE.WORKSPACE",288:"CHART.WIZARD",289:"DELETE.TOOL",290:"MOVE.TOOL",291:"WORKBOOK.SELECT",292:"WORKBOOK.ACTIVATE",293:"ASSIGN.TO.TOOL",295:"COPY.TOOL",296:"RESET.TOOL",297:"CONSTRAIN.NUMERIC",298:"PASTE.TOOL",302:"WORKBOOK.NEW",305:"SCENARIO.CELLS",306:"SCENARIO.DELETE",307:"SCENARIO.ADD",308:"SCENARIO.EDIT",309:"SCENARIO.SHOW",310:"SCENARIO.SHOW.NEXT",311:"SCENARIO.SUMMARY",312:"PIVOT.TABLE.WIZARD",313:"PIVOT.FIELD.PROPERTIES",314:"PIVOT.FIELD",315:"PIVOT.ITEM",316:"PIVOT.ADD.FIELDS",318:"OPTIONS.CALCULATION",319:"OPTIONS.EDIT",320:"OPTIONS.VIEW",321:"ADDIN.MANAGER",322:"MENU.EDITOR",323:"ATTACH.TOOLBARS",324:"VBAActivate",325:"OPTIONS.CHART",328:"VBA.INSERT.FILE",330:"VBA.PROCEDURE.DEFINITION",336:"ROUTING.SLIP",338:"ROUTE.DOCUMENT",339:"MAIL.LOGON",342:"INSERT.PICTURE",343:"EDIT.TOOL",344:"GALLERY.DOUGHNUT",350:"CHART.TREND",352:"PIVOT.ITEM.PROPERTIES",354:"WORKBOOK.INSERT",355:"OPTIONS.TRANSITION",356:"OPTIONS.GENERAL",370:"FILTER.ADVANCED",373:"MAIL.ADD.MAILER",374:"MAIL.DELETE.MAILER",375:"MAIL.REPLY",376:"MAIL.REPLY.ALL",377:"MAIL.FORWARD",378:"MAIL.NEXT.LETTER",379:"DATA.LABEL",380:"INSERT.TITLE",381:"FONT.PROPERTIES",382:"MACRO.OPTIONS",383:"WORKBOOK.HIDE",384:"WORKBOOK.UNHIDE",385:"WORKBOOK.DELETE",386:"WORKBOOK.NAME",388:"GALLERY.CUSTOM",390:"ADD.CHART.AUTOFORMAT",391:"DELETE.CHART.AUTOFORMAT",392:"CHART.ADD.DATA",393:"AUTO.OUTLINE",394:"TAB.ORDER",395:"SHOW.DIALOG",396:"SELECT.ALL",397:"UNGROUP.SHEETS",398:"SUBTOTAL.CREATE",399:"SUBTOTAL.REMOVE",400:"RENAME.OBJECT",412:"WORKBOOK.SCROLL",413:"WORKBOOK.NEXT",414:"WORKBOOK.PREV",415:"WORKBOOK.TAB.SPLIT",416:"FULL.SCREEN",417:"WORKBOOK.PROTECT",420:"SCROLLBAR.PROPERTIES",421:"PIVOT.SHOW.PAGES",422:"TEXT.TO.COLUMNS",423:"FORMAT.CHARTTYPE",424:"LINK.FORMAT",425:"TRACER.DISPLAY",430:"TRACER.NAVIGATE",431:"TRACER.CLEAR",432:"TRACER.ERROR",433:"PIVOT.FIELD.GROUP",434:"PIVOT.FIELD.UNGROUP",435:"CHECKBOX.PROPERTIES",436:"LABEL.PROPERTIES",437:"LISTBOX.PROPERTIES",438:"EDITBOX.PROPERTIES",439:"PIVOT.REFRESH",440:"LINK.COMBO",441:"OPEN.TEXT",442:"HIDE.DIALOG",443:"SET.DIALOG.FOCUS",444:"ENABLE.OBJECT",445:"PUSHBUTTON.PROPERTIES",446:"SET.DIALOG.DEFAULT",447:"FILTER",448:"FILTER.SHOW.ALL",449:"CLEAR.OUTLINE",450:"FUNCTION.WIZARD",451:"ADD.LIST.ITEM",452:"SET.LIST.ITEM",453:"REMOVE.LIST.ITEM",454:"SELECT.LIST.ITEM",455:"SET.CONTROL.VALUE",456:"SAVE.COPY.AS",458:"OPTIONS.LISTS.ADD",459:"OPTIONS.LISTS.DELETE",460:"SERIES.AXES",461:"SERIES.X",462:"SERIES.Y",463:"ERRORBAR.X",464:"ERRORBAR.Y",465:"FORMAT.CHART",466:"SERIES.ORDER",467:"MAIL.LOGOFF",468:"CLEAR.ROUTING.SLIP",469:"APP.ACTIVATE.MICROSOFT",470:"MAIL.EDIT.MAILER",471:"ON.SHEET",472:"STANDARD.WIDTH",473:"SCENARIO.MERGE",474:"SUMMARY.INFO",475:"FIND.FILE",476:"ACTIVE.CELL.FONT",477:"ENABLE.TIPWIZARD",478:"VBA.MAKE.ADDIN",480:"INSERTDATATABLE",481:"WORKGROUP.OPTIONS",482:"MAIL.SEND.MAILER",485:"AUTOCORRECT",489:"POST.DOCUMENT",491:"PICKLIST",493:"VIEW.SHOW",494:"VIEW.DEFINE",495:"VIEW.DELETE",509:"SHEET.BACKGROUND",510:"INSERT.MAP.OBJECT",511:"OPTIONS.MENONO",517:"MSOCHECKS",518:"NORMAL",519:"LAYOUT",520:"RM.PRINT.AREA",521:"CLEAR.PRINT.AREA",522:"ADD.PRINT.AREA",523:"MOVE.BRK",545:"HIDECURR.NOTE",546:"HIDEALL.NOTES",547:"DELETE.NOTE",548:"TRAVERSE.NOTES",549:"ACTIVATE.NOTES",620:"PROTECT.REVISIONS",621:"UNPROTECT.REVISIONS",647:"OPTIONS.ME",653:"WEB.PUBLISH",667:"NEWWEBQUERY",673:"PIVOT.TABLE.CHART",753:"OPTIONS.SAVE",755:"OPTIONS.SPELL",808:"HIDEALL.INKANNOTS"},gw={0:"COUNT",1:"IF",2:"ISNA",3:"ISERROR",4:"SUM",5:"AVERAGE",6:"MIN",7:"MAX",8:"ROW",9:"COLUMN",10:"NA",11:"NPV",12:"STDEV",13:"DOLLAR",14:"FIXED",15:"SIN",16:"COS",17:"TAN",18:"ATAN",19:"PI",20:"SQRT",21:"EXP",22:"LN",23:"LOG10",24:"ABS",25:"INT",26:"SIGN",27:"ROUND",28:"LOOKUP",29:"INDEX",30:"REPT",31:"MID",32:"LEN",33:"VALUE",34:"TRUE",35:"FALSE",36:"AND",37:"OR",38:"NOT",39:"MOD",40:"DCOUNT",41:"DSUM",42:"DAVERAGE",43:"DMIN",44:"DMAX",45:"DSTDEV",46:"VAR",47:"DVAR",48:"TEXT",49:"LINEST",50:"TREND",51:"LOGEST",52:"GROWTH",53:"GOTO",54:"HALT",55:"RETURN",56:"PV",57:"FV",58:"NPER",59:"PMT",60:"RATE",61:"MIRR",62:"IRR",63:"RAND",64:"MATCH",65:"DATE",66:"TIME",67:"DAY",68:"MONTH",69:"YEAR",70:"WEEKDAY",71:"HOUR",72:"MINUTE",73:"SECOND",74:"NOW",75:"AREAS",76:"ROWS",77:"COLUMNS",78:"OFFSET",79:"ABSREF",80:"RELREF",81:"ARGUMENT",82:"SEARCH",83:"TRANSPOSE",84:"ERROR",85:"STEP",86:"TYPE",87:"ECHO",88:"SET.NAME",89:"CALLER",90:"DEREF",91:"WINDOWS",92:"SERIES",93:"DOCUMENTS",94:"ACTIVE.CELL",95:"SELECTION",96:"RESULT",97:"ATAN2",98:"ASIN",99:"ACOS",100:"CHOOSE",101:"HLOOKUP",102:"VLOOKUP",103:"LINKS",104:"INPUT",105:"ISREF",106:"GET.FORMULA",107:"GET.NAME",108:"SET.VALUE",109:"LOG",110:"EXEC",111:"CHAR",112:"LOWER",113:"UPPER",114:"PROPER",115:"LEFT",116:"RIGHT",117:"EXACT",118:"TRIM",119:"REPLACE",120:"SUBSTITUTE",121:"CODE",122:"NAMES",123:"DIRECTORY",124:"FIND",125:"CELL",126:"ISERR",127:"ISTEXT",128:"ISNUMBER",129:"ISBLANK",130:"T",131:"N",132:"FOPEN",133:"FCLOSE",134:"FSIZE",135:"FREADLN",136:"FREAD",137:"FWRITELN",138:"FWRITE",139:"FPOS",140:"DATEVALUE",141:"TIMEVALUE",142:"SLN",143:"SYD",144:"DDB",145:"GET.DEF",146:"REFTEXT",147:"TEXTREF",148:"INDIRECT",149:"REGISTER",150:"CALL",151:"ADD.BAR",152:"ADD.MENU",153:"ADD.COMMAND",154:"ENABLE.COMMAND",155:"CHECK.COMMAND",156:"RENAME.COMMAND",157:"SHOW.BAR",158:"DELETE.MENU",159:"DELETE.COMMAND",160:"GET.CHART.ITEM",161:"DIALOG.BOX",162:"CLEAN",163:"MDETERM",164:"MINVERSE",165:"MMULT",166:"FILES",167:"IPMT",168:"PPMT",169:"COUNTA",170:"CANCEL.KEY",171:"FOR",172:"WHILE",173:"BREAK",174:"NEXT",175:"INITIATE",176:"REQUEST",177:"POKE",178:"EXECUTE",179:"TERMINATE",180:"RESTART",181:"HELP",182:"GET.BAR",183:"PRODUCT",184:"FACT",185:"GET.CELL",186:"GET.WORKSPACE",187:"GET.WINDOW",188:"GET.DOCUMENT",189:"DPRODUCT",190:"ISNONTEXT",191:"GET.NOTE",192:"NOTE",193:"STDEVP",194:"VARP",195:"DSTDEVP",196:"DVARP",197:"TRUNC",198:"ISLOGICAL",199:"DCOUNTA",200:"DELETE.BAR",201:"UNREGISTER",204:"USDOLLAR",205:"FINDB",206:"SEARCHB",207:"REPLACEB",208:"LEFTB",209:"RIGHTB",210:"MIDB",211:"LENB",212:"ROUNDUP",213:"ROUNDDOWN",214:"ASC",215:"DBCS",216:"RANK",219:"ADDRESS",220:"DAYS360",221:"TODAY",222:"VDB",223:"ELSE",224:"ELSE.IF",225:"END.IF",226:"FOR.CELL",227:"MEDIAN",228:"SUMPRODUCT",229:"SINH",230:"COSH",231:"TANH",232:"ASINH",233:"ACOSH",234:"ATANH",235:"DGET",236:"CREATE.OBJECT",237:"VOLATILE",238:"LAST.ERROR",239:"CUSTOM.UNDO",240:"CUSTOM.REPEAT",241:"FORMULA.CONVERT",242:"GET.LINK.INFO",243:"TEXT.BOX",244:"INFO",245:"GROUP",246:"GET.OBJECT",247:"DB",248:"PAUSE",251:"RESUME",252:"FREQUENCY",253:"ADD.TOOLBAR",254:"DELETE.TOOLBAR",255:"User",256:"RESET.TOOLBAR",257:"EVALUATE",258:"GET.TOOLBAR",259:"GET.TOOL",260:"SPELLING.CHECK",261:"ERROR.TYPE",262:"APP.TITLE",263:"WINDOW.TITLE",264:"SAVE.TOOLBAR",265:"ENABLE.TOOL",266:"PRESS.TOOL",267:"REGISTER.ID",268:"GET.WORKBOOK",269:"AVEDEV",270:"BETADIST",271:"GAMMALN",272:"BETAINV",273:"BINOMDIST",274:"CHIDIST",275:"CHIINV",276:"COMBIN",277:"CONFIDENCE",278:"CRITBINOM",279:"EVEN",280:"EXPONDIST",281:"FDIST",282:"FINV",283:"FISHER",284:"FISHERINV",285:"FLOOR",286:"GAMMADIST",287:"GAMMAINV",288:"CEILING",289:"HYPGEOMDIST",290:"LOGNORMDIST",291:"LOGINV",292:"NEGBINOMDIST",293:"NORMDIST",294:"NORMSDIST",295:"NORMINV",296:"NORMSINV",297:"STANDARDIZE",298:"ODD",299:"PERMUT",300:"POISSON",301:"TDIST",302:"WEIBULL",303:"SUMXMY2",304:"SUMX2MY2",305:"SUMX2PY2",306:"CHITEST",307:"CORREL",308:"COVAR",309:"FORECAST",310:"FTEST",311:"INTERCEPT",312:"PEARSON",313:"RSQ",314:"STEYX",315:"SLOPE",316:"TTEST",317:"PROB",318:"DEVSQ",319:"GEOMEAN",320:"HARMEAN",321:"SUMSQ",322:"KURT",323:"SKEW",324:"ZTEST",325:"LARGE",326:"SMALL",327:"QUARTILE",328:"PERCENTILE",329:"PERCENTRANK",330:"MODE",331:"TRIMMEAN",332:"TINV",334:"MOVIE.COMMAND",335:"GET.MOVIE",336:"CONCATENATE",337:"POWER",338:"PIVOT.ADD.DATA",339:"GET.PIVOT.TABLE",340:"GET.PIVOT.FIELD",341:"GET.PIVOT.ITEM",342:"RADIANS",343:"DEGREES",344:"SUBTOTAL",345:"SUMIF",346:"COUNTIF",347:"COUNTBLANK",348:"SCENARIO.GET",349:"OPTIONS.LISTS.GET",350:"ISPMT",351:"DATEDIF",352:"DATESTRING",353:"NUMBERSTRING",354:"ROMAN",355:"OPEN.DIALOG",356:"SAVE.DIALOG",357:"VIEW.GET",358:"GETPIVOTDATA",359:"HYPERLINK",360:"PHONETIC",361:"AVERAGEA",362:"MAXA",363:"MINA",364:"STDEVPA",365:"VARPA",366:"STDEVA",367:"VARA",368:"BAHTTEXT",369:"THAIDAYOFWEEK",370:"THAIDIGIT",371:"THAIMONTHOFYEAR",372:"THAINUMSOUND",373:"THAINUMSTRING",374:"THAISTRINGLENGTH",375:"ISTHAIDIGIT",376:"ROUNDBAHTDOWN",377:"ROUNDBAHTUP",378:"THAIYEAR",379:"RTD",380:"CUBEVALUE",381:"CUBEMEMBER",382:"CUBEMEMBERPROPERTY",383:"CUBERANKEDMEMBER",384:"HEX2BIN",385:"HEX2DEC",386:"HEX2OCT",387:"DEC2BIN",388:"DEC2HEX",389:"DEC2OCT",390:"OCT2BIN",391:"OCT2HEX",392:"OCT2DEC",393:"BIN2DEC",394:"BIN2OCT",395:"BIN2HEX",396:"IMSUB",397:"IMDIV",398:"IMPOWER",399:"IMABS",400:"IMSQRT",401:"IMLN",402:"IMLOG2",403:"IMLOG10",404:"IMSIN",405:"IMCOS",406:"IMEXP",407:"IMARGUMENT",408:"IMCONJUGATE",409:"IMAGINARY",410:"IMREAL",411:"COMPLEX",412:"IMSUM",413:"IMPRODUCT",414:"SERIESSUM",415:"FACTDOUBLE",416:"SQRTPI",417:"QUOTIENT",418:"DELTA",419:"GESTEP",420:"ISEVEN",421:"ISODD",422:"MROUND",423:"ERF",424:"ERFC",425:"BESSELJ",426:"BESSELK",427:"BESSELY",428:"BESSELI",429:"XIRR",430:"XNPV",431:"PRICEMAT",432:"YIELDMAT",433:"INTRATE",434:"RECEIVED",435:"DISC",436:"PRICEDISC",437:"YIELDDISC",438:"TBILLEQ",439:"TBILLPRICE",440:"TBILLYIELD",441:"PRICE",442:"YIELD",443:"DOLLARDE",444:"DOLLARFR",445:"NOMINAL",446:"EFFECT",447:"CUMPRINC",448:"CUMIPMT",449:"EDATE",450:"EOMONTH",451:"YEARFRAC",452:"COUPDAYBS",453:"COUPDAYS",454:"COUPDAYSNC",455:"COUPNCD",456:"COUPNUM",457:"COUPPCD",458:"DURATION",459:"MDURATION",460:"ODDLPRICE",461:"ODDLYIELD",462:"ODDFPRICE",463:"ODDFYIELD",464:"RANDBETWEEN",465:"WEEKNUM",466:"AMORDEGRC",467:"AMORLINC",468:"CONVERT",724:"SHEETJS",469:"ACCRINT",470:"ACCRINTM",471:"WORKDAY",472:"NETWORKDAYS",473:"GCD",474:"MULTINOMIAL",475:"LCM",476:"FVSCHEDULE",477:"CUBEKPIMEMBER",478:"CUBESET",479:"CUBESETCOUNT",480:"IFERROR",481:"COUNTIFS",482:"SUMIFS",483:"AVERAGEIF",484:"AVERAGEIFS"},O8={2:1,3:1,10:0,15:1,16:1,17:1,18:1,19:0,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:2,30:2,31:3,32:1,33:1,34:0,35:0,38:1,39:2,40:3,41:3,42:3,43:3,44:3,45:3,47:3,48:2,53:1,61:3,63:0,65:3,66:3,67:1,68:1,69:1,70:1,71:1,72:1,73:1,74:0,75:1,76:1,77:1,79:2,80:2,83:1,85:0,86:1,89:0,90:1,94:0,95:0,97:2,98:1,99:1,101:3,102:3,105:1,106:1,108:2,111:1,112:1,113:1,114:1,117:2,118:1,119:4,121:1,126:1,127:1,128:1,129:1,130:1,131:1,133:1,134:1,135:1,136:2,137:2,138:2,140:1,141:1,142:3,143:4,144:4,161:1,162:1,163:1,164:1,165:2,172:1,175:2,176:2,177:3,178:2,179:1,184:1,186:1,189:3,190:1,195:3,196:3,197:1,198:1,199:3,201:1,207:4,210:3,211:1,212:2,213:2,214:1,215:1,225:0,229:1,230:1,231:1,232:1,233:1,234:1,235:3,244:1,247:4,252:2,257:1,261:1,271:1,273:4,274:2,275:2,276:2,277:3,278:3,279:1,280:3,281:3,282:3,283:1,284:1,285:2,286:4,287:3,288:2,289:4,290:3,291:3,292:3,293:4,294:1,295:3,296:1,297:3,298:1,299:2,300:3,301:3,302:4,303:2,304:2,305:2,306:2,307:2,308:2,309:3,310:2,311:2,312:2,313:2,314:2,315:2,316:4,325:2,326:2,327:2,328:2,331:2,332:2,337:2,342:1,343:1,346:2,347:1,350:4,351:3,352:1,353:2,360:1,368:1,369:1,370:1,371:1,372:1,373:1,374:1,375:1,376:1,377:1,378:1,382:3,385:1,392:1,393:1,396:2,397:2,398:2,399:1,400:1,401:1,402:1,403:1,404:1,405:1,406:1,407:1,408:1,409:1,410:1,414:4,415:1,416:1,417:2,420:1,421:1,422:2,424:1,425:2,426:2,427:2,428:2,430:3,438:3,439:3,440:3,443:2,444:2,445:2,446:2,447:6,448:6,449:2,450:2,464:2,468:3,476:2,479:1,480:2,65535:0};function L8(e){var t="of:="+e.replace(kp,"$1[.$2$3$4$5]").replace(/\]:\[/g,":");return t.replace(/;/g,"|").replace(/,/g,";")}function M8(e){return e.replace(/\./,"!")}var Vd=typeof Map!="undefined";function jp(e,t,a){var s=0,o=e.length;if(a){if(Vd?a.has(t):Object.prototype.hasOwnProperty.call(a,t)){for(var u=Vd?a.get(t):a[t];s<u.length;++s)if(e[u[s]].t===t)return e.Count++,u[s]}}else for(;s<o;++s)if(e[s].t===t)return e.Count++,s;return e[o]={t},e.Count++,e.Unique++,a&&(Vd?(a.has(t)||a.set(t,[]),a.get(t).push(o)):(Object.prototype.hasOwnProperty.call(a,t)||(a[t]=[]),a[t].push(o))),o}function Yf(e,t){var a={min:e+1,max:e+1},s=-1;return t.MDW&&(li=t.MDW),t.width!=null?a.customWidth=1:t.wpx!=null?s=Tf(t.wpx):t.wch!=null&&(s=t.wch),s>-1?(a.width=zg(s),a.customWidth=1):t.width!=null&&(a.width=t.width),t.hidden&&(a.hidden=!0),t.level!=null&&(a.outlineLevel=a.level=t.level),a}function pw(e,t){if(e){var a=[.7,.7,.75,.75,.3,.3];e.left==null&&(e.left=a[0]),e.right==null&&(e.right=a[1]),e.top==null&&(e.top=a[2]),e.bottom==null&&(e.bottom=a[3]),e.header==null&&(e.header=a[4]),e.footer==null&&(e.footer=a[5])}}function so(e,t,a){var s=a.revssf[t.z!=null?t.z:"General"],o=60,u=e.length;if(s==null&&a.ssf){for(;o<392;++o)if(a.ssf[o]==null){u2(t.z,o),a.ssf[o]=t.z,a.revssf[t.z]=s=o;break}}for(o=0;o!=u;++o)if(e[o].numFmtId===s)return o;return e[u]={numFmtId:s,fontId:0,fillId:0,borderId:0,xfId:0,applyNumberFormat:1},u}function D8(e,t,a){if(e&&e["!ref"]){var s=Ma(e["!ref"]);if(s.e.c<s.s.c||s.e.r<s.s.r)throw new Error("Bad range ("+a+"): "+e["!ref"])}}function R8(e){if(e.length===0)return"";for(var t='<mergeCells count="'+e.length+'">',a=0;a!=e.length;++a)t+='<mergeCell ref="'+rr(e[a])+'"/>';return t+"</mergeCells>"}function P8(e,t,a,s,o){var u=!1,c={},f=null;if(s.bookType!=="xlsx"&&t.vbaraw){var p=t.SheetNames[a];try{t.Workbook&&(p=t.Workbook.Sheets[a].CodeName||p)}catch(x){}u=!0,c.codeName=Jd(pa(p))}if(e&&e["!outline"]){var g={summaryBelow:1,summaryRight:1};e["!outline"].above&&(g.summaryBelow=0),e["!outline"].left&&(g.summaryRight=0),f=(f||"")+rt("outlinePr",null,g)}!u&&!f||(o[o.length]=rt("sheetPr",f,c))}var F8=["objects","scenarios","selectLockedCells","selectUnlockedCells"],I8=["formatColumns","formatRows","formatCells","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"];function B8(e){var t={sheet:1};return F8.forEach(function(a){e[a]!=null&&e[a]&&(t[a]="1")}),I8.forEach(function(a){e[a]!=null&&!e[a]&&(t[a]="0")}),e.password&&(t.password=Q2(e.password).toString(16).toUpperCase()),rt("sheetProtection",null,t)}function z8(e){return pw(e),rt("pageMargins",null,e)}function U8(e,t){for(var a=["<cols>"],s,o=0;o!=t.length;++o)(s=t[o])&&(a[a.length]=rt("col",null,Yf(o,s)));return a[a.length]="</cols>",a.join("")}function H8(e,t,a,s){var o=typeof e.ref=="string"?e.ref:rr(e.ref);a.Workbook||(a.Workbook={Sheets:[]}),a.Workbook.Names||(a.Workbook.Names=[]);var u=a.Workbook.Names,c=En(o);c.s.r==c.e.r&&(c.e.r=En(t["!ref"]).e.r,o=rr(c));for(var f=0;f<u.length;++f){var p=u[f];if(p.Name=="_xlnm._FilterDatabase"&&p.Sheet==s){p.Ref="'"+a.SheetNames[s]+"'!"+o;break}}return f==u.length&&u.push({Name:"_xlnm._FilterDatabase",Sheet:s,Ref:"'"+a.SheetNames[s]+"'!"+o}),rt("autoFilter",null,{ref:o})}function $8(e,t,a,s){var o={workbookViewId:"0"};return(((s||{}).Workbook||{}).Views||[])[0]&&(o.rightToLeft=s.Workbook.Views[0].RTL?"1":"0"),rt("sheetViews",rt("sheetView",null,o),{})}function W8(e,t,a,s){if(e.c&&a["!comments"].push([t,e.c]),e.v===void 0&&typeof e.f!="string"||e.t==="z"&&!e.f)return"";var o="",u=e.t,c=e.v;if(e.t!=="z")switch(e.t){case"b":o=e.v?"1":"0";break;case"n":o=""+e.v;break;case"e":o=pu[e.v];break;case"d":s&&s.cellDates?o=$r(e.v,-1).toISOString():(e=on(e),e.t="n",o=""+(e.v=sn($r(e.v)))),typeof e.z=="undefined"&&(e.z=Ga[14]);break;default:o=e.v;break}var f=Nr("v",pa(o)),p={r:t},g=so(s.cellXfs,e,s);switch(g!==0&&(p.s=g),e.t){case"n":break;case"d":p.t="d";break;case"b":p.t="b";break;case"e":p.t="e";break;case"z":break;default:if(e.v==null){delete e.t;break}if(e.v.length>32767)throw new Error("Text length must not exceed 32767 characters");if(s&&s.bookSST){f=Nr("v",""+jp(s.Strings,e.v,s.revStrings)),p.t="s";break}p.t="str";break}if(e.t!=u&&(e.t=u,e.v=c),typeof e.f=="string"&&e.f){var x=e.F&&e.F.slice(0,t.length)==t?{t:"array",ref:e.F}:null;f=rt("f",pa(e.f),x)+(e.v!=null?f:"")}return e.l&&a["!links"].push([t,e.l]),e.D&&(p.cm=1),rt("c",f,p)}function V8(e,t,a,s){var o=[],u=[],c=Ma(e["!ref"]),f="",p,g="",x=[],v=0,_=0,k=e["!rows"],T=Array.isArray(e),N={r:g},j,P=-1;for(_=c.s.c;_<=c.e.c;++_)x[_]=Lr(_);for(v=c.s.r;v<=c.e.r;++v){for(u=[],g=Sr(v),_=c.s.c;_<=c.e.c;++_){p=x[_]+g;var C=T?(e[v]||[])[_]:e[p];C!==void 0&&(f=W8(C,p,e,t))!=null&&u.push(f)}(u.length>0||k&&k[v])&&(N={r:g},k&&k[v]&&(j=k[v],j.hidden&&(N.hidden=1),P=-1,j.hpx?P=Ef(j.hpx):j.hpt&&(P=j.hpt),P>-1&&(N.ht=P,N.customHeight=1),j.level&&(N.outlineLevel=j.level)),o[o.length]=rt("row",u.join(""),N))}if(k)for(;v<k.length;++v)k&&k[v]&&(N={r:v+1},j=k[v],j.hidden&&(N.hidden=1),P=-1,j.hpx?P=Ef(j.hpx):j.hpt&&(P=j.hpt),P>-1&&(N.ht=P,N.customHeight=1),j.level&&(N.outlineLevel=j.level),o[o.length]=rt("row","",N));return o.join("")}function xw(e,t,a,s){var o=[nr,rt("worksheet",null,{xmlns:Tc[0],"xmlns:r":fr.r})],u=a.SheetNames[e],c=0,f="",p=a.Sheets[u];p==null&&(p={});var g=p["!ref"]||"A1",x=Ma(g);if(x.e.c>16383||x.e.r>1048575){if(t.WTF)throw new Error("Range "+g+" exceeds format limit A1:XFD1048576");x.e.c=Math.min(x.e.c,16383),x.e.r=Math.min(x.e.c,1048575),g=rr(x)}s||(s={}),p["!comments"]=[];var v=[];P8(p,a,e,t,o),o[o.length]=rt("dimension",null,{ref:g}),o[o.length]=$8(p,t,e,a),t.sheetFormat&&(o[o.length]=rt("sheetFormatPr",null,{defaultRowHeight:t.sheetFormat.defaultRowHeight||"16",baseColWidth:t.sheetFormat.baseColWidth||"10",outlineLevelRow:t.sheetFormat.outlineLevelRow||"7"})),p["!cols"]!=null&&p["!cols"].length>0&&(o[o.length]=U8(p,p["!cols"])),o[c=o.length]="<sheetData/>",p["!links"]=[],p["!ref"]!=null&&(f=V8(p,t),f.length>0&&(o[o.length]=f)),o.length>c+1&&(o[o.length]="</sheetData>",o[c]=o[c].replace("/>",">")),p["!protect"]&&(o[o.length]=B8(p["!protect"])),p["!autofilter"]!=null&&(o[o.length]=H8(p["!autofilter"],p,a,e)),p["!merges"]!=null&&p["!merges"].length>0&&(o[o.length]=R8(p["!merges"]));var _=-1,k,T=-1;return p["!links"].length>0&&(o[o.length]="<hyperlinks>",p["!links"].forEach(function(N){N[1].Target&&(k={ref:N[0]},N[1].Target.charAt(0)!="#"&&(T=ga(s,-1,pa(N[1].Target).replace(/#.*$/,""),sa.HLINK),k["r:id"]="rId"+T),(_=N[1].Target.indexOf("#"))>-1&&(k.location=pa(N[1].Target.slice(_+1))),N[1].Tooltip&&(k.tooltip=pa(N[1].Tooltip)),o[o.length]=rt("hyperlink",null,k))}),o[o.length]="</hyperlinks>"),delete p["!links"],p["!margins"]!=null&&(o[o.length]=z8(p["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&(o[o.length]=Nr("ignoredErrors",rt("ignoredError",null,{numberStoredAsText:1,sqref:g}))),v.length>0&&(T=ga(s,-1,"../drawings/drawing"+(e+1)+".xml",sa.DRAW),o[o.length]=rt("drawing",null,{"r:id":"rId"+T}),p["!drawing"]=v),p["!comments"].length>0&&(T=ga(s,-1,"../drawings/vmlDrawing"+(e+1)+".vml",sa.VML),o[o.length]=rt("legacyDrawing",null,{"r:id":"rId"+T}),p["!legacy"]=T),o.length>1&&(o[o.length]="</worksheet>",o[1]=o[1].replace("/>",">")),o.join("")}function G8(e,t){var a={},s=e.l+t;a.r=e.read_shift(4),e.l+=4;var o=e.read_shift(2);e.l+=1;var u=e.read_shift(1);return e.l=s,u&7&&(a.level=u&7),u&16&&(a.hidden=!0),u&32&&(a.hpt=o/20),a}function Z8(e,t,a){var s=Ie(145),o=(a["!rows"]||[])[e]||{};s.write_shift(4,e),s.write_shift(4,0);var u=320;o.hpx?u=Ef(o.hpx)*20:o.hpt&&(u=o.hpt*20),s.write_shift(2,u),s.write_shift(1,0);var c=0;o.level&&(c|=o.level),o.hidden&&(c|=16),(o.hpx||o.hpt)&&(c|=32),s.write_shift(1,c),s.write_shift(1,0);var f=0,p=s.l;s.l+=4;for(var g={r:e,c:0},x=0;x<16;++x)if(!(t.s.c>x+1<<10||t.e.c<x<<10)){for(var v=-1,_=-1,k=x<<10;k<x+1<<10;++k){g.c=k;var T=Array.isArray(a)?(a[g.r]||[])[g.c]:a[xa(g)];T&&(v<0&&(v=k),_=k)}v<0||(++f,s.write_shift(4,v),s.write_shift(4,_))}var N=s.l;return s.l=p,s.write_shift(4,f),s.l=N,s.length>s.l?s.slice(0,s.l):s}function q8(e,t,a,s){var o=Z8(s,a,t);(o.length>17||(t["!rows"]||[])[s])&&Xe(e,0,o)}var Y8=ll,X8=Cc;function K8(){}function J8(e,t){var a={},s=e[e.l];return++e.l,a.above=!(s&64),a.left=!(s&128),e.l+=18,a.name=lT(e),a}function Q8(e,t,a){a==null&&(a=Ie(84+4*e.length));var s=192;t&&(t.above&&(s&=-65),t.left&&(s&=-129)),a.write_shift(1,s);for(var o=1;o<3;++o)a.write_shift(1,0);return Nf({auto:1},a),a.write_shift(-4,-1),a.write_shift(-4,-1),L2(e,a),a.slice(0,a.l)}function e7(e){var t=Gn(e);return[t]}function t7(e,t,a){return a==null&&(a=Ie(8)),sl(t,a)}function a7(e){var t=il(e);return[t]}function r7(e,t,a){return a==null&&(a=Ie(4)),ol(t,a)}function n7(e){var t=Gn(e),a=e.read_shift(1);return[t,a,"b"]}function s7(e,t,a){return a==null&&(a=Ie(9)),sl(t,a),a.write_shift(1,e.v?1:0),a}function i7(e){var t=il(e),a=e.read_shift(1);return[t,a,"b"]}function o7(e,t,a){return a==null&&(a=Ie(5)),ol(t,a),a.write_shift(1,e.v?1:0),a}function l7(e){var t=Gn(e),a=e.read_shift(1);return[t,a,"e"]}function c7(e,t,a){return a==null&&(a=Ie(9)),sl(t,a),a.write_shift(1,e.v),a}function d7(e){var t=il(e),a=e.read_shift(1);return[t,a,"e"]}function u7(e,t,a){return a==null&&(a=Ie(8)),ol(t,a),a.write_shift(1,e.v),a.write_shift(2,0),a.write_shift(1,0),a}function f7(e){var t=Gn(e),a=e.read_shift(4);return[t,a,"s"]}function h7(e,t,a){return a==null&&(a=Ie(12)),sl(t,a),a.write_shift(4,t.v),a}function m7(e){var t=il(e),a=e.read_shift(4);return[t,a,"s"]}function g7(e,t,a){return a==null&&(a=Ie(8)),ol(t,a),a.write_shift(4,t.v),a}function p7(e){var t=Gn(e),a=Ac(e);return[t,a,"n"]}function x7(e,t,a){return a==null&&(a=Ie(16)),sl(t,a),el(e.v,a),a}function y7(e){var t=il(e),a=Ac(e);return[t,a,"n"]}function b7(e,t,a){return a==null&&(a=Ie(12)),ol(t,a),el(e.v,a),a}function v7(e){var t=Gn(e),a=M2(e);return[t,a,"n"]}function _7(e,t,a){return a==null&&(a=Ie(12)),sl(t,a),D2(e.v,a),a}function w7(e){var t=il(e),a=M2(e);return[t,a,"n"]}function k7(e,t,a){return a==null&&(a=Ie(8)),ol(t,a),D2(e.v,a),a}function N7(e){var t=Gn(e),a=yp(e);return[t,a,"is"]}function S7(e){var t=Gn(e),a=Mr(e);return[t,a,"str"]}function j7(e,t,a){return a==null&&(a=Ie(12+4*e.v.length)),sl(t,a),mr(e.v,a),a.length>a.l?a.slice(0,a.l):a}function T7(e){var t=il(e),a=Mr(e);return[t,a,"str"]}function E7(e,t,a){return a==null&&(a=Ie(8+4*e.v.length)),ol(t,a),mr(e.v,a),a.length>a.l?a.slice(0,a.l):a}function C7(e,t,a){var s=e.l+t,o=Gn(e);o.r=a["!row"];var u=e.read_shift(1),c=[o,u,"b"];if(a.cellFormula){e.l+=2;var f=qf(e,s-e.l,a);c[3]=xc(f,null,o,a.supbooks,a)}else e.l=s;return c}function A7(e,t,a){var s=e.l+t,o=Gn(e);o.r=a["!row"];var u=e.read_shift(1),c=[o,u,"e"];if(a.cellFormula){e.l+=2;var f=qf(e,s-e.l,a);c[3]=xc(f,null,o,a.supbooks,a)}else e.l=s;return c}function O7(e,t,a){var s=e.l+t,o=Gn(e);o.r=a["!row"];var u=Ac(e),c=[o,u,"n"];if(a.cellFormula){e.l+=2;var f=qf(e,s-e.l,a);c[3]=xc(f,null,o,a.supbooks,a)}else e.l=s;return c}function L7(e,t,a){var s=e.l+t,o=Gn(e);o.r=a["!row"];var u=Mr(e),c=[o,u,"str"];if(a.cellFormula){e.l+=2;var f=qf(e,s-e.l,a);c[3]=xc(f,null,o,a.supbooks,a)}else e.l=s;return c}var M7=ll,D7=Cc;function R7(e,t){return t==null&&(t=Ie(4)),t.write_shift(4,e),t}function P7(e,t){var a=e.l+t,s=ll(e),o=bp(e),u=Mr(e),c=Mr(e),f=Mr(e);e.l=a;var p={rfx:s,relId:o,loc:u,display:f};return c&&(p.Tooltip=c),p}function F7(e,t){var a=Ie(50+4*(e[1].Target.length+(e[1].Tooltip||"").length));Cc({s:hr(e[0]),e:hr(e[0])},a),vp("rId"+t,a);var s=e[1].Target.indexOf("#"),o=s==-1?"":e[1].Target.slice(s+1);return mr(o||"",a),mr(e[1].Tooltip||"",a),mr("",a),a.slice(0,a.l)}function I7(){}function B7(e,t,a){var s=e.l+t,o=R2(e),u=e.read_shift(1),c=[o];if(c[2]=u,a.cellFormula){var f=T8(e,s-e.l,a);c[1]=f}else e.l=s;return c}function z7(e,t,a){var s=e.l+t,o=ll(e),u=[o];if(a.cellFormula){var c=C8(e,s-e.l,a);u[1]=c,e.l=s}else e.l=s;return u}function U7(e,t,a){a==null&&(a=Ie(18));var s=Yf(e,t);a.write_shift(-4,e),a.write_shift(-4,e),a.write_shift(4,(s.width||10)*256),a.write_shift(4,0);var o=0;return t.hidden&&(o|=1),typeof s.width=="number"&&(o|=2),t.level&&(o|=t.level<<8),a.write_shift(2,o),a}var yw=["left","right","top","bottom","header","footer"];function H7(e){var t={};return yw.forEach(function(a){t[a]=Ac(e)}),t}function $7(e,t){return t==null&&(t=Ie(48)),pw(e),yw.forEach(function(a){el(e[a],t)}),t}function W7(e){var t=e.read_shift(2);return e.l+=28,{RTL:t&32}}function V7(e,t,a){a==null&&(a=Ie(30));var s=924;return(((t||{}).Views||[])[0]||{}).RTL&&(s|=32),a.write_shift(2,s),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(1,0),a.write_shift(1,0),a.write_shift(2,0),a.write_shift(2,100),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(4,0),a}function G7(e){var t=Ie(24);return t.write_shift(4,4),t.write_shift(4,1),Cc(e,t),t}function Z7(e,t){return t==null&&(t=Ie(66)),t.write_shift(2,e.password?Q2(e.password):0),t.write_shift(4,1),[["objects",!1],["scenarios",!1],["formatCells",!0],["formatColumns",!0],["formatRows",!0],["insertColumns",!0],["insertRows",!0],["insertHyperlinks",!0],["deleteColumns",!0],["deleteRows",!0],["selectLockedCells",!1],["sort",!0],["autoFilter",!0],["pivotTables",!0],["selectUnlockedCells",!1]].forEach(function(a){a[1]?t.write_shift(4,e[a[0]]!=null&&!e[a[0]]?1:0):t.write_shift(4,e[a[0]]!=null&&e[a[0]]?0:1)}),t}function q7(){}function Y7(){}function X7(e,t,a,s,o,u,c){if(t.v===void 0)return!1;var f="";switch(t.t){case"b":f=t.v?"1":"0";break;case"d":t=on(t),t.z=t.z||Ga[14],t.v=sn($r(t.v)),t.t="n";break;case"n":case"e":f=""+t.v;break;default:f=t.v;break}var p={r:a,c:s};switch(p.s=so(o.cellXfs,t,o),t.l&&u["!links"].push([xa(p),t.l]),t.c&&u["!comments"].push([xa(p),t.c]),t.t){case"s":case"str":return o.bookSST?(f=jp(o.Strings,t.v,o.revStrings),p.t="s",p.v=f,c?Xe(e,18,g7(t,p)):Xe(e,7,h7(t,p))):(p.t="str",c?Xe(e,17,E7(t,p)):Xe(e,6,j7(t,p))),!0;case"n":return t.v==(t.v|0)&&t.v>-1e3&&t.v<1e3?c?Xe(e,13,k7(t,p)):Xe(e,2,_7(t,p)):c?Xe(e,16,b7(t,p)):Xe(e,5,x7(t,p)),!0;case"b":return p.t="b",c?Xe(e,15,o7(t,p)):Xe(e,4,s7(t,p)),!0;case"e":return p.t="e",c?Xe(e,14,u7(t,p)):Xe(e,3,c7(t,p)),!0}return c?Xe(e,12,r7(t,p)):Xe(e,1,t7(t,p)),!0}function K7(e,t,a,s){var o=Ma(t["!ref"]||"A1"),u,c="",f=[];Xe(e,145);var p=Array.isArray(t),g=o.e.r;t["!rows"]&&(g=Math.max(o.e.r,t["!rows"].length-1));for(var x=o.s.r;x<=g;++x){c=Sr(x),q8(e,t,o,x);var v=!1;if(x<=o.e.r)for(var _=o.s.c;_<=o.e.c;++_){x===o.s.r&&(f[_]=Lr(_)),u=f[_]+c;var k=p?(t[x]||[])[_]:t[u];if(!k){v=!1;continue}v=X7(e,k,x,_,s,t,v)}}Xe(e,146)}function J7(e,t){!t||!t["!merges"]||(Xe(e,177,R7(t["!merges"].length)),t["!merges"].forEach(function(a){Xe(e,176,D7(a))}),Xe(e,178))}function Q7(e,t){!t||!t["!cols"]||(Xe(e,390),t["!cols"].forEach(function(a,s){a&&Xe(e,60,U7(s,a))}),Xe(e,391))}function eA(e,t){!t||!t["!ref"]||(Xe(e,648),Xe(e,649,G7(Ma(t["!ref"]))),Xe(e,650))}function tA(e,t,a){t["!links"].forEach(function(s){if(s[1].Target){var o=ga(a,-1,s[1].Target.replace(/#.*$/,""),sa.HLINK);Xe(e,494,F7(s,o))}}),delete t["!links"]}function aA(e,t,a,s){if(t["!comments"].length>0){var o=ga(s,-1,"../drawings/vmlDrawing"+(a+1)+".vml",sa.VML);Xe(e,551,vp("rId"+o)),t["!legacy"]=o}}function rA(e,t,a,s){if(t["!autofilter"]){var o=t["!autofilter"],u=typeof o.ref=="string"?o.ref:rr(o.ref);a.Workbook||(a.Workbook={Sheets:[]}),a.Workbook.Names||(a.Workbook.Names=[]);var c=a.Workbook.Names,f=En(u);f.s.r==f.e.r&&(f.e.r=En(t["!ref"]).e.r,u=rr(f));for(var p=0;p<c.length;++p){var g=c[p];if(g.Name=="_xlnm._FilterDatabase"&&g.Sheet==s){g.Ref="'"+a.SheetNames[s]+"'!"+u;break}}p==c.length&&c.push({Name:"_xlnm._FilterDatabase",Sheet:s,Ref:"'"+a.SheetNames[s]+"'!"+u}),Xe(e,161,Cc(Ma(u))),Xe(e,162)}}function nA(e,t,a){Xe(e,133),Xe(e,137,V7(t,a)),Xe(e,138),Xe(e,134)}function sA(e,t){t["!protect"]&&Xe(e,535,Z7(t["!protect"]))}function iA(e,t,a,s){var o=nn(),u=a.SheetNames[e],c=a.Sheets[u]||{},f=u;try{a&&a.Workbook&&(f=a.Workbook.Sheets[e].CodeName||f)}catch(g){}var p=Ma(c["!ref"]||"A1");if(p.e.c>16383||p.e.r>1048575){if(t.WTF)throw new Error("Range "+(c["!ref"]||"A1")+" exceeds format limit A1:XFD1048576");p.e.c=Math.min(p.e.c,16383),p.e.r=Math.min(p.e.c,1048575)}return c["!links"]=[],c["!comments"]=[],Xe(o,129),(a.vbaraw||c["!outline"])&&Xe(o,147,Q8(f,c["!outline"])),Xe(o,148,X8(p)),nA(o,c,a.Workbook),Q7(o,c),K7(o,c,e,t),sA(o,c),rA(o,c,a,e),J7(o,c),tA(o,c,s),c["!margins"]&&Xe(o,476,$7(c["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&eA(o,c),aA(o,c,e,s),Xe(o,130),o.end()}function oA(e,t){e.l+=10;var a=Mr(e);return{name:a}}var lA=[["allowRefreshQuery",!1,"bool"],["autoCompressPictures",!0,"bool"],["backupFile",!1,"bool"],["checkCompatibility",!1,"bool"],["CodeName",""],["date1904",!1,"bool"],["defaultThemeVersion",0,"int"],["filterPrivacy",!1,"bool"],["hidePivotFieldList",!1,"bool"],["promptedSolutions",!1,"bool"],["publishItems",!1,"bool"],["refreshAllConnections",!1,"bool"],["saveExternalLinkValues",!0,"bool"],["showBorderUnselectedTables",!0,"bool"],["showInkAnnotation",!0,"bool"],["showObjects","all"],["showPivotChartFilter",!1,"bool"],["updateLinks","userSet"]];function cA(e){return!e.Workbook||!e.Workbook.WBProps?"false":z5(e.Workbook.WBProps.date1904)?"true":"false"}var dA="][*?/\\".split("");function bw(e,t){if(e.length>31)throw new Error("Sheet names cannot exceed 31 chars");var a=!0;return dA.forEach(function(s){if(e.indexOf(s)!=-1)throw new Error("Sheet name cannot contain : \\ / ? * [ ]")}),a}function uA(e,t,a){e.forEach(function(s,o){bw(s);for(var u=0;u<o;++u)if(s==e[u])throw new Error("Duplicate Sheet Name: "+s);if(a){var c=t&&t[o]&&t[o].CodeName||s;if(c.charCodeAt(0)==95&&c.length>22)throw new Error("Bad Code Name: Worksheet"+c)}})}function fA(e){if(!e||!e.SheetNames||!e.Sheets)throw new Error("Invalid Workbook");if(!e.SheetNames.length)throw new Error("Workbook is empty");var t=e.Workbook&&e.Workbook.Sheets||[];uA(e.SheetNames,t,!!e.vbaraw);for(var a=0;a<e.SheetNames.length;++a)D8(e.Sheets[e.SheetNames[a]],e.SheetNames[a],a)}function vw(e){var t=[nr];t[t.length]=rt("workbook",null,{xmlns:Tc[0],"xmlns:r":fr.r});var a=e.Workbook&&(e.Workbook.Names||[]).length>0,s={codeName:"ThisWorkbook"};e.Workbook&&e.Workbook.WBProps&&(lA.forEach(function(f){e.Workbook.WBProps[f[0]]!=null&&e.Workbook.WBProps[f[0]]!=f[1]&&(s[f[0]]=e.Workbook.WBProps[f[0]])}),e.Workbook.WBProps.CodeName&&(s.codeName=e.Workbook.WBProps.CodeName,delete s.CodeName)),t[t.length]=rt("workbookPr",null,s);var o=e.Workbook&&e.Workbook.Sheets||[],u=0;if(o&&o[0]&&o[0].Hidden){for(t[t.length]="<bookViews>",u=0;u!=e.SheetNames.length&&!(!o[u]||!o[u].Hidden);++u);u==e.SheetNames.length&&(u=0),t[t.length]='<workbookView firstSheet="'+u+'" activeTab="'+u+'"/>',t[t.length]="</bookViews>"}for(t[t.length]="<sheets>",u=0;u!=e.SheetNames.length;++u){var c={name:pa(e.SheetNames[u].slice(0,31))};if(c.sheetId=""+(u+1),c["r:id"]="rId"+(u+1),o[u])switch(o[u].Hidden){case 1:c.state="hidden";break;case 2:c.state="veryHidden";break}t[t.length]=rt("sheet",null,c)}return t[t.length]="</sheets>",a&&(t[t.length]="<definedNames>",e.Workbook&&e.Workbook.Names&&e.Workbook.Names.forEach(function(f){var p={name:f.Name};f.Comment&&(p.comment=f.Comment),f.Sheet!=null&&(p.localSheetId=""+f.Sheet),f.Hidden&&(p.hidden="1"),f.Ref&&(t[t.length]=rt("definedName",pa(f.Ref),p))}),t[t.length]="</definedNames>"),t.length>2&&(t[t.length]="</workbook>",t[1]=t[1].replace("/>",">")),t.join("")}function hA(e,t){var a={};return a.Hidden=e.read_shift(4),a.iTabID=e.read_shift(4),a.strRelID=Bg(e),a.name=Mr(e),a}function mA(e,t){return t||(t=Ie(127)),t.write_shift(4,e.Hidden),t.write_shift(4,e.iTabID),vp(e.strRelID,t),mr(e.name.slice(0,31),t),t.length>t.l?t.slice(0,t.l):t}function gA(e,t){var a={},s=e.read_shift(4);a.defaultThemeVersion=e.read_shift(4);var o=t>8?Mr(e):"";return o.length>0&&(a.CodeName=o),a.autoCompressPictures=!!(s&65536),a.backupFile=!!(s&64),a.checkCompatibility=!!(s&4096),a.date1904=!!(s&1),a.filterPrivacy=!!(s&8),a.hidePivotFieldList=!!(s&1024),a.promptedSolutions=!!(s&16),a.publishItems=!!(s&2048),a.refreshAllConnections=!!(s&262144),a.saveExternalLinkValues=!!(s&128),a.showBorderUnselectedTables=!!(s&4),a.showInkAnnotation=!!(s&32),a.showObjects=["all","placeholders","none"][s>>13&3],a.showPivotChartFilter=!!(s&32768),a.updateLinks=["userSet","never","always"][s>>8&3],a}function pA(e,t){t||(t=Ie(72));var a=0;return e&&e.filterPrivacy&&(a|=8),t.write_shift(4,a),t.write_shift(4,0),L2(e&&e.CodeName||"ThisWorkbook",t),t.slice(0,t.l)}function xA(e,t,a){var s=e.l+t;e.l+=4,e.l+=1;var o=e.read_shift(4),u=cT(e),c=E8(e,0,a),f=bp(e);e.l=s;var p={Name:u,Ptg:c};return o<268435455&&(p.Sheet=o),f&&(p.Comment=f),p}function yA(e,t){Xe(e,143);for(var a=0;a!=t.SheetNames.length;++a){var s=t.Workbook&&t.Workbook.Sheets&&t.Workbook.Sheets[a]&&t.Workbook.Sheets[a].Hidden||0,o={Hidden:s,iTabID:a+1,strRelID:"rId"+(a+1),name:t.SheetNames[a]};Xe(e,156,mA(o))}Xe(e,144)}function bA(e,t){t||(t=Ie(127));for(var a=0;a!=4;++a)t.write_shift(4,0);return mr("SheetJS",t),mr(pf.version,t),mr(pf.version,t),mr("7262",t),t.length>t.l?t.slice(0,t.l):t}function vA(e,t){t||(t=Ie(29)),t.write_shift(-4,0),t.write_shift(-4,460),t.write_shift(4,28800),t.write_shift(4,17600),t.write_shift(4,500),t.write_shift(4,e),t.write_shift(4,e);var a=120;return t.write_shift(1,a),t.length>t.l?t.slice(0,t.l):t}function _A(e,t){if(!(!t.Workbook||!t.Workbook.Sheets)){for(var a=t.Workbook.Sheets,s=0,o=-1,u=-1;s<a.length;++s)!a[s]||!a[s].Hidden&&o==-1?o=s:a[s].Hidden==1&&u==-1&&(u=s);u>o||(Xe(e,135),Xe(e,158,vA(o)),Xe(e,136))}}function wA(e,t){var a=nn();return Xe(a,131),Xe(a,128,bA()),Xe(a,153,pA(e.Workbook&&e.Workbook.WBProps||null)),_A(a,e),yA(a,e),Xe(a,132),a.end()}function kA(e,t,a){return(t.slice(-4)===".bin"?wA:vw)(e)}function NA(e,t,a,s,o){return(t.slice(-4)===".bin"?iA:xw)(e,a,s,o)}function SA(e,t,a){return(t.slice(-4)===".bin"?$E:aw)(e,a)}function jA(e,t,a){return(t.slice(-4)===".bin"?pE:J2)(e,a)}function TA(e,t,a){return(t.slice(-4)===".bin"?sC:ow)(e)}function EA(e){return(e.slice(-4)===".bin"?KE:sw)()}function CA(e,t){var a=[];return e.Props&&a.push(ST(e.Props,t)),e.Custprops&&a.push(jT(e.Props,e.Custprops)),a.join("")}function AA(){return""}function OA(e,t){var a=['<Style ss:ID="Default" ss:Name="Normal"><NumberFormat/></Style>'];return t.cellXfs.forEach(function(s,o){var u=[];u.push(rt("NumberFormat",null,{"ss:Format":pa(Ga[s.numFmtId])}));var c={"ss:ID":"s"+(21+o)};a.push(rt("Style",u.join(""),c))}),rt("Styles",a.join(""))}function _w(e){return rt("NamedRange",null,{"ss:Name":e.Name,"ss:RefersTo":"="+Np(e.Ref,{r:0,c:0})})}function LA(e){if(!((e||{}).Workbook||{}).Names)return"";for(var t=e.Workbook.Names,a=[],s=0;s<t.length;++s){var o=t[s];o.Sheet==null&&(o.Name.match(/^_xlfn\./)||a.push(_w(o)))}return rt("Names",a.join(""))}function MA(e,t,a,s){if(!e||!((s||{}).Workbook||{}).Names)return"";for(var o=s.Workbook.Names,u=[],c=0;c<o.length;++c){var f=o[c];f.Sheet==a&&(f.Name.match(/^_xlfn\./)||u.push(_w(f)))}return u.join("")}function DA(e,t,a,s){if(!e)return"";var o=[];if(e["!margins"]&&(o.push("<PageSetup>"),e["!margins"].header&&o.push(rt("Header",null,{"x:Margin":e["!margins"].header})),e["!margins"].footer&&o.push(rt("Footer",null,{"x:Margin":e["!margins"].footer})),o.push(rt("PageMargins",null,{"x:Bottom":e["!margins"].bottom||"0.75","x:Left":e["!margins"].left||"0.7","x:Right":e["!margins"].right||"0.7","x:Top":e["!margins"].top||"0.75"})),o.push("</PageSetup>")),s&&s.Workbook&&s.Workbook.Sheets&&s.Workbook.Sheets[a])if(s.Workbook.Sheets[a].Hidden)o.push(rt("Visible",s.Workbook.Sheets[a].Hidden==1?"SheetHidden":"SheetVeryHidden",{}));else{for(var u=0;u<a&&!(s.Workbook.Sheets[u]&&!s.Workbook.Sheets[u].Hidden);++u);u==a&&o.push("<Selected/>")}return((((s||{}).Workbook||{}).Views||[])[0]||{}).RTL&&o.push("<DisplayRightToLeft/>"),e["!protect"]&&(o.push(Nr("ProtectContents","True")),e["!protect"].objects&&o.push(Nr("ProtectObjects","True")),e["!protect"].scenarios&&o.push(Nr("ProtectScenarios","True")),e["!protect"].selectLockedCells!=null&&!e["!protect"].selectLockedCells?o.push(Nr("EnableSelection","NoSelection")):e["!protect"].selectUnlockedCells!=null&&!e["!protect"].selectUnlockedCells&&o.push(Nr("EnableSelection","UnlockedCells")),[["formatCells","AllowFormatCells"],["formatColumns","AllowSizeCols"],["formatRows","AllowSizeRows"],["insertColumns","AllowInsertCols"],["insertRows","AllowInsertRows"],["insertHyperlinks","AllowInsertHyperlinks"],["deleteColumns","AllowDeleteCols"],["deleteRows","AllowDeleteRows"],["sort","AllowSort"],["autoFilter","AllowFilter"],["pivotTables","AllowUsePivotTables"]].forEach(function(c){e["!protect"][c[0]]&&o.push("<"+c[1]+"/>")})),o.length==0?"":rt("WorksheetOptions",o.join(""),{xmlns:Nn.x})}function RA(e){return e.map(function(t){var a=B5(t.t||""),s=rt("ss:Data",a,{xmlns:"http://www.w3.org/TR/REC-html40"});return rt("Comment",s,{"ss:Author":t.a})}).join("")}function PA(e,t,a,s,o,u,c){if(!e||e.v==null&&e.f==null)return"";var f={};if(e.f&&(f["ss:Formula"]="="+pa(Np(e.f,c))),e.F&&e.F.slice(0,t.length)==t){var p=hr(e.F.slice(t.length+1));f["ss:ArrayRange"]="RC:R"+(p.r==c.r?"":"["+(p.r-c.r)+"]")+"C"+(p.c==c.c?"":"["+(p.c-c.c)+"]")}if(e.l&&e.l.Target&&(f["ss:HRef"]=pa(e.l.Target),e.l.Tooltip&&(f["x:HRefScreenTip"]=pa(e.l.Tooltip))),a["!merges"])for(var g=a["!merges"],x=0;x!=g.length;++x)g[x].s.c!=c.c||g[x].s.r!=c.r||(g[x].e.c>g[x].s.c&&(f["ss:MergeAcross"]=g[x].e.c-g[x].s.c),g[x].e.r>g[x].s.r&&(f["ss:MergeDown"]=g[x].e.r-g[x].s.r));var v="",_="";switch(e.t){case"z":if(!s.sheetStubs)return"";break;case"n":v="Number",_=String(e.v);break;case"b":v="Boolean",_=e.v?"1":"0";break;case"e":v="Error",_=pu[e.v];break;case"d":v="DateTime",_=new Date(e.v).toISOString(),e.z==null&&(e.z=e.z||Ga[14]);break;case"s":v="String",_=I5(e.v||"");break}var k=so(s.cellXfs,e,s);f["ss:StyleID"]="s"+(21+k),f["ss:Index"]=c.c+1;var T=e.v!=null?_:"",N=e.t=="z"?"":'<Data ss:Type="'+v+'">'+T+"</Data>";return(e.c||[]).length>0&&(N+=RA(e.c)),rt("Cell",N,f)}function FA(e,t){var a='<Row ss:Index="'+(e+1)+'"';return t&&(t.hpt&&!t.hpx&&(t.hpx=tw(t.hpt)),t.hpx&&(a+=' ss:AutoFitHeight="0" ss:Height="'+t.hpx+'"'),t.hidden&&(a+=' ss:Hidden="1"')),a+">"}function IA(e,t,a,s){if(!e["!ref"])return"";var o=Ma(e["!ref"]),u=e["!merges"]||[],c=0,f=[];e["!cols"]&&e["!cols"].forEach(function(j,P){wp(j);var C=!!j.width,O=Yf(P,j),R={"ss:Index":P+1};C&&(R["ss:Width"]=jf(O.width)),j.hidden&&(R["ss:Hidden"]="1"),f.push(rt("Column",null,R))});for(var p=Array.isArray(e),g=o.s.r;g<=o.e.r;++g){for(var x=[FA(g,(e["!rows"]||[])[g])],v=o.s.c;v<=o.e.c;++v){var _=!1;for(c=0;c!=u.length;++c)if(!(u[c].s.c>v)&&!(u[c].s.r>g)&&!(u[c].e.c<v)&&!(u[c].e.r<g)){(u[c].s.c!=v||u[c].s.r!=g)&&(_=!0);break}if(!_){var k={r:g,c:v},T=xa(k),N=p?(e[g]||[])[v]:e[T];x.push(PA(N,T,e,t,a,s,k))}}x.push("</Row>"),x.length>2&&f.push(x.join(""))}return f.join("")}function BA(e,t,a){var s=[],o=a.SheetNames[e],u=a.Sheets[o],c=u?MA(u,t,e,a):"";return c.length>0&&s.push("<Names>"+c+"</Names>"),c=u?IA(u,t,e,a):"",c.length>0&&s.push("<Table>"+c+"</Table>"),s.push(DA(u,t,e,a)),s.join("")}function zA(e,t){t||(t={}),e.SSF||(e.SSF=on(Ga)),e.SSF&&(Wf(),$f(e.SSF),t.revssf=Vf(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF,t.cellXfs=[],so(t.cellXfs,{},{revssf:{General:0}}));var a=[];a.push(CA(e,t)),a.push(AA()),a.push(""),a.push("");for(var s=0;s<e.SheetNames.length;++s)a.push(rt("Worksheet",BA(s,t,e),{"ss:Name":pa(e.SheetNames[s])}));return a[2]=OA(e,t),a[3]=LA(e),nr+rt("Workbook",a.join(""),{xmlns:Nn.ss,"xmlns:o":Nn.o,"xmlns:x":Nn.x,"xmlns:ss":Nn.ss,"xmlns:dt":Nn.dt,"xmlns:html":Nn.html})}var yg={SI:"e0859ff2f94f6810ab9108002b27b3d9",DSI:"02d5cdd59c2e1b10939708002b2cf9ae",UDI:"05d5cdd59c2e1b10939708002b2cf9ae"};function UA(e,t){var a=[],s=[],o=[],u=0,c,f=tv(mv,"n"),p=tv(gv,"n");if(e.Props)for(c=jr(e.Props),u=0;u<c.length;++u)(Object.prototype.hasOwnProperty.call(f,c[u])?a:Object.prototype.hasOwnProperty.call(p,c[u])?s:o).push([c[u],e.Props[c[u]]]);if(e.Custprops)for(c=jr(e.Custprops),u=0;u<c.length;++u)Object.prototype.hasOwnProperty.call(e.Props||{},c[u])||(Object.prototype.hasOwnProperty.call(f,c[u])?a:Object.prototype.hasOwnProperty.call(p,c[u])?s:o).push([c[u],e.Custprops[c[u]]]);var g=[];for(u=0;u<o.length;++u)V2.indexOf(o[u][0])>-1||H2.indexOf(o[u][0])>-1||o[u][1]!=null&&g.push(o[u]);s.length&&Na.utils.cfb_add(t,"/SummaryInformation",vv(s,yg.SI,p,gv)),(a.length||g.length)&&Na.utils.cfb_add(t,"/DocumentSummaryInformation",vv(a,yg.DSI,f,mv,g.length?g:null,yg.UDI))}function HA(e,t){var a=t||{},s=Na.utils.cfb_new({root:"R"}),o="/Workbook";switch(a.bookType||"xls"){case"xls":a.bookType="biff8";case"xla":a.bookType||(a.bookType="xla");case"biff8":o="/Workbook",a.biff=8;break;case"biff5":o="/Book",a.biff=5;break;default:throw new Error("invalid type "+a.bookType+" for XLS CFB")}return Na.utils.cfb_add(s,o,ww(e,a)),a.biff==8&&(e.Props||e.Custprops)&&UA(e,s),a.biff==8&&e.vbaraw&&iC(s,Na.read(e.vbaraw,{type:typeof e.vbaraw=="string"?"binary":"buffer"})),s}var $A={0:{f:G8},1:{f:e7},2:{f:v7},3:{f:l7},4:{f:n7},5:{f:p7},6:{f:S7},7:{f:f7},8:{f:L7},9:{f:O7},10:{f:C7},11:{f:A7},12:{f:a7},13:{f:w7},14:{f:d7},15:{f:i7},16:{f:y7},17:{f:T7},18:{f:m7},19:{f:yp},20:{},21:{},22:{},23:{},24:{},25:{},26:{},27:{},28:{},29:{},30:{},31:{},32:{},33:{},34:{},35:{T:1},36:{T:-1},37:{T:1},38:{T:-1},39:{f:xA},40:{},42:{},43:{f:SE},44:{f:kE},45:{f:EE},46:{f:AE},47:{f:CE},48:{},49:{f:aT},50:{},51:{f:GE},52:{T:1},53:{T:-1},54:{T:1},55:{T:-1},56:{T:1},57:{T:-1},58:{},59:{},60:{f:rE},62:{f:N7},63:{f:JE},64:{f:q7},65:{},66:{},67:{},68:{},69:{},70:{},128:{},129:{T:1},130:{T:-1},131:{T:1,f:Fs,p:0},132:{T:-1},133:{T:1},134:{T:-1},135:{T:1},136:{T:-1},137:{T:1,f:W7},138:{T:-1},139:{T:1},140:{T:-1},141:{T:1},142:{T:-1},143:{T:1},144:{T:-1},145:{T:1},146:{T:-1},147:{f:J8},148:{f:Y8,p:16},151:{f:I7},152:{},153:{f:gA},154:{},155:{},156:{f:hA},157:{},158:{},159:{T:1,f:hE},160:{T:-1},161:{T:1,f:ll},162:{T:-1},163:{T:1},164:{T:-1},165:{T:1},166:{T:-1},167:{},168:{},169:{},170:{},171:{},172:{T:1},173:{T:-1},174:{},175:{},176:{f:M7},177:{T:1},178:{T:-1},179:{T:1},180:{T:-1},181:{T:1},182:{T:-1},183:{T:1},184:{T:-1},185:{T:1},186:{T:-1},187:{T:1},188:{T:-1},189:{T:1},190:{T:-1},191:{T:1},192:{T:-1},193:{T:1},194:{T:-1},195:{T:1},196:{T:-1},197:{T:1},198:{T:-1},199:{T:1},200:{T:-1},201:{T:1},202:{T:-1},203:{T:1},204:{T:-1},205:{T:1},206:{T:-1},207:{T:1},208:{T:-1},209:{T:1},210:{T:-1},211:{T:1},212:{T:-1},213:{T:1},214:{T:-1},215:{T:1},216:{T:-1},217:{T:1},218:{T:-1},219:{T:1},220:{T:-1},221:{T:1},222:{T:-1},223:{T:1},224:{T:-1},225:{T:1},226:{T:-1},227:{T:1},228:{T:-1},229:{T:1},230:{T:-1},231:{T:1},232:{T:-1},233:{T:1},234:{T:-1},235:{T:1},236:{T:-1},237:{T:1},238:{T:-1},239:{T:1},240:{T:-1},241:{T:1},242:{T:-1},243:{T:1},244:{T:-1},245:{T:1},246:{T:-1},247:{T:1},248:{T:-1},249:{T:1},250:{T:-1},251:{T:1},252:{T:-1},253:{T:1},254:{T:-1},255:{T:1},256:{T:-1},257:{T:1},258:{T:-1},259:{T:1},260:{T:-1},261:{T:1},262:{T:-1},263:{T:1},264:{T:-1},265:{T:1},266:{T:-1},267:{T:1},268:{T:-1},269:{T:1},270:{T:-1},271:{T:1},272:{T:-1},273:{T:1},274:{T:-1},275:{T:1},276:{T:-1},277:{},278:{T:1},279:{T:-1},280:{T:1},281:{T:-1},282:{T:1},283:{T:1},284:{T:-1},285:{T:1},286:{T:-1},287:{T:1},288:{T:-1},289:{T:1},290:{T:-1},291:{T:1},292:{T:-1},293:{T:1},294:{T:-1},295:{T:1},296:{T:-1},297:{T:1},298:{T:-1},299:{T:1},300:{T:-1},301:{T:1},302:{T:-1},303:{T:1},304:{T:-1},305:{T:1},306:{T:-1},307:{T:1},308:{T:-1},309:{T:1},310:{T:-1},311:{T:1},312:{T:-1},313:{T:-1},314:{T:1},315:{T:-1},316:{T:1},317:{T:-1},318:{T:1},319:{T:-1},320:{T:1},321:{T:-1},322:{T:1},323:{T:-1},324:{T:1},325:{T:-1},326:{T:1},327:{T:-1},328:{T:1},329:{T:-1},330:{T:1},331:{T:-1},332:{T:1},333:{T:-1},334:{T:1},335:{f:WE},336:{T:-1},337:{f:YE,T:1},338:{T:-1},339:{T:1},340:{T:-1},341:{T:1},342:{T:-1},343:{T:1},344:{T:-1},345:{T:1},346:{T:-1},347:{T:1},348:{T:-1},349:{T:1},350:{T:-1},351:{},352:{},353:{T:1},354:{T:-1},355:{f:Bg},357:{},358:{},359:{},360:{T:1},361:{},362:{f:KT},363:{},364:{},366:{},367:{},368:{},369:{},370:{},371:{},372:{T:1},373:{T:-1},374:{T:1},375:{T:-1},376:{T:1},377:{T:-1},378:{T:1},379:{T:-1},380:{T:1},381:{T:-1},382:{T:1},383:{T:-1},384:{T:1},385:{T:-1},386:{T:1},387:{T:-1},388:{T:1},389:{T:-1},390:{T:1},391:{T:-1},392:{T:1},393:{T:-1},394:{T:1},395:{T:-1},396:{},397:{},398:{},399:{},400:{},401:{T:1},403:{},404:{},405:{},406:{},407:{},408:{},409:{},410:{},411:{},412:{},413:{},414:{},415:{},416:{},417:{},418:{},419:{},420:{},421:{},422:{T:1},423:{T:1},424:{T:-1},425:{T:-1},426:{f:B7},427:{f:z7},428:{},429:{T:1},430:{T:-1},431:{T:1},432:{T:-1},433:{T:1},434:{T:-1},435:{T:1},436:{T:-1},437:{T:1},438:{T:-1},439:{T:1},440:{T:-1},441:{T:1},442:{T:-1},443:{T:1},444:{T:-1},445:{T:1},446:{T:-1},447:{T:1},448:{T:-1},449:{T:1},450:{T:-1},451:{T:1},452:{T:-1},453:{T:1},454:{T:-1},455:{T:1},456:{T:-1},457:{T:1},458:{T:-1},459:{T:1},460:{T:-1},461:{T:1},462:{T:-1},463:{T:1},464:{T:-1},465:{T:1},466:{T:-1},467:{T:1},468:{T:-1},469:{T:1},470:{T:-1},471:{},472:{},473:{T:1},474:{T:-1},475:{},476:{f:H7},477:{},478:{},479:{T:1},480:{T:-1},481:{T:1},482:{T:-1},483:{T:1},484:{T:-1},485:{f:K8},486:{T:1},487:{T:-1},488:{T:1},489:{T:-1},490:{T:1},491:{T:-1},492:{T:1},493:{T:-1},494:{f:P7},495:{T:1},496:{T:-1},497:{T:1},498:{T:-1},499:{},500:{T:1},501:{T:-1},502:{T:1},503:{T:-1},504:{},505:{T:1},506:{T:-1},507:{},508:{T:1},509:{T:-1},510:{T:1},511:{T:-1},512:{},513:{},514:{T:1},515:{T:-1},516:{T:1},517:{T:-1},518:{T:1},519:{T:-1},520:{T:1},521:{T:-1},522:{},523:{},524:{},525:{},526:{},527:{},528:{T:1},529:{T:-1},530:{T:1},531:{T:-1},532:{T:1},533:{T:-1},534:{},535:{},536:{},537:{},538:{T:1},539:{T:-1},540:{T:1},541:{T:-1},542:{T:1},548:{},549:{},550:{f:Bg},551:{},552:{},553:{},554:{T:1},555:{T:-1},556:{T:1},557:{T:-1},558:{T:1},559:{T:-1},560:{T:1},561:{T:-1},562:{},564:{},565:{T:1},566:{T:-1},569:{T:1},570:{T:-1},572:{},573:{T:1},574:{T:-1},577:{},578:{},579:{},580:{},581:{},582:{},583:{},584:{},585:{},586:{},587:{},588:{T:-1},589:{},590:{T:1},591:{T:-1},592:{T:1},593:{T:-1},594:{T:1},595:{T:-1},596:{},597:{T:1},598:{T:-1},599:{T:1},600:{T:-1},601:{T:1},602:{T:-1},603:{T:1},604:{T:-1},605:{T:1},606:{T:-1},607:{},608:{T:1},609:{T:-1},610:{},611:{T:1},612:{T:-1},613:{T:1},614:{T:-1},615:{T:1},616:{T:-1},617:{T:1},618:{T:-1},619:{T:1},620:{T:-1},625:{},626:{T:1},627:{T:-1},628:{T:1},629:{T:-1},630:{T:1},631:{T:-1},632:{f:rC},633:{T:1},634:{T:-1},635:{T:1,f:tC},636:{T:-1},637:{f:iT},638:{T:1},639:{},640:{T:-1},641:{T:1},642:{T:-1},643:{T:1},644:{},645:{T:-1},646:{T:1},648:{T:1},649:{},650:{T:-1},651:{f:oA},652:{},653:{T:1},654:{T:-1},655:{T:1},656:{T:-1},657:{T:1},658:{T:-1},659:{},660:{T:1},661:{},662:{T:-1},663:{},664:{T:1},665:{},666:{T:-1},667:{},668:{},669:{},671:{T:1},672:{T:-1},673:{T:1},674:{T:-1},675:{},676:{},677:{},678:{},679:{},680:{},681:{},1024:{},1025:{},1026:{T:1},1027:{T:-1},1028:{T:1},1029:{T:-1},1030:{},1031:{T:1},1032:{T:-1},1033:{T:1},1034:{T:-1},1035:{},1036:{},1037:{},1038:{T:1},1039:{T:-1},1040:{},1041:{T:1},1042:{T:-1},1043:{},1044:{},1045:{},1046:{T:1},1047:{T:-1},1048:{T:1},1049:{T:-1},1050:{},1051:{T:1},1052:{T:1},1053:{f:Y7},1054:{T:1},1055:{},1056:{T:1},1057:{T:-1},1058:{T:1},1059:{T:-1},1061:{},1062:{T:1},1063:{T:-1},1064:{T:1},1065:{T:-1},1066:{T:1},1067:{T:-1},1068:{T:1},1069:{T:-1},1070:{T:1},1071:{T:-1},1072:{T:1},1073:{T:-1},1075:{T:1},1076:{T:-1},1077:{T:1},1078:{T:-1},1079:{T:1},1080:{T:-1},1081:{T:1},1082:{T:-1},1083:{T:1},1084:{T:-1},1085:{},1086:{T:1},1087:{T:-1},1088:{T:1},1089:{T:-1},1090:{T:1},1091:{T:-1},1092:{T:1},1093:{T:-1},1094:{T:1},1095:{T:-1},1096:{},1097:{T:1},1098:{},1099:{T:-1},1100:{T:1},1101:{T:-1},1102:{},1103:{},1104:{},1105:{},1111:{},1112:{},1113:{T:1},1114:{T:-1},1115:{T:1},1116:{T:-1},1117:{},1118:{T:1},1119:{T:-1},1120:{T:1},1121:{T:-1},1122:{T:1},1123:{T:-1},1124:{T:1},1125:{T:-1},1126:{},1128:{T:1},1129:{T:-1},1130:{},1131:{T:1},1132:{T:-1},1133:{T:1},1134:{T:-1},1135:{T:1},1136:{T:-1},1137:{T:1},1138:{T:-1},1139:{T:1},1140:{T:-1},1141:{},1142:{T:1},1143:{T:-1},1144:{T:1},1145:{T:-1},1146:{},1147:{T:1},1148:{T:-1},1149:{T:1},1150:{T:-1},1152:{T:1},1153:{T:-1},1154:{T:-1},1155:{T:-1},1156:{T:-1},1157:{T:1},1158:{T:-1},1159:{T:1},1160:{T:-1},1161:{T:1},1162:{T:-1},1163:{T:1},1164:{T:-1},1165:{T:1},1166:{T:-1},1167:{T:1},1168:{T:-1},1169:{T:1},1170:{T:-1},1171:{},1172:{T:1},1173:{T:-1},1177:{},1178:{T:1},1180:{},1181:{},1182:{},2048:{T:1},2049:{T:-1},2050:{},2051:{T:1},2052:{T:-1},2053:{},2054:{},2055:{T:1},2056:{T:-1},2057:{T:1},2058:{T:-1},2060:{},2067:{},2068:{T:1},2069:{T:-1},2070:{},2071:{},2072:{T:1},2073:{T:-1},2075:{},2076:{},2077:{T:1},2078:{T:-1},2079:{},2080:{T:1},2081:{T:-1},2082:{},2083:{T:1},2084:{T:-1},2085:{T:1},2086:{T:-1},2087:{T:1},2088:{T:-1},2089:{T:1},2090:{T:-1},2091:{},2092:{},2093:{T:1},2094:{T:-1},2095:{},2096:{T:1},2097:{T:-1},2098:{T:1},2099:{T:-1},2100:{T:1},2101:{T:-1},2102:{},2103:{T:1},2104:{T:-1},2105:{},2106:{T:1},2107:{T:-1},2108:{},2109:{T:1},2110:{T:-1},2111:{T:1},2112:{T:-1},2113:{T:1},2114:{T:-1},2115:{},2116:{},2117:{},2118:{T:1},2119:{T:-1},2120:{},2121:{T:1},2122:{T:-1},2123:{T:1},2124:{T:-1},2125:{},2126:{T:1},2127:{T:-1},2128:{},2129:{T:1},2130:{T:-1},2131:{T:1},2132:{T:-1},2133:{T:1},2134:{},2135:{},2136:{},2137:{T:1},2138:{T:-1},2139:{T:1},2140:{T:-1},2141:{},3072:{},3073:{},4096:{T:1},4097:{T:-1},5002:{T:1},5003:{T:-1},5081:{T:1},5082:{T:-1},5083:{},5084:{T:1},5085:{T:-1},5086:{T:1},5087:{T:-1},5088:{},5089:{},5090:{},5092:{T:1},5093:{T:-1},5094:{},5095:{T:1},5096:{T:-1},5097:{},5099:{},65535:{n:""}};function st(e,t,a,s){var o=t;if(!isNaN(o)){var u=s||(a||[]).length||0,c=e.next(4);c.write_shift(2,o),c.write_shift(2,u),u>0&&gp(a)&&e.push(a)}}function WA(e,t,a,s){var o=(a||[]).length||0;if(o<=8224)return st(e,t,a,o);var u=t;if(!isNaN(u)){for(var c=a.parts||[],f=0,p=0,g=0;g+(c[f]||8224)<=8224;)g+=c[f]||8224,f++;var x=e.next(4);for(x.write_shift(2,u),x.write_shift(2,g),e.push(a.slice(p,p+g)),p+=g;p<o;){for(x=e.next(4),x.write_shift(2,60),g=0;g+(c[f]||8224)<=8224;)g+=c[f]||8224,f++;x.write_shift(2,g),e.push(a.slice(p,p+g)),p+=g}}}function yu(e,t,a){return e||(e=Ie(7)),e.write_shift(2,t),e.write_shift(2,a),e.write_shift(2,0),e.write_shift(1,0),e}function VA(e,t,a,s){var o=Ie(9);return yu(o,e,t),Z2(a,s||"b",o),o}function GA(e,t,a){var s=Ie(8+2*a.length);return yu(s,e,t),s.write_shift(1,a.length),s.write_shift(a.length,a,"sbcs"),s.l<s.length?s.slice(0,s.l):s}function ZA(e,t,a,s){if(t.v!=null)switch(t.t){case"d":case"n":var o=t.t=="d"?sn($r(t.v)):t.v;o==(o|0)&&o>=0&&o<65536?st(e,2,oE(a,s,o)):st(e,3,iE(a,s,o));return;case"b":case"e":st(e,5,VA(a,s,t.v,t.t));return;case"s":case"str":st(e,4,GA(a,s,(t.v||"").slice(0,255)));return}st(e,1,yu(null,a,s))}function qA(e,t,a,s){var o=Array.isArray(t),u=Ma(t["!ref"]||"A1"),c,f="",p=[];if(u.e.c>255||u.e.r>16383){if(s.WTF)throw new Error("Range "+(t["!ref"]||"A1")+" exceeds format limit A1:IV16384");u.e.c=Math.min(u.e.c,255),u.e.r=Math.min(u.e.c,16383),c=rr(u)}for(var g=u.s.r;g<=u.e.r;++g){f=Sr(g);for(var x=u.s.c;x<=u.e.c;++x){g===u.s.r&&(p[x]=Lr(x)),c=p[x]+f;var v=o?(t[g]||[])[x]:t[c];v&&ZA(e,v,g,x)}}}function YA(e,t){for(var a=t||{},s=nn(),o=0,u=0;u<e.SheetNames.length;++u)e.SheetNames[u]==a.sheet&&(o=u);if(o==0&&a.sheet&&e.SheetNames[0]!=a.sheet)throw new Error("Sheet not found: "+a.sheet);return st(s,a.biff==4?1033:a.biff==3?521:9,_p(e,16,a)),qA(s,e.Sheets[e.SheetNames[o]],o,a),st(s,10),s.end()}function XA(e,t,a){st(e,49,$T({sz:12,name:"Arial"},a))}function KA(e,t,a){t&&[[5,8],[23,26],[41,44],[50,392]].forEach(function(s){for(var o=s[0];o<=s[1];++o)t[o]!=null&&st(e,1054,GT(o,t[o],a))})}function JA(e,t){var a=Ie(19);a.write_shift(4,2151),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(2,3),a.write_shift(1,1),a.write_shift(4,0),st(e,2151,a),a=Ie(39),a.write_shift(4,2152),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(2,3),a.write_shift(1,0),a.write_shift(4,0),a.write_shift(2,1),a.write_shift(4,4),a.write_shift(2,0),X2(Ma(t["!ref"]||"A1"),a),a.write_shift(4,4),st(e,2152,a)}function QA(e,t){for(var a=0;a<16;++a)st(e,224,wv({numFmtId:0,style:!0},0,t));t.cellXfs.forEach(function(s){st(e,224,wv(s,0,t))})}function eO(e,t){for(var a=0;a<t["!links"].length;++a){var s=t["!links"][a];st(e,440,eE(s)),s[1].Tooltip&&st(e,2048,tE(s))}delete t["!links"]}function tO(e,t){if(t){var a=0;t.forEach(function(s,o){++a<=256&&s&&st(e,125,nE(Yf(o,s),o))})}}function aO(e,t,a,s,o){var u=16+so(o.cellXfs,t,o);if(t.v==null&&!t.bf){st(e,513,tl(a,s,u));return}if(t.bf)st(e,6,j8(t,a,s,o,u));else switch(t.t){case"d":case"n":var c=t.t=="d"?sn($r(t.v)):t.v;st(e,515,XT(a,s,c,u));break;case"b":case"e":st(e,517,YT(a,s,t.v,u,o,t.t));break;case"s":case"str":if(o.bookSST){var f=jp(o.Strings,t.v,o.revStrings);st(e,253,WT(a,s,f,u))}else st(e,516,VT(a,s,(t.v||"").slice(0,255),u,o));break;default:st(e,513,tl(a,s,u))}}function rO(e,t,a){var s=nn(),o=a.SheetNames[e],u=a.Sheets[o]||{},c=(a||{}).Workbook||{},f=(c.Sheets||[])[e]||{},p=Array.isArray(u),g=t.biff==8,x,v="",_=[],k=Ma(u["!ref"]||"A1"),T=g?65536:16384;if(k.e.c>255||k.e.r>=T){if(t.WTF)throw new Error("Range "+(u["!ref"]||"A1")+" exceeds format limit A1:IV16384");k.e.c=Math.min(k.e.c,255),k.e.r=Math.min(k.e.c,T-1)}st(s,2057,_p(a,16,t)),st(s,13,Hn(1)),st(s,12,Hn(100)),st(s,15,Ur(!0)),st(s,17,Ur(!1)),st(s,16,el(.001)),st(s,95,Ur(!0)),st(s,42,Ur(!1)),st(s,43,Ur(!1)),st(s,130,Hn(1)),st(s,128,qT()),st(s,131,Ur(!1)),st(s,132,Ur(!1)),g&&tO(s,u["!cols"]),st(s,512,ZT(k,t)),g&&(u["!links"]=[]);for(var N=k.s.r;N<=k.e.r;++N){v=Sr(N);for(var j=k.s.c;j<=k.e.c;++j){N===k.s.r&&(_[j]=Lr(j)),x=_[j]+v;var P=p?(u[N]||[])[j]:u[x];P&&(aO(s,P,N,j,t),g&&P.l&&u["!links"].push([x,P.l]))}}var C=f.CodeName||f.name||o;return g&&st(s,574,HT((c.Views||[])[0])),g&&(u["!merges"]||[]).length&&st(s,229,QT(u["!merges"])),g&&eO(s,u),st(s,442,Y2(C)),g&&JA(s,u),st(s,10),s.end()}function nO(e,t,a){var s=nn(),o=(e||{}).Workbook||{},u=o.Sheets||[],c=o.WBProps||{},f=a.biff==8,p=a.biff==5;if(st(s,2057,_p(e,5,a)),a.bookType=="xla"&&st(s,135),st(s,225,f?Hn(1200):null),st(s,193,CT(2)),p&&st(s,191),p&&st(s,192),st(s,226),st(s,92,IT("SheetJS",a)),st(s,66,Hn(f?1200:1252)),f&&st(s,353,Hn(0)),f&&st(s,448),st(s,317,sE(e.SheetNames.length)),f&&e.vbaraw&&st(s,211),f&&e.vbaraw){var g=c.CodeName||"ThisWorkbook";st(s,442,Y2(g))}st(s,156,Hn(17)),st(s,25,Ur(!1)),st(s,18,Ur(!1)),st(s,19,Hn(0)),f&&st(s,431,Ur(!1)),f&&st(s,444,Hn(0)),st(s,61,UT()),st(s,64,Ur(!1)),st(s,141,Hn(0)),st(s,34,Ur(cA(e)=="true")),st(s,14,Ur(!0)),f&&st(s,439,Ur(!1)),st(s,218,Hn(0)),XA(s,e,a),KA(s,e.SSF,a),QA(s,a),f&&st(s,352,Ur(!1));var x=s.end(),v=nn();f&&st(v,140,aE()),f&&a.Strings&&WA(v,252,zT(a.Strings)),st(v,10);var _=v.end(),k=nn(),T=0,N=0;for(N=0;N<e.SheetNames.length;++N)T+=(f?12:11)+(f?2:1)*e.SheetNames[N].length;var j=x.length+T+_.length;for(N=0;N<e.SheetNames.length;++N){var P=u[N]||{};st(k,133,BT({pos:j,hs:P.Hidden||0,dt:0,name:e.SheetNames[N]},a)),j+=t[N].length}var C=k.end();if(T!=C.length)throw new Error("BS8 "+T+" != "+C.length);var O=[];return x.length&&O.push(x),C.length&&O.push(C),_.length&&O.push(_),kr(O)}function sO(e,t){var a=t||{},s=[];e&&!e.SSF&&(e.SSF=on(Ga)),e&&e.SSF&&(Wf(),$f(e.SSF),a.revssf=Vf(e.SSF),a.revssf[e.SSF[65535]]=0,a.ssf=e.SSF),a.Strings=[],a.Strings.Count=0,a.Strings.Unique=0,Tp(a),a.cellXfs=[],so(a.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={});for(var o=0;o<e.SheetNames.length;++o)s[s.length]=rO(o,a,e);return s.unshift(nO(e,s,a)),kr(s)}function ww(e,t){for(var a=0;a<=e.SheetNames.length;++a){var s=e.Sheets[e.SheetNames[a]];if(!(!s||!s["!ref"])){var o=En(s["!ref"]);o.e.c>255&&typeof console!="undefined"&&console.error&&console.error("Worksheet '"+e.SheetNames[a]+"' extends beyond column IV (255). Data may be lost.")}}var u=t||{};switch(u.biff||2){case 8:case 5:return sO(e,t);case 4:case 3:case 2:return YA(e,t)}throw new Error("invalid type "+u.bookType+" for BIFF")}function iO(e,t,a,s){for(var o=e["!merges"]||[],u=[],c=t.s.c;c<=t.e.c;++c){for(var f=0,p=0,g=0;g<o.length;++g)if(!(o[g].s.r>a||o[g].s.c>c)&&!(o[g].e.r<a||o[g].e.c<c)){if(o[g].s.r<a||o[g].s.c<c){f=-1;break}f=o[g].e.r-o[g].s.r+1,p=o[g].e.c-o[g].s.c+1;break}if(!(f<0)){var x=xa({r:a,c}),v=s.dense?(e[a]||[])[c]:e[x],_=v&&v.v!=null&&(v.h||F5(v.w||(mi(v),v.w)||""))||"",k={};f>1&&(k.rowspan=f),p>1&&(k.colspan=p),s.editable?_='<span contenteditable="true">'+_+"</span>":v&&(k["data-t"]=v&&v.t||"z",v.v!=null&&(k["data-v"]=v.v),v.z!=null&&(k["data-z"]=v.z),v.l&&(v.l.Target||"#").charAt(0)!="#"&&(_='<a href="'+v.l.Target+'">'+_+"</a>")),k.id=(s.id||"sjs")+"-"+x,u.push(rt("td",_,k))}}var T="<tr>";return T+u.join("")+"</tr>"}var oO='<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body>',lO="</body></html>";function cO(e,t,a){var s=[];return s.join("")+"<table"+(a&&a.id?' id="'+a.id+'"':"")+">"}function kw(e,t){var a=t||{},s=a.header!=null?a.header:oO,o=a.footer!=null?a.footer:lO,u=[s],c=En(e["!ref"]);a.dense=Array.isArray(e),u.push(cO(e,c,a));for(var f=c.s.r;f<=c.e.r;++f)u.push(iO(e,c,f,a));return u.push("</table>"+o),u.join("")}function Nw(e,t,a){var s=a||{},o=0,u=0;if(s.origin!=null)if(typeof s.origin=="number")o=s.origin;else{var c=typeof s.origin=="string"?hr(s.origin):s.origin;o=c.r,u=c.c}var f=t.getElementsByTagName("tr"),p=Math.min(s.sheetRows||1e7,f.length),g={s:{r:0,c:0},e:{r:o,c:u}};if(e["!ref"]){var x=En(e["!ref"]);g.s.r=Math.min(g.s.r,x.s.r),g.s.c=Math.min(g.s.c,x.s.c),g.e.r=Math.max(g.e.r,x.e.r),g.e.c=Math.max(g.e.c,x.e.c),o==-1&&(g.e.r=o=x.e.r+1)}var v=[],_=0,k=e["!rows"]||(e["!rows"]=[]),T=0,N=0,j=0,P=0,C=0,O=0;for(e["!cols"]||(e["!cols"]=[]);T<f.length&&N<p;++T){var R=f[T];if(Cv(R)){if(s.display)continue;k[N]={hidden:!0}}var U=R.children;for(j=P=0;j<U.length;++j){var H=U[j];if(!(s.display&&Cv(H))){var B=H.hasAttribute("data-v")?H.getAttribute("data-v"):H.hasAttribute("v")?H.getAttribute("v"):U5(H.innerHTML),oe=H.getAttribute("data-z")||H.getAttribute("z");for(_=0;_<v.length;++_){var se=v[_];se.s.c==P+u&&se.s.r<N+o&&N+o<=se.e.r&&(P=se.e.c+1-u,_=-1)}O=+H.getAttribute("colspan")||1,((C=+H.getAttribute("rowspan")||1)>1||O>1)&&v.push({s:{r:N+o,c:P+u},e:{r:N+o+(C||1)-1,c:P+u+(O||1)-1}});var pe={t:"s",v:B},le=H.getAttribute("data-t")||H.getAttribute("t")||"";B!=null&&(B.length==0?pe.t=le||"z":s.raw||B.trim().length==0||le=="s"||(B==="TRUE"?pe={t:"b",v:!0}:B==="FALSE"?pe={t:"b",v:!1}:isNaN(oi(B))?isNaN(Kd(B).getDate())||(pe={t:"d",v:$r(B)},s.cellDates||(pe={t:"n",v:sn(pe.v)}),pe.z=s.dateNF||Ga[14]):pe={t:"n",v:oi(B)})),pe.z===void 0&&oe!=null&&(pe.z=oe);var re="",de=H.getElementsByTagName("A");if(de&&de.length)for(var ye=0;ye<de.length&&!(de[ye].hasAttribute("href")&&(re=de[ye].getAttribute("href"),re.charAt(0)!="#"));++ye);re&&re.charAt(0)!="#"&&(pe.l={Target:re}),s.dense?(e[N+o]||(e[N+o]=[]),e[N+o][P+u]=pe):e[xa({c:P+u,r:N+o})]=pe,g.e.c<P+u&&(g.e.c=P+u),P+=O}}++N}return v.length&&(e["!merges"]=(e["!merges"]||[]).concat(v)),g.e.r=Math.max(g.e.r,N-1+o),e["!ref"]=rr(g),N>=p&&(e["!fullref"]=rr((g.e.r=f.length-T+N-1+o,g))),e}function Sw(e,t){var a=t||{},s=a.dense?[]:{};return Nw(s,e,t)}function dO(e,t){return nl(Sw(e,t),t)}function Cv(e){var t="",a=uO(e);return a&&(t=a(e).getPropertyValue("display")),t||(t=e.style&&e.style.display),t==="none"}function uO(e){return e.ownerDocument.defaultView&&typeof e.ownerDocument.defaultView.getComputedStyle=="function"?e.ownerDocument.defaultView.getComputedStyle:typeof getComputedStyle=="function"?getComputedStyle:null}var fO=(function(){var e=["<office:master-styles>",'<style:master-page style:name="mp1" style:page-layout-name="mp1">',"<style:header/>",'<style:header-left style:display="false"/>',"<style:footer/>",'<style:footer-left style:display="false"/>',"</style:master-page>","</office:master-styles>"].join(""),t="<office:document-styles "+Qd({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","office:version":"1.2"})+">"+e+"</office:document-styles>";return function(){return nr+t}})(),Av=(function(){var e=function(u){return pa(u).replace(/ +/g,function(c){return'<text:s text:c="'+c.length+'"/>'}).replace(/\t/g,"<text:tab/>").replace(/\n/g,"</text:p><text:p>").replace(/^ /,"<text:s/>").replace(/ $/,"<text:s/>")},t=` <table:table-cell />
`,a=` <table:covered-table-cell/>
`,s=function(u,c,f){var p=[];p.push(' <table:table table:name="'+pa(c.SheetNames[f])+`" table:style-name="ta1">
`);var g=0,x=0,v=En(u["!ref"]||"A1"),_=u["!merges"]||[],k=0,T=Array.isArray(u);if(u["!cols"])for(x=0;x<=v.e.c;++x)p.push(" <table:table-column"+(u["!cols"][x]?' table:style-name="co'+u["!cols"][x].ods+'"':"")+`></table:table-column>
`);var N="",j=u["!rows"]||[];for(g=0;g<v.s.r;++g)N=j[g]?' table:style-name="ro'+j[g].ods+'"':"",p.push(" <table:table-row"+N+`></table:table-row>
`);for(;g<=v.e.r;++g){for(N=j[g]?' table:style-name="ro'+j[g].ods+'"':"",p.push(" <table:table-row"+N+`>
`),x=0;x<v.s.c;++x)p.push(t);for(;x<=v.e.c;++x){var P=!1,C={},O="";for(k=0;k!=_.length;++k)if(!(_[k].s.c>x)&&!(_[k].s.r>g)&&!(_[k].e.c<x)&&!(_[k].e.r<g)){(_[k].s.c!=x||_[k].s.r!=g)&&(P=!0),C["table:number-columns-spanned"]=_[k].e.c-_[k].s.c+1,C["table:number-rows-spanned"]=_[k].e.r-_[k].s.r+1;break}if(P){p.push(a);continue}var R=xa({r:g,c:x}),U=T?(u[g]||[])[x]:u[R];if(U&&U.f&&(C["table:formula"]=pa(L8(U.f)),U.F&&U.F.slice(0,R.length)==R)){var H=En(U.F);C["table:number-matrix-columns-spanned"]=H.e.c-H.s.c+1,C["table:number-matrix-rows-spanned"]=H.e.r-H.s.r+1}if(!U){p.push(t);continue}switch(U.t){case"b":O=U.v?"TRUE":"FALSE",C["office:value-type"]="boolean",C["office:boolean-value"]=U.v?"true":"false";break;case"n":O=U.w||String(U.v||0),C["office:value-type"]="float",C["office:value"]=U.v||0;break;case"s":case"str":O=U.v==null?"":U.v,C["office:value-type"]="string";break;case"d":O=U.w||$r(U.v).toISOString(),C["office:value-type"]="date",C["office:date-value"]=$r(U.v).toISOString(),C["table:style-name"]="ce1";break;default:p.push(t);continue}var B=e(O);if(U.l&&U.l.Target){var oe=U.l.Target;oe=oe.charAt(0)=="#"?"#"+M8(oe.slice(1)):oe,oe.charAt(0)!="#"&&!oe.match(/^\w+:/)&&(oe="../"+oe),B=rt("text:a",B,{"xlink:href":oe.replace(/&/g,"&amp;")})}p.push(" "+rt("table:table-cell",rt("text:p",B,{}),C)+`
`)}p.push(` </table:table-row>
`)}return p.push(` </table:table>
`),p.join("")},o=function(u,c){u.push(` <office:automatic-styles>
`),u.push(` <number:date-style style:name="N37" number:automatic-order="true">
`),u.push(` <number:month number:style="long"/>
`),u.push(` <number:text>/</number:text>
`),u.push(` <number:day number:style="long"/>
`),u.push(` <number:text>/</number:text>
`),u.push(` <number:year/>
`),u.push(` </number:date-style>
`);var f=0;c.SheetNames.map(function(g){return c.Sheets[g]}).forEach(function(g){if(g&&g["!cols"]){for(var x=0;x<g["!cols"].length;++x)if(g["!cols"][x]){var v=g["!cols"][x];if(v.width==null&&v.wpx==null&&v.wch==null)continue;wp(v),v.ods=f;var _=g["!cols"][x].wpx+"px";u.push(' <style:style style:name="co'+f+`" style:family="table-column">
`),u.push(' <style:table-column-properties fo:break-before="auto" style:column-width="'+_+`"/>
`),u.push(` </style:style>
`),++f}}});var p=0;c.SheetNames.map(function(g){return c.Sheets[g]}).forEach(function(g){if(g&&g["!rows"]){for(var x=0;x<g["!rows"].length;++x)if(g["!rows"][x]){g["!rows"][x].ods=p;var v=g["!rows"][x].hpx+"px";u.push(' <style:style style:name="ro'+p+`" style:family="table-row">
`),u.push(' <style:table-row-properties fo:break-before="auto" style:row-height="'+v+`"/>
`),u.push(` </style:style>
`),++p}}}),u.push(` <style:style style:name="ta1" style:family="table" style:master-page-name="mp1">
`),u.push(` <style:table-properties table:display="true" style:writing-mode="lr-tb"/>
`),u.push(` </style:style>
`),u.push(` <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>
`),u.push(` </office:automatic-styles>
`)};return function(c,f){var p=[nr],g=Qd({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:meta":"urn:oasis:names:tc:opendocument:xmlns:meta:1.0","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:presentation":"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:chart":"urn:oasis:names:tc:opendocument:xmlns:chart:1.0","xmlns:dr3d":"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0","xmlns:math":"http://www.w3.org/1998/Math/MathML","xmlns:form":"urn:oasis:names:tc:opendocument:xmlns:form:1.0","xmlns:script":"urn:oasis:names:tc:opendocument:xmlns:script:1.0","xmlns:ooo":"http://openoffice.org/2004/office","xmlns:ooow":"http://openoffice.org/2004/writer","xmlns:oooc":"http://openoffice.org/2004/calc","xmlns:dom":"http://www.w3.org/2001/xml-events","xmlns:xforms":"http://www.w3.org/2002/xforms","xmlns:xsd":"http://www.w3.org/2001/XMLSchema","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:sheet":"urn:oasis:names:tc:opendocument:sh33tjs:1.0","xmlns:rpt":"http://openoffice.org/2005/report","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","xmlns:xhtml":"http://www.w3.org/1999/xhtml","xmlns:grddl":"http://www.w3.org/2003/g/data-view#","xmlns:tableooo":"http://openoffice.org/2009/table","xmlns:drawooo":"http://openoffice.org/2010/draw","xmlns:calcext":"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0","xmlns:loext":"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0","xmlns:field":"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0","xmlns:formx":"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0","xmlns:css3t":"http://www.w3.org/TR/css3-text/","office:version":"1.2"}),x=Qd({"xmlns:config":"urn:oasis:names:tc:opendocument:xmlns:config:1.0","office:mimetype":"application/vnd.oasis.opendocument.spreadsheet"});f.bookType=="fods"?(p.push("<office:document"+g+x+`>
`),p.push(z2().replace(/office:document-meta/g,"office:meta"))):p.push("<office:document-content"+g+`>
`),o(p,c),p.push(` <office:body>
`),p.push(` <office:spreadsheet>
`);for(var v=0;v!=c.SheetNames.length;++v)p.push(s(c.Sheets[c.SheetNames[v]],c,v));return p.push(` </office:spreadsheet>
`),p.push(` </office:body>
`),f.bookType=="fods"?p.push("</office:document>"):p.push("</office:document-content>"),p.join("")}})();function jw(e,t){if(t.bookType=="fods")return Av(e,t);var a=up(),s="",o=[],u=[];return s="mimetype",Wt(a,s,"application/vnd.oasis.opendocument.spreadsheet"),s="content.xml",Wt(a,s,Av(e,t)),o.push([s,"text/xml"]),u.push([s,"ContentFile"]),s="styles.xml",Wt(a,s,fO(e,t)),o.push([s,"text/xml"]),u.push([s,"StylesFile"]),s="meta.xml",Wt(a,s,nr+z2()),o.push([s,"text/xml"]),u.push([s,"MetadataFile"]),s="manifest.rdf",Wt(a,s,NT(u)),o.push([s,"application/rdf+xml"]),s="META-INF/manifest.xml",Wt(a,s,wT(o)),a}function Cf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function hO(e){return typeof TextEncoder!="undefined"?new TextEncoder().encode(e):cs(Jd(e))}function mO(e,t){e:for(var a=0;a<=e.length-t.length;++a){for(var s=0;s<t.length;++s)if(e[a+s]!=t[s])continue e;return!0}return!1}function ro(e){var t=e.reduce(function(o,u){return o+u.length},0),a=new Uint8Array(t),s=0;return e.forEach(function(o){a.set(o,s),s+=o.length}),a}function gO(e,t,a){var s=Math.floor(a==0?0:Math.LOG10E*Math.log(Math.abs(a)))+6176-20,o=a/Math.pow(10,s-6176);e[t+15]|=s>>7,e[t+14]|=(s&127)<<1;for(var u=0;o>=1;++u,o/=256)e[t+u]=o&255;e[t+15]|=a>=0?0:128}function eu(e,t){var a=t?t[0]:0,s=e[a]&127;e:if(e[a++]>=128&&(s|=(e[a]&127)<<7,e[a++]<128||(s|=(e[a]&127)<<14,e[a++]<128)||(s|=(e[a]&127)<<21,e[a++]<128)||(s+=(e[a]&127)*Math.pow(2,28),++a,e[a++]<128)||(s+=(e[a]&127)*Math.pow(2,35),++a,e[a++]<128)||(s+=(e[a]&127)*Math.pow(2,42),++a,e[a++]<128)))break e;return t&&(t[0]=a),s}function ma(e){var t=new Uint8Array(7);t[0]=e&127;var a=1;e:if(e>127){if(t[a-1]|=128,t[a]=e>>7&127,++a,e<=16383||(t[a-1]|=128,t[a]=e>>14&127,++a,e<=2097151)||(t[a-1]|=128,t[a]=e>>21&127,++a,e<=268435455)||(t[a-1]|=128,t[a]=e/256>>>21&127,++a,e<=34359738367)||(t[a-1]|=128,t[a]=e/65536>>>21&127,++a,e<=4398046511103))break e;t[a-1]|=128,t[a]=e/16777216>>>21&127,++a}return t.slice(0,a)}function hc(e){var t=0,a=e[t]&127;e:if(e[t++]>=128){if(a|=(e[t]&127)<<7,e[t++]<128||(a|=(e[t]&127)<<14,e[t++]<128)||(a|=(e[t]&127)<<21,e[t++]<128))break e;a|=(e[t]&127)<<28}return a}function lr(e){for(var t=[],a=[0];a[0]<e.length;){var s=a[0],o=eu(e,a),u=o&7;o=Math.floor(o/8);var c=0,f;if(o==0)break;switch(u){case 0:{for(var p=a[0];e[a[0]++]>=128;);f=e.slice(p,a[0])}break;case 5:c=4,f=e.slice(a[0],a[0]+c),a[0]+=c;break;case 1:c=8,f=e.slice(a[0],a[0]+c),a[0]+=c;break;case 2:c=eu(e,a),f=e.slice(a[0],a[0]+c),a[0]+=c;break;case 3:case 4:default:throw new Error("PB Type ".concat(u," for Field ").concat(o," at offset ").concat(s))}var g={data:f,type:u};t[o]==null?t[o]=[g]:t[o].push(g)}return t}function _r(e){var t=[];return e.forEach(function(a,s){a.forEach(function(o){o.data&&(t.push(ma(s*8+o.type)),o.type==2&&t.push(ma(o.data.length)),t.push(o.data))})}),ro(t)}function os(e){for(var t,a=[],s=[0];s[0]<e.length;){var o=eu(e,s),u=lr(e.slice(s[0],s[0]+o));s[0]+=o;var c={id:hc(u[1][0].data),messages:[]};u[2].forEach(function(f){var p=lr(f.data),g=hc(p[3][0].data);c.messages.push({meta:p,data:e.slice(s[0],s[0]+g)}),s[0]+=g}),(t=u[3])!=null&&t[0]&&(c.merge=hc(u[3][0].data)>>>0>0),a.push(c)}return a}function tc(e){var t=[];return e.forEach(function(a){var s=[];s[1]=[{data:ma(a.id),type:0}],s[2]=[],a.merge!=null&&(s[3]=[{data:ma(+!!a.merge),type:0}]);var o=[];a.messages.forEach(function(c){o.push(c.data),c.meta[3]=[{type:0,data:ma(c.data.length)}],s[2].push({data:_r(c.meta),type:2})});var u=_r(s);t.push(ma(u.length)),t.push(u),o.forEach(function(c){return t.push(c)})}),ro(t)}function pO(e,t){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var a=[0],s=eu(t,a),o=[];a[0]<t.length;){var u=t[a[0]]&3;if(u==0){var c=t[a[0]++]>>2;if(c<60)++c;else{var f=c-59;c=t[a[0]],f>1&&(c|=t[a[0]+1]<<8),f>2&&(c|=t[a[0]+2]<<16),f>3&&(c|=t[a[0]+3]<<24),c>>>=0,c++,a[0]+=f}o.push(t.slice(a[0],a[0]+c)),a[0]+=c;continue}else{var p=0,g=0;if(u==1?(g=(t[a[0]]>>2&7)+4,p=(t[a[0]++]&224)<<3,p|=t[a[0]++]):(g=(t[a[0]++]>>2)+1,u==2?(p=t[a[0]]|t[a[0]+1]<<8,a[0]+=2):(p=(t[a[0]]|t[a[0]+1]<<8|t[a[0]+2]<<16|t[a[0]+3]<<24)>>>0,a[0]+=4)),o=[ro(o)],p==0)throw new Error("Invalid offset 0");if(p>o[0].length)throw new Error("Invalid offset beyond length");if(g>=p)for(o.push(o[0].slice(-p)),g-=p;g>=o[o.length-1].length;)o.push(o[o.length-1]),g-=o[o.length-1].length;o.push(o[0].slice(-p,-p+g))}}var x=ro(o);if(x.length!=s)throw new Error("Unexpected length: ".concat(x.length," != ").concat(s));return x}function ls(e){for(var t=[],a=0;a<e.length;){var s=e[a++],o=e[a]|e[a+1]<<8|e[a+2]<<16;a+=3,t.push(pO(s,e.slice(a,a+o))),a+=o}if(a!==e.length)throw new Error("data is not a valid framed stream!");return ro(t)}function ac(e){for(var t=[],a=0;a<e.length;){var s=Math.min(e.length-a,268435455),o=new Uint8Array(4);t.push(o);var u=ma(s),c=u.length;t.push(u),s<=60?(c++,t.push(new Uint8Array([s-1<<2]))):s<=256?(c+=2,t.push(new Uint8Array([240,s-1&255]))):s<=65536?(c+=3,t.push(new Uint8Array([244,s-1&255,s-1>>8&255]))):s<=16777216?(c+=4,t.push(new Uint8Array([248,s-1&255,s-1>>8&255,s-1>>16&255]))):s<=4294967296&&(c+=5,t.push(new Uint8Array([252,s-1&255,s-1>>8&255,s-1>>16&255,s-1>>>24&255]))),t.push(e.slice(a,a+s)),c+=s,o[0]=0,o[1]=c&255,o[2]=c>>8&255,o[3]=c>>16&255,a+=s}return ro(t)}function bg(e,t){var a=new Uint8Array(32),s=Cf(a),o=12,u=0;switch(a[0]=5,e.t){case"n":a[1]=2,gO(a,o,e.v),u|=1,o+=16;break;case"b":a[1]=6,s.setFloat64(o,e.v?1:0,!0),u|=2,o+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));a[1]=3,s.setUint32(o,t.indexOf(e.v),!0),u|=8,o+=4;break;default:throw"unsupported cell type "+e.t}return s.setUint32(8,u,!0),a.slice(0,o)}function vg(e,t){var a=new Uint8Array(32),s=Cf(a),o=12,u=0;switch(a[0]=3,e.t){case"n":a[2]=2,s.setFloat64(o,e.v,!0),u|=32,o+=8;break;case"b":a[2]=6,s.setFloat64(o,e.v?1:0,!0),u|=32,o+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));a[2]=3,s.setUint32(o,t.indexOf(e.v),!0),u|=16,o+=4;break;default:throw"unsupported cell type "+e.t}return s.setUint32(4,u,!0),a.slice(0,o)}function Ji(e){var t=lr(e);return eu(t[1][0].data)}function xO(e,t,a){var s,o,u,c;if(!((s=e[6])!=null&&s[0])||!((o=e[7])!=null&&o[0]))throw"Mutation only works on post-BNC storages!";var f=((c=(u=e[8])==null?void 0:u[0])==null?void 0:c.data)&&hc(e[8][0].data)>0||!1;if(f)throw"Math only works with normal offsets";for(var p=0,g=Cf(e[7][0].data),x=0,v=[],_=Cf(e[4][0].data),k=0,T=[],N=0;N<t.length;++N){if(t[N]==null){g.setUint16(N*2,65535,!0),_.setUint16(N*2,65535);continue}g.setUint16(N*2,x,!0),_.setUint16(N*2,k,!0);var j,P;switch(typeof t[N]){case"string":j=bg({t:"s",v:t[N]},a),P=vg({t:"s",v:t[N]},a);break;case"number":j=bg({t:"n",v:t[N]},a),P=vg({t:"n",v:t[N]},a);break;case"boolean":j=bg({t:"b",v:t[N]},a),P=vg({t:"b",v:t[N]},a);break;default:throw new Error("Unsupported value "+t[N])}v.push(j),x+=j.length,T.push(P),k+=P.length,++p}for(e[2][0].data=ma(p);N<e[7][0].data.length/2;++N)g.setUint16(N*2,65535,!0),_.setUint16(N*2,65535,!0);return e[6][0].data=ro(v),e[3][0].data=ro(T),p}function yO(e,t){if(!t||!t.numbers)throw new Error("Must pass a `numbers` option -- check the README");var a=e.Sheets[e.SheetNames[0]];e.SheetNames.length>1&&console.error("The Numbers writer currently writes only the first table");var s=En(a["!ref"]);s.s.r=s.s.c=0;var o=!1;s.e.c>9&&(o=!0,s.e.c=9),s.e.r>49&&(o=!0,s.e.r=49),o&&console.error("The Numbers writer is currently limited to ".concat(rr(s)));var u=Af(a,{range:s,header:1}),c=["~Sh33tJ5~"];u.forEach(function(G){return G.forEach(function(q){typeof q=="string"&&c.push(q)})});var f={},p=[],g=Na.read(t.numbers,{type:"base64"});g.FileIndex.map(function(G,q){return[G,g.FullPaths[q]]}).forEach(function(G){var q=G[0],K=G[1];if(q.type==2&&q.name.match(/\.iwa/)){var fe=q.content,Pe=ls(fe),We=os(Pe);We.forEach(function(Fe){p.push(Fe.id),f[Fe.id]={deps:[],location:K,type:hc(Fe.messages[0].meta[1][0].data)}})}}),p.sort(function(G,q){return G-q});var x=p.filter(function(G){return G>1}).map(function(G){return[G,ma(G)]});g.FileIndex.map(function(G,q){return[G,g.FullPaths[q]]}).forEach(function(G){var q=G[0];if(G[1],!!q.name.match(/\.iwa/)){var K=os(ls(q.content));K.forEach(function(fe){fe.messages.forEach(function(Pe){x.forEach(function(We){fe.messages.some(function(Fe){return hc(Fe.meta[1][0].data)!=11006&&mO(Fe.data,We[1])})&&f[We[0]].deps.push(fe.id)})})})}});for(var v=Na.find(g,f[1].location),_=os(ls(v.content)),k,T=0;T<_.length;++T){var N=_[T];N.id==1&&(k=N)}var j=Ji(lr(k.messages[0].data)[1][0].data);for(v=Na.find(g,f[j].location),_=os(ls(v.content)),T=0;T<_.length;++T)N=_[T],N.id==j&&(k=N);for(j=Ji(lr(k.messages[0].data)[2][0].data),v=Na.find(g,f[j].location),_=os(ls(v.content)),T=0;T<_.length;++T)N=_[T],N.id==j&&(k=N);for(j=Ji(lr(k.messages[0].data)[2][0].data),v=Na.find(g,f[j].location),_=os(ls(v.content)),T=0;T<_.length;++T)N=_[T],N.id==j&&(k=N);var P=lr(k.messages[0].data);{P[6][0].data=ma(s.e.r+1),P[7][0].data=ma(s.e.c+1);var C=Ji(P[46][0].data),O=Na.find(g,f[C].location),R=os(ls(O.content));{for(var U=0;U<R.length&&R[U].id!=C;++U);if(R[U].id!=C)throw"Bad ColumnRowUIDMapArchive";var H=lr(R[U].messages[0].data);H[1]=[],H[2]=[],H[3]=[];for(var B=0;B<=s.e.c;++B){var oe=[];oe[1]=oe[2]=[{type:0,data:ma(B+420690)}],H[1].push({type:2,data:_r(oe)}),H[2].push({type:0,data:ma(B)}),H[3].push({type:0,data:ma(B)})}H[4]=[],H[5]=[],H[6]=[];for(var se=0;se<=s.e.r;++se)oe=[],oe[1]=oe[2]=[{type:0,data:ma(se+726270)}],H[4].push({type:2,data:_r(oe)}),H[5].push({type:0,data:ma(se)}),H[6].push({type:0,data:ma(se)});R[U].messages[0].data=_r(H)}O.content=ac(tc(R)),O.size=O.content.length,delete P[46];var pe=lr(P[4][0].data);{pe[7][0].data=ma(s.e.r+1);var le=lr(pe[1][0].data),re=Ji(le[2][0].data);O=Na.find(g,f[re].location),R=os(ls(O.content));{if(R[0].id!=re)throw"Bad HeaderStorageBucket";var de=lr(R[0].messages[0].data);for(se=0;se<u.length;++se){var ye=lr(de[2][0].data);ye[1][0].data=ma(se),ye[4][0].data=ma(u[se].length),de[2][se]={type:de[2][0].type,data:_r(ye)}}R[0].messages[0].data=_r(de)}O.content=ac(tc(R)),O.size=O.content.length;var ue=Ji(pe[2][0].data);O=Na.find(g,f[ue].location),R=os(ls(O.content));{if(R[0].id!=ue)throw"Bad HeaderStorageBucket";for(de=lr(R[0].messages[0].data),B=0;B<=s.e.c;++B)ye=lr(de[2][0].data),ye[1][0].data=ma(B),ye[4][0].data=ma(s.e.r+1),de[2][B]={type:de[2][0].type,data:_r(ye)};R[0].messages[0].data=_r(de)}O.content=ac(tc(R)),O.size=O.content.length;var te=Ji(pe[4][0].data);(function(){for(var G=Na.find(g,f[te].location),q=os(ls(G.content)),K,fe=0;fe<q.length;++fe){var Pe=q[fe];Pe.id==te&&(K=Pe)}var We=lr(K.messages[0].data);{We[3]=[];var Fe=[];c.forEach(function(ht,Vt){Fe[1]=[{type:0,data:ma(Vt)}],Fe[2]=[{type:0,data:ma(1)}],Fe[3]=[{type:2,data:hO(ht)}],We[3].push({type:2,data:_r(Fe)})})}K.messages[0].data=_r(We);var He=tc(q),it=ac(He);G.content=it,G.size=G.content.length})();var V=lr(pe[3][0].data);{var J=V[1][0];delete V[2];var ne=lr(J.data);{var ae=Ji(ne[2][0].data);(function(){for(var G=Na.find(g,f[ae].location),q=os(ls(G.content)),K,fe=0;fe<q.length;++fe){var Pe=q[fe];Pe.id==ae&&(K=Pe)}var We=lr(K.messages[0].data);{delete We[6],delete V[7];var Fe=new Uint8Array(We[5][0].data);We[5]=[];for(var He=0,it=0;it<=s.e.r;++it){var ht=lr(Fe);He+=xO(ht,u[it],c),ht[1][0].data=ma(it),We[5].push({data:_r(ht),type:2})}We[1]=[{type:0,data:ma(s.e.c+1)}],We[2]=[{type:0,data:ma(s.e.r+1)}],We[3]=[{type:0,data:ma(He)}],We[4]=[{type:0,data:ma(s.e.r+1)}]}K.messages[0].data=_r(We);var Vt=tc(q),_t=ac(Vt);G.content=_t,G.size=G.content.length})()}J.data=_r(ne)}pe[3][0].data=_r(V)}P[4][0].data=_r(pe)}k.messages[0].data=_r(P);var z=tc(_),D=ac(z);return v.content=D,v.size=v.content.length,g}function bO(e){return function(a){for(var s=0;s!=e.length;++s){var o=e[s];a[o[0]]===void 0&&(a[o[0]]=o[1]),o[2]==="n"&&(a[o[0]]=Number(a[o[0]]))}}}function Tp(e){bO([["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]])(e)}function vO(e,t){return t.bookType=="ods"?jw(e,t):t.bookType=="numbers"?yO(e,t):t.bookType=="xlsb"?_O(e,t):wO(e,t)}function _O(e,t){ic=1024,e&&!e.SSF&&(e.SSF=on(Ga)),e&&e.SSF&&(Wf(),$f(e.SSF),t.revssf=Vf(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF),t.rels={},t.wbrels={},t.Strings=[],t.Strings.Count=0,t.Strings.Unique=0,Vd?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var a=t.bookType=="xlsb"?"bin":"xml",s=lw.indexOf(t.bookType)>-1,o=F2();Tp(t=t||{});var u=up(),c="",f=0;if(t.cellXfs=[],so(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),c="docProps/core.xml",Wt(u,c,U2(e.Props,t)),o.coreprops.push(c),ga(t.rels,2,c,sa.CORE_PROPS),c="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var p=[],g=0;g<e.SheetNames.length;++g)(e.Workbook.Sheets[g]||{}).Hidden!=2&&p.push(e.SheetNames[g]);e.Props.SheetNames=p}for(e.Props.Worksheets=e.Props.SheetNames.length,Wt(u,c,$2(e.Props)),o.extprops.push(c),ga(t.rels,3,c,sa.EXT_PROPS),e.Custprops!==e.Props&&jr(e.Custprops||{}).length>0&&(c="docProps/custom.xml",Wt(u,c,W2(e.Custprops)),o.custprops.push(c),ga(t.rels,4,c,sa.CUST_PROPS)),f=1;f<=e.SheetNames.length;++f){var x={"!id":{}},v=e.Sheets[e.SheetNames[f-1]],_=(v||{})["!type"]||"sheet";switch(_){case"chart":default:c="xl/worksheets/sheet"+f+"."+a,Wt(u,c,NA(f-1,c,t,e,x)),o.sheets.push(c),ga(t.wbrels,-1,"worksheets/sheet"+f+"."+a,sa.WS[0])}if(v){var k=v["!comments"],T=!1,N="";k&&k.length>0&&(N="xl/comments"+f+"."+a,Wt(u,N,TA(k,N)),o.comments.push(N),ga(x,-1,"../comments"+f+"."+a,sa.CMNT),T=!0),v["!legacy"]&&T&&Wt(u,"xl/drawings/vmlDrawing"+f+".vml",iw(f,v["!comments"])),delete v["!comments"],delete v["!legacy"]}x["!id"].rId1&&Wt(u,B2(c),uc(x))}return t.Strings!=null&&t.Strings.length>0&&(c="xl/sharedStrings."+a,Wt(u,c,jA(t.Strings,c,t)),o.strs.push(c),ga(t.wbrels,-1,"sharedStrings."+a,sa.SST)),c="xl/workbook."+a,Wt(u,c,kA(e,c)),o.workbooks.push(c),ga(t.rels,1,c,sa.WB),c="xl/theme/theme1.xml",Wt(u,c,nw(e.Themes,t)),o.themes.push(c),ga(t.wbrels,-1,"theme/theme1.xml",sa.THEME),c="xl/styles."+a,Wt(u,c,SA(e,c,t)),o.styles.push(c),ga(t.wbrels,-1,"styles."+a,sa.STY),e.vbaraw&&s&&(c="xl/vbaProject.bin",Wt(u,c,e.vbaraw),o.vba.push(c),ga(t.wbrels,-1,"vbaProject.bin",sa.VBA)),c="xl/metadata."+a,Wt(u,c,EA(c)),o.metadata.push(c),ga(t.wbrels,-1,"metadata."+a,sa.XLMETA),Wt(u,"[Content_Types].xml",I2(o,t)),Wt(u,"_rels/.rels",uc(t.rels)),Wt(u,"xl/_rels/workbook."+a+".rels",uc(t.wbrels)),delete t.revssf,delete t.ssf,u}function wO(e,t){ic=1024,e&&!e.SSF&&(e.SSF=on(Ga)),e&&e.SSF&&(Wf(),$f(e.SSF),t.revssf=Vf(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF),t.rels={},t.wbrels={},t.Strings=[],t.Strings.Count=0,t.Strings.Unique=0,Vd?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var a="xml",s=lw.indexOf(t.bookType)>-1,o=F2();Tp(t=t||{});var u=up(),c="",f=0;if(t.cellXfs=[],so(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),c="docProps/core.xml",Wt(u,c,U2(e.Props,t)),o.coreprops.push(c),ga(t.rels,2,c,sa.CORE_PROPS),c="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var p=[],g=0;g<e.SheetNames.length;++g)(e.Workbook.Sheets[g]||{}).Hidden!=2&&p.push(e.SheetNames[g]);e.Props.SheetNames=p}e.Props.Worksheets=e.Props.SheetNames.length,Wt(u,c,$2(e.Props)),o.extprops.push(c),ga(t.rels,3,c,sa.EXT_PROPS),e.Custprops!==e.Props&&jr(e.Custprops||{}).length>0&&(c="docProps/custom.xml",Wt(u,c,W2(e.Custprops)),o.custprops.push(c),ga(t.rels,4,c,sa.CUST_PROPS));var x=["SheetJ5"];for(t.tcid=0,f=1;f<=e.SheetNames.length;++f){var v={"!id":{}},_=e.Sheets[e.SheetNames[f-1]],k=(_||{})["!type"]||"sheet";switch(k){case"chart":default:c="xl/worksheets/sheet"+f+"."+a,Wt(u,c,xw(f-1,t,e,v)),o.sheets.push(c),ga(t.wbrels,-1,"worksheets/sheet"+f+"."+a,sa.WS[0])}if(_){var T=_["!comments"],N=!1,j="";if(T&&T.length>0){var P=!1;T.forEach(function(C){C[1].forEach(function(O){O.T==!0&&(P=!0)})}),P&&(j="xl/threadedComments/threadedComment"+f+"."+a,Wt(u,j,QE(T,x,t)),o.threadedcomments.push(j),ga(v,-1,"../threadedComments/threadedComment"+f+"."+a,sa.TCMNT)),j="xl/comments"+f+"."+a,Wt(u,j,ow(T)),o.comments.push(j),ga(v,-1,"../comments"+f+"."+a,sa.CMNT),N=!0}_["!legacy"]&&N&&Wt(u,"xl/drawings/vmlDrawing"+f+".vml",iw(f,_["!comments"])),delete _["!comments"],delete _["!legacy"]}v["!id"].rId1&&Wt(u,B2(c),uc(v))}return t.Strings!=null&&t.Strings.length>0&&(c="xl/sharedStrings."+a,Wt(u,c,J2(t.Strings,t)),o.strs.push(c),ga(t.wbrels,-1,"sharedStrings."+a,sa.SST)),c="xl/workbook."+a,Wt(u,c,vw(e)),o.workbooks.push(c),ga(t.rels,1,c,sa.WB),c="xl/theme/theme1.xml",Wt(u,c,nw(e.Themes,t)),o.themes.push(c),ga(t.wbrels,-1,"theme/theme1.xml",sa.THEME),c="xl/styles."+a,Wt(u,c,aw(e,t)),o.styles.push(c),ga(t.wbrels,-1,"styles."+a,sa.STY),e.vbaraw&&s&&(c="xl/vbaProject.bin",Wt(u,c,e.vbaraw),o.vba.push(c),ga(t.wbrels,-1,"vbaProject.bin",sa.VBA)),c="xl/metadata."+a,Wt(u,c,sw()),o.metadata.push(c),ga(t.wbrels,-1,"metadata."+a,sa.XLMETA),x.length>1&&(c="xl/persons/person.xml",Wt(u,c,eC(x)),o.people.push(c),ga(t.wbrels,-1,"persons/person.xml",sa.PEOPLE)),Wt(u,"[Content_Types].xml",I2(o,t)),Wt(u,"_rels/.rels",uc(t.rels)),Wt(u,"xl/_rels/workbook."+a+".rels",uc(t.wbrels)),delete t.revssf,delete t.ssf,u}function kO(e,t){var a="";switch((t||{}).type||"base64"){case"buffer":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];case"base64":a=hi(e.slice(0,12));break;case"binary":a=e;break;case"array":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];default:throw new Error("Unrecognized type "+(t&&t.type||"undefined"))}return[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3),a.charCodeAt(4),a.charCodeAt(5),a.charCodeAt(6),a.charCodeAt(7)]}function Tw(e,t){switch(t.type){case"base64":case"binary":break;case"buffer":case"array":t.type="";break;case"file":return mu(t.file,Na.write(e,{type:la?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");default:throw new Error("Unrecognized type "+t.type)}return Na.write(e,t)}function NO(e,t){var a=on(t||{}),s=vO(e,a);return SO(s,a)}function SO(e,t){var a={},s=la?"nodebuffer":typeof Uint8Array!="undefined"?"array":"string";if(t.compression&&(a.compression="DEFLATE"),t.password)a.type=s;else switch(t.type){case"base64":a.type="base64";break;case"binary":a.type="string";break;case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");case"buffer":case"file":a.type=s;break;default:throw new Error("Unrecognized type "+t.type)}var o=e.FullPaths?Na.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[a.type]||a.type,compression:!!t.compression}):e.generate(a);if(typeof Deno!="undefined"&&typeof o=="string"){if(t.type=="binary"||t.type=="base64")return o;o=new Uint8Array(Hf(o))}return t.password&&typeof encrypt_agile!="undefined"?Tw(encrypt_agile(o,t.password),t):t.type==="file"?mu(t.file,o):t.type=="string"?Ud(o):o}function jO(e,t){var a=t||{},s=HA(e,a);return Tw(s,a)}function Ds(e,t,a){a||(a="");var s=a+e;switch(t.type){case"base64":return Xd(Jd(s));case"binary":return Jd(s);case"string":return e;case"file":return mu(t.file,s,"utf8");case"buffer":return la?pi(s,"utf8"):typeof TextEncoder!="undefined"?new TextEncoder().encode(s):Ds(s,{type:"binary"}).split("").map(function(o){return o.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function TO(e,t){switch(t.type){case"base64":return Xd(e);case"binary":return e;case"string":return e;case"file":return mu(t.file,e,"binary");case"buffer":return la?pi(e,"binary"):e.split("").map(function(a){return a.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function K0(e,t){switch(t.type){case"string":case"base64":case"binary":for(var a="",s=0;s<e.length;++s)a+=String.fromCharCode(e[s]);return t.type=="base64"?Xd(a):t.type=="string"?Ud(a):a;case"file":return mu(t.file,e);case"buffer":return e;default:throw new Error("Unrecognized type "+t.type)}}function Ew(e,t){t5(),fA(e);var a=on(t||{});if(a.cellStyles&&(a.cellNF=!0,a.sheetStubs=!0),a.type=="array"){a.type="binary";var s=Ew(e,a);return a.type="array",Hf(s)}var o=0;if(a.sheet&&(typeof a.sheet=="number"?o=a.sheet:o=e.SheetNames.indexOf(a.sheet),!e.SheetNames[o]))throw new Error("Sheet not found: "+a.sheet+" : "+typeof a.sheet);switch(a.bookType||"xlsb"){case"xml":case"xlml":return Ds(zA(e,a),a);case"slk":case"sylk":return Ds(cE.from_sheet(e.Sheets[e.SheetNames[o]],a),a);case"htm":case"html":return Ds(kw(e.Sheets[e.SheetNames[o]],a),a);case"txt":return TO(Cw(e.Sheets[e.SheetNames[o]],a),a);case"csv":return Ds(Cp(e.Sheets[e.SheetNames[o]],a),a,"\uFEFF");case"dif":return Ds(dE.from_sheet(e.Sheets[e.SheetNames[o]],a),a);case"dbf":return K0(lE.from_sheet(e.Sheets[e.SheetNames[o]],a),a);case"prn":return Ds(uE.from_sheet(e.Sheets[e.SheetNames[o]],a),a);case"rtf":return Ds(yE.from_sheet(e.Sheets[e.SheetNames[o]],a),a);case"eth":return Ds(K2.from_sheet(e.Sheets[e.SheetNames[o]],a),a);case"fods":return Ds(jw(e,a),a);case"wk1":return K0(kv.sheet_to_wk1(e.Sheets[e.SheetNames[o]],a),a);case"wk3":return K0(kv.book_to_wk3(e,a),a);case"biff2":a.biff||(a.biff=2);case"biff3":a.biff||(a.biff=3);case"biff4":return a.biff||(a.biff=4),K0(ww(e,a),a);case"biff5":a.biff||(a.biff=5);case"biff8":case"xla":case"xls":return a.biff||(a.biff=8),jO(e,a);case"xlsx":case"xlsm":case"xlam":case"xlsb":case"numbers":case"ods":return NO(e,a);default:throw new Error("Unrecognized bookType |"+a.bookType+"|")}}function EO(e){if(!e.bookType){var t={xls:"biff8",htm:"html",slk:"sylk",socialcalc:"eth",Sh33tJS:"WTF"},a=e.file.slice(e.file.lastIndexOf(".")).toLowerCase();a.match(/^\.[a-z]+$/)&&(e.bookType=a.slice(1)),e.bookType=t[e.bookType]||e.bookType}}function Ep(e,t,a){var s={};return s.type="file",s.file=t,EO(s),Ew(e,s)}function CO(e,t,a,s,o,u,c,f){var p=Sr(a),g=f.defval,x=f.raw||!Object.prototype.hasOwnProperty.call(f,"raw"),v=!0,_=o===1?[]:{};if(o!==1)if(Object.defineProperty)try{Object.defineProperty(_,"__rowNum__",{value:a,enumerable:!1})}catch(j){_.__rowNum__=a}else _.__rowNum__=a;if(!c||e[a])for(var k=t.s.c;k<=t.e.c;++k){var T=c?e[a][k]:e[s[k]+p];if(T===void 0||T.t===void 0){if(g===void 0)continue;u[k]!=null&&(_[u[k]]=g);continue}var N=T.v;switch(T.t){case"z":if(N==null)break;continue;case"e":N=N==0?null:void 0;break;case"s":case"d":case"b":case"n":break;default:throw new Error("unrecognized type "+T.t)}if(u[k]!=null){if(N==null)if(T.t=="e"&&N===null)_[u[k]]=null;else if(g!==void 0)_[u[k]]=g;else if(x&&N===null)_[u[k]]=null;else continue;else _[u[k]]=x&&(T.t!=="n"||T.t==="n"&&f.rawNumbers!==!1)?N:mi(T,N,f);N!=null&&(v=!1)}}return{row:_,isempty:v}}function Af(e,t){if(e==null||e["!ref"]==null)return[];var a={t:"n",v:0},s=0,o=1,u=[],c=0,f="",p={s:{r:0,c:0},e:{r:0,c:0}},g=t||{},x=g.range!=null?g.range:e["!ref"];switch(g.header===1?s=1:g.header==="A"?s=2:Array.isArray(g.header)?s=3:g.header==null&&(s=0),typeof x){case"string":p=Ma(x);break;case"number":p=Ma(e["!ref"]),p.s.r=x;break;default:p=x}s>0&&(o=0);var v=Sr(p.s.r),_=[],k=[],T=0,N=0,j=Array.isArray(e),P=p.s.r,C=0,O={};j&&!e[P]&&(e[P]=[]);var R=g.skipHidden&&e["!cols"]||[],U=g.skipHidden&&e["!rows"]||[];for(C=p.s.c;C<=p.e.c;++C)if(!(R[C]||{}).hidden)switch(_[C]=Lr(C),a=j?e[P][C]:e[_[C]+v],s){case 1:u[C]=C-p.s.c;break;case 2:u[C]=_[C];break;case 3:u[C]=g.header[C-p.s.c];break;default:if(a==null&&(a={w:"__EMPTY",t:"s"}),f=c=mi(a,null,g),N=O[c]||0,!N)O[c]=1;else{do f=c+"_"+N++;while(O[f]);O[c]=N,O[f]=1}u[C]=f}for(P=p.s.r+o;P<=p.e.r;++P)if(!(U[P]||{}).hidden){var H=CO(e,p,P,_,s,u,j,g);(H.isempty===!1||(s===1?g.blankrows!==!1:g.blankrows))&&(k[T++]=H.row)}return k.length=T,k}var Ov=/"/g;function AO(e,t,a,s,o,u,c,f){for(var p=!0,g=[],x="",v=Sr(a),_=t.s.c;_<=t.e.c;++_)if(s[_]){var k=f.dense?(e[a]||[])[_]:e[s[_]+v];if(k==null)x="";else if(k.v!=null){p=!1,x=""+(f.rawNumbers&&k.t=="n"?k.v:mi(k,null,f));for(var T=0,N=0;T!==x.length;++T)if((N=x.charCodeAt(T))===o||N===u||N===34||f.forceQuotes){x='"'+x.replace(Ov,'""')+'"';break}x=="ID"&&(x='"ID"')}else k.f!=null&&!k.F?(p=!1,x="="+k.f,x.indexOf(",")>=0&&(x='"'+x.replace(Ov,'""')+'"')):x="";g.push(x)}return f.blankrows===!1&&p?null:g.join(c)}function Cp(e,t){var a=[],s=t==null?{}:t;if(e==null||e["!ref"]==null)return"";var o=Ma(e["!ref"]),u=s.FS!==void 0?s.FS:",",c=u.charCodeAt(0),f=s.RS!==void 0?s.RS:`
`,p=f.charCodeAt(0),g=new RegExp((u=="|"?"\\|":u)+"+$"),x="",v=[];s.dense=Array.isArray(e);for(var _=s.skipHidden&&e["!cols"]||[],k=s.skipHidden&&e["!rows"]||[],T=o.s.c;T<=o.e.c;++T)(_[T]||{}).hidden||(v[T]=Lr(T));for(var N=0,j=o.s.r;j<=o.e.r;++j)(k[j]||{}).hidden||(x=AO(e,o,j,v,c,p,u,s),x!=null&&(s.strip&&(x=x.replace(g,"")),(x||s.blankrows!==!1)&&a.push((N++?f:"")+x)));return delete s.dense,a.join("")}function Cw(e,t){t||(t={}),t.FS=" ",t.RS=`
`;var a=Cp(e,t);return a}function OO(e){var t="",a,s="";if(e==null||e["!ref"]==null)return[];var o=Ma(e["!ref"]),u="",c=[],f,p=[],g=Array.isArray(e);for(f=o.s.c;f<=o.e.c;++f)c[f]=Lr(f);for(var x=o.s.r;x<=o.e.r;++x)for(u=Sr(x),f=o.s.c;f<=o.e.c;++f)if(t=c[f]+u,a=g?(e[x]||[])[f]:e[t],s="",a!==void 0){if(a.F!=null){if(t=a.F,!a.f)continue;s=a.f,t.indexOf(":")==-1&&(t=t+":"+t)}if(a.f!=null)s=a.f;else{if(a.t=="z")continue;if(a.t=="n"&&a.v!=null)s=""+a.v;else if(a.t=="b")s=a.v?"TRUE":"FALSE";else if(a.w!==void 0)s="'"+a.w;else{if(a.v===void 0)continue;a.t=="s"?s="'"+a.v:s=""+a.v}}p[p.length]=t+"="+s}return p}function Aw(e,t,a){var s=a||{},o=+!s.skipHeader,u=e||{},c=0,f=0;if(u&&s.origin!=null)if(typeof s.origin=="number")c=s.origin;else{var p=typeof s.origin=="string"?hr(s.origin):s.origin;c=p.r,f=p.c}var g,x={s:{c:0,r:0},e:{c:f,r:c+t.length-1+o}};if(u["!ref"]){var v=Ma(u["!ref"]);x.e.c=Math.max(x.e.c,v.e.c),x.e.r=Math.max(x.e.r,v.e.r),c==-1&&(c=v.e.r+1,x.e.r=c+t.length-1+o)}else c==-1&&(c=0,x.e.r=t.length-1+o);var _=s.header||[],k=0;t.forEach(function(N,j){jr(N).forEach(function(P){(k=_.indexOf(P))==-1&&(_[k=_.length]=P);var C=N[P],O="z",R="",U=xa({c:f+k,r:c+j+o});g=tu(u,U),C&&typeof C=="object"&&!(C instanceof Date)?u[U]=C:(typeof C=="number"?O="n":typeof C=="boolean"?O="b":typeof C=="string"?O="s":C instanceof Date?(O="d",s.cellDates||(O="n",C=sn(C)),R=s.dateNF||Ga[14]):C===null&&s.nullError&&(O="e",C=0),g?(g.t=O,g.v=C,delete g.w,delete g.R,R&&(g.z=R)):u[U]=g={t:O,v:C},R&&(g.z=R))})}),x.e.c=Math.max(x.e.c,f+_.length-1);var T=Sr(c);if(o)for(k=0;k<_.length;++k)u[Lr(k+f)+T]={t:"s",v:_[k]};return u["!ref"]=rr(x),u}function LO(e,t){return Aw(null,e,t)}function tu(e,t,a){if(typeof t=="string"){if(Array.isArray(e)){var s=hr(t);return e[s.r]||(e[s.r]=[]),e[s.r][s.c]||(e[s.r][s.c]={t:"z"})}return e[t]||(e[t]={t:"z"})}return typeof t!="number"?tu(e,xa(t)):tu(e,xa({r:t,c:a||0}))}function MO(e,t){if(typeof t=="number"){if(t>=0&&e.SheetNames.length>t)return t;throw new Error("Cannot find sheet # "+t)}else if(typeof t=="string"){var a=e.SheetNames.indexOf(t);if(a>-1)return a;throw new Error("Cannot find sheet name |"+t+"|")}else throw new Error("Cannot find sheet |"+t+"|")}function DO(){return{SheetNames:[],Sheets:{}}}function RO(e,t,a,s){var o=1;if(!a)for(;o<=65535&&e.SheetNames.indexOf(a="Sheet"+o)!=-1;++o,a=void 0);if(!a||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(s&&e.SheetNames.indexOf(a)>=0){var u=a.match(/(^.*?)(\d+)$/);o=u&&+u[2]||0;var c=u&&u[1]||a;for(++o;o<=65535&&e.SheetNames.indexOf(a=c+o)!=-1;++o);}if(bw(a),e.SheetNames.indexOf(a)>=0)throw new Error("Worksheet with name |"+a+"| already exists!");return e.SheetNames.push(a),e.Sheets[a]=t,a}function PO(e,t,a){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var s=MO(e,t);switch(e.Workbook.Sheets[s]||(e.Workbook.Sheets[s]={}),a){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+a)}e.Workbook.Sheets[s].Hidden=a}function FO(e,t){return e.z=t,e}function Ow(e,t,a){return t?(e.l={Target:t},a&&(e.l.Tooltip=a)):delete e.l,e}function IO(e,t,a){return Ow(e,"#"+t,a)}function BO(e,t,a){e.c||(e.c=[]),e.c.push({t,a:a||"SheetJS"})}function zO(e,t,a,s){for(var o=typeof t!="string"?t:Ma(t),u=typeof t=="string"?t:rr(t),c=o.s.r;c<=o.e.r;++c)for(var f=o.s.c;f<=o.e.c;++f){var p=tu(e,c,f);p.t="n",p.F=u,delete p.v,c==o.s.r&&f==o.s.c&&(p.f=a,s&&(p.D=!0))}return e}var ci={encode_col:Lr,encode_row:Sr,encode_cell:xa,encode_range:rr,decode_col:xp,decode_row:pp,split_cell:tT,decode_cell:hr,decode_range:En,format_cell:mi,sheet_add_aoa:O2,sheet_add_json:Aw,sheet_add_dom:Nw,aoa_to_sheet:Ec,json_to_sheet:LO,table_to_sheet:Sw,table_to_book:dO,sheet_to_csv:Cp,sheet_to_txt:Cw,sheet_to_json:Af,sheet_to_html:kw,sheet_to_formulae:OO,sheet_to_row_object_array:Af,sheet_get_cell:tu,book_new:DO,book_append_sheet:RO,book_set_sheet_visibility:PO,cell_set_number_format:FO,cell_set_hyperlink:Ow,cell_set_internal_link:IO,cell_add_comment:BO,sheet_set_array_formula:zO,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};const UO={},St=({label:e,doctype:t,value:a,onChange:s,placeholder:o,disabled:u=!1,filters:c,compact:f=!1,usePortal:p=!1})=>{const[g,x]=E.useState([]),[v,_]=E.useState(""),[k,T]=E.useState(!1),[N,j]=E.useState(!1),[P,C]=E.useState({top:0,left:0,width:0}),O=E.useRef(null),R=E.useRef(null),U=E.useRef(null),H=E.useRef(null),B=E.useRef(""),oe=E.useRef(!1),se=c||UO,pe=E.useMemo(()=>JSON.stringify(se),[se]),le=E.useCallback((V="",J=!1)=>ge(null,null,function*(){const ne=`${V}-${pe}`;if(!(!J&&B.current===ne)){B.current=ne,j(!0);try{const ae=new URLSearchParams({doctype:t,txt:V});se&&Object.keys(se).length>0&&ae.append("filters",JSON.stringify(se));const z=yield Ke.apiCall(`/api/method/frappe.desk.search.search_link?${ae.toString()}`);x(z||[])}catch(ae){console.error(`Error fetching ${t} links:`,ae),x([])}finally{j(!1)}}}),[t,pe,se]),re=E.useCallback(V=>{H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{le(V)},300)},[le]);E.useEffect(()=>{k&&!oe.current&&(oe.current=!0,le(v||"",!0)),k||(oe.current=!1,B.current="")},[k]),E.useEffect(()=>()=>{H.current&&clearTimeout(H.current)},[]);const de=E.useCallback(()=>{if(p&&R.current){const V=R.current.getBoundingClientRect();C({top:V.bottom+window.scrollY,left:V.left+window.scrollX,width:V.width})}},[p]);E.useEffect(()=>{if(k&&p){de();const V=()=>de();return window.addEventListener("scroll",V,!0),window.addEventListener("resize",V),()=>{window.removeEventListener("scroll",V,!0),window.removeEventListener("resize",V)}}},[k,p,de]),E.useEffect(()=>{const V=J=>{const ne=J.target,ae=O.current&&!O.current.contains(ne),z=p&&U.current&&!U.current.contains(ne);p?ae&&z&&(T(!1),_("")):ae&&(T(!1),_(""))};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[p]);const ye=V=>{s(V),_(""),T(!1)},ue=()=>{s(""),_(""),T(!1)},te=()=>{const V=`bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600
rounded-md w-full shadow-lg ${f?"mt-0.5":"mt-1"}`,J=p?{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,width:`${P.width}px`,zIndex:1050,marginTop:f?"2px":"4px"}:{};if(!k||u)return null;const ne=r.jsxs("div",{ref:U,children:[N&&r.jsxs("div",{className:`${p?"":"absolute z-[1050]"} ${V} text-center text-gray-500 dark:text-gray-400
${f?"p-1.5 text-[10px]":"p-3 text-sm"}`,style:J,children:[r.jsx("span",{className:"inline-block animate-spin mr-2",children:"⏳"}),"Loading..."]}),!N&&g.length>0&&r.jsx("ul",{className:`${p?"":"absolute z-[1050]"} ${V} overflow-auto
${f?"max-h-36":"max-h-48"}`,style:J,children:g.map((ae,z)=>r.jsxs("li",{onClick:()=>ye(ae.value),className:`cursor-pointer text-gray-900 dark:text-gray-100
hover:bg-blue-500 dark:hover:bg-blue-600 hover:text-white
${f?"px-2 py-1 text-xs":"px-3 py-2 text-sm"}
${a===ae.value?"bg-blue-50 dark:bg-blue-700 font-semibold":""}`,children:[ae.value,ae.description&&r.jsx("span",{className:`text-gray-600 dark:text-gray-300 ml-2
${f?"text-[9px] ml-1":"text-xs ml-2"}`,children:ae.description})]},z))}),!N&&g.length===0&&r.jsx("div",{className:`${p?"":"absolute z-[1050]"} ${V} text-center text-gray-500 dark:text-gray-400
${f?"p-1.5 text-[10px]":"p-3 text-sm"}`,style:J,children:"No results found"})]});return p?c_.createPortal(ne,document.body):ne};return r.jsxs("div",{ref:O,className:`relative w-full ${f?"mb-2":"mb-4"}`,children:[r.jsx("label",{className:`block font-medium text-gray-700 dark:text-gray-300 ${f?"text-[10px] mb-0.5":"text-sm mb-1"}`,children:e}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{ref:R,type:"text",value:k?v:a,placeholder:o||`Select ${e}`,disabled:u,className:`w-full border border-gray-300 dark:border-gray-600 rounded-md
focus:outline-none disabled:bg-gray-100 dark:disabled:bg-gray-700
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
${f?"px-2 py-1 text-xs focus:ring-1 focus:ring-blue-500 rounded":"px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500"}
${a?f?"pr-5":"pr-8":""}`,onFocus:()=>{u||(T(!0),_(""),p&&de())},onChange:V=>{const J=V.target.value;_(J),re(J)}}),a&&!u&&!k&&r.jsx("button",{type:"button",onClick:ue,className:`absolute top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300
${f?"right-1 text-xs":"right-2 text-sm"}`,children:"✕"})]}),te()]})},Lw=(e="Asset")=>{const[t,a]=E.useState({isAdmin:!1,restrictions:{},permissionFilters:{},targetDoctype:e,loading:!0,error:null}),s=E.useCallback(g=>ge(null,null,function*(){const x=g||e;try{a(_=>Le(ie({},_),{loading:!0,error:null,targetDoctype:x}));const v=yield Ke.getPermissionFilters(x);return a({isAdmin:v.is_admin,restrictions:v.restrictions||{},permissionFilters:v.filters||{},targetDoctype:x,loading:!1,error:null}),v}catch(v){return console.error(`Error fetching permissions for ${x}:`,v),a(_=>Le(ie({},_),{loading:!1,error:v instanceof Error?v.message:"Failed to fetch permissions"})),null}}),[e]);E.useEffect(()=>{s()},[s]);const o=E.useCallback(g=>{var x;return((x=t.restrictions[g])==null?void 0:x.values)||[]},[t.restrictions]),u=E.useCallback(g=>t.isAdmin?!1:!!t.restrictions[g],[t.isAdmin,t.restrictions]),c=E.useMemo(()=>!t.isAdmin&&Object.keys(t.restrictions).length>0,[t.isAdmin,t.restrictions]),f=E.useCallback(g=>{if(t.isAdmin)return g;const x=ie({},g);for(const[v,_]of Object.entries(t.permissionFilters))if(!x[v])x[v]=_;else if(Array.isArray(_)&&_[0]==="in"){const k=_[1];typeof x[v]=="string"&&!k.includes(x[v])&&(x[v]=["in",[]])}return x},[t.isAdmin,t.permissionFilters]),p=E.useMemo(()=>Object.entries(t.restrictions).map(([g,x])=>({type:g,field:x.field,values:x.values,count:x.count})),[t.restrictions]);return Le(ie({},t),{refetch:s,switchDoctype:s,getAllowedValues:o,hasRestriction:u,hasAnyRestrictions:c,mergeFilters:f,restrictionsList:p})},HO=({isOpen:e,onClose:t,selectedCount:a,totalCount:s,pageCount:o,onExport:u,isExporting:c,exportColumns:f})=>{const{t:p}=ln(),[g,x]=E.useState(a>0?"selected":"all_with_filters"),[v,_]=E.useState("csv"),[k,T]=E.useState(f.filter(C=>C.default).map(C=>C.key));E.useEffect(()=>{a>0?x("selected"):x("all_with_filters")},[a]);const N=C=>{T(O=>O.includes(C)?O.filter(R=>R!==C):[...O,C])},j=()=>{T(f.map(C=>C.key))},P=()=>{T(f.filter(C=>C.default).map(C=>C.key))};return e?r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden animate-scale-in",children:[r.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ui,{className:"text-white text-xl"}),r.jsxs("h3",{className:"text-lg font-semibold text-white",children:[p("listPages.export")," ",p("assets.title")]})]}),r.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:r.jsx(pt,{size:20})})]})}),r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:p("listPages.exportFormat")}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="selected"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${a===0?"opacity-50 cursor-not-allowed":""}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"selected",checked:g==="selected",onChange:()=>x("selected"),disabled:a===0,className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",a," selected asset",a!==1?"s":""]})]}),a>0&&r.jsxs("span",{className:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 px-2 py-1 rounded text-xs font-medium",children:[a," selected"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="all_on_page"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:g==="all_on_page",onChange:()=>x("all_on_page"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",o," asset",o!==1?"s":""," on current page"]})]}),r.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 px-2 py-1 rounded text-xs font-medium",children:[o," rows"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="all_with_filters"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:g==="all_with_filters",onChange:()=>x("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," asset",s!==1?"s":""," matching current filters"]})]}),r.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/40 text-purple-700 dark:text-purple-300 px-2 py-1 rounded text-xs font-medium",children:[s," total"]})]})]})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:p("listPages.exportFormat")}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${v==="csv"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"csv",checked:v==="csv",onChange:()=>_("csv"),className:"text-green-600 focus:ring-green-500"}),r.jsx(tp,{className:"text-green-600 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:p("listPages.csv")}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${v==="excel"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"excel",checked:v==="excel",onChange:()=>_("excel"),className:"text-green-600 focus:ring-green-500"}),r.jsx(ap,{className:"text-green-700 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:p("listPages.excel")}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:j,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),r.jsx("button",{onClick:P,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-48 overflow-y-auto p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg",children:f.map(C=>r.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${k.includes(C.key)?"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-400"}`,children:[r.jsx("input",{type:"checkbox",checked:k.includes(C.key),onChange:()=>N(C.key),className:"rounded text-green-600 focus:ring-green-500"}),r.jsx("span",{className:"text-sm truncate",children:C.label})]},C.key))}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[k.length," column",k.length!==1?"s":""," selected"]})]})]}),r.jsxs("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[r.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[g==="selected"&&`Exporting ${a} selected row${a!==1?"s":""}`,g==="all_on_page"&&`Exporting ${o} row${o!==1?"s":""} from current page`,g==="all_with_filters"&&`Exporting all ${s} row${s!==1?"s":""}`]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",disabled:c,children:"Cancel"}),r.jsx("button",{onClick:()=>u(g,v,k),disabled:k.length===0||c,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:c?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(kc,{}),"Export"]})})]})]})]})}):null},$O=()=>{const{t:e}=ln(),t=Da(),[a,s]=E.useState(0),[o,u]=E.useState(""),[c,f]=E.useState(null),[p,g]=E.useState(null),x=E.useRef(null),v=20,_=[{key:"name",label:e("commonFields.assetId"),default:!0},{key:"asset_name",label:e("commonFields.assetName"),default:!0},{key:"custom_serial_number",label:e("commonFields.serialNumber"),default:!0},{key:"company",label:e("commonFields.company"),default:!0},{key:"location",label:e("commonFields.location"),default:!0},{key:"department",label:e("commonFields.department"),default:!1},{key:"custom_device_status",label:e("commonFields.deviceStatus"),default:!0},{key:"custom_modality",label:e("commonFields.modality"),default:!1},{key:"custom_manufacturer",label:e("commonFields.manufacturer"),default:!1},{key:"supplier",label:e("commonFields.supplier"),default:!1},{key:"asset_category",label:e("commonFields.assetCategory"),default:!1},{key:"purchase_date",label:e("commonFields.purchaseDate"),default:!1},{key:"gross_purchase_amount",label:e("commonFields.purchaseAmount"),default:!1},{key:"available_for_use_date",label:e("commonFields.availableForUseDate"),default:!1},{key:"creation",label:e("commonFields.createdOn"),default:!1},{key:"modified",label:e("commonFields.modifiedOn"),default:!0},{key:"owner",label:e("commonFields.createdBy"),default:!1},{key:"modified_by",label:e("commonFields.modifiedBy"),default:!1}],[k,T]=E.useState(!1),[N,j]=E.useState(new Set),[P,C]=E.useState(!1),[O,R]=E.useState(!1),{permissionFilters:U,loading:H,error:B,hasAnyRestrictions:oe}=Lw("Asset"),[se,pe]=E.useState(!1),le=["Maintenance Manager","Maintenance User","System Manager"];E.useEffect(()=>{ge(null,null,function*(){try{console.log("🔍 [Role Check] Starting role check...");const Ee=yield(yield fetch("/api/method/asset_lite.api.user_roles.check_has_role",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({roles:le.join(",")})})).json();console.log("🔍 [Role Check] API Response:",Ee),Ee.message?(console.log("🔍 [Role Check] User roles:",Ee.message.user_roles),console.log("🔍 [Role Check] Matching roles:",Ee.message.matching_roles),console.log("✅ [Role Check] Has allowed role:",Ee.message.has_role),pe(Ee.message.has_role)):(console.error("❌ [Role Check] Invalid response:",Ee),pe(!1))}catch(he){console.error("❌ [Role Check] Error:",he),pe(!1)}})},[]);const[re,de]=E.useState(""),[ye,ue]=E.useState(""),[te,V]=E.useState(""),[J,ne]=E.useState(""),[ae,z]=E.useState(""),[D,G]=E.useState(""),[q,K]=E.useState(""),[fe,Pe]=E.useState(""),[We,Fe]=E.useState(""),[He,it]=E.useState(""),[ht,Vt]=E.useState(!0),[_t,ia]=E.useState(0),[Lt,Be]=E.useState([]),[yt,ke]=E.useState(!1),[ze,Je]=E.useState(""),[nt,ut]=E.useState(""),[ft,bt]=E.useState(""),Ut=E.useRef(null),Rt=E.useRef(null);E.useEffect(()=>{const F=localStorage.getItem("assetFilterPresets");F&&Be(JSON.parse(F))},[]),E.useEffect(()=>{const F=[re,ye,ae,D,q,te,J,fe,We,He,o].filter(Boolean).length;ia(F)},[re,ye,ae,D,q,te,J,fe,We,He,o]);const Pt={};re&&(Pt.name=re),ye&&(Pt.company=ye),te&&(Pt.custom_manufacturer=te),J&&(Pt.supplier=J),ae&&(Pt.location=ae),D&&(Pt.department=D),q&&(Pt.custom_modality=q),fe&&(Pt.custom_device_status=fe),We&&(Pt.asset_name=["like",`%${We}%`]),He&&(Pt.custom_serial_number=["like",`%${He}%`]),o&&(Pt.asset_name=["like",`%${o}%`]);const{assets:qe,totalCount:at,hasMore:wt,loading:kt,error:da,refetch:xe}=x_(Pt,v,a*v,"creation desc",U),{deleteAsset:De,loading:$e}=y_();E.useEffect(()=>{!kt&&!k&&!H&&T(!0)},[kt,k,H]),E.useEffect(()=>{a!==0&&s(0)},[re,ye,te,J,ae,D,q,fe,We,He,o]),E.useEffect(()=>{j(new Set)},[re,ye,te,J,ae,D,q,fe,We,He,o,a]);const Et=F=>{ut(F),Ut.current&&clearTimeout(Ut.current),Ut.current=window.setTimeout(()=>{Fe(F)},800)},Gt=F=>{bt(F),Rt.current&&clearTimeout(Rt.current),Rt.current=window.setTimeout(()=>{it(F)},800)},Sa=(F,he)=>{F.key==="Enter"&&(F.preventDefault(),he==="assetName"?(Ut.current&&clearTimeout(Ut.current),Fe(nt)):he==="serialNumber"&&(Rt.current&&clearTimeout(Rt.current),it(ft)))},tt=()=>{if(!ze.trim()){alert("Please enter a filter name");return}const F={id:Date.now(),name:ze,filters:{filterAssetId:re,filterCompany:ye,filterLocation:ae,filterDepartment:D,filterModality:q,filterManufacturer:te,filterSupplier:J,filterDeviceStatus:fe,filterAssetName:We,filterSerialNumber:He,searchTerm:o}},he=[...Lt,F];Be(he),Je(""),ke(!1),localStorage.setItem("assetFilterPresets",JSON.stringify(he))},Zt=F=>{const he=F.filters;de(he.filterAssetId||""),ue(he.filterCompany||""),z(he.filterLocation||""),G(he.filterDepartment||""),K(he.filterModality||""),V(he.filterManufacturer||""),ne(he.filterSupplier||""),Pe(he.filterDeviceStatus||""),Fe(he.filterAssetName||""),ut(he.filterAssetName||""),it(he.filterSerialNumber||""),bt(he.filterSerialNumber||""),u(he.searchTerm||"")},Ia=F=>{const he=Lt.filter(Ee=>Ee.id!==F);Be(he),localStorage.setItem("assetFilterPresets",JSON.stringify(he))};E.useEffect(()=>()=>{Ut.current&&clearTimeout(Ut.current),Rt.current&&clearTimeout(Rt.current)},[]);const Ba=F=>F?new Date(F).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-";E.useEffect(()=>{const F=he=>{x.current&&!x.current.contains(he.target)&&g(null)};return p&&document.addEventListener("mousedown",F),()=>{document.removeEventListener("mousedown",F)}},[p]);const Dr=F=>{j(he=>{const Ee=new Set(he);return Ee.has(F)?Ee.delete(F):Ee.add(F),Ee})},cn=()=>{N.size===qe.length?j(new Set):j(new Set(qe.map(F=>F.name)))},gs=qe.length>0&&N.size===qe.length,ps=N.size>0&&N.size<qe.length,Zn=E.useCallback(()=>ge(null,null,function*(){const F=[];let he=0;const Ee=100;let _e=!0;for(;_e;)try{const Ye=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Asset",filters:ie(ie({},Pt),U),fields:["*"],limit_start:he*Ee,limit_page_length:Ee,order_by:"creation desc"})})).json()).message||[];F.push(...Ye),Ye.length<Ee?_e=!1:he++,he>100&&(console.warn("Export safety limit reached"),_e=!1)}catch(je){throw console.error("Error fetching assets for export:",je),je}return F}),[Pt,U]),Rr=(F,he,Ee)=>ge(null,null,function*(){R(!0);try{let _e=[];switch(F){case"selected":_e=qe.filter(Se=>N.has(Se.name));break;case"all_on_page":_e=qe;break;case"all_with_filters":_e=yield Zn();break}if(_e.length===0){alert("No data to export");return}const je=Ee.map(Se=>{const Ye=_.find(et=>et.key===Se);return(Ye==null?void 0:Ye.label)||Se});if(he==="csv"){const Se=[je.join(","),..._e.map(Qe=>Ee.map(lt=>{let mt=Qe[lt]||"";return typeof mt=="string"&&(mt.includes(",")||mt.includes('"')||mt.includes(`
`))&&(mt=`"${mt.replace(/"/g,'""')}"`),mt}).join(","))].join(`
`),Ye=new Blob(["\uFEFF"+Se],{type:"text/csv;charset=utf-8;"}),et=URL.createObjectURL(Ye),ot=document.createElement("a");ot.href=et,ot.download=`assets_export_${new Date().toISOString().split("T")[0]}.csv`,ot.click(),URL.revokeObjectURL(et)}else if(he==="excel"){const Se=[je,..._e.map(ot=>Ee.map(Qe=>ot[Qe]||""))],Ye=ci.aoa_to_sheet(Se),et=ci.book_new();ci.book_append_sheet(et,Ye,"Assets"),Ep(et,`assets_export_${new Date().toISOString().split("T")[0]}.xlsx`)}C(!1),j(new Set)}catch(_e){console.error("Export failed:",_e),alert(`Export failed: ${_e instanceof Error?_e.message:"Unknown error"}`)}finally{R(!1)}}),qn=()=>t("/assets/new"),dn=F=>t(`/assets/${F}`),Cn=F=>t(`/assets/${F}`),xs=F=>t(`/assets/new?duplicate=${F}`),Za=F=>{const he=new URLSearchParams;F.name&&he.append("asset",F.name),F.asset_name&&he.append("asset_name",F.asset_name),F.custom_asset_type&&he.append("asset_type",F.custom_asset_type),F.custom_manufacturer&&he.append("manufacturer",F.custom_manufacturer),F.custom_serial_number&&he.append("serial_number",F.custom_serial_number),F.department&&he.append("department",F.department),F.custom_site_contractor&&he.append("site_contractor",F.custom_site_contractor),F.custom_subcontractor&&he.append("subcontractor",F.custom_subcontractor),F.company&&he.append("company",F.company),F.custom_service_agreement&&he.append("custom_service_agreement",F.custom_service_agreement),F.custom_service_coverage&&he.append("custom_service_coverage",F.custom_service_coverage),t(`/work-orders/new?${he.toString()}`)},be=F=>{t(`/work-orders?asset=${encodeURIComponent(F)}`)},I=F=>ge(null,null,function*(){try{yield De(F),f(null),xe(),alert("Asset deleted successfully!")}catch(he){alert(`Failed to delete asset: ${he instanceof Error?he.message:"Unknown error"}`)}}),ee=F=>{const he=JSON.stringify(F,null,2),Ee=new Blob([he],{type:"application/json"}),_e=URL.createObjectURL(Ee),je=document.createElement("a");je.href=_e,je.download=`asset_${F.name}.json`,je.click(),URL.revokeObjectURL(_e)},Y=F=>{window.open(`/assets/${F}?print=true`,"_blank")},X=()=>{de(""),ue(""),V(""),ne(""),z(""),G(""),K(""),Pe(""),Fe(""),it(""),ut(""),bt(""),u(""),Ut.current&&clearTimeout(Ut.current),Rt.current&&clearTimeout(Rt.current)},Q=re||ye||te||J||ae||D||q||fe||We||He||o;return H&&!k?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading permissions..."})]})}):B?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"⚠️ Permission Error"}),r.jsxs("div",{className:"text-red-700 dark:text-red-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"Unable to load user permissions."})}),r.jsx("p",{children:B}),r.jsx("button",{onClick:()=>window.location.reload(),className:"mt-2 bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded",children:"Retry"})]})]})}):kt&&!k?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:e("listPages.loading")})]})}):da?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ Asset API Not Available"}),r.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"The Asset API endpoint is not deployed yet."})}),r.jsx("button",{onClick:()=>t("/assets/new"),className:"mt-2 bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Creating a New Asset (Demo)"}),r.jsx("button",{onClick:xe,className:"mt-2 ml-2 bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]})}):r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("assets.title")}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",at," asset",at!==1?"s":"",N.size>0&&r.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",N.size," selected"]}),kt&&k&&r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[r.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:()=>C(!0),className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow transition-all",disabled:at===0,children:[r.jsx(ui,{}),r.jsx("span",{className:"font-medium",children:e("listPages.export")}),N.size>0&&r.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:N.size})]}),se&&r.jsxs("button",{onClick:qn,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(fi,{}),r.jsx("span",{className:"font-medium",children:e("assets.addAsset")})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[r.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-blue-600 dark:from-blue-600 dark:to-blue-700 px-4 py-3 rounded-t-lg",children:r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[r.jsx("button",{onClick:()=>Vt(!ht),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:ht?r.jsx(iu,{size:14}):r.jsx(wc,{size:14})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ko,{className:"text-white",size:16}),r.jsx("h3",{className:"text-white font-semibold text-sm",children:e("listPages.filters")})]}),_t>0&&r.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:_t})]}),Q&&r.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:r.jsxs("div",{className:"flex items-center gap-2 py-1",children:[re&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-blue-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Asset ID:"})," ",re,r.jsx("button",{onClick:F=>{F.stopPropagation(),de("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),ye&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-green-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Hospital:"})," ",ye,r.jsx("button",{onClick:F=>{F.stopPropagation(),ue("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),We&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-cyan-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Name:"})," ",We,r.jsx("button",{onClick:F=>{F.stopPropagation(),Fe(""),ut("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),He&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-lime-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Serial:"})," ",He,r.jsx("button",{onClick:F=>{F.stopPropagation(),it(""),bt("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),fe&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-orange-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Status:"})," ",fe,r.jsx("button",{onClick:F=>{F.stopPropagation(),Pe("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),ae&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-purple-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Location:"})," ",ae,r.jsx("button",{onClick:F=>{F.stopPropagation(),z("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),D&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-yellow-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Dept:"})," ",D,r.jsx("button",{onClick:F=>{F.stopPropagation(),G("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),q&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-pink-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Modality:"})," ",q,r.jsx("button",{onClick:F=>{F.stopPropagation(),K("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),te&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-indigo-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Mfr:"})," ",te,r.jsx("button",{onClick:F=>{F.stopPropagation(),V("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),J&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-teal-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Supplier:"})," ",J,r.jsx("button",{onClick:F=>{F.stopPropagation(),ne("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]})]})}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[_t>0&&r.jsxs("button",{onClick:()=>ke(!0),className:"px-3 py-1.5 bg-white text-blue-600 hover:bg-blue-50 rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(Wn,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),Q&&r.jsxs("button",{onClick:X,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(pt,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),ht&&r.jsxs("div",{className:"p-4",children:[Lt.length>0&&r.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[r.jsx(rp,{className:"text-yellow-500",size:12}),"Saved Filters"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Lt.map(F=>r.jsxs("div",{className:"group relative inline-flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-100 to-blue-100 dark:from-purple-900/30 dark:to-blue-900/30 border border-purple-200 dark:border-purple-700 rounded-lg hover:shadow-md transition-all",children:[r.jsx("button",{onClick:()=>Zt(F),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:F.name}),r.jsx("button",{onClick:()=>Ia(F.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:r.jsx(Xa,{size:10})})]},F.id))})]}),r.jsx("div",{className:"space-y-5",children:r.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-3",children:[r.jsxs("div",{className:"relative z-[60]",children:[r.jsx(St,{label:"Asset ID",doctype:"Asset",value:re,onChange:F=>de(F),placeholder:"Select Asset ID",disabled:!1,compact:!0}),re&&r.jsx("button",{onClick:()=>de(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Asset Name"}),r.jsx("input",{type:"text",value:nt,onChange:F=>Et(F.target.value),onKeyDown:F=>Sa(F,"assetName"),placeholder:"Type to search...",className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),nt&&nt!==We&&r.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),We&&r.jsx("button",{onClick:()=>{Fe(""),ut("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Serial Number"}),r.jsx("input",{type:"text",value:ft,onChange:F=>Gt(F.target.value),onKeyDown:F=>Sa(F,"serialNumber"),placeholder:"Type to search...",className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),ft&&ft!==He&&r.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),He&&r.jsx("button",{onClick:()=>{it(""),bt("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[59]",children:[r.jsx(St,{label:"Hospital",doctype:"Company",value:ye,onChange:F=>ue(F),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),ye&&r.jsx("button",{onClick:()=>ue(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Device Status"}),r.jsxs("select",{value:fe,onChange:F=>Pe(F.target.value),className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"All Status"}),r.jsx("option",{value:"Up",children:"✓ Up"}),r.jsx("option",{value:"Down",children:"⚠ Down"})]}),fe&&r.jsx("button",{onClick:()=>Pe(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[58]",children:[r.jsx(St,{label:"Location",doctype:"Location",value:ae,onChange:F=>z(F),placeholder:"Select Location",disabled:!1,compact:!0}),ae&&r.jsx("button",{onClick:()=>z(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[57]",children:[r.jsx(St,{label:"Department",doctype:"Department",value:D,onChange:F=>G(F),placeholder:"Select Department",disabled:!1,compact:!0}),D&&r.jsx("button",{onClick:()=>G(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[56]",children:[r.jsx(St,{label:"Modality",doctype:"Modality",value:q,onChange:F=>K(F),placeholder:"Select Modality",disabled:!1,compact:!0}),q&&r.jsx("button",{onClick:()=>K(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[55]",children:[r.jsx(St,{label:"Manufacturer",doctype:"Manufacturer",value:te,onChange:F=>V(F),placeholder:"Select Manufacturer",disabled:!1,compact:!0}),te&&r.jsx("button",{onClick:()=>V(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[54]",children:[r.jsx(St,{label:"Supplier",doctype:"Supplier",value:J,onChange:F=>ne(F),placeholder:"Select Supplier",disabled:!1,compact:!0}),J&&r.jsx("button",{onClick:()=>ne(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]})]})})})]})]}),yt&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Save Filter Preset"}),r.jsx("input",{type:"text",value:ze,onChange:F=>Je(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),tt())},placeholder:"Enter filter name (e.g., 'My Active Assets')",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white mb-4",autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{ke(!1),Je("")},className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Cancel"}),r.jsxs("button",{onClick:tt,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors flex items-center gap-2",children:[r.jsx(Wn,{size:12}),"Save Filter"]})]})]})}),r.jsx(HO,{isOpen:P,onClose:()=>C(!1),selectedCount:N.size,totalCount:at,pageCount:qe.length,onExport:Rr,isExporting:O,exportColumns:_}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[kt&&k&&r.jsx("div",{className:"absolute inset-0 bg-white/60 dark:bg-gray-800/60 flex items-center justify-center z-10 backdrop-blur-[1px]",children:r.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[r.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Filtering..."})]})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-3 text-left",children:r.jsx("button",{onClick:cn,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:gs?"Deselect all":"Select all",children:gs?r.jsx(mc,{className:"text-blue-600 dark:text-blue-400",size:18}):ps?r.jsxs("div",{className:"relative",children:[r.jsx(si,{size:18}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):r.jsx(si,{size:18})})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Asset Name"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Serial No"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Company"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Location"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Updated on"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:qe.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:8,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Ps,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:"No assets found"}),Q?r.jsx("button",{onClick:X,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Clear filters"}):se?r.jsx("button",{onClick:qn,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Create your first asset"}):null]})})}):qe.map(F=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${N.has(F.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>dn(F.name),children:[r.jsx("td",{className:"px-4 py-4",onClick:he=>he.stopPropagation(),children:r.jsx("button",{onClick:()=>Dr(F.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:N.has(F.name)?r.jsx(mc,{className:"text-blue-600 dark:text-blue-400",size:18}):r.jsx(si,{size:18})})}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:F.asset_name}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:F.name})]}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:F.custom_serial_number||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:F.company||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:F.location||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:F.custom_device_status||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:Ba(F.modified)}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"flex items-center gap-1",onClick:he=>he.stopPropagation(),children:[r.jsx("button",{onClick:()=>dn(F.name),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:"View Details",children:r.jsx(Nc,{})}),r.jsx("button",{onClick:()=>Cn(F.name),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:"Edit Asset",children:r.jsx(Tn,{})}),r.jsx("button",{onClick:()=>xs(F.name),className:"text-purple-600 dark:text-purple-400 hover:text-purple-900 dark:hover:text-purple-300 p-2 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded transition-colors",title:"Duplicate Asset",children:r.jsx(ou,{})}),r.jsx("button",{onClick:()=>Za(F),className:"text-orange-600 dark:text-orange-400 hover:text-orange-900 dark:hover:text-orange-300 p-2 hover:bg-orange-50 dark:hover:bg-orange-900/30 rounded transition-colors",title:"Create Work Order",children:r.jsx(Tb,{})}),r.jsx("button",{onClick:()=>be(F.name),className:"text-cyan-600 dark:text-cyan-400 hover:text-cyan-900 dark:hover:text-cyan-300 p-2 hover:bg-cyan-50 dark:hover:bg-cyan-900/30 rounded transition-colors",title:"View Linked Work Orders",children:r.jsx(jb,{})}),r.jsx("button",{onClick:()=>f(F.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete Asset",disabled:$e,children:r.jsx(Xa,{})}),r.jsxs("div",{className:"relative",ref:p===F.name?x:null,children:[r.jsx("button",{onClick:()=>g(p===F.name?null:F.name),className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 p-2 hover:bg-gray-50 dark:hover:bg-gray-700 rounded transition-colors",title:"More Actions",children:r.jsx(lu,{})}),p===F.name&&r.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-10",children:[r.jsxs("button",{onClick:()=>{Za(F),g(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-t-lg",children:[r.jsx(Tb,{className:"text-orange-500"}),"Create Work Order"]}),r.jsxs("button",{onClick:()=>{be(F.name),g(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(jb,{className:"text-cyan-500"}),"View Linked WOs"]}),r.jsxs("button",{onClick:()=>{ee(F),g(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(kc,{className:"text-blue-500"}),"Export as JSON"]}),r.jsxs("button",{onClick:()=>{Y(F.name),g(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-b-lg",children:[r.jsx(Pf,{className:"text-purple-500"}),"Print Asset"]})]})]})]})})]},F.name))})]})}),qe.length>0&&r.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 px-6 py-4 flex items-center justify-between border-t border-gray-200 dark:border-gray-600",children:[r.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",r.jsx("span",{className:"font-medium",children:a*v+1})," to"," ",r.jsx("span",{className:"font-medium",children:Math.min((a+1)*v,at)})," ","of ",r.jsx("span",{className:"font-medium",children:at})," results",oe&&r.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(filtered)"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{disabled:a===0,onClick:()=>s(a-1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Previous"}),r.jsx("button",{disabled:!wt,onClick:()=>s(a+1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Next"})]})]})]}),c&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:r.jsx(Xa,{className:"text-red-600 dark:text-red-400 text-xl"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Asset"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Are you sure you want to delete this asset? This action cannot be undone."}),r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-3 mb-4",children:r.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[r.jsx("strong",{children:"Asset ID:"})," ",c]})}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>f(null),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",disabled:$e,children:"Cancel"}),r.jsx("button",{onClick:()=>I(c),className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",disabled:$e,children:$e?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Xa,{}),"Delete Asset"]})})]})]})]})})}),r.jsx("style",{children:`
@keyframes scale-in {
from {
transform: scale(0.95);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}
}
.animate-scale-in {
animation: scale-in 0.2s ease-out;
}
.scrollbar-hide {
-ms-overflow-style: none;
scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
display: none;
}
`})]})},WO=e=>{const[t,a]=E.useState([]),[s,o]=E.useState(new Set),[u,c]=E.useState(!0),[f,p]=E.useState(null);return E.useEffect(()=>{ge(null,null,function*(){try{c(!0);const v=yield Ke.apiCall(`/api/resource/DocType/${e}`),k=(v.data||v).fields||[],T=new Set;k.forEach(N=>{N.allow_on_submit===1&&T.add(N.fieldname)}),a(k),o(T),p(null)}catch(v){console.error(`[DocTypeMeta] Error fetching DocType meta for ${e}:`,v),p(v instanceof Error?v.message:"Unknown error"),a([]),o(new Set)}finally{c(!1)}})},[e]),{fields:t,allowOnSubmitFields:s,isAllowedOnSubmit:x=>s.has(x),loading:u,error:f}};function _g(e,t){if(!e||(e=e.trim(),!e))return!1;if(!e.startsWith("eval:"))return!!t[e];const a=e.substring(5).trim();try{return new Function("doc",`
try {
return Boolean(${a});
} catch (e) {
console.warn('Expression evaluation error:', e);
return false;
}
`)(t)}catch(s){return console.warn(`Failed to evaluate expression: ${e}`,s),!1}}function VO(e){if(!e)return null;const t=e.split(".");return t.length!==2?null:{linkField:t[0],targetField:t[1]}}const wg={};function Mw(e,t){const[a,s]=E.useState([]),[o,u]=E.useState(!0),[c,f]=E.useState(null);E.useEffect(()=>{if(!e){u(!1);return}if(wg[e]){s(wg[e]),u(!1);return}ge(null,null,function*(){var C;u(!0);try{const O=yield Ke.apiCall(`/api/method/frappe.client.get_doc?doctype=DocType&name=${encodeURIComponent(e)}`,{credentials:"include"});if((C=O==null?void 0:O.message)!=null&&C.fields){const R=O.message.fields.map(U=>({fieldname:U.fieldname,label:U.label,fieldtype:U.fieldtype,options:U.options,reqd:U.reqd,hidden:U.hidden,read_only:U.read_only,depends_on:U.depends_on,mandatory_depends_on:U.mandatory_depends_on,read_only_depends_on:U.read_only_depends_on,fetch_from:U.fetch_from,fetch_if_empty:U.fetch_if_empty,default:U.default,description:U.description,in_list_view:U.in_list_view,permlevel:U.permlevel,allow_on_submit:U.allow_on_submit}));wg[e]=R,s(R)}}catch(O){console.warn(`Could not fetch DocType meta for ${e}:`,O.message),f(O.message)}finally{u(!1)}})},[e]);const p=E.useMemo(()=>{const P={};return a.forEach(C=>{P[C.fieldname]=C}),P},[a]),g=E.useCallback(P=>{const C=p[P];if(!C)return{isVisible:!0,isReadOnly:!1,isMandatory:!1};let O=!(C.hidden===1||C.hidden===!0);C.depends_on&&O&&(O=_g(C.depends_on,t));let R=C.read_only===1||C.read_only===!0;C.read_only_depends_on&&(R=R||_g(C.read_only_depends_on,t));let U=C.reqd===1||C.reqd===!0;return C.mandatory_depends_on&&(U=U||_g(C.mandatory_depends_on,t)),{isVisible:O,isReadOnly:R,isMandatory:U}},[p,t]),x=E.useCallback(P=>g(P).isVisible,[g]),v=E.useCallback(P=>{const C=g(P);return C.isVisible&&C.isMandatory},[g]),_=E.useCallback(P=>g(P).isReadOnly,[g]),k=E.useCallback(P=>{const C=p[P];return(C==null?void 0:C.label)||P},[p]),T=E.useCallback(P=>{const C=p[P];return C!=null&&C.options?C.fieldtype==="Select"?C.options.split(`
`).filter(O=>O.trim()!==""):[]:[]},[p]),N=E.useCallback((P,C)=>{const O=p[P];if(!(O!=null&&O.fetch_from)||!C)return;const R=VO(O.fetch_from);if(R)return C[R.targetField]},[p]),j=E.useCallback(()=>{const P={};return a.forEach(C=>{const O=g(C.fieldname);if(O.isVisible&&O.isMandatory){const R=t[C.fieldname];(R==null||R==="")&&(P[C.fieldname]=`${C.label||C.fieldname} is required`)}}),{valid:Object.keys(P).length===0,errors:P}},[a,t,g]);return{loading:o,error:c,fields:a,getFieldState:g,shouldShowField:x,isMandatory:v,isReadOnly:_,getFieldLabel:k,getFieldOptions:T,getFetchFromValue:N,validateMandatory:j}}const GO=()=>{var yt;const{assetName:e}=_c(),t=Da(),[a]=rl(),s=a.get("duplicate"),o=e==="new",u=o&&!!s,{isAllowedOnSubmit:c}=WO("Asset"),[f,p]=E.useState({asset_name:"",company:"",custom_serial_number:"",location:"",custom_manufacturer:"",department:"",custom_asset_type:"",custom_manufacturing_year:"",custom_model:"",custom_class:"",custom_device_status:"",custom_down_time:0,asset_owner_company:"",custom_up_time:0,custom_total_hours:0,custom_modality:"",custom_attach_image:"",custom_site_contractor:"",custom_site:"",custom_total_amount:0,calculate_depreciation:!1,available_for_use_date:void 0,finance_books:[],custom_service_agreement:"",custom_service_coverage:"",custom_start_date:"",custom_end_date:"",custom_warranty:!1,custom_extended_warranty:!1,custom__service_contract:!1,custom_covering_spare_parts:!1,custom_spare_parts_labour:!1,custom_covering_labour:!1,custom_ppm_only:!1,custom_support_plan:"",custom_spare_parts:[],custom_total_spare_parts_amount:0,is_existing_asset:!0,__islocal:!1}),{shouldShowField:g,isMandatory:x,isReadOnly:v}=Mw("Asset",f),{asset:_,loading:k,error:T,refetch:N}=qS(u?s:o?null:e||null),{createAsset:j,updateAsset:P,submitAsset:C,loading:O}=y_(),[R,U]=E.useState(o),H=(yt=_==null?void 0:_.docstatus)!=null?yt:0,B=H===1,oe=H===2,se=H===0,[pe,le]=E.useState(!1),re=E.useRef(null);E.useEffect(()=>{const ke=ze=>{re.current&&!re.current.contains(ze.target)&&le(!1)};return document.addEventListener("mousedown",ke),()=>document.removeEventListener("mousedown",ke)},[]),E.useEffect(()=>{},[_,H,se,B,oe,R]);const de=E.useCallback(ke=>!R||oe||v(ke)?!0:B?!c(ke):!se,[R,oe,B,se,c,v]),ye=E.useCallback(ke=>g(ke),[g]),ue=E.useCallback(ke=>x(ke),[x]),[te,V]=E.useState(""),[J,ne]=E.useState({});E.useEffect(()=>{o&&!f.available_for_use_date&&p(ke=>Le(ie({},ke),{available_for_use_date:new Date().toISOString().split("T")[0],__islocal:!0}))},[o]),E.useEffect(()=>{function ke(){return ge(this,null,function*(){try{const ze=yield Ke.getUserDetails();V(ze.custom_site_name||""),p(Je=>{const nt={};return(o||!Je.company)&&ze.custom_site_name&&(nt.company=ze.custom_site_name,nt.asset_owner_company=ze.custom_site_name),!Je.custom_site&&ze.custom_phcc_site_name&&(nt.custom_site=ze.custom_phcc_site_name),ie(ie({},Je),nt)})}catch(ze){console.error("Error loading user details",ze)}})}ke()},[o]);const ae=()=>{const ze={finance_book:"Depreciation Entries",depreciation_method:"Straight Line",total_number_of_depreciations:10,frequency_of_depreciation:12,depreciation_start_date:new Date().toISOString().split("T")[0]};p(Je=>Le(ie({},Je),{finance_books:[...Je.finance_books||[],ze]}))},z=ke=>{p(ze=>{const Je=[...ze.finance_books||[]];return Je.splice(ke,1),Le(ie({},ze),{finance_books:Je})})},D=(ke,ze)=>{p(Je=>{const nt=[...Je.finance_books||[]];return nt[ke]=ie(ie({},nt[ke]||{}),ze),Le(ie({},Je),{finance_books:nt})})};E.useEffect(()=>{if(f.calculate_depreciation&&(!f.finance_books||f.finance_books.length===0)){const ze={finance_book:"Depreciation Entries",depreciation_method:"Straight Line",total_number_of_depreciations:10,frequency_of_depreciation:12,depreciation_start_date:new Date().toISOString().split("T")[0]};p(Je=>Le(ie({},Je),{finance_books:[ze]}))}},[f.calculate_depreciation]);const G=(ke,ze,Je)=>{p(nt=>{const ut=[...nt.custom_spare_parts||[]],ft=ie({},ut[ke]);ze==="qty"||ze==="rate"?(ft[ze]=Je,ft.amount=(ft.qty||0)*(ft.rate||0)):ft[ze]=Je,ut[ke]=ft;const bt=ut.reduce((Ut,Rt)=>Ut+(Rt.amount||0),0);return Le(ie({},nt),{custom_spare_parts:ut,custom_total_spare_parts_amount:bt})})},q=()=>{p(ke=>Le(ie({},ke),{custom_spare_parts:[...ke.custom_spare_parts||[],{qty:0,rate:0,amount:0}]}))},K=ke=>{p(ze=>{const Je=[...ze.custom_spare_parts||[]];Je.splice(ke,1);const nt=Je.reduce((ut,ft)=>ut+(ft.amount||0),0);return Le(ie({},ze),{custom_spare_parts:Je,custom_total_spare_parts_amount:nt})})};E.useEffect(()=>{if(f.available_for_use_date){const ke=new Date(f.available_for_use_date),Je=new Date().getTime()-ke.getTime(),ut=Math.floor(Je/(1e3*60*60*24))*24,ft=ut-(f.custom_down_time||0);p(bt=>Le(ie({},bt),{custom_total_hours:ut,custom_up_time:ft}))}},[f.available_for_use_date,f.custom_down_time]);const fe=E.useRef("");E.useEffect(()=>{if(!R){fe.current=f.custom_asset_type||"";return}const ke=(f.custom_asset_type||"").toString().trim().toLowerCase(),ze=(fe.current||"").toString().trim().toLowerCase();ke!==ze&&(fe.current=f.custom_asset_type||"",ke==="biomedical"?f.custom_site_contractor!=="SAMAMA"&&p(Je=>Le(ie({},Je),{custom_site_contractor:"SAMAMA"})):ze==="biomedical"&&f.custom_site_contractor==="SAMAMA"&&p(Je=>Le(ie({},Je),{custom_site_contractor:""})))},[f.custom_asset_type,R]),E.useEffect(()=>{const ke={};f.company&&(ke.company=f.company);const ze=te&&te.startsWith("Mobile")||f.company&&f.company.startsWith("Mobile");(te||f.company)&&(ze?ke.department_name=["not like","Non Bio%"]:ke.department_name=["not like","Non Bio%"]),ne(ke)},[f.company,te]),E.useEffect(()=>{_&&(fe.current=_.custom_asset_type||"",p({asset_name:u?`${_.asset_name} (Copy)`:_.asset_name||"",company:_.company||"",custom_serial_number:u?"":_.custom_serial_number||"",location:_.location||"",custom_manufacturer:_.custom_manufacturer||"",department:_.department||"",custom_asset_type:_.custom_asset_type||"",custom_manufacturing_year:_.custom_manufacturing_year||"",custom_model:_.custom_model||"",custom_class:_.custom_class||"",custom_device_status:_.custom_device_status||"",custom_down_time:_.custom_down_time||0,asset_owner_company:_.asset_owner_company||"",custom_up_time:_.custom_up_time||0,custom_total_hours:_.custom_total_hours||0,custom_modality:_.custom_modality||"",custom_attach_image:_.custom_attach_image||"",custom_site_contractor:_.custom_site_contractor||"",custom_site:_.custom_site||"",custom_total_amount:_.custom_total_amount||0,gross_purchase_amount:_.gross_purchase_amount||0,available_for_use_date:_.available_for_use_date||"",calculate_depreciation:_.calculate_depreciation||!1,finance_books:_.finance_books||[],custom_service_agreement:_.custom_service_agreement||"",custom_service_coverage:_.custom_service_coverage||"",custom_start_date:_.custom_start_date?_.custom_start_date.split(" ")[0]:"",custom_end_date:_.custom_end_date?_.custom_end_date.split(" ")[0]:"",custom_warranty:_.custom_warranty||!1,custom_extended_warranty:_.custom_extended_warranty||!1,custom__service_contract:_.custom__service_contract||!1,custom_covering_spare_parts:_.custom_covering_spare_parts||!1,custom_spare_parts_labour:_.custom_spare_parts_labour||!1,custom_covering_labour:_.custom_covering_labour||!1,custom_ppm_only:_.custom_ppm_only||!1,custom_support_plan:_.custom_support_plan||"",custom_spare_parts:_.custom_spare_parts||[],custom_total_spare_parts_amount:_.custom_total_spare_parts_amount||0}))},[_,u]);const[Pe,We]=E.useState(null);E.useEffect(()=>{if(!e||e==="new")return;ge(null,null,function*(){var ze;try{const Je=`/files/${e}-qr.png`;if((yield fetch(Je,{method:"HEAD"})).ok){We(Je);return}const ut=yield Ke.apiCall(`/api/resource/File?filters=[["File","attached_to_name","=","${e}"]]`);((ze=ut==null?void 0:ut.data)==null?void 0:ze.length)>0&&We(ut.data[0].file_url)}catch(Je){console.error("Error loading QR code:",Je)}})},[e,_]);const Fe=ke=>{const{name:ze,value:Je}=ke.target;p(nt=>Le(ie({},nt),{[ze]:Je}))},He=ke=>ge(null,null,function*(){if(ke.preventDefault(),!f.asset_name){alert("Please enter an Asset Name");return}if(!f.custom_asset_type){alert("Please select a Category");return}console.log("Submitting asset data:",f);try{if(o||u){const ze=yield j(f);if(ze.name){const nt=`/files/${ze.name}-qr.png`;We(nt)}alert(u?"Asset duplicated successfully!":"Asset created successfully!"),t(`/assets/${ze.name}`)}else e&&(yield P(e,f),alert("Asset updated successfully!"),U(!1),N())}catch(ze){console.error("Asset save error:",ze);const Je=ze instanceof Error?ze.message:"Unknown error";Je.includes("404")||Je.includes("not found")||Je.includes("has no attribute")||Je.includes("417")?alert(`⚠️ Asset API Not Deployed
The Asset API endpoint (asset_api.py) is not deployed on your Frappe server yet.
To fix this:
1. SSH into your Frappe server
2. Navigate to: frappe-bench/apps/asset_lite/asset_lite/api/
3. Create the file: asset_api.py
4. Copy the content from frappe_asset_api.py in this project
5. Restart Frappe: bench restart
Error: `+Je):alert(`Failed to save asset:
`+Je)}}),it=()=>ge(null,null,function*(){if(!e||o){alert("Cannot submit: Asset not saved yet");return}if(window.confirm('Are you sure you want to submit this asset? Once submitted, only fields marked as "Allow on Submit" can be edited.'))try{yield C(e),alert("Asset submitted successfully!"),N(),U(!1)}catch(ke){console.error("Asset submit error:",ke);const ze=ke instanceof Error?ke.message:"Unknown error";alert(`Failed to submit asset:
`+ze)}});if(k)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading asset details..."})]})});if(T&&!o&&!u)return r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",T]}),r.jsx("button",{onClick:()=>t("/assets"),className:"mt-2 text-red-700 dark:text-red-400 underline hover:text-red-800 dark:hover:text-red-300",children:"Back to assets list"})]})});if(T&&u)return r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-yellow-800 dark:text-yellow-300 mb-2",children:"Source Asset Not Found"}),r.jsx("p",{className:"text-yellow-700 dark:text-yellow-400",children:"The asset you're trying to duplicate could not be found."}),r.jsxs("div",{className:"mt-4 flex gap-3",children:[r.jsx("button",{onClick:()=>t("/assets/new"),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:"Create New Asset"}),r.jsx("button",{onClick:()=>t("/assets"),className:"px-4 py-2 bg-gray-600 hover:bg-gray-700 text-white rounded-lg transition-colors",children:"Back to Assets List"})]})]})});const ht=()=>{if(!Pe||!_)return;const ke=window.open("","_blank");ke&&(ke.document.write(`
<!DOCTYPE html>
<html>
<head>
<title>Print QR Code - ${_.name}</title>
<style>
@page {
margin: 0.5in;
size: auto;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
padding: 0;
}
.qr-container {
text-align: center;
border: 2px solid #333;
padding: 20px;
border-radius: 8px;
background: white;
max-width: 400px;
}
.qr-image {
width: 300px;
height: 300px;
margin: 15px 0;
display: block;
margin-left: auto;
margin-right: auto;
}
h1 {
font-size: 20px;
margin-bottom: 10px;
}
.asset-info {
margin: 10px 0;
font-size: 14px;
line-height: 1.5;
}
</style>
</head>
<body>
<div class="qr-container">
<h1>Asset QR Code</h1>
<div class="asset-info">
<strong>Asset ID:</strong> ${_.name}<br/>
<strong>Asset Name:</strong> ${_.asset_name||"N/A"}
</div>
<img src="${Pe}" alt="QR Code" class="qr-image" onload="window.print();" />
</div>
</body>
</html>
`),ke.document.close())},Vt=()=>{const ke=window.open("","_blank");ke&&(ke.document.write(`
<!DOCTYPE html>
<html>
<head>
<title>Stay Plugged</title>
<style>
@page {
margin: 0.5in;
size: auto;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
padding: 0;
}
.image-container {
text-align: center;
padding: 40px;
max-width: 100%;
}
.stay-plugged-image {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="image-container">
<img src="/files/Stay Plugged.jpg" alt="Stay Plugged" class="stay-plugged-image" onload="window.print();" />
</div>
</body>
</html>
`),ke.document.close())},_t=()=>ge(null,null,function*(){if(!e||o){alert("Please save the asset first to view PPM Plan");return}try{const ke=yield Ke.apiCall(`/api/resource/Asset Maintenance Log?filters=[["asset_name","=","${e}"],["maintenance_status","=","Planned"]]&fields=["name","due_date","periodicity","custom_asset_names","asset_name","maintenance_type","assign_to_name"]`),ze=(ke==null?void 0:ke.data)||[],Je=(at,wt)=>{const kt=new Date(at);return kt.setDate(kt.getDate()+wt),kt},nt=(at,wt)=>{const kt=new Date(at);return kt.setMonth(kt.getMonth()+wt),kt},ut=(at,wt)=>{const kt=new Date(at);return kt.setFullYear(kt.getFullYear()+wt),kt},ft=(at,wt)=>{switch(wt){case"Daily":return Je(at,1);case"Weekly":return Je(at,7);case"Monthly":return nt(at,1);case"Quarterly":return nt(at,3);case"Half-yearly":return nt(at,6);case"Yearly":return ut(at,1);case"2 Yearly":return ut(at,2);case"3 Yearly":return ut(at,3);default:return nt(at,1)}},bt=at=>at.toISOString().split("T")[0],Ut=ut(new Date,5),Rt=[];for(const at of ze){let wt=new Date(at.due_date);const kt=at.periodicity||"Monthly";for(let da=0;da<60&&(Rt.push({asset_name:at.asset_name||"",custom_asset_names:at.custom_asset_names||"",serial_number:f.custom_serial_number||"N/A",due_date:bt(wt),periodicity:kt,maintenance_type:at.maintenance_type||"",assign_to_name:at.assign_to_name||"",status:"Planned"}),wt=ft(wt,kt),!(wt>Ut));da++);}Rt.sort((at,wt)=>new Date(at.due_date).getTime()-new Date(wt.due_date).getTime());const Pt=window.open("","_blank");if(!Pt)return;const qe=Rt.length>0?Rt.map((at,wt)=>`
<tr class="${wt%2===0?"bg-white":"bg-gray-50"}">
<td class="border px-3 py-2">${at.asset_name}</td>
<td class="border px-3 py-2">${at.custom_asset_names}</td>
<td class="border px-3 py-2">${at.serial_number}</td>
<td class="border px-3 py-2">${at.due_date}</td>
<td class="border px-3 py-2">${at.periodicity}</td>
<td class="border px-3 py-2">${at.maintenance_type}</td>
<td class="border px-3 py-2">${at.assign_to_name}</td>
<td class="border px-3 py-2">
<span class="px-2 py-1 bg-yellow-100 text-yellow-800 rounded text-xs">${at.status}</span>
</td>
</tr>
`).join(""):'<tr><td colspan="8" class="border px-3 py-4 text-center text-gray-500">No planned maintenance found for this asset</td></tr>';Pt.document.write(`
<!DOCTYPE html>
<html>
<head>
<title>PPM Plan - ${e}</title>
<style>
@page {
margin: 0.5in;
size: landscape;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
padding: 20px;
background: #f5f5f5;
}
.container {
max-width: 1400px;
margin: 0 auto;
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 2px solid #3b82f6;
}
h1 {
font-size: 24px;
color: #1f2937;
}
.asset-info {
font-size: 14px;
color: #6b7280;
}
.btn {
padding: 10px 20px;
font-size: 14px;
border: none;
border-radius: 5px;
cursor: pointer;
margin-left: 10px;
}
.btn-print {
background: #3b82f6;
color: white;
}
.btn-print:hover {
background: #2563eb;
}
.btn-close {
background: #6b7280;
color: white;
}
.btn-close:hover {
background: #4b5563;
}
.table-container {
overflow-x: auto;
margin-top: 20px;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
th {
background: #3b82f6;
color: white;
padding: 12px 8px;
text-align: left;
border: 1px solid #2563eb;
font-weight: 600;
}
td {
border: 1px solid #e5e7eb;
padding: 8px;
}
.bg-white { background: white; }
.bg-gray-50 { background: #f9fafb; }
.summary {
margin-top: 20px;
padding: 15px;
background: #f0f9ff;
border-radius: 5px;
font-size: 14px;
color: #1e40af;
}
@media print {
.no-print { display: none; }
body { background: white; padding: 0; }
.container { box-shadow: none; padding: 0; }
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<div>
<h1>PPM Planner Report</h1>
<div class="asset-info">
<strong>Asset ID:</strong> ${e} |
<strong>Asset Name:</strong> ${f.asset_name||"N/A"} |
<strong>Generated:</strong> ${new Date().toLocaleDateString()}
</div>
</div>
<div class="no-print">
<button class="btn btn-print" onclick="window.print()">Print / Save PDF</button>
<button class="btn btn-close" onclick="window.close()">Close</button>
</div>
</div>
<div class="table-container">
<table>
<thead>
<tr>
<th>Asset ID</th>
<th>Asset Name</th>
<th>Serial Number</th>
<th>Due Date</th>
<th>Periodicity</th>
<th>Maintenance Type</th>
<th>Assigned To</th>
<th>Status</th>
</tr>
</thead>
<tbody>
${qe}
</tbody>
</table>
</div>
<div class="summary">
<strong>Summary:</strong> ${Rt.length} planned maintenance entries for the next 5 years
</div>
</div>
</body>
</html>
`),Pt.document.close()}catch(ke){console.error("Error fetching PPM Plan:",ke),alert("Failed to load PPM Plan. Please try again.")}}),ia=()=>ge(null,null,function*(){if(!e||o){alert("Please save the asset first to view Asset History");return}try{const ke=yield Ke.apiCall(`/api/resource/Asset/${e}`),ze=(ke==null?void 0:ke.data)||{},Je=yield Ke.apiCall(`/api/resource/Work_Order?filters=[["asset","=","${e}"]]&fields=["name","work_order_type","repair_status","creation","total_repair_cost"]`),nt=(Je==null?void 0:Je.data)||[],ut=yield Ke.apiCall(`/api/resource/Asset Maintenance?filters=[["asset_name","=","${e}"]]&fields=["name","maintenance_team","custom_type_of_maintenance"]`),ft=(ut==null?void 0:ut.data)||[];let bt=[],Ut=[];for(const tt of ft){const Zt=yield Ke.apiCall(`/api/resource/Asset Maintenance/${tt.name}`),Ia=(Zt==null?void 0:Zt.data)||{};Ia.asset_maintenance_tasks&&(Ut=[...Ut,...Ia.asset_maintenance_tasks.map(Dr=>Le(ie({},Dr),{maintenance_id:tt.name}))]);const Ba=yield Ke.apiCall(`/api/resource/Asset Maintenance Log?filters=[["asset_maintenance","=","${tt.name}"]]&fields=["name","maintenance_status","assign_to_name","maintenance_type","due_date","completion_date","periodicity","actions_performed"]&order_by=completion_date desc`);bt=[...bt,...(Ba==null?void 0:Ba.data)||[]]}const Rt=bt.filter(tt=>tt.maintenance_status==="Completed"),Pt=bt.filter(tt=>tt.maintenance_status!=="Completed"),qe={};bt.forEach(tt=>{qe[tt.maintenance_status]=(qe[tt.maintenance_status]||0)+1});const at=ze.custom_spare_parts||[],wt={};at.forEach(tt=>{const Zt=tt.work_order||"Unassigned";wt[Zt]||(wt[Zt]=[]),wt[Zt].push(tt)});const kt=window.open("","_blank");if(!kt)return;const da=nt.length>0?nt.map((tt,Zt)=>{const Ia=tt.repair_status==="Completed"?"bg-green-100 text-green-800":tt.repair_status==="Work In Progress"?"bg-yellow-100 text-yellow-800":"bg-gray-100 text-gray-800";return`
<tr class="${Zt%2===0?"bg-white":"bg-gray-50"}">
<td class="px-4 py-3 font-medium text-blue-600">${tt.name}</td>
<td class="px-4 py-3">${tt.work_order_type||"-"}</td>
<td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs font-medium ${Ia}">${tt.repair_status||"-"}</span></td>
<td class="px-4 py-3 font-semibold">${parseFloat(tt.total_repair_cost||0).toFixed(2)} ر.س</td>
<td class="px-4 py-3 text-gray-500">${tt.creation?new Date(tt.creation).toLocaleDateString():"-"}</td>
</tr>
`}).join(""):'<tr><td colspan="5" class="px-4 py-8 text-center text-gray-500">No Work Orders Found</td></tr>';let xe="";Object.keys(wt).length>0?Object.keys(wt).forEach(tt=>{xe+=`
<div class="mb-4">
<div class="bg-amber-50 border-l-4 border-amber-400 px-4 py-2 mb-2">
<span class="font-medium">Work Order: </span>
<span class="text-blue-600 font-medium">${tt}</span>
</div>
<table class="w-full">
<thead>
<tr class="bg-gray-100">
<th class="px-4 py-2 text-left text-xs font-semibold text-gray-600">Item Name</th>
<th class="px-4 py-2 text-left text-xs font-semibold text-gray-600">Quantity</th>
<th class="px-4 py-2 text-left text-xs font-semibold text-gray-600">Cost</th>
<th class="px-4 py-2 text-left text-xs font-semibold text-gray-600">Amount</th>
</tr>
</thead>
<tbody>
${wt[tt].map((Zt,Ia)=>`
<tr class="${Ia%2===0?"bg-white":"bg-gray-50"}">
<td class="px-4 py-2">${Zt.item_code||"-"}</td>
<td class="px-4 py-2">${Zt.qty||0}</td>
<td class="px-4 py-2">${Zt.rate||0} ر.س</td>
<td class="px-4 py-2 font-medium">${Zt.amount||0} ر.س</td>
</tr>
`).join("")}
</tbody>
</table>
</div>
`}):xe='<p class="text-gray-500 text-center py-8">No Spare Parts Used</p>';const De=ft.length>0?ft.map(tt=>`
<div class="bg-white border rounded-lg p-4 mb-3 shadow-sm">
<div class="flex justify-between items-start">
<div>
<p class="text-sm text-gray-500">Maintenance ID</p>
<p class="font-medium text-blue-600">${tt.name}</p>
</div>
<div class="text-right">
<p class="text-sm text-gray-500">Type</p>
<p class="font-medium">${tt.custom_type_of_maintenance||"-"}</p>
</div>
</div>
<div class="mt-2">
<p class="text-sm text-gray-500">Maintenance Team</p>
<p class="font-medium">${tt.maintenance_team||"-"}</p>
</div>
</div>
`).join(""):'<p class="text-gray-500 text-center py-8">No Maintenance Records Found</p>',$e=Ut.length>0?Ut.map((tt,Zt)=>`
<tr class="${Zt%2===0?"bg-white":"bg-gray-50"}">
<td class="px-4 py-3">${tt.assign_to_name||"-"}</td>
<td class="px-4 py-3">${tt.periodicity||"-"}</td>
<td class="px-4 py-3">${tt.next_due_date||"-"}</td>
<td class="px-4 py-3 text-blue-600 text-sm">${tt.maintenance_id||"-"}</td>
</tr>
`).join(""):'<tr><td colspan="4" class="px-4 py-8 text-center text-gray-500">No Maintenance Tasks Found</td></tr>',Et=Object.keys(qe).length>0?Object.entries(qe).map(([tt,Zt])=>`
<div class="flex items-center justify-between p-3 rounded-lg border ${tt==="Completed"?"bg-green-100 text-green-800 border-green-200":tt==="Planned"?"bg-blue-100 text-blue-800 border-blue-200":"bg-yellow-100 text-yellow-800 border-yellow-200"}">
<span class="font-medium">${tt}</span>
<span class="text-2xl font-bold">${Zt}</span>
</div>
`).join(""):'<p class="text-gray-500 text-center">No Data</p>',Gt=Rt.length>0?Rt.map((tt,Zt)=>`
<tr class="${Zt%2===0?"bg-white":"bg-gray-50"}">
<td class="px-3 py-2 text-blue-600 font-medium">${tt.name}</td>
<td class="px-3 py-2">${tt.assign_to_name||"-"}</td>
<td class="px-3 py-2">${tt.maintenance_type||"-"}</td>
<td class="px-3 py-2">${tt.due_date||"-"}</td>
<td class="px-3 py-2 text-green-600 font-medium">${tt.completion_date||"-"}</td>
<td class="px-3 py-2">${tt.periodicity||"-"}</td>
<td class="px-3 py-2 text-sm text-gray-600">${tt.actions_performed||"-"}</td>
</tr>
`).join(""):'<tr><td colspan="7" class="px-4 py-8 text-center text-gray-500">No Completed Maintenance Logs</td></tr>',Sa=Pt.length>0?Pt.map((tt,Zt)=>{const Ia=tt.maintenance_status==="Planned"?"bg-blue-100 text-blue-800":"bg-yellow-100 text-yellow-800";return`
<tr class="${Zt%2===0?"bg-white":"bg-gray-50"}">
<td class="px-3 py-2 text-blue-600 font-medium">${tt.name}</td>
<td class="px-3 py-2">${tt.assign_to_name||"-"}</td>
<td class="px-3 py-2">${tt.maintenance_type||"-"}</td>
<td class="px-3 py-2">${tt.due_date||"-"}</td>
<td class="px-3 py-2">${tt.periodicity||"-"}</td>
<td class="px-3 py-2"><span class="px-2 py-1 rounded-full text-xs font-medium ${Ia}">${tt.maintenance_status||"-"}</span></td>
<td class="px-3 py-2 text-sm text-gray-600">${tt.actions_performed||"-"}</td>
</tr>
`}).join(""):'<tr><td colspan="7" class="px-4 py-8 text-center text-gray-500">No Pending/Planned Maintenance Logs</td></tr>';kt.document.write(`
<!DOCTYPE html>
<html>
<head>
<title>Asset History - ${e}</title>
<script src="https://cdn.tailwindcss.com"><\/script>
<style>
@page { margin: 0.5in; size: landscape; }
@media print {
.no-print { display: none !important; }
.page-break { page-break-before: always; }
}
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
.section-card {
background: white;
border-radius: 12px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
margin-bottom: 24px;
overflow: hidden;
}
.section-header {
padding: 16px 20px;
font-weight: 600;
font-size: 16px;
display: flex;
align-items: center;
gap: 10px;
}
.section-content {
padding: 16px 20px;
}
table {
width: 100%;
border-collapse: collapse;
}
th {
text-align: left;
padding: 12px 16px;
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
td {
border-top: 1px solid #e5e7eb;
}
</style>
</head>
<body class="bg-gray-100 min-h-screen">
<!-- Header -->
<div class="bg-gradient-to-r from-blue-600 to-blue-800 text-white py-6 px-8 no-print">
<div class="max-w-7xl mx-auto flex justify-between items-center">
<div>
<h1 class="text-2xl font-bold">Asset History</h1>
<p class="text-blue-200 mt-1">Complete history and maintenance records</p>
</div>
<div class="flex gap-3">
<button onclick="window.print()" class="bg-white text-blue-600 px-4 py-2 rounded-lg font-medium hover:bg-blue-50 transition">
🖨️ Print / Save PDF
</button>
<button onclick="window.close()" class="bg-blue-700 text-white px-4 py-2 rounded-lg font-medium hover:bg-blue-600 transition">
✕ Close
</button>
</div>
</div>
</div>
<div class="max-w-7xl mx-auto py-6 px-8">
<!-- Asset Details Card -->
<div class="section-card">
<div class="section-header bg-gradient-to-r from-blue-500 to-blue-600 text-white">
<span>🔍</span> Asset Details
</div>
<div class="section-content">
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4">
<div class="bg-gray-50 rounded-lg p-4">
<p class="text-xs text-gray-500 uppercase tracking-wide">Asset ID</p>
<p class="font-semibold text-blue-600 mt-1">${e}</p>
</div>
<div class="bg-gray-50 rounded-lg p-4">
<p class="text-xs text-gray-500 uppercase tracking-wide">Asset Name</p>
<p class="font-semibold mt-1">${ze.asset_name||"-"}</p>
</div>
<div class="bg-gray-50 rounded-lg p-4">
<p class="text-xs text-gray-500 uppercase tracking-wide">🏥 Hospital</p>
<p class="font-semibold mt-1">${ze.company||"-"}</p>
</div>
<div class="bg-gray-50 rounded-lg p-4">
<p class="text-xs text-gray-500 uppercase tracking-wide">📍 Location</p>
<p class="font-semibold mt-1">${ze.location||"-"}</p>
</div>
<div class="bg-gray-50 rounded-lg p-4">
<p class="text-xs text-gray-500 uppercase tracking-wide">🚛 Supplier</p>
<p class="font-semibold mt-1">${ze.supplier||"-"}</p>
</div>
<div class="bg-amber-50 rounded-lg p-4 border border-amber-200">
<p class="text-xs text-amber-600 uppercase tracking-wide">💰 Total Repair Cost</p>
<p class="font-bold text-amber-700 mt-1 text-lg">${ze.custom_total_spare_parts_amount||0} ر.س</p>
</div>
</div>
</div>
</div>
<!-- Two Column Layout -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<!-- Work Orders -->
<div class="section-card">
<div class="section-header bg-gradient-to-r from-indigo-500 to-indigo-600 text-white">
<span>🔗</span> Linked Work Orders
</div>
<div class="overflow-x-auto">
<table>
<thead class="bg-gray-50">
<tr>
<th class="text-gray-600">Work Order No</th>
<th class="text-gray-600">Type</th>
<th class="text-gray-600">Status</th>
<th class="text-gray-600">Repair Cost</th>
<th class="text-gray-600">Created</th>
</tr>
</thead>
<tbody>
${da}
</tbody>
</table>
</div>
</div>
<!-- Spare Parts -->
<div class="section-card">
<div class="section-header bg-gradient-to-r from-orange-500 to-orange-600 text-white">
<span>🛠️</span> Items Used for Repair
</div>
<div class="section-content max-h-96 overflow-y-auto">
${xe}
</div>
</div>
</div>
<!-- Maintenance Section -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mt-6">
<!-- Maintenance Records -->
<div class="section-card">
<div class="section-header bg-gradient-to-r from-teal-500 to-teal-600 text-white">
<span>🛠️</span> Maintenance Records
</div>
<div class="section-content max-h-80 overflow-y-auto">
${De}
</div>
</div>
<!-- Maintenance Tasks -->
<div class="section-card lg:col-span-2">
<div class="section-header bg-gradient-to-r from-purple-500 to-purple-600 text-white">
<span>📋</span> Maintenance Tasks
</div>
<div class="overflow-x-auto">
<table>
<thead class="bg-gray-50">
<tr>
<th class="text-gray-600">Assigned To</th>
<th class="text-gray-600">Periodicity</th>
<th class="text-gray-600">Next Due Date</th>
<th class="text-gray-600">Maintenance ID</th>
</tr>
</thead>
<tbody>
${$e}
</tbody>
</table>
</div>
</div>
</div>
<!-- Periodic Maintenance Summary -->
<div class="section-card mt-6">
<div class="section-header bg-gradient-to-r from-cyan-500 to-cyan-600 text-white">
<span>📜</span> Periodic Maintenance Summary
</div>
<div class="section-content">
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
${Et}
</div>
</div>
</div>
<!-- Completed Maintenance Logs -->
<div class="section-card mt-6">
<div class="section-header bg-gradient-to-r from-green-500 to-green-600 text-white">
<span>✅</span> Completed Maintenance Logs
</div>
<div class="overflow-x-auto">
<table>
<thead class="bg-gray-50">
<tr>
<th class="text-gray-600">Log ID</th>
<th class="text-gray-600">Assigned To</th>
<th class="text-gray-600">Type</th>
<th class="text-gray-600">Due Date</th>
<th class="text-gray-600">Completed</th>
<th class="text-gray-600">Periodicity</th>
<th class="text-gray-600">Actions</th>
</tr>
</thead>
<tbody>
${Gt}
</tbody>
</table>
</div>
</div>
<!-- Pending/Planned Maintenance Logs -->
<div class="section-card mt-6">
<div class="section-header bg-gradient-to-r from-amber-500 to-amber-600 text-white">
<span>⏳</span> Pending/Planned Maintenance Logs
</div>
<div class="overflow-x-auto">
<table>
<thead class="bg-gray-50">
<tr>
<th class="text-gray-600">Log ID</th>
<th class="text-gray-600">Assigned To</th>
<th class="text-gray-600">Type</th>
<th class="text-gray-600">Due Date</th>
<th class="text-gray-600">Periodicity</th>
<th class="text-gray-600">Status</th>
<th class="text-gray-600">Actions</th>
</tr>
</thead>
<tbody>
${Sa}
</tbody>
</table>
</div>
</div>
<!-- Footer -->
<div class="text-center text-gray-500 text-sm mt-8 pb-8">
Generated on ${new Date().toLocaleString()} | Asset: ${e}
</div>
</div>
</body>
</html>
`),kt.document.close()}catch(ke){console.error("Error fetching Asset History:",ke),alert("Failed to load Asset History. Please try again.")}}),Lt=()=>{if(!e||o){alert("Please save the asset first to view Installation Report");return}const ke=window.open("","_blank");if(!ke)return;const ze=new Date,Je=bt=>{const Ut=String(bt.getDate()).padStart(2,"0"),Rt=String(bt.getMonth()+1).padStart(2,"0"),Pt=bt.getFullYear();return`${Ut}/${Rt}/${Pt}`},nt=(_==null?void 0:_.custom_spare_parts)||[];let ut="";const ft=3;if(nt.length>0){nt.forEach((bt,Ut)=>{ut+=`
<tr>
<td>${Ut+1}</td>
<td>${bt.item_name||""}</td>
<td>${bt.item_code||""}</td>
<td>${bt.uom||""}</td>
<td>${bt.qty||""}</td>
</tr>
`});for(let bt=nt.length;bt<ft;bt++)ut+=`
<tr>
<td>${bt+1}</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
`}else for(let bt=0;bt<ft;bt++)ut+=`
<tr>
<td>${bt+1}</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
`;ke.document.write(`
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Installation Report - ${e}</title>
<style>
@page {
margin: 0.5in;
size: A4;
}
body {
font-family: 'Times New Roman', serif;
margin: 0;
padding: 20px;
font-size: 12px;
line-height: 1.3;
direction: rtl;
text-align: right;
}
.header-line {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 5px;
}
.header-right {
font-weight: bold;
}
.header-center {
font-weight: bold;
text-align: center;
flex-grow: 1;
}
.header-left {
font-weight: bold;
}
.dotted-line {
border-bottom: 1px dotted #000;
display: inline-block;
min-width: 100px;
}
.main-content {
margin: 15px 0;
text-align: justify;
}
.equipment-section {
margin: 15px 0;
}
.equipment-line {
display: flex;
justify-content: space-between;
margin: 8px 0;
font-weight: bold;
}
.equipment-item {
display: flex;
align-items: center;
direction: ltr;
text-align: left;
width: 48%;
}
.arabic-label {
direction: rtl;
text-align: right;
margin-left: 10px;
}
.colon {
margin: 0 5px;
}
.field-value {
border-bottom: 1px solid #000;
min-width: 120px;
display: inline-block;
height: 18px;
}
.location-line {
margin: 10px 0;
font-weight: bold;
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
.location-arabic {
direction: rtl;
text-align: right;
}
.location-english {
direction: ltr;
text-align: left;
}
.parts-table {
width: 100%;
border-collapse: collapse;
margin: 15px 0;
border: 2px solid #000;
}
.parts-table th,
.parts-table td {
border: 1px solid #000;
padding: 6px;
text-align: center;
font-weight: bold;
vertical-align: middle;
}
.parts-table th {
background-color: #f8f8f8;
font-size: 11px;
}
.parts-table .row-number {
width: 8%;
}
.parts-table .description {
width: 35%;
}
.parts-table .part-number {
width: 25%;
}
.parts-table .unit {
width: 16%;
}
.parts-table .quantity {
width: 16%;
}
.footer-text {
margin: 20px 0;
text-align: justify;
}
.signatures-section {
margin-top: 40px;
}
.signature-row {
display: flex;
justify-content: space-between;
margin: 30px 0;
}
.signature-block-right {
text-align: left;
width: 45%;
float: right;
}
.signature-block-left {
text-align: left;
width: 45%;
float: left;
}
.signature-title {
font-weight: bold;
margin-bottom: 3px;
font-size: 11px;
}
.signature-line {
border-bottom: 1px solid #000;
height: 25px;
margin: 8px 0;
display: inline-block;
width: 120px;
margin-left: 10px;
}
.signature-label {
font-size: 10px;
font-weight: bold;
}
.seal-section {
text-align: center;
margin-top: 30px;
font-weight: bold;
font-size: 12px;
}
</style>
</head>
<body>
<!-- Header Section -->
<div class="header-line">
<div class="header-right">المملكة العربية السعودية</div>
<div class="header-center"></div>
<div class="header-left">الرقم: <span class="dotted-line">${e||""}</span></div>
</div>
<div class="header-line">
<div class="header-right">تجمع الجوف الصحي</div>
<div class="header-center">محضر تركيب</div>
<div class="header-left">التاريخ: <span class="dotted-line">${Je(ze)}</span> هـ</div>
</div>
<div class="header-line">
<div class="header-right">الصيانة الطبية</div>
<div class="header-center">INSTALLATION REPORT</div>
<div class="header-left">الموافق: <span class="dotted-line">${Je(ze)}</span> م</div>
</div>
<div style="margin: 15px 0; font-weight: bold;">
مستشفى <span class="dotted-line" style="min-width: 200px;">${f.company||""}</span>
</div>
<!-- Main Content -->
<div class="main-content">
تشهد مستشفى <span class="dotted-line" style="min-width: 180px;">${f.company||""}</span> بأن <span class="dotted-line" style="min-width: 180px;">${f.supplier||""}</span> قامت بتركيب و توريد قطع الغيار الخاصة التالية والتابعة:
</div>
<!-- Equipment Information -->
<div class="equipment-section">
<div class="equipment-line">
<div class="equipment-item">
<span>EQUIPMENT NAME</span>
<span class="colon">:</span>
<span class="field-value">${f.asset_name||""}</span>
<span class="arabic-label">اسم الجهاز:</span>
</div>
<div class="equipment-item">
<span>MFR</span>
<span class="colon">:</span>
<span class="field-value">${f.custom_manufacturer||""}</span>
<span class="arabic-label">صناعة:</span>
</div>
</div>
<div class="equipment-line">
<div class="equipment-item">
<span>SERIAL NO</span>
<span class="colon">:</span>
<span class="field-value">${f.custom_serial_number||""}</span>
<span class="arabic-label">مسلسل:</span>
</div>
<div class="equipment-item">
<span>MODEL</span>
<span class="colon">:</span>
<span class="field-value">${f.custom_model||""}</span>
<span class="arabic-label">موديل:</span>
</div>
</div>
</div>
<div class="location-line">
<span class="location-arabic">
التابع لقسم:
</span>
<span class="field-value" style="min-width: 300px; flex-grow: 1; margin: 0 10px; text-align: left;">${f.location||""}</span>
<span class="location-english">
LOCATION:
</span>
</div>
<!-- Parts Table -->
<table class="parts-table">
<thead>
<tr>
<th class="row-number">م</th>
<th class="description">وصف القطعة<br>DESCRIPTION</th>
<th class="part-number">رقم القطعة<br>PART NO.</th>
<th class="unit">الوحدة<br>UNIT</th>
<th class="quantity">الكمية<br>QTY.</th>
</tr>
</thead>
<tbody>
${ut}
</tbody>
</table>
<!-- Footer Text -->
<div class="footer-text">
وذلك طبقا لعقد صيانة وإصلاح الأجهزة الطبية بمستشفى <span class="dotted-line" style="min-width: 150px;">${f.company||""}</span> والجهاز يعمل بحالة جيدة.
<br><br>
وﷲ الموفق .....
</div>
<!-- Signatures Section -->
<div class="signatures-section">
<!-- First Row -->
<div class="signature-row">
<div class="signature-block-right">
<div class="signature-title">المسئول في القسم &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dept. Responsible</div>
<div><span class="signature-line"></span><span class="signature-label">Name</span></div>
<div><span class="signature-line"></span><span class="signature-label">Sign</span></div>
</div>
<div class="signature-block-left">
<div class="signature-title">مدير شركة سمامة &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Site Manager</div>
<div><span class="signature-line"></span><span class="signature-label">Name</span></div>
<div><span class="signature-line"></span><span class="signature-label">Sign</span></div>
</div>
</div>
<!-- Installation Engineer - Right aligned -->
<div style="text-align: left; margin: 25px 0; width: 45%; float: right; clear: both;">
<div class="signature-title">مهندس/ فني التركيب &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Installation Eng</div>
<div><span class="signature-line"></span><span class="signature-label">Name</span></div>
<div><span class="signature-line"></span><span class="signature-label">Sign</span></div>
</div>
<div style="clear: both;"></div>
<!-- Second Row -->
<div class="signature-row">
<div class="signature-block-right">
<div class="signature-title">مشرف الوزارة بالمستشفى &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hospital Supervisor</div>
<div><span class="signature-line"></span><span class="signature-label">Name</span></div>
<div><span class="signature-line"></span><span class="signature-label">Sign</span></div>
</div>
<div class="signature-block-left">
<div class="signature-title">مدير المستشفى/ المركز &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hospital Manager</div>
<div><span class="signature-line"></span><span class="signature-label">Name</span></div>
<div><span class="signature-line"></span><span class="signature-label">Sign</span></div>
</div>
</div>
</div>
<!-- Official Seal -->
<div class="seal-section">
الختم الرسمي
</div>
<script>
window.onload = function() {
window.print();
};
<\/script>
</body>
</html>
`),ke.document.close()},Be=()=>{if(!e||o){alert("Please save the asset first to view Dismantling Report");return}const ke=window.open("","_blank");if(!ke)return;const ze=new Date,Je=ft=>{const bt=String(ft.getDate()).padStart(2,"0"),Ut=String(ft.getMonth()+1).padStart(2,"0"),Rt=ft.getFullYear();return`${bt}/${Ut}/${Rt}`},nt=_!=null&&_.creation?new Date(_.creation):null;let ut="";if(nt){const ft=Math.floor((ze.getTime()-nt.getTime())/31536e6),bt=Math.floor((ze.getTime()-nt.getTime())%(1e3*60*60*24*365)/(1e3*60*60*24*30));ut=`${ft} سنة و ${bt} شهر`}ke.document.write(`
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dismantling Report - ${e}</title>
<style>
@page {
margin: 0.5in;
size: A4;
}
body {
font-family: 'Times New Roman', serif;
margin: 0;
padding: 20px;
font-size: 12px;
line-height: 1.4;
direction: rtl;
text-align: right;
}
.header {
text-align: left;
margin-bottom: 30px;
}
.title {
text-align: center;
font-size: 14px;
font-weight: bold;
margin: 20px 0;
}
.department-line {
margin: 15px 0;
font-weight: bold;
}
.section-title {
font-weight: bold;
margin: 20px 0 10px 0;
}
.reasons-section {
margin: 20px 0;
}
.reasons-table {
width: 60%;
border-collapse: collapse;
margin: 10px 0;
}
.reasons-table td {
border: 2px solid #000;
padding: 8px;
text-align: center;
font-weight: bold;
width: 16.66%;
height: 30px;
}
.reason-text {
margin: 8px 0;
text-align: right;
font-size: 11px;
direction: rtl;
word-wrap: break-word;
overflow-wrap: break-word;
}
.committee-opinion {
margin: 20px 0;
padding: 10px;
border: 1px solid #ccc;
text-align: justify;
}
.signatures-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
.signatures-table td {
padding: 8px;
text-align: right;
vertical-align: top;
font-weight: bold;
direction: rtl;
word-wrap: break-word;
overflow-wrap: break-word;
}
.signature-title {
font-size: 11px;
height: 30px;
font-weight: bold;
}
.signature-field {
height: 25px;
font-size: 10px;
}
.hospital-manager {
text-align: right;
margin: 20px 0;
}
.hospital-manager-table {
width: 100%;
margin: 0;
border-collapse: collapse;
float: right;
}
.hospital-manager-table td {
padding: 8px;
text-align: right;
font-weight: bold;
direction: rtl;
word-wrap: break-word;
overflow-wrap: break-word;
}
.seal-section {
text-align: center;
margin: 30px 0;
font-weight: bold;
}
.footer {
margin-top: 40px;
text-align: right;
}
.footer-title {
font-weight: bold;
margin-bottom: 5px;
color: #0066cc;
}
.footer-name {
font-size: 11px;
color: #0066cc;
}
.logo {
width: 100px;
height: 60px;
margin: 0;
display: inline-flex;
align-items: center;
justify-content: center;
}
.logo img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
}
.equipment-table {
width: 100%;
border: 1px solid black;
border-collapse: collapse;
}
.equipment-table td {
width: 25%;
border: 1px solid black;
padding: 8px;
}
</style>
</head>
<body>
<!-- Header Section -->
<div class="header">
<div class="logo"><img src='/files/SEMH!.png' onerror="this.style.display='none'"></div>
</div>
<!-- Title -->
<div class="title">
محضر تكهين / إبعاد عن الخدمة
</div>
<!-- Department -->
<div class="department-line">
القسم : <span style="border-bottom: 1px solid #000; min-width: 200px; display: inline-block;">${f.department||""}</span>
</div>
<!-- Equipment Data Section -->
<div class="section-title">0-1 بيانات الجهاز المطلوب تكهينه :</div>
<table class="equipment-table">
<tr>
<td>اسم الجهاز</td>
<td>${f.asset_name||""}</td>
<td>الرقم التسلسلي</td>
<td>${f.custom_serial_number||""}</td>
</tr>
<tr>
<td>الشركة الصانعة</td>
<td>${f.custom_manufacturer||""}</td>
<td>تاريخ التوريد</td>
<td>${nt?Je(nt):""}</td>
</tr>
<tr>
<td>الطراز/الموديل</td>
<td>${f.custom_model||""}</td>
<td>مدة استخدام الجهاز</td>
<td>${ut}</td>
</tr>
</table>
<!-- Reasons Section -->
<div class="section-title">2- أسباب طلب التكهين / إبعاد عن الخدمة :</div>
<table class="reasons-table">
<tr>
<td>أ</td>
<td>ب</td>
<td>ج</td>
<td>د</td>
<td>هـ</td>
<td>و</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<div class="reason-text">
أ) تكاليف قطع الغيار المطلوبة للإصلاح أكثر من نصف قيمة الجهاز (مرفق عرض أسعار قطع الغيار اللازمة للإصلاح).
</div>
<div class="reason-text">
ب) توقف انتاج الجهاز وقطع الغيار من الشركة الصانعة حسب تقرير المورد.
</div>
<div class="reason-text">
ج) جهاز قديم وتم استخدامه أكثر من عشر سنوات.
</div>
<div class="reason-text">
د) ليس للجهاز وكيل معروف بالمملكة في الوقت الحالي ولا يمكن توفير قطع غيار للجهاز.
</div>
<div class="reason-text">
ه) تكرار أعطال الجهاز وإصلاحه على فترات متقاربة.
</div>
<div class="reason-text">
و) أخرى : <span style="border-bottom: 1px solid #000; min-width: 300px; display: inline-block;"></span>
</div>
<!-- Committee Opinion -->
<div class="section-title">3- مرئيات اللجنة:</div>
<div class="reason-text">
بناءاً على الفقرة أ. ج. و. يتم تكهين الجهاز وادراجه ضمن بنود الإحلال المطلوبة للمستشفى.
</div>
<!-- Signatures Section -->
<div class="section-title">توقيع اللجنة :</div>
<table class="signatures-table">
<tr>
<td class="signature-title">المقاول</td>
<td class="signature-title">رئيس القسم</td>
<td class="signature-title">مدير الصيانة الطبية</td>
<td class="signature-title">مدير مراقبة المخزون</td>
</tr>
<tr>
<td class="signature-field">الإسم :</td>
<td class="signature-field">الإسم :</td>
<td class="signature-field">الإسم :</td>
<td class="signature-field">الإسم :</td>
</tr>
<tr>
<td class="signature-field">التوقيع :</td>
<td class="signature-field">التوقيع :</td>
<td class="signature-field">التوقيع :</td>
<td class="signature-field">التوقيع :</td>
</tr>
<tr>
<td class="signature-field">التاريخ :</td>
<td class="signature-field">التاريخ :</td>
<td class="signature-field">التاريخ :</td>
<td class="signature-field">التاريخ :</td>
</tr>
</table>
<!-- Hospital Manager Section -->
<div class="hospital-manager">
<table class="hospital-manager-table">
<tr>
<td class="signature-title">مدير مستشفى</td>
</tr>
<tr>
<td class="signature-field">الإسم :</td>
</tr>
<tr>
<td class="signature-field">التوقيع :</td>
</tr>
<tr>
<td class="signature-field">التاريخ :</td>
</tr>
<tr>
<td class="signature-field">الختم :</td>
</tr>
</table>
</div>
<!-- Arabic text after last table -->
<div style="clear: both; text-align: left; margin: 20px 0;">
<div style="font-weight: bold; margin-bottom: 5px;">الصيانة الطبية بتجمع الجوف الصحي</div>
<div>المهندس/عبد العزيز زايد الخمعلي</div>
</div>
<!-- Footer -->
<div class="footer">
<div style="color: #0066cc; font-weight: bold;">تجمع الجوف الصحي</div>
<div style="color: #0066cc;">Aljouf Health Cluster</div>
</div>
<script>
window.onload = function() {
window.print();
};
<\/script>
</body>
</html>
`),ke.document.close()};return r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("button",{onClick:()=>t("/assets"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[r.jsx(no,{}),r.jsx("span",{className:"text-gray-900 dark:text-white font-medium",children:u?"Duplicate Asset":o?"New Asset Details":"Asset Details"})]}),_&&r.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${H===0?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300":H===1?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300":"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300"}`,children:H===0?"Draft":H===1?"Submitted":"Cancelled"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[!o&&!R&&!oe&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",ref:re,children:[r.jsxs("button",{onClick:()=>le(!pe),className:"bg-blue-600 hover:bg-blue-700 text-white px-2 py-1 rounded-lg flex items-center gap-2",children:["Actions",r.jsx(wc,{size:12,className:`transition-transform ${pe?"rotate-180":""}`})]}),pe&&r.jsx("div",{className:"absolute right-0 mt-2 w-56 bg-white dark:bg-gray-800 rounded-md shadow-lg z-50 border border-gray-200 dark:border-gray-700",children:r.jsxs("div",{className:"py-1",children:[Pe&&r.jsxs("button",{onClick:()=>{ht(),le(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(U0,{size:14}),"Print QR"]}),r.jsxs("button",{onClick:()=>{Vt(),le(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(U0,{size:14}),"Stay Plugged"]}),r.jsxs("button",{onClick:()=>{_t(),le(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(Xo,{size:14}),"PPM Plan"]}),r.jsxs("button",{onClick:()=>{ia(),le(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(c6,{size:14}),"Asset History"]}),r.jsxs("button",{onClick:()=>{Lt(),le(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(l6,{size:14}),"Installation Report"]}),(_==null?void 0:_.status)==="Scrapped"&&r.jsxs("button",{onClick:()=>{Be(),le(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center gap-2 text-red-600 dark:text-red-400 border-t border-gray-200 dark:border-gray-700",children:[r.jsx(m6,{size:14}),"Dismantling Report"]})]})})]}),r.jsxs("button",{onClick:()=>U(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-2 py-1 rounded-lg flex items-center gap-2",children:[r.jsx(Tn,{}),"Edit"]}),se&&r.jsxs("button",{onClick:it,disabled:O,className:"bg-purple-600 hover:bg-purple-700 text-white px-2 py-1 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(w_,{}),O?"Submitting...":"Submit"]})]}),oe&&r.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 italic",children:"Cancelled documents cannot be edited"}),R&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>{o?t("/assets"):U(!1)},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 dark:text-gray-800 px-2 py-1 rounded-lg",disabled:O,children:"Cancel"}),r.jsxs("button",{onClick:He,disabled:O,className:"bg-green-600 hover:bg-green-700 text-white px-2 py-1 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(Wn,{}),O?"Saving...":"Save Changes"]})]})]})]}),r.jsxs("form",{onSubmit:He,children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Asset Information"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Asset Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{type:"text",name:"asset_name",value:f.asset_name,onChange:Fe,placeholder:"e.g. Laptop Model X",required:!0,disabled:de("asset_name"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsx(St,{label:"Category",doctype:"Asset Type",value:f.custom_asset_type||"",onChange:ke=>p(Le(ie({},f),{custom_asset_type:ke})),disabled:de("custom_asset_type")}),r.jsx(St,{label:"Modality",doctype:"Modality",value:f.custom_modality||"",onChange:ke=>p(Le(ie({},f),{custom_modality:ke})),disabled:de("custom_modality")}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Class"}),r.jsxs("select",{name:"custom_class",value:f.custom_class,onChange:Fe,disabled:de("custom_class"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select class"}),r.jsx("option",{value:"Class A",children:"Class A"}),r.jsx("option",{value:"Class B",children:"Class B"}),r.jsx("option",{value:"Class C",children:"Class C"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset ID"}),r.jsx("input",{type:"text",value:o||u?"Auto-generated":_==null?void 0:_.name,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"}),u&&r.jsxs("p",{className:"mt-1 text-xs text-blue-600 dark:text-blue-400",children:["💡 Duplicating from: ",s]})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Device Status ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsxs("select",{name:"custom_device_status",value:f.custom_device_status,onChange:Fe,disabled:!R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"Up",children:"Up"}),r.jsx("option",{value:"Down",children:"Down"})]})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Technical Specs"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Serial Code"}),r.jsx("input",{type:"text",name:"custom_serial_number",value:f.custom_serial_number,onChange:Fe,placeholder:"e.g. SN-12345",disabled:de("custom_serial_number"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsx(St,{label:"Manufacturer",doctype:"Manufacturer",value:f.custom_manufacturer||"",onChange:ke=>p(Le(ie({},f),{custom_manufacturer:ke})),disabled:de("custom_manufacturer")}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Model"}),r.jsx("input",{type:"text",name:"custom_model",value:f.custom_model,onChange:Fe,placeholder:"Model number",disabled:de("custom_model"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Hours"}),r.jsx("input",{type:"number",name:"custom_total_hours",value:f.custom_total_hours||0,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Calculated from Available For Use Date"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Down Time (Hours)"}),r.jsx("input",{type:"number",name:"custom_down_time",value:f.custom_down_time||0,onChange:Fe,placeholder:"0",disabled:de("custom_down_time"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Up Time (Hours)"}),r.jsx("input",{type:"number",name:"custom_up_time",value:f.custom_up_time||0,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Calculated: Total Hours - Down Time"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Location"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(St,{label:"Hospital",doctype:"Company",value:f.company||"",onChange:ke=>{p(Le(ie({},f),{company:ke,asset_owner_company:ke,department:""}))},disabled:de("company"),filters:{domain:"Healthcare"}}),ye("custom_site")&&r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Site Name ",ue("custom_site")&&r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{type:"text",name:"custom_site",value:f.custom_site||"",onChange:Fe,placeholder:"Site name",disabled:de("custom_site"),required:ue("custom_site"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsx(St,{label:"Department",doctype:"Department",value:f.department||"",onChange:ke=>p(Le(ie({},f),{department:ke})),disabled:de("department"),filters:J}),r.jsx(St,{label:"Location",doctype:"Location",value:f.location||"",onChange:ke=>p(Le(ie({},f),{location:ke})),disabled:de("location")}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Building"}),r.jsx("input",{type:"text",placeholder:"Building name",disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Room Number"}),r.jsx("input",{type:"text",placeholder:"e.g. Room 001-002",disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"More Details"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col items-center my-4",children:[r.jsx("div",{className:"border-2 border-gray-300 dark:border-gray-600 p-3 rounded-lg bg-white dark:bg-gray-700",children:Pe?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:Pe,alt:`QR Code for ${(_==null?void 0:_.name)||"Asset"}`,className:"w-[120px] h-[120px] object-contain",onError:ke=>{const ze=ke.target;ze.style.display="none";const Je=ze.nextElementSibling;Je&&(Je.style.display="flex")}}),r.jsx("div",{className:"w-[120px] h-[120px] hidden items-center justify-center bg-gray-100 dark:bg-gray-700 rounded",children:r.jsx(U0,{size:80,className:"text-gray-400 dark:text-gray-500"})})]}):r.jsx("div",{className:"w-[120px] h-[120px] flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded",children:r.jsx(U0,{size:80,className:"text-gray-400 dark:text-gray-500"})})}),(_==null?void 0:_.name)&&r.jsxs("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 text-center",children:["Asset ID: ",_.name]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Description"}),r.jsx("textarea",{rows:4,placeholder:"Brief description of the asset",disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mt-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Coverage"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Site Contractor"}),r.jsx("input",{type:"text",name:"custom_site_contractor",value:f.custom_site_contractor,onChange:Fe,disabled:de("custom_site_contractor"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Contract Number"}),r.jsx("input",{type:"text",disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Agreement"}),r.jsxs("select",{name:"custom_service_agreement",value:f.custom_service_agreement||"",onChange:Fe,disabled:de("custom_service_agreement"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Service Agreement"}),r.jsx("option",{value:"Warranty",children:"Warranty"}),r.jsx("option",{value:"Contract",children:"Contract"}),r.jsx("option",{value:"Frame Work",children:"Frame Work"}),r.jsx("option",{value:"Main Contractor",children:"Main Contractor"}),r.jsx("option",{value:"Out of warranty",children:"Out of warranty"}),r.jsx("option",{value:"Under Dismantle",children:"Under Dismantle"}),r.jsx("option",{value:"Under Installation",children:"Under Installation"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Coverage"}),r.jsxs("select",{name:"custom_service_coverage",value:f.custom_service_coverage||"",onChange:Fe,disabled:de("custom_service_coverage"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Service Coverage"}),r.jsx("option",{value:"PM Only",children:"PM Only"}),r.jsx("option",{value:"Labour",children:"Labour"}),r.jsx("option",{value:"Labour & Parts",children:"Labour & Parts"}),r.jsx("option",{value:"Comprehensive",children:"Comprehensive"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Start Date"}),r.jsx("input",{type:"date",name:"custom_start_date",value:f.custom_start_date||"",onChange:Fe,disabled:de("custom_start_date"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"End Date"}),r.jsx("input",{type:"date",name:"custom_end_date",value:f.custom_end_date||"",onChange:Fe,disabled:de("custom_end_date"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Amount"}),r.jsx("input",{type:"number",name:"custom_total_amount",value:f.custom_total_amount,onChange:Fe,disabled:de("custom_total_amount"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Comments"}),r.jsx("textarea",{rows:2,disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Acquisition Details"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Purchase Order Number"}),r.jsx("input",{type:"text",placeholder:"PO number",disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsx(St,{label:"Supplier/Vendor",doctype:"Supplier",value:f.supplier||"",onChange:ke=>p(Le(ie({},f),{supplier:ke})),disabled:de("supplier")}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Gross Purchase Amount"}),r.jsx("input",{type:"number",name:"gross_purchase_amount",value:f.gross_purchase_amount||0,onChange:Fe,disabled:de("gross_purchase_amount"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Purchase Date"}),r.jsx("input",{type:"date",disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Installation Date"}),r.jsx("input",{type:"date",disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Available For Use Date"}),r.jsx("input",{type:"date",name:"available_for_use_date",value:f.available_for_use_date||"",onChange:ke=>p(ze=>Le(ie({},ze),{available_for_use_date:ke.target.value})),disabled:de("available_for_use_date"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Financial Details"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"The depreciation method is an accounting method used to allocate the cost of a tangible asset over its useful life."}),r.jsxs("div",{className:"flex items-center mb-6",children:[r.jsx("input",{id:"calculate_depreciation",type:"checkbox",checked:f.calculate_depreciation,onChange:ke=>p(Le(ie({},f),{calculate_depreciation:ke.target.checked})),disabled:!R,className:"h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"}),r.jsx("label",{htmlFor:"calculate_depreciation",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Calculate Depreciation"})]}),f.calculate_depreciation&&r.jsxs("div",{className:"border-t pt-4",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsx("h3",{className:"text-md font-semibold text-gray-800 dark:text-white",children:"Asset Finance Books"}),R&&r.jsxs("button",{type:"button",onClick:ae,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 flex items-center gap-2",children:[r.jsx("span",{children:"+"})," Add Row"]})]}),(!f.finance_books||f.finance_books.length===0)&&r.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-900 rounded-lg",children:'No finance books added yet. Click "Add Row" to add one.'}),f.finance_books&&f.finance_books.length>0&&r.jsx("div",{className:"overflow-visible",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full border-collapse",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-300 dark:border-gray-600",children:[r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[200px]",children:"Finance Book"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[200px]",children:"Depreciation Method*"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[180px]",children:"Total Depreciations*"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[180px]",children:"Frequency (Months)*"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[200px]",children:"Depreciation Posting Date*"}),R&&r.jsx("th",{className:"text-center px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[120px]",children:"Action"})]})}),r.jsx("tbody",{children:f.finance_books.map((ke,ze)=>{var Je,nt;return r.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750",children:[r.jsx("td",{className:"px-4 py-3 relative",style:{overflow:"visible"},children:r.jsx("div",{className:"relative z-20",children:r.jsx(St,{label:"",doctype:"Finance Book",value:ke.finance_book||"",onChange:ut=>D(ze,{finance_book:ut}),disabled:!R})})}),r.jsx("td",{className:"px-4 py-3",children:r.jsxs("select",{value:ke.depreciation_method||"",onChange:ut=>D(ze,{depreciation_method:ut.target.value}),disabled:!R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Method"}),r.jsx("option",{value:"Straight Line",children:"Straight Line"}),r.jsx("option",{value:"Double Declining Balance",children:"Double Declining Balance"}),r.jsx("option",{value:"Written Down Value",children:"Written Down Value"}),r.jsx("option",{value:"Manual",children:"Manual"})]})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"number",value:(Je=ke.total_number_of_depreciations)!=null?Je:"",onChange:ut=>D(ze,{total_number_of_depreciations:Number(ut.target.value)}),disabled:!R,placeholder:"0",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"number",value:(nt=ke.frequency_of_depreciation)!=null?nt:"",onChange:ut=>D(ze,{frequency_of_depreciation:Number(ut.target.value)}),disabled:!R,placeholder:"0",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"date",value:ke.depreciation_start_date||"",onChange:ut=>D(ze,{depreciation_start_date:ut.target.value}),disabled:!R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),R&&r.jsx("td",{className:"px-4 py-3 text-center",children:r.jsx("button",{type:"button",onClick:()=>z(ze),className:"px-3 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors",children:"Remove"})})]},ze)})})]})})})]})]})}),r.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 mt-6",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"End-of-Life Details"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Expected End-of-Life Date"}),r.jsx("input",{type:"date",disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Disposal Method"}),r.jsxs("select",{disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Recycling"}),r.jsx("option",{value:"Donation",children:"Donation"}),r.jsx("option",{value:"Sale",children:"Sale"})]})]})]})]})}),r.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Warranty & Service Contract"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_warranty",type:"checkbox",checked:f.custom_warranty||!1,onChange:ke=>{p(Le(ie({},f),{custom_warranty:ke.target.checked}))},disabled:de("custom_warranty"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_warranty?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_warranty",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Warranty"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_extended_warranty",type:"checkbox",checked:f.custom_extended_warranty||!1,onChange:ke=>{p(Le(ie({},f),{custom_extended_warranty:ke.target.checked}))},disabled:de("custom_extended_warranty"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_extended_warranty?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_extended_warranty",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Extended Warranty"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom__service_contract",type:"checkbox",checked:f.custom__service_contract||!1,onChange:ke=>{p(Le(ie({},f),{custom__service_contract:ke.target.checked}))},disabled:de("custom__service_contract"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom__service_contract?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom__service_contract",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Service Contract"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_covering_spare_parts",type:"checkbox",checked:f.custom_covering_spare_parts||!1,onChange:ke=>{p(Le(ie({},f),{custom_covering_spare_parts:ke.target.checked}))},disabled:de("custom_covering_spare_parts"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_covering_spare_parts?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_covering_spare_parts",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Covering Spare Parts"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_spare_parts_labour",type:"checkbox",checked:f.custom_spare_parts_labour||!1,onChange:ke=>{p(Le(ie({},f),{custom_spare_parts_labour:ke.target.checked}))},disabled:de("custom_spare_parts_labour"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_spare_parts_labour?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_spare_parts_labour",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Spare Parts Labour"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_covering_labour",type:"checkbox",checked:f.custom_covering_labour||!1,onChange:ke=>{p(Le(ie({},f),{custom_covering_labour:ke.target.checked}))},disabled:de("custom_covering_labour"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_covering_labour?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_covering_labour",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Covering Labour"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_ppm_only",type:"checkbox",checked:f.custom_ppm_only||!1,onChange:ke=>{p(Le(ie({},f),{custom_ppm_only:ke.target.checked}))},disabled:de("custom_ppm_only"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_ppm_only?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_ppm_only",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"PPM Only"})]})]}),r.jsxs("div",{className:"mt-4",children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Support Plan"}),r.jsx("input",{type:"text",name:"custom_support_plan",value:f.custom_support_plan||"",onChange:Fe,disabled:de("custom_support_plan"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]}),r.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white",children:"Spare Parts"}),R&&r.jsxs("button",{type:"button",onClick:q,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 flex items-center gap-2 text-sm",children:[r.jsx("span",{children:"+"})," Add Row"]})]}),(!f.custom_spare_parts||f.custom_spare_parts.length===0)&&r.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-900 rounded-lg",children:'No spare parts added yet. Click "Add Row" to add one.'}),f.custom_spare_parts&&f.custom_spare_parts.length>0&&r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full border-collapse",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-300 dark:border-gray-600",children:[r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Item Code"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Item Name"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Qty"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Rate"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Amount"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"UOM"}),R&&r.jsx("th",{className:"text-center px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Action"})]})}),r.jsx("tbody",{children:f.custom_spare_parts.map((ke,ze)=>r.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750",children:[r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"text",value:ke.item_code||"",onChange:Je=>G(ze,"item_code",Je.target.value),disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"text",value:ke.item_name||"",onChange:Je=>G(ze,"item_name",Je.target.value),disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"number",value:ke.qty||0,onChange:Je=>G(ze,"qty",Number(Je.target.value)),disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"number",value:ke.rate||0,onChange:Je=>G(ze,"rate",Number(Je.target.value)),disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"number",value:ke.amount||0,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"text",value:ke.uom||"",onChange:Je=>G(ze,"uom",Je.target.value),disabled:!R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),R&&r.jsx("td",{className:"px-4 py-3 text-center",children:r.jsx("button",{type:"button",onClick:()=>K(ze),className:"px-3 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors text-sm",children:"Remove"})})]},ze))}),r.jsx("tfoot",{children:r.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700 font-semibold",children:[r.jsx("td",{colSpan:4,className:"px-4 py-3 text-right text-sm text-gray-700 dark:text-gray-300",children:"Total Amount:"}),r.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-white",children:f.custom_total_spare_parts_amount||0}),r.jsx("td",{colSpan:R?2:1})]})})]})})]})]})]})},ZO=({isOpen:e,onClose:t,selectedCount:a,totalCount:s,pageCount:o,onExport:u,isExporting:c,exportColumns:f})=>{const{t:p}=ln(),[g,x]=E.useState(a>0?"selected":"all_with_filters"),[v,_]=E.useState("csv"),[k,T]=E.useState(f.filter(C=>C.default).map(C=>C.key));E.useEffect(()=>{a>0?x("selected"):x("all_with_filters")},[a]);const N=C=>{T(O=>O.includes(C)?O.filter(R=>R!==C):[...O,C])},j=()=>{T(f.map(C=>C.key))},P=()=>{T(f.filter(C=>C.default).map(C=>C.key))};return e?r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden animate-scale-in",children:[r.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ui,{className:"text-white text-xl"}),r.jsxs("h3",{className:"text-lg font-semibold text-white",children:[p("listPages.export")," ",p("workOrders.title")]})]}),r.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:r.jsx(pt,{size:20})})]})}),r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"What to Export"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="selected"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${a===0?"opacity-50 cursor-not-allowed":""}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"selected",checked:g==="selected",onChange:()=>x("selected"),disabled:a===0,className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",a," selected work order",a!==1?"s":""]})]}),a>0&&r.jsxs("span",{className:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 px-2 py-1 rounded text-xs font-medium",children:[a," selected"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="all_on_page"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:g==="all_on_page",onChange:()=>x("all_on_page"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",o," work order",o!==1?"s":""," on current page"]})]}),r.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 px-2 py-1 rounded text-xs font-medium",children:[o," rows"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="all_with_filters"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:g==="all_with_filters",onChange:()=>x("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," work order",s!==1?"s":""," matching current filters"]})]}),r.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/40 text-purple-700 dark:text-purple-300 px-2 py-1 rounded text-xs font-medium",children:[s," total"]})]})]})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Format"}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${v==="csv"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"csv",checked:v==="csv",onChange:()=>_("csv"),className:"text-green-600 focus:ring-green-500"}),r.jsx(tp,{className:"text-green-600 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"CSV"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${v==="excel"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"excel",checked:v==="excel",onChange:()=>_("excel"),className:"text-green-600 focus:ring-green-500"}),r.jsx(ap,{className:"text-green-700 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Excel"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:j,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),r.jsx("button",{onClick:P,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-48 overflow-y-auto p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg",children:f.map(C=>r.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${k.includes(C.key)?"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-400"}`,children:[r.jsx("input",{type:"checkbox",checked:k.includes(C.key),onChange:()=>N(C.key),className:"rounded text-green-600 focus:ring-green-500"}),r.jsx("span",{className:"text-sm truncate",children:C.label})]},C.key))}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[k.length," column",k.length!==1?"s":""," selected"]})]})]}),r.jsxs("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[r.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[g==="selected"&&`Exporting ${a} selected row${a!==1?"s":""}`,g==="all_on_page"&&`Exporting ${o} row${o!==1?"s":""} from current page`,g==="all_with_filters"&&`Exporting all ${s} row${s!==1?"s":""}`]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",disabled:c,children:"Cancel"}),r.jsx("button",{onClick:()=>u(g,v,k),disabled:k.length===0||c,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:c?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(kc,{}),"Export"]})})]})]})]})}):null},qO=()=>{const{t:e}=ln(),t=Da(),[a,s]=rl(),[o,u]=E.useState(0),[c,f]=E.useState(null),[p,g]=E.useState(null),x=E.useRef(null),v=20,_=[{key:"name",label:e("commonFields.workOrderId"),default:!0},{key:"asset",label:e("commonFields.assetId"),default:!0},{key:"asset_name",label:e("commonFields.assetName"),default:!0},{key:"work_order_type",label:e("commonFields.workOrderType"),default:!0},{key:"company",label:e("commonFields.company"),default:!0},{key:"department",label:e("commonFields.department"),default:!0},{key:"repair_status",label:e("commonFields.status"),default:!0},{key:"custom_priority_",label:e("commonFields.priority"),default:!0},{key:"custom_serial_number",label:e("commonFields.serialNumber"),default:!1},{key:"custom_manufacturer",label:e("commonFields.manufacturer"),default:!1},{key:"supplier",label:e("commonFields.supplier"),default:!1},{key:"description",label:e("commonFields.description"),default:!1},{key:"assigned_to",label:e("commonFields.assignedTo"),default:!1},{key:"scheduled_date",label:e("commonFields.scheduledDate"),default:!1},{key:"completed_date",label:e("commonFields.completedDate"),default:!1},{key:"creation",label:e("commonFields.createdOn"),default:!0},{key:"modified",label:e("commonFields.modifiedOn"),default:!1},{key:"owner",label:e("commonFields.createdBy"),default:!1}],k=a.get("asset"),[T,N]=E.useState(!1),[j,P]=E.useState(new Set),[C,O]=E.useState(!1),[R,U]=E.useState(!1),{permissionFilters:H,loading:B,error:oe,hasAnyRestrictions:se}=Lw("Work_Order"),[pe,le]=E.useState(""),[re,de]=E.useState(""),[ye,ue]=E.useState(""),[te,V]=E.useState(""),[J,ne]=E.useState(""),[ae,z]=E.useState(""),[D,G]=E.useState(""),[q,K]=E.useState(""),[fe,Pe]=E.useState(""),[We,Fe]=E.useState(""),[He,it]=E.useState(!0),[ht,Vt]=E.useState(0),[_t,ia]=E.useState([]),[Lt,Be]=E.useState(!1),[yt,ke]=E.useState(""),[ze,Je]=E.useState(""),nt=E.useRef(null);E.useEffect(()=>{const be=a.get("company"),I=a.get("priority"),ee=a.get("status");be&&V(be),I&&Fe(I),ee&&ne(ee)},[a]),E.useEffect(()=>{k&&de(k)},[k]),E.useEffect(()=>{const be=localStorage.getItem("workOrderFilterPresets");be&&ia(JSON.parse(be))},[]),E.useEffect(()=>{const be=[pe,re,ye,te,J,ae,D,q,fe,We].filter(Boolean).length;Vt(be)},[pe,re,ye,te,J,ae,D,q,fe,We]);const ut={};pe&&(ut.name=pe),re&&(ut.asset=re),ye&&(ut.work_order_type=ye),te&&(ut.company=te),J&&(ut.repair_status=J),ae&&(ut.custom_serial_number=["like",`%${ae}%`]),D&&(ut.custom_manufacturer=D),q&&(ut.supplier=q),fe&&(ut.department=fe),We&&(ut.custom_priority_=We);const{workOrders:ft,totalCount:bt,hasMore:Ut,loading:Rt,error:Pt,refetch:qe}=m_(ut,v,o*v,"creation desc",H),{deleteWorkOrder:at,loading:wt}=g_();E.useEffect(()=>{!Rt&&!T&&!B&&N(!0)},[Rt,T,B]),E.useEffect(()=>{o!==0&&u(0)},[pe,re,ye,te,J,ae,D,q,fe,We]),E.useEffect(()=>{P(new Set)},[pe,re,ye,te,J,ae,D,q,fe,We,o]);const kt=be=>{Je(be),nt.current&&clearTimeout(nt.current),nt.current=window.setTimeout(()=>{z(be)},800)},da=be=>{be.key==="Enter"&&(be.preventDefault(),nt.current&&clearTimeout(nt.current),z(ze))},xe=()=>{if(!yt.trim()){alert("Please enter a filter name");return}const be={id:Date.now(),name:yt,filters:{filterWorkOrderId:pe,filterAsset:re,filterType:ye,filterCompany:te,filterStatus:J,filterSerialNumber:ae,filterManufacturer:D,filterSupplier:q,filterDepartment:fe,filterPriority:We}},I=[..._t,be];ia(I),ke(""),Be(!1),localStorage.setItem("workOrderFilterPresets",JSON.stringify(I))},De=be=>{const I=be.filters;le(I.filterWorkOrderId||""),de(I.filterAsset||""),ue(I.filterType||""),V(I.filterCompany||""),ne(I.filterStatus||""),z(I.filterSerialNumber||""),Je(I.filterSerialNumber||""),G(I.filterManufacturer||""),K(I.filterSupplier||""),Pe(I.filterDepartment||""),Fe(I.filterPriority||"")},$e=be=>{const I=_t.filter(ee=>ee.id!==be);ia(I),localStorage.setItem("workOrderFilterPresets",JSON.stringify(I))};E.useEffect(()=>()=>{nt.current&&clearTimeout(nt.current)},[]),E.useEffect(()=>{const be=I=>{x.current&&!x.current.contains(I.target)&&g(null)};return p&&document.addEventListener("mousedown",be),()=>{document.removeEventListener("mousedown",be)}},[p]);const Et=be=>{P(I=>{const ee=new Set(I);return ee.has(be)?ee.delete(be):ee.add(be),ee})},Gt=()=>{j.size===ft.length?P(new Set):P(new Set(ft.map(be=>be.name)))},Sa=ft.length>0&&j.size===ft.length,tt=j.size>0&&j.size<ft.length,Zt=E.useCallback(()=>ge(null,null,function*(){const be=[];let I=0;const ee=100;let Y=!0;for(;Y;)try{const F=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Work_Order",filters:ie(ie({},ut),H),fields:["*"],limit_start:I*ee,limit_page_length:ee,order_by:"creation desc"})})).json()).message||[];be.push(...F),F.length<ee?Y=!1:I++,I>100&&(console.warn("Export safety limit reached"),Y=!1)}catch(X){throw console.error("Error fetching work orders for export:",X),X}return be}),[ut,H]),Ia=(be,I,ee)=>ge(null,null,function*(){U(!0);try{let Y=[];switch(be){case"selected":Y=ft.filter(Q=>j.has(Q.name));break;case"all_on_page":Y=ft;break;case"all_with_filters":Y=yield Zt();break}if(Y.length===0){alert("No data to export");return}const X=ee.map(Q=>{const F=_.find(he=>he.key===Q);return(F==null?void 0:F.label)||Q});if(I==="csv"){const Q=[X.join(","),...Y.map(_e=>ee.map(je=>{let Se=_e[je]||"";return typeof Se=="string"&&(Se.includes(",")||Se.includes('"')||Se.includes(`
`))&&(Se=`"${Se.replace(/"/g,'""')}"`),Se}).join(","))].join(`
`),F=new Blob(["\uFEFF"+Q],{type:"text/csv;charset=utf-8;"}),he=URL.createObjectURL(F),Ee=document.createElement("a");Ee.href=he,Ee.download=`work_orders_export_${new Date().toISOString().split("T")[0]}.csv`,Ee.click(),URL.revokeObjectURL(he)}else if(I==="excel"){const Q=[X,...Y.map(Ee=>ee.map(_e=>Ee[_e]||""))],F=ci.aoa_to_sheet(Q),he=ci.book_new();ci.book_append_sheet(he,F,"Work Orders"),Ep(he,`work_orders_export_${new Date().toISOString().split("T")[0]}.xlsx`)}O(!1),P(new Set)}catch(Y){console.error("Export failed:",Y),alert(`Export failed: ${Y instanceof Error?Y.message:"Unknown error"}`)}finally{U(!1)}}),Ba=()=>t("/work-orders/new"),Dr=be=>t(`/work-orders/${be}`),cn=be=>t(`/work-orders/${be}`),gs=be=>t(`/work-orders/new?duplicate=${be}`),ps=be=>ge(null,null,function*(){try{yield at(be),f(null),qe(),alert("Work order deleted successfully!")}catch(I){alert(`Failed to delete work order: ${I instanceof Error?I.message:"Unknown error"}`)}}),Zn=be=>{const I=JSON.stringify(be,null,2),ee=new Blob([I],{type:"application/json"}),Y=URL.createObjectURL(ee),X=document.createElement("a");X.href=Y,X.download=`work_order_${be.name}.json`,X.click(),URL.revokeObjectURL(Y)},Rr=be=>{window.open(`/work-orders/${be}?print=true`,"_blank")},qn=()=>{le(""),de(""),ue(""),V(""),ne(""),z(""),Je(""),G(""),K(""),Pe(""),Fe(""),a.has("asset")&&(a.delete("asset"),s(a)),nt.current&&clearTimeout(nt.current)},dn=pe||re||ye||te||J||ae||D||q||fe||We,Cn=be=>{switch(be==null?void 0:be.toLowerCase()){case"completed":return r.jsx($n,{className:"text-green-500"});case"in progress":return r.jsx(gc,{className:"text-blue-500"});case"pending":return r.jsx(Br,{className:"text-yellow-500"});default:return r.jsx(gc,{className:"text-gray-400"})}},xs=be=>{switch(be==null?void 0:be.toLowerCase()){case"completed":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300";case"in progress":return"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300";case"pending":case"open":return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-300";case"cancelled":return"bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-300";default:return"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300"}},Za=be=>{switch(be==null?void 0:be.toLowerCase()){case"high":case"urgent":return"bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-300";case"medium":return"bg-orange-100 dark:bg-orange-900/30 text-orange-800 dark:text-orange-300";case"low":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300";default:return"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300"}};return B&&!T?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading permissions..."})]})}):oe?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"⚠️ Permission Error"}),r.jsxs("div",{className:"text-red-700 dark:text-red-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"Unable to load user permissions."})}),r.jsx("p",{children:oe}),r.jsx("button",{onClick:()=>window.location.reload(),className:"mt-2 bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded",children:"Retry"})]})]})}):Rt&&!T?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading work orders..."})]})}):Pt?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ Work Order API Not Available"}),r.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"The Work Order API endpoint is not deployed yet."})}),r.jsx("button",{onClick:()=>t("/work-orders/new"),className:"mt-2 bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Creating a New Work Order (Demo)"}),r.jsx("button",{onClick:qe,className:"mt-2 ml-2 bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]})}):r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("workOrders.title")}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",bt," work order",bt!==1?"s":"",j.size>0&&r.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",j.size," selected"]}),Rt&&T&&r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[r.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:()=>O(!0),className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow transition-all",disabled:bt===0,children:[r.jsx(ui,{}),r.jsx("span",{className:"font-medium",children:e("listPages.export")}),j.size>0&&r.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:j.size})]}),r.jsxs("button",{onClick:Ba,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(fi,{}),r.jsx("span",{className:"font-medium",children:e("workOrders.addWorkOrder")})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[r.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-blue-600 dark:from-blue-600 dark:to-blue-700 px-4 py-3 rounded-t-lg",children:r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[r.jsx("button",{onClick:()=>it(!He),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:He?r.jsx(iu,{size:14}):r.jsx(wc,{size:14})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ko,{className:"text-white",size:16}),r.jsx("h3",{className:"text-white font-semibold text-sm",children:"Filters"})]}),ht>0&&r.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:ht})]}),dn&&r.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:r.jsxs("div",{className:"flex items-center gap-2 py-1",children:[pe&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-blue-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"WO ID:"})," ",pe,r.jsx("button",{onClick:be=>{be.stopPropagation(),le("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),re&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-cyan-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Asset:"})," ",re,r.jsx("button",{onClick:be=>{be.stopPropagation(),de(""),a.delete("asset"),s(a)},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),ye&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-purple-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Type:"})," ",ye,r.jsx("button",{onClick:be=>{be.stopPropagation(),ue("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),te&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-green-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Hospital:"})," ",te,r.jsx("button",{onClick:be=>{be.stopPropagation(),V("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),J&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-orange-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Status:"})," ",J,r.jsx("button",{onClick:be=>{be.stopPropagation(),ne("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),ae&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-lime-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Serial:"})," ",ae,r.jsx("button",{onClick:be=>{be.stopPropagation(),z(""),Je("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),D&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-indigo-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Mfr:"})," ",D,r.jsx("button",{onClick:be=>{be.stopPropagation(),G("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),q&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-teal-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Supplier:"})," ",q,r.jsx("button",{onClick:be=>{be.stopPropagation(),K("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),fe&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-yellow-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Dept:"})," ",fe,r.jsx("button",{onClick:be=>{be.stopPropagation(),Pe("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),We&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-red-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Priority:"})," ",We,r.jsx("button",{onClick:be=>{be.stopPropagation(),Fe("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]})]})}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[ht>0&&r.jsxs("button",{onClick:()=>Be(!0),className:"px-3 py-1.5 bg-white text-blue-600 hover:bg-blue-50 rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(Wn,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),dn&&r.jsxs("button",{onClick:qn,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(pt,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),He&&r.jsxs("div",{className:"p-4",children:[_t.length>0&&r.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[r.jsx(rp,{className:"text-yellow-500",size:12}),"Saved Filters"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:_t.map(be=>r.jsxs("div",{className:"group relative inline-flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-100 to-blue-100 dark:from-purple-900/30 dark:to-blue-900/30 border border-purple-200 dark:border-purple-700 rounded-lg hover:shadow-md transition-all",children:[r.jsx("button",{onClick:()=>De(be),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:be.name}),r.jsx("button",{onClick:()=>$e(be.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:r.jsx(Xa,{size:10})})]},be.id))})]}),r.jsx("div",{className:"space-y-5",children:r.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-3",children:[r.jsxs("div",{className:"relative z-[60]",children:[r.jsx(St,{label:"Work Order ID",doctype:"Work_Order",value:pe,onChange:be=>le(be),placeholder:"Select WO ID",disabled:!1,compact:!0}),pe&&r.jsx("button",{onClick:()=>le(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[59]",children:[r.jsx(St,{label:"Asset",doctype:"Asset",value:re,onChange:be=>de(be),placeholder:"Select Asset",disabled:!1,compact:!0}),re&&r.jsx("button",{onClick:()=>{de(""),a.delete("asset"),s(a)},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[58]",children:[r.jsx(St,{label:"Type",doctype:"Issue Type",value:ye,onChange:be=>ue(be),placeholder:"Select Type",disabled:!1,compact:!0}),ye&&r.jsx("button",{onClick:()=>ue(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[57]",children:[r.jsx(St,{label:"Hospital",doctype:"Company",value:te,onChange:be=>V(be),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),te&&r.jsx("button",{onClick:()=>V(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Status"}),r.jsxs("select",{value:J,onChange:be=>ne(be.target.value),className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"All Status"}),r.jsx("option",{value:"Open",children:"Open"}),r.jsx("option",{value:"Work In Progress",children:"Work In Progress"}),r.jsx("option",{value:"Pending Review",children:"Pending Review"}),r.jsx("option",{value:"Completed",children:"Completed"}),r.jsx("option",{value:"Cancelled",children:"Cancelled"}),r.jsx("option",{value:"Closed",children:"Closed"})]}),J&&r.jsx("button",{onClick:()=>ne(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Serial Number"}),r.jsx("input",{type:"text",value:ze,onChange:be=>kt(be.target.value),onKeyDown:da,placeholder:"Type to search...",className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),ze&&ze!==ae&&r.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),ae&&r.jsx("button",{onClick:()=>{z(""),Je("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[56]",children:[r.jsx(St,{label:"Manufacturer",doctype:"Manufacturer",value:D,onChange:be=>G(be),placeholder:"Select Manufacturer",disabled:!1,compact:!0}),D&&r.jsx("button",{onClick:()=>G(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[55]",children:[r.jsx(St,{label:"Supplier",doctype:"Supplier",value:q,onChange:be=>K(be),placeholder:"Select Supplier",disabled:!1,compact:!0}),q&&r.jsx("button",{onClick:()=>K(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[54]",children:[r.jsx(St,{label:"Department",doctype:"Department",value:fe,onChange:be=>Pe(be),placeholder:"Select Department",disabled:!1,compact:!0}),fe&&r.jsx("button",{onClick:()=>Pe(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Priority"}),r.jsxs("select",{value:We,onChange:be=>Fe(be.target.value),className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"All Priorities"}),r.jsx("option",{value:"Normal",children:"Normal"}),r.jsx("option",{value:"Urgent",children:"Urgent"})]}),We&&r.jsx("button",{onClick:()=>Fe(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(pt,{size:10})})]})]})})})]})]}),Lt&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Save Filter Preset"}),r.jsx("input",{type:"text",value:yt,onChange:be=>ke(be.target.value),onKeyDown:be=>{be.key==="Enter"&&(be.preventDefault(),xe())},placeholder:"Enter filter name (e.g., 'Pending High Priority')",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white mb-4",autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{Be(!1),ke("")},className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Cancel"}),r.jsxs("button",{onClick:xe,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors flex items-center gap-2",children:[r.jsx(Wn,{size:12}),"Save Filter"]})]})]})}),r.jsx(ZO,{isOpen:C,onClose:()=>O(!1),selectedCount:j.size,totalCount:bt,pageCount:ft.length,onExport:Ia,isExporting:R,exportColumns:_}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[Rt&&T&&r.jsx("div",{className:"absolute inset-0 bg-white/60 dark:bg-gray-800/60 flex items-center justify-center z-10 backdrop-blur-[1px]",children:r.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[r.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Filtering..."})]})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-3 text-left",children:r.jsx("button",{onClick:Gt,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:Sa?"Deselect all":"Select all",children:Sa?r.jsx(mc,{className:"text-blue-600 dark:text-blue-400",size:18}):tt?r.jsxs("div",{className:"relative",children:[r.jsx(si,{size:18}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):r.jsx(si,{size:18})})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Work Order ID"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Asset"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Department"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Priority"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:ft.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:8,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Ps,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:"No work orders found"}),dn?r.jsx("button",{onClick:qn,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Clear filters"}):r.jsx("button",{onClick:Ba,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Create your first work order"})]})})}):ft.map(be=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${j.has(be.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>Dr(be.name),children:[r.jsx("td",{className:"px-4 py-4",onClick:I=>I.stopPropagation(),children:r.jsx("button",{onClick:()=>Et(be.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:j.has(be.name)?r.jsx(mc,{className:"text-blue-600 dark:text-blue-400",size:18}):r.jsx(si,{size:18})})}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:be.name}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:be.creation?new Date(be.creation).toLocaleDateString():""})]}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:be.asset_name||"-"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:be.asset||""})]}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:be.work_order_type||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:be.department||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center gap-2",children:[Cn(be.repair_status||""),r.jsx("span",{className:`px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${xs(be.repair_status||"")}`,children:be.repair_status||"Unknown"})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${Za(be.custom_priority_||"")}`,children:be.custom_priority_||"Normal"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"flex items-center gap-1",onClick:I=>I.stopPropagation(),children:[r.jsx("button",{onClick:()=>Dr(be.name),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:"View Details",children:r.jsx(Nc,{})}),r.jsx("button",{onClick:()=>cn(be.name),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:"Edit Work Order",children:r.jsx(Tn,{})}),r.jsx("button",{onClick:()=>gs(be.name),className:"text-purple-600 dark:text-purple-400 hover:text-purple-900 dark:hover:text-purple-300 p-2 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded transition-colors",title:"Duplicate Work Order",children:r.jsx(ou,{})}),r.jsx("button",{onClick:()=>f(be.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete Work Order",disabled:wt,children:r.jsx(Xa,{})}),r.jsxs("div",{className:"relative",ref:p===be.name?x:null,children:[r.jsx("button",{onClick:()=>g(p===be.name?null:be.name),className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 p-2 hover:bg-gray-50 dark:hover:bg-gray-700 rounded transition-colors",title:"More Actions",children:r.jsx(lu,{})}),p===be.name&&r.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-10",children:[r.jsxs("button",{onClick:()=>{Zn(be),g(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-t-lg",children:[r.jsx(kc,{className:"text-blue-500"}),"Export as JSON"]}),r.jsxs("button",{onClick:()=>{Rr(be.name),g(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-b-lg",children:[r.jsx(Pf,{className:"text-purple-500"}),"Print Work Order"]})]})]})]})})]},be.name))})]})}),ft.length>0&&r.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 px-6 py-4 flex items-center justify-between border-t border-gray-200 dark:border-gray-600",children:[r.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",r.jsx("span",{className:"font-medium",children:o*v+1})," to"," ",r.jsx("span",{className:"font-medium",children:Math.min((o+1)*v,bt)})," ","of ",r.jsx("span",{className:"font-medium",children:bt})," results",se&&r.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(filtered)"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{disabled:o===0,onClick:()=>u(o-1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Previous"}),r.jsx("button",{disabled:!Ut,onClick:()=>u(o+1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Next"})]})]})]}),c&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:r.jsx(Xa,{className:"text-red-600 dark:text-red-400 text-xl"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Work Order"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Are you sure you want to delete this work order? This action cannot be undone."}),r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-3 mb-4",children:r.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[r.jsx("strong",{children:"Work Order ID:"})," ",c]})}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>f(null),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",disabled:wt,children:"Cancel"}),r.jsx("button",{onClick:()=>ps(c),className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",disabled:wt,children:wt?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Xa,{}),"Delete Work Order"]})})]})]})]})})}),r.jsx("style",{children:`
@keyframes scale-in {
from {
transform: scale(0.95);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}
}
.animate-scale-in {
animation: scale-in 0.2s ease-out;
}
.scrollbar-hide {
-ms-overflow-style: none;
scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
display: none;
}
`})]})};let oc=null,lc=null;const YO=(e,t)=>{oc=e,t&&(lc=t),console.log("[Workflow] User set manually:",e,"Roles:",t)},XO=()=>{oc=null,lc=null},Ap=()=>ge(null,null,function*(){try{if(oc&&lc)return console.log("[Workflow] Using cached user:",oc,"roles:",lc),{user:oc,roles:lc};const e=yield Ke.getUserDetails();if(e&&e.email){const t=e.email||e.user_id,a=e.roles||[];return oc=t,lc=a,console.log("[Workflow] User from getUserDetails():",t),console.log("[Workflow] Roles from getUserDetails():",a),{user:t,roles:a}}return console.warn("[Workflow] getUserDetails() returned no user"),{user:"",roles:[]}}catch(e){return console.error("[Workflow] Error getting user details:",e),{user:"",roles:[]}}}),KO=()=>ge(null,null,function*(){const{user:e}=yield Ap();return e}),Xf=()=>ge(null,null,function*(){const{roles:e}=yield Ap();return e}),Kf=()=>ge(null,null,function*(){try{const e=yield Xf(),t=e.includes("System Manager");return console.log("[Workflow] Is System Manager:",t,"Roles:",e),t}catch(e){return console.error("[Workflow] Error checking System Manager role:",e),!1}}),Op=(e,t)=>{if(!e||e.trim()==="")return!0;try{console.log("[Workflow] Evaluating condition:",e),console.log("[Workflow] Document data for condition:",{asset_type:t.asset_type,site_name:t.site_name,need_procurement:t.need_procurement,custom_assign_to_contractor:t.custom_assign_to_contractor,docstatus:t.docstatus});let a=e;a=a.replace(/\band\b/g,"&&"),a=a.replace(/\bor\b/g,"||"),a=a.replace(/\bnot\s+/g,"!"),a=a.replace(/\bTrue\b/g,"true"),a=a.replace(/\bFalse\b/g,"false"),a=a.replace(/\bNone\b/g,"null"),a=a.replace(/doc\.(\w+)/g,(o,u)=>{const c=t[u];return c==null||c===""?"false":typeof c=="string"?`"${c.replace(/"/g,'\\"')}"`:typeof c=="boolean"?c?"true":"false":typeof c=="number"?String(c):JSON.stringify(c)}),a=a.replace(/== 1/g,"=== 1"),a=a.replace(/== 0/g,"=== 0"),a=a.replace(/!= 1/g,"!== 1"),a=a.replace(/!= 0/g,"!== 0"),console.log("[Workflow] Transformed condition:",a);const s=new Function(`return (${a})`)();return console.log("[Workflow] Condition result:",s),!!s}catch(a){return console.error("[Workflow] Error evaluating condition:",e,a),!1}},Jf=e=>ge(null,null,function*(){var t,a,s,o;try{console.log("[Workflow] Getting workflow info for doctype:",e);const u=yield Ke.apiCall(`/api/resource/Workflow?filters=[["document_type","=","${e}"],["is_active","=",1]]&fields=["name","workflow_state_field"]&limit=1`);if(console.log("[Workflow] Workflow response:",u),!(u!=null&&u.data)||u.data.length===0)return console.warn("[Workflow] No active workflow found for doctype:",e),null;const c=u.data[0].name;console.log("[Workflow] Found workflow:",c);const f=yield Ke.apiCall(`/api/resource/Workflow/${encodeURIComponent(c)}`);return console.log("[Workflow] Full workflow data:",f==null?void 0:f.data),console.log("[Workflow] Transitions count:",(a=(t=f==null?void 0:f.data)==null?void 0:t.transitions)==null?void 0:a.length),console.log("[Workflow] States count:",(o=(s=f==null?void 0:f.data)==null?void 0:s.states)==null?void 0:o.length),{workflow_name:f.data.name,workflow_state:"",workflow_state_field:f.data.workflow_state_field,transitions:f.data.transitions||[],states:f.data.states||[]}}catch(u){return console.error("[Workflow] Error fetching workflow info:",u),null}}),Dw=(e,t,a)=>ge(null,null,function*(){try{console.log("[Workflow] Getting all transitions for state:",t);const s=yield Jf(e);if(!s)return console.warn("[Workflow] No workflow info found"),[];console.log("[Workflow] All transitions from workflow:",s.transitions.length);let o=s.transitions.filter(f=>f.state===t);console.log("[Workflow] Transitions for state",t,":",o.length),a&&(o=o.filter(f=>{const p=Op(f.condition,a);return console.log(`[Workflow] Transition "${f.action}" (allowed: ${f.allowed}) condition "${f.condition||"none"}" = ${p}`),p}),console.log("[Workflow] Transitions after condition evaluation:",o.length));const u=new Set,c=[];for(const f of o){const p=`${f.action}::${f.next_state}`;u.has(p)?console.log(`[Workflow] Skipping duplicate: ${f.action} → ${f.next_state} (allowed: ${f.allowed})`):(u.add(p),c.push(f))}return console.log("[Workflow] Unique transitions after deduplication:",c.length),c}catch(s){return console.error("[Workflow] Error fetching all transitions:",s),[]}}),JO=(e,t,a,s)=>ge(null,null,function*(){var o;try{console.log("[Workflow] getWorkflowTransitions called with:",{doctype:e,docname:t,currentState:a});const u=yield Kf(),c=yield Xf();if(console.log("[Workflow] User is System Manager:",u),console.log("[Workflow] User roles:",c),u&&a){console.log("[Workflow] System Manager detected, getting all transitions for state:",a);const g=yield Dw(e,a,s);return console.log("[Workflow] Final transitions for System Manager:",g.map(x=>`${x.action} → ${x.next_state}`)),g}console.log("[Workflow] Non-System Manager, using Frappe API");const f=yield Ke.apiCall("/api/method/frappe.model.workflow.get_transitions",{method:"POST",body:JSON.stringify({doc:JSON.stringify({doctype:e,name:t})})});console.log("[Workflow] Frappe transitions raw response:",f);let p=[];if(Array.isArray(f)?p=f:f!=null&&f.message&&Array.isArray(f.message)?p=f.message:f!=null&&f.data&&Array.isArray(f.data)?p=f.data:(o=f==null?void 0:f.data)!=null&&o.message&&Array.isArray(f.data.message)&&(p=f.data.message),console.log("[Workflow] Parsed transitions:",p),console.log("[Workflow] Transitions count:",p.length),p.length===0&&a&&s){console.log("[Workflow] Frappe API returned no transitions, trying local filtering");const g=yield Jf(e);if(g){const x=g.transitions.filter(k=>!(k.state!==a||!c.includes(k.allowed)||!Op(k.condition,s))),v=new Set,_=[];for(const k of x){const T=`${k.action}::${k.next_state}`;v.has(T)||(v.add(T),_.push(k))}return console.log("[Workflow] Local filtered transitions:",_),_}}return p}catch(u){return console.error("[Workflow] Error fetching workflow transitions:",u),[]}}),QO=(e,t,a,s)=>ge(null,null,function*(){try{if(console.log("[Workflow] Applying action:",{doctype:e,docname:t,action:a,nextState:s}),(yield Kf())&&s)try{const c=yield Ke.apiCall("/api/method/frappe.model.workflow.apply_workflow",{method:"POST",body:JSON.stringify({doc:JSON.stringify({doctype:e,name:t}),action:a})});return console.log("[Workflow] Action applied successfully via workflow API"),c==null?void 0:c.message}catch(c){console.log("[Workflow] Normal workflow failed, System Manager forcing state change...");const f=yield Ke.apiCall(`/api/resource/${e}/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify({workflow_state:s})});return console.log("[Workflow] Force update response:",f),f==null?void 0:f.data}const u=yield Ke.apiCall("/api/method/frappe.model.workflow.apply_workflow",{method:"POST",body:JSON.stringify({doc:JSON.stringify({doctype:e,name:t}),action:a})});return console.log("[Workflow] Action applied successfully"),u==null?void 0:u.message}catch(o){throw console.error("[Workflow] Error applying workflow action:",o),o}}),e9=(e,t,a)=>ge(null,null,function*(){try{if(yield Kf())return console.log("[Workflow] System Manager can always edit"),!0;const o=yield Jf(e);if(!o)return!0;const u=yield Xf(),c=o.states.filter(p=>p.state===a);if(c.length===0)return!0;const f=c.some(p=>u.includes(p.allow_edit));return console.log("[Workflow] Can user edit:",f,"User roles:",u,"Allowed roles:",c.map(p=>p.allow_edit)),f}catch(s){return console.error("[Workflow] Error checking edit permission:",s),!1}}),Rw=e=>{const t={Draft:{bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-800 dark:text-gray-200",border:"border-gray-300 dark:border-gray-600"},"Sent To Maintenance manger":{bg:"bg-blue-100 dark:bg-blue-900/30",text:"text-blue-800 dark:text-blue-200",border:"border-blue-300 dark:border-blue-600"},"Sent to General WOA":{bg:"bg-blue-100 dark:bg-blue-900/30",text:"text-blue-800 dark:text-blue-200",border:"border-blue-300 dark:border-blue-600"},"Repair InProgress":{bg:"bg-yellow-100 dark:bg-yellow-900/30",text:"text-yellow-800 dark:text-yellow-200",border:"border-yellow-300 dark:border-yellow-600"},"Pending Purchase":{bg:"bg-orange-100 dark:bg-orange-900/30",text:"text-orange-800 dark:text-orange-200",border:"border-orange-300 dark:border-orange-600"},"Pending Approval":{bg:"bg-purple-100 dark:bg-purple-900/30",text:"text-purple-800 dark:text-purple-200",border:"border-purple-300 dark:border-purple-600"},Completed:{bg:"bg-green-100 dark:bg-green-900/30",text:"text-green-800 dark:text-green-200",border:"border-green-300 dark:border-green-600"},Rejected:{bg:"bg-red-100 dark:bg-red-900/30",text:"text-red-800 dark:text-red-200",border:"border-red-300 dark:border-red-600"},Cancelled:{bg:"bg-red-100 dark:bg-red-900/30",text:"text-red-800 dark:text-red-200",border:"border-red-300 dark:border-red-600"},Closed:{bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-800 dark:text-gray-200",border:"border-gray-300 dark:border-gray-600"},Applied:{bg:"bg-blue-100 dark:bg-blue-900/30",text:"text-blue-800 dark:text-blue-200",border:"border-blue-300 dark:border-blue-600"}};return t[e]||t.Draft},Pw=e=>({Apply:"bg-blue-600 hover:bg-blue-700 text-white","Send For Repair":"bg-yellow-600 hover:bg-yellow-700 text-white","Send For Approval":"bg-purple-600 hover:bg-purple-700 text-white","Material Request":"bg-orange-600 hover:bg-orange-700 text-white",Accept:"bg-green-600 hover:bg-green-700 text-white",Reject:"bg-red-600 hover:bg-red-700 text-white",Close:"bg-gray-600 hover:bg-gray-700 text-white","Re-Open":"bg-blue-600 hover:bg-blue-700 text-white",Cancel:"bg-red-600 hover:bg-red-700 text-white",Approve:"bg-green-600 hover:bg-green-700 text-white"})[e]||"bg-blue-600 hover:bg-blue-700 text-white",Fw=e=>({Apply:"📤","Send For Repair":"🔧","Send For Approval":"📋","Material Request":"📦",Accept:"✅",Reject:"❌",Close:"🔒","Re-Open":"🔓",Cancel:"🚫",Approve:"✅"})[e]||"▶️",zo={getWorkflowTransitions:JO,applyWorkflowAction:QO,getWorkflowInfo:Jf,getCurrentUserRoles:Xf,getCurrentUser:KO,getCurrentUserAndRoles:Ap,setCurrentUser:YO,clearCurrentUser:XO,canUserEditDocument:e9,getWorkflowStateStyle:Rw,getActionButtonStyle:Pw,getActionIcon:Fw,isSystemManager:Kf,getAllTransitionsForState:Dw,evaluateCondition:Op},Iw=({doctype:e,docname:t,workflowState:a,enabled:s=!0,docData:o})=>{const[u,c]=E.useState([]),[f,p]=E.useState(null),[g,x]=E.useState([]),[v,_]=E.useState(""),[k,T]=E.useState(!1),[N,j]=E.useState(!1),[P,C]=E.useState(!1),[O,R]=E.useState(null),[U,H]=E.useState(!0);E.useEffect(()=>{if(!s)return;ge(null,null,function*(){try{const pe=yield zo.getWorkflowInfo(e);p(pe)}catch(pe){console.error("Error fetching workflow info:",pe)}})},[e,s]),E.useEffect(()=>{if(!s)return;ge(null,null,function*(){try{const[pe,le,re]=yield Promise.all([zo.getCurrentUserRoles(),zo.getCurrentUser(),zo.isSystemManager()]);x(pe),_(le),T(re),re&&H(!0)}catch(pe){console.error("Error fetching user info:",pe)}})},[s]);const B=E.useCallback(()=>ge(null,null,function*(){if(!t||!s){c([]);return}j(!0),R(null);try{const se=yield zo.getWorkflowTransitions(e,t,a,o);if(console.log("[useWorkflow] Available transitions:",se),c(se),a){const pe=yield zo.canUserEditDocument(e,t,a);H(pe)}}catch(se){console.error("Error fetching transitions:",se),R("Failed to load workflow actions"),c([])}finally{j(!1)}}),[e,t,a,s,o]);E.useEffect(()=>{B()},[B]);const oe=E.useCallback((se,pe)=>ge(null,null,function*(){if(!t)return R("Document not saved yet"),!1;C(!0),R(null);try{return yield zo.applyWorkflowAction(e,t,se,pe),yield B(),!0}catch(le){console.error("Error applying workflow action:",le);let re="Failed to apply action";if(le.message)re=le.message;else if(le._server_messages)try{re=JSON.parse(le._server_messages).map(ye=>{try{return JSON.parse(ye).message}catch(ue){return ye}}).join(`
`)}catch(de){re=le._server_messages}return R(re),!1}finally{C(!1)}}),[e,t,B]);return{transitions:u,workflowInfo:f,userRoles:g,currentUser:v,isSystemManager:k,loading:N,actionLoading:P,error:O,canEdit:U,applyAction:oe,refreshTransitions:B,getStateStyle:Rw,getButtonStyle:Pw,getIcon:Fw}};function Bw(e){var t,a,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(a=Bw(e[t]))&&(s&&(s+=" "),s+=a)}else for(a in e)e[a]&&(s&&(s+=" "),s+=a);return s}function qo(){for(var e,t,a=0,s="",o=arguments.length;a<o;a++)(e=arguments[a])&&(t=Bw(e))&&(s&&(s+=" "),s+=t);return s}function t9(e){if(typeof document=="undefined")return;let t=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",t.firstChild?t.insertBefore(a,t.firstChild):t.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}t9(`:root{--toastify-color-light: #fff;--toastify-color-dark: #121212;--toastify-color-info: #3498db;--toastify-color-success: #07bc0c;--toastify-color-warning: #f1c40f;--toastify-color-error: hsl(6, 78%, 57%);--toastify-color-transparent: rgba(255, 255, 255, .7);--toastify-icon-color-info: var(--toastify-color-info);--toastify-icon-color-success: var(--toastify-color-success);--toastify-icon-color-warning: var(--toastify-color-warning);--toastify-icon-color-error: var(--toastify-color-error);--toastify-container-width: fit-content;--toastify-toast-width: 320px;--toastify-toast-offset: 16px;--toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top));--toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right));--toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left));--toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom));--toastify-toast-background: #fff;--toastify-toast-padding: 14px;--toastify-toast-min-height: 64px;--toastify-toast-max-height: 800px;--toastify-toast-bd-radius: 6px;--toastify-toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toastify-font-family: sans-serif;--toastify-z-index: 9999;--toastify-text-color-light: #757575;--toastify-text-color-dark: #fff;--toastify-text-color-info: #fff;--toastify-text-color-success: #fff;--toastify-text-color-warning: #fff;--toastify-text-color-error: #fff;--toastify-spinner-color: #616161;--toastify-spinner-color-empty-area: #e0e0e0;--toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);--toastify-color-progress-dark: #bb86fc;--toastify-color-progress-info: var(--toastify-color-info);--toastify-color-progress-success: var(--toastify-color-success);--toastify-color-progress-warning: var(--toastify-color-warning);--toastify-color-progress-error: var(--toastify-color-error);--toastify-color-progress-bgo: .2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translate3d(0,0,var(--toastify-z-index));position:fixed;width:var(--toastify-container-width);box-sizing:border-box;color:#fff;display:flex;flex-direction:column}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right);align-items:end}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right);align-items:end}.Toastify__toast{--y: 0;position:relative;touch-action:none;width:var(--toastify-toast-width);min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:var(--toastify-toast-padding);border-radius:var(--toastify-toast-bd-radius);box-shadow:var(--toastify-toast-shadow);max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);z-index:0;display:flex;flex:1 auto;align-items:center;word-break:break-word}@media only screen and (max-width: 480px){.Toastify__toast-container{width:100vw;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-left,.Toastify__toast-container--top-center,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translate(0)}.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translate(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:initial}.Toastify__toast{--toastify-toast-width: 100%;margin-bottom:0;border-radius:0}}.Toastify__toast-container[data-stacked=true]{width:var(--toastify-toast-width)}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body,.Toastify__toast--stacked[data-collapsed] .Toastify__close-button{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-icon{margin-inline-end:10px;width:22px;flex-shrink:0;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--light,.Toastify__toast-theme--colored.Toastify__toast--default{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;position:absolute;top:6px;right:6px;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;z-index:1}.Toastify__toast--rtl .Toastify__close-button{left:6px;right:unset}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:hover,.Toastify__close-button:focus{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:1;opacity:.7;transform-origin:left}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:initial;transform-origin:right;border-bottom-left-radius:initial}.Toastify__progress-bar--wrp{position:absolute;overflow:hidden;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius);border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--top-left,.Toastify__bounce-enter--bottom-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--top-right,.Toastify__bounce-enter--bottom-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--top-left,.Toastify__bounce-exit--bottom-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--top-right,.Toastify__bounce-exit--bottom-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--top-left,.Toastify__slide-enter--bottom-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--top-right,.Toastify__slide-enter--bottom-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--top-left,.Toastify__slide-exit--bottom-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-right,.Toastify__slide-exit--bottom-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
`);var bu=e=>typeof e=="number"&&!isNaN(e),al=e=>typeof e=="string",gi=e=>typeof e=="function",a9=e=>al(e)||bu(e),Ug=e=>al(e)||gi(e)?e:null,r9=(e,t)=>e===!1||bu(e)&&e>0?e:t,Hg=e=>E.isValidElement(e)||al(e)||gi(e)||bu(e);function n9(e,t,a=300){let{scrollHeight:s,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=s+"px",o.transition=`all ${a}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,a)})})}function s9({enter:e,exit:t,appendPosition:a=!1,collapse:s=!0,collapseDuration:o=300}){return function({children:u,position:c,preventExitTransition:f,done:p,nodeRef:g,isIn:x,playToast:v}){let _=a?`${e}--${c}`:e,k=a?`${t}--${c}`:t,T=E.useRef(0);return E.useLayoutEffect(()=>{let N=g.current,j=_.split(" "),P=C=>{C.target===g.current&&(v(),N.removeEventListener("animationend",P),N.removeEventListener("animationcancel",P),T.current===0&&C.type!=="animationcancel"&&N.classList.remove(...j))};N.classList.add(...j),N.addEventListener("animationend",P),N.addEventListener("animationcancel",P)},[]),E.useEffect(()=>{let N=g.current,j=()=>{N.removeEventListener("animationend",j),s?n9(N,p,o):p()};x||(f?j():(T.current=1,N.className+=` ${k}`,N.addEventListener("animationend",j)))},[x]),ea.createElement(ea.Fragment,null,u)}}function Lv(e,t){return{content:zw(e.content,e.props),containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,reason:e.removalReason,status:t}}function zw(e,t,a=!1){return E.isValidElement(e)&&!al(e.type)?E.cloneElement(e,{closeToast:t.closeToast,toastProps:t,data:t.data,isPaused:a}):gi(e)?e({closeToast:t.closeToast,toastProps:t,data:t.data,isPaused:a}):e}function i9({closeToast:e,theme:t,ariaLabel:a="close"}){return ea.createElement("button",{className:`Toastify__close-button Toastify__close-button--${t}`,type:"button",onClick:s=>{s.stopPropagation(),e(!0)},"aria-label":a},ea.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},ea.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function o9({delay:e,isRunning:t,closeToast:a,type:s="default",hide:o,className:u,controlledProgress:c,progress:f,rtl:p,isIn:g,theme:x}){let v=o||c&&f===0,_={animationDuration:`${e}ms`,animationPlayState:t?"running":"paused"};c&&(_.transform=`scaleX(${f})`);let k=qo("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${x}`,`Toastify__progress-bar--${s}`,{"Toastify__progress-bar--rtl":p}),T=gi(u)?u({rtl:p,type:s,defaultClassName:k}):qo(k,u),N={[c&&f>=1?"onTransitionEnd":"onAnimationEnd"]:c&&f<1?null:()=>{g&&a()}};return ea.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":v},ea.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${x} Toastify__progress-bar--${s}`}),ea.createElement("div",ie({role:"progressbar","aria-hidden":v?"true":"false","aria-label":"notification timer",className:T,style:_},N)))}var l9=1,Uw=()=>`${l9++}`;function c9(e,t,a){let s=1,o=0,u=[],c=[],f=t,p=new Map,g=new Set,x=C=>(g.add(C),()=>g.delete(C)),v=()=>{c=Array.from(p.values()),g.forEach(C=>C())},_=({containerId:C,toastId:O,updateId:R})=>{let U=C?C!==e:e!==1,H=p.has(O)&&R==null;return U||H},k=(C,O)=>{p.forEach(R=>{var U;(O==null||O===R.props.toastId)&&((U=R.toggle)==null||U.call(R,C))})},T=C=>{var O,R;(R=(O=C.props)==null?void 0:O.onClose)==null||R.call(O,C.removalReason),C.isActive=!1},N=C=>{if(C==null)p.forEach(T);else{let O=p.get(C);O&&T(O)}v()},j=()=>{o-=u.length,u=[]},P=C=>{var O,R;let{toastId:U,updateId:H}=C.props,B=H==null;C.staleId&&p.delete(C.staleId),C.isActive=!0,p.set(U,C),v(),a(Lv(C,B?"added":"updated")),B&&((R=(O=C.props).onOpen)==null||R.call(O))};return{id:e,props:f,observe:x,toggle:k,removeToast:N,toasts:p,clearQueue:j,buildToast:(C,O)=>{if(_(O))return;let{toastId:R,updateId:U,data:H,staleId:B,delay:oe}=O,se=U==null;se&&o++;let pe=Le(ie(Le(ie({},f),{style:f.toastStyle,key:s++}),Object.fromEntries(Object.entries(O).filter(([re,de])=>de!=null))),{toastId:R,updateId:U,data:H,isIn:!1,className:Ug(O.className||f.toastClassName),progressClassName:Ug(O.progressClassName||f.progressClassName),autoClose:O.isLoading?!1:r9(O.autoClose,f.autoClose),closeToast(re){p.get(R).removalReason=re,N(R)},deleteToast(){let re=p.get(R);if(re!=null){if(a(Lv(re,"removed")),p.delete(R),o--,o<0&&(o=0),u.length>0){P(u.shift());return}v()}}});pe.closeButton=f.closeButton,O.closeButton===!1||Hg(O.closeButton)?pe.closeButton=O.closeButton:O.closeButton===!0&&(pe.closeButton=Hg(f.closeButton)?f.closeButton:!0);let le={content:C,props:pe,staleId:B};f.limit&&f.limit>0&&o>f.limit&&se?u.push(le):bu(oe)?setTimeout(()=>{P(le)},oe):P(le)},setProps(C){f=C},setToggle:(C,O)=>{let R=p.get(C);R&&(R.toggle=O)},isToastActive:C=>{var O;return(O=p.get(C))==null?void 0:O.isActive},getSnapshot:()=>c}}var Hr=new Map,au=[],$g=new Set,d9=e=>$g.forEach(t=>t(e)),Hw=()=>Hr.size>0;function u9(){au.forEach(e=>Ww(e.content,e.options)),au=[]}var f9=(e,{containerId:t})=>{var a;return(a=Hr.get(t||1))==null?void 0:a.toasts.get(e)};function $w(e,t){var a;if(t)return!!((a=Hr.get(t))!=null&&a.isToastActive(e));let s=!1;return Hr.forEach(o=>{o.isToastActive(e)&&(s=!0)}),s}function h9(e){if(!Hw()){au=au.filter(t=>e!=null&&t.options.toastId!==e);return}if(e==null||a9(e))Hr.forEach(t=>{t.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){let t=Hr.get(e.containerId);t?t.removeToast(e.id):Hr.forEach(a=>{a.removeToast(e.id)})}}var m9=(e={})=>{Hr.forEach(t=>{t.props.limit&&(!e.containerId||t.id===e.containerId)&&t.clearQueue()})};function Ww(e,t){Hg(e)&&(Hw()||au.push({content:e,options:t}),Hr.forEach(a=>{a.buildToast(e,t)}))}function g9(e){var t;(t=Hr.get(e.containerId||1))==null||t.setToggle(e.id,e.fn)}function Vw(e,t){Hr.forEach(a=>{(t==null||!(t!=null&&t.containerId)||(t==null?void 0:t.containerId)===a.id)&&a.toggle(e,t==null?void 0:t.id)})}function p9(e){let t=e.containerId||1;return{subscribe(a){let s=c9(t,e,d9);Hr.set(t,s);let o=s.observe(a);return u9(),()=>{o(),Hr.delete(t)}},setProps(a){var s;(s=Hr.get(t))==null||s.setProps(a)},getSnapshot(){var a;return(a=Hr.get(t))==null?void 0:a.getSnapshot()}}}function x9(e){return $g.add(e),()=>{$g.delete(e)}}function y9(e){return e&&(al(e.toastId)||bu(e.toastId))?e.toastId:Uw()}function vu(e,t){return Ww(e,t),t.toastId}function Qf(e,t){return Le(ie({},t),{type:t&&t.type||e,toastId:y9(t)})}function eh(e){return(t,a)=>vu(t,Qf(e,a))}function At(e,t){return vu(e,Qf("default",t))}At.loading=(e,t)=>vu(e,Qf("default",ie({isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1},t)));function b9(e,{pending:t,error:a,success:s},o){let u;t&&(u=al(t)?At.loading(t,o):At.loading(t.render,ie(ie({},o),t)));let c={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},f=(g,x,v)=>{if(x==null){At.dismiss(u);return}let _=Le(ie(ie({type:g},c),o),{data:v}),k=al(x)?{render:x}:x;return u?At.update(u,ie(ie({},_),k)):At(k.render,ie(ie({},_),k)),v},p=gi(e)?e():e;return p.then(g=>f("success",s,g)).catch(g=>f("error",a,g)),p}At.promise=b9;At.success=eh("success");At.info=eh("info");At.error=eh("error");At.warning=eh("warning");At.warn=At.warning;At.dark=(e,t)=>vu(e,Qf("default",ie({theme:"dark"},t)));function v9(e){h9(e)}At.dismiss=v9;At.clearWaitingQueue=m9;At.isActive=$w;At.update=(e,t={})=>{let a=f9(e,t);if(a){let{props:s,content:o}=a,u=Le(ie(ie({delay:100},s),t),{toastId:t.toastId||e,updateId:Uw()});u.toastId!==e&&(u.staleId=e);let c=u.render||o;delete u.render,vu(c,u)}};At.done=e=>{At.update(e,{progress:1})};At.onChange=x9;At.play=e=>Vw(!0,e);At.pause=e=>Vw(!1,e);function _9(e){var t;let{subscribe:a,getSnapshot:s,setProps:o}=E.useRef(p9(e)).current;o(e);let u=(t=E.useSyncExternalStore(a,s,s))==null?void 0:t.slice();function c(f){if(!u)return[];let p=new Map;return e.newestOnTop&&u.reverse(),u.forEach(g=>{let{position:x}=g.props;p.has(x)||p.set(x,[]),p.get(x).push(g)}),Array.from(p,g=>f(g[0],g[1]))}return{getToastToRender:c,isToastActive:$w,count:u==null?void 0:u.length}}function w9(e){let[t,a]=E.useState(!1),[s,o]=E.useState(!1),u=E.useRef(null),c=E.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:f,pauseOnHover:p,closeToast:g,onClick:x,closeOnClick:v}=e;g9({id:e.toastId,containerId:e.containerId,fn:a}),E.useEffect(()=>{if(e.pauseOnFocusLoss)return _(),()=>{k()}},[e.pauseOnFocusLoss]);function _(){document.hasFocus()||P(),window.addEventListener("focus",j),window.addEventListener("blur",P)}function k(){window.removeEventListener("focus",j),window.removeEventListener("blur",P)}function T(B){if(e.draggable===!0||e.draggable===B.pointerType){C();let oe=u.current;c.canCloseOnClick=!0,c.canDrag=!0,oe.style.transition="none",e.draggableDirection==="x"?(c.start=B.clientX,c.removalDistance=oe.offsetWidth*(e.draggablePercent/100)):(c.start=B.clientY,c.removalDistance=oe.offsetHeight*(e.draggablePercent===80?e.draggablePercent*1.5:e.draggablePercent)/100)}}function N(B){let{top:oe,bottom:se,left:pe,right:le}=u.current.getBoundingClientRect();B.nativeEvent.type!=="touchend"&&e.pauseOnHover&&B.clientX>=pe&&B.clientX<=le&&B.clientY>=oe&&B.clientY<=se?P():j()}function j(){a(!0)}function P(){a(!1)}function C(){c.didMove=!1,document.addEventListener("pointermove",R),document.addEventListener("pointerup",U)}function O(){document.removeEventListener("pointermove",R),document.removeEventListener("pointerup",U)}function R(B){let oe=u.current;if(c.canDrag&&oe){c.didMove=!0,t&&P(),e.draggableDirection==="x"?c.delta=B.clientX-c.start:c.delta=B.clientY-c.start,c.start!==B.clientX&&(c.canCloseOnClick=!1);let se=e.draggableDirection==="x"?`${c.delta}px, var(--y)`:`0, calc(${c.delta}px + var(--y))`;oe.style.transform=`translate3d(${se},0)`,oe.style.opacity=`${1-Math.abs(c.delta/c.removalDistance)}`}}function U(){O();let B=u.current;if(c.canDrag&&c.didMove&&B){if(c.canDrag=!1,Math.abs(c.delta)>c.removalDistance){o(!0),e.closeToast(!0),e.collapseAll();return}B.style.transition="transform 0.2s, opacity 0.2s",B.style.removeProperty("transform"),B.style.removeProperty("opacity")}}let H={onPointerDown:T,onPointerUp:N};return f&&p&&(H.onMouseEnter=P,e.stacked||(H.onMouseLeave=j)),v&&(H.onClick=B=>{x&&x(B),c.canCloseOnClick&&g(!0)}),{playToast:j,pauseToast:P,isRunning:t,preventExitTransition:s,toastRef:u,eventHandlers:H}}var k9=typeof window!="undefined"?E.useLayoutEffect:E.useEffect,th=o=>{var u=o,{theme:e,type:t,isLoading:a}=u,s=tn(u,["theme","type","isLoading"]);return ea.createElement("svg",ie({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${t})`},s))};function N9(e){return ea.createElement(th,ie({},e),ea.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function S9(e){return ea.createElement(th,ie({},e),ea.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function j9(e){return ea.createElement(th,ie({},e),ea.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function T9(e){return ea.createElement(th,ie({},e),ea.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function E9(){return ea.createElement("div",{className:"Toastify__spinner"})}var Wg={info:S9,warning:N9,success:j9,error:T9,spinner:E9},C9=e=>e in Wg;function A9({theme:e,type:t,isLoading:a,icon:s}){let o=null,u={theme:e,type:t};return s===!1||(gi(s)?o=s(Le(ie({},u),{isLoading:a})):E.isValidElement(s)?o=E.cloneElement(s,u):a?o=Wg.spinner():C9(t)&&(o=Wg[t](u))),o}var O9=e=>{let{isRunning:t,preventExitTransition:a,toastRef:s,eventHandlers:o,playToast:u}=w9(e),{closeButton:c,children:f,autoClose:p,onClick:g,type:x,hideProgressBar:v,closeToast:_,transition:k,position:T,className:N,style:j,progressClassName:P,updateId:C,role:O,progress:R,rtl:U,toastId:H,deleteToast:B,isIn:oe,isLoading:se,closeOnClick:pe,theme:le,ariaLabel:re}=e,de=qo("Toastify__toast",`Toastify__toast-theme--${le}`,`Toastify__toast--${x}`,{"Toastify__toast--rtl":U},{"Toastify__toast--close-on-click":pe}),ye=gi(N)?N({rtl:U,position:T,type:x,defaultClassName:de}):qo(de,N),ue=A9(e),te=!!R||!p,V={closeToast:_,type:x,theme:le},J=null;return c===!1||(gi(c)?J=c(V):E.isValidElement(c)?J=E.cloneElement(c,V):J=i9(V)),ea.createElement(k,{isIn:oe,done:B,position:T,preventExitTransition:a,nodeRef:s,playToast:u},ea.createElement("div",ie(Le(ie({id:H,tabIndex:0,onClick:g,"data-in":oe,className:ye},o),{style:j,ref:s}),oe&&{role:O,"aria-label":re}),ue!=null&&ea.createElement("div",{className:qo("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!se})},ue),zw(f,e,!t),J,!e.customProgressBar&&ea.createElement(o9,Le(ie({},C&&!te?{key:`p-${C}`}:{}),{rtl:U,theme:le,delay:p,isRunning:t,isIn:oe,closeToast:_,hide:v,type:x,className:P,controlledProgress:te,progress:R||0}))))},L9=(e,t=!1)=>({enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}),Gw=s9(L9("bounce",!0)),M9={position:"top-right",transition:Gw,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light","aria-label":"Notifications Alt+T",hotKeys:e=>e.altKey&&e.code==="KeyT"};function D9(e){let t=ie(ie({},M9),e),a=e.stacked,[s,o]=E.useState(!0),u=E.useRef(null),{getToastToRender:c,isToastActive:f,count:p}=_9(t),{className:g,style:x,rtl:v,containerId:_,hotKeys:k}=t;function T(j){let P=qo("Toastify__toast-container",`Toastify__toast-container--${j}`,{"Toastify__toast-container--rtl":v});return gi(g)?g({position:j,rtl:v,defaultClassName:P}):qo(P,Ug(g))}function N(){a&&(o(!0),At.play())}return k9(()=>{var j;if(a){let P=u.current.querySelectorAll('[data-in="true"]'),C=12,O=(j=t.position)==null?void 0:j.includes("top"),R=0,U=0;Array.from(P).reverse().forEach((H,B)=>{let oe=H;oe.classList.add("Toastify__toast--stacked"),B>0&&(oe.dataset.collapsed=`${s}`),oe.dataset.pos||(oe.dataset.pos=O?"top":"bot");let se=R*(s?.2:1)+(s?0:C*B);oe.style.setProperty("--y",`${O?se:se*-1}px`),oe.style.setProperty("--g",`${C}`),oe.style.setProperty("--s",`${1-(s?U:0)}`),R+=oe.offsetHeight,U+=.025})}},[s,p,a]),E.useEffect(()=>{function j(P){var C;let O=u.current;k(P)&&((C=O.querySelector('[tabIndex="0"]'))==null||C.focus(),o(!1),At.pause()),P.key==="Escape"&&(document.activeElement===O||O!=null&&O.contains(document.activeElement))&&(o(!0),At.play())}return document.addEventListener("keydown",j),()=>{document.removeEventListener("keydown",j)}},[k]),ea.createElement("section",{ref:u,className:"Toastify",id:_,onMouseEnter:()=>{a&&(o(!1),At.pause())},onMouseLeave:N,"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text","aria-label":t["aria-label"]},c((j,P)=>{let C=P.length?ie({},x):Le(ie({},x),{pointerEvents:"none"});return ea.createElement("div",{tabIndex:-1,className:T(j),"data-stacked":a,style:C,key:`c-${j}`},P.map(({content:O,props:R})=>ea.createElement(O9,Le(ie({},R),{stacked:a,collapseAll:N,isIn:f(R.toastId,R.containerId),key:`t-${R.key}`}),O)))}))}const R9=({doctype:e,docname:t,workflowState:a,onActionComplete:s,onStateChange:o,showStateInfo:u=!0,className:c=""})=>{const{transitions:f,loading:p,actionLoading:g,error:x,applyAction:v,getStateStyle:_,getButtonStyle:k,getIcon:T}=Iw({doctype:e,docname:t,workflowState:a,enabled:!!t}),[N,j]=E.useState(null),P=["Reject","Cancel","Close"],C=U=>ge(null,null,function*(){if(P.includes(U)&&N!==U){j(U);return}j(null);const H=yield v(U);s&&s(U,H),H&&o&&o()}),O=()=>{j(null)};if(!t)return null;const R=_(a||"Draft");return r.jsxs("div",{className:`space-y-4 ${c}`,children:[u&&a&&r.jsx("div",{className:`p-4 rounded-lg border ${R.bg} ${R.border}`,children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Workflow State"}),r.jsx("p",{className:`text-lg font-semibold ${R.text}`,children:a})]}),r.jsx("div",{className:`w-3 h-3 rounded-full ${R.bg.replace("100","500").replace("900/30","500")}`})]})}),p&&r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[r.jsx(ds,{className:"animate-spin"}),r.jsx("span",{className:"text-sm",children:"Loading workflow actions..."})]}),x&&r.jsx("div",{className:"p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Br,{className:"text-red-500 mt-0.5"}),r.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:x})]})}),N&&r.jsxs("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:[r.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[r.jsx(Br,{className:"text-yellow-500 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-200",children:"Confirm Action"}),r.jsxs("p",{className:"text-xs text-yellow-600 dark:text-yellow-400 mt-1",children:["Are you sure you want to ",r.jsx("strong",{children:N})," this work order?"]})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>C(N),disabled:g,className:"px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-sm rounded-md disabled:opacity-50",children:g?r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ds,{className:"animate-spin",size:12}),"Processing..."]}):`Yes, ${N}`}),r.jsx("button",{onClick:O,disabled:g,className:"px-3 py-1.5 bg-gray-300 hover:bg-gray-400 text-gray-700 text-sm rounded-md disabled:opacity-50",children:"Cancel"})]})]}),!p&&f.length>0&&!N&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center gap-1",children:[r.jsx(Rd,{size:12}),"Available Actions"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((U,H)=>r.jsxs("button",{onClick:()=>C(U.action),disabled:g,className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors disabled:opacity-50 flex items-center gap-2 ${k(U.action)}`,title:`Move to: ${U.next_state}`,children:[g?r.jsx(ds,{className:"animate-spin",size:14}):r.jsx("span",{children:T(U.action)}),U.action]},`${U.action}-${H}`))}),r.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:f.map((U,H)=>r.jsxs("span",{className:"inline-block mr-3",children:[U.action," → ",r.jsx("span",{className:"font-medium",children:U.next_state})]},H))})]}),!p&&f.length===0&&t&&r.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center",children:"No workflow actions available for your role"})})]})},P9="Service Report",Mv=()=>new Date().toISOString().split("T")[0],F9=(e,t)=>{if(!e)return"";const a=new Date(e);return a.setDate(a.getDate()+t),a.toISOString().split("T")[0]},I9=()=>{const{workOrderName:e}=_c(),t=Da(),[a]=rl(),s=a.get("duplicate"),o=a.get("asset"),u=!!o,c=e==="new",f=c&&!!s,p=()=>{if(!e||c)return;const De=`${Ot.BASE_URL}/printview?doctype=Work_Order&name=${encodeURIComponent(e)}&format=${encodeURIComponent(P9)}&trigger_print=1`;window.open(De,"_blank")||At.warning("Please allow popups for this site to print the Service Report.",{position:"top-right",autoClose:5e3,icon:r.jsx(Br,{})})},{workOrder:g,loading:x,error:v,refetch:_}=$S(f?s:c?null:e||null),{createWorkOrder:k,updateWorkOrder:T,loading:N}=g_(),[j,P]=E.useState(c),[C,O]=E.useState(!1),[R,U]=E.useState(null),[H,B]=E.useState({company:"",work_order_type:"",asset:"",asset_name:"",description:"",repair_status:"Open",workflow_state:"Draft",department:"",custom_priority_:"Normal",asset_type:"",manufacturer:"",supplier:"",serial_number:"",model:"",custom_site_contractor:"",custom_subcontractor:"",failure_date:c?Mv():"",custom_deadline_date:"",completion_date:"",first_responded_on:"",actions_performed:"",stock_consumption:0,stock_items:[],site_name:"",need_procurement:0,custom_assign_to_contractor:"",docstatus:0,custom_assigned_supervisor:"",total_hours_spent:0,custom_pending_reason:"",total_repair_cost:0,custom_service_agreement:"",custom_service_coverage:"",custom_start_date:"",custom_end_date:"",custom_total_amount:0,__islocal:!1}),oe=H.asset_type==="Non Biomedical",se=E.useCallback((xe,De,$e)=>{if(!xe)return"";let Et=0;const Gt=$e===1;return De==="Normal"?Et=Gt?30:5:De==="Urgent"&&(Et=Gt?30:1),F9(xe,Et)},[]);E.useEffect(()=>{if(!j)return;const xe=se(H.failure_date,H.custom_priority_||"Normal",H.need_procurement||0);xe&&xe!==H.custom_deadline_date&&B(De=>Le(ie({},De),{custom_deadline_date:xe}))},[H.failure_date,H.custom_priority_,H.need_procurement,j,se]),E.useEffect(()=>{oe&&j&&B(xe=>Le(ie({},xe),{asset:"",asset_name:"",serial_number:"",manufacturer:"",supplier:"",model:""}))},[oe,j]);const{shouldShowField:pe,isMandatory:le,isReadOnly:re}=Mw("Work_Order",H);E.useCallback(xe=>pe(xe),[pe]),E.useCallback(xe=>le(xe),[le]);const de=E.useCallback(xe=>re(xe),[re]);E.useCallback(xe=>j?de(xe):!0,[j,de]);const ye=E.useMemo(()=>{if(!c)return{asset_type:(g==null?void 0:g.asset_type)||H.asset_type||"",site_name:(g==null?void 0:g.site_name)||H.site_name||"",need_procurement:(g==null?void 0:g.need_procurement)||H.need_procurement||0,custom_assign_to_contractor:(g==null?void 0:g.custom_assign_to_contractor)||H.custom_assign_to_contractor||"",docstatus:(g==null?void 0:g.docstatus)||H.docstatus||0,company:(g==null?void 0:g.company)||H.company||"",department:(g==null?void 0:g.department)||H.department||"",repair_status:(g==null?void 0:g.repair_status)||H.repair_status||""}},[c,g==null?void 0:g.asset_type,g==null?void 0:g.site_name,g==null?void 0:g.need_procurement,g==null?void 0:g.custom_assign_to_contractor,g==null?void 0:g.docstatus,g==null?void 0:g.company,g==null?void 0:g.department,g==null?void 0:g.repair_status,H.asset_type,H.site_name,H.need_procurement,H.custom_assign_to_contractor,H.docstatus,H.company,H.department,H.repair_status]),{transitions:ue,loading:te,actionLoading:V,error:J,isSystemManager:ne,applyAction:ae,getStateStyle:z,getButtonStyle:D,getIcon:G}=Iw({doctype:"Work_Order",docname:c?null:e||null,workflowState:g==null?void 0:g.workflow_state,enabled:!c,docData:ye}),q="Al Jouf Central Warehouse - AJH",[K,fe]=E.useState({}),Pe=(xe,De)=>ge(null,null,function*(){if(!xe||!De)return 0;try{const $e=yield Ke.apiCall(`/api/resource/Bin?filters=[["item_code","=","${xe}"],["warehouse","=","${De}"]]&fields=["actual_qty"]&limit=1`);return $e!=null&&$e.data&&$e.data.length>0&&$e.data[0].actual_qty||0}catch($e){return console.error("Error fetching available stock:",$e),0}}),We=xe=>ge(null,null,function*(){var De;if(!xe)return 0;try{const $e=yield Ke.apiCall(`/api/resource/Item/${xe}?fields=["valuation_rate"]`);return((De=$e==null?void 0:$e.data)==null?void 0:De.valuation_rate)||0}catch($e){return console.error("Error fetching valuation rate:",$e),0}}),Fe=(xe,De)=>ge(null,null,function*(){const $e=[...H.stock_items||[]];if($e[xe]=Le(ie({},$e[xe]),{item_code:De}),De){const Et=yield We(De);if($e[xe].valuation_rate=Et,$e[xe].total_value=Et*($e[xe].consumed_quantity||1),$e[xe].warehouse){const Gt=yield Pe(De,$e[xe].warehouse);$e[xe].custom_available_stock=Gt,it(xe,$e[xe].consumed_quantity,Gt,De,$e[xe].warehouse)}}B(Le(ie({},H),{stock_items:$e}))}),He=(xe,De)=>ge(null,null,function*(){const $e=[...H.stock_items||[]];if($e[xe]=Le(ie({},$e[xe]),{warehouse:De}),De&&$e[xe].item_code){const Et=yield Pe($e[xe].item_code,De);$e[xe].custom_available_stock=Et,it(xe,$e[xe].consumed_quantity,Et,$e[xe].item_code,De)}B(Le(ie({},H),{stock_items:$e}))}),it=(xe,De,$e,Et,Gt)=>{De>$e?(fe(Sa=>Le(ie({},Sa),{[xe]:`Insufficient stock for ${Et} in ${Gt}. Available: ${$e}, Required: ${De}`})),At.warning(`Insufficient stock for ${Et}. Available: ${$e}, Required: ${De}`,{position:"top-right",autoClose:5e3,icon:r.jsx(Br,{}),toastId:`stock-warning-${xe}`})):fe(Sa=>{const tt=ie({},Sa);return delete tt[xe],tt})},ht=(xe,De)=>{const $e=[...H.stock_items||[]],Et=$e[xe].valuation_rate||0,Gt=$e[xe].custom_available_stock||0;$e[xe]=Le(ie({},$e[xe]),{consumed_quantity:De,total_value:Et*De}),$e[xe].item_code&&$e[xe].warehouse&&it(xe,De,Gt,$e[xe].item_code,$e[xe].warehouse),B(Le(ie({},H),{stock_items:$e}))},[Vt,_t]=E.useState({});E.useEffect(()=>{const xe={};H.company&&(xe.company=H.company),_t(xe)},[H.company]);const ia=xe=>ge(null,null,function*(){if(!xe)return null;try{O(!0);const De=yield Ke.apiCall(`/api/resource/Asset/${xe}`);return(De==null?void 0:De.data)||null}catch(De){return console.error("Error fetching asset details:",De),null}finally{O(!1)}}),Lt=xe=>ge(null,null,function*(){if(!xe)return null;try{O(!0);const De=yield Ke.apiCall(`/api/resource/Asset?filters=[["custom_serial_number","=","${xe}"]]&fields=["name","asset_name","company","department","custom_serial_number","custom_asset_type","custom_manufacturer","supplier","custom_site_contractor","custom_subcontractor","custom_model","custom_service_agreement","custom_service_coverage","custom_start_date","custom_end_date","custom_total_amount"]&limit=1`);return De!=null&&De.data&&De.data.length>0?De.data[0]:null}catch(De){return console.error("Error fetching asset by serial number:",De),null}finally{O(!1)}}),Be=xe=>xe?xe.split(" ")[0]:"",yt=xe=>{xe&&B(De=>Le(ie({},De),{asset:xe.name||De.asset,asset_name:xe.asset_name||"",company:xe.company||"",department:xe.department||"",serial_number:xe.custom_serial_number||"",asset_type:xe.custom_asset_type||"",manufacturer:xe.custom_manufacturer||"",supplier:xe.supplier||"",custom_site_contractor:xe.custom_site_contractor||"",custom_subcontractor:xe.custom_subcontractor||"",model:xe.custom_model||"",custom_service_agreement:xe.custom_service_agreement||"",custom_service_coverage:xe.custom_service_coverage||"",custom_start_date:Be(xe.custom_start_date)||"",custom_end_date:Be(xe.custom_end_date)||"",custom_total_amount:xe.custom_total_amount||0}))},ke=xe=>ge(null,null,function*(){if(B(De=>Le(ie({},De),{asset:xe})),xe){const De=yield ia(xe);De&&yt(De)}else B(De=>Le(ie({},De),{asset:"",asset_name:"",serial_number:"",asset_type:"",manufacturer:"",supplier:"",custom_site_contractor:"",custom_subcontractor:"",model:"",custom_service_agreement:"",custom_service_coverage:"",custom_start_date:"",custom_end_date:"",custom_total_amount:0}))}),ze=()=>ge(null,null,function*(){if(!H.serial_number){At.warning("Please enter a serial number to search",{position:"top-right",autoClose:3e3,icon:r.jsx(Br,{})});return}const xe=yield Lt(H.serial_number);xe?(yt(xe),At.success(`Asset found: ${xe.asset_name||xe.name}`,{position:"top-right",autoClose:3e3,icon:r.jsx($n,{})})):At.error("No asset found with this serial number",{position:"top-right",autoClose:4e3,icon:r.jsx(Ld,{})})}),Je=()=>ge(null,null,function*(){if(H.serial_number&&!H.asset){const xe=yield Lt(H.serial_number);xe&&yt(xe)}});E.useEffect(()=>{if(c&&u&&!f){const xe={asset:a.get("asset")||"",asset_name:a.get("asset_name")||"",asset_type:a.get("asset_type")||"",manufacturer:a.get("manufacturer")||"",supplier:a.get("supplier")||"",serial_number:a.get("serial_number")||"",department:a.get("department")||"",custom_site_contractor:a.get("site_contractor")||"",custom_subcontractor:a.get("subcontractor")||"",company:a.get("company")||""};B(De=>Le(ie(ie({},De),xe),{repair_status:"Open",workflow_state:"Draft",custom_priority_:"Normal",failure_date:Mv()}))}},[c,u,f,a]),E.useEffect(()=>{g&&B({company:g.company||"",work_order_type:g.work_order_type||"",asset:g.asset||"",asset_name:f?`${g.asset_name} (Copy)`:g.asset_name||"",description:g.description||"",repair_status:f?"Open":g.repair_status||"Open",workflow_state:f?"Draft":g.workflow_state||"Draft",department:g.department||"",custom_priority_:g.custom_priority_||"Normal",asset_type:g.asset_type||"",manufacturer:g.manufacturer||"",supplier:g.supplier||"",serial_number:g.serial_number||"",model:g.model||"",custom_site_contractor:g.custom_site_contractor||"",custom_subcontractor:g.custom_subcontractor||"",failure_date:Be(g.failure_date)||"",custom_deadline_date:Be(g.custom_deadline_date)||"",first_responded_on:Be(g.first_responded_on)||"",completion_date:Be(g.completion_date)||"",actions_performed:g.actions_performed||"",stock_consumption:g.stock_consumption||0,stock_items:g.stock_items||[],site_name:g.site_name||"",need_procurement:g.need_procurement||0,custom_assign_to_contractor:g.custom_assign_to_contractor||"",docstatus:g.docstatus||0,custom_assigned_supervisor:g.custom_assigned_supervisor||"",total_hours_spent:g.total_hours_spent||0,custom_pending_reason:g.custom_pending_reason||"",total_repair_cost:g.total_repair_cost||0,custom_service_agreement:g.custom_service_agreement||"",custom_service_coverage:g.custom_service_coverage||"",custom_start_date:Be(g.custom_start_date)||"",custom_end_date:Be(g.custom_end_date)||"",custom_total_amount:g.custom_total_amount||0})},[g,f]);const nt=xe=>{const{name:De,value:$e}=xe.target;B(Et=>Le(ie({},Et),{[De]:$e}))},ut=xe=>{const De=xe.target.value;B($e=>Le(ie({},$e),{custom_priority_:De}))},ft=xe=>{const De=xe.target.value;B($e=>Le(ie({},$e),{failure_date:De}))},bt=xe=>{const De=xe.target.checked?1:0;B($e=>Le(ie({},$e),{need_procurement:De}))},Ut=xe=>{B(xe==="Non Biomedical"?De=>Le(ie({},De),{asset_type:xe,asset:"",asset_name:"",serial_number:"",manufacturer:"",supplier:"",model:""}):De=>Le(ie({},De),{asset_type:xe}))},Rt=xe=>ge(null,null,function*(){if(xe.preventDefault(),!H.work_order_type){At.error("Please select a Work Order Type",{position:"top-right",autoClose:4e3,icon:r.jsx(Ld,{})});return}try{if(c||f){const De=yield k(H),$e=f?"Work order duplicated successfully!":u?"Work order created from asset successfully!":"Work order created successfully!";At.success($e,{position:"top-right",autoClose:3e3,icon:r.jsx($n,{})}),t(`/work-orders/${De.name}`)}else e&&(yield T(e,H),At.success("Work order updated successfully!",{position:"top-right",autoClose:3e3,icon:r.jsx($n,{})}),P(!1),_())}catch(De){console.error("Work order save error:",De);const $e=De instanceof Error?De.message:"Unknown error",Et=JSON.stringify(De);$e.includes("TimestampMismatchError")||$e.includes("Document has been modified")||$e.includes("Please refresh")||Et.includes("TimestampMismatchError")?(At.error("Document was modified by another user. Refreshing...",{position:"top-right",autoClose:4e3,icon:r.jsx(Br,{})}),yield _(),At.info("Please review the latest changes and try saving again.",{position:"top-right",autoClose:5e3,icon:r.jsx(Rd,{})})):At.error(`Failed to save work order: ${$e}`,{position:"top-right",autoClose:6e3,icon:r.jsx(Ld,{})})}}),Pt=xe=>ge(null,null,function*(){if(!e||c||!["Apply","Send For Repair"].includes(xe))return null;try{const $e=yield Ke.apiCall("/api/method/assign_supervisor_or_technician",{method:"POST",body:JSON.stringify({work_order:e,action:xe,asset_type:H.asset_type||(g==null?void 0:g.asset_type)||""})});return($e==null?void 0:$e.message)||null}catch($e){return console.error("Error in before_workflow_action:",$e),null}}),qe=(xe,De)=>ge(null,null,function*(){if(["Reject","Cancel","Close"].includes(xe)&&(R==null?void 0:R.action)!==xe){U({action:xe,nextState:De||""});return}U(null);const Et=At.loading(`Applying action "${xe}"...`,{position:"top-right"}),Gt=yield Pt(xe);Gt!=null&&Gt.assigned_to&&At.info(`Assigned to: ${Gt.assigned_to}`,{position:"top-right",autoClose:4e3,icon:r.jsx($n,{})});const Sa=yield ae(xe,De);if(At.dismiss(Et),Sa)At.success(`Action "${xe}" completed successfully!`,{position:"top-right",autoClose:3e3,icon:r.jsx($n,{})}),_();else{const tt=J||"Please try again.";tt.includes("TimestampMismatchError")||tt.includes("Document has been modified")||tt.includes("Please refresh")?(At.error("Document was modified. Refreshing...",{position:"top-right",autoClose:4e3,icon:r.jsx(Br,{})}),yield _(),At.info("Please try the action again after reviewing the latest changes.",{position:"top-right",autoClose:5e3,icon:r.jsx(Rd,{})})):At.error(`Failed to apply action "${xe}". ${tt}`,{position:"top-right",autoClose:6e3,icon:r.jsx(Ld,{})})}});if(x)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading work order details..."})]})});if(v&&!c&&!f)return r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",v]}),r.jsx("button",{onClick:()=>t("/work-orders"),className:"mt-2 text-red-700 dark:text-red-400 underline hover:text-red-800 dark:hover:text-red-300",children:"Back to work orders list"})]})});const at=()=>f?"Duplicate Work Order":u?"Create Work Order from Asset":c?"New Work Order":"Work Order Details",wt=(g==null?void 0:g.workflow_state)||H.workflow_state||"Draft",kt=z(wt),da=c||!te&&ue.length>0;return r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[r.jsx(D9,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:Gw}),r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("button",{onClick:()=>t("/work-orders"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[r.jsx(no,{}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:at()})]}),!c&&r.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${kt.bg} ${kt.text} ${kt.border} border`,children:wt}),u&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-300 rounded-full text-xs font-medium",children:[r.jsx(cg,{size:10}),"Linked from Asset: ",o]}),C&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded-full text-xs font-medium",children:[r.jsx(ds,{className:"animate-spin",size:12}),"Loading asset details..."]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[!c&&r.jsxs("button",{onClick:p,className:"bg-purple-600 hover:bg-purple-700 text-white px-6 py-2 rounded-lg flex items-center gap-2",title:"Print Service Report",children:[r.jsx(Pf,{}),"Service Report"]}),!c&&!j&&da&&r.jsxs("button",{onClick:()=>{P(!0),At.info("Edit mode enabled",{position:"top-right",autoClose:2e3,icon:r.jsx(Tn,{})})},className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(Tn,{}),"Edit"]}),j&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>{c?t("/work-orders"):(P(!1),At.info("Edit cancelled - changes discarded",{position:"top-right",autoClose:2e3,icon:r.jsx(Ld,{})}))},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 px-6 py-2 rounded-lg",disabled:N,children:"Cancel"}),r.jsxs("button",{onClick:Rt,disabled:N||C,className:"bg-green-600 hover:bg-green-700 text-white px-6 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(Wn,{}),N?"Saving...":"Save Changes"]})]})]})]}),u&&c&&r.jsx("div",{className:"mb-6 bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(cg,{className:"text-orange-500 mt-0.5"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-semibold text-orange-800 dark:text-orange-300",children:"Creating Work Order from Asset"}),r.jsxs("p",{className:"text-xs text-orange-700 dark:text-orange-400 mt-1",children:["Asset information has been pre-filled from ",r.jsx("strong",{children:H.asset_name||o}),". Please select a Work Order Type and add any additional details."]})]})]})}),r.jsx("form",{onSubmit:Rt,className:"space-y-6",style:{overflow:"visible"},children:r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",style:{overflow:"visible"},children:[r.jsxs("div",{className:"lg:col-span-3 space-y-6",style:{overflow:"visible"},children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white",children:"Asset Information"}),u&&r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400 rounded text-[10px] font-medium",children:[r.jsx(cg,{size:8}),"From Asset"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[r.jsx("div",{children:r.jsx(St,{label:"Hospital",doctype:"Company",value:H.company||"",onChange:xe=>B(Le(ie({},H),{company:xe,department:""})),disabled:!j,filters:{domain:"Healthcare"}})}),r.jsx("div",{children:r.jsx(St,{label:"Asset Type",doctype:"Asset Type",value:H.asset_type||"",onChange:Ut,disabled:!j})}),oe&&r.jsx("div",{children:r.jsx(St,{label:"Site Name",doctype:"Mobile Team Site",value:H.site_name||"",onChange:xe=>B(Le(ie({},H),{site_name:xe})),disabled:!j})}),!oe&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative z-[50]",children:[r.jsx(St,{label:"Asset ID",doctype:"Asset",value:H.asset||"",onChange:ke,disabled:!j||C,filters:H.company?{company:H.company}:{}}),H.asset&&r.jsx("p",{className:"mt-1 text-xs text-green-600 dark:text-green-400",children:"✓ Asset details auto-populated"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Serial Number"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",name:"serial_number",value:H.serial_number,onChange:nt,onBlur:Je,disabled:!j||C,placeholder:"Enter serial number",className:"flex-1 px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),j&&r.jsx("button",{type:"button",onClick:ze,disabled:C||!H.serial_number,className:"px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md disabled:opacity-50 disabled:cursor-not-allowed",title:"Search asset by serial number",children:r.jsx(Ps,{size:14})})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset Name"}),r.jsx("input",{type:"text",name:"asset_name",value:H.asset_name,onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsx("div",{children:r.jsx(St,{label:"Manufacturer",doctype:"Manufacturer",value:H.manufacturer||"",onChange:xe=>B(Le(ie({},H),{manufacturer:xe})),disabled:!j})}),r.jsx("div",{children:r.jsx(St,{label:"Supplier",doctype:"Supplier",value:H.supplier||"",onChange:xe=>B(Le(ie({},H),{supplier:xe})),disabled:!j})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Model"}),r.jsx("input",{type:"text",name:"model",value:H.model,onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Work Order Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Work Order ID"}),r.jsx("input",{type:"text",value:c||f?"Auto-generated":g==null?void 0:g.name,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"})]}),r.jsx("div",{className:"relative z-[50]",children:r.jsx(St,{label:"Work Order Type",doctype:"Issue Type",value:H.work_order_type||"",onChange:xe=>B(Le(ie({},H),{work_order_type:xe})),disabled:!j})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Priority"}),r.jsxs("select",{name:"custom_priority_",value:H.custom_priority_,onChange:ut,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"Normal",children:"Normal"}),r.jsx("option",{value:"Urgent",children:"Urgent"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),r.jsx("input",{type:"text",value:H.repair_status,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Pending Reason"}),r.jsxs("select",{name:"custom_pending_reason",value:H.custom_pending_reason||"",onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Pending Reason"}),r.jsx("option",{value:"Need Part",children:"Need Part"}),r.jsx("option",{value:"Waiting For Quotation",children:"Waiting For Quotation"}),r.jsx("option",{value:"Waiting For PO",children:"Waiting For PO"}),r.jsx("option",{value:"Waiting For Part Delivery",children:"Waiting For Part Delivery"})]})]}),r.jsx("div",{className:"flex items-center",children:r.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:H.need_procurement===1,onChange:bt,disabled:!j,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 disabled:opacity-50"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Need Procurement"})]})})]})]}),!oe&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Service Agreement Details"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Site Contractor"}),r.jsx("input",{type:"text",name:"custom_site_contractor",value:H.custom_site_contractor,onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Subcontractor"}),r.jsx("input",{type:"text",name:"custom_subcontractor",value:H.custom_subcontractor,onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Agreement"}),r.jsxs("select",{name:"custom_service_agreement",value:H.custom_service_agreement||"",onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Service Agreement"}),r.jsx("option",{value:"Warranty",children:"Warranty"}),r.jsx("option",{value:"Contract",children:"Contract"}),r.jsx("option",{value:"Frame Work",children:"Frame Work"}),r.jsx("option",{value:"Main Contractor",children:"Main Contractor"}),r.jsx("option",{value:"Out of warranty",children:"Out of warranty"}),r.jsx("option",{value:"Under Dismantle",children:"Under Dismantle"}),r.jsx("option",{value:"Under Installation",children:"Under Installation"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Coverage"}),r.jsxs("select",{name:"custom_service_coverage",value:H.custom_service_coverage||"",onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Service Coverage"}),r.jsx("option",{value:"PM Only",children:"PM Only"}),r.jsx("option",{value:"Labour",children:"Labour"}),r.jsx("option",{value:"Labour & Parts",children:"Labour & Parts"}),r.jsx("option",{value:"Comprehensive",children:"Comprehensive"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Start Date"}),r.jsx("input",{type:"date",name:"custom_start_date",value:H.custom_start_date||"",onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"End Date"}),r.jsx("input",{type:"date",name:"custom_end_date",value:H.custom_end_date||"",onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Amount"}),r.jsx("input",{type:"number",name:"custom_total_amount",min:"0",step:"0.01",value:H.custom_total_amount||0,onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Description"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Nature of Complaint"}),r.jsx("textarea",{name:"description",value:H.description,onChange:nt,disabled:!j,placeholder:"Describe the nature of complaint...",rows:4,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white resize-none"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Work Performed"}),r.jsx("textarea",{name:"actions_performed",value:H.actions_performed,onChange:nt,disabled:!j,placeholder:"Describe the work performed...",rows:4,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white resize-none"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Location & Assignment"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[r.jsx("div",{children:r.jsx(St,{label:"Department",doctype:"Department",value:H.department||"",onChange:xe=>B(Le(ie({},H),{department:xe})),disabled:!j,filters:Vt})}),r.jsx("div",{children:r.jsx(St,{label:"Assigned Supervisor",doctype:"User",value:H.custom_assigned_supervisor||"",onChange:xe=>B(Le(ie({},H),{custom_assigned_supervisor:xe})),disabled:!j})}),r.jsx("div",{children:r.jsx(St,{label:"Assigned Contractor",doctype:"User",value:H.custom_assign_to_contractor||"",onChange:xe=>B(Le(ie({},H),{custom_assign_to_contractor:xe})),disabled:!j})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Hours Spent"}),r.jsx("input",{type:"number",name:"total_hours_spent",min:"0",step:"0.5",value:H.total_hours_spent||0,onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Failure Date"}),r.jsx("input",{type:"date",name:"failure_date",value:H.failure_date,onChange:ft,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Deadline Date",r.jsx("span",{className:"ml-1 text-xs text-gray-400",children:"(Auto-calculated)"})]}),r.jsx("input",{type:"date",name:"custom_deadline_date",value:H.custom_deadline_date,onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),j&&H.failure_date&&r.jsxs("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[H.custom_priority_==="Urgent"?"Urgent":"Normal"," priority",H.need_procurement===1?" + Procurement":"",":"," ","+",H.need_procurement===1?30:H.custom_priority_==="Urgent"?1:5," days"]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"First Responded On"}),r.jsx("input",{type:"date",name:"first_responded_on",value:H.first_responded_on,onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Completion Date"}),r.jsx("input",{type:"date",name:"completion_date",value:H.completion_date,onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700 relative z-20",style:{overflow:"visible"},children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Stock Consumption Details"}),r.jsxs("div",{className:"mb-4",children:[r.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:H.stock_consumption===1,onChange:xe=>{var De;B(Le(ie({},H),{stock_consumption:xe.target.checked?1:0,stock_items:xe.target.checked?(De=H.stock_items)!=null&&De.length?H.stock_items:[{item_code:"",warehouse:q,consumed_quantity:1,valuation_rate:0,custom_available_stock:0,total_value:0}]:[]}))},disabled:!j,className:"w-5 h-5 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 disabled:opacity-50"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Parts Consumed"})]}),r.jsx("p",{className:"mt-1 ml-8 text-xs text-gray-500 dark:text-gray-400",children:"Check this if spare parts or items were used during the repair"})]}),H.stock_consumption===1&&r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Stock Items"}),j&&r.jsxs("button",{type:"button",onClick:()=>{B(Le(ie({},H),{stock_items:[...H.stock_items||[],{item_code:"",warehouse:q,consumed_quantity:1,valuation_rate:0,custom_available_stock:0,total_value:0}]})),At.info("New stock item row added",{position:"top-right",autoClose:2e3,icon:r.jsx(fi,{})})},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-white bg-green-600 hover:bg-green-700 rounded-md transition-colors",children:[r.jsx(fi,{size:10}),"Add Item"]})]}),r.jsx("div",{className:"stock-items-table-wrapper",children:r.jsx("div",{className:"stock-items-scroll-container",children:r.jsxs("table",{className:"w-full text-sm border border-gray-200 dark:border-gray-700 rounded-lg",children:[r.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-10",children:"#"}),r.jsxs("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider min-w-[180px]",children:["Item ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-28",children:"Valuation Rate"}),r.jsxs("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider min-w-[180px]",children:["Warehouse ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-24",children:"Consumed Qty"}),r.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-28",children:"Available Stock"}),r.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-28",children:"Total Value"}),j&&r.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-16",children:"Action"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(H.stock_items||[]).length===0?r.jsx("tr",{children:r.jsxs("td",{colSpan:j?8:7,className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:[r.jsx("p",{children:"No items added yet"}),j&&r.jsx("button",{type:"button",onClick:()=>{B(Le(ie({},H),{stock_items:[{item_code:"",warehouse:q,consumed_quantity:1,valuation_rate:0,custom_available_stock:0,total_value:0}]}))},className:"mt-2 text-blue-600 dark:text-blue-400 hover:underline text-sm",children:"+ Add first item"})]})}):(H.stock_items||[]).map((xe,De)=>r.jsxs(ea.Fragment,{children:[r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 ${K[De]?"bg-red-50 dark:bg-red-900/20":""}`,children:[r.jsx("td",{className:"px-3 py-3 text-gray-500 dark:text-gray-400",children:De+1}),r.jsx("td",{className:"px-3 py-3 relative",style:{zIndex:50-De},children:r.jsx("div",{className:"relative",children:r.jsx(St,{label:"",doctype:"Item",value:xe.item_code,onChange:$e=>Fe(De,$e),disabled:!j,placeholder:"Select Item",compact:!0,usePortal:!0,filters:ie({is_stock_item:1},H.company?{custom_hospital_name:H.company}:{})})})}),r.jsx("td",{className:"px-3 py-3",children:r.jsx("input",{type:"number",min:"0",step:"0.01",value:xe.valuation_rate||0,onChange:$e=>{const Et=[...H.stock_items||[]],Gt=parseFloat($e.target.value)||0,Sa=Et[De].consumed_quantity||0;Et[De]=Le(ie({},Et[De]),{valuation_rate:Gt,total_value:Gt*Sa}),B(Le(ie({},H),{stock_items:Et}))},disabled:!j,className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-3 py-3 relative",style:{zIndex:50-De},children:r.jsx("div",{className:"relative",children:r.jsx(St,{label:"",doctype:"Warehouse",value:xe.warehouse,onChange:$e=>He(De,$e),disabled:!j,placeholder:"Select Warehouse",compact:!0,usePortal:!0})})}),r.jsx("td",{className:"px-3 py-3",children:r.jsx("input",{type:"number",min:"1",value:xe.consumed_quantity||1,onChange:$e=>ht(De,parseInt($e.target.value)||1),disabled:!j,className:`w-full px-2 py-1.5 text-sm border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white ${K[De]?"border-red-500 dark:border-red-500":"border-gray-300 dark:border-gray-600"}`})}),r.jsx("td",{className:"px-3 py-3",children:r.jsx("input",{type:"number",min:"0",value:xe.custom_available_stock||0,disabled:!0,className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300",title:"Auto-populated from stock"})}),r.jsx("td",{className:"px-3 py-3",children:r.jsx("input",{type:"number",min:"0",step:"0.01",value:xe.total_value||0,disabled:!0,className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"})}),j&&r.jsx("td",{className:"px-3 py-3 text-center",children:r.jsx("button",{type:"button",onClick:()=>{var Gt;const $e=(Gt=H.stock_items)==null?void 0:Gt[De],Et=(H.stock_items||[]).filter((Sa,tt)=>tt!==De);B(Le(ie({},H),{stock_items:Et})),fe(Sa=>{const tt=ie({},Sa);return delete tt[De],tt}),At.warning(`Stock item ${($e==null?void 0:$e.item_code)||"row"} removed`,{position:"top-right",autoClose:2e3,icon:r.jsx(Xa,{})})},className:"p-1.5 text-red-500 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors",title:"Remove item",children:r.jsx(Xa,{size:14})})})]}),K[De]&&r.jsx("tr",{className:"bg-red-50 dark:bg-red-900/30",children:r.jsx("td",{colSpan:j?8:7,className:"px-4 py-2",children:r.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400 text-xs",children:[r.jsx(Br,{}),r.jsx("span",{children:K[De]})]})})})]},De))})]})})}),(H.stock_items||[]).length>0&&r.jsxs("div",{className:"mt-3 flex flex-wrap justify-between items-center gap-4 text-sm bg-gray-50 dark:bg-gray-700/50 p-3 rounded-lg",children:[r.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Total Items: ",r.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:(H.stock_items||[]).length})]}),r.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Total Qty: ",r.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:(H.stock_items||[]).reduce((xe,De)=>xe+(De.consumed_quantity||0),0)})]}),r.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Total Value: ",r.jsx("span",{className:"font-semibold text-green-600 dark:text-green-400",children:(H.stock_items||[]).reduce((xe,De)=>xe+(De.total_value||0),0).toFixed(2)})]})]})]}),r.jsx("div",{className:"mt-6 pt-4 border-t border-gray-200 dark:border-gray-700",children:r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Repair Cost"}),r.jsx("input",{type:"number",name:"total_repair_cost",min:"0",step:"0.01",value:H.total_repair_cost||0,onChange:nt,disabled:!j,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})})})]})]}),r.jsxs("div",{className:"space-y-6",children:[!c&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("div",{className:"flex items-center justify-between mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white",children:"Workflow Actions"})}),r.jsxs("div",{className:`p-4 rounded-lg border mb-4 ${kt.bg} ${kt.border}`,children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Current State"}),r.jsx("p",{className:`text-lg font-semibold ${kt.text}`,children:wt})]}),te&&r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-4",children:[r.jsx(ds,{className:"animate-spin"}),r.jsx("span",{className:"text-sm",children:"Loading actions..."})]}),J&&r.jsx("div",{className:"p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg mb-4",children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Br,{className:"text-red-500 mt-0.5"}),r.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:J})]})}),R&&r.jsxs("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg mb-4",children:[r.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[r.jsx(Br,{className:"text-yellow-500 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-200",children:"Confirm Action"}),r.jsxs("p",{className:"text-xs text-yellow-600 dark:text-yellow-400 mt-1",children:["Are you sure you want to ",r.jsx("strong",{children:R.action})," this work order?"]})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>qe(R.action,R.nextState),disabled:V,className:"px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-sm rounded-md disabled:opacity-50",children:V?r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ds,{className:"animate-spin",size:12}),"Processing..."]}):`Yes, ${R.action}`}),r.jsx("button",{onClick:()=>U(null),disabled:V,className:"px-3 py-1.5 bg-gray-300 hover:bg-gray-400 text-gray-700 text-sm rounded-md disabled:opacity-50",children:"Cancel"})]})]}),!te&&ue.length>0&&!R&&r.jsxs("div",{className:"space-y-3",children:[ne&&r.jsx("div",{className:"p-2 bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg mb-2",children:r.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[r.jsx("strong",{children:"System Manager:"})," Showing all valid actions for this state (conditions evaluated)."]})}),r.jsxs("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center gap-1",children:[r.jsx(Rd,{size:12}),"Available Actions (",ue.length,")"]}),r.jsx("div",{className:"flex flex-col gap-2",children:ue.map((xe,De)=>r.jsxs("button",{onClick:()=>qe(xe.action,xe.next_state),disabled:V,className:`w-full px-4 py-2.5 rounded-lg text-sm font-medium transition-colors disabled:opacity-50 flex items-center justify-center gap-2 ${D(xe.action)}`,children:[V?r.jsx(ds,{className:"animate-spin",size:14}):r.jsx("span",{children:G(xe.action)}),xe.action]},`${xe.action}-${xe.next_state}-${De}`))}),r.jsxs("div",{className:"mt-3 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"Action Results:"}),ue.map((xe,De)=>r.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:[xe.action," → ",r.jsx("span",{className:"font-medium",children:xe.next_state})]},De))]})]}),!te&&ue.length===0&&r.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center",children:"No workflow actions available"}),r.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 text-center mt-1",children:"(Conditions may not be met for available transitions)"})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Status Summary"}),!c&&g&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Repair Status"}),r.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:g.repair_status||"Open"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Priority"}),r.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:g.custom_priority_||"Normal"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:g.creation?new Date(g.creation).toLocaleString():"-"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Last Modified"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:g.modified?new Date(g.modified).toLocaleString():"-"})]})]}),c&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx(Rd,{className:"text-4xl text-gray-400 dark:text-gray-500 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Status information will appear after creation"})]})]})]})]})}),r.jsx("style",{children:`
/* Wrapper for table - allow natural flow */
.stock-items-table-wrapper {
width: 100%;
position: relative;
}
/* Scroll container handles horizontal scrolling only */
.stock-items-scroll-container {
width: 100%;
overflow-x: auto;
overflow-y: visible;
-webkit-overflow-scrolling: touch;
}
/* Table styling */
.stock-items-scroll-container table {
border-collapse: separate;
border-spacing: 0;
min-width: 100%;
}
.stock-items-scroll-container tbody tr td {
position: relative;
}
`})]})},B9=()=>{const{t:e}=ln(),t=Da(),[a,s]=E.useState(0),[o,u]=E.useState(""),[c,f]=E.useState(""),[p,g]=E.useState(null),[x,v]=E.useState(null),_=E.useRef(null),k=20,T=c?{maintenance_status:c}:{},{logs:N,totalCount:j,hasMore:P,loading:C,error:O,refetch:R}=Rf(T,k,a*k,"due_date asc"),{deleteLog:U,loading:H}=p_();E.useEffect(()=>{const ne=ae=>{_.current&&!_.current.contains(ae.target)&&v(null)};return x&&document.addEventListener("mousedown",ne),()=>{document.removeEventListener("mousedown",ne)}},[x]);const B=()=>{t("/maintenance/new")},oe=ne=>{t(`/maintenance/${ne}`)},se=ne=>{t(`/maintenance/${ne}`)},pe=ne=>ge(null,null,function*(){try{yield U(ne),g(null),R(),alert("Maintenance log deleted successfully!")}catch(ae){alert(`Failed to delete: ${ae instanceof Error?ae.message:"Unknown error"}`)}}),le=ne=>{t(`/maintenance/new?duplicate=${ne}`)},re=ne=>{const ae=JSON.stringify(ne,null,2),z=new Blob([ae],{type:"application/json"}),D=URL.createObjectURL(z),G=document.createElement("a");G.href=D,G.download=`maintenance_${ne.name}.json`,G.click(),URL.revokeObjectURL(D)},de=ne=>{window.open(`/maintenance/${ne}?print=true`,"_blank")},ye=()=>{const ae=[["Log ID","Asset","Type","Status","Due Date","Assigned To"].join(","),...N.map(q=>[q.name,q.asset_name||"",q.maintenance_type||"",q.maintenance_status||"",q.due_date||"",q.assign_to_name||""].join(","))].join(`
`),z=new Blob([ae],{type:"text/csv"}),D=URL.createObjectURL(z),G=document.createElement("a");G.href=D,G.download=`maintenance_logs_${new Date().toISOString().split("T")[0]}.csv`,G.click(),URL.revokeObjectURL(D)},ue=ne=>{switch(ne==null?void 0:ne.toLowerCase()){case"completed":return r.jsx($n,{className:"text-green-500"});case"planned":return r.jsx(__,{className:"text-blue-500"});case"overdue":return r.jsx(Br,{className:"text-red-500"});default:return r.jsx(gc,{className:"text-gray-400"})}},te=ne=>{switch(ne==null?void 0:ne.toLowerCase()){case"completed":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300";case"planned":return"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300";case"overdue":return"bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-300";case"cancelled":return"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300";default:return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-300"}},V=(ne,ae)=>!ne||(ae==null?void 0:ae.toLowerCase())==="completed"?!1:new Date(ne)<new Date;if(C&&a===0)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading maintenance logs..."})]})});if(O)return r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ Maintenance API Not Available"}),r.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"The Asset Maintenance API endpoint is not deployed yet."})}),r.jsxs("div",{className:"mt-4 flex gap-3",children:[r.jsx("button",{onClick:()=>t("/maintenance/new"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Creating New (Demo)"}),r.jsx("button",{onClick:R,className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]}),r.jsx("div",{className:"mt-4 p-4 bg-white dark:bg-gray-800 rounded border border-yellow-300 dark:border-yellow-700",children:r.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[r.jsx("strong",{children:"Technical Error:"})," ",O]})})]})});const J=N.filter(ne=>{var ae,z,D;return((ae=ne.name)==null?void 0:ae.toLowerCase().includes(o.toLowerCase()))||((z=ne.asset_name)==null?void 0:z.toLowerCase().includes(o.toLowerCase()))||((D=ne.task_name)==null?void 0:D.toLowerCase().includes(o.toLowerCase()))});return r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("maintenance.title")}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",j," maintenance log",j!==1?"s":""]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:ye,className:"bg-green-600 hover:bg-green-700 text-white px-4 py-3 rounded-lg flex items-center gap-2 shadow transition-all",disabled:N.length===0,children:[r.jsx(ui,{}),r.jsx("span",{className:"font-medium",children:"Export All"})]}),r.jsxs("button",{onClick:B,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(fi,{}),r.jsx("span",{className:"font-medium",children:"New Maintenance Log"})]})]})]}),r.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:r.jsxs("div",{className:"flex items-center gap-2 border border-gray-300 dark:border-gray-600 rounded-lg px-4 py-2 bg-white dark:bg-gray-700",children:[r.jsx(Ps,{className:"text-gray-400 dark:text-gray-500"}),r.jsx("input",{type:"text",placeholder:"Search by ID, asset, task...",value:o,onChange:ne=>u(ne.target.value),className:"flex-1 outline-none text-gray-700 dark:text-gray-200 bg-transparent"})]})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:r.jsxs("select",{value:c,onChange:ne=>{f(ne.target.value),s(0)},className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"",children:"All Statuses"}),r.jsx("option",{value:"Planned",children:"Planned"}),r.jsx("option",{value:"Completed",children:"Completed"}),r.jsx("option",{value:"Overdue",children:"Overdue"}),r.jsx("option",{value:"Cancelled",children:"Cancelled"})]})})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden",children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Log ID"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Asset"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Due Date"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:J.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Ps,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:"No maintenance logs found"}),r.jsx("button",{onClick:B,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Create your first maintenance log"})]})})}):J.map(ne=>{const ae=V(ne.due_date||"",ne.maintenance_status||"");return r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${ae?"bg-red-50 dark:bg-red-900/10":""}`,onClick:()=>oe(ne.name),children:[r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:ne.name}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:ne.creation?new Date(ne.creation).toLocaleDateString():""})]}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:ne.asset_name||"-"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:ne.custom_asset_type||""})]}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:ne.maintenance_type||"-"}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:ne.due_date?new Date(ne.due_date).toLocaleDateString():"-"}),ae&&r.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 font-semibold",children:"Overdue"})]}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ue(ne.maintenance_status||""),r.jsx("span",{className:`px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${te(ne.maintenance_status||"")}`,children:ne.maintenance_status||"Unknown"})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"flex items-center gap-1",onClick:z=>z.stopPropagation(),children:[r.jsx("button",{onClick:()=>oe(ne.name),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:"View Details",children:r.jsx(Nc,{})}),r.jsx("button",{onClick:()=>se(ne.name),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:"Edit Log",children:r.jsx(Tn,{})}),r.jsx("button",{onClick:()=>le(ne.name),className:"text-purple-600 dark:text-purple-400 hover:text-purple-900 dark:hover:text-purple-300 p-2 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded transition-colors",title:"Duplicate",children:r.jsx(ou,{})}),r.jsx("button",{onClick:()=>g(ne.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete",disabled:H,children:r.jsx(Xa,{})}),r.jsxs("div",{className:"relative",ref:x===ne.name?_:null,children:[r.jsx("button",{onClick:()=>v(x===ne.name?null:ne.name),className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 p-2 hover:bg-gray-50 dark:hover:bg-gray-700 rounded transition-colors",title:"More Actions",children:r.jsx(lu,{})}),x===ne.name&&r.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-10",children:[r.jsxs("button",{onClick:()=>{re(ne),v(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-t-lg",children:[r.jsx(kc,{className:"text-blue-500"}),"Export as JSON"]}),r.jsxs("button",{onClick:()=>{de(ne.name),v(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-b-lg",children:[r.jsx(Pf,{className:"text-purple-500"}),"Print Log"]})]})]})]})})]},ne.name)})})]})}),J.length>0&&r.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 px-6 py-4 flex items-center justify-between border-t border-gray-200 dark:border-gray-600",children:[r.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",r.jsx("span",{className:"font-medium",children:a*k+1})," to"," ",r.jsx("span",{className:"font-medium",children:Math.min((a+1)*k,j)})," ","of ",r.jsx("span",{className:"font-medium",children:j})," results"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{disabled:a===0,onClick:()=>s(a-1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Previous"}),r.jsx("button",{disabled:!P,onClick:()=>s(a+1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Next"})]})]})]}),p&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:r.jsx(Xa,{className:"text-red-600 dark:text-red-400 text-xl"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Maintenance Log"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Are you sure you want to delete this maintenance log? This action cannot be undone."}),r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-3 mb-4",children:r.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[r.jsx("strong",{children:"Log ID:"})," ",p]})}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>g(null),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",disabled:H,children:"Cancel"}),r.jsx("button",{onClick:()=>pe(p),className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",disabled:H,children:H?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Xa,{}),"Delete Log"]})})]})]})]})})})]})},z9=Ke,U9=({message:e,type:t,onClose:a})=>{E.useEffect(()=>{const o=setTimeout(a,1e4);return()=>clearTimeout(o)},[a]);const s=t==="warning"?"bg-yellow-500":t==="success"?"bg-green-500":"bg-red-500";return r.jsx("div",{className:`fixed top-4 right-4 ${s} text-white px-6 py-4 rounded-lg shadow-lg z-50 max-w-md`,children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Br,{className:"mt-0.5 flex-shrink-0"}),r.jsx("p",{className:"text-sm",children:e}),r.jsx("button",{onClick:a,className:"ml-2 text-white hover:text-gray-200",children:r.jsx(pt,{})})]})})},H9=()=>{const{logName:e}=_c(),t=Da(),[a]=rl(),s=a.get("duplicate"),o=e==="new",u=o&&!!s,{log:c,loading:f,error:p}=VS(u?s:o?null:e||null),{createLog:g,updateLog:x,loading:v}=p_(),_=(c==null?void 0:c.workflow_state)==="Approved",[k,T]=E.useState(o),[N,j]=E.useState([]),[P,C]=E.useState(null),[O,R]=E.useState(!1),[U,H]=E.useState({asset_name:"",custom_asset_type:"",item_code:"",item_name:"",custom_asset_names:"",custom_hospital_name:"",task:"",task_name:"",maintenance_type:"Preventive Maintenance",periodicity:"",has_certificate:0,custom_early_completion:"",maintenance_status:"Planned",custom_accepted_by_moh:0,assign_to_name:"",due_date:"",completion_date:"",custom_early_completion_reason:"",custom_accepted_by_moh_:0,custom_template:"",custom_table:[],description:""}),B=E.useCallback((ne,ae,z)=>{if(z!=="Completed"){H(K=>Le(ie({},K),{custom_early_completion:""}));return}if(!ne||!ae)return;const D=new Date(ne),G=new Date(ae),q=new Date(D.getFullYear(),D.getMonth(),1);if(G<q){H(Pe=>Le(ie({},Pe),{custom_early_completion:"Yes"}));const K=G.toLocaleDateString(),fe=D.toLocaleDateString();C({message:`⚠️ Warning: Completion Date (${K}) is before the Due Date Month (${fe}). Please verify.`,type:"warning"})}},[]),oe=E.useCallback(ne=>ge(null,null,function*(){var ae;if(ne){R(!0);try{const z=yield z9.apiCall(`/api/resource/PPM Templates/${encodeURIComponent(ne)}`,"GET");if((ae=z==null?void 0:z.data)!=null&&ae.ppm_template_table&&Array.isArray(z.data.ppm_template_table)){const D=z.data.ppm_template_table.map((G,q)=>({idx:q+1,maintenance_name:G.maintenance_name||"",working:0,defect_found:0,not_working:0}));j(D)}}catch(z){console.error("Error loading PPM template:",z),C({message:"Failed to load PPM template. Please add items manually.",type:"error"})}finally{R(!1)}}}),[]);E.useEffect(()=>{c&&(c.workflow_state==="Approved"&&T(!1),H({asset_name:c.asset_name||"",custom_asset_type:c.custom_asset_type||"",item_code:c.item_code||"",item_name:c.item_name||"",custom_asset_names:c.custom_asset_names||"",custom_hospital_name:c.custom_hospital_name||"",task:c.task||"",task_name:c.task_name||"",maintenance_type:c.maintenance_type||"Preventive Maintenance",periodicity:c.periodicity||"",has_certificate:c.has_certificate||0,custom_early_completion:u?"":c.custom_early_completion||"",maintenance_status:u?"Planned":c.maintenance_status||"Planned",custom_accepted_by_moh:c.custom_accepted_by_moh||0,assign_to_name:c.assign_to_name||"",due_date:c.due_date||"",completion_date:u?"":c.completion_date||"",custom_early_completion_reason:u?"":c.custom_early_completion_reason||"",custom_accepted_by_moh_:c.custom_accepted_by_moh_||0,custom_template:c.custom_template||"",custom_table:c.custom_table||[],description:c.description||""}),c.custom_table&&Array.isArray(c.custom_table)&&c.custom_table.length>0?j(c.custom_table.map((ne,ae)=>({name:ne.name,idx:ne.idx||ae+1,maintenance_name:ne.maintenance_name||"",working:ne.working||0,defect_found:ne.defect_found||0,not_working:ne.not_working||0}))):c.custom_template&&(!c.custom_table||c.custom_table.length===0)&&oe(c.custom_template))},[c,u,oe]),E.useEffect(()=>{U.completion_date&&U.due_date&&B(U.due_date,U.completion_date,U.maintenance_status)},[U.completion_date,U.due_date,U.maintenance_status,B]);const se=ne=>{const{name:ae,value:z,type:D}=ne.target,G=ne.target.checked;H(q=>Le(ie({},q),{[ae]:D==="checkbox"?G?1:0:z}))},pe=ne=>{const ae=ne.target.value;H(z=>Le(ie({},z),{maintenance_status:ae})),ae==="Completed"?B(U.due_date||"",U.completion_date||"",ae):H(z=>Le(ie({},z),{custom_early_completion:""}))},le=ne=>{const ae=ne.target.value;H(z=>Le(ie({},z),{completion_date:ae})),U.maintenance_status==="Completed"&&B(U.due_date||"",ae,U.maintenance_status)},re=ne=>ge(null,null,function*(){const ae=ne.target.value;H(z=>Le(ie({},z),{custom_template:ae})),(ae&&N.length===0||ae&&N.length>0&&window.confirm("Loading a template will replace existing checklist items. Continue?"))&&oe(ae)}),de=()=>{const ne={idx:N.length+1,maintenance_name:"",working:0,defect_found:0,not_working:0};j([...N,ne])},ye=ne=>{const ae=N.filter((z,D)=>D!==ne).map((z,D)=>Le(ie({},z),{idx:D+1}));j(ae)},ue=(ne,ae,z)=>{const D=[...N];D[ne]=Le(ie({},D[ne]),{[ae]:z}),j(D)},te=ne=>ge(null,null,function*(){if(ne.preventDefault(),!U.asset_name){alert("Please enter Asset Name");return}if(!U.maintenance_type){alert("Please select Maintenance Type");return}const ae=N.map((D,G)=>{const q={idx:D.idx||G+1,maintenance_name:D.maintenance_name||"",working:D.working?1:0,defect_found:D.defect_found?1:0,not_working:D.not_working?1:0};return D.name&&typeof D.name=="string"&&D.name.trim()!==""&&(q.name=D.name),q}),z=Le(ie({},U),{custom_table:ae});console.log("Submitting maintenance log data:",z);try{if(o||u){const D=yield g(z);alert(u?"Maintenance log duplicated successfully!":"Maintenance log created successfully!"),t(`/maintenance/${D.name}`)}else e&&(yield x(e,z),alert("Maintenance log updated successfully!"),T(!1))}catch(D){console.error("Maintenance log save error:",D),alert("Failed to save: "+(D instanceof Error?D.message:"Unknown error"))}}),V=ne=>({Draft:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",Applied:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",Pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",Approved:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",Rejected:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",Completed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"})[ne]||"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",J=ne=>({Planned:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",Completed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",Overdue:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",Cancelled:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"})[ne]||"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300";return f?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading maintenance log..."})]})}):p&&!o&&!u?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",p]}),r.jsx("button",{onClick:()=>t("/maintenance"),className:"mt-2 text-red-700 dark:text-red-400 underline hover:text-red-800 dark:hover:text-red-300",children:"Back to maintenance logs"})]})}):r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[P&&r.jsx(U9,{message:P.message,type:P.type,onClose:()=>C(null)}),r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("button",{onClick:()=>t("/maintenance"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[r.jsx(no,{}),r.jsx("span",{className:"text-gray-900 dark:text-white font-semibold",children:u?"Duplicate Maintenance Log":o?"New Maintenance Log":"Maintenance Log Details"})]}),!o&&(c==null?void 0:c.workflow_state)&&r.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${V(c.workflow_state)}`,children:c.workflow_state})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[!o&&!k&&!_&&r.jsxs("button",{onClick:()=>T(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(Tn,{}),"Edit"]}),k&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>{o?t("/maintenance"):T(!1)},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 px-6 py-2 rounded-lg",disabled:v,children:"Cancel"}),r.jsxs("button",{onClick:te,disabled:v,className:"bg-green-600 hover:bg-green-700 text-white px-6 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(Wn,{}),v?"Saving...":"Save Changes"]})]})]})]}),r.jsx("form",{onSubmit:te,className:"space-y-6",children:r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Log ID"}),r.jsx("input",{type:"text",value:o||u?"Auto-generated":(c==null?void 0:c.name)||"",disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white"}),u&&r.jsxs("p",{className:"mt-1 text-xs text-blue-600 dark:text-blue-400",children:["💡 Duplicating from: ",s]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Hospital"}),r.jsx("input",{type:"text",name:"custom_hospital_name",value:U.custom_hospital_name||"",onChange:se,disabled:!k,placeholder:"Hospital name",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Asset Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{type:"text",name:"asset_name",value:U.asset_name,onChange:se,required:!0,disabled:!k,placeholder:"Asset ID",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset Display Name"}),r.jsx("input",{type:"text",name:"custom_asset_names",value:U.custom_asset_names||"",onChange:se,disabled:!k,placeholder:"Display name",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset Type"}),r.jsx("input",{type:"text",name:"custom_asset_type",value:U.custom_asset_type||"",onChange:se,disabled:!k,placeholder:"e.g., Bio Medical",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Maintenance Details"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Maintenance Type ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsxs("select",{name:"maintenance_type",value:U.maintenance_type,onChange:se,required:!0,disabled:!k,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"Preventive Maintenance",children:"Preventive Maintenance"}),r.jsx("option",{value:"Corrective Maintenance",children:"Corrective Maintenance"}),r.jsx("option",{value:"Calibration",children:"Calibration"}),r.jsx("option",{value:"Inspection",children:"Inspection"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Periodicity"}),r.jsxs("select",{name:"periodicity",value:U.periodicity||"",onChange:se,disabled:!k,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select periodicity"}),r.jsx("option",{value:"Daily",children:"Daily"}),r.jsx("option",{value:"Weekly",children:"Weekly"}),r.jsx("option",{value:"Monthly",children:"Monthly"}),r.jsx("option",{value:"Quarterly",children:"Quarterly"}),r.jsx("option",{value:"Half Yearly",children:"Half Yearly"}),r.jsx("option",{value:"Yearly",children:"Yearly"}),r.jsx("option",{value:"2 Yearly",children:"2 Yearly"}),r.jsx("option",{value:"3 Yearly",children:"3 Yearly"})]})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Template",O&&r.jsx("span",{className:"ml-2 text-blue-500",children:"(Loading...)"})]}),r.jsx("input",{type:"text",name:"custom_template",value:U.custom_template||"",onChange:re,disabled:!k,placeholder:"PPM Template name",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Enter template name to auto-load checklist items"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),r.jsxs("select",{name:"maintenance_status",value:U.maintenance_status,onChange:pe,disabled:!k,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"Planned",children:"Planned"}),r.jsx("option",{value:"Completed",children:"Completed"}),r.jsx("option",{value:"Overdue",children:"Overdue"}),r.jsx("option",{value:"Cancelled",children:"Cancelled"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Assigned To"}),r.jsx("input",{type:"text",name:"assign_to_name",value:U.assign_to_name||"",onChange:se,disabled:!k,placeholder:"Technician name",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Due Date"}),r.jsx("input",{type:"date",name:"due_date",value:U.due_date||"",onChange:se,disabled:!k,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Completion Date"}),r.jsx("input",{type:"date",name:"completion_date",value:U.completion_date||"",onChange:le,disabled:!k,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Completion & Approval"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Early Completion",U.custom_early_completion==="Yes"&&r.jsx("span",{className:"ml-2 text-yellow-500",children:"⚠️ Auto-detected"})]}),r.jsx("input",{type:"text",value:U.custom_early_completion||"No",disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Auto-set based on completion date vs due date"})]}),U.custom_early_completion==="Yes"&&r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Early Completion Reason ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{type:"text",name:"custom_early_completion_reason",value:U.custom_early_completion_reason||"",onChange:se,disabled:!k,required:!0,placeholder:"Required when early completion",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"checkbox",name:"custom_accepted_by_moh",checked:!!U.custom_accepted_by_moh,onChange:se,disabled:!k,className:"w-4 h-4 text-blue-600 rounded focus:ring-2 focus:ring-blue-500"}),r.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:"Accepted by MOH"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-base font-semibold text-gray-800 dark:text-white flex items-center gap-2",children:[r.jsx(d6,{}),"PPM Checklist Table",O&&r.jsx("span",{className:"text-sm text-blue-500 font-normal",children:"(Loading template...)"})]}),k&&r.jsxs("button",{type:"button",onClick:de,className:"flex items-center gap-1 px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white text-sm rounded-md",children:[r.jsx(fi,{className:"text-xs"}),"Add Row"]})]}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-gray-50 dark:bg-gray-700",children:[r.jsx("th",{className:"text-left py-3 px-3 text-xs font-medium text-gray-700 dark:text-gray-300 w-12",children:"#"}),r.jsx("th",{className:"text-left py-3 px-3 text-xs font-medium text-gray-700 dark:text-gray-300",children:"Maintenance Task"}),r.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-green-600 dark:text-green-400 w-24",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(w_,{})," Working"]})}),r.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-yellow-600 dark:text-yellow-400 w-28",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Br,{})," Defect"]})}),r.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-red-600 dark:text-red-400 w-28",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(pt,{})," Not Working"]})}),k&&r.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-gray-700 dark:text-gray-300 w-16",children:"Action"})]})}),r.jsx("tbody",{children:N.length===0?r.jsx("tr",{children:r.jsxs("td",{colSpan:k?6:5,className:"text-center py-8 text-gray-500 dark:text-gray-400",children:["No checklist items. ",k&&'Enter a template name above or click "Add Row" to add items.']})}):N.map((ne,ae)=>r.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[r.jsx("td",{className:"py-3 px-3 text-sm text-gray-600 dark:text-gray-400",children:ne.idx||ae+1}),r.jsx("td",{className:"py-3 px-3",children:k?r.jsx("input",{type:"text",value:ne.maintenance_name,onChange:z=>ue(ae,"maintenance_name",z.target.value),placeholder:"Enter maintenance task",className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-1 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:ne.maintenance_name})}),r.jsx("td",{className:"py-3 px-3 text-center",children:r.jsx("input",{type:"checkbox",checked:!!ne.working,onChange:z=>ue(ae,"working",z.target.checked?1:0),disabled:!k,className:"w-5 h-5 text-green-600 rounded focus:ring-2 focus:ring-green-500 cursor-pointer disabled:cursor-default"})}),r.jsx("td",{className:"py-3 px-3 text-center",children:r.jsx("input",{type:"checkbox",checked:!!ne.defect_found,onChange:z=>ue(ae,"defect_found",z.target.checked?1:0),disabled:!k,className:"w-5 h-5 text-yellow-600 rounded focus:ring-2 focus:ring-yellow-500 cursor-pointer disabled:cursor-default"})}),r.jsx("td",{className:"py-3 px-3 text-center",children:r.jsx("input",{type:"checkbox",checked:!!ne.not_working,onChange:z=>ue(ae,"not_working",z.target.checked?1:0),disabled:!k,className:"w-5 h-5 text-red-600 rounded focus:ring-2 focus:ring-red-500 cursor-pointer disabled:cursor-default"})}),k&&r.jsx("td",{className:"py-3 px-3 text-center",children:r.jsx("button",{type:"button",onClick:()=>ye(ae),className:"text-red-500 hover:text-red-700 p-1",title:"Remove row",children:r.jsx(Xa,{})})})]},ne.name||ae))})]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[!o&&c&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Workflow Actions"}),r.jsx(R9,{doctype:"Asset Maintenance Log",docname:c.name||null,workflowState:c.workflow_state,showStateInfo:!1,onActionComplete:(ne,ae)=>{ae&&console.log(`Action "${ne}" completed successfully`)},onStateChange:()=>{window.location.reload()}})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Status Summary"}),!o&&c?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Current Status"}),r.jsx("span",{className:`inline-block px-3 py-1 rounded-full text-sm font-medium ${J(U.maintenance_status)}`,children:U.maintenance_status||"Planned"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Workflow State"}),r.jsx("span",{className:`inline-block px-3 py-1 rounded-full text-sm font-medium ${V(c.workflow_state||"Draft")}`,children:c.workflow_state||"Draft"})]}),U.custom_early_completion==="Yes"&&r.jsxs("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-lg border border-yellow-200 dark:border-yellow-800",children:[r.jsx("p",{className:"text-xs text-yellow-600 dark:text-yellow-400 mb-1",children:"⚠️ Early Completion"}),r.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300 font-medium",children:"Completion date is before the due month"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Due Date"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:U.due_date?new Date(U.due_date).toLocaleDateString():"Not set"}),U.due_date&&new Date(U.due_date)<new Date&&U.maintenance_status!=="Completed"&&r.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 font-semibold mt-1",children:"⚠️ Overdue"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Completion Date"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:U.completion_date?new Date(U.completion_date).toLocaleDateString():"Not completed"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Assigned To"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:U.assign_to_name||"Unassigned"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"PPM Checklist"}),r.jsxs("p",{className:"text-sm text-gray-900 dark:text-white",children:[N.length," item(s)"]}),N.length>0&&r.jsxs("div",{className:"mt-2 text-xs space-y-1",children:[r.jsxs("p",{className:"text-green-600 dark:text-green-400",children:["✓ Working: ",N.filter(ne=>ne.working).length]}),r.jsxs("p",{className:"text-yellow-600 dark:text-yellow-400",children:["⚠ Defects: ",N.filter(ne=>ne.defect_found).length]}),r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["✗ Not Working: ",N.filter(ne=>ne.not_working).length]})]})]})]}):r.jsxs("div",{className:"text-center py-8",children:[r.jsx(gc,{className:"text-4xl text-gray-400 dark:text-gray-500 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Status information will appear after creation"})]})]}),!o&&c&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Audit Information"}),r.jsxs("div",{className:"space-y-3 text-sm",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Created By"}),r.jsx("p",{className:"text-gray-900 dark:text-white",children:c.owner||"-"})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Created On"}),r.jsx("p",{className:"text-gray-900 dark:text-white",children:c.creation?new Date(c.creation).toLocaleString():"-"})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Modified By"}),r.jsx("p",{className:"text-gray-900 dark:text-white",children:c.modified_by||"-"})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Modified On"}),r.jsx("p",{className:"text-gray-900 dark:text-white",children:c.modified?new Date(c.modified).toLocaleString():"-"})]})]})]})]})]})})]})};class $9{getAssetMaintenances(t,a,s=20,o=0,u){return ge(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),a&&a.length>0&&c.append("fields",JSON.stringify(a)),c.append("limit",s.toString()),c.append("offset",o.toString()),u&&c.append("order_by",u);const f=`${Ot.ENDPOINTS.GET_ASSET_MAINTENANCES}?${c.toString()}`;return Ke.apiCall(f)})}getAssetMaintenanceDetails(t){return ge(this,null,function*(){const a=new URLSearchParams;a.append("maintenance_name",t);const s=`${Ot.ENDPOINTS.GET_ASSET_MAINTENANCE_DETAILS}?${a.toString()}`;return Ke.apiCall(s)})}createAssetMaintenance(t){return ge(this,null,function*(){const a=`${Ot.ENDPOINTS.CREATE_ASSET_MAINTENANCE}`;return Ke.apiCall(a,{method:"POST",body:JSON.stringify({maintenance_data:JSON.stringify(t)})})})}updateAssetMaintenance(t,a){return ge(this,null,function*(){const s=`${Ot.ENDPOINTS.UPDATE_ASSET_MAINTENANCE}`;return Ke.apiCall(s,{method:"POST",body:JSON.stringify({maintenance_name:t,maintenance_data:JSON.stringify(a)})})})}deleteAssetMaintenance(t){return ge(this,null,function*(){const a=`${Ot.ENDPOINTS.DELETE_ASSET_MAINTENANCE}`;return Ke.apiCall(a,{method:"POST",body:JSON.stringify({maintenance_name:t})})})}getMaintenanceTasks(t){return ge(this,null,function*(){const a=new URLSearchParams;a.append("maintenance_name",t);const s=`${Ot.ENDPOINTS.GET_MAINTENANCE_TASKS}?${a.toString()}`;return Ke.apiCall(s)})}getServiceCoverage(t){return ge(this,null,function*(){const a=new URLSearchParams;a.append("maintenance_name",t);const s=`${Ot.ENDPOINTS.GET_SERVICE_COVERAGE}?${a.toString()}`;return Ke.apiCall(s)})}getMaintenancesByAsset(t,a,s=20,o=0){return ge(this,null,function*(){const u=new URLSearchParams;u.append("asset_name",t),a&&u.append("filters",JSON.stringify(a)),u.append("limit",s.toString()),u.append("offset",o.toString());const c=`${Ot.ENDPOINTS.GET_MAINTENANCES_BY_ASSET}?${u.toString()}`;return Ke.apiCall(c)})}getActiveServiceContracts(t,a=20,s=0){return ge(this,null,function*(){const o=new URLSearchParams;t&&o.append("filters",JSON.stringify(t)),o.append("limit",a.toString()),o.append("offset",s.toString());const u=`${Ot.ENDPOINTS.GET_ACTIVE_SERVICE_CONTRACTS}?${o.toString()}`;return Ke.apiCall(u)})}}const Gd=new $9;function W9(e,t=20,a=0,s){const[o,u]=E.useState([]),[c,f]=E.useState(0),[p,g]=E.useState(!1),[x,v]=E.useState(!0),[_,k]=E.useState(null),[T,N]=E.useState(0),j=E.useRef(!1),P=JSON.stringify(e);E.useEffect(()=>{if(j.current&&_)return;let O=!1;return j.current=!0,ge(null,null,function*(){try{v(!0);const U=yield Gd.getAssetMaintenances(e,void 0,t,a,s);O||(u(U.asset_maintenances),f(U.total_count),g(U.has_more),k(null))}catch(U){if(!O){const H=U instanceof Error?U.message:"Failed to fetch PPM schedules";H.includes("417")||H.includes("Expectation Failed")||H.includes("has no attribute")?k("API endpoint not deployed. Please deploy ppm_api.py to your Frappe server."):k(H),u([]),f(0),g(!1)}}finally{O||v(!1)}}),()=>{O=!0}},[P,t,a,s,T]);const C=E.useCallback(()=>{j.current=!1,N(O=>O+1)},[]);return{ppms:o,totalCount:c,hasMore:p,loading:x,error:_,refetch:C}}function V9(e){const[t,a]=E.useState(null),[s,o]=E.useState(!0),[u,c]=E.useState(null),f=E.useCallback(()=>ge(null,null,function*(){if(!e){a(null),o(!1);return}try{o(!0),c(null);const g=yield Gd.getAssetMaintenanceDetails(e);a(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch PPM details")}finally{o(!1)}}),[e]);E.useEffect(()=>{f()},[f]);const p=E.useCallback(()=>{f()},[f]);return{ppm:t,loading:s,error:u,refetch:p}}function Zw(){const[e,t]=E.useState(!1),[a,s]=E.useState(null),o=E.useCallback(f=>ge(null,null,function*(){try{return t(!0),s(null),yield Gd.createAssetMaintenance(f)}catch(p){const g=p instanceof Error?p.message:"Failed to create PPM schedule";throw s(g),p}finally{t(!1)}}),[]),u=E.useCallback((f,p)=>ge(null,null,function*(){try{return t(!0),s(null),yield Gd.updateAssetMaintenance(f,p)}catch(g){const x=g instanceof Error?g.message:"Failed to update PPM schedule";throw s(x),g}finally{t(!1)}}),[]),c=E.useCallback(f=>ge(null,null,function*(){try{return t(!0),s(null),yield Gd.deleteAssetMaintenance(f)}catch(p){const g=p instanceof Error?p.message:"Failed to delete PPM schedule";throw s(g),p}finally{t(!1)}}),[]);return{createPPM:o,updatePPM:u,deletePPM:c,loading:e,error:a}}const G9=()=>{const{t:e}=ln(),t=Da(),[a,s]=E.useState(0),[o,u]=E.useState(""),[c,f]=E.useState(""),[p,g]=E.useState(null),[x,v]=E.useState(null),_=E.useRef(null),k=20,T=c?{company:c}:{},{ppms:N,totalCount:j,hasMore:P,loading:C,error:O,refetch:R}=W9(T,k,a*k,"creation desc"),{deletePPM:U,loading:H}=Zw();E.useEffect(()=>{const ue=te=>{_.current&&!_.current.contains(te.target)&&v(null)};return x&&document.addEventListener("mousedown",ue),()=>{document.removeEventListener("mousedown",ue)}},[x]);const B=()=>{t("/ppm/new")},oe=ue=>{t(`/ppm/${ue}`)},se=ue=>{t(`/ppm/${ue}`)},pe=ue=>ge(null,null,function*(){try{yield U(ue),g(null),R(),alert("PPM schedule deleted successfully!")}catch(te){alert(`Failed to delete: ${te instanceof Error?te.message:"Unknown error"}`)}}),le=ue=>{t(`/ppm/new?duplicate=${ue}`)},re=ue=>{const te=JSON.stringify(ue,null,2),V=new Blob([te],{type:"application/json"}),J=URL.createObjectURL(V),ne=document.createElement("a");ne.href=J,ne.download=`ppm_${ue.name}.json`,ne.click(),URL.revokeObjectURL(J)},de=()=>{const te=[["PPM ID","Company","Asset","Asset Type","Frequency","No. of PMs","Total Amount"].join(","),...N.map(ae=>[ae.name,ae.company||"",ae.asset_name||"",ae.custom_asset_type||"",ae.custom_frequency||"",ae.custom_no_of_pms||"",ae.custom_total_amount||""].join(","))].join(`
`),V=new Blob([te],{type:"text/csv"}),J=URL.createObjectURL(V),ne=document.createElement("a");ne.href=J,ne.download=`ppm_schedules_${new Date().toISOString().split("T")[0]}.csv`,ne.click(),URL.revokeObjectURL(J)};if(C&&a===0)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:e("listPages.loading")})]})});if(O)return r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ PPM API Not Available"}),r.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"The PPM API endpoint is not deployed yet."})}),r.jsxs("div",{className:"mt-4 flex gap-3",children:[r.jsx("button",{onClick:()=>t("/ppm/new"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Creating New (Demo)"}),r.jsx("button",{onClick:R,className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]}),r.jsx("div",{className:"mt-4 p-4 bg-white dark:bg-gray-800 rounded border border-yellow-300 dark:border-yellow-700",children:r.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[r.jsx("strong",{children:"Technical Error:"})," ",O]})})]})});const ye=N.filter(ue=>{var te,V,J,ne;return((te=ue.name)==null?void 0:te.toLowerCase().includes(o.toLowerCase()))||((V=ue.asset_name)==null?void 0:V.toLowerCase().includes(o.toLowerCase()))||((J=ue.company)==null?void 0:J.toLowerCase().includes(o.toLowerCase()))||((ne=ue.custom_asset_type)==null?void 0:ne.toLowerCase().includes(o.toLowerCase()))});return r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("ppm.title")}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",j," PPM schedule",j!==1?"s":""]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:de,className:"bg-green-600 hover:bg-green-700 text-white px-4 py-3 rounded-lg flex items-center gap-2 shadow transition-all",disabled:N.length===0,children:[r.jsx(ui,{}),r.jsx("span",{className:"font-medium",children:e("listPages.export")})]}),r.jsxs("button",{onClick:B,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(fi,{}),r.jsx("span",{className:"font-medium",children:e("ppm.addPPM")})]})]})]}),r.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:r.jsxs("div",{className:"flex items-center gap-2 border border-gray-300 dark:border-gray-600 rounded-lg px-4 py-2 bg-white dark:bg-gray-700",children:[r.jsx(Ps,{className:"text-gray-400 dark:text-gray-500"}),r.jsx("input",{type:"text",placeholder:"Search by ID, asset, company...",value:o,onChange:ue=>u(ue.target.value),className:"flex-1 outline-none text-gray-700 dark:text-gray-200 bg-transparent"})]})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:r.jsx("input",{type:"text",placeholder:"Filter by Company",value:c,onChange:ue=>{f(ue.target.value),s(0)},className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500"})})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden",children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"PPM ID"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Company"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Asset"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Asset Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Frequency"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"No. of PMs"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Total Amount"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:ye.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:8,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Ps,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:"No PPM schedules found"}),r.jsx("button",{onClick:B,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Create your first PPM schedule"})]})})}):ye.map(ue=>r.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors cursor-pointer",onClick:()=>oe(ue.name),children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:ue.name})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(i6,{className:"text-gray-400"}),r.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:ue.company||"-"})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:ue.asset_name||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:ue.custom_asset_type||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(__,{className:"text-blue-500"}),r.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:ue.custom_frequency||"-"})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:ue.custom_no_of_pms||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:ue.custom_total_amount?`$${ue.custom_total_amount.toLocaleString()}`:"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"relative",onClick:te=>te.stopPropagation(),children:[r.jsx("button",{onClick:()=>v(x===ue.name?null:ue.name),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700",children:r.jsx(lu,{})}),x===ue.name&&r.jsxs("div",{ref:_,className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded-lg shadow-lg z-10 border border-gray-200 dark:border-gray-700",children:[r.jsxs("button",{onClick:()=>{oe(ue.name),v(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(Nc,{}),"View"]}),r.jsxs("button",{onClick:()=>{se(ue.name),v(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(Tn,{}),"Edit"]}),r.jsxs("button",{onClick:()=>{le(ue.name),v(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(ou,{}),"Duplicate"]}),r.jsxs("button",{onClick:()=>{re(ue),v(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(ui,{}),"Export"]}),r.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700"}),r.jsxs("button",{onClick:()=>{g(ue.name),v(null)},className:"w-full text-left px-4 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center gap-2",children:[r.jsx(Xa,{}),"Delete"]})]})]})})]},ue.name))})]})}),(P||a>0)&&r.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[r.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",a*k+1," to ",Math.min((a+1)*k,j)," of ",j," results"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>s(Math.max(0,a-1)),disabled:a===0,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),r.jsx("button",{onClick:()=>s(a+1),disabled:!P,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]}),p&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4",children:[r.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-white mb-4",children:"Confirm Delete"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"Are you sure you want to delete this PPM schedule? This action cannot be undone."}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>g(null),className:"px-4 py-2 text-gray-700 dark:text-gray-300 bg-gray-200 dark:bg-gray-700 rounded-lg hover:bg-gray-300 dark:hover:bg-gray-600",children:"Cancel"}),r.jsx("button",{onClick:()=>pe(p),disabled:H,className:"px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50",children:H?"Deleting...":"Delete"})]})]})})]})},Z9=()=>{const{ppmName:e}=_c(),t=Da(),[a]=rl(),s=a.get("duplicate"),o=e==="new",u=o&&!!s,{ppm:c,loading:f,error:p,refetch:g}=V9(u?s:o?null:e||null),{createPPM:x,updatePPM:v,loading:_}=Zw(),[k,T]=E.useState(o),[N,j]=E.useState({company:"",asset_name:"",custom_asset_type:"",maintenance_team:"",custom_frequency:"",custom_total_amount:0,custom_no_of_pms:0,custom_price_per_pm:0});E.useEffect(()=>{c&&j({company:c.company||"",asset_name:c.asset_name||"",custom_asset_type:c.custom_asset_type||"",maintenance_team:c.maintenance_team||"",custom_frequency:c.custom_frequency||"",custom_total_amount:c.custom_total_amount||0,custom_no_of_pms:c.custom_no_of_pms||0,custom_price_per_pm:c.custom_price_per_pm||0})},[c,u]);const P=O=>{const{name:R,value:U}=O.target;j(H=>Le(ie({},H),{[R]:R.includes("amount")||R.includes("pms")||R.includes("price")?parseFloat(U)||0:U}))},C=O=>ge(null,null,function*(){var R;if(O.preventDefault(),!N.asset_name){alert("Please enter Asset Name");return}try{if(o||u){const U=yield x(N);alert(u?"PPM schedule duplicated successfully!":"PPM schedule created successfully!"),(R=U.asset_maintenance)!=null&&R.name?t(`/ppm/${U.asset_maintenance.name}`):(g(),t("/ppm"))}else e&&(yield v(e,N),alert("PPM schedule updated successfully!"),T(!1),g())}catch(U){console.error("PPM save error:",U),alert("Failed to save: "+(U instanceof Error?U.message:"Unknown error"))}});return f?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading PPM schedule..."})]})}):p&&!o&&!u?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",p]}),r.jsx("button",{onClick:()=>t("/ppm"),className:"mt-2 text-red-700 dark:text-red-400 underline hover:text-red-800 dark:hover:text-red-300",children:"Back to PPM schedules"})]})}):r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsx("div",{className:"flex items-center gap-4",children:r.jsxs("button",{onClick:()=>t("/ppm"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[r.jsx(no,{}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:u?"Duplicate PPM Schedule":o?"New PPM Schedule":"PPM Schedule Details"})]})}),r.jsx("div",{className:"flex items-center gap-3",children:!o&&!k&&r.jsxs("button",{onClick:()=>T(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(Tn,{}),"Edit"]})})]}),r.jsxs("form",{onSubmit:C,children:[r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Company *"}),k?r.jsx("input",{type:"text",name:"company",value:N.company,onChange:P,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.company)||"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Asset Name *"}),k?r.jsx("input",{type:"text",name:"asset_name",value:N.asset_name,onChange:P,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.asset_name)||"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Asset Type"}),k?r.jsx("input",{type:"text",name:"custom_asset_type",value:N.custom_asset_type,onChange:P,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.custom_asset_type)||"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Maintenance Team"}),k?r.jsx("input",{type:"text",name:"maintenance_team",value:N.maintenance_team,onChange:P,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.maintenance_team)||"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Frequency"}),k?r.jsx("input",{type:"text",name:"custom_frequency",value:N.custom_frequency,onChange:P,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"e.g., Monthly, Quarterly, Yearly"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.custom_frequency)||"-"})})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"Financial Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Number of PMs"}),k?r.jsx("input",{type:"number",name:"custom_no_of_pms",value:N.custom_no_of_pms,onChange:P,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",min:"0"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.custom_no_of_pms)||"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Price per PM"}),k?r.jsx("input",{type:"number",name:"custom_price_per_pm",value:N.custom_price_per_pm,onChange:P,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",min:"0",step:"0.01"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:c!=null&&c.custom_price_per_pm?`$${c.custom_price_per_pm.toLocaleString()}`:"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Total Amount"}),k?r.jsx("input",{type:"number",name:"custom_total_amount",value:N.custom_total_amount,onChange:P,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",min:"0",step:"0.01"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white font-semibold",children:c!=null&&c.custom_total_amount?`$${c.custom_total_amount.toLocaleString()}`:"-"})})]})]})]})]}),r.jsx("div",{className:"lg:col-span-1",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Schedule Information"}),!o&&c&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"PPM ID"}),r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:c.name})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),r.jsx("p",{className:"text-xs text-gray-900 dark:text-white",children:c.creation?new Date(c.creation).toLocaleString():"-"})]})]}),o&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx(Lg,{className:"text-4xl text-gray-400 dark:text-gray-500 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Schedule information will appear after creation"})]})]})})]}),k&&r.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[r.jsx("button",{type:"button",onClick:()=>{o?t("/ppm"):(T(!1),c&&j({company:c.company||"",asset_name:c.asset_name||"",custom_asset_type:c.custom_asset_type||"",maintenance_team:c.maintenance_team||"",custom_frequency:c.custom_frequency||"",custom_total_amount:c.custom_total_amount||0,custom_no_of_pms:c.custom_no_of_pms||0,custom_price_per_pm:c.custom_price_per_pm||0}))},className:"px-6 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:"Cancel"}),r.jsxs("button",{type:"submit",disabled:_,className:"px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(Wn,{}),_?"Saving...":o?"Create":"Save Changes"]})]})]})]})};class q9{submitDocument(t,a){return ge(this,null,function*(){try{const s=yield this.fetchWithTimeout(`${Ot.BASE_URL}/api/resource/PM Schedule Generator/${encodeURIComponent(t)}`,{method:"GET",headers:{Accept:"application/json"},credentials:"include"},3e4);if(!s.ok){const f=yield s.text();console.warn("Failed to fetch document for submit:",f);return}const u=(yield s.json()).data;if(!u){console.warn("No document data received");return}const c=yield this.fetchWithTimeout(`${Ot.BASE_URL}/api/method/frappe.client.submit`,{method:"POST",headers:a,credentials:"include",body:JSON.stringify({doc:u})},6e4);if(c.ok)console.log("✅ Document submitted successfully");else{const f=yield c.text();console.warn("Failed to submit document:",f)}}catch(s){console.warn("Error submitting document:",s.message)}})}fetchWithTimeout(t,a,s=12e4){return ge(this,null,function*(){var c,f;const o=new AbortController,u=setTimeout(()=>o.abort(),s);try{const p=yield fetch(t,Le(ie({},a),{signal:o.signal}));return clearTimeout(u),p}catch(p){throw clearTimeout(u),p.name==="AbortError"?new Error(`Request timeout after ${s}ms. The server may be slow or the request is too large.`):(c=p.message)!=null&&c.includes("Failed to fetch")||(f=p.message)!=null&&f.includes("ERR_CONNECTION_TIMED_OUT")?new Error(`Connection timeout. Please check:
1. Your internet connection
2. Server is accessible
3. Try with fewer assets`):p}})}getFilteredAssets(t){return ge(this,null,function*(){const a=[];t.modality&&a.push(["custom_modality","=",t.modality]),t.asset_type&&a.push(["custom_asset_type","=",t.asset_type]),t.department&&a.push(["department","=",t.department]),t.location&&a.push(["location","=",t.location]),t.manufacturer&&a.push(["custom_manufacturer","=",t.manufacturer]),t.model&&a.push(["custom_model","=",t.model]);const s=JSON.stringify(a),o=JSON.stringify(["name","asset_name","custom_asset_type","department","location","custom_manufacturer","custom_model","custom_modality","company"]),u=yield Ke.apiCall(`/api/resource/Asset?filters=${encodeURIComponent(s)}&fields=${encodeURIComponent(o)}&limit_page_length=1000`);return(u==null?void 0:u.data)||[]})}createBulkMaintenanceSchedules(t){return ge(this,null,function*(){var u,f,p,g,x,v;if(!t.hospital)throw new Error("Hospital/Company is required to create PM Schedule Generator");if(!t.periodicity)throw new Error("Periodicity is required");if(t.asset_names.length===0)throw new Error("At least one asset must be selected");t.asset_names.length>50&&console.warn(`Creating schedules for ${t.asset_names.length} assets. This may take a while...`);const a={doctype:"PM Schedule Generator",hospital:t.hospital,start_date:t.start_date,end_date:t.end_date,periodicity:t.periodicity,pm_for:t.pm_for||null,no_of_pms:t.no_of_pms||null,maintenance_team:t.maintenance_team||null,maintenance_manager:t.maintenance_manager||null,assign_to:t.assign_to||null,modality:t.modality||null,manufacturer:t.manufacturer||null,model:t.model||null,department:t.department||null,maintenance_entries:t.asset_names.map(_=>({doctype:"PM Entry Line",asset:_,start_date:t.start_date,end_date:t.end_date}))};console.log("Creating PM Schedule Generator with document:",JSON.stringify(a,null,2));const s=yield Ke.getCSRFToken(),o={"Content-Type":"application/json",Accept:"application/json"};s&&(o["X-Frappe-CSRF-Token"]=s);try{const _=yield this.fetchWithTimeout(`${Ot.BASE_URL}/api/method/frappe.client.insert`,{method:"POST",headers:o,credentials:"include",body:JSON.stringify({doc:a})},12e4),k=yield _.text();if(console.log("frappe.client.insert response:",k),!_.ok)throw new Error(`HTTP ${_.status}: ${k}`);const T=JSON.parse(k),N=(u=T==null?void 0:T.message)==null?void 0:u.name;if(N)return console.log("✅ PM Schedule Generator created successfully:",N),yield this.submitDocument(N,o),{success:!0,created:t.asset_names.length,document:N,message:`PM Schedule Generator "${N}" created and submitted with ${t.asset_names.length} assets`};throw new Error("No document name in response")}catch(_){console.warn("Method 1 (frappe.client.insert) failed:",_.message);try{const c=a,{doctype:k,maintenance_entries:T}=c,N=tn(c,["doctype","maintenance_entries"]),j=Le(ie({},N),{maintenance_entries:T.map(B=>{var oe=B,{doctype:U}=oe,H=tn(oe,["doctype"]);return H})});console.log("Trying Resource API with:",JSON.stringify(j,null,2));const P=yield this.fetchWithTimeout(`${Ot.BASE_URL}/api/resource/PM%20Schedule%20Generator`,{method:"POST",headers:o,credentials:"include",body:JSON.stringify(j)},12e4),C=yield P.text();if(console.log("Resource API response:",C),!P.ok)throw new Error(`HTTP ${P.status}: ${C}`);const O=JSON.parse(C),R=(f=O==null?void 0:O.data)==null?void 0:f.name;if(R)return console.log("✅ PM Schedule Generator created via Resource API:",R),yield this.submitDocument(R,o),{success:!0,created:t.asset_names.length,document:R,message:`PM Schedule Generator "${R}" created and submitted with ${t.asset_names.length} assets`};throw new Error("No document name in response")}catch(k){console.warn("Method 2 (Resource API) failed:",k.message);const T=[];throw(((p=_==null?void 0:_.message)==null?void 0:p.includes("timeout"))||((g=_==null?void 0:_.message)==null?void 0:g.includes("Failed to fetch")))&&(((x=k==null?void 0:k.message)==null?void 0:x.includes("timeout"))||((v=k==null?void 0:k.message)==null?void 0:v.includes("Failed to fetch")))?T.push(`⚠️ Connection timeout detected. This usually means:
• The server is taking too long to process ${t.asset_names.length} assets
• Network connection is slow or unstable
• Server may be overloaded
💡 Suggestions:
• Try with fewer assets (10-20 at a time)
• Check your internet connection
• Try again later if server is busy`):(T.push("Failed to create PM Schedule Generator. Errors:"),_!=null&&_.message&&T.push(`• frappe.client.insert: ${_.message.substring(0,150)}`),k!=null&&k.message&&T.push(`• Resource API: ${k.message.substring(0,150)}`),T.push(`
Please ensure:
1. Hospital (${t.hospital}) is valid
2. You have permission to create PM Schedule Generator
3. All required fields are filled (including PM Name and Assign To)`)),new Error(`Failed to create PM Schedule Generator.
${T.join(`
`)}`)}}})}getFilterOptions(){return ge(this,null,function*(){try{const t=yield Ke.apiCall(`/api/resource/Asset?fields=${encodeURIComponent(JSON.stringify(["custom_modality","custom_asset_type","department","location","custom_manufacturer","custom_model"]))}&limit_page_length=1000`),a=(t==null?void 0:t.data)||[];return{modalities:[...new Set(a.map(o=>o.custom_modality).filter(Boolean))],assetTypes:[...new Set(a.map(o=>o.custom_asset_type).filter(Boolean))],departments:[...new Set(a.map(o=>o.department).filter(Boolean))],locations:[...new Set(a.map(o=>o.location).filter(Boolean))],manufacturers:[...new Set(a.map(o=>o.custom_manufacturer).filter(Boolean))],models:[...new Set(a.map(o=>o.custom_model).filter(Boolean))],company:[...new Set(a.map(o=>o.company).filter(Boolean))]}}catch(t){return console.error("Error fetching filter options:",t),{modalities:[],assetTypes:[],departments:[],locations:[],manufacturers:[],models:[],company:[]}}})}getMaintenanceTeams(){return ge(this,null,function*(){try{const t=yield Ke.apiCall(`/api/resource/Asset Maintenance Team?fields=${encodeURIComponent(JSON.stringify(["name"]))}&limit_page_length=1000`);return t!=null&&t.data&&t.data.length>0?t.data.map(a=>({name:a.name,maintenance_team_name:a.name})):[]}catch(t){return console.warn("Could not fetch maintenance teams:",(t==null?void 0:t.message)||"Unknown error"),[]}})}getMaintenanceTeamDetails(t){return ge(this,null,function*(){try{const a=yield Ke.apiCall(`/api/resource/Asset Maintenance Team/${encodeURIComponent(t)}`);if(a!=null&&a.data){const s=a.data,o=[];return s.maintenance_team_members&&Array.isArray(s.maintenance_team_members)&&s.maintenance_team_members.forEach(u=>{u.team_member&&o.push(u.team_member)}),{name:s.name,maintenance_manager:s.maintenance_manager||void 0,team_members:o.length>0?o:void 0}}return null}catch(a){return console.warn("Could not fetch maintenance team details:",(a==null?void 0:a.message)||"Unknown error"),null}})}}const J0=new q9,Y9=()=>{const{t:e}=ln(),t=Da(),[a,s]=E.useState({}),[o,u]=E.useState([]),[c,f]=E.useState({start_date:"",end_date:"",maintenance_team:"",assign_to:"",pm_for:"",maintenance_manager:"",periodicity:"Monthly",maintenance_type:"Preventive",no_of_pms:"",department:""}),[p,g]=E.useState(!1),[x,v]=E.useState(!1),[_,k]=E.useState([]),[T,N]=E.useState({modalities:[],assetTypes:[],departments:[],locations:[],manufacturers:[],models:[],company:[]}),[j,P]=E.useState([]),[C,O]=E.useState(""),[R,U]=E.useState(null);E.useEffect(()=>{B(),oe()},[]);const H=(V,J,ne)=>{if(!V||!J||!ne)return null;const ae=parseInt(ne,10);if(isNaN(ae)||ae<1)return null;const z=ae-1;if(z<0)return null;const D=new Date(V),G=new Date(D);switch(J){case"Daily":G.setDate(G.getDate()+z);break;case"Weekly":G.setDate(G.getDate()+z*7);break;case"Monthly":G.setMonth(G.getMonth()+z);break;case"Quarterly":G.setMonth(G.getMonth()+z*3);break;case"Half-yearly":G.setMonth(G.getMonth()+z*6);break;case"Yearly":G.setFullYear(G.getFullYear()+z);break;case"2 Yearly":G.setFullYear(G.getFullYear()+z*2);break;case"3 Yearly":G.setFullYear(G.getFullYear()+z*3);break;default:return null}const q=G.getFullYear(),K=String(G.getMonth()+1).padStart(2,"0"),fe=String(G.getDate()).padStart(2,"0");return`${q}-${K}-${fe}`};E.useEffect(()=>{ge(null,null,function*(){if(c.maintenance_team){const J=yield J0.getMaintenanceTeamDetails(c.maintenance_team);J&&f(ne=>Le(ie({},ne),{maintenance_manager:J.maintenance_manager||"",assign_to:J.team_members&&J.team_members.length===1?J.team_members[0]:ne.assign_to}))}else f(J=>Le(ie({},J),{maintenance_manager:"",assign_to:""}))})},[c.maintenance_team]),E.useEffect(()=>{if(c.start_date&&c.periodicity&&c.no_of_pms){const V=H(c.start_date,c.periodicity,c.no_of_pms);V&&f(J=>Le(ie({},J),{end_date:V}))}},[c.start_date,c.periodicity,c.no_of_pms]);const B=()=>ge(null,null,function*(){const V=yield J0.getFilterOptions();N(V)}),oe=()=>ge(null,null,function*(){const V=yield J0.getMaintenanceTeams();P(V)}),se=()=>ge(null,null,function*(){v(!0);try{const V=new URLSearchParams;a.company&&V.append("company",a.company),a.custom_modality&&V.append("custom_modality",a.custom_modality),a.custom_manufacturer&&V.append("custom_manufacturer",a.custom_manufacturer),a.custom_device_status&&V.append("custom_device_status",a.custom_device_status),a.custom_model&&V.append("custom_model",a.custom_model),a.department&&V.append("department",a.department);const J=yield fetch(`/api/method/get_assets?${V.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(!J.ok)throw new Error(`HTTP error! status: ${J.status}`);const ae=(yield J.json()).message||[];k(ae),u([])}catch(V){console.error("Error fetching assets:",V),alert("Failed to fetch assets: "+(V instanceof Error?V.message:"Unknown error"))}finally{v(!1)}}),pe=(V,J)=>{s(ne=>Le(ie({},ne),{[V]:J||void 0}))},le=V=>{u(J=>J.includes(V)?J.filter(ne=>ne!==V):[...J,V])},re=()=>{const V=de();o.length===V.length&&V.length>0?u([]):u(V.map(J=>J.name))},de=()=>{if(!C)return _;const V=C.toLowerCase();return _.filter(J=>{var ne,ae,z,D,G,q;return((ne=J.asset_name)==null?void 0:ne.toLowerCase().includes(V))||((ae=J.custom_modality)==null?void 0:ae.toLowerCase().includes(V))||((z=J.company)==null?void 0:z.toLowerCase().includes(V))||((D=J.custom_manufacturer)==null?void 0:D.toLowerCase().includes(V))||((G=J.custom_model)==null?void 0:G.toLowerCase().includes(V))||((q=J.custom_device_status)==null?void 0:q.toLowerCase().includes(V))})},ye=()=>ge(null,null,function*(){if(o.length===0){alert("Please select at least one asset");return}if(!a.company){alert("Please select a Hospital/Company in the filters first");return}if(!c.pm_for){alert("Please enter a PM Name");return}if(!c.start_date||!c.end_date){alert("Please select start and end dates");return}if(new Date(c.start_date)>new Date(c.end_date)){alert("Start date must be before end date");return}if(!c.assign_to){alert("Please assign the task to a team member. This is required for Asset Maintenance creation.");return}if(window.confirm(`Are you sure you want to create maintenance schedules for ${o.length} asset(s)?`)){g(!0);try{const J={asset_names:o,start_date:c.start_date,end_date:c.end_date,maintenance_team:c.maintenance_team||void 0,assign_to:c.assign_to||void 0,maintenance_manager:c.maintenance_manager||void 0,periodicity:c.periodicity,maintenance_type:c.maintenance_type,no_of_pms:c.no_of_pms||void 0,pm_for:c.pm_for||void 0,hospital:a.company,modality:a.custom_modality,manufacturer:a.custom_manufacturer,model:a.custom_model,department:c.department||a.department||void 0},ne=yield J0.createBulkMaintenanceSchedules(J);U({show:!0,document:ne.document,schedules:ne.schedules,count:ne.created||o.length,type:"pm_schedule"}),u([]),f({start_date:"",end_date:"",maintenance_team:"",assign_to:"",pm_for:"",maintenance_manager:"",periodicity:"Monthly",maintenance_type:"Preventive",no_of_pms:""})}catch(J){console.error("Error creating schedules:",J);const ne=J instanceof Error?J.message:"Unknown error";alert(`Failed to create maintenance schedules:
${ne}`)}finally{g(!1)}}}),ue=de(),te=Object.values(a).some(V=>V);return r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex items-center gap-4",children:[r.jsxs("button",{onClick:()=>t("/ppm-planner"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[r.jsx(no,{}),r.jsx("span",{children:"Back to PPM Planner"})]}),r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:"PPM Planner - Bulk Schedule Generator"})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 mb-6",children:[r.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white",children:[r.jsx(Ko,{})," Filter Assets"]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[r.jsx("div",{children:r.jsx(St,{label:"Hospital/Company *",doctype:"Company",value:a.company||"",onChange:V=>pe("company",V),placeholder:"Select a hospital/company"})}),r.jsx("div",{children:r.jsx(St,{label:"Modality",doctype:"Modality",value:a.custom_modality||"",onChange:V=>pe("custom_modality",V),placeholder:"Leave empty for all modalities"})}),r.jsx("div",{children:r.jsx(St,{label:"Manufacturer",doctype:"Manufacturer",value:a.custom_manufacturer||"",onChange:V=>pe("custom_manufacturer",V),placeholder:"Leave empty for all manufacturers"})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Device Status"}),r.jsxs("select",{value:a.custom_device_status||"",onChange:V=>pe("custom_device_status",V.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"",children:"All Statuses"}),r.jsx("option",{value:"Active",children:"Active"}),r.jsx("option",{value:"Inactive",children:"Inactive"}),r.jsx("option",{value:"Under Maintenance",children:"Under Maintenance"}),r.jsx("option",{value:"Decommissioned",children:"Decommissioned"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Model"}),r.jsxs("select",{value:a.custom_model||"",onChange:V=>pe("custom_model",V.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"",children:"Select Model (optional)"}),T.models.map(V=>r.jsx("option",{value:V,children:V},V))]})]}),r.jsx("div",{children:r.jsx(St,{label:"Department",doctype:"Department",value:a.department||"",onChange:V=>pe("department",V),placeholder:"Select department (optional)"})})]}),r.jsxs("div",{className:"mt-4 flex gap-3",children:[r.jsx("button",{onClick:se,disabled:x,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:x?r.jsxs(r.Fragment,{children:[r.jsx(ds,{className:"animate-spin"}),"Loading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ps,{}),"Fetch Assets"]})}),te&&r.jsx("button",{onClick:()=>{s({}),k([]),u([])},className:"bg-gray-600 hover:bg-gray-700 text-white px-6 py-2 rounded-lg",children:"Clear Filters"})]})]}),_.length>0&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 mb-6",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsxs("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white",children:["Select Assets (",o.length," of ",_.length," selected)"]}),r.jsxs("div",{className:"flex gap-3 items-center",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Ps,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),r.jsx("input",{type:"text",placeholder:"Search assets...",value:C,onChange:V=>O(V.target.value),className:"pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsx("button",{onClick:re,className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 px-4 py-2 border border-blue-600 dark:border-blue-400 rounded-lg",children:o.length===ue.length&&ue.length>0?"Deselect All":"Select All"})]})]}),r.jsx("div",{className:"max-h-96 overflow-y-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 sticky top-0",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:r.jsx("input",{type:"checkbox",checked:o.length===ue.length&&ue.length>0,onChange:re,className:"rounded"})}),r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Asset Name"}),r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Modality"}),r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Manufacturer"}),r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Model"}),r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Status"})]})}),r.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:ue.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:6,className:"p-6 text-center text-gray-500 dark:text-gray-400",children:"No assets match your search criteria"})}):ue.map(V=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${o.includes(V.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,children:[r.jsx("td",{className:"p-3",children:r.jsx("input",{type:"checkbox",checked:o.includes(V.name),onChange:()=>le(V.name),className:"rounded"})}),r.jsx("td",{className:"p-3 text-sm text-gray-900 dark:text-white font-medium",children:V.asset_name}),r.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:V.custom_modality||"-"}),r.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:V.custom_manufacturer||"-"}),r.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:V.custom_model||"-"}),r.jsx("td",{className:"p-3 text-sm",children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${V.custom_device_status==="Active"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":V.custom_device_status==="Inactive"?"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}`,children:V.custom_device_status||"-"})})]},V.name))})]})})]}),o.length>0&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 mb-6",children:[r.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white",children:[r.jsx(af,{})," Schedule Configuration"]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"PPM Name *"}),r.jsx("input",{type:"text",value:c.pm_for,onChange:V=>f(J=>Le(ie({},J),{pm_for:V.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"Enter PM Name",required:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"First PPM Date *"}),r.jsx("input",{type:"date",value:c.start_date,onChange:V=>f(J=>Le(ie({},J),{start_date:V.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Periodicity *"}),r.jsxs("select",{value:c.periodicity,onChange:V=>f(J=>Le(ie({},J),{periodicity:V.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"Daily",children:"Daily"}),r.jsx("option",{value:"Weekly",children:"Weekly"}),r.jsx("option",{value:"Monthly",children:"Monthly"}),r.jsx("option",{value:"Quarterly",children:"Quarterly"}),r.jsx("option",{value:"Half-yearly",children:"Half-yearly"}),r.jsx("option",{value:"Yearly",children:"Yearly"}),r.jsx("option",{value:"2 Yearly",children:"2 Yearly"}),r.jsx("option",{value:"3 Yearly",children:"3 Yearly"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Maintenance Type"}),r.jsxs("select",{value:c.maintenance_type,onChange:V=>f(J=>Le(ie({},J),{maintenance_type:V.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"Preventive",children:"Preventive"}),r.jsx("option",{value:"Corrective",children:"Corrective"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"No. of PMs"}),r.jsx("input",{type:"number",value:c.no_of_pms,onChange:V=>f(J=>Le(ie({},J),{no_of_pms:V.target.value})),min:"1",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"Enter number of PMs"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"End date will be auto-calculated"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Last PPM Date *"}),r.jsx("input",{type:"date",value:c.end_date,onChange:V=>f(J=>Le(ie({},J),{end_date:V.target.value})),min:c.start_date,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0})]}),r.jsxs("div",{children:[r.jsx(St,{label:"Maintenance Team",doctype:"Asset Maintenance Team",value:c.maintenance_team,onChange:V=>f(J=>Le(ie({},J),{maintenance_team:V}))}),c.maintenance_manager&&r.jsxs("div",{className:"mt-2 p-2 bg-blue-50 dark:bg-blue-900/20 rounded text-xs text-gray-600 dark:text-gray-400",children:[r.jsx("span",{className:"font-medium",children:"Maintenance Manager:"})," ",c.maintenance_manager]})]}),r.jsxs("div",{children:[r.jsx(St,{label:"Assign To *",doctype:"User",value:c.assign_to,onChange:V=>f(J=>Le(ie({},J),{assign_to:V})),placeholder:c.maintenance_team?"Select user (auto-selected if only one team member)":"Select user to assign tasks"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Required for Asset Maintenance creation"}),c.assign_to&&r.jsxs("div",{className:"mt-1 p-2 bg-green-50 dark:bg-green-900/20 rounded text-xs text-gray-600 dark:text-gray-400",children:[r.jsx("span",{className:"font-medium",children:"Assigned To:"})," ",c.assign_to]})]}),r.jsx("div",{children:r.jsx(St,{label:"Department",doctype:"Department",value:c.department,onChange:V=>f(J=>Le(ie({},J),{department:V})),placeholder:"Select department (optional)"})})]}),r.jsx("button",{onClick:ye,disabled:p||!c.start_date||!c.end_date||!c.pm_for||!c.assign_to,className:"mt-6 bg-green-600 hover:bg-green-700 text-white px-6 py-3 rounded-lg flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed font-medium",children:p?r.jsxs(r.Fragment,{children:[r.jsx(ds,{className:"animate-spin"}),"Creating Schedules..."]}):r.jsxs(r.Fragment,{children:[r.jsx($n,{}),"Generate Maintenance Schedules (",o.length," asset",o.length!==1?"s":"",")"]})})]}),_.length===0&&!x&&!(R!=null&&R.show)&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-12 text-center",children:[r.jsx(Ko,{className:"mx-auto text-4xl text-gray-400 dark:text-gray-600 mb-4"}),r.jsx("h3",{className:"text-lg font-semibold text-gray-700 dark:text-gray-300 mb-2",children:"No Assets Loaded"}),r.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:'Use the filters above to search for assets, then click "Fetch Assets" to load them.'}),r.jsx("p",{className:"text-sm text-blue-600 dark:text-blue-400",children:"Note: Only submitted assets without existing maintenance schedules will be shown."})]}),(R==null?void 0:R.show)&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl max-w-lg w-full p-6",children:[r.jsxs("div",{className:"text-center mb-6",children:[r.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mx-auto mb-4",children:r.jsx($n,{className:"text-green-600 dark:text-green-400 text-3xl"})}),r.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Schedules Created Successfully!"}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400",children:[R.count," maintenance schedule",R.count!==1?"s":""," have been created."]})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 mb-6",children:[r.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"What was created:"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Document:"}),r.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-400",children:R.document})]}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:["A PM Schedule Generator document has been created with ",R.count," asset(s). Frappe will automatically create Asset Maintenance Logs when the document is submitted. You can view and manage it in the PPM Planner section."]})]})]}),r.jsxs("div",{className:"flex flex-col gap-3",children:[R.document&&r.jsxs("button",{onClick:()=>{t(`/ppm-planner/${R.document}`),U(null)},className:"w-full bg-blue-600 hover:bg-blue-700 text-white px-4 py-3 rounded-lg font-medium text-center flex items-center justify-center gap-2",children:[r.jsx(af,{}),"View PPM Planner"]}),r.jsxs("button",{onClick:()=>t("/maintenance-calendar"),className:"w-full bg-purple-600 hover:bg-purple-700 text-white px-4 py-3 rounded-lg font-medium flex items-center justify-center gap-2",children:[r.jsx(af,{}),"View Calendar"]}),r.jsx("button",{onClick:()=>U(null),className:"w-full bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 px-4 py-3 rounded-lg font-medium",children:"Create More Schedules"})]})]})})]})};function Lp(e={},t=20,a=0,s="creation desc",o={}){const[u,c]=E.useState([]),[f,p]=E.useState(0),[g,x]=E.useState(!1),[v,_]=E.useState(!0),[k,T]=E.useState(null),[N,j]=E.useState(0),P=JSON.stringify(e),C=JSON.stringify(o);E.useEffect(()=>{let R=!1;const U=P,H=C,B=t,oe=a,se=s;return ge(null,null,function*(){try{_(!0),T(null);let le={},re={};try{le=U?JSON.parse(U):{}}catch(ue){le={}}try{re=H?JSON.parse(H):{}}catch(ue){re={}}const de=ie(ie({},le),re),ye=yield Ke.apiCall("/api/method/asset_lite.api.ppm_generator_api.get_pm_schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filters:JSON.stringify(de),limit:B,offset:oe,order_by:se,include_child_tables:!0,fields:JSON.stringify(["name","pm_for","hospital","modality","periodicity","start_date","end_date","due_date"])})});if(!R){const ue=(ye==null?void 0:ye.message)||ye;if(ue&&ue.pm_schedules){const te=ue.pm_schedules||[];if(console.log("[usePMSchedules] Loaded",te.length,"PM Schedules"),te.length>0){const V=te[0];console.log("[usePMSchedules] 🔍 FIRST SCHEDULE FIELDS:",{name:V.name,pm_for:V.pm_for,"pm_for (bracket)":V.pm_for,allKeys:Object.keys(V),allKeysList:Object.keys(V).join(", "),fullObject:V})}c(te),p(ue.total_count||0),x(ue.has_more||!1)}else console.warn("[usePMSchedules] No pm_schedules in response:",ye),c([]),p(0),x(!1)}}catch(le){R||(console.error("Error fetching PM Schedules:",le),T(le instanceof Error?le.message:"Failed to fetch PM Schedules"),c([]),p(0))}finally{R||_(!1)}}),()=>{R=!0}},[P,C,t,a,s,N]);const O=E.useCallback(()=>{j(R=>R+1)},[]);return{pmSchedules:u,totalCount:f,hasMore:g,loading:v,error:k,refetch:O}}function X9(e){const[t,a]=E.useState(null),[s,o]=E.useState(!0),[u,c]=E.useState(null),f=E.useCallback(()=>ge(null,null,function*(){if(!e){a(null),o(!1);return}o(!0),c(null);try{const p=yield Ke.apiCall("/api/method/asset_lite.api.ppm_generator_api.get_pm_schedule_details",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:e})});if(console.log("[usePMScheduleDetails] API Response:",p),p&&p.name&&!p.error)console.log("[usePMScheduleDetails] Setting PM Schedule:",p),a(p);else{const g=(p==null?void 0:p.error)||"PM Schedule not found";console.warn("[usePMScheduleDetails] Error or not found:",g),c(g),a(null)}}catch(p){console.error("Error fetching PM Schedule details:",p),c(p instanceof Error?p.message:"Failed to fetch PM Schedule"),a(null)}finally{o(!1)}}),[e]);return E.useEffect(()=>{f()},[f]),{pmSchedule:t,loading:s,error:u,refetch:f}}function qw(){const[e,t]=E.useState(!1);return{createPMSchedule:x=>ge(null,null,function*(){t(!0);try{const v=yield Ke.apiCall("/api/method/asset_lite.api.ppm_generator_api.create_pm_schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_data:JSON.stringify(x)})});if(v!=null&&v.success)return v.pm_schedule;throw new Error((v==null?void 0:v.error)||"Failed to create PM Schedule")}finally{t(!1)}}),updatePMSchedule:(x,v)=>ge(null,null,function*(){t(!0);try{const _=yield Ke.apiCall("/api/method/asset_lite.api.ppm_generator_api.update_pm_schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x,pm_schedule_data:JSON.stringify(v)})});if(_!=null&&_.success)return _.pm_schedule;throw new Error((_==null?void 0:_.error)||"Failed to update PM Schedule")}finally{t(!1)}}),deletePMSchedule:x=>ge(null,null,function*(){t(!0);try{const v=yield Ke.apiCall("/api/method/asset_lite.api.ppm_generator_api.delete_pm_schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x})});if(!(v!=null&&v.success))throw new Error((v==null?void 0:v.error)||"Failed to delete PM Schedule")}finally{t(!1)}}),submitPMSchedule:x=>ge(null,null,function*(){t(!0);try{const v=yield Ke.apiCall("/api/method/asset_lite.api.ppm_generator_api.submit_pm_schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x})});if(v!=null&&v.success)return v.pm_schedule;throw new Error((v==null?void 0:v.error)||"Failed to submit PM Schedule")}finally{t(!1)}}),cancelPMSchedule:x=>ge(null,null,function*(){t(!0);try{const v=yield Ke.apiCall("/api/method/asset_lite.api.ppm_generator_api.cancel_pm_schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x})});if(v!=null&&v.success)return v.pm_schedule;throw new Error((v==null?void 0:v.error)||"Failed to cancel PM Schedule")}finally{t(!1)}}),addMaintenanceEntry:(x,v)=>ge(null,null,function*(){t(!0);try{const _=yield Ke.apiCall("/api/method/asset_lite.api.ppm_generator_api.add_maintenance_entry",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x,entry_data:JSON.stringify(v)})});if(_!=null&&_.success)return _.maintenance_entries;throw new Error((_==null?void 0:_.error)||"Failed to add maintenance entry")}finally{t(!1)}}),removeMaintenanceEntry:(x,v)=>ge(null,null,function*(){t(!0);try{const _=yield Ke.apiCall("/api/method/asset_lite.api.ppm_generator_api.remove_maintenance_entry",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x,entry_name:v})});if(_!=null&&_.success)return _.maintenance_entries;throw new Error((_==null?void 0:_.error)||"Failed to remove maintenance entry")}finally{t(!1)}}),updateMaintenanceEntry:(x,v,_)=>ge(null,null,function*(){t(!0);try{const k=yield Ke.apiCall("/api/method/asset_lite.api.ppm_generator_api.update_maintenance_entry",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x,entry_name:v,entry_data:JSON.stringify(_)})});if(k!=null&&k.success)return k.maintenance_entries;throw new Error((k==null?void 0:k.error)||"Failed to update maintenance entry")}finally{t(!1)}}),loading:e}}const K9=()=>{const e=Da(),[t,a]=E.useState(0),[s,o]=E.useState(""),[u,c]=E.useState(null),[f,p]=E.useState(null),g=E.useRef(null),[x,v]=E.useState(!1),[_,k]=E.useState(""),[T,N]=E.useState(""),[j,P]=E.useState(""),C=20,O={};_&&(O.hospital=_),T&&(O.modality=T),j&&(O.periodicity=j);const{pmSchedules:R,totalCount:U,hasMore:H,loading:B,error:oe,refetch:se}=Lp(O,C,t*C,"creation desc"),{deletePMSchedule:pe,loading:le}=qw();E.useEffect(()=>{const D=G=>{g.current&&!g.current.contains(G.target)&&p(null)};return f&&document.addEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)}},[f]);const re=()=>{e("/ppm-planner/new")},de=D=>{e(`/ppm-planner/${D}`)},ye=D=>{e(`/ppm-planner/${D}`)},ue=D=>ge(null,null,function*(){try{yield pe(D),se(),c(null)}catch(G){console.error("Error deleting PM Schedule:",G),alert("Failed to delete PM Schedule")}}),te=()=>{k(""),N(""),P(""),a(0)},V=D=>{var G;return D.docstatus!==void 0?Number(D.docstatus):((G=D.maintenance_entries)==null?void 0:G.length)>0?Number(D.maintenance_entries[0].docstatus):0},J=_||T||j,ne=[_,T,j].filter(Boolean).length,ae=R.filter(D=>{var q,K,fe,Pe;if(!s)return!0;const G=s.toLowerCase();return((q=D.name)==null?void 0:q.toLowerCase().includes(G))||((K=D.hospital)==null?void 0:K.toLowerCase().includes(G))||((fe=D.modality)==null?void 0:fe.toLowerCase().includes(G))||((Pe=D.maintenance_team)==null?void 0:Pe.toLowerCase().includes(G))}),z=Math.ceil(U/C);return r.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[r.jsxs("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3 lg:px-6",children:[r.jsxs("div",{className:"flex justify-between items-center mb-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Xo,{className:"text-blue-600 dark:text-blue-400",size:24}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-800 dark:text-white",children:"PPM Planners"}),r.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Manage preventive maintenance schedules"})]})]}),r.jsxs("button",{onClick:re,className:"px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors flex items-center gap-2 text-sm",children:[r.jsx(fi,{}),r.jsx("span",{children:"Create PPM Planner"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Ps,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400",size:14}),r.jsx("input",{type:"text",placeholder:"Search by name, hospital, modality...",value:s,onChange:D=>o(D.target.value),className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("button",{onClick:()=>v(!x),className:`px-3 py-1.5 border rounded-lg transition-colors flex items-center gap-2 text-sm ${J?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400":"border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[r.jsx(Ko,{}),r.jsx("span",{children:"Filters"}),ne>0&&r.jsx("span",{className:"bg-blue-600 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs",children:ne}),x?r.jsx(iu,{}):r.jsx(wc,{})]})]}),x&&r.jsxs("div",{className:"mt-3 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg border border-gray-200 dark:border-gray-600",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[r.jsx("div",{children:r.jsx(St,{label:"Hospital",doctype:"Company",value:_,onChange:k,placeholder:"All Hospitals",filters:{domain:"Healthcare"}})}),r.jsx("div",{children:r.jsx(St,{label:"Modality",doctype:"Modality",value:T,onChange:N,placeholder:"All Modalities",filters:{}})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Periodicity"}),r.jsxs("select",{value:j,onChange:D=>P(D.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"All"}),r.jsx("option",{value:"Daily",children:"Daily"}),r.jsx("option",{value:"Weekly",children:"Weekly"}),r.jsx("option",{value:"Monthly",children:"Monthly"}),r.jsx("option",{value:"Quarterly",children:"Quarterly"}),r.jsx("option",{value:"Half-yearly",children:"Half-yearly"}),r.jsx("option",{value:"Yearly",children:"Yearly"})]})]})]}),J&&r.jsx("div",{className:"mt-4 flex justify-end",children:r.jsxs("button",{onClick:te,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 flex items-center gap-2",children:[r.jsx(pt,{}),"Clear Filters"]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto p-4 lg:p-5",children:B&&t===0?r.jsxs("div",{className:"flex items-center justify-center h-full",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}),r.jsx("span",{className:"ml-3 text-gray-600 dark:text-gray-400",children:"Loading PPM Planners..."})]}):oe?r.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:r.jsx("p",{className:"text-red-600 dark:text-red-400",children:oe})}):ae.length===0?r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-8 text-center",children:[r.jsx(Xo,{className:"mx-auto text-gray-400 mb-4",size:48}),r.jsx("h3",{className:"text-lg font-semibold text-gray-700 dark:text-gray-300 mb-2",children:"No PPM Planners Found"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:s||J?"Try adjusting your search or filters":"Get started by creating your first PPM Planner"}),!s&&!J&&r.jsx("button",{onClick:re,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:"Create PPM Planner"})]}):r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden",children:[r.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[r.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Name"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Hospital"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Modality"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Periodicity"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Due Date"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:ae.map(D=>r.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("button",{onClick:()=>de(D.name),className:"text-blue-600 dark:text-blue-400 hover:underline font-medium",children:D.name})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:D.hospital||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:D.modality||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:D.periodicity||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:D.due_date?new Date(D.due_date).toLocaleDateString():"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:(()=>{const G=V(D);return r.jsx("span",{className:`px-2 py-1 text-xs font-semibold rounded-full ${G===1?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":G===0?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-400"}`,children:G===1?"Submitted":G===2?"Cancelled":"Draft"})})()}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:r.jsxs("div",{className:"relative inline-block",ref:f===D.name?g:null,children:[r.jsx("button",{onClick:()=>p(f===D.name?null:D.name),className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 p-2",children:r.jsx(lu,{})}),f===D.name&&r.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-700 rounded-lg shadow-lg border border-gray-200 dark:border-gray-600 z-10",children:[r.jsxs("button",{onClick:()=>{de(D.name),p(null)},className:"w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600 flex items-center gap-2",children:[r.jsx(Nc,{})," View"]}),r.jsxs("button",{onClick:()=>{ye(D.name),p(null)},className:"w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600 flex items-center gap-2",children:[r.jsx(Tn,{})," Edit"]}),r.jsxs("button",{onClick:()=>{c(D.name),p(null)},className:"w-full px-4 py-2 text-left text-sm text-red-600 dark:text-red-400 hover:bg-gray-100 dark:hover:bg-gray-600 flex items-center gap-2",children:[r.jsx(Xa,{})," Delete"]})]})]})})]},D.name))})]}),z>1&&r.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[r.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Showing ",t*C+1," to ",Math.min((t+1)*C,U)," of ",U," results"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>a(Math.max(0,t-1)),disabled:t===0,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300",children:"Previous"}),r.jsx("button",{onClick:()=>a(t+1),disabled:!H,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300",children:"Next"})]})]})]})}),u&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 max-w-md",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Confirm Delete"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"Are you sure you want to delete this PPM Planner? This action cannot be undone."}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>c(null),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",disabled:le,children:"Cancel"}),r.jsx("button",{onClick:()=>ue(u),className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors",disabled:le,children:le?"Deleting...":"Delete"})]})]})})]})},J9=()=>{const{scheduleName:e}=_c(),t=Da(),{pmSchedule:a,loading:s,error:o,refetch:u}=X9(e||null),{updatePMSchedule:c,deletePMSchedule:f,submitPMSchedule:p,cancelPMSchedule:g,loading:x}=qw(),{logs:v}=Rf({},1e4,0),[_,k]=E.useState(!1),[T,N]=E.useState(!1),[j,P]=E.useState({hospital:"",modality:"",device_status:"",start_date:"",end_date:"",maintenance_team:"",maintenance_manager:"",periodicity:"Monthly",assign_to:"",due_date:"",next_pm_date:"",manufacturer:"",model:"",pm_for:"",asset_name:"",no_of_pms:""}),C=(le,re,de)=>{if(!re||!de)return null;const ue=v.filter(q=>q.asset_name===le).filter(q=>q.maintenance_status==="Completed"&&q.completion_date).sort((q,K)=>{const fe=new Date(q.completion_date||0).getTime();return new Date(K.completion_date||0).getTime()-fe});if(ue.length===0)return de;const te=ue[0],V=new Date(te.due_date||de),J=new Date(te.completion_date),ne=Math.max(0,Math.floor((J.getTime()-V.getTime())/(1e3*60*60*24))),ae=new Date(J);switch(re){case"Daily":ae.setDate(ae.getDate()+1);break;case"Weekly":ae.setDate(ae.getDate()+7);break;case"Monthly":ae.setMonth(ae.getMonth()+1);break;case"Quarterly":ae.setMonth(ae.getMonth()+3);break;case"Half-yearly":ae.setMonth(ae.getMonth()+6);break;case"Yearly":ae.setFullYear(ae.getFullYear()+1);break;case"2 Yearly":ae.setFullYear(ae.getFullYear()+2);break;case"3 Yearly":ae.setFullYear(ae.getFullYear()+3);break;default:return de}ae.setDate(ae.getDate()+ne);const z=ae.getFullYear(),D=String(ae.getMonth()+1).padStart(2,"0"),G=String(ae.getDate()).padStart(2,"0");return`${z}-${D}-${G}`};E.useEffect(()=>{if(a&&a.maintenance_entries&&v.length>0){const le=[];if(a.maintenance_entries.forEach(re=>{const de=C(re.asset,a.periodicity||"Monthly",a.due_date||"");de&&le.push(de)}),le.length>0){const re=le.sort((de,ye)=>new Date(de).getTime()-new Date(ye).getTime())[0];P(de=>de.next_pm_date!==re?Le(ie({},de),{next_pm_date:re}):de)}}},[a,v]),E.useEffect(()=>{a&&P({hospital:a.hospital||"",modality:a.modality||"",device_status:a.device_status||"",start_date:a.start_date||"",end_date:a.end_date||"",maintenance_team:a.maintenance_team||"",maintenance_manager:a.maintenance_manager||"",periodicity:a.periodicity||"Monthly",assign_to:a.assign_to||"",due_date:a.due_date||"",next_pm_date:a.next_pm_date||"",manufacturer:a.manufacturer||"",model:a.model||"",pm_for:a.pm_for||"",asset_name:a.asset_name||"",no_of_pms:a.no_of_pms||""})},[a]);const O=(le,re,de)=>{if(!le||!re||!de)return null;const ye=parseInt(de,10);if(isNaN(ye)||ye<1)return null;const ue=ye-1;if(ue<0)return null;const te=new Date(le),V=new Date(te);switch(re){case"Daily":V.setDate(V.getDate()+ue);break;case"Weekly":V.setDate(V.getDate()+ue*7);break;case"Monthly":V.setMonth(V.getMonth()+ue);break;case"Quarterly":V.setMonth(V.getMonth()+ue*3);break;case"Half-yearly":V.setMonth(V.getMonth()+ue*6);break;case"Yearly":V.setFullYear(V.getFullYear()+ue);break;case"2 Yearly":V.setFullYear(V.getFullYear()+ue*2);break;case"3 Yearly":V.setFullYear(V.getFullYear()+ue*3);break;default:return null}const J=V.getFullYear(),ne=String(V.getMonth()+1).padStart(2,"0"),ae=String(V.getDate()).padStart(2,"0");return`${J}-${ne}-${ae}`},R=le=>{const{name:re,value:de}=le.target;P(ye=>{const ue=Le(ie({},ye),{[re]:de});if(re==="start_date"||re==="periodicity"||re==="no_of_pms"){const te=O(re==="start_date"?de:ye.start_date,re==="periodicity"?de:ye.periodicity,re==="no_of_pms"?de:ye.no_of_pms);te&&(ue.end_date=te)}return ue})},U=()=>ge(null,null,function*(){if(e)try{yield c(e,j),k(!1),u(),alert("PPM Planner updated successfully")}catch(le){console.error("Error updating PPM Planner:",le),alert("Failed to update PPM Planner")}}),H=()=>ge(null,null,function*(){if(e)try{yield f(e),t("/ppm-planner")}catch(le){console.error("Error deleting PPM Planner:",le),alert("Failed to delete PPM Planner")}}),B=()=>ge(null,null,function*(){if(e)try{yield p(e),u(),alert("PPM Planner submitted successfully")}catch(le){console.error("Error submitting PPM Planner:",le),alert("Failed to submit PPM Planner")}}),oe=()=>ge(null,null,function*(){if(e)try{yield g(e),u(),alert("PPM Planner cancelled successfully")}catch(le){console.error("Error cancelling PPM Planner:",le),alert("Failed to cancel PPM Planner")}});if(s)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ds,{className:"animate-spin text-blue-600",size:24}),r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Loading PPM Planner..."})]})});if(o)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[r.jsx("p",{className:"text-red-600 dark:text-red-400",children:o}),r.jsx("button",{onClick:()=>t("/ppm-planner"),className:"mt-4 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:"Back to List"})]})});if(!a)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[r.jsx("p",{className:"text-yellow-600 dark:text-yellow-400",children:"PPM Planner not found"}),r.jsx("button",{onClick:()=>t("/ppm-planner"),className:"mt-4 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:"Back to List"})]})});const se=a.docstatus===0,pe=a.docstatus===1;return a.docstatus,r.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[r.jsx("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-6 py-4",children:r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:()=>t("/ppm-planner"),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:r.jsx(no,{className:"text-gray-600 dark:text-gray-400"})}),r.jsx(Xo,{className:"text-blue-600 dark:text-blue-400",size:28}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-800 dark:text-white",children:a.name}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"PPM Planner Details"})]}),r.jsx("span",{className:`ml-4 px-3 py-1 text-sm font-semibold rounded-full ${pe?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":se?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-400"}`,children:pe?"Submitted":se?"Draft":"Cancelled"})]}),r.jsxs("div",{className:"flex gap-2",children:[se&&!_&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>k(!0),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors flex items-center gap-2",children:[r.jsx(Tn,{}),"Edit"]}),r.jsxs("button",{onClick:B,disabled:x,className:"px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",children:[r.jsx($n,{}),"Submit"]}),r.jsxs("button",{onClick:()=>N(!0),disabled:x,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",children:[r.jsx(Xa,{}),"Delete"]})]}),_&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:U,disabled:x,className:"px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",children:[x?r.jsx(ds,{className:"animate-spin"}):r.jsx(Wn,{}),"Save"]}),r.jsx("button",{onClick:()=>{k(!1),P({hospital:a.hospital||"",modality:a.modality||"",device_status:a.device_status||"",start_date:a.start_date||"",end_date:a.end_date||"",maintenance_team:a.maintenance_team||"",maintenance_manager:a.maintenance_manager||"",periodicity:a.periodicity||"Monthly",assign_to:a.assign_to||"",due_date:a.due_date||"",next_pm_date:a.next_pm_date||"",manufacturer:a.manufacturer||"",model:a.model||"",pm_for:a.pm_for||"",asset_name:a.asset_name||"",no_of_pms:a.no_of_pms||""})},disabled:x,className:"px-4 py-2 bg-gray-600 hover:bg-gray-700 text-white rounded-lg transition-colors disabled:opacity-50",children:"Cancel"})]}),pe&&r.jsx("button",{onClick:oe,disabled:x,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",children:"Cancel Document"})]})]})}),r.jsx("div",{className:"flex-1 overflow-auto p-6",children:r.jsx("div",{className:"max-w-4xl mx-auto bg-white dark:bg-gray-800 rounded-lg shadow",children:r.jsxs("div",{className:"p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx("div",{children:_?r.jsx(St,{label:"Hospital *",doctype:"Company",value:j.hospital,onChange:le=>P(re=>Le(ie({},re),{hospital:le})),placeholder:"Select Hospital",filters:{}}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.hospital||"-"})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Modality"}),_?r.jsx("input",{type:"text",name:"modality",value:j.modality,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.modality||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Device Status"}),_?r.jsx("input",{type:"text",name:"device_status",value:j.device_status,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.device_status||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Periodicity *"}),_?r.jsxs("select",{name:"periodicity",value:j.periodicity,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"Daily",children:"Daily"}),r.jsx("option",{value:"Weekly",children:"Weekly"}),r.jsx("option",{value:"Monthly",children:"Monthly"}),r.jsx("option",{value:"Quarterly",children:"Quarterly"}),r.jsx("option",{value:"Half-yearly",children:"Half-yearly"}),r.jsx("option",{value:"Yearly",children:"Yearly"})]}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.periodicity||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Manufacturer"}),_?r.jsx("input",{type:"text",name:"manufacturer",value:j.manufacturer,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.manufacturer||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Model"}),_?r.jsx("input",{type:"text",name:"model",value:j.model,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.model||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"PM Name"}),_?r.jsx("input",{type:"text",name:"pm_for",value:j.pm_for,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.pm_for||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Asset Name"}),_?r.jsx("input",{type:"text",name:"asset_name",value:j.asset_name,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.asset_name||"-"})]})]})]}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Schedule Dates"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Start Date *"}),_?r.jsx("input",{type:"date",name:"start_date",value:j.start_date,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.start_date?new Date(a.start_date).toLocaleDateString():"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"End Date *"}),_?r.jsx("input",{type:"date",name:"end_date",value:j.end_date,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.end_date?new Date(a.end_date).toLocaleDateString():"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"First PM Date"}),_?r.jsx("input",{type:"date",name:"due_date",value:j.due_date,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.due_date?new Date(a.due_date).toLocaleDateString():"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Next PM Date"}),_?r.jsx("input",{type:"date",name:"next_pm_date",value:j.next_pm_date,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:j.next_pm_date?new Date(j.next_pm_date).toLocaleDateString():a.next_pm_date?new Date(a.next_pm_date).toLocaleDateString():"-"}),!_&&j.next_pm_date&&r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Calculated based on last completion"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"No. of PMs"}),_?r.jsx("input",{type:"number",name:"no_of_pms",value:j.no_of_pms,onChange:R,min:"1",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",placeholder:"Enter number of PMs"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.no_of_pms||"-"}),_&&r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"End date will be auto-calculated based on start date, periodicity, and number of PMs"})]})]})]}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Assignment"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Maintenance Team"}),_?r.jsx("input",{type:"text",name:"maintenance_team",value:j.maintenance_team,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.maintenance_team||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Maintenance Manager"}),_?r.jsx("input",{type:"text",name:"maintenance_manager",value:j.maintenance_manager,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.maintenance_manager||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Assign To"}),_?r.jsx("input",{type:"text",name:"assign_to",value:j.assign_to,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:a.assign_to||"-"})]})]})]}),a.maintenance_entries&&a.maintenance_entries.length>0&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Maintenance Entries"}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full border-collapse border border-gray-300 dark:border-gray-600",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700",children:[r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Asset"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Asset Name"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Manufacturer"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Model"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"PM Start Date"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"PM End Date"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Maintenance Log"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Next PM Date"})]})}),r.jsx("tbody",{children:a.maintenance_entries.map((le,re)=>{const de=v.filter(ue=>ue.asset_name===le.asset),ye=C(le.asset,a.periodicity||"Monthly",a.due_date||"");return r.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:le.asset?r.jsx("button",{onClick:()=>t(`/assets/${le.asset}`),className:"text-blue-600 dark:text-blue-400 hover:underline",children:le.asset}):"-"}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:le.asset_name||"-"}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:le.manufacturer||"-"}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:le.model||"-"}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:le.start_date?new Date(le.start_date).toLocaleDateString():"-"}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:le.end_date?new Date(le.end_date).toLocaleDateString():"-"}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:de.length>0?r.jsxs("div",{className:"space-y-1",children:[de.map(ue=>r.jsx("button",{onClick:()=>t(`/maintenance/${ue.name}`),className:"block text-blue-600 dark:text-blue-400 hover:underline text-left",title:`Status: ${ue.maintenance_status||"N/A"} | Due: ${ue.due_date?new Date(ue.due_date).toLocaleDateString():"N/A"}`,children:ue.name},ue.name)),de.length>3&&r.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["+",de.length-3," more"]})]}):r.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"No logs"})}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:ye?r.jsx("span",{className:"font-medium text-blue-600 dark:text-blue-400",children:new Date(ye).toLocaleDateString()}):r.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"-"})})]},le.name||re)})})]})})]}),r.jsxs("div",{className:"pt-4 border-t border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-sm font-semibold text-gray-600 dark:text-gray-400 mb-3",children:"Metadata"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Created:"}),r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:a.creation?new Date(a.creation).toLocaleString():"-"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Created By:"}),r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:a.owner||"-"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Modified:"}),r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:a.modified?new Date(a.modified).toLocaleString():"-"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Modified By:"}),r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:a.modified_by||"-"})]}),a.amended_from&&r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Amended From:"}),r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:a.amended_from})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Doc Status:"}),r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:a.docstatus===0?"Draft":a.docstatus===1?"Submitted":"Cancelled"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"IDX:"}),r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:a.idx||"-"})]})]})]})]})})}),T&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 max-w-md",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Confirm Delete"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"Are you sure you want to delete this PPM Planner? This action cannot be undone."}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>N(!1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",disabled:x,children:"Cancel"}),r.jsx("button",{onClick:H,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors",disabled:x,children:x?"Deleting...":"Delete"})]})]})})]})},Q9=({month:e,year:t,filters:a={},viewType:s="maintenance-log",timeView:o="day-month"})=>{const u=Da(),c=new Date,[f,p]=E.useState(e!=null?e:c.getMonth()),[g,x]=E.useState(t!=null?t:c.getFullYear()),v=new Date(g,f,1).toISOString().split("T")[0],_=new Date(g,f+1,0).toISOString().split("T")[0],k=JSON.stringify(a),T=E.useMemo(()=>a,[k]),N=E.useMemo(()=>ie({due_date:["between",[v,_]]},T),[v,_,T]),j=E.useMemo(()=>({}),[]),P=E.useMemo(()=>({}),[]),{logs:C,loading:O}=Rf(s==="maintenance-log"?N:j,s==="maintenance-log"?1e3:0,0,"due_date asc"),{pmSchedules:R,loading:U}=Lp(s==="ppm-planner"?T:j,1e3,0,"creation desc",P),H=s==="maintenance-log"?O:U,B=E.useMemo(()=>s==="maintenance-log"?C.filter(V=>{if(!V.due_date)return!1;const J=new Date(V.due_date);return J.getMonth()===f&&J.getFullYear()===g}):R.filter(J=>{const ne=J.due_date||J.start_date;if(!ne)return!1;const[ae,z,D]=ne.split("-").map(Number),G=new Date(ae,z-1,D);return G.getMonth()===f&&G.getFullYear()===g}),[C,R,f,g,s]);E.useEffect(()=>{s==="ppm-planner"&&!U&&(console.log("=== PPM PLANNER DEBUG ==="),console.log("[MaintenanceCalendar] Viewing Month:",f+1,"Year:",g),console.log("[MaintenanceCalendar] Total PM Schedules fetched:",R.length),console.log("[MaintenanceCalendar] Filtered for current month:",B.length),B.length>0?(console.log("[MaintenanceCalendar] Schedules showing in this month:"),B.forEach(V=>{console.log(` - ${V.name}: due_date=${V.due_date}, start_date=${V.start_date}`)})):(console.log("[MaintenanceCalendar] No schedules match this month."),console.log("[MaintenanceCalendar] Due dates in fetched data:"),R.slice(0,5).forEach(V=>{const J=V.due_date||V.start_date;console.log(` - ${V.name}: due_date=${V.due_date}, start_date=${V.start_date}, will show in: ${J?(()=>{const[ne,ae]=J.split("-").map(Number);return`${ae}/${ne}`})():"unknown"}`)}),console.log("[MaintenanceCalendar] TIP: Navigate to the month where due_dates match to see schedules.")),console.log("========================="))},[s,R,U,B.length,f,g]);const oe=(V,J)=>{const ne=new Date(J)<new Date&&V!=="Completed";switch(V){case"Completed":return"bg-green-500 text-white border-green-600";case"Planned":return ne?"bg-red-500 text-white border-red-600":"bg-yellow-500 text-white border-yellow-600";case"Overdue":return"bg-red-600 text-white border-red-700";default:return"bg-gray-500 text-white border-gray-600"}},se=new Date(g,f,1).getDay(),pe=new Date(g,f+1,0).getDate(),le=Array.from({length:pe},(V,J)=>J+1),re=V=>{V>0?f===11?(p(0),x(g+1)):p(f+1):f===0?(p(11),x(g-1)):p(f-1)},de=V=>s==="maintenance-log"?B.filter(J=>J.due_date?new Date(J.due_date).getDate()===V:!1):B.filter(ne=>{const ae=ne.due_date||ne.start_date;if(!ae)return!1;const[z,D,G]=ae.split("-").map(Number),q=new Date(z,D-1,G);return q.getDate()===V&&q.getMonth()===f&&q.getFullYear()===g}),ye=()=>{p(c.getMonth()),x(c.getFullYear())},ue=["January","February","March","April","May","June","July","August","September","October","November","December"],te=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow h-full flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex-shrink-0 flex justify-between items-center p-4 lg:p-6 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex items-center gap-2 lg:gap-3",children:[r.jsx(Xo,{className:"text-blue-600 dark:text-blue-400",size:20}),r.jsxs("h2",{className:"text-xl lg:text-2xl font-bold text-gray-800 dark:text-white",children:[ue[f]," ",g]})]}),r.jsxs("div",{className:"flex gap-1 lg:gap-2",children:[r.jsx("button",{onClick:()=>re(-1),className:"px-2 py-2 lg:px-4 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg text-gray-700 dark:text-gray-300 transition-colors",title:"Previous Month",children:r.jsx(k_,{})}),r.jsx("button",{onClick:ye,className:"px-2 py-2 lg:px-4 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors text-xs lg:text-sm font-medium",children:"Today"}),r.jsx("button",{onClick:()=>re(1),className:"px-2 py-2 lg:px-4 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg text-gray-700 dark:text-gray-300 transition-colors",title:"Next Month",children:r.jsx(N_,{})})]})]}),H?r.jsxs("div",{className:"flex items-center justify-center flex-1",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}),r.jsxs("span",{className:"ml-3 text-gray-600 dark:text-gray-400",children:["Loading ",s==="maintenance-log"?"maintenance logs":"PPM Planners","..."]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex-1 overflow-auto p-4 lg:p-6",children:[r.jsx("div",{className:"grid grid-cols-7 gap-1 lg:gap-2 mb-2",children:te.map(V=>r.jsx("div",{className:"text-center font-semibold p-1 lg:p-2 text-gray-700 dark:text-gray-300 text-xs lg:text-sm",children:V},V))}),r.jsxs("div",{className:"grid grid-cols-7 gap-1 lg:gap-2 auto-rows-fr",children:[Array.from({length:se}).map((V,J)=>r.jsx("div",{className:"p-1 lg:p-2"},`empty-${J}`)),le.map(V=>{const J=de(V),ne=V===c.getDate()&&f===c.getMonth()&&g===c.getFullYear();return r.jsxs("div",{className:`border rounded-lg p-1 lg:p-2 min-h-16 lg:min-h-20 hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors flex flex-col ${ne?"border-blue-500 border-2 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700"}`,children:[r.jsx("div",{className:`font-semibold mb-1 text-xs lg:text-sm flex-shrink-0 ${ne?"text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300"}`,children:V}),r.jsxs("div",{className:"space-y-1 flex-1 overflow-hidden",children:[J.slice(0,2).map(ae=>{if(s==="maintenance-log"){const z=ae,D=new Date(z.due_date||"")<new Date&&z.maintenance_status!=="Completed";return r.jsx("div",{onClick:()=>u(`/maintenance/${z.name}`),className:`text-xs p-1 rounded border ${oe(z.maintenance_status||"Planned",z.due_date||"")} truncate cursor-pointer hover:opacity-80 transition-opacity`,title:`${z.asset_name||z.name} - ${z.maintenance_status||"Planned"}${D?" (Overdue)":""} - Click to view details`,children:r.jsx("div",{className:"truncate font-medium text-xs",children:z.asset_name||z.name})},z.name)}else{const z=ae,G=z.pm_for||z.pm_for||z["PM Name"]||null||z.name||"PPM Planner",q=z.name?`${z.name}${z.modality?` - ${z.modality}`:""}${z.hospital?` - ${z.hospital}`:""} - Click to view PPM Planner`:"Click to view PPM Planner";return r.jsx("div",{onClick:()=>u(`/ppm-planner/${z.name}`),className:"text-xs p-1 rounded border bg-purple-500 text-white border-purple-600 truncate cursor-pointer hover:opacity-80 transition-opacity",title:q,children:r.jsx("div",{className:"truncate font-medium text-xs",children:G})},z.name)}}),J.length>2&&r.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium",children:["+",J.length-2]})]})]},V)})]})]}),r.jsx("div",{className:"flex-shrink-0 border-t border-gray-200 dark:border-gray-700 p-3 lg:p-4 bg-gray-50 dark:bg-gray-900/30",children:r.jsxs("div",{className:"flex flex-col lg:flex-row justify-between items-center gap-3 lg:gap-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-3 lg:gap-4 items-center justify-center lg:justify-start",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 bg-green-500 rounded border border-green-600"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Completed"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded border border-yellow-600"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Planned"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 bg-red-500 rounded border border-red-600"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Overdue"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 border-2 border-blue-500 rounded bg-blue-50 dark:bg-blue-900/20"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Today"})]})]}),r.jsx("div",{className:"flex gap-4 lg:gap-6 text-center",children:s==="maintenance-log"?r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg lg:text-xl font-bold text-green-600 dark:text-green-400",children:B.filter(V=>V.maintenance_status==="Completed").length}),r.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Completed"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg lg:text-xl font-bold text-yellow-600 dark:text-yellow-400",children:B.filter(V=>V.maintenance_status==="Planned"&&new Date(V.due_date||"")>=new Date).length}),r.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Planned"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg lg:text-xl font-bold text-red-600 dark:text-red-400",children:B.filter(V=>new Date(V.due_date||"")<new Date&&V.maintenance_status!=="Completed").length}),r.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Overdue"})]})]}):r.jsxs("div",{children:[r.jsx("div",{className:"text-lg lg:text-xl font-bold text-purple-600 dark:text-purple-400",children:B.length}),r.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"PPM Planners"})]})})]})})]})]})},eL=()=>{const e=Da(),[t]=rl(),[a,s]=E.useState(""),[o,u]=E.useState(""),[c,f]=E.useState(""),[p,g]=E.useState("");E.useEffect(()=>{const O=t.get("hospital"),R=t.get("status");O&&s(O),R&&f(R)},[t]);const[x,v]=E.useState("maintenance-log"),[_,k]=E.useState(!1),[T,N]=E.useState(0);E.useEffect(()=>{const O=[a,o,c,p].filter(Boolean).length;N(O)},[a,o,c,p]);const j=()=>{s(""),u(""),f(""),g("")},P=a||o||c||p,C=E.useMemo(()=>{const O={};return a&&(O.company=a),o&&(O.department=o),c&&(O.maintenance_status=c),p&&(O.assign_to_name=p),O},[a,o,c,p]);return r.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[r.jsxs("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-2.5 lg:px-6",children:[r.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-3 md:gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[r.jsx(Xo,{className:"text-blue-600 dark:text-blue-400 flex-shrink-0",size:22}),r.jsx("div",{className:"min-w-0",children:r.jsx("h1",{className:"text-lg md:text-xl font-bold text-gray-800 dark:text-white whitespace-nowrap",children:"Maintenance Calendar"})})]}),r.jsxs("div",{className:"flex items-end gap-2 md:gap-3 flex-wrap md:flex-nowrap",children:[r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"View Type"}),r.jsxs("select",{value:x,onChange:O=>v(O.target.value),className:"px-2.5 md:px-3 py-1.5 text-xs md:text-sm border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"maintenance-log",children:"Maintenance Log"}),r.jsx("option",{value:"ppm-planner",children:"PPM Planner"})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1 invisible",children:"Filters"}),r.jsxs("button",{onClick:()=>k(!_),className:`px-3 md:px-4 py-1.5 md:py-2 border rounded-lg transition-colors flex items-center gap-1.5 md:gap-2 text-xs md:text-sm ${P?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400":"border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[r.jsx(Ko,{size:14}),r.jsx("span",{className:"hidden sm:inline",children:"Filters"}),T>0&&r.jsx("span",{className:"bg-blue-600 text-white rounded-full w-4 h-4 md:w-5 md:h-5 flex items-center justify-center text-[10px] md:text-xs",children:T}),_?r.jsx(iu,{size:12}):r.jsx(wc,{size:12})]})]}),x==="ppm-planner"&&r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1 invisible",children:"Yearly Map"}),r.jsxs("button",{onClick:()=>e("/yearly-ppm-planner"),className:"px-3 md:px-4 py-1.5 md:py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors flex items-center gap-1.5 md:gap-2 text-xs md:text-sm font-medium whitespace-nowrap",title:"View Yearly PPM Planner Map",children:[r.jsx(u6,{size:14}),r.jsx("span",{className:"hidden sm:inline",children:"Yearly Map"}),r.jsx("span",{className:"sm:hidden",children:"Map"})]})]})]})]}),_&&r.jsxs("div",{className:"mt-2.5 md:mt-3 p-3 md:p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg border border-gray-200 dark:border-gray-600",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[r.jsxs("div",{className:"relative z-[60]",children:[r.jsx(St,{label:"Hospital",doctype:"Company",value:a,onChange:O=>s(O),placeholder:"Select Hospital",compact:!0}),a&&r.jsx("button",{onClick:()=>s(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[55]",children:[r.jsx(St,{label:"Department",doctype:"Department",value:o,onChange:O=>u(O),placeholder:"All Departments",compact:!0}),o&&r.jsx("button",{onClick:()=>u(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),r.jsxs("select",{value:c,onChange:O=>f(O.target.value),className:"w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"All Statuses"}),r.jsx("option",{value:"Planned",children:"Planned"}),r.jsx("option",{value:"Completed",children:"Completed"}),r.jsx("option",{value:"Overdue",children:"Overdue"}),r.jsx("option",{value:"Cancelled",children:"Cancelled"})]}),c&&r.jsx("button",{onClick:()=>f(""),className:"absolute right-8 top-7 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[50]",children:[r.jsx(St,{label:"Assigned To",doctype:"User",value:p,onChange:O=>g(O),placeholder:"All Technicians",compact:!0}),p&&r.jsx("button",{onClick:()=>g(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]})]}),P&&r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsxs("button",{onClick:j,className:"px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 flex items-center gap-2",children:[r.jsx(pt,{}),"Clear Filters"]})})]})]}),r.jsx("div",{className:"flex-1 overflow-hidden px-3 pb-3 lg:px-4 lg:pb-4",children:r.jsx(Q9,{filters:C,viewType:x,timeView:"day-month"})})]})},Dv=()=>{const e=Da(),[t,a]=E.useState(2025),[s,o]=E.useState(2030),u=E.useMemo(()=>({}),[]),c=E.useMemo(()=>({}),[]),{pmSchedules:f,loading:p,error:g}=Lp(u,1e3,0,"creation desc",c),x=(N,j,P,C,O)=>{const R=N.toLowerCase().trim(),U=j.getFullYear(),H=j.getMonth(),B=new Date(C,O,1),oe=new Date(C,O+1,0,23,59,59,999);if(B>P||oe<j)return!1;const se=(C-U)*12+(O-H);switch(R){case"daily":return B<=P&&oe>=j;case"weekly":return B<=P&&oe>=j;case"monthly":return se>=0&&B<=P;case"quarterly":return se>=0&&se%3===0&&B<=P;case"half-yearly":case"half yearly":return se>=0&&se%6===0&&B<=P;case"yearly":case"annually":return O===H&&B<=P&&B>=j;case"2 yearly":case"2-yearly":return se>=0&&se%24===0&&B<=P;case"3 yearly":case"3-yearly":return se>=0&&se%36===0&&B<=P;default:return B<=P&&oe>=j}},v=E.useMemo(()=>{const N={};for(let j=t;j<=s;j++){N[j]={};for(let P=0;P<12;P++)N[j][P]=[]}return f.forEach(j=>{let P=null,C=null;if(j.start_date){const[U,H,B]=j.start_date.split("-").map(Number)}if(j.end_date){const[U,H,B]=j.end_date.split("-").map(Number);P=new Date(U,H-1,B)}if(j.due_date){const[U,H,B]=j.due_date.split("-").map(Number);C=new Date(U,H-1,B)}if(!C)return;const O=P||C,R=j.periodicity||"monthly";for(let U=t;U<=s;U++)for(let H=0;H<12;H++)x(R,C,O,U,H)&&(N[U][H].some(oe=>oe.name===j.name)||N[U][H].push(j))}),N},[f,t,s]);E.useEffect(()=>{p||(console.log("[YearlyPPMPlannerPage] PM Schedules count:",f.length),console.log("[YearlyPPMPlannerPage] Matrix years:",t,"to",s))},[f,p,t,s]);const _=N=>{a(j=>j+N),o(j=>j+N)},k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],T=Array.from({length:s-t+1},(N,j)=>t+j);return r.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[r.jsx("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3 lg:px-6",children:r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:()=>e("/maintenance-calendar/month-view"),className:"p-1.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Back to Month View",children:r.jsx(no,{className:"text-gray-600 dark:text-gray-400",size:18})}),r.jsx(Xo,{className:"text-blue-600 dark:text-blue-400",size:24}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-800 dark:text-white",children:"Site or Cluster PPM Calendar"}),r.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"View PM Schedule Generators across multiple years"})]})]}),r.jsxs("button",{onClick:()=>e("/maintenance-calendar/month-view"),className:"px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors flex items-center gap-2 text-sm font-medium",title:"Go to Month View",children:[r.jsx(af,{size:14}),"Month"]})]})}),r.jsx("div",{className:"flex-shrink-0 px-3 lg:px-4 py-2",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow border border-gray-200 dark:border-gray-700 p-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("button",{onClick:()=>_(-1),className:"px-3 py-1.5 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg text-gray-700 dark:text-gray-300 transition-colors",children:r.jsx(k_,{})}),r.jsxs("h2",{className:"text-lg font-bold text-gray-800 dark:text-white",children:[t," - ",s]}),r.jsx("button",{onClick:()=>_(1),className:"px-3 py-1.5 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg text-gray-700 dark:text-gray-300 transition-colors",children:r.jsx(N_,{})})]})})}),r.jsx("div",{className:"flex-1 overflow-auto px-3 pb-3 lg:px-4 lg:pb-4",children:p?r.jsxs("div",{className:"flex items-center justify-center h-full",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}),r.jsx("span",{className:"ml-3 text-gray-600 dark:text-gray-400",children:"Loading PPM Planners..."})]}):g?r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error loading PPM Planners: ",g]})})}):r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full border-collapse",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 sticky top-0 z-10",children:r.jsxs("tr",{children:[r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-3 text-left font-bold text-gray-800 dark:text-white bg-gray-200 dark:bg-gray-800",children:"Year/Month"}),k.map((N,j)=>r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-2 py-3 text-center font-semibold text-gray-800 dark:text-white min-w-[140px]",children:N},j))]})}),r.jsx("tbody",{children:T.map(N=>r.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-3 font-bold text-gray-800 dark:text-white bg-gray-50 dark:bg-gray-800/50",children:N}),k.map((j,P)=>{var O;const C=((O=v[N])==null?void 0:O[P])||[];return r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-2 py-2 align-top min-h-[60px]",children:C.length>0?r.jsx("div",{className:"space-y-1",children:C.map(R=>{const U=R.pm_for||R.pm_for||R["PM Name"]||null;C.indexOf(R)===0&&console.log("[YearlyCalendar] 🔍 SCHEDULE IN CELL:",{name:R.name,pm_for:R.pm_for,"pm_for (bracket)":R.pm_for,allKeys:Object.keys(R),pmName:U});const H=U||R.name||"PPM Planner",B=[];R.name&&B.push(R.name),R.modality&&B.push(R.modality),R.hospital&&B.push(R.hospital);const oe=B.length>0?`${B.join(" - ")} - Click to view details`:"Click to view details";return r.jsx("div",{onClick:()=>e(`/ppm-planner/${R.name}`),className:"text-[10px] p-1 bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-700 rounded cursor-pointer hover:bg-blue-100 dark:hover:bg-blue-900/50 transition-colors group",title:oe,children:r.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-300 leading-tight group-hover:underline break-words",children:H})},R.name)})}):r.jsx("div",{className:"text-xs text-gray-300 dark:text-gray-700 text-center py-1",children:"-"})},P)})]},N))})]})})})})]})};function Yw(e,t){const a=E.useRef(t);E.useEffect(function(){t!==a.current&&e.attributionControl!=null&&(a.current!=null&&e.attributionControl.removeAttribution(a.current),t!=null&&e.attributionControl.addAttribution(t)),a.current=t},[e,t])}const tL=1;function aL(e){return Object.freeze({__version:tL,map:e})}function rL(e,t){return Object.freeze(ie(ie({},e),t))}const Mp=E.createContext(null);function Dp(){const e=E.use(Mp);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}function nL(e){function t(a,s){const{instance:o,context:u}=e(a).current;E.useImperativeHandle(s,()=>o);const{children:c}=a;return c==null?null:ea.createElement(Mp,{value:u},c)}return E.forwardRef(t)}function sL(e){function t(a,s){const[o,u]=E.useState(!1),{instance:c}=e(a,u).current;E.useImperativeHandle(s,()=>c),E.useEffect(function(){o&&c.update()},[c,o,a.children]);const f=c._contentNode;return f?c_.createPortal(a.children,f):null}return E.forwardRef(t)}function iL(e){function t(a,s){const{instance:o}=e(a).current;return E.useImperativeHandle(s,()=>o),null}return E.forwardRef(t)}function Xw(e,t){const a=E.useRef(void 0);E.useEffect(function(){return t!=null&&e.instance.on(t),a.current=t,function(){a.current!=null&&e.instance.off(a.current),a.current=null}},[e,t])}function Rp(e,t){var s;const a=(s=e.pane)!=null?s:t.pane;return a?Le(ie({},e),{pane:a}):e}function oL(e,t){return function(s,o){const u=Dp(),c=e(Rp(s,u),u);return Yw(u.map,s.attribution),Xw(c.current,s.eventHandlers),t(c.current,u,s,o),c}}var Fd={exports:{}};var lL=Fd.exports,Rv;function cL(){return Rv||(Rv=1,(function(e,t){(function(a,s){s(t)})(lL,(function(a){var s="1.9.4";function o(l){var h,y,S,A;for(y=1,S=arguments.length;y<S;y++){A=arguments[y];for(h in A)l[h]=A[h]}return l}var u=Object.create||(function(){function l(){}return function(h){return l.prototype=h,new l}})();function c(l,h){var y=Array.prototype.slice;if(l.bind)return l.bind.apply(l,y.call(arguments,1));var S=y.call(arguments,2);return function(){return l.apply(h,S.length?S.concat(y.call(arguments)):arguments)}}var f=0;function p(l){return"_leaflet_id"in l||(l._leaflet_id=++f),l._leaflet_id}function g(l,h,y){var S,A,W,ce;return ce=function(){S=!1,A&&(W.apply(y,A),A=!1)},W=function(){S?A=arguments:(l.apply(y,arguments),setTimeout(ce,h),S=!0)},W}function x(l,h,y){var S=h[1],A=h[0],W=S-A;return l===S&&y?l:((l-A)%W+W)%W+A}function v(){return!1}function _(l,h){if(h===!1)return l;var y=Math.pow(10,h===void 0?6:h);return Math.round(l*y)/y}function k(l){return l.trim?l.trim():l.replace(/^\s+|\s+$/g,"")}function T(l){return k(l).split(/\s+/)}function N(l,h){Object.prototype.hasOwnProperty.call(l,"options")||(l.options=l.options?u(l.options):{});for(var y in h)l.options[y]=h[y];return l.options}function j(l,h,y){var S=[];for(var A in l)S.push(encodeURIComponent(y?A.toUpperCase():A)+"="+encodeURIComponent(l[A]));return(!h||h.indexOf("?")===-1?"?":"&")+S.join("&")}var P=/\{ *([\w_ -]+) *\}/g;function C(l,h){return l.replace(P,function(y,S){var A=h[S];if(A===void 0)throw new Error("No value provided for variable "+y);return typeof A=="function"&&(A=A(h)),A})}var O=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"};function R(l,h){for(var y=0;y<l.length;y++)if(l[y]===h)return y;return-1}var U="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function H(l){return window["webkit"+l]||window["moz"+l]||window["ms"+l]}var B=0;function oe(l){var h=+new Date,y=Math.max(0,16-(h-B));return B=h+y,window.setTimeout(l,y)}var se=window.requestAnimationFrame||H("RequestAnimationFrame")||oe,pe=window.cancelAnimationFrame||H("CancelAnimationFrame")||H("CancelRequestAnimationFrame")||function(l){window.clearTimeout(l)};function le(l,h,y){if(y&&se===oe)l.call(h);else return se.call(window,c(l,h))}function re(l){l&&pe.call(window,l)}var de={__proto__:null,extend:o,create:u,bind:c,get lastId(){return f},stamp:p,throttle:g,wrapNum:x,falseFn:v,formatNum:_,trim:k,splitWords:T,setOptions:N,getParamString:j,template:C,isArray:O,indexOf:R,emptyImageUrl:U,requestFn:se,cancelFn:pe,requestAnimFrame:le,cancelAnimFrame:re};function ye(){}ye.extend=function(l){var h=function(){N(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},y=h.__super__=this.prototype,S=u(y);S.constructor=h,h.prototype=S;for(var A in this)Object.prototype.hasOwnProperty.call(this,A)&&A!=="prototype"&&A!=="__super__"&&(h[A]=this[A]);return l.statics&&o(h,l.statics),l.includes&&(ue(l.includes),o.apply(null,[S].concat(l.includes))),o(S,l),delete S.statics,delete S.includes,S.options&&(S.options=y.options?u(y.options):{},o(S.options,l.options)),S._initHooks=[],S.callInitHooks=function(){if(!this._initHooksCalled){y.callInitHooks&&y.callInitHooks.call(this),this._initHooksCalled=!0;for(var W=0,ce=S._initHooks.length;W<ce;W++)S._initHooks[W].call(this)}},h},ye.include=function(l){var h=this.prototype.options;return o(this.prototype,l),l.options&&(this.prototype.options=h,this.mergeOptions(l.options)),this},ye.mergeOptions=function(l){return o(this.prototype.options,l),this},ye.addInitHook=function(l){var h=Array.prototype.slice.call(arguments,1),y=typeof l=="function"?l:function(){this[l].apply(this,h)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(y),this};function ue(l){if(!(typeof L=="undefined"||!L||!L.Mixin)){l=O(l)?l:[l];for(var h=0;h<l.length;h++)l[h]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var te={on:function(l,h,y){if(typeof l=="object")for(var S in l)this._on(S,l[S],h);else{l=T(l);for(var A=0,W=l.length;A<W;A++)this._on(l[A],h,y)}return this},off:function(l,h,y){if(!arguments.length)delete this._events;else if(typeof l=="object")for(var S in l)this._off(S,l[S],h);else{l=T(l);for(var A=arguments.length===1,W=0,ce=l.length;W<ce;W++)A?this._off(l[W]):this._off(l[W],h,y)}return this},_on:function(l,h,y,S){if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}if(this._listens(l,h,y)===!1){y===this&&(y=void 0);var A={fn:h,ctx:y};S&&(A.once=!0),this._events=this._events||{},this._events[l]=this._events[l]||[],this._events[l].push(A)}},_off:function(l,h,y){var S,A,W;if(this._events&&(S=this._events[l],!!S)){if(arguments.length===1){if(this._firingCount)for(A=0,W=S.length;A<W;A++)S[A].fn=v;delete this._events[l];return}if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}var ce=this._listens(l,h,y);if(ce!==!1){var Ne=S[ce];this._firingCount&&(Ne.fn=v,this._events[l]=S=S.slice()),S.splice(ce,1)}}},fire:function(l,h,y){if(!this.listens(l,y))return this;var S=o({},h,{type:l,target:this,sourceTarget:h&&h.sourceTarget||this});if(this._events){var A=this._events[l];if(A){this._firingCount=this._firingCount+1||1;for(var W=0,ce=A.length;W<ce;W++){var Ne=A[W],Ae=Ne.fn;Ne.once&&this.off(l,Ae,Ne.ctx),Ae.call(Ne.ctx||this,S)}this._firingCount--}}return y&&this._propagateEvent(S),this},listens:function(l,h,y,S){typeof l!="string"&&console.warn('"string" type argument expected');var A=h;typeof h!="function"&&(S=!!h,A=void 0,y=void 0);var W=this._events&&this._events[l];if(W&&W.length&&this._listens(l,A,y)!==!1)return!0;if(S){for(var ce in this._eventParents)if(this._eventParents[ce].listens(l,h,y,S))return!0}return!1},_listens:function(l,h,y){if(!this._events)return!1;var S=this._events[l]||[];if(!h)return!!S.length;y===this&&(y=void 0);for(var A=0,W=S.length;A<W;A++)if(S[A].fn===h&&S[A].ctx===y)return A;return!1},once:function(l,h,y){if(typeof l=="object")for(var S in l)this._on(S,l[S],h,!0);else{l=T(l);for(var A=0,W=l.length;A<W;A++)this._on(l[A],h,y,!0)}return this},addEventParent:function(l){return this._eventParents=this._eventParents||{},this._eventParents[p(l)]=l,this},removeEventParent:function(l){return this._eventParents&&delete this._eventParents[p(l)],this},_propagateEvent:function(l){for(var h in this._eventParents)this._eventParents[h].fire(l.type,o({layer:l.target,propagatedFrom:l.target},l),!0)}};te.addEventListener=te.on,te.removeEventListener=te.clearAllEventListeners=te.off,te.addOneTimeEventListener=te.once,te.fireEvent=te.fire,te.hasEventListeners=te.listens;var V=ye.extend(te);function J(l,h,y){this.x=y?Math.round(l):l,this.y=y?Math.round(h):h}var ne=Math.trunc||function(l){return l>0?Math.floor(l):Math.ceil(l)};J.prototype={clone:function(){return new J(this.x,this.y)},add:function(l){return this.clone()._add(ae(l))},_add:function(l){return this.x+=l.x,this.y+=l.y,this},subtract:function(l){return this.clone()._subtract(ae(l))},_subtract:function(l){return this.x-=l.x,this.y-=l.y,this},divideBy:function(l){return this.clone()._divideBy(l)},_divideBy:function(l){return this.x/=l,this.y/=l,this},multiplyBy:function(l){return this.clone()._multiplyBy(l)},_multiplyBy:function(l){return this.x*=l,this.y*=l,this},scaleBy:function(l){return new J(this.x*l.x,this.y*l.y)},unscaleBy:function(l){return new J(this.x/l.x,this.y/l.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=ne(this.x),this.y=ne(this.y),this},distanceTo:function(l){l=ae(l);var h=l.x-this.x,y=l.y-this.y;return Math.sqrt(h*h+y*y)},equals:function(l){return l=ae(l),l.x===this.x&&l.y===this.y},contains:function(l){return l=ae(l),Math.abs(l.x)<=Math.abs(this.x)&&Math.abs(l.y)<=Math.abs(this.y)},toString:function(){return"Point("+_(this.x)+", "+_(this.y)+")"}};function ae(l,h,y){return l instanceof J?l:O(l)?new J(l[0],l[1]):l==null?l:typeof l=="object"&&"x"in l&&"y"in l?new J(l.x,l.y):new J(l,h,y)}function z(l,h){if(l)for(var y=h?[l,h]:l,S=0,A=y.length;S<A;S++)this.extend(y[S])}z.prototype={extend:function(l){var h,y;if(!l)return this;if(l instanceof J||typeof l[0]=="number"||"x"in l)h=y=ae(l);else if(l=D(l),h=l.min,y=l.max,!h||!y)return this;return!this.min&&!this.max?(this.min=h.clone(),this.max=y.clone()):(this.min.x=Math.min(h.x,this.min.x),this.max.x=Math.max(y.x,this.max.x),this.min.y=Math.min(h.y,this.min.y),this.max.y=Math.max(y.y,this.max.y)),this},getCenter:function(l){return ae((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,l)},getBottomLeft:function(){return ae(this.min.x,this.max.y)},getTopRight:function(){return ae(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(l){var h,y;return typeof l[0]=="number"||l instanceof J?l=ae(l):l=D(l),l instanceof z?(h=l.min,y=l.max):h=y=l,h.x>=this.min.x&&y.x<=this.max.x&&h.y>=this.min.y&&y.y<=this.max.y},intersects:function(l){l=D(l);var h=this.min,y=this.max,S=l.min,A=l.max,W=A.x>=h.x&&S.x<=y.x,ce=A.y>=h.y&&S.y<=y.y;return W&&ce},overlaps:function(l){l=D(l);var h=this.min,y=this.max,S=l.min,A=l.max,W=A.x>h.x&&S.x<y.x,ce=A.y>h.y&&S.y<y.y;return W&&ce},isValid:function(){return!!(this.min&&this.max)},pad:function(l){var h=this.min,y=this.max,S=Math.abs(h.x-y.x)*l,A=Math.abs(h.y-y.y)*l;return D(ae(h.x-S,h.y-A),ae(y.x+S,y.y+A))},equals:function(l){return l?(l=D(l),this.min.equals(l.getTopLeft())&&this.max.equals(l.getBottomRight())):!1}};function D(l,h){return!l||l instanceof z?l:new z(l,h)}function G(l,h){if(l)for(var y=h?[l,h]:l,S=0,A=y.length;S<A;S++)this.extend(y[S])}G.prototype={extend:function(l){var h=this._southWest,y=this._northEast,S,A;if(l instanceof K)S=l,A=l;else if(l instanceof G){if(S=l._southWest,A=l._northEast,!S||!A)return this}else return l?this.extend(fe(l)||q(l)):this;return!h&&!y?(this._southWest=new K(S.lat,S.lng),this._northEast=new K(A.lat,A.lng)):(h.lat=Math.min(S.lat,h.lat),h.lng=Math.min(S.lng,h.lng),y.lat=Math.max(A.lat,y.lat),y.lng=Math.max(A.lng,y.lng)),this},pad:function(l){var h=this._southWest,y=this._northEast,S=Math.abs(h.lat-y.lat)*l,A=Math.abs(h.lng-y.lng)*l;return new G(new K(h.lat-S,h.lng-A),new K(y.lat+S,y.lng+A))},getCenter:function(){return new K((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new K(this.getNorth(),this.getWest())},getSouthEast:function(){return new K(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(l){typeof l[0]=="number"||l instanceof K||"lat"in l?l=fe(l):l=q(l);var h=this._southWest,y=this._northEast,S,A;return l instanceof G?(S=l.getSouthWest(),A=l.getNorthEast()):S=A=l,S.lat>=h.lat&&A.lat<=y.lat&&S.lng>=h.lng&&A.lng<=y.lng},intersects:function(l){l=q(l);var h=this._southWest,y=this._northEast,S=l.getSouthWest(),A=l.getNorthEast(),W=A.lat>=h.lat&&S.lat<=y.lat,ce=A.lng>=h.lng&&S.lng<=y.lng;return W&&ce},overlaps:function(l){l=q(l);var h=this._southWest,y=this._northEast,S=l.getSouthWest(),A=l.getNorthEast(),W=A.lat>h.lat&&S.lat<y.lat,ce=A.lng>h.lng&&S.lng<y.lng;return W&&ce},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(l,h){return l?(l=q(l),this._southWest.equals(l.getSouthWest(),h)&&this._northEast.equals(l.getNorthEast(),h)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function q(l,h){return l instanceof G?l:new G(l,h)}function K(l,h,y){if(isNaN(l)||isNaN(h))throw new Error("Invalid LatLng object: ("+l+", "+h+")");this.lat=+l,this.lng=+h,y!==void 0&&(this.alt=+y)}K.prototype={equals:function(l,h){if(!l)return!1;l=fe(l);var y=Math.max(Math.abs(this.lat-l.lat),Math.abs(this.lng-l.lng));return y<=(h===void 0?1e-9:h)},toString:function(l){return"LatLng("+_(this.lat,l)+", "+_(this.lng,l)+")"},distanceTo:function(l){return We.distance(this,fe(l))},wrap:function(){return We.wrapLatLng(this)},toBounds:function(l){var h=180*l/40075017,y=h/Math.cos(Math.PI/180*this.lat);return q([this.lat-h,this.lng-y],[this.lat+h,this.lng+y])},clone:function(){return new K(this.lat,this.lng,this.alt)}};function fe(l,h,y){return l instanceof K?l:O(l)&&typeof l[0]!="object"?l.length===3?new K(l[0],l[1],l[2]):l.length===2?new K(l[0],l[1]):null:l==null?l:typeof l=="object"&&"lat"in l?new K(l.lat,"lng"in l?l.lng:l.lon,l.alt):h===void 0?null:new K(l,h,y)}var Pe={latLngToPoint:function(l,h){var y=this.projection.project(l),S=this.scale(h);return this.transformation._transform(y,S)},pointToLatLng:function(l,h){var y=this.scale(h),S=this.transformation.untransform(l,y);return this.projection.unproject(S)},project:function(l){return this.projection.project(l)},unproject:function(l){return this.projection.unproject(l)},scale:function(l){return 256*Math.pow(2,l)},zoom:function(l){return Math.log(l/256)/Math.LN2},getProjectedBounds:function(l){if(this.infinite)return null;var h=this.projection.bounds,y=this.scale(l),S=this.transformation.transform(h.min,y),A=this.transformation.transform(h.max,y);return new z(S,A)},infinite:!1,wrapLatLng:function(l){var h=this.wrapLng?x(l.lng,this.wrapLng,!0):l.lng,y=this.wrapLat?x(l.lat,this.wrapLat,!0):l.lat,S=l.alt;return new K(y,h,S)},wrapLatLngBounds:function(l){var h=l.getCenter(),y=this.wrapLatLng(h),S=h.lat-y.lat,A=h.lng-y.lng;if(S===0&&A===0)return l;var W=l.getSouthWest(),ce=l.getNorthEast(),Ne=new K(W.lat-S,W.lng-A),Ae=new K(ce.lat-S,ce.lng-A);return new G(Ne,Ae)}},We=o({},Pe,{wrapLng:[-180,180],R:6371e3,distance:function(l,h){var y=Math.PI/180,S=l.lat*y,A=h.lat*y,W=Math.sin((h.lat-l.lat)*y/2),ce=Math.sin((h.lng-l.lng)*y/2),Ne=W*W+Math.cos(S)*Math.cos(A)*ce*ce,Ae=2*Math.atan2(Math.sqrt(Ne),Math.sqrt(1-Ne));return this.R*Ae}}),Fe=6378137,He={R:Fe,MAX_LATITUDE:85.0511287798,project:function(l){var h=Math.PI/180,y=this.MAX_LATITUDE,S=Math.max(Math.min(y,l.lat),-y),A=Math.sin(S*h);return new J(this.R*l.lng*h,this.R*Math.log((1+A)/(1-A))/2)},unproject:function(l){var h=180/Math.PI;return new K((2*Math.atan(Math.exp(l.y/this.R))-Math.PI/2)*h,l.x*h/this.R)},bounds:(function(){var l=Fe*Math.PI;return new z([-l,-l],[l,l])})()};function it(l,h,y,S){if(O(l)){this._a=l[0],this._b=l[1],this._c=l[2],this._d=l[3];return}this._a=l,this._b=h,this._c=y,this._d=S}it.prototype={transform:function(l,h){return this._transform(l.clone(),h)},_transform:function(l,h){return h=h||1,l.x=h*(this._a*l.x+this._b),l.y=h*(this._c*l.y+this._d),l},untransform:function(l,h){return h=h||1,new J((l.x/h-this._b)/this._a,(l.y/h-this._d)/this._c)}};function ht(l,h,y,S){return new it(l,h,y,S)}var Vt=o({},We,{code:"EPSG:3857",projection:He,transformation:(function(){var l=.5/(Math.PI*He.R);return ht(l,.5,-l,.5)})()}),_t=o({},Vt,{code:"EPSG:900913"});function ia(l){return document.createElementNS("http://www.w3.org/2000/svg",l)}function Lt(l,h){var y="",S,A,W,ce,Ne,Ae;for(S=0,W=l.length;S<W;S++){for(Ne=l[S],A=0,ce=Ne.length;A<ce;A++)Ae=Ne[A],y+=(A?"L":"M")+Ae.x+" "+Ae.y;y+=h?be.svg?"z":"x":""}return y||"M0 0"}var Be=document.documentElement.style,yt="ActiveXObject"in window,ke=yt&&!document.addEventListener,ze="msLaunchUri"in navigator&&!("documentMode"in document),Je=Za("webkit"),nt=Za("android"),ut=Za("android 2")||Za("android 3"),ft=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),bt=nt&&Za("Google")&&ft<537&&!("AudioNode"in window),Ut=!!window.opera,Rt=!ze&&Za("chrome"),Pt=Za("gecko")&&!Je&&!Ut&&!yt,qe=!Rt&&Za("safari"),at=Za("phantom"),wt="OTransition"in Be,kt=navigator.platform.indexOf("Win")===0,da=yt&&"transition"in Be,xe="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!ut,De="MozPerspective"in Be,$e=!window.L_DISABLE_3D&&(da||xe||De)&&!wt&&!at,Et=typeof orientation!="undefined"||Za("mobile"),Gt=Et&&Je,Sa=Et&&xe,tt=!window.PointerEvent&&window.MSPointerEvent,Zt=!!(window.PointerEvent||tt),Ia="ontouchstart"in window||!!window.TouchEvent,Ba=!window.L_NO_TOUCH&&(Ia||Zt),Dr=Et&&Ut,cn=Et&&Pt,gs=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,ps=(function(){var l=!1;try{var h=Object.defineProperty({},"passive",{get:function(){l=!0}});window.addEventListener("testPassiveEventSupport",v,h),window.removeEventListener("testPassiveEventSupport",v,h)}catch(y){}return l})(),Zn=(function(){return!!document.createElement("canvas").getContext})(),Rr=!!(document.createElementNS&&ia("svg").createSVGRect),qn=!!Rr&&(function(){var l=document.createElement("div");return l.innerHTML="<svg/>",(l.firstChild&&l.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),dn=!Rr&&(function(){try{var l=document.createElement("div");l.innerHTML='<v:shape adj="1"/>';var h=l.firstChild;return h.style.behavior="url(#default#VML)",h&&typeof h.adj=="object"}catch(y){return!1}})(),Cn=navigator.platform.indexOf("Mac")===0,xs=navigator.platform.indexOf("Linux")===0;function Za(l){return navigator.userAgent.toLowerCase().indexOf(l)>=0}var be={ie:yt,ielt9:ke,edge:ze,webkit:Je,android:nt,android23:ut,androidStock:bt,opera:Ut,chrome:Rt,gecko:Pt,safari:qe,phantom:at,opera12:wt,win:kt,ie3d:da,webkit3d:xe,gecko3d:De,any3d:$e,mobile:Et,mobileWebkit:Gt,mobileWebkit3d:Sa,msPointer:tt,pointer:Zt,touch:Ba,touchNative:Ia,mobileOpera:Dr,mobileGecko:cn,retina:gs,passiveEvents:ps,canvas:Zn,svg:Rr,vml:dn,inlineSvg:qn,mac:Cn,linux:xs},I=be.msPointer?"MSPointerDown":"pointerdown",ee=be.msPointer?"MSPointerMove":"pointermove",Y=be.msPointer?"MSPointerUp":"pointerup",X=be.msPointer?"MSPointerCancel":"pointercancel",Q={touchstart:I,touchmove:ee,touchend:Y,touchcancel:X},F={touchstart:lt,touchmove:Qe,touchend:Qe,touchcancel:Qe},he={},Ee=!1;function _e(l,h,y){return h==="touchstart"&&ot(),F[h]?(y=F[h].bind(this,y),l.addEventListener(Q[h],y,!1),y):(console.warn("wrong event specified:",h),v)}function je(l,h,y){if(!Q[h]){console.warn("wrong event specified:",h);return}l.removeEventListener(Q[h],y,!1)}function Se(l){he[l.pointerId]=l}function Ye(l){he[l.pointerId]&&(he[l.pointerId]=l)}function et(l){delete he[l.pointerId]}function ot(){Ee||(document.addEventListener(I,Se,!0),document.addEventListener(ee,Ye,!0),document.addEventListener(Y,et,!0),document.addEventListener(X,et,!0),Ee=!0)}function Qe(l,h){if(h.pointerType!==(h.MSPOINTER_TYPE_MOUSE||"mouse")){h.touches=[];for(var y in he)h.touches.push(he[y]);h.changedTouches=[h],l(h)}}function lt(l,h){h.MSPOINTER_TYPE_TOUCH&&h.pointerType===h.MSPOINTER_TYPE_TOUCH&&Ua(h),Qe(l,h)}function mt(l){var h={},y,S;for(S in l)y=l[S],h[S]=y&&y.bind?y.bind(l):y;return l=h,h.type="dblclick",h.detail=2,h.isTrusted=!1,h._simulated=!0,h}var ya=200;function ba(l,h){l.addEventListener("dblclick",h);var y=0,S;function A(W){if(W.detail!==1){S=W.detail;return}if(!(W.pointerType==="mouse"||W.sourceCapabilities&&!W.sourceCapabilities.firesTouchEvents)){var ce=uo(W);if(!(ce.some(function(Ae){return Ae instanceof HTMLLabelElement&&Ae.attributes.for})&&!ce.some(function(Ae){return Ae instanceof HTMLInputElement||Ae instanceof HTMLSelectElement}))){var Ne=Date.now();Ne-y<=ya?(S++,S===2&&h(mt(W))):S=1,y=Ne}}}return l.addEventListener("click",A),{dblclick:h,simDblclick:A}}function Ea(l,h){l.removeEventListener("dblclick",h.dblclick),l.removeEventListener("click",h.simDblclick)}var Tr=io(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),un=io(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Yn=un==="webkitTransition"||un==="OTransition"?un+"End":"transitionend";function fn(l){return typeof l=="string"?document.getElementById(l):l}function Xn(l,h){var y=l.style[h]||l.currentStyle&&l.currentStyle[h];if((!y||y==="auto")&&document.defaultView){var S=document.defaultView.getComputedStyle(l,null);y=S?S[h]:null}return y==="auto"?null:y}function Mt(l,h,y){var S=document.createElement(l);return S.className=h||"",y&&y.appendChild(S),S}function va(l){var h=l.parentNode;h&&h.removeChild(l)}function Wr(l){for(;l.firstChild;)l.removeChild(l.firstChild)}function sr(l){var h=l.parentNode;h&&h.lastChild!==l&&h.appendChild(l)}function Bs(l){var h=l.parentNode;h&&h.firstChild!==l&&h.insertBefore(l,h.firstChild)}function Lc(l,h){if(l.classList!==void 0)return l.classList.contains(h);var y=cl(l);return y.length>0&&new RegExp("(^|\\s)"+h+"(\\s|$)").test(y)}function Ft(l,h){if(l.classList!==void 0)for(var y=T(h),S=0,A=y.length;S<A;S++)l.classList.add(y[S]);else if(!Lc(l,h)){var W=cl(l);xi(l,(W?W+" ":"")+h)}}function Ra(l,h){l.classList!==void 0?l.classList.remove(h):xi(l,k((" "+cl(l)+" ").replace(" "+h+" "," ")))}function xi(l,h){l.className.baseVal===void 0?l.className=h:l.className.baseVal=h}function cl(l){return l.correspondingElement&&(l=l.correspondingElement),l.className.baseVal===void 0?l.className:l.className.baseVal}function Ca(l,h){"opacity"in l.style?l.style.opacity=h:"filter"in l.style&&Mc(l,h)}function Mc(l,h){var y=!1,S="DXImageTransform.Microsoft.Alpha";try{y=l.filters.item(S)}catch(A){if(h===1)return}h=Math.round(h*100),y?(y.Enabled=h!==100,y.Opacity=h):l.style.filter+=" progid:"+S+"(opacity="+h+")"}function io(l){for(var h=document.documentElement.style,y=0;y<l.length;y++)if(l[y]in h)return l[y];return!1}function Kn(l,h,y){var S=h||new J(0,0);l.style[Tr]=(be.ie3d?"translate("+S.x+"px,"+S.y+"px)":"translate3d("+S.x+"px,"+S.y+"px,0)")+(y?" scale("+y+")":"")}function ja(l,h){l._leaflet_pos=h,be.any3d?Kn(l,h):(l.style.left=h.x+"px",l.style.top=h.y+"px")}function ys(l){return l._leaflet_pos||new J(0,0)}var yi,An,Dc;if("onselectstart"in document)yi=function(){Ct(window,"selectstart",Ua)},An=function(){ca(window,"selectstart",Ua)};else{var bi=io(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);yi=function(){if(bi){var l=document.documentElement.style;Dc=l[bi],l[bi]="none"}},An=function(){bi&&(document.documentElement.style[bi]=Dc,Dc=void 0)}}function dl(){Ct(window,"dragstart",Ua)}function oo(){ca(window,"dragstart",Ua)}var ul,Rc;function vi(l){for(;l.tabIndex===-1;)l=l.parentNode;l.style&&(Vr(),ul=l,Rc=l.style.outlineStyle,l.style.outlineStyle="none",Ct(window,"keydown",Vr))}function Vr(){ul&&(ul.style.outlineStyle=Rc,ul=void 0,Rc=void 0,ca(window,"keydown",Vr))}function fl(l){do l=l.parentNode;while((!l.offsetWidth||!l.offsetHeight)&&l!==document.body);return l}function lo(l){var h=l.getBoundingClientRect();return{x:h.width/l.offsetWidth||1,y:h.height/l.offsetHeight||1,boundingClientRect:h}}var _i={__proto__:null,TRANSFORM:Tr,TRANSITION:un,TRANSITION_END:Yn,get:fn,getStyle:Xn,create:Mt,remove:va,empty:Wr,toFront:sr,toBack:Bs,hasClass:Lc,addClass:Ft,removeClass:Ra,setClass:xi,getClass:cl,setOpacity:Ca,testProp:io,setTransform:Kn,setPosition:ja,getPosition:ys,get disableTextSelection(){return yi},get enableTextSelection(){return An},disableImageDrag:dl,enableImageDrag:oo,preventOutline:vi,restoreOutline:Vr,getSizedParentNode:fl,getScale:lo};function Ct(l,h,y,S){if(h&&typeof h=="object")for(var A in h)mn(l,A,h[A],y);else{h=T(h);for(var W=0,ce=h.length;W<ce;W++)mn(l,h[W],y,S)}return this}var hn="_leaflet_events";function ca(l,h,y,S){if(arguments.length===1)Pc(l),delete l[hn];else if(h&&typeof h=="object")for(var A in h)co(l,A,h[A],y);else if(h=T(h),arguments.length===2)Pc(l,function(Ne){return R(h,Ne)!==-1});else for(var W=0,ce=h.length;W<ce;W++)co(l,h[W],y,S);return this}function Pc(l,h){for(var y in l[hn]){var S=y.split(/\d/)[0];(!h||h(S))&&co(l,S,null,null,y)}}var zs={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function mn(l,h,y,S){var A=h+p(y)+(S?"_"+p(S):"");if(l[hn]&&l[hn][A])return this;var W=function(Ne){return y.call(S||l,Ne||window.event)},ce=W;!be.touchNative&&be.pointer&&h.indexOf("touch")===0?W=_e(l,h,W):be.touch&&h==="dblclick"?W=ba(l,W):"addEventListener"in l?h==="touchstart"||h==="touchmove"||h==="wheel"||h==="mousewheel"?l.addEventListener(zs[h]||h,W,be.passiveEvents?{passive:!1}:!1):h==="mouseenter"||h==="mouseleave"?(W=function(Ne){Ne=Ne||window.event,Jn(l,Ne)&&ce(Ne)},l.addEventListener(zs[h],W,!1)):l.addEventListener(h,ce,!1):l.attachEvent("on"+h,W),l[hn]=l[hn]||{},l[hn][A]=W}function co(l,h,y,S,A){A=A||h+p(y)+(S?"_"+p(S):"");var W=l[hn]&&l[hn][A];if(!W)return this;!be.touchNative&&be.pointer&&h.indexOf("touch")===0?je(l,h,W):be.touch&&h==="dblclick"?Ea(l,W):"removeEventListener"in l?l.removeEventListener(zs[h]||h,W,!1):l.detachEvent("on"+h,W),l[hn][A]=null}function gn(l){return l.stopPropagation?l.stopPropagation():l.originalEvent?l.originalEvent._stopped=!0:l.cancelBubble=!0,this}function On(l){return mn(l,"wheel",gn),this}function Us(l){return Ct(l,"mousedown touchstart dblclick contextmenu",gn),l._leaflet_disable_click=!0,this}function Ua(l){return l.preventDefault?l.preventDefault():l.returnValue=!1,this}function bs(l){return Ua(l),gn(l),this}function uo(l){if(l.composedPath)return l.composedPath();for(var h=[],y=l.target;y;)h.push(y),y=y.parentNode;return h}function fo(l,h){if(!h)return new J(l.clientX,l.clientY);var y=lo(h),S=y.boundingClientRect;return new J((l.clientX-S.left)/y.x-h.clientLeft,(l.clientY-S.top)/y.y-h.clientTop)}var _u=be.linux&&be.chrome?window.devicePixelRatio:be.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function xr(l){return be.edge?l.wheelDeltaY/2:l.deltaY&&l.deltaMode===0?-l.deltaY/_u:l.deltaY&&l.deltaMode===1?-l.deltaY*20:l.deltaY&&l.deltaMode===2?-l.deltaY*60:l.deltaX||l.deltaZ?0:l.wheelDelta?(l.wheelDeltaY||l.wheelDelta)/2:l.detail&&Math.abs(l.detail)<32765?-l.detail*20:l.detail?l.detail/-32765*60:0}function Jn(l,h){var y=h.relatedTarget;if(!y)return!0;try{for(;y&&y!==l;)y=y.parentNode}catch(S){return!1}return y!==l}var hl={__proto__:null,on:Ct,off:ca,stopPropagation:gn,disableScrollPropagation:On,disableClickPropagation:Us,preventDefault:Ua,stop:bs,getPropagationPath:uo,getMousePosition:fo,getWheelDelta:xr,isExternalTarget:Jn,addListener:Ct,removeListener:ca},wi=V.extend({run:function(l,h,y,S){this.stop(),this._el=l,this._inProgress=!0,this._duration=y||.25,this._easeOutPower=1/Math.max(S||.5,.2),this._startPos=ys(l),this._offset=h.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=le(this._animate,this),this._step()},_step:function(l){var h=+new Date-this._startTime,y=this._duration*1e3;h<y?this._runFrame(this._easeOut(h/y),l):(this._runFrame(1),this._complete())},_runFrame:function(l,h){var y=this._startPos.add(this._offset.multiplyBy(l));h&&y._round(),ja(this._el,y),this.fire("step")},_complete:function(){re(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(l){return 1-Math.pow(1-l,this._easeOutPower)}}),Kt=V.extend({options:{crs:Vt,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(l,h){h=N(this,h),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(l),this._initLayout(),this._onResize=c(this._onResize,this),this._initEvents(),h.maxBounds&&this.setMaxBounds(h.maxBounds),h.zoom!==void 0&&(this._zoom=this._limitZoom(h.zoom)),h.center&&h.zoom!==void 0&&this.setView(fe(h.center),h.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=un&&be.any3d&&!be.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Ct(this._proxy,Yn,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(l,h,y){if(h=h===void 0?this._zoom:this._limitZoom(h),l=this._limitCenter(fe(l),h,this.options.maxBounds),y=y||{},this._stop(),this._loaded&&!y.reset&&y!==!0){y.animate!==void 0&&(y.zoom=o({animate:y.animate},y.zoom),y.pan=o({animate:y.animate,duration:y.duration},y.pan));var S=this._zoom!==h?this._tryAnimatedZoom&&this._tryAnimatedZoom(l,h,y.zoom):this._tryAnimatedPan(l,y.pan);if(S)return clearTimeout(this._sizeTimer),this}return this._resetView(l,h,y.pan&&y.pan.noMoveStart),this},setZoom:function(l,h){return this._loaded?this.setView(this.getCenter(),l,{zoom:h}):(this._zoom=l,this)},zoomIn:function(l,h){return l=l||(be.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+l,h)},zoomOut:function(l,h){return l=l||(be.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-l,h)},setZoomAround:function(l,h,y){var S=this.getZoomScale(h),A=this.getSize().divideBy(2),W=l instanceof J?l:this.latLngToContainerPoint(l),ce=W.subtract(A).multiplyBy(1-1/S),Ne=this.containerPointToLatLng(A.add(ce));return this.setView(Ne,h,{zoom:y})},_getBoundsCenterZoom:function(l,h){h=h||{},l=l.getBounds?l.getBounds():q(l);var y=ae(h.paddingTopLeft||h.padding||[0,0]),S=ae(h.paddingBottomRight||h.padding||[0,0]),A=this.getBoundsZoom(l,!1,y.add(S));if(A=typeof h.maxZoom=="number"?Math.min(h.maxZoom,A):A,A===1/0)return{center:l.getCenter(),zoom:A};var W=S.subtract(y).divideBy(2),ce=this.project(l.getSouthWest(),A),Ne=this.project(l.getNorthEast(),A),Ae=this.unproject(ce.add(Ne).divideBy(2).add(W),A);return{center:Ae,zoom:A}},fitBounds:function(l,h){if(l=q(l),!l.isValid())throw new Error("Bounds are not valid.");var y=this._getBoundsCenterZoom(l,h);return this.setView(y.center,y.zoom,h)},fitWorld:function(l){return this.fitBounds([[-90,-180],[90,180]],l)},panTo:function(l,h){return this.setView(l,this._zoom,{pan:h})},panBy:function(l,h){if(l=ae(l).round(),h=h||{},!l.x&&!l.y)return this.fire("moveend");if(h.animate!==!0&&!this.getSize().contains(l))return this._resetView(this.unproject(this.project(this.getCenter()).add(l)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new wi,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),h.noMoveStart||this.fire("movestart"),h.animate!==!1){Ft(this._mapPane,"leaflet-pan-anim");var y=this._getMapPanePos().subtract(l).round();this._panAnim.run(this._mapPane,y,h.duration||.25,h.easeLinearity)}else this._rawPanBy(l),this.fire("move").fire("moveend");return this},flyTo:function(l,h,y){if(y=y||{},y.animate===!1||!be.any3d)return this.setView(l,h,y);this._stop();var S=this.project(this.getCenter()),A=this.project(l),W=this.getSize(),ce=this._zoom;l=fe(l),h=h===void 0?ce:h;var Ne=Math.max(W.x,W.y),Ae=Ne*this.getZoomScale(ce,h),Ge=A.distanceTo(S)||1,ct=1.42,vt=ct*ct;function Ht(za){var as=za?-1:1,Vs=za?Ae:Ne,Kc=Ae*Ae-Ne*Ne+as*vt*vt*Ge*Ge,Eo=2*Vs*vt*Ge,Co=Kc/Eo,Es=Math.sqrt(Co*Co+1)-Co,rs=Es<1e-9?-18:Math.log(Es);return rs}function ir(za){return(Math.exp(za)-Math.exp(-za))/2}function Ha(za){return(Math.exp(za)+Math.exp(-za))/2}function Fr(za){return ir(za)/Ha(za)}var ta=Ht(0);function aa(za){return Ne*(Ha(ta)/Ha(ta+ct*za))}function qt(za){return Ne*(Ha(ta)*Fr(ta+ct*za)-ir(ta))/vt}function js(za){return 1-Math.pow(1-za,1.5)}var Yr=Date.now(),Tl=(Ht(1)-ta)/ct,Ts=y.duration?1e3*y.duration:1e3*Tl*.8;function Xc(){var za=(Date.now()-Yr)/Ts,as=js(za)*Tl;za<=1?(this._flyToFrame=le(Xc,this),this._move(this.unproject(S.add(A.subtract(S).multiplyBy(qt(as)/Ge)),ce),this.getScaleZoom(Ne/aa(as),ce),{flyTo:!0})):this._move(l,h)._moveEnd(!0)}return this._moveStart(!0,y.noMoveStart),Xc.call(this),this},flyToBounds:function(l,h){var y=this._getBoundsCenterZoom(l,h);return this.flyTo(y.center,y.zoom,h)},setMaxBounds:function(l){return l=q(l),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),l.isValid()?(this.options.maxBounds=l,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(l){var h=this.options.minZoom;return this.options.minZoom=l,this._loaded&&h!==l&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(l):this},setMaxZoom:function(l){var h=this.options.maxZoom;return this.options.maxZoom=l,this._loaded&&h!==l&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(l):this},panInsideBounds:function(l,h){this._enforcingBounds=!0;var y=this.getCenter(),S=this._limitCenter(y,this._zoom,q(l));return y.equals(S)||this.panTo(S,h),this._enforcingBounds=!1,this},panInside:function(l,h){h=h||{};var y=ae(h.paddingTopLeft||h.padding||[0,0]),S=ae(h.paddingBottomRight||h.padding||[0,0]),A=this.project(this.getCenter()),W=this.project(l),ce=this.getPixelBounds(),Ne=D([ce.min.add(y),ce.max.subtract(S)]),Ae=Ne.getSize();if(!Ne.contains(W)){this._enforcingBounds=!0;var Ge=W.subtract(Ne.getCenter()),ct=Ne.extend(W).getSize().subtract(Ae);A.x+=Ge.x<0?-ct.x:ct.x,A.y+=Ge.y<0?-ct.y:ct.y,this.panTo(this.unproject(A),h),this._enforcingBounds=!1}return this},invalidateSize:function(l){if(!this._loaded)return this;l=o({animate:!1,pan:!0},l===!0?{animate:!0}:l);var h=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var y=this.getSize(),S=h.divideBy(2).round(),A=y.divideBy(2).round(),W=S.subtract(A);return!W.x&&!W.y?this:(l.animate&&l.pan?this.panBy(W):(l.pan&&this._rawPanBy(W),this.fire("move"),l.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(c(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:h,newSize:y}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(l){if(l=this._locateOptions=o({timeout:1e4,watch:!1},l),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var h=c(this._handleGeolocationResponse,this),y=c(this._handleGeolocationError,this);return l.watch?this._locationWatchId=navigator.geolocation.watchPosition(h,y,l):navigator.geolocation.getCurrentPosition(h,y,l),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(l){if(this._container._leaflet_id){var h=l.code,y=l.message||(h===1?"permission denied":h===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:h,message:"Geolocation error: "+y+"."})}},_handleGeolocationResponse:function(l){if(this._container._leaflet_id){var h=l.coords.latitude,y=l.coords.longitude,S=new K(h,y),A=S.toBounds(l.coords.accuracy*2),W=this._locateOptions;if(W.setView){var ce=this.getBoundsZoom(A);this.setView(S,W.maxZoom?Math.min(ce,W.maxZoom):ce)}var Ne={latlng:S,bounds:A,timestamp:l.timestamp};for(var Ae in l.coords)typeof l.coords[Ae]=="number"&&(Ne[Ae]=l.coords[Ae]);this.fire("locationfound",Ne)}},addHandler:function(l,h){if(!h)return this;var y=this[l]=new h(this);return this._handlers.push(y),this.options[l]&&y.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(h){this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),va(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(re(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var l;for(l in this._layers)this._layers[l].remove();for(l in this._panes)va(this._panes[l]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(l,h){var y="leaflet-pane"+(l?" leaflet-"+l.replace("Pane","")+"-pane":""),S=Mt("div",y,h||this._mapPane);return l&&(this._panes[l]=S),S},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var l=this.getPixelBounds(),h=this.unproject(l.getBottomLeft()),y=this.unproject(l.getTopRight());return new G(h,y)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(l,h,y){l=q(l),y=ae(y||[0,0]);var S=this.getZoom()||0,A=this.getMinZoom(),W=this.getMaxZoom(),ce=l.getNorthWest(),Ne=l.getSouthEast(),Ae=this.getSize().subtract(y),Ge=D(this.project(Ne,S),this.project(ce,S)).getSize(),ct=be.any3d?this.options.zoomSnap:1,vt=Ae.x/Ge.x,Ht=Ae.y/Ge.y,ir=h?Math.max(vt,Ht):Math.min(vt,Ht);return S=this.getScaleZoom(ir,S),ct&&(S=Math.round(S/(ct/100))*(ct/100),S=h?Math.ceil(S/ct)*ct:Math.floor(S/ct)*ct),Math.max(A,Math.min(W,S))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new J(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(l,h){var y=this._getTopLeftPoint(l,h);return new z(y,y.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(l){return this.options.crs.getProjectedBounds(l===void 0?this.getZoom():l)},getPane:function(l){return typeof l=="string"?this._panes[l]:l},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(l,h){var y=this.options.crs;return h=h===void 0?this._zoom:h,y.scale(l)/y.scale(h)},getScaleZoom:function(l,h){var y=this.options.crs;h=h===void 0?this._zoom:h;var S=y.zoom(l*y.scale(h));return isNaN(S)?1/0:S},project:function(l,h){return h=h===void 0?this._zoom:h,this.options.crs.latLngToPoint(fe(l),h)},unproject:function(l,h){return h=h===void 0?this._zoom:h,this.options.crs.pointToLatLng(ae(l),h)},layerPointToLatLng:function(l){var h=ae(l).add(this.getPixelOrigin());return this.unproject(h)},latLngToLayerPoint:function(l){var h=this.project(fe(l))._round();return h._subtract(this.getPixelOrigin())},wrapLatLng:function(l){return this.options.crs.wrapLatLng(fe(l))},wrapLatLngBounds:function(l){return this.options.crs.wrapLatLngBounds(q(l))},distance:function(l,h){return this.options.crs.distance(fe(l),fe(h))},containerPointToLayerPoint:function(l){return ae(l).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(l){return ae(l).add(this._getMapPanePos())},containerPointToLatLng:function(l){var h=this.containerPointToLayerPoint(ae(l));return this.layerPointToLatLng(h)},latLngToContainerPoint:function(l){return this.layerPointToContainerPoint(this.latLngToLayerPoint(fe(l)))},mouseEventToContainerPoint:function(l){return fo(l,this._container)},mouseEventToLayerPoint:function(l){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(l))},mouseEventToLatLng:function(l){return this.layerPointToLatLng(this.mouseEventToLayerPoint(l))},_initContainer:function(l){var h=this._container=fn(l);if(h){if(h._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");Ct(h,"scroll",this._onScroll,this),this._containerId=p(h)},_initLayout:function(){var l=this._container;this._fadeAnimated=this.options.fadeAnimation&&be.any3d,Ft(l,"leaflet-container"+(be.touch?" leaflet-touch":"")+(be.retina?" leaflet-retina":"")+(be.ielt9?" leaflet-oldie":"")+(be.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var h=Xn(l,"position");h!=="absolute"&&h!=="relative"&&h!=="fixed"&&h!=="sticky"&&(l.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var l=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),ja(this._mapPane,new J(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Ft(l.markerPane,"leaflet-zoom-hide"),Ft(l.shadowPane,"leaflet-zoom-hide"))},_resetView:function(l,h,y){ja(this._mapPane,new J(0,0));var S=!this._loaded;this._loaded=!0,h=this._limitZoom(h),this.fire("viewprereset");var A=this._zoom!==h;this._moveStart(A,y)._move(l,h)._moveEnd(A),this.fire("viewreset"),S&&this.fire("load")},_moveStart:function(l,h){return l&&this.fire("zoomstart"),h||this.fire("movestart"),this},_move:function(l,h,y,S){h===void 0&&(h=this._zoom);var A=this._zoom!==h;return this._zoom=h,this._lastCenter=l,this._pixelOrigin=this._getNewPixelOrigin(l),S?y&&y.pinch&&this.fire("zoom",y):((A||y&&y.pinch)&&this.fire("zoom",y),this.fire("move",y)),this},_moveEnd:function(l){return l&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return re(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(l){ja(this._mapPane,this._getMapPanePos().subtract(l))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(l){this._targets={},this._targets[p(this._container)]=this;var h=l?ca:Ct;h(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&h(window,"resize",this._onResize,this),be.any3d&&this.options.transform3DLimit&&(l?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){re(this._resizeRequest),this._resizeRequest=le(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var l=this._getMapPanePos();Math.max(Math.abs(l.x),Math.abs(l.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(l,h){for(var y=[],S,A=h==="mouseout"||h==="mouseover",W=l.target||l.srcElement,ce=!1;W;){if(S=this._targets[p(W)],S&&(h==="click"||h==="preclick")&&this._draggableMoved(S)){ce=!0;break}if(S&&S.listens(h,!0)&&(A&&!Jn(W,l)||(y.push(S),A))||W===this._container)break;W=W.parentNode}return!y.length&&!ce&&!A&&this.listens(h,!0)&&(y=[this]),y},_isClickDisabled:function(l){for(;l&&l!==this._container;){if(l._leaflet_disable_click)return!0;l=l.parentNode}},_handleDOMEvent:function(l){var h=l.target||l.srcElement;if(!(!this._loaded||h._leaflet_disable_events||l.type==="click"&&this._isClickDisabled(h))){var y=l.type;y==="mousedown"&&vi(h),this._fireDOMEvent(l,y)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(l,h,y){if(l.type==="click"){var S=o({},l);S.type="preclick",this._fireDOMEvent(S,S.type,y)}var A=this._findEventTargets(l,h);if(y){for(var W=[],ce=0;ce<y.length;ce++)y[ce].listens(h,!0)&&W.push(y[ce]);A=W.concat(A)}if(A.length){h==="contextmenu"&&Ua(l);var Ne=A[0],Ae={originalEvent:l};if(l.type!=="keypress"&&l.type!=="keydown"&&l.type!=="keyup"){var Ge=Ne.getLatLng&&(!Ne._radius||Ne._radius<=10);Ae.containerPoint=Ge?this.latLngToContainerPoint(Ne.getLatLng()):this.mouseEventToContainerPoint(l),Ae.layerPoint=this.containerPointToLayerPoint(Ae.containerPoint),Ae.latlng=Ge?Ne.getLatLng():this.layerPointToLatLng(Ae.layerPoint)}for(ce=0;ce<A.length;ce++)if(A[ce].fire(h,Ae,!0),Ae.originalEvent._stopped||A[ce].options.bubblingMouseEvents===!1&&R(this._mouseEvents,h)!==-1)return}},_draggableMoved:function(l){return l=l.dragging&&l.dragging.enabled()?l:this,l.dragging&&l.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var l=0,h=this._handlers.length;l<h;l++)this._handlers[l].disable()},whenReady:function(l,h){return this._loaded?l.call(h||this,{target:this}):this.on("load",l,h),this},_getMapPanePos:function(){return ys(this._mapPane)||new J(0,0)},_moved:function(){var l=this._getMapPanePos();return l&&!l.equals([0,0])},_getTopLeftPoint:function(l,h){var y=l&&h!==void 0?this._getNewPixelOrigin(l,h):this.getPixelOrigin();return y.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(l,h){var y=this.getSize()._divideBy(2);return this.project(l,h)._subtract(y)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(l,h,y){var S=this._getNewPixelOrigin(y,h);return this.project(l,h)._subtract(S)},_latLngBoundsToNewLayerBounds:function(l,h,y){var S=this._getNewPixelOrigin(y,h);return D([this.project(l.getSouthWest(),h)._subtract(S),this.project(l.getNorthWest(),h)._subtract(S),this.project(l.getSouthEast(),h)._subtract(S),this.project(l.getNorthEast(),h)._subtract(S)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(l){return this.latLngToLayerPoint(l).subtract(this._getCenterLayerPoint())},_limitCenter:function(l,h,y){if(!y)return l;var S=this.project(l,h),A=this.getSize().divideBy(2),W=new z(S.subtract(A),S.add(A)),ce=this._getBoundsOffset(W,y,h);return Math.abs(ce.x)<=1&&Math.abs(ce.y)<=1?l:this.unproject(S.add(ce),h)},_limitOffset:function(l,h){if(!h)return l;var y=this.getPixelBounds(),S=new z(y.min.add(l),y.max.add(l));return l.add(this._getBoundsOffset(S,h))},_getBoundsOffset:function(l,h,y){var S=D(this.project(h.getNorthEast(),y),this.project(h.getSouthWest(),y)),A=S.min.subtract(l.min),W=S.max.subtract(l.max),ce=this._rebound(A.x,-W.x),Ne=this._rebound(A.y,-W.y);return new J(ce,Ne)},_rebound:function(l,h){return l+h>0?Math.round(l-h)/2:Math.max(0,Math.ceil(l))-Math.max(0,Math.floor(h))},_limitZoom:function(l){var h=this.getMinZoom(),y=this.getMaxZoom(),S=be.any3d?this.options.zoomSnap:1;return S&&(l=Math.round(l/S)*S),Math.max(h,Math.min(y,l))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Ra(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(l,h){var y=this._getCenterOffset(l)._trunc();return(h&&h.animate)!==!0&&!this.getSize().contains(y)?!1:(this.panBy(y,h),!0)},_createAnimProxy:function(){var l=this._proxy=Mt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(l),this.on("zoomanim",function(h){var y=Tr,S=this._proxy.style[y];Kn(this._proxy,this.project(h.center,h.zoom),this.getZoomScale(h.zoom,1)),S===this._proxy.style[y]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){va(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var l=this.getCenter(),h=this.getZoom();Kn(this._proxy,this.project(l,h),this.getZoomScale(h,1))},_catchTransitionEnd:function(l){this._animatingZoom&&l.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(l,h,y){if(this._animatingZoom)return!0;if(y=y||{},!this._zoomAnimated||y.animate===!1||this._nothingToAnimate()||Math.abs(h-this._zoom)>this.options.zoomAnimationThreshold)return!1;var S=this.getZoomScale(h),A=this._getCenterOffset(l)._divideBy(1-1/S);return y.animate!==!0&&!this.getSize().contains(A)?!1:(le(function(){this._moveStart(!0,y.noMoveStart||!1)._animateZoom(l,h,!0)},this),!0)},_animateZoom:function(l,h,y,S){this._mapPane&&(y&&(this._animatingZoom=!0,this._animateToCenter=l,this._animateToZoom=h,Ft(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:l,zoom:h,noUpdate:S}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(c(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Ra(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Fc(l,h){return new Kt(l,h)}var Pr=ye.extend({options:{position:"topright"},initialize:function(l){N(this,l)},getPosition:function(){return this.options.position},setPosition:function(l){var h=this._map;return h&&h.removeControl(this),this.options.position=l,h&&h.addControl(this),this},getContainer:function(){return this._container},addTo:function(l){this.remove(),this._map=l;var h=this._container=this.onAdd(l),y=this.getPosition(),S=l._controlCorners[y];return Ft(h,"leaflet-control"),y.indexOf("bottom")!==-1?S.insertBefore(h,S.firstChild):S.appendChild(h),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(va(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(l){this._map&&l&&l.screenX>0&&l.screenY>0&&this._map.getContainer().focus()}}),Qn=function(l){return new Pr(l)};Kt.include({addControl:function(l){return l.addTo(this),this},removeControl:function(l){return l.remove(),this},_initControlPos:function(){var l=this._controlCorners={},h="leaflet-",y=this._controlContainer=Mt("div",h+"control-container",this._container);function S(A,W){var ce=h+A+" "+h+W;l[A+W]=Mt("div",ce,y)}S("top","left"),S("top","right"),S("bottom","left"),S("bottom","right")},_clearControlPos:function(){for(var l in this._controlCorners)va(this._controlCorners[l]);va(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ho=Pr.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(l,h,y,S){return y<S?-1:S<y?1:0}},initialize:function(l,h,y){N(this,y),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var S in l)this._addLayer(l[S],S);for(S in h)this._addLayer(h[S],S,!0)},onAdd:function(l){this._initLayout(),this._update(),this._map=l,l.on("zoomend",this._checkDisabledLayers,this);for(var h=0;h<this._layers.length;h++)this._layers[h].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(l){return Pr.prototype.addTo.call(this,l),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var l=0;l<this._layers.length;l++)this._layers[l].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(l,h){return this._addLayer(l,h),this._map?this._update():this},addOverlay:function(l,h){return this._addLayer(l,h,!0),this._map?this._update():this},removeLayer:function(l){l.off("add remove",this._onLayerChange,this);var h=this._getLayer(p(l));return h&&this._layers.splice(this._layers.indexOf(h),1),this._map?this._update():this},expand:function(){Ft(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var l=this._map.getSize().y-(this._container.offsetTop+50);return l<this._section.clientHeight?(Ft(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=l+"px"):Ra(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Ra(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var l="leaflet-control-layers",h=this._container=Mt("div",l),y=this.options.collapsed;h.setAttribute("aria-haspopup",!0),Us(h),On(h);var S=this._section=Mt("section",l+"-list");y&&(this._map.on("click",this.collapse,this),Ct(h,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var A=this._layersLink=Mt("a",l+"-toggle",h);A.href="#",A.title="Layers",A.setAttribute("role","button"),Ct(A,{keydown:function(W){W.keyCode===13&&this._expandSafely()},click:function(W){Ua(W),this._expandSafely()}},this),y||this.expand(),this._baseLayersList=Mt("div",l+"-base",S),this._separator=Mt("div",l+"-separator",S),this._overlaysList=Mt("div",l+"-overlays",S),h.appendChild(S)},_getLayer:function(l){for(var h=0;h<this._layers.length;h++)if(this._layers[h]&&p(this._layers[h].layer)===l)return this._layers[h]},_addLayer:function(l,h,y){this._map&&l.on("add remove",this._onLayerChange,this),this._layers.push({layer:l,name:h,overlay:y}),this.options.sortLayers&&this._layers.sort(c(function(S,A){return this.options.sortFunction(S.layer,A.layer,S.name,A.name)},this)),this.options.autoZIndex&&l.setZIndex&&(this._lastZIndex++,l.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Wr(this._baseLayersList),Wr(this._overlaysList),this._layerControlInputs=[];var l,h,y,S,A=0;for(y=0;y<this._layers.length;y++)S=this._layers[y],this._addItem(S),h=h||S.overlay,l=l||!S.overlay,A+=S.overlay?0:1;return this.options.hideSingleBase&&(l=l&&A>1,this._baseLayersList.style.display=l?"":"none"),this._separator.style.display=h&&l?"":"none",this},_onLayerChange:function(l){this._handlingClick||this._update();var h=this._getLayer(p(l.target)),y=h.overlay?l.type==="add"?"overlayadd":"overlayremove":l.type==="add"?"baselayerchange":null;y&&this._map.fire(y,h)},_createRadioElement:function(l,h){var y='<input type="radio" class="leaflet-control-layers-selector" name="'+l+'"'+(h?' checked="checked"':"")+"/>",S=document.createElement("div");return S.innerHTML=y,S.firstChild},_addItem:function(l){var h=document.createElement("label"),y=this._map.hasLayer(l.layer),S;l.overlay?(S=document.createElement("input"),S.type="checkbox",S.className="leaflet-control-layers-selector",S.defaultChecked=y):S=this._createRadioElement("leaflet-base-layers_"+p(this),y),this._layerControlInputs.push(S),S.layerId=p(l.layer),Ct(S,"click",this._onInputClick,this);var A=document.createElement("span");A.innerHTML=" "+l.name;var W=document.createElement("span");h.appendChild(W),W.appendChild(S),W.appendChild(A);var ce=l.overlay?this._overlaysList:this._baseLayersList;return ce.appendChild(h),this._checkDisabledLayers(),h},_onInputClick:function(){if(!this._preventClick){var l=this._layerControlInputs,h,y,S=[],A=[];this._handlingClick=!0;for(var W=l.length-1;W>=0;W--)h=l[W],y=this._getLayer(h.layerId).layer,h.checked?S.push(y):h.checked||A.push(y);for(W=0;W<A.length;W++)this._map.hasLayer(A[W])&&this._map.removeLayer(A[W]);for(W=0;W<S.length;W++)this._map.hasLayer(S[W])||this._map.addLayer(S[W]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var l=this._layerControlInputs,h,y,S=this._map.getZoom(),A=l.length-1;A>=0;A--)h=l[A],y=this._getLayer(h.layerId).layer,h.disabled=y.options.minZoom!==void 0&&S<y.options.minZoom||y.options.maxZoom!==void 0&&S>y.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var l=this._section;this._preventClick=!0,Ct(l,"click",Ua),this.expand();var h=this;setTimeout(function(){ca(l,"click",Ua),h._preventClick=!1})}}),wu=function(l,h,y){return new ho(l,h,y)},Ic=Pr.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"},onAdd:function(l){var h="leaflet-control-zoom",y=Mt("div",h+" leaflet-bar"),S=this.options;return this._zoomInButton=this._createButton(S.zoomInText,S.zoomInTitle,h+"-in",y,this._zoomIn),this._zoomOutButton=this._createButton(S.zoomOutText,S.zoomOutTitle,h+"-out",y,this._zoomOut),this._updateDisabled(),l.on("zoomend zoomlevelschange",this._updateDisabled,this),y},onRemove:function(l){l.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(l){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(l.shiftKey?3:1))},_zoomOut:function(l){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(l.shiftKey?3:1))},_createButton:function(l,h,y,S,A){var W=Mt("a",y,S);return W.innerHTML=l,W.href="#",W.title=h,W.setAttribute("role","button"),W.setAttribute("aria-label",h),Us(W),Ct(W,"click",bs),Ct(W,"click",A,this),Ct(W,"click",this._refocusOnMap,this),W},_updateDisabled:function(){var l=this._map,h="leaflet-disabled";Ra(this._zoomInButton,h),Ra(this._zoomOutButton,h),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||l._zoom===l.getMinZoom())&&(Ft(this._zoomOutButton,h),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||l._zoom===l.getMaxZoom())&&(Ft(this._zoomInButton,h),this._zoomInButton.setAttribute("aria-disabled","true"))}});Kt.mergeOptions({zoomControl:!0}),Kt.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ic,this.addControl(this.zoomControl))});var rh=function(l){return new Ic(l)},ku=Pr.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(l){var h="leaflet-control-scale",y=Mt("div",h),S=this.options;return this._addScales(S,h+"-line",y),l.on(S.updateWhenIdle?"moveend":"move",this._update,this),l.whenReady(this._update,this),y},onRemove:function(l){l.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(l,h,y){l.metric&&(this._mScale=Mt("div",h,y)),l.imperial&&(this._iScale=Mt("div",h,y))},_update:function(){var l=this._map,h=l.getSize().y/2,y=l.distance(l.containerPointToLatLng([0,h]),l.containerPointToLatLng([this.options.maxWidth,h]));this._updateScales(y)},_updateScales:function(l){this.options.metric&&l&&this._updateMetric(l),this.options.imperial&&l&&this._updateImperial(l)},_updateMetric:function(l){var h=this._getRoundNum(l),y=h<1e3?h+" m":h/1e3+" km";this._updateScale(this._mScale,y,h/l)},_updateImperial:function(l){var h=l*3.2808399,y,S,A;h>5280?(y=h/5280,S=this._getRoundNum(y),this._updateScale(this._iScale,S+" mi",S/y)):(A=this._getRoundNum(h),this._updateScale(this._iScale,A+" ft",A/h))},_updateScale:function(l,h,y){l.style.width=Math.round(this.options.maxWidth*y)+"px",l.innerHTML=h},_getRoundNum:function(l){var h=Math.pow(10,(Math.floor(l)+"").length-1),y=l/h;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:1,h*y}}),Bc=function(l){return new ku(l)},nh='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',zc=Pr.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(be.inlineSvg?nh+" ":"")+"Leaflet</a>"},initialize:function(l){N(this,l),this._attributions={}},onAdd:function(l){l.attributionControl=this,this._container=Mt("div","leaflet-control-attribution"),Us(this._container);for(var h in l._layers)l._layers[h].getAttribution&&this.addAttribution(l._layers[h].getAttribution());return this._update(),l.on("layeradd",this._addAttribution,this),this._container},onRemove:function(l){l.off("layeradd",this._addAttribution,this)},_addAttribution:function(l){l.layer.getAttribution&&(this.addAttribution(l.layer.getAttribution()),l.layer.once("remove",function(){this.removeAttribution(l.layer.getAttribution())},this))},setPrefix:function(l){return this.options.prefix=l,this._update(),this},addAttribution:function(l){return l?(this._attributions[l]||(this._attributions[l]=0),this._attributions[l]++,this._update(),this):this},removeAttribution:function(l){return l?(this._attributions[l]&&(this._attributions[l]--,this._update()),this):this},_update:function(){if(this._map){var l=[];for(var h in this._attributions)this._attributions[h]&&l.push(h);var y=[];this.options.prefix&&y.push(this.options.prefix),l.length&&y.push(l.join(", ")),this._container.innerHTML=y.join(' <span aria-hidden="true">|</span> ')}}});Kt.mergeOptions({attributionControl:!0}),Kt.addInitHook(function(){this.options.attributionControl&&new zc().addTo(this)});var sh=function(l){return new zc(l)};Pr.Layers=ho,Pr.Zoom=Ic,Pr.Scale=ku,Pr.Attribution=zc,Qn.layers=wu,Qn.zoom=rh,Qn.scale=Bc,Qn.attribution=sh;var Ln=ye.extend({initialize:function(l){this._map=l},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Ln.addTo=function(l,h){return l.addHandler(h,this),this};var ih={Events:te},Uc=be.touch?"touchstart mousedown":"mousedown",vs=V.extend({options:{clickTolerance:3},initialize:function(l,h,y,S){N(this,S),this._element=l,this._dragStartTarget=h||l,this._preventOutline=y},enable:function(){this._enabled||(Ct(this._dragStartTarget,Uc,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(vs._dragging===this&&this.finishDrag(!0),ca(this._dragStartTarget,Uc,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(l){if(this._enabled&&(this._moved=!1,!Lc(this._element,"leaflet-zoom-anim"))){if(l.touches&&l.touches.length!==1){vs._dragging===this&&this.finishDrag();return}if(!(vs._dragging||l.shiftKey||l.which!==1&&l.button!==1&&!l.touches)&&(vs._dragging=this,this._preventOutline&&vi(this._element),dl(),yi(),!this._moving)){this.fire("down");var h=l.touches?l.touches[0]:l,y=fl(this._element);this._startPoint=new J(h.clientX,h.clientY),this._startPos=ys(this._element),this._parentScale=lo(y);var S=l.type==="mousedown";Ct(document,S?"mousemove":"touchmove",this._onMove,this),Ct(document,S?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(l){if(this._enabled){if(l.touches&&l.touches.length>1){this._moved=!0;return}var h=l.touches&&l.touches.length===1?l.touches[0]:l,y=new J(h.clientX,h.clientY)._subtract(this._startPoint);!y.x&&!y.y||Math.abs(y.x)+Math.abs(y.y)<this.options.clickTolerance||(y.x/=this._parentScale.x,y.y/=this._parentScale.y,Ua(l),this._moved||(this.fire("dragstart"),this._moved=!0,Ft(document.body,"leaflet-dragging"),this._lastTarget=l.target||l.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Ft(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(y),this._moving=!0,this._lastEvent=l,this._updatePosition())}},_updatePosition:function(){var l={originalEvent:this._lastEvent};this.fire("predrag",l),ja(this._element,this._newPos),this.fire("drag",l)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(l){Ra(document.body,"leaflet-dragging"),this._lastTarget&&(Ra(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),ca(document,"mousemove touchmove",this._onMove,this),ca(document,"mouseup touchend touchcancel",this._onUp,this),oo(),An();var h=this._moved&&this._moving;this._moving=!1,vs._dragging=!1,h&&this.fire("dragend",{noInertia:l,distance:this._newPos.distanceTo(this._startPos)})}});function Nu(l,h,y){var S,A=[1,4,2,8],W,ce,Ne,Ae,Ge,ct,vt,Ht;for(W=0,ct=l.length;W<ct;W++)l[W]._code=Hs(l[W],h);for(Ne=0;Ne<4;Ne++){for(vt=A[Ne],S=[],W=0,ct=l.length,ce=ct-1;W<ct;ce=W++)Ae=l[W],Ge=l[ce],Ae._code&vt?Ge._code&vt||(Ht=ml(Ge,Ae,vt,h,y),Ht._code=Hs(Ht,h),S.push(Ht)):(Ge._code&vt&&(Ht=ml(Ge,Ae,vt,h,y),Ht._code=Hs(Ht,h),S.push(Ht)),S.push(Ae));l=S}return l}function Su(l,h){var y,S,A,W,ce,Ne,Ae,Ge,ct;if(!l||l.length===0)throw new Error("latlngs not passed");Gr(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var vt=fe([0,0]),Ht=q(l),ir=Ht.getNorthWest().distanceTo(Ht.getSouthWest())*Ht.getNorthEast().distanceTo(Ht.getNorthWest());ir<1700&&(vt=Hc(l));var Ha=l.length,Fr=[];for(y=0;y<Ha;y++){var ta=fe(l[y]);Fr.push(h.project(fe([ta.lat-vt.lat,ta.lng-vt.lng])))}for(Ne=Ae=Ge=0,y=0,S=Ha-1;y<Ha;S=y++)A=Fr[y],W=Fr[S],ce=A.y*W.x-W.y*A.x,Ae+=(A.x+W.x)*ce,Ge+=(A.y+W.y)*ce,Ne+=ce*3;Ne===0?ct=Fr[0]:ct=[Ae/Ne,Ge/Ne];var aa=h.unproject(ae(ct));return fe([aa.lat+vt.lat,aa.lng+vt.lng])}function Hc(l){for(var h=0,y=0,S=0,A=0;A<l.length;A++){var W=fe(l[A]);h+=W.lat,y+=W.lng,S++}return fe([h/S,y/S])}var $c={__proto__:null,clipPolygon:Nu,polygonCenter:Su,centroid:Hc};function ju(l,h){if(!h||!l.length)return l.slice();var y=h*h;return l=lh(l,y),l=Eu(l,y),l}function Tu(l,h,y){return Math.sqrt(mo(l,h,y,!0))}function oh(l,h,y){return mo(l,h,y)}function Eu(l,h){var y=l.length,S=typeof Uint8Array!="undefined"?Uint8Array:Array,A=new S(y);A[0]=A[y-1]=1,Wc(l,A,h,0,y-1);var W,ce=[];for(W=0;W<y;W++)A[W]&&ce.push(l[W]);return ce}function Wc(l,h,y,S,A){var W=0,ce,Ne,Ae;for(Ne=S+1;Ne<=A-1;Ne++)Ae=mo(l[Ne],l[S],l[A],!0),Ae>W&&(ce=Ne,W=Ae);W>y&&(h[ce]=1,Wc(l,h,y,S,ce),Wc(l,h,y,ce,A))}function lh(l,h){for(var y=[l[0]],S=1,A=0,W=l.length;S<W;S++)ch(l[S],l[A])>h&&(y.push(l[S]),A=S);return A<W-1&&y.push(l[W-1]),y}var Cu;function Au(l,h,y,S,A){var W=S?Cu:Hs(l,y),ce=Hs(h,y),Ne,Ae,Ge;for(Cu=ce;;){if(!(W|ce))return[l,h];if(W&ce)return!1;Ne=W||ce,Ae=ml(l,h,Ne,y,A),Ge=Hs(Ae,y),Ne===W?(l=Ae,W=Ge):(h=Ae,ce=Ge)}}function ml(l,h,y,S,A){var W=h.x-l.x,ce=h.y-l.y,Ne=S.min,Ae=S.max,Ge,ct;return y&8?(Ge=l.x+W*(Ae.y-l.y)/ce,ct=Ae.y):y&4?(Ge=l.x+W*(Ne.y-l.y)/ce,ct=Ne.y):y&2?(Ge=Ae.x,ct=l.y+ce*(Ae.x-l.x)/W):y&1&&(Ge=Ne.x,ct=l.y+ce*(Ne.x-l.x)/W),new J(Ge,ct,A)}function Hs(l,h){var y=0;return l.x<h.min.x?y|=1:l.x>h.max.x&&(y|=2),l.y<h.min.y?y|=4:l.y>h.max.y&&(y|=8),y}function ch(l,h){var y=h.x-l.x,S=h.y-l.y;return y*y+S*S}function mo(l,h,y,S){var A=h.x,W=h.y,ce=y.x-A,Ne=y.y-W,Ae=ce*ce+Ne*Ne,Ge;return Ae>0&&(Ge=((l.x-A)*ce+(l.y-W)*Ne)/Ae,Ge>1?(A=y.x,W=y.y):Ge>0&&(A+=ce*Ge,W+=Ne*Ge)),ce=l.x-A,Ne=l.y-W,S?ce*ce+Ne*Ne:new J(A,W)}function Gr(l){return!O(l[0])||typeof l[0][0]!="object"&&typeof l[0][0]!="undefined"}function gl(l){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Gr(l)}function ki(l,h){var y,S,A,W,ce,Ne,Ae,Ge;if(!l||l.length===0)throw new Error("latlngs not passed");Gr(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var ct=fe([0,0]),vt=q(l),Ht=vt.getNorthWest().distanceTo(vt.getSouthWest())*vt.getNorthEast().distanceTo(vt.getNorthWest());Ht<1700&&(ct=Hc(l));var ir=l.length,Ha=[];for(y=0;y<ir;y++){var Fr=fe(l[y]);Ha.push(h.project(fe([Fr.lat-ct.lat,Fr.lng-ct.lng])))}for(y=0,S=0;y<ir-1;y++)S+=Ha[y].distanceTo(Ha[y+1])/2;if(S===0)Ge=Ha[0];else for(y=0,W=0;y<ir-1;y++)if(ce=Ha[y],Ne=Ha[y+1],A=ce.distanceTo(Ne),W+=A,W>S){Ae=(W-S)/A,Ge=[Ne.x-Ae*(Ne.x-ce.x),Ne.y-Ae*(Ne.y-ce.y)];break}var ta=h.unproject(ae(Ge));return fe([ta.lat+ct.lat,ta.lng+ct.lng])}var dh={__proto__:null,simplify:ju,pointToSegmentDistance:Tu,closestPointOnSegment:oh,clipSegment:Au,_getEdgeIntersection:ml,_getBitCode:Hs,_sqClosestPointOnSegment:mo,isFlat:Gr,_flat:gl,polylineCenter:ki},pl={project:function(l){return new J(l.lng,l.lat)},unproject:function(l){return new K(l.y,l.x)},bounds:new z([-180,-90],[180,90])},xl={R:6378137,R_MINOR:6356752314245179e-9,bounds:new z([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(l){var h=Math.PI/180,y=this.R,S=l.lat*h,A=this.R_MINOR/y,W=Math.sqrt(1-A*A),ce=W*Math.sin(S),Ne=Math.tan(Math.PI/4-S/2)/Math.pow((1-ce)/(1+ce),W/2);return S=-y*Math.log(Math.max(Ne,1e-10)),new J(l.lng*h*y,S)},unproject:function(l){for(var h=180/Math.PI,y=this.R,S=this.R_MINOR/y,A=Math.sqrt(1-S*S),W=Math.exp(-l.y/y),ce=Math.PI/2-2*Math.atan(W),Ne=0,Ae=.1,Ge;Ne<15&&Math.abs(Ae)>1e-7;Ne++)Ge=A*Math.sin(ce),Ge=Math.pow((1-Ge)/(1+Ge),A/2),Ae=Math.PI/2-2*Math.atan(W*Ge)-ce,ce+=Ae;return new K(ce*h,l.x*h/y)}},Ou={__proto__:null,LonLat:pl,Mercator:xl,SphericalMercator:He},Lu=o({},We,{code:"EPSG:3395",projection:xl,transformation:(function(){var l=.5/(Math.PI*xl.R);return ht(l,.5,-l,.5)})()}),Vc=o({},We,{code:"EPSG:4326",projection:pl,transformation:ht(1/180,1,-1/180,.5)}),Ni=o({},Pe,{projection:pl,transformation:ht(1,0,-1,0),scale:function(l){return Math.pow(2,l)},zoom:function(l){return Math.log(l)/Math.LN2},distance:function(l,h){var y=h.lng-l.lng,S=h.lat-l.lat;return Math.sqrt(y*y+S*S)},infinite:!0});Pe.Earth=We,Pe.EPSG3395=Lu,Pe.EPSG3857=Vt,Pe.EPSG900913=_t,Pe.EPSG4326=Vc,Pe.Simple=Ni;var pn=V.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(l){return l.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(l){return l&&l.removeLayer(this),this},getPane:function(l){return this._map.getPane(l?this.options[l]||l:this.options.pane)},addInteractiveTarget:function(l){return this._map._targets[p(l)]=this,this},removeInteractiveTarget:function(l){return delete this._map._targets[p(l)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(l){var h=l.target;if(h.hasLayer(this)){if(this._map=h,this._zoomAnimated=h._zoomAnimated,this.getEvents){var y=this.getEvents();h.on(y,this),this.once("remove",function(){h.off(y,this)},this)}this.onAdd(h),this.fire("add"),h.fire("layeradd",{layer:this})}}});Kt.include({addLayer:function(l){if(!l._layerAdd)throw new Error("The provided object is not a Layer.");var h=p(l);return this._layers[h]?this:(this._layers[h]=l,l._mapToAdd=this,l.beforeAdd&&l.beforeAdd(this),this.whenReady(l._layerAdd,l),this)},removeLayer:function(l){var h=p(l);return this._layers[h]?(this._loaded&&l.onRemove(this),delete this._layers[h],this._loaded&&(this.fire("layerremove",{layer:l}),l.fire("remove")),l._map=l._mapToAdd=null,this):this},hasLayer:function(l){return p(l)in this._layers},eachLayer:function(l,h){for(var y in this._layers)l.call(h,this._layers[y]);return this},_addLayers:function(l){l=l?O(l)?l:[l]:[];for(var h=0,y=l.length;h<y;h++)this.addLayer(l[h])},_addZoomLimit:function(l){(!isNaN(l.options.maxZoom)||!isNaN(l.options.minZoom))&&(this._zoomBoundLayers[p(l)]=l,this._updateZoomLevels())},_removeZoomLimit:function(l){var h=p(l);this._zoomBoundLayers[h]&&(delete this._zoomBoundLayers[h],this._updateZoomLevels())},_updateZoomLevels:function(){var l=1/0,h=-1/0,y=this._getZoomSpan();for(var S in this._zoomBoundLayers){var A=this._zoomBoundLayers[S].options;l=A.minZoom===void 0?l:Math.min(l,A.minZoom),h=A.maxZoom===void 0?h:Math.max(h,A.maxZoom)}this._layersMaxZoom=h===-1/0?void 0:h,this._layersMinZoom=l===1/0?void 0:l,y!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Si=pn.extend({initialize:function(l,h){N(this,h),this._layers={};var y,S;if(l)for(y=0,S=l.length;y<S;y++)this.addLayer(l[y])},addLayer:function(l){var h=this.getLayerId(l);return this._layers[h]=l,this._map&&this._map.addLayer(l),this},removeLayer:function(l){var h=l in this._layers?l:this.getLayerId(l);return this._map&&this._layers[h]&&this._map.removeLayer(this._layers[h]),delete this._layers[h],this},hasLayer:function(l){var h=typeof l=="number"?l:this.getLayerId(l);return h in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(l){var h=Array.prototype.slice.call(arguments,1),y,S;for(y in this._layers)S=this._layers[y],S[l]&&S[l].apply(S,h);return this},onAdd:function(l){this.eachLayer(l.addLayer,l)},onRemove:function(l){this.eachLayer(l.removeLayer,l)},eachLayer:function(l,h){for(var y in this._layers)l.call(h,this._layers[y]);return this},getLayer:function(l){return this._layers[l]},getLayers:function(){var l=[];return this.eachLayer(l.push,l),l},setZIndex:function(l){return this.invoke("setZIndex",l)},getLayerId:function(l){return p(l)}}),uh=function(l,h){return new Si(l,h)},Mn=Si.extend({addLayer:function(l){return this.hasLayer(l)?this:(l.addEventParent(this),Si.prototype.addLayer.call(this,l),this.fire("layeradd",{layer:l}))},removeLayer:function(l){return this.hasLayer(l)?(l in this._layers&&(l=this._layers[l]),l.removeEventParent(this),Si.prototype.removeLayer.call(this,l),this.fire("layerremove",{layer:l})):this},setStyle:function(l){return this.invoke("setStyle",l)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var l=new G;for(var h in this._layers){var y=this._layers[h];l.extend(y.getBounds?y.getBounds():y.getLatLng())}return l}}),Mu=function(l,h){return new Mn(l,h)},Dn=ye.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(l){N(this,l)},createIcon:function(l){return this._createIcon("icon",l)},createShadow:function(l){return this._createIcon("shadow",l)},_createIcon:function(l,h){var y=this._getIconUrl(l);if(!y){if(l==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var S=this._createImg(y,h&&h.tagName==="IMG"?h:null);return this._setIconStyles(S,l),(this.options.crossOrigin||this.options.crossOrigin==="")&&(S.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),S},_setIconStyles:function(l,h){var y=this.options,S=y[h+"Size"];typeof S=="number"&&(S=[S,S]);var A=ae(S),W=ae(h==="shadow"&&y.shadowAnchor||y.iconAnchor||A&&A.divideBy(2,!0));l.className="leaflet-marker-"+h+" "+(y.className||""),W&&(l.style.marginLeft=-W.x+"px",l.style.marginTop=-W.y+"px"),A&&(l.style.width=A.x+"px",l.style.height=A.y+"px")},_createImg:function(l,h){return h=h||document.createElement("img"),h.src=l,h},_getIconUrl:function(l){return be.retina&&this.options[l+"RetinaUrl"]||this.options[l+"Url"]}});function go(l){return new Dn(l)}var po=Dn.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(l){return typeof po.imagePath!="string"&&(po.imagePath=this._detectIconPath()),(this.options.imagePath||po.imagePath)+Dn.prototype._getIconUrl.call(this,l)},_stripUrl:function(l){var h=function(y,S,A){var W=S.exec(y);return W&&W[A]};return l=h(l,/^url\((['"])?(.+)\1\)$/,2),l&&h(l,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var l=Mt("div","leaflet-default-icon-path",document.body),h=Xn(l,"background-image")||Xn(l,"backgroundImage");if(document.body.removeChild(l),h=this._stripUrl(h),h)return h;var y=document.querySelector('link[href$="leaflet.css"]');return y?y.href.substring(0,y.href.length-11-1):""}}),xo=Ln.extend({initialize:function(l){this._marker=l},addHooks:function(){var l=this._marker._icon;this._draggable||(this._draggable=new vs(l,l,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Ft(l,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&Ra(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(l){var h=this._marker,y=h._map,S=this._marker.options.autoPanSpeed,A=this._marker.options.autoPanPadding,W=ys(h._icon),ce=y.getPixelBounds(),Ne=y.getPixelOrigin(),Ae=D(ce.min._subtract(Ne).add(A),ce.max._subtract(Ne).subtract(A));if(!Ae.contains(W)){var Ge=ae((Math.max(Ae.max.x,W.x)-Ae.max.x)/(ce.max.x-Ae.max.x)-(Math.min(Ae.min.x,W.x)-Ae.min.x)/(ce.min.x-Ae.min.x),(Math.max(Ae.max.y,W.y)-Ae.max.y)/(ce.max.y-Ae.max.y)-(Math.min(Ae.min.y,W.y)-Ae.min.y)/(ce.min.y-Ae.min.y)).multiplyBy(S);y.panBy(Ge,{animate:!1}),this._draggable._newPos._add(Ge),this._draggable._startPos._add(Ge),ja(h._icon,this._draggable._newPos),this._onDrag(l),this._panRequest=le(this._adjustPan.bind(this,l))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(l){this._marker.options.autoPan&&(re(this._panRequest),this._panRequest=le(this._adjustPan.bind(this,l)))},_onDrag:function(l){var h=this._marker,y=h._shadow,S=ys(h._icon),A=h._map.layerPointToLatLng(S);y&&ja(y,S),h._latlng=A,l.latlng=A,l.oldLatLng=this._oldLatLng,h.fire("move",l).fire("drag",l)},_onDragEnd:function(l){re(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",l)}}),yo=pn.extend({options:{icon:new po,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(l,h){N(this,h),this._latlng=fe(l)},onAdd:function(l){this._zoomAnimated=this._zoomAnimated&&l.options.markerZoomAnimation,this._zoomAnimated&&l.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(l){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&l.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(l){var h=this._latlng;return this._latlng=fe(l),this.update(),this.fire("move",{oldLatLng:h,latlng:this._latlng})},setZIndexOffset:function(l){return this.options.zIndexOffset=l,this.update()},getIcon:function(){return this.options.icon},setIcon:function(l){return this.options.icon=l,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var l=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(l)}return this},_initIcon:function(){var l=this.options,h="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),y=l.icon.createIcon(this._icon),S=!1;y!==this._icon&&(this._icon&&this._removeIcon(),S=!0,l.title&&(y.title=l.title),y.tagName==="IMG"&&(y.alt=l.alt||"")),Ft(y,h),l.keyboard&&(y.tabIndex="0",y.setAttribute("role","button")),this._icon=y,l.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Ct(y,"focus",this._panOnFocus,this);var A=l.icon.createShadow(this._shadow),W=!1;A!==this._shadow&&(this._removeShadow(),W=!0),A&&(Ft(A,h),A.alt=""),this._shadow=A,l.opacity<1&&this._updateOpacity(),S&&this.getPane().appendChild(this._icon),this._initInteraction(),A&&W&&this.getPane(l.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&ca(this._icon,"focus",this._panOnFocus,this),va(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&va(this._shadow),this._shadow=null},_setPos:function(l){this._icon&&ja(this._icon,l),this._shadow&&ja(this._shadow,l),this._zIndex=l.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(l){this._icon&&(this._icon.style.zIndex=this._zIndex+l)},_animateZoom:function(l){var h=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center).round();this._setPos(h)},_initInteraction:function(){if(this.options.interactive&&(Ft(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),xo)){var l=this.options.draggable;this.dragging&&(l=this.dragging.enabled(),this.dragging.disable()),this.dragging=new xo(this),l&&this.dragging.enable()}},setOpacity:function(l){return this.options.opacity=l,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var l=this.options.opacity;this._icon&&Ca(this._icon,l),this._shadow&&Ca(this._shadow,l)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var l=this._map;if(l){var h=this.options.icon.options,y=h.iconSize?ae(h.iconSize):ae(0,0),S=h.iconAnchor?ae(h.iconAnchor):ae(0,0);l.panInside(this._latlng,{paddingTopLeft:S,paddingBottomRight:y.subtract(S)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Du(l,h){return new yo(l,h)}var Rn=pn.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(l){this._renderer=l.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(l){return N(this,l),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&l&&Object.prototype.hasOwnProperty.call(l,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),ji=Rn.extend({options:{fill:!0,radius:10},initialize:function(l,h){N(this,h),this._latlng=fe(l),this._radius=this.options.radius},setLatLng:function(l){var h=this._latlng;return this._latlng=fe(l),this.redraw(),this.fire("move",{oldLatLng:h,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(l){return this.options.radius=this._radius=l,this.redraw()},getRadius:function(){return this._radius},setStyle:function(l){var h=l&&l.radius||this._radius;return Rn.prototype.setStyle.call(this,l),this.setRadius(h),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var l=this._radius,h=this._radiusY||l,y=this._clickTolerance(),S=[l+y,h+y];this._pxBounds=new z(this._point.subtract(S),this._point.add(S))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(l){return l.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function Ru(l,h){return new ji(l,h)}var yl=ji.extend({initialize:function(l,h,y){if(typeof h=="number"&&(h=o({},y,{radius:h})),N(this,h),this._latlng=fe(l),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(l){return this._mRadius=l,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var l=[this._radius,this._radiusY||this._radius];return new G(this._map.layerPointToLatLng(this._point.subtract(l)),this._map.layerPointToLatLng(this._point.add(l)))},setStyle:Rn.prototype.setStyle,_project:function(){var l=this._latlng.lng,h=this._latlng.lat,y=this._map,S=y.options.crs;if(S.distance===We.distance){var A=Math.PI/180,W=this._mRadius/We.R/A,ce=y.project([h+W,l]),Ne=y.project([h-W,l]),Ae=ce.add(Ne).divideBy(2),Ge=y.unproject(Ae).lat,ct=Math.acos((Math.cos(W*A)-Math.sin(h*A)*Math.sin(Ge*A))/(Math.cos(h*A)*Math.cos(Ge*A)))/A;(isNaN(ct)||ct===0)&&(ct=W/Math.cos(Math.PI/180*h)),this._point=Ae.subtract(y.getPixelOrigin()),this._radius=isNaN(ct)?0:Ae.x-y.project([Ge,l-ct]).x,this._radiusY=Ae.y-ce.y}else{var vt=S.unproject(S.project(this._latlng).subtract([this._mRadius,0]));this._point=y.latLngToLayerPoint(this._latlng),this._radius=this._point.x-y.latLngToLayerPoint(vt).x}this._updateBounds()}});function Pu(l,h,y){return new yl(l,h,y)}var es=Rn.extend({options:{smoothFactor:1,noClip:!1},initialize:function(l,h){N(this,h),this._setLatLngs(l)},getLatLngs:function(){return this._latlngs},setLatLngs:function(l){return this._setLatLngs(l),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(l){for(var h=1/0,y=null,S=mo,A,W,ce=0,Ne=this._parts.length;ce<Ne;ce++)for(var Ae=this._parts[ce],Ge=1,ct=Ae.length;Ge<ct;Ge++){A=Ae[Ge-1],W=Ae[Ge];var vt=S(l,A,W,!0);vt<h&&(h=vt,y=S(l,A,W))}return y&&(y.distance=Math.sqrt(h)),y},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return ki(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(l,h){return h=h||this._defaultShape(),l=fe(l),h.push(l),this._bounds.extend(l),this.redraw()},_setLatLngs:function(l){this._bounds=new G,this._latlngs=this._convertLatLngs(l)},_defaultShape:function(){return Gr(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(l){for(var h=[],y=Gr(l),S=0,A=l.length;S<A;S++)y?(h[S]=fe(l[S]),this._bounds.extend(h[S])):h[S]=this._convertLatLngs(l[S]);return h},_project:function(){var l=new z;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,l),this._bounds.isValid()&&l.isValid()&&(this._rawPxBounds=l,this._updateBounds())},_updateBounds:function(){var l=this._clickTolerance(),h=new J(l,l);this._rawPxBounds&&(this._pxBounds=new z([this._rawPxBounds.min.subtract(h),this._rawPxBounds.max.add(h)]))},_projectLatlngs:function(l,h,y){var S=l[0]instanceof K,A=l.length,W,ce;if(S){for(ce=[],W=0;W<A;W++)ce[W]=this._map.latLngToLayerPoint(l[W]),y.extend(ce[W]);h.push(ce)}else for(W=0;W<A;W++)this._projectLatlngs(l[W],h,y)},_clipPoints:function(){var l=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(l))){if(this.options.noClip){this._parts=this._rings;return}var h=this._parts,y,S,A,W,ce,Ne,Ae;for(y=0,A=0,W=this._rings.length;y<W;y++)for(Ae=this._rings[y],S=0,ce=Ae.length;S<ce-1;S++)Ne=Au(Ae[S],Ae[S+1],l,S,!0),Ne&&(h[A]=h[A]||[],h[A].push(Ne[0]),(Ne[1]!==Ae[S+1]||S===ce-2)&&(h[A].push(Ne[1]),A++))}},_simplifyPoints:function(){for(var l=this._parts,h=this.options.smoothFactor,y=0,S=l.length;y<S;y++)l[y]=ju(l[y],h)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(l,h){var y,S,A,W,ce,Ne,Ae=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(y=0,W=this._parts.length;y<W;y++)for(Ne=this._parts[y],S=0,ce=Ne.length,A=ce-1;S<ce;A=S++)if(!(!h&&S===0)&&Tu(l,Ne[A],Ne[S])<=Ae)return!0;return!1}});function fh(l,h){return new es(l,h)}es._flat=gl;var Ti=es.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Su(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(l){var h=es.prototype._convertLatLngs.call(this,l),y=h.length;return y>=2&&h[0]instanceof K&&h[0].equals(h[y-1])&&h.pop(),h},_setLatLngs:function(l){es.prototype._setLatLngs.call(this,l),Gr(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Gr(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var l=this._renderer._bounds,h=this.options.weight,y=new J(h,h);if(l=new z(l.min.subtract(y),l.max.add(y)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(l))){if(this.options.noClip){this._parts=this._rings;return}for(var S=0,A=this._rings.length,W;S<A;S++)W=Nu(this._rings[S],l,!0),W.length&&this._parts.push(W)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(l){var h=!1,y,S,A,W,ce,Ne,Ae,Ge;if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(W=0,Ae=this._parts.length;W<Ae;W++)for(y=this._parts[W],ce=0,Ge=y.length,Ne=Ge-1;ce<Ge;Ne=ce++)S=y[ce],A=y[Ne],S.y>l.y!=A.y>l.y&&l.x<(A.x-S.x)*(l.y-S.y)/(A.y-S.y)+S.x&&(h=!h);return h||es.prototype._containsPoint.call(this,l,!0)}});function hh(l,h){return new Ti(l,h)}var ts=Mn.extend({initialize:function(l,h){N(this,h),this._layers={},l&&this.addData(l)},addData:function(l){var h=O(l)?l:l.features,y,S,A;if(h){for(y=0,S=h.length;y<S;y++)A=h[y],(A.geometries||A.geometry||A.features||A.coordinates)&&this.addData(A);return this}var W=this.options;if(W.filter&&!W.filter(l))return this;var ce=cr(l,W);return ce?(ce.feature=_l(l),ce.defaultOptions=ce.options,this.resetStyle(ce),W.onEachFeature&&W.onEachFeature(l,ce),this.addLayer(ce)):this},resetStyle:function(l){return l===void 0?this.eachLayer(this.resetStyle,this):(l.options=o({},l.defaultOptions),this._setLayerStyle(l,this.options.style),this)},setStyle:function(l){return this.eachLayer(function(h){this._setLayerStyle(h,l)},this)},_setLayerStyle:function(l,h){l.setStyle&&(typeof h=="function"&&(h=h(l.feature)),l.setStyle(h))}});function cr(l,h){var y=l.type==="Feature"?l.geometry:l,S=y?y.coordinates:null,A=[],W=h&&h.pointToLayer,ce=h&&h.coordsToLatLng||bl,Ne,Ae,Ge,ct;if(!S&&!y)return null;switch(y.type){case"Point":return Ne=ce(S),Ei(W,l,Ne,h);case"MultiPoint":for(Ge=0,ct=S.length;Ge<ct;Ge++)Ne=ce(S[Ge]),A.push(Ei(W,l,Ne,h));return new Mn(A);case"LineString":case"MultiLineString":return Ae=bo(S,y.type==="LineString"?0:1,ce),new es(Ae,h);case"Polygon":case"MultiPolygon":return Ae=bo(S,y.type==="Polygon"?1:2,ce),new Ti(Ae,h);case"GeometryCollection":for(Ge=0,ct=y.geometries.length;Ge<ct;Ge++){var vt=cr({geometry:y.geometries[Ge],type:"Feature",properties:l.properties},h);vt&&A.push(vt)}return new Mn(A);case"FeatureCollection":for(Ge=0,ct=y.features.length;Ge<ct;Ge++){var Ht=cr(y.features[Ge],h);Ht&&A.push(Ht)}return new Mn(A);default:throw new Error("Invalid GeoJSON object.")}}function Ei(l,h,y,S){return l?l(h,y):new yo(y,S&&S.markersInheritOptions&&S)}function bl(l){return new K(l[1],l[0],l[2])}function bo(l,h,y){for(var S=[],A=0,W=l.length,ce;A<W;A++)ce=h?bo(l[A],h-1,y):(y||bl)(l[A]),S.push(ce);return S}function vl(l,h){return l=fe(l),l.alt!==void 0?[_(l.lng,h),_(l.lat,h),_(l.alt,h)]:[_(l.lng,h),_(l.lat,h)]}function vo(l,h,y,S){for(var A=[],W=0,ce=l.length;W<ce;W++)A.push(h?vo(l[W],Gr(l[W])?0:h-1,y,S):vl(l[W],S));return!h&&y&&A.length>0&&A.push(A[0].slice()),A}function _s(l,h){return l.feature?o({},l.feature,{geometry:h}):_l(h)}function _l(l){return l.type==="Feature"||l.type==="FeatureCollection"?l:{type:"Feature",properties:{},geometry:l}}var ws={toGeoJSON:function(l){return _s(this,{type:"Point",coordinates:vl(this.getLatLng(),l)})}};yo.include(ws),yl.include(ws),ji.include(ws),es.include({toGeoJSON:function(l){var h=!Gr(this._latlngs),y=vo(this._latlngs,h?1:0,!1,l);return _s(this,{type:(h?"Multi":"")+"LineString",coordinates:y})}}),Ti.include({toGeoJSON:function(l){var h=!Gr(this._latlngs),y=h&&!Gr(this._latlngs[0]),S=vo(this._latlngs,y?2:h?1:0,!0,l);return h||(S=[S]),_s(this,{type:(y?"Multi":"")+"Polygon",coordinates:S})}}),Si.include({toMultiPoint:function(l){var h=[];return this.eachLayer(function(y){h.push(y.toGeoJSON(l).geometry.coordinates)}),_s(this,{type:"MultiPoint",coordinates:h})},toGeoJSON:function(l){var h=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(h==="MultiPoint")return this.toMultiPoint(l);var y=h==="GeometryCollection",S=[];return this.eachLayer(function(A){if(A.toGeoJSON){var W=A.toGeoJSON(l);if(y)S.push(W.geometry);else{var ce=_l(W);ce.type==="FeatureCollection"?S.push.apply(S,ce.features):S.push(ce)}}}),y?_s(this,{geometries:S,type:"GeometryCollection"}):{type:"FeatureCollection",features:S}}});function wl(l,h){return new ts(l,h)}var _o=wl,Ci=pn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(l,h,y){this._url=l,this._bounds=q(h),N(this,y)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Ft(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){va(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(l){return this.options.opacity=l,this._image&&this._updateOpacity(),this},setStyle:function(l){return l.opacity&&this.setOpacity(l.opacity),this},bringToFront:function(){return this._map&&sr(this._image),this},bringToBack:function(){return this._map&&Bs(this._image),this},setUrl:function(l){return this._url=l,this._image&&(this._image.src=l),this},setBounds:function(l){return this._bounds=q(l),this._map&&this._reset(),this},getEvents:function(){var l={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(l.zoomanim=this._animateZoom),l},setZIndex:function(l){return this.options.zIndex=l,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var l=this._url.tagName==="IMG",h=this._image=l?this._url:Mt("img");if(Ft(h,"leaflet-image-layer"),this._zoomAnimated&&Ft(h,"leaflet-zoom-animated"),this.options.className&&Ft(h,this.options.className),h.onselectstart=v,h.onmousemove=v,h.onload=c(this.fire,this,"load"),h.onerror=c(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(h.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),l){this._url=h.src;return}h.src=this._url,h.alt=this.options.alt},_animateZoom:function(l){var h=this._map.getZoomScale(l.zoom),y=this._map._latLngBoundsToNewLayerBounds(this._bounds,l.zoom,l.center).min;Kn(this._image,y,h)},_reset:function(){var l=this._image,h=new z(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),y=h.getSize();ja(l,h.min),l.style.width=y.x+"px",l.style.height=y.y+"px"},_updateOpacity:function(){Ca(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var l=this.options.errorOverlayUrl;l&&this._url!==l&&(this._url=l,this._image.src=l)},getCenter:function(){return this._bounds.getCenter()}}),Fu=function(l,h,y){return new Ci(l,h,y)},ks=Ci.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var l=this._url.tagName==="VIDEO",h=this._image=l?this._url:Mt("video");if(Ft(h,"leaflet-image-layer"),this._zoomAnimated&&Ft(h,"leaflet-zoom-animated"),this.options.className&&Ft(h,this.options.className),h.onselectstart=v,h.onmousemove=v,h.onloadeddata=c(this.fire,this,"load"),l){for(var y=h.getElementsByTagName("source"),S=[],A=0;A<y.length;A++)S.push(y[A].src);this._url=y.length>0?S:[h.src];return}O(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(h.style,"objectFit")&&(h.style.objectFit="fill"),h.autoplay=!!this.options.autoplay,h.loop=!!this.options.loop,h.muted=!!this.options.muted,h.playsInline=!!this.options.playsInline;for(var W=0;W<this._url.length;W++){var ce=Mt("source");ce.src=this._url[W],h.appendChild(ce)}}});function Ai(l,h,y){return new ks(l,h,y)}var kl=Ci.extend({_initImage:function(){var l=this._image=this._url;Ft(l,"leaflet-image-layer"),this._zoomAnimated&&Ft(l,"leaflet-zoom-animated"),this.options.className&&Ft(l,this.options.className),l.onselectstart=v,l.onmousemove=v}});function Iu(l,h,y){return new kl(l,h,y)}var dr=pn.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(l,h){l&&(l instanceof K||O(l))?(this._latlng=fe(l),N(this,h)):(N(this,l),this._source=h),this.options.content&&(this._content=this.options.content)},openOn:function(l){return l=arguments.length?l:this._source._map,l.hasLayer(this)||l.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(l){return this._map?this.close():(arguments.length?this._source=l:l=this._source,this._prepareOpen(),this.openOn(l._map)),this},onAdd:function(l){this._zoomAnimated=l._zoomAnimated,this._container||this._initLayout(),l._fadeAnimated&&Ca(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),l._fadeAnimated&&Ca(this._container,1),this.bringToFront(),this.options.interactive&&(Ft(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(l){l._fadeAnimated?(Ca(this._container,0),this._removeTimeout=setTimeout(c(va,void 0,this._container),200)):va(this._container),this.options.interactive&&(Ra(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(l){return this._latlng=fe(l),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(l){return this._content=l,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var l={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(l.zoomanim=this._animateZoom),l},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&sr(this._container),this},bringToBack:function(){return this._map&&Bs(this._container),this},_prepareOpen:function(l){var h=this._source;if(!h._map)return!1;if(h instanceof Mn){h=null;var y=this._source._layers;for(var S in y)if(y[S]._map){h=y[S];break}if(!h)return!1;this._source=h}if(!l)if(h.getCenter)l=h.getCenter();else if(h.getLatLng)l=h.getLatLng();else if(h.getBounds)l=h.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(l),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var l=this._contentNode,h=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof h=="string")l.innerHTML=h;else{for(;l.hasChildNodes();)l.removeChild(l.firstChild);l.appendChild(h)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var l=this._map.latLngToLayerPoint(this._latlng),h=ae(this.options.offset),y=this._getAnchor();this._zoomAnimated?ja(this._container,l.add(y)):h=h.add(l).add(y);var S=this._containerBottom=-h.y,A=this._containerLeft=-Math.round(this._containerWidth/2)+h.x;this._container.style.bottom=S+"px",this._container.style.left=A+"px"}},_getAnchor:function(){return[0,0]}});Kt.include({_initOverlay:function(l,h,y,S){var A=h;return A instanceof l||(A=new l(S).setContent(h)),y&&A.setLatLng(y),A}}),pn.include({_initOverlay:function(l,h,y,S){var A=y;return A instanceof l?(N(A,S),A._source=this):(A=h&&!S?h:new l(S,this),A.setContent(y)),A}});var wo=dr.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(l){return l=arguments.length?l:this._source._map,!l.hasLayer(this)&&l._popup&&l._popup.options.autoClose&&l.removeLayer(l._popup),l._popup=this,dr.prototype.openOn.call(this,l)},onAdd:function(l){dr.prototype.onAdd.call(this,l),l.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Rn||this._source.on("preclick",gn))},onRemove:function(l){dr.prototype.onRemove.call(this,l),l.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Rn||this._source.off("preclick",gn))},getEvents:function(){var l=dr.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(l.preclick=this.close),this.options.keepInView&&(l.moveend=this._adjustPan),l},_initLayout:function(){var l="leaflet-popup",h=this._container=Mt("div",l+" "+(this.options.className||"")+" leaflet-zoom-animated"),y=this._wrapper=Mt("div",l+"-content-wrapper",h);if(this._contentNode=Mt("div",l+"-content",y),Us(h),On(this._contentNode),Ct(h,"contextmenu",gn),this._tipContainer=Mt("div",l+"-tip-container",h),this._tip=Mt("div",l+"-tip",this._tipContainer),this.options.closeButton){var S=this._closeButton=Mt("a",l+"-close-button",h);S.setAttribute("role","button"),S.setAttribute("aria-label","Close popup"),S.href="#close",S.innerHTML='<span aria-hidden="true">&#215;</span>',Ct(S,"click",function(A){Ua(A),this.close()},this)}},_updateLayout:function(){var l=this._contentNode,h=l.style;h.width="",h.whiteSpace="nowrap";var y=l.offsetWidth;y=Math.min(y,this.options.maxWidth),y=Math.max(y,this.options.minWidth),h.width=y+1+"px",h.whiteSpace="",h.height="";var S=l.offsetHeight,A=this.options.maxHeight,W="leaflet-popup-scrolled";A&&S>A?(h.height=A+"px",Ft(l,W)):Ra(l,W),this._containerWidth=this._container.offsetWidth},_animateZoom:function(l){var h=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center),y=this._getAnchor();ja(this._container,h.add(y))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var l=this._map,h=parseInt(Xn(this._container,"marginBottom"),10)||0,y=this._container.offsetHeight+h,S=this._containerWidth,A=new J(this._containerLeft,-y-this._containerBottom);A._add(ys(this._container));var W=l.layerPointToContainerPoint(A),ce=ae(this.options.autoPanPadding),Ne=ae(this.options.autoPanPaddingTopLeft||ce),Ae=ae(this.options.autoPanPaddingBottomRight||ce),Ge=l.getSize(),ct=0,vt=0;W.x+S+Ae.x>Ge.x&&(ct=W.x+S-Ge.x+Ae.x),W.x-ct-Ne.x<0&&(ct=W.x-Ne.x),W.y+y+Ae.y>Ge.y&&(vt=W.y+y-Ge.y+Ae.y),W.y-vt-Ne.y<0&&(vt=W.y-Ne.y),(ct||vt)&&(this.options.keepInView&&(this._autopanning=!0),l.fire("autopanstart").panBy([ct,vt]))}},_getAnchor:function(){return ae(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Bu=function(l,h){return new wo(l,h)};Kt.mergeOptions({closePopupOnClick:!0}),Kt.include({openPopup:function(l,h,y){return this._initOverlay(wo,l,h,y).openOn(this),this},closePopup:function(l){return l=arguments.length?l:this._popup,l&&l.close(),this}}),pn.include({bindPopup:function(l,h){return this._popup=this._initOverlay(wo,this._popup,l,h),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(l){return this._popup&&(this instanceof Mn||(this._popup._source=this),this._popup._prepareOpen(l||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(l){return this._popup&&this._popup.setContent(l),this},getPopup:function(){return this._popup},_openPopup:function(l){if(!(!this._popup||!this._map)){bs(l);var h=l.layer||l.target;if(this._popup._source===h&&!(h instanceof Rn)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(l.latlng);return}this._popup._source=h,this.openPopup(l.latlng)}},_movePopup:function(l){this._popup.setLatLng(l.latlng)},_onKeyPress:function(l){l.originalEvent.keyCode===13&&this._openPopup(l)}});var ko=dr.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(l){dr.prototype.onAdd.call(this,l),this.setOpacity(this.options.opacity),l.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(l){dr.prototype.onRemove.call(this,l),l.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var l=dr.prototype.getEvents.call(this);return this.options.permanent||(l.preclick=this.close),l},_initLayout:function(){var l="leaflet-tooltip",h=l+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=Mt("div",h),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+p(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(l){var h,y,S=this._map,A=this._container,W=S.latLngToContainerPoint(S.getCenter()),ce=S.layerPointToContainerPoint(l),Ne=this.options.direction,Ae=A.offsetWidth,Ge=A.offsetHeight,ct=ae(this.options.offset),vt=this._getAnchor();Ne==="top"?(h=Ae/2,y=Ge):Ne==="bottom"?(h=Ae/2,y=0):Ne==="center"?(h=Ae/2,y=Ge/2):Ne==="right"?(h=0,y=Ge/2):Ne==="left"?(h=Ae,y=Ge/2):ce.x<W.x?(Ne="right",h=0,y=Ge/2):(Ne="left",h=Ae+(ct.x+vt.x)*2,y=Ge/2),l=l.subtract(ae(h,y,!0)).add(ct).add(vt),Ra(A,"leaflet-tooltip-right"),Ra(A,"leaflet-tooltip-left"),Ra(A,"leaflet-tooltip-top"),Ra(A,"leaflet-tooltip-bottom"),Ft(A,"leaflet-tooltip-"+Ne),ja(A,l)},_updatePosition:function(){var l=this._map.latLngToLayerPoint(this._latlng);this._setPosition(l)},setOpacity:function(l){this.options.opacity=l,this._container&&Ca(this._container,l)},_animateZoom:function(l){var h=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center);this._setPosition(h)},_getAnchor:function(){return ae(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),mh=function(l,h){return new ko(l,h)};Kt.include({openTooltip:function(l,h,y){return this._initOverlay(ko,l,h,y).openOn(this),this},closeTooltip:function(l){return l.close(),this}}),pn.include({bindTooltip:function(l,h){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(ko,this._tooltip,l,h),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(l){if(!(!l&&this._tooltipHandlersAdded)){var h=l?"off":"on",y={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?y.add=this._openTooltip:(y.mouseover=this._openTooltip,y.mouseout=this.closeTooltip,y.click=this._openTooltip,this._map?this._addFocusListeners():y.add=this._addFocusListeners),this._tooltip.options.sticky&&(y.mousemove=this._moveTooltip),this[h](y),this._tooltipHandlersAdded=!l}},openTooltip:function(l){return this._tooltip&&(this instanceof Mn||(this._tooltip._source=this),this._tooltip._prepareOpen(l)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(l){return this._tooltip&&this._tooltip.setContent(l),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(l){var h=typeof l.getElement=="function"&&l.getElement();h&&(Ct(h,"focus",function(){this._tooltip._source=l,this.openTooltip()},this),Ct(h,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(l){var h=typeof l.getElement=="function"&&l.getElement();h&&h.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(l){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var h=this;this._map.once("moveend",function(){h._openOnceFlag=!1,h._openTooltip(l)});return}this._tooltip._source=l.layer||l.target,this.openTooltip(this._tooltip.options.sticky?l.latlng:void 0)}},_moveTooltip:function(l){var h=l.latlng,y,S;this._tooltip.options.sticky&&l.originalEvent&&(y=this._map.mouseEventToContainerPoint(l.originalEvent),S=this._map.containerPointToLayerPoint(y),h=this._map.layerPointToLatLng(S)),this._tooltip.setLatLng(h)}});var zu=Dn.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(l){var h=l&&l.tagName==="DIV"?l:document.createElement("div"),y=this.options;if(y.html instanceof Element?(Wr(h),h.appendChild(y.html)):h.innerHTML=y.html!==!1?y.html:"",y.bgPos){var S=ae(y.bgPos);h.style.backgroundPosition=-S.x+"px "+-S.y+"px"}return this._setIconStyles(h,"icon"),h},createShadow:function(){return null}});function gh(l){return new zu(l)}Dn.Default=po;var Oi=pn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:be.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(l){N(this,l)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(l){l._addZoomLimit(this)},onRemove:function(l){this._removeAllTiles(),va(this._container),l._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(sr(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Bs(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(l){return this.options.opacity=l,this._updateOpacity(),this},setZIndex:function(l){return this.options.zIndex=l,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var l=this._clampZoom(this._map.getZoom());l!==this._tileZoom&&(this._tileZoom=l,this._updateLevels()),this._update()}return this},getEvents:function(){var l={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=g(this._onMoveEnd,this.options.updateInterval,this)),l.move=this._onMove),this._zoomAnimated&&(l.zoomanim=this._animateZoom),l},createTile:function(){return document.createElement("div")},getTileSize:function(){var l=this.options.tileSize;return l instanceof J?l:new J(l,l)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(l){for(var h=this.getPane().children,y=-l(-1/0,1/0),S=0,A=h.length,W;S<A;S++)W=h[S].style.zIndex,h[S]!==this._container&&W&&(y=l(y,+W));isFinite(y)&&(this.options.zIndex=y+l(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!be.ielt9){Ca(this._container,this.options.opacity);var l=+new Date,h=!1,y=!1;for(var S in this._tiles){var A=this._tiles[S];if(!(!A.current||!A.loaded)){var W=Math.min(1,(l-A.loaded)/200);Ca(A.el,W),W<1?h=!0:(A.active?y=!0:this._onOpaqueTile(A),A.active=!0)}}y&&!this._noPrune&&this._pruneTiles(),h&&(re(this._fadeFrame),this._fadeFrame=le(this._updateOpacity,this))}},_onOpaqueTile:v,_initContainer:function(){this._container||(this._container=Mt("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var l=this._tileZoom,h=this.options.maxZoom;if(l!==void 0){for(var y in this._levels)y=Number(y),this._levels[y].el.children.length||y===l?(this._levels[y].el.style.zIndex=h-Math.abs(l-y),this._onUpdateLevel(y)):(va(this._levels[y].el),this._removeTilesAtZoom(y),this._onRemoveLevel(y),delete this._levels[y]);var S=this._levels[l],A=this._map;return S||(S=this._levels[l]={},S.el=Mt("div","leaflet-tile-container leaflet-zoom-animated",this._container),S.el.style.zIndex=h,S.origin=A.project(A.unproject(A.getPixelOrigin()),l).round(),S.zoom=l,this._setZoomTransform(S,A.getCenter(),A.getZoom()),v(S.el.offsetWidth),this._onCreateLevel(S)),this._level=S,S}},_onUpdateLevel:v,_onRemoveLevel:v,_onCreateLevel:v,_pruneTiles:function(){if(this._map){var l,h,y=this._map.getZoom();if(y>this.options.maxZoom||y<this.options.minZoom){this._removeAllTiles();return}for(l in this._tiles)h=this._tiles[l],h.retain=h.current;for(l in this._tiles)if(h=this._tiles[l],h.current&&!h.active){var S=h.coords;this._retainParent(S.x,S.y,S.z,S.z-5)||this._retainChildren(S.x,S.y,S.z,S.z+2)}for(l in this._tiles)this._tiles[l].retain||this._removeTile(l)}},_removeTilesAtZoom:function(l){for(var h in this._tiles)this._tiles[h].coords.z===l&&this._removeTile(h)},_removeAllTiles:function(){for(var l in this._tiles)this._removeTile(l)},_invalidateAll:function(){for(var l in this._levels)va(this._levels[l].el),this._onRemoveLevel(Number(l)),delete this._levels[l];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(l,h,y,S){var A=Math.floor(l/2),W=Math.floor(h/2),ce=y-1,Ne=new J(+A,+W);Ne.z=+ce;var Ae=this._tileCoordsToKey(Ne),Ge=this._tiles[Ae];return Ge&&Ge.active?(Ge.retain=!0,!0):(Ge&&Ge.loaded&&(Ge.retain=!0),ce>S?this._retainParent(A,W,ce,S):!1)},_retainChildren:function(l,h,y,S){for(var A=2*l;A<2*l+2;A++)for(var W=2*h;W<2*h+2;W++){var ce=new J(A,W);ce.z=y+1;var Ne=this._tileCoordsToKey(ce),Ae=this._tiles[Ne];if(Ae&&Ae.active){Ae.retain=!0;continue}else Ae&&Ae.loaded&&(Ae.retain=!0);y+1<S&&this._retainChildren(A,W,y+1,S)}},_resetView:function(l){var h=l&&(l.pinch||l.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),h,h)},_animateZoom:function(l){this._setView(l.center,l.zoom,!0,l.noUpdate)},_clampZoom:function(l){var h=this.options;return h.minNativeZoom!==void 0&&l<h.minNativeZoom?h.minNativeZoom:h.maxNativeZoom!==void 0&&h.maxNativeZoom<l?h.maxNativeZoom:l},_setView:function(l,h,y,S){var A=Math.round(h);this.options.maxZoom!==void 0&&A>this.options.maxZoom||this.options.minZoom!==void 0&&A<this.options.minZoom?A=void 0:A=this._clampZoom(A);var W=this.options.updateWhenZooming&&A!==this._tileZoom;(!S||W)&&(this._tileZoom=A,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),A!==void 0&&this._update(l),y||this._pruneTiles(),this._noPrune=!!y),this._setZoomTransforms(l,h)},_setZoomTransforms:function(l,h){for(var y in this._levels)this._setZoomTransform(this._levels[y],l,h)},_setZoomTransform:function(l,h,y){var S=this._map.getZoomScale(y,l.zoom),A=l.origin.multiplyBy(S).subtract(this._map._getNewPixelOrigin(h,y)).round();be.any3d?Kn(l.el,A,S):ja(l.el,A)},_resetGrid:function(){var l=this._map,h=l.options.crs,y=this._tileSize=this.getTileSize(),S=this._tileZoom,A=this._map.getPixelWorldBounds(this._tileZoom);A&&(this._globalTileRange=this._pxBoundsToTileRange(A)),this._wrapX=h.wrapLng&&!this.options.noWrap&&[Math.floor(l.project([0,h.wrapLng[0]],S).x/y.x),Math.ceil(l.project([0,h.wrapLng[1]],S).x/y.y)],this._wrapY=h.wrapLat&&!this.options.noWrap&&[Math.floor(l.project([h.wrapLat[0],0],S).y/y.x),Math.ceil(l.project([h.wrapLat[1],0],S).y/y.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(l){var h=this._map,y=h._animatingZoom?Math.max(h._animateToZoom,h.getZoom()):h.getZoom(),S=h.getZoomScale(y,this._tileZoom),A=h.project(l,this._tileZoom).floor(),W=h.getSize().divideBy(S*2);return new z(A.subtract(W),A.add(W))},_update:function(l){var h=this._map;if(h){var y=this._clampZoom(h.getZoom());if(l===void 0&&(l=h.getCenter()),this._tileZoom!==void 0){var S=this._getTiledPixelBounds(l),A=this._pxBoundsToTileRange(S),W=A.getCenter(),ce=[],Ne=this.options.keepBuffer,Ae=new z(A.getBottomLeft().subtract([Ne,-Ne]),A.getTopRight().add([Ne,-Ne]));if(!(isFinite(A.min.x)&&isFinite(A.min.y)&&isFinite(A.max.x)&&isFinite(A.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var Ge in this._tiles){var ct=this._tiles[Ge].coords;(ct.z!==this._tileZoom||!Ae.contains(new J(ct.x,ct.y)))&&(this._tiles[Ge].current=!1)}if(Math.abs(y-this._tileZoom)>1){this._setView(l,y);return}for(var vt=A.min.y;vt<=A.max.y;vt++)for(var Ht=A.min.x;Ht<=A.max.x;Ht++){var ir=new J(Ht,vt);if(ir.z=this._tileZoom,!!this._isValidTile(ir)){var Ha=this._tiles[this._tileCoordsToKey(ir)];Ha?Ha.current=!0:ce.push(ir)}}if(ce.sort(function(ta,aa){return ta.distanceTo(W)-aa.distanceTo(W)}),ce.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Fr=document.createDocumentFragment();for(Ht=0;Ht<ce.length;Ht++)this._addTile(ce[Ht],Fr);this._level.el.appendChild(Fr)}}}},_isValidTile:function(l){var h=this._map.options.crs;if(!h.infinite){var y=this._globalTileRange;if(!h.wrapLng&&(l.x<y.min.x||l.x>y.max.x)||!h.wrapLat&&(l.y<y.min.y||l.y>y.max.y))return!1}if(!this.options.bounds)return!0;var S=this._tileCoordsToBounds(l);return q(this.options.bounds).overlaps(S)},_keyToBounds:function(l){return this._tileCoordsToBounds(this._keyToTileCoords(l))},_tileCoordsToNwSe:function(l){var h=this._map,y=this.getTileSize(),S=l.scaleBy(y),A=S.add(y),W=h.unproject(S,l.z),ce=h.unproject(A,l.z);return[W,ce]},_tileCoordsToBounds:function(l){var h=this._tileCoordsToNwSe(l),y=new G(h[0],h[1]);return this.options.noWrap||(y=this._map.wrapLatLngBounds(y)),y},_tileCoordsToKey:function(l){return l.x+":"+l.y+":"+l.z},_keyToTileCoords:function(l){var h=l.split(":"),y=new J(+h[0],+h[1]);return y.z=+h[2],y},_removeTile:function(l){var h=this._tiles[l];h&&(va(h.el),delete this._tiles[l],this.fire("tileunload",{tile:h.el,coords:this._keyToTileCoords(l)}))},_initTile:function(l){Ft(l,"leaflet-tile");var h=this.getTileSize();l.style.width=h.x+"px",l.style.height=h.y+"px",l.onselectstart=v,l.onmousemove=v,be.ielt9&&this.options.opacity<1&&Ca(l,this.options.opacity)},_addTile:function(l,h){var y=this._getTilePos(l),S=this._tileCoordsToKey(l),A=this.createTile(this._wrapCoords(l),c(this._tileReady,this,l));this._initTile(A),this.createTile.length<2&&le(c(this._tileReady,this,l,null,A)),ja(A,y),this._tiles[S]={el:A,coords:l,current:!0},h.appendChild(A),this.fire("tileloadstart",{tile:A,coords:l})},_tileReady:function(l,h,y){h&&this.fire("tileerror",{error:h,tile:y,coords:l});var S=this._tileCoordsToKey(l);y=this._tiles[S],y&&(y.loaded=+new Date,this._map._fadeAnimated?(Ca(y.el,0),re(this._fadeFrame),this._fadeFrame=le(this._updateOpacity,this)):(y.active=!0,this._pruneTiles()),h||(Ft(y.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:y.el,coords:l})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),be.ielt9||!this._map._fadeAnimated?le(this._pruneTiles,this):setTimeout(c(this._pruneTiles,this),250)))},_getTilePos:function(l){return l.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(l){var h=new J(this._wrapX?x(l.x,this._wrapX):l.x,this._wrapY?x(l.y,this._wrapY):l.y);return h.z=l.z,h},_pxBoundsToTileRange:function(l){var h=this.getTileSize();return new z(l.min.unscaleBy(h).floor(),l.max.unscaleBy(h).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var l in this._tiles)if(!this._tiles[l].loaded)return!1;return!0}});function Uu(l){return new Oi(l)}var Ns=Oi.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(l,h){this._url=l,h=N(this,h),h.detectRetina&&be.retina&&h.maxZoom>0?(h.tileSize=Math.floor(h.tileSize/2),h.zoomReverse?(h.zoomOffset--,h.minZoom=Math.min(h.maxZoom,h.minZoom+1)):(h.zoomOffset++,h.maxZoom=Math.max(h.minZoom,h.maxZoom-1)),h.minZoom=Math.max(0,h.minZoom)):h.zoomReverse?h.minZoom=Math.min(h.maxZoom,h.minZoom):h.maxZoom=Math.max(h.minZoom,h.maxZoom),typeof h.subdomains=="string"&&(h.subdomains=h.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(l,h){return this._url===l&&h===void 0&&(h=!0),this._url=l,h||this.redraw(),this},createTile:function(l,h){var y=document.createElement("img");return Ct(y,"load",c(this._tileOnLoad,this,h,y)),Ct(y,"error",c(this._tileOnError,this,h,y)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(y.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(y.referrerPolicy=this.options.referrerPolicy),y.alt="",y.src=this.getTileUrl(l),y},getTileUrl:function(l){var h={r:be.retina?"@2x":"",s:this._getSubdomain(l),x:l.x,y:l.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var y=this._globalTileRange.max.y-l.y;this.options.tms&&(h.y=y),h["-y"]=y}return C(this._url,o(h,this.options))},_tileOnLoad:function(l,h){be.ielt9?setTimeout(c(l,this,null,h),0):l(null,h)},_tileOnError:function(l,h,y){var S=this.options.errorTileUrl;S&&h.getAttribute("src")!==S&&(h.src=S),l(y,h)},_onTileRemove:function(l){l.tile.onload=null},_getZoomForUrl:function(){var l=this._tileZoom,h=this.options.maxZoom,y=this.options.zoomReverse,S=this.options.zoomOffset;return y&&(l=h-l),l+S},_getSubdomain:function(l){var h=Math.abs(l.x+l.y)%this.options.subdomains.length;return this.options.subdomains[h]},_abortLoading:function(){var l,h;for(l in this._tiles)if(this._tiles[l].coords.z!==this._tileZoom&&(h=this._tiles[l].el,h.onload=v,h.onerror=v,!h.complete)){h.src=U;var y=this._tiles[l].coords;va(h),delete this._tiles[l],this.fire("tileabort",{tile:h,coords:y})}},_removeTile:function(l){var h=this._tiles[l];if(h)return h.el.setAttribute("src",U),Oi.prototype._removeTile.call(this,l)},_tileReady:function(l,h,y){if(!(!this._map||y&&y.getAttribute("src")===U))return Oi.prototype._tileReady.call(this,l,h,y)}});function Zr(l,h){return new Ns(l,h)}var No=Ns.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(l,h){this._url=l;var y=o({},this.defaultWmsParams);for(var S in h)S in this.options||(y[S]=h[S]);h=N(this,h);var A=h.detectRetina&&be.retina?2:1,W=this.getTileSize();y.width=W.x*A,y.height=W.y*A,this.wmsParams=y},onAdd:function(l){this._crs=this.options.crs||l.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var h=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[h]=this._crs.code,Ns.prototype.onAdd.call(this,l)},getTileUrl:function(l){var h=this._tileCoordsToNwSe(l),y=this._crs,S=D(y.project(h[0]),y.project(h[1])),A=S.min,W=S.max,ce=(this._wmsVersion>=1.3&&this._crs===Vc?[A.y,A.x,W.y,W.x]:[A.x,A.y,W.x,W.y]).join(","),Ne=Ns.prototype.getTileUrl.call(this,l);return Ne+j(this.wmsParams,Ne,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+ce},setParams:function(l,h){return o(this.wmsParams,l),h||this.redraw(),this}});function qr(l,h){return new No(l,h)}Ns.WMS=No,Zr.wms=qr;var Er=pn.extend({options:{padding:.1},initialize:function(l){N(this,l),p(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Ft(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var l={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(l.zoomanim=this._onAnimZoom),l},_onAnimZoom:function(l){this._updateTransform(l.center,l.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(l,h){var y=this._map.getZoomScale(h,this._zoom),S=this._map.getSize().multiplyBy(.5+this.options.padding),A=this._map.project(this._center,h),W=S.multiplyBy(-y).add(A).subtract(this._map._getNewPixelOrigin(l,h));be.any3d?Kn(this._container,W,y):ja(this._container,W)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var l in this._layers)this._layers[l]._reset()},_onZoomEnd:function(){for(var l in this._layers)this._layers[l]._project()},_updatePaths:function(){for(var l in this._layers)this._layers[l]._update()},_update:function(){var l=this.options.padding,h=this._map.getSize(),y=this._map.containerPointToLayerPoint(h.multiplyBy(-l)).round();this._bounds=new z(y,y.add(h.multiplyBy(1+l*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Nl=Er.extend({options:{tolerance:0},getEvents:function(){var l=Er.prototype.getEvents.call(this);return l.viewprereset=this._onViewPreReset,l},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Er.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var l=this._container=document.createElement("canvas");Ct(l,"mousemove",this._onMouseMove,this),Ct(l,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Ct(l,"mouseout",this._handleMouseOut,this),l._leaflet_disable_events=!0,this._ctx=l.getContext("2d")},_destroyContainer:function(){re(this._redrawRequest),delete this._ctx,va(this._container),ca(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var l;this._redrawBounds=null;for(var h in this._layers)l=this._layers[h],l._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Er.prototype._update.call(this);var l=this._bounds,h=this._container,y=l.getSize(),S=be.retina?2:1;ja(h,l.min),h.width=S*y.x,h.height=S*y.y,h.style.width=y.x+"px",h.style.height=y.y+"px",be.retina&&this._ctx.scale(2,2),this._ctx.translate(-l.min.x,-l.min.y),this.fire("update")}},_reset:function(){Er.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(l){this._updateDashArray(l),this._layers[p(l)]=l;var h=l._order={layer:l,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=h),this._drawLast=h,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(l){this._requestRedraw(l)},_removePath:function(l){var h=l._order,y=h.next,S=h.prev;y?y.prev=S:this._drawLast=S,S?S.next=y:this._drawFirst=y,delete l._order,delete this._layers[p(l)],this._requestRedraw(l)},_updatePath:function(l){this._extendRedrawBounds(l),l._project(),l._update(),this._requestRedraw(l)},_updateStyle:function(l){this._updateDashArray(l),this._requestRedraw(l)},_updateDashArray:function(l){if(typeof l.options.dashArray=="string"){var h=l.options.dashArray.split(/[, ]+/),y=[],S,A;for(A=0;A<h.length;A++){if(S=Number(h[A]),isNaN(S))return;y.push(S)}l.options._dashArray=y}else l.options._dashArray=l.options.dashArray},_requestRedraw:function(l){this._map&&(this._extendRedrawBounds(l),this._redrawRequest=this._redrawRequest||le(this._redraw,this))},_extendRedrawBounds:function(l){if(l._pxBounds){var h=(l.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new z,this._redrawBounds.extend(l._pxBounds.min.subtract([h,h])),this._redrawBounds.extend(l._pxBounds.max.add([h,h]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var l=this._redrawBounds;if(l){var h=l.getSize();this._ctx.clearRect(l.min.x,l.min.y,h.x,h.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var l,h=this._redrawBounds;if(this._ctx.save(),h){var y=h.getSize();this._ctx.beginPath(),this._ctx.rect(h.min.x,h.min.y,y.x,y.y),this._ctx.clip()}this._drawing=!0;for(var S=this._drawFirst;S;S=S.next)l=S.layer,(!h||l._pxBounds&&l._pxBounds.intersects(h))&&l._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(l,h){if(this._drawing){var y,S,A,W,ce=l._parts,Ne=ce.length,Ae=this._ctx;if(Ne){for(Ae.beginPath(),y=0;y<Ne;y++){for(S=0,A=ce[y].length;S<A;S++)W=ce[y][S],Ae[S?"lineTo":"moveTo"](W.x,W.y);h&&Ae.closePath()}this._fillStroke(Ae,l)}}},_updateCircle:function(l){if(!(!this._drawing||l._empty())){var h=l._point,y=this._ctx,S=Math.max(Math.round(l._radius),1),A=(Math.max(Math.round(l._radiusY),1)||S)/S;A!==1&&(y.save(),y.scale(1,A)),y.beginPath(),y.arc(h.x,h.y/A,S,0,Math.PI*2,!1),A!==1&&y.restore(),this._fillStroke(y,l)}},_fillStroke:function(l,h){var y=h.options;y.fill&&(l.globalAlpha=y.fillOpacity,l.fillStyle=y.fillColor||y.color,l.fill(y.fillRule||"evenodd")),y.stroke&&y.weight!==0&&(l.setLineDash&&l.setLineDash(h.options&&h.options._dashArray||[]),l.globalAlpha=y.opacity,l.lineWidth=y.weight,l.strokeStyle=y.color,l.lineCap=y.lineCap,l.lineJoin=y.lineJoin,l.stroke())},_onClick:function(l){for(var h=this._map.mouseEventToLayerPoint(l),y,S,A=this._drawFirst;A;A=A.next)y=A.layer,y.options.interactive&&y._containsPoint(h)&&(!(l.type==="click"||l.type==="preclick")||!this._map._draggableMoved(y))&&(S=y);this._fireEvent(S?[S]:!1,l)},_onMouseMove:function(l){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var h=this._map.mouseEventToLayerPoint(l);this._handleMouseHover(l,h)}},_handleMouseOut:function(l){var h=this._hoveredLayer;h&&(Ra(this._container,"leaflet-interactive"),this._fireEvent([h],l,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(l,h){if(!this._mouseHoverThrottled){for(var y,S,A=this._drawFirst;A;A=A.next)y=A.layer,y.options.interactive&&y._containsPoint(h)&&(S=y);S!==this._hoveredLayer&&(this._handleMouseOut(l),S&&(Ft(this._container,"leaflet-interactive"),this._fireEvent([S],l,"mouseover"),this._hoveredLayer=S)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,l),this._mouseHoverThrottled=!0,setTimeout(c(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(l,h,y){this._map._fireDOMEvent(h,y||h.type,l)},_bringToFront:function(l){var h=l._order;if(h){var y=h.next,S=h.prev;if(y)y.prev=S;else return;S?S.next=y:y&&(this._drawFirst=y),h.prev=this._drawLast,this._drawLast.next=h,h.next=null,this._drawLast=h,this._requestRedraw(l)}},_bringToBack:function(l){var h=l._order;if(h){var y=h.next,S=h.prev;if(S)S.next=y;else return;y?y.prev=S:S&&(this._drawLast=S),h.prev=null,h.next=this._drawFirst,this._drawFirst.prev=h,this._drawFirst=h,this._requestRedraw(l)}}});function So(l){return be.canvas?new Nl(l):null}var Ss=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(l){return document.createElement("<lvml:"+l+' class="lvml">')}}catch(l){}return function(l){return document.createElement("<"+l+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),Gc={_initContainer:function(){this._container=Mt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Er.prototype._update.call(this),this.fire("update"))},_initPath:function(l){var h=l._container=Ss("shape");Ft(h,"leaflet-vml-shape "+(this.options.className||"")),h.coordsize="1 1",l._path=Ss("path"),h.appendChild(l._path),this._updateStyle(l),this._layers[p(l)]=l},_addPath:function(l){var h=l._container;this._container.appendChild(h),l.options.interactive&&l.addInteractiveTarget(h)},_removePath:function(l){var h=l._container;va(h),l.removeInteractiveTarget(h),delete this._layers[p(l)]},_updateStyle:function(l){var h=l._stroke,y=l._fill,S=l.options,A=l._container;A.stroked=!!S.stroke,A.filled=!!S.fill,S.stroke?(h||(h=l._stroke=Ss("stroke")),A.appendChild(h),h.weight=S.weight+"px",h.color=S.color,h.opacity=S.opacity,S.dashArray?h.dashStyle=O(S.dashArray)?S.dashArray.join(" "):S.dashArray.replace(/( *, *)/g," "):h.dashStyle="",h.endcap=S.lineCap.replace("butt","flat"),h.joinstyle=S.lineJoin):h&&(A.removeChild(h),l._stroke=null),S.fill?(y||(y=l._fill=Ss("fill")),A.appendChild(y),y.color=S.fillColor||S.color,y.opacity=S.fillOpacity):y&&(A.removeChild(y),l._fill=null)},_updateCircle:function(l){var h=l._point.round(),y=Math.round(l._radius),S=Math.round(l._radiusY||y);this._setPath(l,l._empty()?"M0 0":"AL "+h.x+","+h.y+" "+y+","+S+" 0,"+65535*360)},_setPath:function(l,h){l._path.v=h},_bringToFront:function(l){sr(l._container)},_bringToBack:function(l){Bs(l._container)}},Pn=be.vml?Ss:ia,Li=Er.extend({_initContainer:function(){this._container=Pn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Pn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){va(this._container),ca(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Er.prototype._update.call(this);var l=this._bounds,h=l.getSize(),y=this._container;(!this._svgSize||!this._svgSize.equals(h))&&(this._svgSize=h,y.setAttribute("width",h.x),y.setAttribute("height",h.y)),ja(y,l.min),y.setAttribute("viewBox",[l.min.x,l.min.y,h.x,h.y].join(" ")),this.fire("update")}},_initPath:function(l){var h=l._path=Pn("path");l.options.className&&Ft(h,l.options.className),l.options.interactive&&Ft(h,"leaflet-interactive"),this._updateStyle(l),this._layers[p(l)]=l},_addPath:function(l){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(l._path),l.addInteractiveTarget(l._path)},_removePath:function(l){va(l._path),l.removeInteractiveTarget(l._path),delete this._layers[p(l)]},_updatePath:function(l){l._project(),l._update()},_updateStyle:function(l){var h=l._path,y=l.options;h&&(y.stroke?(h.setAttribute("stroke",y.color),h.setAttribute("stroke-opacity",y.opacity),h.setAttribute("stroke-width",y.weight),h.setAttribute("stroke-linecap",y.lineCap),h.setAttribute("stroke-linejoin",y.lineJoin),y.dashArray?h.setAttribute("stroke-dasharray",y.dashArray):h.removeAttribute("stroke-dasharray"),y.dashOffset?h.setAttribute("stroke-dashoffset",y.dashOffset):h.removeAttribute("stroke-dashoffset")):h.setAttribute("stroke","none"),y.fill?(h.setAttribute("fill",y.fillColor||y.color),h.setAttribute("fill-opacity",y.fillOpacity),h.setAttribute("fill-rule",y.fillRule||"evenodd")):h.setAttribute("fill","none"))},_updatePoly:function(l,h){this._setPath(l,Lt(l._parts,h))},_updateCircle:function(l){var h=l._point,y=Math.max(Math.round(l._radius),1),S=Math.max(Math.round(l._radiusY),1)||y,A="a"+y+","+S+" 0 1,0 ",W=l._empty()?"M0 0":"M"+(h.x-y)+","+h.y+A+y*2+",0 "+A+-y*2+",0 ";this._setPath(l,W)},_setPath:function(l,h){l._path.setAttribute("d",h)},_bringToFront:function(l){sr(l._path)},_bringToBack:function(l){Bs(l._path)}});be.vml&&Li.include(Gc);function jo(l){return be.svg||be.vml?new Li(l):null}Kt.include({getRenderer:function(l){var h=l.options.renderer||this._getPaneRenderer(l.options.pane)||this.options.renderer||this._renderer;return h||(h=this._renderer=this._createRenderer()),this.hasLayer(h)||this.addLayer(h),h},_getPaneRenderer:function(l){if(l==="overlayPane"||l===void 0)return!1;var h=this._paneRenderers[l];return h===void 0&&(h=this._createRenderer({pane:l}),this._paneRenderers[l]=h),h},_createRenderer:function(l){return this.options.preferCanvas&&So(l)||jo(l)}});var $s=Ti.extend({initialize:function(l,h){Ti.prototype.initialize.call(this,this._boundsToLatLngs(l),h)},setBounds:function(l){return this.setLatLngs(this._boundsToLatLngs(l))},_boundsToLatLngs:function(l){return l=q(l),[l.getSouthWest(),l.getNorthWest(),l.getNorthEast(),l.getSouthEast()]}});function ph(l,h){return new $s(l,h)}Li.create=Pn,Li.pointsToPath=Lt,ts.geometryToLayer=cr,ts.coordsToLatLng=bl,ts.coordsToLatLngs=bo,ts.latLngToCoords=vl,ts.latLngsToCoords=vo,ts.getFeature=_s,ts.asFeature=_l,Kt.mergeOptions({boxZoom:!0});var Cr=Ln.extend({initialize:function(l){this._map=l,this._container=l._container,this._pane=l._panes.overlayPane,this._resetStateTimeout=0,l.on("unload",this._destroy,this)},addHooks:function(){Ct(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){ca(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){va(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(l){if(!l.shiftKey||l.which!==1&&l.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),yi(),dl(),this._startPoint=this._map.mouseEventToContainerPoint(l),Ct(document,{contextmenu:bs,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(l){this._moved||(this._moved=!0,this._box=Mt("div","leaflet-zoom-box",this._container),Ft(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(l);var h=new z(this._point,this._startPoint),y=h.getSize();ja(this._box,h.min),this._box.style.width=y.x+"px",this._box.style.height=y.y+"px"},_finish:function(){this._moved&&(va(this._box),Ra(this._container,"leaflet-crosshair")),An(),oo(),ca(document,{contextmenu:bs,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(l){if(!(l.which!==1&&l.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(c(this._resetState,this),0);var h=new G(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(h).fire("boxzoomend",{boxZoomBounds:h})}},_onKeyDown:function(l){l.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Kt.addInitHook("addHandler","boxZoom",Cr),Kt.mergeOptions({doubleClickZoom:!0});var Sl=Ln.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(l){var h=this._map,y=h.getZoom(),S=h.options.zoomDelta,A=l.originalEvent.shiftKey?y-S:y+S;h.options.doubleClickZoom==="center"?h.setZoom(A):h.setZoomAround(l.containerPoint,A)}});Kt.addInitHook("addHandler","doubleClickZoom",Sl),Kt.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Fn=Ln.extend({addHooks:function(){if(!this._draggable){var l=this._map;this._draggable=new vs(l._mapPane,l._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),l.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),l.on("zoomend",this._onZoomEnd,this),l.whenReady(this._onZoomEnd,this))}Ft(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Ra(this._map._container,"leaflet-grab"),Ra(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var l=this._map;if(l._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var h=q(this._map.options.maxBounds);this._offsetLimit=D(this._map.latLngToContainerPoint(h.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(h.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;l.fire("movestart").fire("dragstart"),l.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(l){if(this._map.options.inertia){var h=this._lastTime=+new Date,y=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(y),this._times.push(h),this._prunePositions(h)}this._map.fire("move",l).fire("drag",l)},_prunePositions:function(l){for(;this._positions.length>1&&l-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var l=this._map.getSize().divideBy(2),h=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=h.subtract(l).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(l,h){return l-(l-h)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var l=this._draggable._newPos.subtract(this._draggable._startPos),h=this._offsetLimit;l.x<h.min.x&&(l.x=this._viscousLimit(l.x,h.min.x)),l.y<h.min.y&&(l.y=this._viscousLimit(l.y,h.min.y)),l.x>h.max.x&&(l.x=this._viscousLimit(l.x,h.max.x)),l.y>h.max.y&&(l.y=this._viscousLimit(l.y,h.max.y)),this._draggable._newPos=this._draggable._startPos.add(l)}},_onPreDragWrap:function(){var l=this._worldWidth,h=Math.round(l/2),y=this._initialWorldOffset,S=this._draggable._newPos.x,A=(S-h+y)%l+h-y,W=(S+h+y)%l-h-y,ce=Math.abs(A+y)<Math.abs(W+y)?A:W;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=ce},_onDragEnd:function(l){var h=this._map,y=h.options,S=!y.inertia||l.noInertia||this._times.length<2;if(h.fire("dragend",l),S)h.fire("moveend");else{this._prunePositions(+new Date);var A=this._lastPos.subtract(this._positions[0]),W=(this._lastTime-this._times[0])/1e3,ce=y.easeLinearity,Ne=A.multiplyBy(ce/W),Ae=Ne.distanceTo([0,0]),Ge=Math.min(y.inertiaMaxSpeed,Ae),ct=Ne.multiplyBy(Ge/Ae),vt=Ge/(y.inertiaDeceleration*ce),Ht=ct.multiplyBy(-vt/2).round();!Ht.x&&!Ht.y?h.fire("moveend"):(Ht=h._limitOffset(Ht,h.options.maxBounds),le(function(){h.panBy(Ht,{duration:vt,easeLinearity:ce,noMoveStart:!0,animate:!0})}))}}});Kt.addInitHook("addHandler","dragging",Fn),Kt.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Zc=Ln.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(l){this._map=l,this._setPanDelta(l.options.keyboardPanDelta),this._setZoomDelta(l.options.zoomDelta)},addHooks:function(){var l=this._map._container;l.tabIndex<=0&&(l.tabIndex="0"),Ct(l,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),ca(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var l=document.body,h=document.documentElement,y=l.scrollTop||h.scrollTop,S=l.scrollLeft||h.scrollLeft;this._map._container.focus(),window.scrollTo(S,y)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(l){var h=this._panKeys={},y=this.keyCodes,S,A;for(S=0,A=y.left.length;S<A;S++)h[y.left[S]]=[-1*l,0];for(S=0,A=y.right.length;S<A;S++)h[y.right[S]]=[l,0];for(S=0,A=y.down.length;S<A;S++)h[y.down[S]]=[0,l];for(S=0,A=y.up.length;S<A;S++)h[y.up[S]]=[0,-1*l]},_setZoomDelta:function(l){var h=this._zoomKeys={},y=this.keyCodes,S,A;for(S=0,A=y.zoomIn.length;S<A;S++)h[y.zoomIn[S]]=l;for(S=0,A=y.zoomOut.length;S<A;S++)h[y.zoomOut[S]]=-l},_addHooks:function(){Ct(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){ca(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(l){if(!(l.altKey||l.ctrlKey||l.metaKey)){var h=l.keyCode,y=this._map,S;if(h in this._panKeys){if(!y._panAnim||!y._panAnim._inProgress)if(S=this._panKeys[h],l.shiftKey&&(S=ae(S).multiplyBy(3)),y.options.maxBounds&&(S=y._limitOffset(ae(S),y.options.maxBounds)),y.options.worldCopyJump){var A=y.wrapLatLng(y.unproject(y.project(y.getCenter()).add(S)));y.panTo(A)}else y.panBy(S)}else if(h in this._zoomKeys)y.setZoom(y.getZoom()+(l.shiftKey?3:1)*this._zoomKeys[h]);else if(h===27&&y._popup&&y._popup.options.closeOnEscapeKey)y.closePopup();else return;bs(l)}}});Kt.addInitHook("addHandler","keyboard",Zc),Kt.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var To=Ln.extend({addHooks:function(){Ct(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){ca(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(l){var h=xr(l),y=this._map.options.wheelDebounceTime;this._delta+=h,this._lastMousePos=this._map.mouseEventToContainerPoint(l),this._startTime||(this._startTime=+new Date);var S=Math.max(y-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(c(this._performZoom,this),S),bs(l)},_performZoom:function(){var l=this._map,h=l.getZoom(),y=this._map.options.zoomSnap||0;l._stop();var S=this._delta/(this._map.options.wheelPxPerZoomLevel*4),A=4*Math.log(2/(1+Math.exp(-Math.abs(S))))/Math.LN2,W=y?Math.ceil(A/y)*y:A,ce=l._limitZoom(h+(this._delta>0?W:-W))-h;this._delta=0,this._startTime=null,ce&&(l.options.scrollWheelZoom==="center"?l.setZoom(h+ce):l.setZoomAround(this._lastMousePos,h+ce))}});Kt.addInitHook("addHandler","scrollWheelZoom",To);var Ws=600;Kt.mergeOptions({tapHold:be.touchNative&&be.safari&&be.mobile,tapTolerance:15});var jl=Ln.extend({addHooks:function(){Ct(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){ca(this._map._container,"touchstart",this._onDown,this)},_onDown:function(l){if(clearTimeout(this._holdTimeout),l.touches.length===1){var h=l.touches[0];this._startPos=this._newPos=new J(h.clientX,h.clientY),this._holdTimeout=setTimeout(c(function(){this._cancel(),this._isTapValid()&&(Ct(document,"touchend",Ua),Ct(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",h))},this),Ws),Ct(document,"touchend touchcancel contextmenu",this._cancel,this),Ct(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function l(){ca(document,"touchend",Ua),ca(document,"touchend touchcancel",l)},_cancel:function(){clearTimeout(this._holdTimeout),ca(document,"touchend touchcancel contextmenu",this._cancel,this),ca(document,"touchmove",this._onMove,this)},_onMove:function(l){var h=l.touches[0];this._newPos=new J(h.clientX,h.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(l,h){var y=new MouseEvent(l,{bubbles:!0,cancelable:!0,view:window,screenX:h.screenX,screenY:h.screenY,clientX:h.clientX,clientY:h.clientY});y._simulated=!0,h.target.dispatchEvent(y)}});Kt.addInitHook("addHandler","tapHold",jl),Kt.mergeOptions({touchZoom:be.touch,bounceAtZoomLimits:!0});var qc=Ln.extend({addHooks:function(){Ft(this._map._container,"leaflet-touch-zoom"),Ct(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Ra(this._map._container,"leaflet-touch-zoom"),ca(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(l){var h=this._map;if(!(!l.touches||l.touches.length!==2||h._animatingZoom||this._zooming)){var y=h.mouseEventToContainerPoint(l.touches[0]),S=h.mouseEventToContainerPoint(l.touches[1]);this._centerPoint=h.getSize()._divideBy(2),this._startLatLng=h.containerPointToLatLng(this._centerPoint),h.options.touchZoom!=="center"&&(this._pinchStartLatLng=h.containerPointToLatLng(y.add(S)._divideBy(2))),this._startDist=y.distanceTo(S),this._startZoom=h.getZoom(),this._moved=!1,this._zooming=!0,h._stop(),Ct(document,"touchmove",this._onTouchMove,this),Ct(document,"touchend touchcancel",this._onTouchEnd,this),Ua(l)}},_onTouchMove:function(l){if(!(!l.touches||l.touches.length!==2||!this._zooming)){var h=this._map,y=h.mouseEventToContainerPoint(l.touches[0]),S=h.mouseEventToContainerPoint(l.touches[1]),A=y.distanceTo(S)/this._startDist;if(this._zoom=h.getScaleZoom(A,this._startZoom),!h.options.bounceAtZoomLimits&&(this._zoom<h.getMinZoom()&&A<1||this._zoom>h.getMaxZoom()&&A>1)&&(this._zoom=h._limitZoom(this._zoom)),h.options.touchZoom==="center"){if(this._center=this._startLatLng,A===1)return}else{var W=y._add(S)._divideBy(2)._subtract(this._centerPoint);if(A===1&&W.x===0&&W.y===0)return;this._center=h.unproject(h.project(this._pinchStartLatLng,this._zoom).subtract(W),this._zoom)}this._moved||(h._moveStart(!0,!1),this._moved=!0),re(this._animRequest);var ce=c(h._move,h,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=le(ce,this,!0),Ua(l)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,re(this._animRequest),ca(document,"touchmove",this._onTouchMove,this),ca(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Kt.addInitHook("addHandler","touchZoom",qc),Kt.BoxZoom=Cr,Kt.DoubleClickZoom=Sl,Kt.Drag=Fn,Kt.Keyboard=Zc,Kt.ScrollWheelZoom=To,Kt.TapHold=jl,Kt.TouchZoom=qc,a.Bounds=z,a.Browser=be,a.CRS=Pe,a.Canvas=Nl,a.Circle=yl,a.CircleMarker=ji,a.Class=ye,a.Control=Pr,a.DivIcon=zu,a.DivOverlay=dr,a.DomEvent=hl,a.DomUtil=_i,a.Draggable=vs,a.Evented=V,a.FeatureGroup=Mn,a.GeoJSON=ts,a.GridLayer=Oi,a.Handler=Ln,a.Icon=Dn,a.ImageOverlay=Ci,a.LatLng=K,a.LatLngBounds=G,a.Layer=pn,a.LayerGroup=Si,a.LineUtil=dh,a.Map=Kt,a.Marker=yo,a.Mixin=ih,a.Path=Rn,a.Point=J,a.PolyUtil=$c,a.Polygon=Ti,a.Polyline=es,a.Popup=wo,a.PosAnimation=wi,a.Projection=Ou,a.Rectangle=$s,a.Renderer=Er,a.SVG=Li,a.SVGOverlay=kl,a.TileLayer=Ns,a.Tooltip=ko,a.Transformation=it,a.Util=de,a.VideoOverlay=ks,a.bind=c,a.bounds=D,a.canvas=So,a.circle=Pu,a.circleMarker=Ru,a.control=Qn,a.divIcon=gh,a.extend=o,a.featureGroup=Mu,a.geoJSON=wl,a.geoJson=_o,a.gridLayer=Uu,a.icon=go,a.imageOverlay=Fu,a.latLng=fe,a.latLngBounds=q,a.layerGroup=uh,a.map=Fc,a.marker=Du,a.point=ae,a.polygon=hh,a.polyline=fh,a.popup=Bu,a.rectangle=ph,a.setOptions=N,a.stamp=p,a.svg=jo,a.svgOverlay=Iu,a.tileLayer=Zr,a.tooltip=mh,a.transformation=ht,a.version=s,a.videoOverlay=Ai;var Yc=window.L;a.noConflict=function(){return window.L=Yc,this},window.L=a}))})(Fd,Fd.exports)),Fd.exports}var Oc=cL();const Pp=Iv(Oc);function ah(e,t,a){return Object.freeze({instance:e,context:t,container:a})}function Fp(e,t){return t==null?function(s,o){const u=E.useRef(void 0);return u.current||(u.current=e(s,o)),u}:function(s,o){const u=E.useRef(void 0);u.current||(u.current=e(s,o));const c=E.useRef(s),{instance:f}=u.current;return E.useEffect(function(){c.current!==s&&(t(f,s,c.current),c.current=s)},[f,s,t]),u}}function dL(e,t){E.useEffect(function(){var o;return((o=t.layerContainer)!=null?o:t.map).addLayer(e.instance),function(){var c;(c=t.layerContainer)==null||c.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function Kw(e){return function(a){const s=Dp(),o=e(Rp(a,s),s);return Yw(s.map,a.attribution),Xw(o.current,a.eventHandlers),dL(o.current,s),o}}function uL(e,t){const a=Fp(e,t),s=Kw(a);return nL(s)}function Jw(e,t){const a=Fp(e),s=oL(a,t);return sL(s)}function fL(e,t){const a=Fp(e,t),s=Kw(a);return iL(s)}function hL(e,t,a){const{opacity:s,zIndex:o}=t;s!=null&&s!==a.opacity&&e.setOpacity(s),o!=null&&o!==a.zIndex&&e.setZIndex(o)}function mL(){return Dp().map}function gL(_,v){var k=_,{bounds:e,boundsOptions:t,center:a,children:s,className:o,id:u,placeholder:c,style:f,whenReady:p,zoom:g}=k,x=tn(k,["bounds","boundsOptions","center","children","className","id","placeholder","style","whenReady","zoom"]);const[T]=E.useState({className:o,id:u,style:f}),[N,j]=E.useState(null),P=E.useRef(void 0);E.useImperativeHandle(v,()=>{var R;return(R=N==null?void 0:N.map)!=null?R:null},[N]);const C=E.useCallback(R=>{if(R!==null&&!P.current){const U=new Oc.Map(R,x);P.current=U,a!=null&&g!=null?U.setView(a,g):e!=null&&U.fitBounds(e,t),p!=null&&U.whenReady(p),j(aL(U))}},[]);E.useEffect(()=>()=>{N==null||N.map.remove()},[N]);const O=N?ea.createElement(Mp,{value:N},s):c!=null?c:null;return ea.createElement("div",Le(ie({},T),{ref:C}),O)}const pL=E.forwardRef(gL),xL=uL(function(o,s){var u=o,{position:t}=u,a=tn(u,["position"]);const c=new Oc.Marker(t,a);return ah(c,rL(s,{overlayContainer:c}))},function(t,a,s){a.position!==s.position&&t.setLatLng(a.position),a.icon!=null&&a.icon!==s.icon&&t.setIcon(a.icon),a.zIndexOffset!=null&&a.zIndexOffset!==s.zIndexOffset&&t.setZIndexOffset(a.zIndexOffset),a.opacity!=null&&a.opacity!==s.opacity&&t.setOpacity(a.opacity),t.dragging!=null&&a.draggable!==s.draggable&&(a.draggable===!0?t.dragging.enable():t.dragging.disable())}),yL=Jw(function(t,a){const s=new Oc.Popup(t,a.overlayContainer);return ah(s,a)},function(t,a,{position:s},o){E.useEffect(function(){const{instance:c}=t;function f(g){g.popup===c&&(c.update(),o(!0))}function p(g){g.popup===c&&o(!1)}return a.map.on({popupopen:f,popupclose:p}),a.overlayContainer==null?(s!=null&&c.setLatLng(s),c.openOn(a.map)):a.overlayContainer.bindPopup(c),function(){var x;a.map.off({popupopen:f,popupclose:p}),(x=a.overlayContainer)==null||x.unbindPopup(),a.map.removeLayer(c)}},[t,a,o,s])}),bL=fL(function(o,s){var u=o,{url:t}=u,a=tn(u,["url"]);const c=new Oc.TileLayer(t,Rp(a,s));return ah(c,s)},function(t,a,s){hL(t,a,s);const{url:o}=a;o!=null&&o!==s.url&&t.setUrl(o)}),vL=Jw(function(t,a){const s=new Oc.Tooltip(t,a.overlayContainer);return ah(s,a)},function(t,a,{position:s},o){E.useEffect(function(){const c=a.overlayContainer;if(c==null)return;const{instance:f}=t,p=x=>{x.tooltip===f&&(s!=null&&f.setLatLng(s),f.update(),o(!0))},g=x=>{x.tooltip===f&&o(!1)};return c.on({tooltipopen:p,tooltipclose:g}),c.bindTooltip(f),function(){c.off({tooltipopen:p,tooltipclose:g}),c._map!=null&&c.unbindTooltip()}},[t,a,o,s])}),_L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",wL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",kL=Pp.icon({iconUrl:_L,shadowUrl:wL,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]});Pp.Marker.prototype.options.icon=kL;const NL=({locations:e})=>{const t=mL();return E.useEffect(()=>{if(e.length>0&&e.some(a=>a.latitude&&a.longitude)){const a=Pp.latLngBounds(e.filter(s=>s.latitude&&s.longitude).map(s=>[s.latitude,s.longitude]));t.fitBounds(a,{padding:[30,30],maxZoom:8})}else t.setView([24.8,45.5],6)},[e,t]),null},SL=()=>{const e=Da(),[t,a]=E.useState(""),[s,o]=E.useState([]),[u,c]=E.useState(!0),f=E.useRef({}),p=()=>ge(null,null,function*(){c(!0);try{const k={latitude:["!=",""],longitude:["!=",""]};t&&(k.name=t);const T=yield Ke.apiCall(`/api/resource/Location?filters=${encodeURIComponent(JSON.stringify(k))}&fields=["name","latitude","longitude"]`),j=((T==null?void 0:T.data)||[]).map(C=>ge(null,null,function*(){var R,U,H,B,oe,se,pe,le,re,de;const O={assets:0,normal_work_orders:0,urgent_work_orders:0,planned_maintenance:0,completed_maintenance:0,overdue_maintenance:0,wo_open:0,wo_progress:0,wo_review:0,wo_completed:0};try{const ye=yield Ke.apiCall(`/api/resource/Asset?filters=${encodeURIComponent(JSON.stringify({company:C.name}))}&fields=["name"]`);O.assets=((R=ye==null?void 0:ye.data)==null?void 0:R.length)||0;const ue=yield Ke.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({company:C.name,custom_priority_:"Normal",repair_status:["in",["Open","Work In Progress"]]}))}&fields=["name"]`);O.normal_work_orders=((U=ue==null?void 0:ue.data)==null?void 0:U.length)||0;const te=yield Ke.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({company:C.name,custom_priority_:"Urgent",repair_status:["in",["Open","Work In Progress"]]}))}&fields=["name"]`);O.urgent_work_orders=((H=te==null?void 0:te.data)==null?void 0:H.length)||0;const[V,J,ne,ae,z,D,G]=yield Promise.all([Ke.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({company:C.name,repair_status:"Open"}))}&fields=["name"]`),Ke.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({company:C.name,repair_status:"Work In Progress"}))}&fields=["name"]`),Ke.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({company:C.name,repair_status:"Pending Review"}))}&fields=["name"]`),Ke.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({company:C.name,repair_status:"Completed"}))}&fields=["name"]`),Ke.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({custom_hospital_name:C.name,maintenance_status:"Planned"}))}&fields=["name"]`),Ke.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({custom_hospital_name:C.name,maintenance_status:"Completed"}))}&fields=["name"]`),Ke.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({custom_hospital_name:C.name,maintenance_status:"Overdue"}))}&fields=["name"]`)]);O.wo_open=((B=V==null?void 0:V.data)==null?void 0:B.length)||0,O.wo_progress=((oe=J==null?void 0:J.data)==null?void 0:oe.length)||0,O.wo_review=((se=ne==null?void 0:ne.data)==null?void 0:se.length)||0,O.wo_completed=((pe=ae==null?void 0:ae.data)==null?void 0:pe.length)||0,O.planned_maintenance=((le=z==null?void 0:z.data)==null?void 0:le.length)||0,O.completed_maintenance=((re=D==null?void 0:D.data)==null?void 0:re.length)||0,O.overdue_maintenance=((de=G==null?void 0:G.data)==null?void 0:de.length)||0}catch(ye){console.error(`Error fetching counts for ${C.name}:`,ye)}return ie({name:C.name,latitude:parseFloat(C.latitude),longitude:parseFloat(C.longitude)},O)})),P=yield Promise.all(j);o(P.filter(C=>!isNaN(C.latitude)&&!isNaN(C.longitude)))}catch(k){console.error("Error fetching map data:",k)}finally{c(!1)}});E.useEffect(()=>{p()},[t]);const g=(k,T,N)=>{const j=new URLSearchParams;k&&j.set("company",k),T&&j.set("priority",T),N&&j.set("status",N),e(`/work-orders?${j.toString()}`)},x=k=>{const T=new URLSearchParams;k&&T.set("company",k),e(`/assets?${T.toString()}`)},v=(k,T)=>{const N=new URLSearchParams;k&&N.set("hospital",k),T&&N.set("status",T),e(`/maintenance-calendar?${N.toString()}`)},_=k=>r.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg shadow-lg min-w-[280px] max-w-[320px]",children:[r.jsxs("div",{className:"mb-4 pb-3 border-b border-gray-200 dark:border-gray-700",children:[r.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-white",children:k.name}),r.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:["Total Assets: ",r.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:k.assets})]})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 mb-2",children:"Work Order Status"}),r.jsxs("div",{className:"flex gap-2 mb-3",children:[r.jsxs("button",{onClick:()=>g(k.name,"Normal"),className:"px-3 py-1.5 bg-blue-100 dark:bg-blue-900/30 hover:bg-blue-200 dark:hover:bg-blue-900/50 text-blue-700 dark:text-blue-300 rounded-lg text-xs font-semibold transition-colors cursor-pointer",children:["Normal: ",k.normal_work_orders]}),r.jsxs("button",{onClick:()=>g(k.name,"Urgent"),className:"px-3 py-1.5 bg-red-100 dark:bg-red-900/30 hover:bg-red-200 dark:hover:bg-red-900/50 text-red-700 dark:text-red-300 rounded-lg text-xs font-semibold transition-colors cursor-pointer",children:["Urgent: ",k.urgent_work_orders]})]}),r.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 text-left font-semibold text-gray-700 dark:text-gray-300",children:"Status"}),r.jsx("th",{className:"px-3 py-2 text-left font-semibold text-gray-700 dark:text-gray-300",children:"Count"})]})}),r.jsxs("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:[r.jsxs("tr",{className:"bg-red-50 dark:bg-red-900/20 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors",children:[r.jsx("td",{className:"px-3 py-2 text-red-800 dark:text-red-300 font-medium",children:"Open"}),r.jsx("td",{className:"px-3 py-2",children:r.jsx("button",{onClick:()=>g(k.name,void 0,"Open"),className:"text-red-700 dark:text-red-400 font-bold hover:underline cursor-pointer",children:k.wo_open})})]}),r.jsxs("tr",{className:"bg-yellow-50 dark:bg-yellow-900/20 hover:bg-yellow-100 dark:hover:bg-yellow-900/30 transition-colors",children:[r.jsx("td",{className:"px-3 py-2 text-yellow-800 dark:text-yellow-300 font-medium",children:"Work In Progress"}),r.jsx("td",{className:"px-3 py-2",children:r.jsx("button",{onClick:()=>g(k.name,void 0,"Work In Progress"),className:"text-yellow-700 dark:text-yellow-400 font-bold hover:underline cursor-pointer",children:k.wo_progress})})]}),r.jsxs("tr",{className:"bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/30 transition-colors",children:[r.jsx("td",{className:"px-3 py-2 text-blue-800 dark:text-blue-300 font-medium",children:"Pending Review"}),r.jsx("td",{className:"px-3 py-2",children:r.jsx("button",{onClick:()=>g(k.name,void 0,"Pending Review"),className:"text-blue-700 dark:text-blue-400 font-bold hover:underline cursor-pointer",children:k.wo_review})})]}),r.jsxs("tr",{className:"bg-green-50 dark:bg-green-900/20 hover:bg-green-100 dark:hover:bg-green-900/30 transition-colors",children:[r.jsx("td",{className:"px-3 py-2 text-green-800 dark:text-green-300 font-medium",children:"Completed"}),r.jsx("td",{className:"px-3 py-2",children:r.jsx("button",{onClick:()=>g(k.name,void 0,"Completed"),className:"text-green-700 dark:text-green-400 font-bold hover:underline cursor-pointer",children:k.wo_completed})})]})]})]})})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 mb-2",children:"Preventive Maintenance"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs("button",{onClick:()=>v(k.name,"Planned"),className:"px-3 py-1.5 bg-orange-100 dark:bg-orange-900/30 hover:bg-orange-200 dark:hover:bg-orange-900/50 text-orange-700 dark:text-orange-300 rounded-lg text-xs font-semibold transition-colors cursor-pointer",children:["Planned: ",k.planned_maintenance]}),r.jsxs("button",{onClick:()=>v(k.name,"Completed"),className:"px-3 py-1.5 bg-green-100 dark:bg-green-900/30 hover:bg-green-200 dark:hover:bg-green-900/50 text-green-700 dark:text-green-300 rounded-lg text-xs font-semibold transition-colors cursor-pointer",children:["Completed: ",k.completed_maintenance]}),r.jsxs("button",{onClick:()=>v(k.name,"Overdue"),className:"px-3 py-1.5 bg-red-100 dark:bg-red-900/30 hover:bg-red-200 dark:hover:bg-red-900/50 text-red-700 dark:text-red-300 rounded-lg text-xs font-semibold transition-colors cursor-pointer",children:["Overdue: ",k.overdue_maintenance]})]})]}),r.jsxs("div",{className:"flex gap-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[r.jsx("button",{onClick:()=>x(k.name),className:"flex-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-600 text-white rounded-lg text-sm font-medium transition-colors cursor-pointer",children:"View Assets"}),r.jsx("button",{onClick:()=>g(k.name),className:"flex-1 px-4 py-2 bg-purple-600 hover:bg-purple-700 dark:bg-purple-700 dark:hover:bg-purple-600 text-white rounded-lg text-sm font-medium transition-colors cursor-pointer",children:"View Work Orders"})]})]});return r.jsxs("div",{className:"h-screen flex flex-col bg-gray-50 dark:bg-gray-900",children:[r.jsx("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 shadow-sm border-b border-gray-200 dark:border-gray-700 px-4 py-3",children:r.jsx("h1",{className:"text-xl font-semibold text-gray-800 dark:text-white",children:"Active Map"})}),r.jsx("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3 relative z-[1000]",children:r.jsx("div",{className:"max-w-md relative z-[1000]",children:r.jsx(St,{label:"Hospital",doctype:"Location",value:t,onChange:a,filters:{custom_is_hospital:1},placeholder:"Select hospital (leave empty for all)"})})}),r.jsxs("div",{className:"flex-1 relative",style:{zIndex:1},children:[u&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-75 z-[1000]",children:r.jsx("div",{className:"text-gray-600 dark:text-gray-300",children:"Loading map data..."})}),r.jsxs(pL,{center:[24.8,45.5],zoom:6,style:{height:"100%",width:"100%"},zoomControl:!0,children:[r.jsx(bL,{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),r.jsx(NL,{locations:s}),s.map(k=>{const T=k.urgent_work_orders>0?"🚨 URGENT! ":"",N=`${k.latitude}-${k.longitude}`;return r.jsxs(xL,{position:[k.latitude,k.longitude],ref:j=>{j&&(f.current[N]=j,k.urgent_work_orders>0&&setTimeout(()=>{const P=j.getElement();P&&P.classList.add("urgent-marker","red-marker")},100))},children:[r.jsx(vL,{permanent:!1,direction:"right",className:"hospital-tooltip-modern",children:r.jsxs("div",{className:"p-2 bg-white dark:bg-gray-800 rounded-lg shadow-lg min-w-[200px]",children:[r.jsxs("div",{className:"mb-2 pb-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h4",{className:"text-sm font-bold text-gray-900 dark:text-white",children:[T,k.name]}),r.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-0.5",children:["Assets: ",r.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:k.assets})]})]}),r.jsxs("div",{className:"space-y-1 text-xs",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Normal WOs:"}),r.jsx("span",{className:"font-semibold text-blue-700 dark:text-blue-300",children:k.normal_work_orders})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Urgent WOs:"}),r.jsx("span",{className:"font-semibold text-red-700 dark:text-red-300",children:k.urgent_work_orders})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Planned PMs:"}),r.jsx("span",{className:"font-semibold text-orange-700 dark:text-orange-300",children:k.planned_maintenance})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Completed PMs:"}),r.jsx("span",{className:"font-semibold text-green-700 dark:text-green-300",children:k.completed_maintenance})]})]})]})}),r.jsx(yL,{className:"hospital-popup-container",maxWidth:300,maxHeight:410,autoPan:!0,keepInView:!0,closeButton:!0,autoClose:!1,children:_(k)})]},N)})]})]}),r.jsx("style",{children:`
/* Ensure filter container and dropdowns stay above map */
.leaflet-container {
z-index: 1 !important;
}
/* LinkField dropdown z-index - ensure it's above everything */
[data-linkfield-dropdown],
.linkfield-dropdown,
.react-select__menu,
.react-select__menu-portal,
.select2-container,
.select2-dropdown {
z-index: 1050 !important;
}
/* Any dropdown menu from LinkField */
div[role="listbox"],
ul[role="listbox"],
.dropdown-menu,
.autocomplete-dropdown {
z-index: 1050 !important;
}
.hospital-tooltip-modern {
background: transparent !important;
border: none !important;
box-shadow: none !important;
}
.hospital-tooltip-modern .leaflet-tooltip-content-wrapper {
background: transparent !important;
border: none !important;
box-shadow: none !important;
padding: 0 !important;
}
.hospital-tooltip-modern .leaflet-tooltip-content {
margin: 0 !important;
}
.hospital-popup-container .leaflet-popup-content-wrapper {
padding: 0;
border-radius: 8px;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.hospital-popup-container .leaflet-popup-content {
margin: 0;
width: auto !important;
}
.urgent-marker {
animation: urgent-flash 2s infinite;
}
@keyframes urgent-flash {
0%, 50% {
filter: hue-rotate(0deg) brightness(1) saturate(1);
}
25%, 75% {
filter: hue-rotate(0deg) brightness(1.5) saturate(2) drop-shadow(0 0 10px red);
}
}
.red-marker {
filter: hue-rotate(120deg) saturate(2) brightness(0.8);
}
.leaflet-popup {
z-index: 2000 !important;
}
.leaflet-tooltip {
z-index: 2000 !important;
}
`})]})};class jL{getItems(t,a,s=20,o=0){return ge(this,null,function*(){var u;try{const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),a&&c.append("fields",JSON.stringify(a)),c.append("limit_page_length",s.toString()),c.append("limit_start",o.toString());const f=yield Ke.apiCall(`/api/resource/Item?${c.toString()}`),p=((u=f.data)==null?void 0:u.length)||0;return{data:f.data||[],total:p}}catch(c){throw console.error("Error fetching items:",c),c}})}getItem(t){return ge(this,null,function*(){try{return(yield Ke.apiCall(`/api/resource/Item/${t}`)).data}catch(a){throw console.error("Error fetching item:",a),a}})}createItem(t){return ge(this,null,function*(){try{return(yield Ke.apiCall("/api/resource/Item",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).data}catch(a){throw console.error("Error creating item:",a),a}})}updateItem(t,a){return ge(this,null,function*(){try{return(yield Ke.apiCall(`/api/resource/Item/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).data}catch(s){throw console.error("Error updating item:",s),s}})}deleteItem(t){return ge(this,null,function*(){try{yield Ke.apiCall(`/api/resource/Item/${t}`,{method:"DELETE"})}catch(a){throw console.error("Error deleting item:",a),a}})}submitItem(t){return ge(this,null,function*(){try{return(yield Ke.apiCall(`/api/resource/Item/${t}/submit`,{method:"POST"})).data}catch(a){throw console.error("Error submitting item:",a),a}})}cancelItem(t){return ge(this,null,function*(){try{return(yield Ke.apiCall(`/api/resource/Item/${t}/cancel`,{method:"POST"})).data}catch(a){throw console.error("Error cancelling item:",a),a}})}}const cc=new jL;function TL(e,t=20,a=0,s){const[o,u]=E.useState([]),[c,f]=E.useState(0),[p,g]=E.useState(!1),[x,v]=E.useState(!0),[_,k]=E.useState(null),[T,N]=E.useState(0),j=E.useRef(!1),P=JSON.stringify(e);E.useEffect(()=>{if(j.current&&_)return;let O=!1;return j.current=!0,ge(null,null,function*(){try{v(!0);const U=["name","item_code","item_name","item_group","stock_uom","disabled","is_stock_item","custom_hospital_name","opening_stock","valuation_rate","standard_rate","creation","modified","owner","docstatus"],H=yield cc.getItems(e,U,t,a);O||(u(H.data),f(H.total),g(H.data.length===t),k(null))}catch(U){if(!O){const H=U instanceof Error?U.message:"Failed to fetch items";k(H),u([]),f(0),g(!1)}}finally{O||v(!1)}}),()=>{O=!0}},[P,t,a,s,T]);const C=E.useCallback(()=>{j.current=!1,N(O=>O+1)},[]);return{items:o,totalCount:c,hasMore:p,loading:x,error:_,refetch:C}}function EL(e){const[t,a]=E.useState(null),[s,o]=E.useState(!0),[u,c]=E.useState(null),f=E.useCallback(()=>ge(null,null,function*(){if(!e){a(null),o(!1);return}try{o(!0),c(null);const g=yield cc.getItem(e);a(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch item details")}finally{o(!1)}}),[e]);E.useEffect(()=>{f()},[f]);const p=E.useCallback(()=>{f()},[f]);return{item:t,loading:s,error:u,refetch:p}}function Qw(){const[e,t]=E.useState(!1),[a,s]=E.useState(null),o=E.useCallback(p=>ge(null,null,function*(){try{return t(!0),s(null),yield cc.createItem(p)}catch(g){const x=g instanceof Error?g.message:"Failed to create item";throw s(x),g}finally{t(!1)}}),[]),u=E.useCallback((p,g)=>ge(null,null,function*(){try{return t(!0),s(null),yield cc.updateItem(p,g)}catch(x){const v=x instanceof Error?x.message:"Failed to update item";throw s(v),x}finally{t(!1)}}),[]),c=E.useCallback(p=>ge(null,null,function*(){try{t(!0),s(null),yield cc.deleteItem(p)}catch(g){const x=g instanceof Error?g.message:"Failed to delete item";throw s(x),g}finally{t(!1)}}),[]),f=E.useCallback(p=>ge(null,null,function*(){try{return t(!0),s(null),yield cc.submitItem(p)}catch(g){const x=g instanceof Error?g.message:"Failed to submit item";throw s(x),g}finally{t(!1)}}),[]);return{createItem:o,updateItem:u,deleteItem:c,submitItem:f,loading:e,error:a}}const CL=({isOpen:e,onClose:t,selectedCount:a,totalCount:s,pageCount:o,onExport:u,isExporting:c,exportColumns:f})=>{const{t:p}=ln(),[g,x]=E.useState(a>0?"selected":"all_with_filters"),[v,_]=E.useState("csv"),[k,T]=E.useState(f.filter(C=>C.default).map(C=>C.key));E.useEffect(()=>{a>0?x("selected"):x("all_with_filters")},[a]);const N=C=>{T(O=>O.includes(C)?O.filter(R=>R!==C):[...O,C])},j=()=>{T(f.map(C=>C.key))},P=()=>{T(f.filter(C=>C.default).map(C=>C.key))};return e?r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden animate-scale-in",children:[r.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ui,{className:"text-white text-xl"}),r.jsxs("h3",{className:"text-lg font-semibold text-white",children:[p("listPages.export")," Items"]})]}),r.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:r.jsx(pt,{size:20})})]})}),r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Select Data to Export"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="selected"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${a===0?"opacity-50 cursor-not-allowed":""}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"selected",checked:g==="selected",onChange:()=>x("selected"),disabled:a===0,className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",a," selected item",a!==1?"s":""]})]}),a>0&&r.jsxs("span",{className:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 px-2 py-1 rounded text-xs font-medium",children:[a," selected"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="all_on_page"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:g==="all_on_page",onChange:()=>x("all_on_page"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",o," item",o!==1?"s":""," on current page"]})]}),r.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 px-2 py-1 rounded text-xs font-medium",children:[o," rows"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="all_with_filters"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:g==="all_with_filters",onChange:()=>x("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," item",s!==1?"s":""," matching current filters"]})]}),r.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/40 text-purple-700 dark:text-purple-300 px-2 py-1 rounded text-xs font-medium",children:[s," total"]})]})]})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Format"}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${v==="csv"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"csv",checked:v==="csv",onChange:()=>_("csv"),className:"text-green-600 focus:ring-green-500"}),r.jsx(tp,{className:"text-green-600 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"CSV"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${v==="excel"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"excel",checked:v==="excel",onChange:()=>_("excel"),className:"text-green-600 focus:ring-green-500"}),r.jsx(ap,{className:"text-green-700 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Excel"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:j,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),r.jsx("button",{onClick:P,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-48 overflow-y-auto p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg",children:f.map(C=>r.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${k.includes(C.key)?"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-400"}`,children:[r.jsx("input",{type:"checkbox",checked:k.includes(C.key),onChange:()=>N(C.key),className:"rounded text-green-600 focus:ring-green-500"}),r.jsx("span",{className:"text-sm truncate",children:C.label})]},C.key))}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[k.length," column",k.length!==1?"s":""," selected"]})]})]}),r.jsxs("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[r.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[g==="selected"&&`Exporting ${a} selected row${a!==1?"s":""}`,g==="all_on_page"&&`Exporting ${o} row${o!==1?"s":""} from current page`,g==="all_with_filters"&&`Exporting all ${s} row${s!==1?"s":""}`]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",disabled:c,children:"Cancel"}),r.jsx("button",{onClick:()=>u(g,v,k),disabled:k.length===0||c,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:c?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(kc,{}),"Export"]})})]})]})]})}):null},AL=()=>{const{t:e}=ln(),t=Da(),[a,s]=E.useState(0),[o,u]=E.useState(null),c=20,f=[{key:"name",label:"Item ID",default:!0},{key:"item_code",label:"Item Code",default:!0},{key:"item_name",label:"Item Name",default:!0},{key:"item_group",label:"Item Group",default:!0},{key:"custom_hospital_name",label:"Hospital",default:!0},{key:"stock_uom",label:"Stock UOM",default:!1},{key:"custom_part_description",label:"Part Description",default:!1},{key:"brand",label:"Brand",default:!1},{key:"valuation_rate",label:"Valuation Rate",default:!1},{key:"opening_stock",label:"Opening Stock",default:!1},{key:"custom_last_calibration_date",label:"Last Calibration Date",default:!1},{key:"custom_next_due_calibration_date",label:"Next Calibration Date",default:!1},{key:"description",label:"Description",default:!1},{key:"creation",label:"Created On",default:!1},{key:"modified",label:"Modified On",default:!0},{key:"owner",label:"Created By",default:!1},{key:"modified_by",label:"Modified By",default:!1}],[p,g]=E.useState(!1),[x,v]=E.useState(new Set),[_,k]=E.useState(!1),[T,N]=E.useState(!1),[j,P]=E.useState(""),[C,O]=E.useState(""),[R,U]=E.useState(""),[H,B]=E.useState(""),[oe,se]=E.useState(!0),[pe,le]=E.useState(0),[re,de]=E.useState([]),[ye,ue]=E.useState(!1),[te,V]=E.useState(""),[J,ne]=E.useState(""),ae=E.useRef(null);E.useEffect(()=>{const qe=localStorage.getItem("itemFilterPresets");qe&&de(JSON.parse(qe))},[]),E.useEffect(()=>{const qe=[j,C,R,H].filter(Boolean).length;le(qe)},[j,C,R,H]);const z={};j&&(z.name=j),C&&(z.item_group=C),R&&(z.custom_hospital_name=R),H&&(z.item_name=["like",`%${H}%`]);const{items:D,totalCount:G,hasMore:q,loading:K,error:fe,refetch:Pe}=TL(Object.keys(z).length>0?z:void 0,c,a*c,"creation desc"),{deleteItem:We,loading:Fe}=Qw();E.useEffect(()=>{!K&&!p&&g(!0)},[K,p]),E.useEffect(()=>{a!==0&&s(0)},[j,C,R,H]),E.useEffect(()=>{v(new Set)},[j,C,R,H,a]);const He=qe=>{ne(qe),ae.current&&clearTimeout(ae.current),ae.current=window.setTimeout(()=>{B(qe)},800)},it=qe=>{qe.key==="Enter"&&(qe.preventDefault(),ae.current&&clearTimeout(ae.current),B(J))},ht=()=>{if(!te.trim()){alert("Please enter a filter name");return}const qe={id:Date.now(),name:te,filters:{filterItemId:j,filterItemGroup:C,filterCompany:R,filterItemName:H}},at=[...re,qe];de(at),V(""),ue(!1),localStorage.setItem("itemFilterPresets",JSON.stringify(at))},Vt=qe=>{const at=qe.filters;P(at.filterItemId||""),O(at.filterItemGroup||""),U(at.filterCompany||""),B(at.filterItemName||""),ne(at.filterItemName||"")},_t=qe=>{const at=re.filter(wt=>wt.id!==qe);de(at),localStorage.setItem("itemFilterPresets",JSON.stringify(at))};E.useEffect(()=>()=>{ae.current&&clearTimeout(ae.current)},[]);const ia=()=>{P(""),O(""),U(""),B(""),ne(""),ae.current&&clearTimeout(ae.current)},Lt=j||C||R||H,Be=qe=>qe?new Date(qe).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-",yt=qe=>{v(at=>{const wt=new Set(at);return wt.has(qe)?wt.delete(qe):wt.add(qe),wt})},ke=()=>{x.size===D.length?v(new Set):v(new Set(D.map(qe=>qe.name)))},ze=D.length>0&&x.size===D.length,Je=x.size>0&&x.size<D.length,nt=E.useCallback(()=>ge(null,null,function*(){const qe=[];let at=0;const wt=100;let kt=!0;for(;kt;)try{const De=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Item",filters:z,fields:["*"],limit_start:at*wt,limit_page_length:wt,order_by:"creation desc"})})).json()).message||[];qe.push(...De),De.length<wt?kt=!1:at++,at>100&&(console.warn("Export safety limit reached"),kt=!1)}catch(da){throw console.error("Error fetching items for export:",da),da}return qe}),[z]),ut=(qe,at,wt)=>ge(null,null,function*(){N(!0);try{let kt=[];switch(qe){case"selected":kt=D.filter(xe=>x.has(xe.name));break;case"all_on_page":kt=D;break;case"all_with_filters":kt=yield nt();break}if(kt.length===0){alert("No data to export");return}const da=wt.map(xe=>{const De=f.find($e=>$e.key===xe);return(De==null?void 0:De.label)||xe});if(at==="csv"){const xe=[da.join(","),...kt.map(Gt=>wt.map(Sa=>{let tt=Gt[Sa]||"";return typeof tt=="string"&&(tt.includes(",")||tt.includes('"')||tt.includes(`
`))&&(tt=`"${tt.replace(/"/g,'""')}"`),tt}).join(","))].join(`
`),De=new Blob(["\uFEFF"+xe],{type:"text/csv;charset=utf-8;"}),$e=URL.createObjectURL(De),Et=document.createElement("a");Et.href=$e,Et.download=`items_export_${new Date().toISOString().split("T")[0]}.csv`,Et.click(),URL.revokeObjectURL($e)}else if(at==="excel"){const xe=[da,...kt.map(Et=>wt.map(Gt=>Et[Gt]||""))],De=ci.aoa_to_sheet(xe),$e=ci.book_new();ci.book_append_sheet($e,De,"Items"),Ep($e,`items_export_${new Date().toISOString().split("T")[0]}.xlsx`)}k(!1),v(new Set)}catch(kt){console.error("Export failed:",kt),alert(`Export failed: ${kt instanceof Error?kt.message:"Unknown error"}`)}finally{N(!1)}}),ft=()=>{t("/inventory/new")},bt=qe=>{t(`/inventory/${qe}`)},Ut=qe=>{t(`/inventory/${qe}`)},Rt=qe=>ge(null,null,function*(){try{yield We(qe),u(null),Pe(),alert("Item deleted successfully!")}catch(at){alert(`Failed to delete: ${at instanceof Error?at.message:"Unknown error"}`)}}),Pt=qe=>{t(`/inventory/new?duplicate=${qe}`)};return K&&!p?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading items..."})]})}):fe?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"⚠️ Error Loading Items"}),r.jsxs("div",{className:"text-red-700 dark:text-red-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"Failed to load items."})}),r.jsxs("div",{className:"mt-4 flex gap-3",children:[r.jsx("button",{onClick:()=>t("/inventory/new"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Create New Item"}),r.jsx("button",{onClick:Pe,className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]}),r.jsx("div",{className:"mt-4 p-4 bg-white dark:bg-gray-800 rounded border border-red-300 dark:border-red-700",children:r.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[r.jsx("strong",{children:"Technical Error:"})," ",fe]})})]})}):r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:"Inventory"}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",G," item",G!==1?"s":"",x.size>0&&r.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",x.size," selected"]}),K&&p&&r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[r.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:()=>k(!0),className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow transition-all",disabled:G===0,children:[r.jsx(ui,{}),r.jsx("span",{className:"font-medium",children:e("listPages.export")}),x.size>0&&r.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:x.size})]}),r.jsxs("button",{onClick:ft,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(fi,{}),r.jsx("span",{className:"font-medium",children:"Add Item"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[r.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-blue-600 dark:from-blue-600 dark:to-blue-700 px-4 py-3 rounded-t-lg",children:r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[r.jsx("button",{onClick:()=>se(!oe),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:oe?r.jsx(iu,{size:14}):r.jsx(wc,{size:14})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ko,{className:"text-white",size:16}),r.jsx("h3",{className:"text-white font-semibold text-sm",children:e("listPages.filters")})]}),pe>0&&r.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:pe})]}),Lt&&r.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:r.jsxs("div",{className:"flex items-center gap-2 py-1",children:[j&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-blue-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Item ID:"})," ",j,r.jsx("button",{onClick:qe=>{qe.stopPropagation(),P("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),H&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-cyan-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Name:"})," ",H,r.jsx("button",{onClick:qe=>{qe.stopPropagation(),B(""),ne("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),R&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-green-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Hospital:"})," ",R,r.jsx("button",{onClick:qe=>{qe.stopPropagation(),U("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]}),C&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-purple-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Item Group:"})," ",C,r.jsx("button",{onClick:qe=>{qe.stopPropagation(),O("")},className:"hover:text-red-500 transition-colors",children:r.jsx(pt,{className:"text-[9px]"})})]})]})}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[pe>0&&r.jsxs("button",{onClick:()=>ue(!0),className:"px-3 py-1.5 bg-white text-blue-600 hover:bg-blue-50 rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(Wn,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),Lt&&r.jsxs("button",{onClick:ia,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(pt,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),oe&&r.jsxs("div",{className:"p-4",children:[re.length>0&&r.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[r.jsx(rp,{className:"text-yellow-500",size:12}),"Saved Filters"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:re.map(qe=>r.jsxs("div",{className:"group relative inline-flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-100 to-blue-100 dark:from-purple-900/30 dark:to-blue-900/30 border border-purple-200 dark:border-purple-700 rounded-lg hover:shadow-md transition-all",children:[r.jsx("button",{onClick:()=>Vt(qe),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:qe.name}),r.jsx("button",{onClick:()=>_t(qe.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:r.jsx(Xa,{size:10})})]},qe.id))})]}),r.jsx("div",{className:"space-y-5",children:r.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[r.jsxs("div",{className:"relative z-[60]",children:[r.jsx(St,{label:"Item",doctype:"Item",value:j,onChange:qe=>P(qe),placeholder:"Select Item",disabled:!1,compact:!0}),j&&r.jsx("button",{onClick:()=>P(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Item Name"}),r.jsx("input",{type:"text",value:J,onChange:qe=>He(qe.target.value),onKeyDown:it,placeholder:"Type to search...",className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),J&&J!==H&&r.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),H&&r.jsx("button",{onClick:()=>{B(""),ne("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[59]",children:[r.jsx(St,{label:"Hospital",doctype:"Company",value:R,onChange:qe=>U(qe),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),R&&r.jsx("button",{onClick:()=>U(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]}),r.jsxs("div",{className:"relative z-[58]",children:[r.jsx(St,{label:"Item Group",doctype:"Item Group",value:C,onChange:qe=>O(qe),placeholder:"Select Item Group",disabled:!1,compact:!0}),C&&r.jsx("button",{onClick:()=>O(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(pt,{size:10})})]})]})})})]})]}),ye&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Save Filter Preset"}),r.jsx("input",{type:"text",value:te,onChange:qe=>V(qe.target.value),onKeyDown:qe=>{qe.key==="Enter"&&(qe.preventDefault(),ht())},placeholder:"Enter filter name (e.g., 'Medical Supplies')",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white mb-4",autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{ue(!1),V("")},className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Cancel"}),r.jsxs("button",{onClick:ht,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors flex items-center gap-2",children:[r.jsx(Wn,{size:12}),"Save Filter"]})]})]})}),r.jsx(CL,{isOpen:_,onClose:()=>k(!1),selectedCount:x.size,totalCount:G,pageCount:D.length,onExport:ut,isExporting:T,exportColumns:f}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[K&&p&&r.jsx("div",{className:"absolute inset-0 bg-white/60 dark:bg-gray-800/60 flex items-center justify-center z-10 backdrop-blur-[1px]",children:r.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[r.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Filtering..."})]})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-3 text-left",children:r.jsx("button",{onClick:ke,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:ze?"Deselect all":"Select all",children:ze?r.jsx(mc,{className:"text-blue-600 dark:text-blue-400",size:18}):Je?r.jsxs("div",{className:"relative",children:[r.jsx(si,{size:18}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):r.jsx(si,{size:18})})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Item Code"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Item Name"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Item Group"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Hospital"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Updated On"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:D.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:7,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(n6,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:"No items found"}),Lt?r.jsx("button",{onClick:ia,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Clear filters"}):r.jsx("button",{onClick:ft,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Create your first item"})]})})}):D.map(qe=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors cursor-pointer ${x.has(qe.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>bt(qe.name),children:[r.jsx("td",{className:"px-4 py-4",onClick:at=>at.stopPropagation(),children:r.jsx("button",{onClick:()=>yt(qe.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:x.has(qe.name)?r.jsx(mc,{className:"text-blue-600 dark:text-blue-400",size:18}):r.jsx(si,{size:18})})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:qe.item_code||qe.name})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:qe.item_name||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:qe.item_group||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:qe.custom_hospital_name||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:Be(qe.modified)})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"flex items-center gap-1",onClick:at=>at.stopPropagation(),children:[r.jsx("button",{onClick:()=>bt(qe.name),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:"View Details",children:r.jsx(Nc,{})}),r.jsx("button",{onClick:()=>Ut(qe.name),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:"Edit Item",children:r.jsx(Tn,{})}),r.jsx("button",{onClick:()=>Pt(qe.name),className:"text-purple-600 dark:text-purple-400 hover:text-purple-900 dark:hover:text-purple-300 p-2 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded transition-colors",title:"Duplicate Item",children:r.jsx(ou,{})}),r.jsx("button",{onClick:()=>u(qe.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete Item",disabled:Fe,children:r.jsx(Xa,{})})]})})]},qe.name))})]})}),(q||a>0)&&r.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[r.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",a*c+1," to ",Math.min((a+1)*c,G)," of ",G," results"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>s(Math.max(0,a-1)),disabled:a===0,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),r.jsx("button",{onClick:()=>s(a+1),disabled:!q,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]}),o&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:r.jsx(Xa,{className:"text-red-600 dark:text-red-400 text-xl"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Item"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Are you sure you want to delete this item? This action cannot be undone."}),r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-3 mb-4",children:r.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[r.jsx("strong",{children:"Item ID:"})," ",o]})}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>u(null),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",disabled:Fe,children:"Cancel"}),r.jsx("button",{onClick:()=>Rt(o),className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",disabled:Fe,children:Fe?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Xa,{}),"Delete Item"]})})]})]})]})})}),r.jsx("style",{children:`
@keyframes scale-in {
from {
transform: scale(0.95);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}
}
.animate-scale-in {
animation: scale-in 0.2s ease-out;
}
.scrollbar-hide {
-ms-overflow-style: none;
scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
display: none;
}
`})]})},OL=()=>{var de;const{itemName:e}=_c(),t=Da(),[a]=rl(),s=a.get("duplicate"),o=e==="new",u=o&&!!s,[c,f]=E.useState(0),[p,g]=E.useState(!1),[x,v]=E.useState({item_code:"",item_name:"",item_group:"",custom_hospital_name:"",custom_part_description:"",stock_uom:"Nos",custom_item_cost_per_unit:0,disabled:0,is_stock_item:1,opening_stock:0,valuation_rate:0,standard_rate:0,custom_last_calibration_date:"",custom_next_due_calibration_date:"",description:"",brand:"",custom_warranty_in_months:"",valuation_method:"",has_batch_no:0,has_serial_no:0,is_purchase_item:1,is_sales_item:1,country_of_origin:"Saudi Arabia"}),{item:_,loading:k,error:T,refetch:N}=EL(u?s:o?null:e||null),{createItem:j,updateItem:P,loading:C}=Qw(),[O,R]=E.useState(o),U=(de=_==null?void 0:_.docstatus)!=null?de:0,H=U===1,B=U===2,oe=U===0,se=x.item_group==="Tools",pe=E.useCallback(ye=>ge(null,null,function*(){var ue;if(ye){g(!0);try{let te=null;typeof window!="undefined"&&window.csrf_token&&(te=window.csrf_token);const V=JSON.stringify([["item_code","=",ye]]),J=JSON.stringify(["actual_qty","warehouse"]),ne=`${Ot.BASE_URL}/api/resource/Bin?filters=${encodeURIComponent(V)}&fields=${encodeURIComponent(J)}&limit_page_length=0`,ae={Accept:"application/json","Content-Type":"application/json"};te&&(ae["X-Frappe-CSRF-Token"]=te);const z=yield fetch(ne,{method:"GET",headers:ae,credentials:"include"});if(!z.ok)throw new Error(`HTTP error! status: ${z.status}`);const G=((ue=(yield z.json()).data)==null?void 0:ue.reduce((q,K)=>q+(K.actual_qty||0),0))||0;f(G)}catch(te){console.error("Failed to fetch balance qty:",te),f(0)}finally{g(!1)}}}),[]);E.useEffect(()=>{!o&&(_!=null&&_.item_code)&&pe(_.item_code)},[o,_==null?void 0:_.item_code,pe]),E.useEffect(()=>{var ye,ue,te,V,J,ne;_&&!u?(v({item_code:_.item_code||"",item_name:_.item_name||"",item_group:_.item_group||"",custom_hospital_name:_.custom_hospital_name||"",custom_part_description:_.custom_part_description||"",stock_uom:_.stock_uom||"Nos",custom_item_cost_per_unit:_.custom_item_cost_per_unit||0,disabled:_.disabled||0,is_stock_item:(ye=_.is_stock_item)!=null?ye:1,opening_stock:_.opening_stock||0,valuation_rate:_.valuation_rate||0,standard_rate:_.standard_rate||0,custom_last_calibration_date:_.custom_last_calibration_date||"",custom_next_due_calibration_date:_.custom_next_due_calibration_date||"",description:_.description||"",brand:_.brand||"",custom_warranty_in_months:_.custom_warranty_in_months||"",valuation_method:_.valuation_method||"",has_batch_no:_.has_batch_no||0,has_serial_no:_.has_serial_no||0,is_purchase_item:(ue=_.is_purchase_item)!=null?ue:1,is_sales_item:(te=_.is_sales_item)!=null?te:1,country_of_origin:_.country_of_origin||"Saudi Arabia",uoms:_.uoms||[],item_defaults:_.item_defaults||[]}),R(!1)):u&&_&&v({item_code:"",item_name:_.item_name||"",item_group:_.item_group||"",custom_hospital_name:_.custom_hospital_name||"",custom_part_description:_.custom_part_description||"",stock_uom:_.stock_uom||"Nos",custom_item_cost_per_unit:_.custom_item_cost_per_unit||0,disabled:0,is_stock_item:(V=_.is_stock_item)!=null?V:1,opening_stock:_.opening_stock||0,valuation_rate:_.valuation_rate||0,standard_rate:_.standard_rate||0,custom_last_calibration_date:_.custom_last_calibration_date||"",custom_next_due_calibration_date:_.custom_next_due_calibration_date||"",description:_.description||"",brand:_.brand||"",custom_warranty_in_months:_.custom_warranty_in_months||"",valuation_method:_.valuation_method||"",has_batch_no:_.has_batch_no||0,has_serial_no:_.has_serial_no||0,is_purchase_item:(J=_.is_purchase_item)!=null?J:1,is_sales_item:(ne=_.is_sales_item)!=null?ne:1,country_of_origin:_.country_of_origin||"Saudi Arabia",uoms:_.uoms||[],item_defaults:_.item_defaults||[]})},[_,u]);const le=()=>ge(null,null,function*(){try{if(o){const ye=yield j(x);t(`/inventory/${ye.name}`)}else yield P(e,x),yield N(),x.item_code&&pe(x.item_code),R(!1),alert("Item updated successfully!")}catch(ye){alert(`Failed to save: ${ye instanceof Error?ye.message:"Unknown error"}`)}}),re=E.useCallback(ye=>!!(!O||B||H),[O,B,H]);return k?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading item..."})]})}):T&&!o?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"Error Loading Item"}),r.jsx("p",{className:"text-red-700 dark:text-red-400 mb-4",children:T}),r.jsx("button",{onClick:()=>t("/inventory"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Back to Inventory"})]})}):r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("button",{onClick:()=>t("/inventory"),className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200",children:r.jsx(no,{size:20})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:o?"New Item":(_==null?void 0:_.item_name)||(_==null?void 0:_.item_code)||"Item"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:o?"Create a new item":`Item Code: ${(_==null?void 0:_.item_code)||e}`})]})]}),r.jsxs("div",{className:"flex gap-3",children:[!o&&!O&&oe&&r.jsxs("button",{onClick:()=>R(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(Tn,{}),"Edit"]}),O&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>{o?t("/inventory"):(R(!1),N())},className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg",children:"Cancel"}),r.jsxs("button",{onClick:le,disabled:C,className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(Wn,{}),C?"Saving...":"Save"]})]})]})]}),r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Basic Information"})}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Item Code ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{type:"text",value:x.item_code,onChange:ye=>v(Le(ie({},x),{item_code:ye.target.value})),disabled:re("item_code")||!o,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800",required:!0})]}),r.jsx("div",{children:r.jsx(St,{label:"Hospital",doctype:"Company",value:x.custom_hospital_name||"",onChange:ye=>v(Le(ie({},x),{custom_hospital_name:ye})),disabled:re("custom_hospital_name"),placeholder:"Select Hospital",filters:{domain:"Healthcare"}})}),r.jsx("div",{children:r.jsx(St,{label:"Item Group",doctype:"Item Group",value:x.item_group||"",onChange:ye=>v(Le(ie({},x),{item_group:ye})),disabled:re("item_group"),placeholder:"Select item group"})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Stock UOM"}),r.jsx("input",{type:"text",value:x.stock_uom,onChange:ye=>v(Le(ie({},x),{stock_uom:ye.target.value})),disabled:re("stock_uom"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Part Description"}),r.jsx("input",{type:"text",value:x.custom_part_description,onChange:ye=>v(Le(ie({},x),{custom_part_description:ye.target.value})),disabled:re("custom_part_description"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),r.jsx("div",{className:"md:col-span-2 mt-6",children:r.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Stock Information"})}),r.jsx("div",{className:"md:col-span-2",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 items-end",children:[r.jsxs("div",{className:"flex items-center gap-2 h-[42px]",children:[r.jsx("input",{type:"checkbox",id:"is_stock_item",checked:x.is_stock_item===1,onChange:ye=>v(Le(ie({},x),{is_stock_item:ye.target.checked?1:0})),disabled:re("is_stock_item"),className:"w-4 h-4"}),r.jsx("label",{htmlFor:"is_stock_item",className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Is Stock Item"})]}),o&&x.is_stock_item===1&&r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Opening Stock"}),r.jsx("input",{type:"number",value:x.opening_stock,onChange:ye=>v(Le(ie({},x),{opening_stock:parseFloat(ye.target.value)||0})),disabled:re("opening_stock"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),o&&x.is_stock_item===1&&r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Valuation Rate"}),r.jsx("input",{type:"number",step:"0.01",value:x.valuation_rate,onChange:ye=>v(Le(ie({},x),{valuation_rate:parseFloat(ye.target.value)||0})),disabled:re("valuation_rate"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),!o&&x.is_stock_item===1&&r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Balance Qty"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"number",value:c,readOnly:!0,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white cursor-not-allowed"}),r.jsx("button",{type:"button",onClick:()=>x.item_code&&pe(x.item_code),disabled:p,className:"p-2 text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 disabled:opacity-50",title:"Refresh Balance Qty",children:r.jsx(h6,{className:p?"animate-spin":""})})]})]})]})}),se&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"md:col-span-2 mt-6",children:r.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Calibration Information"})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Last Calibration Date"}),r.jsx("input",{type:"date",value:x.custom_last_calibration_date,onChange:ye=>v(Le(ie({},x),{custom_last_calibration_date:ye.target.value})),disabled:re("custom_last_calibration_date"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Next Due Calibration Date"}),r.jsx("input",{type:"date",value:x.custom_next_due_calibration_date,onChange:ye=>v(Le(ie({},x),{custom_next_due_calibration_date:ye.target.value})),disabled:re("custom_next_due_calibration_date"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]})]}),r.jsx("div",{className:"md:col-span-2 mt-6",children:r.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Additional Information"})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Description"}),r.jsx("textarea",{value:x.description,onChange:ye=>v(Le(ie({},x),{description:ye.target.value})),disabled:re("description"),rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Warranty (Months)"}),r.jsx("input",{type:"text",value:x.custom_warranty_in_months,onChange:ye=>v(Le(ie({},x),{custom_warranty_in_months:ye.target.value})),disabled:re("custom_warranty_in_months"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]})]})})]})};const LL=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ML=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,s)=>s?s.toUpperCase():a.toLowerCase()),Pv=e=>{const t=ML(e);return t.charAt(0).toUpperCase()+t.slice(1)},e4=(...e)=>e.filter((t,a,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===a).join(" ").trim(),DL=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var RL={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"};const PL=E.forwardRef((g,p)=>{var x=g,{color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:s,className:o="",children:u,iconNode:c}=x,f=tn(x,["color","size","strokeWidth","absoluteStrokeWidth","className","children","iconNode"]);return E.createElement("svg",ie(ie(Le(ie({ref:p},RL),{width:t,height:t,stroke:e,strokeWidth:s?Number(a)*24/Number(t):a,className:e4("lucide",o)}),!u&&!DL(f)&&{"aria-hidden":"true"}),f),[...c.map(([v,_])=>E.createElement(v,_)),...Array.isArray(u)?u:[u]])});const pr=(e,t)=>{const a=E.forwardRef((c,u)=>{var f=c,{className:s}=f,o=tn(f,["className"]);return E.createElement(PL,ie({ref:u,iconNode:t,className:e4(`lucide-${LL(Pv(e))}`,`lucide-${e}`,s)},o))});return a.displayName=Pv(e),a};const FL=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],IL=pr("bell",FL);const BL=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]],zL=pr("calendar-check",BL);const UL=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],HL=pr("calendar",UL);const $L=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],WL=pr("circle-question-mark",$L);const VL=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],GL=pr("clipboard-list",VL);const ZL=[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]],qL=pr("construction",ZL);const YL=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],XL=pr("file-text",YL);const KL=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],JL=pr("languages",KL);const QL=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],eM=pr("layout-dashboard",QL);const tM=[["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"}]],aM=pr("log-out",tM);const rM=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],nM=pr("map",rM);const sM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],iM=pr("menu",sM);const oM=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],lM=pr("moon",oM);const cM=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Fv=pr("package",cM);const dM=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],uM=pr("shopping-cart",dM);const fM=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],hM=pr("sun",fM);const mM=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],gM=pr("users",mM);const pM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xM=pr("x",pM),Q0=({title:e="Coming Soon"})=>r.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-900 p-4",children:r.jsxs("div",{className:"text-center max-w-md",children:[r.jsx("div",{className:"mb-6 flex justify-center",children:r.jsx("div",{className:"bg-blue-100 dark:bg-blue-900/30 p-6 rounded-full",children:r.jsx(qL,{size:64,className:"text-blue-600 dark:text-blue-400"})})}),r.jsx("h1",{className:"text-4xl font-bold text-gray-900 dark:text-white mb-4",children:e}),r.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 mb-8",children:"This feature is currently under development and will be available soon."}),r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 shadow-lg",children:r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"We're working hard to bring you the best experience. Stay tuned for updates!"})})]})}),yM=({userEmail:e})=>{const[t,a]=E.useState(!1),s=Is(),{isRTL:o}=Qg(),{t:u}=ln(),c="/assets/asm_ui_app/asm_app/",f="?v=1765196376",p="?v=1765198405",g=c.endsWith("/")?`${c}sidebar-background.jpg${f}`:`${c}/sidebar-background.jpg${f}`,x=e==="financemanager@gmail.com",v=e&&(e.startsWith("enduser1-kash")||e.startsWith("enduser1-dajh")||e.startsWith("enduser1-th")),_=!x&&!v,k=!x&&!v,T=!x&&!v,j=[{id:"dashboard",title:u("common.dashboard"),icon:r.jsx(eM,{size:20}),path:"/dashboard",visible:!0},{id:"assets",title:u("common.assets"),icon:r.jsx(Fv,{size:20}),path:"/assets",visible:_},{id:"inventory",title:"Inventory",icon:r.jsx(Fv,{size:20}),path:"/inventory",visible:!0},{id:"work-orders",title:u("common.workOrders"),icon:r.jsx(GL,{size:20}),path:"/work-orders",visible:T},{id:"ppm-planner",title:"PPM Planner",icon:r.jsx(zL,{size:20}),path:"/ppm-planner",visible:k},{id:"maintenance-calendar",title:"Maintenance Calendar",icon:r.jsx(HL,{size:20}),path:"/maintenance-calendar",visible:k},{id:"active-map",title:"Active Map",icon:r.jsx(nM,{size:20}),path:"/active-map",visible:!0},{id:"maintenance-team",title:"Maintenance Team",icon:r.jsx(gM,{size:20}),path:"/maintenance-team",visible:!0},{id:"procurement",title:"Procurement",icon:r.jsx(uM,{size:20}),path:"/procurement",visible:!0},{id:"sla",title:"Service Level Agreement (SLA)",icon:r.jsx(XL,{size:20}),path:"/sla",visible:!0},{id:"support",title:"Support",icon:r.jsx(WL,{size:20}),path:"/support",visible:!0}].filter(C=>C.visible),P=C=>s.pathname===C;return r.jsxs("div",{className:`
relative
h-screen
transition-all
duration-300
ease-in-out
flex
flex-col
shadow-xl
border-r border-gray-200 dark:border-gray-700
${t?"w-16":"w-64"}
`,style:{backgroundImage:`url(${g})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"},children:[r.jsx("div",{className:"absolute inset-0 bg-black/60 dark:bg-black/70 z-0"}),r.jsxs("div",{className:"relative z-10 flex flex-col h-full bg-white/0 dark:bg-white/0",children:[r.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200/30 dark:border-gray-700/30",children:[!t&&r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs("div",{className:"w-10 h-10 flex items-center justify-center bg-white/20 dark:bg-white/20 rounded-lg p-1 backdrop-blur-sm",children:[r.jsx("img",{src:`${c}${c.endsWith("/")?"":"/"}seera-logo.png${p}`,alt:"Seera-ASM",className:"w-full h-full object-contain",onError:C=>{var O;C.currentTarget.style.display="none",(O=C.currentTarget.nextElementSibling)==null||O.classList.remove("hidden")}}),r.jsxs("svg",{className:"w-6 h-6 hidden",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"#6366F1",fillOpacity:"0.9"}),r.jsx("path",{d:"M2 17L12 22L22 17V12L12 17L2 12V17Z",fill:"#8B5CF6",fillOpacity:"0.7"}),r.jsx("path",{d:"M12 12V17",stroke:"#A855F7",strokeWidth:"2",strokeLinecap:"round"})]})]}),r.jsx("h1",{className:"text-white dark:text-white text-lg font-semibold drop-shadow-lg",children:u("sidebar.title")})]}),t&&r.jsxs("div",{className:"w-8 h-8 flex items-center justify-center bg-white dark:bg-gray-700 rounded-lg p-1",children:[r.jsx("img",{src:`${c}${c.endsWith("/")?"":"/"}seera-logo.png?v=1765198405${p}`,alt:"Seera-ASM",className:"w-full h-full object-contain",onError:C=>{var O;C.currentTarget.style.display="none",(O=C.currentTarget.nextElementSibling)==null||O.classList.remove("hidden")}}),r.jsxs("svg",{className:"w-5 h-5 hidden",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"#6366F1",fillOpacity:"0.9"}),r.jsx("path",{d:"M2 17L12 22L22 17V12L12 17L2 12V17Z",fill:"#8B5CF6",fillOpacity:"0.7"}),r.jsx("path",{d:"M12 12V17",stroke:"#A855F7",strokeWidth:"2",strokeLinecap:"round"})]})]}),r.jsx("button",{onClick:()=>a(!t),className:"text-white dark:text-white hover:bg-white/20 dark:hover:bg-white/20 p-2 rounded-lg transition-colors",children:t?r.jsx(iM,{size:20}):r.jsx(xM,{size:20})})]}),r.jsx("nav",{className:"flex-1 overflow-y-auto py-4",children:j.map(C=>r.jsxs(Jg,{to:C.path,className:`
flex
items-center
px-4
py-3
text-white dark:text-white
hover:bg-white/20 dark:hover:bg-white/20
hover:text-white dark:hover:text-white
transition-all
duration-200
${P(C.path)?"bg-white/30 dark:bg-white/30 text-white dark:text-white border-l-4 border-white":""}
${t?"justify-center":""}
`,title:t?C.title:"",children:[r.jsx("span",{children:C.icon}),!t&&r.jsx("span",{className:`${o?"mr-4":"ml-4"} font-medium`,children:C.title})]},C.id))}),r.jsxs("div",{className:`${t?"p-2":"p-4"} border-t border-white/10 backdrop-blur-sm bg-white/5 space-y-3 relative z-10`,children:[!t&&e&&r.jsxs("div",{children:[r.jsx("div",{className:"text-white/80 dark:text-white/80 text-xs truncate",children:u("sidebar.loggedInAs")}),r.jsx("div",{className:"text-white dark:text-white text-sm font-medium truncate",children:e})]}),!t&&r.jsx("div",{className:"text-xs text-white/70 dark:text-white/70 text-center",children:u("sidebar.version")})]})]})]})},t4=E.createContext(void 0),bM=({children:e})=>{const[t,a]=E.useState(()=>localStorage.getItem("theme")||"light");E.useEffect(()=>{const o=document.documentElement;localStorage.setItem("theme",t),t==="dark"?o.classList.add("dark"):o.classList.remove("dark")},[t]);const s=()=>{a(o=>o==="light"?"dark":"light")};return r.jsx(t4.Provider,{value:{theme:t,toggleTheme:s},children:e})},vM=()=>{const e=E.useContext(t4);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e};class _M{getNotifications(t=50,a=0){return ge(this,null,function*(){var u,c,f,p;const s=localStorage.getItem("user"),o=s?JSON.parse(s).email:"";if(!o)return[];try{const g=JSON.stringify([["for_user","=",o]]),x=JSON.stringify(["name","subject","email_content","document_type","document_name","read","creation","from_user","type"]),v=yield Ke.apiCall(`/api/resource/Notification Log?filters=${encodeURIComponent(g)}&fields=${encodeURIComponent(x)}&order_by=creation desc&limit=${t}&offset=${a}`);return console.log("[NotificationService] Fetched notifications:",v==null?void 0:v.data),((u=v==null?void 0:v.data)==null?void 0:u.length)>0&&console.log("[NotificationService] First notification sample:",v.data[0]),(v==null?void 0:v.data)||[]}catch(g){return(c=g==null?void 0:g.message)!=null&&c.includes("417")||(f=g==null?void 0:g.message)!=null&&f.includes("EXPECTATION FAILED")?[]:((p=g==null?void 0:g.message)!=null&&p.includes("417")||console.warn("Notifications API not available:",(g==null?void 0:g.message)||"Unknown error"),[])}})}markAsRead(t){return ge(this,null,function*(){var a,s,o,u;try{return yield Ke.apiCall(`/api/resource/Notification Log/${t}`,{method:"PUT",body:JSON.stringify({read:1})})}catch(c){if((a=c==null?void 0:c.message)!=null&&a.includes("417")||(s=c==null?void 0:c.message)!=null&&s.includes("EXPECTATION FAILED")||(o=c==null?void 0:c.message)!=null&&o.includes("PermissionError")||(u=c==null?void 0:c.message)!=null&&u.includes("Insufficient Permission"))return console.warn("[NotificationService] Cannot mark as read (permissions)"),{success:!1,reason:"permission_denied"};throw console.warn("Error marking notification as read:",(c==null?void 0:c.message)||"Unknown error"),c}})}markAllAsRead(){return ge(this,null,function*(){try{const a=(yield this.getNotifications(1e3)).filter(o=>!o.read);let s=0;for(const o of a)try{const u=yield this.markAsRead(o.name);(u==null?void 0:u.success)!==!1&&s++}catch(u){console.error(`Error marking notification ${o.name} as read:`,u)}return{success:!0,marked:s,total:a.length}}catch(t){return console.error("Error marking all notifications as read:",t),{success:!1,marked:0,total:0}}})}getUnreadCount(){return ge(this,null,function*(){try{return(yield this.getNotifications(1e3)).filter(a=>!a.read).length}catch(t){return console.error("Error getting unread count:",t),0}})}}const kg=new _M;function wM(){const[e,t]=E.useState([]),[a,s]=E.useState(0),[o,u]=E.useState(!0),[c,f]=E.useState(null),p=E.useCallback(()=>ge(null,null,function*(){var v,_;try{u(!0),f(null);const k=yield kg.getNotifications();t(k),s(k.filter(T=>!T.read).length)}catch(k){if((v=k==null?void 0:k.message)!=null&&v.includes("417")||(_=k==null?void 0:k.message)!=null&&_.includes("EXPECTATION FAILED"))t([]),s(0),f(null);else{const T=k instanceof Error?k.message:"Failed to fetch notifications";f(T),console.warn("Error fetching notifications:",k)}}finally{u(!1)}}),[]);E.useEffect(()=>{p();const v=setInterval(p,3e4);return()=>clearInterval(v)},[p]);const g=E.useCallback(v=>ge(null,null,function*(){try{yield kg.markAsRead(v),t(_=>_.map(k=>k.name===v?Le(ie({},k),{read:1}):k)),s(_=>Math.max(0,_-1))}catch(_){throw console.error("Error marking notification as read:",_),_}}),[]),x=E.useCallback(()=>ge(null,null,function*(){try{yield kg.markAllAsRead(),t(v=>v.map(_=>Le(ie({},_),{read:1}))),s(0)}catch(v){throw console.error("Error marking all notifications as read:",v),v}}),[]);return{notifications:e,unreadCount:a,loading:o,error:c,markAsRead:g,markAllAsRead:x,refetch:p}}const kM=()=>{const{notifications:e,unreadCount:t,markAsRead:a,markAllAsRead:s}=wM(),[o,u]=E.useState(!1),c=E.useRef(null),f=Da();E.useEffect(()=>{const _=k=>{c.current&&!c.current.contains(k.target)&&u(!1)};return o&&document.addEventListener("mousedown",_),()=>{document.removeEventListener("mousedown",_)}},[o]);const p=_=>ge(null,null,function*(){if(console.log("[NotificationBell] Clicked notification:",_),console.log("[NotificationBell] document_type:",_.document_type),console.log("[NotificationBell] document_name:",_.document_name),!_.read)try{yield a(_.name)}catch(k){console.warn("[NotificationBell] Could not mark as read (permission issue):",k)}if(_.document_type&&_.document_name){const k=_.document_type,T=_.document_name,N=k.replace(/_/g," ").trim();if(console.log("[NotificationBell] Normalized type:",N),console.log("[NotificationBell] Document name:",T),N==="Asset Maintenance Log"||N==="Asset Maintenance")console.log("[NotificationBell] Navigating to maintenance:",`/maintenance/${T}`),f(`/maintenance/${T}`);else if(N==="Work Order"||N==="Asset Repair")console.log("[NotificationBell] Navigating to work order:",`/work-orders/${T}`),f(`/work-orders/${T}`);else if(N==="Asset")console.log("[NotificationBell] Navigating to asset:",`/assets/${T}`),f(`/assets/${T}`);else if(N==="PM Schedule Generator"||N==="PM Schedule")console.log("[NotificationBell] Navigating to PPM planner:",`/ppm-planner/${T}`),f(`/ppm-planner/${T}`);else if(N==="PPM")console.log("[NotificationBell] Navigating to PPM:",`/ppm/${T}`),f(`/ppm/${T}`);else if(N==="Item")console.log("[NotificationBell] Navigating to inventory:",`/inventory/${T}`),f(`/inventory/${T}`);else{console.warn(`[NotificationBell] Unknown document type: ${k}, opening in Frappe`);const j=k.toLowerCase().replace(/\s+/g,"-").replace(/_/g,"-");window.open(`/app/${j}/${T}`,"_blank")}}else console.warn("[NotificationBell] No document_type or document_name found:",{document_type:_.document_type,document_name:_.document_name,notification:_});u(!1)}),g=_=>{const k=new Date(_),N=new Date().getTime()-k.getTime(),j=Math.floor(N/6e4),P=Math.floor(N/36e5),C=Math.floor(N/864e5);return j<1?"Just now":j<60?`${j}m ago`:P<24?`${P}h ago`:C<7?`${C}d ago`:k.toLocaleDateString()},x=e.filter(_=>!_.read),v=e.filter(_=>_.read).slice(0,10);return r.jsxs("div",{className:"relative",ref:c,children:[r.jsxs("button",{onClick:()=>u(!o),className:"relative p-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Notifications",children:[r.jsx(IL,{size:20}),t>0&&r.jsx("span",{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 rounded-full",children:t>9?"9+":t})]}),o&&r.jsxs("div",{className:"absolute right-0 mt-2 w-80 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 z-[9999] max-h-96 overflow-hidden flex flex-col",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[r.jsxs("h3",{className:"font-semibold text-gray-800 dark:text-white flex items-center gap-2",children:[r.jsx(Sb,{}),"Notifications",t>0&&r.jsxs("span",{className:"text-xs bg-red-500 text-white px-2 py-0.5 rounded-full",children:[t," new"]})]}),t>0&&r.jsx("button",{onClick:s,className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300",children:"Mark all read"})]}),r.jsx("div",{className:"overflow-y-auto flex-1",children:e.length===0?r.jsxs("div",{className:"p-8 text-center text-gray-500 dark:text-gray-400",children:[r.jsx(Sb,{className:"mx-auto text-3xl mb-2 opacity-50"}),r.jsx("p",{children:"No notifications"})]}):r.jsxs(r.Fragment,{children:[x.length>0&&r.jsxs("div",{className:"p-2",children:[r.jsx("div",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 px-2 mb-1",children:"NEW"}),x.map(_=>r.jsx("div",{onClick:()=>p(_),className:"p-3 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-900/20",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:_.subject||_.document_type||"Notification"}),_.email_content&&r.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1 line-clamp-2",children:_.email_content}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500 mt-1",children:g(_.creation)})]}),r.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full flex-shrink-0 mt-1"})]})},_.name))]}),v.length>0&&r.jsxs("div",{className:"p-2 border-t border-gray-200 dark:border-gray-700",children:[x.length>0&&r.jsx("div",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 px-2 mb-1",children:"EARLIER"}),v.map(_=>r.jsx("div",{onClick:()=>p(_),className:"p-3 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer",children:r.jsx("div",{className:"flex items-start justify-between gap-2",children:r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 truncate",children:_.subject||_.document_type||"Notification"}),_.email_content&&r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 line-clamp-2",children:_.email_content}),r.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:g(_.creation)})]})})},_.name))]})]})})]})]})},NM=({userEmail:e})=>{const t=Da(),{theme:a,toggleTheme:s}=vM(),{language:o,changeLanguage:u}=Qg(),{t:c}=ln(),f=()=>{localStorage.removeItem("user"),localStorage.removeItem("sid"),t("/login")};return r.jsxs("header",{className:"h-14 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 flex items-center justify-end gap-2 flex-shrink-0",children:[e&&r.jsx("div",{className:"hidden md:block text-sm text-gray-600 dark:text-gray-400 mr-2",children:e}),r.jsx("div",{className:"relative",children:r.jsx(kM,{})}),r.jsx("button",{onClick:()=>u(o==="en"?"ar":"en"),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-gray-700 dark:text-gray-300",title:c("common.language"),children:r.jsx(JL,{size:20})}),r.jsx("button",{onClick:s,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-gray-700 dark:text-gray-300",title:c(a==="light"?"common.darkMode":"common.lightMode"),children:a==="light"?r.jsx(lM,{size:20}):r.jsx(hM,{size:20})}),r.jsx("button",{onClick:f,className:"p-2 rounded-lg hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors text-red-600 dark:text-red-400",title:c("common.logout"),children:r.jsx(aM,{size:20})})]})},Oa=({children:e})=>{const t=localStorage.getItem("user"),a=t?JSON.parse(t).email:"";return r.jsxs("div",{className:"flex h-screen overflow-hidden bg-gray-50 dark:bg-gray-900",children:[r.jsx(yM,{userEmail:a}),r.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r.jsx(NM,{userEmail:a}),r.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 dark:bg-gray-900",children:e})]})]})},La=({children:e})=>localStorage.getItem("user")?r.jsx(r.Fragment,{children:e}):r.jsx(Cg,{to:"/login",replace:!0}),SM=()=>r.jsx(_S,{basename:"/asm_app",children:r.jsxs(KN,{children:[r.jsx(ha,{path:"/login",element:r.jsx(DS,{})}),r.jsx(ha,{path:"/dashboard",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(g6,{})})})}),r.jsx(ha,{path:"/assets",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx($O,{})})})}),r.jsx(ha,{path:"/assets/:assetName",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(GO,{})})})}),r.jsx(ha,{path:"/work-orders",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(qO,{})})})}),r.jsx(ha,{path:"/work-orders/:workOrderName",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(I9,{})})})}),r.jsx(ha,{path:"/maintenance",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(B9,{})})})}),r.jsx(ha,{path:"/maintenance/:logName",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(H9,{})})})}),r.jsx(ha,{path:"/ppm",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(G9,{})})})}),r.jsx(ha,{path:"/ppm/:ppmName",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(Z9,{})})})}),r.jsx(ha,{path:"/ppm-planner",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(K9,{})})})}),r.jsx(ha,{path:"/ppm-planner/new",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(Y9,{})})})}),r.jsx(ha,{path:"/ppm-planner/:scheduleName",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(J9,{})})})}),r.jsx(ha,{path:"/maintenance-calendar",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(Dv,{})})})}),r.jsx(ha,{path:"/maintenance-calendar/month-view",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(eL,{})})})}),r.jsx(ha,{path:"/yearly-ppm-planner",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(Dv,{})})})}),r.jsx(ha,{path:"/active-map",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(SL,{})})})}),r.jsx(ha,{path:"/inventory",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(AL,{})})})}),r.jsx(ha,{path:"/inventory/:itemName",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(OL,{})})})}),r.jsx(ha,{path:"/users",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(Kj,{})})})}),r.jsx(ha,{path:"/events",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(Jj,{})})})}),r.jsx(ha,{path:"/old-dashboard",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(zS,{})})})}),r.jsx(ha,{path:"/maintenance-team",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(Q0,{title:"Maintenance Team"})})})}),r.jsx(ha,{path:"/procurement",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(Q0,{title:"Procurement"})})})}),r.jsx(ha,{path:"/sla",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(Q0,{title:"Service Level Agreement (SLA)"})})})}),r.jsx(ha,{path:"/support",element:r.jsx(La,{children:r.jsx(Oa,{children:r.jsx(Q0,{title:"Support"})})})}),r.jsx(ha,{path:"/",element:r.jsx(Cg,{to:"/login",replace:!0})}),r.jsx(ha,{path:"*",element:r.jsx(Cg,{to:"/login",replace:!0})})]})});Ok.createRoot(document.getElementById("root")).render(r.jsx(E.StrictMode,{children:r.jsx(MS,{children:r.jsx(bM,{children:r.jsx(SM,{})})})}))});export default jM();