var mX=Object.defineProperty;var pX=(e,t,r)=>t in e?mX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var En=(e,t,r)=>pX(e,typeof t!="symbol"?t+"":t,r);function xX(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in e)){const s=Object.getOwnPropertyDescriptor(n,a);s&&Object.defineProperty(e,a,s.get?s:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(a){if(a.ep)return;a.ep=!0;const s=r(a);fetch(a.href,s)}})();var FMe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function af(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mN={exports:{}},Sg={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var fP;function gX(){if(fP)return Sg;fP=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,a,s){var o=null;if(s!==void 0&&(o=""+s),a.key!==void 0&&(o=""+a.key),"key"in a){s={};for(var l in a)l!=="key"&&(s[l]=a[l])}else s=a;return a=s.ref,{$$typeof:e,type:n,key:o,ref:a!==void 0?a:null,props:s}}return Sg.Fragment=t,Sg.jsx=r,Sg.jsxs=r,Sg}var hP;function vX(){return hP||(hP=1,mN.exports=gX()),mN.exports}var i=vX(),pN={exports:{}},Ir={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var mP;function yX(){if(mP)return Ir;mP=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),g=Symbol.iterator;function x(ce){return ce===null||typeof ce!="object"?null:(ce=g&&ce[g]||ce["@@iterator"],typeof ce=="function"?ce:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,w={};function j(ce,D,H){this.props=ce,this.context=D,this.refs=w,this.updater=H||y}j.prototype.isReactComponent={},j.prototype.setState=function(ce,D){if(typeof ce!="object"&&typeof ce!="function"&&ce!=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,ce,D,"setState")},j.prototype.forceUpdate=function(ce){this.updater.enqueueForceUpdate(this,ce,"forceUpdate")};function k(){}k.prototype=j.prototype;function A(ce,D,H){this.props=ce,this.context=D,this.refs=w,this.updater=H||y}var T=A.prototype=new k;T.constructor=A,v(T,j.prototype),T.isPureReactComponent=!0;var M=Array.isArray;function B(){}var L={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function I(ce,D,H){var G=H.ref;return{$$typeof:e,type:ce,key:D,ref:G!==void 0?G:null,props:H}}function q(ce,D){return I(ce.type,D,ce.props)}function P(ce){return typeof ce=="object"&&ce!==null&&ce.$$typeof===e}function R(ce){var D={"=":"=0",":":"=2"};return"$"+ce.replace(/[=:]/g,function(H){return D[H]})}var K=/\/+/g;function ee(ce,D){return typeof ce=="object"&&ce!==null&&ce.key!=null?R(""+ce.key):D.toString(36)}function se(ce){switch(ce.status){case"fulfilled":return ce.value;case"rejected":throw ce.reason;default:switch(typeof ce.status=="string"?ce.then(B,B):(ce.status="pending",ce.then(function(D){ce.status==="pending"&&(ce.status="fulfilled",ce.value=D)},function(D){ce.status==="pending"&&(ce.status="rejected",ce.reason=D)})),ce.status){case"fulfilled":return ce.value;case"rejected":throw ce.reason}}throw ce}function Z(ce,D,H,G,E){var re=typeof ce;(re==="undefined"||re==="boolean")&&(ce=null);var he=!1;if(ce===null)he=!0;else switch(re){case"bigint":case"string":case"number":he=!0;break;case"object":switch(ce.$$typeof){case e:case t:he=!0;break;case f:return he=ce._init,Z(he(ce._payload),D,H,G,E)}}if(he)return E=E(ce),he=G===""?"."+ee(ce,0):G,M(E)?(H="",he!=null&&(H=he.replace(K,"$&/")+"/"),Z(E,D,H,"",function(fe){return fe})):E!=null&&(P(E)&&(E=q(E,H+(E.key==null||ce&&ce.key===E.key?"":(""+E.key).replace(K,"$&/")+"/")+he)),D.push(E)),1;he=0;var oe=G===""?".":G+":";if(M(ce))for(var z=0;z<ce.length;z++)G=ce[z],re=oe+ee(G,z),he+=Z(G,D,H,re,E);else if(z=x(ce),typeof z=="function")for(ce=z.call(ce),z=0;!(G=ce.next()).done;)G=G.value,re=oe+ee(G,z++),he+=Z(G,D,H,re,E);else if(re==="object"){if(typeof ce.then=="function")return Z(se(ce),D,H,G,E);throw D=String(ce),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(ce).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.")}return he}function ne(ce,D,H){if(ce==null)return ce;var G=[],E=0;return Z(ce,G,"","",function(re){return D.call(H,re,E++)}),G}function X(ce){if(ce._status===-1){var D=ce._result;D=D(),D.then(function(H){(ce._status===0||ce._status===-1)&&(ce._status=1,ce._result=H)},function(H){(ce._status===0||ce._status===-1)&&(ce._status=2,ce._result=H)}),ce._status===-1&&(ce._status=0,ce._result=D)}if(ce._status===1)return ce._result.default;throw ce._result}var le=typeof reportError=="function"?reportError:function(ce){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var D=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof ce=="object"&&ce!==null&&typeof ce.message=="string"?String(ce.message):String(ce),error:ce});if(!window.dispatchEvent(D))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",ce);return}console.error(ce)},Ae={map:ne,forEach:function(ce,D,H){ne(ce,function(){D.apply(this,arguments)},H)},count:function(ce){var D=0;return ne(ce,function(){D++}),D},toArray:function(ce){return ne(ce,function(D){return D})||[]},only:function(ce){if(!P(ce))throw Error("React.Children.only expected to receive a single React element child.");return ce}};return Ir.Activity=m,Ir.Children=Ae,Ir.Component=j,Ir.Fragment=r,Ir.Profiler=a,Ir.PureComponent=A,Ir.StrictMode=n,Ir.Suspense=u,Ir.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Ir.__COMPILER_RUNTIME={__proto__:null,c:function(ce){return L.H.useMemoCache(ce)}},Ir.cache=function(ce){return function(){return ce.apply(null,arguments)}},Ir.cacheSignal=function(){return null},Ir.cloneElement=function(ce,D,H){if(ce==null)throw Error("The argument must be a React element, but you passed "+ce+".");var G=v({},ce.props),E=ce.key;if(D!=null)for(re in D.key!==void 0&&(E=""+D.key),D)!F.call(D,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&D.ref===void 0||(G[re]=D[re]);var re=arguments.length-2;if(re===1)G.children=H;else if(1<re){for(var he=Array(re),oe=0;oe<re;oe++)he[oe]=arguments[oe+2];G.children=he}return I(ce.type,E,G)},Ir.createContext=function(ce){return ce={$$typeof:o,_currentValue:ce,_currentValue2:ce,_threadCount:0,Provider:null,Consumer:null},ce.Provider=ce,ce.Consumer={$$typeof:s,_context:ce},ce},Ir.createElement=function(ce,D,H){var G,E={},re=null;if(D!=null)for(G in D.key!==void 0&&(re=""+D.key),D)F.call(D,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(E[G]=D[G]);var he=arguments.length-2;if(he===1)E.children=H;else if(1<he){for(var oe=Array(he),z=0;z<he;z++)oe[z]=arguments[z+2];E.children=oe}if(ce&&ce.defaultProps)for(G in he=ce.defaultProps,he)E[G]===void 0&&(E[G]=he[G]);return I(ce,re,E)},Ir.createRef=function(){return{current:null}},Ir.forwardRef=function(ce){return{$$typeof:l,render:ce}},Ir.isValidElement=P,Ir.lazy=function(ce){return{$$typeof:f,_payload:{_status:-1,_result:ce},_init:X}},Ir.memo=function(ce,D){return{$$typeof:d,type:ce,compare:D===void 0?null:D}},Ir.startTransition=function(ce){var D=L.T,H={};L.T=H;try{var G=ce(),E=L.S;E!==null&&E(H,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(B,le)}catch(re){le(re)}finally{D!==null&&H.types!==null&&(D.types=H.types),L.T=D}},Ir.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Ir.use=function(ce){return L.H.use(ce)},Ir.useActionState=function(ce,D,H){return L.H.useActionState(ce,D,H)},Ir.useCallback=function(ce,D){return L.H.useCallback(ce,D)},Ir.useContext=function(ce){return L.H.useContext(ce)},Ir.useDebugValue=function(){},Ir.useDeferredValue=function(ce,D){return L.H.useDeferredValue(ce,D)},Ir.useEffect=function(ce,D){return L.H.useEffect(ce,D)},Ir.useEffectEvent=function(ce){return L.H.useEffectEvent(ce)},Ir.useId=function(){return L.H.useId()},Ir.useImperativeHandle=function(ce,D,H){return L.H.useImperativeHandle(ce,D,H)},Ir.useInsertionEffect=function(ce,D){return L.H.useInsertionEffect(ce,D)},Ir.useLayoutEffect=function(ce,D){return L.H.useLayoutEffect(ce,D)},Ir.useMemo=function(ce,D){return L.H.useMemo(ce,D)},Ir.useOptimistic=function(ce,D){return L.H.useOptimistic(ce,D)},Ir.useReducer=function(ce,D,H){return L.H.useReducer(ce,D,H)},Ir.useRef=function(ce){return L.H.useRef(ce)},Ir.useState=function(ce){return L.H.useState(ce)},Ir.useSyncExternalStore=function(ce,D,H){return L.H.useSyncExternalStore(ce,D,H)},Ir.useTransition=function(){return L.H.useTransition()},Ir.version="19.2.4",Ir}var pP;function vx(){return pP||(pP=1,pN.exports=yX()),pN.exports}var N=vx();const Mt=af(N),bX=xX({__proto__:null,default:Mt},[N]);var xN={exports:{}},Ag={},gN={exports:{}},vN={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var xP;function wX(){return xP||(xP=1,(function(e){function t(Z,ne){var X=Z.length;Z.push(ne);e:for(;0<X;){var le=X-1>>>1,Ae=Z[le];if(0<a(Ae,ne))Z[le]=ne,Z[X]=Ae,X=le;else break e}}function r(Z){return Z.length===0?null:Z[0]}function n(Z){if(Z.length===0)return null;var ne=Z[0],X=Z.pop();if(X!==ne){Z[0]=X;e:for(var le=0,Ae=Z.length,ce=Ae>>>1;le<ce;){var D=2*(le+1)-1,H=Z[D],G=D+1,E=Z[G];if(0>a(H,X))G<Ae&&0>a(E,H)?(Z[le]=E,Z[G]=X,le=G):(Z[le]=H,Z[D]=X,le=D);else if(G<Ae&&0>a(E,X))Z[le]=E,Z[G]=X,le=G;else break e}}return ne}function a(Z,ne){var X=Z.sortIndex-ne.sortIndex;return X!==0?X:Z.id-ne.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var u=[],d=[],f=1,m=null,g=3,x=!1,y=!1,v=!1,w=!1,j=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function T(Z){for(var ne=r(d);ne!==null;){if(ne.callback===null)n(d);else if(ne.startTime<=Z)n(d),ne.sortIndex=ne.expirationTime,t(u,ne);else break;ne=r(d)}}function M(Z){if(v=!1,T(Z),!y)if(r(u)!==null)y=!0,B||(B=!0,R());else{var ne=r(d);ne!==null&&se(M,ne.startTime-Z)}}var B=!1,L=-1,F=5,I=-1;function q(){return w?!0:!(e.unstable_now()-I<F)}function P(){if(w=!1,B){var Z=e.unstable_now();I=Z;var ne=!0;try{e:{y=!1,v&&(v=!1,k(L),L=-1),x=!0;var X=g;try{t:{for(T(Z),m=r(u);m!==null&&!(m.expirationTime>Z&&q());){var le=m.callback;if(typeof le=="function"){m.callback=null,g=m.priorityLevel;var Ae=le(m.expirationTime<=Z);if(Z=e.unstable_now(),typeof Ae=="function"){m.callback=Ae,T(Z),ne=!0;break t}m===r(u)&&n(u),T(Z)}else n(u);m=r(u)}if(m!==null)ne=!0;else{var ce=r(d);ce!==null&&se(M,ce.startTime-Z),ne=!1}}break e}finally{m=null,g=X,x=!1}ne=void 0}}finally{ne?R():B=!1}}}var R;if(typeof A=="function")R=function(){A(P)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,ee=K.port2;K.port1.onmessage=P,R=function(){ee.postMessage(null)}}else R=function(){j(P,0)};function se(Z,ne){L=j(function(){Z(e.unstable_now())},ne)}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(Z){Z.callback=null},e.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_next=function(Z){switch(g){case 1:case 2:case 3:var ne=3;break;default:ne=g}var X=g;g=ne;try{return Z()}finally{g=X}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(Z,ne){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var X=g;g=Z;try{return ne()}finally{g=X}},e.unstable_scheduleCallback=function(Z,ne,X){var le=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?le+X:le):X=le,Z){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=X+Ae,Z={id:f++,callback:ne,priorityLevel:Z,startTime:X,expirationTime:Ae,sortIndex:-1},X>le?(Z.sortIndex=X,t(d,Z),r(u)===null&&Z===r(d)&&(v?(k(L),L=-1):v=!0,se(M,X-le))):(Z.sortIndex=Ae,t(u,Z),y||x||(y=!0,B||(B=!0,R()))),Z},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(Z){var ne=g;return function(){var X=g;g=ne;try{return Z.apply(this,arguments)}finally{g=X}}}})(vN)),vN}var gP;function jX(){return gP||(gP=1,gN.exports=wX()),gN.exports}var yN={exports:{}},Os={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var vP;function NX(){if(vP)return Os;vP=1;var e=vx();function t(u){var d="https://react.dev/errors/"+u;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)d+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+u+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for("react.portal");function s(u,d,f){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:m==null?null:""+m,children:u,containerInfo:d,implementation:f}}var o=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(u,d){if(u==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Os.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Os.createPortal=function(u,d){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return s(u,d,null,f)},Os.flushSync=function(u){var d=o.T,f=n.p;try{if(o.T=null,n.p=2,u)return u()}finally{o.T=d,n.p=f,n.d.f()}},Os.preconnect=function(u,d){typeof u=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(u,d))},Os.prefetchDNS=function(u){typeof u=="string"&&n.d.D(u)},Os.preinit=function(u,d){if(typeof u=="string"&&d&&typeof d.as=="string"){var f=d.as,m=l(f,d.crossOrigin),g=typeof d.integrity=="string"?d.integrity:void 0,x=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;f==="style"?n.d.S(u,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:m,integrity:g,fetchPriority:x}):f==="script"&&n.d.X(u,{crossOrigin:m,integrity:g,fetchPriority:x,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Os.preinitModule=function(u,d){if(typeof u=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var f=l(d.as,d.crossOrigin);n.d.M(u,{crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&n.d.M(u)},Os.preload=function(u,d){if(typeof u=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var f=d.as,m=l(f,d.crossOrigin);n.d.L(u,f,{crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Os.preloadModule=function(u,d){if(typeof u=="string")if(d){var f=l(d.as,d.crossOrigin);n.d.m(u,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else n.d.m(u)},Os.requestFormReset=function(u){n.d.r(u)},Os.unstable_batchedUpdates=function(u,d){return u(d)},Os.useFormState=function(u,d,f){return o.H.useFormState(u,d,f)},Os.useFormStatus=function(){return o.H.useHostTransitionStatus()},Os.version="19.2.4",Os}var yP;function q7(){if(yP)return yN.exports;yP=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),yN.exports=NX(),yN.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var bP;function SX(){if(bP)return Ag;bP=1;var e=jX(),t=vx(),r=q7();function n(c){var h="https://react.dev/errors/"+c;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+c+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)}function s(c){var h=c,p=c;if(c.alternate)for(;h.return;)h=h.return;else{c=h;do h=c,(h.flags&4098)!==0&&(p=h.return),c=h.return;while(c)}return h.tag===3?p:null}function o(c){if(c.tag===13){var h=c.memoizedState;if(h===null&&(c=c.alternate,c!==null&&(h=c.memoizedState)),h!==null)return h.dehydrated}return null}function l(c){if(c.tag===31){var h=c.memoizedState;if(h===null&&(c=c.alternate,c!==null&&(h=c.memoizedState)),h!==null)return h.dehydrated}return null}function u(c){if(s(c)!==c)throw Error(n(188))}function d(c){var h=c.alternate;if(!h){if(h=s(c),h===null)throw Error(n(188));return h!==c?null:c}for(var p=c,b=h;;){var C=p.return;if(C===null)break;var O=C.alternate;if(O===null){if(b=C.return,b!==null){p=b;continue}break}if(C.child===O.child){for(O=C.child;O;){if(O===p)return u(C),c;if(O===b)return u(C),h;O=O.sibling}throw Error(n(188))}if(p.return!==b.return)p=C,b=O;else{for(var ie=!1,Se=C.child;Se;){if(Se===p){ie=!0,p=C,b=O;break}if(Se===b){ie=!0,b=C,p=O;break}Se=Se.sibling}if(!ie){for(Se=O.child;Se;){if(Se===p){ie=!0,p=O,b=C;break}if(Se===b){ie=!0,b=O,p=C;break}Se=Se.sibling}if(!ie)throw Error(n(189))}}if(p.alternate!==b)throw Error(n(190))}if(p.tag!==3)throw Error(n(188));return p.stateNode.current===p?c:h}function f(c){var h=c.tag;if(h===5||h===26||h===27||h===6)return c;for(c=c.child;c!==null;){if(h=f(c),h!==null)return h;c=c.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),A=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function R(c){return c===null||typeof c!="object"?null:(c=P&&c[P]||c["@@iterator"],typeof c=="function"?c:null)}var K=Symbol.for("react.client.reference");function ee(c){if(c==null)return null;if(typeof c=="function")return c.$$typeof===K?null:c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case v:return"Fragment";case j:return"Profiler";case w:return"StrictMode";case M:return"Suspense";case B:return"SuspenseList";case I:return"Activity"}if(typeof c=="object")switch(c.$$typeof){case y:return"Portal";case A:return c.displayName||"Context";case k:return(c._context.displayName||"Context")+".Consumer";case T:var h=c.render;return c=c.displayName,c||(c=h.displayName||h.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case L:return h=c.displayName||null,h!==null?h:ee(c.type)||"Memo";case F:h=c._payload,c=c._init;try{return ee(c(h))}catch{}}return null}var se=Array.isArray,Z=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},le=[],Ae=-1;function ce(c){return{current:c}}function D(c){0>Ae||(c.current=le[Ae],le[Ae]=null,Ae--)}function H(c,h){Ae++,le[Ae]=c.current,c.current=h}var G=ce(null),E=ce(null),re=ce(null),he=ce(null);function oe(c,h){switch(H(re,h),H(E,c),H(G,null),h.nodeType){case 9:case 11:c=(c=h.documentElement)&&(c=c.namespaceURI)?M6(c):0;break;default:if(c=h.tagName,h=h.namespaceURI)h=M6(h),c=L6(h,c);else switch(c){case"svg":c=1;break;case"math":c=2;break;default:c=0}}D(G),H(G,c)}function z(){D(G),D(E),D(re)}function fe(c){c.memoizedState!==null&&H(he,c);var h=G.current,p=L6(h,c.type);h!==p&&(H(E,c),H(G,p))}function de(c){E.current===c&&(D(G),D(E)),he.current===c&&(D(he),bg._currentValue=X)}var W,ae;function _e(c){if(W===void 0)try{throw Error()}catch(p){var h=p.stack.trim().match(/\n( *(at )?)/);W=h&&h[1]||"",ae=-1<p.stack.indexOf(`
    at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
`+W+c+ae}var ue=!1;function ke(c,h){if(!c||ue)return"";ue=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var b={DetermineComponentFrameRoot:function(){try{if(h){var Et=function(){throw Error()};if(Object.defineProperty(Et.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Et,[])}catch(yt){var gt=yt}Reflect.construct(c,[],Et)}else{try{Et.call()}catch(yt){gt=yt}c.call(Et.prototype)}}else{try{throw Error()}catch(yt){gt=yt}(Et=c())&&typeof Et.catch=="function"&&Et.catch(function(){})}}catch(yt){if(yt&&gt&&typeof yt.stack=="string")return[yt.stack,gt.stack]}return[null,null]}};b.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var C=Object.getOwnPropertyDescriptor(b.DetermineComponentFrameRoot,"name");C&&C.configurable&&Object.defineProperty(b.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var O=b.DetermineComponentFrameRoot(),ie=O[0],Se=O[1];if(ie&&Se){var He=ie.split(`
`),xt=Se.split(`
`);for(C=b=0;b<He.length&&!He[b].includes("DetermineComponentFrameRoot");)b++;for(;C<xt.length&&!xt[C].includes("DetermineComponentFrameRoot");)C++;if(b===He.length||C===xt.length)for(b=He.length-1,C=xt.length-1;1<=b&&0<=C&&He[b]!==xt[C];)C--;for(;1<=b&&0<=C;b--,C--)if(He[b]!==xt[C]){if(b!==1||C!==1)do if(b--,C--,0>C||He[b]!==xt[C]){var At=`
`+He[b].replace(" at new "," at ");return c.displayName&&At.includes("<anonymous>")&&(At=At.replace("<anonymous>",c.displayName)),At}while(1<=b&&0<=C);break}}}finally{ue=!1,Error.prepareStackTrace=p}return(p=c?c.displayName||c.name:"")?_e(p):""}function $e(c,h){switch(c.tag){case 26:case 27:case 5:return _e(c.type);case 16:return _e("Lazy");case 13:return c.child!==h&&h!==null?_e("Suspense Fallback"):_e("Suspense");case 19:return _e("SuspenseList");case 0:case 15:return ke(c.type,!1);case 11:return ke(c.type.render,!1);case 1:return ke(c.type,!0);case 31:return _e("Activity");default:return""}}function Je(c){try{var h="",p=null;do h+=$e(c,p),p=c,c=c.return;while(c);return h}catch(b){return`
Error generating stack: `+b.message+`
`+b.stack}}var Xe=Object.prototype.hasOwnProperty,Ne=e.unstable_scheduleCallback,Ye=e.unstable_cancelCallback,at=e.unstable_shouldYield,Y=e.unstable_requestPaint,we=e.unstable_now,J=e.unstable_getCurrentPriorityLevel,ve=e.unstable_ImmediatePriority,Oe=e.unstable_UserBlockingPriority,xe=e.unstable_NormalPriority,qe=e.unstable_LowPriority,me=e.unstable_IdlePriority,Ge=e.log,Be=e.unstable_setDisableYieldValue,it=null,st=null;function Ve(c){if(typeof Ge=="function"&&Be(c),st&&typeof st.setStrictMode=="function")try{st.setStrictMode(it,c)}catch{}}var te=Math.clz32?Math.clz32:vt,Ue=Math.log,ot=Math.LN2;function vt(c){return c>>>=0,c===0?32:31-(Ue(c)/ot|0)|0}var _t=256,qt=262144,Ft=4194304;function Dt(c){var h=c&42;if(h!==0)return h;switch(c&-c){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 c&261888;case 262144:case 524288:case 1048576:case 2097152:return c&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return c&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return c}}function Rt(c,h,p){var b=c.pendingLanes;if(b===0)return 0;var C=0,O=c.suspendedLanes,ie=c.pingedLanes;c=c.warmLanes;var Se=b&134217727;return Se!==0?(b=Se&~O,b!==0?C=Dt(b):(ie&=Se,ie!==0?C=Dt(ie):p||(p=Se&~c,p!==0&&(C=Dt(p))))):(Se=b&~O,Se!==0?C=Dt(Se):ie!==0?C=Dt(ie):p||(p=b&~c,p!==0&&(C=Dt(p)))),C===0?0:h!==0&&h!==C&&(h&O)===0&&(O=C&-C,p=h&-h,O>=p||O===32&&(p&4194048)!==0)?h:C}function wr(c,h){return(c.pendingLanes&~(c.suspendedLanes&~c.pingedLanes)&h)===0}function gr(c,h){switch(c){case 1:case 2:case 4:case 8:case 64:return h+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 h+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 Er(){var c=Ft;return Ft<<=1,(Ft&62914560)===0&&(Ft=4194304),c}function Ur(c){for(var h=[],p=0;31>p;p++)h.push(c);return h}function Ht(c,h){c.pendingLanes|=h,h!==268435456&&(c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0)}function It(c,h,p,b,C,O){var ie=c.pendingLanes;c.pendingLanes=p,c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0,c.expiredLanes&=p,c.entangledLanes&=p,c.errorRecoveryDisabledLanes&=p,c.shellSuspendCounter=0;var Se=c.entanglements,He=c.expirationTimes,xt=c.hiddenUpdates;for(p=ie&~p;0<p;){var At=31-te(p),Et=1<<At;Se[At]=0,He[At]=-1;var gt=xt[At];if(gt!==null)for(xt[At]=null,At=0;At<gt.length;At++){var yt=gt[At];yt!==null&&(yt.lane&=-536870913)}p&=~Et}b!==0&&Rr(c,b,0),O!==0&&C===0&&c.tag!==0&&(c.suspendedLanes|=O&~(ie&~h))}function Rr(c,h,p){c.pendingLanes|=h,c.suspendedLanes&=~h;var b=31-te(h);c.entangledLanes|=h,c.entanglements[b]=c.entanglements[b]|1073741824|p&261930}function kr(c,h){var p=c.entangledLanes|=h;for(c=c.entanglements;p;){var b=31-te(p),C=1<<b;C&h|c[b]&h&&(c[b]|=h),p&=~C}}function qr(c,h){var p=h&-h;return p=(p&42)!==0?1:Xr(p),(p&(c.suspendedLanes|h))!==0?0:p}function Xr(c){switch(c){case 2:c=1;break;case 8:c=4;break;case 32:c=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:c=128;break;case 268435456:c=134217728;break;default:c=0}return c}function Zr(c){return c&=-c,2<c?8<c?(c&134217727)!==0?32:268435456:8:2}function ye(){var c=ne.p;return c!==0?c:(c=window.event,c===void 0?32:iP(c.type))}function Ie(c,h){var p=ne.p;try{return ne.p=c,h()}finally{ne.p=p}}var Ee=Math.random().toString(36).slice(2),Te="__reactFiber$"+Ee,Re="__reactProps$"+Ee,ze="__reactContainer$"+Ee,ct="__reactEvents$"+Ee,bt="__reactListeners$"+Ee,dt="__reactHandles$"+Ee,ft="__reactResources$"+Ee,mt="__reactMarker$"+Ee;function Lt(c){delete c[Te],delete c[Re],delete c[ct],delete c[bt],delete c[dt]}function Vt(c){var h=c[Te];if(h)return h;for(var p=c.parentNode;p;){if(h=p[ze]||p[Te]){if(p=h.alternate,h.child!==null||p!==null&&p.child!==null)for(c=H6(c);c!==null;){if(p=c[Te])return p;c=H6(c)}return h}c=p,p=c.parentNode}return null}function Xt(c){if(c=c[Te]||c[ze]){var h=c.tag;if(h===5||h===6||h===13||h===31||h===26||h===27||h===3)return c}return null}function $t(c){var h=c.tag;if(h===5||h===26||h===27||h===6)return c.stateNode;throw Error(n(33))}function Gt(c){var h=c[ft];return h||(h=c[ft]={hoistableStyles:new Map,hoistableScripts:new Map}),h}function er(c){c[mt]=!0}var An=new Set,Wr={};function Pn(c,h){xs(c,h),xs(c+"Capture",h)}function xs(c,h){for(Wr[c]=h,c=0;c<h.length;c++)An.add(h[c])}var Vo=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]*$"),qo={},Zs={};function Hc(c){return Xe.call(Zs,c)?!0:Xe.call(qo,c)?!1:Vo.test(c)?Zs[c]=!0:(qo[c]=!0,!1)}function ua(c,h,p){if(Hc(h))if(p===null)c.removeAttribute(h);else{switch(typeof p){case"undefined":case"function":case"symbol":c.removeAttribute(h);return;case"boolean":var b=h.toLowerCase().slice(0,5);if(b!=="data-"&&b!=="aria-"){c.removeAttribute(h);return}}c.setAttribute(h,""+p)}}function Ql(c,h,p){if(p===null)c.removeAttribute(h);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":c.removeAttribute(h);return}c.setAttribute(h,""+p)}}function Wo(c,h,p,b){if(b===null)c.removeAttribute(p);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":c.removeAttribute(p);return}c.setAttributeNS(h,p,""+b)}}function pn(c){switch(typeof c){case"bigint":case"boolean":case"number":case"string":case"undefined":return c;case"object":return c;default:return""}}function Vh(c){var h=c.type;return(c=c.nodeName)&&c.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function bl(c,h,p){var b=Object.getOwnPropertyDescriptor(c.constructor.prototype,h);if(!c.hasOwnProperty(h)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var C=b.get,O=b.set;return Object.defineProperty(c,h,{configurable:!0,get:function(){return C.call(this)},set:function(ie){p=""+ie,O.call(this,ie)}}),Object.defineProperty(c,h,{enumerable:b.enumerable}),{getValue:function(){return p},setValue:function(ie){p=""+ie},stopTracking:function(){c._valueTracker=null,delete c[h]}}}}function Vc(c){if(!c._valueTracker){var h=Vh(c)?"checked":"value";c._valueTracker=bl(c,h,""+c[h])}}function xf(c){if(!c)return!1;var h=c._valueTracker;if(!h)return!0;var p=h.getValue(),b="";return c&&(b=Vh(c)?c.checked?"true":"false":c.value),c=b,c!==p?(h.setValue(c),!0):!1}function Gi(c){if(c=c||(typeof document<"u"?document:void 0),typeof c>"u")return null;try{return c.activeElement||c.body}catch{return c.body}}var gf=/[\n"\\]/g;function Ua(c){return c.replace(gf,function(h){return"\\"+h.charCodeAt(0).toString(16)+" "})}function ai(c,h,p,b,C,O,ie,Se){c.name="",ie!=null&&typeof ie!="function"&&typeof ie!="symbol"&&typeof ie!="boolean"?c.type=ie:c.removeAttribute("type"),h!=null?ie==="number"?(h===0&&c.value===""||c.value!=h)&&(c.value=""+pn(h)):c.value!==""+pn(h)&&(c.value=""+pn(h)):ie!=="submit"&&ie!=="reset"||c.removeAttribute("value"),h!=null?Wh(c,ie,pn(h)):p!=null?Wh(c,ie,pn(p)):b!=null&&c.removeAttribute("value"),C==null&&O!=null&&(c.defaultChecked=!!O),C!=null&&(c.checked=C&&typeof C!="function"&&typeof C!="symbol"),Se!=null&&typeof Se!="function"&&typeof Se!="symbol"&&typeof Se!="boolean"?c.name=""+pn(Se):c.removeAttribute("name")}function qh(c,h,p,b,C,O,ie,Se){if(O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(c.type=O),h!=null||p!=null){if(!(O!=="submit"&&O!=="reset"||h!=null)){Vc(c);return}p=p!=null?""+pn(p):"",h=h!=null?""+pn(h):p,Se||h===c.value||(c.value=h),c.defaultValue=h}b=b??C,b=typeof b!="function"&&typeof b!="symbol"&&!!b,c.checked=Se?c.checked:!!b,c.defaultChecked=!!b,ie!=null&&typeof ie!="function"&&typeof ie!="symbol"&&typeof ie!="boolean"&&(c.name=ie),Vc(c)}function Wh(c,h,p){h==="number"&&Gi(c.ownerDocument)===c||c.defaultValue===""+p||(c.defaultValue=""+p)}function qc(c,h,p,b){if(c=c.options,h){h={};for(var C=0;C<p.length;C++)h["$"+p[C]]=!0;for(p=0;p<c.length;p++)C=h.hasOwnProperty("$"+c[p].value),c[p].selected!==C&&(c[p].selected=C),C&&b&&(c[p].defaultSelected=!0)}else{for(p=""+pn(p),h=null,C=0;C<c.length;C++){if(c[C].value===p){c[C].selected=!0,b&&(c[C].defaultSelected=!0);return}h!==null||c[C].disabled||(h=c[C])}h!==null&&(h.selected=!0)}}function _0(c,h,p){if(h!=null&&(h=""+pn(h),h!==c.value&&(c.value=h),p==null)){c.defaultValue!==h&&(c.defaultValue=h);return}c.defaultValue=p!=null?""+pn(p):""}function Go(c,h,p,b){if(h==null){if(b!=null){if(p!=null)throw Error(n(92));if(se(b)){if(1<b.length)throw Error(n(93));b=b[0]}p=b}p==null&&(p=""),h=p}p=pn(h),c.defaultValue=p,b=c.textContent,b===p&&b!==""&&b!==null&&(c.value=b),Vc(c)}function ec(c,h){if(h){var p=c.firstChild;if(p&&p===c.lastChild&&p.nodeType===3){p.nodeValue=h;return}}c.textContent=h}var vf=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 Qu(c,h,p){var b=h.indexOf("--")===0;p==null||typeof p=="boolean"||p===""?b?c.setProperty(h,""):h==="float"?c.cssFloat="":c[h]="":b?c.setProperty(h,p):typeof p!="number"||p===0||vf.has(h)?h==="float"?c.cssFloat=p:c[h]=(""+p).trim():c[h]=p+"px"}function yf(c,h,p){if(h!=null&&typeof h!="object")throw Error(n(62));if(c=c.style,p!=null){for(var b in p)!p.hasOwnProperty(b)||h!=null&&h.hasOwnProperty(b)||(b.indexOf("--")===0?c.setProperty(b,""):b==="float"?c.cssFloat="":c[b]="");for(var C in h)b=h[C],h.hasOwnProperty(C)&&p[C]!==b&&Qu(c,C,b)}else for(var O in h)h.hasOwnProperty(O)&&Qu(c,O,h[O])}function Gh(c){if(c.indexOf("-")===-1)return!1;switch(c){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 Ux=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"]]),$x=/^[\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 Yo(c){return $x.test(""+c)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":c}function xo(){}var wl=null;function Yh(c){return c=c.target||c.srcElement||window,c.correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var go=null,jr=null;function E0(c){var h=Xt(c);if(h&&(c=h.stateNode)){var p=c[Re]||null;e:switch(c=h.stateNode,h.type){case"input":if(ai(c,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name),h=p.name,p.type==="radio"&&h!=null){for(p=c;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll('input[name="'+Ua(""+h)+'"][type="radio"]'),h=0;h<p.length;h++){var b=p[h];if(b!==c&&b.form===c.form){var C=b[Re]||null;if(!C)throw Error(n(90));ai(b,C.value,C.defaultValue,C.defaultValue,C.checked,C.defaultChecked,C.type,C.name)}}for(h=0;h<p.length;h++)b=p[h],b.form===c.form&&xf(b)}break e;case"textarea":_0(c,p.value,p.defaultValue);break e;case"select":h=p.value,h!=null&&qc(c,!!p.multiple,h,!1)}}}var Kh=!1;function T0(c,h,p){if(Kh)return c(h,p);Kh=!0;try{var b=c(h);return b}finally{if(Kh=!1,(go!==null||jr!==null)&&(fy(),go&&(h=go,c=jr,jr=go=null,E0(h),c)))for(h=0;h<c.length;h++)E0(c[h])}}function ed(c,h){var p=c.stateNode;if(p===null)return null;var b=p[Re]||null;if(b===null)return null;p=b[h];e:switch(h){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(c=c.type,b=!(c==="button"||c==="input"||c==="select"||c==="textarea")),c=!b;break e;default:c=!1}if(c)return null;if(p&&typeof p!="function")throw Error(n(231,h,typeof p));return p}var Ko=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xo=!1;if(Ko)try{var Js={};Object.defineProperty(Js,"passive",{get:function(){Xo=!0}}),window.addEventListener("test",Js,Js),window.removeEventListener("test",Js,Js)}catch{Xo=!1}var jl=null,Xh=null,tc=null;function bf(){if(tc)return tc;var c,h=Xh,p=h.length,b,C="value"in jl?jl.value:jl.textContent,O=C.length;for(c=0;c<p&&h[c]===C[c];c++);var ie=p-c;for(b=1;b<=ie&&h[p-b]===C[O-b];b++);return tc=C.slice(c,1<b?1-b:void 0)}function Qs(c){var h=c.keyCode;return"charCode"in c?(c=c.charCode,c===0&&h===13&&(c=13)):c=h,c===10&&(c=13),32<=c||c===13?c:0}function wf(){return!0}function td(){return!1}function Yi(c){function h(p,b,C,O,ie){this._reactName=p,this._targetInst=C,this.type=b,this.nativeEvent=O,this.target=ie,this.currentTarget=null;for(var Se in c)c.hasOwnProperty(Se)&&(p=c[Se],this[Se]=p?p(O):O[Se]);return this.isDefaultPrevented=(O.defaultPrevented!=null?O.defaultPrevented:O.returnValue===!1)?wf:td,this.isPropagationStopped=td,this}return m(h.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=wf)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=wf)},persist:function(){},isPersistent:wf}),h}var Zo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(c){return c.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jo=Yi(Zo),rc=m({},Zo,{view:0,detail:0}),rd=Yi(rc),nd,Wc,nc,ac=m({},rc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rr,button:0,buttons:0,relatedTarget:function(c){return c.relatedTarget===void 0?c.fromElement===c.srcElement?c.toElement:c.fromElement:c.relatedTarget},movementX:function(c){return"movementX"in c?c.movementX:(c!==nc&&(nc&&c.type==="mousemove"?(nd=c.screenX-nc.screenX,Wc=c.screenY-nc.screenY):Wc=nd=0,nc=c),nd)},movementY:function(c){return"movementY"in c?c.movementY:Wc}}),Zh=Yi(ac),ic=m({},ac,{dataTransfer:0}),sc=Yi(ic),P0=m({},rc,{relatedTarget:0}),jf=Yi(P0),D0=m({},Zo,{animationName:0,elapsedTime:0,pseudoElement:0}),ad=Yi(D0),O0=m({},Zo,{clipboardData:function(c){return"clipboardData"in c?c.clipboardData:window.clipboardData}}),U=Yi(O0),pe=m({},Zo,{data:0}),Me=Yi(pe),We={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},et={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"},Nt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pt(c){var h=this.nativeEvent;return h.getModifierState?h.getModifierState(c):(c=Nt[c])?!!h[c]:!1}function rr(){return Pt}var or=m({},rc,{key:function(c){if(c.key){var h=We[c.key]||c.key;if(h!=="Unidentified")return h}return c.type==="keypress"?(c=Qs(c),c===13?"Enter":String.fromCharCode(c)):c.type==="keydown"||c.type==="keyup"?et[c.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rr,charCode:function(c){return c.type==="keypress"?Qs(c):0},keyCode:function(c){return c.type==="keydown"||c.type==="keyup"?c.keyCode:0},which:function(c){return c.type==="keypress"?Qs(c):c.type==="keydown"||c.type==="keyup"?c.keyCode:0}}),Pr=Yi(or),Mr=m({},ac,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),en=Yi(Mr),$a=m({},rc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rr}),Mn=Yi($a),Dn=m({},Zo,{propertyName:0,elapsedTime:0,pseudoElement:0}),Jn=Yi(Dn),da=m({},ac,{deltaX:function(c){return"deltaX"in c?c.deltaX:"wheelDeltaX"in c?-c.wheelDeltaX:0},deltaY:function(c){return"deltaY"in c?c.deltaY:"wheelDeltaY"in c?-c.wheelDeltaY:"wheelDelta"in c?-c.wheelDelta:0},deltaZ:0,deltaMode:0}),fa=Yi(da),Ki=m({},Zo,{newState:0,oldState:0}),oc=Yi(Ki),Jh=[9,13,27,32],lc=Ko&&"CompositionEvent"in window,Qo=null;Ko&&"documentMode"in document&&(Qo=document.documentMode);var Gc=Ko&&"TextEvent"in window&&!Qo,Yc=Ko&&(!lc||Qo&&8<Qo&&11>=Qo),id=" ",sd=!1;function ki(c,h){switch(c){case"keyup":return Jh.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kc(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var vo=!1;function Qh(c,h){switch(c){case"compositionend":return Kc(h);case"keypress":return h.which!==32?null:(sd=!0,id);case"textInput":return c=h.data,c===id&&sd?null:c;default:return null}}function Nl(c,h){if(vo)return c==="compositionend"||!lc&&ki(c,h)?(c=bf(),tc=Xh=jl=null,vo=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1<h.char.length)return h.char;if(h.which)return String.fromCharCode(h.which)}return null;case"compositionend":return Yc&&h.locale!=="ko"?null:h.data;default:return null}}var gs={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 em(c){var h=c&&c.nodeName&&c.nodeName.toLowerCase();return h==="input"?!!gs[c.type]:h==="textarea"}function od(c,h,p,b){go?jr?jr.push(b):jr=[b]:go=b,h=yy(h,"onChange"),0<h.length&&(p=new Jo("onChange","change",null,p,b),c.push({event:p,listeners:h}))}var Xc=null,Xi=null;function ld(c){E6(c,0)}function Zc(c){var h=$t(c);if(xf(h))return c}function cd(c,h){if(c==="change")return h}var Jc=!1;if(Ko){var ud;if(Ko){var Ci="oninput"in document;if(!Ci){var vs=document.createElement("div");vs.setAttribute("oninput","return;"),Ci=typeof vs.oninput=="function"}ud=Ci}else ud=!1;Jc=ud&&(!document.documentMode||9<document.documentMode)}function dd(){Xc&&(Xc.detachEvent("onpropertychange",cc),Xi=Xc=null)}function cc(c){if(c.propertyName==="value"&&Zc(Xi)){var h=[];od(h,Xi,c,Yh(c)),T0(ld,h)}}function Qc(c,h,p){c==="focusin"?(dd(),Xc=h,Xi=p,Xc.attachEvent("onpropertychange",cc)):c==="focusout"&&dd()}function Nf(c){if(c==="selectionchange"||c==="keyup"||c==="keydown")return Zc(Xi)}function fd(c,h){if(c==="click")return Zc(h)}function Ha(c,h){if(c==="input"||c==="change")return Zc(h)}function Hx(c,h){return c===h&&(c!==0||1/c===1/h)||c!==c&&h!==h}var Aa=typeof Object.is=="function"?Object.is:Hx;function ys(c,h){if(Aa(c,h))return!0;if(typeof c!="object"||c===null||typeof h!="object"||h===null)return!1;var p=Object.keys(c),b=Object.keys(h);if(p.length!==b.length)return!1;for(b=0;b<p.length;b++){var C=p[b];if(!Xe.call(h,C)||!Aa(c[C],h[C]))return!1}return!0}function eu(c){for(;c&&c.firstChild;)c=c.firstChild;return c}function Sf(c,h){var p=eu(c);c=0;for(var b;p;){if(p.nodeType===3){if(b=c+p.textContent.length,c<=h&&b>=h)return{node:p,offset:h-c};c=b}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=eu(p)}}function Af(c,h){return c&&h?c===h?!0:c&&c.nodeType===3?!1:h&&h.nodeType===3?Af(c,h.parentNode):"contains"in c?c.contains(h):c.compareDocumentPosition?!!(c.compareDocumentPosition(h)&16):!1:!1}function hd(c){c=c!=null&&c.ownerDocument!=null&&c.ownerDocument.defaultView!=null?c.ownerDocument.defaultView:window;for(var h=Gi(c.document);h instanceof c.HTMLIFrameElement;){try{var p=typeof h.contentWindow.location.href=="string"}catch{p=!1}if(p)c=h.contentWindow;else break;h=Gi(c.document)}return h}function uc(c){var h=c&&c.nodeName&&c.nodeName.toLowerCase();return h&&(h==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||h==="textarea"||c.contentEditable==="true")}var md=Ko&&"documentMode"in document&&11>=document.documentMode,eo=null,el=null,yo=null,tu=!1;function _i(c,h,p){var b=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;tu||eo==null||eo!==Gi(b)||(b=eo,"selectionStart"in b&&uc(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),yo&&ys(yo,b)||(yo=b,b=yy(el,"onSelect"),0<b.length&&(h=new Jo("onSelect","select",null,h,p),c.push({event:h,listeners:b}),h.target=eo)))}function Zi(c,h){var p={};return p[c.toLowerCase()]=h.toLowerCase(),p["Webkit"+c]="webkit"+h,p["Moz"+c]="moz"+h,p}var xn={animationend:Zi("Animation","AnimationEnd"),animationiteration:Zi("Animation","AnimationIteration"),animationstart:Zi("Animation","AnimationStart"),transitionrun:Zi("Transition","TransitionRun"),transitionstart:Zi("Transition","TransitionStart"),transitioncancel:Zi("Transition","TransitionCancel"),transitionend:Zi("Transition","TransitionEnd")},On={},ka={};Ko&&(ka=document.createElement("div").style,"AnimationEvent"in window||(delete xn.animationend.animation,delete xn.animationiteration.animation,delete xn.animationstart.animation),"TransitionEvent"in window||delete xn.transitionend.transition);function Qn(c){if(On[c])return On[c];if(!xn[c])return c;var h=xn[c],p;for(p in h)if(h.hasOwnProperty(p)&&p in ka)return On[c]=h[p];return c}var Sl=Qn("animationend"),kf=Qn("animationiteration"),pd=Qn("animationstart"),R0=Qn("transitionrun"),H1=Qn("transitionstart"),V1=Qn("transitioncancel"),Vx=Qn("transitionend"),qx=new Map,xd="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(" ");xd.push("scrollEnd");function bo(c,h){qx.set(c,h),Pn(h,[c])}var tm=typeof reportError=="function"?reportError:function(c){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var h=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof c=="object"&&c!==null&&typeof c.message=="string"?String(c.message):String(c),error:c});if(!window.dispatchEvent(h))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",c);return}console.error(c)},to=[],gd=0,M0=0;function rm(){for(var c=gd,h=M0=gd=0;h<c;){var p=to[h];to[h++]=null;var b=to[h];to[h++]=null;var C=to[h];to[h++]=null;var O=to[h];if(to[h++]=null,b!==null&&C!==null){var ie=b.pending;ie===null?C.next=C:(C.next=ie.next,ie.next=C),b.pending=C}O!==0&&am(p,C,O)}}function nm(c,h,p,b){to[gd++]=c,to[gd++]=h,to[gd++]=p,to[gd++]=b,M0|=b,c.lanes|=b,c=c.alternate,c!==null&&(c.lanes|=b)}function L0(c,h,p,b){return nm(c,h,p,b),Ji(c)}function dc(c,h){return nm(c,null,null,h),Ji(c)}function am(c,h,p){c.lanes|=p;var b=c.alternate;b!==null&&(b.lanes|=p);for(var C=!1,O=c.return;O!==null;)O.childLanes|=p,b=O.alternate,b!==null&&(b.childLanes|=p),O.tag===22&&(c=O.stateNode,c===null||c._visibility&1||(C=!0)),c=O,O=O.return;return c.tag===3?(O=c.stateNode,C&&h!==null&&(C=31-te(p),c=O.hiddenUpdates,b=c[C],b===null?c[C]=[h]:b.push(h),h.lane=p|536870912),O):null}function Ji(c){if(50<hg)throw hg=0,Fj=null,Error(n(185));for(var h=c.return;h!==null;)c=h,h=c.return;return c.tag===3?c.stateNode:null}var Ei={};function I0(c,h,p,b){this.tag=c,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qi(c,h,p,b){return new I0(c,h,p,b)}function F0(c){return c=c.prototype,!(!c||!c.isReactComponent)}function wo(c,h){var p=c.alternate;return p===null?(p=Qi(c.tag,h,c.key,c.mode),p.elementType=c.elementType,p.type=c.type,p.stateNode=c.stateNode,p.alternate=c,c.alternate=p):(p.pendingProps=h,p.type=c.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=c.flags&65011712,p.childLanes=c.childLanes,p.lanes=c.lanes,p.child=c.child,p.memoizedProps=c.memoizedProps,p.memoizedState=c.memoizedState,p.updateQueue=c.updateQueue,h=c.dependencies,p.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},p.sibling=c.sibling,p.index=c.index,p.ref=c.ref,p.refCleanup=c.refCleanup,p}function im(c,h){c.flags&=65011714;var p=c.alternate;return p===null?(c.childLanes=0,c.lanes=h,c.child=null,c.subtreeFlags=0,c.memoizedProps=null,c.memoizedState=null,c.updateQueue=null,c.dependencies=null,c.stateNode=null):(c.childLanes=p.childLanes,c.lanes=p.lanes,c.child=p.child,c.subtreeFlags=0,c.deletions=null,c.memoizedProps=p.memoizedProps,c.memoizedState=p.memoizedState,c.updateQueue=p.updateQueue,c.type=p.type,h=p.dependencies,c.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),c}function Cf(c,h,p,b,C,O){var ie=0;if(b=c,typeof c=="function")F0(c)&&(ie=1);else if(typeof c=="string")ie=rX(c,p,G.current)?26:c==="html"||c==="head"||c==="body"?27:5;else e:switch(c){case I:return c=Qi(31,p,h,C),c.elementType=I,c.lanes=O,c;case v:return ru(p.children,C,O,h);case w:ie=8,C|=24;break;case j:return c=Qi(12,p,h,C|2),c.elementType=j,c.lanes=O,c;case M:return c=Qi(13,p,h,C),c.elementType=M,c.lanes=O,c;case B:return c=Qi(19,p,h,C),c.elementType=B,c.lanes=O,c;default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case A:ie=10;break e;case k:ie=9;break e;case T:ie=11;break e;case L:ie=14;break e;case F:ie=16,b=null;break e}ie=29,p=Error(n(130,c===null?"null":typeof c,"")),b=null}return h=Qi(ie,p,h,C),h.elementType=c,h.type=b,h.lanes=O,h}function ru(c,h,p,b){return c=Qi(7,c,b,h),c.lanes=p,c}function sm(c,h,p){return c=Qi(6,c,null,h),c.lanes=p,c}function B0(c){var h=Qi(18,null,null,0);return h.stateNode=c,h}function _f(c,h,p){return h=Qi(4,c.children!==null?c.children:[],c.key,h),h.lanes=p,h.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},h}var z0=new WeakMap;function jo(c,h){if(typeof c=="object"&&c!==null){var p=z0.get(c);return p!==void 0?p:(h={value:c,source:h,stack:Je(h)},z0.set(c,h),h)}return{value:c,source:h,stack:Je(h)}}var Ef=[],vd=0,U0=null,om=0,No=[],So=0,nu=null,Ao=1,ko="";function ro(c,h){Ef[vd++]=om,Ef[vd++]=U0,U0=c,om=h}function q1(c,h,p){No[So++]=Ao,No[So++]=ko,No[So++]=nu,nu=c;var b=Ao;c=ko;var C=32-te(b)-1;b&=~(1<<C),p+=1;var O=32-te(h)+C;if(30<O){var ie=C-C%5;O=(b&(1<<ie)-1).toString(32),b>>=ie,C-=ie,Ao=1<<32-te(h)+C|p<<C|b,ko=O+c}else Ao=1<<O|p<<C|b,ko=c}function Wx(c){c.return!==null&&(ro(c,1),q1(c,1,0))}function $0(c){for(;c===U0;)U0=Ef[--vd],Ef[vd]=null,om=Ef[--vd],Ef[vd]=null;for(;c===nu;)nu=No[--So],No[So]=null,ko=No[--So],No[So]=null,Ao=No[--So],No[So]=null}function W1(c,h){No[So++]=Ao,No[So++]=ko,No[So++]=nu,Ao=h.id,ko=h.overflow,nu=c}var Ti=null,ea=null,tn=!1,bs=null,Ca=!1,tl=Error(n(519));function au(c){var h=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Tf(jo(h,c)),tl}function Gx(c){var h=c.stateNode,p=c.type,b=c.memoizedProps;switch(h[Te]=c,h[Re]=b,p){case"dialog":nn("cancel",h),nn("close",h);break;case"iframe":case"object":case"embed":nn("load",h);break;case"video":case"audio":for(p=0;p<pg.length;p++)nn(pg[p],h);break;case"source":nn("error",h);break;case"img":case"image":case"link":nn("error",h),nn("load",h);break;case"details":nn("toggle",h);break;case"input":nn("invalid",h),qh(h,b.value,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name,!0);break;case"select":nn("invalid",h);break;case"textarea":nn("invalid",h),Go(h,b.value,b.defaultValue,b.children)}p=b.children,typeof p!="string"&&typeof p!="number"&&typeof p!="bigint"||h.textContent===""+p||b.suppressHydrationWarning===!0||O6(h.textContent,p)?(b.popover!=null&&(nn("beforetoggle",h),nn("toggle",h)),b.onScroll!=null&&nn("scroll",h),b.onScrollEnd!=null&&nn("scrollend",h),b.onClick!=null&&(h.onclick=xo),h=!0):h=!1,h||au(c,!0)}function fc(c){for(Ti=c.return;Ti;)switch(Ti.tag){case 5:case 31:case 13:Ca=!1;return;case 27:case 3:Ca=!0;return;default:Ti=Ti.return}}function Pi(c){if(c!==Ti)return!1;if(!tn)return fc(c),tn=!0,!1;var h=c.tag,p;if((p=h!==3&&h!==27)&&((p=h===5)&&(p=c.type,p=!(p!=="form"&&p!=="button")||Qj(c.type,c.memoizedProps)),p=!p),p&&ea&&au(c),fc(c),h===13){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(n(317));ea=$6(c)}else if(h===31){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(n(317));ea=$6(c)}else h===27?(h=ea,Vf(c.type)?(c=aN,aN=null,ea=c):ea=h):ea=Ti?_l(c.stateNode.nextSibling):null;return!0}function yd(){ea=Ti=null,tn=!1}function Yx(){var c=bs;return c!==null&&(Do===null?Do=c:Do.push.apply(Do,c),bs=null),c}function Tf(c){bs===null?bs=[c]:bs.push(c)}var H0=ce(null),iu=null,Al=null;function su(c,h,p){H(H0,h._currentValue),h._currentValue=p}function Co(c){c._currentValue=H0.current,D(H0)}function Pf(c,h,p){for(;c!==null;){var b=c.alternate;if((c.childLanes&h)!==h?(c.childLanes|=h,b!==null&&(b.childLanes|=h)):b!==null&&(b.childLanes&h)!==h&&(b.childLanes|=h),c===p)break;c=c.return}}function bd(c,h,p,b){var C=c.child;for(C!==null&&(C.return=c);C!==null;){var O=C.dependencies;if(O!==null){var ie=C.child;O=O.firstContext;e:for(;O!==null;){var Se=O;O=C;for(var He=0;He<h.length;He++)if(Se.context===h[He]){O.lanes|=p,Se=O.alternate,Se!==null&&(Se.lanes|=p),Pf(O.return,p,c),b||(ie=null);break e}O=Se.next}}else if(C.tag===18){if(ie=C.return,ie===null)throw Error(n(341));ie.lanes|=p,O=ie.alternate,O!==null&&(O.lanes|=p),Pf(ie,p,c),ie=null}else ie=C.child;if(ie!==null)ie.return=C;else for(ie=C;ie!==null;){if(ie===c){ie=null;break}if(C=ie.sibling,C!==null){C.return=ie.return,ie=C;break}ie=ie.return}C=ie}}function ou(c,h,p,b){c=null;for(var C=h,O=!1;C!==null;){if(!O){if((C.flags&524288)!==0)O=!0;else if((C.flags&262144)!==0)break}if(C.tag===10){var ie=C.alternate;if(ie===null)throw Error(n(387));if(ie=ie.memoizedProps,ie!==null){var Se=C.type;Aa(C.pendingProps.value,ie.value)||(c!==null?c.push(Se):c=[Se])}}else if(C===he.current){if(ie=C.alternate,ie===null)throw Error(n(387));ie.memoizedState.memoizedState!==C.memoizedState.memoizedState&&(c!==null?c.push(bg):c=[bg])}C=C.return}c!==null&&bd(h,c,p,b),h.flags|=262144}function V0(c){for(c=c.firstContext;c!==null;){if(!Aa(c.context._currentValue,c.memoizedValue))return!0;c=c.next}return!1}function lu(c){iu=c,Al=null,c=c.dependencies,c!==null&&(c.firstContext=null)}function Di(c){return G1(iu,c)}function q0(c,h){return iu===null&&lu(c),G1(c,h)}function G1(c,h){var p=h._currentValue;if(h={context:h,memoizedValue:p,next:null},Al===null){if(c===null)throw Error(n(308));Al=h,c.dependencies={lanes:0,firstContext:h},c.flags|=524288}else Al=Al.next=h;return p}var nj=typeof AbortController<"u"?AbortController:function(){var c=[],h=this.signal={aborted:!1,addEventListener:function(p,b){c.push(b)}};this.abort=function(){h.aborted=!0,c.forEach(function(p){return p()})}},aj=e.unstable_scheduleCallback,ij=e.unstable_NormalPriority,Ma={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Df(){return{controller:new nj,data:new Map,refCount:0}}function lm(c){c.refCount--,c.refCount===0&&aj(ij,function(){c.controller.abort()})}var cm=null,W0=0,S=0,_=null;function V(c,h){if(cm===null){var p=cm=[];W0=0,S=Vj(),_={status:"pending",value:void 0,then:function(b){p.push(b)}}}return W0++,h.then(Q,Q),h}function Q(){if(--W0===0&&cm!==null){_!==null&&(_.status="fulfilled");var c=cm;cm=null,S=0,_=null;for(var h=0;h<c.length;h++)(0,c[h])()}}function ge(c,h){var p=[],b={status:"pending",value:null,reason:null,then:function(C){p.push(C)}};return c.then(function(){b.status="fulfilled",b.value=h;for(var C=0;C<p.length;C++)(0,p[C])(h)},function(C){for(b.status="rejected",b.reason=C,C=0;C<p.length;C++)(0,p[C])(void 0)}),b}var be=Z.S;Z.S=function(c,h){n6=we(),typeof h=="object"&&h!==null&&typeof h.then=="function"&&V(c,h),be!==null&&be(c,h)};var je=ce(null);function Ce(){var c=je.current;return c!==null?c:ra.pooledCache}function Pe(c,h){h===null?H(je,je.current):H(je,h.pool)}function Fe(){var c=Ce();return c===null?null:{parent:Ma._currentValue,pool:c}}var Ke=Error(n(460)),ht=Error(n(474)),Le=Error(n(542)),Qe={then:function(){}};function lt(c){return c=c.status,c==="fulfilled"||c==="rejected"}function jt(c,h,p){switch(p=c[p],p===void 0?c.push(h):p!==h&&(h.then(xo,xo),h=p),h.status){case"fulfilled":return h.value;case"rejected":throw c=h.reason,zt(c),c;default:if(typeof h.status=="string")h.then(xo,xo);else{if(c=ra,c!==null&&100<c.shellSuspendCounter)throw Error(n(482));c=h,c.status="pending",c.then(function(b){if(h.status==="pending"){var C=h;C.status="fulfilled",C.value=b}},function(b){if(h.status==="pending"){var C=h;C.status="rejected",C.reason=b}})}switch(h.status){case"fulfilled":return h.value;case"rejected":throw c=h.reason,zt(c),c}throw wt=h,Ke}}function ut(c){try{var h=c._init;return h(c._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(wt=p,Ke):p}}var wt=null;function kt(){if(wt===null)throw Error(n(459));var c=wt;return wt=null,c}function zt(c){if(c===Ke||c===Le)throw Error(n(483))}var Tt=null,cr=0;function Jt(c){var h=cr;return cr+=1,Tt===null&&(Tt=[]),jt(Tt,c,h)}function Dr(c,h){h=h.props.ref,c.ref=h!==void 0?h:null}function nr(c,h){throw h.$$typeof===g?Error(n(525)):(c=Object.prototype.toString.call(h),Error(n(31,c==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":c)))}function Jr(c){function h(rt,Ze){if(c){var pt=rt.deletions;pt===null?(rt.deletions=[Ze],rt.flags|=16):pt.push(Ze)}}function p(rt,Ze){if(!c)return null;for(;Ze!==null;)h(rt,Ze),Ze=Ze.sibling;return null}function b(rt){for(var Ze=new Map;rt!==null;)rt.key!==null?Ze.set(rt.key,rt):Ze.set(rt.index,rt),rt=rt.sibling;return Ze}function C(rt,Ze){return rt=wo(rt,Ze),rt.index=0,rt.sibling=null,rt}function O(rt,Ze,pt){return rt.index=pt,c?(pt=rt.alternate,pt!==null?(pt=pt.index,pt<Ze?(rt.flags|=67108866,Ze):pt):(rt.flags|=67108866,Ze)):(rt.flags|=1048576,Ze)}function ie(rt){return c&&rt.alternate===null&&(rt.flags|=67108866),rt}function Se(rt,Ze,pt,Ct){return Ze===null||Ze.tag!==6?(Ze=sm(pt,rt.mode,Ct),Ze.return=rt,Ze):(Ze=C(Ze,pt),Ze.return=rt,Ze)}function He(rt,Ze,pt,Ct){var yr=pt.type;return yr===v?At(rt,Ze,pt.props.children,Ct,pt.key):Ze!==null&&(Ze.elementType===yr||typeof yr=="object"&&yr!==null&&yr.$$typeof===F&&ut(yr)===Ze.type)?(Ze=C(Ze,pt.props),Dr(Ze,pt),Ze.return=rt,Ze):(Ze=Cf(pt.type,pt.key,pt.props,null,rt.mode,Ct),Dr(Ze,pt),Ze.return=rt,Ze)}function xt(rt,Ze,pt,Ct){return Ze===null||Ze.tag!==4||Ze.stateNode.containerInfo!==pt.containerInfo||Ze.stateNode.implementation!==pt.implementation?(Ze=_f(pt,rt.mode,Ct),Ze.return=rt,Ze):(Ze=C(Ze,pt.children||[]),Ze.return=rt,Ze)}function At(rt,Ze,pt,Ct,yr){return Ze===null||Ze.tag!==7?(Ze=ru(pt,rt.mode,Ct,yr),Ze.return=rt,Ze):(Ze=C(Ze,pt),Ze.return=rt,Ze)}function Et(rt,Ze,pt){if(typeof Ze=="string"&&Ze!==""||typeof Ze=="number"||typeof Ze=="bigint")return Ze=sm(""+Ze,rt.mode,pt),Ze.return=rt,Ze;if(typeof Ze=="object"&&Ze!==null){switch(Ze.$$typeof){case x:return pt=Cf(Ze.type,Ze.key,Ze.props,null,rt.mode,pt),Dr(pt,Ze),pt.return=rt,pt;case y:return Ze=_f(Ze,rt.mode,pt),Ze.return=rt,Ze;case F:return Ze=ut(Ze),Et(rt,Ze,pt)}if(se(Ze)||R(Ze))return Ze=ru(Ze,rt.mode,pt,null),Ze.return=rt,Ze;if(typeof Ze.then=="function")return Et(rt,Jt(Ze),pt);if(Ze.$$typeof===A)return Et(rt,q0(rt,Ze),pt);nr(rt,Ze)}return null}function gt(rt,Ze,pt,Ct){var yr=Ze!==null?Ze.key:null;if(typeof pt=="string"&&pt!==""||typeof pt=="number"||typeof pt=="bigint")return yr!==null?null:Se(rt,Ze,""+pt,Ct);if(typeof pt=="object"&&pt!==null){switch(pt.$$typeof){case x:return pt.key===yr?He(rt,Ze,pt,Ct):null;case y:return pt.key===yr?xt(rt,Ze,pt,Ct):null;case F:return pt=ut(pt),gt(rt,Ze,pt,Ct)}if(se(pt)||R(pt))return yr!==null?null:At(rt,Ze,pt,Ct,null);if(typeof pt.then=="function")return gt(rt,Ze,Jt(pt),Ct);if(pt.$$typeof===A)return gt(rt,Ze,q0(rt,pt),Ct);nr(rt,pt)}return null}function yt(rt,Ze,pt,Ct,yr){if(typeof Ct=="string"&&Ct!==""||typeof Ct=="number"||typeof Ct=="bigint")return rt=rt.get(pt)||null,Se(Ze,rt,""+Ct,yr);if(typeof Ct=="object"&&Ct!==null){switch(Ct.$$typeof){case x:return rt=rt.get(Ct.key===null?pt:Ct.key)||null,He(Ze,rt,Ct,yr);case y:return rt=rt.get(Ct.key===null?pt:Ct.key)||null,xt(Ze,rt,Ct,yr);case F:return Ct=ut(Ct),yt(rt,Ze,pt,Ct,yr)}if(se(Ct)||R(Ct))return rt=rt.get(pt)||null,At(Ze,rt,Ct,yr,null);if(typeof Ct.then=="function")return yt(rt,Ze,pt,Jt(Ct),yr);if(Ct.$$typeof===A)return yt(rt,Ze,pt,q0(Ze,Ct),yr);nr(Ze,Ct)}return null}function lr(rt,Ze,pt,Ct){for(var yr=null,bn=null,mr=Ze,$r=Ze=0,sn=null;mr!==null&&$r<pt.length;$r++){mr.index>$r?(sn=mr,mr=null):sn=mr.sibling;var wn=gt(rt,mr,pt[$r],Ct);if(wn===null){mr===null&&(mr=sn);break}c&&mr&&wn.alternate===null&&h(rt,mr),Ze=O(wn,Ze,$r),bn===null?yr=wn:bn.sibling=wn,bn=wn,mr=sn}if($r===pt.length)return p(rt,mr),tn&&ro(rt,$r),yr;if(mr===null){for(;$r<pt.length;$r++)mr=Et(rt,pt[$r],Ct),mr!==null&&(Ze=O(mr,Ze,$r),bn===null?yr=mr:bn.sibling=mr,bn=mr);return tn&&ro(rt,$r),yr}for(mr=b(mr);$r<pt.length;$r++)sn=yt(mr,rt,$r,pt[$r],Ct),sn!==null&&(c&&sn.alternate!==null&&mr.delete(sn.key===null?$r:sn.key),Ze=O(sn,Ze,$r),bn===null?yr=sn:bn.sibling=sn,bn=sn);return c&&mr.forEach(function(Kf){return h(rt,Kf)}),tn&&ro(rt,$r),yr}function Ar(rt,Ze,pt,Ct){if(pt==null)throw Error(n(151));for(var yr=null,bn=null,mr=Ze,$r=Ze=0,sn=null,wn=pt.next();mr!==null&&!wn.done;$r++,wn=pt.next()){mr.index>$r?(sn=mr,mr=null):sn=mr.sibling;var Kf=gt(rt,mr,wn.value,Ct);if(Kf===null){mr===null&&(mr=sn);break}c&&mr&&Kf.alternate===null&&h(rt,mr),Ze=O(Kf,Ze,$r),bn===null?yr=Kf:bn.sibling=Kf,bn=Kf,mr=sn}if(wn.done)return p(rt,mr),tn&&ro(rt,$r),yr;if(mr===null){for(;!wn.done;$r++,wn=pt.next())wn=Et(rt,wn.value,Ct),wn!==null&&(Ze=O(wn,Ze,$r),bn===null?yr=wn:bn.sibling=wn,bn=wn);return tn&&ro(rt,$r),yr}for(mr=b(mr);!wn.done;$r++,wn=pt.next())wn=yt(mr,rt,$r,wn.value,Ct),wn!==null&&(c&&wn.alternate!==null&&mr.delete(wn.key===null?$r:wn.key),Ze=O(wn,Ze,$r),bn===null?yr=wn:bn.sibling=wn,bn=wn);return c&&mr.forEach(function(hX){return h(rt,hX)}),tn&&ro(rt,$r),yr}function Yn(rt,Ze,pt,Ct){if(typeof pt=="object"&&pt!==null&&pt.type===v&&pt.key===null&&(pt=pt.props.children),typeof pt=="object"&&pt!==null){switch(pt.$$typeof){case x:e:{for(var yr=pt.key;Ze!==null;){if(Ze.key===yr){if(yr=pt.type,yr===v){if(Ze.tag===7){p(rt,Ze.sibling),Ct=C(Ze,pt.props.children),Ct.return=rt,rt=Ct;break e}}else if(Ze.elementType===yr||typeof yr=="object"&&yr!==null&&yr.$$typeof===F&&ut(yr)===Ze.type){p(rt,Ze.sibling),Ct=C(Ze,pt.props),Dr(Ct,pt),Ct.return=rt,rt=Ct;break e}p(rt,Ze);break}else h(rt,Ze);Ze=Ze.sibling}pt.type===v?(Ct=ru(pt.props.children,rt.mode,Ct,pt.key),Ct.return=rt,rt=Ct):(Ct=Cf(pt.type,pt.key,pt.props,null,rt.mode,Ct),Dr(Ct,pt),Ct.return=rt,rt=Ct)}return ie(rt);case y:e:{for(yr=pt.key;Ze!==null;){if(Ze.key===yr)if(Ze.tag===4&&Ze.stateNode.containerInfo===pt.containerInfo&&Ze.stateNode.implementation===pt.implementation){p(rt,Ze.sibling),Ct=C(Ze,pt.children||[]),Ct.return=rt,rt=Ct;break e}else{p(rt,Ze);break}else h(rt,Ze);Ze=Ze.sibling}Ct=_f(pt,rt.mode,Ct),Ct.return=rt,rt=Ct}return ie(rt);case F:return pt=ut(pt),Yn(rt,Ze,pt,Ct)}if(se(pt))return lr(rt,Ze,pt,Ct);if(R(pt)){if(yr=R(pt),typeof yr!="function")throw Error(n(150));return pt=yr.call(pt),Ar(rt,Ze,pt,Ct)}if(typeof pt.then=="function")return Yn(rt,Ze,Jt(pt),Ct);if(pt.$$typeof===A)return Yn(rt,Ze,q0(rt,pt),Ct);nr(rt,pt)}return typeof pt=="string"&&pt!==""||typeof pt=="number"||typeof pt=="bigint"?(pt=""+pt,Ze!==null&&Ze.tag===6?(p(rt,Ze.sibling),Ct=C(Ze,pt),Ct.return=rt,rt=Ct):(p(rt,Ze),Ct=sm(pt,rt.mode,Ct),Ct.return=rt,rt=Ct),ie(rt)):p(rt,Ze)}return function(rt,Ze,pt,Ct){try{cr=0;var yr=Yn(rt,Ze,pt,Ct);return Tt=null,yr}catch(mr){if(mr===Ke||mr===Le)throw mr;var bn=Qi(29,mr,null,rt.mode);return bn.lanes=Ct,bn.return=rt,bn}finally{}}}var ta=Jr(!0),Lr=Jr(!1),Qt=!1;function Kt(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ha(c,h){c=c.updateQueue,h.updateQueue===c&&(h.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,callbacks:null})}function Sr(c){return{lane:c,tag:0,payload:null,callback:null,next:null}}function Br(c,h,p){var b=c.updateQueue;if(b===null)return null;if(b=b.shared,(_n&2)!==0){var C=b.pending;return C===null?h.next=h:(h.next=C.next,C.next=h),b.pending=h,h=Ji(c),am(c,null,p),h}return nm(c,b,h,p),Ji(c)}function kn(c,h,p){if(h=h.updateQueue,h!==null&&(h=h.shared,(p&4194048)!==0)){var b=h.lanes;b&=c.pendingLanes,p|=b,h.lanes=p,kr(c,p)}}function ii(c,h){var p=c.updateQueue,b=c.alternate;if(b!==null&&(b=b.updateQueue,p===b)){var C=null,O=null;if(p=p.firstBaseUpdate,p!==null){do{var ie={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};O===null?C=O=ie:O=O.next=ie,p=p.next}while(p!==null);O===null?C=O=h:O=O.next=h}else C=O=h;p={baseState:b.baseState,firstBaseUpdate:C,lastBaseUpdate:O,shared:b.shared,callbacks:b.callbacks},c.updateQueue=p;return}c=p.lastBaseUpdate,c===null?p.firstBaseUpdate=h:c.next=h,p.lastBaseUpdate=h}var Oi=!1;function qn(){if(Oi){var c=_;if(c!==null)throw c}}function Va(c,h,p,b){Oi=!1;var C=c.updateQueue;Qt=!1;var O=C.firstBaseUpdate,ie=C.lastBaseUpdate,Se=C.shared.pending;if(Se!==null){C.shared.pending=null;var He=Se,xt=He.next;He.next=null,ie===null?O=xt:ie.next=xt,ie=He;var At=c.alternate;At!==null&&(At=At.updateQueue,Se=At.lastBaseUpdate,Se!==ie&&(Se===null?At.firstBaseUpdate=xt:Se.next=xt,At.lastBaseUpdate=He))}if(O!==null){var Et=C.baseState;ie=0,At=xt=He=null,Se=O;do{var gt=Se.lane&-536870913,yt=gt!==Se.lane;if(yt?(an&gt)===gt:(b&gt)===gt){gt!==0&&gt===S&&(Oi=!0),At!==null&&(At=At.next={lane:0,tag:Se.tag,payload:Se.payload,callback:null,next:null});e:{var lr=c,Ar=Se;gt=h;var Yn=p;switch(Ar.tag){case 1:if(lr=Ar.payload,typeof lr=="function"){Et=lr.call(Yn,Et,gt);break e}Et=lr;break e;case 3:lr.flags=lr.flags&-65537|128;case 0:if(lr=Ar.payload,gt=typeof lr=="function"?lr.call(Yn,Et,gt):lr,gt==null)break e;Et=m({},Et,gt);break e;case 2:Qt=!0}}gt=Se.callback,gt!==null&&(c.flags|=64,yt&&(c.flags|=8192),yt=C.callbacks,yt===null?C.callbacks=[gt]:yt.push(gt))}else yt={lane:gt,tag:Se.tag,payload:Se.payload,callback:Se.callback,next:null},At===null?(xt=At=yt,He=Et):At=At.next=yt,ie|=gt;if(Se=Se.next,Se===null){if(Se=C.shared.pending,Se===null)break;yt=Se,Se=yt.next,yt.next=null,C.lastBaseUpdate=yt,C.shared.pending=null}}while(!0);At===null&&(He=Et),C.baseState=He,C.firstBaseUpdate=xt,C.lastBaseUpdate=At,O===null&&(C.shared.lanes=0),Bf|=ie,c.lanes=ie,c.memoizedState=Et}}function es(c,h){if(typeof c!="function")throw Error(n(191,c));c.call(h)}function qa(c,h){var p=c.callbacks;if(p!==null)for(c.callbacks=null,c=0;c<p.length;c++)es(p[c],h)}var Vr=ce(null),dn=ce(0);function ma(c,h){c=Td,H(dn,c),H(Vr,h),Td=c|h.baseLanes}function gn(){H(dn,Td),H(Vr,Vr.current)}function si(){Td=dn.current,D(Vr),D(dn)}var pa=ce(null),fn=null;function La(c){var h=c.alternate;H(ln,ln.current&1),H(pa,c),fn===null&&(h===null||Vr.current!==null||h.memoizedState!==null)&&(fn=c)}function Cn(c){H(ln,ln.current),H(pa,c),fn===null&&(fn=c)}function Wa(c){c.tag===22?(H(ln,ln.current),H(pa,c),fn===null&&(fn=c)):Ga()}function Ga(){H(ln,ln.current),H(pa,pa.current)}function Ln(c){D(pa),fn===c&&(fn=null),D(ln)}var ln=ce(0);function ts(c){for(var h=c;h!==null;){if(h.tag===13){var p=h.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||rN(p)||nN(p)))return h}else if(h.tag===19&&(h.memoizedProps.revealOrder==="forwards"||h.memoizedProps.revealOrder==="backwards"||h.memoizedProps.revealOrder==="unstable_legacy-backwards"||h.memoizedProps.revealOrder==="together")){if((h.flags&128)!==0)return h}else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===c)break;for(;h.sibling===null;){if(h.return===null||h.return===c)return null;h=h.return}h.sibling.return=h.return,h=h.sibling}return null}var _a=0,pr=null,vr=null,hn=null,Ds=!1,_o=!1,ws=!1,Ya=0,cu=0,uu=null,G0=0;function Wn(){throw Error(n(321))}function Kx(c,h){if(h===null)return!1;for(var p=0;p<h.length&&p<c.length;p++)if(!Aa(c[p],h[p]))return!1;return!0}function Xx(c,h,p,b,C,O){return _a=O,pr=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,Z.H=c===null||c.memoizedState===null?mT:hj,ws=!1,O=p(b,C),ws=!1,_o&&(O=hc(h,p,b,C)),Y0(c),O}function Y0(c){Z.H=ag;var h=vr!==null&&vr.next!==null;if(_a=0,hn=vr=pr=null,Ds=!1,cu=0,uu=null,h)throw Error(n(300));c===null||gi||(c=c.dependencies,c!==null&&V0(c)&&(gi=!0))}function hc(c,h,p,b){pr=c;var C=0;do{if(_o&&(uu=null),cu=0,_o=!1,25<=C)throw Error(n(301));if(C+=1,hn=vr=null,c.updateQueue!=null){var O=c.updateQueue;O.lastEffect=null,O.events=null,O.stores=null,O.memoCache!=null&&(O.memoCache.index=0)}Z.H=pT,O=h(p,b)}while(_o);return O}function sj(){var c=Z.H,h=c.useState()[0];return h=typeof h.then=="function"?du(h):h,c=c.useState()[0],(vr!==null?vr.memoizedState:null)!==c&&(pr.flags|=1024),h}function Zx(){var c=Ya!==0;return Ya=0,c}function Jx(c,h,p){h.updateQueue=c.updateQueue,h.flags&=-2053,c.lanes&=~p}function K0(c){if(Ds){for(c=c.memoizedState;c!==null;){var h=c.queue;h!==null&&(h.pending=null),c=c.next}Ds=!1}_a=0,hn=vr=pr=null,_o=!1,cu=Ya=0,uu=null}function xi(){var c={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return hn===null?pr.memoizedState=hn=c:hn=hn.next=c,hn}function Ea(){if(vr===null){var c=pr.alternate;c=c!==null?c.memoizedState:null}else c=vr.next;var h=hn===null?pr.memoizedState:hn.next;if(h!==null)hn=h,vr=c;else{if(c===null)throw pr.alternate===null?Error(n(467)):Error(n(310));vr=c,c={memoizedState:vr.memoizedState,baseState:vr.baseState,baseQueue:vr.baseQueue,queue:vr.queue,next:null},hn===null?pr.memoizedState=hn=c:hn=hn.next=c}return hn}function um(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function du(c){var h=cu;return cu+=1,uu===null&&(uu=[]),c=jt(uu,c,h),h=pr,(hn===null?h.memoizedState:hn.next)===null&&(h=h.alternate,Z.H=h===null||h.memoizedState===null?mT:hj),c}function Of(c){if(c!==null&&typeof c=="object"){if(typeof c.then=="function")return du(c);if(c.$$typeof===A)return Di(c)}throw Error(n(438,String(c)))}function wd(c){var h=null,p=pr.updateQueue;if(p!==null&&(h=p.memoCache),h==null){var b=pr.alternate;b!==null&&(b=b.updateQueue,b!==null&&(b=b.memoCache,b!=null&&(h={data:b.data.map(function(C){return C.slice()}),index:0})))}if(h==null&&(h={data:[],index:0}),p===null&&(p=um(),pr.updateQueue=p),p.memoCache=h,p=h.data[h.index],p===void 0)for(p=h.data[h.index]=Array(c),b=0;b<c;b++)p[b]=q;return h.index++,p}function kl(c,h){return typeof h=="function"?h(c):h}function X0(c){var h=Ea();return Rf(h,vr,c)}function Rf(c,h,p){var b=c.queue;if(b===null)throw Error(n(311));b.lastRenderedReducer=p;var C=c.baseQueue,O=b.pending;if(O!==null){if(C!==null){var ie=C.next;C.next=O.next,O.next=ie}h.baseQueue=C=O,b.pending=null}if(O=c.baseState,C===null)c.memoizedState=O;else{h=C.next;var Se=ie=null,He=null,xt=h,At=!1;do{var Et=xt.lane&-536870913;if(Et!==xt.lane?(an&Et)===Et:(_a&Et)===Et){var gt=xt.revertLane;if(gt===0)He!==null&&(He=He.next={lane:0,revertLane:0,gesture:null,action:xt.action,hasEagerState:xt.hasEagerState,eagerState:xt.eagerState,next:null}),Et===S&&(At=!0);else if((_a&gt)===gt){xt=xt.next,gt===S&&(At=!0);continue}else Et={lane:0,revertLane:xt.revertLane,gesture:null,action:xt.action,hasEagerState:xt.hasEagerState,eagerState:xt.eagerState,next:null},He===null?(Se=He=Et,ie=O):He=He.next=Et,pr.lanes|=gt,Bf|=gt;Et=xt.action,ws&&p(O,Et),O=xt.hasEagerState?xt.eagerState:p(O,Et)}else gt={lane:Et,revertLane:xt.revertLane,gesture:xt.gesture,action:xt.action,hasEagerState:xt.hasEagerState,eagerState:xt.eagerState,next:null},He===null?(Se=He=gt,ie=O):He=He.next=gt,pr.lanes|=Et,Bf|=Et;xt=xt.next}while(xt!==null&&xt!==h);if(He===null?ie=O:He.next=Se,!Aa(O,c.memoizedState)&&(gi=!0,At&&(p=_,p!==null)))throw p;c.memoizedState=O,c.baseState=ie,c.baseQueue=He,b.lastRenderedState=O}return C===null&&(b.lanes=0),[c.memoizedState,b.dispatch]}function Z0(c){var h=Ea(),p=h.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=c;var b=p.dispatch,C=p.pending,O=h.memoizedState;if(C!==null){p.pending=null;var ie=C=C.next;do O=c(O,ie.action),ie=ie.next;while(ie!==C);Aa(O,h.memoizedState)||(gi=!0),h.memoizedState=O,h.baseQueue===null&&(h.baseState=O),p.lastRenderedState=O}return[O,b]}function J0(c,h,p){var b=pr,C=Ea(),O=tn;if(O){if(p===void 0)throw Error(n(407));p=p()}else p=h();var ie=!Aa((vr||C).memoizedState,p);if(ie&&(C.memoizedState=p,gi=!0),C=C.queue,oj(eg.bind(null,b,C,c),[c]),C.getSnapshot!==h||ie||hn!==null&&hn.memoizedState.tag&1){if(b.flags|=2048,Nd(9,{destroy:void 0},Qx.bind(null,b,C,p,h),null),ra===null)throw Error(n(349));O||(_a&127)!==0||mc(b,h,p)}return p}function mc(c,h,p){c.flags|=16384,c={getSnapshot:h,value:p},h=pr.updateQueue,h===null?(h=um(),pr.updateQueue=h,h.stores=[c]):(p=h.stores,p===null?h.stores=[c]:p.push(c))}function Qx(c,h,p,b){h.value=p,h.getSnapshot=b,Y1(h)&&tg(c)}function eg(c,h,p){return p(function(){Y1(h)&&tg(c)})}function Y1(c){var h=c.getSnapshot;c=c.value;try{var p=h();return!Aa(c,p)}catch{return!0}}function tg(c){var h=dc(c,2);h!==null&&Oo(h,c,2)}function fu(c){var h=xi();if(typeof c=="function"){var p=c;if(c=p(),ws){Ve(!0);try{p()}finally{Ve(!1)}}}return h.memoizedState=h.baseState=c,h.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kl,lastRenderedState:c},h}function K1(c,h,p,b){return c.baseState=p,Rf(c,vr,typeof b=="function"?b:kl)}function X1(c,h,p,b,C){if(ey(c))throw Error(n(485));if(c=h.action,c!==null){var O={payload:C,action:c,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(ie){O.listeners.push(ie)}};Z.T!==null?p(!0):O.isTransition=!1,b(O),p=h.pending,p===null?(O.next=h.pending=O,Z1(h,O)):(O.next=p.next,h.pending=p.next=O)}}function Z1(c,h){var p=h.action,b=h.payload,C=c.state;if(h.isTransition){var O=Z.T,ie={};Z.T=ie;try{var Se=p(C,b),He=Z.S;He!==null&&He(ie,Se),rg(c,h,Se)}catch(xt){jd(c,h,xt)}finally{O!==null&&ie.types!==null&&(O.types=ie.types),Z.T=O}}else try{O=p(C,b),rg(c,h,O)}catch(xt){jd(c,h,xt)}}function rg(c,h,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(b){J1(c,h,b)},function(b){return jd(c,h,b)}):J1(c,h,p)}function J1(c,h,p){h.status="fulfilled",h.value=p,Q0(h),c.state=p,h=c.pending,h!==null&&(p=h.next,p===h?c.pending=null:(p=p.next,h.next=p,Z1(c,p)))}function jd(c,h,p){var b=c.pending;if(c.pending=null,b!==null){b=b.next;do h.status="rejected",h.reason=p,Q0(h),h=h.next;while(h!==b)}c.action=null}function Q0(c){c=c.listeners;for(var h=0;h<c.length;h++)(0,c[h])()}function dm(c,h){return h}function Cl(c,h){if(tn){var p=ra.formState;if(p!==null){e:{var b=pr;if(tn){if(ea){t:{for(var C=ea,O=Ca;C.nodeType!==8;){if(!O){C=null;break t}if(C=_l(C.nextSibling),C===null){C=null;break t}}O=C.data,C=O==="F!"||O==="F"?C:null}if(C){ea=_l(C.nextSibling),b=C.data==="F!";break e}}au(b)}b=!1}b&&(h=p[0])}}return p=xi(),p.memoizedState=p.baseState=h,b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:dm,lastRenderedState:h},p.queue=b,p=dT.bind(null,pr,b),b.dispatch=p,b=fu(!1),O=fj.bind(null,pr,!1,b.queue),b=xi(),C={state:h,dispatch:null,action:c,pending:null},b.queue=C,p=X1.bind(null,pr,C,O,p),C.dispatch=p,b.memoizedState=c,[h,p,!1]}function pc(c){var h=Ea();return xc(h,vr,c)}function xc(c,h,p){if(h=Rf(c,h,dm)[0],c=X0(kl)[0],typeof h=="object"&&h!==null&&typeof h.then=="function")try{var b=du(h)}catch(ie){throw ie===Ke?Le:ie}else b=h;h=Ea();var C=h.queue,O=C.dispatch;return p!==h.memoizedState&&(pr.flags|=2048,Nd(9,{destroy:void 0},ep.bind(null,C,p),null)),[b,O,c]}function ep(c,h){c.action=h}function tp(c){var h=Ea(),p=vr;if(p!==null)return xc(h,p,c);Ea(),h=h.memoizedState,p=Ea();var b=p.queue.dispatch;return p.memoizedState=c,[h,b,!1]}function Nd(c,h,p,b){return c={tag:c,create:p,deps:b,inst:h,next:null},h=pr.updateQueue,h===null&&(h=um(),pr.updateQueue=h),p=h.lastEffect,p===null?h.lastEffect=c.next=c:(b=p.next,p.next=c,c.next=b,h.lastEffect=c),c}function Q1(){return Ea().memoizedState}function Mf(c,h,p,b){var C=xi();pr.flags|=c,C.memoizedState=Nd(1|h,{destroy:void 0},p,b===void 0?null:b)}function Lf(c,h,p,b){var C=Ea();b=b===void 0?null:b;var O=C.memoizedState.inst;vr!==null&&b!==null&&Kx(b,vr.memoizedState.deps)?C.memoizedState=Nd(h,O,p,b):(pr.flags|=c,C.memoizedState=Nd(1|h,O,p,b))}function ZE(c,h){Mf(8390656,8,c,h)}function oj(c,h){Lf(2048,8,c,h)}function oK(c){pr.flags|=4;var h=pr.updateQueue;if(h===null)h=um(),pr.updateQueue=h,h.events=[c];else{var p=h.events;p===null?h.events=[c]:p.push(c)}}function JE(c){var h=Ea().memoizedState;return oK({ref:h,nextImpl:c}),function(){if((_n&2)!==0)throw Error(n(440));return h.impl.apply(void 0,arguments)}}function QE(c,h){return Lf(4,2,c,h)}function eT(c,h){return Lf(4,4,c,h)}function tT(c,h){if(typeof h=="function"){c=c();var p=h(c);return function(){typeof p=="function"?p():h(null)}}if(h!=null)return c=c(),h.current=c,function(){h.current=null}}function rT(c,h,p){p=p!=null?p.concat([c]):null,Lf(4,4,tT.bind(null,h,c),p)}function lj(){}function nT(c,h){var p=Ea();h=h===void 0?null:h;var b=p.memoizedState;return h!==null&&Kx(h,b[1])?b[0]:(p.memoizedState=[c,h],c)}function aT(c,h){var p=Ea();h=h===void 0?null:h;var b=p.memoizedState;if(h!==null&&Kx(h,b[1]))return b[0];if(b=c(),ws){Ve(!0);try{c()}finally{Ve(!1)}}return p.memoizedState=[b,h],b}function cj(c,h,p){return p===void 0||(_a&1073741824)!==0&&(an&261930)===0?c.memoizedState=h:(c.memoizedState=p,c=i6(),pr.lanes|=c,Bf|=c,p)}function iT(c,h,p,b){return Aa(p,h)?p:Vr.current!==null?(c=cj(c,p,b),Aa(c,h)||(gi=!0),c):(_a&42)===0||(_a&1073741824)!==0&&(an&261930)===0?(gi=!0,c.memoizedState=p):(c=i6(),pr.lanes|=c,Bf|=c,h)}function sT(c,h,p,b,C){var O=ne.p;ne.p=O!==0&&8>O?O:8;var ie=Z.T,Se={};Z.T=Se,fj(c,!1,h,p);try{var He=C(),xt=Z.S;if(xt!==null&&xt(Se,He),He!==null&&typeof He=="object"&&typeof He.then=="function"){var At=ge(He,b);ng(c,h,At,al(c))}else ng(c,h,b,al(c))}catch(Et){ng(c,h,{then:function(){},status:"rejected",reason:Et},al())}finally{ne.p=O,ie!==null&&Se.types!==null&&(ie.types=Se.types),Z.T=ie}}function lK(){}function uj(c,h,p,b){if(c.tag!==5)throw Error(n(476));var C=oT(c).queue;sT(c,C,h,X,p===null?lK:function(){return lT(c),p(b)})}function oT(c){var h=c.memoizedState;if(h!==null)return h;h={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kl,lastRenderedState:X},next:null};var p={};return h.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kl,lastRenderedState:p},next:null},c.memoizedState=h,c=c.alternate,c!==null&&(c.memoizedState=h),h}function lT(c){var h=oT(c);h.next===null&&(h=c.alternate.memoizedState),ng(c,h.next.queue,{},al())}function dj(){return Di(bg)}function cT(){return Ea().memoizedState}function uT(){return Ea().memoizedState}function cK(c){for(var h=c.return;h!==null;){switch(h.tag){case 24:case 3:var p=al();c=Sr(p);var b=Br(h,c,p);b!==null&&(Oo(b,h,p),kn(b,h,p)),h={cache:Df()},c.payload=h;return}h=h.return}}function uK(c,h,p){var b=al();p={lane:b,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},ey(c)?fT(h,p):(p=L0(c,h,p,b),p!==null&&(Oo(p,c,b),hT(p,h,b)))}function dT(c,h,p){var b=al();ng(c,h,p,b)}function ng(c,h,p,b){var C={lane:b,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(ey(c))fT(h,C);else{var O=c.alternate;if(c.lanes===0&&(O===null||O.lanes===0)&&(O=h.lastRenderedReducer,O!==null))try{var ie=h.lastRenderedState,Se=O(ie,p);if(C.hasEagerState=!0,C.eagerState=Se,Aa(Se,ie))return nm(c,h,C,0),ra===null&&rm(),!1}catch{}finally{}if(p=L0(c,h,C,b),p!==null)return Oo(p,c,b),hT(p,h,b),!0}return!1}function fj(c,h,p,b){if(b={lane:2,revertLane:Vj(),gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},ey(c)){if(h)throw Error(n(479))}else h=L0(c,p,b,2),h!==null&&Oo(h,c,2)}function ey(c){var h=c.alternate;return c===pr||h!==null&&h===pr}function fT(c,h){_o=Ds=!0;var p=c.pending;p===null?h.next=h:(h.next=p.next,p.next=h),c.pending=h}function hT(c,h,p){if((p&4194048)!==0){var b=h.lanes;b&=c.pendingLanes,p|=b,h.lanes=p,kr(c,p)}}var ag={readContext:Di,use:Of,useCallback:Wn,useContext:Wn,useEffect:Wn,useImperativeHandle:Wn,useLayoutEffect:Wn,useInsertionEffect:Wn,useMemo:Wn,useReducer:Wn,useRef:Wn,useState:Wn,useDebugValue:Wn,useDeferredValue:Wn,useTransition:Wn,useSyncExternalStore:Wn,useId:Wn,useHostTransitionStatus:Wn,useFormState:Wn,useActionState:Wn,useOptimistic:Wn,useMemoCache:Wn,useCacheRefresh:Wn};ag.useEffectEvent=Wn;var mT={readContext:Di,use:Of,useCallback:function(c,h){return xi().memoizedState=[c,h===void 0?null:h],c},useContext:Di,useEffect:ZE,useImperativeHandle:function(c,h,p){p=p!=null?p.concat([c]):null,Mf(4194308,4,tT.bind(null,h,c),p)},useLayoutEffect:function(c,h){return Mf(4194308,4,c,h)},useInsertionEffect:function(c,h){Mf(4,2,c,h)},useMemo:function(c,h){var p=xi();h=h===void 0?null:h;var b=c();if(ws){Ve(!0);try{c()}finally{Ve(!1)}}return p.memoizedState=[b,h],b},useReducer:function(c,h,p){var b=xi();if(p!==void 0){var C=p(h);if(ws){Ve(!0);try{p(h)}finally{Ve(!1)}}}else C=h;return b.memoizedState=b.baseState=C,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:C},b.queue=c,c=c.dispatch=uK.bind(null,pr,c),[b.memoizedState,c]},useRef:function(c){var h=xi();return c={current:c},h.memoizedState=c},useState:function(c){c=fu(c);var h=c.queue,p=dT.bind(null,pr,h);return h.dispatch=p,[c.memoizedState,p]},useDebugValue:lj,useDeferredValue:function(c,h){var p=xi();return cj(p,c,h)},useTransition:function(){var c=fu(!1);return c=sT.bind(null,pr,c.queue,!0,!1),xi().memoizedState=c,[!1,c]},useSyncExternalStore:function(c,h,p){var b=pr,C=xi();if(tn){if(p===void 0)throw Error(n(407));p=p()}else{if(p=h(),ra===null)throw Error(n(349));(an&127)!==0||mc(b,h,p)}C.memoizedState=p;var O={value:p,getSnapshot:h};return C.queue=O,ZE(eg.bind(null,b,O,c),[c]),b.flags|=2048,Nd(9,{destroy:void 0},Qx.bind(null,b,O,p,h),null),p},useId:function(){var c=xi(),h=ra.identifierPrefix;if(tn){var p=ko,b=Ao;p=(b&~(1<<32-te(b)-1)).toString(32)+p,h="_"+h+"R_"+p,p=Ya++,0<p&&(h+="H"+p.toString(32)),h+="_"}else p=G0++,h="_"+h+"r_"+p.toString(32)+"_";return c.memoizedState=h},useHostTransitionStatus:dj,useFormState:Cl,useActionState:Cl,useOptimistic:function(c){var h=xi();h.memoizedState=h.baseState=c;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return h.queue=p,h=fj.bind(null,pr,!0,p),p.dispatch=h,[c,h]},useMemoCache:wd,useCacheRefresh:function(){return xi().memoizedState=cK.bind(null,pr)},useEffectEvent:function(c){var h=xi(),p={impl:c};return h.memoizedState=p,function(){if((_n&2)!==0)throw Error(n(440));return p.impl.apply(void 0,arguments)}}},hj={readContext:Di,use:Of,useCallback:nT,useContext:Di,useEffect:oj,useImperativeHandle:rT,useInsertionEffect:QE,useLayoutEffect:eT,useMemo:aT,useReducer:X0,useRef:Q1,useState:function(){return X0(kl)},useDebugValue:lj,useDeferredValue:function(c,h){var p=Ea();return iT(p,vr.memoizedState,c,h)},useTransition:function(){var c=X0(kl)[0],h=Ea().memoizedState;return[typeof c=="boolean"?c:du(c),h]},useSyncExternalStore:J0,useId:cT,useHostTransitionStatus:dj,useFormState:pc,useActionState:pc,useOptimistic:function(c,h){var p=Ea();return K1(p,vr,c,h)},useMemoCache:wd,useCacheRefresh:uT};hj.useEffectEvent=JE;var pT={readContext:Di,use:Of,useCallback:nT,useContext:Di,useEffect:oj,useImperativeHandle:rT,useInsertionEffect:QE,useLayoutEffect:eT,useMemo:aT,useReducer:Z0,useRef:Q1,useState:function(){return Z0(kl)},useDebugValue:lj,useDeferredValue:function(c,h){var p=Ea();return vr===null?cj(p,c,h):iT(p,vr.memoizedState,c,h)},useTransition:function(){var c=Z0(kl)[0],h=Ea().memoizedState;return[typeof c=="boolean"?c:du(c),h]},useSyncExternalStore:J0,useId:cT,useHostTransitionStatus:dj,useFormState:tp,useActionState:tp,useOptimistic:function(c,h){var p=Ea();return vr!==null?K1(p,vr,c,h):(p.baseState=c,[c,p.queue.dispatch])},useMemoCache:wd,useCacheRefresh:uT};pT.useEffectEvent=JE;function mj(c,h,p,b){h=c.memoizedState,p=p(b,h),p=p==null?h:m({},h,p),c.memoizedState=p,c.lanes===0&&(c.updateQueue.baseState=p)}var pj={enqueueSetState:function(c,h,p){c=c._reactInternals;var b=al(),C=Sr(b);C.payload=h,p!=null&&(C.callback=p),h=Br(c,C,b),h!==null&&(Oo(h,c,b),kn(h,c,b))},enqueueReplaceState:function(c,h,p){c=c._reactInternals;var b=al(),C=Sr(b);C.tag=1,C.payload=h,p!=null&&(C.callback=p),h=Br(c,C,b),h!==null&&(Oo(h,c,b),kn(h,c,b))},enqueueForceUpdate:function(c,h){c=c._reactInternals;var p=al(),b=Sr(p);b.tag=2,h!=null&&(b.callback=h),h=Br(c,b,p),h!==null&&(Oo(h,c,p),kn(h,c,p))}};function xT(c,h,p,b,C,O,ie){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(b,O,ie):h.prototype&&h.prototype.isPureReactComponent?!ys(p,b)||!ys(C,O):!0}function gT(c,h,p,b){c=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(p,b),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(p,b),h.state!==c&&pj.enqueueReplaceState(h,h.state,null)}function fm(c,h){var p=h;if("ref"in h){p={};for(var b in h)b!=="ref"&&(p[b]=h[b])}if(c=c.defaultProps){p===h&&(p=m({},p));for(var C in c)p[C]===void 0&&(p[C]=c[C])}return p}function vT(c){tm(c)}function yT(c){console.error(c)}function bT(c){tm(c)}function ty(c,h){try{var p=c.onUncaughtError;p(h.value,{componentStack:h.stack})}catch(b){setTimeout(function(){throw b})}}function wT(c,h,p){try{var b=c.onCaughtError;b(p.value,{componentStack:p.stack,errorBoundary:h.tag===1?h.stateNode:null})}catch(C){setTimeout(function(){throw C})}}function xj(c,h,p){return p=Sr(p),p.tag=3,p.payload={element:null},p.callback=function(){ty(c,h)},p}function jT(c){return c=Sr(c),c.tag=3,c}function NT(c,h,p,b){var C=p.type.getDerivedStateFromError;if(typeof C=="function"){var O=b.value;c.payload=function(){return C(O)},c.callback=function(){wT(h,p,b)}}var ie=p.stateNode;ie!==null&&typeof ie.componentDidCatch=="function"&&(c.callback=function(){wT(h,p,b),typeof C!="function"&&(zf===null?zf=new Set([this]):zf.add(this));var Se=b.stack;this.componentDidCatch(b.value,{componentStack:Se!==null?Se:""})})}function dK(c,h,p,b,C){if(p.flags|=32768,b!==null&&typeof b=="object"&&typeof b.then=="function"){if(h=p.alternate,h!==null&&ou(h,p,C,!0),p=pa.current,p!==null){switch(p.tag){case 31:case 13:return fn===null?hy():p.alternate===null&&Ka===0&&(Ka=3),p.flags&=-257,p.flags|=65536,p.lanes=C,b===Qe?p.flags|=16384:(h=p.updateQueue,h===null?p.updateQueue=new Set([b]):h.add(b),Uj(c,b,C)),!1;case 22:return p.flags|=65536,b===Qe?p.flags|=16384:(h=p.updateQueue,h===null?(h={transitions:null,markerInstances:null,retryQueue:new Set([b])},p.updateQueue=h):(p=h.retryQueue,p===null?h.retryQueue=new Set([b]):p.add(b)),Uj(c,b,C)),!1}throw Error(n(435,p.tag))}return Uj(c,b,C),hy(),!1}if(tn)return h=pa.current,h!==null?((h.flags&65536)===0&&(h.flags|=256),h.flags|=65536,h.lanes=C,b!==tl&&(c=Error(n(422),{cause:b}),Tf(jo(c,p)))):(b!==tl&&(h=Error(n(423),{cause:b}),Tf(jo(h,p))),c=c.current.alternate,c.flags|=65536,C&=-C,c.lanes|=C,b=jo(b,p),C=xj(c.stateNode,b,C),ii(c,C),Ka!==4&&(Ka=2)),!1;var O=Error(n(520),{cause:b});if(O=jo(O,p),fg===null?fg=[O]:fg.push(O),Ka!==4&&(Ka=2),h===null)return!0;b=jo(b,p),p=h;do{switch(p.tag){case 3:return p.flags|=65536,c=C&-C,p.lanes|=c,c=xj(p.stateNode,b,c),ii(p,c),!1;case 1:if(h=p.type,O=p.stateNode,(p.flags&128)===0&&(typeof h.getDerivedStateFromError=="function"||O!==null&&typeof O.componentDidCatch=="function"&&(zf===null||!zf.has(O))))return p.flags|=65536,C&=-C,p.lanes|=C,C=jT(C),NT(C,c,p,b),ii(p,C),!1}p=p.return}while(p!==null);return!1}var gj=Error(n(461)),gi=!1;function js(c,h,p,b){h.child=c===null?Lr(h,null,p,b):ta(h,c.child,p,b)}function ST(c,h,p,b,C){p=p.render;var O=h.ref;if("ref"in b){var ie={};for(var Se in b)Se!=="ref"&&(ie[Se]=b[Se])}else ie=b;return lu(h),b=Xx(c,h,p,ie,O,C),Se=Zx(),c!==null&&!gi?(Jx(c,h,C),Sd(c,h,C)):(tn&&Se&&Wx(h),h.flags|=1,js(c,h,b,C),h.child)}function AT(c,h,p,b,C){if(c===null){var O=p.type;return typeof O=="function"&&!F0(O)&&O.defaultProps===void 0&&p.compare===null?(h.tag=15,h.type=O,kT(c,h,O,b,C)):(c=Cf(p.type,null,b,h,h.mode,C),c.ref=h.ref,c.return=h,h.child=c)}if(O=c.child,!Aj(c,C)){var ie=O.memoizedProps;if(p=p.compare,p=p!==null?p:ys,p(ie,b)&&c.ref===h.ref)return Sd(c,h,C)}return h.flags|=1,c=wo(O,b),c.ref=h.ref,c.return=h,h.child=c}function kT(c,h,p,b,C){if(c!==null){var O=c.memoizedProps;if(ys(O,b)&&c.ref===h.ref)if(gi=!1,h.pendingProps=b=O,Aj(c,C))(c.flags&131072)!==0&&(gi=!0);else return h.lanes=c.lanes,Sd(c,h,C)}return vj(c,h,p,b,C)}function CT(c,h,p,b){var C=b.children,O=c!==null?c.memoizedState:null;if(c===null&&h.stateNode===null&&(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),b.mode==="hidden"){if((h.flags&128)!==0){if(O=O!==null?O.baseLanes|p:p,c!==null){for(b=h.child=c.child,C=0;b!==null;)C=C|b.lanes|b.childLanes,b=b.sibling;b=C&~O}else b=0,h.child=null;return _T(c,h,O,p,b)}if((p&536870912)!==0)h.memoizedState={baseLanes:0,cachePool:null},c!==null&&Pe(h,O!==null?O.cachePool:null),O!==null?ma(h,O):gn(),Wa(h);else return b=h.lanes=536870912,_T(c,h,O!==null?O.baseLanes|p:p,p,b)}else O!==null?(Pe(h,O.cachePool),ma(h,O),Ga(),h.memoizedState=null):(c!==null&&Pe(h,null),gn(),Ga());return js(c,h,C,p),h.child}function ig(c,h){return c!==null&&c.tag===22||h.stateNode!==null||(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.sibling}function _T(c,h,p,b,C){var O=Ce();return O=O===null?null:{parent:Ma._currentValue,pool:O},h.memoizedState={baseLanes:p,cachePool:O},c!==null&&Pe(h,null),gn(),Wa(h),c!==null&&ou(c,h,b,!0),h.childLanes=C,null}function ry(c,h){return h=ay({mode:h.mode,children:h.children},c.mode),h.ref=c.ref,c.child=h,h.return=c,h}function ET(c,h,p){return ta(h,c.child,null,p),c=ry(h,h.pendingProps),c.flags|=2,Ln(h),h.memoizedState=null,c}function fK(c,h,p){var b=h.pendingProps,C=(h.flags&128)!==0;if(h.flags&=-129,c===null){if(tn){if(b.mode==="hidden")return c=ry(h,b),h.lanes=536870912,ig(null,c);if(Cn(h),(c=ea)?(c=U6(c,Ca),c=c!==null&&c.data==="&"?c:null,c!==null&&(h.memoizedState={dehydrated:c,treeContext:nu!==null?{id:Ao,overflow:ko}:null,retryLane:536870912,hydrationErrors:null},p=B0(c),p.return=h,h.child=p,Ti=h,ea=null)):c=null,c===null)throw au(h);return h.lanes=536870912,null}return ry(h,b)}var O=c.memoizedState;if(O!==null){var ie=O.dehydrated;if(Cn(h),C)if(h.flags&256)h.flags&=-257,h=ET(c,h,p);else if(h.memoizedState!==null)h.child=c.child,h.flags|=128,h=null;else throw Error(n(558));else if(gi||ou(c,h,p,!1),C=(p&c.childLanes)!==0,gi||C){if(b=ra,b!==null&&(ie=qr(b,p),ie!==0&&ie!==O.retryLane))throw O.retryLane=ie,dc(c,ie),Oo(b,c,ie),gj;hy(),h=ET(c,h,p)}else c=O.treeContext,ea=_l(ie.nextSibling),Ti=h,tn=!0,bs=null,Ca=!1,c!==null&&W1(h,c),h=ry(h,b),h.flags|=4096;return h}return c=wo(c.child,{mode:b.mode,children:b.children}),c.ref=h.ref,h.child=c,c.return=h,c}function ny(c,h){var p=h.ref;if(p===null)c!==null&&c.ref!==null&&(h.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(n(284));(c===null||c.ref!==p)&&(h.flags|=4194816)}}function vj(c,h,p,b,C){return lu(h),p=Xx(c,h,p,b,void 0,C),b=Zx(),c!==null&&!gi?(Jx(c,h,C),Sd(c,h,C)):(tn&&b&&Wx(h),h.flags|=1,js(c,h,p,C),h.child)}function TT(c,h,p,b,C,O){return lu(h),h.updateQueue=null,p=hc(h,b,p,C),Y0(c),b=Zx(),c!==null&&!gi?(Jx(c,h,O),Sd(c,h,O)):(tn&&b&&Wx(h),h.flags|=1,js(c,h,p,O),h.child)}function PT(c,h,p,b,C){if(lu(h),h.stateNode===null){var O=Ei,ie=p.contextType;typeof ie=="object"&&ie!==null&&(O=Di(ie)),O=new p(b,O),h.memoizedState=O.state!==null&&O.state!==void 0?O.state:null,O.updater=pj,h.stateNode=O,O._reactInternals=h,O=h.stateNode,O.props=b,O.state=h.memoizedState,O.refs={},Kt(h),ie=p.contextType,O.context=typeof ie=="object"&&ie!==null?Di(ie):Ei,O.state=h.memoizedState,ie=p.getDerivedStateFromProps,typeof ie=="function"&&(mj(h,p,ie,b),O.state=h.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof O.getSnapshotBeforeUpdate=="function"||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(ie=O.state,typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount(),ie!==O.state&&pj.enqueueReplaceState(O,O.state,null),Va(h,b,O,C),qn(),O.state=h.memoizedState),typeof O.componentDidMount=="function"&&(h.flags|=4194308),b=!0}else if(c===null){O=h.stateNode;var Se=h.memoizedProps,He=fm(p,Se);O.props=He;var xt=O.context,At=p.contextType;ie=Ei,typeof At=="object"&&At!==null&&(ie=Di(At));var Et=p.getDerivedStateFromProps;At=typeof Et=="function"||typeof O.getSnapshotBeforeUpdate=="function",Se=h.pendingProps!==Se,At||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(Se||xt!==ie)&&gT(h,O,b,ie),Qt=!1;var gt=h.memoizedState;O.state=gt,Va(h,b,O,C),qn(),xt=h.memoizedState,Se||gt!==xt||Qt?(typeof Et=="function"&&(mj(h,p,Et,b),xt=h.memoizedState),(He=Qt||xT(h,p,He,b,gt,xt,ie))?(At||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(h.flags|=4194308)):(typeof O.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=b,h.memoizedState=xt),O.props=b,O.state=xt,O.context=ie,b=He):(typeof O.componentDidMount=="function"&&(h.flags|=4194308),b=!1)}else{O=h.stateNode,ha(c,h),ie=h.memoizedProps,At=fm(p,ie),O.props=At,Et=h.pendingProps,gt=O.context,xt=p.contextType,He=Ei,typeof xt=="object"&&xt!==null&&(He=Di(xt)),Se=p.getDerivedStateFromProps,(xt=typeof Se=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(ie!==Et||gt!==He)&&gT(h,O,b,He),Qt=!1,gt=h.memoizedState,O.state=gt,Va(h,b,O,C),qn();var yt=h.memoizedState;ie!==Et||gt!==yt||Qt||c!==null&&c.dependencies!==null&&V0(c.dependencies)?(typeof Se=="function"&&(mj(h,p,Se,b),yt=h.memoizedState),(At=Qt||xT(h,p,At,b,gt,yt,He)||c!==null&&c.dependencies!==null&&V0(c.dependencies))?(xt||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(b,yt,He),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(b,yt,He)),typeof O.componentDidUpdate=="function"&&(h.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof O.componentDidUpdate!="function"||ie===c.memoizedProps&&gt===c.memoizedState||(h.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||ie===c.memoizedProps&&gt===c.memoizedState||(h.flags|=1024),h.memoizedProps=b,h.memoizedState=yt),O.props=b,O.state=yt,O.context=He,b=At):(typeof O.componentDidUpdate!="function"||ie===c.memoizedProps&&gt===c.memoizedState||(h.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||ie===c.memoizedProps&&gt===c.memoizedState||(h.flags|=1024),b=!1)}return O=b,ny(c,h),b=(h.flags&128)!==0,O||b?(O=h.stateNode,p=b&&typeof p.getDerivedStateFromError!="function"?null:O.render(),h.flags|=1,c!==null&&b?(h.child=ta(h,c.child,null,C),h.child=ta(h,null,p,C)):js(c,h,p,C),h.memoizedState=O.state,c=h.child):c=Sd(c,h,C),c}function DT(c,h,p,b){return yd(),h.flags|=256,js(c,h,p,b),h.child}var yj={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bj(c){return{baseLanes:c,cachePool:Fe()}}function wj(c,h,p){return c=c!==null?c.childLanes&~p:0,h&&(c|=nl),c}function OT(c,h,p){var b=h.pendingProps,C=!1,O=(h.flags&128)!==0,ie;if((ie=O)||(ie=c!==null&&c.memoizedState===null?!1:(ln.current&2)!==0),ie&&(C=!0,h.flags&=-129),ie=(h.flags&32)!==0,h.flags&=-33,c===null){if(tn){if(C?La(h):Ga(),(c=ea)?(c=U6(c,Ca),c=c!==null&&c.data!=="&"?c:null,c!==null&&(h.memoizedState={dehydrated:c,treeContext:nu!==null?{id:Ao,overflow:ko}:null,retryLane:536870912,hydrationErrors:null},p=B0(c),p.return=h,h.child=p,Ti=h,ea=null)):c=null,c===null)throw au(h);return nN(c)?h.lanes=32:h.lanes=536870912,null}var Se=b.children;return b=b.fallback,C?(Ga(),C=h.mode,Se=ay({mode:"hidden",children:Se},C),b=ru(b,C,p,null),Se.return=h,b.return=h,Se.sibling=b,h.child=Se,b=h.child,b.memoizedState=bj(p),b.childLanes=wj(c,ie,p),h.memoizedState=yj,ig(null,b)):(La(h),jj(h,Se))}var He=c.memoizedState;if(He!==null&&(Se=He.dehydrated,Se!==null)){if(O)h.flags&256?(La(h),h.flags&=-257,h=Nj(c,h,p)):h.memoizedState!==null?(Ga(),h.child=c.child,h.flags|=128,h=null):(Ga(),Se=b.fallback,C=h.mode,b=ay({mode:"visible",children:b.children},C),Se=ru(Se,C,p,null),Se.flags|=2,b.return=h,Se.return=h,b.sibling=Se,h.child=b,ta(h,c.child,null,p),b=h.child,b.memoizedState=bj(p),b.childLanes=wj(c,ie,p),h.memoizedState=yj,h=ig(null,b));else if(La(h),nN(Se)){if(ie=Se.nextSibling&&Se.nextSibling.dataset,ie)var xt=ie.dgst;ie=xt,b=Error(n(419)),b.stack="",b.digest=ie,Tf({value:b,source:null,stack:null}),h=Nj(c,h,p)}else if(gi||ou(c,h,p,!1),ie=(p&c.childLanes)!==0,gi||ie){if(ie=ra,ie!==null&&(b=qr(ie,p),b!==0&&b!==He.retryLane))throw He.retryLane=b,dc(c,b),Oo(ie,c,b),gj;rN(Se)||hy(),h=Nj(c,h,p)}else rN(Se)?(h.flags|=192,h.child=c.child,h=null):(c=He.treeContext,ea=_l(Se.nextSibling),Ti=h,tn=!0,bs=null,Ca=!1,c!==null&&W1(h,c),h=jj(h,b.children),h.flags|=4096);return h}return C?(Ga(),Se=b.fallback,C=h.mode,He=c.child,xt=He.sibling,b=wo(He,{mode:"hidden",children:b.children}),b.subtreeFlags=He.subtreeFlags&65011712,xt!==null?Se=wo(xt,Se):(Se=ru(Se,C,p,null),Se.flags|=2),Se.return=h,b.return=h,b.sibling=Se,h.child=b,ig(null,b),b=h.child,Se=c.child.memoizedState,Se===null?Se=bj(p):(C=Se.cachePool,C!==null?(He=Ma._currentValue,C=C.parent!==He?{parent:He,pool:He}:C):C=Fe(),Se={baseLanes:Se.baseLanes|p,cachePool:C}),b.memoizedState=Se,b.childLanes=wj(c,ie,p),h.memoizedState=yj,ig(c.child,b)):(La(h),p=c.child,c=p.sibling,p=wo(p,{mode:"visible",children:b.children}),p.return=h,p.sibling=null,c!==null&&(ie=h.deletions,ie===null?(h.deletions=[c],h.flags|=16):ie.push(c)),h.child=p,h.memoizedState=null,p)}function jj(c,h){return h=ay({mode:"visible",children:h},c.mode),h.return=c,c.child=h}function ay(c,h){return c=Qi(22,c,null,h),c.lanes=0,c}function Nj(c,h,p){return ta(h,c.child,null,p),c=jj(h,h.pendingProps.children),c.flags|=2,h.memoizedState=null,c}function RT(c,h,p){c.lanes|=h;var b=c.alternate;b!==null&&(b.lanes|=h),Pf(c.return,h,p)}function Sj(c,h,p,b,C,O){var ie=c.memoizedState;ie===null?c.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:b,tail:p,tailMode:C,treeForkCount:O}:(ie.isBackwards=h,ie.rendering=null,ie.renderingStartTime=0,ie.last=b,ie.tail=p,ie.tailMode=C,ie.treeForkCount=O)}function MT(c,h,p){var b=h.pendingProps,C=b.revealOrder,O=b.tail;b=b.children;var ie=ln.current,Se=(ie&2)!==0;if(Se?(ie=ie&1|2,h.flags|=128):ie&=1,H(ln,ie),js(c,h,b,p),b=tn?om:0,!Se&&c!==null&&(c.flags&128)!==0)e:for(c=h.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&RT(c,p,h);else if(c.tag===19)RT(c,p,h);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===h)break e;for(;c.sibling===null;){if(c.return===null||c.return===h)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}switch(C){case"forwards":for(p=h.child,C=null;p!==null;)c=p.alternate,c!==null&&ts(c)===null&&(C=p),p=p.sibling;p=C,p===null?(C=h.child,h.child=null):(C=p.sibling,p.sibling=null),Sj(h,!1,C,p,O,b);break;case"backwards":case"unstable_legacy-backwards":for(p=null,C=h.child,h.child=null;C!==null;){if(c=C.alternate,c!==null&&ts(c)===null){h.child=C;break}c=C.sibling,C.sibling=p,p=C,C=c}Sj(h,!0,p,null,O,b);break;case"together":Sj(h,!1,null,null,void 0,b);break;default:h.memoizedState=null}return h.child}function Sd(c,h,p){if(c!==null&&(h.dependencies=c.dependencies),Bf|=h.lanes,(p&h.childLanes)===0)if(c!==null){if(ou(c,h,p,!1),(p&h.childLanes)===0)return null}else return null;if(c!==null&&h.child!==c.child)throw Error(n(153));if(h.child!==null){for(c=h.child,p=wo(c,c.pendingProps),h.child=p,p.return=h;c.sibling!==null;)c=c.sibling,p=p.sibling=wo(c,c.pendingProps),p.return=h;p.sibling=null}return h.child}function Aj(c,h){return(c.lanes&h)!==0?!0:(c=c.dependencies,!!(c!==null&&V0(c)))}function hK(c,h,p){switch(h.tag){case 3:oe(h,h.stateNode.containerInfo),su(h,Ma,c.memoizedState.cache),yd();break;case 27:case 5:fe(h);break;case 4:oe(h,h.stateNode.containerInfo);break;case 10:su(h,h.type,h.memoizedProps.value);break;case 31:if(h.memoizedState!==null)return h.flags|=128,Cn(h),null;break;case 13:var b=h.memoizedState;if(b!==null)return b.dehydrated!==null?(La(h),h.flags|=128,null):(p&h.child.childLanes)!==0?OT(c,h,p):(La(h),c=Sd(c,h,p),c!==null?c.sibling:null);La(h);break;case 19:var C=(c.flags&128)!==0;if(b=(p&h.childLanes)!==0,b||(ou(c,h,p,!1),b=(p&h.childLanes)!==0),C){if(b)return MT(c,h,p);h.flags|=128}if(C=h.memoizedState,C!==null&&(C.rendering=null,C.tail=null,C.lastEffect=null),H(ln,ln.current),b)break;return null;case 22:return h.lanes=0,CT(c,h,p,h.pendingProps);case 24:su(h,Ma,c.memoizedState.cache)}return Sd(c,h,p)}function LT(c,h,p){if(c!==null)if(c.memoizedProps!==h.pendingProps)gi=!0;else{if(!Aj(c,p)&&(h.flags&128)===0)return gi=!1,hK(c,h,p);gi=(c.flags&131072)!==0}else gi=!1,tn&&(h.flags&1048576)!==0&&q1(h,om,h.index);switch(h.lanes=0,h.tag){case 16:e:{var b=h.pendingProps;if(c=ut(h.elementType),h.type=c,typeof c=="function")F0(c)?(b=fm(c,b),h.tag=1,h=PT(null,h,c,b,p)):(h.tag=0,h=vj(null,h,c,b,p));else{if(c!=null){var C=c.$$typeof;if(C===T){h.tag=11,h=ST(null,h,c,b,p);break e}else if(C===L){h.tag=14,h=AT(null,h,c,b,p);break e}}throw h=ee(c)||c,Error(n(306,h,""))}}return h;case 0:return vj(c,h,h.type,h.pendingProps,p);case 1:return b=h.type,C=fm(b,h.pendingProps),PT(c,h,b,C,p);case 3:e:{if(oe(h,h.stateNode.containerInfo),c===null)throw Error(n(387));b=h.pendingProps;var O=h.memoizedState;C=O.element,ha(c,h),Va(h,b,null,p);var ie=h.memoizedState;if(b=ie.cache,su(h,Ma,b),b!==O.cache&&bd(h,[Ma],p,!0),qn(),b=ie.element,O.isDehydrated)if(O={element:b,isDehydrated:!1,cache:ie.cache},h.updateQueue.baseState=O,h.memoizedState=O,h.flags&256){h=DT(c,h,b,p);break e}else if(b!==C){C=jo(Error(n(424)),h),Tf(C),h=DT(c,h,b,p);break e}else{switch(c=h.stateNode.containerInfo,c.nodeType){case 9:c=c.body;break;default:c=c.nodeName==="HTML"?c.ownerDocument.body:c}for(ea=_l(c.firstChild),Ti=h,tn=!0,bs=null,Ca=!0,p=Lr(h,null,b,p),h.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(yd(),b===C){h=Sd(c,h,p);break e}js(c,h,b,p)}h=h.child}return h;case 26:return ny(c,h),c===null?(p=G6(h.type,null,h.pendingProps,null))?h.memoizedState=p:tn||(p=h.type,c=h.pendingProps,b=by(re.current).createElement(p),b[Te]=h,b[Re]=c,Ns(b,p,c),er(b),h.stateNode=b):h.memoizedState=G6(h.type,c.memoizedProps,h.pendingProps,c.memoizedState),null;case 27:return fe(h),c===null&&tn&&(b=h.stateNode=V6(h.type,h.pendingProps,re.current),Ti=h,Ca=!0,C=ea,Vf(h.type)?(aN=C,ea=_l(b.firstChild)):ea=C),js(c,h,h.pendingProps.children,p),ny(c,h),c===null&&(h.flags|=4194304),h.child;case 5:return c===null&&tn&&((C=b=ea)&&(b=HK(b,h.type,h.pendingProps,Ca),b!==null?(h.stateNode=b,Ti=h,ea=_l(b.firstChild),Ca=!1,C=!0):C=!1),C||au(h)),fe(h),C=h.type,O=h.pendingProps,ie=c!==null?c.memoizedProps:null,b=O.children,Qj(C,O)?b=null:ie!==null&&Qj(C,ie)&&(h.flags|=32),h.memoizedState!==null&&(C=Xx(c,h,sj,null,null,p),bg._currentValue=C),ny(c,h),js(c,h,b,p),h.child;case 6:return c===null&&tn&&((c=p=ea)&&(p=VK(p,h.pendingProps,Ca),p!==null?(h.stateNode=p,Ti=h,ea=null,c=!0):c=!1),c||au(h)),null;case 13:return OT(c,h,p);case 4:return oe(h,h.stateNode.containerInfo),b=h.pendingProps,c===null?h.child=ta(h,null,b,p):js(c,h,b,p),h.child;case 11:return ST(c,h,h.type,h.pendingProps,p);case 7:return js(c,h,h.pendingProps,p),h.child;case 8:return js(c,h,h.pendingProps.children,p),h.child;case 12:return js(c,h,h.pendingProps.children,p),h.child;case 10:return b=h.pendingProps,su(h,h.type,b.value),js(c,h,b.children,p),h.child;case 9:return C=h.type._context,b=h.pendingProps.children,lu(h),C=Di(C),b=b(C),h.flags|=1,js(c,h,b,p),h.child;case 14:return AT(c,h,h.type,h.pendingProps,p);case 15:return kT(c,h,h.type,h.pendingProps,p);case 19:return MT(c,h,p);case 31:return fK(c,h,p);case 22:return CT(c,h,p,h.pendingProps);case 24:return lu(h),b=Di(Ma),c===null?(C=Ce(),C===null&&(C=ra,O=Df(),C.pooledCache=O,O.refCount++,O!==null&&(C.pooledCacheLanes|=p),C=O),h.memoizedState={parent:b,cache:C},Kt(h),su(h,Ma,C)):((c.lanes&p)!==0&&(ha(c,h),Va(h,null,null,p),qn()),C=c.memoizedState,O=h.memoizedState,C.parent!==b?(C={parent:b,cache:b},h.memoizedState=C,h.lanes===0&&(h.memoizedState=h.updateQueue.baseState=C),su(h,Ma,b)):(b=O.cache,su(h,Ma,b),b!==C.cache&&bd(h,[Ma],p,!0))),js(c,h,h.pendingProps.children,p),h.child;case 29:throw h.pendingProps}throw Error(n(156,h.tag))}function Ad(c){c.flags|=4}function kj(c,h,p,b,C){if((h=(c.mode&32)!==0)&&(h=!1),h){if(c.flags|=16777216,(C&335544128)===C)if(c.stateNode.complete)c.flags|=8192;else if(c6())c.flags|=8192;else throw wt=Qe,ht}else c.flags&=-16777217}function IT(c,h){if(h.type!=="stylesheet"||(h.state.loading&4)!==0)c.flags&=-16777217;else if(c.flags|=16777216,!J6(h))if(c6())c.flags|=8192;else throw wt=Qe,ht}function iy(c,h){h!==null&&(c.flags|=4),c.flags&16384&&(h=c.tag!==22?Er():536870912,c.lanes|=h,ip|=h)}function sg(c,h){if(!tn)switch(c.tailMode){case"hidden":h=c.tail;for(var p=null;h!==null;)h.alternate!==null&&(p=h),h=h.sibling;p===null?c.tail=null:p.sibling=null;break;case"collapsed":p=c.tail;for(var b=null;p!==null;)p.alternate!==null&&(b=p),p=p.sibling;b===null?h||c.tail===null?c.tail=null:c.tail.sibling=null:b.sibling=null}}function xa(c){var h=c.alternate!==null&&c.alternate.child===c.child,p=0,b=0;if(h)for(var C=c.child;C!==null;)p|=C.lanes|C.childLanes,b|=C.subtreeFlags&65011712,b|=C.flags&65011712,C.return=c,C=C.sibling;else for(C=c.child;C!==null;)p|=C.lanes|C.childLanes,b|=C.subtreeFlags,b|=C.flags,C.return=c,C=C.sibling;return c.subtreeFlags|=b,c.childLanes=p,h}function mK(c,h,p){var b=h.pendingProps;switch($0(h),h.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xa(h),null;case 1:return xa(h),null;case 3:return p=h.stateNode,b=null,c!==null&&(b=c.memoizedState.cache),h.memoizedState.cache!==b&&(h.flags|=2048),Co(Ma),z(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(c===null||c.child===null)&&(Pi(h)?Ad(h):c===null||c.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,Yx())),xa(h),null;case 26:var C=h.type,O=h.memoizedState;return c===null?(Ad(h),O!==null?(xa(h),IT(h,O)):(xa(h),kj(h,C,null,b,p))):O?O!==c.memoizedState?(Ad(h),xa(h),IT(h,O)):(xa(h),h.flags&=-16777217):(c=c.memoizedProps,c!==b&&Ad(h),xa(h),kj(h,C,c,b,p)),null;case 27:if(de(h),p=re.current,C=h.type,c!==null&&h.stateNode!=null)c.memoizedProps!==b&&Ad(h);else{if(!b){if(h.stateNode===null)throw Error(n(166));return xa(h),null}c=G.current,Pi(h)?Gx(h):(c=V6(C,b,p),h.stateNode=c,Ad(h))}return xa(h),null;case 5:if(de(h),C=h.type,c!==null&&h.stateNode!=null)c.memoizedProps!==b&&Ad(h);else{if(!b){if(h.stateNode===null)throw Error(n(166));return xa(h),null}if(O=G.current,Pi(h))Gx(h);else{var ie=by(re.current);switch(O){case 1:O=ie.createElementNS("http://www.w3.org/2000/svg",C);break;case 2:O=ie.createElementNS("http://www.w3.org/1998/Math/MathML",C);break;default:switch(C){case"svg":O=ie.createElementNS("http://www.w3.org/2000/svg",C);break;case"math":O=ie.createElementNS("http://www.w3.org/1998/Math/MathML",C);break;case"script":O=ie.createElement("div"),O.innerHTML="<script><\/script>",O=O.removeChild(O.firstChild);break;case"select":O=typeof b.is=="string"?ie.createElement("select",{is:b.is}):ie.createElement("select"),b.multiple?O.multiple=!0:b.size&&(O.size=b.size);break;default:O=typeof b.is=="string"?ie.createElement(C,{is:b.is}):ie.createElement(C)}}O[Te]=h,O[Re]=b;e:for(ie=h.child;ie!==null;){if(ie.tag===5||ie.tag===6)O.appendChild(ie.stateNode);else if(ie.tag!==4&&ie.tag!==27&&ie.child!==null){ie.child.return=ie,ie=ie.child;continue}if(ie===h)break e;for(;ie.sibling===null;){if(ie.return===null||ie.return===h)break e;ie=ie.return}ie.sibling.return=ie.return,ie=ie.sibling}h.stateNode=O;e:switch(Ns(O,C,b),C){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}b&&Ad(h)}}return xa(h),kj(h,h.type,c===null?null:c.memoizedProps,h.pendingProps,p),null;case 6:if(c&&h.stateNode!=null)c.memoizedProps!==b&&Ad(h);else{if(typeof b!="string"&&h.stateNode===null)throw Error(n(166));if(c=re.current,Pi(h)){if(c=h.stateNode,p=h.memoizedProps,b=null,C=Ti,C!==null)switch(C.tag){case 27:case 5:b=C.memoizedProps}c[Te]=h,c=!!(c.nodeValue===p||b!==null&&b.suppressHydrationWarning===!0||O6(c.nodeValue,p)),c||au(h,!0)}else c=by(c).createTextNode(b),c[Te]=h,h.stateNode=c}return xa(h),null;case 31:if(p=h.memoizedState,c===null||c.memoizedState!==null){if(b=Pi(h),p!==null){if(c===null){if(!b)throw Error(n(318));if(c=h.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(n(557));c[Te]=h}else yd(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;xa(h),c=!1}else p=Yx(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=p),c=!0;if(!c)return h.flags&256?(Ln(h),h):(Ln(h),null);if((h.flags&128)!==0)throw Error(n(558))}return xa(h),null;case 13:if(b=h.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(C=Pi(h),b!==null&&b.dehydrated!==null){if(c===null){if(!C)throw Error(n(318));if(C=h.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(n(317));C[Te]=h}else yd(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;xa(h),C=!1}else C=Yx(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=C),C=!0;if(!C)return h.flags&256?(Ln(h),h):(Ln(h),null)}return Ln(h),(h.flags&128)!==0?(h.lanes=p,h):(p=b!==null,c=c!==null&&c.memoizedState!==null,p&&(b=h.child,C=null,b.alternate!==null&&b.alternate.memoizedState!==null&&b.alternate.memoizedState.cachePool!==null&&(C=b.alternate.memoizedState.cachePool.pool),O=null,b.memoizedState!==null&&b.memoizedState.cachePool!==null&&(O=b.memoizedState.cachePool.pool),O!==C&&(b.flags|=2048)),p!==c&&p&&(h.child.flags|=8192),iy(h,h.updateQueue),xa(h),null);case 4:return z(),c===null&&Yj(h.stateNode.containerInfo),xa(h),null;case 10:return Co(h.type),xa(h),null;case 19:if(D(ln),b=h.memoizedState,b===null)return xa(h),null;if(C=(h.flags&128)!==0,O=b.rendering,O===null)if(C)sg(b,!1);else{if(Ka!==0||c!==null&&(c.flags&128)!==0)for(c=h.child;c!==null;){if(O=ts(c),O!==null){for(h.flags|=128,sg(b,!1),c=O.updateQueue,h.updateQueue=c,iy(h,c),h.subtreeFlags=0,c=p,p=h.child;p!==null;)im(p,c),p=p.sibling;return H(ln,ln.current&1|2),tn&&ro(h,b.treeForkCount),h.child}c=c.sibling}b.tail!==null&&we()>uy&&(h.flags|=128,C=!0,sg(b,!1),h.lanes=4194304)}else{if(!C)if(c=ts(O),c!==null){if(h.flags|=128,C=!0,c=c.updateQueue,h.updateQueue=c,iy(h,c),sg(b,!0),b.tail===null&&b.tailMode==="hidden"&&!O.alternate&&!tn)return xa(h),null}else 2*we()-b.renderingStartTime>uy&&p!==536870912&&(h.flags|=128,C=!0,sg(b,!1),h.lanes=4194304);b.isBackwards?(O.sibling=h.child,h.child=O):(c=b.last,c!==null?c.sibling=O:h.child=O,b.last=O)}return b.tail!==null?(c=b.tail,b.rendering=c,b.tail=c.sibling,b.renderingStartTime=we(),c.sibling=null,p=ln.current,H(ln,C?p&1|2:p&1),tn&&ro(h,b.treeForkCount),c):(xa(h),null);case 22:case 23:return Ln(h),si(),b=h.memoizedState!==null,c!==null?c.memoizedState!==null!==b&&(h.flags|=8192):b&&(h.flags|=8192),b?(p&536870912)!==0&&(h.flags&128)===0&&(xa(h),h.subtreeFlags&6&&(h.flags|=8192)):xa(h),p=h.updateQueue,p!==null&&iy(h,p.retryQueue),p=null,c!==null&&c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),b=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(b=h.memoizedState.cachePool.pool),b!==p&&(h.flags|=2048),c!==null&&D(je),null;case 24:return p=null,c!==null&&(p=c.memoizedState.cache),h.memoizedState.cache!==p&&(h.flags|=2048),Co(Ma),xa(h),null;case 25:return null;case 30:return null}throw Error(n(156,h.tag))}function pK(c,h){switch($0(h),h.tag){case 1:return c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 3:return Co(Ma),z(),c=h.flags,(c&65536)!==0&&(c&128)===0?(h.flags=c&-65537|128,h):null;case 26:case 27:case 5:return de(h),null;case 31:if(h.memoizedState!==null){if(Ln(h),h.alternate===null)throw Error(n(340));yd()}return c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 13:if(Ln(h),c=h.memoizedState,c!==null&&c.dehydrated!==null){if(h.alternate===null)throw Error(n(340));yd()}return c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 19:return D(ln),null;case 4:return z(),null;case 10:return Co(h.type),null;case 22:case 23:return Ln(h),si(),c!==null&&D(je),c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 24:return Co(Ma),null;case 25:return null;default:return null}}function FT(c,h){switch($0(h),h.tag){case 3:Co(Ma),z();break;case 26:case 27:case 5:de(h);break;case 4:z();break;case 31:h.memoizedState!==null&&Ln(h);break;case 13:Ln(h);break;case 19:D(ln);break;case 10:Co(h.type);break;case 22:case 23:Ln(h),si(),c!==null&&D(je);break;case 24:Co(Ma)}}function og(c,h){try{var p=h.updateQueue,b=p!==null?p.lastEffect:null;if(b!==null){var C=b.next;p=C;do{if((p.tag&c)===c){b=void 0;var O=p.create,ie=p.inst;b=O(),ie.destroy=b}p=p.next}while(p!==C)}}catch(Se){Fn(h,h.return,Se)}}function If(c,h,p){try{var b=h.updateQueue,C=b!==null?b.lastEffect:null;if(C!==null){var O=C.next;b=O;do{if((b.tag&c)===c){var ie=b.inst,Se=ie.destroy;if(Se!==void 0){ie.destroy=void 0,C=h;var He=p,xt=Se;try{xt()}catch(At){Fn(C,He,At)}}}b=b.next}while(b!==O)}}catch(At){Fn(h,h.return,At)}}function BT(c){var h=c.updateQueue;if(h!==null){var p=c.stateNode;try{qa(h,p)}catch(b){Fn(c,c.return,b)}}}function zT(c,h,p){p.props=fm(c.type,c.memoizedProps),p.state=c.memoizedState;try{p.componentWillUnmount()}catch(b){Fn(c,h,b)}}function lg(c,h){try{var p=c.ref;if(p!==null){switch(c.tag){case 26:case 27:case 5:var b=c.stateNode;break;case 30:b=c.stateNode;break;default:b=c.stateNode}typeof p=="function"?c.refCleanup=p(b):p.current=b}}catch(C){Fn(c,h,C)}}function hu(c,h){var p=c.ref,b=c.refCleanup;if(p!==null)if(typeof b=="function")try{b()}catch(C){Fn(c,h,C)}finally{c.refCleanup=null,c=c.alternate,c!=null&&(c.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(C){Fn(c,h,C)}else p.current=null}function UT(c){var h=c.type,p=c.memoizedProps,b=c.stateNode;try{e:switch(h){case"button":case"input":case"select":case"textarea":p.autoFocus&&b.focus();break e;case"img":p.src?b.src=p.src:p.srcSet&&(b.srcset=p.srcSet)}}catch(C){Fn(c,c.return,C)}}function Cj(c,h,p){try{var b=c.stateNode;IK(b,c.type,p,h),b[Re]=h}catch(C){Fn(c,c.return,C)}}function $T(c){return c.tag===5||c.tag===3||c.tag===26||c.tag===27&&Vf(c.type)||c.tag===4}function _j(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||$T(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.tag===27&&Vf(c.type)||c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function Ej(c,h,p){var b=c.tag;if(b===5||b===6)c=c.stateNode,h?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(c,h):(h=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,h.appendChild(c),p=p._reactRootContainer,p!=null||h.onclick!==null||(h.onclick=xo));else if(b!==4&&(b===27&&Vf(c.type)&&(p=c.stateNode,h=null),c=c.child,c!==null))for(Ej(c,h,p),c=c.sibling;c!==null;)Ej(c,h,p),c=c.sibling}function sy(c,h,p){var b=c.tag;if(b===5||b===6)c=c.stateNode,h?p.insertBefore(c,h):p.appendChild(c);else if(b!==4&&(b===27&&Vf(c.type)&&(p=c.stateNode),c=c.child,c!==null))for(sy(c,h,p),c=c.sibling;c!==null;)sy(c,h,p),c=c.sibling}function HT(c){var h=c.stateNode,p=c.memoizedProps;try{for(var b=c.type,C=h.attributes;C.length;)h.removeAttributeNode(C[0]);Ns(h,b,p),h[Te]=c,h[Re]=p}catch(O){Fn(c,c.return,O)}}var kd=!1,vi=!1,Tj=!1,VT=typeof WeakSet=="function"?WeakSet:Set,rs=null;function xK(c,h){if(c=c.containerInfo,Zj=Cy,c=hd(c),uc(c)){if("selectionStart"in c)var p={start:c.selectionStart,end:c.selectionEnd};else e:{p=(p=c.ownerDocument)&&p.defaultView||window;var b=p.getSelection&&p.getSelection();if(b&&b.rangeCount!==0){p=b.anchorNode;var C=b.anchorOffset,O=b.focusNode;b=b.focusOffset;try{p.nodeType,O.nodeType}catch{p=null;break e}var ie=0,Se=-1,He=-1,xt=0,At=0,Et=c,gt=null;t:for(;;){for(var yt;Et!==p||C!==0&&Et.nodeType!==3||(Se=ie+C),Et!==O||b!==0&&Et.nodeType!==3||(He=ie+b),Et.nodeType===3&&(ie+=Et.nodeValue.length),(yt=Et.firstChild)!==null;)gt=Et,Et=yt;for(;;){if(Et===c)break t;if(gt===p&&++xt===C&&(Se=ie),gt===O&&++At===b&&(He=ie),(yt=Et.nextSibling)!==null)break;Et=gt,gt=Et.parentNode}Et=yt}p=Se===-1||He===-1?null:{start:Se,end:He}}else p=null}p=p||{start:0,end:0}}else p=null;for(Jj={focusedElem:c,selectionRange:p},Cy=!1,rs=h;rs!==null;)if(h=rs,c=h.child,(h.subtreeFlags&1028)!==0&&c!==null)c.return=h,rs=c;else for(;rs!==null;){switch(h=rs,O=h.alternate,c=h.flags,h.tag){case 0:if((c&4)!==0&&(c=h.updateQueue,c=c!==null?c.events:null,c!==null))for(p=0;p<c.length;p++)C=c[p],C.ref.impl=C.nextImpl;break;case 11:case 15:break;case 1:if((c&1024)!==0&&O!==null){c=void 0,p=h,C=O.memoizedProps,O=O.memoizedState,b=p.stateNode;try{var lr=fm(p.type,C);c=b.getSnapshotBeforeUpdate(lr,O),b.__reactInternalSnapshotBeforeUpdate=c}catch(Ar){Fn(p,p.return,Ar)}}break;case 3:if((c&1024)!==0){if(c=h.stateNode.containerInfo,p=c.nodeType,p===9)tN(c);else if(p===1)switch(c.nodeName){case"HEAD":case"HTML":case"BODY":tN(c);break;default:c.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((c&1024)!==0)throw Error(n(163))}if(c=h.sibling,c!==null){c.return=h.return,rs=c;break}rs=h.return}}function qT(c,h,p){var b=p.flags;switch(p.tag){case 0:case 11:case 15:_d(c,p),b&4&&og(5,p);break;case 1:if(_d(c,p),b&4)if(c=p.stateNode,h===null)try{c.componentDidMount()}catch(ie){Fn(p,p.return,ie)}else{var C=fm(p.type,h.memoizedProps);h=h.memoizedState;try{c.componentDidUpdate(C,h,c.__reactInternalSnapshotBeforeUpdate)}catch(ie){Fn(p,p.return,ie)}}b&64&&BT(p),b&512&&lg(p,p.return);break;case 3:if(_d(c,p),b&64&&(c=p.updateQueue,c!==null)){if(h=null,p.child!==null)switch(p.child.tag){case 27:case 5:h=p.child.stateNode;break;case 1:h=p.child.stateNode}try{qa(c,h)}catch(ie){Fn(p,p.return,ie)}}break;case 27:h===null&&b&4&&HT(p);case 26:case 5:_d(c,p),h===null&&b&4&&UT(p),b&512&&lg(p,p.return);break;case 12:_d(c,p);break;case 31:_d(c,p),b&4&&YT(c,p);break;case 13:_d(c,p),b&4&&KT(c,p),b&64&&(c=p.memoizedState,c!==null&&(c=c.dehydrated,c!==null&&(p=AK.bind(null,p),qK(c,p))));break;case 22:if(b=p.memoizedState!==null||kd,!b){h=h!==null&&h.memoizedState!==null||vi,C=kd;var O=vi;kd=b,(vi=h)&&!O?Ed(c,p,(p.subtreeFlags&8772)!==0):_d(c,p),kd=C,vi=O}break;case 30:break;default:_d(c,p)}}function WT(c){var h=c.alternate;h!==null&&(c.alternate=null,WT(h)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(h=c.stateNode,h!==null&&Lt(h)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}var Ta=null,Eo=!1;function Cd(c,h,p){for(p=p.child;p!==null;)GT(c,h,p),p=p.sibling}function GT(c,h,p){if(st&&typeof st.onCommitFiberUnmount=="function")try{st.onCommitFiberUnmount(it,p)}catch{}switch(p.tag){case 26:vi||hu(p,h),Cd(c,h,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:vi||hu(p,h);var b=Ta,C=Eo;Vf(p.type)&&(Ta=p.stateNode,Eo=!1),Cd(c,h,p),gg(p.stateNode),Ta=b,Eo=C;break;case 5:vi||hu(p,h);case 6:if(b=Ta,C=Eo,Ta=null,Cd(c,h,p),Ta=b,Eo=C,Ta!==null)if(Eo)try{(Ta.nodeType===9?Ta.body:Ta.nodeName==="HTML"?Ta.ownerDocument.body:Ta).removeChild(p.stateNode)}catch(O){Fn(p,h,O)}else try{Ta.removeChild(p.stateNode)}catch(O){Fn(p,h,O)}break;case 18:Ta!==null&&(Eo?(c=Ta,B6(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,p.stateNode),hp(c)):B6(Ta,p.stateNode));break;case 4:b=Ta,C=Eo,Ta=p.stateNode.containerInfo,Eo=!0,Cd(c,h,p),Ta=b,Eo=C;break;case 0:case 11:case 14:case 15:If(2,p,h),vi||If(4,p,h),Cd(c,h,p);break;case 1:vi||(hu(p,h),b=p.stateNode,typeof b.componentWillUnmount=="function"&&zT(p,h,b)),Cd(c,h,p);break;case 21:Cd(c,h,p);break;case 22:vi=(b=vi)||p.memoizedState!==null,Cd(c,h,p),vi=b;break;default:Cd(c,h,p)}}function YT(c,h){if(h.memoizedState===null&&(c=h.alternate,c!==null&&(c=c.memoizedState,c!==null))){c=c.dehydrated;try{hp(c)}catch(p){Fn(h,h.return,p)}}}function KT(c,h){if(h.memoizedState===null&&(c=h.alternate,c!==null&&(c=c.memoizedState,c!==null&&(c=c.dehydrated,c!==null))))try{hp(c)}catch(p){Fn(h,h.return,p)}}function gK(c){switch(c.tag){case 31:case 13:case 19:var h=c.stateNode;return h===null&&(h=c.stateNode=new VT),h;case 22:return c=c.stateNode,h=c._retryCache,h===null&&(h=c._retryCache=new VT),h;default:throw Error(n(435,c.tag))}}function oy(c,h){var p=gK(c);h.forEach(function(b){if(!p.has(b)){p.add(b);var C=kK.bind(null,c,b);b.then(C,C)}})}function To(c,h){var p=h.deletions;if(p!==null)for(var b=0;b<p.length;b++){var C=p[b],O=c,ie=h,Se=ie;e:for(;Se!==null;){switch(Se.tag){case 27:if(Vf(Se.type)){Ta=Se.stateNode,Eo=!1;break e}break;case 5:Ta=Se.stateNode,Eo=!1;break e;case 3:case 4:Ta=Se.stateNode.containerInfo,Eo=!0;break e}Se=Se.return}if(Ta===null)throw Error(n(160));GT(O,ie,C),Ta=null,Eo=!1,O=C.alternate,O!==null&&(O.return=null),C.return=null}if(h.subtreeFlags&13886)for(h=h.child;h!==null;)XT(h,c),h=h.sibling}var gc=null;function XT(c,h){var p=c.alternate,b=c.flags;switch(c.tag){case 0:case 11:case 14:case 15:To(h,c),Po(c),b&4&&(If(3,c,c.return),og(3,c),If(5,c,c.return));break;case 1:To(h,c),Po(c),b&512&&(vi||p===null||hu(p,p.return)),b&64&&kd&&(c=c.updateQueue,c!==null&&(b=c.callbacks,b!==null&&(p=c.shared.hiddenCallbacks,c.shared.hiddenCallbacks=p===null?b:p.concat(b))));break;case 26:var C=gc;if(To(h,c),Po(c),b&512&&(vi||p===null||hu(p,p.return)),b&4){var O=p!==null?p.memoizedState:null;if(b=c.memoizedState,p===null)if(b===null)if(c.stateNode===null){e:{b=c.type,p=c.memoizedProps,C=C.ownerDocument||C;t:switch(b){case"title":O=C.getElementsByTagName("title")[0],(!O||O[mt]||O[Te]||O.namespaceURI==="http://www.w3.org/2000/svg"||O.hasAttribute("itemprop"))&&(O=C.createElement(b),C.head.insertBefore(O,C.querySelector("head > title"))),Ns(O,b,p),O[Te]=c,er(O),b=O;break e;case"link":var ie=X6("link","href",C).get(b+(p.href||""));if(ie){for(var Se=0;Se<ie.length;Se++)if(O=ie[Se],O.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&O.getAttribute("rel")===(p.rel==null?null:p.rel)&&O.getAttribute("title")===(p.title==null?null:p.title)&&O.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){ie.splice(Se,1);break t}}O=C.createElement(b),Ns(O,b,p),C.head.appendChild(O);break;case"meta":if(ie=X6("meta","content",C).get(b+(p.content||""))){for(Se=0;Se<ie.length;Se++)if(O=ie[Se],O.getAttribute("content")===(p.content==null?null:""+p.content)&&O.getAttribute("name")===(p.name==null?null:p.name)&&O.getAttribute("property")===(p.property==null?null:p.property)&&O.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&O.getAttribute("charset")===(p.charSet==null?null:p.charSet)){ie.splice(Se,1);break t}}O=C.createElement(b),Ns(O,b,p),C.head.appendChild(O);break;default:throw Error(n(468,b))}O[Te]=c,er(O),b=O}c.stateNode=b}else Z6(C,c.type,c.stateNode);else c.stateNode=K6(C,b,c.memoizedProps);else O!==b?(O===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):O.count--,b===null?Z6(C,c.type,c.stateNode):K6(C,b,c.memoizedProps)):b===null&&c.stateNode!==null&&Cj(c,c.memoizedProps,p.memoizedProps)}break;case 27:To(h,c),Po(c),b&512&&(vi||p===null||hu(p,p.return)),p!==null&&b&4&&Cj(c,c.memoizedProps,p.memoizedProps);break;case 5:if(To(h,c),Po(c),b&512&&(vi||p===null||hu(p,p.return)),c.flags&32){C=c.stateNode;try{ec(C,"")}catch(lr){Fn(c,c.return,lr)}}b&4&&c.stateNode!=null&&(C=c.memoizedProps,Cj(c,C,p!==null?p.memoizedProps:C)),b&1024&&(Tj=!0);break;case 6:if(To(h,c),Po(c),b&4){if(c.stateNode===null)throw Error(n(162));b=c.memoizedProps,p=c.stateNode;try{p.nodeValue=b}catch(lr){Fn(c,c.return,lr)}}break;case 3:if(Ny=null,C=gc,gc=wy(h.containerInfo),To(h,c),gc=C,Po(c),b&4&&p!==null&&p.memoizedState.isDehydrated)try{hp(h.containerInfo)}catch(lr){Fn(c,c.return,lr)}Tj&&(Tj=!1,ZT(c));break;case 4:b=gc,gc=wy(c.stateNode.containerInfo),To(h,c),Po(c),gc=b;break;case 12:To(h,c),Po(c);break;case 31:To(h,c),Po(c),b&4&&(b=c.updateQueue,b!==null&&(c.updateQueue=null,oy(c,b)));break;case 13:To(h,c),Po(c),c.child.flags&8192&&c.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(cy=we()),b&4&&(b=c.updateQueue,b!==null&&(c.updateQueue=null,oy(c,b)));break;case 22:C=c.memoizedState!==null;var He=p!==null&&p.memoizedState!==null,xt=kd,At=vi;if(kd=xt||C,vi=At||He,To(h,c),vi=At,kd=xt,Po(c),b&8192)e:for(h=c.stateNode,h._visibility=C?h._visibility&-2:h._visibility|1,C&&(p===null||He||kd||vi||hm(c)),p=null,h=c;;){if(h.tag===5||h.tag===26){if(p===null){He=p=h;try{if(O=He.stateNode,C)ie=O.style,typeof ie.setProperty=="function"?ie.setProperty("display","none","important"):ie.display="none";else{Se=He.stateNode;var Et=He.memoizedProps.style,gt=Et!=null&&Et.hasOwnProperty("display")?Et.display:null;Se.style.display=gt==null||typeof gt=="boolean"?"":(""+gt).trim()}}catch(lr){Fn(He,He.return,lr)}}}else if(h.tag===6){if(p===null){He=h;try{He.stateNode.nodeValue=C?"":He.memoizedProps}catch(lr){Fn(He,He.return,lr)}}}else if(h.tag===18){if(p===null){He=h;try{var yt=He.stateNode;C?z6(yt,!0):z6(He.stateNode,!1)}catch(lr){Fn(He,He.return,lr)}}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===c)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===c)break e;for(;h.sibling===null;){if(h.return===null||h.return===c)break e;p===h&&(p=null),h=h.return}p===h&&(p=null),h.sibling.return=h.return,h=h.sibling}b&4&&(b=c.updateQueue,b!==null&&(p=b.retryQueue,p!==null&&(b.retryQueue=null,oy(c,p))));break;case 19:To(h,c),Po(c),b&4&&(b=c.updateQueue,b!==null&&(c.updateQueue=null,oy(c,b)));break;case 30:break;case 21:break;default:To(h,c),Po(c)}}function Po(c){var h=c.flags;if(h&2){try{for(var p,b=c.return;b!==null;){if($T(b)){p=b;break}b=b.return}if(p==null)throw Error(n(160));switch(p.tag){case 27:var C=p.stateNode,O=_j(c);sy(c,O,C);break;case 5:var ie=p.stateNode;p.flags&32&&(ec(ie,""),p.flags&=-33);var Se=_j(c);sy(c,Se,ie);break;case 3:case 4:var He=p.stateNode.containerInfo,xt=_j(c);Ej(c,xt,He);break;default:throw Error(n(161))}}catch(At){Fn(c,c.return,At)}c.flags&=-3}h&4096&&(c.flags&=-4097)}function ZT(c){if(c.subtreeFlags&1024)for(c=c.child;c!==null;){var h=c;ZT(h),h.tag===5&&h.flags&1024&&h.stateNode.reset(),c=c.sibling}}function _d(c,h){if(h.subtreeFlags&8772)for(h=h.child;h!==null;)qT(c,h.alternate,h),h=h.sibling}function hm(c){for(c=c.child;c!==null;){var h=c;switch(h.tag){case 0:case 11:case 14:case 15:If(4,h,h.return),hm(h);break;case 1:hu(h,h.return);var p=h.stateNode;typeof p.componentWillUnmount=="function"&&zT(h,h.return,p),hm(h);break;case 27:gg(h.stateNode);case 26:case 5:hu(h,h.return),hm(h);break;case 22:h.memoizedState===null&&hm(h);break;case 30:hm(h);break;default:hm(h)}c=c.sibling}}function Ed(c,h,p){for(p=p&&(h.subtreeFlags&8772)!==0,h=h.child;h!==null;){var b=h.alternate,C=c,O=h,ie=O.flags;switch(O.tag){case 0:case 11:case 15:Ed(C,O,p),og(4,O);break;case 1:if(Ed(C,O,p),b=O,C=b.stateNode,typeof C.componentDidMount=="function")try{C.componentDidMount()}catch(xt){Fn(b,b.return,xt)}if(b=O,C=b.updateQueue,C!==null){var Se=b.stateNode;try{var He=C.shared.hiddenCallbacks;if(He!==null)for(C.shared.hiddenCallbacks=null,C=0;C<He.length;C++)es(He[C],Se)}catch(xt){Fn(b,b.return,xt)}}p&&ie&64&&BT(O),lg(O,O.return);break;case 27:HT(O);case 26:case 5:Ed(C,O,p),p&&b===null&&ie&4&&UT(O),lg(O,O.return);break;case 12:Ed(C,O,p);break;case 31:Ed(C,O,p),p&&ie&4&&YT(C,O);break;case 13:Ed(C,O,p),p&&ie&4&&KT(C,O);break;case 22:O.memoizedState===null&&Ed(C,O,p),lg(O,O.return);break;case 30:break;default:Ed(C,O,p)}h=h.sibling}}function Pj(c,h){var p=null;c!==null&&c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),c=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(c=h.memoizedState.cachePool.pool),c!==p&&(c!=null&&c.refCount++,p!=null&&lm(p))}function Dj(c,h){c=null,h.alternate!==null&&(c=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==c&&(h.refCount++,c!=null&&lm(c))}function vc(c,h,p,b){if(h.subtreeFlags&10256)for(h=h.child;h!==null;)JT(c,h,p,b),h=h.sibling}function JT(c,h,p,b){var C=h.flags;switch(h.tag){case 0:case 11:case 15:vc(c,h,p,b),C&2048&&og(9,h);break;case 1:vc(c,h,p,b);break;case 3:vc(c,h,p,b),C&2048&&(c=null,h.alternate!==null&&(c=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==c&&(h.refCount++,c!=null&&lm(c)));break;case 12:if(C&2048){vc(c,h,p,b),c=h.stateNode;try{var O=h.memoizedProps,ie=O.id,Se=O.onPostCommit;typeof Se=="function"&&Se(ie,h.alternate===null?"mount":"update",c.passiveEffectDuration,-0)}catch(He){Fn(h,h.return,He)}}else vc(c,h,p,b);break;case 31:vc(c,h,p,b);break;case 13:vc(c,h,p,b);break;case 23:break;case 22:O=h.stateNode,ie=h.alternate,h.memoizedState!==null?O._visibility&2?vc(c,h,p,b):cg(c,h):O._visibility&2?vc(c,h,p,b):(O._visibility|=2,rp(c,h,p,b,(h.subtreeFlags&10256)!==0||!1)),C&2048&&Pj(ie,h);break;case 24:vc(c,h,p,b),C&2048&&Dj(h.alternate,h);break;default:vc(c,h,p,b)}}function rp(c,h,p,b,C){for(C=C&&((h.subtreeFlags&10256)!==0||!1),h=h.child;h!==null;){var O=c,ie=h,Se=p,He=b,xt=ie.flags;switch(ie.tag){case 0:case 11:case 15:rp(O,ie,Se,He,C),og(8,ie);break;case 23:break;case 22:var At=ie.stateNode;ie.memoizedState!==null?At._visibility&2?rp(O,ie,Se,He,C):cg(O,ie):(At._visibility|=2,rp(O,ie,Se,He,C)),C&&xt&2048&&Pj(ie.alternate,ie);break;case 24:rp(O,ie,Se,He,C),C&&xt&2048&&Dj(ie.alternate,ie);break;default:rp(O,ie,Se,He,C)}h=h.sibling}}function cg(c,h){if(h.subtreeFlags&10256)for(h=h.child;h!==null;){var p=c,b=h,C=b.flags;switch(b.tag){case 22:cg(p,b),C&2048&&Pj(b.alternate,b);break;case 24:cg(p,b),C&2048&&Dj(b.alternate,b);break;default:cg(p,b)}h=h.sibling}}var ug=8192;function np(c,h,p){if(c.subtreeFlags&ug)for(c=c.child;c!==null;)QT(c,h,p),c=c.sibling}function QT(c,h,p){switch(c.tag){case 26:np(c,h,p),c.flags&ug&&c.memoizedState!==null&&nX(p,gc,c.memoizedState,c.memoizedProps);break;case 5:np(c,h,p);break;case 3:case 4:var b=gc;gc=wy(c.stateNode.containerInfo),np(c,h,p),gc=b;break;case 22:c.memoizedState===null&&(b=c.alternate,b!==null&&b.memoizedState!==null?(b=ug,ug=16777216,np(c,h,p),ug=b):np(c,h,p));break;default:np(c,h,p)}}function e6(c){var h=c.alternate;if(h!==null&&(c=h.child,c!==null)){h.child=null;do h=c.sibling,c.sibling=null,c=h;while(c!==null)}}function dg(c){var h=c.deletions;if((c.flags&16)!==0){if(h!==null)for(var p=0;p<h.length;p++){var b=h[p];rs=b,r6(b,c)}e6(c)}if(c.subtreeFlags&10256)for(c=c.child;c!==null;)t6(c),c=c.sibling}function t6(c){switch(c.tag){case 0:case 11:case 15:dg(c),c.flags&2048&&If(9,c,c.return);break;case 3:dg(c);break;case 12:dg(c);break;case 22:var h=c.stateNode;c.memoizedState!==null&&h._visibility&2&&(c.return===null||c.return.tag!==13)?(h._visibility&=-3,ly(c)):dg(c);break;default:dg(c)}}function ly(c){var h=c.deletions;if((c.flags&16)!==0){if(h!==null)for(var p=0;p<h.length;p++){var b=h[p];rs=b,r6(b,c)}e6(c)}for(c=c.child;c!==null;){switch(h=c,h.tag){case 0:case 11:case 15:If(8,h,h.return),ly(h);break;case 22:p=h.stateNode,p._visibility&2&&(p._visibility&=-3,ly(h));break;default:ly(h)}c=c.sibling}}function r6(c,h){for(;rs!==null;){var p=rs;switch(p.tag){case 0:case 11:case 15:If(8,p,h);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var b=p.memoizedState.cachePool.pool;b!=null&&b.refCount++}break;case 24:lm(p.memoizedState.cache)}if(b=p.child,b!==null)b.return=p,rs=b;else e:for(p=c;rs!==null;){b=rs;var C=b.sibling,O=b.return;if(WT(b),b===p){rs=null;break e}if(C!==null){C.return=O,rs=C;break e}rs=O}}}var vK={getCacheForType:function(c){var h=Di(Ma),p=h.data.get(c);return p===void 0&&(p=c(),h.data.set(c,p)),p},cacheSignal:function(){return Di(Ma).controller.signal}},yK=typeof WeakMap=="function"?WeakMap:Map,_n=0,ra=null,rn=null,an=0,In=0,rl=null,Ff=!1,ap=!1,Oj=!1,Td=0,Ka=0,Bf=0,mm=0,Rj=0,nl=0,ip=0,fg=null,Do=null,Mj=!1,cy=0,n6=0,uy=1/0,dy=null,zf=null,Ri=0,Uf=null,sp=null,Pd=0,Lj=0,Ij=null,a6=null,hg=0,Fj=null;function al(){return(_n&2)!==0&&an!==0?an&-an:Z.T!==null?Vj():ye()}function i6(){if(nl===0)if((an&536870912)===0||tn){var c=qt;qt<<=1,(qt&3932160)===0&&(qt=262144),nl=c}else nl=536870912;return c=pa.current,c!==null&&(c.flags|=32),nl}function Oo(c,h,p){(c===ra&&(In===2||In===9)||c.cancelPendingCommit!==null)&&(op(c,0),$f(c,an,nl,!1)),Ht(c,p),((_n&2)===0||c!==ra)&&(c===ra&&((_n&2)===0&&(mm|=p),Ka===4&&$f(c,an,nl,!1)),mu(c))}function s6(c,h,p){if((_n&6)!==0)throw Error(n(327));var b=!p&&(h&127)===0&&(h&c.expiredLanes)===0||wr(c,h),C=b?jK(c,h):zj(c,h,!0),O=b;do{if(C===0){ap&&!b&&$f(c,h,0,!1);break}else{if(p=c.current.alternate,O&&!bK(p)){C=zj(c,h,!1),O=!1;continue}if(C===2){if(O=h,c.errorRecoveryDisabledLanes&O)var ie=0;else ie=c.pendingLanes&-536870913,ie=ie!==0?ie:ie&536870912?536870912:0;if(ie!==0){h=ie;e:{var Se=c;C=fg;var He=Se.current.memoizedState.isDehydrated;if(He&&(op(Se,ie).flags|=256),ie=zj(Se,ie,!1),ie!==2){if(Oj&&!He){Se.errorRecoveryDisabledLanes|=O,mm|=O,C=4;break e}O=Do,Do=C,O!==null&&(Do===null?Do=O:Do.push.apply(Do,O))}C=ie}if(O=!1,C!==2)continue}}if(C===1){op(c,0),$f(c,h,0,!0);break}e:{switch(b=c,O=C,O){case 0:case 1:throw Error(n(345));case 4:if((h&4194048)!==h)break;case 6:$f(b,h,nl,!Ff);break e;case 2:Do=null;break;case 3:case 5:break;default:throw Error(n(329))}if((h&62914560)===h&&(C=cy+300-we(),10<C)){if($f(b,h,nl,!Ff),Rt(b,0,!0)!==0)break e;Pd=h,b.timeoutHandle=I6(o6.bind(null,b,p,Do,dy,Mj,h,nl,mm,ip,Ff,O,"Throttled",-0,0),C);break e}o6(b,p,Do,dy,Mj,h,nl,mm,ip,Ff,O,null,-0,0)}}break}while(!0);mu(c)}function o6(c,h,p,b,C,O,ie,Se,He,xt,At,Et,gt,yt){if(c.timeoutHandle=-1,Et=h.subtreeFlags,Et&8192||(Et&16785408)===16785408){Et={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xo},QT(h,O,Et);var lr=(O&62914560)===O?cy-we():(O&4194048)===O?n6-we():0;if(lr=aX(Et,lr),lr!==null){Pd=O,c.cancelPendingCommit=lr(p6.bind(null,c,h,O,p,b,C,ie,Se,He,At,Et,null,gt,yt)),$f(c,O,ie,!xt);return}}p6(c,h,O,p,b,C,ie,Se,He)}function bK(c){for(var h=c;;){var p=h.tag;if((p===0||p===11||p===15)&&h.flags&16384&&(p=h.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var b=0;b<p.length;b++){var C=p[b],O=C.getSnapshot;C=C.value;try{if(!Aa(O(),C))return!1}catch{return!1}}if(p=h.child,h.subtreeFlags&16384&&p!==null)p.return=h,h=p;else{if(h===c)break;for(;h.sibling===null;){if(h.return===null||h.return===c)return!0;h=h.return}h.sibling.return=h.return,h=h.sibling}}return!0}function $f(c,h,p,b){h&=~Rj,h&=~mm,c.suspendedLanes|=h,c.pingedLanes&=~h,b&&(c.warmLanes|=h),b=c.expirationTimes;for(var C=h;0<C;){var O=31-te(C),ie=1<<O;b[O]=-1,C&=~ie}p!==0&&Rr(c,p,h)}function fy(){return(_n&6)===0?(mg(0),!1):!0}function Bj(){if(rn!==null){if(In===0)var c=rn.return;else c=rn,Al=iu=null,K0(c),Tt=null,cr=0,c=rn;for(;c!==null;)FT(c.alternate,c),c=c.return;rn=null}}function op(c,h){var p=c.timeoutHandle;p!==-1&&(c.timeoutHandle=-1,zK(p)),p=c.cancelPendingCommit,p!==null&&(c.cancelPendingCommit=null,p()),Pd=0,Bj(),ra=c,rn=p=wo(c.current,null),an=h,In=0,rl=null,Ff=!1,ap=wr(c,h),Oj=!1,ip=nl=Rj=mm=Bf=Ka=0,Do=fg=null,Mj=!1,(h&8)!==0&&(h|=h&32);var b=c.entangledLanes;if(b!==0)for(c=c.entanglements,b&=h;0<b;){var C=31-te(b),O=1<<C;h|=c[C],b&=~O}return Td=h,rm(),p}function l6(c,h){pr=null,Z.H=ag,h===Ke||h===Le?(h=kt(),In=3):h===ht?(h=kt(),In=4):In=h===gj?8:h!==null&&typeof h=="object"&&typeof h.then=="function"?6:1,rl=h,rn===null&&(Ka=1,ty(c,jo(h,c.current)))}function c6(){var c=pa.current;return c===null?!0:(an&4194048)===an?fn===null:(an&62914560)===an||(an&536870912)!==0?c===fn:!1}function u6(){var c=Z.H;return Z.H=ag,c===null?ag:c}function d6(){var c=Z.A;return Z.A=vK,c}function hy(){Ka=4,Ff||(an&4194048)!==an&&pa.current!==null||(ap=!0),(Bf&134217727)===0&&(mm&134217727)===0||ra===null||$f(ra,an,nl,!1)}function zj(c,h,p){var b=_n;_n|=2;var C=u6(),O=d6();(ra!==c||an!==h)&&(dy=null,op(c,h)),h=!1;var ie=Ka;e:do try{if(In!==0&&rn!==null){var Se=rn,He=rl;switch(In){case 8:Bj(),ie=6;break e;case 3:case 2:case 9:case 6:pa.current===null&&(h=!0);var xt=In;if(In=0,rl=null,lp(c,Se,He,xt),p&&ap){ie=0;break e}break;default:xt=In,In=0,rl=null,lp(c,Se,He,xt)}}wK(),ie=Ka;break}catch(At){l6(c,At)}while(!0);return h&&c.shellSuspendCounter++,Al=iu=null,_n=b,Z.H=C,Z.A=O,rn===null&&(ra=null,an=0,rm()),ie}function wK(){for(;rn!==null;)f6(rn)}function jK(c,h){var p=_n;_n|=2;var b=u6(),C=d6();ra!==c||an!==h?(dy=null,uy=we()+500,op(c,h)):ap=wr(c,h);e:do try{if(In!==0&&rn!==null){h=rn;var O=rl;t:switch(In){case 1:In=0,rl=null,lp(c,h,O,1);break;case 2:case 9:if(lt(O)){In=0,rl=null,h6(h);break}h=function(){In!==2&&In!==9||ra!==c||(In=7),mu(c)},O.then(h,h);break e;case 3:In=7;break e;case 4:In=5;break e;case 7:lt(O)?(In=0,rl=null,h6(h)):(In=0,rl=null,lp(c,h,O,7));break;case 5:var ie=null;switch(rn.tag){case 26:ie=rn.memoizedState;case 5:case 27:var Se=rn;if(ie?J6(ie):Se.stateNode.complete){In=0,rl=null;var He=Se.sibling;if(He!==null)rn=He;else{var xt=Se.return;xt!==null?(rn=xt,my(xt)):rn=null}break t}}In=0,rl=null,lp(c,h,O,5);break;case 6:In=0,rl=null,lp(c,h,O,6);break;case 8:Bj(),Ka=6;break e;default:throw Error(n(462))}}NK();break}catch(At){l6(c,At)}while(!0);return Al=iu=null,Z.H=b,Z.A=C,_n=p,rn!==null?0:(ra=null,an=0,rm(),Ka)}function NK(){for(;rn!==null&&!at();)f6(rn)}function f6(c){var h=LT(c.alternate,c,Td);c.memoizedProps=c.pendingProps,h===null?my(c):rn=h}function h6(c){var h=c,p=h.alternate;switch(h.tag){case 15:case 0:h=TT(p,h,h.pendingProps,h.type,void 0,an);break;case 11:h=TT(p,h,h.pendingProps,h.type.render,h.ref,an);break;case 5:K0(h);default:FT(p,h),h=rn=im(h,Td),h=LT(p,h,Td)}c.memoizedProps=c.pendingProps,h===null?my(c):rn=h}function lp(c,h,p,b){Al=iu=null,K0(h),Tt=null,cr=0;var C=h.return;try{if(dK(c,C,h,p,an)){Ka=1,ty(c,jo(p,c.current)),rn=null;return}}catch(O){if(C!==null)throw rn=C,O;Ka=1,ty(c,jo(p,c.current)),rn=null;return}h.flags&32768?(tn||b===1?c=!0:ap||(an&536870912)!==0?c=!1:(Ff=c=!0,(b===2||b===9||b===3||b===6)&&(b=pa.current,b!==null&&b.tag===13&&(b.flags|=16384))),m6(h,c)):my(h)}function my(c){var h=c;do{if((h.flags&32768)!==0){m6(h,Ff);return}c=h.return;var p=mK(h.alternate,h,Td);if(p!==null){rn=p;return}if(h=h.sibling,h!==null){rn=h;return}rn=h=c}while(h!==null);Ka===0&&(Ka=5)}function m6(c,h){do{var p=pK(c.alternate,c);if(p!==null){p.flags&=32767,rn=p;return}if(p=c.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!h&&(c=c.sibling,c!==null)){rn=c;return}rn=c=p}while(c!==null);Ka=6,rn=null}function p6(c,h,p,b,C,O,ie,Se,He){c.cancelPendingCommit=null;do py();while(Ri!==0);if((_n&6)!==0)throw Error(n(327));if(h!==null){if(h===c.current)throw Error(n(177));if(O=h.lanes|h.childLanes,O|=M0,It(c,p,O,ie,Se,He),c===ra&&(rn=ra=null,an=0),sp=h,Uf=c,Pd=p,Lj=O,Ij=C,a6=b,(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?(c.callbackNode=null,c.callbackPriority=0,CK(xe,function(){return b6(),null})):(c.callbackNode=null,c.callbackPriority=0),b=(h.flags&13878)!==0,(h.subtreeFlags&13878)!==0||b){b=Z.T,Z.T=null,C=ne.p,ne.p=2,ie=_n,_n|=4;try{xK(c,h,p)}finally{_n=ie,ne.p=C,Z.T=b}}Ri=1,x6(),g6(),v6()}}function x6(){if(Ri===1){Ri=0;var c=Uf,h=sp,p=(h.flags&13878)!==0;if((h.subtreeFlags&13878)!==0||p){p=Z.T,Z.T=null;var b=ne.p;ne.p=2;var C=_n;_n|=4;try{XT(h,c);var O=Jj,ie=hd(c.containerInfo),Se=O.focusedElem,He=O.selectionRange;if(ie!==Se&&Se&&Se.ownerDocument&&Af(Se.ownerDocument.documentElement,Se)){if(He!==null&&uc(Se)){var xt=He.start,At=He.end;if(At===void 0&&(At=xt),"selectionStart"in Se)Se.selectionStart=xt,Se.selectionEnd=Math.min(At,Se.value.length);else{var Et=Se.ownerDocument||document,gt=Et&&Et.defaultView||window;if(gt.getSelection){var yt=gt.getSelection(),lr=Se.textContent.length,Ar=Math.min(He.start,lr),Yn=He.end===void 0?Ar:Math.min(He.end,lr);!yt.extend&&Ar>Yn&&(ie=Yn,Yn=Ar,Ar=ie);var rt=Sf(Se,Ar),Ze=Sf(Se,Yn);if(rt&&Ze&&(yt.rangeCount!==1||yt.anchorNode!==rt.node||yt.anchorOffset!==rt.offset||yt.focusNode!==Ze.node||yt.focusOffset!==Ze.offset)){var pt=Et.createRange();pt.setStart(rt.node,rt.offset),yt.removeAllRanges(),Ar>Yn?(yt.addRange(pt),yt.extend(Ze.node,Ze.offset)):(pt.setEnd(Ze.node,Ze.offset),yt.addRange(pt))}}}}for(Et=[],yt=Se;yt=yt.parentNode;)yt.nodeType===1&&Et.push({element:yt,left:yt.scrollLeft,top:yt.scrollTop});for(typeof Se.focus=="function"&&Se.focus(),Se=0;Se<Et.length;Se++){var Ct=Et[Se];Ct.element.scrollLeft=Ct.left,Ct.element.scrollTop=Ct.top}}Cy=!!Zj,Jj=Zj=null}finally{_n=C,ne.p=b,Z.T=p}}c.current=h,Ri=2}}function g6(){if(Ri===2){Ri=0;var c=Uf,h=sp,p=(h.flags&8772)!==0;if((h.subtreeFlags&8772)!==0||p){p=Z.T,Z.T=null;var b=ne.p;ne.p=2;var C=_n;_n|=4;try{qT(c,h.alternate,h)}finally{_n=C,ne.p=b,Z.T=p}}Ri=3}}function v6(){if(Ri===4||Ri===3){Ri=0,Y();var c=Uf,h=sp,p=Pd,b=a6;(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?Ri=5:(Ri=0,sp=Uf=null,y6(c,c.pendingLanes));var C=c.pendingLanes;if(C===0&&(zf=null),Zr(p),h=h.stateNode,st&&typeof st.onCommitFiberRoot=="function")try{st.onCommitFiberRoot(it,h,void 0,(h.current.flags&128)===128)}catch{}if(b!==null){h=Z.T,C=ne.p,ne.p=2,Z.T=null;try{for(var O=c.onRecoverableError,ie=0;ie<b.length;ie++){var Se=b[ie];O(Se.value,{componentStack:Se.stack})}}finally{Z.T=h,ne.p=C}}(Pd&3)!==0&&py(),mu(c),C=c.pendingLanes,(p&261930)!==0&&(C&42)!==0?c===Fj?hg++:(hg=0,Fj=c):hg=0,mg(0)}}function y6(c,h){(c.pooledCacheLanes&=h)===0&&(h=c.pooledCache,h!=null&&(c.pooledCache=null,lm(h)))}function py(){return x6(),g6(),v6(),b6()}function b6(){if(Ri!==5)return!1;var c=Uf,h=Lj;Lj=0;var p=Zr(Pd),b=Z.T,C=ne.p;try{ne.p=32>p?32:p,Z.T=null,p=Ij,Ij=null;var O=Uf,ie=Pd;if(Ri=0,sp=Uf=null,Pd=0,(_n&6)!==0)throw Error(n(331));var Se=_n;if(_n|=4,t6(O.current),JT(O,O.current,ie,p),_n=Se,mg(0,!1),st&&typeof st.onPostCommitFiberRoot=="function")try{st.onPostCommitFiberRoot(it,O)}catch{}return!0}finally{ne.p=C,Z.T=b,y6(c,h)}}function w6(c,h,p){h=jo(p,h),h=xj(c.stateNode,h,2),c=Br(c,h,2),c!==null&&(Ht(c,2),mu(c))}function Fn(c,h,p){if(c.tag===3)w6(c,c,p);else for(;h!==null;){if(h.tag===3){w6(h,c,p);break}else if(h.tag===1){var b=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(zf===null||!zf.has(b))){c=jo(p,c),p=jT(2),b=Br(h,p,2),b!==null&&(NT(p,b,h,c),Ht(b,2),mu(b));break}}h=h.return}}function Uj(c,h,p){var b=c.pingCache;if(b===null){b=c.pingCache=new yK;var C=new Set;b.set(h,C)}else C=b.get(h),C===void 0&&(C=new Set,b.set(h,C));C.has(p)||(Oj=!0,C.add(p),c=SK.bind(null,c,h,p),h.then(c,c))}function SK(c,h,p){var b=c.pingCache;b!==null&&b.delete(h),c.pingedLanes|=c.suspendedLanes&p,c.warmLanes&=~p,ra===c&&(an&p)===p&&(Ka===4||Ka===3&&(an&62914560)===an&&300>we()-cy?(_n&2)===0&&op(c,0):Rj|=p,ip===an&&(ip=0)),mu(c)}function j6(c,h){h===0&&(h=Er()),c=dc(c,h),c!==null&&(Ht(c,h),mu(c))}function AK(c){var h=c.memoizedState,p=0;h!==null&&(p=h.retryLane),j6(c,p)}function kK(c,h){var p=0;switch(c.tag){case 31:case 13:var b=c.stateNode,C=c.memoizedState;C!==null&&(p=C.retryLane);break;case 19:b=c.stateNode;break;case 22:b=c.stateNode._retryCache;break;default:throw Error(n(314))}b!==null&&b.delete(h),j6(c,p)}function CK(c,h){return Ne(c,h)}var xy=null,cp=null,$j=!1,gy=!1,Hj=!1,Hf=0;function mu(c){c!==cp&&c.next===null&&(cp===null?xy=cp=c:cp=cp.next=c),gy=!0,$j||($j=!0,EK())}function mg(c,h){if(!Hj&&gy){Hj=!0;do for(var p=!1,b=xy;b!==null;){if(c!==0){var C=b.pendingLanes;if(C===0)var O=0;else{var ie=b.suspendedLanes,Se=b.pingedLanes;O=(1<<31-te(42|c)+1)-1,O&=C&~(ie&~Se),O=O&201326741?O&201326741|1:O?O|2:0}O!==0&&(p=!0,k6(b,O))}else O=an,O=Rt(b,b===ra?O:0,b.cancelPendingCommit!==null||b.timeoutHandle!==-1),(O&3)===0||wr(b,O)||(p=!0,k6(b,O));b=b.next}while(p);Hj=!1}}function _K(){N6()}function N6(){gy=$j=!1;var c=0;Hf!==0&&BK()&&(c=Hf);for(var h=we(),p=null,b=xy;b!==null;){var C=b.next,O=S6(b,h);O===0?(b.next=null,p===null?xy=C:p.next=C,C===null&&(cp=p)):(p=b,(c!==0||(O&3)!==0)&&(gy=!0)),b=C}Ri!==0&&Ri!==5||mg(c),Hf!==0&&(Hf=0)}function S6(c,h){for(var p=c.suspendedLanes,b=c.pingedLanes,C=c.expirationTimes,O=c.pendingLanes&-62914561;0<O;){var ie=31-te(O),Se=1<<ie,He=C[ie];He===-1?((Se&p)===0||(Se&b)!==0)&&(C[ie]=gr(Se,h)):He<=h&&(c.expiredLanes|=Se),O&=~Se}if(h=ra,p=an,p=Rt(c,c===h?p:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),b=c.callbackNode,p===0||c===h&&(In===2||In===9)||c.cancelPendingCommit!==null)return b!==null&&b!==null&&Ye(b),c.callbackNode=null,c.callbackPriority=0;if((p&3)===0||wr(c,p)){if(h=p&-p,h===c.callbackPriority)return h;switch(b!==null&&Ye(b),Zr(p)){case 2:case 8:p=Oe;break;case 32:p=xe;break;case 268435456:p=me;break;default:p=xe}return b=A6.bind(null,c),p=Ne(p,b),c.callbackPriority=h,c.callbackNode=p,h}return b!==null&&b!==null&&Ye(b),c.callbackPriority=2,c.callbackNode=null,2}function A6(c,h){if(Ri!==0&&Ri!==5)return c.callbackNode=null,c.callbackPriority=0,null;var p=c.callbackNode;if(py()&&c.callbackNode!==p)return null;var b=an;return b=Rt(c,c===ra?b:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),b===0?null:(s6(c,b,h),S6(c,we()),c.callbackNode!=null&&c.callbackNode===p?A6.bind(null,c):null)}function k6(c,h){if(py())return null;s6(c,h,!0)}function EK(){UK(function(){(_n&6)!==0?Ne(ve,_K):N6()})}function Vj(){if(Hf===0){var c=S;c===0&&(c=_t,_t<<=1,(_t&261888)===0&&(_t=256)),Hf=c}return Hf}function C6(c){return c==null||typeof c=="symbol"||typeof c=="boolean"?null:typeof c=="function"?c:Yo(""+c)}function _6(c,h){var p=h.ownerDocument.createElement("input");return p.name=h.name,p.value=h.value,c.id&&p.setAttribute("form",c.id),h.parentNode.insertBefore(p,h),c=new FormData(c),p.parentNode.removeChild(p),c}function TK(c,h,p,b,C){if(h==="submit"&&p&&p.stateNode===C){var O=C6((C[Re]||null).action),ie=b.submitter;ie&&(h=(h=ie[Re]||null)?C6(h.formAction):ie.getAttribute("formAction"),h!==null&&(O=h,ie=null));var Se=new Jo("action","action",null,b,C);c.push({event:Se,listeners:[{instance:null,listener:function(){if(b.defaultPrevented){if(Hf!==0){var He=ie?_6(C,ie):new FormData(C);uj(p,{pending:!0,data:He,method:C.method,action:O},null,He)}}else typeof O=="function"&&(Se.preventDefault(),He=ie?_6(C,ie):new FormData(C),uj(p,{pending:!0,data:He,method:C.method,action:O},O,He))},currentTarget:C}]})}}for(var qj=0;qj<xd.length;qj++){var Wj=xd[qj],PK=Wj.toLowerCase(),DK=Wj[0].toUpperCase()+Wj.slice(1);bo(PK,"on"+DK)}bo(Sl,"onAnimationEnd"),bo(kf,"onAnimationIteration"),bo(pd,"onAnimationStart"),bo("dblclick","onDoubleClick"),bo("focusin","onFocus"),bo("focusout","onBlur"),bo(R0,"onTransitionRun"),bo(H1,"onTransitionStart"),bo(V1,"onTransitionCancel"),bo(Vx,"onTransitionEnd"),xs("onMouseEnter",["mouseout","mouseover"]),xs("onMouseLeave",["mouseout","mouseover"]),xs("onPointerEnter",["pointerout","pointerover"]),xs("onPointerLeave",["pointerout","pointerover"]),Pn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Pn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Pn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Pn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Pn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Pn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pg="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(" "),OK=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pg));function E6(c,h){h=(h&4)!==0;for(var p=0;p<c.length;p++){var b=c[p],C=b.event;b=b.listeners;e:{var O=void 0;if(h)for(var ie=b.length-1;0<=ie;ie--){var Se=b[ie],He=Se.instance,xt=Se.currentTarget;if(Se=Se.listener,He!==O&&C.isPropagationStopped())break e;O=Se,C.currentTarget=xt;try{O(C)}catch(At){tm(At)}C.currentTarget=null,O=He}else for(ie=0;ie<b.length;ie++){if(Se=b[ie],He=Se.instance,xt=Se.currentTarget,Se=Se.listener,He!==O&&C.isPropagationStopped())break e;O=Se,C.currentTarget=xt;try{O(C)}catch(At){tm(At)}C.currentTarget=null,O=He}}}}function nn(c,h){var p=h[ct];p===void 0&&(p=h[ct]=new Set);var b=c+"__bubble";p.has(b)||(T6(h,c,2,!1),p.add(b))}function Gj(c,h,p){var b=0;h&&(b|=4),T6(p,c,b,h)}var vy="_reactListening"+Math.random().toString(36).slice(2);function Yj(c){if(!c[vy]){c[vy]=!0,An.forEach(function(p){p!=="selectionchange"&&(OK.has(p)||Gj(p,!1,c),Gj(p,!0,c))});var h=c.nodeType===9?c:c.ownerDocument;h===null||h[vy]||(h[vy]=!0,Gj("selectionchange",!1,h))}}function T6(c,h,p,b){switch(iP(h)){case 2:var C=oX;break;case 8:C=lX;break;default:C=cN}p=C.bind(null,h,p,c),C=void 0,!Xo||h!=="touchstart"&&h!=="touchmove"&&h!=="wheel"||(C=!0),b?C!==void 0?c.addEventListener(h,p,{capture:!0,passive:C}):c.addEventListener(h,p,!0):C!==void 0?c.addEventListener(h,p,{passive:C}):c.addEventListener(h,p,!1)}function Kj(c,h,p,b,C){var O=b;if((h&1)===0&&(h&2)===0&&b!==null)e:for(;;){if(b===null)return;var ie=b.tag;if(ie===3||ie===4){var Se=b.stateNode.containerInfo;if(Se===C)break;if(ie===4)for(ie=b.return;ie!==null;){var He=ie.tag;if((He===3||He===4)&&ie.stateNode.containerInfo===C)return;ie=ie.return}for(;Se!==null;){if(ie=Vt(Se),ie===null)return;if(He=ie.tag,He===5||He===6||He===26||He===27){b=O=ie;continue e}Se=Se.parentNode}}b=b.return}T0(function(){var xt=O,At=Yh(p),Et=[];e:{var gt=qx.get(c);if(gt!==void 0){var yt=Jo,lr=c;switch(c){case"keypress":if(Qs(p)===0)break e;case"keydown":case"keyup":yt=Pr;break;case"focusin":lr="focus",yt=jf;break;case"focusout":lr="blur",yt=jf;break;case"beforeblur":case"afterblur":yt=jf;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":yt=Zh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":yt=sc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":yt=Mn;break;case Sl:case kf:case pd:yt=ad;break;case Vx:yt=Jn;break;case"scroll":case"scrollend":yt=rd;break;case"wheel":yt=fa;break;case"copy":case"cut":case"paste":yt=U;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":yt=en;break;case"toggle":case"beforetoggle":yt=oc}var Ar=(h&4)!==0,Yn=!Ar&&(c==="scroll"||c==="scrollend"),rt=Ar?gt!==null?gt+"Capture":null:gt;Ar=[];for(var Ze=xt,pt;Ze!==null;){var Ct=Ze;if(pt=Ct.stateNode,Ct=Ct.tag,Ct!==5&&Ct!==26&&Ct!==27||pt===null||rt===null||(Ct=ed(Ze,rt),Ct!=null&&Ar.push(xg(Ze,Ct,pt))),Yn)break;Ze=Ze.return}0<Ar.length&&(gt=new yt(gt,lr,null,p,At),Et.push({event:gt,listeners:Ar}))}}if((h&7)===0){e:{if(gt=c==="mouseover"||c==="pointerover",yt=c==="mouseout"||c==="pointerout",gt&&p!==wl&&(lr=p.relatedTarget||p.fromElement)&&(Vt(lr)||lr[ze]))break e;if((yt||gt)&&(gt=At.window===At?At:(gt=At.ownerDocument)?gt.defaultView||gt.parentWindow:window,yt?(lr=p.relatedTarget||p.toElement,yt=xt,lr=lr?Vt(lr):null,lr!==null&&(Yn=s(lr),Ar=lr.tag,lr!==Yn||Ar!==5&&Ar!==27&&Ar!==6)&&(lr=null)):(yt=null,lr=xt),yt!==lr)){if(Ar=Zh,Ct="onMouseLeave",rt="onMouseEnter",Ze="mouse",(c==="pointerout"||c==="pointerover")&&(Ar=en,Ct="onPointerLeave",rt="onPointerEnter",Ze="pointer"),Yn=yt==null?gt:$t(yt),pt=lr==null?gt:$t(lr),gt=new Ar(Ct,Ze+"leave",yt,p,At),gt.target=Yn,gt.relatedTarget=pt,Ct=null,Vt(At)===xt&&(Ar=new Ar(rt,Ze+"enter",lr,p,At),Ar.target=pt,Ar.relatedTarget=Yn,Ct=Ar),Yn=Ct,yt&&lr)t:{for(Ar=RK,rt=yt,Ze=lr,pt=0,Ct=rt;Ct;Ct=Ar(Ct))pt++;Ct=0;for(var yr=Ze;yr;yr=Ar(yr))Ct++;for(;0<pt-Ct;)rt=Ar(rt),pt--;for(;0<Ct-pt;)Ze=Ar(Ze),Ct--;for(;pt--;){if(rt===Ze||Ze!==null&&rt===Ze.alternate){Ar=rt;break t}rt=Ar(rt),Ze=Ar(Ze)}Ar=null}else Ar=null;yt!==null&&P6(Et,gt,yt,Ar,!1),lr!==null&&Yn!==null&&P6(Et,Yn,lr,Ar,!0)}}e:{if(gt=xt?$t(xt):window,yt=gt.nodeName&&gt.nodeName.toLowerCase(),yt==="select"||yt==="input"&&gt.type==="file")var bn=cd;else if(em(gt))if(Jc)bn=Ha;else{bn=Nf;var mr=Qc}else yt=gt.nodeName,!yt||yt.toLowerCase()!=="input"||gt.type!=="checkbox"&&gt.type!=="radio"?xt&&Gh(xt.elementType)&&(bn=cd):bn=fd;if(bn&&(bn=bn(c,xt))){od(Et,bn,p,At);break e}mr&&mr(c,gt,xt),c==="focusout"&&xt&&gt.type==="number"&&xt.memoizedProps.value!=null&&Wh(gt,"number",gt.value)}switch(mr=xt?$t(xt):window,c){case"focusin":(em(mr)||mr.contentEditable==="true")&&(eo=mr,el=xt,yo=null);break;case"focusout":yo=el=eo=null;break;case"mousedown":tu=!0;break;case"contextmenu":case"mouseup":case"dragend":tu=!1,_i(Et,p,At);break;case"selectionchange":if(md)break;case"keydown":case"keyup":_i(Et,p,At)}var $r;if(lc)e:{switch(c){case"compositionstart":var sn="onCompositionStart";break e;case"compositionend":sn="onCompositionEnd";break e;case"compositionupdate":sn="onCompositionUpdate";break e}sn=void 0}else vo?ki(c,p)&&(sn="onCompositionEnd"):c==="keydown"&&p.keyCode===229&&(sn="onCompositionStart");sn&&(Yc&&p.locale!=="ko"&&(vo||sn!=="onCompositionStart"?sn==="onCompositionEnd"&&vo&&($r=bf()):(jl=At,Xh="value"in jl?jl.value:jl.textContent,vo=!0)),mr=yy(xt,sn),0<mr.length&&(sn=new Me(sn,c,null,p,At),Et.push({event:sn,listeners:mr}),$r?sn.data=$r:($r=Kc(p),$r!==null&&(sn.data=$r)))),($r=Gc?Qh(c,p):Nl(c,p))&&(sn=yy(xt,"onBeforeInput"),0<sn.length&&(mr=new Me("onBeforeInput","beforeinput",null,p,At),Et.push({event:mr,listeners:sn}),mr.data=$r)),TK(Et,c,xt,p,At)}E6(Et,h)})}function xg(c,h,p){return{instance:c,listener:h,currentTarget:p}}function yy(c,h){for(var p=h+"Capture",b=[];c!==null;){var C=c,O=C.stateNode;if(C=C.tag,C!==5&&C!==26&&C!==27||O===null||(C=ed(c,p),C!=null&&b.unshift(xg(c,C,O)),C=ed(c,h),C!=null&&b.push(xg(c,C,O))),c.tag===3)return b;c=c.return}return[]}function RK(c){if(c===null)return null;do c=c.return;while(c&&c.tag!==5&&c.tag!==27);return c||null}function P6(c,h,p,b,C){for(var O=h._reactName,ie=[];p!==null&&p!==b;){var Se=p,He=Se.alternate,xt=Se.stateNode;if(Se=Se.tag,He!==null&&He===b)break;Se!==5&&Se!==26&&Se!==27||xt===null||(He=xt,C?(xt=ed(p,O),xt!=null&&ie.unshift(xg(p,xt,He))):C||(xt=ed(p,O),xt!=null&&ie.push(xg(p,xt,He)))),p=p.return}ie.length!==0&&c.push({event:h,listeners:ie})}var MK=/\r\n?/g,LK=/\u0000|\uFFFD/g;function D6(c){return(typeof c=="string"?c:""+c).replace(MK,`
`).replace(LK,"")}function O6(c,h){return h=D6(h),D6(c)===h}function Gn(c,h,p,b,C,O){switch(p){case"children":typeof b=="string"?h==="body"||h==="textarea"&&b===""||ec(c,b):(typeof b=="number"||typeof b=="bigint")&&h!=="body"&&ec(c,""+b);break;case"className":Ql(c,"class",b);break;case"tabIndex":Ql(c,"tabindex",b);break;case"dir":case"role":case"viewBox":case"width":case"height":Ql(c,p,b);break;case"style":yf(c,b,O);break;case"data":if(h!=="object"){Ql(c,"data",b);break}case"src":case"href":if(b===""&&(h!=="a"||p!=="href")){c.removeAttribute(p);break}if(b==null||typeof b=="function"||typeof b=="symbol"||typeof b=="boolean"){c.removeAttribute(p);break}b=Yo(""+b),c.setAttribute(p,b);break;case"action":case"formAction":if(typeof b=="function"){c.setAttribute(p,"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 O=="function"&&(p==="formAction"?(h!=="input"&&Gn(c,h,"name",C.name,C,null),Gn(c,h,"formEncType",C.formEncType,C,null),Gn(c,h,"formMethod",C.formMethod,C,null),Gn(c,h,"formTarget",C.formTarget,C,null)):(Gn(c,h,"encType",C.encType,C,null),Gn(c,h,"method",C.method,C,null),Gn(c,h,"target",C.target,C,null)));if(b==null||typeof b=="symbol"||typeof b=="boolean"){c.removeAttribute(p);break}b=Yo(""+b),c.setAttribute(p,b);break;case"onClick":b!=null&&(c.onclick=xo);break;case"onScroll":b!=null&&nn("scroll",c);break;case"onScrollEnd":b!=null&&nn("scrollend",c);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(p=b.__html,p!=null){if(C.children!=null)throw Error(n(60));c.innerHTML=p}}break;case"multiple":c.multiple=b&&typeof b!="function"&&typeof b!="symbol";break;case"muted":c.muted=b&&typeof b!="function"&&typeof b!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(b==null||typeof b=="function"||typeof b=="boolean"||typeof b=="symbol"){c.removeAttribute("xlink:href");break}p=Yo(""+b),c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",p);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":b!=null&&typeof b!="function"&&typeof b!="symbol"?c.setAttribute(p,""+b):c.removeAttribute(p);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":b&&typeof b!="function"&&typeof b!="symbol"?c.setAttribute(p,""):c.removeAttribute(p);break;case"capture":case"download":b===!0?c.setAttribute(p,""):b!==!1&&b!=null&&typeof b!="function"&&typeof b!="symbol"?c.setAttribute(p,b):c.removeAttribute(p);break;case"cols":case"rows":case"size":case"span":b!=null&&typeof b!="function"&&typeof b!="symbol"&&!isNaN(b)&&1<=b?c.setAttribute(p,b):c.removeAttribute(p);break;case"rowSpan":case"start":b==null||typeof b=="function"||typeof b=="symbol"||isNaN(b)?c.removeAttribute(p):c.setAttribute(p,b);break;case"popover":nn("beforetoggle",c),nn("toggle",c),ua(c,"popover",b);break;case"xlinkActuate":Wo(c,"http://www.w3.org/1999/xlink","xlink:actuate",b);break;case"xlinkArcrole":Wo(c,"http://www.w3.org/1999/xlink","xlink:arcrole",b);break;case"xlinkRole":Wo(c,"http://www.w3.org/1999/xlink","xlink:role",b);break;case"xlinkShow":Wo(c,"http://www.w3.org/1999/xlink","xlink:show",b);break;case"xlinkTitle":Wo(c,"http://www.w3.org/1999/xlink","xlink:title",b);break;case"xlinkType":Wo(c,"http://www.w3.org/1999/xlink","xlink:type",b);break;case"xmlBase":Wo(c,"http://www.w3.org/XML/1998/namespace","xml:base",b);break;case"xmlLang":Wo(c,"http://www.w3.org/XML/1998/namespace","xml:lang",b);break;case"xmlSpace":Wo(c,"http://www.w3.org/XML/1998/namespace","xml:space",b);break;case"is":ua(c,"is",b);break;case"innerText":case"textContent":break;default:(!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(p=Ux.get(p)||p,ua(c,p,b))}}function Xj(c,h,p,b,C,O){switch(p){case"style":yf(c,b,O);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(p=b.__html,p!=null){if(C.children!=null)throw Error(n(60));c.innerHTML=p}}break;case"children":typeof b=="string"?ec(c,b):(typeof b=="number"||typeof b=="bigint")&&ec(c,""+b);break;case"onScroll":b!=null&&nn("scroll",c);break;case"onScrollEnd":b!=null&&nn("scrollend",c);break;case"onClick":b!=null&&(c.onclick=xo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Wr.hasOwnProperty(p))e:{if(p[0]==="o"&&p[1]==="n"&&(C=p.endsWith("Capture"),h=p.slice(2,C?p.length-7:void 0),O=c[Re]||null,O=O!=null?O[p]:null,typeof O=="function"&&c.removeEventListener(h,O,C),typeof b=="function")){typeof O!="function"&&O!==null&&(p in c?c[p]=null:c.hasAttribute(p)&&c.removeAttribute(p)),c.addEventListener(h,b,C);break e}p in c?c[p]=b:b===!0?c.setAttribute(p,""):ua(c,p,b)}}}function Ns(c,h,p){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":nn("error",c),nn("load",c);var b=!1,C=!1,O;for(O in p)if(p.hasOwnProperty(O)){var ie=p[O];if(ie!=null)switch(O){case"src":b=!0;break;case"srcSet":C=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,h));default:Gn(c,h,O,ie,p,null)}}C&&Gn(c,h,"srcSet",p.srcSet,p,null),b&&Gn(c,h,"src",p.src,p,null);return;case"input":nn("invalid",c);var Se=O=ie=C=null,He=null,xt=null;for(b in p)if(p.hasOwnProperty(b)){var At=p[b];if(At!=null)switch(b){case"name":C=At;break;case"type":ie=At;break;case"checked":He=At;break;case"defaultChecked":xt=At;break;case"value":O=At;break;case"defaultValue":Se=At;break;case"children":case"dangerouslySetInnerHTML":if(At!=null)throw Error(n(137,h));break;default:Gn(c,h,b,At,p,null)}}qh(c,O,Se,He,xt,ie,C,!1);return;case"select":nn("invalid",c),b=ie=O=null;for(C in p)if(p.hasOwnProperty(C)&&(Se=p[C],Se!=null))switch(C){case"value":O=Se;break;case"defaultValue":ie=Se;break;case"multiple":b=Se;default:Gn(c,h,C,Se,p,null)}h=O,p=ie,c.multiple=!!b,h!=null?qc(c,!!b,h,!1):p!=null&&qc(c,!!b,p,!0);return;case"textarea":nn("invalid",c),O=C=b=null;for(ie in p)if(p.hasOwnProperty(ie)&&(Se=p[ie],Se!=null))switch(ie){case"value":b=Se;break;case"defaultValue":C=Se;break;case"children":O=Se;break;case"dangerouslySetInnerHTML":if(Se!=null)throw Error(n(91));break;default:Gn(c,h,ie,Se,p,null)}Go(c,b,C,O);return;case"option":for(He in p)if(p.hasOwnProperty(He)&&(b=p[He],b!=null))switch(He){case"selected":c.selected=b&&typeof b!="function"&&typeof b!="symbol";break;default:Gn(c,h,He,b,p,null)}return;case"dialog":nn("beforetoggle",c),nn("toggle",c),nn("cancel",c),nn("close",c);break;case"iframe":case"object":nn("load",c);break;case"video":case"audio":for(b=0;b<pg.length;b++)nn(pg[b],c);break;case"image":nn("error",c),nn("load",c);break;case"details":nn("toggle",c);break;case"embed":case"source":case"link":nn("error",c),nn("load",c);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(xt in p)if(p.hasOwnProperty(xt)&&(b=p[xt],b!=null))switch(xt){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,h));default:Gn(c,h,xt,b,p,null)}return;default:if(Gh(h)){for(At in p)p.hasOwnProperty(At)&&(b=p[At],b!==void 0&&Xj(c,h,At,b,p,void 0));return}}for(Se in p)p.hasOwnProperty(Se)&&(b=p[Se],b!=null&&Gn(c,h,Se,b,p,null))}function IK(c,h,p,b){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var C=null,O=null,ie=null,Se=null,He=null,xt=null,At=null;for(yt in p){var Et=p[yt];if(p.hasOwnProperty(yt)&&Et!=null)switch(yt){case"checked":break;case"value":break;case"defaultValue":He=Et;default:b.hasOwnProperty(yt)||Gn(c,h,yt,null,b,Et)}}for(var gt in b){var yt=b[gt];if(Et=p[gt],b.hasOwnProperty(gt)&&(yt!=null||Et!=null))switch(gt){case"type":O=yt;break;case"name":C=yt;break;case"checked":xt=yt;break;case"defaultChecked":At=yt;break;case"value":ie=yt;break;case"defaultValue":Se=yt;break;case"children":case"dangerouslySetInnerHTML":if(yt!=null)throw Error(n(137,h));break;default:yt!==Et&&Gn(c,h,gt,yt,b,Et)}}ai(c,ie,Se,He,xt,At,O,C);return;case"select":yt=ie=Se=gt=null;for(O in p)if(He=p[O],p.hasOwnProperty(O)&&He!=null)switch(O){case"value":break;case"multiple":yt=He;default:b.hasOwnProperty(O)||Gn(c,h,O,null,b,He)}for(C in b)if(O=b[C],He=p[C],b.hasOwnProperty(C)&&(O!=null||He!=null))switch(C){case"value":gt=O;break;case"defaultValue":Se=O;break;case"multiple":ie=O;default:O!==He&&Gn(c,h,C,O,b,He)}h=Se,p=ie,b=yt,gt!=null?qc(c,!!p,gt,!1):!!b!=!!p&&(h!=null?qc(c,!!p,h,!0):qc(c,!!p,p?[]:"",!1));return;case"textarea":yt=gt=null;for(Se in p)if(C=p[Se],p.hasOwnProperty(Se)&&C!=null&&!b.hasOwnProperty(Se))switch(Se){case"value":break;case"children":break;default:Gn(c,h,Se,null,b,C)}for(ie in b)if(C=b[ie],O=p[ie],b.hasOwnProperty(ie)&&(C!=null||O!=null))switch(ie){case"value":gt=C;break;case"defaultValue":yt=C;break;case"children":break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(n(91));break;default:C!==O&&Gn(c,h,ie,C,b,O)}_0(c,gt,yt);return;case"option":for(var lr in p)if(gt=p[lr],p.hasOwnProperty(lr)&&gt!=null&&!b.hasOwnProperty(lr))switch(lr){case"selected":c.selected=!1;break;default:Gn(c,h,lr,null,b,gt)}for(He in b)if(gt=b[He],yt=p[He],b.hasOwnProperty(He)&&gt!==yt&&(gt!=null||yt!=null))switch(He){case"selected":c.selected=gt&&typeof gt!="function"&&typeof gt!="symbol";break;default:Gn(c,h,He,gt,b,yt)}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 Ar in p)gt=p[Ar],p.hasOwnProperty(Ar)&&gt!=null&&!b.hasOwnProperty(Ar)&&Gn(c,h,Ar,null,b,gt);for(xt in b)if(gt=b[xt],yt=p[xt],b.hasOwnProperty(xt)&&gt!==yt&&(gt!=null||yt!=null))switch(xt){case"children":case"dangerouslySetInnerHTML":if(gt!=null)throw Error(n(137,h));break;default:Gn(c,h,xt,gt,b,yt)}return;default:if(Gh(h)){for(var Yn in p)gt=p[Yn],p.hasOwnProperty(Yn)&&gt!==void 0&&!b.hasOwnProperty(Yn)&&Xj(c,h,Yn,void 0,b,gt);for(At in b)gt=b[At],yt=p[At],!b.hasOwnProperty(At)||gt===yt||gt===void 0&&yt===void 0||Xj(c,h,At,gt,b,yt);return}}for(var rt in p)gt=p[rt],p.hasOwnProperty(rt)&&gt!=null&&!b.hasOwnProperty(rt)&&Gn(c,h,rt,null,b,gt);for(Et in b)gt=b[Et],yt=p[Et],!b.hasOwnProperty(Et)||gt===yt||gt==null&&yt==null||Gn(c,h,Et,gt,b,yt)}function R6(c){switch(c){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function FK(){if(typeof performance.getEntriesByType=="function"){for(var c=0,h=0,p=performance.getEntriesByType("resource"),b=0;b<p.length;b++){var C=p[b],O=C.transferSize,ie=C.initiatorType,Se=C.duration;if(O&&Se&&R6(ie)){for(ie=0,Se=C.responseEnd,b+=1;b<p.length;b++){var He=p[b],xt=He.startTime;if(xt>Se)break;var At=He.transferSize,Et=He.initiatorType;At&&R6(Et)&&(He=He.responseEnd,ie+=At*(He<Se?1:(Se-xt)/(He-xt)))}if(--b,h+=8*(O+ie)/(C.duration/1e3),c++,10<c)break}}if(0<c)return h/c/1e6}return navigator.connection&&(c=navigator.connection.downlink,typeof c=="number")?c:5}var Zj=null,Jj=null;function by(c){return c.nodeType===9?c:c.ownerDocument}function M6(c){switch(c){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function L6(c,h){if(c===0)switch(h){case"svg":return 1;case"math":return 2;default:return 0}return c===1&&h==="foreignObject"?0:c}function Qj(c,h){return c==="textarea"||c==="noscript"||typeof h.children=="string"||typeof h.children=="number"||typeof h.children=="bigint"||typeof h.dangerouslySetInnerHTML=="object"&&h.dangerouslySetInnerHTML!==null&&h.dangerouslySetInnerHTML.__html!=null}var eN=null;function BK(){var c=window.event;return c&&c.type==="popstate"?c===eN?!1:(eN=c,!0):(eN=null,!1)}var I6=typeof setTimeout=="function"?setTimeout:void 0,zK=typeof clearTimeout=="function"?clearTimeout:void 0,F6=typeof Promise=="function"?Promise:void 0,UK=typeof queueMicrotask=="function"?queueMicrotask:typeof F6<"u"?function(c){return F6.resolve(null).then(c).catch($K)}:I6;function $K(c){setTimeout(function(){throw c})}function Vf(c){return c==="head"}function B6(c,h){var p=h,b=0;do{var C=p.nextSibling;if(c.removeChild(p),C&&C.nodeType===8)if(p=C.data,p==="/$"||p==="/&"){if(b===0){c.removeChild(C),hp(h);return}b--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")b++;else if(p==="html")gg(c.ownerDocument.documentElement);else if(p==="head"){p=c.ownerDocument.head,gg(p);for(var O=p.firstChild;O;){var ie=O.nextSibling,Se=O.nodeName;O[mt]||Se==="SCRIPT"||Se==="STYLE"||Se==="LINK"&&O.rel.toLowerCase()==="stylesheet"||p.removeChild(O),O=ie}}else p==="body"&&gg(c.ownerDocument.body);p=C}while(p);hp(h)}function z6(c,h){var p=c;c=0;do{var b=p.nextSibling;if(p.nodeType===1?h?(p._stashedDisplay=p.style.display,p.style.display="none"):(p.style.display=p._stashedDisplay||"",p.getAttribute("style")===""&&p.removeAttribute("style")):p.nodeType===3&&(h?(p._stashedText=p.nodeValue,p.nodeValue=""):p.nodeValue=p._stashedText||""),b&&b.nodeType===8)if(p=b.data,p==="/$"){if(c===0)break;c--}else p!=="$"&&p!=="$?"&&p!=="$~"&&p!=="$!"||c++;p=b}while(p)}function tN(c){var h=c.firstChild;for(h&&h.nodeType===10&&(h=h.nextSibling);h;){var p=h;switch(h=h.nextSibling,p.nodeName){case"HTML":case"HEAD":case"BODY":tN(p),Lt(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}c.removeChild(p)}}function HK(c,h,p,b){for(;c.nodeType===1;){var C=p;if(c.nodeName.toLowerCase()!==h.toLowerCase()){if(!b&&(c.nodeName!=="INPUT"||c.type!=="hidden"))break}else if(b){if(!c[mt])switch(h){case"meta":if(!c.hasAttribute("itemprop"))break;return c;case"link":if(O=c.getAttribute("rel"),O==="stylesheet"&&c.hasAttribute("data-precedence"))break;if(O!==C.rel||c.getAttribute("href")!==(C.href==null||C.href===""?null:C.href)||c.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin)||c.getAttribute("title")!==(C.title==null?null:C.title))break;return c;case"style":if(c.hasAttribute("data-precedence"))break;return c;case"script":if(O=c.getAttribute("src"),(O!==(C.src==null?null:C.src)||c.getAttribute("type")!==(C.type==null?null:C.type)||c.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin))&&O&&c.hasAttribute("async")&&!c.hasAttribute("itemprop"))break;return c;default:return c}}else if(h==="input"&&c.type==="hidden"){var O=C.name==null?null:""+C.name;if(C.type==="hidden"&&c.getAttribute("name")===O)return c}else return c;if(c=_l(c.nextSibling),c===null)break}return null}function VK(c,h,p){if(h==="")return null;for(;c.nodeType!==3;)if((c.nodeType!==1||c.nodeName!=="INPUT"||c.type!=="hidden")&&!p||(c=_l(c.nextSibling),c===null))return null;return c}function U6(c,h){for(;c.nodeType!==8;)if((c.nodeType!==1||c.nodeName!=="INPUT"||c.type!=="hidden")&&!h||(c=_l(c.nextSibling),c===null))return null;return c}function rN(c){return c.data==="$?"||c.data==="$~"}function nN(c){return c.data==="$!"||c.data==="$?"&&c.ownerDocument.readyState!=="loading"}function qK(c,h){var p=c.ownerDocument;if(c.data==="$~")c._reactRetry=h;else if(c.data!=="$?"||p.readyState!=="loading")h();else{var b=function(){h(),p.removeEventListener("DOMContentLoaded",b)};p.addEventListener("DOMContentLoaded",b),c._reactRetry=b}}function _l(c){for(;c!=null;c=c.nextSibling){var h=c.nodeType;if(h===1||h===3)break;if(h===8){if(h=c.data,h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"||h==="F!"||h==="F")break;if(h==="/$"||h==="/&")return null}}return c}var aN=null;function $6(c){c=c.nextSibling;for(var h=0;c;){if(c.nodeType===8){var p=c.data;if(p==="/$"||p==="/&"){if(h===0)return _l(c.nextSibling);h--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||h++}c=c.nextSibling}return null}function H6(c){c=c.previousSibling;for(var h=0;c;){if(c.nodeType===8){var p=c.data;if(p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"){if(h===0)return c;h--}else p!=="/$"&&p!=="/&"||h++}c=c.previousSibling}return null}function V6(c,h,p){switch(h=by(p),c){case"html":if(c=h.documentElement,!c)throw Error(n(452));return c;case"head":if(c=h.head,!c)throw Error(n(453));return c;case"body":if(c=h.body,!c)throw Error(n(454));return c;default:throw Error(n(451))}}function gg(c){for(var h=c.attributes;h.length;)c.removeAttributeNode(h[0]);Lt(c)}var El=new Map,q6=new Set;function wy(c){return typeof c.getRootNode=="function"?c.getRootNode():c.nodeType===9?c:c.ownerDocument}var Dd=ne.d;ne.d={f:WK,r:GK,D:YK,C:KK,L:XK,m:ZK,X:QK,S:JK,M:eX};function WK(){var c=Dd.f(),h=fy();return c||h}function GK(c){var h=Xt(c);h!==null&&h.tag===5&&h.type==="form"?lT(h):Dd.r(c)}var up=typeof document>"u"?null:document;function W6(c,h,p){var b=up;if(b&&typeof h=="string"&&h){var C=Ua(h);C='link[rel="'+c+'"][href="'+C+'"]',typeof p=="string"&&(C+='[crossorigin="'+p+'"]'),q6.has(C)||(q6.add(C),c={rel:c,crossOrigin:p,href:h},b.querySelector(C)===null&&(h=b.createElement("link"),Ns(h,"link",c),er(h),b.head.appendChild(h)))}}function YK(c){Dd.D(c),W6("dns-prefetch",c,null)}function KK(c,h){Dd.C(c,h),W6("preconnect",c,h)}function XK(c,h,p){Dd.L(c,h,p);var b=up;if(b&&c&&h){var C='link[rel="preload"][as="'+Ua(h)+'"]';h==="image"&&p&&p.imageSrcSet?(C+='[imagesrcset="'+Ua(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(C+='[imagesizes="'+Ua(p.imageSizes)+'"]')):C+='[href="'+Ua(c)+'"]';var O=C;switch(h){case"style":O=dp(c);break;case"script":O=fp(c)}El.has(O)||(c=m({rel:"preload",href:h==="image"&&p&&p.imageSrcSet?void 0:c,as:h},p),El.set(O,c),b.querySelector(C)!==null||h==="style"&&b.querySelector(vg(O))||h==="script"&&b.querySelector(yg(O))||(h=b.createElement("link"),Ns(h,"link",c),er(h),b.head.appendChild(h)))}}function ZK(c,h){Dd.m(c,h);var p=up;if(p&&c){var b=h&&typeof h.as=="string"?h.as:"script",C='link[rel="modulepreload"][as="'+Ua(b)+'"][href="'+Ua(c)+'"]',O=C;switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":O=fp(c)}if(!El.has(O)&&(c=m({rel:"modulepreload",href:c},h),El.set(O,c),p.querySelector(C)===null)){switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(yg(O)))return}b=p.createElement("link"),Ns(b,"link",c),er(b),p.head.appendChild(b)}}}function JK(c,h,p){Dd.S(c,h,p);var b=up;if(b&&c){var C=Gt(b).hoistableStyles,O=dp(c);h=h||"default";var ie=C.get(O);if(!ie){var Se={loading:0,preload:null};if(ie=b.querySelector(vg(O)))Se.loading=5;else{c=m({rel:"stylesheet",href:c,"data-precedence":h},p),(p=El.get(O))&&iN(c,p);var He=ie=b.createElement("link");er(He),Ns(He,"link",c),He._p=new Promise(function(xt,At){He.onload=xt,He.onerror=At}),He.addEventListener("load",function(){Se.loading|=1}),He.addEventListener("error",function(){Se.loading|=2}),Se.loading|=4,jy(ie,h,b)}ie={type:"stylesheet",instance:ie,count:1,state:Se},C.set(O,ie)}}}function QK(c,h){Dd.X(c,h);var p=up;if(p&&c){var b=Gt(p).hoistableScripts,C=fp(c),O=b.get(C);O||(O=p.querySelector(yg(C)),O||(c=m({src:c,async:!0},h),(h=El.get(C))&&sN(c,h),O=p.createElement("script"),er(O),Ns(O,"link",c),p.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},b.set(C,O))}}function eX(c,h){Dd.M(c,h);var p=up;if(p&&c){var b=Gt(p).hoistableScripts,C=fp(c),O=b.get(C);O||(O=p.querySelector(yg(C)),O||(c=m({src:c,async:!0,type:"module"},h),(h=El.get(C))&&sN(c,h),O=p.createElement("script"),er(O),Ns(O,"link",c),p.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},b.set(C,O))}}function G6(c,h,p,b){var C=(C=re.current)?wy(C):null;if(!C)throw Error(n(446));switch(c){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(h=dp(p.href),p=Gt(C).hoistableStyles,b=p.get(h),b||(b={type:"style",instance:null,count:0,state:null},p.set(h,b)),b):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){c=dp(p.href);var O=Gt(C).hoistableStyles,ie=O.get(c);if(ie||(C=C.ownerDocument||C,ie={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},O.set(c,ie),(O=C.querySelector(vg(c)))&&!O._p&&(ie.instance=O,ie.state.loading=5),El.has(c)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},El.set(c,p),O||tX(C,c,p,ie.state))),h&&b===null)throw Error(n(528,""));return ie}if(h&&b!==null)throw Error(n(529,""));return null;case"script":return h=p.async,p=p.src,typeof p=="string"&&h&&typeof h!="function"&&typeof h!="symbol"?(h=fp(p),p=Gt(C).hoistableScripts,b=p.get(h),b||(b={type:"script",instance:null,count:0,state:null},p.set(h,b)),b):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,c))}}function dp(c){return'href="'+Ua(c)+'"'}function vg(c){return'link[rel="stylesheet"]['+c+"]"}function Y6(c){return m({},c,{"data-precedence":c.precedence,precedence:null})}function tX(c,h,p,b){c.querySelector('link[rel="preload"][as="style"]['+h+"]")?b.loading=1:(h=c.createElement("link"),b.preload=h,h.addEventListener("load",function(){return b.loading|=1}),h.addEventListener("error",function(){return b.loading|=2}),Ns(h,"link",p),er(h),c.head.appendChild(h))}function fp(c){return'[src="'+Ua(c)+'"]'}function yg(c){return"script[async]"+c}function K6(c,h,p){if(h.count++,h.instance===null)switch(h.type){case"style":var b=c.querySelector('style[data-href~="'+Ua(p.href)+'"]');if(b)return h.instance=b,er(b),b;var C=m({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return b=(c.ownerDocument||c).createElement("style"),er(b),Ns(b,"style",C),jy(b,p.precedence,c),h.instance=b;case"stylesheet":C=dp(p.href);var O=c.querySelector(vg(C));if(O)return h.state.loading|=4,h.instance=O,er(O),O;b=Y6(p),(C=El.get(C))&&iN(b,C),O=(c.ownerDocument||c).createElement("link"),er(O);var ie=O;return ie._p=new Promise(function(Se,He){ie.onload=Se,ie.onerror=He}),Ns(O,"link",b),h.state.loading|=4,jy(O,p.precedence,c),h.instance=O;case"script":return O=fp(p.src),(C=c.querySelector(yg(O)))?(h.instance=C,er(C),C):(b=p,(C=El.get(O))&&(b=m({},p),sN(b,C)),c=c.ownerDocument||c,C=c.createElement("script"),er(C),Ns(C,"link",b),c.head.appendChild(C),h.instance=C);case"void":return null;default:throw Error(n(443,h.type))}else h.type==="stylesheet"&&(h.state.loading&4)===0&&(b=h.instance,h.state.loading|=4,jy(b,p.precedence,c));return h.instance}function jy(c,h,p){for(var b=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),C=b.length?b[b.length-1]:null,O=C,ie=0;ie<b.length;ie++){var Se=b[ie];if(Se.dataset.precedence===h)O=Se;else if(O!==C)break}O?O.parentNode.insertBefore(c,O.nextSibling):(h=p.nodeType===9?p.head:p,h.insertBefore(c,h.firstChild))}function iN(c,h){c.crossOrigin==null&&(c.crossOrigin=h.crossOrigin),c.referrerPolicy==null&&(c.referrerPolicy=h.referrerPolicy),c.title==null&&(c.title=h.title)}function sN(c,h){c.crossOrigin==null&&(c.crossOrigin=h.crossOrigin),c.referrerPolicy==null&&(c.referrerPolicy=h.referrerPolicy),c.integrity==null&&(c.integrity=h.integrity)}var Ny=null;function X6(c,h,p){if(Ny===null){var b=new Map,C=Ny=new Map;C.set(p,b)}else C=Ny,b=C.get(p),b||(b=new Map,C.set(p,b));if(b.has(c))return b;for(b.set(c,null),p=p.getElementsByTagName(c),C=0;C<p.length;C++){var O=p[C];if(!(O[mt]||O[Te]||c==="link"&&O.getAttribute("rel")==="stylesheet")&&O.namespaceURI!=="http://www.w3.org/2000/svg"){var ie=O.getAttribute(h)||"";ie=c+ie;var Se=b.get(ie);Se?Se.push(O):b.set(ie,[O])}}return b}function Z6(c,h,p){c=c.ownerDocument||c,c.head.insertBefore(p,h==="title"?c.querySelector("head > title"):null)}function rX(c,h,p){if(p===1||h.itemProp!=null)return!1;switch(c){case"meta":case"title":return!0;case"style":if(typeof h.precedence!="string"||typeof h.href!="string"||h.href==="")break;return!0;case"link":if(typeof h.rel!="string"||typeof h.href!="string"||h.href===""||h.onLoad||h.onError)break;switch(h.rel){case"stylesheet":return c=h.disabled,typeof h.precedence=="string"&&c==null;default:return!0}case"script":if(h.async&&typeof h.async!="function"&&typeof h.async!="symbol"&&!h.onLoad&&!h.onError&&h.src&&typeof h.src=="string")return!0}return!1}function J6(c){return!(c.type==="stylesheet"&&(c.state.loading&3)===0)}function nX(c,h,p,b){if(p.type==="stylesheet"&&(typeof b.media!="string"||matchMedia(b.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var C=dp(b.href),O=h.querySelector(vg(C));if(O){h=O._p,h!==null&&typeof h=="object"&&typeof h.then=="function"&&(c.count++,c=Sy.bind(c),h.then(c,c)),p.state.loading|=4,p.instance=O,er(O);return}O=h.ownerDocument||h,b=Y6(b),(C=El.get(C))&&iN(b,C),O=O.createElement("link"),er(O);var ie=O;ie._p=new Promise(function(Se,He){ie.onload=Se,ie.onerror=He}),Ns(O,"link",b),p.instance=O}c.stylesheets===null&&(c.stylesheets=new Map),c.stylesheets.set(p,h),(h=p.state.preload)&&(p.state.loading&3)===0&&(c.count++,p=Sy.bind(c),h.addEventListener("load",p),h.addEventListener("error",p))}}var oN=0;function aX(c,h){return c.stylesheets&&c.count===0&&ky(c,c.stylesheets),0<c.count||0<c.imgCount?function(p){var b=setTimeout(function(){if(c.stylesheets&&ky(c,c.stylesheets),c.unsuspend){var O=c.unsuspend;c.unsuspend=null,O()}},6e4+h);0<c.imgBytes&&oN===0&&(oN=62500*FK());var C=setTimeout(function(){if(c.waitingForImages=!1,c.count===0&&(c.stylesheets&&ky(c,c.stylesheets),c.unsuspend)){var O=c.unsuspend;c.unsuspend=null,O()}},(c.imgBytes>oN?50:800)+h);return c.unsuspend=p,function(){c.unsuspend=null,clearTimeout(b),clearTimeout(C)}}:null}function Sy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ky(this,this.stylesheets);else if(this.unsuspend){var c=this.unsuspend;this.unsuspend=null,c()}}}var Ay=null;function ky(c,h){c.stylesheets=null,c.unsuspend!==null&&(c.count++,Ay=new Map,h.forEach(iX,c),Ay=null,Sy.call(c))}function iX(c,h){if(!(h.state.loading&4)){var p=Ay.get(c);if(p)var b=p.get(null);else{p=new Map,Ay.set(c,p);for(var C=c.querySelectorAll("link[data-precedence],style[data-precedence]"),O=0;O<C.length;O++){var ie=C[O];(ie.nodeName==="LINK"||ie.getAttribute("media")!=="not all")&&(p.set(ie.dataset.precedence,ie),b=ie)}b&&p.set(null,b)}C=h.instance,ie=C.getAttribute("data-precedence"),O=p.get(ie)||b,O===b&&p.set(null,C),p.set(ie,C),this.count++,b=Sy.bind(this),C.addEventListener("load",b),C.addEventListener("error",b),O?O.parentNode.insertBefore(C,O.nextSibling):(c=c.nodeType===9?c.head:c,c.insertBefore(C,c.firstChild)),h.state.loading|=4}}var bg={$$typeof:A,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function sX(c,h,p,b,C,O,ie,Se,He){this.tag=1,this.containerInfo=c,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=Ur(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ur(0),this.hiddenUpdates=Ur(null),this.identifierPrefix=b,this.onUncaughtError=C,this.onCaughtError=O,this.onRecoverableError=ie,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=He,this.incompleteTransitions=new Map}function Q6(c,h,p,b,C,O,ie,Se,He,xt,At,Et){return c=new sX(c,h,p,ie,He,xt,At,Et,Se),h=1,O===!0&&(h|=24),O=Qi(3,null,null,h),c.current=O,O.stateNode=c,h=Df(),h.refCount++,c.pooledCache=h,h.refCount++,O.memoizedState={element:b,isDehydrated:p,cache:h},Kt(O),c}function eP(c){return c?(c=Ei,c):Ei}function tP(c,h,p,b,C,O){C=eP(C),b.context===null?b.context=C:b.pendingContext=C,b=Sr(h),b.payload={element:p},O=O===void 0?null:O,O!==null&&(b.callback=O),p=Br(c,b,h),p!==null&&(Oo(p,c,h),kn(p,c,h))}function rP(c,h){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var p=c.retryLane;c.retryLane=p!==0&&p<h?p:h}}function lN(c,h){rP(c,h),(c=c.alternate)&&rP(c,h)}function nP(c){if(c.tag===13||c.tag===31){var h=dc(c,67108864);h!==null&&Oo(h,c,67108864),lN(c,67108864)}}function aP(c){if(c.tag===13||c.tag===31){var h=al();h=Xr(h);var p=dc(c,h);p!==null&&Oo(p,c,h),lN(c,h)}}var Cy=!0;function oX(c,h,p,b){var C=Z.T;Z.T=null;var O=ne.p;try{ne.p=2,cN(c,h,p,b)}finally{ne.p=O,Z.T=C}}function lX(c,h,p,b){var C=Z.T;Z.T=null;var O=ne.p;try{ne.p=8,cN(c,h,p,b)}finally{ne.p=O,Z.T=C}}function cN(c,h,p,b){if(Cy){var C=uN(b);if(C===null)Kj(c,h,b,_y,p),sP(c,b);else if(uX(C,c,h,p,b))b.stopPropagation();else if(sP(c,b),h&4&&-1<cX.indexOf(c)){for(;C!==null;){var O=Xt(C);if(O!==null)switch(O.tag){case 3:if(O=O.stateNode,O.current.memoizedState.isDehydrated){var ie=Dt(O.pendingLanes);if(ie!==0){var Se=O;for(Se.pendingLanes|=2,Se.entangledLanes|=2;ie;){var He=1<<31-te(ie);Se.entanglements[1]|=He,ie&=~He}mu(O),(_n&6)===0&&(uy=we()+500,mg(0))}}break;case 31:case 13:Se=dc(O,2),Se!==null&&Oo(Se,O,2),fy(),lN(O,2)}if(O=uN(b),O===null&&Kj(c,h,b,_y,p),O===C)break;C=O}C!==null&&b.stopPropagation()}else Kj(c,h,b,null,p)}}function uN(c){return c=Yh(c),dN(c)}var _y=null;function dN(c){if(_y=null,c=Vt(c),c!==null){var h=s(c);if(h===null)c=null;else{var p=h.tag;if(p===13){if(c=o(h),c!==null)return c;c=null}else if(p===31){if(c=l(h),c!==null)return c;c=null}else if(p===3){if(h.stateNode.current.memoizedState.isDehydrated)return h.tag===3?h.stateNode.containerInfo:null;c=null}else h!==c&&(c=null)}}return _y=c,null}function iP(c){switch(c){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(J()){case ve:return 2;case Oe:return 8;case xe:case qe:return 32;case me:return 268435456;default:return 32}default:return 32}}var fN=!1,qf=null,Wf=null,Gf=null,wg=new Map,jg=new Map,Yf=[],cX="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 sP(c,h){switch(c){case"focusin":case"focusout":qf=null;break;case"dragenter":case"dragleave":Wf=null;break;case"mouseover":case"mouseout":Gf=null;break;case"pointerover":case"pointerout":wg.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":jg.delete(h.pointerId)}}function Ng(c,h,p,b,C,O){return c===null||c.nativeEvent!==O?(c={blockedOn:h,domEventName:p,eventSystemFlags:b,nativeEvent:O,targetContainers:[C]},h!==null&&(h=Xt(h),h!==null&&nP(h)),c):(c.eventSystemFlags|=b,h=c.targetContainers,C!==null&&h.indexOf(C)===-1&&h.push(C),c)}function uX(c,h,p,b,C){switch(h){case"focusin":return qf=Ng(qf,c,h,p,b,C),!0;case"dragenter":return Wf=Ng(Wf,c,h,p,b,C),!0;case"mouseover":return Gf=Ng(Gf,c,h,p,b,C),!0;case"pointerover":var O=C.pointerId;return wg.set(O,Ng(wg.get(O)||null,c,h,p,b,C)),!0;case"gotpointercapture":return O=C.pointerId,jg.set(O,Ng(jg.get(O)||null,c,h,p,b,C)),!0}return!1}function oP(c){var h=Vt(c.target);if(h!==null){var p=s(h);if(p!==null){if(h=p.tag,h===13){if(h=o(p),h!==null){c.blockedOn=h,Ie(c.priority,function(){aP(p)});return}}else if(h===31){if(h=l(p),h!==null){c.blockedOn=h,Ie(c.priority,function(){aP(p)});return}}else if(h===3&&p.stateNode.current.memoizedState.isDehydrated){c.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}c.blockedOn=null}function Ey(c){if(c.blockedOn!==null)return!1;for(var h=c.targetContainers;0<h.length;){var p=uN(c.nativeEvent);if(p===null){p=c.nativeEvent;var b=new p.constructor(p.type,p);wl=b,p.target.dispatchEvent(b),wl=null}else return h=Xt(p),h!==null&&nP(h),c.blockedOn=p,!1;h.shift()}return!0}function lP(c,h,p){Ey(c)&&p.delete(h)}function dX(){fN=!1,qf!==null&&Ey(qf)&&(qf=null),Wf!==null&&Ey(Wf)&&(Wf=null),Gf!==null&&Ey(Gf)&&(Gf=null),wg.forEach(lP),jg.forEach(lP)}function Ty(c,h){c.blockedOn===h&&(c.blockedOn=null,fN||(fN=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,dX)))}var Py=null;function cP(c){Py!==c&&(Py=c,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Py===c&&(Py=null);for(var h=0;h<c.length;h+=3){var p=c[h],b=c[h+1],C=c[h+2];if(typeof b!="function"){if(dN(b||p)===null)continue;break}var O=Xt(p);O!==null&&(c.splice(h,3),h-=3,uj(O,{pending:!0,data:C,method:p.method,action:b},b,C))}}))}function hp(c){function h(He){return Ty(He,c)}qf!==null&&Ty(qf,c),Wf!==null&&Ty(Wf,c),Gf!==null&&Ty(Gf,c),wg.forEach(h),jg.forEach(h);for(var p=0;p<Yf.length;p++){var b=Yf[p];b.blockedOn===c&&(b.blockedOn=null)}for(;0<Yf.length&&(p=Yf[0],p.blockedOn===null);)oP(p),p.blockedOn===null&&Yf.shift();if(p=(c.ownerDocument||c).$$reactFormReplay,p!=null)for(b=0;b<p.length;b+=3){var C=p[b],O=p[b+1],ie=C[Re]||null;if(typeof O=="function")ie||cP(p);else if(ie){var Se=null;if(O&&O.hasAttribute("formAction")){if(C=O,ie=O[Re]||null)Se=ie.formAction;else if(dN(C)!==null)continue}else Se=ie.action;typeof Se=="function"?p[b+1]=Se:(p.splice(b,3),b-=3),cP(p)}}}function uP(){function c(O){O.canIntercept&&O.info==="react-transition"&&O.intercept({handler:function(){return new Promise(function(ie){return C=ie})},focusReset:"manual",scroll:"manual"})}function h(){C!==null&&(C(),C=null),b||setTimeout(p,20)}function p(){if(!b&&!navigation.transition){var O=navigation.currentEntry;O&&O.url!=null&&navigation.navigate(O.url,{state:O.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var b=!1,C=null;return navigation.addEventListener("navigate",c),navigation.addEventListener("navigatesuccess",h),navigation.addEventListener("navigateerror",h),setTimeout(p,100),function(){b=!0,navigation.removeEventListener("navigate",c),navigation.removeEventListener("navigatesuccess",h),navigation.removeEventListener("navigateerror",h),C!==null&&(C(),C=null)}}}function hN(c){this._internalRoot=c}Dy.prototype.render=hN.prototype.render=function(c){var h=this._internalRoot;if(h===null)throw Error(n(409));var p=h.current,b=al();tP(p,b,c,h,null,null)},Dy.prototype.unmount=hN.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var h=c.containerInfo;tP(c.current,2,null,c,null,null),fy(),h[ze]=null}};function Dy(c){this._internalRoot=c}Dy.prototype.unstable_scheduleHydration=function(c){if(c){var h=ye();c={blockedOn:null,target:c,priority:h};for(var p=0;p<Yf.length&&h!==0&&h<Yf[p].priority;p++);Yf.splice(p,0,c),p===0&&oP(c)}};var dP=t.version;if(dP!=="19.2.4")throw Error(n(527,dP,"19.2.4"));ne.findDOMNode=function(c){var h=c._reactInternals;if(h===void 0)throw typeof c.render=="function"?Error(n(188)):(c=Object.keys(c).join(","),Error(n(268,c)));return c=d(h),c=c!==null?f(c):null,c=c===null?null:c.stateNode,c};var fX={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Oy=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Oy.isDisabled&&Oy.supportsFiber)try{it=Oy.inject(fX),st=Oy}catch{}}return Ag.createRoot=function(c,h){if(!a(c))throw Error(n(299));var p=!1,b="",C=vT,O=yT,ie=bT;return h!=null&&(h.unstable_strictMode===!0&&(p=!0),h.identifierPrefix!==void 0&&(b=h.identifierPrefix),h.onUncaughtError!==void 0&&(C=h.onUncaughtError),h.onCaughtError!==void 0&&(O=h.onCaughtError),h.onRecoverableError!==void 0&&(ie=h.onRecoverableError)),h=Q6(c,1,!1,null,null,p,b,null,C,O,ie,uP),c[ze]=h.current,Yj(c),new hN(h)},Ag.hydrateRoot=function(c,h,p){if(!a(c))throw Error(n(299));var b=!1,C="",O=vT,ie=yT,Se=bT,He=null;return p!=null&&(p.unstable_strictMode===!0&&(b=!0),p.identifierPrefix!==void 0&&(C=p.identifierPrefix),p.onUncaughtError!==void 0&&(O=p.onUncaughtError),p.onCaughtError!==void 0&&(ie=p.onCaughtError),p.onRecoverableError!==void 0&&(Se=p.onRecoverableError),p.formState!==void 0&&(He=p.formState)),h=Q6(c,1,!0,h,p??null,b,C,He,O,ie,Se,uP),h.context=eP(null),p=h.current,b=al(),b=Xr(b),C=Sr(b),C.callback=null,Br(p,C,b),p=b,h.current.lanes=p,Ht(h,p),mu(h),c[ze]=h.current,Yj(c),new Dy(h)},Ag.version="19.2.4",Ag}var wP;function AX(){if(wP)return xN.exports;wP=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),xN.exports=SX(),xN.exports}var kX=AX();/**
 * react-router v7.13.2
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */var jP="popstate";function NP(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function CX(e={}){function t(n,a){var d;let s=(d=a.state)==null?void 0:d.masked,{pathname:o,search:l,hash:u}=s||n.location;return m3("",{pathname:o,search:l,hash:u},a.state&&a.state.usr||null,a.state&&a.state.key||"default",s?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function r(n,a){return typeof a=="string"?a:yv(a)}return EX(t,r,null,e)}function Ra(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Wl(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function _X(){return Math.random().toString(36).substring(2,10)}function SP(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function m3(e,t,r=null,n,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?yx(t):t,state:r,key:t&&t.key||n||_X(),unstable_mask:a}}function yv({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function yx(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function EX(e,t,r,n={}){let{window:a=document.defaultView,v5Compat:s=!1}=n,o=a.history,l="POP",u=null,d=f();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function f(){return(o.state||{idx:null}).idx}function m(){l="POP";let w=f(),j=w==null?null:w-d;d=w,u&&u({action:l,location:v.location,delta:j})}function g(w,j){l="PUSH";let k=NP(w)?w:m3(v.location,w,j);d=f()+1;let A=SP(k,d),T=v.createHref(k.unstable_mask||k);try{o.pushState(A,"",T)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;a.location.assign(T)}s&&u&&u({action:l,location:v.location,delta:1})}function x(w,j){l="REPLACE";let k=NP(w)?w:m3(v.location,w,j);d=f();let A=SP(k,d),T=v.createHref(k.unstable_mask||k);o.replaceState(A,"",T),s&&u&&u({action:l,location:v.location,delta:0})}function y(w){return TX(w)}let v={get action(){return l},get location(){return e(a,o)},listen(w){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(jP,m),u=w,()=>{a.removeEventListener(jP,m),u=null}},createHref(w){return t(a,w)},createURL:y,encodeLocation(w){let j=y(w);return{pathname:j.pathname,search:j.search,hash:j.hash}},push:g,replace:x,go(w){return o.go(w)}};return v}function TX(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Ra(r,"No window.location.(origin|href) available to create URL");let n=typeof e=="string"?e:yv(e);return n=n.replace(/ $/,"%20"),!t&&n.startsWith("//")&&(n=r+n),new URL(n,r)}function W7(e,t,r="/"){return PX(e,t,r,!1)}function PX(e,t,r,n){let a=typeof t=="string"?yx(t):t,s=Zd(a.pathname||"/",r);if(s==null)return null;let o=G7(e);DX(o);let l=null;for(let u=0;l==null&&u<o.length;++u){let d=HX(s);l=UX(o[u],d,n)}return l}function G7(e,t=[],r=[],n="",a=!1){let s=(o,l,u=a,d)=>{let f={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(n)&&u)return;Ra(f.relativePath.startsWith(n),`Absolute route path "${f.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(n.length)}let m=Lu([n,f.relativePath]),g=r.concat(f);o.children&&o.children.length>0&&(Ra(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),G7(o.children,t,g,m,u)),!(o.path==null&&!o.index)&&t.push({path:m,score:BX(m,o.index),routesMeta:g})};return e.forEach((o,l)=>{var u;if(o.path===""||!((u=o.path)!=null&&u.includes("?")))s(o,l);else for(let d of Y7(o.path))s(o,l,!0,d)}),t}function Y7(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return a?[s,""]:[s];let o=Y7(n.join("/")),l=[];return l.push(...o.map(u=>u===""?s:[s,u].join("/"))),a&&l.push(...o),l.map(u=>e.startsWith("/")&&u===""?"/":u)}function DX(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:zX(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var OX=/^:[\w-]+$/,RX=3,MX=2,LX=1,IX=10,FX=-2,AP=e=>e==="*";function BX(e,t){let r=e.split("/"),n=r.length;return r.some(AP)&&(n+=FX),t&&(n+=MX),r.filter(a=>!AP(a)).reduce((a,s)=>a+(OX.test(s)?RX:s===""?LX:IX),n)}function zX(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function UX(e,t,r=!1){let{routesMeta:n}=e,a={},s="/",o=[];for(let l=0;l<n.length;++l){let u=n[l],d=l===n.length-1,f=s==="/"?t:t.slice(s.length)||"/",m=o2({path:u.relativePath,caseSensitive:u.caseSensitive,end:d},f),g=u.route;if(!m&&d&&r&&!n[n.length-1].route.index&&(m=o2({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},f)),!m)return null;Object.assign(a,m.params),o.push({params:a,pathname:Lu([s,m.pathname]),pathnameBase:GX(Lu([s,m.pathnameBase])),route:g}),m.pathnameBase!=="/"&&(s=Lu([s,m.pathnameBase]))}return o}function o2(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=$X(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let s=a[0],o=s.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce((d,{paramName:f,isOptional:m},g)=>{if(f==="*"){let y=l[g]||"";o=s.slice(0,s.length-y.length).replace(/(.)\/+$/,"$1")}const x=l[g];return m&&!x?d[f]=void 0:d[f]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:o,pattern:e}}function $X(e,t=!1,r=!0){Wl(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 n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,u,d,f)=>{if(n.push({paramName:l,isOptional:u!=null}),u){let m=f.charAt(d+o.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function HX(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Wl(!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 Zd(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}var VX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function qX(e,t="/"){let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?yx(e):e,s;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?s=kP(r.substring(1),"/"):s=kP(r,t)):s=t,{pathname:s,search:YX(n),hash:KX(a)}}function kP(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function bN(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}].  Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function WX(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function vk(e){let t=WX(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function Uw(e,t,r,n=!1){let a;typeof e=="string"?a=yx(e):(a={...e},Ra(!a.pathname||!a.pathname.includes("?"),bN("?","pathname","search",a)),Ra(!a.pathname||!a.pathname.includes("#"),bN("#","pathname","hash",a)),Ra(!a.search||!a.search.includes("#"),bN("#","search","hash",a)));let s=e===""||a.pathname==="",o=s?"/":a.pathname,l;if(o==null)l=r;else{let m=t.length-1;if(!n&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;a.pathname=g.join("/")}l=m>=0?t[m]:"/"}let u=qX(a,l),d=o&&o!=="/"&&o.endsWith("/"),f=(s||o===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(d||f)&&(u.pathname+="/"),u}var Lu=e=>e.join("/").replace(/\/\/+/g,"/"),GX=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),YX=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,KX=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,XX=class{constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function ZX(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function JX(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var K7=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function X7(e,t){let r=e;if(typeof r!="string"||!VX.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,a=!1;if(K7)try{let s=new URL(window.location.href),o=r.startsWith("//")?new URL(s.protocol+r):new URL(r),l=Zd(o.pathname,t);o.origin===s.origin&&l!=null?r=l+o.search+o.hash:a=!0}catch{Wl(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:a,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Z7=["POST","PUT","PATCH","DELETE"];new Set(Z7);var QX=["GET",...Z7];new Set(QX);var bx=N.createContext(null);bx.displayName="DataRouter";var $w=N.createContext(null);$w.displayName="DataRouterState";var eZ=N.createContext(!1),J7=N.createContext({isTransitioning:!1});J7.displayName="ViewTransition";var tZ=N.createContext(new Map);tZ.displayName="Fetchers";var rZ=N.createContext(null);rZ.displayName="Await";var yl=N.createContext(null);yl.displayName="Navigation";var s1=N.createContext(null);s1.displayName="Location";var Gu=N.createContext({outlet:null,matches:[],isDataRoute:!1});Gu.displayName="Route";var yk=N.createContext(null);yk.displayName="RouteError";var Q7="REACT_ROUTER_ERROR",nZ="REDIRECT",aZ="ROUTE_ERROR_RESPONSE";function iZ(e){if(e.startsWith(`${Q7}:${nZ}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function sZ(e){if(e.startsWith(`${Q7}:${aZ}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new XX(t.status,t.statusText,t.data)}catch{}}function oZ(e,{relative:t}={}){Ra(wx(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=N.useContext(yl),{hash:a,pathname:s,search:o}=o1(e,{relative:t}),l=s;return r!=="/"&&(l=s==="/"?r:Lu([r,s])),n.createHref({pathname:l,search:o,hash:a})}function wx(){return N.useContext(s1)!=null}function Ic(){return Ra(wx(),"useLocation() may be used only in the context of a <Router> component."),N.useContext(s1).location}var e9="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function t9(e){N.useContext(yl).static||N.useLayoutEffect(e)}function mo(){let{isDataRoute:e}=N.useContext(Gu);return e?bZ():lZ()}function lZ(){Ra(wx(),"useNavigate() may be used only in the context of a <Router> component.");let e=N.useContext(bx),{basename:t,navigator:r}=N.useContext(yl),{matches:n}=N.useContext(Gu),{pathname:a}=Ic(),s=JSON.stringify(vk(n)),o=N.useRef(!1);return t9(()=>{o.current=!0}),N.useCallback((u,d={})=>{if(Wl(o.current,e9),!o.current)return;if(typeof u=="number"){r.go(u);return}let f=Uw(u,JSON.parse(s),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Lu([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,s,a,e])}N.createContext(null);function o1(e,{relative:t}={}){let{matches:r}=N.useContext(Gu),{pathname:n}=Ic(),a=JSON.stringify(vk(r));return N.useMemo(()=>Uw(e,JSON.parse(a),n,t==="path"),[e,a,n,t])}function cZ(e,t){return r9(e,t)}function r9(e,t,r){var w;Ra(wx(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=N.useContext(yl),{matches:a}=N.useContext(Gu),s=a[a.length-1],o=s?s.params:{},l=s?s.pathname:"/",u=s?s.pathnameBase:"/",d=s&&s.route;{let j=d&&d.path||"";a9(l,!d||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${j}">) 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="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let f=Ic(),m;if(t){let j=typeof t=="string"?yx(t):t;Ra(u==="/"||((w=j.pathname)==null?void 0:w.startsWith(u)),`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 "${u}" but pathname "${j.pathname}" was given in the \`location\` prop.`),m=j}else m=f;let g=m.pathname||"/",x=g;if(u!=="/"){let j=u.replace(/^\//,"").split("/");x="/"+g.replace(/^\//,"").split("/").slice(j.length).join("/")}let y=W7(e,{pathname:x});Wl(d||y!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Wl(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.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 v=mZ(y&&y.map(j=>Object.assign({},j,{params:Object.assign({},o,j.params),pathname:Lu([u,n.encodeLocation?n.encodeLocation(j.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?u:Lu([u,n.encodeLocation?n.encodeLocation(j.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),a,r);return t&&v?N.createElement(s1.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...m},navigationType:"POP"}},v):v}function uZ(){let e=yZ(),t=ZX(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},s={padding:"2px 4px",backgroundColor:n},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=N.createElement(N.Fragment,null,N.createElement("p",null,"💿 Hey developer 👋"),N.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",N.createElement("code",{style:s},"ErrorBoundary")," or"," ",N.createElement("code",{style:s},"errorElement")," prop on your route.")),N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},t),r?N.createElement("pre",{style:a},r):null,o)}var dZ=N.createElement(uZ,null),n9=class extends N.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(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=sZ(e.digest);r&&(e=r)}let t=e!==void 0?N.createElement(Gu.Provider,{value:this.props.routeContext},N.createElement(yk.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?N.createElement(fZ,{error:e},t):t}};n9.contextType=eZ;var wN=new WeakMap;function fZ({children:e,error:t}){let{basename:r}=N.useContext(yl);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=iZ(t.digest);if(n){let a=wN.get(t);if(a)throw a;let s=X7(n.location,r);if(K7&&!wN.get(t))if(s.isExternal||n.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:n.replace}));throw wN.set(t,o),o}return N.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function hZ({routeContext:e,match:t,children:r}){let n=N.useContext(bx);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),N.createElement(Gu.Provider,{value:e},r)}function mZ(e,t=[],r){let n=r==null?void 0:r.state;if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,s=n==null?void 0:n.errors;if(s!=null){let f=a.findIndex(m=>m.route.id&&(s==null?void 0:s[m.route.id])!==void 0);Ra(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),a=a.slice(0,Math.min(a.length,f+1))}let o=!1,l=-1;if(r&&n){o=n.renderFallback;for(let f=0;f<a.length;f++){let m=a[f];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(l=f),m.route.id){let{loaderData:g,errors:x}=n,y=m.route.loader&&!g.hasOwnProperty(m.route.id)&&(!x||x[m.route.id]===void 0);if(m.route.lazy||y){r.isStatic&&(o=!0),l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}}let u=r==null?void 0:r.onError,d=n&&u?(f,m)=>{var g,x;u(f,{location:n.location,params:((x=(g=n.matches)==null?void 0:g[0])==null?void 0:x.params)??{},unstable_pattern:JX(n.matches),errorInfo:m})}:void 0;return a.reduceRight((f,m,g)=>{let x,y=!1,v=null,w=null;n&&(x=s&&m.route.id?s[m.route.id]:void 0,v=m.route.errorElement||dZ,o&&(l<0&&g===0?(a9("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,w=null):l===g&&(y=!0,w=m.route.hydrateFallbackElement||null)));let j=t.concat(a.slice(0,g+1)),k=()=>{let A;return x?A=v:y?A=w:m.route.Component?A=N.createElement(m.route.Component,null):m.route.element?A=m.route.element:A=f,N.createElement(hZ,{match:m,routeContext:{outlet:f,matches:j,isDataRoute:n!=null},children:A})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?N.createElement(n9,{location:n.location,revalidation:n.revalidation,component:v,error:x,children:k(),routeContext:{outlet:null,matches:j,isDataRoute:!0},onError:d}):k()},null)}function bk(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function pZ(e){let t=N.useContext(bx);return Ra(t,bk(e)),t}function xZ(e){let t=N.useContext($w);return Ra(t,bk(e)),t}function gZ(e){let t=N.useContext(Gu);return Ra(t,bk(e)),t}function wk(e){let t=gZ(e),r=t.matches[t.matches.length-1];return Ra(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function vZ(){return wk("useRouteId")}function yZ(){var n;let e=N.useContext(yk),t=xZ("useRouteError"),r=wk("useRouteError");return e!==void 0?e:(n=t.errors)==null?void 0:n[r]}function bZ(){let{router:e}=pZ("useNavigate"),t=wk("useNavigate"),r=N.useRef(!1);return t9(()=>{r.current=!0}),N.useCallback(async(a,s={})=>{Wl(r.current,e9),r.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...s}))},[e,t])}var CP={};function a9(e,t,r){!t&&!CP[e]&&(CP[e]=!0,Wl(!1,r))}N.memo(wZ);function wZ({routes:e,future:t,state:r,isStatic:n,onError:a}){return r9(e,void 0,{state:r,isStatic:n,onError:a})}function _P({to:e,replace:t,state:r,relative:n}){Ra(wx(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=N.useContext(yl);Wl(!a,"<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:s}=N.useContext(Gu),{pathname:o}=Ic(),l=mo(),u=Uw(e,vk(s),o,n==="path"),d=JSON.stringify(u);return N.useEffect(()=>{l(JSON.parse(d),{replace:t,state:r,relative:n})},[l,d,n,t,r]),null}function oi(e){Ra(!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 jZ({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:a,static:s=!1,unstable_useTransitions:o}){Ra(!wx(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),u=N.useMemo(()=>({basename:l,navigator:a,static:s,unstable_useTransitions:o,future:{}}),[l,a,s,o]);typeof r=="string"&&(r=yx(r));let{pathname:d="/",search:f="",hash:m="",state:g=null,key:x="default",unstable_mask:y}=r,v=N.useMemo(()=>{let w=Zd(d,l);return w==null?null:{location:{pathname:w,search:f,hash:m,state:g,key:x,unstable_mask:y},navigationType:n}},[l,d,f,m,g,x,n,y]);return Wl(v!=null,`<Router basename="${l}"> is not able to match the URL "${d}${f}${m}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:N.createElement(yl.Provider,{value:u},N.createElement(s1.Provider,{children:t,value:v}))}function NZ({children:e,location:t}){return cZ(p3(e),t)}function p3(e,t=[]){let r=[];return N.Children.forEach(e,(n,a)=>{if(!N.isValidElement(n))return;let s=[...t,a];if(n.type===N.Fragment){r.push.apply(r,p3(n.props.children,s));return}Ra(n.type===oi,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ra(!n.props.index||!n.props.children,"An index route cannot have child routes.");let o={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=p3(n.props.children,s)),r.push(o)}),r}var zb="get",Ub="application/x-www-form-urlencoded";function Hw(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function SZ(e){return Hw(e)&&e.tagName.toLowerCase()==="button"}function AZ(e){return Hw(e)&&e.tagName.toLowerCase()==="form"}function kZ(e){return Hw(e)&&e.tagName.toLowerCase()==="input"}function CZ(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function _Z(e,t){return e.button===0&&(!t||t==="_self")&&!CZ(e)}function x3(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function EZ(e,t){let r=x3(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(s=>{r.append(a,s)})}),r}var Ry=null;function TZ(){if(Ry===null)try{new FormData(document.createElement("form"),0),Ry=!1}catch{Ry=!0}return Ry}var PZ=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function jN(e){return e!=null&&!PZ.has(e)?(Wl(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ub}"`),null):e}function DZ(e,t){let r,n,a,s,o;if(AZ(e)){let l=e.getAttribute("action");n=l?Zd(l,t):null,r=e.getAttribute("method")||zb,a=jN(e.getAttribute("enctype"))||Ub,s=new FormData(e)}else if(SZ(e)||kZ(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||l.getAttribute("action");if(n=u?Zd(u,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||zb,a=jN(e.getAttribute("formenctype"))||jN(l.getAttribute("enctype"))||Ub,s=new FormData(l,e),!TZ()){let{name:d,type:f,value:m}=e;if(f==="image"){let g=d?`${d}.`:"";s.append(`${g}x`,"0"),s.append(`${g}y`,"0")}else d&&s.append(d,m)}}else{if(Hw(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=zb,n=null,a=Ub,o=e}return s&&a==="text/plain"&&(o=s,s=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function jk(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function OZ(e,t,r,n){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${n}`:a.pathname=`${a.pathname}.${n}`:a.pathname==="/"?a.pathname=`_root.${n}`:t&&Zd(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${n}`,a}async function RZ(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function MZ(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"}async function LZ(e,t,r){let n=await Promise.all(e.map(async a=>{let s=t.routes[a.route.id];if(s){let o=await RZ(s,r);return o.links?o.links():[]}return[]}));return zZ(n.flat(1).filter(MZ).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function EP(e,t,r,n,a,s){let o=(u,d)=>r[d]?u.route.id!==r[d].route.id:!0,l=(u,d)=>{var f;return r[d].pathname!==u.pathname||((f=r[d].route.path)==null?void 0:f.endsWith("*"))&&r[d].params["*"]!==u.params["*"]};return s==="assets"?t.filter((u,d)=>o(u,d)||l(u,d)):s==="data"?t.filter((u,d)=>{var m;let f=n.routes[u.route.id];if(!f||!f.hasLoader)return!1;if(o(u,d)||l(u,d))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((m=r[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function IZ(e,t,{includeHydrateFallback:r}={}){return FZ(e.map(n=>{let a=t.routes[n.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),r&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function FZ(e){return[...new Set(e)]}function BZ(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function zZ(e,t){let r=new Set;return new Set(t),e.reduce((n,a)=>{let s=JSON.stringify(BZ(a));return r.has(s)||(r.add(s),n.push({key:s,link:a})),n},[])}function i9(){let e=N.useContext(bx);return jk(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function UZ(){let e=N.useContext($w);return jk(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Nk=N.createContext(void 0);Nk.displayName="FrameworkContext";function s9(){let e=N.useContext(Nk);return jk(e,"You must render this element inside a <HydratedRouter> element"),e}function $Z(e,t){let r=N.useContext(Nk),[n,a]=N.useState(!1),[s,o]=N.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:d,onMouseLeave:f,onTouchStart:m}=t,g=N.useRef(null);N.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let v=j=>{j.forEach(k=>{o(k.isIntersecting)})},w=new IntersectionObserver(v,{threshold:.5});return g.current&&w.observe(g.current),()=>{w.disconnect()}}},[e]),N.useEffect(()=>{if(n){let v=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(v)}}},[n]);let x=()=>{a(!0)},y=()=>{a(!1),o(!1)};return r?e!=="intent"?[s,g,{}]:[s,g,{onFocus:kg(l,x),onBlur:kg(u,y),onMouseEnter:kg(d,x),onMouseLeave:kg(f,y),onTouchStart:kg(m,x)}]:[!1,g,{}]}function kg(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function HZ({page:e,...t}){let{router:r}=i9(),n=N.useMemo(()=>W7(r.routes,e,r.basename),[r.routes,e,r.basename]);return n?N.createElement(qZ,{page:e,matches:n,...t}):null}function VZ(e){let{manifest:t,routeModules:r}=s9(),[n,a]=N.useState([]);return N.useEffect(()=>{let s=!1;return LZ(e,t,r).then(o=>{s||a(o)}),()=>{s=!0}},[e,t,r]),n}function qZ({page:e,matches:t,...r}){let n=Ic(),{future:a,manifest:s,routeModules:o}=s9(),{basename:l}=i9(),{loaderData:u,matches:d}=UZ(),f=N.useMemo(()=>EP(e,t,d,s,n,"data"),[e,t,d,s,n]),m=N.useMemo(()=>EP(e,t,d,s,n,"assets"),[e,t,d,s,n]),g=N.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let v=new Set,w=!1;if(t.forEach(k=>{var T;let A=s.routes[k.route.id];!A||!A.hasLoader||(!f.some(M=>M.route.id===k.route.id)&&k.route.id in u&&((T=o[k.route.id])!=null&&T.shouldRevalidate)||A.hasClientLoader?w=!0:v.add(k.route.id))}),v.size===0)return[];let j=OZ(e,l,a.unstable_trailingSlashAwareDataRequests,"data");return w&&v.size>0&&j.searchParams.set("_routes",t.filter(k=>v.has(k.route.id)).map(k=>k.route.id).join(",")),[j.pathname+j.search]},[l,a.unstable_trailingSlashAwareDataRequests,u,n,s,f,t,e,o]),x=N.useMemo(()=>IZ(m,s),[m,s]),y=VZ(m);return N.createElement(N.Fragment,null,g.map(v=>N.createElement("link",{key:v,rel:"prefetch",as:"fetch",href:v,...r})),x.map(v=>N.createElement("link",{key:v,rel:"modulepreload",href:v,...r})),y.map(({key:v,link:w})=>N.createElement("link",{key:v,nonce:r.nonce,...w,crossOrigin:w.crossOrigin??r.crossOrigin})))}function WZ(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var GZ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{GZ&&(window.__reactRouterVersion="7.13.2")}catch{}function YZ({basename:e,children:t,unstable_useTransitions:r,window:n}){let a=N.useRef();a.current==null&&(a.current=CX({window:n,v5Compat:!0}));let s=a.current,[o,l]=N.useState({action:s.action,location:s.location}),u=N.useCallback(d=>{r===!1?l(d):N.startTransition(()=>l(d))},[r]);return N.useLayoutEffect(()=>s.listen(u),[s,u]),N.createElement(jZ,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:s,unstable_useTransitions:r})}var o9=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tx=N.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:a,reloadDocument:s,replace:o,unstable_mask:l,state:u,target:d,to:f,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:x,...y},v){let{basename:w,navigator:j,unstable_useTransitions:k}=N.useContext(yl),A=typeof f=="string"&&o9.test(f),T=X7(f,w);f=T.to;let M=oZ(f,{relative:a}),B=Ic(),L=null;if(l){let se=Uw(l,[],B.unstable_mask?B.unstable_mask.pathname:"/",!0);w!=="/"&&(se.pathname=se.pathname==="/"?w:Lu([w,se.pathname])),L=j.createHref(se)}let[F,I,q]=$Z(n,y),P=JZ(f,{replace:o,unstable_mask:l,state:u,target:d,preventScrollReset:m,relative:a,viewTransition:g,unstable_defaultShouldRevalidate:x,unstable_useTransitions:k});function R(se){t&&t(se),se.defaultPrevented||P(se)}let K=!(T.isExternal||s),ee=N.createElement("a",{...y,...q,href:(K?L:void 0)||T.absoluteURL||M,onClick:K?R:t,ref:WZ(v,I),target:d,"data-discover":!A&&r==="render"?"true":void 0});return F&&!A?N.createElement(N.Fragment,null,ee,N.createElement(HZ,{page:M})):ee});tx.displayName="Link";var KZ=N.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:a=!1,style:s,to:o,viewTransition:l,children:u,...d},f){let m=o1(o,{relative:d.relative}),g=Ic(),x=N.useContext($w),{navigator:y,basename:v}=N.useContext(yl),w=x!=null&&nJ(m)&&l===!0,j=y.encodeLocation?y.encodeLocation(m).pathname:m.pathname,k=g.pathname,A=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;r||(k=k.toLowerCase(),A=A?A.toLowerCase():null,j=j.toLowerCase()),A&&v&&(A=Zd(A,v)||A);const T=j!=="/"&&j.endsWith("/")?j.length-1:j.length;let M=k===j||!a&&k.startsWith(j)&&k.charAt(T)==="/",B=A!=null&&(A===j||!a&&A.startsWith(j)&&A.charAt(j.length)==="/"),L={isActive:M,isPending:B,isTransitioning:w},F=M?t:void 0,I;typeof n=="function"?I=n(L):I=[n,M?"active":null,B?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let q=typeof s=="function"?s(L):s;return N.createElement(tx,{...d,"aria-current":F,className:I,ref:f,style:q,to:o,viewTransition:l},typeof u=="function"?u(L):u)});KZ.displayName="NavLink";var XZ=N.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:a,state:s,method:o=zb,action:l,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:m,unstable_defaultShouldRevalidate:g,...x},y)=>{let{unstable_useTransitions:v}=N.useContext(yl),w=tJ(),j=rJ(l,{relative:d}),k=o.toLowerCase()==="get"?"get":"post",A=typeof l=="string"&&o9.test(l),T=M=>{if(u&&u(M),M.defaultPrevented)return;M.preventDefault();let B=M.nativeEvent.submitter,L=(B==null?void 0:B.getAttribute("formmethod"))||o,F=()=>w(B||M.currentTarget,{fetcherKey:t,method:L,navigate:r,replace:a,state:s,relative:d,preventScrollReset:f,viewTransition:m,unstable_defaultShouldRevalidate:g});v&&r!==!1?N.startTransition(()=>F()):F()};return N.createElement("form",{ref:y,method:k,action:j,onSubmit:n?u:T,...x,"data-discover":!A&&e==="render"?"true":void 0})});XZ.displayName="Form";function ZZ(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function l9(e){let t=N.useContext(bx);return Ra(t,ZZ(e)),t}function JZ(e,{target:t,replace:r,unstable_mask:n,state:a,preventScrollReset:s,relative:o,viewTransition:l,unstable_defaultShouldRevalidate:u,unstable_useTransitions:d}={}){let f=mo(),m=Ic(),g=o1(e,{relative:o});return N.useCallback(x=>{if(_Z(x,t)){x.preventDefault();let y=r!==void 0?r:yv(m)===yv(g),v=()=>f(e,{replace:y,unstable_mask:n,state:a,preventScrollReset:s,relative:o,viewTransition:l,unstable_defaultShouldRevalidate:u});d?N.startTransition(()=>v()):v()}},[m,f,g,r,n,a,t,e,s,o,l,u,d])}function sf(e){Wl(typeof URLSearchParams<"u","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=N.useRef(x3(e)),r=N.useRef(!1),n=Ic(),a=N.useMemo(()=>EZ(n.search,r.current?null:t.current),[n.search]),s=mo(),o=N.useCallback((l,u)=>{const d=x3(typeof l=="function"?l(new URLSearchParams(a)):l);r.current=!0,s("?"+d,u)},[s,a]);return[a,o]}var QZ=0,eJ=()=>`__${String(++QZ)}__`;function tJ(){let{router:e}=l9("useSubmit"),{basename:t}=N.useContext(yl),r=vZ(),n=e.fetch,a=e.navigate;return N.useCallback(async(s,o={})=>{let{action:l,method:u,encType:d,formData:f,body:m}=DZ(s,t);if(o.navigate===!1){let g=o.fetcherKey||eJ();await n(g,r,o.action||l,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:f,body:m,formMethod:o.method||u,formEncType:o.encType||d,flushSync:o.flushSync})}else await a(o.action||l,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:f,body:m,formMethod:o.method||u,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:r,flushSync:o.flushSync,viewTransition:o.viewTransition})},[n,a,t,r])}function rJ(e,{relative:t}={}){let{basename:r}=N.useContext(yl),n=N.useContext(Gu);Ra(n,"useFormAction must be used inside a RouteContext");let[a]=n.matches.slice(-1),s={...o1(e||".",{relative:t})},o=Ic();if(e==null){s.search=o.search;let l=new URLSearchParams(s.search),u=l.getAll("index");if(u.some(f=>f==="")){l.delete("index"),u.filter(m=>m).forEach(m=>l.append("index",m));let f=l.toString();s.search=f?`?${f}`:""}}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(s.pathname=s.pathname==="/"?r:Lu([r,s.pathname])),yv(s)}function nJ(e,{relative:t}={}){let r=N.useContext(J7);Ra(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=l9("useViewTransitionState"),a=o1(e,{relative:t});if(!r.isTransitioning)return!1;let s=Zd(r.currentLocation.pathname,n)||r.currentLocation.pathname,o=Zd(r.nextLocation.pathname,n)||r.nextLocation.pathname;return o2(a.pathname,o)!=null||o2(a.pathname,s)!=null}var jx=q7();const aJ=af(jx);function iJ(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const sJ=e=>{switch(e){case"success":return cJ;case"info":return dJ;case"warning":return uJ;case"error":return fJ;default:return null}},oJ=Array(12).fill(0),lJ=({visible:e,className:t})=>Mt.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Mt.createElement("div",{className:"sonner-spinner"},oJ.map((r,n)=>Mt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),cJ=Mt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Mt.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),uJ=Mt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Mt.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),dJ=Mt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Mt.createElement("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 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),fJ=Mt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Mt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),hJ=Mt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Mt.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Mt.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),mJ=()=>{const[e,t]=Mt.useState(document.hidden);return Mt.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let g3=1;class pJ{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:n,...a}=t,s=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:g3++,o=this.toasts.find(u=>u.id===s),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(u=>u.id===s?(this.publish({...u,...t,id:s,title:n}),{...u,...t,id:s,dismissible:l,title:n}):u):this.addToast({title:n,...a,dismissible:l,id:s}),s},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const a=Promise.resolve(t instanceof Function?t():t);let s=n!==void 0,o;const l=a.then(async d=>{if(o=["resolve",d],Mt.isValidElement(d))s=!1,this.create({id:n,type:"default",message:d});else if(gJ(d)&&!d.ok){s=!1;const m=typeof r.error=="function"?await r.error(`HTTP error! status: ${d.status}`):r.error,g=typeof r.description=="function"?await r.description(`HTTP error! status: ${d.status}`):r.description,y=typeof m=="object"&&!Mt.isValidElement(m)?m:{message:m};this.create({id:n,type:"error",description:g,...y})}else if(d instanceof Error){s=!1;const m=typeof r.error=="function"?await r.error(d):r.error,g=typeof r.description=="function"?await r.description(d):r.description,y=typeof m=="object"&&!Mt.isValidElement(m)?m:{message:m};this.create({id:n,type:"error",description:g,...y})}else if(r.success!==void 0){s=!1;const m=typeof r.success=="function"?await r.success(d):r.success,g=typeof r.description=="function"?await r.description(d):r.description,y=typeof m=="object"&&!Mt.isValidElement(m)?m:{message:m};this.create({id:n,type:"success",description:g,...y})}}).catch(async d=>{if(o=["reject",d],r.error!==void 0){s=!1;const f=typeof r.error=="function"?await r.error(d):r.error,m=typeof r.description=="function"?await r.description(d):r.description,x=typeof f=="object"&&!Mt.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:m,...x})}}).finally(()=>{s&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),u=()=>new Promise((d,f)=>l.then(()=>o[0]==="reject"?f(o[1]):d(o[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:u}:Object.assign(n,{unwrap:u})},this.custom=(t,r)=>{const n=(r==null?void 0:r.id)||g3++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ro=new pJ,xJ=(e,t)=>{const r=(t==null?void 0:t.id)||g3++;return Ro.addToast({title:e,...t,id:r}),r},gJ=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",vJ=xJ,yJ=()=>Ro.toasts,bJ=()=>Ro.getActiveToasts(),De=Object.assign(vJ,{success:Ro.success,info:Ro.info,warning:Ro.warning,error:Ro.error,custom:Ro.custom,message:Ro.message,promise:Ro.promise,dismiss:Ro.dismiss,loading:Ro.loading},{getHistory:yJ,getToasts:bJ});iJ("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function My(e){return e.label!==void 0}const wJ=3,jJ="24px",NJ="16px",TP=4e3,SJ=356,AJ=14,kJ=45,CJ=200;function pu(...e){return e.filter(Boolean).join(" ")}function _J(e){const[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}const EJ=e=>{var t,r,n,a,s,o,l,u,d;const{invert:f,toast:m,unstyled:g,interacting:x,setHeights:y,visibleToasts:v,heights:w,index:j,toasts:k,expanded:A,removeToast:T,defaultRichColors:M,closeButton:B,style:L,cancelButtonStyle:F,actionButtonStyle:I,className:q="",descriptionClassName:P="",duration:R,position:K,gap:ee,expandByDefault:se,classNames:Z,icons:ne,closeButtonAriaLabel:X="Close toast"}=e,[le,Ae]=Mt.useState(null),[ce,D]=Mt.useState(null),[H,G]=Mt.useState(!1),[E,re]=Mt.useState(!1),[he,oe]=Mt.useState(!1),[z,fe]=Mt.useState(!1),[de,W]=Mt.useState(!1),[ae,_e]=Mt.useState(0),[ue,ke]=Mt.useState(0),$e=Mt.useRef(m.duration||R||TP),Je=Mt.useRef(null),Xe=Mt.useRef(null),Ne=j===0,Ye=j+1<=v,at=m.type,Y=m.dismissible!==!1,we=m.className||"",J=m.descriptionClassName||"",ve=Mt.useMemo(()=>w.findIndex(Rt=>Rt.toastId===m.id)||0,[w,m.id]),Oe=Mt.useMemo(()=>{var Rt;return(Rt=m.closeButton)!=null?Rt:B},[m.closeButton,B]),xe=Mt.useMemo(()=>m.duration||R||TP,[m.duration,R]),qe=Mt.useRef(0),me=Mt.useRef(0),Ge=Mt.useRef(0),Be=Mt.useRef(null),[it,st]=K.split("-"),Ve=Mt.useMemo(()=>w.reduce((Rt,wr,gr)=>gr>=ve?Rt:Rt+wr.height,0),[w,ve]),te=mJ(),Ue=m.invert||f,ot=at==="loading";me.current=Mt.useMemo(()=>ve*ee+Ve,[ve,Ve]),Mt.useEffect(()=>{$e.current=xe},[xe]),Mt.useEffect(()=>{G(!0)},[]),Mt.useEffect(()=>{const Rt=Xe.current;if(Rt){const wr=Rt.getBoundingClientRect().height;return ke(wr),y(gr=>[{toastId:m.id,height:wr,position:m.position},...gr]),()=>y(gr=>gr.filter(Er=>Er.toastId!==m.id))}},[y,m.id]),Mt.useLayoutEffect(()=>{if(!H)return;const Rt=Xe.current,wr=Rt.style.height;Rt.style.height="auto";const gr=Rt.getBoundingClientRect().height;Rt.style.height=wr,ke(gr),y(Er=>Er.find(Ht=>Ht.toastId===m.id)?Er.map(Ht=>Ht.toastId===m.id?{...Ht,height:gr}:Ht):[{toastId:m.id,height:gr,position:m.position},...Er])},[H,m.title,m.description,y,m.id,m.jsx,m.action,m.cancel]);const vt=Mt.useCallback(()=>{re(!0),_e(me.current),y(Rt=>Rt.filter(wr=>wr.toastId!==m.id)),setTimeout(()=>{T(m)},CJ)},[m,T,y,me]);Mt.useEffect(()=>{if(m.promise&&at==="loading"||m.duration===1/0||m.type==="loading")return;let Rt;return A||x||te?(()=>{if(Ge.current<qe.current){const Er=new Date().getTime()-qe.current;$e.current=$e.current-Er}Ge.current=new Date().getTime()})():(()=>{$e.current!==1/0&&(qe.current=new Date().getTime(),Rt=setTimeout(()=>{m.onAutoClose==null||m.onAutoClose.call(m,m),vt()},$e.current))})(),()=>clearTimeout(Rt)},[A,x,m,at,te,vt]),Mt.useEffect(()=>{m.delete&&(vt(),m.onDismiss==null||m.onDismiss.call(m,m))},[vt,m.delete]);function _t(){var Rt;if(ne!=null&&ne.loading){var wr;return Mt.createElement("div",{className:pu(Z==null?void 0:Z.loader,m==null||(wr=m.classNames)==null?void 0:wr.loader,"sonner-loader"),"data-visible":at==="loading"},ne.loading)}return Mt.createElement(lJ,{className:pu(Z==null?void 0:Z.loader,m==null||(Rt=m.classNames)==null?void 0:Rt.loader),visible:at==="loading"})}const qt=m.icon||(ne==null?void 0:ne[at])||sJ(at);var Ft,Dt;return Mt.createElement("li",{tabIndex:0,ref:Xe,className:pu(q,we,Z==null?void 0:Z.toast,m==null||(t=m.classNames)==null?void 0:t.toast,Z==null?void 0:Z.default,Z==null?void 0:Z[at],m==null||(r=m.classNames)==null?void 0:r[at]),"data-sonner-toast":"","data-rich-colors":(Ft=m.richColors)!=null?Ft:M,"data-styled":!(m.jsx||m.unstyled||g),"data-mounted":H,"data-promise":!!m.promise,"data-swiped":de,"data-removed":E,"data-visible":Ye,"data-y-position":it,"data-x-position":st,"data-index":j,"data-front":Ne,"data-swiping":he,"data-dismissible":Y,"data-type":at,"data-invert":Ue,"data-swipe-out":z,"data-swipe-direction":ce,"data-expanded":!!(A||se&&H),"data-testid":m.testId,style:{"--index":j,"--toasts-before":j,"--z-index":k.length-j,"--offset":`${E?ae:me.current}px`,"--initial-height":se?"auto":`${ue}px`,...L,...m.style},onDragEnd:()=>{oe(!1),Ae(null),Be.current=null},onPointerDown:Rt=>{Rt.button!==2&&(ot||!Y||(Je.current=new Date,_e(me.current),Rt.target.setPointerCapture(Rt.pointerId),Rt.target.tagName!=="BUTTON"&&(oe(!0),Be.current={x:Rt.clientX,y:Rt.clientY})))},onPointerUp:()=>{var Rt,wr,gr;if(z||!Y)return;Be.current=null;const Er=Number(((Rt=Xe.current)==null?void 0:Rt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ur=Number(((wr=Xe.current)==null?void 0:wr.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ht=new Date().getTime()-((gr=Je.current)==null?void 0:gr.getTime()),It=le==="x"?Er:Ur,Rr=Math.abs(It)/Ht;if(Math.abs(It)>=kJ||Rr>.11){_e(me.current),m.onDismiss==null||m.onDismiss.call(m,m),D(le==="x"?Er>0?"right":"left":Ur>0?"down":"up"),vt(),fe(!0);return}else{var kr,qr;(kr=Xe.current)==null||kr.style.setProperty("--swipe-amount-x","0px"),(qr=Xe.current)==null||qr.style.setProperty("--swipe-amount-y","0px")}W(!1),oe(!1),Ae(null)},onPointerMove:Rt=>{var wr,gr,Er;if(!Be.current||!Y||((wr=window.getSelection())==null?void 0:wr.toString().length)>0)return;const Ht=Rt.clientY-Be.current.y,It=Rt.clientX-Be.current.x;var Rr;const kr=(Rr=e.swipeDirections)!=null?Rr:_J(K);!le&&(Math.abs(It)>1||Math.abs(Ht)>1)&&Ae(Math.abs(It)>Math.abs(Ht)?"x":"y");let qr={x:0,y:0};const Xr=Zr=>1/(1.5+Math.abs(Zr)/20);if(le==="y"){if(kr.includes("top")||kr.includes("bottom"))if(kr.includes("top")&&Ht<0||kr.includes("bottom")&&Ht>0)qr.y=Ht;else{const Zr=Ht*Xr(Ht);qr.y=Math.abs(Zr)<Math.abs(Ht)?Zr:Ht}}else if(le==="x"&&(kr.includes("left")||kr.includes("right")))if(kr.includes("left")&&It<0||kr.includes("right")&&It>0)qr.x=It;else{const Zr=It*Xr(It);qr.x=Math.abs(Zr)<Math.abs(It)?Zr:It}(Math.abs(qr.x)>0||Math.abs(qr.y)>0)&&W(!0),(gr=Xe.current)==null||gr.style.setProperty("--swipe-amount-x",`${qr.x}px`),(Er=Xe.current)==null||Er.style.setProperty("--swipe-amount-y",`${qr.y}px`)}},Oe&&!m.jsx&&at!=="loading"?Mt.createElement("button",{"aria-label":X,"data-disabled":ot,"data-close-button":!0,onClick:ot||!Y?()=>{}:()=>{vt(),m.onDismiss==null||m.onDismiss.call(m,m)},className:pu(Z==null?void 0:Z.closeButton,m==null||(n=m.classNames)==null?void 0:n.closeButton)},(Dt=ne==null?void 0:ne.close)!=null?Dt:hJ):null,(at||m.icon||m.promise)&&m.icon!==null&&((ne==null?void 0:ne[at])!==null||m.icon)?Mt.createElement("div",{"data-icon":"",className:pu(Z==null?void 0:Z.icon,m==null||(a=m.classNames)==null?void 0:a.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||_t():null,m.type!=="loading"?qt:null):null,Mt.createElement("div",{"data-content":"",className:pu(Z==null?void 0:Z.content,m==null||(s=m.classNames)==null?void 0:s.content)},Mt.createElement("div",{"data-title":"",className:pu(Z==null?void 0:Z.title,m==null||(o=m.classNames)==null?void 0:o.title)},m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title),m.description?Mt.createElement("div",{"data-description":"",className:pu(P,J,Z==null?void 0:Z.description,m==null||(l=m.classNames)==null?void 0:l.description)},typeof m.description=="function"?m.description():m.description):null),Mt.isValidElement(m.cancel)?m.cancel:m.cancel&&My(m.cancel)?Mt.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||F,onClick:Rt=>{My(m.cancel)&&Y&&(m.cancel.onClick==null||m.cancel.onClick.call(m.cancel,Rt),vt())},className:pu(Z==null?void 0:Z.cancelButton,m==null||(u=m.classNames)==null?void 0:u.cancelButton)},m.cancel.label):null,Mt.isValidElement(m.action)?m.action:m.action&&My(m.action)?Mt.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||I,onClick:Rt=>{My(m.action)&&(m.action.onClick==null||m.action.onClick.call(m.action,Rt),!Rt.defaultPrevented&&vt())},className:pu(Z==null?void 0:Z.actionButton,m==null||(d=m.classNames)==null?void 0:d.actionButton)},m.action.label):null)};function PP(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function TJ(e,t){const r={};return[e,t].forEach((n,a)=>{const s=a===1,o=s?"--mobile-offset":"--offset",l=s?NJ:jJ;function u(d){["top","right","bottom","left"].forEach(f=>{r[`${o}-${f}`]=typeof d=="number"?`${d}px`:d})}typeof n=="number"||typeof n=="string"?u(n):typeof n=="object"?["top","right","bottom","left"].forEach(d=>{n[d]===void 0?r[`${o}-${d}`]=l:r[`${o}-${d}`]=typeof n[d]=="number"?`${n[d]}px`:n[d]}):u(l)}),r}const PJ=Mt.forwardRef(function(t,r){const{id:n,invert:a,position:s="bottom-right",hotkey:o=["altKey","KeyT"],expand:l,closeButton:u,className:d,offset:f,mobileOffset:m,theme:g="light",richColors:x,duration:y,style:v,visibleToasts:w=wJ,toastOptions:j,dir:k=PP(),gap:A=AJ,icons:T,containerAriaLabel:M="Notifications"}=t,[B,L]=Mt.useState([]),F=Mt.useMemo(()=>n?B.filter(H=>H.toasterId===n):B.filter(H=>!H.toasterId),[B,n]),I=Mt.useMemo(()=>Array.from(new Set([s].concat(F.filter(H=>H.position).map(H=>H.position)))),[F,s]),[q,P]=Mt.useState([]),[R,K]=Mt.useState(!1),[ee,se]=Mt.useState(!1),[Z,ne]=Mt.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),X=Mt.useRef(null),le=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),Ae=Mt.useRef(null),ce=Mt.useRef(!1),D=Mt.useCallback(H=>{L(G=>{var E;return(E=G.find(re=>re.id===H.id))!=null&&E.delete||Ro.dismiss(H.id),G.filter(({id:re})=>re!==H.id)})},[]);return Mt.useEffect(()=>Ro.subscribe(H=>{if(H.dismiss){requestAnimationFrame(()=>{L(G=>G.map(E=>E.id===H.id?{...E,delete:!0}:E))});return}setTimeout(()=>{aJ.flushSync(()=>{L(G=>{const E=G.findIndex(re=>re.id===H.id);return E!==-1?[...G.slice(0,E),{...G[E],...H},...G.slice(E+1)]:[H,...G]})})})}),[B]),Mt.useEffect(()=>{if(g!=="system"){ne(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ne("dark"):ne("light")),typeof window>"u")return;const H=window.matchMedia("(prefers-color-scheme: dark)");try{H.addEventListener("change",({matches:G})=>{ne(G?"dark":"light")})}catch{H.addListener(({matches:E})=>{try{ne(E?"dark":"light")}catch(re){console.error(re)}})}},[g]),Mt.useEffect(()=>{B.length<=1&&K(!1)},[B]),Mt.useEffect(()=>{const H=G=>{var E;if(o.every(oe=>G[oe]||G.code===oe)){var he;K(!0),(he=X.current)==null||he.focus()}G.code==="Escape"&&(document.activeElement===X.current||(E=X.current)!=null&&E.contains(document.activeElement))&&K(!1)};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[o]),Mt.useEffect(()=>{if(X.current)return()=>{Ae.current&&(Ae.current.focus({preventScroll:!0}),Ae.current=null,ce.current=!1)}},[X.current]),Mt.createElement("section",{ref:r,"aria-label":`${M} ${le}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},I.map((H,G)=>{var E;const[re,he]=H.split("-");return F.length?Mt.createElement("ol",{key:H,dir:k==="auto"?PP():k,tabIndex:-1,ref:X,className:d,"data-sonner-toaster":!0,"data-sonner-theme":Z,"data-y-position":re,"data-x-position":he,style:{"--front-toast-height":`${((E=q[0])==null?void 0:E.height)||0}px`,"--width":`${SJ}px`,"--gap":`${A}px`,...v,...TJ(f,m)},onBlur:oe=>{ce.current&&!oe.currentTarget.contains(oe.relatedTarget)&&(ce.current=!1,Ae.current&&(Ae.current.focus({preventScroll:!0}),Ae.current=null))},onFocus:oe=>{oe.target instanceof HTMLElement&&oe.target.dataset.dismissible==="false"||ce.current||(ce.current=!0,Ae.current=oe.relatedTarget)},onMouseEnter:()=>K(!0),onMouseMove:()=>K(!0),onMouseLeave:()=>{ee||K(!1)},onDragEnd:()=>K(!1),onPointerDown:oe=>{oe.target instanceof HTMLElement&&oe.target.dataset.dismissible==="false"||se(!0)},onPointerUp:()=>se(!1)},F.filter(oe=>!oe.position&&G===0||oe.position===H).map((oe,z)=>{var fe,de;return Mt.createElement(EJ,{key:oe.id,icons:T,index:z,toast:oe,defaultRichColors:x,duration:(fe=j==null?void 0:j.duration)!=null?fe:y,className:j==null?void 0:j.className,descriptionClassName:j==null?void 0:j.descriptionClassName,invert:a,visibleToasts:w,closeButton:(de=j==null?void 0:j.closeButton)!=null?de:u,interacting:ee,position:H,style:j==null?void 0:j.style,unstyled:j==null?void 0:j.unstyled,classNames:j==null?void 0:j.classNames,cancelButtonStyle:j==null?void 0:j.cancelButtonStyle,actionButtonStyle:j==null?void 0:j.actionButtonStyle,closeButtonAriaLabel:j==null?void 0:j.closeButtonAriaLabel,removeToast:D,toasts:F.filter(W=>W.position==oe.position),heights:q.filter(W=>W.position==oe.position),setHeights:P,expandByDefault:l,gap:A,expanded:R,swipeDirections:t.swipeDirections})})):null}))});function c9(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=c9(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function mn(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=c9(e))&&(n&&(n+=" "),n+=t);return n}const DJ=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},OJ=(e,t)=>({classGroupId:e,validator:t}),u9=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),l2="-",DP=[],RJ="arbitrary..",MJ=e=>{const t=IJ(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return LJ(o);const l=o.split(l2),u=l[0]===""&&l.length>1?1:0;return d9(l,u,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const u=n[o],d=r[o];return u?d?DJ(d,u):u:d||DP}return r[o]||DP}}},d9=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const a=e[t],s=r.nextPart.get(a);if(s){const d=d9(e,t+1,s);if(d)return d}const o=r.validators;if(o===null)return;const l=t===0?e.join(l2):e.slice(t).join(l2),u=o.length;for(let d=0;d<u;d++){const f=o[d];if(f.validator(l))return f.classGroupId}},LJ=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?RJ+n:void 0})(),IJ=e=>{const{theme:t,classGroups:r}=e;return FJ(r,t)},FJ=(e,t)=>{const r=u9();for(const n in e){const a=e[n];Sk(a,r,n,t)}return r},Sk=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const o=e[s];BJ(o,t,r,n)}},BJ=(e,t,r,n)=>{if(typeof e=="string"){zJ(e,t,r);return}if(typeof e=="function"){UJ(e,t,r,n);return}$J(e,t,r,n)},zJ=(e,t,r)=>{const n=e===""?t:f9(t,e);n.classGroupId=r},UJ=(e,t,r,n)=>{if(HJ(e)){Sk(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(OJ(r,e))},$J=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let o=0;o<s;o++){const[l,u]=a[o];Sk(u,f9(t,l),r,n)}},f9=(e,t)=>{let r=e;const n=t.split(l2),a=n.length;for(let s=0;s<a;s++){const o=n[s];let l=r.nextPart.get(o);l||(l=u9(),r.nextPart.set(o,l)),r=l}return r},HJ=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,VJ=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(s,o)=>{r[s]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let o=r[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return a(s,o),o},set(s,o){s in r?r[s]=o:a(s,o)}}},v3="!",OP=":",qJ=[],RP=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),WJ=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let o=0,l=0,u=0,d;const f=a.length;for(let v=0;v<f;v++){const w=a[v];if(o===0&&l===0){if(w===OP){s.push(a.slice(u,v)),u=v+1;continue}if(w==="/"){d=v;continue}}w==="["?o++:w==="]"?o--:w==="("?l++:w===")"&&l--}const m=s.length===0?a:a.slice(u);let g=m,x=!1;m.endsWith(v3)?(g=m.slice(0,-1),x=!0):m.startsWith(v3)&&(g=m.slice(1),x=!0);const y=d&&d>u?d-u:void 0;return RP(s,x,g,y)};if(t){const a=t+OP,s=n;n=o=>o.startsWith(a)?s(o.slice(a.length)):RP(qJ,!1,o,void 0,!0)}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},GJ=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let s=0;s<r.length;s++){const o=r[s],l=o[0]==="[",u=t.has(o);l||u?(a.length>0&&(a.sort(),n.push(...a),a=[]),n.push(o)):a.push(o)}return a.length>0&&(a.sort(),n.push(...a)),n}},YJ=e=>({cache:VJ(e.cacheSize),parseClassName:WJ(e),sortModifiers:GJ(e),...MJ(e)}),KJ=/\s+/,XJ=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,o=[],l=e.trim().split(KJ);let u="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:m,modifiers:g,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:v}=r(f);if(m){u=f+(u.length>0?" "+u:u);continue}let w=!!v,j=n(w?y.substring(0,v):y);if(!j){if(!w){u=f+(u.length>0?" "+u:u);continue}if(j=n(y),!j){u=f+(u.length>0?" "+u:u);continue}w=!1}const k=g.length===0?"":g.length===1?g[0]:s(g).join(":"),A=x?k+v3:k,T=A+j;if(o.indexOf(T)>-1)continue;o.push(T);const M=a(j,w);for(let B=0;B<M.length;++B){const L=M[B];o.push(A+L)}u=f+(u.length>0?" "+u:u)}return u},ZJ=(...e)=>{let t=0,r,n,a="";for(;t<e.length;)(r=e[t++])&&(n=h9(r))&&(a&&(a+=" "),a+=n);return a},h9=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=h9(e[n]))&&(r&&(r+=" "),r+=t);return r},JJ=(e,...t)=>{let r,n,a,s;const o=u=>{const d=t.reduce((f,m)=>m(f),e());return r=YJ(d),n=r.cache.get,a=r.cache.set,s=l,l(u)},l=u=>{const d=n(u);if(d)return d;const f=XJ(u,r);return a(u,f),f};return s=o,(...u)=>s(ZJ(...u))},QJ=[],Mi=e=>{const t=r=>r[e]||QJ;return t.isThemeGetter=!0,t},m9=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,p9=/^\((?:(\w[\w-]*):)?(.+)\)$/i,eQ=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,tQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rQ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,nQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,aQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,iQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xf=e=>eQ.test(e),Gr=e=>!!e&&!Number.isNaN(Number(e)),Zf=e=>!!e&&Number.isInteger(Number(e)),NN=e=>e.endsWith("%")&&Gr(e.slice(0,-1)),Od=e=>tQ.test(e),x9=()=>!0,sQ=e=>rQ.test(e)&&!nQ.test(e),Ak=()=>!1,oQ=e=>aQ.test(e),lQ=e=>iQ.test(e),cQ=e=>!ur(e)&&!hr(e),uQ=e=>Dh(e,y9,Ak),ur=e=>m9.test(e),pm=e=>Dh(e,b9,sQ),MP=e=>Dh(e,vQ,Gr),dQ=e=>Dh(e,j9,x9),fQ=e=>Dh(e,w9,Ak),LP=e=>Dh(e,g9,Ak),hQ=e=>Dh(e,v9,lQ),Ly=e=>Dh(e,N9,oQ),hr=e=>p9.test(e),Cg=e=>p0(e,b9),mQ=e=>p0(e,w9),IP=e=>p0(e,g9),pQ=e=>p0(e,y9),xQ=e=>p0(e,v9),Iy=e=>p0(e,N9,!0),gQ=e=>p0(e,j9,!0),Dh=(e,t,r)=>{const n=m9.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},p0=(e,t,r=!1)=>{const n=p9.exec(e);return n?n[1]?t(n[1]):r:!1},g9=e=>e==="position"||e==="percentage",v9=e=>e==="image"||e==="url",y9=e=>e==="length"||e==="size"||e==="bg-size",b9=e=>e==="length",vQ=e=>e==="number",w9=e=>e==="family-name",j9=e=>e==="number"||e==="weight",N9=e=>e==="shadow",yQ=()=>{const e=Mi("color"),t=Mi("font"),r=Mi("text"),n=Mi("font-weight"),a=Mi("tracking"),s=Mi("leading"),o=Mi("breakpoint"),l=Mi("container"),u=Mi("spacing"),d=Mi("radius"),f=Mi("shadow"),m=Mi("inset-shadow"),g=Mi("text-shadow"),x=Mi("drop-shadow"),y=Mi("blur"),v=Mi("perspective"),w=Mi("aspect"),j=Mi("ease"),k=Mi("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],M=()=>[...T(),hr,ur],B=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],F=()=>[hr,ur,u],I=()=>[Xf,"full","auto",...F()],q=()=>[Zf,"none","subgrid",hr,ur],P=()=>["auto",{span:["full",Zf,hr,ur]},Zf,hr,ur],R=()=>[Zf,"auto",hr,ur],K=()=>["auto","min","max","fr",hr,ur],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],se=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...F()],ne=()=>[Xf,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...F()],X=()=>[Xf,"screen","full","dvw","lvw","svw","min","max","fit",...F()],le=()=>[Xf,"screen","full","lh","dvh","lvh","svh","min","max","fit",...F()],Ae=()=>[e,hr,ur],ce=()=>[...T(),IP,LP,{position:[hr,ur]}],D=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",pQ,uQ,{size:[hr,ur]}],G=()=>[NN,Cg,pm],E=()=>["","none","full",d,hr,ur],re=()=>["",Gr,Cg,pm],he=()=>["solid","dashed","dotted","double"],oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>[Gr,NN,IP,LP],fe=()=>["","none",y,hr,ur],de=()=>["none",Gr,hr,ur],W=()=>["none",Gr,hr,ur],ae=()=>[Gr,hr,ur],_e=()=>[Xf,"full",...F()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Od],breakpoint:[Od],color:[x9],container:[Od],"drop-shadow":[Od],ease:["in","out","in-out"],font:[cQ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Od],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Od],shadow:[Od],spacing:["px",Gr],text:[Od],"text-shadow":[Od],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Xf,ur,hr,w]}],container:["container"],columns:[{columns:[Gr,ur,hr,l]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:M()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Zf,"auto",hr,ur]}],basis:[{basis:[Xf,"full","auto",l,...F()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Gr,Xf,"auto","initial","none",ur]}],grow:[{grow:["",Gr,hr,ur]}],shrink:[{shrink:["",Gr,hr,ur]}],order:[{order:[Zf,"first","last","none",hr,ur]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:F()}],"gap-x":[{"gap-x":F()}],"gap-y":[{"gap-y":F()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...se(),"normal"]}],"justify-self":[{"justify-self":["auto",...se()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...se(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...se(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...se(),"baseline"]}],"place-self":[{"place-self":["auto",...se()]}],p:[{p:F()}],px:[{px:F()}],py:[{py:F()}],ps:[{ps:F()}],pe:[{pe:F()}],pbs:[{pbs:F()}],pbe:[{pbe:F()}],pt:[{pt:F()}],pr:[{pr:F()}],pb:[{pb:F()}],pl:[{pl:F()}],m:[{m:Z()}],mx:[{mx:Z()}],my:[{my:Z()}],ms:[{ms:Z()}],me:[{me:Z()}],mbs:[{mbs:Z()}],mbe:[{mbe:Z()}],mt:[{mt:Z()}],mr:[{mr:Z()}],mb:[{mb:Z()}],ml:[{ml:Z()}],"space-x":[{"space-x":F()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":F()}],"space-y-reverse":["space-y-reverse"],size:[{size:ne()}],"inline-size":[{inline:["auto",...X()]}],"min-inline-size":[{"min-inline":["auto",...X()]}],"max-inline-size":[{"max-inline":["none",...X()]}],"block-size":[{block:["auto",...le()]}],"min-block-size":[{"min-block":["auto",...le()]}],"max-block-size":[{"max-block":["none",...le()]}],w:[{w:[l,"screen",...ne()]}],"min-w":[{"min-w":[l,"screen","none",...ne()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...ne()]}],h:[{h:["screen","lh",...ne()]}],"min-h":[{"min-h":["screen","lh","none",...ne()]}],"max-h":[{"max-h":["screen","lh",...ne()]}],"font-size":[{text:["base",r,Cg,pm]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,gQ,dQ]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",NN,ur]}],"font-family":[{font:[mQ,fQ,t]}],"font-features":[{"font-features":[ur]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,hr,ur]}],"line-clamp":[{"line-clamp":[Gr,"none",hr,MP]}],leading:[{leading:[s,...F()]}],"list-image":[{"list-image":["none",hr,ur]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",hr,ur]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Ae()}],"text-color":[{text:Ae()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[Gr,"from-font","auto",hr,pm]}],"text-decoration-color":[{decoration:Ae()}],"underline-offset":[{"underline-offset":[Gr,"auto",hr,ur]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",hr,ur]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",hr,ur]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ce()}],"bg-repeat":[{bg:D()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zf,hr,ur],radial:["",hr,ur],conic:[Zf,hr,ur]},xQ,hQ]}],"bg-color":[{bg:Ae()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:Ae()}],"gradient-via":[{via:Ae()}],"gradient-to":[{to:Ae()}],rounded:[{rounded:E()}],"rounded-s":[{"rounded-s":E()}],"rounded-e":[{"rounded-e":E()}],"rounded-t":[{"rounded-t":E()}],"rounded-r":[{"rounded-r":E()}],"rounded-b":[{"rounded-b":E()}],"rounded-l":[{"rounded-l":E()}],"rounded-ss":[{"rounded-ss":E()}],"rounded-se":[{"rounded-se":E()}],"rounded-ee":[{"rounded-ee":E()}],"rounded-es":[{"rounded-es":E()}],"rounded-tl":[{"rounded-tl":E()}],"rounded-tr":[{"rounded-tr":E()}],"rounded-br":[{"rounded-br":E()}],"rounded-bl":[{"rounded-bl":E()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-bs":[{"border-bs":re()}],"border-w-be":[{"border-be":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:Ae()}],"border-color-x":[{"border-x":Ae()}],"border-color-y":[{"border-y":Ae()}],"border-color-s":[{"border-s":Ae()}],"border-color-e":[{"border-e":Ae()}],"border-color-bs":[{"border-bs":Ae()}],"border-color-be":[{"border-be":Ae()}],"border-color-t":[{"border-t":Ae()}],"border-color-r":[{"border-r":Ae()}],"border-color-b":[{"border-b":Ae()}],"border-color-l":[{"border-l":Ae()}],"divide-color":[{divide:Ae()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Gr,hr,ur]}],"outline-w":[{outline:["",Gr,Cg,pm]}],"outline-color":[{outline:Ae()}],shadow:[{shadow:["","none",f,Iy,Ly]}],"shadow-color":[{shadow:Ae()}],"inset-shadow":[{"inset-shadow":["none",m,Iy,Ly]}],"inset-shadow-color":[{"inset-shadow":Ae()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Ae()}],"ring-offset-w":[{"ring-offset":[Gr,pm]}],"ring-offset-color":[{"ring-offset":Ae()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":Ae()}],"text-shadow":[{"text-shadow":["none",g,Iy,Ly]}],"text-shadow-color":[{"text-shadow":Ae()}],opacity:[{opacity:[Gr,hr,ur]}],"mix-blend":[{"mix-blend":[...oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":oe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Gr]}],"mask-image-linear-from-pos":[{"mask-linear-from":z()}],"mask-image-linear-to-pos":[{"mask-linear-to":z()}],"mask-image-linear-from-color":[{"mask-linear-from":Ae()}],"mask-image-linear-to-color":[{"mask-linear-to":Ae()}],"mask-image-t-from-pos":[{"mask-t-from":z()}],"mask-image-t-to-pos":[{"mask-t-to":z()}],"mask-image-t-from-color":[{"mask-t-from":Ae()}],"mask-image-t-to-color":[{"mask-t-to":Ae()}],"mask-image-r-from-pos":[{"mask-r-from":z()}],"mask-image-r-to-pos":[{"mask-r-to":z()}],"mask-image-r-from-color":[{"mask-r-from":Ae()}],"mask-image-r-to-color":[{"mask-r-to":Ae()}],"mask-image-b-from-pos":[{"mask-b-from":z()}],"mask-image-b-to-pos":[{"mask-b-to":z()}],"mask-image-b-from-color":[{"mask-b-from":Ae()}],"mask-image-b-to-color":[{"mask-b-to":Ae()}],"mask-image-l-from-pos":[{"mask-l-from":z()}],"mask-image-l-to-pos":[{"mask-l-to":z()}],"mask-image-l-from-color":[{"mask-l-from":Ae()}],"mask-image-l-to-color":[{"mask-l-to":Ae()}],"mask-image-x-from-pos":[{"mask-x-from":z()}],"mask-image-x-to-pos":[{"mask-x-to":z()}],"mask-image-x-from-color":[{"mask-x-from":Ae()}],"mask-image-x-to-color":[{"mask-x-to":Ae()}],"mask-image-y-from-pos":[{"mask-y-from":z()}],"mask-image-y-to-pos":[{"mask-y-to":z()}],"mask-image-y-from-color":[{"mask-y-from":Ae()}],"mask-image-y-to-color":[{"mask-y-to":Ae()}],"mask-image-radial":[{"mask-radial":[hr,ur]}],"mask-image-radial-from-pos":[{"mask-radial-from":z()}],"mask-image-radial-to-pos":[{"mask-radial-to":z()}],"mask-image-radial-from-color":[{"mask-radial-from":Ae()}],"mask-image-radial-to-color":[{"mask-radial-to":Ae()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Gr]}],"mask-image-conic-from-pos":[{"mask-conic-from":z()}],"mask-image-conic-to-pos":[{"mask-conic-to":z()}],"mask-image-conic-from-color":[{"mask-conic-from":Ae()}],"mask-image-conic-to-color":[{"mask-conic-to":Ae()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:D()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",hr,ur]}],filter:[{filter:["","none",hr,ur]}],blur:[{blur:fe()}],brightness:[{brightness:[Gr,hr,ur]}],contrast:[{contrast:[Gr,hr,ur]}],"drop-shadow":[{"drop-shadow":["","none",x,Iy,Ly]}],"drop-shadow-color":[{"drop-shadow":Ae()}],grayscale:[{grayscale:["",Gr,hr,ur]}],"hue-rotate":[{"hue-rotate":[Gr,hr,ur]}],invert:[{invert:["",Gr,hr,ur]}],saturate:[{saturate:[Gr,hr,ur]}],sepia:[{sepia:["",Gr,hr,ur]}],"backdrop-filter":[{"backdrop-filter":["","none",hr,ur]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[Gr,hr,ur]}],"backdrop-contrast":[{"backdrop-contrast":[Gr,hr,ur]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Gr,hr,ur]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Gr,hr,ur]}],"backdrop-invert":[{"backdrop-invert":["",Gr,hr,ur]}],"backdrop-opacity":[{"backdrop-opacity":[Gr,hr,ur]}],"backdrop-saturate":[{"backdrop-saturate":[Gr,hr,ur]}],"backdrop-sepia":[{"backdrop-sepia":["",Gr,hr,ur]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":F()}],"border-spacing-x":[{"border-spacing-x":F()}],"border-spacing-y":[{"border-spacing-y":F()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",hr,ur]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Gr,"initial",hr,ur]}],ease:[{ease:["linear","initial",j,hr,ur]}],delay:[{delay:[Gr,hr,ur]}],animate:[{animate:["none",k,hr,ur]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,hr,ur]}],"perspective-origin":[{"perspective-origin":M()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[hr,ur,"","none","gpu","cpu"]}],"transform-origin":[{origin:M()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":["translate-none"],accent:[{accent:Ae()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Ae()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",hr,ur]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mbs":[{"scroll-mbs":F()}],"scroll-mbe":[{"scroll-mbe":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pbs":[{"scroll-pbs":F()}],"scroll-pbe":[{"scroll-pbe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",hr,ur]}],fill:[{fill:["none",...Ae()]}],"stroke-w":[{stroke:[Gr,Cg,pm,MP]}],stroke:[{stroke:["none",...Ae()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},bQ=JJ(yQ);function tt(...e){return bQ(mn(e))}function wQ(e){if(!e)return"";const t=e.trim().split(/\s+/);return t.length===1?t[0].substring(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jQ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),NQ=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),FP=e=>{const t=NQ(e);return t.charAt(0).toUpperCase()+t.slice(1)},S9=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),SQ=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var AQ={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kQ=N.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:s,iconNode:o,...l},u)=>N.createElement("svg",{ref:u,...AQ,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:S9("lucide",a),...!s&&!SQ(l)&&{"aria-hidden":"true"},...l},[...o.map(([d,f])=>N.createElement(d,f)),...Array.isArray(s)?s:[s]]));/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ut=(e,t)=>{const r=N.forwardRef(({className:n,...a},s)=>N.createElement(kQ,{ref:s,iconNode:t,className:S9(`lucide-${jQ(FP(e))}`,`lucide-${e}`,n),...a}));return r.displayName=FP(e),r};/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const CQ=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],bv=Ut("arrow-down-right",CQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _Q=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],wv=Ut("arrow-right",_Q);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const EQ=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],jv=Ut("arrow-up-right",EQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const TQ=[["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"}]],c2=Ut("bell",TQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const PQ=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],DQ=Ut("book-open",PQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const OQ=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],Ni=Ut("briefcase",OQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const RQ=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],zi=Ut("building-2",RQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const MQ=[["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3",key:"cabbwy"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]],BP=Ut("building",MQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const LQ=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]],SN=Ut("calculator",LQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const IQ=[["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"}]],zP=Ut("calendar-check",IQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FQ=[["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"}]],Lo=Ut("calendar",FQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BQ=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],A9=Ut("camera",BQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zQ=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],u2=Ut("chart-column",zQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const UQ=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],UP=Ut("chart-pie",UQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $Q=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ph=Ut("check",$Q);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const HQ=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Nv=Ut("chevron-down",HQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VQ=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],qQ=Ut("chevron-left",VQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const WQ=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Io=Ut("chevron-right",WQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const GQ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],pl=Ut("circle-alert",GQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const YQ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Hl=Ut("circle-check",YQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const KQ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],XQ=Ut("circle-user",KQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ZQ=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ui=Ut("clock",ZQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const JQ=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Wg=Ut("copy",JQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const QQ=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Up=Ut("credit-card",QQ);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eee=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],ev=Ut("database",eee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tee=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],ds=Ut("dollar-sign",tee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ree=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Nr=Ut("download",ree);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nee=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],k9=Ut("ellipsis-vertical",nee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aee=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ym=Ut("ellipsis",aee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iee=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],C9=Ut("external-link",iee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const see=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],xu=Ut("eye",see);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oee=[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]],kk=Ut("file-archive",oee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lee=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]],$P=Ut("file-chart-column-increasing",lee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cee=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]],uee=Ut("file-check",cee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dee=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],fee=Ut("file-code",dee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hee=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],mee=Ut("file-image",hee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pee=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],xee=Ut("file-plus",pee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gee=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Tn=Ut("file-text",gee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vee=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],d2=Ut("file",vee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yee=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],bee=Ut("folder-input",yee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wee=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],HP=Ut("folder",wee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jee=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Oc=Ut("funnel",jee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nee=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Km=Ut("globe",Nee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const See=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],VP=Ut("hard-drive",See);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Aee=[["path",{d:"M10 10V5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v5",key:"1p9q5i"}],["path",{d:"M14 6a6 6 0 0 1 6 6v3",key:"1hnv84"}],["path",{d:"M4 15v-3a6 6 0 0 1 6-6",key:"9ciidu"}],["rect",{x:"2",y:"15",width:"20",height:"4",rx:"1",key:"g3x8cw"}]],qP=Ut("hard-hat",Aee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kee=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],_9=Ut("hash",kee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cee=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Ck=Ut("history",Cee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _ee=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],WP=Ut("info",_ee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Eee=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Tee=Ut("key",Eee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pee=[["path",{d:"M10 18v-7",key:"wt116b"}],["path",{d:"M11.12 2.198a2 2 0 0 1 1.76.006l7.866 3.847c.476.233.31.949-.22.949H3.474c-.53 0-.695-.716-.22-.949z",key:"1m329m"}],["path",{d:"M14 18v-7",key:"vav6t3"}],["path",{d:"M18 18v-7",key:"aexdmj"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M6 18v-7",key:"1ivflk"}]],GP=Ut("landmark",Pee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dee=[["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"}]],Oee=Ut("layout-dashboard",Dee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ree=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],E9=Ut("layout-grid",Ree);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mee=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],y3=Ut("list",Mee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lee=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],yh=Ut("lock",Lee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Iee=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],Fee=Ut("log-in",Iee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bee=[["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"}]],T9=Ut("log-out",Bee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zee=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Gl=Ut("mail",zee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Uee=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],P9=Ut("map-pin",Uee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $ee=[["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"}]],Hee=Ut("moon",$ee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vee=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],D9=Ut("network",Vee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qee=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],O9=Ut("paperclip",qee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wee=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],f2=Ut("pen-line",Wee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gee=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],AN=Ut("pen",Gee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yee=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],Kee=Ut("percent",Yee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xee=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],rx=Ut("phone",Xee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zee=[["path",{d:"M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z",key:"1v9wt8"}]],Jee=Ut("plane",Zee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qee=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],$n=Ut("plus",Qee);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ete=[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]],nx=Ut("receipt",ete);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tte=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],Nc=Ut("refresh-ccw",tte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rte=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],b3=Ut("save",rte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nte=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],fs=Ut("search",nte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ate=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],_k=Ut("settings",ate);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ite=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],ste=Ut("shield-alert",ite);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ote=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],bh=Ut("shield-check",ote);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lte=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Pu=Ut("shield",lte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cte=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ute=Ut("smartphone",cte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dte=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ec=Ut("square-check-big",dte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fte=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Ps=Ut("square-pen",fte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hte=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],kN=Ut("star",hte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mte=[["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"}]],pte=Ut("sun",mte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xte=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],gte=Ut("tag",xte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vte=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],xh=Ut("target",vte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yte=[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]],bte=Ut("ticket",yte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wte=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],h2=Ut("timer",wte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jte=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aa=Ut("trash-2",jte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nte=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Ste=Ut("trash",Nte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ate=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],w3=Ut("trending-down",Ate);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kte=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Fo=Ut("trending-up",kte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cte=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],_te=Ut("triangle-alert",Cte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ete=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],co=Ut("upload",Ete);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tte=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],ax=Ut("user-check",Tte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pte=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Oh=Ut("user-plus",Pte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dte=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ls=Ut("user",Dte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ote=[["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"}]],Hn=Ut("users",Ote);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rte=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],CN=Ut("wallet",Rte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mte=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Vw=Ut("wrench",Mte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lte=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xr=Ut("x",Lte);/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ite=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Fte=Ut("zap",Ite),j3=[{label:"Main",items:[{title:"Dashboard",href:"/",icon:Oee,permission:"dashboard.view"},{title:"Operations Control",href:"/operations",icon:xh,permission:"operations.view"}]},{label:"Operations",items:[{title:"Organization",href:"/organization",icon:zi,permission:"hr.view"},{title:"Employees",href:"/employees",icon:Hn,permission:"hr.view"},{title:"Recruitment",href:"/recruitment",icon:Oh,permission:"hr.view"},{title:"Engineers",href:"/engineers",icon:Vw,permission:"hr.view"}]},{label:"Projects",items:[{title:"Projects",href:"/projects",icon:Ni,permission:"projects.view"},{title:"Tasks & Timesheets",href:"/tasks",icon:Ec,permission:"projects.view"},{title:"Clients",href:"/clients",icon:XQ,permission:"crm.view"}]},{label:"Sales & Finance",items:[{title:"CRM / Sales",href:"/crm",icon:Fo,permission:"crm.view"},{title:"Finance",href:"/finance",icon:ds,permission:"finance.view"},{title:"Company Expenses",href:"/expenses",icon:nx,permission:"finance.view"},{title:"Bank Details",href:"/bank-details",icon:zi,permission:"finance.view"}]},{label:"Insights",items:[{title:"Documents",href:"/documents",icon:Tn,permission:"documents.view"},{title:"Reports & Analytics",href:"/reports",icon:u2,permission:"dashboard.view"}]},{label:"System",items:[{title:"Assigned Users",href:"/users",icon:Hn,permission:"settings.view"},{title:"Settings",href:"/settings",icon:_k,permission:"settings.view"}]}];j3.flatMap(e=>e.items);const Ek=N.createContext({});function Tk(e){const t=N.useRef(null);return t.current===null&&(t.current=e()),t.current}const Bte=typeof window<"u",R9=Bte?N.useLayoutEffect:N.useEffect,qw=N.createContext(null);function Pk(e,t){e.indexOf(t)===-1&&e.push(t)}function m2(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}const zu=(e,t,r)=>r>t?t:r<e?e:r;let Dk=()=>{};const wh={},M9=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function L9(e){return typeof e=="object"&&e!==null}const I9=e=>/^0[^.\s]+$/u.test(e);function F9(e){let t;return()=>(t===void 0&&(t=e()),t)}const Vl=e=>e,zte=(e,t)=>r=>t(e(r)),l1=(...e)=>e.reduce(zte),Sv=(e,t,r)=>{const n=t-e;return n===0?1:(r-e)/n};class Ok{constructor(){this.subscriptions=[]}add(t){return Pk(this.subscriptions,t),()=>m2(this.subscriptions,t)}notify(t,r,n){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](t,r,n);else for(let s=0;s<a;s++){const o=this.subscriptions[s];o&&o(t,r,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const hl=e=>e*1e3,zl=e=>e/1e3;function B9(e,t){return t?e*(1e3/t):0}const z9=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Ute=1e-7,$te=12;function Hte(e,t,r,n,a){let s,o,l=0;do o=t+(r-t)/2,s=z9(o,n,a)-e,s>0?r=o:t=o;while(Math.abs(s)>Ute&&++l<$te);return o}function c1(e,t,r,n){if(e===t&&r===n)return Vl;const a=s=>Hte(s,0,1,e,r);return s=>s===0||s===1?s:z9(a(s),t,n)}const U9=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$9=e=>t=>1-e(1-t),H9=c1(.33,1.53,.69,.99),Rk=$9(H9),V9=U9(Rk),q9=e=>e>=1?1:(e*=2)<1?.5*Rk(e):.5*(2-Math.pow(2,-10*(e-1))),Mk=e=>1-Math.sin(Math.acos(e)),W9=$9(Mk),G9=U9(Mk),Vte=c1(.42,0,1,1),qte=c1(0,0,.58,1),Y9=c1(.42,0,.58,1),Wte=e=>Array.isArray(e)&&typeof e[0]!="number",K9=e=>Array.isArray(e)&&typeof e[0]=="number",Gte={linear:Vl,easeIn:Vte,easeInOut:Y9,easeOut:qte,circIn:Mk,circInOut:G9,circOut:W9,backIn:Rk,backInOut:V9,backOut:H9,anticipate:q9},Yte=e=>typeof e=="string",YP=e=>{if(K9(e)){Dk(e.length===4);const[t,r,n,a]=e;return c1(t,r,n,a)}else if(Yte(e))return Gte[e];return e},Fy=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Kte(e,t){let r=new Set,n=new Set,a=!1,s=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function u(f){o.has(f)&&(d.schedule(f),e()),f(l)}const d={schedule:(f,m=!1,g=!1)=>{const y=g&&a?r:n;return m&&o.add(f),y.add(f),f},cancel:f=>{n.delete(f),o.delete(f)},process:f=>{if(l=f,a){s=!0;return}a=!0;const m=r;r=n,n=m,r.forEach(u),r.clear(),a=!1,s&&(s=!1,d.process(f))}};return d}const Xte=40;function X9(e,t){let r=!1,n=!0;const a={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=Fy.reduce((A,T)=>(A[T]=Kte(s),A),{}),{setup:l,read:u,resolveKeyframes:d,preUpdate:f,update:m,preRender:g,render:x,postRender:y}=o,v=()=>{const A=wh.useManualTiming,T=A?a.timestamp:performance.now();r=!1,A||(a.delta=n?1e3/60:Math.max(Math.min(T-a.timestamp,Xte),1)),a.timestamp=T,a.isProcessing=!0,l.process(a),u.process(a),d.process(a),f.process(a),m.process(a),g.process(a),x.process(a),y.process(a),a.isProcessing=!1,r&&t&&(n=!1,e(v))},w=()=>{r=!0,n=!0,a.isProcessing||e(v)};return{schedule:Fy.reduce((A,T)=>{const M=o[T];return A[T]=(B,L=!1,F=!1)=>(r||w(),M.schedule(B,L,F)),A},{}),cancel:A=>{for(let T=0;T<Fy.length;T++)o[Fy[T]].cancel(A)},state:a,steps:o}}const{schedule:ia,cancel:jh,state:ks,steps:_N}=X9(typeof requestAnimationFrame<"u"?requestAnimationFrame:Vl,!0);let $b;function Zte(){$b=void 0}const so={now:()=>($b===void 0&&so.set(ks.isProcessing||wh.useManualTiming?ks.timestamp:performance.now()),$b),set:e=>{$b=e,queueMicrotask(Zte)}},Z9=e=>t=>typeof t=="string"&&t.startsWith(e),J9=Z9("--"),Jte=Z9("var(--"),Lk=e=>Jte(e)?Qte.test(e.split("/*")[0].trim()):!1,Qte=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function KP(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Nx={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Av={...Nx,transform:e=>zu(0,1,e)},By={...Nx,default:1},tv=e=>Math.round(e*1e5)/1e5,Ik=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ere(e){return e==null}const tre=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Fk=(e,t)=>r=>!!(typeof r=="string"&&tre.test(r)&&r.startsWith(e)||t&&!ere(r)&&Object.prototype.hasOwnProperty.call(r,t)),Q9=(e,t,r)=>n=>{if(typeof n!="string")return n;const[a,s,o,l]=n.match(Ik);return{[e]:parseFloat(a),[t]:parseFloat(s),[r]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},rre=e=>zu(0,255,e),EN={...Nx,transform:e=>Math.round(rre(e))},Em={test:Fk("rgb","red"),parse:Q9("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+EN.transform(e)+", "+EN.transform(t)+", "+EN.transform(r)+", "+tv(Av.transform(n))+")"};function nre(e){let t="",r="",n="",a="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),a=e.substring(4,5),t+=t,r+=r,n+=n,a+=a),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:a?parseInt(a,16)/255:1}}const N3={test:Fk("#"),parse:nre,transform:Em.transform},u1=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),nh=u1("deg"),Iu=u1("%"),dr=u1("px"),are=u1("vh"),ire=u1("vw"),XP={...Iu,parse:e=>Iu.parse(e)/100,transform:e=>Iu.transform(e*100)},Op={test:Fk("hsl","hue"),parse:Q9("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+Iu.transform(tv(t))+", "+Iu.transform(tv(r))+", "+tv(Av.transform(n))+")"},ji={test:e=>Em.test(e)||N3.test(e)||Op.test(e),parse:e=>Em.test(e)?Em.parse(e):Op.test(e)?Op.parse(e):N3.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Em.transform(e):Op.transform(e),getAnimatableNone:e=>{const t=ji.parse(e);return t.alpha=0,ji.transform(t)}},sre=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function ore(e){var t,r;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Ik))==null?void 0:t.length)||0)+(((r=e.match(sre))==null?void 0:r.length)||0)>0}const eB="number",tB="color",lre="var",cre="var(",ZP="${}",ure=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ix(e){const t=e.toString(),r=[],n={color:[],number:[],var:[]},a=[];let s=0;const l=t.replace(ure,u=>(ji.test(u)?(n.color.push(s),a.push(tB),r.push(ji.parse(u))):u.startsWith(cre)?(n.var.push(s),a.push(lre),r.push(u)):(n.number.push(s),a.push(eB),r.push(parseFloat(u))),++s,ZP)).split(ZP);return{values:r,split:l,indexes:n,types:a}}function dre(e){return ix(e).values}function rB({split:e,types:t}){const r=e.length;return n=>{let a="";for(let s=0;s<r;s++)if(a+=e[s],n[s]!==void 0){const o=t[s];o===eB?a+=tv(n[s]):o===tB?a+=ji.transform(n[s]):a+=n[s]}return a}}function fre(e){return rB(ix(e))}const hre=e=>typeof e=="number"?0:ji.test(e)?ji.getAnimatableNone(e):e,mre=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:hre(e);function pre(e){const t=ix(e);return rB(t)(t.values.map((n,a)=>mre(n,t.split[a])))}const Tc={test:ore,parse:dre,createTransformer:fre,getAnimatableNone:pre};function TN(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function xre({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,t/=100,r/=100;let a=0,s=0,o=0;if(!t)a=s=o=r;else{const l=r<.5?r*(1+t):r+t-r*t,u=2*r-l;a=TN(u,l,e+1/3),s=TN(u,l,e),o=TN(u,l,e-1/3)}return{red:Math.round(a*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function p2(e,t){return r=>r>0?t:e}const ba=(e,t,r)=>e+(t-e)*r,PN=(e,t,r)=>{const n=e*e,a=r*(t*t-n)+n;return a<0?0:Math.sqrt(a)},gre=[N3,Em,Op],vre=e=>gre.find(t=>t.test(e));function JP(e){const t=vre(e);if(!t)return!1;let r=t.parse(e);return t===Op&&(r=xre(r)),r}const QP=(e,t)=>{const r=JP(e),n=JP(t);if(!r||!n)return p2(e,t);const a={...r};return s=>(a.red=PN(r.red,n.red,s),a.green=PN(r.green,n.green,s),a.blue=PN(r.blue,n.blue,s),a.alpha=ba(r.alpha,n.alpha,s),Em.transform(a))},S3=new Set(["none","hidden"]);function yre(e,t){return S3.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function bre(e,t){return r=>ba(e,t,r)}function Bk(e){return typeof e=="number"?bre:typeof e=="string"?Lk(e)?p2:ji.test(e)?QP:Nre:Array.isArray(e)?nB:typeof e=="object"?ji.test(e)?QP:wre:p2}function nB(e,t){const r=[...e],n=r.length,a=e.map((s,o)=>Bk(s)(s,t[o]));return s=>{for(let o=0;o<n;o++)r[o]=a[o](s);return r}}function wre(e,t){const r={...e,...t},n={};for(const a in r)e[a]!==void 0&&t[a]!==void 0&&(n[a]=Bk(e[a])(e[a],t[a]));return a=>{for(const s in n)r[s]=n[s](a);return r}}function jre(e,t){const r=[],n={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const s=t.types[a],o=e.indexes[s][n[s]],l=e.values[o]??0;r[a]=l,n[s]++}return r}const Nre=(e,t)=>{const r=Tc.createTransformer(t),n=ix(e),a=ix(t);return n.indexes.var.length===a.indexes.var.length&&n.indexes.color.length===a.indexes.color.length&&n.indexes.number.length>=a.indexes.number.length?S3.has(e)&&!a.values.length||S3.has(t)&&!n.values.length?yre(e,t):l1(nB(jre(n,a),a.values),r):p2(e,t)};function aB(e,t,r){return typeof e=="number"&&typeof t=="number"&&typeof r=="number"?ba(e,t,r):Bk(e)(e,t)}const Sre=e=>{const t=({timestamp:r})=>e(r);return{start:(r=!0)=>ia.update(t,r),stop:()=>jh(t),now:()=>ks.isProcessing?ks.timestamp:so.now()}},iB=(e,t,r=10)=>{let n="";const a=Math.max(Math.round(t/r),2);for(let s=0;s<a;s++)n+=Math.round(e(s/(a-1))*1e4)/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},x2=2e4;function zk(e){let t=0;const r=50;let n=e.next(t);for(;!n.done&&t<x2;)t+=r,n=e.next(t);return t>=x2?1/0:t}function Are(e,t=100,r){const n=r({...e,keyframes:[0,t]}),a=Math.min(zk(n),x2);return{type:"keyframes",ease:s=>n.next(a*s).value/t,duration:zl(a)}}const Ja={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function A3(e,t){return e*Math.sqrt(1-t*t)}const kre=12;function Cre(e,t,r){let n=r;for(let a=1;a<kre;a++)n=n-e(n)/t(n);return n}const DN=.001;function _re({duration:e=Ja.duration,bounce:t=Ja.bounce,velocity:r=Ja.velocity,mass:n=Ja.mass}){let a,s,o=1-t;o=zu(Ja.minDamping,Ja.maxDamping,o),e=zu(Ja.minDuration,Ja.maxDuration,zl(e)),o<1?(a=d=>{const f=d*o,m=f*e,g=f-r,x=A3(d,o),y=Math.exp(-m);return DN-g/x*y},s=d=>{const m=d*o*e,g=m*r+r,x=Math.pow(o,2)*Math.pow(d,2)*e,y=Math.exp(-m),v=A3(Math.pow(d,2),o);return(-a(d)+DN>0?-1:1)*((g-x)*y)/v}):(a=d=>{const f=Math.exp(-d*e),m=(d-r)*e+1;return-DN+f*m},s=d=>{const f=Math.exp(-d*e),m=(r-d)*(e*e);return f*m});const l=5/e,u=Cre(a,s,l);if(e=hl(e),isNaN(u))return{stiffness:Ja.stiffness,damping:Ja.damping,duration:e};{const d=Math.pow(u,2)*n;return{stiffness:d,damping:o*2*Math.sqrt(n*d),duration:e}}}const Ere=["duration","bounce"],Tre=["stiffness","damping","mass"];function eD(e,t){return t.some(r=>e[r]!==void 0)}function Pre(e){let t={velocity:Ja.velocity,stiffness:Ja.stiffness,damping:Ja.damping,mass:Ja.mass,isResolvedFromDuration:!1,...e};if(!eD(e,Tre)&&eD(e,Ere))if(t.velocity=0,e.visualDuration){const r=e.visualDuration,n=2*Math.PI/(r*1.2),a=n*n,s=2*zu(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:Ja.mass,stiffness:a,damping:s}}else{const r=_re({...e,velocity:0});t={...t,...r,mass:Ja.mass},t.isResolvedFromDuration=!0}return t}function g2(e=Ja.visualDuration,t=Ja.bounce){const r=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:a}=r;const s=r.keyframes[0],o=r.keyframes[r.keyframes.length-1],l={done:!1,value:s},{stiffness:u,damping:d,mass:f,duration:m,velocity:g,isResolvedFromDuration:x}=Pre({...r,velocity:-zl(r.velocity||0)}),y=g||0,v=d/(2*Math.sqrt(u*f)),w=o-s,j=zl(Math.sqrt(u/f)),k=Math.abs(w)<5;n||(n=k?Ja.restSpeed.granular:Ja.restSpeed.default),a||(a=k?Ja.restDelta.granular:Ja.restDelta.default);let A,T,M,B,L,F;if(v<1)M=A3(j,v),B=(y+v*j*w)/M,A=q=>{const P=Math.exp(-v*j*q);return o-P*(B*Math.sin(M*q)+w*Math.cos(M*q))},L=v*j*B+w*M,F=v*j*w-B*M,T=q=>Math.exp(-v*j*q)*(L*Math.sin(M*q)+F*Math.cos(M*q));else if(v===1){A=P=>o-Math.exp(-j*P)*(w+(y+j*w)*P);const q=y+j*w;T=P=>Math.exp(-j*P)*(j*q*P-y)}else{const q=j*Math.sqrt(v*v-1);A=ee=>{const se=Math.exp(-v*j*ee),Z=Math.min(q*ee,300);return o-se*((y+v*j*w)*Math.sinh(Z)+q*w*Math.cosh(Z))/q};const P=(y+v*j*w)/q,R=v*j*P-w*q,K=v*j*w-P*q;T=ee=>{const se=Math.exp(-v*j*ee),Z=Math.min(q*ee,300);return se*(R*Math.sinh(Z)+K*Math.cosh(Z))}}const I={calculatedDuration:x&&m||null,velocity:q=>hl(T(q)),next:q=>{if(!x&&v<1){const R=Math.exp(-v*j*q),K=Math.sin(M*q),ee=Math.cos(M*q),se=o-R*(B*K+w*ee),Z=hl(R*(L*K+F*ee));return l.done=Math.abs(Z)<=n&&Math.abs(o-se)<=a,l.value=l.done?o:se,l}const P=A(q);if(x)l.done=q>=m;else{const R=hl(T(q));l.done=Math.abs(R)<=n&&Math.abs(o-P)<=a}return l.value=l.done?o:P,l},toString:()=>{const q=Math.min(zk(I),x2),P=iB(R=>I.next(q*R).value,q,30);return q+"ms "+P},toTransition:()=>{}};return I}g2.applyToOptions=e=>{const t=Are(e,100,g2);return e.ease=t.ease,e.duration=hl(t.duration),e.type="keyframes",e};const Dre=5;function sB(e,t,r){const n=Math.max(t-Dre,0);return B9(r-e(n),t-n)}function k3({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:a=10,bounceStiffness:s=500,modifyTarget:o,min:l,max:u,restDelta:d=.5,restSpeed:f}){const m=e[0],g={done:!1,value:m},x=F=>l!==void 0&&F<l||u!==void 0&&F>u,y=F=>l===void 0?u:u===void 0||Math.abs(l-F)<Math.abs(u-F)?l:u;let v=r*t;const w=m+v,j=o===void 0?w:o(w);j!==w&&(v=j-m);const k=F=>-v*Math.exp(-F/n),A=F=>j+k(F),T=F=>{const I=k(F),q=A(F);g.done=Math.abs(I)<=d,g.value=g.done?j:q};let M,B;const L=F=>{x(g.value)&&(M=F,B=g2({keyframes:[g.value,y(g.value)],velocity:sB(A,F,g.value),damping:a,stiffness:s,restDelta:d,restSpeed:f}))};return L(0),{calculatedDuration:null,next:F=>{let I=!1;return!B&&M===void 0&&(I=!0,T(F),L(F)),M!==void 0&&F>=M?B.next(F-M):(!I&&T(F),g)}}}function Ore(e,t,r){const n=[],a=r||wh.mix||aB,s=e.length-1;for(let o=0;o<s;o++){let l=a(e[o],e[o+1]);if(t){const u=Array.isArray(t)?t[o]||Vl:t;l=l1(u,l)}n.push(l)}return n}function Rre(e,t,{clamp:r=!0,ease:n,mixer:a}={}){const s=e.length;if(Dk(s===t.length),s===1)return()=>t[0];if(s===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=Ore(t,n,a),u=l.length,d=f=>{if(o&&f<e[0])return t[0];let m=0;if(u>1)for(;m<e.length-2&&!(f<e[m+1]);m++);const g=Sv(e[m],e[m+1],f);return l[m](g)};return r?f=>d(zu(e[0],e[s-1],f)):d}function Mre(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const a=Sv(0,t,n);e.push(ba(r,1,a))}}function Lre(e){const t=[0];return Mre(t,e.length-1),t}function Ire(e,t){return e.map(r=>r*t)}function Fre(e,t){return e.map(()=>t||Y9).splice(0,e.length-1)}function rv({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const a=Wte(n)?n.map(YP):YP(n),s={done:!1,value:t[0]},o=Ire(r&&r.length===t.length?r:Lre(t),e),l=Rre(o,t,{ease:Array.isArray(a)?a:Fre(t,a)});return{calculatedDuration:e,next:u=>(s.value=l(u),s.done=u>=e,s)}}const Bre=e=>e!==null;function Ww(e,{repeat:t,repeatType:r="loop"},n,a=1){const s=e.filter(Bre),l=a<0||t&&r!=="loop"&&t%2===1?0:s.length-1;return!l||n===void 0?s[l]:n}const zre={decay:k3,inertia:k3,tween:rv,keyframes:rv,spring:g2};function oB(e){typeof e.type=="string"&&(e.type=zre[e.type])}class Uk{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,r){return this.finished.then(t,r)}}const Ure=e=>e/100;class v2 extends Uk{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var n,a;const{motionValue:r}=this.options;r&&r.updatedAt!==so.now()&&this.tick(so.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(a=(n=this.options).onStop)==null||a.call(n))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;oB(t);const{type:r=rv,repeat:n=0,repeatDelay:a=0,repeatType:s,velocity:o=0}=t;let{keyframes:l}=t;const u=r||rv;u!==rv&&typeof l[0]!="number"&&(this.mixKeyframes=l1(Ure,aB(l[0],l[1])),l=[0,100]);const d=u({...t,keyframes:l});s==="mirror"&&(this.mirroredGenerator=u({...t,keyframes:[...l].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=zk(d));const{calculatedDuration:f}=d;this.calculatedDuration=f,this.resolvedDuration=f+a,this.totalDuration=this.resolvedDuration*(n+1)-a,this.generator=d}updateTime(t){const r=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(t,r=!1){const{generator:n,totalDuration:a,mixKeyframes:s,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:u}=this;if(this.startTime===null)return n.next(0);const{delay:d=0,keyframes:f,repeat:m,repeatType:g,repeatDelay:x,type:y,onUpdate:v,finalKeyframe:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-a/this.speed,this.startTime)),r?this.currentTime=t:this.updateTime(t);const j=this.currentTime-d*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?j<0:j>a;this.currentTime=Math.max(j,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let A=this.currentTime,T=n;if(m){const F=Math.min(this.currentTime,a)/l;let I=Math.floor(F),q=F%1;!q&&F>=1&&(q=1),q===1&&I--,I=Math.min(I,m+1),!!(I%2)&&(g==="reverse"?(q=1-q,x&&(q-=x/l)):g==="mirror"&&(T=o)),A=zu(0,1,q)*l}let M;k?(this.delayState.value=f[0],M=this.delayState):M=T.next(A),s&&!k&&(M.value=s(M.value));let{done:B}=M;!k&&u!==null&&(B=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const L=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&B);return L&&y!==k3&&(M.value=Ww(f,this.options,w,this.speed)),v&&v(M.value),L&&this.finish(),M}then(t,r){return this.finished.then(t,r)}get duration(){return zl(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+zl(t)}get time(){return zl(this.currentTime)}set time(t){t=hl(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const r=this.generator.next(t).value;return sB(n=>this.generator.next(n).value,t,r)}get speed(){return this.playbackSpeed}set speed(t){const r=this.playbackSpeed!==t;r&&this.driver&&this.updateTime(so.now()),this.playbackSpeed=t,r&&this.driver&&(this.time=zl(this.currentTime))}play(){var a,s;if(this.isStopped)return;const{driver:t=Sre,startTime:r}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),(s=(a=this.options).onPlay)==null||s.call(a);const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=r??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(so.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,r;this.notifyFinished(),this.teardown(),this.state="finished",(r=(t=this.options).onComplete)==null||r.call(t)}cancel(){var t,r;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(r=(t=this.options).onCancel)==null||r.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var r;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(r=this.driver)==null||r.stop(),t.observe(this)}}function $re(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Tm=e=>e*180/Math.PI,C3=e=>{const t=Tm(Math.atan2(e[1],e[0]));return _3(t)},Hre={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:C3,rotateZ:C3,skewX:e=>Tm(Math.atan(e[1])),skewY:e=>Tm(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},_3=e=>(e=e%360,e<0&&(e+=360),e),tD=C3,rD=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),nD=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Vre={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:rD,scaleY:nD,scale:e=>(rD(e)+nD(e))/2,rotateX:e=>_3(Tm(Math.atan2(e[6],e[5]))),rotateY:e=>_3(Tm(Math.atan2(-e[2],e[0]))),rotateZ:tD,rotate:tD,skewX:e=>Tm(Math.atan(e[4])),skewY:e=>Tm(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function E3(e){return e.includes("scale")?1:0}function T3(e,t){if(!e||e==="none")return E3(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,a;if(r)n=Vre,a=r;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=Hre,a=l}if(!a)return E3(t);const s=n[t],o=a[1].split(",").map(Wre);return typeof s=="function"?s(o):o[s]}const qre=(e,t)=>{const{transform:r="none"}=getComputedStyle(e);return T3(r,t)};function Wre(e){return parseFloat(e.trim())}const Sx=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ax=new Set(Sx),aD=e=>e===Nx||e===dr,Gre=new Set(["x","y","z"]),Yre=Sx.filter(e=>!Gre.has(e));function Kre(e){const t=[];return Yre.forEach(r=>{const n=e.getValue(r);n!==void 0&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t}const lh={width:({x:e},{paddingLeft:t="0",paddingRight:r="0",boxSizing:n})=>{const a=e.max-e.min;return n==="border-box"?a:a-parseFloat(t)-parseFloat(r)},height:({y:e},{paddingTop:t="0",paddingBottom:r="0",boxSizing:n})=>{const a=e.max-e.min;return n==="border-box"?a:a-parseFloat(t)-parseFloat(r)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>T3(t,"x"),y:(e,{transform:t})=>T3(t,"y")};lh.translateX=lh.x;lh.translateY=lh.y;const Im=new Set;let P3=!1,D3=!1,O3=!1;function lB(){if(D3){const e=Array.from(Im).filter(n=>n.needsMeasurement),t=new Set(e.map(n=>n.element)),r=new Map;t.forEach(n=>{const a=Kre(n);a.length&&(r.set(n,a),n.render())}),e.forEach(n=>n.measureInitialState()),t.forEach(n=>{n.render();const a=r.get(n);a&&a.forEach(([s,o])=>{var l;(l=n.getValue(s))==null||l.set(o)})}),e.forEach(n=>n.measureEndState()),e.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}D3=!1,P3=!1,Im.forEach(e=>e.complete(O3)),Im.clear()}function cB(){Im.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(D3=!0)})}function Xre(){O3=!0,cB(),lB(),O3=!1}class $k{constructor(t,r,n,a,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=r,this.name=n,this.motionValue=a,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Im.add(this),P3||(P3=!0,ia.read(cB),ia.resolveKeyframes(lB))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:r,element:n,motionValue:a}=this;if(t[0]===null){const s=a==null?void 0:a.get(),o=t[t.length-1];if(s!==void 0)t[0]=s;else if(n&&r){const l=n.readValue(r,o);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=o),a&&s===void 0&&a.set(t[0])}$re(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Im.delete(this)}cancel(){this.state==="scheduled"&&(Im.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Zre=e=>e.startsWith("--");function uB(e,t,r){Zre(t)?e.style.setProperty(t,r):e.style[t]=r}const Jre={};function dB(e,t){const r=F9(e);return()=>Jre[t]??r()}const Qre=dB(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),fB=dB(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Gg=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,iD={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Gg([0,.65,.55,1]),circOut:Gg([.55,0,1,.45]),backIn:Gg([.31,.01,.66,-.59]),backOut:Gg([.33,1.53,.69,.99])};function hB(e,t){if(e)return typeof e=="function"?fB()?iB(e,t):"ease-out":K9(e)?Gg(e):Array.isArray(e)?e.map(r=>hB(r,t)||iD.easeOut):iD[e]}function ene(e,t,r,{delay:n=0,duration:a=300,repeat:s=0,repeatType:o="loop",ease:l="easeOut",times:u}={},d=void 0){const f={[t]:r};u&&(f.offset=u);const m=hB(l,a);Array.isArray(m)&&(f.easing=m);const g={delay:n,duration:a,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"};return d&&(g.pseudoElement=d),e.animate(f,g)}function mB(e){return typeof e=="function"&&"applyToOptions"in e}function tne({type:e,...t}){return mB(e)&&fB()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class pB extends Uk{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:r,name:n,keyframes:a,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:l,onComplete:u}=t;this.isPseudoElement=!!s,this.allowFlatten=o,this.options=t,Dk(typeof t.type!="string");const d=tne(t);this.animation=ene(r,n,a,d,s),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const f=Ww(a,this.options,l,this.speed);this.updateMotionValue&&this.updateMotionValue(f),uB(r,n,f),this.animation.cancel()}u==null||u(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,r;(r=(t=this.animation).finish)==null||r.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var r,n,a;const t=(r=this.options)==null?void 0:r.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((a=(n=this.animation).commitStyles)==null||a.call(n))}get duration(){var r,n;const t=((n=(r=this.animation.effect)==null?void 0:r.getComputedTiming)==null?void 0:n.call(r).duration)||0;return zl(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+zl(t)}get time(){return zl(Number(this.animation.currentTime)||0)}set time(t){const r=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=hl(t),r&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:r,rangeEnd:n,observe:a}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&Qre()?(this.animation.timeline=t,r&&(this.animation.rangeStart=r),n&&(this.animation.rangeEnd=n),Vl):a(this)}}const xB={anticipate:q9,backInOut:V9,circInOut:G9};function rne(e){return e in xB}function nne(e){typeof e.ease=="string"&&rne(e.ease)&&(e.ease=xB[e.ease])}const ON=10;class ane extends pB{constructor(t){nne(t),oB(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:r,onUpdate:n,onComplete:a,element:s,...o}=this.options;if(!r)return;if(t!==void 0){r.set(t);return}const l=new v2({...o,autoplay:!1}),u=Math.max(ON,so.now()-this.startTime),d=zu(0,ON,u-ON),f=l.sample(u).value,{name:m}=this.options;s&&m&&uB(s,m,f),r.setWithVelocity(l.sample(Math.max(0,u-d)).value,f,d),l.stop()}}const sD=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Tc.test(e)||e==="0")&&!e.startsWith("url("));function ine(e){const t=e[0];if(e.length===1)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}function sne(e,t,r,n){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const s=e[e.length-1],o=sD(a,t),l=sD(s,t);return!o||!l?!1:ine(e)||(r==="spring"||mB(r))&&n}function R3(e){e.duration=0,e.type="keyframes"}const gB=new Set(["opacity","clipPath","filter","transform"]),one=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function lne(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&one.test(e[t]))return!0;return!1}const cne=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),une=F9(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function dne(e){var m;const{motionValue:t,name:r,repeatDelay:n,repeatType:a,damping:s,type:o,keyframes:l}=e;if(!(((m=t==null?void 0:t.owner)==null?void 0:m.current)instanceof HTMLElement))return!1;const{onUpdate:d,transformTemplate:f}=t.owner.getProps();return une()&&r&&(gB.has(r)||cne.has(r)&&lne(l))&&(r!=="transform"||!f)&&!d&&!n&&a!=="mirror"&&s!==0&&o!=="inertia"}const fne=40;class hne extends Uk{constructor({autoplay:t=!0,delay:r=0,type:n="keyframes",repeat:a=0,repeatDelay:s=0,repeatType:o="loop",keyframes:l,name:u,motionValue:d,element:f,...m}){var y;super(),this.stop=()=>{var v,w;this._animation&&(this._animation.stop(),(v=this.stopTimeline)==null||v.call(this)),(w=this.keyframeResolver)==null||w.cancel()},this.createdAt=so.now();const g={autoplay:t,delay:r,type:n,repeat:a,repeatDelay:s,repeatType:o,name:u,motionValue:d,element:f,...m},x=(f==null?void 0:f.KeyframeResolver)||$k;this.keyframeResolver=new x(l,(v,w,j)=>this.onKeyframesResolved(v,w,g,!j),u,d,f),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(t,r,n,a){var j,k;this.keyframeResolver=void 0;const{name:s,type:o,velocity:l,delay:u,isHandoff:d,onUpdate:f}=n;this.resolvedAt=so.now();let m=!0;sne(t,s,o,l)||(m=!1,(wh.instantAnimations||!u)&&(f==null||f(Ww(t,n,r))),t[0]=t[t.length-1],R3(n),n.repeat=0);const x={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>fne?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...n,keyframes:t},y=m&&!d&&dne(x),v=(k=(j=x.motionValue)==null?void 0:j.owner)==null?void 0:k.current;let w;if(y)try{w=new ane({...x,element:v})}catch{w=new v2(x)}else w=new v2(x);w.finished.then(()=>{this.notifyFinished()}).catch(Vl),this.pendingTimeline&&(this.stopTimeline=w.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=w}get finished(){return this._animation?this.animation.finished:this._finished}then(t,r){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),Xre()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function vB(e,t,r,n=0,a=1){const s=Array.from(e).sort((d,f)=>d.sortNodePosition(f)).indexOf(t),o=e.size,l=(o-1)*n;return typeof r=="function"?r(s,o):a===1?s*n:l-s*n}const mne=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function pne(e){const t=mne.exec(e);if(!t)return[,];const[,r,n,a]=t;return[`--${r??n}`,a]}function yB(e,t,r=1){const[n,a]=pne(e);if(!n)return;const s=window.getComputedStyle(t).getPropertyValue(n);if(s){const o=s.trim();return M9(o)?parseFloat(o):o}return Lk(a)?yB(a,t,r+1):a}const xne={type:"spring",stiffness:500,damping:25,restSpeed:10},gne=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),vne={type:"keyframes",duration:.8},yne={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},bne=(e,{keyframes:t})=>t.length>2?vne:Ax.has(e)?e.startsWith("scale")?gne(t[1]):xne:yne;function bB(e,t){if(e!=null&&e.inherit&&t){const{inherit:r,...n}=e;return{...t,...n}}return e}function Hk(e,t){const r=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return r!==e?bB(r,e):r}const wne=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function jne(e){for(const t in e)if(!wne.has(t))return!0;return!1}const Vk=(e,t,r,n={},a,s)=>o=>{const l=Hk(n,e)||{},u=l.delay||n.delay||0;let{elapsed:d=0}=n;d=d-hl(u);const f={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-d,onUpdate:g=>{t.set(g),l.onUpdate&&l.onUpdate(g)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:s?void 0:a};jne(l)||Object.assign(f,bne(e,f)),f.duration&&(f.duration=hl(f.duration)),f.repeatDelay&&(f.repeatDelay=hl(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let m=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(R3(f),f.delay===0&&(m=!0)),(wh.instantAnimations||wh.skipAnimations||a!=null&&a.shouldSkipAnimations)&&(m=!0,R3(f),f.delay=0),f.allowFlatten=!l.type&&!l.ease,m&&!s&&t.get()!==void 0){const g=Ww(f.keyframes,l);if(g!==void 0){ia.update(()=>{f.onUpdate(g),f.onComplete()});return}}return l.isSync?new v2(f):new hne(f)};function oD(e){const t=[{},{}];return e==null||e.values.forEach((r,n)=>{t[0][n]=r.get(),t[1][n]=r.getVelocity()}),t}function qk(e,t,r,n){if(typeof t=="function"){const[a,s]=oD(n);t=t(r!==void 0?r:e.custom,a,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[a,s]=oD(n);t=t(r!==void 0?r:e.custom,a,s)}return t}function Fm(e,t,r){const n=e.getProps();return qk(n,t,r!==void 0?r:n.custom,e)}const wB=new Set(["width","height","top","left","right","bottom",...Sx]),lD=30,Nne=e=>!isNaN(parseFloat(e));class Sne{constructor(t,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{var s;const a=so.now();if(this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=r.owner}setCurrent(t){this.current=t,this.updatedAt=so.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Nne(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,r){this.events[t]||(this.events[t]=new Ok);const n=this.events[t].add(r);return t==="change"?()=>{n(),ia.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,r=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=so.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>lD)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,lD);return B9(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(t){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=t(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,r;(t=this.dependents)==null||t.clear(),(r=this.events.destroy)==null||r.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function sx(e,t){return new Sne(e,t)}const M3=e=>Array.isArray(e);function Ane(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,sx(r))}function kne(e){return M3(e)?e[e.length-1]||0:e}function Cne(e,t){const r=Fm(e,t);let{transitionEnd:n={},transition:a={},...s}=r||{};s={...s,...n};for(const o in s){const l=kne(s[o]);Ane(e,o,l)}}const Ts=e=>!!(e&&e.getVelocity);function _ne(e){return!!(Ts(e)&&e.add)}function L3(e,t){const r=e.getValue("willChange");if(_ne(r))return r.add(t);if(!r&&wh.WillChange){const n=new wh.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function Wk(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const Ene="framerAppearId",jB="data-"+Wk(Ene);function NB(e){return e.props[jB]}function Tne({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,n}function SB(e,t,{delay:r=0,transitionOverride:n,type:a}={}){let{transition:s,transitionEnd:o,...l}=t;const u=e.getDefaultTransition();s=s?bB(s,u):u;const d=s==null?void 0:s.reduceMotion;n&&(s=n);const f=[],m=a&&e.animationState&&e.animationState.getState()[a];for(const g in l){const x=e.getValue(g,e.latestValues[g]??null),y=l[g];if(y===void 0||m&&Tne(m,g))continue;const v={delay:r,...Hk(s||{},g)},w=x.get();if(w!==void 0&&!x.isAnimating()&&!Array.isArray(y)&&y===w&&!v.velocity){ia.update(()=>x.set(y));continue}let j=!1;if(window.MotionHandoffAnimation){const T=NB(e);if(T){const M=window.MotionHandoffAnimation(T,g,ia);M!==null&&(v.startTime=M,j=!0)}}L3(e,g);const k=d??e.shouldReduceMotion;x.start(Vk(g,x,y,k&&wB.has(g)?{type:!1}:v,e,j));const A=x.animation;A&&f.push(A)}if(o){const g=()=>ia.update(()=>{o&&Cne(e,o)});f.length?Promise.all(f).then(g):g()}return f}function I3(e,t,r={}){var u;const n=Fm(e,t,r.type==="exit"?(u=e.presenceContext)==null?void 0:u.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(a=r.transitionOverride);const s=n?()=>Promise.all(SB(e,n,r)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:f=0,staggerChildren:m,staggerDirection:g}=a;return Pne(e,t,d,f,m,g,r)}:()=>Promise.resolve(),{when:l}=a;if(l){const[d,f]=l==="beforeChildren"?[s,o]:[o,s];return d().then(()=>f())}else return Promise.all([s(),o(r.delay)])}function Pne(e,t,r=0,n=0,a=0,s=1,o){const l=[];for(const u of e.variantChildren)u.notify("AnimationStart",t),l.push(I3(u,t,{...o,delay:r+(typeof n=="function"?0:n)+vB(e.variantChildren,u,n,a,s)}).then(()=>u.notify("AnimationComplete",t)));return Promise.all(l)}function Dne(e,t,r={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const a=t.map(s=>I3(e,s,r));n=Promise.all(a)}else if(typeof t=="string")n=I3(e,t,r);else{const a=typeof t=="function"?Fm(e,t,r.custom):t;n=Promise.all(SB(e,a,r))}return n.then(()=>{e.notify("AnimationComplete",t)})}const One={test:e=>e==="auto",parse:e=>e},AB=e=>t=>t.test(e),kB=[Nx,dr,Iu,nh,ire,are,One],cD=e=>kB.find(AB(e));function Rne(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||I9(e):!0}const Mne=new Set(["brightness","contrast","saturate","opacity"]);function Lne(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=r.match(Ik)||[];if(!n)return e;const a=r.replace(n,"");let s=Mne.has(t)?1:0;return n!==r&&(s*=100),t+"("+s+a+")"}const Ine=/\b([a-z-]*)\(.*?\)/gu,F3={...Tc,getAnimatableNone:e=>{const t=e.match(Ine);return t?t.map(Lne).join(" "):e}},B3={...Tc,getAnimatableNone:e=>{const t=Tc.parse(e);return Tc.createTransformer(e)(t.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},uD={...Nx,transform:Math.round},Fne={rotate:nh,rotateX:nh,rotateY:nh,rotateZ:nh,scale:By,scaleX:By,scaleY:By,scaleZ:By,skew:nh,skewX:nh,skewY:nh,distance:dr,translateX:dr,translateY:dr,translateZ:dr,x:dr,y:dr,z:dr,perspective:dr,transformPerspective:dr,opacity:Av,originX:XP,originY:XP,originZ:dr},Gk={borderWidth:dr,borderTopWidth:dr,borderRightWidth:dr,borderBottomWidth:dr,borderLeftWidth:dr,borderRadius:dr,borderTopLeftRadius:dr,borderTopRightRadius:dr,borderBottomRightRadius:dr,borderBottomLeftRadius:dr,width:dr,maxWidth:dr,height:dr,maxHeight:dr,top:dr,right:dr,bottom:dr,left:dr,inset:dr,insetBlock:dr,insetBlockStart:dr,insetBlockEnd:dr,insetInline:dr,insetInlineStart:dr,insetInlineEnd:dr,padding:dr,paddingTop:dr,paddingRight:dr,paddingBottom:dr,paddingLeft:dr,paddingBlock:dr,paddingBlockStart:dr,paddingBlockEnd:dr,paddingInline:dr,paddingInlineStart:dr,paddingInlineEnd:dr,margin:dr,marginTop:dr,marginRight:dr,marginBottom:dr,marginLeft:dr,marginBlock:dr,marginBlockStart:dr,marginBlockEnd:dr,marginInline:dr,marginInlineStart:dr,marginInlineEnd:dr,fontSize:dr,backgroundPositionX:dr,backgroundPositionY:dr,...Fne,zIndex:uD,fillOpacity:Av,strokeOpacity:Av,numOctaves:uD},Bne={...Gk,color:ji,backgroundColor:ji,outlineColor:ji,fill:ji,stroke:ji,borderColor:ji,borderTopColor:ji,borderRightColor:ji,borderBottomColor:ji,borderLeftColor:ji,filter:F3,WebkitFilter:F3,mask:B3,WebkitMask:B3},CB=e=>Bne[e],zne=new Set([F3,B3]);function _B(e,t){let r=CB(e);return zne.has(r)||(r=Tc),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const Une=new Set(["auto","none","0"]);function $ne(e,t,r){let n=0,a;for(;n<e.length&&!a;){const s=e[n];typeof s=="string"&&!Une.has(s)&&ix(s).values.length&&(a=e[n]),n++}if(a&&r)for(const s of t)e[s]=_B(r,a)}class Hne extends $k{constructor(t,r,n,a,s){super(t,r,n,a,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:r,name:n}=this;if(!r||!r.current)return;super.readKeyframes();for(let f=0;f<t.length;f++){let m=t[f];if(typeof m=="string"&&(m=m.trim(),Lk(m))){const g=yB(m,r.current);g!==void 0&&(t[f]=g),f===t.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!wB.has(n)||t.length!==2)return;const[a,s]=t,o=cD(a),l=cD(s),u=KP(a),d=KP(s);if(u!==d&&lh[n]){this.needsMeasurement=!0;return}if(o!==l)if(aD(o)&&aD(l))for(let f=0;f<t.length;f++){const m=t[f];typeof m=="string"&&(t[f]=parseFloat(m))}else lh[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:r}=this,n=[];for(let a=0;a<t.length;a++)(t[a]===null||Rne(t[a]))&&n.push(a);n.length&&$ne(t,n,r)}measureInitialState(){const{element:t,unresolvedKeyframes:r,name:n}=this;if(!t||!t.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=lh[n](t.measureViewportBox(),window.getComputedStyle(t.current)),r[0]=this.measuredOrigin;const a=r[r.length-1];a!==void 0&&t.getValue(n,a).jump(a,!1)}measureEndState(){var l;const{element:t,name:r,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const a=t.getValue(r);a&&a.jump(this.measuredOrigin,!1);const s=n.length-1,o=n[s];n[s]=lh[r](t.measureViewportBox(),window.getComputedStyle(t.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([u,d])=>{t.getValue(u).set(d)}),this.resolveNoneKeyframes()}}function EB(e,t,r){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let n=document;const a=(r==null?void 0:r[e])??n.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(n=>n!=null)}const TB=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Hb(e){return L9(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:Yk}=X9(queueMicrotask,!1),jc={x:!1,y:!1};function PB(){return jc.x||jc.y}function Vne(e){return e==="x"||e==="y"?jc[e]?null:(jc[e]=!0,()=>{jc[e]=!1}):jc.x||jc.y?null:(jc.x=jc.y=!0,()=>{jc.x=jc.y=!1})}function DB(e,t){const r=EB(e),n=new AbortController,a={passive:!0,...t,signal:n.signal};return[r,a,()=>n.abort()]}function qne(e){return!(e.pointerType==="touch"||PB())}function Wne(e,t,r={}){const[n,a,s]=DB(e,r);return n.forEach(o=>{let l=!1,u=!1,d;const f=()=>{o.removeEventListener("pointerleave",y)},m=w=>{d&&(d(w),d=void 0),f()},g=w=>{l=!1,window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g),u&&(u=!1,m(w))},x=()=>{l=!0,window.addEventListener("pointerup",g,a),window.addEventListener("pointercancel",g,a)},y=w=>{if(w.pointerType!=="touch"){if(l){u=!0;return}m(w)}},v=w=>{if(!qne(w))return;u=!1;const j=t(o,w);typeof j=="function"&&(d=j,o.addEventListener("pointerleave",y,a))};o.addEventListener("pointerenter",v,a),o.addEventListener("pointerdown",x,a)}),s}const OB=(e,t)=>t?e===t?!0:OB(e,t.parentElement):!1,Kk=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Gne=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Yne(e){return Gne.has(e.tagName)||e.isContentEditable===!0}const Kne=new Set(["INPUT","SELECT","TEXTAREA"]);function Xne(e){return Kne.has(e.tagName)||e.isContentEditable===!0}const Vb=new WeakSet;function dD(e){return t=>{t.key==="Enter"&&e(t)}}function RN(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Zne=(e,t)=>{const r=e.currentTarget;if(!r)return;const n=dD(()=>{if(Vb.has(r))return;RN(r,"down");const a=dD(()=>{RN(r,"up")}),s=()=>RN(r,"cancel");r.addEventListener("keyup",a,t),r.addEventListener("blur",s,t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)};function fD(e){return Kk(e)&&!PB()}const hD=new WeakSet;function Jne(e,t,r={}){const[n,a,s]=DB(e,r),o=l=>{const u=l.currentTarget;if(!fD(l)||hD.has(l))return;Vb.add(u),r.stopPropagation&&hD.add(l);const d=t(u,l),f=(x,y)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",g),Vb.has(u)&&Vb.delete(u),fD(x)&&typeof d=="function"&&d(x,{success:y})},m=x=>{f(x,u===window||u===document||r.useGlobalTarget||OB(u,x.target))},g=x=>{f(x,!1)};window.addEventListener("pointerup",m,a),window.addEventListener("pointercancel",g,a)};return n.forEach(l=>{(r.useGlobalTarget?window:l).addEventListener("pointerdown",o,a),Hb(l)&&(l.addEventListener("focus",d=>Zne(d,a)),!Yne(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),s}function Xk(e){return L9(e)&&"ownerSVGElement"in e}const qb=new WeakMap;let ah;const RB=(e,t,r)=>(n,a)=>a&&a[0]?a[0][e+"Size"]:Xk(n)&&"getBBox"in n?n.getBBox()[t]:n[r],Qne=RB("inline","width","offsetWidth"),eae=RB("block","height","offsetHeight");function tae({target:e,borderBoxSize:t}){var r;(r=qb.get(e))==null||r.forEach(n=>{n(e,{get width(){return Qne(e,t)},get height(){return eae(e,t)}})})}function rae(e){e.forEach(tae)}function nae(){typeof ResizeObserver>"u"||(ah=new ResizeObserver(rae))}function aae(e,t){ah||nae();const r=EB(e);return r.forEach(n=>{let a=qb.get(n);a||(a=new Set,qb.set(n,a)),a.add(t),ah==null||ah.observe(n)}),()=>{r.forEach(n=>{const a=qb.get(n);a==null||a.delete(t),a!=null&&a.size||ah==null||ah.unobserve(n)})}}const Wb=new Set;let Rp;function iae(){Rp=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Wb.forEach(t=>t(e))},window.addEventListener("resize",Rp)}function sae(e){return Wb.add(e),Rp||iae(),()=>{Wb.delete(e),!Wb.size&&typeof Rp=="function"&&(window.removeEventListener("resize",Rp),Rp=void 0)}}function mD(e,t){return typeof e=="function"?sae(e):aae(e,t)}function oae(e){return Xk(e)&&e.tagName==="svg"}const lae=[...kB,ji,Tc],cae=e=>lae.find(AB(e)),pD=()=>({translate:0,scale:1,origin:0,originPoint:0}),Mp=()=>({x:pD(),y:pD()}),xD=()=>({min:0,max:0}),Fi=()=>({x:xD(),y:xD()}),uae=new WeakMap;function Gw(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function kv(e){return typeof e=="string"||Array.isArray(e)}const Zk=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Jk=["initial",...Zk];function Yw(e){return Gw(e.animate)||Jk.some(t=>kv(e[t]))}function MB(e){return!!(Yw(e)||e.variants)}function dae(e,t,r){for(const n in t){const a=t[n],s=r[n];if(Ts(a))e.addValue(n,a);else if(Ts(s))e.addValue(n,sx(a,{owner:e}));else if(s!==a)if(e.hasValue(n)){const o=e.getValue(n);o.liveStyle===!0?o.jump(a):o.hasAnimated||o.set(a)}else{const o=e.getStaticValue(n);e.addValue(n,sx(o!==void 0?o:a,{owner:e}))}}for(const n in r)t[n]===void 0&&e.removeValue(n);return t}const z3={current:null},LB={current:!1},fae=typeof window<"u";function hae(){if(LB.current=!0,!!fae)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>z3.current=e.matches;e.addEventListener("change",t),t()}else z3.current=!1}const gD=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let y2={};function IB(e){y2=e}function mae(){return y2}class pae{scrapeMotionValuesFromProps(t,r,n){return{}}constructor({parent:t,props:r,presenceContext:n,reducedMotionConfig:a,skipAnimations:s,blockInitialAnimation:o,visualState:l},u={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=$k,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const x=so.now();this.renderScheduledAt<x&&(this.renderScheduledAt=x,ia.render(this.render,!1,!0))};const{latestValues:d,renderState:f}=l;this.latestValues=d,this.baseTarget={...d},this.initialValues=r.initial?{...d}:{},this.renderState=f,this.parent=t,this.props=r,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=a,this.skipAnimationsConfig=s,this.options=u,this.blockInitialAnimation=!!o,this.isControllingVariants=Yw(r),this.isVariantNode=MB(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:m,...g}=this.scrapeMotionValuesFromProps(r,{},this);for(const x in g){const y=g[x];d[x]!==void 0&&Ts(y)&&y.set(d[x])}}mount(t){var r,n;if(this.hasBeenMounted)for(const a in this.initialValues)(r=this.values.get(a))==null||r.jump(this.initialValues[a]),this.latestValues[a]=this.initialValues[a];this.current=t,uae.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((a,s)=>this.bindToMotionValue(s,a)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(LB.current||hae(),this.shouldReduceMotion=z3.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),jh(this.notifyUpdate),jh(this.render),this.valueSubscriptions.forEach(r=>r()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const r in this.events)this.events[r].clear();for(const r in this.features){const n=this.features[r];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,r){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),r.accelerate&&gB.has(t)&&this.current instanceof HTMLElement){const{factory:o,keyframes:l,times:u,ease:d,duration:f}=r.accelerate,m=new pB({element:this.current,name:t,keyframes:l,times:u,ease:d,duration:hl(f)}),g=o(m);this.valueSubscriptions.set(t,()=>{g(),m.cancel()});return}const n=Ax.has(t);n&&this.onBindTransform&&this.onBindTransform();const a=r.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&ia.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;typeof window<"u"&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,r)),this.valueSubscriptions.set(t,()=>{a(),s&&s(),r.owner&&r.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in y2){const r=y2[t];if(!r)continue;const{isEnabled:n,Feature:a}=r;if(!this.features[t]&&a&&n(this.props)&&(this.features[t]=new a(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Fi()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;n<gD.length;n++){const a=gD[n];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const s="on"+a,o=t[s];o&&(this.propEventSubscriptions[a]=this.on(a,o))}this.prevMotionValues=dae(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(t),()=>r.variantChildren.delete(t)}addValue(t,r){const n=this.values.get(t);r!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,r),this.values.set(t,r),this.latestValues[t]=r.get())}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return n===void 0&&r!==void 0&&(n=sx(r===null?void 0:r,{owner:this}),this.addValue(t,n)),n}readValue(t,r){let n=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return n!=null&&(typeof n=="string"&&(M9(n)||I9(n))?n=parseFloat(n):!cae(n)&&Tc.test(r)&&(n=_B(t,r)),this.setBaseTarget(t,Ts(n)?n.get():n)),Ts(n)?n.get():n}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var s;const{initial:r}=this.props;let n;if(typeof r=="string"||typeof r=="object"){const o=qk(this.props,r,(s=this.presenceContext)==null?void 0:s.custom);o&&(n=o[t])}if(r&&n!==void 0)return n;const a=this.getBaseTargetFromProps(this.props,t);return a!==void 0&&!Ts(a)?a:this.initialValues[t]!==void 0&&n===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new Ok),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}scheduleRenderMicrotask(){Yk.render(this.render)}}class FB extends pae{constructor(){super(...arguments),this.KeyframeResolver=Hne}sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){const n=t.style;return n?n[r]:void 0}removeValueFromRenderState(t,{vars:r,style:n}){delete r[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ts(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class Rh{constructor(t){this.isMounted=!1,this.node=t}update(){}}function BB({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function xae({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function gae(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function MN(e){return e===void 0||e===1}function U3({scale:e,scaleX:t,scaleY:r}){return!MN(e)||!MN(t)||!MN(r)}function jm(e){return U3(e)||zB(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function zB(e){return vD(e.x)||vD(e.y)}function vD(e){return e&&e!=="0%"}function b2(e,t,r){const n=e-r,a=t*n;return r+a}function yD(e,t,r,n,a){return a!==void 0&&(e=b2(e,a,n)),b2(e,r,n)+t}function $3(e,t=0,r=1,n,a){e.min=yD(e.min,t,r,n,a),e.max=yD(e.max,t,r,n,a)}function UB(e,{x:t,y:r}){$3(e.x,t.translate,t.scale,t.originPoint),$3(e.y,r.translate,r.scale,r.originPoint)}const bD=.999999999999,wD=1.0000000000001;function vae(e,t,r,n=!1){var l;const a=r.length;if(!a)return;t.x=t.y=1;let s,o;for(let u=0;u<a;u++){s=r[u],o=s.projectionDelta;const{visualElement:d}=s.options;d&&d.props.style&&d.props.style.display==="contents"||(n&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(Cu(e.x,-s.scroll.offset.x),Cu(e.y,-s.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,UB(e,o)),n&&jm(s.latestValues)&&Gb(e,s.latestValues,(l=s.layout)==null?void 0:l.layoutBox))}t.x<wD&&t.x>bD&&(t.x=1),t.y<wD&&t.y>bD&&(t.y=1)}function Cu(e,t){e.min+=t,e.max+=t}function jD(e,t,r,n,a=.5){const s=ba(e.min,e.max,a);$3(e,t,r,s,n)}function ND(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Gb(e,t,r){const n=r??e;jD(e.x,ND(t.x,n.x),t.scaleX,t.scale,t.originX),jD(e.y,ND(t.y,n.y),t.scaleY,t.scale,t.originY)}function $B(e,t){return BB(gae(e.getBoundingClientRect(),t))}function yae(e,t,r){const n=$B(e,r),{scroll:a}=t;return a&&(Cu(n.x,a.offset.x),Cu(n.y,a.offset.y)),n}const bae={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},wae=Sx.length;function jae(e,t,r){let n="",a=!0;for(let s=0;s<wae;s++){const o=Sx[s],l=e[o];if(l===void 0)continue;let u=!0;if(typeof l=="number")u=l===(o.startsWith("scale")?1:0);else{const d=parseFloat(l);u=o.startsWith("scale")?d===1:d===0}if(!u||r){const d=TB(l,Gk[o]);if(!u){a=!1;const f=bae[o]||o;n+=`${f}(${d}) `}r&&(t[o]=d)}}return n=n.trim(),r?n=r(t,a?"":n):a&&(n="none"),n}function Qk(e,t,r){const{style:n,vars:a,transformOrigin:s}=e;let o=!1,l=!1;for(const u in t){const d=t[u];if(Ax.has(u)){o=!0;continue}else if(J9(u)){a[u]=d;continue}else{const f=TB(d,Gk[u]);u.startsWith("origin")?(l=!0,s[u]=f):n[u]=f}}if(t.transform||(o||r?n.transform=jae(t,e.transform,r):n.transform&&(n.transform="none")),l){const{originX:u="50%",originY:d="50%",originZ:f=0}=s;n.transformOrigin=`${u} ${d} ${f}`}}function HB(e,{style:t,vars:r},n,a){const s=e.style;let o;for(o in t)s[o]=t[o];a==null||a.applyProjectionStyles(s,n);for(o in r)s.setProperty(o,r[o])}function SD(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const _g={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(dr.test(e))e=parseFloat(e);else return e;const r=SD(e,t.target.x),n=SD(e,t.target.y);return`${r}% ${n}%`}},Nae={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,a=Tc.parse(e);if(a.length>5)return n;const s=Tc.createTransformer(e),o=typeof a[0]!="number"?1:0,l=r.x.scale*t.x,u=r.y.scale*t.y;a[0+o]/=l,a[1+o]/=u;const d=ba(l,u,.5);return typeof a[2+o]=="number"&&(a[2+o]/=d),typeof a[3+o]=="number"&&(a[3+o]/=d),s(a)}},H3={borderRadius:{..._g,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:_g,borderTopRightRadius:_g,borderBottomLeftRadius:_g,borderBottomRightRadius:_g,boxShadow:Nae};function VB(e,{layout:t,layoutId:r}){return Ax.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!H3[e]||e==="opacity")}function eC(e,t,r){var o;const n=e.style,a=t==null?void 0:t.style,s={};if(!n)return s;for(const l in n)(Ts(n[l])||a&&Ts(a[l])||VB(l,e)||((o=r==null?void 0:r.getValue(l))==null?void 0:o.liveStyle)!==void 0)&&(s[l]=n[l]);return s}function Sae(e){return window.getComputedStyle(e)}class Aae extends FB{constructor(){super(...arguments),this.type="html",this.renderInstance=HB}readValueFromInstance(t,r){var n;if(Ax.has(r))return(n=this.projection)!=null&&n.isProjecting?E3(r):qre(t,r);{const a=Sae(t),s=(J9(r)?a.getPropertyValue(r):a[r])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:r}){return $B(t,r)}build(t,r,n){Qk(t,r,n.transformTemplate)}scrapeMotionValuesFromProps(t,r,n){return eC(t,r,n)}}const kae={offset:"stroke-dashoffset",array:"stroke-dasharray"},Cae={offset:"strokeDashoffset",array:"strokeDasharray"};function _ae(e,t,r=1,n=0,a=!0){e.pathLength=1;const s=a?kae:Cae;e[s.offset]=`${-n}`,e[s.array]=`${t} ${r}`}const Eae=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function qB(e,{attrX:t,attrY:r,attrScale:n,pathLength:a,pathSpacing:s=1,pathOffset:o=0,...l},u,d,f){if(Qk(e,l,d),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:m,style:g}=e;m.transform&&(g.transform=m.transform,delete m.transform),(g.transform||m.transformOrigin)&&(g.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),g.transform&&(g.transformBox=(f==null?void 0:f.transformBox)??"fill-box",delete m.transformBox);for(const x of Eae)m[x]!==void 0&&(g[x]=m[x],delete m[x]);t!==void 0&&(m.x=t),r!==void 0&&(m.y=r),n!==void 0&&(m.scale=n),a!==void 0&&_ae(m,a,s,o,!1)}const WB=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),GB=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Tae(e,t,r,n){HB(e,t,void 0,n);for(const a in t.attrs)e.setAttribute(WB.has(a)?a:Wk(a),t.attrs[a])}function YB(e,t,r){const n=eC(e,t,r);for(const a in e)if(Ts(e[a])||Ts(t[a])){const s=Sx.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;n[s]=e[a]}return n}class Pae extends FB{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Fi}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Ax.has(r)){const n=CB(r);return n&&n.default||0}return r=WB.has(r)?r:Wk(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,n){return YB(t,r,n)}build(t,r,n){qB(t,r,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,r,n,a){Tae(t,r,n,a)}mount(t){this.isSVGTag=GB(t.tagName),super.mount(t)}}const Dae=Jk.length;function KB(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?KB(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;r<Dae;r++){const n=Jk[r],a=e.props[n];(kv(a)||a===!1)&&(t[n]=a)}return t}function XB(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}const Oae=[...Zk].reverse(),Rae=Zk.length;function Mae(e){return t=>Promise.all(t.map(({animation:r,options:n})=>Dne(e,r,n)))}function Lae(e){let t=Mae(e),r=AD(),n=!0,a=!1;const s=d=>(f,m)=>{var x;const g=Fm(e,m,d==="exit"?(x=e.presenceContext)==null?void 0:x.custom:void 0);if(g){const{transition:y,transitionEnd:v,...w}=g;f={...f,...w,...v}}return f};function o(d){t=d(e)}function l(d){const{props:f}=e,m=KB(e.parent)||{},g=[],x=new Set;let y={},v=1/0;for(let j=0;j<Rae;j++){const k=Oae[j],A=r[k],T=f[k]!==void 0?f[k]:m[k],M=kv(T),B=k===d?A.isActive:null;B===!1&&(v=j);let L=T===m[k]&&T!==f[k]&&M;if(L&&(n||a)&&e.manuallyAnimateOnMount&&(L=!1),A.protectedKeys={...y},!A.isActive&&B===null||!T&&!A.prevProp||Gw(T)||typeof T=="boolean")continue;if(k==="exit"&&A.isActive&&B!==!0){A.prevResolvedValues&&(y={...y,...A.prevResolvedValues});continue}const F=Iae(A.prevProp,T);let I=F||k===d&&A.isActive&&!L&&M||j>v&&M,q=!1;const P=Array.isArray(T)?T:[T];let R=P.reduce(s(k),{});B===!1&&(R={});const{prevResolvedValues:K={}}=A,ee={...K,...R},se=X=>{I=!0,x.has(X)&&(q=!0,x.delete(X)),A.needsAnimating[X]=!0;const le=e.getValue(X);le&&(le.liveStyle=!1)};for(const X in ee){const le=R[X],Ae=K[X];if(y.hasOwnProperty(X))continue;let ce=!1;M3(le)&&M3(Ae)?ce=!XB(le,Ae):ce=le!==Ae,ce?le!=null?se(X):x.add(X):le!==void 0&&x.has(X)?se(X):A.protectedKeys[X]=!0}A.prevProp=T,A.prevResolvedValues=R,A.isActive&&(y={...y,...R}),(n||a)&&e.blockInitialAnimation&&(I=!1);const Z=L&&F;I&&(!Z||q)&&g.push(...P.map(X=>{const le={type:k};if(typeof X=="string"&&(n||a)&&!Z&&e.manuallyAnimateOnMount&&e.parent){const{parent:Ae}=e,ce=Fm(Ae,X);if(Ae.enteringChildren&&ce){const{delayChildren:D}=ce.transition||{};le.delay=vB(Ae.enteringChildren,e,D)}}return{animation:X,options:le}}))}if(x.size){const j={};if(typeof f.initial!="boolean"){const k=Fm(e,Array.isArray(f.initial)?f.initial[0]:f.initial);k&&k.transition&&(j.transition=k.transition)}x.forEach(k=>{const A=e.getBaseTarget(k),T=e.getValue(k);T&&(T.liveStyle=!0),j[k]=A??null}),g.push({animation:j})}let w=!!g.length;return n&&(f.initial===!1||f.initial===f.animate)&&!e.manuallyAnimateOnMount&&(w=!1),n=!1,a=!1,w?t(g):Promise.resolve()}function u(d,f){var g;if(r[d].isActive===f)return Promise.resolve();(g=e.variantChildren)==null||g.forEach(x=>{var y;return(y=x.animationState)==null?void 0:y.setActive(d,f)}),r[d].isActive=f;const m=l(d);for(const x in r)r[x].protectedKeys={};return m}return{animateChanges:l,setActive:u,setAnimateFunction:o,getState:()=>r,reset:()=>{r=AD(),a=!0}}}function Iae(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!XB(t,e):!1}function xm(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function AD(){return{animate:xm(!0),whileInView:xm(),whileHover:xm(),whileTap:xm(),whileDrag:xm(),whileFocus:xm(),exit:xm()}}function V3(e,t){e.min=t.min,e.max=t.max}function yc(e,t){V3(e.x,t.x),V3(e.y,t.y)}function kD(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const ZB=1e-4,Fae=1-ZB,Bae=1+ZB,JB=.01,zae=0-JB,Uae=0+JB;function oo(e){return e.max-e.min}function $ae(e,t,r){return Math.abs(e-t)<=r}function CD(e,t,r,n=.5){e.origin=n,e.originPoint=ba(t.min,t.max,e.origin),e.scale=oo(r)/oo(t),e.translate=ba(r.min,r.max,e.origin)-e.originPoint,(e.scale>=Fae&&e.scale<=Bae||isNaN(e.scale))&&(e.scale=1),(e.translate>=zae&&e.translate<=Uae||isNaN(e.translate))&&(e.translate=0)}function nv(e,t,r,n){CD(e.x,t.x,r.x,n?n.originX:void 0),CD(e.y,t.y,r.y,n?n.originY:void 0)}function _D(e,t,r,n=0){const a=n?ba(r.min,r.max,n):r.min;e.min=a+t.min,e.max=e.min+oo(t)}function Hae(e,t,r,n){_D(e.x,t.x,r.x,n==null?void 0:n.x),_D(e.y,t.y,r.y,n==null?void 0:n.y)}function ED(e,t,r,n=0){const a=n?ba(r.min,r.max,n):r.min;e.min=t.min-a,e.max=e.min+oo(t)}function w2(e,t,r,n){ED(e.x,t.x,r.x,n==null?void 0:n.x),ED(e.y,t.y,r.y,n==null?void 0:n.y)}function TD(e,t,r,n,a){return e-=t,e=b2(e,1/r,n),a!==void 0&&(e=b2(e,1/a,n)),e}function Vae(e,t=0,r=1,n=.5,a,s=e,o=e){if(Iu.test(t)&&(t=parseFloat(t),t=ba(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=ba(s.min,s.max,n);e===s&&(l-=t),e.min=TD(e.min,t,r,l,a),e.max=TD(e.max,t,r,l,a)}function PD(e,t,[r,n,a],s,o){Vae(e,t[r],t[n],t[a],t.scale,s,o)}const qae=["x","scaleX","originX"],Wae=["y","scaleY","originY"];function DD(e,t,r,n){PD(e.x,t,qae,r?r.x:void 0,n?n.x:void 0),PD(e.y,t,Wae,r?r.y:void 0,n?n.y:void 0)}function OD(e){return e.translate===0&&e.scale===1}function QB(e){return OD(e.x)&&OD(e.y)}function RD(e,t){return e.min===t.min&&e.max===t.max}function Gae(e,t){return RD(e.x,t.x)&&RD(e.y,t.y)}function MD(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ez(e,t){return MD(e.x,t.x)&&MD(e.y,t.y)}function LD(e){return oo(e.x)/oo(e.y)}function ID(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function ku(e){return[e("x"),e("y")]}function Yae(e,t,r){let n="";const a=e.x.translate/t.x,s=e.y.translate/t.y,o=(r==null?void 0:r.z)||0;if((a||s||o)&&(n=`translate3d(${a}px, ${s}px, ${o}px) `),(t.x!==1||t.y!==1)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:d,rotate:f,rotateX:m,rotateY:g,skewX:x,skewY:y}=r;d&&(n=`perspective(${d}px) ${n}`),f&&(n+=`rotate(${f}deg) `),m&&(n+=`rotateX(${m}deg) `),g&&(n+=`rotateY(${g}deg) `),x&&(n+=`skewX(${x}deg) `),y&&(n+=`skewY(${y}deg) `)}const l=e.x.scale*t.x,u=e.y.scale*t.y;return(l!==1||u!==1)&&(n+=`scale(${l}, ${u})`),n||"none"}const tz=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],Kae=tz.length,FD=e=>typeof e=="string"?parseFloat(e):e,BD=e=>typeof e=="number"||dr.test(e);function Xae(e,t,r,n,a,s){a?(e.opacity=ba(0,r.opacity??1,Zae(n)),e.opacityExit=ba(t.opacity??1,0,Jae(n))):s&&(e.opacity=ba(t.opacity??1,r.opacity??1,n));for(let o=0;o<Kae;o++){const l=tz[o];let u=zD(t,l),d=zD(r,l);if(u===void 0&&d===void 0)continue;u||(u=0),d||(d=0),u===0||d===0||BD(u)===BD(d)?(e[l]=Math.max(ba(FD(u),FD(d),n),0),(Iu.test(d)||Iu.test(u))&&(e[l]+="%")):e[l]=d}(t.rotate||r.rotate)&&(e.rotate=ba(t.rotate||0,r.rotate||0,n))}function zD(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const Zae=rz(0,.5,W9),Jae=rz(.5,.95,Vl);function rz(e,t,r){return n=>n<e?0:n>t?1:r(Sv(e,t,n))}function Qae(e,t,r){const n=Ts(e)?e:sx(e);return n.start(Vk("",n,t,r)),n.animation}function Cv(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}const eie=(e,t)=>e.depth-t.depth;class tie{constructor(){this.children=[],this.isDirty=!1}add(t){Pk(this.children,t),this.isDirty=!0}remove(t){m2(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(eie),this.isDirty=!1,this.children.forEach(t)}}function rie(e,t){const r=so.now(),n=({timestamp:a})=>{const s=a-r;s>=t&&(jh(n),e(s-t))};return ia.setup(n,!0),()=>jh(n)}function Yb(e){return Ts(e)?e.get():e}class nie{constructor(){this.members=[]}add(t){Pk(this.members,t);for(let r=this.members.length-1;r>=0;r--){const n=this.members[r];if(n===t||n===this.lead||n===this.prevLead)continue;const a=n.instance;(!a||a.isConnected===!1)&&!n.snapshot&&(m2(this.members,n),n.unmount())}t.scheduleRender()}remove(t){if(m2(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){var r;for(let n=this.members.indexOf(t)-1;n>=0;n--){const a=this.members[n];if(a.isPresent!==!1&&((r=a.instance)==null?void 0:r.isConnected)!==!1)return this.promote(a),!0}return!1}promote(t,r){var a;const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.updateSnapshot(),t.scheduleRender();const{layoutDependency:s}=n.options,{layoutDependency:o}=t.options;(s===void 0||s!==o)&&(t.resumeFrom=n,r&&(n.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),(a=t.root)!=null&&a.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var r,n,a,s,o;(n=(r=t.options).onExitComplete)==null||n.call(r),(o=(a=t.resumingFrom)==null?void 0:(s=a.options).onExitComplete)==null||o.call(s)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const Kb={hasAnimatedSinceResize:!0,hasEverUpdated:!1},LN=["","X","Y","Z"],aie=1e3;let iie=0;function IN(e,t,r,n){const{latestValues:a}=t;a[e]&&(r[e]=a[e],t.setStaticValue(e,0),n&&(n[e]=0))}function nz(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=NB(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:a,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",ia,!(a||s))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&nz(n)}function az({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:a}){return class{constructor(o={},l=t==null?void 0:t()){this.id=iie++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(lie),this.nodes.forEach(mie),this.nodes.forEach(pie),this.nodes.forEach(cie)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new tie)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Ok),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const u=this.eventHandlers.get(o);u&&u.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=Xk(o)&&!oae(o),this.instance=o;const{layoutId:l,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(u||l)&&(this.isLayoutDirty=!0),e){let f,m=0;const g=()=>this.root.updateBlockedByResize=!1;ia.read(()=>{m=window.innerWidth}),e(o,()=>{const x=window.innerWidth;x!==m&&(m=x,this.root.updateBlockedByResize=!0,f&&f(),f=rie(g,250),Kb.hasAnimatedSinceResize&&(Kb.hasAnimatedSinceResize=!1,this.nodes.forEach(HD)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:m,hasRelativeLayoutChanged:g,layout:x})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||d.getDefaultTransition()||bie,{onLayoutAnimationStart:v,onLayoutAnimationComplete:w}=d.getProps(),j=!this.targetLayout||!ez(this.targetLayout,x),k=!m&&g;if(this.options.layoutRoot||this.resumeFrom||k||m&&(j||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const A={...Hk(y,"layout"),onPlay:v,onComplete:w};(d.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A),this.setAnimationOrigin(f,k)}else m||HD(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=x})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),jh(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(xie),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&nz(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f<this.path.length;f++){const m=this.path[f];m.shouldResetTransform=!0,(typeof m.latestValues.x=="string"||typeof m.latestValues.y=="string")&&(m.isLayoutDirty=!0),m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:l,layout:u}=this.options;if(l===void 0&&!u)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const u=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),u&&this.nodes.forEach(die),this.nodes.forEach(UD);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach($D);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(fie),this.nodes.forEach(hie),this.nodes.forEach(sie),this.nodes.forEach(oie)):this.nodes.forEach($D),this.clearAllSnapshots();const l=so.now();ks.delta=zu(0,1e3/60,l-ks.timestamp),ks.timestamp=l,ks.isProcessing=!0,_N.update.process(ks),_N.preRender.process(ks),_N.render.process(ks),ks.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Yk.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(uie),this.sharedNodes.forEach(gie)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ia.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ia.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!oo(this.snapshot.measuredBox.x)&&!oo(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Fi()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const u=n(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:u,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!a)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!QB(this.projectionDelta),u=this.getTransformTemplate(),d=u?u(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;o&&this.instance&&(l||jm(this.latestValues)||f)&&(a(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let u=this.removeElementScroll(l);return o&&(u=this.removeTransform(u)),wie(u),{animationId:this.root.animationId,measuredBox:l,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:o}=this.options;if(!o)return Fi();const l=o.measureViewportBox();if(!(((d=this.scroll)==null?void 0:d.wasRoot)||this.path.some(jie))){const{scroll:f}=this.root;f&&(Cu(l.x,f.offset.x),Cu(l.y,f.offset.y))}return l}removeElementScroll(o){var u;const l=Fi();if(yc(l,o),(u=this.scroll)!=null&&u.wasRoot)return l;for(let d=0;d<this.path.length;d++){const f=this.path[d],{scroll:m,options:g}=f;f!==this.root&&m&&g.layoutScroll&&(m.wasRoot&&yc(l,o),Cu(l.x,m.offset.x),Cu(l.y,m.offset.y))}return l}applyTransform(o,l=!1,u){var f,m;const d=u||Fi();yc(d,o);for(let g=0;g<this.path.length;g++){const x=this.path[g];!l&&x.options.layoutScroll&&x.scroll&&x!==x.root&&(Cu(d.x,-x.scroll.offset.x),Cu(d.y,-x.scroll.offset.y)),jm(x.latestValues)&&Gb(d,x.latestValues,(f=x.layout)==null?void 0:f.layoutBox)}return jm(this.latestValues)&&Gb(d,this.latestValues,(m=this.layout)==null?void 0:m.layoutBox),d}removeTransform(o){var u;const l=Fi();yc(l,o);for(let d=0;d<this.path.length;d++){const f=this.path[d];if(!jm(f.latestValues))continue;let m;f.instance&&(U3(f.latestValues)&&f.updateSnapshot(),m=Fi(),yc(m,f.measurePageBox())),DD(l,f.latestValues,(u=f.snapshot)==null?void 0:u.layoutBox,m)}return jm(this.latestValues)&&DD(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ks.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var x;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==l;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||(x=this.parent)!=null&&x.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:f,layoutId:m}=this.options;if(!this.layout||!(f||m))return;this.resolvedRelativeTargetAt=ks.timestamp;const g=this.getClosestProjectingParent();g&&this.linkedParentVersion!==g.layoutVersion&&!g.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&g&&g.layout?this.createRelativeTarget(g,this.layout.layoutBox,g.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Fi(),this.targetWithTransforms=Fi()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Hae(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):yc(this.target,this.layout.layoutBox),UB(this.target,this.targetDelta)):yc(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?this.createRelativeTarget(g,this.target,g.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||U3(this.parent.latestValues)||zB(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,u){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Fi(),this.relativeTargetOrigin=Fi(),w2(this.relativeTargetOrigin,l,u,this.options.layoutAnchor||void 0),yc(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var y;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let u=!0;if((this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===ks.timestamp&&(u=!1),u)return;const{layout:d,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||f))return;yc(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,g=this.treeScale.y;vae(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=Fi());const{target:x}=o;if(!x){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(kD(this.prevProjectionDelta.x,this.projectionDelta.x),kD(this.prevProjectionDelta.y,this.projectionDelta.y)),nv(this.projectionDelta,this.layoutCorrected,x,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==g||!ID(this.projectionDelta.x,this.prevProjectionDelta.x)||!ID(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",x))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Mp(),this.projectionDelta=Mp(),this.projectionDeltaWithTransform=Mp()}setAnimationOrigin(o,l=!1){const u=this.snapshot,d=u?u.latestValues:{},f={...this.latestValues},m=Mp();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const g=Fi(),x=u?u.source:void 0,y=this.layout?this.layout.source:void 0,v=x!==y,w=this.getStack(),j=!w||w.members.length<=1,k=!!(v&&!j&&this.options.crossfade===!0&&!this.path.some(yie));this.animationProgress=0;let A;this.mixTargetDelta=T=>{const M=T/1e3;VD(m.x,o.x,M),VD(m.y,o.y,M),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(w2(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),vie(this.relativeTarget,this.relativeTargetOrigin,g,M),A&&Gae(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Fi()),yc(A,this.relativeTarget)),v&&(this.animationValues=f,Xae(f,d,this.latestValues,M,k,j)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=M},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,u,d;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(d=(u=this.resumingFrom)==null?void 0:u.currentAnimation)==null||d.stop(),this.pendingAnimation&&(jh(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ia.update(()=>{Kb.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=sx(0)),this.motionValue.jump(0,!1),this.currentAnimation=Qae(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),o.onUpdate&&o.onUpdate(f)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(aie),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:u,layout:d,latestValues:f}=o;if(!(!l||!u||!d)){if(this!==o&&this.layout&&d&&iz(this.options.animationType,this.layout.layoutBox,d.layoutBox)){u=this.target||Fi();const m=oo(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+m;const g=oo(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+g}yc(l,u),Gb(l,f),nv(this.projectionDeltaWithTransform,this.layoutCorrected,l,f)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new nie),this.sharedNodes.get(o).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:u}={}){const d=this.getStack();d&&d.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(l=!0),!l)return;const d={};u.z&&IN("z",o,d,this.animationValues);for(let f=0;f<LN.length;f++)IN(`rotate${LN[f]}`,o,d,this.animationValues),IN(`skew${LN[f]}`,o,d,this.animationValues);o.render();for(const f in d)o.setStaticValue(f,d[f]),this.animationValues&&(this.animationValues[f]=d[f]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=Yb(l==null?void 0:l.pointerEvents)||"",o.transform=u?u(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=Yb(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!jm(this.latestValues)&&(o.transform=u?u({},""):"none",this.hasProjected=!1);return}o.visibility="";const f=d.animationValues||d.latestValues;this.applyTransformsToTarget();let m=Yae(this.projectionDeltaWithTransform,this.treeScale,f);u&&(m=u(f,m)),o.transform=m;const{x:g,y:x}=this.projectionDelta;o.transformOrigin=`${g.origin*100}% ${x.origin*100}% 0`,d.animationValues?o.opacity=d===this?f.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:o.opacity=d===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const y in H3){if(f[y]===void 0)continue;const{correct:v,applyTo:w,isCSSVariable:j}=H3[y],k=m==="none"?f[y]:v(f[y],d);if(w){const A=w.length;for(let T=0;T<A;T++)o[w[T]]=k}else j?this.options.visualElement.renderState.vars[y]=k:o[y]=k}this.options.layoutId&&(o.pointerEvents=d===this?Yb(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(UD),this.root.sharedNodes.clear()}}}function sie(e){e.updateLayout()}function oie(e){var r;const t=((r=e.resumeFrom)==null?void 0:r.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:a}=e.layout,{animationType:s}=e.options,o=t.source!==e.layout.source;if(s==="size")ku(m=>{const g=o?t.measuredBox[m]:t.layoutBox[m],x=oo(g);g.min=n[m].min,g.max=g.min+x});else if(s==="x"||s==="y"){const m=s==="x"?"y":"x";V3(o?t.measuredBox[m]:t.layoutBox[m],n[m])}else iz(s,t.layoutBox,n)&&ku(m=>{const g=o?t.measuredBox[m]:t.layoutBox[m],x=oo(n[m]);g.max=g.min+x,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[m].max=e.relativeTarget[m].min+x)});const l=Mp();nv(l,n,t.layoutBox);const u=Mp();o?nv(u,e.applyTransform(a,!0),t.measuredBox):nv(u,n,t.layoutBox);const d=!QB(l);let f=!1;if(!e.resumeFrom){const m=e.getClosestProjectingParent();if(m&&!m.resumeFrom){const{snapshot:g,layout:x}=m;if(g&&x){const y=e.options.layoutAnchor||void 0,v=Fi();w2(v,t.layoutBox,g.layoutBox,y);const w=Fi();w2(w,n,x.layoutBox,y),ez(v,w)||(f=!0),m.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=v,e.relativeParent=m)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:u,layoutDelta:l,hasLayoutChanged:d,hasRelativeLayoutChanged:f})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function lie(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function cie(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function uie(e){e.clearSnapshot()}function UD(e){e.clearMeasurements()}function die(e){e.isLayoutDirty=!0,e.updateLayout()}function $D(e){e.isLayoutDirty=!1}function fie(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function hie(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function HD(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function mie(e){e.resolveTargetDelta()}function pie(e){e.calcProjection()}function xie(e){e.resetSkewAndRotation()}function gie(e){e.removeLeadSnapshot()}function VD(e,t,r){e.translate=ba(t.translate,0,r),e.scale=ba(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function qD(e,t,r,n){e.min=ba(t.min,r.min,n),e.max=ba(t.max,r.max,n)}function vie(e,t,r,n){qD(e.x,t.x,r.x,n),qD(e.y,t.y,r.y,n)}function yie(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const bie={duration:.45,ease:[.4,0,.1,1]},WD=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),GD=WD("applewebkit/")&&!WD("chrome/")?Math.round:Vl;function YD(e){e.min=GD(e.min),e.max=GD(e.max)}function wie(e){YD(e.x),YD(e.y)}function iz(e,t,r){return e==="position"||e==="preserve-aspect"&&!$ae(LD(t),LD(r),.2)}function jie(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const Nie=az({attachResizeListener:(e,t)=>Cv(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),FN={current:void 0},sz=az({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!FN.current){const e=new Nie({});e.mount(window),e.setOptions({layoutScroll:!0}),FN.current=e}return FN.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),tC=N.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function KD(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Sie(...e){return t=>{let r=!1;const n=e.map(a=>{const s=KD(a,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let a=0;a<n.length;a++){const s=n[a];typeof s=="function"?s():KD(e[a],null)}}}}function Aie(...e){return N.useCallback(Sie(...e),e)}class kie extends N.Component{getSnapshotBeforeUpdate(t){const r=this.props.childRef.current;if(Hb(r)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const n=r.offsetParent,a=Hb(n)&&n.offsetWidth||0,s=Hb(n)&&n.offsetHeight||0,o=getComputedStyle(r),l=this.props.sizeRef.current;l.height=parseFloat(o.height),l.width=parseFloat(o.width),l.top=r.offsetTop,l.left=r.offsetLeft,l.right=a-l.width-l.left,l.bottom=s-l.height-l.top}return null}componentDidUpdate(){}render(){return this.props.children}}function Cie({children:e,isPresent:t,anchorX:r,anchorY:n,root:a,pop:s}){var g;const o=N.useId(),l=N.useRef(null),u=N.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:d}=N.useContext(tC),f=((g=e.props)==null?void 0:g.ref)??(e==null?void 0:e.ref),m=Aie(l,f);return N.useInsertionEffect(()=>{const{width:x,height:y,top:v,left:w,right:j,bottom:k}=u.current;if(t||s===!1||!l.current||!x||!y)return;const A=r==="left"?`left: ${w}`:`right: ${j}`,T=n==="bottom"?`bottom: ${k}`:`top: ${v}`;l.current.dataset.motionPopId=o;const M=document.createElement("style");d&&(M.nonce=d);const B=a??document.head;return B.appendChild(M),M.sheet&&M.sheet.insertRule(`
          [data-motion-pop-id="${o}"] {
            position: absolute !important;
            width: ${x}px !important;
            height: ${y}px !important;
            ${A}px !important;
            ${T}px !important;
          }
        `),()=>{var L;(L=l.current)==null||L.removeAttribute("data-motion-pop-id"),B.contains(M)&&B.removeChild(M)}},[t]),i.jsx(kie,{isPresent:t,childRef:l,sizeRef:u,pop:s,children:s===!1?e:N.cloneElement(e,{ref:m})})}const _ie=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:a,presenceAffectsLayout:s,mode:o,anchorX:l,anchorY:u,root:d})=>{const f=Tk(Eie),m=N.useId();let g=!0,x=N.useMemo(()=>(g=!1,{id:m,initial:t,isPresent:r,custom:a,onExitComplete:y=>{f.set(y,!0);for(const v of f.values())if(!v)return;n&&n()},register:y=>(f.set(y,!1),()=>f.delete(y))}),[r,f,n]);return s&&g&&(x={...x}),N.useMemo(()=>{f.forEach((y,v)=>f.set(v,!1))},[r]),N.useEffect(()=>{!r&&!f.size&&n&&n()},[r]),e=i.jsx(Cie,{pop:o==="popLayout",isPresent:r,anchorX:l,anchorY:u,root:d,children:e}),i.jsx(qw.Provider,{value:x,children:e})};function Eie(){return new Map}function oz(e=!0){const t=N.useContext(qw);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:n,register:a}=t,s=N.useId();N.useEffect(()=>{if(e)return a(s)},[e]);const o=N.useCallback(()=>e&&n&&n(s),[s,n,e]);return!r&&n?[!1,o]:[!0]}const zy=e=>e.key||"";function XD(e){const t=[];return N.Children.forEach(e,r=>{N.isValidElement(r)&&t.push(r)}),t}const on=({children:e,custom:t,initial:r=!0,onExitComplete:n,presenceAffectsLayout:a=!0,mode:s="sync",propagate:o=!1,anchorX:l="left",anchorY:u="top",root:d})=>{const[f,m]=oz(o),g=N.useMemo(()=>XD(e),[e]),x=o&&!f?[]:g.map(zy),y=N.useRef(!0),v=N.useRef(g),w=Tk(()=>new Map),j=N.useRef(new Set),[k,A]=N.useState(g),[T,M]=N.useState(g);R9(()=>{y.current=!1,v.current=g;for(let F=0;F<T.length;F++){const I=zy(T[F]);x.includes(I)?(w.delete(I),j.current.delete(I)):w.get(I)!==!0&&w.set(I,!1)}},[T,x.length,x.join("-")]);const B=[];if(g!==k){let F=[...g];for(let I=0;I<T.length;I++){const q=T[I],P=zy(q);x.includes(P)||(F.splice(I,0,q),B.push(q))}return s==="wait"&&B.length&&(F=B),M(XD(F)),A(g),null}const{forceRender:L}=N.useContext(Ek);return i.jsx(i.Fragment,{children:T.map(F=>{const I=zy(F),q=o&&!f?!1:g===T||x.includes(I),P=()=>{if(j.current.has(I))return;if(w.has(I))j.current.add(I),w.set(I,!0);else return;let R=!0;w.forEach(K=>{K||(R=!1)}),R&&(L==null||L(),M(v.current),o&&(m==null||m()),n&&n())};return i.jsx(_ie,{isPresent:q,initial:!y.current||r?void 0:!1,custom:t,presenceAffectsLayout:a,mode:s,root:d,onExitComplete:q?void 0:P,anchorX:l,anchorY:u,children:F},I)})})},lz=N.createContext({strict:!1}),ZD={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let JD=!1;function Tie(){if(JD)return;const e={};for(const t in ZD)e[t]={isEnabled:r=>ZD[t].some(n=>!!r[n])};IB(e),JD=!0}function cz(){return Tie(),mae()}function Pie(e){const t=cz();for(const r in e)t[r]={...t[r],...e[r]};IB(t)}const Die=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function j2(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Die.has(e)}let uz=e=>!j2(e);function Oie(e){typeof e=="function"&&(uz=t=>t.startsWith("on")?!j2(t):e(t))}try{Oie(require("@emotion/is-prop-valid").default)}catch{}function Rie(e,t,r){const n={};for(const a in e)a==="values"&&typeof e.values=="object"||Ts(e[a])||(uz(a)||r===!0&&j2(a)||!t&&!j2(a)||e.draggable&&a.startsWith("onDrag"))&&(n[a]=e[a]);return n}const Kw=N.createContext({});function Mie(e,t){if(Yw(e)){const{initial:r,animate:n}=e;return{initial:r===!1||kv(r)?r:void 0,animate:kv(n)?n:void 0}}return e.inherit!==!1?t:{}}function Lie(e){const{initial:t,animate:r}=Mie(e,N.useContext(Kw));return N.useMemo(()=>({initial:t,animate:r}),[QD(t),QD(r)])}function QD(e){return Array.isArray(e)?e.join(" "):e}const rC=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function dz(e,t,r){for(const n in t)!Ts(t[n])&&!VB(n,r)&&(e[n]=t[n])}function Iie({transformTemplate:e},t){return N.useMemo(()=>{const r=rC();return Qk(r,t,e),Object.assign({},r.vars,r.style)},[t])}function Fie(e,t){const r=e.style||{},n={};return dz(n,r,e),Object.assign(n,Iie(e,t)),n}function Bie(e,t){const r={},n=Fie(e,t);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=n,r}const fz=()=>({...rC(),attrs:{}});function zie(e,t,r,n){const a=N.useMemo(()=>{const s=fz();return qB(s,t,GB(n),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};dz(s,e.style,e),a.style={...s,...a.style}}return a}const Uie=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function nC(e){return typeof e!="string"||e.includes("-")?!1:!!(Uie.indexOf(e)>-1||/[A-Z]/u.test(e))}function $ie(e,t,r,{latestValues:n},a,s=!1,o){const u=(o??nC(e)?zie:Bie)(t,n,a,e),d=Rie(t,typeof e=="string",s),f=e!==N.Fragment?{...d,...u,ref:r}:{},{children:m}=t,g=N.useMemo(()=>Ts(m)?m.get():m,[m]);return N.createElement(e,{...f,children:g})}function Hie({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,a){return{latestValues:Vie(r,n,a,e),renderState:t()}}function Vie(e,t,r,n){const a={},s=n(e,{});for(const g in s)a[g]=Yb(s[g]);let{initial:o,animate:l}=e;const u=Yw(e),d=MB(e);t&&d&&!u&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let f=r?r.initial===!1:!1;f=f||o===!1;const m=f?l:o;if(m&&typeof m!="boolean"&&!Gw(m)){const g=Array.isArray(m)?m:[m];for(let x=0;x<g.length;x++){const y=qk(e,g[x]);if(y){const{transitionEnd:v,transition:w,...j}=y;for(const k in j){let A=j[k];if(Array.isArray(A)){const T=f?A.length-1:0;A=A[T]}A!==null&&(a[k]=A)}for(const k in v)a[k]=v[k]}}}return a}const hz=e=>(t,r)=>{const n=N.useContext(Kw),a=N.useContext(qw),s=()=>Hie(e,t,n,a);return r?s():Tk(s)},qie=hz({scrapeMotionValuesFromProps:eC,createRenderState:rC}),Wie=hz({scrapeMotionValuesFromProps:YB,createRenderState:fz}),Gie=Symbol.for("motionComponentSymbol");function Yie(e,t,r){const n=N.useRef(r);N.useInsertionEffect(()=>{n.current=r});const a=N.useRef(null);return N.useCallback(s=>{var l;s&&((l=e.onMount)==null||l.call(e,s));const o=n.current;if(typeof o=="function")if(s){const u=o(s);typeof u=="function"&&(a.current=u)}else a.current?(a.current(),a.current=null):o(s);else o&&(o.current=s);t&&(s?t.mount(s):t.unmount())},[t])}const mz=N.createContext({});function _p(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Kie(e,t,r,n,a,s){var A,T;const{visualElement:o}=N.useContext(Kw),l=N.useContext(lz),u=N.useContext(qw),d=N.useContext(tC),f=d.reducedMotion,m=d.skipAnimations,g=N.useRef(null),x=N.useRef(!1);n=n||l.renderer,!g.current&&n&&(g.current=n(e,{visualState:t,parent:o,props:r,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:f,skipAnimations:m,isSVG:s}),x.current&&g.current&&(g.current.manuallyAnimateOnMount=!0));const y=g.current,v=N.useContext(mz);y&&!y.projection&&a&&(y.type==="html"||y.type==="svg")&&Xie(g.current,r,a,v);const w=N.useRef(!1);N.useInsertionEffect(()=>{y&&w.current&&y.update(r,u)});const j=r[jB],k=N.useRef(!!j&&typeof window<"u"&&!((A=window.MotionHandoffIsComplete)!=null&&A.call(window,j))&&((T=window.MotionHasOptimisedAnimation)==null?void 0:T.call(window,j)));return R9(()=>{x.current=!0,y&&(w.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),k.current&&y.animationState&&y.animationState.animateChanges())}),N.useEffect(()=>{y&&(!k.current&&y.animationState&&y.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var M;(M=window.MotionHandoffMarkAsComplete)==null||M.call(window,j)}),k.current=!1),y.enteringChildren=void 0)}),y}function Xie(e,t,r,n){const{layoutId:a,layout:s,drag:o,dragConstraints:l,layoutScroll:u,layoutRoot:d,layoutAnchor:f,layoutCrossfade:m}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:pz(e.parent)),e.projection.setOptions({layoutId:a,layout:s,alwaysMeasureLayout:!!o||l&&_p(l),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,crossfade:m,layoutScroll:u,layoutRoot:d,layoutAnchor:f})}function pz(e){if(e)return e.options.allowProjection!==!1?e.projection:pz(e.parent)}function BN(e,{forwardMotionProps:t=!1,type:r}={},n,a){n&&Pie(n);const s=r?r==="svg":nC(e),o=s?Wie:qie;function l(d,f){let m;const g={...N.useContext(tC),...d,layoutId:Zie(d)},{isStatic:x}=g,y=Lie(d),v=o(d,x);if(!x&&typeof window<"u"){Jie();const w=Qie(g);m=w.MeasureLayout,y.visualElement=Kie(e,v,g,a,w.ProjectionNode,s)}return i.jsxs(Kw.Provider,{value:y,children:[m&&y.visualElement?i.jsx(m,{visualElement:y.visualElement,...g}):null,$ie(e,d,Yie(v,y.visualElement,f),v,x,t,s)]})}l.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const u=N.forwardRef(l);return u[Gie]=e,u}function Zie({layoutId:e}){const t=N.useContext(Ek).id;return t&&e!==void 0?t+"-"+e:e}function Jie(e,t){N.useContext(lz).strict}function Qie(e){const t=cz(),{drag:r,layout:n}=t;if(!r&&!n)return{};const a={...r,...n};return{MeasureLayout:r!=null&&r.isEnabled(e)||n!=null&&n.isEnabled(e)?a.MeasureLayout:void 0,ProjectionNode:a.ProjectionNode}}function ese(e,t){if(typeof Proxy>"u")return BN;const r=new Map,n=(s,o)=>BN(s,o,e,t),a=(s,o)=>n(s,o);return new Proxy(a,{get:(s,o)=>o==="create"?n:(r.has(o)||r.set(o,BN(o,void 0,e,t)),r.get(o))})}const tse=(e,t)=>t.isSVG??nC(e)?new Pae(t):new Aae(t,{allowProjection:e!==N.Fragment});class rse extends Rh{constructor(t){super(t),t.animationState||(t.animationState=Lae(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Gw(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let nse=0;class ase extends Rh{constructor(){super(...arguments),this.id=nse++,this.isExitComplete=!1}update(){var s;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;if(t&&n===!1){if(this.isExitComplete){const{initial:o,custom:l}=this.node.getProps();if(typeof o=="string"){const u=Fm(this.node,o,l);if(u){const{transition:d,transitionEnd:f,...m}=u;for(const g in m)(s=this.node.getValue(g))==null||s.jump(m[g])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const a=this.node.animationState.setActive("exit",!t);r&&!t&&a.then(()=>{this.isExitComplete=!0,r(this.id)})}mount(){const{register:t,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const ise={animation:{Feature:rse},exit:{Feature:ase}};function d1(e){return{point:{x:e.pageX,y:e.pageY}}}const sse=e=>t=>Kk(t)&&e(t,d1(t));function av(e,t,r,n){return Cv(e,t,sse(r),n)}const xz=({current:e})=>e?e.ownerDocument.defaultView:null,e8=(e,t)=>Math.abs(e-t);function ose(e,t){const r=e8(e.x,t.x),n=e8(e.y,t.y);return Math.sqrt(r**2+n**2)}const t8=new Set(["auto","scroll"]);class gz{constructor(t,r,{transformPagePoint:n,contextWindow:a=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=x=>{this.handleScroll(x.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Uy(this.lastRawMoveEventInfo,this.transformPagePoint));const x=zN(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,v=ose(x.offset,{x:0,y:0})>=this.distanceThreshold;if(!y&&!v)return;const{point:w}=x,{timestamp:j}=ks;this.history.push({...w,timestamp:j});const{onStart:k,onMove:A}=this.handlers;y||(k&&k(this.lastMoveEvent,x),this.startEvent=this.lastMoveEvent),A&&A(this.lastMoveEvent,x)},this.handlePointerMove=(x,y)=>{this.lastMoveEvent=x,this.lastRawMoveEventInfo=y,this.lastMoveEventInfo=Uy(y,this.transformPagePoint),ia.update(this.updatePoint,!0)},this.handlePointerUp=(x,y)=>{this.end();const{onEnd:v,onSessionEnd:w,resumeAnimation:j}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=zN(x.type==="pointercancel"?this.lastMoveEventInfo:Uy(y,this.transformPagePoint),this.history);this.startEvent&&v&&v(x,k),w&&w(x,k)},!Kk(t))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.distanceThreshold=o,this.contextWindow=a||window;const u=d1(t),d=Uy(u,this.transformPagePoint),{point:f}=d,{timestamp:m}=ks;this.history=[{...f,timestamp:m}];const{onSessionStart:g}=r;g&&g(t,zN(d,this.history)),this.removeListeners=l1(av(this.contextWindow,"pointermove",this.handlePointerMove),av(this.contextWindow,"pointerup",this.handlePointerUp),av(this.contextWindow,"pointercancel",this.handlePointerUp)),l&&this.startScrollTracking(l)}startScrollTracking(t){let r=t.parentElement;for(;r;){const n=getComputedStyle(r);(t8.has(n.overflowX)||t8.has(n.overflowY))&&this.scrollPositions.set(r,{x:r.scrollLeft,y:r.scrollTop}),r=r.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const r=this.scrollPositions.get(t);if(!r)return;const n=t===window,a=n?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},s={x:a.x-r.x,y:a.y-r.y};s.x===0&&s.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(t,a),ia.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),jh(this.updatePoint)}}function Uy(e,t){return t?{point:t(e.point)}:e}function r8(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zN({point:e},t){return{point:e,delta:r8(e,vz(t)),offset:r8(e,lse(t)),velocity:cse(t,.1)}}function lse(e){return e[0]}function vz(e){return e[e.length-1]}function cse(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const a=vz(e);for(;r>=0&&(n=e[r],!(a.timestamp-n.timestamp>hl(t)));)r--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&a.timestamp-n.timestamp>hl(t)*2&&(n=e[1]);const s=zl(a.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(a.x-n.x)/s,y:(a.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function use(e,{min:t,max:r},n){return t!==void 0&&e<t?e=n?ba(t,e,n.min):Math.max(e,t):r!==void 0&&e>r&&(e=n?ba(r,e,n.max):Math.min(e,r)),e}function n8(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function dse(e,{top:t,left:r,bottom:n,right:a}){return{x:n8(e.x,r,a),y:n8(e.y,t,n)}}function a8(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}function fse(e,t){return{x:a8(e.x,t.x),y:a8(e.y,t.y)}}function hse(e,t){let r=.5;const n=oo(e),a=oo(t);return a>n?r=Sv(t.min,t.max-n,e.min):n>a&&(r=Sv(e.min,e.max-a,t.min)),zu(0,1,r)}function mse(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const q3=.35;function pse(e=q3){return e===!1?e=0:e===!0&&(e=q3),{x:i8(e,"left","right"),y:i8(e,"top","bottom")}}function i8(e,t,r){return{min:s8(e,t),max:s8(e,r)}}function s8(e,t){return typeof e=="number"?e:e[t]||0}const xse=new WeakMap;class gse{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Fi(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:r=!1,distanceThreshold:n}={}){const{presenceContext:a}=this.visualElement;if(a&&a.isPresent===!1)return;const s=m=>{r&&this.snapToCursor(d1(m).point),this.stopAnimation()},o=(m,g)=>{const{drag:x,dragPropagation:y,onDragStart:v}=this.getProps();if(x&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Vne(x),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=g,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ku(j=>{let k=this.getAxisMotionValue(j).get()||0;if(Iu.test(k)){const{projection:A}=this.visualElement;if(A&&A.layout){const T=A.layout.layoutBox[j];T&&(k=oo(T)*(parseFloat(k)/100))}}this.originPoint[j]=k}),v&&ia.update(()=>v(m,g),!1,!0),L3(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},l=(m,g)=>{this.latestPointerEvent=m,this.latestPanInfo=g;const{dragPropagation:x,dragDirectionLock:y,onDirectionLock:v,onDrag:w}=this.getProps();if(!x&&!this.openDragLock)return;const{offset:j}=g;if(y&&this.currentDirection===null){this.currentDirection=yse(j),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",g.point,j),this.updateAxis("y",g.point,j),this.visualElement.render(),w&&ia.update(()=>w(m,g),!1,!0)},u=(m,g)=>{this.latestPointerEvent=m,this.latestPanInfo=g,this.stop(m,g),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>{const{dragSnapToOrigin:m}=this.getProps();(m||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:f}=this.getProps();this.panSession=new gz(t,{onSessionStart:s,onStart:o,onMove:l,onSessionEnd:u,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:f,distanceThreshold:n,contextWindow:xz(this.visualElement),element:this.visualElement.current})}stop(t,r){const n=t||this.latestPointerEvent,a=r||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!a||!n)return;const{velocity:o}=a;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&ia.postRender(()=>l(n,a))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,r,n){const{drag:a}=this.getProps();if(!n||!$y(t,a,this.currentDirection))return;const s=this.getAxisMotionValue(t);let o=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(o=use(o,this.constraints[t],this.elastic[t])),s.set(o)}resolveConstraints(){var s;const{dragConstraints:t,dragElastic:r}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,a=this.constraints;t&&_p(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&n?this.constraints=dse(n.layoutBox,t):this.constraints=!1,this.elastic=pse(r),a!==this.constraints&&!_p(t)&&n&&this.constraints&&!this.hasMutatedConstraints&&ku(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=mse(n.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!_p(t))return!1;const n=t.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const s=yae(n,a.root,this.visualElement.getTransformPagePoint());let o=fse(a.layout.layoutBox,s);if(r){const l=r(xae(o));this.hasMutatedConstraints=!!l,l&&(o=BB(l))}return o}startAnimation(t){const{drag:r,dragMomentum:n,dragElastic:a,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),u=this.constraints||{},d=ku(f=>{if(!$y(f,r,this.currentDirection))return;let m=u&&u[f]||{};(o===!0||o===f)&&(m={min:0,max:0});const g=a?200:1e6,x=a?40:1e7,y={type:"inertia",velocity:n?t[f]:0,bounceStiffness:g,bounceDamping:x,timeConstant:750,restDelta:1,restSpeed:10,...s,...m};return this.startAxisValueAnimation(f,y)});return Promise.all(d).then(l)}startAxisValueAnimation(t,r){const n=this.getAxisMotionValue(t);return L3(this.visualElement,t),n.start(Vk(t,n,0,r,this.visualElement,!1))}stopAnimation(){ku(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const r=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),a=n[r];return a||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){ku(r=>{const{drag:n}=this.getProps();if(!$y(r,n,this.currentDirection))return;const{projection:a}=this.visualElement,s=this.getAxisMotionValue(r);if(a&&a.layout){const{min:o,max:l}=a.layout.layoutBox[r],u=s.get()||0;s.set(t[r]-ba(o,l,.5)+u)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!_p(r)||!n||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};ku(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const u=l.get();a[o]=hse({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),ku(o=>{if(!$y(o,t,null))return;const l=this.getAxisMotionValue(o),{min:u,max:d}=this.constraints[o];l.set(ba(u,d,a[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;xse.set(this.visualElement,this);const t=this.visualElement.current,r=av(t,"pointerdown",d=>{const{drag:f,dragListener:m=!0}=this.getProps(),g=d.target,x=g!==t&&Xne(g);f&&m&&!x&&this.start(d)});let n;const a=()=>{const{dragConstraints:d}=this.getProps();_p(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),n||(n=vse(t,d.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,o=s.addEventListener("measure",a);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),ia.read(a);const l=Cv(window,"resize",()=>this.scalePositionWithinConstraints()),u=s.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:f})=>{this.isDragging&&f&&(ku(m=>{const g=this.getAxisMotionValue(m);g&&(this.originPoint[m]+=d[m].translate,g.set(g.get()+d[m].translate))}),this.visualElement.render())}));return()=>{l(),r(),o(),u&&u(),n&&n()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:a=!1,dragConstraints:s=!1,dragElastic:o=q3,dragMomentum:l=!0}=t;return{...t,drag:r,dragDirectionLock:n,dragPropagation:a,dragConstraints:s,dragElastic:o,dragMomentum:l}}}function o8(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function vse(e,t,r){const n=mD(e,o8(r)),a=mD(t,o8(r));return()=>{n(),a()}}function $y(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function yse(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class bse extends Rh{constructor(t){super(t),this.removeGroupControls=Vl,this.removeListeners=Vl,this.controls=new gse(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Vl}update(){const{dragControls:t}=this.node.getProps(),{dragControls:r}=this.node.prevProps||{};t!==r&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const UN=e=>(t,r)=>{e&&ia.update(()=>e(t,r),!1,!0)};class wse extends Rh{constructor(){super(...arguments),this.removePointerDownListener=Vl}onPointerDown(t){this.session=new gz(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:xz(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:n,onPanEnd:a}=this.node.getProps();return{onSessionStart:UN(t),onStart:UN(r),onMove:UN(n),onEnd:(s,o)=>{delete this.session,a&&ia.postRender(()=>a(s,o))}}}mount(){this.removePointerDownListener=av(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let $N=!1;class jse extends N.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n,layoutId:a}=this.props,{projection:s}=t;s&&(r.group&&r.group.add(s),n&&n.register&&a&&n.register(s),$N&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Kb.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:n,drag:a,isPresent:s}=this.props,{projection:o}=n;return o&&(o.isPresent=s,t.layoutDependency!==r&&o.setOptions({...o.options,layoutDependency:r}),$N=!0,a||t.layoutDependency!==r||r===void 0||t.isPresent!==s?o.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?o.promote():o.relegate()||ia.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:r}=this.props,{projection:n}=t;n&&(n.options.layoutAnchor=r,n.root.didUpdate(),Yk.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:a}=t;$N=!0,a&&(a.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(a),n&&n.deregister&&n.deregister(a))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function yz(e){const[t,r]=oz(),n=N.useContext(Ek);return i.jsx(jse,{...e,layoutGroup:n,switchLayoutGroup:N.useContext(mz),isPresent:t,safeToRemove:r})}const Nse={pan:{Feature:wse},drag:{Feature:bse,ProjectionNode:sz,MeasureLayout:yz}};function l8(e,t,r){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover",r==="Start");const a="onHover"+r,s=n[a];s&&ia.postRender(()=>s(t,d1(t)))}class Sse extends Rh{mount(){const{current:t}=this.node;t&&(this.unmount=Wne(t,(r,n)=>(l8(this.node,n,"Start"),a=>l8(this.node,a,"End"))))}unmount(){}}class Ase extends Rh{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=l1(Cv(this.node.current,"focus",()=>this.onFocus()),Cv(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function c8(e,t,r){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap",r==="Start");const a="onTap"+(r==="End"?"":r),s=n[a];s&&ia.postRender(()=>s(t,d1(t)))}class kse extends Rh{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:r,propagate:n}=this.node.props;this.unmount=Jne(t,(a,s)=>(c8(this.node,s,"Start"),(o,{success:l})=>c8(this.node,o,l?"End":"Cancel")),{useGlobalTarget:r,stopPropagation:(n==null?void 0:n.tap)===!1})}unmount(){}}const W3=new WeakMap,HN=new WeakMap,Cse=e=>{const t=W3.get(e.target);t&&t(e)},_se=e=>{e.forEach(Cse)};function Ese({root:e,...t}){const r=e||document;HN.has(r)||HN.set(r,{});const n=HN.get(r),a=JSON.stringify(t);return n[a]||(n[a]=new IntersectionObserver(_se,{root:e,...t})),n[a]}function Tse(e,t,r){const n=Ese(t);return W3.set(e,r),n.observe(e),()=>{W3.delete(e),n.unobserve(e)}}const Pse={some:0,all:1};class Dse extends Rh{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var u;(u=this.stopObserver)==null||u.call(this);const{viewport:t={}}=this.node.getProps(),{root:r,margin:n,amount:a="some",once:s}=t,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof a=="number"?a:Pse[a]},l=d=>{const{isIntersecting:f}=d;if(this.isInView===f||(this.isInView=f,s&&!f&&this.hasEnteredView))return;f&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",f);const{onViewportEnter:m,onViewportLeave:g}=this.node.getProps(),x=f?m:g;x&&x(d)};this.stopObserver=Tse(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some(Ose(t,r))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function Ose({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const Rse={inView:{Feature:Dse},tap:{Feature:kse},focus:{Feature:Ase},hover:{Feature:Sse}},Mse={layout:{ProjectionNode:sz,MeasureLayout:yz}},Lse={...ise,...Rse,...Nse,...Mse},ar=ese(Lse,tse),u8="/api/data",Hy=new Map,Eg=new Map,Ise=5e3,Tg=(e={})=>{const t=localStorage.getItem("sessionId"),r={...e};return t&&(r["x-session-id"]=t),r},Bt={get:async(e,t)=>{const r=Eg.get(e);if(r&&Date.now()-r.timestamp<Ise)return r.data;if(Hy.has(e))return Hy.get(e);const n=(async()=>{let a=0;const s=2;for(;a<=s;)try{const o=new AbortController,l=setTimeout(()=>{try{o.abort("Timeout after 30s")}catch{o.abort()}},3e4),u=await fetch(`${u8}/${e}`,{headers:Tg({Accept:"application/json"}),credentials:"include",signal:o.signal});if(clearTimeout(l),!u.ok)throw new Error(`Failed to fetch ${e}: ${u.status} ${u.statusText}`);const d=u.headers.get("content-type");if(!d||!d.includes("application/json"))throw new Error(`Server returned non-JSON response for ${e}`);const f=await u.json();return Eg.set(e,{data:f,timestamp:Date.now()}),f}catch(o){if(o.name==="AbortError"){if(console.warn(`[Storage] Fetch attempt ${a+1} timed out or aborted for ${e}`),a++,a<=s){await new Promise(l=>setTimeout(l,1e3*a));continue}}else console.error(`[Storage] Fetch error for ${e}:`,o.message||o);throw o}throw new Error(`Failed to fetch ${e} after ${s} retries`)})();Hy.set(e,n);try{return await n}finally{Hy.delete(e)}},set:async(e,t)=>{let r=0;const n=2;for(;r<=n;)try{const a=new AbortController,s=setTimeout(()=>{try{a.abort("Timeout after 30s")}catch{a.abort()}},3e4),o=await fetch(`${u8}/${e}`,{method:"POST",headers:Tg({"Content-Type":"application/json"}),body:JSON.stringify(t),credentials:"include",signal:a.signal});if(clearTimeout(s),o.ok){const u=await o.json();return Eg.delete(e),u.lastChange||null}let l=`Failed to save ${e}: ${o.status} ${o.statusText}`;try{const u=await o.json();u.error&&(l=u.error)}catch{}throw o.status===401&&console.error("Session expired or unauthorized"),new Error(l)}catch(a){if(a.name==="AbortError"){if(console.warn(`[Storage] Save attempt ${r+1} timed out or aborted for ${e}`),r++,r<=n){await new Promise(s=>setTimeout(s,1e3*r));continue}throw new Error("SERVER_TIMEOUT")}else throw console.error(`Error saving ${e}:`,a.message||a),a}return null},clearCache:e=>{e?(console.log(`[Storage] Clearing cache for key: ${e}`),Eg.delete(e)):(console.log("[Storage] Clearing all cache"),Eg.clear())},getUser:async()=>{try{const e=await fetch("/api/auth/user",{headers:Tg(),credentials:"include"});return e.ok?await e.json():null}catch{return null}},setUser:async e=>{try{const t=await fetch("/api/auth/user",{method:"POST",headers:Tg({"Content-Type":"application/json"}),body:JSON.stringify(e),credentials:"include"});if(t.ok){const r=await t.json();r.sessionId&&localStorage.setItem("sessionId",r.sessionId)}}catch(t){console.error("Error saving user:",t)}},logout:async()=>{try{await fetch("/api/auth/logout",{method:"POST",headers:Tg(),credentials:"include"}),localStorage.removeItem("sessionId")}catch(e){console.error("Error logging out:",e)}},getProjects:()=>Bt.get("projects",[]),setProjects:e=>Bt.set("projects",e),getTasks:()=>Bt.get("tasks",[]),setTasks:e=>Bt.set("tasks",e),getClients:()=>Bt.get("clients",[]),setClients:e=>Bt.set("clients",e),getEngineers:()=>Bt.get("engineers",[]),setEngineers:e=>Bt.set("engineers",e),getExpenses:()=>Bt.get("expenses",[]),setExpenses:e=>Bt.set("expenses",e),getLeads:()=>Bt.get("leads",[]),setLeads:e=>Bt.set("leads",e)},Fse=[{id:"dashboard",name:"Dashboard",description:"Main Dashboard",actions:["view"]},{id:"crm",name:"CRM",description:"Customer Relationship Management",actions:["view","create","edit","delete","export"]},{id:"projects",name:"Projects",description:"Project Management",actions:["view","view_all","create","edit","delete","export"]},{id:"tasks",name:"Tasks",description:"Tasks & Timesheets",actions:["view","view_all","create","edit","delete","export"]},{id:"finance",name:"Finance",description:"Financial Management",actions:["view","create","edit","delete","export"]},{id:"hr",name:"HR",description:"Human Resources",actions:["view","create","edit","delete","export"]},{id:"operations",name:"Operations",description:"Operations Control",actions:["view","create","edit","delete","export"]},{id:"documents",name:"Documents",description:"Document Management",actions:["view","create","edit","delete","export"]},{id:"settings",name:"Settings",description:"System Settings",actions:["view","edit"]}],bz=N.createContext(void 0),Bse=({children:e})=>{const[t,r]=N.useState(null),[n,a]=N.useState(null),[s,o]=N.useState(!0),[l,u]=N.useState([{name:"Administrator",description:"Full system access and configuration",users:0},{name:"Manager",description:"Access to departmental reports and tasks",users:0},{name:"Employee",description:"Standard access to personal tasks and documents",users:0},{name:"Guest",description:"Limited read-only access to specific projects",users:0}]),[d,f]=N.useState([]),[m,g]=N.useState({Administrator:["dashboard.view","crm.view","crm.create","crm.edit","crm.delete","crm.export","projects.view","projects.view_all","projects.create","projects.edit","projects.delete","projects.export","tasks.view","tasks.view_all","tasks.create","tasks.edit","tasks.delete","tasks.export","finance.view","finance.create","finance.edit","finance.delete","finance.export","hr.view","hr.create","hr.edit","hr.delete","hr.export","operations.view","operations.create","operations.edit","operations.delete","operations.export","documents.view","documents.create","documents.edit","documents.delete","documents.export","settings.view","settings.edit"],Manager:["dashboard.view","crm.view","crm.create","crm.edit","projects.view","projects.view_all","projects.create","projects.edit","tasks.view","tasks.view_all","tasks.create","tasks.edit","hr.view","operations.view","documents.view","documents.create"],Employee:["dashboard.view","projects.view","tasks.view","documents.view"]}),x=N.useRef(0),y=N.useRef(!1),v=N.useRef(new Set),w=N.useCallback(async(I=!1,q)=>{if(y.current){v.current.add(q||"all");return}y.current=!0;try{const P=await fetch(`/api/health?t=${Date.now()}`,{credentials:"include"});if(P.ok){const R=await P.json();if(!I&&R.lastChange<=x.current)return;x.current=R.lastChange}if(q){const R=q.toLowerCase();if(console.log(`[AuthContext] Syncing targeted key: ${q}`),R==="rolepermissions"){const K=await Bt.get("rolePermissions",null);K&&g(ee=>K)}else if(R==="roles"){const K=await Bt.get("roles",null);K&&u(K)}else if(R==="users"){const K=await Bt.get("users",[]);f(K),r(ee=>{if(!ee)return null;const se=K.find(Z=>Z.uid===ee.uid||Z.id===ee.uid);if(se){const Z={uid:se.uid||se.id,name:se.name,email:se.email,role:se.role,tenantId:se.tenantId,createdAt:se.createdAt};if(JSON.stringify(Z)!==JSON.stringify(ee.profile)){console.log("[AuthContext] Updating current profile from master list");const ne={...ee,profile:Z};return a(Z),Bt.setUser(ne),ne}}return ee})}}else{console.log("[AuthContext] Syncing all auth data");const[R,K,ee,se]=await Promise.all([Bt.getUser(),Bt.get("rolePermissions",null),Bt.get("roles",null),Bt.get("users",[])]);R&&(r(R),a(R.profile)),se&&f(se),K&&g(K),ee&&u(ee)}}catch(P){console.error("[AuthContext] Initialization error:",P)}finally{if(o(!1),y.current=!1,v.current.size>0){const P=Array.from(v.current);v.current.clear();const R=P.includes("all")?void 0:P[P.length-1];console.log(`[AuthContext] Executing queued sync for: ${R||"all"}`),setTimeout(()=>w(!1,R),100)}}},[]);N.useEffect(()=>{w(!0)},[w]),N.useEffect(()=>{if(!t)return;console.log("[AuthContext] Initializing polling for auth updates...");const I=setInterval(()=>{w(!1)},1e4);return()=>{clearInterval(I)}},[t,w]);const j=N.useCallback(async I=>{g(I);const q=await Bt.set("rolePermissions",I);typeof q=="number"&&(x.current=q)},[]),k=N.useCallback(async I=>{u(I);const q=await Bt.set("roles",I);typeof q=="number"&&(x.current=q)},[]),A=N.useCallback(async I=>{f(I);const q=await Bt.set("users",I);typeof q=="number"&&(x.current=q)},[]),T=N.useCallback(async()=>{Bt.clearCache("users");const I=await Bt.get("users",[]);f(I)},[]),M=N.useCallback(I=>n?n.uid==="admin-123"?!0:(m[n.role]||[]).includes(I):!1,[n,m]),B=N.useCallback(async(I,q)=>{if(I.toLowerCase()==="admin"&&(q==="admin"||q==="AdminPassword123!")){const K={uid:"admin-123",name:"System Administrator",email:"admin@app.local",role:"Administrator",createdAt:new Date().toISOString()},ee={uid:"admin-123",email:"admin@app.local",profile:K,username:"admin"};r(ee),a(K),await Bt.setUser(ee);return}const R=(await Bt.get("users",[])).find(K=>(K.username===I||K.email===I)&&K.password===q);if(R){if(R.status==="Pending")throw new Error("Your account is pending activation. Please contact an administrator.");if(R.status==="Inactive")throw new Error("Your account has been deactivated.");const K={uid:R.uid,name:R.name,email:R.email,role:R.role,tenantId:R.tenantId,createdAt:R.createdAt},ee={uid:R.uid,email:R.email,profile:K,username:R.username};r(ee),a(K),await Bt.setUser(ee)}else throw new Error("Invalid username or password")},[]),L=N.useCallback(async()=>{r(null),a(null),await Bt.logout()},[]),F=N.useMemo(()=>({user:t,profile:n,loading:s,isAdmin:(n==null?void 0:n.role)==="Administrator",rolePermissions:m,roles:l,systemUsers:d,modules:Fse,login:B,logout:L,hasPermission:M,updateRolePermissions:j,updateRoles:k,updateSystemUsers:A,refreshUsers:T}),[t,n,s,m,l,d,B,L,M,j,k,A,T]);return i.jsx(bz.Provider,{value:F,children:e})},la=()=>{const e=N.useContext(bz);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e},wz=N.createContext(void 0),Vy={name:"MA IT TECH",email:"support@ma-it-tech.com",location:"Dubai, UAE",phone:"+971 4 123 4567",corporateTaxRate:25,vatTaxRate:20},zse=({children:e})=>{const{user:t,loading:r}=la(),[n,a]=N.useState([]),[s,o]=N.useState([]),[l,u]=N.useState([]),[d,f]=N.useState([]),[m,g]=N.useState([]),[x,y]=N.useState([]),[v,w]=N.useState([]),[j,k]=N.useState([]),[A,T]=N.useState([]),[M,B]=N.useState([]),[L,F]=N.useState([]),[I,q]=N.useState([]),[P,R]=N.useState(Vy),K=N.useRef(0),ee=N.useRef(!1),se=N.useRef(new Set),Z=N.useCallback(async(Ve=!1,te)=>{if(!r){if(ee.current){se.current.add(te||"all");return}if(!t){a([]),o([]),u([]),f([]),g([]),y([]),w([]),k([]),T([]),B([]),F([]),K.current=0;return}ee.current=!0;try{const Ue=await fetch(`/api/health?t=${Date.now()}`,{headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Accept:"application/json"},credentials:"include"});if(!Ue.ok)return;const ot=Ue.headers.get("content-type");if(!ot||!ot.includes("application/json"))return;const vt=await Ue.json();if(!Ve&&vt.lastChange<=K.current)return;if(te)switch(console.log(`[AppContext] Syncing targeted key: ${te}`),te.toLowerCase()){case"projects":a(await Bt.getProjects());break;case"tasks":o(await Bt.getTasks());break;case"expenses":u(await Bt.getExpenses());break;case"clients":f(await Bt.getClients());break;case"engineers":g(await Bt.getEngineers());break;case"departments":y(await Bt.get("departments",[]));break;case"jobs":w(await Bt.get("jobs",[]));break;case"candidates":k(await Bt.get("candidates",[]));break;case"documents":T(await Bt.get("documents",[]));break;case"folders":B(await Bt.get("folders",[]));break;case"companysettings":R(await Bt.get("companySettings",Vy));break;case"bankdetails":F(await Bt.get("bankDetails",[]));break;case"currencies":q(await Bt.get("currencies",[]));break;default:console.warn(`[AppContext] Unrecognized target key for sync: ${te}`)}else{console.log("[AppContext] Syncing all data with server...");const[_t,qt,Ft,Dt,Rt,wr,gr,Er,Ur,Ht,It,Rr,kr]=await Promise.all([Bt.getProjects(),Bt.getTasks(),Bt.getExpenses(),Bt.getClients(),Bt.getEngineers(),Bt.get("departments",[]),Bt.get("jobs",[]),Bt.get("candidates",[]),Bt.get("documents",[]),Bt.get("folders",[{id:"1",name:"Projects",color:"text-blue-500"},{id:"2",name:"Human Resources",color:"text-purple-500"},{id:"3",name:"Finance",color:"text-green-500"},{id:"4",name:"Legal",color:"text-red-500"}]),Bt.get("companySettings",Vy),Bt.get("bankDetails",[]),Bt.get("currencies",[{code:"USD",symbol:"$"},{code:"EUR",symbol:"€"},{code:"GBP",symbol:"£"},{code:"CAD",symbol:"C$"}])]);console.log("[AppContext] All data synced"),a(_t||[]),o(qt||[]),u(Ft||[]),f(Dt||[]),g(Rt||[]),y(wr||[]),w(gr||[]),k(Er||[]),T(Ur||[]),B(Ht||[]),R(qr=>{const Xr={...Vy,...It};return JSON.stringify(qr)===JSON.stringify(Xr)?qr:Xr}),F(Rr||[]),q(kr||[])}K.current=vt.lastChange||Date.now()}catch(Ue){console.error("[AppContext] Failed to sync data:",Ue)}finally{if(ee.current=!1,se.current.size>0){const Ue=Array.from(se.current);se.current.clear();const ot=Ue.includes("all")?void 0:Ue[Ue.length-1];console.log(`[AppContext] Executing queued sync for: ${ot||"all"}`),setTimeout(()=>Z(!1,ot),100)}}}},[r,t==null?void 0:t.uid]),ne=async Ve=>{if(ee.current)throw console.warn("[AppContext] Sync already in progress, blocking action"),new Error("SYSTEM_BUSY");ee.current=!0;try{const te=await Ve();return K.current=typeof te=="number"?te:Date.now(),te}catch(te){console.error("[AppContext] Error during data operation:",te);let Ue="An error occurred while saving your changes.";throw te.message==="SYSTEM_BUSY"?Ue="System is busy. Please wait a moment.":te.message==="SERVER_TIMEOUT"?Ue="Server timed out. Please check your connection.":te.message&&(Ue=te.message),De.error(Ue,{duration:5e3}),te}finally{setTimeout(()=>{ee.current=!1},300)}};N.useEffect(()=>{Z(!0)},[Z]),N.useEffect(()=>{if(!t)return;console.log("[AppContext] Initializing polling for data updates...");const Ve=setInterval(()=>{Z(!1)},1e4);return()=>{clearInterval(Ve)}},[t,Z]);const X=N.useCallback(async Ve=>{await ne(async()=>{const te=[...n,Ve];a(te);const Ue=await Bt.setProjects(te),vt={id:`TSK-${Ve.id.replace("PRJ","")||Math.random().toString(36).substr(2,5).toUpperCase()}`,title:`${Ve.name} Main Task`,project:Ve.name,projectId:Ve.id,assignDate:new Date().toISOString().split("T")[0],status:Ve.status==="Completed"||Ve.status==="Accepted"||Ve.status==="Rejected"?"Completed":Ve.status==="In Progress"||Ve.status==="Work In Progress"||Ve.status==="Active"?"In Progress":"To Do",dueDate:Ve.deadline,assignee:Ve.assignedTo||"Unassigned"};Ve.completedDate&&(vt.completedDate=Ve.completedDate);const _t=[...s,vt];return o(_t),await Bt.setTasks(_t),Ue})},[n,s]),le=N.useCallback(async(Ve,te)=>{await ne(async()=>{const Ue=n.map(vt=>vt.id===Ve?{...vt,...te}:vt);a(Ue);const ot=await Bt.setProjects(Ue);if(te.name||te.status||te.completedDate){const vt=s.map(_t=>{if(_t.projectId===Ve){let qt={};if(te.name&&(qt.project=te.name),te.completedDate&&(qt.completedDate=te.completedDate),te.status){const Ft=Dt=>{switch(Dt){case"Work In Progress":case"Active":case"In Progress":return"In Progress";case"Completed":case"Accepted":case"Rejected":return"Completed";default:return"To Do"}};qt.status=Ft(te.status),qt.status==="Completed"&&!qt.completedDate&&(qt.completedDate=te.completedDate||new Date().toISOString().split("T")[0])}return{..._t,...qt}}return _t});o(vt),await Bt.setTasks(vt)}return ot})},[n,s]),Ae=N.useCallback(async Ve=>{await ne(async()=>{const te=n.filter(vt=>vt.id!==Ve);a(te);const Ue=await Bt.setProjects(te),ot=s.filter(vt=>vt.projectId!==Ve);return o(ot),await Bt.setTasks(ot),Ue})},[n,s]),ce=N.useCallback(async Ve=>{await ne(async()=>{const te=[...s,Ve];return o(te),await Bt.setTasks(te)})},[s]),D=N.useCallback(async(Ve,te)=>{await ne(async()=>{const Ue=s.map(ot=>ot.id===Ve?{...ot,...te}:ot);return o(Ue),await Bt.setTasks(Ue)})},[s]),H=N.useCallback(async Ve=>{await ne(async()=>{const te=s.filter(Ue=>Ue.id!==Ve);return o(te),await Bt.setTasks(te)})},[s]),G=N.useCallback(async Ve=>{await ne(async()=>{const te=[...l,Ve];return u(te),await Bt.setExpenses(te)})},[l]),E=N.useCallback(async(Ve,te)=>{await ne(async()=>{const Ue=l.map(ot=>ot.id===Ve?{...ot,...te}:ot);return u(Ue),await Bt.setExpenses(Ue)})},[l]),re=N.useCallback(async Ve=>{await ne(async()=>{const te=l.filter(Ue=>Ue.id!==Ve);return u(te),await Bt.setExpenses(te)})},[l]),he=N.useCallback(async Ve=>{await ne(async()=>{const te=[...d,Ve];return f(te),await Bt.setClients(te)})},[d]),oe=N.useCallback(async(Ve,te)=>{await ne(async()=>{const Ue=d.map(ot=>ot.id===Ve?{...ot,...te}:ot);return f(Ue),await Bt.setClients(Ue)})},[d]),z=N.useCallback(async Ve=>{await ne(async()=>{const te=d.filter(Ue=>Ue.id!==Ve);return f(te),await Bt.setClients(te)})},[d]),fe=N.useCallback(async Ve=>{await ne(async()=>{const te=[...m,Ve];return g(te),await Bt.setEngineers(te)})},[m]),de=N.useCallback(async(Ve,te)=>{await ne(async()=>{const Ue=m.map(ot=>ot.id===Ve?{...ot,...te}:ot);return g(Ue),await Bt.setEngineers(Ue)})},[m]),W=N.useCallback(async Ve=>{await ne(async()=>{const te=m.filter(Ue=>Ue.id!==Ve);return g(te),await Bt.setEngineers(te)})},[m]),ae=N.useCallback(async Ve=>{await ne(async()=>{const te=[...x,Ve];return y(te),await Bt.set("departments",te)})},[x]),_e=N.useCallback(async(Ve,te)=>{await ne(async()=>{const Ue=x.map(ot=>ot.id===Ve?{...ot,...te}:ot);return y(Ue),await Bt.set("departments",Ue)})},[x]),ue=N.useCallback(async Ve=>{await ne(async()=>{const te=x.filter(Ue=>Ue.id!==Ve);return y(te),await Bt.set("departments",te)})},[x]),ke=N.useCallback(async Ve=>{await ne(async()=>{const te=[...v,Ve];return w(te),await Bt.set("jobs",te)})},[v]),$e=N.useCallback(async(Ve,te)=>{await ne(async()=>{const Ue=v.map(ot=>ot.id===Ve?{...ot,...te}:ot);return w(Ue),await Bt.set("jobs",Ue)})},[v]),Je=N.useCallback(async Ve=>{await ne(async()=>{const te=v.filter(Ue=>Ue.id!==Ve);return w(te),await Bt.set("jobs",te)})},[v]),Xe=N.useCallback(async Ve=>{await ne(async()=>{const te=[...j,Ve];return k(te),await Bt.set("candidates",te)})},[j]),Ne=N.useCallback(async(Ve,te)=>{await ne(async()=>{const Ue=j.map(ot=>ot.id===Ve?{...ot,...te}:ot);return k(Ue),await Bt.set("candidates",Ue)})},[j]),Ye=N.useCallback(async Ve=>{await ne(async()=>{const te=j.filter(Ue=>Ue.id!==Ve);return k(te),await Bt.set("candidates",te)})},[j]),at=N.useCallback(async Ve=>{await ne(async()=>{const te=[...A,Ve];return T(te),await Bt.set("documents",te)})},[A]),Y=N.useCallback(async(Ve,te)=>{await ne(async()=>{const Ue=A.map(ot=>ot.id===Ve?{...ot,...te}:ot);return T(Ue),await Bt.set("documents",Ue)})},[A]),we=N.useCallback(async Ve=>{await ne(async()=>{const te=A.filter(Ue=>Ue.id!==Ve);return T(te),await Bt.set("documents",te)})},[A]),J=N.useCallback(async Ve=>{await ne(async()=>{const te=[...M,Ve];return B(te),await Bt.set("folders",te)})},[M]),ve=N.useCallback(async Ve=>{await ne(async()=>{const te=M.filter(vt=>vt.id!==Ve);B(te);let Ue=await Bt.set("folders",te);const ot=M.find(vt=>vt.id===Ve);if(ot){const vt=A.map(_t=>_t.folder===ot.name?{..._t,folder:void 0}:_t);T(vt),Ue=await Bt.set("documents",vt)}return Ue})},[M,A]),Oe=N.useCallback(async Ve=>{await ne(async()=>{const te=[...L,Ve];return F(te),await Bt.set("bankDetails",te)})},[L]),xe=N.useCallback(async(Ve,te)=>{await ne(async()=>{const Ue=L.map(ot=>ot.id===Ve?{...ot,...te}:ot);return F(Ue),await Bt.set("bankDetails",Ue)})},[L]),qe=N.useCallback(async Ve=>{await ne(async()=>{const te=L.filter(Ue=>Ue.id!==Ve);return F(te),await Bt.set("bankDetails",te)})},[L]),me=N.useCallback(async(Ve,te)=>{await ne(async()=>{const Ue=[...I,{code:Ve,symbol:te}];return q(Ue),await Bt.set("currencies",Ue)})},[I]),Ge=N.useCallback(async Ve=>{await ne(async()=>{const te=I.filter(Ue=>Ue.code!==Ve);return q(te),await Bt.set("currencies",te)})},[I]),Be=N.useCallback(async Ve=>{await ne(async()=>{const te={...P,...Ve};return R(te),await Bt.set("companySettings",te)})},[P]),it=N.useCallback(async()=>{const Ve=new Map;n.forEach(vt=>{if(vt.assignedTo){const _t=vt.assignedTo.toLowerCase().trim();if(!Ve.has(_t)){const qt=vt.assignedRole||"Engineer",Ft=qt.toLowerCase(),Dt=Ft.includes("external")?"External":Ft.includes("internal")?"Internal":"External";Ve.set(_t,{name:vt.assignedTo,role:qt,email:vt.assignedEmail||vt.email||`${vt.assignedTo.toLowerCase().replace(/\s+/g,".")}@company.com`,phone:vt.assignedContactNumber||vt.contactNumber||"N/A",status:vt.status==="Completed"?"Available":"Active",type:Dt,experience:"Synced from Project",department:"Technical"})}}});let te=0;const Ue=[...m],ot=[...m];for(const[vt,_t]of Ve.entries())if(!Ue.find(Ft=>Ft.name.toLowerCase().trim()===vt)){const Ft=`ENG-SYNC-${Math.random().toString(36).substr(2,5).toUpperCase()}`;ot.push({..._t,id:Ft}),te++}return te>0&&(g(ot),await Bt.setEngineers(ot)),te},[n,m]),st=N.useMemo(()=>({projects:n,tasks:s,expenses:l,clients:d,engineers:m,departments:x,jobs:v,candidates:j,documents:A,folders:M,bankDetails:L,currencies:I,companySettings:P,addProject:X,updateProject:le,deleteProject:Ae,addTask:ce,updateTask:D,deleteTask:H,addExpense:G,updateExpense:E,deleteExpense:re,addClient:he,updateClient:oe,deleteClient:z,addEngineer:fe,updateEngineer:de,deleteEngineer:W,addDepartment:ae,updateDepartment:_e,deleteDepartment:ue,addJob:ke,updateJob:$e,deleteJob:Je,addCandidate:Xe,updateCandidate:Ne,deleteCandidate:Ye,addDocument:at,updateDocument:Y,deleteDocument:we,addFolder:J,deleteFolder:ve,addBankDetail:Oe,updateBankDetail:xe,deleteBankDetail:qe,addCurrency:me,deleteCurrency:Ge,updateCompanySettings:Be,syncEngineersFromProjects:it}),[n,s,l,d,m,x,v,j,A,M,L,I,P,X,le,Ae,ce,D,H,G,E,re,he,oe,z,fe,de,W,ae,_e,ue,ke,$e,Je,Xe,Ne,Ye,at,Y,we,J,ve,Oe,xe,qe,me,Ge,Be,it]);return i.jsx(wz.Provider,{value:st,children:e})},ca=()=>{const e=N.useContext(wz);if(e===void 0)throw new Error("useApp must be used within an AppProvider");return e};function Use({isCollapsed:e,setIsCollapsed:t}){const r=Ic(),n=mo(),{profile:a,logout:s,hasPermission:o}=la(),{companySettings:l}=ca(),u=async()=>{try{s(),De.success("Logged out successfully"),n("/login")}catch(d){De.error("Failed to log out"),console.error(d)}};return i.jsxs("aside",{className:tt("fixed left-0 top-0 z-40 h-screen border-r border-border bg-card transition-all duration-300 ease-in-out flex flex-col",e?"w-16":"w-64"),children:[i.jsxs("div",{className:"flex h-16 items-center gap-3 px-3 border-b border-border shrink-0",children:[i.jsx("div",{className:"h-9 w-9 rounded-xl bg-primary flex items-center justify-center overflow-hidden shadow-sm ring-1 ring-primary/10 shrink-0",children:l.logo?i.jsx("img",{src:l.logo,alt:"Logo",className:"h-full w-full object-contain",referrerPolicy:"no-referrer"}):i.jsx("span",{className:"text-primary-foreground font-bold text-lg",children:wQ(l.name)||"M"})}),i.jsx(on,{mode:"wait",children:!e&&i.jsxs(ar.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},className:"flex flex-1 items-center justify-between min-w-0",children:[i.jsx("span",{className:"text-lg font-bold tracking-tight text-primary truncate mr-2",children:l.name}),i.jsx("button",{onClick:()=>t(!e),className:"rounded-md p-1.5 hover:bg-accent hover:text-accent-foreground transition-colors shrink-0",children:i.jsx(qQ,{size:18})})]})}),e&&i.jsx("button",{onClick:()=>t(!e),className:"rounded-md p-1.5 hover:bg-accent hover:text-accent-foreground transition-colors mx-auto",children:i.jsx(Io,{size:18})})]}),i.jsx("nav",{className:"flex-1 overflow-y-auto py-4 scrollbar-thin scrollbar-thumb-border",children:j3.map((d,f)=>{const m=d.items.filter(g=>!g.permission||o(g.permission));return m.length===0?null:i.jsxs("div",{className:tt("mb-6",f===0&&"mt-0"),children:[!e&&i.jsx("h3",{className:"px-6 mb-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70",children:d.label}),i.jsx("div",{className:"px-3 space-y-1",children:m.map(g=>{const x=r.pathname===g.href;return i.jsxs(tx,{to:g.href,className:tt("flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-all group relative",x?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-accent hover:text-accent-foreground",e&&"justify-center px-2"),title:e?g.title:void 0,children:[i.jsx(g.icon,{size:20,className:tt("shrink-0 transition-colors",x?"text-primary":"group-hover:text-accent-foreground")}),!e&&i.jsx("span",{className:"truncate",children:g.title}),x&&!e&&i.jsx(ar.div,{layoutId:"active-nav-indicator",className:"absolute left-0 w-1 h-6 bg-primary rounded-r-full"})]},g.href)})}),f<j3.length-1&&!e&&i.jsx("div",{className:"mx-6 mt-4 border-t border-border/50"})]},d.label)})}),i.jsx("div",{className:"shrink-0 border-t border-border p-4 bg-card/50 backdrop-blur-sm",children:i.jsxs("div",{className:tt("flex items-center gap-3",e?"justify-center":"justify-between"),children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-9 w-9 rounded-full bg-accent flex items-center justify-center border border-border overflow-hidden",children:a!=null&&a.photoURL?i.jsx("img",{src:a.photoURL,alt:a.name,className:"h-full w-full object-cover",referrerPolicy:"no-referrer"}):i.jsx(ls,{size:18,className:"text-muted-foreground"})}),!e&&i.jsxs("div",{className:"flex flex-col min-w-0",children:[i.jsx("span",{className:"text-sm font-semibold truncate",children:(a==null?void 0:a.name)||"User"}),i.jsx("span",{className:"text-[10px] text-muted-foreground truncate",children:(a==null?void 0:a.role)||"Member"})]})]}),!e&&i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(tx,{to:"/settings",className:"p-1.5 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"System Settings",children:i.jsx(_k,{size:18})}),i.jsx("button",{onClick:u,className:"p-1.5 rounded-md hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",title:"Logout",children:i.jsx(T9,{size:18})})]})]})})]})}function $se({onOpenQuickCreate:e}){var ne;const{profile:t,logout:r,isAdmin:n,rolePermissions:a,hasPermission:s}=la(),{companySettings:o,projects:l,tasks:u,expenses:d,candidates:f}=ca(),[m,g]=Mt.useState(!1),[x,y]=Mt.useState(!1),[v,w]=Mt.useState(!1),[j,k]=Mt.useState(!1),[A,T]=Mt.useState("English"),[M,B]=Mt.useState(()=>{const X=localStorage.getItem("read_notifications");return X?JSON.parse(X):[]}),L=mo();n||t&&(a[t.role]||[]).length>0;const F=!!t,I=Mt.useMemo(()=>{const X=[],le=new Date;le.setHours(0,0,0,0),u.forEach(ce=>{new Date(ce.dueDate)<le&&ce.status!=="Completed"&&X.push({id:`task-overdue-${ce.id}`,title:"Task Overdue",description:`Task "${ce.title}" was due on ${ce.dueDate}`,time:"Overdue",type:"task",link:"/tasks"})});const Ae=new Date;return Ae.setDate(Ae.getDate()-7),l.forEach(ce=>{const D=ce.issueDate?new Date(ce.issueDate):null;D&&D>=Ae&&X.push({id:`project-new-${ce.id}`,title:"New Project",description:`New project "${ce.name}" has been created.`,time:ce.issueDate,type:"project",link:"/projects"})}),d.filter(ce=>ce.status==="Pending").forEach(ce=>{X.push({id:`expense-pending-${ce.id}`,title:"Pending Expense",description:`Expense "${ce.description}" requires approval.`,time:ce.date,type:"finance",link:"/expenses"})}),f.forEach(ce=>{new Date(ce.appliedDate)>=Ae&&X.push({id:`candidate-new-${ce.id}`,title:"New Candidate",description:`${ce.name} applied for ${ce.role}`,time:ce.appliedDate,type:"crm",link:"/recruitment"})}),X.sort((ce,D)=>ce.time==="Overdue"?-1:D.time==="Overdue"?1:new Date(D.time).getTime()-new Date(ce.time).getTime()).map(ce=>({...ce,read:M.includes(ce.id)}))},[u,l,d,f,M]),q=I.filter(X=>!X.read).length,P=X=>{if(!M.includes(X)){const le=[...M,X];B(le),localStorage.setItem("read_notifications",JSON.stringify(le))}},R=()=>{const X=I.map(le=>le.id);B(X),localStorage.setItem("read_notifications",JSON.stringify(X)),k(!1),De.success("All notifications marked as read")},K=[{name:"English",code:"EN",flag:"🇺🇸"},{name:"Spanish",code:"ES",flag:"🇪🇸"},{name:"French",code:"FR",flag:"🇫🇷"},{name:"German",code:"DE",flag:"🇩🇪"},{name:"Arabic",code:"AR",flag:"🇦🇪"}],ee=X=>{T(X),w(!1),De.success(`Language changed to ${X}`)},se=async()=>{try{r(),De.success("Logged out successfully"),L("/login")}catch(X){De.error("Failed to log out"),console.error(X)}},Z=()=>{const X=!m;g(X),X?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),De.success(`${X?"Dark":"Light"} mode enabled`)};return i.jsxs("header",{className:"sticky top-0 z-30 flex h-16 w-full items-center justify-between border-b border-border bg-card/80 px-4 backdrop-blur-md",children:[i.jsx("div",{className:"flex-1 hidden md:flex"}),i.jsx("div",{className:"flex-[2] flex items-center justify-center gap-4 overflow-hidden",children:F&&i.jsxs("div",{className:"flex items-center gap-4 w-full max-w-2xl justify-center",children:[i.jsxs("button",{onClick:e,className:"flex h-10 items-center gap-2 rounded-full bg-primary px-5 text-sm font-bold text-primary-foreground transition-all hover:bg-primary/90 active:scale-95 shrink-0 shadow-md shadow-primary/20",children:[i.jsx($n,{size:18}),i.jsx("span",{className:"hidden lg:inline uppercase tracking-widest text-[10px]",children:"Quick Create"})]}),i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(fs,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search anything...",className:"h-10 w-full rounded-full border border-border bg-background/50 pl-11 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all",onKeyDown:X=>X.key==="Enter"&&De.info(`Searching for: ${X.currentTarget.value}`)})]})]})}),i.jsxs("div",{className:"flex-1 flex items-center justify-end gap-2",children:[i.jsx("div",{className:"h-6 w-px bg-border mx-2"}),i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>w(!v),className:tt("rounded-full p-2 hover:bg-accent text-muted-foreground transition-all flex items-center gap-1.5",v&&"bg-accent text-primary"),children:[i.jsx(Km,{size:20}),i.jsx("span",{className:"text-[10px] font-bold uppercase",children:(ne=K.find(X=>X.name===A))==null?void 0:ne.code})]}),i.jsx(on,{children:v&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>w(!1)}),i.jsxs(ar.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},className:"absolute right-0 mt-2 w-48 origin-top-right rounded-xl border border-border bg-card p-2 shadow-xl z-20",children:[i.jsx("div",{className:"px-3 py-2 mb-1 border-b border-border",children:i.jsx("p",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Select Language"})}),K.map(X=>i.jsxs("button",{onClick:()=>ee(X.name),className:tt("flex w-full items-center justify-between rounded-lg px-3 py-2 text-sm font-medium transition-all hover:bg-accent",A===X.name?"text-primary bg-primary/5":"text-muted-foreground"),children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{children:X.flag}),i.jsx("span",{children:X.name})]}),A===X.name&&i.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-primary"})]},X.code))]})]})})]}),i.jsx("button",{onClick:Z,className:"rounded-full p-2 hover:bg-accent text-muted-foreground transition-colors",children:m?i.jsx(pte,{size:20}):i.jsx(Hee,{size:20})}),F&&i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>k(!j),className:tt("relative rounded-full p-2 hover:bg-accent text-muted-foreground transition-all",j&&"bg-accent text-primary"),children:[i.jsx(c2,{size:20}),q>0&&i.jsx("span",{className:"absolute right-2 top-2 h-2 w-2 rounded-full bg-destructive border-2 border-card"})]}),i.jsx(on,{children:j&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>k(!1)}),i.jsxs(ar.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},className:"absolute right-0 mt-2 w-80 origin-top-right rounded-xl border border-border bg-card p-2 shadow-xl z-20",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 mb-1 border-b border-border",children:[i.jsx("p",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Notifications"}),I.length>0&&i.jsx("button",{onClick:R,className:"text-[10px] font-bold uppercase text-primary hover:underline",children:"Mark all as read"})]}),i.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:I.length>0?I.map(X=>i.jsxs("button",{onClick:()=>{P(X.id),L(X.link),k(!1),De.info(`Viewing: ${X.title}`)},className:tt("flex w-full items-start gap-3 rounded-lg px-3 py-3 text-left transition-all hover:bg-accent",!X.read&&"bg-primary/5"),children:[i.jsx("div",{className:tt("mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-full",X.type==="project"?"bg-blue-500/10 text-blue-500":X.type==="task"?"bg-purple-500/10 text-purple-500":X.type==="finance"?"bg-green-500/10 text-green-500":X.type==="crm"?"bg-orange-500/10 text-orange-500":"bg-slate-500/10 text-slate-500"),children:X.type==="project"?i.jsx(Ni,{size:14}):X.type==="task"?i.jsx(Ec,{size:14}):X.type==="finance"?i.jsx(ds,{size:14}):X.type==="crm"?i.jsx(Hn,{size:14}):i.jsx(Fte,{size:14})}),i.jsxs("div",{className:"flex flex-col min-w-0",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:tt("text-xs font-bold truncate",X.read?"text-muted-foreground":"text-foreground"),children:X.title}),i.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap",children:X.time})]}),i.jsx("p",{className:"text-[10px] text-muted-foreground line-clamp-2 mt-0.5",children:X.description})]}),!X.read&&i.jsx("div",{className:"mt-2 h-1.5 w-1.5 shrink-0 rounded-full bg-primary"})]},X.id)):i.jsxs("div",{className:"py-8 text-center",children:[i.jsx(c2,{size:24,className:"mx-auto text-muted-foreground/30 mb-2"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"No new notifications"})]})}),I.length>0&&i.jsx("div",{className:"mt-1 border-t border-border pt-1",children:i.jsx("button",{onClick:()=>{L("/"),k(!1),De.info("Viewing all recent activity on Dashboard")},className:"flex w-full items-center justify-center py-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground hover:text-primary transition-colors",children:"View All Activity"})})]})]})})]}),i.jsx("div",{className:"h-6 w-px bg-border mx-2"}),i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>y(!x),className:"flex items-center gap-2 rounded-full p-1 pl-2 hover:bg-accent transition-colors",children:[i.jsxs("div",{className:"hidden text-right sm:block",children:[i.jsx("p",{className:"text-sm font-semibold leading-none",children:(t==null?void 0:t.name)||"User"}),i.jsx("p",{className:"text-[10px] text-muted-foreground font-medium uppercase tracking-wider",children:(t==null?void 0:t.role)||"Member"})]}),t!=null&&t.photoURL?i.jsx("img",{src:t.photoURL,alt:t.name,className:"h-8 w-8 rounded-full object-cover",referrerPolicy:"no-referrer"}):i.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(ls,{size:20})})]}),i.jsx(on,{children:x&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>y(!1)}),i.jsxs(ar.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},className:"absolute right-0 mt-2 w-56 origin-top-right rounded-xl border border-border bg-card p-2 shadow-xl z-20",children:[i.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-border",children:[i.jsx("p",{className:"text-sm font-bold",children:(t==null?void 0:t.name)||"User"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:(t==null?void 0:t.email)||""})]}),i.jsxs("button",{onClick:()=>{L("/profile"),y(!1)},className:"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all",children:[i.jsx(ls,{size:18}),"Profile Settings"]}),s("settings.view")&&i.jsxs("button",{onClick:()=>{L("/settings"),y(!1)},className:"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all",children:[i.jsx(_k,{size:18}),"System Settings"]}),s("dashboard.view")&&i.jsxs("button",{onClick:()=>{De.info("Opening activity logs..."),y(!1)},className:"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all",children:[i.jsx(Ck,{size:18}),"Activity Logs"]}),i.jsx("div",{className:"my-1 border-t border-border"}),i.jsxs("button",{onClick:()=>{se(),y(!1)},className:"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-destructive hover:bg-destructive/10 transition-all",children:[i.jsx(T9,{size:18}),"Logout"]})]})]})})]})]})]})}function Hse({children:e}){const[t,r]=N.useState(!1),[n,a]=N.useState(!1),{profile:s,rolePermissions:o,isAdmin:l,hasPermission:u}=la(),{companySettings:d}=ca(),f=mo(),m=y=>{const w={Employee:"/employees",Candidate:"/recruitment",Engineer:"/engineers",Project:"/projects",Task:"/tasks",Lead:"/crm",Invoice:"/finance",Expense:"/expenses"}[y];w?(f(`${w}?create=true`),a(!1)):(De.success(`Opening ${y} form...`),a(!1))},g=l||s&&(o[s.role]||[]).length>0,x=!!s;return i.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[x&&i.jsx(Use,{isCollapsed:t,setIsCollapsed:r}),i.jsxs("div",{className:tt("transition-all duration-300 ease-in-out",x?t?"pl-16":"pl-64":"pl-0"),children:[i.jsx($se,{onOpenQuickCreate:()=>a(!0)}),i.jsx("main",{className:"p-6",children:g?e:i.jsxs("div",{className:"flex h-[70vh] flex-col items-center justify-center text-center px-4",children:[i.jsx("div",{className:"mb-6 rounded-full bg-primary/10 p-6 text-primary",children:i.jsx(ste,{size:48})}),i.jsxs("h1",{className:"text-3xl font-bold tracking-tight mb-2",children:["Welcome to ",d.name]}),i.jsxs("div",{className:"max-w-md space-y-4",children:[i.jsxs("div",{className:"text-lg text-muted-foreground",children:[i.jsx("p",{children:"You currently do not have permission to access this system."}),i.jsx("p",{children:"Please contact the Management Team for access."})]}),i.jsx("div",{className:"pt-4",children:i.jsxs("p",{className:"text-[10px] text-muted-foreground/60 uppercase tracking-widest font-bold",children:["Please contact ",i.jsx("span",{className:"text-primary/80",children:d.email||"support@maittech.com"})]})})]})]})})]}),i.jsx(on,{children:n&&i.jsxs(i.Fragment,{children:[i.jsx(ar.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>a(!1),className:"fixed inset-0 z-[100] bg-background/80 backdrop-blur-sm"}),i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"fixed left-1/2 top-1/2 z-[101] w-[95vw] max-w-2xl -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-border bg-card p-8 shadow-2xl overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Quick Create"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Select an action to quickly add a new record to the system."})]}),i.jsx("button",{onClick:()=>a(!1),className:"rounded-full p-2 hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",children:i.jsx(xr,{size:24})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Operations"}),i.jsx(Jf,{icon:Hn,label:"Employee",description:"Add new staff member",onClick:()=>m("Employee")}),i.jsx(Jf,{icon:Oh,label:"Candidate",description:"Add to recruitment",onClick:()=>m("Candidate")}),i.jsx(Jf,{icon:Vw,label:"Engineer",description:"Register specialist",onClick:()=>m("Engineer")})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Execution"}),i.jsx(Jf,{icon:Ni,label:"Project",description:"Launch new initiative",onClick:()=>m("Project")}),i.jsx(Jf,{icon:Ec,label:"Task",description:"Assign new work item",onClick:()=>m("Task")}),i.jsx(Jf,{icon:Fo,label:"Lead",description:"New sales opportunity",onClick:()=>m("Lead")})]}),i.jsxs("div",{className:"space-y-3 col-span-2 mt-2",children:[i.jsx("p",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Financials"}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(Jf,{icon:xee,label:"Invoice",description:"Generate billing",onClick:()=>m("Invoice")}),i.jsx(Jf,{icon:bte,label:"Expense",description:"Log new cost",onClick:()=>m("Expense")})]})]})]})]})]})})]})}function Jf({icon:e,label:t,description:r,onClick:n}){return i.jsxs("button",{onClick:n,className:"flex items-center gap-4 w-full rounded-xl border border-border bg-background p-3 text-left transition-all hover:border-primary hover:bg-primary/5 hover:shadow-md group",children:[i.jsx("div",{className:"rounded-lg bg-accent p-2.5 group-hover:bg-primary/10 group-hover:text-primary transition-colors shrink-0",children:i.jsx(e,{size:20})}),i.jsxs("div",{className:"flex flex-col min-w-0",children:[i.jsx("span",{className:"text-sm font-bold group-hover:text-primary transition-colors",children:t}),i.jsx("span",{className:"text-[10px] text-muted-foreground truncate",children:r})]})]})}var Vse=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function aC(e){if(typeof e!="string")return!1;var t=Vse;return t.includes(e)}var qse=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],Wse=new Set(qse);function jz(e){return typeof e!="string"?!1:Wse.has(e)}function Nz(e){return typeof e=="string"&&e.startsWith("data-")}function fo(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(jz(r)||Nz(r))&&(t[r]=e[r]);return t}function Xm(e){if(e==null)return null;if(N.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return fo(t)}return typeof e=="object"&&!Array.isArray(e)?fo(e):null}function Gs(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(jz(r)||Nz(r)||aC(r))&&(t[r]=e[r]);return t}function Gse(e){return e==null?null:N.isValidElement(e)?Gs(e.props):typeof e=="object"&&!Array.isArray(e)?Gs(e):null}var Yse=["children","width","height","viewBox","className","style","title","desc"];function G3(){return G3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},G3.apply(null,arguments)}function Kse(e,t){if(e==null)return{};var r,n,a=Xse(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Xse(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var iC=N.forwardRef((e,t)=>{var{children:r,width:n,height:a,viewBox:s,className:o,style:l,title:u,desc:d}=e,f=Kse(e,Yse),m=s||{width:n,height:a,x:0,y:0},g=mn("recharts-surface",o);return N.createElement("svg",G3({},Gs(f),{className:g,width:n,height:a,style:l,viewBox:"".concat(m.x," ").concat(m.y," ").concat(m.width," ").concat(m.height),ref:t}),N.createElement("title",null,u),N.createElement("desc",null,d),r)}),Zse=["children","className"];function Y3(){return Y3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Y3.apply(null,arguments)}function Jse(e,t){if(e==null)return{};var r,n,a=Qse(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Qse(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Ba=N.forwardRef((e,t)=>{var{children:r,className:n}=e,a=Jse(e,Zse),s=mn("recharts-layer",n);return N.createElement("g",Y3({className:s},Gs(a),{ref:t}),r)}),Sz=N.createContext(null),eoe=()=>N.useContext(Sz);function oa(e){return function(){return e}}const Az=Math.cos,N2=Math.sin,Fc=Math.sqrt,S2=Math.PI,Xw=2*S2,K3=Math.PI,X3=2*K3,Nm=1e-6,toe=X3-Nm;function kz(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function roe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return kz;const r=10**t;return function(n){this._+=n[0];for(let a=1,s=n.length;a<s;++a)this._+=Math.round(arguments[a]*r)/r+n[a]}}class noe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?kz:roe(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,a){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+a}`}bezierCurveTo(t,r,n,a,s,o){this._append`C${+t},${+r},${+n},${+a},${this._x1=+s},${this._y1=+o}`}arcTo(t,r,n,a,s){if(t=+t,r=+r,n=+n,a=+a,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,l=this._y1,u=n-t,d=a-r,f=o-t,m=l-r,g=f*f+m*m;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(g>Nm)if(!(Math.abs(m*u-d*f)>Nm)||!s)this._append`L${this._x1=t},${this._y1=r}`;else{let x=n-o,y=a-l,v=u*u+d*d,w=x*x+y*y,j=Math.sqrt(v),k=Math.sqrt(g),A=s*Math.tan((K3-Math.acos((v+g-w)/(2*j*k)))/2),T=A/k,M=A/j;Math.abs(T-1)>Nm&&this._append`L${t+T*f},${r+T*m}`,this._append`A${s},${s},0,0,${+(m*x>f*y)},${this._x1=t+M*u},${this._y1=r+M*d}`}}arc(t,r,n,a,s,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(a),u=n*Math.sin(a),d=t+l,f=r+u,m=1^o,g=o?a-s:s-a;this._x1===null?this._append`M${d},${f}`:(Math.abs(this._x1-d)>Nm||Math.abs(this._y1-f)>Nm)&&this._append`L${d},${f}`,n&&(g<0&&(g=g%X3+X3),g>toe?this._append`A${n},${n},0,1,${m},${t-l},${r-u}A${n},${n},0,1,${m},${this._x1=d},${this._y1=f}`:g>Nm&&this._append`A${n},${n},0,${+(g>=K3)},${m},${this._x1=t+n*Math.cos(s)},${this._y1=r+n*Math.sin(s)}`)}rect(t,r,n,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}}function sC(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new noe(t)}function oC(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Cz(e){this._context=e}Cz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Zw(e){return new Cz(e)}function _z(e){return e[0]}function Ez(e){return e[1]}function Tz(e,t){var r=oa(!0),n=null,a=Zw,s=null,o=sC(l);e=typeof e=="function"?e:e===void 0?_z:oa(e),t=typeof t=="function"?t:t===void 0?Ez:oa(t);function l(u){var d,f=(u=oC(u)).length,m,g=!1,x;for(n==null&&(s=a(x=o())),d=0;d<=f;++d)!(d<f&&r(m=u[d],d,u))===g&&((g=!g)?s.lineStart():s.lineEnd()),g&&s.point(+e(m,d,u),+t(m,d,u));if(x)return s=null,x+""||null}return l.x=function(u){return arguments.length?(e=typeof u=="function"?u:oa(+u),l):e},l.y=function(u){return arguments.length?(t=typeof u=="function"?u:oa(+u),l):t},l.defined=function(u){return arguments.length?(r=typeof u=="function"?u:oa(!!u),l):r},l.curve=function(u){return arguments.length?(a=u,n!=null&&(s=a(n)),l):a},l.context=function(u){return arguments.length?(u==null?n=s=null:s=a(n=u),l):n},l}function qy(e,t,r){var n=null,a=oa(!0),s=null,o=Zw,l=null,u=sC(d);e=typeof e=="function"?e:e===void 0?_z:oa(+e),t=typeof t=="function"?t:oa(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?Ez:oa(+r);function d(m){var g,x,y,v=(m=oC(m)).length,w,j=!1,k,A=new Array(v),T=new Array(v);for(s==null&&(l=o(k=u())),g=0;g<=v;++g){if(!(g<v&&a(w=m[g],g,m))===j)if(j=!j)x=g,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),y=g-1;y>=x;--y)l.point(A[y],T[y]);l.lineEnd(),l.areaEnd()}j&&(A[g]=+e(w,g,m),T[g]=+t(w,g,m),l.point(n?+n(w,g,m):A[g],r?+r(w,g,m):T[g]))}if(k)return l=null,k+""||null}function f(){return Tz().defined(a).curve(o).context(s)}return d.x=function(m){return arguments.length?(e=typeof m=="function"?m:oa(+m),n=null,d):e},d.x0=function(m){return arguments.length?(e=typeof m=="function"?m:oa(+m),d):e},d.x1=function(m){return arguments.length?(n=m==null?null:typeof m=="function"?m:oa(+m),d):n},d.y=function(m){return arguments.length?(t=typeof m=="function"?m:oa(+m),r=null,d):t},d.y0=function(m){return arguments.length?(t=typeof m=="function"?m:oa(+m),d):t},d.y1=function(m){return arguments.length?(r=m==null?null:typeof m=="function"?m:oa(+m),d):r},d.lineX0=d.lineY0=function(){return f().x(e).y(t)},d.lineY1=function(){return f().x(e).y(r)},d.lineX1=function(){return f().x(n).y(t)},d.defined=function(m){return arguments.length?(a=typeof m=="function"?m:oa(!!m),d):a},d.curve=function(m){return arguments.length?(o=m,s!=null&&(l=o(s)),d):o},d.context=function(m){return arguments.length?(m==null?s=l=null:l=o(s=m),d):s},d}class Pz{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function aoe(e){return new Pz(e,!0)}function ioe(e){return new Pz(e,!1)}const lC={draw(e,t){const r=Fc(t/S2);e.moveTo(r,0),e.arc(0,0,r,0,Xw)}},soe={draw(e,t){const r=Fc(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},Dz=Fc(1/3),ooe=Dz*2,loe={draw(e,t){const r=Fc(t/ooe),n=r*Dz;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},coe={draw(e,t){const r=Fc(t),n=-r/2;e.rect(n,n,r,r)}},uoe=.8908130915292852,Oz=N2(S2/10)/N2(7*S2/10),doe=N2(Xw/10)*Oz,foe=-Az(Xw/10)*Oz,hoe={draw(e,t){const r=Fc(t*uoe),n=doe*r,a=foe*r;e.moveTo(0,-r),e.lineTo(n,a);for(let s=1;s<5;++s){const o=Xw*s/5,l=Az(o),u=N2(o);e.lineTo(u*r,-l*r),e.lineTo(l*n-u*a,u*n+l*a)}e.closePath()}},VN=Fc(3),moe={draw(e,t){const r=-Fc(t/(VN*3));e.moveTo(0,r*2),e.lineTo(-VN*r,-r),e.lineTo(VN*r,-r),e.closePath()}},Tl=-.5,Pl=Fc(3)/2,Z3=1/Fc(12),poe=(Z3/2+1)*3,xoe={draw(e,t){const r=Fc(t/poe),n=r/2,a=r*Z3,s=n,o=r*Z3+r,l=-s,u=o;e.moveTo(n,a),e.lineTo(s,o),e.lineTo(l,u),e.lineTo(Tl*n-Pl*a,Pl*n+Tl*a),e.lineTo(Tl*s-Pl*o,Pl*s+Tl*o),e.lineTo(Tl*l-Pl*u,Pl*l+Tl*u),e.lineTo(Tl*n+Pl*a,Tl*a-Pl*n),e.lineTo(Tl*s+Pl*o,Tl*o-Pl*s),e.lineTo(Tl*l+Pl*u,Tl*u-Pl*l),e.closePath()}};function goe(e,t){let r=null,n=sC(a);e=typeof e=="function"?e:oa(e||lC),t=typeof t=="function"?t:oa(t===void 0?64:+t);function a(){let s;if(r||(r=s=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),s)return r=null,s+""||null}return a.type=function(s){return arguments.length?(e=typeof s=="function"?s:oa(s),a):e},a.size=function(s){return arguments.length?(t=typeof s=="function"?s:oa(+s),a):t},a.context=function(s){return arguments.length?(r=s??null,a):r},a}function A2(){}function k2(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Rz(e){this._context=e}Rz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:k2(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:k2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function voe(e){return new Rz(e)}function Mz(e){this._context=e}Mz.prototype={areaStart:A2,areaEnd:A2,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:k2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function yoe(e){return new Mz(e)}function Lz(e){this._context=e}Lz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:k2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function boe(e){return new Lz(e)}function Iz(e){this._context=e}Iz.prototype={areaStart:A2,areaEnd:A2,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function woe(e){return new Iz(e)}function d8(e){return e<0?-1:1}function f8(e,t,r){var n=e._x1-e._x0,a=t-e._x1,s=(e._y1-e._y0)/(n||a<0&&-0),o=(r-e._y1)/(a||n<0&&-0),l=(s*a+o*n)/(n+a);return(d8(s)+d8(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function h8(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function qN(e,t,r){var n=e._x0,a=e._y0,s=e._x1,o=e._y1,l=(s-n)/3;e._context.bezierCurveTo(n+l,a+l*t,s-l,o-l*r,s,o)}function C2(e){this._context=e}C2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:qN(this,this._t0,h8(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,qN(this,h8(this,r=f8(this,e,t)),r);break;default:qN(this,this._t0,r=f8(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Fz(e){this._context=new Bz(e)}(Fz.prototype=Object.create(C2.prototype)).point=function(e,t){C2.prototype.point.call(this,t,e)};function Bz(e){this._context=e}Bz.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,a,s){this._context.bezierCurveTo(t,e,n,r,s,a)}};function joe(e){return new C2(e)}function Noe(e){return new Fz(e)}function zz(e){this._context=e}zz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=m8(e),a=m8(t),s=0,o=1;o<r;++s,++o)this._context.bezierCurveTo(n[0][s],a[0][s],n[1][s],a[1][s],e[o],t[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function m8(e){var t,r=e.length-1,n,a=new Array(r),s=new Array(r),o=new Array(r);for(a[0]=0,s[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)a[t]=1,s[t]=4,o[t]=4*e[t]+2*e[t+1];for(a[r-1]=2,s[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=a[t]/s[t-1],s[t]-=n,o[t]-=n*o[t-1];for(a[r-1]=o[r-1]/s[r-1],t=r-2;t>=0;--t)a[t]=(o[t]-a[t+1])/s[t];for(s[r-1]=(e[r]+a[r-1])/2,t=0;t<r-1;++t)s[t]=2*e[t+1]-a[t+1];return[a,s]}function Soe(e){return new zz(e)}function Jw(e,t){this._context=e,this._t=t}Jw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function Aoe(e){return new Jw(e,.5)}function koe(e){return new Jw(e,0)}function Coe(e){return new Jw(e,1)}function Zm(e,t){if((o=e.length)>1)for(var r=1,n,a,s=e[t[0]],o,l=s.length;r<o;++r)for(a=s,s=e[t[r]],n=0;n<l;++n)s[n][1]+=s[n][0]=isNaN(a[n][1])?a[n][0]:a[n][1]}function J3(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function _oe(e,t){return e[t]}function Eoe(e){const t=[];return t.key=e,t}function Toe(){var e=oa([]),t=J3,r=Zm,n=_oe;function a(s){var o=Array.from(e.apply(this,arguments),Eoe),l,u=o.length,d=-1,f;for(const m of s)for(l=0,++d;l<u;++l)(o[l][d]=[0,+n(m,o[l].key,d,s)]).data=m;for(l=0,f=oC(t(o));l<u;++l)o[f[l]].index=l;return r(o,f),o}return a.keys=function(s){return arguments.length?(e=typeof s=="function"?s:oa(Array.from(s)),a):e},a.value=function(s){return arguments.length?(n=typeof s=="function"?s:oa(+s),a):n},a.order=function(s){return arguments.length?(t=s==null?J3:typeof s=="function"?s:oa(Array.from(s)),a):t},a.offset=function(s){return arguments.length?(r=s??Zm,a):r},a}function Poe(e,t){if((n=e.length)>0){for(var r,n,a=0,s=e[0].length,o;a<s;++a){for(o=r=0;r<n;++r)o+=e[r][a][1]||0;if(o)for(r=0;r<n;++r)e[r][a][1]/=o}Zm(e,t)}}function Doe(e,t){if((a=e.length)>0){for(var r=0,n=e[t[0]],a,s=n.length;r<s;++r){for(var o=0,l=0;o<a;++o)l+=e[o][r][1]||0;n[r][1]+=n[r][0]=-l/2}Zm(e,t)}}function Ooe(e,t){if(!(!((o=e.length)>0)||!((s=(a=e[t[0]]).length)>0))){for(var r=0,n=1,a,s,o;n<s;++n){for(var l=0,u=0,d=0;l<o;++l){for(var f=e[t[l]],m=f[n][1]||0,g=f[n-1][1]||0,x=(m-g)/2,y=0;y<l;++y){var v=e[t[y]],w=v[n][1]||0,j=v[n-1][1]||0;x+=w-j}u+=m,d+=x*m}a[n-1][1]+=a[n-1][0]=r,u&&(r-=d/u)}a[n-1][1]+=a[n-1][0]=r,Zm(e,t)}}var WN={},GN={},p8;function Roe(){return p8||(p8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==="__proto__"}e.isUnsafeProperty=t})(GN)),GN}var YN={},x8;function Uz(){return x8||(x8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){switch(typeof r){case"number":case"symbol":return!1;case"string":return r.includes(".")||r.includes("[")||r.includes("]")}}e.isDeepKey=t})(YN)),YN}var KN={},g8;function cC(){return g8||(g8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){var n;return typeof r=="string"||typeof r=="symbol"?r:Object.is((n=r==null?void 0:r.valueOf)==null?void 0:n.call(r),-0)?"-0":String(r)}e.toKey=t})(KN)),KN}var XN={},ZN={},v8;function Moe(){return v8||(v8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){if(r==null)return"";if(typeof r=="string")return r;if(Array.isArray(r))return r.map(t).join(",");const n=String(r);return n==="0"&&Object.is(Number(r),-0)?"-0":n}e.toString=t})(ZN)),ZN}var y8;function uC(){return y8||(y8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Moe(),r=cC();function n(a){if(Array.isArray(a))return a.map(r.toKey);if(typeof a=="symbol")return[a];a=t.toString(a);const s=[],o=a.length;if(o===0)return s;let l=0,u="",d="",f=!1;for(a.charCodeAt(0)===46&&(s.push(""),l++);l<o;){const m=a[l];d?m==="\\"&&l+1<o?(l++,u+=a[l]):m===d?d="":u+=m:f?m==='"'||m==="'"?d=m:m==="]"?(f=!1,s.push(u),u=""):u+=m:m==="["?(f=!0,u&&(s.push(u),u="")):m==="."?u&&(s.push(u),u=""):u+=m,l++}return u&&s.push(u),s}e.toPath=n})(XN)),XN}var b8;function dC(){return b8||(b8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Roe(),r=Uz(),n=cC(),a=uC();function s(l,u,d){if(l==null)return d;switch(typeof u){case"string":{if(t.isUnsafeProperty(u))return d;const f=l[u];return f===void 0?r.isDeepKey(u)?s(l,a.toPath(u),d):d:f}case"number":case"symbol":{typeof u=="number"&&(u=n.toKey(u));const f=l[u];return f===void 0?d:f}default:{if(Array.isArray(u))return o(l,u,d);if(Object.is(u==null?void 0:u.valueOf(),-0)?u="-0":u=String(u),t.isUnsafeProperty(u))return d;const f=l[u];return f===void 0?d:f}}}function o(l,u,d){if(u.length===0)return d;let f=l;for(let m=0;m<u.length;m++){if(f==null||t.isUnsafeProperty(u[m]))return d;f=f[u[m]]}return f===void 0?d:f}e.get=s})(WN)),WN}var JN,w8;function Loe(){return w8||(w8=1,JN=dC().get),JN}var Ioe=Loe();const Jm=af(Ioe);var Foe=4;function ch(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Foe,r=10**t,n=Math.round(e*r)/r;return Object.is(n,-0)?0:n}function Qa(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.reduce((a,s,o)=>{var l=r[o-1];return typeof l=="string"?a+l+s:l!==void 0?a+ch(l)+s:a+s},"")}var cs=e=>e===0?0:e>0?1:-1,Rc=e=>typeof e=="number"&&e!=+e,Qm=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,Zt=e=>(typeof e=="number"||e instanceof Number)&&!Rc(e),Uu=e=>Zt(e)||typeof e=="string",Boe=0,_v=e=>{var t=++Boe;return"".concat(e||"").concat(t)},qs=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Zt(t)&&typeof t!="string")return n;var s;if(Qm(t)){if(r==null)return n;var o=t.indexOf("%");s=r*parseFloat(t.slice(0,o))/100}else s=+t;return Rc(s)&&(s=n),a&&r!=null&&s>r&&(s=r),s},$z=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;n<t;n++)if(!r[String(e[n])])r[String(e[n])]=!0;else return!0;return!1};function Rn(e,t,r){return Zt(e)&&Zt(t)?ch(e+r*(t-e)):t}function Hz(e,t,r){if(!(!e||!e.length))return e.find(n=>n&&(typeof t=="function"?t(n):Jm(n,t))===r)}var Sa=e=>e===null||typeof e>"u",f1=e=>Sa(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function Bo(e){return e!=null}function Mh(){}var zoe=["type","size","sizeType"];function Q3(){return Q3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Q3.apply(null,arguments)}function j8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function N8(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?j8(Object(r),!0).forEach(function(n){Uoe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j8(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Uoe(e,t,r){return(t=$oe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $oe(e){var t=Hoe(e,"string");return typeof t=="symbol"?t:t+""}function Hoe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Voe(e,t){if(e==null)return{};var r,n,a=qoe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function qoe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Vz={symbolCircle:lC,symbolCross:soe,symbolDiamond:loe,symbolSquare:coe,symbolStar:hoe,symbolTriangle:moe,symbolWye:xoe},Woe=Math.PI/180,Goe=e=>{var t="symbol".concat(f1(e));return Vz[t]||lC},Yoe=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*Woe;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Koe=(e,t)=>{Vz["symbol".concat(f1(e))]=t},fC=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,a=Voe(e,zoe),s=N8(N8({},a),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var g=Goe(o),x=goe().type(g).size(Yoe(r,n,o)),y=x();if(y!==null)return y},{className:u,cx:d,cy:f}=s,m=Gs(s);return Zt(d)&&Zt(f)&&Zt(r)?N.createElement("path",Q3({},m,{className:mn("recharts-symbols",u),transform:"translate(".concat(d,", ").concat(f,")"),d:l()})):null};fC.registerSymbol=Koe;var qz=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,hC=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(N.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(a=>{aC(a)&&typeof r[a]=="function"&&(n[a]=(s=>r[a](r,s)))}),n},Xoe=(e,t,r)=>n=>(e(t,r,n),null),h1=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(a=>{var s=e[a];aC(a)&&typeof s=="function"&&(n||(n={}),n[a]=Xoe(s,t,r))}),n};function S8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Zoe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?S8(Object(r),!0).forEach(function(n){Joe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S8(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Joe(e,t,r){return(t=Qoe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qoe(e){var t=ele(e,"string");return typeof t=="symbol"?t:t+""}function ele(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mi(e,t){var r=Zoe({},e),n=t,a=Object.keys(t),s=a.reduce((o,l)=>(o[l]===void 0&&n[l]!==void 0&&(o[l]=n[l]),o),r);return s}function _2(){return _2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_2.apply(null,arguments)}function A8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Wz(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?A8(Object(r),!0).forEach(function(n){tle(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A8(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tle(e,t,r){return(t=rle(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rle(e){var t=nle(e,"string");return typeof t=="symbol"?t:t+""}function nle(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Il=32,ale={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle",labelStyle:{}};function ile(e){if(typeof e=="object"&&e!==null&&"strokeDasharray"in e)return String(e.strokeDasharray)}function sle(e){var{data:t,iconType:r,inactiveColor:n}=e,a=Il/2,s=Il/6,o=Il/3,l=t.inactive?n:t.color,u=r??t.type;if(u==="none")return null;if(u==="plainline")return N.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:ile(t.payload),x1:0,y1:a,x2:Il,y2:a,className:"recharts-legend-icon"});if(u==="line")return N.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(a,"h").concat(o,`
            A`).concat(s,",").concat(s,",0,1,1,").concat(2*o,",").concat(a,`
            H`).concat(Il,"M").concat(2*o,",").concat(a,`
            A`).concat(s,",").concat(s,",0,1,1,").concat(o,",").concat(a),className:"recharts-legend-icon"});if(u==="rect")return N.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(Il/8,"h").concat(Il,"v").concat(Il*3/4,"h").concat(-Il,"z"),className:"recharts-legend-icon"});if(N.isValidElement(t.legendIcon)){var d=Wz({},t);return delete d.legendIcon,N.cloneElement(t.legendIcon,d)}return N.createElement(fC,{fill:l,cx:a,cy:a,size:Il,sizeType:"diameter",type:u})}function ole(e){var{payload:t,iconSize:r,layout:n,formatter:a,inactiveColor:s,iconType:o,labelStyle:l}=e,u={x:0,y:0,width:Il,height:Il},d={display:n==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return t.map((m,g)=>{var x=m.formatter||a,y=mn({"recharts-legend-item":!0,["legend-item-".concat(g)]:!0,inactive:m.inactive});if(m.type==="none")return null;var v=typeof l=="object"?Wz({},l):{};v.color=m.inactive?s:v.color||m.color;var w=x?x(m.value,m,g):m.value;return N.createElement("li",_2({className:y,style:d,key:"legend-item-".concat(g)},h1(e,m,g)),N.createElement(iC,{width:r,height:r,viewBox:u,style:f,"aria-label":"".concat(m.value," legend icon")},N.createElement(sle,{data:m,iconType:o,inactiveColor:s})),N.createElement("span",{className:"recharts-legend-item-text",style:v},w))})}var lle=e=>{var t=mi(e,ale),{payload:r,layout:n,align:a}=t;if(!r||!r.length)return null;var s={padding:0,margin:0,textAlign:n==="horizontal"?a:"left"};return N.createElement("ul",{className:"recharts-default-legend",style:s},N.createElement(ole,_2({},t,{payload:r})))},QN={},e4={},k8;function cle(){return k8||(k8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){const a=new Map;for(let s=0;s<r.length;s++){const o=r[s],l=n(o,s,r);a.has(l)||a.set(l,o)}return Array.from(a.values())}e.uniqBy=t})(e4)),e4}var t4={},C8;function ule(){return C8||(C8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){return function(...a){return r.apply(this,a.slice(0,n))}}e.ary=t})(t4)),t4}var r4={},_8;function Gz(){return _8||(_8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r}e.identity=t})(r4)),r4}var n4={},a4={},i4={},E8;function dle(){return E8||(E8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Number.isSafeInteger(r)&&r>=0}e.isLength=t})(i4)),i4}var T8;function Yz(){return T8||(T8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=dle();function r(n){return n!=null&&typeof n!="function"&&t.isLength(n.length)}e.isArrayLike=r})(a4)),a4}var s4={},P8;function fle(){return P8||(P8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="object"&&r!==null}e.isObjectLike=t})(s4)),s4}var D8;function hle(){return D8||(D8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Yz(),r=fle();function n(a){return r.isObjectLike(a)&&t.isArrayLike(a)}e.isArrayLikeObject=n})(n4)),n4}var o4={},l4={},O8;function mle(){return O8||(O8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=dC();function r(n){return function(a){return t.get(a,n)}}e.property=r})(l4)),l4}var c4={},u4={},d4={},f4={},R8;function Kz(){return R8||(R8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r!==null&&(typeof r=="object"||typeof r=="function")}e.isObject=t})(f4)),f4}var h4={},M8;function Xz(){return M8||(M8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null||typeof r!="object"&&typeof r!="function"}e.isPrimitive=t})(h4)),h4}var m4={},L8;function Zz(){return L8||(L8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){return r===n||Number.isNaN(r)&&Number.isNaN(n)}e.isEqualsSameValueZero=t})(m4)),m4}var I8;function ple(){return I8||(I8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kz(),r=Xz(),n=Zz();function a(f,m,g){return typeof g!="function"?a(f,m,()=>{}):s(f,m,function x(y,v,w,j,k,A){const T=g(y,v,w,j,k,A);return T!==void 0?!!T:s(y,v,x,A)},new Map)}function s(f,m,g,x){if(m===f)return!0;switch(typeof m){case"object":return o(f,m,g,x);case"function":return Object.keys(m).length>0?s(f,{...m},g,x):n.isEqualsSameValueZero(f,m);default:return t.isObject(f)?typeof m=="string"?m==="":!0:n.isEqualsSameValueZero(f,m)}}function o(f,m,g,x){if(m==null)return!0;if(Array.isArray(m))return u(f,m,g,x);if(m instanceof Map)return l(f,m,g,x);if(m instanceof Set)return d(f,m,g,x);const y=Object.keys(m);if(f==null||r.isPrimitive(f))return y.length===0;if(y.length===0)return!0;if(x!=null&&x.has(m))return x.get(m)===f;x==null||x.set(m,f);try{for(let v=0;v<y.length;v++){const w=y[v];if(!r.isPrimitive(f)&&!(w in f)||m[w]===void 0&&f[w]!==void 0||m[w]===null&&f[w]!==null||!g(f[w],m[w],w,f,m,x))return!1}return!0}finally{x==null||x.delete(m)}}function l(f,m,g,x){if(m.size===0)return!0;if(!(f instanceof Map))return!1;for(const[y,v]of m.entries()){const w=f.get(y);if(g(w,v,y,f,m,x)===!1)return!1}return!0}function u(f,m,g,x){if(m.length===0)return!0;if(!Array.isArray(f))return!1;const y=new Set;for(let v=0;v<m.length;v++){const w=m[v];let j=!1;for(let k=0;k<f.length;k++){if(y.has(k))continue;const A=f[k];let T=!1;if(g(A,w,v,f,m,x)&&(T=!0),T){y.add(k),j=!0;break}}if(!j)return!1}return!0}function d(f,m,g,x){return m.size===0?!0:f instanceof Set?u([...f],[...m],g,x):!1}e.isMatchWith=a,e.isSetMatch=d})(d4)),d4}var F8;function Jz(){return F8||(F8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ple();function r(n,a){return t.isMatchWith(n,a,()=>{})}e.isMatch=r})(u4)),u4}var p4={},x4={},g4={},B8;function xle(){return B8||(B8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Object.getOwnPropertySymbols(r).filter(n=>Object.prototype.propertyIsEnumerable.call(r,n))}e.getSymbols=t})(g4)),g4}var v4={},z8;function mC(){return z8||(z8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}e.getTag=t})(v4)),v4}var y4={},U8;function Qz(){return U8||(U8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",r="[object String]",n="[object Number]",a="[object Boolean]",s="[object Arguments]",o="[object Symbol]",l="[object Date]",u="[object Map]",d="[object Set]",f="[object Array]",m="[object Function]",g="[object ArrayBuffer]",x="[object Object]",y="[object Error]",v="[object DataView]",w="[object Uint8Array]",j="[object Uint8ClampedArray]",k="[object Uint16Array]",A="[object Uint32Array]",T="[object BigUint64Array]",M="[object Int8Array]",B="[object Int16Array]",L="[object Int32Array]",F="[object BigInt64Array]",I="[object Float32Array]",q="[object Float64Array]";e.argumentsTag=s,e.arrayBufferTag=g,e.arrayTag=f,e.bigInt64ArrayTag=F,e.bigUint64ArrayTag=T,e.booleanTag=a,e.dataViewTag=v,e.dateTag=l,e.errorTag=y,e.float32ArrayTag=I,e.float64ArrayTag=q,e.functionTag=m,e.int16ArrayTag=B,e.int32ArrayTag=L,e.int8ArrayTag=M,e.mapTag=u,e.numberTag=n,e.objectTag=x,e.regexpTag=t,e.setTag=d,e.stringTag=r,e.symbolTag=o,e.uint16ArrayTag=k,e.uint32ArrayTag=A,e.uint8ArrayTag=w,e.uint8ClampedArrayTag=j})(y4)),y4}var b4={},$8;function gle(){return $8||($8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}e.isTypedArray=t})(b4)),b4}var H8;function eU(){return H8||(H8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=xle(),r=mC(),n=Qz(),a=Xz(),s=gle();function o(f,m){return l(f,void 0,f,new Map,m)}function l(f,m,g,x=new Map,y=void 0){const v=y==null?void 0:y(f,m,g,x);if(v!==void 0)return v;if(a.isPrimitive(f))return f;if(x.has(f))return x.get(f);if(Array.isArray(f)){const w=new Array(f.length);x.set(f,w);for(let j=0;j<f.length;j++)w[j]=l(f[j],j,g,x,y);return Object.hasOwn(f,"index")&&(w.index=f.index),Object.hasOwn(f,"input")&&(w.input=f.input),w}if(f instanceof Date)return new Date(f.getTime());if(f instanceof RegExp){const w=new RegExp(f.source,f.flags);return w.lastIndex=f.lastIndex,w}if(f instanceof Map){const w=new Map;x.set(f,w);for(const[j,k]of f)w.set(j,l(k,j,g,x,y));return w}if(f instanceof Set){const w=new Set;x.set(f,w);for(const j of f)w.add(l(j,void 0,g,x,y));return w}if(typeof Buffer<"u"&&Buffer.isBuffer(f))return f.subarray();if(s.isTypedArray(f)){const w=new(Object.getPrototypeOf(f)).constructor(f.length);x.set(f,w);for(let j=0;j<f.length;j++)w[j]=l(f[j],j,g,x,y);return w}if(f instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&f instanceof SharedArrayBuffer)return f.slice(0);if(f instanceof DataView){const w=new DataView(f.buffer.slice(0),f.byteOffset,f.byteLength);return x.set(f,w),u(w,f,g,x,y),w}if(typeof File<"u"&&f instanceof File){const w=new File([f],f.name,{type:f.type});return x.set(f,w),u(w,f,g,x,y),w}if(typeof Blob<"u"&&f instanceof Blob){const w=new Blob([f],{type:f.type});return x.set(f,w),u(w,f,g,x,y),w}if(f instanceof Error){const w=structuredClone(f);return x.set(f,w),w.message=f.message,w.name=f.name,w.stack=f.stack,w.cause=f.cause,w.constructor=f.constructor,u(w,f,g,x,y),w}if(f instanceof Boolean){const w=new Boolean(f.valueOf());return x.set(f,w),u(w,f,g,x,y),w}if(f instanceof Number){const w=new Number(f.valueOf());return x.set(f,w),u(w,f,g,x,y),w}if(f instanceof String){const w=new String(f.valueOf());return x.set(f,w),u(w,f,g,x,y),w}if(typeof f=="object"&&d(f)){const w=Object.create(Object.getPrototypeOf(f));return x.set(f,w),u(w,f,g,x,y),w}return f}function u(f,m,g=f,x,y){const v=[...Object.keys(m),...t.getSymbols(m)];for(let w=0;w<v.length;w++){const j=v[w],k=Object.getOwnPropertyDescriptor(f,j);(k==null||k.writable)&&(f[j]=l(m[j],j,g,x,y))}}function d(f){switch(r.getTag(f)){case n.argumentsTag:case n.arrayTag:case n.arrayBufferTag:case n.dataViewTag:case n.booleanTag:case n.dateTag:case n.float32ArrayTag:case n.float64ArrayTag:case n.int8ArrayTag:case n.int16ArrayTag:case n.int32ArrayTag:case n.mapTag:case n.numberTag:case n.objectTag:case n.regexpTag:case n.setTag:case n.stringTag:case n.symbolTag:case n.uint8ArrayTag:case n.uint8ClampedArrayTag:case n.uint16ArrayTag:case n.uint32ArrayTag:return!0;default:return!1}}e.cloneDeepWith=o,e.cloneDeepWithImpl=l,e.copyProperties=u})(x4)),x4}var V8;function vle(){return V8||(V8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=eU();function r(n){return t.cloneDeepWithImpl(n,void 0,n,new Map,void 0)}e.cloneDeep=r})(p4)),p4}var q8;function yle(){return q8||(q8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Jz(),r=vle();function n(a){return a=r.cloneDeep(a),s=>t.isMatch(s,a)}e.matches=n})(c4)),c4}var w4={},j4={},N4={},W8;function ble(){return W8||(W8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=eU(),r=mC(),n=Qz();function a(s,o){return t.cloneDeepWith(s,(l,u,d,f)=>{const m=o==null?void 0:o(l,u,d,f);if(m!==void 0)return m;if(typeof s=="object"){if(r.getTag(s)===n.objectTag&&typeof s.constructor!="function"){const g={};return f.set(s,g),t.copyProperties(g,s,d,f),g}switch(Object.prototype.toString.call(s)){case n.numberTag:case n.stringTag:case n.booleanTag:{const g=new s.constructor(s==null?void 0:s.valueOf());return t.copyProperties(g,s),g}case n.argumentsTag:{const g={};return t.copyProperties(g,s),g.length=s.length,g[Symbol.iterator]=s[Symbol.iterator],g}default:return}}})}e.cloneDeepWith=a})(N4)),N4}var G8;function wle(){return G8||(G8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ble();function r(n){return t.cloneDeepWith(n)}e.cloneDeep=r})(j4)),j4}var S4={},A4={},Y8;function tU(){return Y8||(Y8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function r(n,a=Number.MAX_SAFE_INTEGER){switch(typeof n){case"number":return Number.isInteger(n)&&n>=0&&n<a;case"symbol":return!1;case"string":return t.test(n)}}e.isIndex=r})(A4)),A4}var k4={},K8;function jle(){return K8||(K8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=mC();function r(n){return n!==null&&typeof n=="object"&&t.getTag(n)==="[object Arguments]"}e.isArguments=r})(k4)),k4}var X8;function Nle(){return X8||(X8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Uz(),r=tU(),n=jle(),a=uC();function s(o,l){let u;if(Array.isArray(l)?u=l:typeof l=="string"&&t.isDeepKey(l)&&(o==null?void 0:o[l])==null?u=a.toPath(l):u=[l],u.length===0)return!1;let d=o;for(let f=0;f<u.length;f++){const m=u[f];if((d==null||!Object.hasOwn(d,m))&&!((Array.isArray(d)||n.isArguments(d))&&r.isIndex(m)&&m<d.length))return!1;d=d[m]}return!0}e.has=s})(S4)),S4}var Z8;function Sle(){return Z8||(Z8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Jz(),r=cC(),n=wle(),a=dC(),s=Nle();function o(l,u){switch(typeof l){case"object":{Object.is(l==null?void 0:l.valueOf(),-0)&&(l="-0");break}case"number":{l=r.toKey(l);break}}return u=n.cloneDeep(u),function(d){const f=a.get(d,l);return f===void 0?s.has(d,l):u===void 0?f===void 0:t.isMatch(f,u)}}e.matchesProperty=o})(w4)),w4}var J8;function Ale(){return J8||(J8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Gz(),r=mle(),n=yle(),a=Sle();function s(o){if(o==null)return t.identity;switch(typeof o){case"function":return o;case"object":return Array.isArray(o)&&o.length===2?a.matchesProperty(o[0],o[1]):n.matches(o);case"string":case"symbol":case"number":return r.property(o)}}e.iteratee=s})(o4)),o4}var Q8;function kle(){return Q8||(Q8=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=cle(),r=ule(),n=Gz(),a=hle(),s=Ale();function o(l,u=n.identity){return a.isArrayLikeObject(l)?t.uniqBy(Array.from(l),r.ary(s.iteratee(u),1)):[]}e.uniqBy=o})(QN)),QN}var C4,eO;function Cle(){return eO||(eO=1,C4=kle().uniqBy),C4}var _le=Cle();const tO=af(_le);function rU(e,t,r){return t===!0?tO(e,r):typeof t=="function"?tO(e,t):e}var _4={exports:{}},E4={},T4={exports:{}},P4={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var rO;function Ele(){if(rO)return P4;rO=1;var e=vx();function t(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,a=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function l(m,g){var x=g(),y=n({inst:{value:x,getSnapshot:g}}),v=y[0].inst,w=y[1];return s(function(){v.value=x,v.getSnapshot=g,u(v)&&w({inst:v})},[m,x,g]),a(function(){return u(v)&&w({inst:v}),m(function(){u(v)&&w({inst:v})})},[m]),o(x),x}function u(m){var g=m.getSnapshot;m=m.value;try{var x=g();return!r(m,x)}catch{return!0}}function d(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return P4.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,P4}var nO;function Tle(){return nO||(nO=1,T4.exports=Ele()),T4.exports}/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var aO;function Ple(){if(aO)return E4;aO=1;var e=vx(),t=Tle();function r(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:r,a=t.useSyncExternalStore,s=e.useRef,o=e.useEffect,l=e.useMemo,u=e.useDebugValue;return E4.useSyncExternalStoreWithSelector=function(d,f,m,g,x){var y=s(null);if(y.current===null){var v={hasValue:!1,value:null};y.current=v}else v=y.current;y=l(function(){function j(B){if(!k){if(k=!0,A=B,B=g(B),x!==void 0&&v.hasValue){var L=v.value;if(x(L,B))return T=L}return T=B}if(L=T,n(A,B))return L;var F=g(B);return x!==void 0&&x(L,F)?(A=B,L):(A=B,T=F)}var k=!1,A,T,M=m===void 0?null:m;return[function(){return j(f())},M===null?void 0:function(){return j(M())}]},[f,m,g,x]);var w=a(d,y[0],y[1]);return o(function(){v.hasValue=!0,v.value=w},[w]),u(w),w},E4}var iO;function Dle(){return iO||(iO=1,_4.exports=Ple()),_4.exports}var Ole=Dle(),pC=N.createContext(null),Rle=e=>e,Zn=()=>{var e=N.useContext(pC);return e?e.store.dispatch:Rle},Xb=()=>{},Mle=()=>Xb,Lle=(e,t)=>e===t;function ir(e){var t=N.useContext(pC),r=N.useMemo(()=>t?n=>{if(n!=null)return e(n)}:Xb,[t,e]);return Ole.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:Mle,t?t.store.getState:Xb,t?t.store.getState:Xb,r,Lle)}function Ile(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Fle(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Ble(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var sO=e=>Array.isArray(e)?e:[e];function zle(e){const t=Array.isArray(e[0])?e[0]:e;return Ble(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Ule(e,t){const r=[],{length:n}=e;for(let a=0;a<n;a++)r.push(e[a].apply(null,t));return r}var $le=class{constructor(e){this.value=e}deref(){return this.value}},Hle=typeof WeakRef<"u"?WeakRef:$le,Vle=0,oO=1;function Wy(){return{s:Vle,v:void 0,o:null,p:null}}function nU(e,t={}){let r=Wy();const{resultEqualityCheck:n}=t;let a,s=0;function o(){var m;let l=r;const{length:u}=arguments;for(let g=0,x=u;g<x;g++){const y=arguments[g];if(typeof y=="function"||typeof y=="object"&&y!==null){let v=l.o;v===null&&(l.o=v=new WeakMap);const w=v.get(y);w===void 0?(l=Wy(),v.set(y,l)):l=w}else{let v=l.p;v===null&&(l.p=v=new Map);const w=v.get(y);w===void 0?(l=Wy(),v.set(y,l)):l=w}}const d=l;let f;if(l.s===oO)f=l.v;else if(f=e.apply(null,arguments),s++,n){const g=((m=a==null?void 0:a.deref)==null?void 0:m.call(a))??a;g!=null&&n(g,f)&&(f=g,s!==0&&s--),a=typeof f=="object"&&f!==null||typeof f=="function"?new Hle(f):f}return d.s=oO,d.v=f,f}return o.clearCache=()=>{r=Wy(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function qle(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...a)=>{let s=0,o=0,l,u={},d=a.pop();typeof d=="object"&&(u=d,d=a.pop()),Ile(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const f={...r,...u},{memoize:m,memoizeOptions:g=[],argsMemoize:x=nU,argsMemoizeOptions:y=[]}=f,v=sO(g),w=sO(y),j=zle(a),k=m(function(){return s++,d.apply(null,arguments)},...v),A=x(function(){o++;const M=Ule(j,arguments);return l=k.apply(null,M),l},...w);return Object.assign(A,{resultFunc:d,memoizedResultFunc:k,dependencies:j,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:m,argsMemoize:x})};return Object.assign(n,{withTypes:()=>n}),n}var nt=qle(nU),Wle=Object.assign((e,t=nt)=>{Fle(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(s=>e[s]);return t(n,(...s)=>s.reduce((o,l,u)=>(o[r[u]]=l,o),{}))},{withTypes:()=>Wle}),D4={},O4={},R4={},lO;function Gle(){return lO||(lO=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"?1:n===null?2:n===void 0?3:n!==n?4:0}const r=(n,a,s)=>{if(n!==a){const o=t(n),l=t(a);if(o===l&&o===0){if(n<a)return s==="desc"?1:-1;if(n>a)return s==="desc"?-1:1}return s==="desc"?l-o:o-l}return 0};e.compareValues=r})(R4)),R4}var M4={},L4={},cO;function aU(){return cO||(cO=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"||r instanceof Symbol}e.isSymbol=t})(L4)),L4}var uO;function Yle(){return uO||(uO=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=aU(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(s,o){return Array.isArray(s)?!1:typeof s=="number"||typeof s=="boolean"||s==null||t.isSymbol(s)?!0:typeof s=="string"&&(n.test(s)||!r.test(s))||o!=null&&Object.hasOwn(o,s)}e.isKey=a})(M4)),M4}var dO;function Kle(){return dO||(dO=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Gle(),r=Yle(),n=uC();function a(s,o,l,u){if(s==null)return[];l=u?void 0:l,Array.isArray(s)||(s=Object.values(s)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(x=>String(x));const d=(x,y)=>{let v=x;for(let w=0;w<y.length&&v!=null;++w)v=v[y[w]];return v},f=(x,y)=>y==null||x==null?y:typeof x=="object"&&"key"in x?Object.hasOwn(y,x.key)?y[x.key]:d(y,x.path):typeof x=="function"?x(y):Array.isArray(x)?d(y,x):typeof y=="object"?y[x]:y,m=o.map(x=>(Array.isArray(x)&&x.length===1&&(x=x[0]),x==null||typeof x=="function"||Array.isArray(x)||r.isKey(x)?x:{key:x,path:n.toPath(x)}));return s.map(x=>({original:x,criteria:m.map(y=>f(y,x))})).slice().sort((x,y)=>{for(let v=0;v<m.length;v++){const w=t.compareValues(x.criteria[v],y.criteria[v],l[v]);if(w!==0)return w}return 0}).map(x=>x.original)}e.orderBy=a})(O4)),O4}var I4={},fO;function Xle(){return fO||(fO=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n=1){const a=[],s=Math.floor(n),o=(l,u)=>{for(let d=0;d<l.length;d++){const f=l[d];Array.isArray(f)&&u<s?o(f,u+1):a.push(f)}};return o(r,0),a}e.flatten=t})(I4)),I4}var F4={},hO;function iU(){return hO||(hO=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=tU(),r=Yz(),n=Kz(),a=Zz();function s(o,l,u){return n.isObject(u)&&(typeof l=="number"&&r.isArrayLike(u)&&t.isIndex(l)&&l<u.length||typeof l=="string"&&l in u)?a.isEqualsSameValueZero(u[l],o):!1}e.isIterateeCall=s})(F4)),F4}var mO;function Zle(){return mO||(mO=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kle(),r=Xle(),n=iU();function a(s,...o){const l=o.length;return l>1&&n.isIterateeCall(s,o[0],o[1])?o=[]:l>2&&n.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(s,r.flatten(o),["asc"])}e.sortBy=a})(D4)),D4}var B4,pO;function Jle(){return pO||(pO=1,B4=Zle().sortBy),B4}var Qle=Jle();const Qw=af(Qle);var sU=e=>e.legend.settings,ece=e=>e.legend.size,tce=e=>e.legend.payload,rce=nt([tce,sU],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?Qw(n,r):n});function nce(){return ir(rce)}var Gy=1;function oU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=N.useState({height:0,left:0,top:0,width:0}),n=N.useCallback(a=>{if(a!=null){var s=a.getBoundingClientRect(),o={height:s.height,left:s.left,top:s.top,width:s.width};(Math.abs(o.height-t.height)>Gy||Math.abs(o.left-t.left)>Gy||Math.abs(o.top-t.top)>Gy||Math.abs(o.width-t.width)>Gy)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function As(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ace=typeof Symbol=="function"&&Symbol.observable||"@@observable",xO=ace,z4=()=>Math.random().toString(36).substring(7).split("").join("."),ice={INIT:`@@redux/INIT${z4()}`,REPLACE:`@@redux/REPLACE${z4()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${z4()}`},E2=ice;function xC(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function lU(e,t,r){if(typeof e!="function")throw new Error(As(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(As(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(As(1));return r(lU)(e,t)}let n=e,a=t,s=new Map,o=s,l=0,u=!1;function d(){o===s&&(o=new Map,s.forEach((w,j)=>{o.set(j,w)}))}function f(){if(u)throw new Error(As(3));return a}function m(w){if(typeof w!="function")throw new Error(As(4));if(u)throw new Error(As(5));let j=!0;d();const k=l++;return o.set(k,w),function(){if(j){if(u)throw new Error(As(6));j=!1,d(),o.delete(k),s=null}}}function g(w){if(!xC(w))throw new Error(As(7));if(typeof w.type>"u")throw new Error(As(8));if(typeof w.type!="string")throw new Error(As(17));if(u)throw new Error(As(9));try{u=!0,a=n(a,w)}finally{u=!1}return(s=o).forEach(k=>{k()}),w}function x(w){if(typeof w!="function")throw new Error(As(10));n=w,g({type:E2.REPLACE})}function y(){const w=m;return{subscribe(j){if(typeof j!="object"||j===null)throw new Error(As(11));function k(){const T=j;T.next&&T.next(f())}return k(),{unsubscribe:w(k)}},[xO](){return this}}}return g({type:E2.INIT}),{dispatch:g,subscribe:m,getState:f,replaceReducer:x,[xO]:y}}function sce(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:E2.INIT})>"u")throw new Error(As(12));if(typeof r(void 0,{type:E2.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(As(13))})}function cU(e){const t=Object.keys(e),r={};for(let s=0;s<t.length;s++){const o=t[s];typeof e[o]=="function"&&(r[o]=e[o])}const n=Object.keys(r);let a;try{sce(r)}catch(s){a=s}return function(o={},l){if(a)throw a;let u=!1;const d={};for(let f=0;f<n.length;f++){const m=n[f],g=r[m],x=o[m],y=g(x,l);if(typeof y>"u")throw l&&l.type,new Error(As(14));d[m]=y,u=u||y!==x}return u=u||n.length!==Object.keys(o).length,u?d:o}}function T2(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function oce(...e){return t=>(r,n)=>{const a=t(r,n);let s=()=>{throw new Error(As(15))};const o={getState:a.getState,dispatch:(u,...d)=>s(u,...d)},l=e.map(u=>u(o));return s=T2(...l)(a.dispatch),{...a,dispatch:s}}}function uU(e){return xC(e)&&"type"in e&&typeof e.type=="string"}var dU=Symbol.for("immer-nothing"),gO=Symbol.for("immer-draftable"),ho=Symbol.for("immer-state");function Sc(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var dl=Object,ox=dl.getPrototypeOf,P2="constructor",e5="prototype",eA="configurable",D2="enumerable",Zb="writable",Ev="value",Jd=e=>!!e&&!!e[ho];function Mc(e){var t;return e?fU(e)||r5(e)||!!e[gO]||!!((t=e[P2])!=null&&t[gO])||n5(e)||a5(e):!1}var lce=dl[e5][P2].toString(),vO=new WeakMap;function fU(e){if(!e||!gC(e))return!1;const t=ox(e);if(t===null||t===dl[e5])return!0;const r=dl.hasOwnProperty.call(t,P2)&&t[P2];if(r===Object)return!0;if(!Ep(r))return!1;let n=vO.get(r);return n===void 0&&(n=Function.toString.call(r),vO.set(r,n)),n===lce}function t5(e,t,r=!0){m1(e)===0?(r?Reflect.ownKeys(e):dl.keys(e)).forEach(a=>{t(a,e[a],e)}):e.forEach((n,a)=>t(a,n,e))}function m1(e){const t=e[ho];return t?t.type_:r5(e)?1:n5(e)?2:a5(e)?3:0}var yO=(e,t,r=m1(e))=>r===2?e.has(t):dl[e5].hasOwnProperty.call(e,t),tA=(e,t,r=m1(e))=>r===2?e.get(t):e[t],O2=(e,t,r,n=m1(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function cce(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var r5=Array.isArray,n5=e=>e instanceof Map,a5=e=>e instanceof Set,gC=e=>typeof e=="object",Ep=e=>typeof e=="function",U4=e=>typeof e=="boolean";function uce(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Ld=e=>e.copy_||e.base_,vC=e=>e.modified_?e.copy_:e.base_;function rA(e,t){if(n5(e))return new Map(e);if(a5(e))return new Set(e);if(r5(e))return Array[e5].slice.call(e);const r=fU(e);if(t===!0||t==="class_only"&&!r){const n=dl.getOwnPropertyDescriptors(e);delete n[ho];let a=Reflect.ownKeys(n);for(let s=0;s<a.length;s++){const o=a[s],l=n[o];l[Zb]===!1&&(l[Zb]=!0,l[eA]=!0),(l.get||l.set)&&(n[o]={[eA]:!0,[Zb]:!0,[D2]:l[D2],[Ev]:e[o]})}return dl.create(ox(e),n)}else{const n=ox(e);if(n!==null&&r)return{...e};const a=dl.create(n);return dl.assign(a,e)}}function yC(e,t=!1){return i5(e)||Jd(e)||!Mc(e)||(m1(e)>1&&dl.defineProperties(e,{set:Yy,add:Yy,clear:Yy,delete:Yy}),dl.freeze(e),t&&t5(e,(r,n)=>{yC(n,!0)},!1)),e}function dce(){Sc(2)}var Yy={[Ev]:dce};function i5(e){return e===null||!gC(e)?!0:dl.isFrozen(e)}var R2="MapSet",nA="Patches",bO="ArrayMethods",hU={};function e0(e){const t=hU[e];return t||Sc(0,e),t}var wO=e=>!!hU[e],Tv,mU=()=>Tv,fce=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:wO(R2)?e0(R2):void 0,arrayMethodsPlugin_:wO(bO)?e0(bO):void 0});function jO(e,t){t&&(e.patchPlugin_=e0(nA),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function aA(e){iA(e),e.drafts_.forEach(hce),e.drafts_=null}function iA(e){e===Tv&&(Tv=e.parent_)}var NO=e=>Tv=fce(Tv,e);function hce(e){const t=e[ho];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function SO(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[ho].modified_&&(aA(t),Sc(4)),Mc(e)&&(e=AO(t,e));const{patchPlugin_:a}=t;a&&a.generateReplacementPatches_(r[ho].base_,e,t)}else e=AO(t,r);return mce(t,e,!0),aA(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==dU?e:void 0}function AO(e,t){if(i5(t))return t;const r=t[ho];if(!r)return M2(t,e.handledSet_,e);if(!s5(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);gU(r,e)}return r.copy_}function mce(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&yC(t,r)}function pU(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var s5=(e,t)=>e.scope_===t,pce=[];function xU(e,t,r,n){const a=Ld(e),s=e.type_;if(n!==void 0&&tA(a,n,s)===t){O2(a,n,r,s);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;t5(a,(u,d)=>{if(Jd(d)){const f=l.get(d)||[];f.push(u),l.set(d,f)}})}const o=e.draftLocations_.get(t)??pce;for(const l of o)O2(a,l,r,s)}function xce(e,t,r){e.callbacks_.push(function(a){var l;const s=t;if(!s||!s5(s,a))return;(l=a.mapSetPlugin_)==null||l.fixSetContents(s);const o=vC(s);xU(e,s.draft_??s,o,r),gU(s,a)})}function gU(e,t){var n;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((n=e.assigned_)==null?void 0:n.size)??0)>0)){const{patchPlugin_:a}=t;if(a){const s=a.getPath(e);s&&a.generatePatches_(e,s,t)}pU(e)}}function gce(e,t,r){const{scope_:n}=e;if(Jd(r)){const a=r[ho];s5(a,n)&&a.callbacks_.push(function(){Jb(e);const o=vC(a);xU(e,r,o,t)})}else Mc(r)&&e.callbacks_.push(function(){const s=Ld(e);e.type_===3?s.has(r)&&M2(r,n.handledSet_,n):tA(s,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&M2(tA(e.copy_,t,e.type_),n.handledSet_,n)})}function M2(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Jd(e)||t.has(e)||!Mc(e)||i5(e)||(t.add(e),t5(e,(n,a)=>{if(Jd(a)){const s=a[ho];if(s5(s,r)){const o=vC(s);O2(e,n,o,e.type_),pU(s)}}else Mc(a)&&M2(a,t,r)})),e}function vce(e,t){const r=r5(e),n={type_:r?1:0,scope_:t?t.scope_:mU(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let a=n,s=L2;r&&(a=[n],s=Pv);const{revoke:o,proxy:l}=Proxy.revocable(a,s);return n.draft_=l,n.revoke_=o,[l,n]}var L2={get(e,t){if(t===ho)return e;let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const a=Ld(e);if(!yO(a,t,e.type_))return yce(e,a,t);const s=a[t];if(e.finalized_||!Mc(s)||n&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&uce(t))return s;if(s===$4(e.base_,t)){Jb(e);const o=e.type_===1?+t:t,l=oA(e.scope_,s,e,o);return e.copy_[o]=l}return s},has(e,t){return t in Ld(e)},ownKeys(e){return Reflect.ownKeys(Ld(e))},set(e,t,r){const n=vU(Ld(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const a=$4(Ld(e),t),s=a==null?void 0:a[ho];if(s&&s.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(cce(r,a)&&(r!==void 0||yO(e.base_,t,e.type_)))return!0;Jb(e),sA(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),gce(e,t,r)),!0},deleteProperty(e,t){return Jb(e),$4(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),sA(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Ld(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Zb]:!0,[eA]:e.type_!==1||t!=="length",[D2]:n[D2],[Ev]:r[t]}},defineProperty(){Sc(11)},getPrototypeOf(e){return ox(e.base_)},setPrototypeOf(){Sc(12)}},Pv={};for(let e in L2){let t=L2[e];Pv[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Pv.deleteProperty=function(e,t){return Pv.set.call(this,e,t,void 0)};Pv.set=function(e,t,r){return L2.set.call(this,e[0],t,r,e[0])};function $4(e,t){const r=e[ho];return(r?Ld(r):e)[t]}function yce(e,t,r){var a;const n=vU(t,r);return n?Ev in n?n[Ev]:(a=n.get)==null?void 0:a.call(e.draft_):void 0}function vU(e,t){if(!(t in e))return;let r=ox(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=ox(r)}}function sA(e){e.modified_||(e.modified_=!0,e.parent_&&sA(e.parent_))}function Jb(e){e.copy_||(e.assigned_=new Map,e.copy_=rA(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var bce=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,n,a)=>{if(Ep(r)&&!Ep(n)){const o=n;n=r;const l=this;return function(d=o,...f){return l.produce(d,m=>n.call(this,m,...f))}}Ep(n)||Sc(6),a!==void 0&&!Ep(a)&&Sc(7);let s;if(Mc(r)){const o=NO(this),l=oA(o,r,void 0);let u=!0;try{s=n(l),u=!1}finally{u?aA(o):iA(o)}return jO(o,a),SO(s,o)}else if(!r||!gC(r)){if(s=n(r),s===void 0&&(s=r),s===dU&&(s=void 0),this.autoFreeze_&&yC(s,!0),a){const o=[],l=[];e0(nA).generateReplacementPatches_(r,s,{patches_:o,inversePatches_:l}),a(o,l)}return s}else Sc(1,r)},this.produceWithPatches=(r,n)=>{if(Ep(r))return(l,...u)=>this.produceWithPatches(l,d=>r(d,...u));let a,s;return[this.produce(r,n,(l,u)=>{a=l,s=u}),a,s]},U4(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),U4(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),U4(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Mc(t)||Sc(8),Jd(t)&&(t=Ul(t));const r=NO(this),n=oA(r,t,void 0);return n[ho].isManual_=!0,iA(r),n}finishDraft(t,r){const n=t&&t[ho];(!n||!n.isManual_)&&Sc(9);const{scope_:a}=n;return jO(a,r),SO(void 0,a)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const s=r[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(r=r.slice(n+1));const a=e0(nA).applyPatches_;return Jd(t)?a(t,r):this.produce(t,s=>a(s,r))}};function oA(e,t,r,n){const[a,s]=n5(t)?e0(R2).proxyMap_(t,r):a5(t)?e0(R2).proxySet_(t,r):vce(t,r);return((r==null?void 0:r.scope_)??mU()).drafts_.push(a),s.callbacks_=(r==null?void 0:r.callbacks_)??[],s.key_=n,r&&n!==void 0?xce(r,s,n):s.callbacks_.push(function(u){var f;(f=u.mapSetPlugin_)==null||f.fixSetContents(s);const{patchPlugin_:d}=u;s.modified_&&d&&d.generatePatches_(s,[],u)}),a}function Ul(e){return Jd(e)||Sc(10,e),yU(e)}function yU(e){if(!Mc(e)||i5(e))return e;const t=e[ho];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=rA(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=rA(e,!0);return t5(r,(a,s)=>{O2(r,a,yU(s))},n),t&&(t.finalized_=!1),r}var wce=new bce,bU=wce.produce;function wU(e){return({dispatch:r,getState:n})=>a=>s=>typeof s=="function"?s(r,n,e):a(s)}var jce=wU(),Nce=wU,Sce=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?T2:T2.apply(null,arguments)};function xl(e,t){function r(...n){if(t){let a=t(...n);if(!a)throw new Error(ml(0));return{type:e,payload:a.payload,..."meta"in a&&{meta:a.meta},..."error"in a&&{error:a.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>uU(n)&&n.type===e,r}var jU=class Yg extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Yg.prototype)}static get[Symbol.species](){return Yg}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Yg(...t[0].concat(this)):new Yg(...t.concat(this))}};function kO(e){return Mc(e)?bU(e,()=>{}):e}function Ky(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Ace(e){return typeof e=="boolean"}var kce=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:a=!0,actionCreatorCheck:s=!0}=t??{};let o=new jU;return r&&(Ace(r)?o.push(jce):o.push(Nce(r.extraArgument))),o},NU="RTK_autoBatch",ga=()=>e=>({payload:e,meta:{[NU]:!0}}),CO=e=>t=>{setTimeout(t,e)},SU=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let a=!0,s=!1,o=!1;const l=new Set,u=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:CO(10):e.type==="callback"?e.queueNotification:CO(e.timeout),d=()=>{o=!1,s&&(s=!1,l.forEach(f=>f()))};return Object.assign({},n,{subscribe(f){const m=()=>a&&f(),g=n.subscribe(m);return l.add(f),()=>{g(),l.delete(f)}},dispatch(f){var m;try{return a=!((m=f==null?void 0:f.meta)!=null&&m[NU]),s=!a,s&&(o||(o=!0,u(d))),n.dispatch(f)}finally{a=!0}}})},Cce=e=>function(r){const{autoBatch:n=!0}=r??{};let a=new jU(e);return n&&a.push(SU(typeof n=="object"?n:void 0)),a};function _ce(e){const t=kce(),{reducer:r=void 0,middleware:n,devTools:a=!0,preloadedState:s=void 0,enhancers:o=void 0}=e||{};let l;if(typeof r=="function")l=r;else if(xC(r))l=cU(r);else throw new Error(ml(1));let u;typeof n=="function"?u=n(t):u=t();let d=T2;a&&(d=Sce({trace:!1,...typeof a=="object"&&a}));const f=oce(...u),m=Cce(f);let g=typeof o=="function"?o(m):m();const x=d(...g);return lU(l,s,x)}function AU(e){const t={},r=[];let n;const a={addCase(s,o){const l=typeof s=="string"?s:s.type;if(!l)throw new Error(ml(28));if(l in t)throw new Error(ml(29));return t[l]=o,a},addAsyncThunk(s,o){return o.pending&&(t[s.pending.type]=o.pending),o.rejected&&(t[s.rejected.type]=o.rejected),o.fulfilled&&(t[s.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:s.settled,reducer:o.settled}),a},addMatcher(s,o){return r.push({matcher:s,reducer:o}),a},addDefaultCase(s){return n=s,a}};return e(a),[t,r,n]}function Ece(e){return typeof e=="function"}function Tce(e,t){let[r,n,a]=AU(t),s;if(Ece(e))s=()=>kO(e());else{const l=kO(e);s=()=>l}function o(l=s(),u){let d=[r[u.type],...n.filter(({matcher:f})=>f(u)).map(({reducer:f})=>f)];return d.filter(f=>!!f).length===0&&(d=[a]),d.reduce((f,m)=>{if(m)if(Jd(f)){const x=m(f,u);return x===void 0?f:x}else{if(Mc(f))return bU(f,g=>m(g,u));{const g=m(f,u);if(g===void 0){if(f===null)return f;throw Error("A case reducer on a non-draftable value must not return undefined")}return g}}return f},l)}return o.getInitialState=s,o}var Pce="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Dce=(e=21)=>{let t="",r=e;for(;r--;)t+=Pce[Math.random()*64|0];return t},Oce=Symbol.for("rtk-slice-createasyncthunk");function Rce(e,t){return`${e}/${t}`}function Mce({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[Oce];return function(a){const{name:s,reducerPath:o=s}=a;if(!s)throw new Error(ml(11));const l=(typeof a.reducers=="function"?a.reducers(Ice()):a.reducers)||{},u=Object.keys(l),d={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},f={addCase(T,M){const B=typeof T=="string"?T:T.type;if(!B)throw new Error(ml(12));if(B in d.sliceCaseReducersByType)throw new Error(ml(13));return d.sliceCaseReducersByType[B]=M,f},addMatcher(T,M){return d.sliceMatchers.push({matcher:T,reducer:M}),f},exposeAction(T,M){return d.actionCreators[T]=M,f},exposeCaseReducer(T,M){return d.sliceCaseReducersByName[T]=M,f}};u.forEach(T=>{const M=l[T],B={reducerName:T,type:Rce(s,T),createNotation:typeof a.reducers=="function"};Bce(M)?Uce(B,M,f,t):Fce(B,M,f)});function m(){const[T={},M=[],B=void 0]=typeof a.extraReducers=="function"?AU(a.extraReducers):[a.extraReducers],L={...T,...d.sliceCaseReducersByType};return Tce(a.initialState,F=>{for(let I in L)F.addCase(I,L[I]);for(let I of d.sliceMatchers)F.addMatcher(I.matcher,I.reducer);for(let I of M)F.addMatcher(I.matcher,I.reducer);B&&F.addDefaultCase(B)})}const g=T=>T,x=new Map,y=new WeakMap;let v;function w(T,M){return v||(v=m()),v(T,M)}function j(){return v||(v=m()),v.getInitialState()}function k(T,M=!1){function B(F){let I=F[T];return typeof I>"u"&&M&&(I=Ky(y,B,j)),I}function L(F=g){const I=Ky(x,M,()=>new WeakMap);return Ky(I,F,()=>{const q={};for(const[P,R]of Object.entries(a.selectors??{}))q[P]=Lce(R,F,()=>Ky(y,F,j),M);return q})}return{reducerPath:T,getSelectors:L,get selectors(){return L(B)},selectSlice:B}}const A={name:s,reducer:w,actions:d.actionCreators,caseReducers:d.sliceCaseReducersByName,getInitialState:j,...k(o),injectInto(T,{reducerPath:M,...B}={}){const L=M??o;return T.inject({reducerPath:L,reducer:w},B),{...A,...k(L,!0)}}};return A}}function Lce(e,t,r,n){function a(s,...o){let l=t(s);return typeof l>"u"&&n&&(l=r()),e(l,...o)}return a.unwrapped=e,a}var Ks=Mce();function Ice(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function Fce({type:e,reducerName:t,createNotation:r},n,a){let s,o;if("reducer"in n){if(r&&!zce(n))throw new Error(ml(17));s=n.reducer,o=n.prepare}else s=n;a.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?xl(e,o):xl(e))}function Bce(e){return e._reducerDefinitionType==="asyncThunk"}function zce(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Uce({type:e,reducerName:t},r,n,a){if(!a)throw new Error(ml(18));const{payloadCreator:s,fulfilled:o,pending:l,rejected:u,settled:d,options:f}=r,m=a(e,s,f);n.exposeAction(t,m),o&&n.addCase(m.fulfilled,o),l&&n.addCase(m.pending,l),u&&n.addCase(m.rejected,u),d&&n.addMatcher(m.settled,d),n.exposeCaseReducer(t,{fulfilled:o||Xy,pending:l||Xy,rejected:u||Xy,settled:d||Xy})}function Xy(){}var $ce="task",kU="listener",CU="completed",bC="cancelled",Hce=`task-${bC}`,Vce=`task-${CU}`,lA=`${kU}-${bC}`,qce=`${kU}-${CU}`,o5=class{constructor(e){En(this,"name","TaskAbortError");En(this,"message");this.code=e,this.message=`${$ce} ${bC} (reason: ${e})`}},wC=(e,t)=>{if(typeof e!="function")throw new TypeError(ml(32))},I2=()=>{},_U=(e,t=I2)=>(e.catch(t),e),EU=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Bm=e=>{if(e.aborted)throw new o5(e.reason)};function TU(e,t){let r=I2;return new Promise((n,a)=>{const s=()=>a(new o5(e.reason));if(e.aborted){s();return}r=EU(e,s),t.finally(()=>r()).then(n,a)}).finally(()=>{r=I2})}var Wce=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof o5?"cancelled":"rejected",error:r}}finally{t==null||t()}},F2=e=>t=>_U(TU(e,t).then(r=>(Bm(e),r))),PU=e=>{const t=F2(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:$p}=Object,_O={},l5="listenerMiddleware",Gce=(e,t)=>{const r=n=>EU(e,()=>n.abort(e.reason));return(n,a)=>{wC(n);const s=new AbortController;r(s);const o=Wce(async()=>{Bm(e),Bm(s.signal);const l=await n({pause:F2(s.signal),delay:PU(s.signal),signal:s.signal});return Bm(s.signal),l},()=>s.abort(Vce));return a!=null&&a.autoJoin&&t.push(o.catch(I2)),{result:F2(e)(o),cancel(){s.abort(Hce)}}}},Yce=(e,t)=>{const r=async(n,a)=>{Bm(t);let s=()=>{};const l=[new Promise((u,d)=>{let f=e({predicate:n,effect:(m,g)=>{g.unsubscribe(),u([m,g.getState(),g.getOriginalState()])}});s=()=>{f(),d()}})];a!=null&&l.push(new Promise(u=>setTimeout(u,a,null)));try{const u=await TU(t,Promise.race(l));return Bm(t),u}finally{s()}};return(n,a)=>_U(r(n,a))},DU=e=>{let{type:t,actionCreator:r,matcher:n,predicate:a,effect:s}=e;if(t)a=xl(t).match;else if(r)t=r.type,a=r.match;else if(n)a=n;else if(!a)throw new Error(ml(21));return wC(s),{predicate:a,type:t,effect:s}},OU=$p(e=>{const{type:t,predicate:r,effect:n}=DU(e);return{id:Dce(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ml(22))}}},{withTypes:()=>OU}),EO=(e,t)=>{const{type:r,effect:n,predicate:a}=DU(t);return Array.from(e.values()).find(s=>(typeof r=="string"?s.type===r:s.predicate===a)&&s.effect===n)},cA=e=>{e.pending.forEach(t=>{t.abort(lA)})},Kce=(e,t)=>()=>{for(const r of t.keys())cA(r);e.clear()},TO=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},RU=$p(xl(`${l5}/add`),{withTypes:()=>RU}),Xce=xl(`${l5}/removeAll`),MU=$p(xl(`${l5}/remove`),{withTypes:()=>MU}),Zce=(...e)=>{console.error(`${l5}/error`,...e)},p1=(e={})=>{const t=new Map,r=new Map,n=x=>{const y=r.get(x)??0;r.set(x,y+1)},a=x=>{const y=r.get(x)??1;y===1?r.delete(x):r.set(x,y-1)},{extra:s,onError:o=Zce}=e;wC(o);const l=x=>(x.unsubscribe=()=>t.delete(x.id),t.set(x.id,x),y=>{x.unsubscribe(),y!=null&&y.cancelActive&&cA(x)}),u=x=>{const y=EO(t,x)??OU(x);return l(y)};$p(u,{withTypes:()=>u});const d=x=>{const y=EO(t,x);return y&&(y.unsubscribe(),x.cancelActive&&cA(y)),!!y};$p(d,{withTypes:()=>d});const f=async(x,y,v,w)=>{const j=new AbortController,k=Yce(u,j.signal),A=[];try{x.pending.add(j),n(x),await Promise.resolve(x.effect(y,$p({},v,{getOriginalState:w,condition:(T,M)=>k(T,M).then(Boolean),take:k,delay:PU(j.signal),pause:F2(j.signal),extra:s,signal:j.signal,fork:Gce(j.signal,A),unsubscribe:x.unsubscribe,subscribe:()=>{t.set(x.id,x)},cancelActiveListeners:()=>{x.pending.forEach((T,M,B)=>{T!==j&&(T.abort(lA),B.delete(T))})},cancel:()=>{j.abort(lA),x.pending.delete(j)},throwIfCancelled:()=>{Bm(j.signal)}})))}catch(T){T instanceof o5||TO(o,T,{raisedBy:"effect"})}finally{await Promise.all(A),j.abort(qce),a(x),x.pending.delete(j)}},m=Kce(t,r);return{middleware:x=>y=>v=>{if(!uU(v))return y(v);if(RU.match(v))return u(v.payload);if(Xce.match(v)){m();return}if(MU.match(v))return d(v.payload);let w=x.getState();const j=()=>{if(w===_O)throw new Error(ml(23));return w};let k;try{if(k=y(v),t.size>0){const A=x.getState(),T=Array.from(t.values());for(const M of T){let B=!1;try{B=M.predicate(v,A,w)}catch(L){B=!1,TO(o,L,{raisedBy:"predicate"})}B&&f(M,v,x,j)}}}finally{w=_O}return k},startListening:u,stopListening:d,clearListeners:m}};function ml(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Jce={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},LU=Ks({name:"chartLayout",initialState:Jce,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,a,s;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(a=t.payload.bottom)!==null&&a!==void 0?a:0,e.margin.left=(s=t.payload.left)!==null&&s!==void 0?s:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:Qce,setLayout:eue,setChartSize:tue,setScale:rue}=LU.actions,nue=LU.reducer;function IU(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function Kr(e){return Number.isFinite(e)}function $u(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function PO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Lp(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?PO(Object(r),!0).forEach(function(n){aue(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function aue(e,t,r){return(t=iue(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iue(e){var t=sue(e,"string");return typeof t=="symbol"?t:t+""}function sue(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nn(e,t,r){return Sa(e)||Sa(t)?r:Uu(t)?Jm(e,t,r):typeof t=="function"?t(e):r}var oue=(e,t,r)=>{if(t&&r){var{width:n,height:a}=r,{align:s,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&s!=="center"&&Zt(e[s]))return Lp(Lp({},e),{},{[s]:e[s]+(n||0)});if((l==="horizontal"||l==="vertical"&&s==="center")&&o!=="middle"&&Zt(e[o]))return Lp(Lp({},e),{},{[o]:e[o]+(a||0)})}return e},Bc=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",FU=(e,t,r,n)=>{if(n)return e.map(l=>l.coordinate);var a,s,o=e.map(l=>(l.coordinate===t&&(a=!0),l.coordinate===r&&(s=!0),l.coordinate));return a||o.push(t),s||o.push(r),o},BU=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:a,range:s,scale:o,realScaleType:l,isCategorical:u,categoricalDomain:d,tickCount:f,ticks:m,niceTicks:g,axisType:x}=e;if(!o)return null;var y=l==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,v=a==="category"&&o.bandwidth?o.bandwidth()/y:0;if(v=x==="angleAxis"&&s&&s.length>=2?cs(s[0]-s[1])*2*v:v,m||g){var w=(m||g||[]).map((j,k)=>{var A=n?n.indexOf(j):j,T=o.map(A);return Kr(T)?{coordinate:T+v,value:j,offset:v,index:k}:null}).filter(Bo);return w}return u&&d?d.map((j,k)=>{var A=o.map(j);return Kr(A)?{coordinate:A+v,value:j,index:k,offset:v}:null}).filter(Bo):o.ticks&&f!=null?o.ticks(f).map((j,k)=>{var A=o.map(j);return Kr(A)?{coordinate:A+v,value:j,index:k,offset:v}:null}).filter(Bo):o.domain().map((j,k)=>{var A=o.map(j);return Kr(A)?{coordinate:A+v,value:n?n[j]:j,index:k,offset:v}:null}).filter(Bo)},lue=(e,t)=>{if(!t||t.length!==2||!Zt(t[0])||!Zt(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),a=[e[0],e[1]];return(!Zt(e[0])||e[0]<r)&&(a[0]=r),(!Zt(e[1])||e[1]>n)&&(a[1]=n),a[0]>n&&(a[0]=n),a[1]<r&&(a[1]=r),a},cue=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var a=0;a<n;++a)for(var s=0,o=0,l=0;l<r;++l){var u=e[l],d=u==null?void 0:u[a];if(d!=null){var f=d[1],m=d[0],g=Rc(f)?m:f;g>=0?(d[0]=s,s+=g,d[1]=s):(d[0]=o,o+=g,d[1]=o)}}}},uue=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var a=0;a<n;++a)for(var s=0,o=0;o<r;++o){var l=e[o],u=l==null?void 0:l[a];if(u!=null){var d=Rc(u[1])?u[0]:u[1];d>=0?(u[0]=s,s+=d,u[1]=s):(u[0]=0,u[1]=0)}}}},due={sign:cue,expand:Poe,none:Zm,silhouette:Doe,wiggle:Ooe,positive:uue},fue=(e,t,r)=>{var n,a=(n=due[r])!==null&&n!==void 0?n:Zm,s=Toe().keys(t).value((l,u)=>Number(Nn(l,u,0))).order(J3).offset(a),o=s(e);return o.forEach((l,u)=>{l.forEach((d,f)=>{var m=Nn(e[f],t[u],0);Array.isArray(m)&&m.length===2&&Zt(m[0])&&Zt(m[1])&&(d[0]=m[0],d[1]=m[1])})}),o};function zU(e){return e==null?void 0:String(e)}function B2(e){var{axis:t,ticks:r,bandSize:n,entry:a,index:s,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Sa(a[t.dataKey])){var l=Hz(r,"value",a[t.dataKey]);if(l)return l.coordinate+n/2}return r!=null&&r[s]?r[s].coordinate+n/2:null}var u=Nn(a,Sa(o)?t.dataKey:o),d=t.scale.map(u);return Zt(d)?d:null}var DO=e=>{var{axis:t,ticks:r,offset:n,bandSize:a,entry:s,index:o}=e;if(t.type==="category")return r[o]?r[o].coordinate+n:null;var l=Nn(s,t.dataKey,t.scale.domain()[o]);if(Sa(l))return null;var u=t.scale.map(l);return Zt(u)?u-a/2+n:null},hue=e=>{var{numericAxis:t}=e,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);return n<=0&&a>=0?0:a<0?a:n}return r[0]},mue=e=>{var t=e.flat(2).filter(Zt);return[Math.min(...t),Math.max(...t)]},pue=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],xue=(e,t,r)=>{if(e!=null)return pue(Object.keys(e).reduce((n,a)=>{var s=e[a];if(!s)return n;var{stackedData:o}=s,l=o.reduce((u,d)=>{var f=IU(d,t,r),m=mue(f);return!Kr(m[0])||!Kr(m[1])?u:[Math.min(u[0],m[0]),Math.max(u[1],m[1])]},[1/0,-1/0]);return[Math.min(l[0],n[0]),Math.max(l[1],n[1])]},[1/0,-1/0]))},OO=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,RO=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Nh=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var a=Qw(t,f=>f.coordinate),s=1/0,o=1,l=a.length;o<l;o++){var u=a[o],d=a[o-1];s=Math.min(((u==null?void 0:u.coordinate)||0)-((d==null?void 0:d.coordinate)||0),s)}return s===1/0?0:s}return r?void 0:0};function MO(e){var{tooltipEntrySettings:t,dataKey:r,payload:n,value:a,name:s}=e;return Lp(Lp({},t),{},{dataKey:r,payload:n,value:a,name:s})}function Lh(e,t){if(e)return String(e);if(typeof t=="string")return t}var gue=(e,t)=>{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},vue=(e,t)=>t==="centric"?e.angle:e.radius,of=e=>e.layout.width,lf=e=>e.layout.height,yue=e=>e.layout.scale,UU=e=>e.layout.margin,c5=nt(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),u5=nt(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),$U="data-recharts-item-index",HU="data-recharts-item-id",x1=60;function LO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Zy(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LO(Object(r),!0).forEach(function(n){bue(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bue(e,t,r){return(t=wue(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wue(e){var t=jue(e,"string");return typeof t=="symbol"?t:t+""}function jue(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Nue=e=>e.brush.height;function Sue(e){var t=u5(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var a=typeof n.width=="number"?n.width:x1;return r+a}return r},0)}function Aue(e){var t=u5(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var a=typeof n.width=="number"?n.width:x1;return r+a}return r},0)}function kue(e){var t=c5(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function Cue(e){var t=c5(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var Vi=nt([of,lf,UU,Nue,Sue,Aue,kue,Cue,sU,ece],(e,t,r,n,a,s,o,l,u,d)=>{var f={left:(r.left||0)+a,right:(r.right||0)+s},m={top:(r.top||0)+o,bottom:(r.bottom||0)+l},g=Zy(Zy({},m),f),x=g.bottom;g.bottom+=n,g=oue(g,u,d);var y=e-g.left-g.right,v=t-g.top-g.bottom;return Zy(Zy({brushBottom:x},g),{},{width:Math.max(y,0),height:Math.max(v,0)})}),_ue=nt(Vi,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),jC=nt(of,lf,(e,t)=>({x:0,y:0,width:e,height:t})),Eue=N.createContext(null),hs=()=>N.useContext(Eue)!=null,d5=e=>e.brush,f5=nt([d5,Vi,UU],(e,t,r)=>({height:e.height,x:Zt(e.x)?e.x:t.left,y:Zt(e.y)?e.y:t.top+t.height+t.brushBottom-((r==null?void 0:r.bottom)||0),width:Zt(e.width)?e.width:t.width})),H4={},V4={},q4={},IO;function Tue(){return IO||(IO=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n,{signal:a,edges:s}={}){let o,l=null;const u=s!=null&&s.includes("leading"),d=s==null||s.includes("trailing"),f=()=>{l!==null&&(r.apply(o,l),o=void 0,l=null)},m=()=>{d&&f(),v()};let g=null;const x=()=>{g!=null&&clearTimeout(g),g=setTimeout(()=>{g=null,m()},n)},y=()=>{g!==null&&(clearTimeout(g),g=null)},v=()=>{y(),o=void 0,l=null},w=()=>{f()},j=function(...k){if(a!=null&&a.aborted)return;o=this,l=k;const A=g==null;x(),u&&A&&f()};return j.schedule=x,j.cancel=v,j.flush=w,a==null||a.addEventListener("abort",v,{once:!0}),j}e.debounce=t})(q4)),q4}var FO;function Pue(){return FO||(FO=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Tue();function r(n,a=0,s={}){typeof s!="object"&&(s={});const{leading:o=!1,trailing:l=!0,maxWait:u}=s,d=Array(2);o&&(d[0]="leading"),l&&(d[1]="trailing");let f,m=null;const g=t.debounce(function(...v){f=n.apply(this,v),m=null},a,{edges:d}),x=function(...v){return u!=null&&(m===null&&(m=Date.now()),Date.now()-m>=u)?(f=n.apply(this,v),m=Date.now(),g.cancel(),g.schedule(),f):(g.apply(this,v),f)},y=()=>(g.flush(),f);return x.cancel=g.cancel,x.flush=y,x}e.debounce=r})(V4)),V4}var BO;function Due(){return BO||(BO=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Pue();function r(n,a=0,s={}){const{leading:o=!0,trailing:l=!0}=s;return t.debounce(n,a,{leading:o,maxWait:a,trailing:l})}e.throttle=r})(H4)),H4}var W4,zO;function Oue(){return zO||(zO=1,W4=Due().throttle),W4}var Rue=Oue();const Mue=af(Rue);var z2=function(t,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),s=2;s<n;s++)a[s-2]=arguments[s];if(typeof console<"u"&&console.warn&&(r===void 0&&console.warn("LogUtils requires an error message argument"),!t))if(r===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;console.warn(r.replace(/%s/g,()=>a[o++]))}},Du={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},VU=(e,t,r)=>{var{width:n=Du.width,height:a=Du.height,aspect:s,maxHeight:o}=r,l=Qm(n)?e:Number(n),u=Qm(a)?t:Number(a);return s&&s>0&&(l?u=l/s:u&&(l=u*s),o&&u!=null&&u>o&&(u=o)),{calculatedWidth:l,calculatedHeight:u}},Lue={width:0,height:0,overflow:"visible"},Iue={width:0,overflowX:"visible"},Fue={height:0,overflowY:"visible"},Bue={},zue=e=>{var{width:t,height:r}=e,n=Qm(t),a=Qm(r);return n&&a?Lue:n?Iue:a?Fue:Bue};function Uue(e){var{width:t,height:r,aspect:n}=e,a=t,s=r;return a===void 0&&s===void 0?(a=Du.width,s=Du.height):a===void 0?a=n&&n>0?void 0:Du.width:s===void 0&&(s=n&&n>0?void 0:Du.height),{width:a,height:s}}function uA(){return uA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},uA.apply(null,arguments)}function UO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function $O(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?UO(Object(r),!0).forEach(function(n){$ue(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $ue(e,t,r){return(t=Hue(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hue(e){var t=Vue(e,"string");return typeof t=="symbol"?t:t+""}function Vue(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var qU=N.createContext(Du.initialDimension);function que(e){return $u(e.width)&&$u(e.height)}function WU(e){var{children:t,width:r,height:n}=e,a=N.useMemo(()=>({width:r,height:n}),[r,n]);return que(a)?N.createElement(qU.Provider,{value:a},t):null}var NC=()=>N.useContext(qU),Wue=N.forwardRef((e,t)=>{var{aspect:r,initialDimension:n=Du.initialDimension,width:a,height:s,minWidth:o=Du.minWidth,minHeight:l,maxHeight:u,children:d,debounce:f=Du.debounce,id:m,className:g,onResize:x,style:y={}}=e,v=N.useRef(null),w=N.useRef();w.current=x,N.useImperativeHandle(t,()=>v.current);var[j,k]=N.useState({containerWidth:n.width,containerHeight:n.height}),A=N.useCallback((F,I)=>{k(q=>{var P=Math.round(F),R=Math.round(I);return q.containerWidth===P&&q.containerHeight===R?q:{containerWidth:P,containerHeight:R}})},[]);N.useEffect(()=>{if(v.current==null||typeof ResizeObserver>"u")return Mh;var F=R=>{var K,ee=R[0];if(ee!=null){var{width:se,height:Z}=ee.contentRect;A(se,Z),(K=w.current)===null||K===void 0||K.call(w,se,Z)}};f>0&&(F=Mue(F,f,{trailing:!0,leading:!1}));var I=new ResizeObserver(F),{width:q,height:P}=v.current.getBoundingClientRect();return A(q,P),I.observe(v.current),()=>{I.disconnect()}},[A,f]);var{containerWidth:T,containerHeight:M}=j;z2(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:B,calculatedHeight:L}=VU(T,M,{width:a,height:s,aspect:r,maxHeight:u});return z2(B!=null&&B>0||L!=null&&L>0,`The width(%s) and height(%s) of chart should be greater than 0,
       please check the style of container, or the props width(%s) and height(%s),
       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
       height and width.`,B,L,a,s,o,l,r),N.createElement("div",{id:m?"".concat(m):void 0,className:mn("recharts-responsive-container",g),style:$O($O({},y),{},{width:a,height:s,minWidth:o,minHeight:l,maxHeight:u}),ref:v},N.createElement("div",{style:zue({width:a,height:s})},N.createElement(WU,{width:B,height:L},d)))}),_u=N.forwardRef((e,t)=>{var r=NC();if($u(r.width)&&$u(r.height))return e.children;var{width:n,height:a}=Uue({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:s,calculatedHeight:o}=VU(void 0,void 0,{width:n,height:a,aspect:e.aspect,maxHeight:e.maxHeight});return Zt(s)&&Zt(o)?N.createElement(WU,{width:s,height:o},e.children):N.createElement(Wue,uA({},e,{width:n,height:a,ref:t}))});function SC(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var h5=()=>{var e,t=hs(),r=ir(_ue),n=ir(f5),a=(e=ir(d5))===null||e===void 0?void 0:e.padding;return!t||!n||!a?r:{width:n.width-a.left-a.right,height:n.height-a.top-a.bottom,x:a.left,y:a.top}},Gue={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},GU=()=>{var e;return(e=ir(Vi))!==null&&e!==void 0?e:Gue},AC=()=>ir(of),kC=()=>ir(lf),Yue=()=>ir(e=>e.layout.margin),un=e=>e.layout.layoutType,Ih=()=>ir(un),CC=()=>{var e=Ih();if(e==="horizontal"||e==="vertical")return e},YU=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},Kue=()=>{var e=Ih();return e!==void 0},g1=e=>{var t=Zn(),r=hs(),{width:n,height:a}=e,s=NC(),o=n,l=a;return s&&(o=s.width>0?s.width:n,l=s.height>0?s.height:a),N.useEffect(()=>{!r&&$u(o)&&$u(l)&&t(tue({width:o,height:l}))},[t,r,o,l]),null},KU=Symbol.for("immer-nothing"),HO=Symbol.for("immer-draftable"),gl=Symbol.for("immer-state");function Ac(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Dv=Object.getPrototypeOf;function lx(e){return!!e&&!!e[gl]}function t0(e){var t;return e?XU(e)||Array.isArray(e)||!!e[HO]||!!((t=e.constructor)!=null&&t[HO])||v1(e)||p5(e):!1}var Xue=Object.prototype.constructor.toString(),VO=new WeakMap;function XU(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=VO.get(r);return n===void 0&&(n=Function.toString.call(r),VO.set(r,n)),n===Xue}function U2(e,t,r=!0){m5(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(a=>{t(a,e[a],e)}):e.forEach((n,a)=>t(a,n,e))}function m5(e){const t=e[gl];return t?t.type_:Array.isArray(e)?1:v1(e)?2:p5(e)?3:0}function dA(e,t){return m5(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ZU(e,t,r){const n=m5(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Zue(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function v1(e){return e instanceof Map}function p5(e){return e instanceof Set}function Sm(e){return e.copy_||e.base_}function fA(e,t){if(v1(e))return new Map(e);if(p5(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=XU(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[gl];let a=Reflect.ownKeys(n);for(let s=0;s<a.length;s++){const o=a[s],l=n[o];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(n[o]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[o]})}return Object.create(Dv(e),n)}else{const n=Dv(e);if(n!==null&&r)return{...e};const a=Object.create(n);return Object.assign(a,e)}}function _C(e,t=!1){return x5(e)||lx(e)||!t0(e)||(m5(e)>1&&Object.defineProperties(e,{set:Jy,add:Jy,clear:Jy,delete:Jy}),Object.freeze(e),t&&Object.values(e).forEach(r=>_C(r,!0))),e}function Jue(){Ac(2)}var Jy={value:Jue};function x5(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Que={};function r0(e){const t=Que[e];return t||Ac(0,e),t}var Ov;function JU(){return Ov}function ede(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function qO(e,t){t&&(r0("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function hA(e){mA(e),e.drafts_.forEach(tde),e.drafts_=null}function mA(e){e===Ov&&(Ov=e.parent_)}function WO(e){return Ov=ede(Ov,e)}function tde(e){const t=e[gl];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function GO(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[gl].modified_&&(hA(t),Ac(4)),t0(e)&&(e=$2(t,e),t.parent_||H2(t,e)),t.patches_&&r0("Patches").generateReplacementPatches_(r[gl].base_,e,t.patches_,t.inversePatches_)):e=$2(t,r,[]),hA(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==KU?e:void 0}function $2(e,t,r){if(x5(t))return t;const n=e.immer_.shouldUseStrictIteration(),a=t[gl];if(!a)return U2(t,(s,o)=>YO(e,a,t,s,o,r),n),t;if(a.scope_!==e)return t;if(!a.modified_)return H2(e,a.base_,!0),a.base_;if(!a.finalized_){a.finalized_=!0,a.scope_.unfinalizedDrafts_--;const s=a.copy_;let o=s,l=!1;a.type_===3&&(o=new Set(s),s.clear(),l=!0),U2(o,(u,d)=>YO(e,a,s,u,d,r,l),n),H2(e,s,!1),r&&e.patches_&&r0("Patches").generatePatches_(a,r,e.patches_,e.inversePatches_)}return a.copy_}function YO(e,t,r,n,a,s,o){if(a==null||typeof a!="object"&&!o)return;const l=x5(a);if(!(l&&!o)){if(lx(a)){const u=s&&t&&t.type_!==3&&!dA(t.assigned_,n)?s.concat(n):void 0,d=$2(e,a,u);if(ZU(r,n,d),lx(d))e.canAutoFreeze_=!1;else return}else o&&r.add(a);if(t0(a)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===a&&l)return;$2(e,a),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(v1(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&H2(e,a)}}}function H2(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&_C(t,r)}function rde(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:JU(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=n,s=EC;r&&(a=[n],s=Rv);const{revoke:o,proxy:l}=Proxy.revocable(a,s);return n.draft_=l,n.revoke_=o,l}var EC={get(e,t){if(t===gl)return e;const r=Sm(e);if(!dA(r,t))return nde(e,r,t);const n=r[t];return e.finalized_||!t0(n)?n:n===G4(e.base_,t)?(Y4(e),e.copy_[t]=xA(n,e)):n},has(e,t){return t in Sm(e)},ownKeys(e){return Reflect.ownKeys(Sm(e))},set(e,t,r){const n=QU(Sm(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const a=G4(Sm(e),t),s=a==null?void 0:a[gl];if(s&&s.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(Zue(r,a)&&(r!==void 0||dA(e.base_,t)))return!0;Y4(e),pA(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return G4(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Y4(e),pA(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Sm(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Ac(11)},getPrototypeOf(e){return Dv(e.base_)},setPrototypeOf(){Ac(12)}},Rv={};U2(EC,(e,t)=>{Rv[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Rv.deleteProperty=function(e,t){return Rv.set.call(this,e,t,void 0)};Rv.set=function(e,t,r){return EC.set.call(this,e[0],t,r,e[0])};function G4(e,t){const r=e[gl];return(r?Sm(r):e)[t]}function nde(e,t,r){var a;const n=QU(t,r);return n?"value"in n?n.value:(a=n.get)==null?void 0:a.call(e.draft_):void 0}function QU(e,t){if(!(t in e))return;let r=Dv(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Dv(r)}}function pA(e){e.modified_||(e.modified_=!0,e.parent_&&pA(e.parent_))}function Y4(e){e.copy_||(e.copy_=fA(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var ade=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const s=r;r=t;const o=this;return function(u=s,...d){return o.produce(u,f=>r.call(this,f,...d))}}typeof r!="function"&&Ac(6),n!==void 0&&typeof n!="function"&&Ac(7);let a;if(t0(t)){const s=WO(this),o=xA(t,void 0);let l=!0;try{a=r(o),l=!1}finally{l?hA(s):mA(s)}return qO(s,n),GO(a,s)}else if(!t||typeof t!="object"){if(a=r(t),a===void 0&&(a=t),a===KU&&(a=void 0),this.autoFreeze_&&_C(a,!0),n){const s=[],o=[];r0("Patches").generateReplacementPatches_(t,a,s,o),n(s,o)}return a}else Ac(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,u=>t(u,...l));let n,a;return[this.produce(t,r,(o,l)=>{n=o,a=l}),n,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){t0(e)||Ac(8),lx(e)&&(e=ide(e));const t=WO(this),r=xA(e,void 0);return r[gl].isManual_=!0,mA(t),r}finishDraft(e,t){const r=e&&e[gl];(!r||!r.isManual_)&&Ac(9);const{scope_:n}=r;return qO(n,t),GO(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const a=t[r];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}r>-1&&(t=t.slice(r+1));const n=r0("Patches").applyPatches_;return lx(e)?n(e,t):this.produce(e,a=>n(a,t))}};function xA(e,t){const r=v1(e)?r0("MapSet").proxyMap_(e,t):p5(e)?r0("MapSet").proxySet_(e,t):rde(e,t);return(t?t.scope_:JU()).drafts_.push(r),r}function ide(e){return lx(e)||Ac(10,e),e$(e)}function e$(e){if(!t0(e)||x5(e))return e;const t=e[gl];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=fA(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=fA(e,!0);return U2(r,(a,s)=>{ZU(r,a,e$(s))},n),t&&(t.finalized_=!1),r}var sde=new ade;sde.produce;var ode={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},t$=Ks({name:"legend",initialState:ode,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:ga()},replaceLegendPayload:{reducer(e,t){var{prev:r,next:n}=t.payload,a=Ul(e).payload.indexOf(r);a>-1&&(e.payload[a]=n)},prepare:ga()},removeLegendPayload:{reducer(e,t){var r=Ul(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:ga()}}}),{setLegendSize:KO,setLegendSettings:lde,addLegendPayload:r$,replaceLegendPayload:n$,removeLegendPayload:a$}=t$.actions,cde=t$.reducer,K4={exports:{}},X4={};/**
 * @license React
 * use-sync-external-store-with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var XO;function ude(){if(XO)return X4;XO=1;var e=vx();function t(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,a=e.useRef,s=e.useEffect,o=e.useMemo,l=e.useDebugValue;return X4.useSyncExternalStoreWithSelector=function(u,d,f,m,g){var x=a(null);if(x.current===null){var y={hasValue:!1,value:null};x.current=y}else y=x.current;x=o(function(){function w(M){if(!j){if(j=!0,k=M,M=m(M),g!==void 0&&y.hasValue){var B=y.value;if(g(B,M))return A=B}return A=M}if(B=A,r(k,M))return B;var L=m(M);return g!==void 0&&g(B,L)?(k=M,B):(k=M,A=L)}var j=!1,k,A,T=f===void 0?null:f;return[function(){return w(d())},T===null?void 0:function(){return w(T())}]},[d,f,m,g]);var v=n(u,x[0],x[1]);return s(function(){y.hasValue=!0,y.value=v},[v]),l(v),v},X4}var ZO;function dde(){return ZO||(ZO=1,K4.exports=ude()),K4.exports}dde();function fde(e){e()}function hde(){let e=null,t=null;return{clear(){e=null,t=null},notify(){fde(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const a=t={callback:r,next:null,prev:t};return a.prev?a.prev.next=a:e=a,function(){!n||e===null||(n=!1,a.next?a.next.prev=a.prev:t=a.prev,a.prev?a.prev.next=a.next:e=a.next)}}}}var JO={notify(){},get:()=>[]};function mde(e,t){let r,n=JO,a=0,s=!1;function o(v){f();const w=n.subscribe(v);let j=!1;return()=>{j||(j=!0,w(),m())}}function l(){n.notify()}function u(){y.onStateChange&&y.onStateChange()}function d(){return s}function f(){a++,r||(r=e.subscribe(u),n=hde())}function m(){a--,r&&a===0&&(r(),r=void 0,n.clear(),n=JO)}function g(){s||(s=!0,f())}function x(){s&&(s=!1,m())}const y={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:u,isSubscribed:d,trySubscribe:g,tryUnsubscribe:x,getListeners:()=>n};return y}var pde=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",xde=pde(),gde=()=>typeof navigator<"u"&&navigator.product==="ReactNative",vde=gde(),yde=()=>xde||vde?N.useLayoutEffect:N.useEffect,bde=yde();function QO(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function wde(e,t){if(QO(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let a=0;a<r.length;a++)if(!Object.prototype.hasOwnProperty.call(t,r[a])||!QO(e[r[a]],t[r[a]]))return!1;return!0}var Z4=Symbol.for("react-redux-context"),J4=typeof globalThis<"u"?globalThis:{};function jde(){if(!N.createContext)return{};const e=J4[Z4]??(J4[Z4]=new Map);let t=e.get(N.createContext);return t||(t=N.createContext(null),e.set(N.createContext,t)),t}var Nde=jde();function Sde(e){const{children:t,context:r,serverState:n,store:a}=e,s=N.useMemo(()=>{const u=mde(a);return{store:a,subscription:u,getServerState:n?()=>n:void 0}},[a,n]),o=N.useMemo(()=>a.getState(),[a]);bde(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),o!==a.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,o]);const l=r||Nde;return N.createElement(l.Provider,{value:s},t)}var Ade=Sde,kde=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function Cde(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function x0(e,t){var r=new Set([...Object.keys(e),...Object.keys(t)]);for(var n of r)if(kde.has(n)){if(e[n]==null&&t[n]==null)continue;if(!wde(e[n],t[n]))return!1}else if(!Cde(e[n],t[n]))return!1;return!0}var _de=["contextPayload"];function gA(){return gA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},gA.apply(null,arguments)}function eR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function cx(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?eR(Object(r),!0).forEach(function(n){Ede(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):eR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ede(e,t,r){return(t=Tde(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tde(e){var t=Pde(e,"string");return typeof t=="symbol"?t:t+""}function Pde(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Dde(e,t){if(e==null)return{};var r,n,a=Ode(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Ode(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Rde(e){return e.value}function Mde(e){var{contextPayload:t}=e,r=Dde(e,_de),n=rU(t,e.payloadUniqBy,Rde),a=cx(cx({},r),{},{payload:n});return N.isValidElement(e.content)?N.cloneElement(e.content,a):typeof e.content=="function"?N.createElement(e.content,a):N.createElement(lle,a)}function Lde(e,t,r,n,a,s){var{layout:o,align:l,verticalAlign:u}=t,d,f;return(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))&&(l==="center"&&o==="vertical"?d={left:((n||0)-s.width)/2}:d=l==="right"?{right:r&&r.right||0}:{left:r&&r.left||0}),(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))&&(u==="middle"?f={top:((a||0)-s.height)/2}:f=u==="bottom"?{bottom:r&&r.bottom||0}:{top:r&&r.top||0}),cx(cx({},d),f)}function Ide(e){var t=Zn();return N.useEffect(()=>{t(lde(e))},[t,e]),null}function Fde(e){var t=Zn();return N.useEffect(()=>(t(KO(e)),()=>{t(KO({width:0,height:0}))}),[t,e]),null}function Bde(e,t,r,n){return e==="vertical"&&t!=null?{height:t}:e==="horizontal"?{width:r||n}:null}var zde={align:"center",iconSize:14,inactiveColor:"#ccc",itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function Ude(e){var t=mi(e,zde),r=nce(),n=eoe(),a=Yue(),{width:s,height:o,wrapperStyle:l,portal:u}=t,[d,f]=oU([r]),m=AC(),g=kC();if(m==null||g==null)return null;var x=m-((a==null?void 0:a.left)||0)-((a==null?void 0:a.right)||0),y=Bde(t.layout,o,s,x),v=u?l:cx(cx({position:"absolute",width:(y==null?void 0:y.width)||s||"auto",height:(y==null?void 0:y.height)||o||"auto"},Lde(l,t,a,m,g,d)),l),w=u??n;if(w==null||r==null)return null;var j=N.createElement("div",{className:"recharts-legend-wrapper",style:v,ref:f},N.createElement(Ide,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!u&&N.createElement(Fde,{width:d.width,height:d.height}),N.createElement(Mde,gA({},t,y,{margin:a,chartWidth:m,chartHeight:g,contextPayload:r})));return jx.createPortal(j,w)}var i$=N.memo(Ude,x0);i$.displayName="Legend";function vA(){return vA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vA.apply(null,arguments)}function tR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Pg(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tR(Object(r),!0).forEach(function(n){$de(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $de(e,t,r){return(t=Hde(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hde(e){var t=Vde(e,"string");return typeof t=="symbol"?t:t+""}function Vde(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qde(e){return Array.isArray(e)&&Uu(e[0])&&Uu(e[1])?e.join(" ~ "):e}var mp={separator:" : ",contentStyle:{margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},itemStyle:{display:"block",paddingTop:4,paddingBottom:4,color:"#000"},labelStyle:{},accessibilityLayer:!1};function Wde(e,t){return t==null?e:Qw(e,t)}var Gde=e=>{var{separator:t=mp.separator,contentStyle:r,itemStyle:n,labelStyle:a=mp.labelStyle,payload:s,formatter:o,itemSorter:l,wrapperClassName:u,labelClassName:d,label:f,labelFormatter:m,accessibilityLayer:g=mp.accessibilityLayer}=e,x=()=>{if(s&&s.length){var M={padding:0,margin:0},B=Wde(s,l),L=B.map((F,I)=>{if(!F||F.type==="none")return null;var q=F.formatter||o||qde,{value:P,name:R}=F,K=P,ee=R;if(q){var se=q(P,R,F,I,s);if(Array.isArray(se))[K,ee]=se;else if(se!=null)K=se;else return null}var Z=Pg(Pg({},mp.itemStyle),{},{color:F.color||mp.itemStyle.color},n);return N.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(I),style:Z},Uu(ee)?N.createElement("span",{className:"recharts-tooltip-item-name"},ee):null,Uu(ee)?N.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,N.createElement("span",{className:"recharts-tooltip-item-value"},K),N.createElement("span",{className:"recharts-tooltip-item-unit"},F.unit||""))});return N.createElement("ul",{className:"recharts-tooltip-item-list",style:M},L)}return null},y=Pg(Pg({},mp.contentStyle),r),v=Pg({margin:0},a),w=!Sa(f),j=w?f:"",k=mn("recharts-default-tooltip",u),A=mn("recharts-tooltip-label",d);w&&m&&s!==void 0&&s!==null&&(j=m(f,s));var T=g?{role:"status","aria-live":"assertive"}:{};return N.createElement("div",vA({className:k,style:y},T),N.createElement("p",{className:A,style:v},N.isValidElement(j)?j:"".concat(j)),x())},Dg="recharts-tooltip-wrapper",Yde={visibility:"hidden"};function Kde(e){var{coordinate:t,translateX:r,translateY:n}=e;return mn(Dg,{["".concat(Dg,"-right")]:Zt(r)&&t&&Zt(t.x)&&r>=t.x,["".concat(Dg,"-left")]:Zt(r)&&t&&Zt(t.x)&&r<t.x,["".concat(Dg,"-bottom")]:Zt(n)&&t&&Zt(t.y)&&n>=t.y,["".concat(Dg,"-top")]:Zt(n)&&t&&Zt(t.y)&&n<t.y})}function rR(e){var{allowEscapeViewBox:t,coordinate:r,key:n,offset:a,position:s,reverseDirection:o,tooltipDimension:l,viewBox:u,viewBoxDimension:d}=e;if(s&&Zt(s[n]))return s[n];var f=r[n]-l-(a>0?a:0),m=r[n]+a;if(t[n])return o[n]?f:m;var g=u[n];if(g==null)return 0;if(o[n]){var x=f,y=g;return x<y?Math.max(m,g):Math.max(f,g)}if(d==null)return 0;var v=m+l,w=g+d;return v>w?Math.max(f,g):Math.max(m,g)}function Xde(e){var{translateX:t,translateY:r,useTranslate3d:n}=e;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function Zde(e){var{allowEscapeViewBox:t,coordinate:r,offsetTop:n,offsetLeft:a,position:s,reverseDirection:o,tooltipBox:l,useTranslate3d:u,viewBox:d}=e,f,m,g;return l.height>0&&l.width>0&&r?(m=rR({allowEscapeViewBox:t,coordinate:r,key:"x",offset:a,position:s,reverseDirection:o,tooltipDimension:l.width,viewBox:d,viewBoxDimension:d.width}),g=rR({allowEscapeViewBox:t,coordinate:r,key:"y",offset:n,position:s,reverseDirection:o,tooltipDimension:l.height,viewBox:d,viewBoxDimension:d.height}),f=Xde({translateX:m,translateY:g,useTranslate3d:u})):f=Yde,{cssProperties:f,cssClasses:Kde({translateX:m,translateY:g,coordinate:r})}}var Jde=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),y1={isSsr:Jde()};function s$(){var[e,t]=N.useState(()=>y1.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return N.useEffect(()=>{if(window.matchMedia){var r=window.matchMedia("(prefers-reduced-motion: reduce)"),n=()=>{t(r.matches)};return r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}}},[]),e}function nR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function pp(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nR(Object(r),!0).forEach(function(n){Qde(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qde(e,t,r){return(t=efe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function efe(e){var t=tfe(e,"string");return typeof t=="symbol"?t:t+""}function tfe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rfe(e){if(!(e.prefersReducedMotion&&e.isAnimationActive==="auto")&&e.isAnimationActive&&e.active)return"transform ".concat(e.animationDuration,"ms ").concat(e.animationEasing)}function nfe(e){var t,r,n,a,s,o,l=s$(),[u,d]=N.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}));N.useEffect(()=>{var y=v=>{if(v.key==="Escape"){var w,j,k,A;d({dismissed:!0,dismissedAtCoordinate:{x:(w=(j=e.coordinate)===null||j===void 0?void 0:j.x)!==null&&w!==void 0?w:0,y:(k=(A=e.coordinate)===null||A===void 0?void 0:A.y)!==null&&k!==void 0?k:0}})}};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}},[(t=e.coordinate)===null||t===void 0?void 0:t.x,(r=e.coordinate)===null||r===void 0?void 0:r.y]),u.dismissed&&(((n=(a=e.coordinate)===null||a===void 0?void 0:a.x)!==null&&n!==void 0?n:0)!==u.dismissedAtCoordinate.x||((s=(o=e.coordinate)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)!==u.dismissedAtCoordinate.y)&&d(pp(pp({},u),{},{dismissed:!1}));var{cssClasses:f,cssProperties:m}=Zde({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset=="number"?e.offset:e.offset.x,offsetTop:typeof e.offset=="number"?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),g=e.hasPortalFromProps?{}:pp(pp({transition:rfe({prefersReducedMotion:l,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},m),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),x=pp(pp({},g),{},{visibility:!u.dismissed&&e.active&&e.hasPayload?"visible":"hidden"},e.wrapperStyle);return N.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:f,style:x,ref:e.innerRef},e.children)}var afe=N.memo(nfe),o$=()=>{var e;return(e=ir(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function yA(){return yA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},yA.apply(null,arguments)}function aR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function iR(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?aR(Object(r),!0).forEach(function(n){ife(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ife(e,t,r){return(t=sfe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sfe(e){var t=ofe(e,"string");return typeof t=="symbol"?t:t+""}function ofe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var sR={curveBasisClosed:yoe,curveBasisOpen:boe,curveBasis:voe,curveBumpX:aoe,curveBumpY:ioe,curveLinearClosed:woe,curveLinear:Zw,curveMonotoneX:joe,curveMonotoneY:Noe,curveNatural:Soe,curveStep:Aoe,curveStepAfter:Coe,curveStepBefore:koe},V2=e=>Kr(e.x)&&Kr(e.y),oR=e=>e.base!=null&&V2(e.base)&&V2(e),Og=e=>e.x,Rg=e=>e.y,lfe=(e,t)=>{if(typeof e=="function")return e;var r="curve".concat(f1(e));if((r==="curveMonotone"||r==="curveBump")&&t){var n=sR["".concat(r).concat(t==="vertical"?"Y":"X")];if(n)return n}return sR[r]||Zw},lR={connectNulls:!1,type:"linear"},cfe=e=>{var{type:t=lR.type,points:r=[],baseLine:n,layout:a,connectNulls:s=lR.connectNulls}=e,o=lfe(t,a),l=s?r.filter(V2):r;if(Array.isArray(n)){var u,d=r.map((y,v)=>iR(iR({},y),{},{base:n[v]}));a==="vertical"?u=qy().y(Rg).x1(Og).x0(y=>y.base.x):u=qy().x(Og).y1(Rg).y0(y=>y.base.y);var f=u.defined(oR).curve(o),m=s?d.filter(oR):d;return f(m)}var g;a==="vertical"&&Zt(n)?g=qy().y(Rg).x1(Og).x0(n):Zt(n)?g=qy().x(Og).y1(Rg).y0(n):g=Tz().x(Og).y(Rg);var x=g.defined(V2).curve(o);return x(l)},Hp=e=>{var{className:t,points:r,path:n,pathRef:a}=e,s=Ih();if((!r||!r.length)&&!n)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||s,connectNulls:e.connectNulls},l=r&&r.length?cfe(o):n;return N.createElement("path",yA({},fo(e),hC(e),{className:mn("recharts-curve",t),d:l===null?void 0:l,ref:a}))},ufe=["x","y","top","left","width","height","className"];function bA(){return bA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bA.apply(null,arguments)}function cR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function dfe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cR(Object(r),!0).forEach(function(n){ffe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ffe(e,t,r){return(t=hfe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hfe(e){var t=mfe(e,"string");return typeof t=="symbol"?t:t+""}function mfe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pfe(e,t){if(e==null)return{};var r,n,a=xfe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function xfe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var gfe=(e,t,r,n,a,s)=>"M".concat(e,",").concat(a,"v").concat(n,"M").concat(s,",").concat(t,"h").concat(r),vfe=e=>{var{x:t=0,y:r=0,top:n=0,left:a=0,width:s=0,height:o=0,className:l}=e,u=pfe(e,ufe),d=dfe({x:t,y:r,top:n,left:a,width:s,height:o},u);return!Zt(t)||!Zt(r)||!Zt(s)||!Zt(o)||!Zt(n)||!Zt(a)?null:N.createElement("path",bA({},Gs(d),{className:mn("recharts-cross",l),d:gfe(t,r,s,o,n,a)}))};function yfe(e,t,r,n){var a=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-a:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-a,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function uR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function dR(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uR(Object(r),!0).forEach(function(n){bfe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bfe(e,t,r){return(t=wfe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wfe(e){var t=jfe(e,"string");return typeof t=="symbol"?t:t+""}function jfe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Nfe=e=>e.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),l$=(e,t,r)=>e.map(n=>"".concat(Nfe(n)," ").concat(t,"ms ").concat(r)).join(","),Sfe=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((r,n)=>r.filter(a=>n.includes(a))),Mv=(e,t)=>Object.keys(t).reduce((r,n)=>dR(dR({},r),{},{[n]:e(n,t[n])}),{});function fR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Bi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fR(Object(r),!0).forEach(function(n){Afe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Afe(e,t,r){return(t=kfe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kfe(e){var t=Cfe(e,"string");return typeof t=="symbol"?t:t+""}function Cfe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var q2=(e,t,r)=>e+(t-e)*r,wA=e=>{var{from:t,to:r}=e;return t!==r},c$=(e,t,r)=>{var n=Mv((a,s)=>{if(wA(s)){var[o,l]=e(s.from,s.to,s.velocity);return Bi(Bi({},s),{},{from:o,velocity:l})}return s},t);return r<1?Mv((a,s)=>wA(s)&&n[a]!=null?Bi(Bi({},s),{},{velocity:q2(s.velocity,n[a].velocity,r),from:q2(s.from,n[a].from,r)}):s,t):c$(e,n,r-1)};function _fe(e,t,r,n,a,s){var o,l=n.reduce((g,x)=>Bi(Bi({},g),{},{[x]:{from:e[x],velocity:0,to:t[x]}}),{}),u=()=>Mv((g,x)=>x.from,l),d=()=>!Object.values(l).filter(wA).length,f=null,m=g=>{o||(o=g);var x=g-o,y=x/r.dt;l=c$(r,l,y),a(Bi(Bi(Bi({},e),t),u())),o=g,d()||(f=s.setTimeout(m))};return()=>(f=s.setTimeout(m),()=>{var g;(g=f)===null||g===void 0||g()})}function Efe(e,t,r,n,a,s,o){var l=null,u=a.reduce((m,g)=>{var x=e[g],y=t[g];return x==null||y==null?m:Bi(Bi({},m),{},{[g]:[x,y]})},{}),d,f=m=>{d||(d=m);var g=(m-d)/n,x=Mv((v,w)=>q2(...w,r(g)),u);if(s(Bi(Bi(Bi({},e),t),x)),g<1)l=o.setTimeout(f);else{var y=Mv((v,w)=>q2(...w,r(1)),u);s(Bi(Bi(Bi({},e),t),y))}};return()=>(l=o.setTimeout(f),()=>{var m;(m=l)===null||m===void 0||m()})}const Tfe=(e,t,r,n,a,s)=>{var o=Sfe(e,t);return r==null?()=>(a(Bi(Bi({},e),t)),()=>{}):r.isStepper===!0?_fe(e,t,r,o,a,s):Efe(e,t,r,n,o,a,s)};var W2=1e-4,u$=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],d$=(e,t)=>e.map((r,n)=>r*t**n).reduce((r,n)=>r+n),hR=(e,t)=>r=>{var n=u$(e,t);return d$(n,r)},Pfe=(e,t)=>r=>{var n=u$(e,t),a=[...n.map((s,o)=>s*o).slice(1),0];return d$(a,r)},Dfe=e=>{var t,r=e.split("(");if(r.length!==2||r[0]!=="cubic-bezier")return null;var n=(t=r[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(n==null||n.length!==4)return null;var a=n.map(s=>parseFloat(s));return[a[0],a[1],a[2],a[3]]},Ofe=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(r.length===1)switch(r[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:{var a=Dfe(r[0]);if(a)return a}}return r.length===4?r:[0,0,1,1]},Rfe=(e,t,r,n)=>{var a=hR(e,r),s=hR(t,n),o=Pfe(e,r),l=d=>d>1?1:d<0?0:d,u=d=>{for(var f=d>1?1:d,m=f,g=0;g<8;++g){var x=a(m)-f,y=o(m);if(Math.abs(x-f)<W2||y<W2)return s(m);m=l(m-x/y)}return s(m)};return u.isStepper=!1,u},mR=function(){return Rfe(...Ofe(...arguments))},Mfe=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:r=100,damping:n=8,dt:a=17}=t,s=(o,l,u)=>{var d=-(o-l)*r,f=u*n,m=u+(d-f)*a/1e3,g=u*a/1e3+o;return Math.abs(g-l)<W2&&Math.abs(m)<W2?[l,0]:[g,m]};return s.isStepper=!0,s.dt=a,s},Lfe=e=>{if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return mR(e);case"spring":return Mfe();default:if(e.split("(")[0]==="cubic-bezier")return mR(e)}return typeof e=="function"?e:null};function Ife(e){var t,r=()=>null,n=!1,a=null,s=o=>{if(!n){if(Array.isArray(o)){if(!o.length)return;var l=o,[u,...d]=l;if(typeof u=="number"){a=e.setTimeout(s.bind(null,d),u);return}s(u),a=e.setTimeout(s.bind(null,d));return}typeof o=="string"&&(t=o,r(t)),typeof o=="object"&&(t=o,r(t)),typeof o=="function"&&o()}};return{stop:()=>{n=!0},start:o=>{n=!1,a&&(a(),a=null),s(o)},subscribe:o=>(r=o,()=>{r=()=>null}),getTimeoutController:()=>e}}class Ffe{setTimeout(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),a=null,s=o=>{o-n>=r?t(o):typeof requestAnimationFrame=="function"&&(a=requestAnimationFrame(s))};return a=requestAnimationFrame(s),()=>{a!=null&&cancelAnimationFrame(a)}}}function Bfe(){return Ife(new Ffe)}var zfe=N.createContext(Bfe);function Ufe(e,t){var r=N.useContext(zfe);return N.useMemo(()=>t??r(e),[e,t,r])}var $fe={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},pR={t:0},Q4={t:1};function kx(e){var t=mi(e,$fe),{isActive:r,canBegin:n,duration:a,easing:s,begin:o,onAnimationEnd:l,onAnimationStart:u,children:d}=t,f=s$(),m=r==="auto"?!y1.isSsr&&!f:r,g=Ufe(t.animationId,t.animationManager),[x,y]=N.useState(m?pR:Q4),v=N.useRef(null);return N.useEffect(()=>{m||y(Q4)},[m]),N.useEffect(()=>{if(!m||!n)return Mh;var w=Tfe(pR,Q4,Lfe(s),a,y,g.getTimeoutController()),j=()=>{v.current=w()};return g.start([u,o,j,a,l]),()=>{g.stop(),v.current&&v.current(),l()}},[m,n,a,s,o,u,l,g]),d(x.t)}function Cx(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",r=N.useRef(_v(t)),n=N.useRef(e);return n.current!==e&&(r.current=_v(t),n.current=e),r.current}var Hfe=["radius"],Vfe=["radius"],xR,gR,vR,yR,bR,wR,jR,NR,SR,AR;function kR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function CR(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?kR(Object(r),!0).forEach(function(n){qfe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qfe(e,t,r){return(t=Wfe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wfe(e){var t=Gfe(e,"string");return typeof t=="symbol"?t:t+""}function Gfe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function G2(){return G2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},G2.apply(null,arguments)}function _R(e,t){if(e==null)return{};var r,n,a=Yfe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Yfe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function gu(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ER=(e,t,r,n,a)=>{var s=ch(r),o=ch(n),l=Math.min(Math.abs(s)/2,Math.abs(o)/2),u=o>=0?1:-1,d=s>=0?1:-1,f=o>=0&&s>=0||o<0&&s<0?1:0,m;if(l>0&&Array.isArray(a)){for(var g=[0,0,0,0],x=0,y=4;x<y;x++){var v,w=(v=a[x])!==null&&v!==void 0?v:0;g[x]=w>l?l:w}m=Qa(xR||(xR=gu(["M",",",""])),e,t+u*g[0]),g[0]>0&&(m+=Qa(gR||(gR=gu(["A ",",",",0,0,",",",",",""])),g[0],g[0],f,e+d*g[0],t)),m+=Qa(vR||(vR=gu(["L ",",",""])),e+r-d*g[1],t),g[1]>0&&(m+=Qa(yR||(yR=gu(["A ",",",",0,0,",`,
        `,",",""])),g[1],g[1],f,e+r,t+u*g[1])),m+=Qa(bR||(bR=gu(["L ",",",""])),e+r,t+n-u*g[2]),g[2]>0&&(m+=Qa(wR||(wR=gu(["A ",",",",0,0,",`,
        `,",",""])),g[2],g[2],f,e+r-d*g[2],t+n)),m+=Qa(jR||(jR=gu(["L ",",",""])),e+d*g[3],t+n),g[3]>0&&(m+=Qa(NR||(NR=gu(["A ",",",",0,0,",`,
        `,",",""])),g[3],g[3],f,e,t+n-u*g[3])),m+="Z"}else if(l>0&&a===+a&&a>0){var j=Math.min(l,a);m=Qa(SR||(SR=gu(["M ",",",`
            A `,",",",0,0,",",",",",`
            L `,",",`
            A `,",",",0,0,",",",",",`
            L `,",",`
            A `,",",",0,0,",",",",",`
            L `,",",`
            A `,",",",0,0,",",",","," Z"])),e,t+u*j,j,j,f,e+d*j,t,e+r-d*j,t,j,j,f,e+r,t+u*j,e+r,t+n-u*j,j,j,f,e+r-d*j,t+n,e+d*j,t+n,j,j,f,e,t+n-u*j)}else m=Qa(AR||(AR=gu(["M ",","," h "," v "," h "," Z"])),e,t,r,n,-r);return m},TR={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},f$=e=>{var t=mi(e,TR),r=N.useRef(null),[n,a]=N.useState(-1);N.useEffect(()=>{if(r.current&&r.current.getTotalLength)try{var ne=r.current.getTotalLength();ne&&a(ne)}catch{}},[]);var{x:s,y:o,width:l,height:u,radius:d,className:f}=t,{animationEasing:m,animationDuration:g,animationBegin:x,isAnimationActive:y,isUpdateAnimationActive:v}=t,w=N.useRef(l),j=N.useRef(u),k=N.useRef(s),A=N.useRef(o),T=N.useMemo(()=>({x:s,y:o,width:l,height:u,radius:d}),[s,o,l,u,d]),M=Cx(T,"rectangle-");if(s!==+s||o!==+o||l!==+l||u!==+u||l===0||u===0)return null;var B=mn("recharts-rectangle",f);if(!v){var L=Gs(t),{radius:F}=L,I=_R(L,Hfe);return N.createElement("path",G2({},I,{x:ch(s),y:ch(o),width:ch(l),height:ch(u),radius:typeof d=="number"?d:void 0,className:B,d:ER(s,o,l,u,d)}))}var q=w.current,P=j.current,R=k.current,K=A.current,ee="0px ".concat(n===-1?1:n,"px"),se="".concat(n,"px ").concat(n,"px"),Z=l$(["strokeDasharray"],g,typeof m=="string"?m:TR.animationEasing);return N.createElement(kx,{animationId:M,key:M,canBegin:n>0,duration:g,easing:m,isActive:v,begin:x},ne=>{var X=Rn(q,l,ne),le=Rn(P,u,ne),Ae=Rn(R,s,ne),ce=Rn(K,o,ne);r.current&&(w.current=X,j.current=le,k.current=Ae,A.current=ce);var D;y?ne>0?D={transition:Z,strokeDasharray:se}:D={strokeDasharray:ee}:D={strokeDasharray:se};var H=Gs(t),{radius:G}=H,E=_R(H,Vfe);return N.createElement("path",G2({},E,{radius:typeof d=="number"?d:void 0,className:B,d:ER(Ae,ce,X,le,d),ref:r,style:CR(CR({},D),t.style)}))})};function PR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function DR(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?PR(Object(r),!0).forEach(function(n){Kfe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Kfe(e,t,r){return(t=Xfe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xfe(e){var t=Zfe(e,"string");return typeof t=="symbol"?t:t+""}function Zfe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Y2=Math.PI/180,Jfe=e=>e*180/Math.PI,Si=(e,t,r,n)=>({x:e+Math.cos(-Y2*n)*r,y:t+Math.sin(-Y2*n)*r}),h$=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},Qfe=(e,t)=>{var{x:r,y:n}=e,{x:a,y:s}=t;return Math.sqrt((r-a)**2+(n-s)**2)},ehe=(e,t)=>{var{x:r,y:n}=e,{cx:a,cy:s}=t,o=Qfe({x:r,y:n},{x:a,y:s});if(o<=0)return{radius:o,angle:0};var l=(r-a)/o,u=Math.acos(l);return n>s&&(u=2*Math.PI-u),{radius:o,angle:Jfe(u),angleInRadian:u}},the=e=>{var{startAngle:t,endAngle:r}=e,n=Math.floor(t/360),a=Math.floor(r/360),s=Math.min(n,a);return{startAngle:t-s*360,endAngle:r-s*360}},rhe=(e,t)=>{var{startAngle:r,endAngle:n}=t,a=Math.floor(r/360),s=Math.floor(n/360),o=Math.min(a,s);return e+o*360},nhe=(e,t)=>{var{relativeX:r,relativeY:n}=e,{radius:a,angle:s}=ehe({x:r,y:n},t),{innerRadius:o,outerRadius:l}=t;if(a<o||a>l||a===0)return null;var{startAngle:u,endAngle:d}=the(t),f=s,m;if(u<=d){for(;f>d;)f-=360;for(;f<u;)f+=360;m=f>=u&&f<=d}else{for(;f>u;)f-=360;for(;f<d;)f+=360;m=f>=d&&f<=u}return m?DR(DR({},t),{},{radius:a,angle:rhe(f,t)}):null};function m$(e){var{cx:t,cy:r,radius:n,startAngle:a,endAngle:s}=e,o=Si(t,r,n,a),l=Si(t,r,n,s);return{points:[o,l],cx:t,cy:r,radius:n,startAngle:a,endAngle:s}}var OR,RR,MR,LR,IR,FR,BR;function jA(){return jA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jA.apply(null,arguments)}function Pm(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ahe=(e,t)=>{var r=cs(t-e),n=Math.min(Math.abs(t-e),359.999);return r*n},Qy=e=>{var{cx:t,cy:r,radius:n,angle:a,sign:s,isExternal:o,cornerRadius:l,cornerIsExternal:u}=e,d=l*(o?1:-1)+n,f=Math.asin(l/d)/Y2,m=u?a:a+s*f,g=Si(t,r,d,m),x=Si(t,r,n,m),y=u?a-s*f:a,v=Si(t,r,d*Math.cos(f*Y2),y);return{center:g,circleTangency:x,lineTangency:v,theta:f}},p$=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:a,startAngle:s,endAngle:o}=e,l=ahe(s,o),u=s+l,d=Si(t,r,a,s),f=Si(t,r,a,u),m=Qa(OR||(OR=Pm(["M ",",",`
    A `,",",`,0,
    `,",",`,
    `,",",`
  `])),d.x,d.y,a,a,+(Math.abs(l)>180),+(s>u),f.x,f.y);if(n>0){var g=Si(t,r,n,s),x=Si(t,r,n,u);m+=Qa(RR||(RR=Pm(["L ",",",`
            A `,",",`,0,
            `,",",`,
            `,","," Z"])),x.x,x.y,n,n,+(Math.abs(l)>180),+(s<=u),g.x,g.y)}else m+=Qa(MR||(MR=Pm(["L ",","," Z"])),t,r);return m},ihe=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:a,cornerRadius:s,forceCornerRadius:o,cornerIsExternal:l,startAngle:u,endAngle:d}=e,f=cs(d-u),{circleTangency:m,lineTangency:g,theta:x}=Qy({cx:t,cy:r,radius:a,angle:u,sign:f,cornerRadius:s,cornerIsExternal:l}),{circleTangency:y,lineTangency:v,theta:w}=Qy({cx:t,cy:r,radius:a,angle:d,sign:-f,cornerRadius:s,cornerIsExternal:l}),j=l?Math.abs(u-d):Math.abs(u-d)-x-w;if(j<0)return o?Qa(LR||(LR=Pm(["M ",",",`
        a`,",",",0,0,1,",`,0
        a`,",",",0,0,1,",`,0
      `])),g.x,g.y,s,s,s*2,s,s,-s*2):p$({cx:t,cy:r,innerRadius:n,outerRadius:a,startAngle:u,endAngle:d});var k=Qa(IR||(IR=Pm(["M ",",",`
    A`,",",",0,0,",",",",",`
    A`,",",",0,",",",",",",",`
    A`,",",",0,0,",",",",",`
  `])),g.x,g.y,s,s,+(f<0),m.x,m.y,a,a,+(j>180),+(f<0),y.x,y.y,s,s,+(f<0),v.x,v.y);if(n>0){var{circleTangency:A,lineTangency:T,theta:M}=Qy({cx:t,cy:r,radius:n,angle:u,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),{circleTangency:B,lineTangency:L,theta:F}=Qy({cx:t,cy:r,radius:n,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),I=l?Math.abs(u-d):Math.abs(u-d)-M-F;if(I<0&&s===0)return"".concat(k,"L").concat(t,",").concat(r,"Z");k+=Qa(FR||(FR=Pm(["L",",",`
      A`,",",",0,0,",",",",",`
      A`,",",",0,",",",",",",",`
      A`,",",",0,0,",",",",","Z"])),L.x,L.y,s,s,+(f<0),B.x,B.y,n,n,+(I>180),+(f>0),A.x,A.y,s,s,+(f<0),T.x,T.y)}else k+=Qa(BR||(BR=Pm(["L",",","Z"])),t,r);return k},she={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},x$=e=>{var t=mi(e,she),{cx:r,cy:n,innerRadius:a,outerRadius:s,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:u,startAngle:d,endAngle:f,className:m}=t;if(s<a||d===f)return null;var g=mn("recharts-sector",m),x=s-a,y=qs(o,x,0,!0),v;return y>0&&Math.abs(d-f)<360?v=ihe({cx:r,cy:n,innerRadius:a,outerRadius:s,cornerRadius:Math.min(y,x/2),forceCornerRadius:l,cornerIsExternal:u,startAngle:d,endAngle:f}):v=p$({cx:r,cy:n,innerRadius:a,outerRadius:s,startAngle:d,endAngle:f}),N.createElement("path",jA({},Gs(t),{className:g,d:v}))};function ohe(e,t,r){if(e==="horizontal")return[{x:t.x,y:r.top},{x:t.x,y:r.top+r.height}];if(e==="vertical")return[{x:r.left,y:t.y},{x:r.left+r.width,y:t.y}];if(qz(t)){if(e==="centric"){var{cx:n,cy:a,innerRadius:s,outerRadius:o,angle:l}=t,u=Si(n,a,s,l),d=Si(n,a,o,l);return[{x:u.x,y:u.y},{x:d.x,y:d.y}]}return m$(t)}}var eS={},tS={},rS={},zR;function lhe(){return zR||(zR=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=aU();function r(n){return t.isSymbol(n)?NaN:Number(n)}e.toNumber=r})(rS)),rS}var UR;function che(){return UR||(UR=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=lhe();function r(n){return n?(n=t.toNumber(n),n===1/0||n===-1/0?(n<0?-1:1)*Number.MAX_VALUE:n===n?n:0):n===0?n:0}e.toFinite=r})(tS)),tS}var $R;function uhe(){return $R||($R=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=iU(),r=che();function n(a,s,o){o&&typeof o!="number"&&t.isIterateeCall(a,s,o)&&(s=o=void 0),a=r.toFinite(a),s===void 0?(s=a,a=0):s=r.toFinite(s),o=o===void 0?a<s?1:-1:r.toFinite(o);const l=Math.max(Math.ceil((s-a)/(o||1)),0),u=new Array(l);for(let d=0;d<l;d++)u[d]=a,a+=o;return u}e.range=n})(eS)),eS}var nS,HR;function dhe(){return HR||(HR=1,nS=uhe().range),nS}var fhe=dhe();const g$=af(fhe);var zc=e=>e.chartData,b1=nt([zc],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),w1=(e,t,r,n)=>n?b1(e):zc(e),v$=(e,t,r)=>r?b1(e):zc(e),hhe=nt([w1],e=>{var{chartData:t,dataStartIndex:r,dataEndIndex:n}=e;return t!=null?t.slice(r,n+1):[]}),mhe=nt([b1],e=>{var{chartData:t,dataStartIndex:r,dataEndIndex:n}=e;return t!=null?t.slice(r,n+1):[]}),phe=nt([zc],e=>{var{chartData:t,dataStartIndex:r,dataEndIndex:n}=e;return t!=null?t.slice(r,n+1):[]});function Fu(e){if(Array.isArray(e)&&e.length===2){var[t,r]=e;if(Kr(t)&&Kr(r))return!0}return!1}function VR(e,t,r){return r?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function y$(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[r,n]=e,a,s;if(Kr(r))a=r;else if(typeof r=="function")return;if(Kr(n))s=n;else if(typeof n=="function")return;var o=[a,s];if(Fu(o))return o}}function xhe(e,t,r){if(!(!r&&t==null)){if(typeof e=="function"&&t!=null)try{var n=e(t,r);if(Fu(n))return VR(n,t,r)}catch{}if(Array.isArray(e)&&e.length===2){var[a,s]=e,o,l;if(a==="auto")t!=null&&(o=Math.min(...t));else if(Zt(a))o=a;else if(typeof a=="function")try{t!=null&&(o=a(t==null?void 0:t[0]))}catch{}else if(typeof a=="string"&&OO.test(a)){var u=OO.exec(a);if(u==null||u[1]==null||t==null)o=void 0;else{var d=+u[1];o=t[0]-d}}else o=t==null?void 0:t[0];if(s==="auto")t!=null&&(l=Math.max(...t));else if(Zt(s))l=s;else if(typeof s=="function")try{t!=null&&(l=s(t==null?void 0:t[1]))}catch{}else if(typeof s=="string"&&RO.test(s)){var f=RO.exec(s);if(f==null||f[1]==null||t==null)l=void 0;else{var m=+f[1];l=t[1]+m}}else l=t==null?void 0:t[1];var g=[o,l];if(Fu(g))return t==null?g:VR(g,t,r)}}}var _x=1e9,ghe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},PC,Oa=!0,Yl="[DecimalError] ",zm=Yl+"Invalid argument: ",TC=Yl+"Exponent out of range: ",Ex=Math.floor,Am=Math.pow,vhe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ll,as=1e7,va=7,b$=9007199254740991,K2=Ex(b$/va),sr={};sr.absoluteValue=sr.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};sr.comparedTo=sr.cmp=function(e){var t,r,n,a,s=this;if(e=new s.constructor(e),s.s!==e.s)return s.s||-e.s;if(s.e!==e.e)return s.e>e.e^s.s<0?1:-1;for(n=s.d.length,a=e.d.length,t=0,r=n<a?n:a;t<r;++t)if(s.d[t]!==e.d[t])return s.d[t]>e.d[t]^s.s<0?1:-1;return n===a?0:n>a^s.s<0?1:-1};sr.decimalPlaces=sr.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*va;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};sr.dividedBy=sr.div=function(e){return qd(this,new this.constructor(e))};sr.dividedToIntegerBy=sr.idiv=function(e){var t=this,r=t.constructor;return sa(qd(t,new r(e),0,1),r.precision)};sr.equals=sr.eq=function(e){return!this.cmp(e)};sr.exponent=function(){return Ai(this)};sr.greaterThan=sr.gt=function(e){return this.cmp(e)>0};sr.greaterThanOrEqualTo=sr.gte=function(e){return this.cmp(e)>=0};sr.isInteger=sr.isint=function(){return this.e>this.d.length-2};sr.isNegative=sr.isneg=function(){return this.s<0};sr.isPositive=sr.ispos=function(){return this.s>0};sr.isZero=function(){return this.s===0};sr.lessThan=sr.lt=function(e){return this.cmp(e)<0};sr.lessThanOrEqualTo=sr.lte=function(e){return this.cmp(e)<1};sr.logarithm=sr.log=function(e){var t,r=this,n=r.constructor,a=n.precision,s=a+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(ll))throw Error(Yl+"NaN");if(r.s<1)throw Error(Yl+(r.s?"NaN":"-Infinity"));return r.eq(ll)?new n(0):(Oa=!1,t=qd(Lv(r,s),Lv(e,s),s),Oa=!0,sa(t,a))};sr.minus=sr.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?N$(t,e):w$(t,(e.s=-e.s,e))};sr.modulo=sr.mod=function(e){var t,r=this,n=r.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(Yl+"NaN");return r.s?(Oa=!1,t=qd(r,e,0,1).times(e),Oa=!0,r.minus(t)):sa(new n(r),a)};sr.naturalExponential=sr.exp=function(){return j$(this)};sr.naturalLogarithm=sr.ln=function(){return Lv(this)};sr.negated=sr.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};sr.plus=sr.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?w$(t,e):N$(t,(e.s=-e.s,e))};sr.precision=sr.sd=function(e){var t,r,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(zm+e);if(t=Ai(a)+1,n=a.d.length-1,r=n*va+1,n=a.d[n],n){for(;n%10==0;n/=10)r--;for(n=a.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};sr.squareRoot=sr.sqrt=function(){var e,t,r,n,a,s,o,l=this,u=l.constructor;if(l.s<1){if(!l.s)return new u(0);throw Error(Yl+"NaN")}for(e=Ai(l),Oa=!1,a=Math.sqrt(+l),a==0||a==1/0?(t=Ou(l.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Ex((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new u(t)):n=new u(a.toString()),r=u.precision,a=o=r+3;;)if(s=n,n=s.plus(qd(l,s,o+2)).times(.5),Ou(s.d).slice(0,o)===(t=Ou(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&t=="4999"){if(sa(s,r+1,0),s.times(s).eq(l)){n=s;break}}else if(t!="9999")break;o+=4}return Oa=!0,sa(n,r)};sr.times=sr.mul=function(e){var t,r,n,a,s,o,l,u,d,f=this,m=f.constructor,g=f.d,x=(e=new m(e)).d;if(!f.s||!e.s)return new m(0);for(e.s*=f.s,r=f.e+e.e,u=g.length,d=x.length,u<d&&(s=g,g=x,x=s,o=u,u=d,d=o),s=[],o=u+d,n=o;n--;)s.push(0);for(n=d;--n>=0;){for(t=0,a=u+n;a>n;)l=s[a]+x[n]*g[a-n-1]+t,s[a--]=l%as|0,t=l/as|0;s[a]=(s[a]+t)%as|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=r,Oa?sa(e,m.precision):e};sr.toDecimalPlaces=sr.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Hu(e,0,_x),t===void 0?t=n.rounding:Hu(t,0,8),sa(r,e+Ai(r)+1,t))};sr.toExponential=function(e,t){var r,n=this,a=n.constructor;return e===void 0?r=n0(n,!0):(Hu(e,0,_x),t===void 0?t=a.rounding:Hu(t,0,8),n=sa(new a(n),e+1,t),r=n0(n,!0,e+1)),r};sr.toFixed=function(e,t){var r,n,a=this,s=a.constructor;return e===void 0?n0(a):(Hu(e,0,_x),t===void 0?t=s.rounding:Hu(t,0,8),n=sa(new s(a),e+Ai(a)+1,t),r=n0(n.abs(),!1,e+Ai(n)+1),a.isneg()&&!a.isZero()?"-"+r:r)};sr.toInteger=sr.toint=function(){var e=this,t=e.constructor;return sa(new t(e),Ai(e)+1,t.rounding)};sr.toNumber=function(){return+this};sr.toPower=sr.pow=function(e){var t,r,n,a,s,o,l=this,u=l.constructor,d=12,f=+(e=new u(e));if(!e.s)return new u(ll);if(l=new u(l),!l.s){if(e.s<1)throw Error(Yl+"Infinity");return l}if(l.eq(ll))return l;if(n=u.precision,e.eq(ll))return sa(l,n);if(t=e.e,r=e.d.length-1,o=t>=r,s=l.s,o){if((r=f<0?-f:f)<=b$){for(a=new u(ll),t=Math.ceil(n/va+4),Oa=!1;r%2&&(a=a.times(l),WR(a.d,t)),r=Ex(r/2),r!==0;)l=l.times(l),WR(l.d,t);return Oa=!0,e.s<0?new u(ll).div(a):sa(a,n)}}else if(s<0)throw Error(Yl+"NaN");return s=s<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,Oa=!1,a=e.times(Lv(l,n+d)),Oa=!0,a=j$(a),a.s=s,a};sr.toPrecision=function(e,t){var r,n,a=this,s=a.constructor;return e===void 0?(r=Ai(a),n=n0(a,r<=s.toExpNeg||r>=s.toExpPos)):(Hu(e,1,_x),t===void 0?t=s.rounding:Hu(t,0,8),a=sa(new s(a),e,t),r=Ai(a),n=n0(a,e<=r||r<=s.toExpNeg,e)),n};sr.toSignificantDigits=sr.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Hu(e,1,_x),t===void 0?t=n.rounding:Hu(t,0,8)),sa(new n(r),e,t)};sr.toString=sr.valueOf=sr.val=sr.toJSON=sr[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Ai(e),r=e.constructor;return n0(e,t<=r.toExpNeg||t>=r.toExpPos)};function w$(e,t){var r,n,a,s,o,l,u,d,f=e.constructor,m=f.precision;if(!e.s||!t.s)return t.s||(t=new f(e)),Oa?sa(t,m):t;if(u=e.d,d=t.d,o=e.e,a=t.e,u=u.slice(),s=o-a,s){for(s<0?(n=u,s=-s,l=d.length):(n=d,a=o,l=u.length),o=Math.ceil(m/va),l=o>l?o+1:l+1,s>l&&(s=l,n.length=1),n.reverse();s--;)n.push(0);n.reverse()}for(l=u.length,s=d.length,l-s<0&&(s=l,n=d,d=u,u=n),r=0;s;)r=(u[--s]=u[s]+d[s]+r)/as|0,u[s]%=as;for(r&&(u.unshift(r),++a),l=u.length;u[--l]==0;)u.pop();return t.d=u,t.e=a,Oa?sa(t,m):t}function Hu(e,t,r){if(e!==~~e||e<t||e>r)throw Error(zm+e)}function Ou(e){var t,r,n,a=e.length-1,s="",o=e[0];if(a>0){for(s+=o,t=1;t<a;t++)n=e[t]+"",r=va-n.length,r&&(s+=ih(r)),s+=n;o=e[t],n=o+"",r=va-n.length,r&&(s+=ih(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}var qd=(function(){function e(n,a){var s,o=0,l=n.length;for(n=n.slice();l--;)s=n[l]*a+o,n[l]=s%as|0,o=s/as|0;return o&&n.unshift(o),n}function t(n,a,s,o){var l,u;if(s!=o)u=s>o?1:-1;else for(l=u=0;l<s;l++)if(n[l]!=a[l]){u=n[l]>a[l]?1:-1;break}return u}function r(n,a,s){for(var o=0;s--;)n[s]-=o,o=n[s]<a[s]?1:0,n[s]=o*as+n[s]-a[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,a,s,o){var l,u,d,f,m,g,x,y,v,w,j,k,A,T,M,B,L,F,I=n.constructor,q=n.s==a.s?1:-1,P=n.d,R=a.d;if(!n.s)return new I(n);if(!a.s)throw Error(Yl+"Division by zero");for(u=n.e-a.e,L=R.length,M=P.length,x=new I(q),y=x.d=[],d=0;R[d]==(P[d]||0);)++d;if(R[d]>(P[d]||0)&&--u,s==null?k=s=I.precision:o?k=s+(Ai(n)-Ai(a))+1:k=s,k<0)return new I(0);if(k=k/va+2|0,d=0,L==1)for(f=0,R=R[0],k++;(d<M||f)&&k--;d++)A=f*as+(P[d]||0),y[d]=A/R|0,f=A%R|0;else{for(f=as/(R[0]+1)|0,f>1&&(R=e(R,f),P=e(P,f),L=R.length,M=P.length),T=L,v=P.slice(0,L),w=v.length;w<L;)v[w++]=0;F=R.slice(),F.unshift(0),B=R[0],R[1]>=as/2&&++B;do f=0,l=t(R,v,L,w),l<0?(j=v[0],L!=w&&(j=j*as+(v[1]||0)),f=j/B|0,f>1?(f>=as&&(f=as-1),m=e(R,f),g=m.length,w=v.length,l=t(m,v,g,w),l==1&&(f--,r(m,L<g?F:R,g))):(f==0&&(l=f=1),m=R.slice()),g=m.length,g<w&&m.unshift(0),r(v,m,w),l==-1&&(w=v.length,l=t(R,v,L,w),l<1&&(f++,r(v,L<w?F:R,w))),w=v.length):l===0&&(f++,v=[0]),y[d++]=f,l&&v[0]?v[w++]=P[T]||0:(v=[P[T]],w=1);while((T++<M||v[0]!==void 0)&&k--)}return y[0]||y.shift(),x.e=u,sa(x,o?s+Ai(x)+1:s)}})();function j$(e,t){var r,n,a,s,o,l,u=0,d=0,f=e.constructor,m=f.precision;if(Ai(e)>16)throw Error(TC+Ai(e));if(!e.s)return new f(ll);for(Oa=!1,l=m,o=new f(.03125);e.abs().gte(.1);)e=e.times(o),d+=5;for(n=Math.log(Am(2,d))/Math.LN10*2+5|0,l+=n,r=a=s=new f(ll),f.precision=l;;){if(a=sa(a.times(e),l),r=r.times(++u),o=s.plus(qd(a,r,l)),Ou(o.d).slice(0,l)===Ou(s.d).slice(0,l)){for(;d--;)s=sa(s.times(s),l);return f.precision=m,t==null?(Oa=!0,sa(s,m)):s}s=o}}function Ai(e){for(var t=e.e*va,r=e.d[0];r>=10;r/=10)t++;return t}function aS(e,t,r){if(t>e.LN10.sd())throw Oa=!0,r&&(e.precision=r),Error(Yl+"LN10 precision limit exceeded");return sa(new e(e.LN10),t)}function ih(e){for(var t="";e--;)t+="0";return t}function Lv(e,t){var r,n,a,s,o,l,u,d,f,m=1,g=10,x=e,y=x.d,v=x.constructor,w=v.precision;if(x.s<1)throw Error(Yl+(x.s?"NaN":"-Infinity"));if(x.eq(ll))return new v(0);if(t==null?(Oa=!1,d=w):d=t,x.eq(10))return t==null&&(Oa=!0),aS(v,d);if(d+=g,v.precision=d,r=Ou(y),n=r.charAt(0),s=Ai(x),Math.abs(s)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)x=x.times(e),r=Ou(x.d),n=r.charAt(0),m++;s=Ai(x),n>1?(x=new v("0."+r),s++):x=new v(n+"."+r.slice(1))}else return u=aS(v,d+2,w).times(s+""),x=Lv(new v(n+"."+r.slice(1)),d-g).plus(u),v.precision=w,t==null?(Oa=!0,sa(x,w)):x;for(l=o=x=qd(x.minus(ll),x.plus(ll),d),f=sa(x.times(x),d),a=3;;){if(o=sa(o.times(f),d),u=l.plus(qd(o,new v(a),d)),Ou(u.d).slice(0,d)===Ou(l.d).slice(0,d))return l=l.times(2),s!==0&&(l=l.plus(aS(v,d+2,w).times(s+""))),l=qd(l,new v(m),d),v.precision=w,t==null?(Oa=!0,sa(l,w)):l;l=u,a+=2}}function qR(e,t){var r,n,a;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(n,a),t){if(a-=n,r=r-n-1,e.e=Ex(r/va),e.d=[],n=(r+1)%va,r<0&&(n+=va),n<a){for(n&&e.d.push(+t.slice(0,n)),a-=va;n<a;)e.d.push(+t.slice(n,n+=va));t=t.slice(n),n=va-t.length}else n-=a;for(;n--;)t+="0";if(e.d.push(+t),Oa&&(e.e>K2||e.e<-K2))throw Error(TC+r)}else e.s=0,e.e=0,e.d=[0];return e}function sa(e,t,r){var n,a,s,o,l,u,d,f,m=e.d;for(o=1,s=m[0];s>=10;s/=10)o++;if(n=t-o,n<0)n+=va,a=t,d=m[f=0];else{if(f=Math.ceil((n+1)/va),s=m.length,f>=s)return e;for(d=s=m[f],o=1;s>=10;s/=10)o++;n%=va,a=n-va+o}if(r!==void 0&&(s=Am(10,o-a-1),l=d/s%10|0,u=t<0||m[f+1]!==void 0||d%s,u=r<4?(l||u)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||u||r==6&&(n>0?a>0?d/Am(10,o-a):0:m[f-1])%10&1||r==(e.s<0?8:7))),t<1||!m[0])return u?(s=Ai(e),m.length=1,t=t-s-1,m[0]=Am(10,(va-t%va)%va),e.e=Ex(-t/va)||0):(m.length=1,m[0]=e.e=e.s=0),e;if(n==0?(m.length=f,s=1,f--):(m.length=f+1,s=Am(10,va-n),m[f]=a>0?(d/Am(10,o-a)%Am(10,a)|0)*s:0),u)for(;;)if(f==0){(m[0]+=s)==as&&(m[0]=1,++e.e);break}else{if(m[f]+=s,m[f]!=as)break;m[f--]=0,s=1}for(n=m.length;m[--n]===0;)m.pop();if(Oa&&(e.e>K2||e.e<-K2))throw Error(TC+Ai(e));return e}function N$(e,t){var r,n,a,s,o,l,u,d,f,m,g=e.constructor,x=g.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new g(e),Oa?sa(t,x):t;if(u=e.d,m=t.d,n=t.e,d=e.e,u=u.slice(),o=d-n,o){for(f=o<0,f?(r=u,o=-o,l=m.length):(r=m,n=d,l=u.length),a=Math.max(Math.ceil(x/va),l)+2,o>a&&(o=a,r.length=1),r.reverse(),a=o;a--;)r.push(0);r.reverse()}else{for(a=u.length,l=m.length,f=a<l,f&&(l=a),a=0;a<l;a++)if(u[a]!=m[a]){f=u[a]<m[a];break}o=0}for(f&&(r=u,u=m,m=r,t.s=-t.s),l=u.length,a=m.length-l;a>0;--a)u[l++]=0;for(a=m.length;a>o;){if(u[--a]<m[a]){for(s=a;s&&u[--s]===0;)u[s]=as-1;--u[s],u[a]+=as}u[a]-=m[a]}for(;u[--l]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(t.d=u,t.e=n,Oa?sa(t,x):t):new g(0)}function n0(e,t,r){var n,a=Ai(e),s=Ou(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+ih(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(a<0?"e":"e+")+a):a<0?(s="0."+ih(-a-1)+s,r&&(n=r-o)>0&&(s+=ih(n))):a>=o?(s+=ih(a+1-o),r&&(n=r-a-1)>0&&(s=s+"."+ih(n))):((n=a+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(a+1===o&&(s+="."),s+=ih(n))),e.s<0?"-"+s:s}function WR(e,t){if(e.length>t)return e.length=t,!0}function S$(e){var t,r,n;function a(s){var o=this;if(!(o instanceof a))return new a(s);if(o.constructor=a,s instanceof a){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(zm+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return qR(o,s.toString())}else if(typeof s!="string")throw Error(zm+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,vhe.test(s))qR(o,s);else throw Error(zm+s)}if(a.prototype=sr,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=S$,a.config=a.set=yhe,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return a.config(e),a}function yhe(e){if(!e||typeof e!="object")throw Error(Yl+"Object expected");var t,r,n,a=["precision",1,_x,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if((n=e[r=a[t]])!==void 0)if(Ex(n)===n&&n>=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(zm+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(zm+r+": "+n);return this}var PC=S$(ghe);ll=new PC(1);const cn=PC;function A$(e){var t;return e===0?t=1:t=Math.floor(new cn(e).abs().log(10).toNumber())+1,t}function k$(e,t,r){for(var n=new cn(e),a=0,s=[];n.lt(t)&&a<1e5;)s.push(n.toNumber()),n=n.add(r),a++;return s}var C$=e=>{var[t,r]=e,[n,a]=[t,r];return t>r&&([n,a]=[r,t]),[n,a]},DC=(e,t,r)=>{if(e.lte(0))return new cn(0);var n=A$(e.toNumber()),a=new cn(10).pow(n),s=e.div(a),o=n!==1?.05:.1,l=new cn(Math.ceil(s.div(o).toNumber())).add(r).mul(o),u=l.mul(a);return t?new cn(u.toNumber()):new cn(Math.ceil(u.toNumber()))},_$=(e,t,r)=>{var n;if(e.lte(0))return new cn(0);var a=[1,2,2.5,5],s=e.toNumber(),o=Math.floor(new cn(s).abs().log(10).toNumber()),l=new cn(10).pow(o),u=e.div(l).toNumber(),d=a.findIndex(x=>x>=u-1e-10);if(d===-1&&(l=l.mul(10),d=0),d+=r,d>=a.length){var f=Math.floor(d/a.length);d%=a.length,l=l.mul(new cn(10).pow(f))}var m=(n=a[d])!==null&&n!==void 0?n:1,g=new cn(m).mul(l);return t?g:new cn(Math.ceil(g.toNumber()))},bhe=(e,t,r)=>{var n=new cn(1),a=new cn(e);if(!a.isint()&&r){var s=Math.abs(e);s<1?(n=new cn(10).pow(A$(e)-1),a=new cn(Math.floor(a.div(n).toNumber())).mul(n)):s>1&&(a=new cn(Math.floor(e)))}else e===0?a=new cn(Math.floor((t-1)/2)):r||(a=new cn(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],u=0;u<t;u++)l.push(a.add(new cn(u-o).mul(n)).toNumber());return l},E$=function(t,r,n,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:DC;if(!Number.isFinite((r-t)/(n-1)))return{step:new cn(0),tickMin:new cn(0),tickMax:new cn(0)};var l=o(new cn(r).sub(t).div(n-1),a,s),u;t<=0&&r>=0?u=new cn(0):(u=new cn(t).add(r).div(2),u=u.sub(new cn(u).mod(l)));var d=Math.ceil(u.sub(t).div(l).toNumber()),f=Math.ceil(new cn(r).sub(u).div(l).toNumber()),m=d+f+1;return m>n?E$(t,r,n,a,s+1,o):(m<n&&(f=r>0?f+(n-m):f,d=r>0?d:d+(n-m)),{step:l,tickMin:u.sub(new cn(d).mul(l)),tickMax:u.add(new cn(f).mul(l))})},GR=function(t){var[r,n]=t,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(a,2),[u,d]=C$([r,n]);if(u===-1/0||d===1/0){var f=d===1/0?[u,...Array(a-1).fill(1/0)]:[...Array(a-1).fill(-1/0),d];return r>n?f.reverse():f}if(u===d)return bhe(u,a,s);var m=o==="snap125"?_$:DC,{step:g,tickMin:x,tickMax:y}=E$(u,d,l,s,0,m),v=k$(x,y.add(new cn(.1).mul(g)),g);return r>n?v.reverse():v},YR=function(t,r){var[n,a]=t,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",[l,u]=C$([n,a]);if(l===-1/0||u===1/0)return[n,a];if(l===u)return[l];var d=o==="snap125"?_$:DC,f=Math.max(r,2),m=d(new cn(u).sub(l).div(f-1),s,0),g=[...k$(new cn(l),new cn(u),m),u];return s===!1&&(g=g.map(x=>Math.round(x))),n>a?g.reverse():g},T$=e=>e.rootProps.maxBarSize,whe=e=>e.rootProps.barGap,P$=e=>e.rootProps.barCategoryGap,jhe=e=>e.rootProps.barSize,j1=e=>e.rootProps.stackOffset,D$=e=>e.rootProps.reverseStackOrder,OC=e=>e.options.chartName,RC=e=>e.rootProps.syncId,O$=e=>e.rootProps.syncMethod,MC=e=>e.options.eventEmitter,Nhe=e=>e.rootProps.baseValue,fi={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},gm={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},vu={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},g5=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function v5(e,t,r){if(r!=="auto")return r;if(e!=null)return Bc(e,t)?"category":"number"}function KR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function X2(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KR(Object(r),!0).forEach(function(n){She(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function She(e,t,r){return(t=Ahe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ahe(e){var t=khe(e,"string");return typeof t=="symbol"?t:t+""}function khe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var XR={allowDataOverflow:gm.allowDataOverflow,allowDecimals:gm.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:gm.angleAxisId,includeHidden:!1,name:void 0,reversed:gm.reversed,scale:gm.scale,tick:gm.tick,tickCount:void 0,ticks:void 0,type:gm.type,unit:void 0,niceTicks:"auto"},ZR={allowDataOverflow:vu.allowDataOverflow,allowDecimals:vu.allowDecimals,allowDuplicatedCategory:vu.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:vu.radiusAxisId,includeHidden:vu.includeHidden,name:void 0,reversed:vu.reversed,scale:vu.scale,tick:vu.tick,tickCount:vu.tickCount,ticks:void 0,type:vu.type,unit:void 0,niceTicks:"auto"},Che=(e,t)=>{if(t!=null)return e.polarAxis.angleAxis[t]},LC=nt([Che,YU],(e,t)=>{var r;if(e!=null)return e;var n=(r=v5(t,"angleAxis",XR.type))!==null&&r!==void 0?r:"category";return X2(X2({},XR),{},{type:n})}),_he=(e,t)=>e.polarAxis.radiusAxis[t],IC=nt([_he,YU],(e,t)=>{var r;if(e!=null)return e;var n=(r=v5(t,"radiusAxis",ZR.type))!==null&&r!==void 0?r:"category";return X2(X2({},ZR),{},{type:n})}),y5=e=>e.polarOptions,FC=nt([of,lf,Vi],h$),R$=nt([y5,FC],(e,t)=>{if(e!=null)return qs(e.innerRadius,t,0)}),M$=nt([y5,FC],(e,t)=>{if(e!=null)return qs(e.outerRadius,t,t*.8)}),Ehe=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:r}=e;return[t,r]},L$=nt([y5],Ehe);nt([LC,L$],g5);var I$=nt([FC,R$,M$],(e,t,r)=>{if(!(e==null||t==null||r==null))return[t,r]});nt([IC,I$],g5);var F$=nt([un,y5,R$,M$,of,lf],(e,t,r,n,a,s)=>{if(!(e!=="centric"&&e!=="radial"||t==null||r==null||n==null)){var{cx:o,cy:l,startAngle:u,endAngle:d}=t;return{cx:qs(o,a,a/2),cy:qs(l,s,s/2),innerRadius:r,outerRadius:n,startAngle:u,endAngle:d,clockWise:!1}}}),za=(e,t)=>t,N1=(e,t,r)=>r;function b5(e){return e==null?void 0:e.id}function B$(e,t,r){var{chartData:n=[]}=t,{allowDuplicatedCategory:a,dataKey:s}=r,o=new Map;return e.forEach(l=>{var u,d=(u=l.data)!==null&&u!==void 0?u:n;if(!(d==null||d.length===0)){var f=b5(l);d.forEach((m,g)=>{var x=s==null||a?g:String(Nn(m,s,null)),y=Nn(m,l.dataKey,0),v;o.has(x)?v=o.get(x):v={},Object.assign(v,{[f]:y}),o.set(x,v)})}}),Array.from(o.values())}function w5(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var j5=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function N5(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function The(e,t){if(e.length===t.length){for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return!1}var ms=e=>{var t=un(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},Tx=e=>e.tooltip.settings.axisId;function BC(e){if(e!=null){var t=e.ticks,r=e.bandwidth,n=e.range(),a=[Math.min(...n),Math.max(...n)];return{domain:()=>e.domain(),range:(function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o})(()=>a),rangeMin:()=>a[0],rangeMax:()=>a[1],isInRange(s){var o=a[0],l=a[1];return o<=l?s>=o&&s<=l:s>=l&&s<=o},bandwidth:r?()=>r.call(e):void 0,ticks:t?s=>t.call(e,s):void 0,map:(s,o)=>{var l=e(s);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var u=e.bandwidth();switch(o.position){case"middle":l+=u/2;break;case"end":l+=u;break}}return l}}}}}var z$=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Fu(t)){for(var r,n,a=0;a<t.length;a++){var s=t[a];Kr(s)&&((r===void 0||s<r)&&(r=s),(n===void 0||s>n)&&(n=s))}return r!==void 0&&n!==void 0?[r,n]:void 0}return t}default:return t}};function gh(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Phe(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function zC(e){let t,r,n;e.length!==2?(t=gh,r=(l,u)=>gh(e(l),u),n=(l,u)=>e(l)-u):(t=e===gh||e===Phe?e:Dhe,r=e,n=e);function a(l,u,d=0,f=l.length){if(d<f){if(t(u,u)!==0)return f;do{const m=d+f>>>1;r(l[m],u)<0?d=m+1:f=m}while(d<f)}return d}function s(l,u,d=0,f=l.length){if(d<f){if(t(u,u)!==0)return f;do{const m=d+f>>>1;r(l[m],u)<=0?d=m+1:f=m}while(d<f)}return d}function o(l,u,d=0,f=l.length){const m=a(l,u,d,f-1);return m>d&&n(l[m-1],u)>-n(l[m],u)?m-1:m}return{left:a,center:o,right:s}}function Dhe(){return 0}function U$(e){return e===null?NaN:+e}function*Ohe(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const Rhe=zC(gh),S1=Rhe.right;zC(U$).center;class JR extends Map{constructor(t,r=Ihe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,a]of t)this.set(n,a)}get(t){return super.get(QR(this,t))}has(t){return super.has(QR(this,t))}set(t,r){return super.set(Mhe(this,t),r)}delete(t){return super.delete(Lhe(this,t))}}function QR({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function Mhe({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function Lhe({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function Ihe(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Fhe(e=gh){if(e===gh)return $$;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function $$(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Bhe=Math.sqrt(50),zhe=Math.sqrt(10),Uhe=Math.sqrt(2);function Z2(e,t,r){const n=(t-e)/Math.max(0,r),a=Math.floor(Math.log10(n)),s=n/Math.pow(10,a),o=s>=Bhe?10:s>=zhe?5:s>=Uhe?2:1;let l,u,d;return a<0?(d=Math.pow(10,-a)/o,l=Math.round(e*d),u=Math.round(t*d),l/d<e&&++l,u/d>t&&--u,d=-d):(d=Math.pow(10,a)*o,l=Math.round(e/d),u=Math.round(t/d),l*d<e&&++l,u*d>t&&--u),u<l&&.5<=r&&r<2?Z2(e,t,r*2):[l,u,d]}function NA(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const n=t<e,[a,s,o]=n?Z2(t,e,r):Z2(e,t,r);if(!(s>=a))return[];const l=s-a+1,u=new Array(l);if(n)if(o<0)for(let d=0;d<l;++d)u[d]=(s-d)/-o;else for(let d=0;d<l;++d)u[d]=(s-d)*o;else if(o<0)for(let d=0;d<l;++d)u[d]=(a+d)/-o;else for(let d=0;d<l;++d)u[d]=(a+d)*o;return u}function SA(e,t,r){return t=+t,e=+e,r=+r,Z2(e,t,r)[2]}function AA(e,t,r){t=+t,e=+e,r=+r;const n=t<e,a=n?SA(t,e,r):SA(e,t,r);return(n?-1:1)*(a<0?1/-a:a)}function eM(e,t){let r;for(const n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function tM(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function H$(e,t,r=0,n=1/0,a){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(a=a===void 0?$$:Fhe(a);n>r;){if(n-r>600){const u=n-r+1,d=t-r+1,f=Math.log(u),m=.5*Math.exp(2*f/3),g=.5*Math.sqrt(f*m*(u-m)/u)*(d-u/2<0?-1:1),x=Math.max(r,Math.floor(t-d*m/u+g)),y=Math.min(n,Math.floor(t+(u-d)*m/u+g));H$(e,t,x,y,a)}const s=e[t];let o=r,l=n;for(Mg(e,r,t),a(e[n],s)>0&&Mg(e,r,n);o<l;){for(Mg(e,o,l),++o,--l;a(e[o],s)<0;)++o;for(;a(e[l],s)>0;)--l}a(e[r],s)===0?Mg(e,r,l):(++l,Mg(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function Mg(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function $he(e,t,r){if(e=Float64Array.from(Ohe(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return tM(e);if(t>=1)return eM(e);var n,a=(n-1)*t,s=Math.floor(a),o=eM(H$(e,s).subarray(0,s+1)),l=tM(e.subarray(s+1));return o+(l-o)*(a-s)}}function Hhe(e,t,r=U$){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,a=(n-1)*t,s=Math.floor(a),o=+r(e[s],s,e),l=+r(e[s+1],s+1,e);return o+(l-o)*(a-s)}}function Vhe(e,t,r){e=+e,t=+t,r=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+r;for(var n=-1,a=Math.max(0,Math.ceil((t-e)/r))|0,s=new Array(a);++n<a;)s[n]=e+n*r;return s}function Zl(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function cf(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const kA=Symbol("implicit");function UC(){var e=new JR,t=[],r=[],n=kA;function a(s){let o=e.get(s);if(o===void 0){if(n!==kA)return n;e.set(s,o=t.push(s)-1)}return r[o%r.length]}return a.domain=function(s){if(!arguments.length)return t.slice();t=[],e=new JR;for(const o of s)e.has(o)||e.set(o,t.push(o)-1);return a},a.range=function(s){return arguments.length?(r=Array.from(s),a):r.slice()},a.unknown=function(s){return arguments.length?(n=s,a):n},a.copy=function(){return UC(t,r).unknown(n)},Zl.apply(a,arguments),a}function $C(){var e=UC().unknown(void 0),t=e.domain,r=e.range,n=0,a=1,s,o,l=!1,u=0,d=0,f=.5;delete e.unknown;function m(){var g=t().length,x=a<n,y=x?a:n,v=x?n:a;s=(v-y)/Math.max(1,g-u+d*2),l&&(s=Math.floor(s)),y+=(v-y-s*(g-u))*f,o=s*(1-u),l&&(y=Math.round(y),o=Math.round(o));var w=Vhe(g).map(function(j){return y+s*j});return r(x?w.reverse():w)}return e.domain=function(g){return arguments.length?(t(g),m()):t()},e.range=function(g){return arguments.length?([n,a]=g,n=+n,a=+a,m()):[n,a]},e.rangeRound=function(g){return[n,a]=g,n=+n,a=+a,l=!0,m()},e.bandwidth=function(){return o},e.step=function(){return s},e.round=function(g){return arguments.length?(l=!!g,m()):l},e.padding=function(g){return arguments.length?(u=Math.min(1,d=+g),m()):u},e.paddingInner=function(g){return arguments.length?(u=Math.min(1,g),m()):u},e.paddingOuter=function(g){return arguments.length?(d=+g,m()):d},e.align=function(g){return arguments.length?(f=Math.max(0,Math.min(1,g)),m()):f},e.copy=function(){return $C(t(),[n,a]).round(l).paddingInner(u).paddingOuter(d).align(f)},Zl.apply(m(),arguments)}function V$(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return V$(t())},e}function qhe(){return V$($C.apply(null,arguments).paddingInner(1))}function HC(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function q$(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function A1(){}var Iv=.7,J2=1/Iv,Vp="\\s*([+-]?\\d+)\\s*",Fv="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Bu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Whe=/^#([0-9a-f]{3,8})$/,Ghe=new RegExp(`^rgb\\(${Vp},${Vp},${Vp}\\)$`),Yhe=new RegExp(`^rgb\\(${Bu},${Bu},${Bu}\\)$`),Khe=new RegExp(`^rgba\\(${Vp},${Vp},${Vp},${Fv}\\)$`),Xhe=new RegExp(`^rgba\\(${Bu},${Bu},${Bu},${Fv}\\)$`),Zhe=new RegExp(`^hsl\\(${Fv},${Bu},${Bu}\\)$`),Jhe=new RegExp(`^hsla\\(${Fv},${Bu},${Bu},${Fv}\\)$`),rM={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};HC(A1,Bv,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:nM,formatHex:nM,formatHex8:Qhe,formatHsl:eme,formatRgb:aM,toString:aM});function nM(){return this.rgb().formatHex()}function Qhe(){return this.rgb().formatHex8()}function eme(){return W$(this).formatHsl()}function aM(){return this.rgb().formatRgb()}function Bv(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Whe.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?iM(t):r===3?new zo(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?eb(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?eb(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ghe.exec(e))?new zo(t[1],t[2],t[3],1):(t=Yhe.exec(e))?new zo(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Khe.exec(e))?eb(t[1],t[2],t[3],t[4]):(t=Xhe.exec(e))?eb(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Zhe.exec(e))?lM(t[1],t[2]/100,t[3]/100,1):(t=Jhe.exec(e))?lM(t[1],t[2]/100,t[3]/100,t[4]):rM.hasOwnProperty(e)?iM(rM[e]):e==="transparent"?new zo(NaN,NaN,NaN,0):null}function iM(e){return new zo(e>>16&255,e>>8&255,e&255,1)}function eb(e,t,r,n){return n<=0&&(e=t=r=NaN),new zo(e,t,r,n)}function tme(e){return e instanceof A1||(e=Bv(e)),e?(e=e.rgb(),new zo(e.r,e.g,e.b,e.opacity)):new zo}function CA(e,t,r,n){return arguments.length===1?tme(e):new zo(e,t,r,n??1)}function zo(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}HC(zo,CA,q$(A1,{brighter(e){return e=e==null?J2:Math.pow(J2,e),new zo(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Iv:Math.pow(Iv,e),new zo(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new zo(Um(this.r),Um(this.g),Um(this.b),Q2(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:sM,formatHex:sM,formatHex8:rme,formatRgb:oM,toString:oM}));function sM(){return`#${Dm(this.r)}${Dm(this.g)}${Dm(this.b)}`}function rme(){return`#${Dm(this.r)}${Dm(this.g)}${Dm(this.b)}${Dm((isNaN(this.opacity)?1:this.opacity)*255)}`}function oM(){const e=Q2(this.opacity);return`${e===1?"rgb(":"rgba("}${Um(this.r)}, ${Um(this.g)}, ${Um(this.b)}${e===1?")":`, ${e})`}`}function Q2(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Um(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Dm(e){return e=Um(e),(e<16?"0":"")+e.toString(16)}function lM(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new kc(e,t,r,n)}function W$(e){if(e instanceof kc)return new kc(e.h,e.s,e.l,e.opacity);if(e instanceof A1||(e=Bv(e)),!e)return new kc;if(e instanceof kc)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,a=Math.min(t,r,n),s=Math.max(t,r,n),o=NaN,l=s-a,u=(s+a)/2;return l?(t===s?o=(r-n)/l+(r<n)*6:r===s?o=(n-t)/l+2:o=(t-r)/l+4,l/=u<.5?s+a:2-s-a,o*=60):l=u>0&&u<1?0:o,new kc(o,l,u,e.opacity)}function nme(e,t,r,n){return arguments.length===1?W$(e):new kc(e,t,r,n??1)}function kc(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}HC(kc,nme,q$(A1,{brighter(e){return e=e==null?J2:Math.pow(J2,e),new kc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Iv:Math.pow(Iv,e),new kc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,a=2*r-n;return new zo(iS(e>=240?e-240:e+120,a,n),iS(e,a,n),iS(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new kc(cM(this.h),tb(this.s),tb(this.l),Q2(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Q2(this.opacity);return`${e===1?"hsl(":"hsla("}${cM(this.h)}, ${tb(this.s)*100}%, ${tb(this.l)*100}%${e===1?")":`, ${e})`}`}}));function cM(e){return e=(e||0)%360,e<0?e+360:e}function tb(e){return Math.max(0,Math.min(1,e||0))}function iS(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const VC=e=>()=>e;function ame(e,t){return function(r){return e+r*t}}function ime(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function sme(e){return(e=+e)==1?G$:function(t,r){return r-t?ime(t,r,e):VC(isNaN(t)?r:t)}}function G$(e,t){var r=t-e;return r?ame(e,r):VC(isNaN(e)?t:e)}const uM=(function e(t){var r=sme(t);function n(a,s){var o=r((a=CA(a)).r,(s=CA(s)).r),l=r(a.g,s.g),u=r(a.b,s.b),d=G$(a.opacity,s.opacity);return function(f){return a.r=o(f),a.g=l(f),a.b=u(f),a.opacity=d(f),a+""}}return n.gamma=e,n})(1);function ome(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),a;return function(s){for(a=0;a<r;++a)n[a]=e[a]*(1-s)+t[a]*s;return n}}function lme(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function cme(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,a=new Array(n),s=new Array(r),o;for(o=0;o<n;++o)a[o]=Px(e[o],t[o]);for(;o<r;++o)s[o]=t[o];return function(l){for(o=0;o<n;++o)s[o]=a[o](l);return s}}function ume(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function ew(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function dme(e,t){var r={},n={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?r[a]=Px(e[a],t[a]):n[a]=t[a];return function(s){for(a in r)n[a]=r[a](s);return n}}var _A=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sS=new RegExp(_A.source,"g");function fme(e){return function(){return e}}function hme(e){return function(t){return e(t)+""}}function mme(e,t){var r=_A.lastIndex=sS.lastIndex=0,n,a,s,o=-1,l=[],u=[];for(e=e+"",t=t+"";(n=_A.exec(e))&&(a=sS.exec(t));)(s=a.index)>r&&(s=t.slice(r,s),l[o]?l[o]+=s:l[++o]=s),(n=n[0])===(a=a[0])?l[o]?l[o]+=a:l[++o]=a:(l[++o]=null,u.push({i:o,x:ew(n,a)})),r=sS.lastIndex;return r<t.length&&(s=t.slice(r),l[o]?l[o]+=s:l[++o]=s),l.length<2?u[0]?hme(u[0].x):fme(t):(t=u.length,function(d){for(var f=0,m;f<t;++f)l[(m=u[f]).i]=m.x(d);return l.join("")})}function Px(e,t){var r=typeof t,n;return t==null||r==="boolean"?VC(t):(r==="number"?ew:r==="string"?(n=Bv(t))?(t=n,uM):mme:t instanceof Bv?uM:t instanceof Date?ume:lme(t)?ome:Array.isArray(t)?cme:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?dme:ew)(e,t)}function qC(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function pme(e,t){t===void 0&&(t=e,e=Px);for(var r=0,n=t.length-1,a=t[0],s=new Array(n<0?0:n);r<n;)s[r]=e(a,a=t[++r]);return function(o){var l=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return s[l](o-l)}}function xme(e){return function(){return e}}function tw(e){return+e}var dM=[0,1];function lo(e){return e}function EA(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:xme(isNaN(t)?NaN:.5)}function gme(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function vme(e,t,r){var n=e[0],a=e[1],s=t[0],o=t[1];return a<n?(n=EA(a,n),s=r(o,s)):(n=EA(n,a),s=r(s,o)),function(l){return s(n(l))}}function yme(e,t,r){var n=Math.min(e.length,t.length)-1,a=new Array(n),s=new Array(n),o=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<n;)a[o]=EA(e[o],e[o+1]),s[o]=r(t[o],t[o+1]);return function(l){var u=S1(e,l,1,n)-1;return s[u](a[u](l))}}function k1(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function S5(){var e=dM,t=dM,r=Px,n,a,s,o=lo,l,u,d;function f(){var g=Math.min(e.length,t.length);return o!==lo&&(o=gme(e[0],e[g-1])),l=g>2?yme:vme,u=d=null,m}function m(g){return g==null||isNaN(g=+g)?s:(u||(u=l(e.map(n),t,r)))(n(o(g)))}return m.invert=function(g){return o(a((d||(d=l(t,e.map(n),ew)))(g)))},m.domain=function(g){return arguments.length?(e=Array.from(g,tw),f()):e.slice()},m.range=function(g){return arguments.length?(t=Array.from(g),f()):t.slice()},m.rangeRound=function(g){return t=Array.from(g),r=qC,f()},m.clamp=function(g){return arguments.length?(o=g?!0:lo,f()):o!==lo},m.interpolate=function(g){return arguments.length?(r=g,f()):r},m.unknown=function(g){return arguments.length?(s=g,m):s},function(g,x){return n=g,a=x,f()}}function WC(){return S5()(lo,lo)}function bme(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function rw(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function ux(e){return e=rw(Math.abs(e)),e?e[1]:NaN}function wme(e,t){return function(r,n){for(var a=r.length,s=[],o=0,l=e[0],u=0;a>0&&l>0&&(u+l+1>n&&(l=Math.max(1,n-u)),s.push(r.substring(a-=l,a+l)),!((u+=l+1)>n));)l=e[o=(o+1)%e.length];return s.reverse().join(t)}}function jme(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var Nme=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zv(e){if(!(t=Nme.exec(e)))throw new Error("invalid format: "+e);var t;return new GC({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}zv.prototype=GC.prototype;function GC(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}GC.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Sme(e){e:for(var t=e.length,r=1,n=-1,a;r<t;++r)switch(e[r]){case".":n=a=r;break;case"0":n===0&&(n=r),a=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(a+1):e}var nw;function Ame(e,t){var r=rw(e,t);if(!r)return nw=void 0,e.toPrecision(t);var n=r[0],a=r[1],s=a-(nw=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+rw(e,Math.max(0,t+s-1))[0]}function fM(e,t){var r=rw(e,t);if(!r)return e+"";var n=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+new Array(a-n.length+2).join("0")}const hM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:bme,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>fM(e*100,t),r:fM,s:Ame,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function mM(e){return e}var pM=Array.prototype.map,xM=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function kme(e){var t=e.grouping===void 0||e.thousands===void 0?mM:wme(pM.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?mM:jme(pM.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",u=e.nan===void 0?"NaN":e.nan+"";function d(m,g){m=zv(m);var x=m.fill,y=m.align,v=m.sign,w=m.symbol,j=m.zero,k=m.width,A=m.comma,T=m.precision,M=m.trim,B=m.type;B==="n"?(A=!0,B="g"):hM[B]||(T===void 0&&(T=12),M=!0,B="g"),(j||x==="0"&&y==="=")&&(j=!0,x="0",y="=");var L=(g&&g.prefix!==void 0?g.prefix:"")+(w==="$"?r:w==="#"&&/[boxX]/.test(B)?"0"+B.toLowerCase():""),F=(w==="$"?n:/[%p]/.test(B)?o:"")+(g&&g.suffix!==void 0?g.suffix:""),I=hM[B],q=/[defgprs%]/.test(B);T=T===void 0?6:/[gprs]/.test(B)?Math.max(1,Math.min(21,T)):Math.max(0,Math.min(20,T));function P(R){var K=L,ee=F,se,Z,ne;if(B==="c")ee=I(R)+ee,R="";else{R=+R;var X=R<0||1/R<0;if(R=isNaN(R)?u:I(Math.abs(R),T),M&&(R=Sme(R)),X&&+R==0&&v!=="+"&&(X=!1),K=(X?v==="("?v:l:v==="-"||v==="("?"":v)+K,ee=(B==="s"&&!isNaN(R)&&nw!==void 0?xM[8+nw/3]:"")+ee+(X&&v==="("?")":""),q){for(se=-1,Z=R.length;++se<Z;)if(ne=R.charCodeAt(se),48>ne||ne>57){ee=(ne===46?a+R.slice(se+1):R.slice(se))+ee,R=R.slice(0,se);break}}}A&&!j&&(R=t(R,1/0));var le=K.length+R.length+ee.length,Ae=le<k?new Array(k-le+1).join(x):"";switch(A&&j&&(R=t(Ae+R,Ae.length?k-ee.length:1/0),Ae=""),y){case"<":R=K+R+ee+Ae;break;case"=":R=K+Ae+R+ee;break;case"^":R=Ae.slice(0,le=Ae.length>>1)+K+R+ee+Ae.slice(le);break;default:R=Ae+K+R+ee;break}return s(R)}return P.toString=function(){return m+""},P}function f(m,g){var x=Math.max(-8,Math.min(8,Math.floor(ux(g)/3)))*3,y=Math.pow(10,-x),v=d((m=zv(m),m.type="f",m),{suffix:xM[8+x/3]});return function(w){return v(y*w)}}return{format:d,formatPrefix:f}}var rb,YC,Y$;Cme({thousands:",",grouping:[3],currency:["$",""]});function Cme(e){return rb=kme(e),YC=rb.format,Y$=rb.formatPrefix,rb}function _me(e){return Math.max(0,-ux(Math.abs(e)))}function Eme(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ux(t)/3)))*3-ux(Math.abs(e)))}function Tme(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ux(t)-ux(e))+1}function K$(e,t,r,n){var a=AA(e,t,r),s;switch(n=zv(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(s=Eme(a,o))&&(n.precision=s),Y$(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=Tme(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=_me(a))&&(n.precision=s-(n.type==="%")*2);break}}return YC(n)}function Fh(e){var t=e.domain;return e.ticks=function(r){var n=t();return NA(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var a=t();return K$(a[0],a[a.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),a=0,s=n.length-1,o=n[a],l=n[s],u,d,f=10;for(l<o&&(d=o,o=l,l=d,d=a,a=s,s=d);f-- >0;){if(d=SA(o,l,r),d===u)return n[a]=o,n[s]=l,t(n);if(d>0)o=Math.floor(o/d)*d,l=Math.ceil(l/d)*d;else if(d<0)o=Math.ceil(o*d)/d,l=Math.floor(l*d)/d;else break;u=d}return e},e}function X$(){var e=WC();return e.copy=function(){return k1(e,X$())},Zl.apply(e,arguments),Fh(e)}function Z$(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,tw),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return Z$(e).unknown(t)},e=arguments.length?Array.from(e,tw):[0,1],Fh(r)}function J$(e,t){e=e.slice();var r=0,n=e.length-1,a=e[r],s=e[n],o;return s<a&&(o=r,r=n,n=o,o=a,a=s,s=o),e[r]=t.floor(a),e[n]=t.ceil(s),e}function gM(e){return Math.log(e)}function vM(e){return Math.exp(e)}function Pme(e){return-Math.log(-e)}function Dme(e){return-Math.exp(-e)}function Ome(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Rme(e){return e===10?Ome:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Mme(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function yM(e){return(t,r)=>-e(-t,r)}function KC(e){const t=e(gM,vM),r=t.domain;let n=10,a,s;function o(){return a=Mme(n),s=Rme(n),r()[0]<0?(a=yM(a),s=yM(s),e(Pme,Dme)):e(gM,vM),t}return t.base=function(l){return arguments.length?(n=+l,o()):n},t.domain=function(l){return arguments.length?(r(l),o()):r()},t.ticks=l=>{const u=r();let d=u[0],f=u[u.length-1];const m=f<d;m&&([d,f]=[f,d]);let g=a(d),x=a(f),y,v;const w=l==null?10:+l;let j=[];if(!(n%1)&&x-g<w){if(g=Math.floor(g),x=Math.ceil(x),d>0){for(;g<=x;++g)for(y=1;y<n;++y)if(v=g<0?y/s(-g):y*s(g),!(v<d)){if(v>f)break;j.push(v)}}else for(;g<=x;++g)for(y=n-1;y>=1;--y)if(v=g>0?y/s(-g):y*s(g),!(v<d)){if(v>f)break;j.push(v)}j.length*2<w&&(j=NA(d,f,w))}else j=NA(g,x,Math.min(x-g,w)).map(s);return m?j.reverse():j},t.tickFormat=(l,u)=>{if(l==null&&(l=10),u==null&&(u=n===10?"s":","),typeof u!="function"&&(!(n%1)&&(u=zv(u)).precision==null&&(u.trim=!0),u=YC(u)),l===1/0)return u;const d=Math.max(1,n*l/t.ticks().length);return f=>{let m=f/s(Math.round(a(f)));return m*n<n-.5&&(m*=n),m<=d?u(f):""}},t.nice=()=>r(J$(r(),{floor:l=>s(Math.floor(a(l))),ceil:l=>s(Math.ceil(a(l)))})),t}function Q$(){const e=KC(S5()).domain([1,10]);return e.copy=()=>k1(e,Q$()).base(e.base()),Zl.apply(e,arguments),e}function bM(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function wM(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function XC(e){var t=1,r=e(bM(t),wM(t));return r.constant=function(n){return arguments.length?e(bM(t=+n),wM(t)):t},Fh(r)}function eH(){var e=XC(S5());return e.copy=function(){return k1(e,eH()).constant(e.constant())},Zl.apply(e,arguments)}function jM(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Lme(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Ime(e){return e<0?-e*e:e*e}function ZC(e){var t=e(lo,lo),r=1;function n(){return r===1?e(lo,lo):r===.5?e(Lme,Ime):e(jM(r),jM(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,n()):r},Fh(t)}function JC(){var e=ZC(S5());return e.copy=function(){return k1(e,JC()).exponent(e.exponent())},Zl.apply(e,arguments),e}function Fme(){return JC.apply(null,arguments).exponent(.5)}function NM(e){return Math.sign(e)*e*e}function Bme(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function tH(){var e=WC(),t=[0,1],r=!1,n;function a(s){var o=Bme(e(s));return isNaN(o)?n:r?Math.round(o):o}return a.invert=function(s){return e.invert(NM(s))},a.domain=function(s){return arguments.length?(e.domain(s),a):e.domain()},a.range=function(s){return arguments.length?(e.range((t=Array.from(s,tw)).map(NM)),a):t.slice()},a.rangeRound=function(s){return a.range(s).round(!0)},a.round=function(s){return arguments.length?(r=!!s,a):r},a.clamp=function(s){return arguments.length?(e.clamp(s),a):e.clamp()},a.unknown=function(s){return arguments.length?(n=s,a):n},a.copy=function(){return tH(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Zl.apply(a,arguments),Fh(a)}function rH(){var e=[],t=[],r=[],n;function a(){var o=0,l=Math.max(1,t.length);for(r=new Array(l-1);++o<l;)r[o-1]=Hhe(e,o/l);return s}function s(o){return o==null||isNaN(o=+o)?n:t[S1(r,o)]}return s.invertExtent=function(o){var l=t.indexOf(o);return l<0?[NaN,NaN]:[l>0?r[l-1]:e[0],l<r.length?r[l]:e[e.length-1]]},s.domain=function(o){if(!arguments.length)return e.slice();e=[];for(let l of o)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(gh),a()},s.range=function(o){return arguments.length?(t=Array.from(o),a()):t.slice()},s.unknown=function(o){return arguments.length?(n=o,s):n},s.quantiles=function(){return r.slice()},s.copy=function(){return rH().domain(e).range(t).unknown(n)},Zl.apply(s,arguments)}function nH(){var e=0,t=1,r=1,n=[.5],a=[0,1],s;function o(u){return u!=null&&u<=u?a[S1(n,u,0,r)]:s}function l(){var u=-1;for(n=new Array(r);++u<r;)n[u]=((u+1)*t-(u-r)*e)/(r+1);return o}return o.domain=function(u){return arguments.length?([e,t]=u,e=+e,t=+t,l()):[e,t]},o.range=function(u){return arguments.length?(r=(a=Array.from(u)).length-1,l()):a.slice()},o.invertExtent=function(u){var d=a.indexOf(u);return d<0?[NaN,NaN]:d<1?[e,n[0]]:d>=r?[n[r-1],t]:[n[d-1],n[d]]},o.unknown=function(u){return arguments.length&&(s=u),o},o.thresholds=function(){return n.slice()},o.copy=function(){return nH().domain([e,t]).range(a).unknown(s)},Zl.apply(Fh(o),arguments)}function aH(){var e=[.5],t=[0,1],r,n=1;function a(s){return s!=null&&s<=s?t[S1(e,s,0,n)]:r}return a.domain=function(s){return arguments.length?(e=Array.from(s),n=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(s){return arguments.length?(t=Array.from(s),n=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(s){var o=t.indexOf(s);return[e[o-1],e[o]]},a.unknown=function(s){return arguments.length?(r=s,a):r},a.copy=function(){return aH().domain(e).range(t).unknown(r)},Zl.apply(a,arguments)}const oS=new Date,lS=new Date;function qi(e,t,r,n){function a(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return a.floor=s=>(e(s=new Date(+s)),s),a.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),a.round=s=>{const o=a(s),l=a.ceil(s);return s-o<l-s?o:l},a.offset=(s,o)=>(t(s=new Date(+s),o==null?1:Math.floor(o)),s),a.range=(s,o,l)=>{const u=[];if(s=a.ceil(s),l=l==null?1:Math.floor(l),!(s<o)||!(l>0))return u;let d;do u.push(d=new Date(+s)),t(s,l),e(s);while(d<s&&s<o);return u},a.filter=s=>qi(o=>{if(o>=o)for(;e(o),!s(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!s(o););else for(;--l>=0;)for(;t(o,1),!s(o););}),r&&(a.count=(s,o)=>(oS.setTime(+s),lS.setTime(+o),e(oS),e(lS),Math.floor(r(oS,lS))),a.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?a.filter(n?o=>n(o)%s===0:o=>a.count(0,o)%s===0):a)),a}const aw=qi(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);aw.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?qi(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):aw);aw.range;const Ud=1e3,$l=Ud*60,$d=$l*60,Qd=$d*24,QC=Qd*7,SM=Qd*30,cS=Qd*365,Om=qi(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Ud)},(e,t)=>(t-e)/Ud,e=>e.getUTCSeconds());Om.range;const e_=qi(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ud)},(e,t)=>{e.setTime(+e+t*$l)},(e,t)=>(t-e)/$l,e=>e.getMinutes());e_.range;const t_=qi(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*$l)},(e,t)=>(t-e)/$l,e=>e.getUTCMinutes());t_.range;const r_=qi(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ud-e.getMinutes()*$l)},(e,t)=>{e.setTime(+e+t*$d)},(e,t)=>(t-e)/$d,e=>e.getHours());r_.range;const n_=qi(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*$d)},(e,t)=>(t-e)/$d,e=>e.getUTCHours());n_.range;const C1=qi(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*$l)/Qd,e=>e.getDate()-1);C1.range;const A5=qi(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Qd,e=>e.getUTCDate()-1);A5.range;const iH=qi(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Qd,e=>Math.floor(e/Qd));iH.range;function g0(e){return qi(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*$l)/QC)}const k5=g0(0),iw=g0(1),zme=g0(2),Ume=g0(3),dx=g0(4),$me=g0(5),Hme=g0(6);k5.range;iw.range;zme.range;Ume.range;dx.range;$me.range;Hme.range;function v0(e){return qi(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/QC)}const C5=v0(0),sw=v0(1),Vme=v0(2),qme=v0(3),fx=v0(4),Wme=v0(5),Gme=v0(6);C5.range;sw.range;Vme.range;qme.range;fx.range;Wme.range;Gme.range;const a_=qi(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());a_.range;const i_=qi(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());i_.range;const ef=qi(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());ef.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:qi(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});ef.range;const tf=qi(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());tf.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:qi(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});tf.range;function sH(e,t,r,n,a,s){const o=[[Om,1,Ud],[Om,5,5*Ud],[Om,15,15*Ud],[Om,30,30*Ud],[s,1,$l],[s,5,5*$l],[s,15,15*$l],[s,30,30*$l],[a,1,$d],[a,3,3*$d],[a,6,6*$d],[a,12,12*$d],[n,1,Qd],[n,2,2*Qd],[r,1,QC],[t,1,SM],[t,3,3*SM],[e,1,cS]];function l(d,f,m){const g=f<d;g&&([d,f]=[f,d]);const x=m&&typeof m.range=="function"?m:u(d,f,m),y=x?x.range(d,+f+1):[];return g?y.reverse():y}function u(d,f,m){const g=Math.abs(f-d)/m,x=zC(([,,w])=>w).right(o,g);if(x===o.length)return e.every(AA(d/cS,f/cS,m));if(x===0)return aw.every(Math.max(AA(d,f,m),1));const[y,v]=o[g/o[x-1][2]<o[x][2]/g?x-1:x];return y.every(v)}return[l,u]}const[Yme,Kme]=sH(tf,i_,C5,iH,n_,t_),[Xme,Zme]=sH(ef,a_,k5,C1,r_,e_);function uS(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function dS(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Lg(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function Jme(e){var t=e.dateTime,r=e.date,n=e.time,a=e.periods,s=e.days,o=e.shortDays,l=e.months,u=e.shortMonths,d=Ig(a),f=Fg(a),m=Ig(s),g=Fg(s),x=Ig(o),y=Fg(o),v=Ig(l),w=Fg(l),j=Ig(u),k=Fg(u),A={a:ne,A:X,b:le,B:Ae,c:null,d:TM,e:TM,f:w0e,g:P0e,G:O0e,H:v0e,I:y0e,j:b0e,L:oH,m:j0e,M:N0e,p:ce,q:D,Q:OM,s:RM,S:S0e,u:A0e,U:k0e,V:C0e,w:_0e,W:E0e,x:null,X:null,y:T0e,Y:D0e,Z:R0e,"%":DM},T={a:H,A:G,b:E,B:re,c:null,d:PM,e:PM,f:F0e,g:Y0e,G:X0e,H:M0e,I:L0e,j:I0e,L:cH,m:B0e,M:z0e,p:he,q:oe,Q:OM,s:RM,S:U0e,u:$0e,U:H0e,V:V0e,w:q0e,W:W0e,x:null,X:null,y:G0e,Y:K0e,Z:Z0e,"%":DM},M={a:q,A:P,b:R,B:K,c:ee,d:_M,e:_M,f:m0e,g:CM,G:kM,H:EM,I:EM,j:u0e,L:h0e,m:c0e,M:d0e,p:I,q:l0e,Q:x0e,s:g0e,S:f0e,u:n0e,U:a0e,V:i0e,w:r0e,W:s0e,x:se,X:Z,y:CM,Y:kM,Z:o0e,"%":p0e};A.x=B(r,A),A.X=B(n,A),A.c=B(t,A),T.x=B(r,T),T.X=B(n,T),T.c=B(t,T);function B(z,fe){return function(de){var W=[],ae=-1,_e=0,ue=z.length,ke,$e,Je;for(de instanceof Date||(de=new Date(+de));++ae<ue;)z.charCodeAt(ae)===37&&(W.push(z.slice(_e,ae)),($e=AM[ke=z.charAt(++ae)])!=null?ke=z.charAt(++ae):$e=ke==="e"?" ":"0",(Je=fe[ke])&&(ke=Je(de,$e)),W.push(ke),_e=ae+1);return W.push(z.slice(_e,ae)),W.join("")}}function L(z,fe){return function(de){var W=Lg(1900,void 0,1),ae=F(W,z,de+="",0),_e,ue;if(ae!=de.length)return null;if("Q"in W)return new Date(W.Q);if("s"in W)return new Date(W.s*1e3+("L"in W?W.L:0));if(fe&&!("Z"in W)&&(W.Z=0),"p"in W&&(W.H=W.H%12+W.p*12),W.m===void 0&&(W.m="q"in W?W.q:0),"V"in W){if(W.V<1||W.V>53)return null;"w"in W||(W.w=1),"Z"in W?(_e=dS(Lg(W.y,0,1)),ue=_e.getUTCDay(),_e=ue>4||ue===0?sw.ceil(_e):sw(_e),_e=A5.offset(_e,(W.V-1)*7),W.y=_e.getUTCFullYear(),W.m=_e.getUTCMonth(),W.d=_e.getUTCDate()+(W.w+6)%7):(_e=uS(Lg(W.y,0,1)),ue=_e.getDay(),_e=ue>4||ue===0?iw.ceil(_e):iw(_e),_e=C1.offset(_e,(W.V-1)*7),W.y=_e.getFullYear(),W.m=_e.getMonth(),W.d=_e.getDate()+(W.w+6)%7)}else("W"in W||"U"in W)&&("w"in W||(W.w="u"in W?W.u%7:"W"in W?1:0),ue="Z"in W?dS(Lg(W.y,0,1)).getUTCDay():uS(Lg(W.y,0,1)).getDay(),W.m=0,W.d="W"in W?(W.w+6)%7+W.W*7-(ue+5)%7:W.w+W.U*7-(ue+6)%7);return"Z"in W?(W.H+=W.Z/100|0,W.M+=W.Z%100,dS(W)):uS(W)}}function F(z,fe,de,W){for(var ae=0,_e=fe.length,ue=de.length,ke,$e;ae<_e;){if(W>=ue)return-1;if(ke=fe.charCodeAt(ae++),ke===37){if(ke=fe.charAt(ae++),$e=M[ke in AM?fe.charAt(ae++):ke],!$e||(W=$e(z,de,W))<0)return-1}else if(ke!=de.charCodeAt(W++))return-1}return W}function I(z,fe,de){var W=d.exec(fe.slice(de));return W?(z.p=f.get(W[0].toLowerCase()),de+W[0].length):-1}function q(z,fe,de){var W=x.exec(fe.slice(de));return W?(z.w=y.get(W[0].toLowerCase()),de+W[0].length):-1}function P(z,fe,de){var W=m.exec(fe.slice(de));return W?(z.w=g.get(W[0].toLowerCase()),de+W[0].length):-1}function R(z,fe,de){var W=j.exec(fe.slice(de));return W?(z.m=k.get(W[0].toLowerCase()),de+W[0].length):-1}function K(z,fe,de){var W=v.exec(fe.slice(de));return W?(z.m=w.get(W[0].toLowerCase()),de+W[0].length):-1}function ee(z,fe,de){return F(z,t,fe,de)}function se(z,fe,de){return F(z,r,fe,de)}function Z(z,fe,de){return F(z,n,fe,de)}function ne(z){return o[z.getDay()]}function X(z){return s[z.getDay()]}function le(z){return u[z.getMonth()]}function Ae(z){return l[z.getMonth()]}function ce(z){return a[+(z.getHours()>=12)]}function D(z){return 1+~~(z.getMonth()/3)}function H(z){return o[z.getUTCDay()]}function G(z){return s[z.getUTCDay()]}function E(z){return u[z.getUTCMonth()]}function re(z){return l[z.getUTCMonth()]}function he(z){return a[+(z.getUTCHours()>=12)]}function oe(z){return 1+~~(z.getUTCMonth()/3)}return{format:function(z){var fe=B(z+="",A);return fe.toString=function(){return z},fe},parse:function(z){var fe=L(z+="",!1);return fe.toString=function(){return z},fe},utcFormat:function(z){var fe=B(z+="",T);return fe.toString=function(){return z},fe},utcParse:function(z){var fe=L(z+="",!0);return fe.toString=function(){return z},fe}}}var AM={"-":"",_:" ",0:"0"},ps=/^\s*\d+/,Qme=/^%/,e0e=/[\\^$*+?|[\]().{}]/g;function Sn(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",s=a.length;return n+(s<r?new Array(r-s+1).join(t)+a:a)}function t0e(e){return e.replace(e0e,"\\$&")}function Ig(e){return new RegExp("^(?:"+e.map(t0e).join("|")+")","i")}function Fg(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function r0e(e,t,r){var n=ps.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function n0e(e,t,r){var n=ps.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function a0e(e,t,r){var n=ps.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function i0e(e,t,r){var n=ps.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function s0e(e,t,r){var n=ps.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function kM(e,t,r){var n=ps.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function CM(e,t,r){var n=ps.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function o0e(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function l0e(e,t,r){var n=ps.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function c0e(e,t,r){var n=ps.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function _M(e,t,r){var n=ps.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function u0e(e,t,r){var n=ps.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function EM(e,t,r){var n=ps.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function d0e(e,t,r){var n=ps.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function f0e(e,t,r){var n=ps.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function h0e(e,t,r){var n=ps.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function m0e(e,t,r){var n=ps.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function p0e(e,t,r){var n=Qme.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function x0e(e,t,r){var n=ps.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function g0e(e,t,r){var n=ps.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function TM(e,t){return Sn(e.getDate(),t,2)}function v0e(e,t){return Sn(e.getHours(),t,2)}function y0e(e,t){return Sn(e.getHours()%12||12,t,2)}function b0e(e,t){return Sn(1+C1.count(ef(e),e),t,3)}function oH(e,t){return Sn(e.getMilliseconds(),t,3)}function w0e(e,t){return oH(e,t)+"000"}function j0e(e,t){return Sn(e.getMonth()+1,t,2)}function N0e(e,t){return Sn(e.getMinutes(),t,2)}function S0e(e,t){return Sn(e.getSeconds(),t,2)}function A0e(e){var t=e.getDay();return t===0?7:t}function k0e(e,t){return Sn(k5.count(ef(e)-1,e),t,2)}function lH(e){var t=e.getDay();return t>=4||t===0?dx(e):dx.ceil(e)}function C0e(e,t){return e=lH(e),Sn(dx.count(ef(e),e)+(ef(e).getDay()===4),t,2)}function _0e(e){return e.getDay()}function E0e(e,t){return Sn(iw.count(ef(e)-1,e),t,2)}function T0e(e,t){return Sn(e.getFullYear()%100,t,2)}function P0e(e,t){return e=lH(e),Sn(e.getFullYear()%100,t,2)}function D0e(e,t){return Sn(e.getFullYear()%1e4,t,4)}function O0e(e,t){var r=e.getDay();return e=r>=4||r===0?dx(e):dx.ceil(e),Sn(e.getFullYear()%1e4,t,4)}function R0e(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Sn(t/60|0,"0",2)+Sn(t%60,"0",2)}function PM(e,t){return Sn(e.getUTCDate(),t,2)}function M0e(e,t){return Sn(e.getUTCHours(),t,2)}function L0e(e,t){return Sn(e.getUTCHours()%12||12,t,2)}function I0e(e,t){return Sn(1+A5.count(tf(e),e),t,3)}function cH(e,t){return Sn(e.getUTCMilliseconds(),t,3)}function F0e(e,t){return cH(e,t)+"000"}function B0e(e,t){return Sn(e.getUTCMonth()+1,t,2)}function z0e(e,t){return Sn(e.getUTCMinutes(),t,2)}function U0e(e,t){return Sn(e.getUTCSeconds(),t,2)}function $0e(e){var t=e.getUTCDay();return t===0?7:t}function H0e(e,t){return Sn(C5.count(tf(e)-1,e),t,2)}function uH(e){var t=e.getUTCDay();return t>=4||t===0?fx(e):fx.ceil(e)}function V0e(e,t){return e=uH(e),Sn(fx.count(tf(e),e)+(tf(e).getUTCDay()===4),t,2)}function q0e(e){return e.getUTCDay()}function W0e(e,t){return Sn(sw.count(tf(e)-1,e),t,2)}function G0e(e,t){return Sn(e.getUTCFullYear()%100,t,2)}function Y0e(e,t){return e=uH(e),Sn(e.getUTCFullYear()%100,t,2)}function K0e(e,t){return Sn(e.getUTCFullYear()%1e4,t,4)}function X0e(e,t){var r=e.getUTCDay();return e=r>=4||r===0?fx(e):fx.ceil(e),Sn(e.getUTCFullYear()%1e4,t,4)}function Z0e(){return"+0000"}function DM(){return"%"}function OM(e){return+e}function RM(e){return Math.floor(+e/1e3)}var xp,dH,fH;J0e({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function J0e(e){return xp=Jme(e),dH=xp.format,xp.parse,fH=xp.utcFormat,xp.utcParse,xp}function Q0e(e){return new Date(e)}function epe(e){return e instanceof Date?+e:+new Date(+e)}function s_(e,t,r,n,a,s,o,l,u,d){var f=WC(),m=f.invert,g=f.domain,x=d(".%L"),y=d(":%S"),v=d("%I:%M"),w=d("%I %p"),j=d("%a %d"),k=d("%b %d"),A=d("%B"),T=d("%Y");function M(B){return(u(B)<B?x:l(B)<B?y:o(B)<B?v:s(B)<B?w:n(B)<B?a(B)<B?j:k:r(B)<B?A:T)(B)}return f.invert=function(B){return new Date(m(B))},f.domain=function(B){return arguments.length?g(Array.from(B,epe)):g().map(Q0e)},f.ticks=function(B){var L=g();return e(L[0],L[L.length-1],B??10)},f.tickFormat=function(B,L){return L==null?M:d(L)},f.nice=function(B){var L=g();return(!B||typeof B.range!="function")&&(B=t(L[0],L[L.length-1],B??10)),B?g(J$(L,B)):f},f.copy=function(){return k1(f,s_(e,t,r,n,a,s,o,l,u,d))},f}function tpe(){return Zl.apply(s_(Xme,Zme,ef,a_,k5,C1,r_,e_,Om,dH).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function rpe(){return Zl.apply(s_(Yme,Kme,tf,i_,C5,A5,n_,t_,Om,fH).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function _5(){var e=0,t=1,r,n,a,s,o=lo,l=!1,u;function d(m){return m==null||isNaN(m=+m)?u:o(a===0?.5:(m=(s(m)-r)*a,l?Math.max(0,Math.min(1,m)):m))}d.domain=function(m){return arguments.length?([e,t]=m,r=s(e=+e),n=s(t=+t),a=r===n?0:1/(n-r),d):[e,t]},d.clamp=function(m){return arguments.length?(l=!!m,d):l},d.interpolator=function(m){return arguments.length?(o=m,d):o};function f(m){return function(g){var x,y;return arguments.length?([x,y]=g,o=m(x,y),d):[o(0),o(1)]}}return d.range=f(Px),d.rangeRound=f(qC),d.unknown=function(m){return arguments.length?(u=m,d):u},function(m){return s=m,r=m(e),n=m(t),a=r===n?0:1/(n-r),d}}function Bh(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function hH(){var e=Fh(_5()(lo));return e.copy=function(){return Bh(e,hH())},cf.apply(e,arguments)}function mH(){var e=KC(_5()).domain([1,10]);return e.copy=function(){return Bh(e,mH()).base(e.base())},cf.apply(e,arguments)}function pH(){var e=XC(_5());return e.copy=function(){return Bh(e,pH()).constant(e.constant())},cf.apply(e,arguments)}function o_(){var e=ZC(_5());return e.copy=function(){return Bh(e,o_()).exponent(e.exponent())},cf.apply(e,arguments)}function npe(){return o_.apply(null,arguments).exponent(.5)}function xH(){var e=[],t=lo;function r(n){if(n!=null&&!isNaN(n=+n))return t((S1(e,n,1)-1)/(e.length-1))}return r.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let a of n)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(gh),r},r.interpolator=function(n){return arguments.length?(t=n,r):t},r.range=function(){return e.map((n,a)=>t(a/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(a,s)=>$he(e,s/n))},r.copy=function(){return xH(t).domain(e)},cf.apply(r,arguments)}function E5(){var e=0,t=.5,r=1,n=1,a,s,o,l,u,d=lo,f,m=!1,g;function x(v){return isNaN(v=+v)?g:(v=.5+((v=+f(v))-s)*(n*v<n*s?l:u),d(m?Math.max(0,Math.min(1,v)):v))}x.domain=function(v){return arguments.length?([e,t,r]=v,a=f(e=+e),s=f(t=+t),o=f(r=+r),l=a===s?0:.5/(s-a),u=s===o?0:.5/(o-s),n=s<a?-1:1,x):[e,t,r]},x.clamp=function(v){return arguments.length?(m=!!v,x):m},x.interpolator=function(v){return arguments.length?(d=v,x):d};function y(v){return function(w){var j,k,A;return arguments.length?([j,k,A]=w,d=pme(v,[j,k,A]),x):[d(0),d(.5),d(1)]}}return x.range=y(Px),x.rangeRound=y(qC),x.unknown=function(v){return arguments.length?(g=v,x):g},function(v){return f=v,a=v(e),s=v(t),o=v(r),l=a===s?0:.5/(s-a),u=s===o?0:.5/(o-s),n=s<a?-1:1,x}}function gH(){var e=Fh(E5()(lo));return e.copy=function(){return Bh(e,gH())},cf.apply(e,arguments)}function vH(){var e=KC(E5()).domain([.1,1,10]);return e.copy=function(){return Bh(e,vH()).base(e.base())},cf.apply(e,arguments)}function yH(){var e=XC(E5());return e.copy=function(){return Bh(e,yH()).constant(e.constant())},cf.apply(e,arguments)}function l_(){var e=ZC(E5());return e.copy=function(){return Bh(e,l_()).exponent(e.exponent())},cf.apply(e,arguments)}function ape(){return l_.apply(null,arguments).exponent(.5)}const bH=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:$C,scaleDiverging:gH,scaleDivergingLog:vH,scaleDivergingPow:l_,scaleDivergingSqrt:ape,scaleDivergingSymlog:yH,scaleIdentity:Z$,scaleImplicit:kA,scaleLinear:X$,scaleLog:Q$,scaleOrdinal:UC,scalePoint:qhe,scalePow:JC,scaleQuantile:rH,scaleQuantize:nH,scaleRadial:tH,scaleSequential:hH,scaleSequentialLog:mH,scaleSequentialPow:o_,scaleSequentialQuantile:xH,scaleSequentialSqrt:npe,scaleSequentialSymlog:pH,scaleSqrt:Fme,scaleSymlog:eH,scaleThreshold:aH,scaleTime:tpe,scaleUtc:rpe,tickFormat:K$},Symbol.toStringTag,{value:"Module"}));function ipe(e){var t=bH;if(e in t&&typeof t[e]=="function")return t[e]();var r="scale".concat(f1(e));if(r in t&&typeof t[r]=="function")return t[r]()}function MM(e,t,r){if(typeof e=="function")return e.copy().domain(t).range(r);if(e!=null){var n=ipe(e);if(n!=null)return n.domain(t).range(r),n}}function c_(e,t,r,n){if(!(r==null||n==null))return typeof e.scale=="function"?MM(e.scale,r,n):MM(t,r,n)}function spe(e){return"scale".concat(f1(e))}function ope(e){return spe(e)in bH}var wH=(e,t,r)=>{if(e!=null){var{scale:n,type:a}=e;if(n==="auto")return a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!t)?"point":a==="category"?"band":"linear";if(typeof n=="string")return ope(n)?n:"point"}};function lpe(e,t){for(var r=0,n=e.length,a=e[0]<e[e.length-1];r<n;){var s=Math.floor((r+n)/2);(a?e[s]<t:e[s]>t)?r=s+1:n=s}return r}function jH(e,t){if(e){var r=t??e.domain(),n=r.map(s=>{var o;return(o=e(s))!==null&&o!==void 0?o:0}),a=e.range();if(!(r.length===0||a.length<2))return s=>{var o,l,u=lpe(n,s);if(u<=0)return r[0];if(u>=r.length)return r[r.length-1];var d=(o=n[u-1])!==null&&o!==void 0?o:0,f=(l=n[u])!==null&&l!==void 0?l:0;return Math.abs(s-d)<=Math.abs(s-f)?r[u-1]:r[u]}}}function cpe(e){if(e!=null)return"invert"in e&&typeof e.invert=="function"?e.invert.bind(e):jH(e,void 0)}function LM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ow(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LM(Object(r),!0).forEach(function(n){upe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function upe(e,t,r){return(t=dpe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dpe(e){var t=fpe(e,"string");return typeof t=="symbol"?t:t+""}function fpe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var TA=[0,"auto"],Li={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0,niceTicks:"auto"},NH=(e,t)=>e.cartesianAxis.xAxis[t],uf=(e,t)=>{var r=NH(e,t);return r??Li},Ii={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:TA,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:x1},SH=(e,t)=>e.cartesianAxis.yAxis[t],df=(e,t)=>{var r=SH(e,t);return r??Ii},hpe={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},u_=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return r??hpe},ni=(e,t,r)=>{switch(t){case"xAxis":return uf(e,r);case"yAxis":return df(e,r);case"zAxis":return u_(e,r);case"angleAxis":return LC(e,r);case"radiusAxis":return IC(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},mpe=(e,t,r)=>{switch(t){case"xAxis":return uf(e,r);case"yAxis":return df(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},Dx=(e,t,r)=>{switch(t){case"xAxis":return uf(e,r);case"yAxis":return df(e,r);case"angleAxis":return LC(e,r);case"radiusAxis":return IC(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},AH=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function d_(e,t){return r=>{switch(e){case"xAxis":return"xAxisId"in r&&r.xAxisId===t;case"yAxis":return"yAxisId"in r&&r.yAxisId===t;case"zAxis":return"zAxisId"in r&&r.zAxisId===t;case"angleAxis":return"angleAxisId"in r&&r.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in r&&r.radiusAxisId===t;default:return!1}}}var _1=e=>e.graphicalItems.cartesianItems,ppe=nt([za,N1],d_),f_=(e,t,r)=>e.filter(r).filter(n=>(t==null?void 0:t.includeHidden)===!0?!0:!n.hide),Ox=nt([_1,ni,ppe],f_,{memoizeOptions:{resultEqualityCheck:N5}}),kH=nt([Ox],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(w5)),CH=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),xpe=nt([Ox],CH),h_=e=>e.map(t=>t.data).filter(Boolean).flat(1),gpe=nt([Ox],e=>e.some(t=>!t.data)),_H=nt([Ox],h_,{memoizeOptions:{resultEqualityCheck:N5}}),m_=(e,t)=>{var{chartData:r=[],dataStartIndex:n,dataEndIndex:a}=t;return e.length>0?e:r.slice(n,a+1)},p_=nt([_H,w1],m_),EH=(e,t,r)=>(t==null?void 0:t.dataKey)!=null?e.map(n=>({value:Nn(n,t.dataKey)})):r.length>0?r.map(n=>n.dataKey).flatMap(n=>e.map(a=>({value:Nn(a,n)}))):e.map(n=>({value:n})),TH=(e,t,r,n,a,s)=>{var{chartData:o=[],dataStartIndex:l,dataEndIndex:u}=n,d=EH(e,t,r);if(a&&(t==null?void 0:t.dataKey)!=null&&s.length>0){var f=o.slice(l,u+1),m=f.map(g=>({value:Nn(g,t.dataKey)})).filter(g=>g.value!=null);return[...m,...d]}return d},E1=nt([p_,ni,Ox,w1,gpe,_H],TH);function qp(e){if(Uu(e)||e instanceof Date){var t=Number(e);if(Kr(t))return t}}function IM(e){if(Array.isArray(e)){var t=[qp(e[0]),qp(e[1])];return Fu(t)?t:void 0}var r=qp(e);if(r!=null)return[r,r]}function Vu(e){return e.map(qp).filter(Bo)}function vpe(e,t){var r=qp(e),n=qp(t);return r==null&&n==null?0:r==null?-1:n==null?1:r-n}var ype=nt([E1],e=>e==null?void 0:e.map(t=>t.value).sort(vpe));function PH(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function bpe(e,t,r){if(!r)return[];if(!r.length)return[];var n;if(typeof t=="number"&&!Rc(t))n=t;else if(Array.isArray(t)){var a=Vu(t);a.length>0&&(n=Math.max(...a))}return n==null?[]:Vu(r.flatMap(s=>{var o=Nn(e,s.dataKey),l,u;if(Array.isArray(o)?[l,u]=o:l=u=o,!(!Kr(l)||!Kr(u)))return[n-l,n+u]}))}var Wi=e=>{var t=ms(e),r=Tx(e);return Dx(e,t,r)},hx=nt([Wi],e=>e==null?void 0:e.dataKey),wpe=nt([kH,w1,Wi],B$),DH=(e,t,r,n)=>{var a={},s=t.reduce((o,l)=>{if(l.stackId==null)return o;var u=o[l.stackId];return u==null&&(u=[]),u.push(l),o[l.stackId]=u,o},a);return Object.fromEntries(Object.entries(s).map(o=>{var[l,u]=o,d=n?[...u].reverse():u,f=d.map(b5);return[l,{stackedData:fue(e,f,r),graphicalItems:d}]}))},lw=nt([wpe,kH,j1,D$],DH),OH=(e,t,r,n)=>{var{dataStartIndex:a,dataEndIndex:s}=t;if(n==null&&r!=="zAxis"){var o=xue(e,a,s);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},jpe=nt([ni],e=>e.allowDataOverflow),x_=e=>{var t;if(e==null||!("domain"in e))return TA;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var r=Vu(e.ticks);return[Math.min(...r),Math.max(...r)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:TA},g_=nt([ni],x_),v_=nt([g_,jpe],y$),Npe=nt([lw,zc,za,v_],OH,{memoizeOptions:{resultEqualityCheck:j5}}),T5=e=>e.errorBars,Spe=(e,t,r)=>e.flatMap(n=>t[n.id]).filter(Boolean).filter(n=>PH(r,n)),cw=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var a=r.filter(Boolean);if(a.length!==0){var s=a.flat(),o=Math.min(...s),l=Math.max(...s);return[o,l]}},y_=function(t,r,n,a,s){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],l,u;if(n.length>0&&n.forEach(d=>{var f,m=d.data!=null?[...d.data]:o,g=(f=a[d.id])===null||f===void 0?void 0:f.filter(x=>PH(s,x));m.forEach(x=>{var y,v=Nn(x,(y=r.dataKey)!==null&&y!==void 0?y:d.dataKey),w=bpe(x,v,g);if(w.length>=2){var j=Math.min(...w),k=Math.max(...w);(l==null||j<l)&&(l=j),(u==null||k>u)&&(u=k)}var A=IM(v);A!=null&&(l=l==null?A[0]:Math.min(l,A[0]),u=u==null?A[1]:Math.max(u,A[1]))})}),(r==null?void 0:r.dataKey)!=null&&n.length===0&&t.forEach(d=>{var f=IM(Nn(d,r.dataKey));f!=null&&(l=l==null?f[0]:Math.min(l,f[0]),u=u==null?f[1]:Math.max(u,f[1]))}),Kr(l)&&Kr(u))return[l,u]},Ape=nt([p_,ni,xpe,T5,za,hhe],y_,{memoizeOptions:{resultEqualityCheck:j5}});function kpe(e){var{value:t}=e;if(Uu(t)||t instanceof Date)return t}var Cpe=(e,t,r)=>{var n=e.map(kpe).filter(a=>a!=null);return r&&(t.dataKey==null||t.allowDuplicatedCategory&&$z(n))?g$(0,e.length):t.allowDuplicatedCategory?n:Array.from(new Set(n))},RH=e=>e.referenceElements.dots,Rx=(e,t,r)=>e.filter(n=>n.ifOverflow==="extendDomain").filter(n=>t==="xAxis"?n.xAxisId===r:n.yAxisId===r),_pe=nt([RH,za,N1],Rx),MH=e=>e.referenceElements.areas,Epe=nt([MH,za,N1],Rx),LH=e=>e.referenceElements.lines,Tpe=nt([LH,za,N1],Rx),IH=(e,t)=>{if(e!=null){var r=Vu(e.map(n=>t==="xAxis"?n.x:n.y));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},Ppe=nt(_pe,za,IH),FH=(e,t)=>{if(e!=null){var r=Vu(e.flatMap(n=>[t==="xAxis"?n.x1:n.y1,t==="xAxis"?n.x2:n.y2]));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},Dpe=nt([Epe,za],FH);function Ope(e){var t;if(e.x!=null)return Vu([e.x]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.x);return r==null||r.length===0?[]:Vu(r)}function Rpe(e){var t;if(e.y!=null)return Vu([e.y]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.y);return r==null||r.length===0?[]:Vu(r)}var BH=(e,t)=>{if(e!=null){var r=e.flatMap(n=>t==="xAxis"?Ope(n):Rpe(n));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},Mpe=nt([Tpe,za],BH),Lpe=nt(Ppe,Mpe,Dpe,(e,t,r)=>cw(e,r,t)),b_=(e,t,r,n,a,s,o,l)=>{if(r!=null)return r;var u=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",d=u?cw(n,s,a):cw(s,a);return xhe(t,d,e.allowDataOverflow)},Ipe=nt([ni,g_,v_,Npe,Ape,Lpe,un,za],b_,{memoizeOptions:{resultEqualityCheck:j5}}),Fpe=[0,1],w_=(e,t,r,n,a,s,o)=>{if(!((e==null||r==null||r.length===0)&&o===void 0)){var{dataKey:l,type:u}=e,d=Bc(t,s);if(d&&l==null){var f;return g$(0,(f=r==null?void 0:r.length)!==null&&f!==void 0?f:0)}return u==="category"?Cpe(n,e,d):a==="expand"&&!d?Fpe:o}},j_=nt([ni,un,p_,E1,j1,za,Ipe],w_),zh=nt([ni,AH,OC],wH),N_=(e,t,r)=>{var{niceTicks:n}=t;if(n!=="none"){var a=x_(t),s=Array.isArray(a)&&(a[0]==="auto"||a[1]==="auto");if((n==="snap125"||n==="adaptive")&&t!=null&&t.tickCount&&Fu(e)){if(s)return GR(e,t.tickCount,t.allowDecimals,n);if(t.type==="number")return YR(e,t.tickCount,t.allowDecimals,n)}if(n==="auto"&&r==="linear"&&t!=null&&t.tickCount){if(s&&Fu(e))return GR(e,t.tickCount,t.allowDecimals,"adaptive");if(t.type==="number"&&Fu(e))return YR(e,t.tickCount,t.allowDecimals,"adaptive")}}},S_=nt([j_,Dx,zh],N_),A_=(e,t,r,n)=>{if(n!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Fu(t)&&Array.isArray(r)&&r.length>0){var a,s,o=t[0],l=(a=r[0])!==null&&a!==void 0?a:0,u=t[1],d=(s=r[r.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,l),Math.max(u,d)]}return t},Bpe=nt([ni,j_,S_,za],A_),zpe=nt(E1,ni,(e,t)=>{if(!(!t||t.type!=="number")){var r=1/0,n=Array.from(Vu(e.map(m=>m.value))).sort((m,g)=>m-g),a=n[0],s=n[n.length-1];if(a==null||s==null)return 1/0;var o=s-a;if(o===0)return 1/0;for(var l=0;l<n.length-1;l++){var u=n[l],d=n[l+1];if(!(u==null||d==null)){var f=d-u;r=Math.min(r,f)}}return r/o}}),zH=nt(zpe,un,P$,Vi,(e,t,r,n,a)=>a,(e,t,r,n,a)=>{if(!Kr(e))return 0;var s=t==="vertical"?n.height:n.width;if(a==="gap")return e*s/2;if(a==="no-gap"){var o=qs(r,e*s),l=e*s/2;return l-o-(l-o)/s*o}return 0}),Upe=(e,t,r)=>{var n=uf(e,t);return n==null||typeof n.padding!="string"?0:zH(e,"xAxis",t,r,n.padding)},$pe=(e,t,r)=>{var n=df(e,t);return n==null||typeof n.padding!="string"?0:zH(e,"yAxis",t,r,n.padding)},Hpe=nt(uf,Upe,(e,t)=>{var r,n;if(e==null)return{left:0,right:0};var{padding:a}=e;return typeof a=="string"?{left:t,right:t}:{left:((r=a.left)!==null&&r!==void 0?r:0)+t,right:((n=a.right)!==null&&n!==void 0?n:0)+t}}),Vpe=nt(df,$pe,(e,t)=>{var r,n;if(e==null)return{top:0,bottom:0};var{padding:a}=e;return typeof a=="string"?{top:t,bottom:t}:{top:((r=a.top)!==null&&r!==void 0?r:0)+t,bottom:((n=a.bottom)!==null&&n!==void 0?n:0)+t}}),qpe=nt([Vi,Hpe,f5,d5,(e,t,r)=>r],(e,t,r,n,a)=>{var{padding:s}=n;return a?[s.left,r.width-s.right]:[e.left+t.left,e.left+e.width-t.right]}),Wpe=nt([Vi,un,Vpe,f5,d5,(e,t,r)=>r],(e,t,r,n,a,s)=>{var{padding:o}=a;return s?[n.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-r.bottom,e.top+r.top]:[e.top+r.top,e.top+e.height-r.bottom]}),T1=(e,t,r,n)=>{var a;switch(t){case"xAxis":return qpe(e,r,n);case"yAxis":return Wpe(e,r,n);case"zAxis":return(a=u_(e,r))===null||a===void 0?void 0:a.range;case"angleAxis":return L$(e);case"radiusAxis":return I$(e,r);default:return}},UH=nt([ni,T1],g5),Gpe=nt([zh,Bpe],z$),k_=nt([ni,zh,Gpe,UH],c_),$H=(e,t,r,n)=>{if(!(r==null||r.dataKey==null)){var{type:a,scale:s}=r,o=Bc(e,n);if(o&&(a==="number"||s!=="auto"))return t.map(l=>l.value)}},C_=nt([un,E1,Dx,za],$H),P5=nt([k_],BC);nt([k_],cpe);nt([k_,ype],jH);nt([Ox,T5,za],Spe);function HH(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var D5=(e,t)=>t,O5=(e,t,r)=>r,Ype=nt(c5,D5,O5,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(HH)),Kpe=nt(u5,D5,O5,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(HH)),VH=(e,t)=>({width:e.width,height:t.height}),Xpe=(e,t)=>{var r=typeof t.width=="number"?t.width:x1;return{width:r,height:e.height}},qH=nt(Vi,uf,VH),Zpe=(e,t,r)=>{switch(t){case"top":return e.top;case"bottom":return r-e.bottom;default:return 0}},Jpe=(e,t,r)=>{switch(t){case"left":return e.left;case"right":return r-e.right;default:return 0}},Qpe=nt(lf,Vi,Ype,D5,O5,(e,t,r,n,a)=>{var s={},o;return r.forEach(l=>{var u=VH(t,l);o==null&&(o=Zpe(t,n,e));var d=n==="top"&&!a||n==="bottom"&&a;s[l.id]=o-Number(d)*u.height,o+=(d?-1:1)*u.height}),s}),exe=nt(of,Vi,Kpe,D5,O5,(e,t,r,n,a)=>{var s={},o;return r.forEach(l=>{var u=Xpe(t,l);o==null&&(o=Jpe(t,n,e));var d=n==="left"&&!a||n==="right"&&a;s[l.id]=o-Number(d)*u.width,o+=(d?-1:1)*u.width}),s}),txe=(e,t)=>{var r=uf(e,t);if(r!=null)return Qpe(e,r.orientation,r.mirror)},rxe=nt([Vi,uf,txe,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var a=r==null?void 0:r[n];return a==null?{x:e.left,y:0}:{x:e.left,y:a}}}),nxe=(e,t)=>{var r=df(e,t);if(r!=null)return exe(e,r.orientation,r.mirror)},axe=nt([Vi,df,nxe,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var a=r==null?void 0:r[n];return a==null?{x:0,y:e.top}:{x:a,y:e.top}}}),WH=nt(Vi,df,(e,t)=>{var r=typeof t.width=="number"?t.width:x1;return{width:r,height:e.height}}),FM=(e,t,r)=>{switch(t){case"xAxis":return qH(e,r).width;case"yAxis":return WH(e,r).height;default:return}},GH=(e,t,r,n)=>{if(r!=null){var{allowDuplicatedCategory:a,type:s,dataKey:o}=r,l=Bc(e,n),u=t.map(f=>f.value),d=u.filter(f=>f!=null);if(o&&l&&s==="category"&&a&&$z(d))return u}},__=nt([un,E1,ni,za],GH),BM=nt([un,mpe,zh,P5,__,C_,T1,S_,za],(e,t,r,n,a,s,o,l,u)=>{if(t!=null){var d=Bc(e,u);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:u,categoricalDomain:s,duplicateDomain:a,isCategorical:d,niceTicks:l,range:o,realScaleType:r,scale:n}}}),ixe=(e,t,r,n,a,s,o,l,u)=>{if(!(t==null||n==null)){var d=Bc(e,u),{type:f,ticks:m,tickCount:g}=t,x=r==="scaleBand"&&typeof n.bandwidth=="function"?n.bandwidth()/2:2,y=f==="category"&&n.bandwidth?n.bandwidth()/x:0;y=u==="angleAxis"&&s!=null&&s.length>=2?cs(s[0]-s[1])*2*y:y;var v=m||a;return v?v.map((w,j)=>{var k=o?o.indexOf(w):w,A=n.map(k);return Kr(A)?{index:j,coordinate:A+y,value:w,offset:y}:null}).filter(Bo):d&&l?l.map((w,j)=>{var k=n.map(w);return Kr(k)?{coordinate:k+y,value:w,index:j,offset:y}:null}).filter(Bo):n.ticks?n.ticks(g).map((w,j)=>{var k=n.map(w);return Kr(k)?{coordinate:k+y,value:w,index:j,offset:y}:null}).filter(Bo):n.domain().map((w,j)=>{var k=n.map(w);return Kr(k)?{coordinate:k+y,value:o?o[w]:w,index:j,offset:y}:null}).filter(Bo)}},YH=nt([un,Dx,zh,P5,S_,T1,__,C_,za],ixe),sxe=(e,t,r,n,a,s,o)=>{if(!(t==null||r==null||n==null||n[0]===n[1])){var l=Bc(e,o),{tickCount:u}=t,d=0;return d=o==="angleAxis"&&(n==null?void 0:n.length)>=2?cs(n[0]-n[1])*2*d:d,l&&s?s.map((f,m)=>{var g=r.map(f);return Kr(g)?{coordinate:g+d,value:f,index:m,offset:d}:null}).filter(Bo):r.ticks?r.ticks(u).map((f,m)=>{var g=r.map(f);return Kr(g)?{coordinate:g+d,value:f,index:m,offset:d}:null}).filter(Bo):r.domain().map((f,m)=>{var g=r.map(f);return Kr(g)?{coordinate:g+d,value:a?a[f]:f,index:m,offset:d}:null}).filter(Bo)}},qu=nt([un,Dx,P5,T1,__,C_,za],sxe),Wu=nt(ni,P5,(e,t)=>{if(!(e==null||t==null))return ow(ow({},e),{},{scale:t})}),oxe=nt([ni,zh,j_,UH],c_),lxe=nt([oxe],BC);nt((e,t,r)=>u_(e,r),lxe,(e,t)=>{if(!(e==null||t==null))return ow(ow({},e),{},{scale:t})});var cxe=nt([un,c5,u5],(e,t,r)=>{switch(e){case"horizontal":return t.some(n=>n.reversed)?"right-to-left":"left-to-right";case"vertical":return r.some(n=>n.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),uxe=(e,t,r)=>{var n;return(n=e.renderedTicks[t])===null||n===void 0?void 0:n[r]};nt([uxe],e=>{if(!(!e||e.length===0))return t=>{var r,n=1/0,a=e[0];for(var s of e){var o=Math.abs(s.coordinate-t);o<n&&(n=o,a=s)}return(r=a)===null||r===void 0?void 0:r.value}});var KH=e=>e.options.defaultTooltipEventType,XH=e=>e.options.validateTooltipEventTypes;function ZH(e,t,r){if(e==null)return t;var n=e?"axis":"item";return r==null?t:r.includes(n)?n:t}function P1(e,t){var r=KH(e),n=XH(e);return ZH(t,r,n)}function dxe(e){return ir(t=>P1(t,e))}var JH=(e,t)=>{var r,n=Number(t);if(!(Rc(n)||t==null))return n>=0?e==null||(r=e[n])===null||r===void 0?void 0:r.value:void 0},fxe=e=>e.tooltip.settings,oh={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},hxe={itemInteraction:{click:oh,hover:oh},axisInteraction:{click:oh,hover:oh},keyboardInteraction:oh,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},QH=Ks({name:"tooltip",initialState:hxe,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:ga()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:r,next:n}=t.payload,a=Ul(e).tooltipItemPayloads.indexOf(r);a>-1&&(e.tooltipItemPayloads[a]=n)},prepare:ga()},removeTooltipEntrySettings:{reducer(e,t){var r=Ul(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:ga()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:mxe,replaceTooltipEntrySettings:pxe,removeTooltipEntrySettings:xxe,setTooltipSettingsState:gxe,setActiveMouseOverItemIndex:eV,mouseLeaveItem:vxe,mouseLeaveChart:tV,setActiveClickItemIndex:yxe,setMouseOverAxisIndex:rV,setMouseClickAxisIndex:bxe,setSyncInteraction:Kg,setKeyboardInteraction:uw}=QH.actions,wxe=QH.reducer;function zM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function nb(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zM(Object(r),!0).forEach(function(n){jxe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jxe(e,t,r){return(t=Nxe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nxe(e){var t=Sxe(e,"string");return typeof t=="symbol"?t:t+""}function Sxe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Axe(e,t,r){return t==="axis"?r==="click"?e.axisInteraction.click:e.axisInteraction.hover:r==="click"?e.itemInteraction.click:e.itemInteraction.hover}function kxe(e){return e.index!=null}var nV=(e,t,r,n)=>{if(t==null)return oh;var a=Axe(e,t,r);if(a==null)return oh;if(a.active)return a;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var s=e.settings.active===!0;if(kxe(a)){if(s)return nb(nb({},a),{},{active:!0})}else if(n!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:n,graphicalItemId:void 0};return nb(nb({},oh),{},{coordinate:a.coordinate})};function Cxe(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var r=Number(e);return Number.isFinite(r)?r:void 0}function _xe(e,t){var r=Cxe(e),n=t[0],a=t[1];if(r===void 0)return!1;var s=Math.min(n,a),o=Math.max(n,a);return r>=s&&r<=o}function Exe(e,t,r){if(r==null||t==null)return!0;var n=Nn(e,t);return n==null||!Fu(r)?!0:_xe(n,r)}var iv=(e,t,r,n)=>{var a=e==null?void 0:e.index;if(a==null)return null;var s=Number(a);if(!Kr(s))return a;var o=0,l=1/0;t.length>0&&(l=t.length-1);var u=Math.max(o,Math.min(s,l)),d=t[u];return d==null||Exe(d,r,n)?String(u):null},aV=(e,t,r,n,a,s,o)=>{if(s!=null){var l=o[0],u=l==null?void 0:l.getPosition(s);if(u!=null)return u;var d=a==null?void 0:a[Number(s)];if(d)switch(r){case"horizontal":return{x:d.coordinate,y:(n.top+t)/2};default:return{x:(n.left+e)/2,y:d.coordinate}}}},iV=(e,t,r,n)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var a;if(r==="hover"?a=e.itemInteraction.hover.graphicalItemId:a=e.itemInteraction.click.graphicalItemId,e.syncInteraction.active&&a==null)return e.tooltipItemPayloads;if(a==null&&(n!=null||e.keyboardInteraction.active)){var s=e.tooltipItemPayloads[0];return s!=null?[s]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===a})},sV=e=>e.options.tooltipPayloadSearcher,Mx=e=>e.tooltip;function UM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function $M(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?UM(Object(r),!0).forEach(function(n){Txe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Txe(e,t,r){return(t=Pxe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pxe(e){var t=Dxe(e,"string");return typeof t=="symbol"?t:t+""}function Dxe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Oxe(e){if(typeof e=="string"||typeof e=="number")return e}function Rxe(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}function Mxe(e){if(typeof e=="string"||typeof e=="number")return e;if(typeof e=="function")return t=>e(t)}function HM(e){if(typeof e=="string")return e}function Lxe(e){if(!(e==null||typeof e!="object")){var t="name"in e?Oxe(e.name):void 0,r="unit"in e?Rxe(e.unit):void 0,n="dataKey"in e?Mxe(e.dataKey):void 0,a="payload"in e?e.payload:void 0,s="color"in e?HM(e.color):void 0,o="fill"in e?HM(e.fill):void 0;return{name:t,unit:r,dataKey:n,payload:a,color:s,fill:o}}}function Ixe(e,t){return e??t}var oV=(e,t,r,n,a,s,o)=>{if(!(t==null||s==null)){var{chartData:l,computedData:u,dataStartIndex:d,dataEndIndex:f}=r,m=[];return e.reduce((g,x)=>{var y,{dataDefinedOnItem:v,settings:w}=x,j=Ixe(v,l),k=Array.isArray(j)?IU(j,d,f):j,A=(y=w==null?void 0:w.dataKey)!==null&&y!==void 0?y:n,T=w==null?void 0:w.nameKey,M;if(n&&Array.isArray(k)&&!Array.isArray(k[0])&&o==="axis"?M=Hz(k,n,a):M=s(k,t,u,T),Array.isArray(M))M.forEach(L=>{var F,I,q=Lxe(L),P=q==null?void 0:q.name,R=q==null?void 0:q.dataKey,K=q==null?void 0:q.payload,ee=$M($M({},w),{},{name:P,unit:q==null?void 0:q.unit,color:(F=q==null?void 0:q.color)!==null&&F!==void 0?F:w==null?void 0:w.color,fill:(I=q==null?void 0:q.fill)!==null&&I!==void 0?I:w==null?void 0:w.fill});g.push(MO({tooltipEntrySettings:ee,dataKey:R,payload:K,value:Nn(K,R),name:P==null?void 0:String(P)}))});else{var B;g.push(MO({tooltipEntrySettings:w,dataKey:A,payload:M,value:Nn(M,A),name:(B=Nn(M,T))!==null&&B!==void 0?B:w==null?void 0:w.name}))}return g},m)}},E_=nt([Wi,AH,OC],wH),Fxe=nt([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Bxe=nt([ms,Tx],d_),y0=nt([Fxe,Wi,Bxe],f_,{memoizeOptions:{resultEqualityCheck:N5}}),zxe=nt([y0],e=>e.filter(w5)),lV=nt([y0],h_,{memoizeOptions:{resultEqualityCheck:N5}}),Uxe=nt([y0],e=>e.some(t=>!t.data)),a0=nt([lV,zc],m_),$xe=nt([zxe,zc,Wi],B$),T_=nt([a0,Wi,y0,zc,Uxe,lV],TH),cV=nt([Wi],x_),Hxe=nt([Wi],e=>e.allowDataOverflow),uV=nt([cV,Hxe],y$),Vxe=nt([y0],e=>e.filter(w5)),qxe=nt([$xe,Vxe,j1,D$],DH),Wxe=nt([qxe,zc,ms,uV],OH),Gxe=nt([y0],CH),Yxe=nt([a0,Wi,Gxe,T5,ms,phe],y_,{memoizeOptions:{resultEqualityCheck:j5}}),Kxe=nt([RH,ms,Tx],Rx),Xxe=nt([Kxe,ms],IH),Zxe=nt([MH,ms,Tx],Rx),Jxe=nt([Zxe,ms],FH),Qxe=nt([LH,ms,Tx],Rx),ege=nt([Qxe,ms],BH),tge=nt([Xxe,ege,Jxe],cw),rge=nt([Wi,cV,uV,Wxe,Yxe,tge,un,ms],b_),mx=nt([Wi,un,a0,T_,j1,ms,rge],w_),nge=nt([mx,Wi,E_],N_),age=nt([Wi,mx,nge,ms],A_),dV=e=>{var t=ms(e),r=Tx(e),n=!1;return T1(e,t,r,n)},fV=nt([Wi,dV],g5),ige=nt([Wi,E_,age,fV],c_),hV=nt([ige],BC),sge=nt([un,T_,Wi,ms],GH),oge=nt([un,T_,Wi,ms],$H),lge=(e,t,r,n,a,s,o,l)=>{if(t){var{type:u}=t,d=Bc(e,l);if(n){var f=r==="scaleBand"&&n.bandwidth?n.bandwidth()/2:2,m=u==="category"&&n.bandwidth?n.bandwidth()/f:0;return m=l==="angleAxis"&&a!=null&&(a==null?void 0:a.length)>=2?cs(a[0]-a[1])*2*m:m,d&&o?o.map((g,x)=>{var y=n.map(g);return Kr(y)?{coordinate:y+m,value:g,index:x,offset:m}:null}).filter(Bo):n.domain().map((g,x)=>{var y=n.map(g);return Kr(y)?{coordinate:y+m,value:s?s[g]:g,index:x,offset:m}:null}).filter(Bo)}}},ff=nt([un,Wi,E_,hV,dV,sge,oge,ms],lge),P_=nt([KH,XH,fxe],(e,t,r)=>ZH(r.shared,e,t)),mV=e=>e.tooltip.settings.trigger,D_=e=>e.tooltip.settings.defaultIndex,D1=nt([Mx,P_,mV,D_],nV),Sh=nt([D1,a0,hx,mx],iv),pV=nt([ff,Sh],JH),O_=nt([D1],e=>{if(e)return e.dataKey}),xV=nt([D1],e=>{if(e)return e.graphicalItemId}),gV=nt([Mx,P_,mV,D_],iV),cge=nt([of,lf,un,Vi,ff,D_,gV],aV),uge=nt([D1,cge],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),dge=nt([D1],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),fge=nt([gV,Sh,zc,hx,pV,sV,P_],oV),hge=nt([fge],e=>{if(e!=null){var t=e.map(r=>r.payload).filter(r=>r!=null);return Array.from(new Set(t))}});function VM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function qM(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?VM(Object(r),!0).forEach(function(n){mge(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):VM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mge(e,t,r){return(t=pge(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pge(e){var t=xge(e,"string");return typeof t=="symbol"?t:t+""}function xge(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var gge=()=>ir(Wi),vge=()=>{var e=gge(),t=ir(ff),r=ir(hV);return Nh(!e||!r?void 0:qM(qM({},e),{},{scale:r}),t)};function WM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function gp(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?WM(Object(r),!0).forEach(function(n){yge(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function yge(e,t,r){return(t=bge(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bge(e){var t=wge(e,"string");return typeof t=="symbol"?t:t+""}function wge(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var jge=(e,t,r,n)=>{var a=t.find(s=>s&&s.index===r);if(a){if(e==="horizontal")return{x:a.coordinate,y:n.relativeY};if(e==="vertical")return{x:n.relativeX,y:a.coordinate}}return{x:0,y:0}},Nge=(e,t,r,n)=>{var a=t.find(d=>d&&d.index===r);if(a){if(e==="centric"){var s=a.coordinate,{radius:o}=n;return gp(gp(gp({},n),Si(n.cx,n.cy,o,s)),{},{angle:s,radius:o})}var l=a.coordinate,{angle:u}=n;return gp(gp(gp({},n),Si(n.cx,n.cy,l,u)),{},{angle:u,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function Sge(e,t){var{relativeX:r,relativeY:n}=e;return r>=t.left&&r<=t.left+t.width&&n>=t.top&&n<=t.top+t.height}var vV=(e,t,r,n,a)=>{var s,o=(s=t==null?void 0:t.length)!==null&&s!==void 0?s:0;if(o<=1||e==null)return 0;if(n==="angleAxis"&&a!=null&&Math.abs(Math.abs(a[1]-a[0])-360)<=1e-6)for(var l=0;l<o;l++){var u,d,f,m,g,x=l>0?(u=r[l-1])===null||u===void 0?void 0:u.coordinate:(d=r[o-1])===null||d===void 0?void 0:d.coordinate,y=(f=r[l])===null||f===void 0?void 0:f.coordinate,v=l>=o-1?(m=r[0])===null||m===void 0?void 0:m.coordinate:(g=r[l+1])===null||g===void 0?void 0:g.coordinate,w=void 0;if(!(x==null||y==null||v==null))if(cs(y-x)!==cs(v-y)){var j=[];if(cs(v-y)===cs(a[1]-a[0])){w=v;var k=y+a[1]-a[0];j[0]=Math.min(k,(k+x)/2),j[1]=Math.max(k,(k+x)/2)}else{w=x;var A=v+a[1]-a[0];j[0]=Math.min(y,(A+y)/2),j[1]=Math.max(y,(A+y)/2)}var T=[Math.min(y,(w+y)/2),Math.max(y,(w+y)/2)];if(e>T[0]&&e<=T[1]||e>=j[0]&&e<=j[1]){var M;return(M=r[l])===null||M===void 0?void 0:M.index}}else{var B=Math.min(x,v),L=Math.max(x,v);if(e>(B+y)/2&&e<=(L+y)/2){var F;return(F=r[l])===null||F===void 0?void 0:F.index}}}else if(t)for(var I=0;I<o;I++){var q=t[I];if(q!=null){var P=t[I+1],R=t[I-1];if(I===0&&P!=null&&e<=(q.coordinate+P.coordinate)/2||I===o-1&&R!=null&&e>(q.coordinate+R.coordinate)/2||I>0&&I<o-1&&R!=null&&P!=null&&e>(q.coordinate+R.coordinate)/2&&e<=(q.coordinate+P.coordinate)/2)return q.index}}return-1},yV=()=>ir(OC),R_=(e,t)=>t,bV=(e,t,r)=>r,M_=(e,t,r,n)=>n,Age=nt(ff,e=>Qw(e,t=>t.coordinate)),L_=nt([Mx,R_,bV,M_],nV),I_=nt([L_,a0,hx,mx],iv),kge=(e,t,r)=>{if(t!=null){var n=Mx(e);return t==="axis"?r==="hover"?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:r==="hover"?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}},wV=nt([Mx,R_,bV,M_],iV),dw=nt([of,lf,un,Vi,ff,M_,wV],aV),Cge=nt([L_,dw],(e,t)=>{var r;return(r=e.coordinate)!==null&&r!==void 0?r:t}),jV=nt([ff,I_],JH),_ge=nt([wV,I_,zc,hx,jV,sV,R_],oV),Ege=nt([L_,I_],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),Tge=(e,t,r,n,a,s,o)=>{if(!(!e||!r||!n||!a)&&Sge(e,o)){var l=gue(e,t),u=vV(l,s,a,r,n),d=jge(t,a,u,e);return{activeIndex:String(u),activeCoordinate:d}}},Pge=(e,t,r,n,a,s,o)=>{if(!(!e||!n||!a||!s||!r)){var l=nhe(e,r);if(l){var u=vue(l,t),d=vV(u,o,s,n,a),f=Nge(t,s,d,l);return{activeIndex:String(d),activeCoordinate:f}}}},Dge=(e,t,r,n,a,s,o,l)=>{if(!(!e||!t||!n||!a||!s))return t==="horizontal"||t==="vertical"?Tge(e,t,n,a,s,o,l):Pge(e,t,r,n,a,s,o)},Oge=nt(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,r)=>r,(e,t,r)=>{if(t!=null){var n=e[t];if(n!=null)return r?n.panoramaElement:n.element}}),Rge=nt(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(n=>parseInt(n,10)).concat(Object.values(fi)),r=Array.from(new Set(t));return r.sort((n,a)=>n-a)},{memoizeOptions:{resultEqualityCheck:The}});function GM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function YM(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?GM(Object(r),!0).forEach(function(n){Mge(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):GM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Mge(e,t,r){return(t=Lge(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Lge(e){var t=Ige(e,"string");return typeof t=="symbol"?t:t+""}function Ige(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Fge={},Bge={zIndexMap:Object.values(fi).reduce((e,t)=>YM(YM({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),Fge)},zge=new Set(Object.values(fi));function Uge(e){return zge.has(e)}var NV=Ks({name:"zIndex",initialState:Bge,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]?e.zIndexMap[r].consumers+=1:e.zIndexMap[r]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:ga()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!Uge(r)&&delete e.zIndexMap[r])},prepare:ga()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r,element:n,isPanorama:a}=t.payload;e.zIndexMap[r]?a?e.zIndexMap[r].panoramaElement=n:e.zIndexMap[r].element=n:e.zIndexMap[r]={consumers:0,element:a?void 0:n,panoramaElement:a?n:void 0}},prepare:ga()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(t.payload.isPanorama?e.zIndexMap[r].panoramaElement=void 0:e.zIndexMap[r].element=void 0)},prepare:ga()}}}),{registerZIndexPortal:$ge,unregisterZIndexPortal:fS,registerZIndexPortalElement:Hge,unregisterZIndexPortalElement:Vge}=NV.actions,qge=NV.reducer;function po(e){var{zIndex:t,children:r}=e,n=Kue(),a=n&&t!==void 0&&t!==0,s=hs(),o=N.useRef(void 0),l=N.useRef(new Set),u=Zn(),d=ir(m=>Oge(m,t,s));if(N.useLayoutEffect(()=>{if(!a){var m=l.current;m.forEach(x=>{u(fS({zIndex:x}))}),m.clear(),o.current=void 0;return}if(l.current.has(t)||(u($ge({zIndex:t})),l.current.add(t)),d){o.current=d;var g=l.current;g.forEach(x=>{x!==t&&(u(fS({zIndex:x})),g.delete(x))})}},[u,t,a,d]),N.useLayoutEffect(()=>{var m=l.current;return()=>{m.forEach(g=>{u(fS({zIndex:g}))}),m.clear()}},[u]),!a)return r;var f=d??o.current;return f?jx.createPortal(r,f):null}function PA(){return PA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},PA.apply(null,arguments)}function KM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ab(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KM(Object(r),!0).forEach(function(n){Wge(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wge(e,t,r){return(t=Gge(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gge(e){var t=Yge(e,"string");return typeof t=="symbol"?t:t+""}function Yge(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kge(e){var{cursor:t,cursorComp:r,cursorProps:n}=e;return N.isValidElement(t)?N.cloneElement(t,n):N.createElement(r,n)}function Xge(e){var t,{coordinate:r,payload:n,index:a,offset:s,tooltipAxisBandSize:o,layout:l,cursor:u,tooltipEventType:d,chartName:f}=e,m=r,g=n,x=a;if(!u||!m||f!=="ScatterChart"&&d!=="axis")return null;var y,v,w;if(f==="ScatterChart")y=m,v=vfe,w=fi.cursorLine;else if(f==="BarChart")y=yfe(l,m,s,o),v=f$,w=fi.cursorRectangle;else if(l==="radial"&&qz(m)){var{cx:j,cy:k,radius:A,startAngle:T,endAngle:M}=m$(m);y={cx:j,cy:k,startAngle:T,endAngle:M,innerRadius:A,outerRadius:A},v=x$,w=fi.cursorLine}else y={points:ohe(l,m,s)},v=Hp,w=fi.cursorLine;var B=typeof u=="object"&&"className"in u?u.className:void 0,L=ab(ab(ab(ab({stroke:"#ccc",pointerEvents:"none"},s),y),Xm(u)),{},{payload:g,payloadIndex:x,className:mn("recharts-tooltip-cursor",B)});return N.createElement(po,{zIndex:(t=e.zIndex)!==null&&t!==void 0?t:w},N.createElement(Kge,{cursor:u,cursorComp:v,cursorProps:L}))}function Zge(e){var t=vge(),r=GU(),n=Ih(),a=yV();return t==null||r==null||n==null||a==null?null:N.createElement(Xge,PA({},e,{offset:r,layout:n,tooltipAxisBandSize:t,chartName:a}))}var SV=N.createContext(null),Jge=()=>N.useContext(SV),hS={exports:{}},XM;function Qge(){return XM||(XM=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function a(u,d,f){this.fn=u,this.context=d,this.once=f||!1}function s(u,d,f,m,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var x=new a(f,m||u,g),y=r?r+d:d;return u._events[y]?u._events[y].fn?u._events[y]=[u._events[y],x]:u._events[y].push(x):(u._events[y]=x,u._eventsCount++),u}function o(u,d){--u._eventsCount===0?u._events=new n:delete u._events[d]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],f,m;if(this._eventsCount===0)return d;for(m in f=this._events)t.call(f,m)&&d.push(r?m.slice(1):m);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},l.prototype.listeners=function(d){var f=r?r+d:d,m=this._events[f];if(!m)return[];if(m.fn)return[m.fn];for(var g=0,x=m.length,y=new Array(x);g<x;g++)y[g]=m[g].fn;return y},l.prototype.listenerCount=function(d){var f=r?r+d:d,m=this._events[f];return m?m.fn?1:m.length:0},l.prototype.emit=function(d,f,m,g,x,y){var v=r?r+d:d;if(!this._events[v])return!1;var w=this._events[v],j=arguments.length,k,A;if(w.fn){switch(w.once&&this.removeListener(d,w.fn,void 0,!0),j){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,f),!0;case 3:return w.fn.call(w.context,f,m),!0;case 4:return w.fn.call(w.context,f,m,g),!0;case 5:return w.fn.call(w.context,f,m,g,x),!0;case 6:return w.fn.call(w.context,f,m,g,x,y),!0}for(A=1,k=new Array(j-1);A<j;A++)k[A-1]=arguments[A];w.fn.apply(w.context,k)}else{var T=w.length,M;for(A=0;A<T;A++)switch(w[A].once&&this.removeListener(d,w[A].fn,void 0,!0),j){case 1:w[A].fn.call(w[A].context);break;case 2:w[A].fn.call(w[A].context,f);break;case 3:w[A].fn.call(w[A].context,f,m);break;case 4:w[A].fn.call(w[A].context,f,m,g);break;default:if(!k)for(M=1,k=new Array(j-1);M<j;M++)k[M-1]=arguments[M];w[A].fn.apply(w[A].context,k)}}return!0},l.prototype.on=function(d,f,m){return s(this,d,f,m,!1)},l.prototype.once=function(d,f,m){return s(this,d,f,m,!0)},l.prototype.removeListener=function(d,f,m,g){var x=r?r+d:d;if(!this._events[x])return this;if(!f)return o(this,x),this;var y=this._events[x];if(y.fn)y.fn===f&&(!g||y.once)&&(!m||y.context===m)&&o(this,x);else{for(var v=0,w=[],j=y.length;v<j;v++)(y[v].fn!==f||g&&!y[v].once||m&&y[v].context!==m)&&w.push(y[v]);w.length?this._events[x]=w.length===1?w[0]:w:o(this,x)}return this},l.prototype.removeAllListeners=function(d){var f;return d?(f=r?r+d:d,this._events[f]&&o(this,f)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,e.exports=l})(hS)),hS.exports}var eve=Qge();const tve=af(eve);var Uv=new tve,DA="recharts.syncEvent.tooltip",ZM="recharts.syncEvent.brush",R5=(e,t)=>{if(t&&Array.isArray(e)){var r=Number.parseInt(t,10);if(!Rc(r))return e[r]}},rve={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},AV=Ks({name:"options",initialState:rve,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),nve=AV.reducer,{createEventEmitter:ave}=AV.actions;function ive(e){return e.tooltip.syncInteraction}var sve={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},kV=Ks({name:"chartData",initialState:sve,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:r,endIndex:n}=t.payload;r!=null&&(e.dataStartIndex=r),n!=null&&(e.dataEndIndex=n)}}}),{setChartData:JM,setDataStartEndIndexes:ove,setComputedData:UMe}=kV.actions,lve=kV.reducer,cve=["x","y"];function QM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function vp(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?QM(Object(r),!0).forEach(function(n){uve(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):QM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function uve(e,t,r){return(t=dve(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dve(e){var t=fve(e,"string");return typeof t=="symbol"?t:t+""}function fve(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hve(e,t){if(e==null)return{};var r,n,a=mve(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function mve(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function pve(){var e=ir(RC),t=ir(MC),r=Zn(),n=ir(O$),a=ir(ff),s=Ih(),o=h5(),l=ir(u=>u.rootProps.className);N.useEffect(()=>{if(e==null)return Mh;var u=(d,f,m)=>{if(t!==m&&e===d){if(f.payload.active===!1){r(Kg({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(n==="index"){var g;if(o&&f!==null&&f!==void 0&&(g=f.payload)!==null&&g!==void 0&&g.coordinate&&f.payload.sourceViewBox){var x=f.payload.coordinate,{x:y,y:v}=x,w=hve(x,cve),{x:j,y:k,width:A,height:T}=f.payload.sourceViewBox,M=vp(vp({},w),{},{x:o.x+(A?(y-j)/A:0)*o.width,y:o.y+(T?(v-k)/T:0)*o.height});r(vp(vp({},f),{},{payload:vp(vp({},f.payload),{},{coordinate:M})}))}else r(f);return}if(a!=null){var B;if(typeof n=="function"){var L={activeTooltipIndex:f.payload.index==null?void 0:Number(f.payload.index),isTooltipActive:f.payload.active,activeIndex:f.payload.index==null?void 0:Number(f.payload.index),activeLabel:f.payload.label,activeDataKey:f.payload.dataKey,activeCoordinate:f.payload.coordinate},F=n(a,L);B=a[F]}else n==="value"&&(B=a.find(Z=>String(Z.value)===f.payload.label));var{coordinate:I}=f.payload;if(I==null||o==null){r(Kg({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(B==null){r(Kg({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:f.payload.sourceViewBox,graphicalItemId:void 0}));return}var{x:q,y:P}=I,R=Math.min(q,o.x+o.width),K=Math.min(P,o.y+o.height),ee={x:s==="horizontal"?B.coordinate:R,y:s==="horizontal"?K:B.coordinate},se=Kg({active:f.payload.active,coordinate:ee,dataKey:f.payload.dataKey,index:String(B.index),label:f.payload.label,sourceViewBox:f.payload.sourceViewBox,graphicalItemId:f.payload.graphicalItemId});r(se)}}};return Uv.on(DA,u),()=>{Uv.off(DA,u)}},[l,r,t,e,n,a,s,o])}function xve(){var e=ir(RC),t=ir(MC),r=Zn();N.useEffect(()=>{if(e==null)return Mh;var n=(a,s,o)=>{t!==o&&e===a&&r(ove(s))};return Uv.on(ZM,n),()=>{Uv.off(ZM,n)}},[r,t,e])}function gve(){var e=Zn();N.useEffect(()=>{e(ave())},[e]),pve(),xve()}function vve(e,t,r,n,a,s){var o=ir(y=>kge(y,e,t)),l=ir(xV),u=ir(MC),d=ir(RC),f=ir(O$),m=ir(ive),g=(m==null?void 0:m.sourceViewBox)!=null,x=h5();N.useEffect(()=>{if(!g&&d!=null&&u!=null){var y=Kg({active:s,coordinate:r,dataKey:o,index:a,label:typeof n=="number"?String(n):n,sourceViewBox:x,graphicalItemId:l});Uv.emit(DA,d,y,u)}},[g,r,o,l,a,n,u,d,f,s,x])}function eL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function tL(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?eL(Object(r),!0).forEach(function(n){yve(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):eL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function yve(e,t,r){return(t=bve(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bve(e){var t=wve(e,"string");return typeof t=="symbol"?t:t+""}function wve(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jve(e){return e.dataKey}function Nve(e,t){return N.isValidElement(e)?N.cloneElement(e,t):typeof e=="function"?N.createElement(e,t):N.createElement(Gde,t)}var rL=[],Sve={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function Eu(e){var t,r,n=mi(e,Sve),{active:a,allowEscapeViewBox:s,animationDuration:o,animationEasing:l,content:u,filterNull:d,isAnimationActive:f,offset:m,payloadUniqBy:g,position:x,reverseDirection:y,useTranslate3d:v,wrapperStyle:w,cursor:j,shared:k,trigger:A,defaultIndex:T,portal:M,axisId:B}=n,L=Zn(),F=typeof T=="number"?String(T):T;N.useEffect(()=>{L(gxe({shared:k,trigger:A,axisId:B,active:a,defaultIndex:F}))},[L,k,A,B,a,F]);var I=h5(),q=o$(),P=dxe(k),{activeIndex:R,isActive:K}=(t=ir(oe=>Ege(oe,P,A,F)))!==null&&t!==void 0?t:{},ee=ir(oe=>_ge(oe,P,A,F)),se=ir(oe=>jV(oe,P,A,F)),Z=ir(oe=>Cge(oe,P,A,F)),ne=ee,X=Jge(),le=(r=a??K)!==null&&r!==void 0?r:!1,[Ae,ce]=oU([ne,le]),D=P==="axis"?se:void 0;vve(P,A,Z,D,R,le);var H=M??X;if(H==null||I==null||P==null)return null;var G=ne??rL;le||(G=rL),d&&G.length&&(G=rU(G.filter(oe=>oe.value!=null&&(oe.hide!==!0||n.includeHidden)),g,jve));var E=G.length>0,re=tL(tL({},n),{},{payload:G,label:D,active:le,activeIndex:R,coordinate:Z,accessibilityLayer:q}),he=N.createElement(afe,{allowEscapeViewBox:s,animationDuration:o,animationEasing:l,isAnimationActive:f,active:le,coordinate:Z,hasPayload:E,offset:m,position:x,reverseDirection:y,useTranslate3d:v,viewBox:I,wrapperStyle:w,lastBoundingBox:Ae,innerRef:ce,hasPortalFromProps:!!M},Nve(u,re));return N.createElement(N.Fragment,null,jx.createPortal(he,H),le&&N.createElement(Zge,{cursor:j,tooltipEventType:P,coordinate:Z,payload:G,index:R}))}var Wd=e=>null;Wd.displayName="Cell";function Ave(e,t,r){return(t=kve(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kve(e){var t=Cve(e,"string");return typeof t=="symbol"?t:t+""}function Cve(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class _ve{constructor(t){Ave(this,"cache",new Map),this.maxSize=t}get(t){var r=this.cache.get(t);return r!==void 0&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(t,r)}clear(){this.cache.clear()}size(){return this.cache.size}}function nL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Eve(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nL(Object(r),!0).forEach(function(n){Tve(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tve(e,t,r){return(t=Pve(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pve(e){var t=Dve(e,"string");return typeof t=="symbol"?t:t+""}function Dve(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ove={cacheSize:2e3,enableCache:!0},CV=Eve({},Ove),aL=new _ve(CV.cacheSize),Rve={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},iL="recharts_measurement_span";function Mve(e,t){var r=t.fontSize||"",n=t.fontFamily||"",a=t.fontWeight||"",s=t.fontStyle||"",o=t.letterSpacing||"",l=t.textTransform||"";return"".concat(e,"|").concat(r,"|").concat(n,"|").concat(a,"|").concat(s,"|").concat(o,"|").concat(l)}var sL=(e,t)=>{try{var r=document.getElementById(iL);r||(r=document.createElement("span"),r.setAttribute("id",iL),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,Rve,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch{return{width:0,height:0}}},sv=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||y1.isSsr)return{width:0,height:0};if(!CV.enableCache)return sL(t,r);var n=Mve(t,r),a=aL.get(n);if(a)return a;var s=sL(t,r);return aL.set(n,s),s},_V;function Lve(e,t,r){return(t=Ive(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ive(e){var t=Fve(e,"string");return typeof t=="symbol"?t:t+""}function Fve(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var oL=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,lL=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Bve=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,zve=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Uve={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},$ve=["cm","mm","pt","pc","in","Q","px"];function Hve(e){return $ve.includes(e)}var Ip="NaN";function Vve(e,t){return e*Uve[t]}class Cs{static parse(t){var r,[,n,a]=(r=zve.exec(t))!==null&&r!==void 0?r:[];return n==null?Cs.NaN:new Cs(parseFloat(n),a??"")}constructor(t,r){this.num=t,this.unit=r,this.num=t,this.unit=r,Rc(t)&&(this.unit=""),r!==""&&!Bve.test(r)&&(this.num=NaN,this.unit=""),Hve(r)&&(this.num=Vve(t,r),this.unit="px")}add(t){return this.unit!==t.unit?new Cs(NaN,""):new Cs(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new Cs(NaN,""):new Cs(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Cs(NaN,""):new Cs(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Cs(NaN,""):new Cs(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Rc(this.num)}}_V=Cs;Lve(Cs,"NaN",new _V(NaN,""));function EV(e){if(e==null||e.includes(Ip))return Ip;for(var t=e;t.includes("*")||t.includes("/");){var r,[,n,a,s]=(r=oL.exec(t))!==null&&r!==void 0?r:[],o=Cs.parse(n??""),l=Cs.parse(s??""),u=a==="*"?o.multiply(l):o.divide(l);if(u.isNaN())return Ip;t=t.replace(oL,u.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var d,[,f,m,g]=(d=lL.exec(t))!==null&&d!==void 0?d:[],x=Cs.parse(f??""),y=Cs.parse(g??""),v=m==="+"?x.add(y):x.subtract(y);if(v.isNaN())return Ip;t=t.replace(lL,v.toString())}return t}var cL=/\(([^()]*)\)/;function qve(e){for(var t=e,r;(r=cL.exec(t))!=null;){var[,n]=r;t=t.replace(cL,EV(n))}return t}function Wve(e){var t=e.replace(/\s+/g,"");return t=qve(t),t=EV(t),t}function Gve(e){try{return Wve(e)}catch{return Ip}}function mS(e){var t=Gve(e.slice(5,-1));return t===Ip?"":t}var Yve=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],Kve=["dx","dy","angle","className","breakAll"];function OA(){return OA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},OA.apply(null,arguments)}function uL(e,t){if(e==null)return{};var r,n,a=Xve(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Xve(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var TV=/[ \f\n\r\t\v\u2028\u2029]+/,PV=e=>{var{children:t,breakAll:r,style:n}=e;try{var a=[];Sa(t)||(r?a=t.toString().split(""):a=t.toString().split(TV));var s=a.map(l=>({word:l,width:sv(l,n).width})),o=r?0:sv(" ",n).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function DV(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}function Zve(e){return Sa(e)||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var OV=(e,t,r,n)=>e.reduce((a,s)=>{var{word:o,width:l}=s,u=a[a.length-1];if(u&&l!=null&&(t==null||n||u.width+l+r<Number(t)))u.words.push(o),u.width+=l+r;else{var d={words:[o],width:l};a.push(d)}return a},[]),RV=e=>e.reduce((t,r)=>t.width>r.width?t:r),Jve="…",dL=(e,t,r,n,a,s,o,l)=>{var u=e.slice(0,t),d=PV({breakAll:r,style:n,children:u+Jve});if(!d)return[!1,[]];var f=OV(d.wordsWithComputedWidth,s,o,l),m=f.length>a||RV(f).width>Number(s);return[m,f]},Qve=(e,t,r,n,a)=>{var{maxLines:s,children:o,style:l,breakAll:u}=e,d=Zt(s),f=String(o),m=OV(t,n,r,a);if(!d||a)return m;var g=m.length>s||RV(m).width>Number(n);if(!g)return m;for(var x=0,y=f.length-1,v=0,w;x<=y&&v<=f.length-1;){var j=Math.floor((x+y)/2),k=j-1,[A,T]=dL(f,k,u,l,s,n,r,a),[M]=dL(f,j,u,l,s,n,r,a);if(!A&&!M&&(x=j+1),A&&M&&(y=j-1),!A&&M){w=T;break}v++}return w||m},fL=e=>{var t=Sa(e)?[]:e.toString().split(TV);return[{words:t,width:void 0}]},e1e=e=>{var{width:t,scaleToFit:r,children:n,style:a,breakAll:s,maxLines:o}=e;if((t||r)&&!y1.isSsr){var l,u,d=PV({breakAll:s,children:n,style:a});if(d){var{wordsWithComputedWidth:f,spaceWidth:m}=d;l=f,u=m}else return fL(n);return Qve({breakAll:s,children:n,maxLines:o,style:a},l,u,t,!!r)}return fL(n)},MV="#808080",t1e={angle:0,breakAll:!1,capHeight:"0.71em",fill:MV,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},M5=N.forwardRef((e,t)=>{var r=mi(e,t1e),{x:n,y:a,lineHeight:s,capHeight:o,fill:l,scaleToFit:u,textAnchor:d,verticalAnchor:f}=r,m=uL(r,Yve),g=N.useMemo(()=>e1e({breakAll:m.breakAll,children:m.children,maxLines:m.maxLines,scaleToFit:u,style:m.style,width:m.width}),[m.breakAll,m.children,m.maxLines,u,m.style,m.width]),{dx:x,dy:y,angle:v,className:w,breakAll:j}=m,k=uL(m,Kve);if(!Uu(n)||!Uu(a)||g.length===0)return null;var A=Number(n)+(Zt(x)?x:0),T=Number(a)+(Zt(y)?y:0);if(!Kr(A)||!Kr(T))return null;var M;switch(f){case"start":M=mS("calc(".concat(o,")"));break;case"middle":M=mS("calc(".concat((g.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:M=mS("calc(".concat(g.length-1," * -").concat(s,")"));break}var B=[],L=g[0];if(u&&L!=null){var F=L.width,{width:I}=m;B.push("scale(".concat(Zt(I)&&Zt(F)?I/F:1,")"))}return v&&B.push("rotate(".concat(v,", ").concat(A,", ").concat(T,")")),B.length&&(k.transform=B.join(" ")),N.createElement("text",OA({},Gs(k),{ref:t,x:A,y:T,className:mn("recharts-text",w),textAnchor:d,fill:l.includes("url")?MV:l}),g.map((q,P)=>{var R=q.words.join(j?"":" ");return N.createElement("tspan",{x:A,dy:P===0?M:s,key:"".concat(R,"-").concat(P)},R)}))});M5.displayName="Text";function hL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function yu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hL(Object(r),!0).forEach(function(n){r1e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function r1e(e,t,r){return(t=n1e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n1e(e){var t=a1e(e,"string");return typeof t=="symbol"?t:t+""}function a1e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var i1e=e=>{var{viewBox:t,position:r,offset:n=0,parentViewBox:a}=e,{x:s,y:o,height:l,upperWidth:u,lowerWidth:d}=SC(t),f=s,m=s+(u-d)/2,g=(f+m)/2,x=(u+d)/2,y=f+u/2,v=l>=0?1:-1,w=v*n,j=v>0?"end":"start",k=v>0?"start":"end",A=u>=0?1:-1,T=A*n,M=A>0?"end":"start",B=A>0?"start":"end",L=a;if(r==="top"){var F={x:f+u/2,y:o-w,horizontalAnchor:"middle",verticalAnchor:j};return L&&(F.height=Math.max(o-L.y,0),F.width=u),F}if(r==="bottom"){var I={x:m+d/2,y:o+l+w,horizontalAnchor:"middle",verticalAnchor:k};return L&&(I.height=Math.max(L.y+L.height-(o+l),0),I.width=d),I}if(r==="left"){var q={x:g-T,y:o+l/2,horizontalAnchor:M,verticalAnchor:"middle"};return L&&(q.width=Math.max(q.x-L.x,0),q.height=l),q}if(r==="right"){var P={x:g+x+T,y:o+l/2,horizontalAnchor:B,verticalAnchor:"middle"};return L&&(P.width=Math.max(L.x+L.width-P.x,0),P.height=l),P}var R=L?{width:x,height:l}:{};return r==="insideLeft"?yu({x:g+T,y:o+l/2,horizontalAnchor:B,verticalAnchor:"middle"},R):r==="insideRight"?yu({x:g+x-T,y:o+l/2,horizontalAnchor:M,verticalAnchor:"middle"},R):r==="insideTop"?yu({x:f+u/2,y:o+w,horizontalAnchor:"middle",verticalAnchor:k},R):r==="insideBottom"?yu({x:m+d/2,y:o+l-w,horizontalAnchor:"middle",verticalAnchor:j},R):r==="insideTopLeft"?yu({x:f+T,y:o+w,horizontalAnchor:B,verticalAnchor:k},R):r==="insideTopRight"?yu({x:f+u-T,y:o+w,horizontalAnchor:M,verticalAnchor:k},R):r==="insideBottomLeft"?yu({x:m+T,y:o+l-w,horizontalAnchor:B,verticalAnchor:j},R):r==="insideBottomRight"?yu({x:m+d-T,y:o+l-w,horizontalAnchor:M,verticalAnchor:j},R):r&&typeof r=="object"&&(Zt(r.x)||Qm(r.x))&&(Zt(r.y)||Qm(r.y))?yu({x:s+qs(r.x,x),y:o+qs(r.y,l),horizontalAnchor:"end",verticalAnchor:"end"},R):yu({x:y,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},R)},s1e=["labelRef"],o1e=["content"];function mL(e,t){if(e==null)return{};var r,n,a=l1e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function l1e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function pL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Xg(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pL(Object(r),!0).forEach(function(n){c1e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function c1e(e,t,r){return(t=u1e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u1e(e){var t=d1e(e,"string");return typeof t=="symbol"?t:t+""}function d1e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fd(){return Fd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fd.apply(null,arguments)}var LV=N.createContext(null),f1e=e=>{var{x:t,y:r,upperWidth:n,lowerWidth:a,width:s,height:o,children:l}=e,u=N.useMemo(()=>({x:t,y:r,upperWidth:n,lowerWidth:a,width:s,height:o}),[t,r,n,a,s,o]);return N.createElement(LV.Provider,{value:u},l)},IV=()=>{var e=N.useContext(LV),t=h5();return e||(t?SC(t):void 0)},h1e=N.createContext(null),m1e=()=>{var e=N.useContext(h1e),t=ir(F$);return e||t},p1e=e=>{var{value:t,formatter:r}=e,n=Sa(e.children)?t:e.children;return typeof r=="function"?r(n):n},F_=e=>e!=null&&typeof e=="function",x1e=(e,t)=>{var r=cs(t-e),n=Math.min(Math.abs(t-e),360);return r*n},g1e=(e,t,r,n,a)=>{var{offset:s,className:o}=e,{cx:l,cy:u,innerRadius:d,outerRadius:f,startAngle:m,endAngle:g,clockWise:x}=a,y=(d+f)/2,v=x1e(m,g),w=v>=0?1:-1,j,k;switch(t){case"insideStart":j=m+w*s,k=x;break;case"insideEnd":j=g-w*s,k=!x;break;case"end":j=g+w*s,k=x;break;default:throw new Error("Unsupported position ".concat(t))}k=v<=0?k:!k;var A=Si(l,u,y,j),T=Si(l,u,y,j+(k?1:-1)*359),M="M".concat(A.x,",").concat(A.y,`
    A`).concat(y,",").concat(y,",0,1,").concat(k?0:1,`,
    `).concat(T.x,",").concat(T.y),B=Sa(e.id)?_v("recharts-radial-line-"):e.id;return N.createElement("text",Fd({},n,{dominantBaseline:"central",className:mn("recharts-radial-bar-label",o)}),N.createElement("defs",null,N.createElement("path",{id:B,d:M})),N.createElement("textPath",{xlinkHref:"#".concat(B)},r))},v1e=(e,t,r)=>{var{cx:n,cy:a,innerRadius:s,outerRadius:o,startAngle:l,endAngle:u}=e,d=(l+u)/2;if(r==="outside"){var{x:f,y:m}=Si(n,a,o+t,d);return{x:f,y:m,textAnchor:f>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:a,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:a,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:a,textAnchor:"middle",verticalAnchor:"end"};var g=(s+o)/2,{x,y}=Si(n,a,g,d);return{x,y,textAnchor:"middle",verticalAnchor:"middle"}},Qb=e=>e!=null&&"cx"in e&&Zt(e.cx),y1e={angle:0,offset:5,zIndex:fi.label,position:"middle",textBreakAll:!1};function b1e(e){if(!Qb(e))return e;var{cx:t,cy:r,outerRadius:n}=e,a=n*2;return{x:t-n,y:r-n,width:a,upperWidth:a,lowerWidth:a,height:a}}function sh(e){var t=mi(e,y1e),{viewBox:r,parentViewBox:n,position:a,value:s,children:o,content:l,className:u="",textBreakAll:d,labelRef:f}=t,m=m1e(),g=IV(),x=a==="center"?g:m??g,y,v,w;r==null?y=x:Qb(r)?y=r:y=SC(r);var j=b1e(y);if(!y||Sa(s)&&Sa(o)&&!N.isValidElement(l)&&typeof l!="function")return null;var k=Xg(Xg({},t),{},{viewBox:y});if(N.isValidElement(l)){var{labelRef:A}=k,T=mL(k,s1e);return N.cloneElement(l,T)}if(typeof l=="function"){var{content:M}=k,B=mL(k,o1e);if(v=N.createElement(l,B),N.isValidElement(v))return v}else v=p1e(t);var L=Gs(t);if(Qb(y)){if(a==="insideStart"||a==="insideEnd"||a==="end")return g1e(t,a,v,L,y);w=v1e(y,t.offset,t.position)}else{if(!j)return null;var F=i1e({viewBox:j,position:a,offset:t.offset,parentViewBox:Qb(n)?void 0:n});w=Xg(Xg({x:F.x,y:F.y,textAnchor:F.horizontalAnchor,verticalAnchor:F.verticalAnchor},F.width!==void 0?{width:F.width}:{}),F.height!==void 0?{height:F.height}:{})}return N.createElement(po,{zIndex:t.zIndex},N.createElement(M5,Fd({ref:f,className:mn("recharts-label",u)},L,w,{textAnchor:DV(L.textAnchor)?L.textAnchor:w.textAnchor,breakAll:d}),v))}sh.displayName="Label";var w1e=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?N.createElement(sh,Fd({key:"label-implicit"},n)):Uu(e)?N.createElement(sh,Fd({key:"label-implicit",value:e},n)):N.isValidElement(e)?e.type===sh?N.cloneElement(e,Xg({key:"label-implicit"},n)):N.createElement(sh,Fd({key:"label-implicit",content:e},n)):F_(e)?N.createElement(sh,Fd({key:"label-implicit",content:e},n)):e&&typeof e=="object"?N.createElement(sh,Fd({},e,{key:"label-implicit"},n)):null};function j1e(e){var{label:t,labelRef:r}=e,n=IV();return w1e(t,n,r)||null}var N1e=["valueAccessor"],S1e=["dataKey","clockWise","id","textBreakAll","zIndex"];function fw(){return fw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fw.apply(null,arguments)}function xL(e,t){if(e==null)return{};var r,n,a=A1e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function A1e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var k1e=e=>{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(Zve(t))return t},FV=N.createContext(void 0),B_=FV.Provider,BV=N.createContext(void 0),C1e=BV.Provider;function _1e(){return N.useContext(FV)}function E1e(){return N.useContext(BV)}function e2(e){var{valueAccessor:t=k1e}=e,r=xL(e,N1e),{dataKey:n,clockWise:a,id:s,textBreakAll:o,zIndex:l}=r,u=xL(r,S1e),d=_1e(),f=E1e(),m=d||f;return!m||!m.length?null:N.createElement(po,{zIndex:l??fi.label},N.createElement(Ba,{className:"recharts-label-list"},m.map((g,x)=>{var y,v=Sa(n)?t(g,x):Nn(g.payload,n),w=Sa(s)?{}:{id:"".concat(s,"-").concat(x)};return N.createElement(sh,fw({key:"label-".concat(x)},Gs(g),u,w,{fill:(y=r.fill)!==null&&y!==void 0?y:g.fill,parentViewBox:g.parentViewBox,value:v,textBreakAll:o,viewBox:g.viewBox,index:x,zIndex:0}))})))}e2.displayName="LabelList";function L5(e){var{label:t}=e;return t?t===!0?N.createElement(e2,{key:"labelList-implicit"}):N.isValidElement(t)||F_(t)?N.createElement(e2,{key:"labelList-implicit",content:t}):typeof t=="object"?N.createElement(e2,fw({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function RA(){return RA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},RA.apply(null,arguments)}var zV=e=>{var{cx:t,cy:r,r:n,className:a}=e,s=mn("recharts-dot",a);return Zt(t)&&Zt(r)&&Zt(n)?N.createElement("circle",RA({},fo(e),hC(e),{className:s,cx:t,cy:r,r:n})):null},UV=e=>e.graphicalItems.polarItems,T1e=nt([za,N1],d_),I5=nt([UV,ni,T1e],f_),P1e=nt([I5],h_),F5=nt([P1e,b1],m_),D1e=nt([F5,ni,I5],EH);nt([F5,ni,I5],(e,t,r)=>r.length>0?e.flatMap(n=>r.flatMap(a=>{var s,o=Nn(n,(s=t.dataKey)!==null&&s!==void 0?s:a.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(n=>({value:Nn(n,t.dataKey),errorDomain:[]})):e.map(n=>({value:n,errorDomain:[]})));var gL=()=>{},O1e=nt([F5,ni,I5,T5,za,mhe],y_),R1e=nt([ni,g_,v_,gL,O1e,gL,un,za],b_),$V=nt([ni,un,F5,D1e,j1,za,R1e],w_),M1e=nt([$V,Dx,zh],N_),L1e=nt([ni,$V,M1e,za],A_);nt([zh,L1e],z$);var I1e={radiusAxis:{},angleAxis:{}},HV=Ks({name:"polarAxis",initialState:I1e,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:$Me,removeRadiusAxis:HMe,addAngleAxis:VMe,removeAngleAxis:qMe}=HV.actions,F1e=HV.reducer;function VV(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function vL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function yL(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vL(Object(r),!0).forEach(function(n){B1e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function B1e(e,t,r){return(t=z1e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function z1e(e){var t=U1e(e,"string");return typeof t=="symbol"?t:t+""}function U1e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $1e=(e,t)=>t,z_=nt([UV,$1e],(e,t)=>e.filter(r=>r.type==="pie").find(r=>r.id===t)),H1e=[],U_=(e,t,r)=>(r==null?void 0:r.length)===0?H1e:r,qV=nt([b1,z_,U_],(e,t,r)=>{var{chartData:n}=e;if(t!=null){var a;if((t==null?void 0:t.data)!=null&&t.data.length>0?a=t.data:a=n,(!a||!a.length)&&r!=null&&(a=r.map(s=>yL(yL({},t.presentationProps),s.props))),a!=null)return a}}),V1e=nt([qV,z_,U_],(e,t,r)=>{if(!(e==null||t==null))return e.map((n,a)=>{var s,o=Nn(n,t.nameKey,t.name),l;return r!=null&&(s=r[a])!==null&&s!==void 0&&(s=s.props)!==null&&s!==void 0&&s.fill?l=r[a].props.fill:typeof n=="object"&&n!=null&&"fill"in n?l=n.fill:l=t.fill,{value:Lh(o,t.dataKey),color:l,payload:n,type:t.legendType}})}),q1e=nt([qV,z_,U_,Vi],(e,t,r,n)=>{if(!(t==null||e==null))return Kye({offset:n,pieSettings:t,displayedData:e,cells:r})}),pS={exports:{}},Kn={};/**
 * @license React
 * react-is.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var bL;function W1e(){if(bL)return Kn;bL=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.view_transition"),x=Symbol.for("react.client.reference");function y(v){if(typeof v=="object"&&v!==null){var w=v.$$typeof;switch(w){case e:switch(v=v.type,v){case r:case a:case n:case u:case d:case g:return v;default:switch(v=v&&v.$$typeof,v){case o:case l:case m:case f:return v;case s:return v;default:return w}}case t:return w}}}return Kn.ContextConsumer=s,Kn.ContextProvider=o,Kn.Element=e,Kn.ForwardRef=l,Kn.Fragment=r,Kn.Lazy=m,Kn.Memo=f,Kn.Portal=t,Kn.Profiler=a,Kn.StrictMode=n,Kn.Suspense=u,Kn.SuspenseList=d,Kn.isContextConsumer=function(v){return y(v)===s},Kn.isContextProvider=function(v){return y(v)===o},Kn.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},Kn.isForwardRef=function(v){return y(v)===l},Kn.isFragment=function(v){return y(v)===r},Kn.isLazy=function(v){return y(v)===m},Kn.isMemo=function(v){return y(v)===f},Kn.isPortal=function(v){return y(v)===t},Kn.isProfiler=function(v){return y(v)===a},Kn.isStrictMode=function(v){return y(v)===n},Kn.isSuspense=function(v){return y(v)===u},Kn.isSuspenseList=function(v){return y(v)===d},Kn.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===r||v===a||v===n||v===u||v===d||typeof v=="object"&&v!==null&&(v.$$typeof===m||v.$$typeof===f||v.$$typeof===o||v.$$typeof===s||v.$$typeof===l||v.$$typeof===x||v.getModuleId!==void 0)},Kn.typeOf=y,Kn}var wL;function G1e(){return wL||(wL=1,pS.exports=W1e()),pS.exports}var Y1e=G1e(),jL=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",NL=null,xS=null,WV=e=>{if(e===NL&&Array.isArray(xS))return xS;var t=[];return N.Children.forEach(e,r=>{Sa(r)||(Y1e.isFragment(r)?t=t.concat(WV(r.props.children)):t.push(r))}),xS=t,NL=e,t};function $_(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(a=>jL(a)):n=[jL(t)],WV(e).forEach(a=>{var s=Jm(a,"type.displayName")||Jm(a,"type.name");s&&n.indexOf(s)!==-1&&r.push(a)}),r}var H_=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,gS={},SL;function K1e(){return SL||(SL=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){var a;if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const s=r[Symbol.toStringTag];return s==null||!((a=Object.getOwnPropertyDescriptor(r,Symbol.toStringTag))!=null&&a.writable)?!1:r.toString()===`[object ${s}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(gS)),gS}var vS,AL;function X1e(){return AL||(AL=1,vS=K1e().isPlainObject),vS}var Z1e=X1e();const J1e=af(Z1e);var kL,CL,_L,EL,TL;function PL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function DL(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?PL(Object(r),!0).forEach(function(n){Q1e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Q1e(e,t,r){return(t=eye(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eye(e){var t=tye(e,"string");return typeof t=="symbol"?t:t+""}function tye(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hw(){return hw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},hw.apply(null,arguments)}function Bg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var OL=(e,t,r,n,a)=>{var s=r-n,o;return o=Qa(kL||(kL=Bg(["M ",",",""])),e,t),o+=Qa(CL||(CL=Bg(["L ",",",""])),e+r,t),o+=Qa(_L||(_L=Bg(["L ",",",""])),e+r-s/2,t+a),o+=Qa(EL||(EL=Bg(["L ",",",""])),e+r-s/2-n,t+a),o+=Qa(TL||(TL=Bg(["L ",","," Z"])),e,t),o},rye={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},nye=e=>{var t=mi(e,rye),{x:r,y:n,upperWidth:a,lowerWidth:s,height:o,className:l}=t,{animationEasing:u,animationDuration:d,animationBegin:f,isUpdateAnimationActive:m}=t,g=N.useRef(null),[x,y]=N.useState(-1),v=N.useRef(a),w=N.useRef(s),j=N.useRef(o),k=N.useRef(r),A=N.useRef(n),T=Cx(e,"trapezoid-");if(N.useEffect(()=>{if(g.current&&g.current.getTotalLength)try{var ee=g.current.getTotalLength();ee&&y(ee)}catch{}},[]),r!==+r||n!==+n||a!==+a||s!==+s||o!==+o||a===0&&s===0||o===0)return null;var M=mn("recharts-trapezoid",l);if(!m)return N.createElement("g",null,N.createElement("path",hw({},Gs(t),{className:M,d:OL(r,n,a,s,o)})));var B=v.current,L=w.current,F=j.current,I=k.current,q=A.current,P="0px ".concat(x===-1?1:x,"px"),R="".concat(x,"px ").concat(x,"px"),K=l$(["strokeDasharray"],d,u);return N.createElement(kx,{animationId:T,key:T,canBegin:x>0,duration:d,easing:u,isActive:m,begin:f},ee=>{var se=Rn(B,a,ee),Z=Rn(L,s,ee),ne=Rn(F,o,ee),X=Rn(I,r,ee),le=Rn(q,n,ee);g.current&&(v.current=se,w.current=Z,j.current=ne,k.current=X,A.current=le);var Ae=ee>0?{transition:K,strokeDasharray:R}:{strokeDasharray:P};return N.createElement("path",hw({},Gs(t),{className:M,d:OL(X,le,se,Z,ne),ref:g,style:DL(DL({},Ae),t.style)}))})},aye=["option","shapeType","activeClassName","inActiveClassName"];function iye(e,t){if(e==null)return{};var r,n,a=sye(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function sye(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function RL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function mw(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?RL(Object(r),!0).forEach(function(n){oye(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):RL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function oye(e,t,r){return(t=lye(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lye(e){var t=cye(e,"string");return typeof t=="symbol"?t:t+""}function cye(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function uye(e,t){return mw(mw({},t),e)}function dye(e,t){return e==="symbols"}function ML(e){var{shapeType:t,elementProps:r}=e;switch(t){case"rectangle":return N.createElement(f$,r);case"trapezoid":return N.createElement(nye,r);case"sector":return N.createElement(x$,r);case"symbols":if(dye(t))return N.createElement(fC,r);break;case"curve":return N.createElement(Hp,r);default:return null}}function fye(e){return N.isValidElement(e)?e.props:e}function V_(e){var{option:t,shapeType:r,activeClassName:n="recharts-active-shape",inActiveClassName:a="recharts-shape"}=e,s=iye(e,aye),o;if(N.isValidElement(t))o=N.cloneElement(t,mw(mw({},s),fye(t)));else if(typeof t=="function")o=t(s,s.index);else if(J1e(t)&&typeof t!="boolean"){var l=uye(t,s);o=N.createElement(ML,{shapeType:r,elementProps:l})}else{var u=s;o=N.createElement(ML,{shapeType:r,elementProps:u})}return s.isActive?N.createElement(Ba,{className:n},o):N.createElement(Ba,{className:a},o)}var q_=(e,t,r)=>{var n=Zn();return(a,s)=>o=>{e==null||e(a,s,o),n(eV({activeIndex:String(s),activeDataKey:t,activeCoordinate:a.tooltipPosition,activeGraphicalItemId:r}))}},W_=e=>{var t=Zn();return(r,n)=>a=>{e==null||e(r,n,a),t(vxe())}},G_=(e,t,r)=>{var n=Zn();return(a,s)=>o=>{e==null||e(a,s,o),n(yxe({activeIndex:String(s),activeDataKey:t,activeCoordinate:a.tooltipPosition,activeGraphicalItemId:r}))}};function B5(e){var{tooltipEntrySettings:t}=e,r=Zn(),n=hs(),a=N.useRef(null);return N.useLayoutEffect(()=>{n||(a.current===null?r(mxe(t)):a.current!==t&&r(pxe({prev:a.current,next:t})),a.current=t)},[t,r,n]),N.useLayoutEffect(()=>()=>{a.current&&(r(xxe(a.current)),a.current=null)},[r]),null}function Y_(e){var{legendPayload:t}=e,r=Zn(),n=hs(),a=N.useRef(null);return N.useLayoutEffect(()=>{n||(a.current===null?r(r$(t)):a.current!==t&&r(n$({prev:a.current,next:t})),a.current=t)},[r,n,t]),N.useLayoutEffect(()=>()=>{a.current&&(r(a$(a.current)),a.current=null)},[r]),null}function hye(e){var{legendPayload:t}=e,r=Zn(),n=ir(un),a=N.useRef(null);return N.useLayoutEffect(()=>{n!=="centric"&&n!=="radial"||(a.current===null?r(r$(t)):a.current!==t&&r(n$({prev:a.current,next:t})),a.current=t)},[r,n,t]),N.useLayoutEffect(()=>()=>{a.current&&(r(a$(a.current)),a.current=null)},[r]),null}var yS,mye=()=>{var[e]=N.useState(()=>_v("uid-"));return e},pye=(yS=bX.useId)!==null&&yS!==void 0?yS:mye;function xye(e,t){var r=pye();return t||(e?"".concat(e,"-").concat(r):r)}var gye=N.createContext(void 0),z5=e=>{var{id:t,type:r,children:n}=e,a=xye("recharts-".concat(r),t);return N.createElement(gye.Provider,{value:a},n(a))},vye={cartesianItems:[],polarItems:[]},GV=Ks({name:"graphicalItems",initialState:vye,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:ga()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,a=Ul(e).cartesianItems.indexOf(r);a>-1&&(e.cartesianItems[a]=n)},prepare:ga()},removeCartesianGraphicalItem:{reducer(e,t){var r=Ul(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:ga()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:ga()},removePolarGraphicalItem:{reducer(e,t){var r=Ul(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:ga()},replacePolarGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,a=Ul(e).polarItems.indexOf(r);a>-1&&(e.polarItems[a]=n)},prepare:ga()}}}),{addCartesianGraphicalItem:yye,replaceCartesianGraphicalItem:bye,removeCartesianGraphicalItem:wye,addPolarGraphicalItem:jye,removePolarGraphicalItem:Nye,replacePolarGraphicalItem:Sye}=GV.actions,Aye=GV.reducer,kye=e=>{var t=Zn(),r=N.useRef(null);return N.useLayoutEffect(()=>{r.current===null?t(yye(e)):r.current!==e&&t(bye({prev:r.current,next:e})),r.current=e},[t,e]),N.useLayoutEffect(()=>()=>{r.current&&(t(wye(r.current)),r.current=null)},[t]),null},K_=N.memo(kye),Cye=e=>{var t=Zn(),r=N.useRef(null);return N.useLayoutEffect(()=>{r.current===null?t(jye(e)):r.current!==e&&t(Sye({prev:r.current,next:e})),r.current=e},[t,e]),N.useLayoutEffect(()=>()=>{r.current&&(t(Nye(r.current)),r.current=null)},[t]),null},_ye=N.memo(Cye),Eye=["key"],Tye=["onMouseEnter","onClick","onMouseLeave"],Pye=["id"],Dye=["id"];function Ah(){return Ah=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ah.apply(null,arguments)}function U5(e,t){if(e==null)return{};var r,n,a=Oye(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Oye(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function LL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Da(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LL(Object(r),!0).forEach(function(n){Rye(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rye(e,t,r){return(t=Mye(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mye(e){var t=Lye(e,"string");return typeof t=="symbol"?t:t+""}function Lye(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Iye(e){var t=N.useMemo(()=>$_(e.children,Wd),[e.children]),r=ir(n=>V1e(n,e.id,t));return r==null?null:N.createElement(hye,{legendPayload:r})}function Fye(e){if(!(e==null||typeof e=="boolean"||typeof e=="function")){if(N.isValidElement(e)){var t,r=(t=e.props)===null||t===void 0?void 0:t.fill;return typeof r=="string"?r:void 0}var{fill:n}=e;return typeof n=="string"?n:void 0}}var Bye=N.memo(e=>{var{dataKey:t,nameKey:r,sectors:n,stroke:a,strokeWidth:s,fill:o,name:l,hide:u,tooltipType:d,id:f,activeShape:m}=e,g=Fye(m),x=n.map(v=>{var w=v.tooltipPayload;return g==null||w==null?w:w.map(j=>Da(Da({},j),{},{color:g,fill:g}))}),y={dataDefinedOnItem:x,getPosition:v=>{var w;return(w=n[Number(v)])===null||w===void 0?void 0:w.tooltipPosition},settings:{stroke:a,strokeWidth:s,fill:o,dataKey:t,nameKey:r,name:Lh(l,t),hide:u,type:d,color:o,unit:"",graphicalItemId:f}};return N.createElement(B5,{tooltipEntrySettings:y})}),zye=(e,t)=>e>t?"start":e<t?"end":"middle",Uye=(e,t,r)=>qs(typeof t=="function"?t(e):t,r,r*.8),$ye=(e,t,r)=>{var{top:n,left:a,width:s,height:o}=t,l=h$(s,o),u=a+qs(e.cx,s,s/2),d=n+qs(e.cy,o,o/2),f=qs(e.innerRadius,l,0),m=Uye(r,e.outerRadius,l),g=e.maxRadius||Math.sqrt(s*s+o*o)/2;return{cx:u,cy:d,innerRadius:f,outerRadius:m,maxRadius:g}},Hye=(e,t)=>{var r=cs(t-e),n=Math.min(Math.abs(t-e),360);return r*n},Vye=(e,t)=>{if(N.isValidElement(e))return N.cloneElement(e,t);if(typeof e=="function")return e(t);var r=mn("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:n}=t,a=U5(t,Eye);return N.createElement(Hp,Ah({},a,{type:"linear",className:r}))},qye=(e,t,r)=>{if(N.isValidElement(e))return N.cloneElement(e,t);var n=r;if(typeof e=="function"&&(n=e(t),N.isValidElement(n)))return n;var a=mn("recharts-pie-label-text",VV(e));return N.createElement(M5,Ah({},t,{alignmentBaseline:"middle",className:a}),n)};function Wye(e){var{sectors:t,props:r,showLabels:n}=e,{label:a,labelLine:s,dataKey:o}=r;if(!n||!a||!t)return null;var l=fo(r),u=Xm(a),d=Xm(s),f=typeof a=="object"&&"offsetRadius"in a&&typeof a.offsetRadius=="number"&&a.offsetRadius||20,m=t.map((g,x)=>{var y=(g.startAngle+g.endAngle)/2,v=Si(g.cx,g.cy,g.outerRadius+f,y),w=Da(Da(Da(Da({},l),g),{},{stroke:"none"},u),{},{index:x,textAnchor:zye(v.x,g.cx)},v),j=Da(Da(Da(Da({},l),g),{},{fill:"none",stroke:g.fill},d),{},{index:x,points:[Si(g.cx,g.cy,g.outerRadius,y),v],key:"line"});return N.createElement(po,{zIndex:fi.label,key:"label-".concat(g.startAngle,"-").concat(g.endAngle,"-").concat(g.midAngle,"-").concat(x)},N.createElement(Ba,null,s&&Vye(s,j),qye(a,w,Nn(g,o))))});return N.createElement(Ba,{className:"recharts-pie-labels"},m)}function Gye(e){var{sectors:t,props:r,showLabels:n}=e,{label:a}=r;return typeof a=="object"&&a!=null&&"position"in a?N.createElement(L5,{label:a}):N.createElement(Wye,{sectors:t,props:r,showLabels:n})}function Yye(e){var{sectors:t,activeShape:r,inactiveShape:n,allOtherPieProps:a,shape:s,id:o}=e,l=ir(Sh),u=ir(O_),d=ir(xV),{onMouseEnter:f,onClick:m,onMouseLeave:g}=a,x=U5(a,Tye),y=q_(f,a.dataKey,o),v=W_(g),w=G_(m,a.dataKey,o);return t==null||t.length===0?null:N.createElement(N.Fragment,null,t.map((j,k)=>{if((j==null?void 0:j.startAngle)===0&&(j==null?void 0:j.endAngle)===0&&t.length!==1)return null;var A=d==null||d===o,T=String(k)===l&&(u==null||a.dataKey===u)&&A,M=l?n:null,B=r&&T?r:M,L=Da(Da({},j),{},{stroke:j.stroke,tabIndex:-1,[$U]:k,[HU]:o});return N.createElement(Ba,Ah({key:"sector-".concat(j==null?void 0:j.startAngle,"-").concat(j==null?void 0:j.endAngle,"-").concat(j.midAngle,"-").concat(k),tabIndex:-1,className:"recharts-pie-sector"},h1(x,j,k),{onMouseEnter:y(j,k),onMouseLeave:v(j,k),onClick:w(j,k)}),N.createElement(V_,Ah({option:s??B,index:k,shapeType:"sector",isActive:T},L)))}))}function Kye(e){var t,{pieSettings:r,displayedData:n,cells:a,offset:s}=e,{cornerRadius:o,startAngle:l,endAngle:u,dataKey:d,nameKey:f,tooltipType:m}=r,g=Math.abs(r.minAngle),x=Hye(l,u),y=Math.abs(x),v=n.length<=1?0:(t=r.paddingAngle)!==null&&t!==void 0?t:0,w=n.filter(F=>Nn(F,d,0)!==0).length,j=(y>=360?w:w-1)*v,k=n.reduce((F,I)=>{var q=Nn(I,d,0);return F+(Zt(q)?q:0)},0),A=g>0&&k>0&&n.some(F=>{var I=Nn(F,d,0),q=(Zt(I)?I:0)/k;return I!==0&&q*y<g}),T=A?g:0,M=y-w*T-j,B;if(k>0){var L;B=n.map((F,I)=>{var q=Nn(F,d,0),P=Nn(F,f,I),R=$ye(r,s,F),K=(Zt(q)?q:0)/k,ee,se=Da(Da({},F),a&&a[I]&&a[I].props),Z=se!=null&&"fill"in se&&typeof se.fill=="string"?se.fill:r.fill;I?ee=L.endAngle+cs(x)*v*(q!==0?1:0):ee=l;var ne=ee+cs(x)*((q!==0?T:0)+K*M),X=(ee+ne)/2,le=(R.innerRadius+R.outerRadius)/2,Ae=[{name:P,value:q,payload:se,dataKey:d,type:m,color:Z,fill:Z,graphicalItemId:r.id}],ce=Si(R.cx,R.cy,le,X);return L=Da(Da(Da(Da({},r.presentationProps),{},{percent:K,cornerRadius:typeof o=="string"?parseFloat(o):o,name:P,tooltipPayload:Ae,midAngle:X,middleRadius:le,tooltipPosition:ce},se),R),{},{value:q,dataKey:d,startAngle:ee,endAngle:ne,payload:se,paddingAngle:q!==0?cs(x)*v:0}),L})}return B}function Xye(e){var{showLabels:t,sectors:r,children:n}=e,a=N.useMemo(()=>!t||!r?[]:r.map(s=>({value:s.value,payload:s.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:s.cx,cy:s.cy,innerRadius:s.innerRadius,outerRadius:s.outerRadius,startAngle:s.startAngle,endAngle:s.endAngle,clockWise:!1},fill:s.fill})),[r,t]);return N.createElement(C1e,{value:t?a:void 0},n)}function Zye(e){var{props:t,previousSectorsRef:r,id:n}=e,{sectors:a,isAnimationActive:s,animationBegin:o,animationDuration:l,animationEasing:u,activeShape:d,inactiveShape:f,onAnimationStart:m,onAnimationEnd:g}=t,x=Cx(t,"recharts-pie-"),y=r.current,[v,w]=N.useState(!1),j=N.useCallback(()=>{typeof g=="function"&&g(),w(!1)},[g]),k=N.useCallback(()=>{typeof m=="function"&&m(),w(!0)},[m]);return N.createElement(Xye,{showLabels:!v,sectors:a},N.createElement(kx,{animationId:x,begin:o,duration:l,isActive:s,easing:u,onAnimationStart:k,onAnimationEnd:j,key:x},A=>{var T,M=[],B=a&&a[0],L=(T=B==null?void 0:B.startAngle)!==null&&T!==void 0?T:0;return a==null||a.forEach((F,I)=>{var q=y&&y[I],P=I>0?Jm(F,"paddingAngle",0):0;if(q){var R=Rn(q.endAngle-q.startAngle,F.endAngle-F.startAngle,A),K=Da(Da({},F),{},{startAngle:L+P,endAngle:L+R+P});M.push(K),L=K.endAngle}else{var{endAngle:ee,startAngle:se}=F,Z=Rn(0,ee-se,A),ne=Da(Da({},F),{},{startAngle:L+P,endAngle:L+Z+P});M.push(ne),L=ne.endAngle}}),r.current=M,N.createElement(Ba,null,N.createElement(Yye,{sectors:M,activeShape:d,inactiveShape:f,allOtherPieProps:t,shape:t.shape,id:n}))}),N.createElement(Gye,{showLabels:!v,sectors:a,props:t}),t.children)}var Jye={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:fi.area};function Qye(e){var{id:t}=e,r=U5(e,Pye),{hide:n,className:a,rootTabIndex:s}=e,o=N.useMemo(()=>$_(e.children,Wd),[e.children]),l=ir(f=>q1e(f,t,o)),u=N.useRef(null),d=mn("recharts-pie",a);return n||l==null?(u.current=null,N.createElement(Ba,{tabIndex:s,className:d})):N.createElement(po,{zIndex:e.zIndex},N.createElement(Bye,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t,activeShape:e.activeShape}),N.createElement(Ba,{tabIndex:s,className:d},N.createElement(Zye,{props:Da(Da({},r),{},{sectors:l}),previousSectorsRef:u,id:t})))}function ebe(e){var t=mi(e,Jye),{id:r}=t,n=U5(t,Dye),a=fo(n);return N.createElement(z5,{id:r,type:"pie"},s=>N.createElement(N.Fragment,null,N.createElement(_ye,{type:"pie",id:s,data:n.data,dataKey:n.dataKey,hide:n.hide,angleAxisId:0,radiusAxisId:0,name:n.name,nameKey:n.nameKey,tooltipType:n.tooltipType,legendType:n.legendType,fill:n.fill,cx:n.cx,cy:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,paddingAngle:n.paddingAngle,minAngle:n.minAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,cornerRadius:n.cornerRadius,presentationProps:a,maxRadius:t.maxRadius}),N.createElement(Iye,Ah({},n,{id:s})),N.createElement(Qye,Ah({},n,{id:s}))))}var pw=ebe;pw.displayName="Pie";var tbe=["points"];function IL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function bS(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?IL(Object(r),!0).forEach(function(n){rbe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):IL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rbe(e,t,r){return(t=nbe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nbe(e){var t=abe(e,"string");return typeof t=="symbol"?t:t+""}function abe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xw(){return xw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xw.apply(null,arguments)}function ibe(e,t){if(e==null)return{};var r,n,a=sbe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function sbe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function obe(e){var{option:t,dotProps:r,className:n}=e;if(N.isValidElement(t))return N.cloneElement(t,r);if(typeof t=="function")return t(r);var a=mn(n,typeof t!="boolean"?t.className:""),s=r??{},{points:o}=s,l=ibe(s,tbe);return N.createElement(zV,xw({},l,{className:a}))}function lbe(e,t){return e==null?!1:t?!0:e.length===1}function YV(e){var{points:t,dot:r,className:n,dotClassName:a,dataKey:s,baseProps:o,needClip:l,clipPathId:u,zIndex:d=fi.scatter}=e;if(!lbe(t,r))return null;var f=H_(r),m=Gse(r),g=t.map((y,v)=>{var w,j,k=bS(bS(bS({r:3},o),m),{},{index:v,cx:(w=y.x)!==null&&w!==void 0?w:void 0,cy:(j=y.y)!==null&&j!==void 0?j:void 0,dataKey:s,value:y.value,payload:y.payload,points:t});return N.createElement(obe,{key:"dot-".concat(v),option:r,dotProps:k,className:a})}),x={};return l&&u!=null&&(x.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(u,")")),N.createElement(po,{zIndex:d},N.createElement(Ba,xw({className:n},x),g))}function FL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function BL(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?FL(Object(r),!0).forEach(function(n){cbe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):FL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cbe(e,t,r){return(t=ube(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ube(e){var t=dbe(e,"string");return typeof t=="symbol"?t:t+""}function dbe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var KV=0,fbe={xAxis:{},yAxis:{},zAxis:{}},XV=Ks({name:"cartesianAxis",initialState:fbe,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:ga()},replaceXAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.xAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.xAxis[r.id],e.xAxis[n.id]=n)},prepare:ga()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:ga()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:ga()},replaceYAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.yAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.yAxis[r.id],e.yAxis[n.id]=n)},prepare:ga()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:ga()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:ga()},replaceZAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.zAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.zAxis[r.id],e.zAxis[n.id]=n)},prepare:ga()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:ga()},updateYAxisWidth(e,t){var{id:r,width:n}=t.payload,a=e.yAxis[r];if(a){var s,o=a.widthHistory||[];if(o.length===3&&o[0]===o[2]&&n===o[1]&&n!==a.width&&Math.abs(n-((s=o[0])!==null&&s!==void 0?s:0))<=1)return;var l=[...o,n].slice(-3);e.yAxis[r]=BL(BL({},a),{},{width:n,widthHistory:l})}}}}),{addXAxis:hbe,replaceXAxis:mbe,removeXAxis:pbe,addYAxis:xbe,replaceYAxis:gbe,removeYAxis:vbe,addZAxis:WMe,replaceZAxis:GMe,removeZAxis:YMe,updateYAxisWidth:ybe}=XV.actions,bbe=XV.reducer,wbe=nt([Vi],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),jbe=nt([wbe,of,lf],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),$5=()=>ir(jbe),Nbe=()=>ir(hge);function zL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function wS(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zL(Object(r),!0).forEach(function(n){Sbe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Sbe(e,t,r){return(t=Abe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Abe(e){var t=kbe(e,"string");return typeof t=="symbol"?t:t+""}function kbe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Cbe=e=>{var{point:t,childIndex:r,mainColor:n,activeDot:a,dataKey:s,clipPath:o}=e;if(a===!1||t.x==null||t.y==null)return null;var l={index:r,dataKey:s,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},u=wS(wS(wS({},l),Xm(a)),hC(a)),d;return N.isValidElement(a)?d=N.cloneElement(a,u):typeof a=="function"?d=a(u):d=N.createElement(zV,u),N.createElement(Ba,{className:"recharts-active-dot",clipPath:o},d)};function MA(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:a,clipPath:s,zIndex:o=fi.activeDot}=e,l=ir(Sh),u=Nbe();if(t==null||u==null)return null;var d=t.find(f=>u.includes(f.payload));return Sa(d)?null:N.createElement(po,{zIndex:o},N.createElement(Cbe,{point:d,childIndex:Number(l),mainColor:r,dataKey:a,activeDot:n,clipPath:s}))}var UL=(e,t,r)=>{var n=r??e;if(!Sa(n))return qs(n,t,0)},_be=(e,t,r)=>{var n={},a=e.filter(w5),s=e.filter(d=>d.stackId==null),o=a.reduce((d,f)=>{var m=d[f.stackId];return m==null&&(m=[]),m.push(f),d[f.stackId]=m,d},n),l=Object.entries(o).map(d=>{var f,[m,g]=d,x=g.map(v=>v.dataKey),y=UL(t,r,(f=g[0])===null||f===void 0?void 0:f.barSize);return{stackId:m,dataKeys:x,barSize:y}}),u=s.map(d=>{var f=[d.dataKey].filter(g=>g!=null),m=UL(t,r,d.barSize);return{stackId:void 0,dataKeys:f,barSize:m}});return[...l,...u]};function $L(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ib(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$L(Object(r),!0).forEach(function(n){Ebe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$L(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ebe(e,t,r){return(t=Tbe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tbe(e){var t=Pbe(e,"string");return typeof t=="symbol"?t:t+""}function Pbe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Dbe(e,t,r,n,a){var s,o=n.length;if(!(o<1)){var l=qs(e,r,0,!0),u,d=[];if(Kr((s=n[0])===null||s===void 0?void 0:s.barSize)){var f=!1,m=r/o,g=n.reduce((k,A)=>k+(A.barSize||0),0);g+=(o-1)*l,g>=r&&(g-=(o-1)*l,l=0),g>=r&&m>0&&(f=!0,m*=.9,g=o*m);var x=(r-g)/2>>0,y={offset:x-l,size:0};u=n.reduce((k,A)=>{var T,M={stackId:A.stackId,dataKeys:A.dataKeys,position:{offset:y.offset+y.size+l,size:f?m:(T=A.barSize)!==null&&T!==void 0?T:0}},B=[...k,M];return y=M.position,B},d)}else{var v=qs(t,r,0,!0);r-2*v-(o-1)*l<=0&&(l=0);var w=(r-2*v-(o-1)*l)/o;w>1&&(w>>=0);var j=Kr(a)?Math.min(w,a):w;u=n.reduce((k,A,T)=>[...k,{stackId:A.stackId,dataKeys:A.dataKeys,position:{offset:v+(w+l)*T+(w-j)/2,size:j}}],d)}return u}}var Obe=(e,t,r,n,a,s,o)=>{var l=Sa(o)?t:o,u=Dbe(r,n,a!==s?a:s,e,l);return a!==s&&u!=null&&(u=u.map(d=>ib(ib({},d),{},{position:ib(ib({},d.position),{},{offset:d.position.offset-a/2})}))),u},Rbe=(e,t)=>{var r=b5(t);if(!(!e||r==null||t==null)){var{stackId:n}=t;if(n!=null){var a=e[n];if(a){var{stackedData:s}=a;if(s)return s.find(o=>o.key===r)}}}},Mbe=(e,t)=>{if(!(e==null||t==null)){var r=e.find(n=>n.stackId===t.stackId&&t.dataKey!=null&&n.dataKeys.includes(t.dataKey));if(r!=null)return r.position}};function Lbe(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&Kr(e.zIndex)?e.zIndex:t}var ZV=e=>{var{chartData:t}=e,r=Zn(),n=hs();return N.useEffect(()=>n?()=>{}:(r(JM(t)),()=>{r(JM(void 0))}),[t,r,n]),null},HL={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},JV=Ks({name:"brush",initialState:HL,reducers:{setBrushSettings(e,t){return t.payload==null?HL:t.payload}}}),{setBrushSettings:KMe}=JV.actions,Ibe=JV.reducer;function Fbe(e){return(e%180+180)%180}var Bbe=function(t){var{width:r,height:n}=t,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=Fbe(a),o=s*Math.PI/180,l=Math.atan(n/r),u=o>l&&o<Math.PI-l?n/Math.sin(o):r/Math.cos(o);return Math.abs(u)},zbe={dots:[],areas:[],lines:[]},QV=Ks({name:"referenceElements",initialState:zbe,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=Ul(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=Ul(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=Ul(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:XMe,removeDot:ZMe,addArea:JMe,removeArea:QMe,addLine:eLe,removeLine:tLe}=QV.actions,Ube=QV.reducer,$be=N.createContext(void 0),Hbe=e=>{var{children:t}=e,[r]=N.useState("".concat(_v("recharts"),"-clip")),n=$5();if(n==null)return null;var{x:a,y:s,width:o,height:l}=n;return N.createElement($be.Provider,{value:r},N.createElement("defs",null,N.createElement("clipPath",{id:r},N.createElement("rect",{x:a,y:s,height:l,width:o}))),t)};function eq(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;n<e.length;n+=t){var a=e[n];a!==void 0&&r.push(a)}return r}function Vbe(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return Bbe(n,r)}function qbe(e,t,r){var n=r==="width",{x:a,y:s,width:o,height:l}=e;return t===1?{start:n?a:s,end:n?a+o:s+l}:{start:n?a+o:s+l,end:n?a:s}}function $v(e,t,r,n,a){if(e*t<e*n||e*t>e*a)return!1;var s=r();return e*(t-e*s/2-n)>=0&&e*(t+e*s/2-a)<=0}function Wbe(e,t){return eq(e,t+1)}function Gbe(e,t,r,n,a){for(var s=(n||[]).slice(),{start:o,end:l}=t,u=0,d=1,f=o,m=function(){var y=n==null?void 0:n[u];if(y===void 0)return{v:eq(n,d)};var v=u,w,j=()=>(w===void 0&&(w=r(y,v)),w),k=y.coordinate,A=u===0||$v(e,k,j,f,l);A||(u=0,f=o,d+=1),A&&(f=k+e*(j()/2+a),u+=d)},g;d<=s.length;)if(g=m(),g)return g.v;return[]}function Ybe(e,t,r,n,a){var s=(n||[]).slice(),o=s.length;if(o===0)return[];for(var{start:l,end:u}=t,d=1;d<=o;d++){for(var f=(o-1)%d,m=l,g=!0,x=function(){var T=n[v];if(T==null)return 0;var M=v,B,L=()=>(B===void 0&&(B=r(T,M)),B),F=T.coordinate,I=v===f||$v(e,F,L,m,u);if(!I)return g=!1,1;I&&(m=F+e*(L()/2+a))},y,v=f;v<o&&(y=x(),!(y!==0&&y===1));v+=d);if(g){for(var w=[],j=f;j<o;j+=d){var k=n[j];k!=null&&w.push(k)}return w}}return[]}function VL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Bs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?VL(Object(r),!0).forEach(function(n){Kbe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):VL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Kbe(e,t,r){return(t=Xbe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xbe(e){var t=Zbe(e,"string");return typeof t=="symbol"?t:t+""}function Zbe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jbe(e,t,r,n,a){for(var s=(n||[]).slice(),o=s.length,{start:l}=t,{end:u}=t,d=function(g){var x=s[g];if(x==null)return 1;var y=x,v,w=()=>(v===void 0&&(v=r(x,g)),v);if(g===o-1){var j=e*(y.coordinate+e*w()/2-u);s[g]=y=Bs(Bs({},y),{},{tickCoord:j>0?y.coordinate-j*e:y.coordinate})}else s[g]=y=Bs(Bs({},y),{},{tickCoord:y.coordinate});if(y.tickCoord!=null){var k=$v(e,y.tickCoord,w,l,u);k&&(u=y.tickCoord-e*(w()/2+a),s[g]=Bs(Bs({},y),{},{isShow:!0}))}},f=o-1;f>=0;f--)d(f);return s}function Qbe(e,t,r,n,a,s){var o=(n||[]).slice(),l=o.length,{start:u,end:d}=t;if(s){var f=n[l-1];if(f!=null){var m=r(f,l-1),g=e*(f.coordinate+e*m/2-d);if(o[l-1]=f=Bs(Bs({},f),{},{tickCoord:g>0?f.coordinate-g*e:f.coordinate}),f.tickCoord!=null){var x=$v(e,f.tickCoord,()=>m,u,d);x&&(d=f.tickCoord-e*(m/2+a),o[l-1]=Bs(Bs({},f),{},{isShow:!0}))}}}for(var y=s?l-1:l,v=function(k){var A=o[k];if(A==null)return 1;var T=A,M,B=()=>(M===void 0&&(M=r(A,k)),M);if(k===0){var L=e*(T.coordinate-e*B()/2-u);o[k]=T=Bs(Bs({},T),{},{tickCoord:L<0?T.coordinate-L*e:T.coordinate})}else o[k]=T=Bs(Bs({},T),{},{tickCoord:T.coordinate});if(T.tickCoord!=null){var F=$v(e,T.tickCoord,B,u,d);F&&(u=T.tickCoord+e*(B()/2+a),o[k]=Bs(Bs({},T),{},{isShow:!0}))}},w=0;w<y;w++)v(w);return o}function X_(e,t,r){var{tick:n,ticks:a,viewBox:s,minTickGap:o,orientation:l,interval:u,tickFormatter:d,unit:f,angle:m}=e;if(!a||!a.length||!n)return[];if(Zt(u)||y1.isSsr){var g;return(g=Wbe(a,Zt(u)?u:0))!==null&&g!==void 0?g:[]}var x=[],y=l==="top"||l==="bottom"?"width":"height",v=f&&y==="width"?sv(f,{fontSize:t,letterSpacing:r}):{width:0,height:0},w=(M,B)=>{var L=typeof d=="function"?d(M.value,B):M.value;return y==="width"?Vbe(sv(L,{fontSize:t,letterSpacing:r}),v,m):sv(L,{fontSize:t,letterSpacing:r})[y]},j=a[0],k=a[1],A=a.length>=2&&j!=null&&k!=null?cs(k.coordinate-j.coordinate):1,T=qbe(s,A,y);return u==="equidistantPreserveStart"?Gbe(A,T,w,a,o):u==="equidistantPreserveEnd"?Ybe(A,T,w,a,o):(u==="preserveStart"||u==="preserveStartEnd"?x=Qbe(A,T,w,a,o,u==="preserveStartEnd"):x=Jbe(A,T,w,a,o),x.filter(M=>M.isShow))}var e2e=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:a=0,tickMargin:s=0}=e,o=0;if(t){Array.from(t).forEach(f=>{if(f){var m=f.getBoundingClientRect();m.width>o&&(o=m.width)}});var l=r?r.getBoundingClientRect().width:0,u=a+s,d=o+u+l+(r?n:0);return Math.round(d)}return 0},t2e={xAxis:{},yAxis:{}},tq=Ks({name:"renderedTicks",initialState:t2e,reducers:{setRenderedTicks:(e,t)=>{var{axisType:r,axisId:n,ticks:a}=t.payload;e[r][n]=a},removeRenderedTicks:(e,t)=>{var{axisType:r,axisId:n}=t.payload;delete e[r][n]}}}),{setRenderedTicks:r2e,removeRenderedTicks:n2e}=tq.actions,a2e=tq.reducer,i2e=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function s2e(e,t){if(e==null)return{};var r,n,a=o2e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function o2e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function i0(){return i0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i0.apply(null,arguments)}function qL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Za(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qL(Object(r),!0).forEach(function(n){l2e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function l2e(e,t,r){return(t=c2e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c2e(e){var t=u2e(e,"string");return typeof t=="symbol"?t:t+""}function u2e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gd={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:fi.axis};function d2e(e){var{x:t,y:r,width:n,height:a,orientation:s,mirror:o,axisLine:l,otherSvgProps:u}=e;if(!l)return null;var d=Za(Za(Za({},u),fo(l)),{},{fill:"none"});if(s==="top"||s==="bottom"){var f=+(s==="top"&&!o||s==="bottom"&&o);d=Za(Za({},d),{},{x1:t,y1:r+f*a,x2:t+n,y2:r+f*a})}else{var m=+(s==="left"&&!o||s==="right"&&o);d=Za(Za({},d),{},{x1:t+m*n,y1:r,x2:t+m*n,y2:r+a})}return N.createElement("line",i0({},d,{className:mn("recharts-cartesian-axis-line",Jm(l,"className"))}))}function f2e(e,t,r,n,a,s,o,l,u){var d,f,m,g,x,y,v=l?-1:1,w=e.tickSize||o,j=Zt(e.tickCoord)?e.tickCoord:e.coordinate;switch(s){case"top":d=f=e.coordinate,g=r+ +!l*a,m=g-v*w,y=m-v*u,x=j;break;case"left":m=g=e.coordinate,f=t+ +!l*n,d=f-v*w,x=d-v*u,y=j;break;case"right":m=g=e.coordinate,f=t+ +l*n,d=f+v*w,x=d+v*u,y=j;break;default:d=f=e.coordinate,g=r+ +l*a,m=g+v*w,y=m+v*u,x=j;break}return{line:{x1:d,y1:m,x2:f,y2:g},tick:{x,y}}}function h2e(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function m2e(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function p2e(e){var{option:t,tickProps:r,value:n}=e,a,s=mn(r.className,"recharts-cartesian-axis-tick-value");if(N.isValidElement(t))a=N.cloneElement(t,Za(Za({},r),{},{className:s}));else if(typeof t=="function")a=t(Za(Za({},r),{},{className:s}));else{var o="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(o=mn(o,VV(t))),a=N.createElement(M5,i0({},r,{className:o}),n)}return a}function x2e(e){var{ticks:t,axisType:r,axisId:n}=e,a=Zn();return N.useEffect(()=>{if(n==null||r==null)return Mh;var s=t.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return a(r2e({ticks:s,axisId:n,axisType:r})),()=>{a(n2e({axisId:n,axisType:r}))}},[a,t,n,r]),null}var g2e=N.forwardRef((e,t)=>{var{ticks:r=[],tick:n,tickLine:a,stroke:s,tickFormatter:o,unit:l,padding:u,tickTextProps:d,orientation:f,mirror:m,x:g,y:x,width:y,height:v,tickSize:w,tickMargin:j,fontSize:k,letterSpacing:A,getTicksConfig:T,events:M,axisType:B,axisId:L}=e,F=X_(Za(Za({},T),{},{ticks:r}),k,A),I=fo(T),q=Xm(n),P=DV(I.textAnchor)?I.textAnchor:h2e(f,m),R=m2e(f,m),K={};typeof a=="object"&&(K=a);var ee=Za(Za({},I),{},{fill:"none"},K),se=F.map(X=>Za({entry:X},f2e(X,g,x,y,v,f,w,m,j))),Z=se.map(X=>{var{entry:le,line:Ae}=X;return N.createElement(Ba,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(le.value,"-").concat(le.coordinate,"-").concat(le.tickCoord)},a&&N.createElement("line",i0({},ee,Ae,{className:mn("recharts-cartesian-axis-tick-line",Jm(a,"className"))})))}),ne=se.map((X,le)=>{var Ae,ce,{entry:D,tick:H}=X,G=Za(Za(Za(Za({verticalAnchor:R},I),{},{textAnchor:P,stroke:"none",fill:s},H),{},{index:le,payload:D,visibleTicksCount:F.length,tickFormatter:o,padding:u},d),{},{angle:(Ae=(ce=d==null?void 0:d.angle)!==null&&ce!==void 0?ce:I.angle)!==null&&Ae!==void 0?Ae:0}),E=Za(Za({},G),q);return N.createElement(Ba,i0({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(D.value,"-").concat(D.coordinate,"-").concat(D.tickCoord)},h1(M,D,le)),n&&N.createElement(p2e,{option:n,tickProps:E,value:"".concat(typeof o=="function"?o(D.value,le):D.value).concat(l||"")}))});return N.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(B,"-ticks")},N.createElement(x2e,{ticks:F,axisId:L,axisType:B}),ne.length>0&&N.createElement(po,{zIndex:fi.label},N.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(B,"-tick-labels"),ref:t},ne)),Z.length>0&&N.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(B,"-tick-lines")},Z))}),v2e=N.forwardRef((e,t)=>{var{axisLine:r,width:n,height:a,className:s,hide:o,ticks:l,axisType:u,axisId:d}=e,f=s2e(e,i2e),[m,g]=N.useState(""),[x,y]=N.useState(""),v=N.useRef(null);N.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var j;return e2e({ticks:v.current,label:(j=e.labelRef)===null||j===void 0?void 0:j.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var w=N.useCallback(j=>{if(j){var k=j.getElementsByClassName("recharts-cartesian-axis-tick-value");v.current=k;var A=k[0];if(A){var T=window.getComputedStyle(A),M=T.fontSize,B=T.letterSpacing;(M!==m||B!==x)&&(g(M),y(B))}}},[m,x]);return o||n!=null&&n<=0||a!=null&&a<=0?null:N.createElement(po,{zIndex:e.zIndex},N.createElement(Ba,{className:mn("recharts-cartesian-axis",s)},N.createElement(d2e,{x:e.x,y:e.y,width:n,height:a,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:fo(e)}),N.createElement(g2e,{ref:w,axisType:u,events:f,fontSize:m,getTicksConfig:e,height:e.height,letterSpacing:x,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:d}),N.createElement(f1e,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},N.createElement(j1e,{label:e.label,labelRef:e.labelRef}),e.children)))}),Z_=N.forwardRef((e,t)=>{var r=mi(e,Gd);return N.createElement(v2e,i0({},r,{ref:t}))});Z_.displayName="CartesianAxis";var y2e=["x1","y1","x2","y2","key"],b2e=["offset"],w2e=["xAxisId","yAxisId"],j2e=["xAxisId","yAxisId"];function WL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function $s(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?WL(Object(r),!0).forEach(function(n){N2e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function N2e(e,t,r){return(t=S2e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S2e(e){var t=A2e(e,"string");return typeof t=="symbol"?t:t+""}function A2e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rm(){return Rm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rm.apply(null,arguments)}function gw(e,t){if(e==null)return{};var r,n,a=k2e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function k2e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var C2e=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:a,width:s,height:o,ry:l}=e;return N.createElement("rect",{x:n,y:a,ry:l,width:s,height:o,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function rq(e){var{option:t,lineItemProps:r}=e,n;if(N.isValidElement(t))n=N.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var a,{x1:s,y1:o,x2:l,y2:u,key:d}=r,f=gw(r,y2e),m=(a=fo(f))!==null&&a!==void 0?a:{},{offset:g}=m,x=gw(m,b2e);n=N.createElement("line",Rm({},x,{x1:s,y1:o,x2:l,y2:u,fill:"none",key:d}))}return n}function _2e(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:a}=e;if(!n||!a||!a.length)return null;var{xAxisId:s,yAxisId:o}=e,l=gw(e,w2e),u=a.map((d,f)=>{var m=$s($s({},l),{},{x1:t,y1:d,x2:t+r,y2:d,key:"line-".concat(f),index:f});return N.createElement(rq,{key:"line-".concat(f),option:n,lineItemProps:m})});return N.createElement("g",{className:"recharts-cartesian-grid-horizontal"},u)}function E2e(e){var{y:t,height:r,vertical:n=!0,verticalPoints:a}=e;if(!n||!a||!a.length)return null;var{xAxisId:s,yAxisId:o}=e,l=gw(e,j2e),u=a.map((d,f)=>{var m=$s($s({},l),{},{x1:d,y1:t,x2:d,y2:t+r,key:"line-".concat(f),index:f});return N.createElement(rq,{option:n,lineItemProps:m,key:"line-".concat(f)})});return N.createElement("g",{className:"recharts-cartesian-grid-vertical"},u)}function T2e(e){var{horizontalFill:t,fillOpacity:r,x:n,y:a,width:s,height:o,horizontalPoints:l,horizontal:u=!0}=e;if(!u||!t||!t.length||l==null)return null;var d=l.map(m=>Math.round(m+a-a)).sort((m,g)=>m-g);a!==d[0]&&d.unshift(0);var f=d.map((m,g)=>{var x=d[g+1],y=x==null,v=y?a+o-m:x-m;if(v<=0)return null;var w=g%t.length;return N.createElement("rect",{key:"react-".concat(g),y:m,x:n,height:v,width:s,stroke:"none",fill:t[w],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return N.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function P2e(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:a,y:s,width:o,height:l,verticalPoints:u}=e;if(!t||!r||!r.length)return null;var d=u.map(m=>Math.round(m+a-a)).sort((m,g)=>m-g);a!==d[0]&&d.unshift(0);var f=d.map((m,g)=>{var x=d[g+1],y=x==null,v=y?a+o-m:x-m;if(v<=0)return null;var w=g%r.length;return N.createElement("rect",{key:"react-".concat(g),x:m,y:s,width:v,height:l,stroke:"none",fill:r[w],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return N.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var D2e=(e,t)=>{var{xAxis:r,width:n,height:a,offset:s}=e;return FU(X_($s($s($s({},Gd),r),{},{ticks:BU(r),viewBox:{x:0,y:0,width:n,height:a}})),s.left,s.left+s.width,t)},O2e=(e,t)=>{var{yAxis:r,width:n,height:a,offset:s}=e;return FU(X_($s($s($s({},Gd),r),{},{ticks:BU(r),viewBox:{x:0,y:0,width:n,height:a}})),s.top,s.top+s.height,t)},R2e={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:fi.grid};function Mm(e){var t=AC(),r=kC(),n=GU(),a=$s($s({},mi(e,R2e)),{},{x:Zt(e.x)?e.x:n.left,y:Zt(e.y)?e.y:n.top,width:Zt(e.width)?e.width:n.width,height:Zt(e.height)?e.height:n.height}),{xAxisId:s,yAxisId:o,x:l,y:u,width:d,height:f,syncWithTicks:m,horizontalValues:g,verticalValues:x}=a,y=hs(),v=ir(I=>BM(I,"xAxis",s,y)),w=ir(I=>BM(I,"yAxis",o,y));if(!$u(d)||!$u(f)||!Zt(l)||!Zt(u))return null;var j=a.verticalCoordinatesGenerator||D2e,k=a.horizontalCoordinatesGenerator||O2e,{horizontalPoints:A,verticalPoints:T}=a;if((!A||!A.length)&&typeof k=="function"){var M=g&&g.length,B=k({yAxis:w?$s($s({},w),{},{ticks:M?g:w.ticks}):void 0,width:t??d,height:r??f,offset:n},M?!0:m);z2(Array.isArray(B),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof B,"]")),Array.isArray(B)&&(A=B)}if((!T||!T.length)&&typeof j=="function"){var L=x&&x.length,F=j({xAxis:v?$s($s({},v),{},{ticks:L?x:v.ticks}):void 0,width:t??d,height:r??f,offset:n},L?!0:m);z2(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof F,"]")),Array.isArray(F)&&(T=F)}return N.createElement(po,{zIndex:a.zIndex},N.createElement("g",{className:"recharts-cartesian-grid"},N.createElement(C2e,{fill:a.fill,fillOpacity:a.fillOpacity,x:a.x,y:a.y,width:a.width,height:a.height,ry:a.ry}),N.createElement(T2e,Rm({},a,{horizontalPoints:A})),N.createElement(P2e,Rm({},a,{verticalPoints:T})),N.createElement(_2e,Rm({},a,{offset:n,horizontalPoints:A,xAxis:v,yAxis:w})),N.createElement(E2e,Rm({},a,{offset:n,verticalPoints:T,xAxis:v,yAxis:w}))))}Mm.displayName="CartesianGrid";var M2e={},nq=Ks({name:"errorBars",initialState:M2e,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:a}=t.payload;e[r]&&(e[r]=e[r].map(s=>s.dataKey===n.dataKey&&s.direction===n.direction?a:s))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(a=>a.dataKey!==n.dataKey||a.direction!==n.direction))}}}),{addErrorBar:rLe,replaceErrorBar:nLe,removeErrorBar:aLe}=nq.actions,L2e=nq.reducer,I2e=["children"];function F2e(e,t){if(e==null)return{};var r,n,a=B2e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function B2e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var z2e={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},U2e=N.createContext(z2e);function aq(e){var{children:t}=e,r=F2e(e,I2e);return N.createElement(U2e.Provider,{value:r},t)}function H5(e,t){var r,n,a=ir(d=>uf(d,e)),s=ir(d=>df(d,t)),o=(r=a==null?void 0:a.allowDataOverflow)!==null&&r!==void 0?r:Li.allowDataOverflow,l=(n=s==null?void 0:s.allowDataOverflow)!==null&&n!==void 0?n:Ii.allowDataOverflow,u=o||l;return{needClip:u,needClipX:o,needClipY:l}}function J_(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,a=$5(),{needClipX:s,needClipY:o,needClip:l}=H5(t,r);if(!l||!a)return null;var{x:u,y:d,width:f,height:m}=a;return N.createElement("clipPath",{id:"clipPath-".concat(n)},N.createElement("rect",{x:s?u:u-f/2,y:o?d:d-m/2,width:s?f:f*2,height:o?m:m*2}))}var iq=(e,t,r,n)=>Wu(e,"xAxis",t,n),sq=(e,t,r,n)=>qu(e,"xAxis",t,n),oq=(e,t,r,n)=>Wu(e,"yAxis",r,n),lq=(e,t,r,n)=>qu(e,"yAxis",r,n),$2e=nt([un,iq,oq,sq,lq],(e,t,r,n,a)=>Bc(e,"xAxis")?Nh(t,n,!1):Nh(r,a,!1)),H2e=(e,t,r,n,a)=>a;function V2e(e){return e.type==="line"}var q2e=nt([_1,H2e],(e,t)=>e.filter(V2e).find(r=>r.id===t)),W2e=nt([un,iq,oq,sq,lq,q2e,$2e,w1],(e,t,r,n,a,s,o,l)=>{var{chartData:u,dataStartIndex:d,dataEndIndex:f}=l;if(!(s==null||t==null||r==null||n==null||a==null||n.length===0||a.length===0||o==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:m,data:g}=s,x;if(g!=null&&g.length>0?x=g:x=u==null?void 0:u.slice(d,f+1),x!=null)return fwe({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:a,dataKey:m,bandSize:o,displayedData:x})}});function cq(e){var t=Xm(e),r=3,n=2;if(t!=null){var{r:a,strokeWidth:s}=t,o=Number(a),l=Number(s);return(Number.isNaN(o)||o<0)&&(o=r),(Number.isNaN(l)||l<0)&&(l=n),{r:o,strokeWidth:l}}return{r,strokeWidth:n}}var G2e=["id"],Y2e=["type","layout","connectNulls","needClip","shape"],K2e=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Hv(){return Hv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Hv.apply(null,arguments)}function GL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Tu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?GL(Object(r),!0).forEach(function(n){X2e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):GL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function X2e(e,t,r){return(t=Z2e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z2e(e){var t=J2e(e,"string");return typeof t=="symbol"?t:t+""}function J2e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Q_(e,t){if(e==null)return{};var r,n,a=Q2e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Q2e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var ewe=e=>{var{dataKey:t,name:r,stroke:n,legendType:a,hide:s}=e;return[{inactive:s,dataKey:t,type:a,color:n,value:Lh(r,t),payload:e}]},twe=N.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:a,fill:s,name:o,hide:l,unit:u,tooltipType:d,id:f}=e,m={dataDefinedOnItem:r,getPosition:Mh,settings:{stroke:n,strokeWidth:a,fill:s,dataKey:t,nameKey:void 0,name:Lh(o,t),hide:l,type:d,color:n,unit:u,graphicalItemId:f}};return N.createElement(B5,{tooltipEntrySettings:m})}),uq=(e,t)=>"".concat(t,"px ").concat(e,"px");function rwe(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],a=0;a<t;++a)n.push(...r);return n}var nwe=(e,t,r)=>{var n=r.reduce((g,x)=>g+x,0);if(!n)return uq(t,e);for(var a=Math.floor(e/n),s=e%n,o=[],l=0,u=0;l<r.length;u+=(d=r[l])!==null&&d!==void 0?d:0,++l){var d,f=r[l];if(f!=null&&u+f>s){o=[...r.slice(0,l),s-u];break}}var m=o.length%2===0?[0,t]:[t];return[...rwe(r,a),...o,...m].map(g=>"".concat(g,"px")).join(", ")};function awe(e){var{clipPathId:t,points:r,props:n}=e,{dot:a,dataKey:s,needClip:o}=n,{id:l}=n,u=Q_(n,G2e),d=fo(u);return N.createElement(YV,{points:r,dot:a,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:s,baseProps:d,needClip:o,clipPathId:t})}function iwe(e){var{showLabels:t,children:r,points:n}=e,a=N.useMemo(()=>n==null?void 0:n.map(s=>{var o,l,u={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Tu(Tu({},u),{},{value:s.value,payload:s.payload,viewBox:u,parentViewBox:void 0,fill:void 0})}),[n]);return N.createElement(B_,{value:t?a:void 0},r)}function YL(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:a,props:s}=e,{type:o,layout:l,connectNulls:u,needClip:d,shape:f}=s,m=Q_(s,Y2e),g=Tu(Tu({},Gs(m)),{},{fill:"none",className:"recharts-line-curve",clipPath:d?"url(#clipPath-".concat(t,")"):void 0,points:n,type:o,layout:l,connectNulls:u,strokeDasharray:a??s.strokeDasharray});return N.createElement(N.Fragment,null,(n==null?void 0:n.length)>1&&N.createElement(V_,Hv({shapeType:"curve",option:f},g,{pathRef:r})),N.createElement(awe,{points:n,clipPathId:t,props:s}))}function swe(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function owe(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:a,longestAnimatedLengthRef:s}=e,{points:o,strokeDasharray:l,isAnimationActive:u,animationBegin:d,animationDuration:f,animationEasing:m,animateNewValues:g,width:x,height:y,onAnimationEnd:v,onAnimationStart:w}=r,j=a.current,k=Cx(o,"recharts-line-"),A=N.useRef(k),[T,M]=N.useState(!1),B=!T,L=N.useCallback(()=>{typeof v=="function"&&v(),M(!1)},[v]),F=N.useCallback(()=>{typeof w=="function"&&w(),M(!0)},[w]),I=swe(n.current),q=N.useRef(0);A.current!==k&&(q.current=s.current,A.current=k);var P=q.current;return N.createElement(iwe,{points:o,showLabels:B},r.children,N.createElement(kx,{animationId:k,begin:d,duration:f,isActive:u,easing:m,onAnimationEnd:L,onAnimationStart:F,key:k},R=>{var K=Rn(P,I+P,R),ee=Math.min(K,I),se;if(u)if(l){var Z="".concat(l).split(/[,\s]+/gim).map(le=>parseFloat(le));se=nwe(ee,I,Z)}else se=uq(I,ee);else se=l==null?void 0:String(l);if(R>0&&I>0&&(a.current=o,s.current=Math.max(s.current,ee)),j){var ne=j.length/o.length,X=R===1?o:o.map((le,Ae)=>{var ce=Math.floor(Ae*ne);if(j[ce]){var D=j[ce];return Tu(Tu({},le),{},{x:Rn(D.x,le.x,R),y:Rn(D.y,le.y,R)})}return g?Tu(Tu({},le),{},{x:Rn(x*2,le.x,R),y:Rn(y/2,le.y,R)}):Tu(Tu({},le),{},{x:le.x,y:le.y})});return a.current=X,N.createElement(YL,{props:r,points:X,clipPathId:t,pathRef:n,strokeDasharray:se})}return N.createElement(YL,{props:r,points:o,clipPathId:t,pathRef:n,strokeDasharray:se})}),N.createElement(L5,{label:r.label}))}function lwe(e){var{clipPathId:t,props:r}=e,n=N.useRef(null),a=N.useRef(0),s=N.useRef(null);return N.createElement(owe,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:a,pathRef:s})}var cwe=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:Nn(e.payload,t)}};class uwe extends N.Component{render(){var{hide:t,dot:r,points:n,className:a,xAxisId:s,yAxisId:o,top:l,left:u,width:d,height:f,id:m,needClip:g,zIndex:x}=this.props;if(t)return null;var y=mn("recharts-line",a),v=m,{r:w,strokeWidth:j}=cq(r),k=H_(r),A=w*2+j,T=g?"url(#clipPath-".concat(k?"":"dots-").concat(v,")"):void 0;return N.createElement(po,{zIndex:x},N.createElement(Ba,{className:y},g&&N.createElement("defs",null,N.createElement(J_,{clipPathId:v,xAxisId:s,yAxisId:o}),!k&&N.createElement("clipPath",{id:"clipPath-dots-".concat(v)},N.createElement("rect",{x:u-A/2,y:l-A/2,width:d+A,height:f+A}))),N.createElement(aq,{xAxisId:s,yAxisId:o,data:n,dataPointFormatter:cwe,errorBarOffset:0},N.createElement(lwe,{props:this.props,clipPathId:v}))),N.createElement(MA,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:T}))}}var dq={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:fi.line,type:"linear"};function dwe(e){var t=mi(e,dq),{activeDot:r,animateNewValues:n,animationBegin:a,animationDuration:s,animationEasing:o,connectNulls:l,dot:u,hide:d,isAnimationActive:f,label:m,legendType:g,xAxisId:x,yAxisId:y,id:v}=t,w=Q_(t,K2e),{needClip:j}=H5(x,y),k=$5(),A=Ih(),T=hs(),M=ir(q=>W2e(q,x,y,T,v));if(A!=="horizontal"&&A!=="vertical"||M==null||k==null)return null;var{height:B,width:L,x:F,y:I}=k;return N.createElement(uwe,Hv({},w,{id:v,connectNulls:l,dot:u,activeDot:r,animateNewValues:n,animationBegin:a,animationDuration:s,animationEasing:o,isAnimationActive:f,hide:d,label:m,legendType:g,xAxisId:x,yAxisId:y,points:M,layout:A,height:B,width:L,left:F,top:I,needClip:j}))}function fwe(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:a,yAxisTicks:s,dataKey:o,bandSize:l,displayedData:u}=e;return u.map((d,f)=>{var m=Nn(d,o);if(t==="horizontal"){var g=B2({axis:r,ticks:a,bandSize:l,entry:d,index:f}),x=Sa(m)?null:n.scale.map(m);return{x:g,y:x??null,value:m,payload:d}}var y=Sa(m)?null:r.scale.map(m),v=B2({axis:n,ticks:s,bandSize:l,entry:d,index:f});return y==null||v==null?null:{x:y,y:v,value:m,payload:d}}).filter(Boolean)}function hwe(e){var t=mi(e,dq),r=hs();return N.createElement(z5,{id:t.id,type:"line"},n=>N.createElement(N.Fragment,null,N.createElement(Y_,{legendPayload:ewe(t)}),N.createElement(twe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:n}),N.createElement(K_,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),N.createElement(dwe,Hv({},t,{id:n}))))}var fq=N.memo(hwe,x0);fq.displayName="Line";function Yu(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(a=>a.id===t))===null||n===void 0?void 0:n.xAxisId)!==null&&r!==void 0?r:KV}function Ku(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(a=>a.id===t))===null||n===void 0?void 0:n.yAxisId)!==null&&r!==void 0?r:KV}var hq=(e,t,r)=>Wu(e,"xAxis",Yu(e,t),r),mq=(e,t,r)=>qu(e,"xAxis",Yu(e,t),r),pq=(e,t,r)=>Wu(e,"yAxis",Ku(e,t),r),xq=(e,t,r)=>qu(e,"yAxis",Ku(e,t),r),mwe=nt([un,hq,pq,mq,xq],(e,t,r,n,a)=>Bc(e,"xAxis")?Nh(t,n,!1):Nh(r,a,!1)),pwe=(e,t)=>t,gq=nt([_1,pwe],(e,t)=>e.filter(r=>r.type==="area").find(r=>r.id===t)),vq=e=>{var t=un(e),r=Bc(t,"xAxis");return r?"yAxis":"xAxis"},xwe=(e,t)=>{var r=vq(e);return r==="yAxis"?Ku(e,t):Yu(e,t)},gwe=(e,t,r)=>lw(e,vq(e),xwe(e,t),r),vwe=nt([gq,gwe],(e,t)=>{var r;if(!(e==null||t==null)){var{stackId:n}=e,a=b5(e);if(!(n==null||a==null)){var s=(r=t[n])===null||r===void 0?void 0:r.stackedData,o=s==null?void 0:s.find(l=>l.key===a);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),ywe=nt([un,hq,pq,mq,xq,vwe,v$,mwe,gq,Nhe],(e,t,r,n,a,s,o,l,u,d)=>{var{chartData:f,dataStartIndex:m,dataEndIndex:g}=o;if(!(u==null||e!=="horizontal"&&e!=="vertical"||t==null||r==null||n==null||a==null||n.length===0||a.length===0||l==null)){var{data:x}=u,y;if(x&&x.length>0?y=x:y=f==null?void 0:f.slice(m,g+1),y!=null)return Bwe({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:a,dataStartIndex:m,areaSettings:u,stackedData:s,displayedData:y,chartBaseValue:d,bandSize:l})}}),bwe=["id"],wwe=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function $m(){return $m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$m.apply(null,arguments)}function yq(e,t){if(e==null)return{};var r,n,a=jwe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function jwe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function KL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Fp(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KL(Object(r),!0).forEach(function(n){Nwe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Nwe(e,t,r){return(t=Swe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Swe(e){var t=Awe(e,"string");return typeof t=="symbol"?t:t+""}function Awe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vw(e,t){return e&&e!=="none"?e:t}var kwe=e=>{var{dataKey:t,name:r,stroke:n,fill:a,legendType:s,hide:o}=e;return[{inactive:o,dataKey:t,type:s,color:vw(n,a),value:Lh(r,t),payload:e}]},Cwe=N.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:a,fill:s,name:o,hide:l,unit:u,tooltipType:d,id:f}=e,m={dataDefinedOnItem:r,getPosition:Mh,settings:{stroke:n,strokeWidth:a,fill:s,dataKey:t,nameKey:void 0,name:Lh(o,t),hide:l,type:d,color:vw(n,s),unit:u,graphicalItemId:f}};return N.createElement(B5,{tooltipEntrySettings:m})});function _we(e){var{clipPathId:t,points:r,props:n}=e,{needClip:a,dot:s,dataKey:o}=n,l=fo(n);return N.createElement(YV,{points:r,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:a,clipPathId:t})}function Ewe(e){var{showLabels:t,children:r,points:n}=e,a=n.map(s=>{var o,l,u={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Fp(Fp({},u),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:u,fill:void 0})});return N.createElement(B_,{value:t?a:void 0},r)}function XL(e){var{points:t,baseLine:r,needClip:n,clipPathId:a,props:s}=e,{layout:o,type:l,stroke:u,connectNulls:d,isRange:f}=s,{id:m}=s,g=yq(s,bwe),x=fo(g),y=Gs(g);return N.createElement(N.Fragment,null,(t==null?void 0:t.length)>1&&N.createElement(Ba,{clipPath:n?"url(#clipPath-".concat(a,")"):void 0},N.createElement(Hp,$m({},y,{id:m,points:t,connectNulls:d,type:l,baseLine:r,layout:o,stroke:"none",className:"recharts-area-area"})),u!=="none"&&N.createElement(Hp,$m({},x,{className:"recharts-area-curve",layout:o,type:l,connectNulls:d,fill:"none",points:t})),u!=="none"&&f&&Array.isArray(r)&&N.createElement(Hp,$m({},x,{className:"recharts-area-curve",layout:o,type:l,connectNulls:d,fill:"none",points:r}))),N.createElement(_we,{points:t,props:g,clipPathId:a}))}function Twe(e){var t,r,{alpha:n,baseLine:a,points:s,strokeWidth:o}=e,l=(t=s[0])===null||t===void 0?void 0:t.y,u=(r=s[s.length-1])===null||r===void 0?void 0:r.y;if(!Kr(l)||!Kr(u))return null;var d=n*Math.abs(l-u),f=Math.max(...s.map(m=>m.x||0));return Zt(a)?f=Math.max(a,f):a&&Array.isArray(a)&&a.length&&(f=Math.max(...a.map(m=>m.x||0),f)),Zt(f)?N.createElement("rect",{x:0,y:l<u?l:l-d,width:f+(o?parseInt("".concat(o),10):1),height:Math.floor(d)}):null}function Pwe(e){var t,r,{alpha:n,baseLine:a,points:s,strokeWidth:o}=e,l=(t=s[0])===null||t===void 0?void 0:t.x,u=(r=s[s.length-1])===null||r===void 0?void 0:r.x;if(!Kr(l)||!Kr(u))return null;var d=n*Math.abs(l-u),f=Math.max(...s.map(m=>m.y||0));return Zt(a)?f=Math.max(a,f):a&&Array.isArray(a)&&a.length&&(f=Math.max(...a.map(m=>m.y||0),f)),Zt(f)?N.createElement("rect",{x:l<u?l:l-d,y:0,width:d,height:Math.floor(f+(o?parseInt("".concat(o),10):1))}):null}function Dwe(e){var{alpha:t,layout:r,points:n,baseLine:a,strokeWidth:s}=e;return r==="vertical"?N.createElement(Twe,{alpha:t,points:n,baseLine:a,strokeWidth:s}):N.createElement(Pwe,{alpha:t,points:n,baseLine:a,strokeWidth:s})}function Owe(e){var{needClip:t,clipPathId:r,props:n,previousPointsRef:a,previousBaselineRef:s}=e,{points:o,baseLine:l,isAnimationActive:u,animationBegin:d,animationDuration:f,animationEasing:m,onAnimationStart:g,onAnimationEnd:x}=n,y=N.useMemo(()=>({points:o,baseLine:l}),[o,l]),v=Cx(y,"recharts-area-"),w=CC(),[j,k]=N.useState(!1),A=!j,T=N.useCallback(()=>{typeof x=="function"&&x(),k(!1)},[x]),M=N.useCallback(()=>{typeof g=="function"&&g(),k(!0)},[g]);if(w==null)return null;var B=a.current,L=s.current;return N.createElement(Ewe,{showLabels:A,points:o},n.children,N.createElement(kx,{animationId:v,begin:d,duration:f,isActive:u,easing:m,onAnimationEnd:T,onAnimationStart:M,key:v},F=>{if(B){var I=B.length/o.length,q=F===1?o:o.map((R,K)=>{var ee=Math.floor(K*I);if(B[ee]){var se=B[ee];return Fp(Fp({},R),{},{x:Rn(se.x,R.x,F),y:Rn(se.y,R.y,F)})}return R}),P;return Zt(l)?P=Rn(L,l,F):Sa(l)||Rc(l)?P=Rn(L,0,F):P=l.map((R,K)=>{var ee=Math.floor(K*I);if(Array.isArray(L)&&L[ee]){var se=L[ee];return Fp(Fp({},R),{},{x:Rn(se.x,R.x,F),y:Rn(se.y,R.y,F)})}return R}),F>0&&(a.current=q,s.current=P),N.createElement(XL,{points:q,baseLine:P,needClip:t,clipPathId:r,props:n})}return F>0&&(a.current=o,s.current=l),N.createElement(Ba,null,u&&N.createElement("defs",null,N.createElement("clipPath",{id:"animationClipPath-".concat(r)},N.createElement(Dwe,{alpha:F,points:o,baseLine:l,layout:w,strokeWidth:n.strokeWidth}))),N.createElement(Ba,{clipPath:"url(#animationClipPath-".concat(r,")")},N.createElement(XL,{points:o,baseLine:l,needClip:t,clipPathId:r,props:n})))}),N.createElement(L5,{label:n.label}))}function Rwe(e){var{needClip:t,clipPathId:r,props:n}=e,a=N.useRef(null),s=N.useRef();return N.createElement(Owe,{needClip:t,clipPathId:r,props:n,previousPointsRef:a,previousBaselineRef:s})}class Mwe extends N.PureComponent{render(){var{hide:t,dot:r,points:n,className:a,top:s,left:o,needClip:l,xAxisId:u,yAxisId:d,width:f,height:m,id:g,baseLine:x,zIndex:y}=this.props;if(t)return null;var v=mn("recharts-area",a),w=g,{r:j,strokeWidth:k}=cq(r),A=H_(r),T=j*2+k,M=l?"url(#clipPath-".concat(A?"":"dots-").concat(w,")"):void 0;return N.createElement(po,{zIndex:y},N.createElement(Ba,{className:v},l&&N.createElement("defs",null,N.createElement(J_,{clipPathId:w,xAxisId:u,yAxisId:d}),!A&&N.createElement("clipPath",{id:"clipPath-dots-".concat(w)},N.createElement("rect",{x:o-T/2,y:s-T/2,width:f+T,height:m+T}))),N.createElement(Rwe,{needClip:l,clipPathId:w,props:this.props})),N.createElement(MA,{points:n,mainColor:vw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:M}),this.props.isRange&&Array.isArray(x)&&N.createElement(MA,{points:x,mainColor:vw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:M}))}}var Lwe={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:fi.area};function Iwe(e){var t,{activeDot:r,animationBegin:n,animationDuration:a,animationEasing:s,connectNulls:o,dot:l,fill:u,fillOpacity:d,hide:f,isAnimationActive:m,legendType:g,stroke:x,xAxisId:y,yAxisId:v}=e,w=yq(e,wwe),j=Ih(),k=yV(),{needClip:A}=H5(y,v),T=hs(),{points:M,isRange:B,baseLine:L}=(t=ir(K=>ywe(K,e.id,T)))!==null&&t!==void 0?t:{},F=$5();if(j!=="horizontal"&&j!=="vertical"||F==null||k!=="AreaChart"&&k!=="ComposedChart")return null;var{height:I,width:q,x:P,y:R}=F;return!M||!M.length?null:N.createElement(Mwe,$m({},w,{activeDot:r,animationBegin:n,animationDuration:a,animationEasing:s,baseLine:L,connectNulls:o,dot:l,fill:u,fillOpacity:d,height:I,hide:f,layout:j,isAnimationActive:m,isRange:B,legendType:g,needClip:A,points:M,stroke:x,width:q,left:P,top:R,xAxisId:y,yAxisId:v}))}var Fwe=(e,t,r,n,a)=>{var s=r??t;if(Zt(s))return s;var o=e==="horizontal"?a:n,l=o.scale.domain();if(o.type==="number"){var u=Math.max(l[0],l[1]),d=Math.min(l[0],l[1]);return s==="dataMin"?d:s==="dataMax"||u<0?u:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]};function Bwe(e){var{areaSettings:{connectNulls:t,baseValue:r,dataKey:n},stackedData:a,layout:s,chartBaseValue:o,xAxis:l,yAxis:u,displayedData:d,dataStartIndex:f,xAxisTicks:m,yAxisTicks:g,bandSize:x}=e,y=a&&a.length,v=Fwe(s,o,r,l,u),w=s==="horizontal",j=!1,k=d.map((T,M)=>{var B,L,F,I;if(y)I=a[f+M];else{var q=Nn(T,n);Array.isArray(q)?(I=q,j=!0):I=[v,q]}var P=(B=(L=I)===null||L===void 0?void 0:L[1])!==null&&B!==void 0?B:null,R=P==null||y&&!t&&Nn(T,n)==null;if(w){var K;return{x:B2({axis:l,ticks:m,bandSize:x,entry:T,index:M}),y:R?null:(K=u.scale.map(P))!==null&&K!==void 0?K:null,value:I,payload:T}}return{x:R?null:(F=l.scale.map(P))!==null&&F!==void 0?F:null,y:B2({axis:u,ticks:g,bandSize:x,entry:T,index:M}),value:I,payload:T}}),A;return y||j?A=k.map(T=>{var M,B=Array.isArray(T.value)?T.value[0]:null;if(w){var L;return{x:T.x,y:B!=null&&T.y!=null&&(L=u.scale.map(B))!==null&&L!==void 0?L:null,payload:T.payload}}return{x:B!=null&&(M=l.scale.map(B))!==null&&M!==void 0?M:null,y:T.y,payload:T.payload}}):A=w?u.scale.map(v):l.scale.map(v),{points:k,baseLine:A??0,isRange:j}}function zwe(e){var t=mi(e,Lwe),r=hs();return N.createElement(z5,{id:t.id,type:"area"},n=>N.createElement(N.Fragment,null,N.createElement(Y_,{legendPayload:kwe(t)}),N.createElement(Cwe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:n}),N.createElement(K_,{type:"area",id:n,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:zU(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:r,connectNulls:t.connectNulls}),N.createElement(Iwe,$m({},t,{id:n}))))}var bq=N.memo(zwe,x0);bq.displayName="Area";var Uwe="Invariant failed";function $we(e,t){throw new Error(Uwe)}function LA(){return LA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},LA.apply(null,arguments)}function eE(e){return N.createElement(V_,LA({shapeType:"rectangle",activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"},e))}var Hwe=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,a)=>{if(Zt(t))return t;var s=Zt(n)||Sa(n);return s?t(n,a):(s||$we(),r)}},Vwe=(e,t,r)=>r,qwe=(e,t)=>t,O1=nt([_1,qwe],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),Wwe=nt([O1],e=>e==null?void 0:e.maxBarSize),Gwe=(e,t,r,n)=>n,Ywe=nt([un,_1,Yu,Ku,Vwe],(e,t,r,n,a)=>t.filter(s=>e==="horizontal"?s.xAxisId===r:s.yAxisId===n).filter(s=>s.isPanorama===a).filter(s=>s.hide===!1).filter(s=>s.type==="bar")),Kwe=(e,t,r)=>{var n=un(e),a=Yu(e,t),s=Ku(e,t);if(!(a==null||s==null))return n==="horizontal"?lw(e,"yAxis",s,r):lw(e,"xAxis",a,r)},Xwe=(e,t)=>{var r=un(e),n=Yu(e,t),a=Ku(e,t);if(!(n==null||a==null))return r==="horizontal"?FM(e,"xAxis",n):FM(e,"yAxis",a)},Zwe=nt([Ywe,jhe,Xwe],_be),Jwe=(e,t,r)=>{var n,a,s=O1(e,t);if(s==null)return 0;var o=Yu(e,t),l=Ku(e,t);if(o==null||l==null)return 0;var u=un(e),d=T$(e),{maxBarSize:f}=s,m=Sa(f)?d:f,g,x;return u==="horizontal"?(g=Wu(e,"xAxis",o,r),x=qu(e,"xAxis",o,r)):(g=Wu(e,"yAxis",l,r),x=qu(e,"yAxis",l,r)),(n=(a=Nh(g,x,!0))!==null&&a!==void 0?a:m)!==null&&n!==void 0?n:0},wq=(e,t,r)=>{var n=un(e),a=Yu(e,t),s=Ku(e,t);if(!(a==null||s==null)){var o,l;return n==="horizontal"?(o=Wu(e,"xAxis",a,r),l=qu(e,"xAxis",a,r)):(o=Wu(e,"yAxis",s,r),l=qu(e,"yAxis",s,r)),Nh(o,l)}},Qwe=nt([Zwe,T$,whe,P$,Jwe,wq,Wwe],Obe),e5e=(e,t,r)=>{var n=Yu(e,t);if(n!=null)return Wu(e,"xAxis",n,r)},t5e=(e,t,r)=>{var n=Ku(e,t);if(n!=null)return Wu(e,"yAxis",n,r)},r5e=(e,t,r)=>{var n=Yu(e,t);if(n!=null)return qu(e,"xAxis",n,r)},n5e=(e,t,r)=>{var n=Ku(e,t);if(n!=null)return qu(e,"yAxis",n,r)},a5e=nt([Qwe,O1],Mbe),i5e=nt([Kwe,O1],Rbe),s5e=nt([Vi,jC,e5e,t5e,r5e,n5e,a5e,un,v$,wq,i5e,O1,Gwe],(e,t,r,n,a,s,o,l,u,d,f,m,g)=>{var{chartData:x,dataStartIndex:y,dataEndIndex:v}=u;if(!(m==null||o==null||t==null||l!=="horizontal"&&l!=="vertical"||r==null||n==null||a==null||s==null||d==null)){var{data:w}=m,j;if(w!=null&&w.length>0?j=w:j=x==null?void 0:x.slice(y,v+1),j!=null)return R5e({layout:l,barSettings:m,pos:o,parentViewBox:t,bandSize:d,xAxis:r,yAxis:n,xAxisTicks:a,yAxisTicks:s,stackedData:f,displayedData:j,offset:e,cells:g,dataStartIndex:y})}}),o5e=["index"];function IA(){return IA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},IA.apply(null,arguments)}function l5e(e,t){if(e==null)return{};var r,n,a=c5e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function c5e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var jq=N.createContext(void 0),u5e=e=>{var t=N.useContext(jq);if(t!=null)return t.stackId;if(e!=null)return zU(e)},d5e=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),f5e=e=>{var t=N.useContext(jq);if(t!=null){var{stackId:r}=t;return"url(#".concat(d5e(r,e),")")}},Nq=e=>{var{index:t}=e,r=l5e(e,o5e),n=f5e(t);return N.createElement(Ba,IA({className:"recharts-bar-stack-layer",clipPath:n},r))},h5e=["onMouseEnter","onMouseLeave","onClick"],m5e=["value","background","tooltipPosition"],p5e=["id"],x5e=["onMouseEnter","onClick","onMouseLeave"];function kh(){return kh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},kh.apply(null,arguments)}function ZL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function io(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ZL(Object(r),!0).forEach(function(n){g5e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function g5e(e,t,r){return(t=v5e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v5e(e){var t=y5e(e,"string");return typeof t=="symbol"?t:t+""}function y5e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yw(e,t){if(e==null)return{};var r,n,a=b5e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function b5e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var w5e=e=>{var{dataKey:t,name:r,fill:n,legendType:a,hide:s}=e;return[{inactive:s,dataKey:t,type:a,color:n,value:Lh(r,t),payload:e}]},j5e=N.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:a,name:s,hide:o,unit:l,tooltipType:u,id:d}=e,f={dataDefinedOnItem:void 0,getPosition:Mh,settings:{stroke:r,strokeWidth:n,fill:a,dataKey:t,nameKey:void 0,name:Lh(s,t),hide:o,type:u,color:a,unit:l,graphicalItemId:d}};return N.createElement(B5,{tooltipEntrySettings:f})});function N5e(e){var t=ir(Sh),{data:r,dataKey:n,background:a,allOtherBarProps:s}=e,{onMouseEnter:o,onMouseLeave:l,onClick:u}=s,d=yw(s,h5e),f=q_(o,n,s.id),m=W_(l),g=G_(u,n,s.id);if(!a||r==null)return null;var x=Xm(a);return N.createElement(po,{zIndex:Lbe(a,fi.barBackground)},r.map((y,v)=>{var{value:w,background:j,tooltipPosition:k}=y,A=yw(y,m5e);if(!j)return null;var T=f(y,v),M=m(y,v),B=g(y,v),L=io(io(io(io(io({option:a,isActive:String(v)===t},A),{},{fill:"#eee"},j),x),h1(d,y,v)),{},{onMouseEnter:T,onMouseLeave:M,onClick:B,dataKey:n,index:v,className:"recharts-bar-background-rectangle"});return N.createElement(eE,kh({key:"background-bar-".concat(v)},L))}))}function S5e(e){var{showLabels:t,children:r,rects:n}=e,a=n==null?void 0:n.map(s=>{var o={x:s.x,y:s.y,width:s.width,lowerWidth:s.width,upperWidth:s.width,height:s.height};return io(io({},o),{},{value:s.value,payload:s.payload,parentViewBox:s.parentViewBox,viewBox:o,fill:s.fill})});return N.createElement(B_,{value:t?a:void 0},r)}function A5e(e){var{shape:t,activeBar:r,baseProps:n,entry:a,index:s,dataKey:o}=e,l=ir(Sh),u=ir(O_),d=r&&String(a.originalDataIndex)===l&&(u==null||o===u),[f,m]=N.useState(!1),[g,x]=N.useState(!1);N.useEffect(()=>{var A;return d?(m(!0),A=requestAnimationFrame(()=>{x(!0)})):x(!1),()=>{cancelAnimationFrame(A)}},[d]);var y=N.useCallback(()=>{d||m(!1)},[d]),v=d&&g,w=d||f,j;d?r===!0?j=t:j=r:j=t;var k=N.createElement(eE,kh({},n,{name:String(n.name)},a,{isActive:v,option:j,index:s,dataKey:o,onTransitionEnd:y}));return w?N.createElement(po,{zIndex:fi.activeBar},N.createElement(Nq,{index:a.originalDataIndex},k)):k}function k5e(e){var{shape:t,baseProps:r,entry:n,index:a,dataKey:s}=e;return N.createElement(eE,kh({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:a,dataKey:s}))}function C5e(e){var t,{data:r,props:n}=e,a=(t=fo(n))!==null&&t!==void 0?t:{},{id:s}=a,o=yw(a,p5e),{shape:l,dataKey:u,activeBar:d}=n,{onMouseEnter:f,onClick:m,onMouseLeave:g}=n,x=yw(n,x5e),y=q_(f,u,s),v=W_(g),w=G_(m,u,s);return r?N.createElement(N.Fragment,null,r.map((j,k)=>N.createElement(Nq,kh({index:j.originalDataIndex,key:"rectangle-".concat(j==null?void 0:j.x,"-").concat(j==null?void 0:j.y,"-").concat(j==null?void 0:j.value,"-").concat(k),className:"recharts-bar-rectangle"},h1(x,j,k),{onMouseEnter:y(j,k),onMouseLeave:v(j,k),onClick:w(j,k)}),d?N.createElement(A5e,{shape:l,activeBar:d,baseProps:o,entry:j,index:k,dataKey:u}):N.createElement(k5e,{shape:l,baseProps:o,entry:j,index:k,dataKey:u})))):null}function _5e(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:a,isAnimationActive:s,animationBegin:o,animationDuration:l,animationEasing:u,onAnimationEnd:d,onAnimationStart:f}=t,m=r.current,g=Cx(t,"recharts-bar-"),[x,y]=N.useState(!1),v=!x,w=N.useCallback(()=>{typeof d=="function"&&d(),y(!1)},[d]),j=N.useCallback(()=>{typeof f=="function"&&f(),y(!0)},[f]);return N.createElement(S5e,{showLabels:v,rects:n},N.createElement(kx,{animationId:g,begin:o,duration:l,isActive:s,easing:u,onAnimationEnd:w,onAnimationStart:j,key:g},k=>{var A=k===1?n:n==null?void 0:n.map((T,M)=>{var B=m&&m[M];if(B)return io(io({},T),{},{x:Rn(B.x,T.x,k),y:Rn(B.y,T.y,k),width:Rn(B.width,T.width,k),height:Rn(B.height,T.height,k)});if(a==="horizontal"){var L=Rn(0,T.height,k),F=Rn(T.stackedBarStart,T.y,k);return io(io({},T),{},{y:F,height:L})}var I=Rn(0,T.width,k),q=Rn(T.stackedBarStart,T.x,k);return io(io({},T),{},{width:I,x:q})});return k>0&&(r.current=A??null),A==null?null:N.createElement(Ba,null,N.createElement(C5e,{props:t,data:A}))}),N.createElement(L5,{label:t.label}),t.children)}function E5e(e){var t=N.useRef(null);return N.createElement(_5e,{previousRectanglesRef:t,props:e})}var Sq=0,T5e=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:Nn(e,t)}};class P5e extends N.PureComponent{render(){var{hide:t,data:r,dataKey:n,className:a,xAxisId:s,yAxisId:o,needClip:l,background:u,id:d}=this.props;if(t||r==null)return null;var f=mn("recharts-bar",a),m=d;return N.createElement(Ba,{className:f,id:d},l&&N.createElement("defs",null,N.createElement(J_,{clipPathId:m,xAxisId:s,yAxisId:o})),N.createElement(Ba,{className:"recharts-bar-rectangles",clipPath:l?"url(#clipPath-".concat(m,")"):void 0},N.createElement(N5e,{data:r,dataKey:n,background:u,allOtherBarProps:this.props}),N.createElement(E5e,this.props)))}}var D5e={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:Sq,xAxisId:0,yAxisId:0,zIndex:fi.bar};function O5e(e){var{xAxisId:t,yAxisId:r,hide:n,legendType:a,minPointSize:s,activeBar:o,animationBegin:l,animationDuration:u,animationEasing:d,isAnimationActive:f}=e,{needClip:m}=H5(t,r),g=Ih(),x=hs(),y=$_(e.children,Wd),v=ir(k=>s5e(k,e.id,x,y));if(g!=="vertical"&&g!=="horizontal")return null;var w,j=v==null?void 0:v[0];return j==null||j.height==null||j.width==null?w=0:w=g==="vertical"?j.height/2:j.width/2,N.createElement(aq,{xAxisId:t,yAxisId:r,data:v,dataPointFormatter:T5e,errorBarOffset:w},N.createElement(P5e,kh({},e,{layout:g,needClip:m,data:v,xAxisId:t,yAxisId:r,hide:n,legendType:a,minPointSize:s,activeBar:o,animationBegin:l,animationDuration:u,animationEasing:d,isAnimationActive:f})))}function R5e(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n,hasCustomShape:a},pos:s,bandSize:o,xAxis:l,yAxis:u,xAxisTicks:d,yAxisTicks:f,stackedData:m,displayedData:g,offset:x,cells:y,parentViewBox:v,dataStartIndex:w}=e,j=t==="horizontal"?u:l,k=m?j.scale.domain():null,A=hue({numericAxis:j}),T=j.scale.map(A);return g.map((M,B)=>{var L,F,I,q,P,R;if(m){var K=m[B+w];if(K==null)return null;L=lue(K,k)}else L=Nn(M,r),Array.isArray(L)||(L=[A,L]);var ee=Hwe(n,Sq)(L[1],B);if(t==="horizontal"){var se,Z=u.scale.map(L[0]),ne=u.scale.map(L[1]);if(Z==null||ne==null)return null;F=DO({axis:l,ticks:d,bandSize:o,offset:s.offset,entry:M,index:B}),I=(se=ne??Z)!==null&&se!==void 0?se:void 0,q=s.size;var X=Z-ne;if(P=Rc(X)?0:X,R={x:F,y:x.top,width:q,height:x.height},Math.abs(ee)>0&&Math.abs(P)<Math.abs(ee)){var le=cs(P||ee)*(Math.abs(ee)-Math.abs(P));I-=le,P+=le}}else{var Ae=l.scale.map(L[0]),ce=l.scale.map(L[1]);if(Ae==null||ce==null)return null;if(F=Ae,I=DO({axis:u,ticks:f,bandSize:o,offset:s.offset,entry:M,index:B}),q=ce-Ae,P=s.size,R={x:x.left,y:I,width:x.width,height:P},Math.abs(ee)>0&&Math.abs(q)<Math.abs(ee)){var D=cs(q||ee)*(Math.abs(ee)-Math.abs(q));q+=D}}if(F==null||I==null||q==null||P==null||!a&&(q===0||P===0))return null;var H=io(io({},M),{},{stackedBarStart:T,x:F,y:I,width:q,height:P,value:m?L:L[1],payload:M,background:R,tooltipPosition:{x:F+q/2,y:I+P/2},parentViewBox:v,originalDataIndex:B},y&&y[B]&&y[B].props);return H}).filter(Boolean)}function M5e(e){var t=mi(e,D5e),r=u5e(t.stackId),n=hs();return N.createElement(z5,{id:t.id,type:"bar"},a=>N.createElement(N.Fragment,null,N.createElement(Y_,{legendPayload:w5e(t)}),N.createElement(j5e,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:a}),N.createElement(K_,{type:"bar",id:a,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:r,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:n,hasCustomShape:t.shape!=null}),N.createElement(po,{zIndex:t.zIndex},N.createElement(O5e,kh({},t,{id:a})))))}var Bd=N.memo(M5e,x0);Bd.displayName="Bar";var L5e=["domain","range"],I5e=["domain","range"];function JL(e,t){if(e==null)return{};var r,n,a=F5e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function F5e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function QL(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function Aq(e,t){if(e===t)return!0;var{domain:r,range:n}=e,a=JL(e,L5e),{domain:s,range:o}=t,l=JL(t,I5e);return!QL(r,s)||!QL(n,o)?!1:x0(a,l)}var B5e=["type"],z5e=["dangerouslySetInnerHTML","ticks","scale"],U5e=["id","scale"];function FA(){return FA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},FA.apply(null,arguments)}function eI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function tI(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?eI(Object(r),!0).forEach(function(n){$5e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):eI(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $5e(e,t,r){return(t=H5e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H5e(e){var t=V5e(e,"string");return typeof t=="symbol"?t:t+""}function V5e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function BA(e,t){if(e==null)return{};var r,n,a=q5e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function q5e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function W5e(e){var t=Zn(),r=N.useRef(null),n=CC(),{type:a}=e,s=BA(e,B5e),o=v5(n,"xAxis",a),l=N.useMemo(()=>{if(o!=null)return tI(tI({},s),{},{type:o})},[s,o]);return N.useLayoutEffect(()=>{l!=null&&(r.current===null?t(hbe(l)):r.current!==l&&t(mbe({prev:r.current,next:l})),r.current=l)},[l,t]),N.useLayoutEffect(()=>()=>{r.current&&(t(pbe(r.current)),r.current=null)},[t]),null}var G5e=e=>{var{xAxisId:t,className:r}=e,n=ir(jC),a=hs(),s="xAxis",o=ir(j=>YH(j,s,t,a)),l=ir(j=>qH(j,t)),u=ir(j=>rxe(j,t)),d=ir(j=>NH(j,t));if(l==null||u==null||d==null)return null;var{dangerouslySetInnerHTML:f,ticks:m,scale:g}=e,x=BA(e,z5e),{id:y,scale:v}=d,w=BA(d,U5e);return N.createElement(Z_,FA({},x,w,{x:u.x,y:u.y,width:l.width,height:l.height,className:mn("recharts-".concat(s," ").concat(s),r),viewBox:n,ticks:o,axisType:s,axisId:t}))},Y5e={allowDataOverflow:Li.allowDataOverflow,allowDecimals:Li.allowDecimals,allowDuplicatedCategory:Li.allowDuplicatedCategory,angle:Li.angle,axisLine:Gd.axisLine,height:Li.height,hide:!1,includeHidden:Li.includeHidden,interval:Li.interval,label:!1,minTickGap:Li.minTickGap,mirror:Li.mirror,orientation:Li.orientation,padding:Li.padding,reversed:Li.reversed,scale:Li.scale,tick:Li.tick,tickCount:Li.tickCount,tickLine:Gd.tickLine,tickSize:Gd.tickSize,type:Li.type,niceTicks:Li.niceTicks,xAxisId:0},K5e=e=>{var t=mi(e,Y5e);return N.createElement(N.Fragment,null,N.createElement(W5e,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),N.createElement(G5e,t))},uh=N.memo(K5e,Aq);uh.displayName="XAxis";var X5e=["type"],Z5e=["dangerouslySetInnerHTML","ticks","scale"],J5e=["id","scale"];function zA(){return zA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},zA.apply(null,arguments)}function rI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function nI(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?rI(Object(r),!0).forEach(function(n){Q5e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rI(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Q5e(e,t,r){return(t=eje(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eje(e){var t=tje(e,"string");return typeof t=="symbol"?t:t+""}function tje(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function UA(e,t){if(e==null)return{};var r,n,a=rje(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function rje(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function nje(e){var t=Zn(),r=N.useRef(null),n=CC(),{type:a}=e,s=UA(e,X5e),o=v5(n,"yAxis",a),l=N.useMemo(()=>{if(o!=null)return nI(nI({},s),{},{type:o})},[o,s]);return N.useLayoutEffect(()=>{l!=null&&(r.current===null?t(xbe(l)):r.current!==l&&t(gbe({prev:r.current,next:l})),r.current=l)},[l,t]),N.useLayoutEffect(()=>()=>{r.current&&(t(vbe(r.current)),r.current=null)},[t]),null}function aje(e){var{yAxisId:t,className:r,width:n,label:a}=e,s=N.useRef(null),o=N.useRef(null),l=ir(jC),u=hs(),d=Zn(),f="yAxis",m=ir(B=>WH(B,t)),g=ir(B=>axe(B,t)),x=ir(B=>YH(B,f,t,u)),y=ir(B=>SH(B,t));if(N.useLayoutEffect(()=>{if(!(n!=="auto"||!m||F_(a)||N.isValidElement(a)||y==null)){var B=s.current;if(B){var L=B.getCalculatedWidth();Math.round(m.width)!==Math.round(L)&&d(ybe({id:t,width:L}))}}},[x,m,d,a,t,n,y]),m==null||g==null||y==null)return null;var{dangerouslySetInnerHTML:v,ticks:w,scale:j}=e,k=UA(e,Z5e),{id:A,scale:T}=y,M=UA(y,J5e);return N.createElement(Z_,zA({},k,M,{ref:s,labelRef:o,x:g.x,y:g.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:m.width,height:m.height,className:mn("recharts-".concat(f," ").concat(f),r),viewBox:l,ticks:x,axisType:f,axisId:t}))}var ije={allowDataOverflow:Ii.allowDataOverflow,allowDecimals:Ii.allowDecimals,allowDuplicatedCategory:Ii.allowDuplicatedCategory,angle:Ii.angle,axisLine:Gd.axisLine,hide:!1,includeHidden:Ii.includeHidden,interval:Ii.interval,label:!1,minTickGap:Ii.minTickGap,mirror:Ii.mirror,orientation:Ii.orientation,padding:Ii.padding,reversed:Ii.reversed,scale:Ii.scale,tick:Ii.tick,tickCount:Ii.tickCount,tickLine:Gd.tickLine,tickSize:Gd.tickSize,type:Ii.type,niceTicks:Ii.niceTicks,width:Ii.width,yAxisId:0},sje=e=>{var t=mi(e,ije);return N.createElement(N.Fragment,null,N.createElement(nje,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),N.createElement(aje,t))},dh=N.memo(sje,Aq);dh.displayName="YAxis";var oje=(e,t)=>t,tE=nt([oje,un,F$,ms,fV,ff,Age,Vi],Dge);function lje(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function rE(e){var t=e.currentTarget.getBoundingClientRect(),r,n;if(lje(e)){var a=e.currentTarget.getBBox();r=a.width>0?t.width/a.width:1,n=a.height>0?t.height/a.height:1}else{var s=e.currentTarget;r=s.offsetWidth>0?t.width/s.offsetWidth:1,n=s.offsetHeight>0?t.height/s.offsetHeight:1}var o=(l,u)=>({relativeX:Math.round((l-t.left)/r),relativeY:Math.round((u-t.top)/n)});return"touches"in e?Array.from(e.touches).map(l=>o(l.clientX,l.clientY)):o(e.clientX,e.clientY)}var kq=xl("mouseClick"),Cq=p1();Cq.startListening({actionCreator:kq,effect:(e,t)=>{var r=e.payload,n=tE(t.getState(),rE(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(bxe({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var $A=xl("mouseMove"),_q=p1(),yp=null,vm=null,jS=null;_q.startListening({actionCreator:$A,effect:(e,t)=>{var r=e.payload,n=t.getState(),{throttleDelay:a,throttledEvents:s}=n.eventSettings,o=s==="all"||(s==null?void 0:s.includes("mousemove"));yp!==null&&(cancelAnimationFrame(yp),yp=null),vm!==null&&(typeof a!="number"||!o)&&(clearTimeout(vm),vm=null),jS=rE(r);var l=()=>{var u=t.getState(),d=P1(u,u.tooltip.settings.shared);if(!jS){yp=null,vm=null;return}if(d==="axis"){var f=tE(u,jS);(f==null?void 0:f.activeIndex)!=null?t.dispatch(rV({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):t.dispatch(tV())}yp=null,vm=null};if(!o){l();return}a==="raf"?yp=requestAnimationFrame(l):typeof a=="number"&&vm===null&&(vm=setTimeout(l,a))}});function cje(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var aI={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},Eq=Ks({name:"rootProps",initialState:aI,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:aI.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),uje=Eq.reducer,{updateOptions:dje}=Eq.actions,fje=null,hje={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},Tq=Ks({name:"polarOptions",initialState:fje,reducers:hje}),{updatePolarOptions:mje}=Tq.actions,pje=Tq.reducer,Pq=xl("keyDown"),Dq=xl("focus"),Oq=xl("blur"),V5=p1(),bp=null,ym=null,sb=null;V5.startListening({actionCreator:Pq,effect:(e,t)=>{sb=e.payload,bp!==null&&(cancelAnimationFrame(bp),bp=null);var r=t.getState(),{throttleDelay:n,throttledEvents:a}=r.eventSettings,s=a==="all"||a.includes("keydown");ym!==null&&(typeof n!="number"||!s)&&(clearTimeout(ym),ym=null);var o=()=>{try{var l=t.getState(),u=l.rootProps.accessibilityLayer!==!1;if(!u)return;var{keyboardInteraction:d}=l.tooltip,f=sb;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var m=iv(d,a0(l),hx(l),mx(l)),g=m==null?-1:Number(m),x=!Number.isFinite(g)||g<0,y=ff(l),v=a0(l),w=P1(l,l.tooltip.settings.shared);if(f==="Enter"){if(x)return;var j=dw(l,w,"hover",String(d.index));t.dispatch(uw({active:!d.active,activeIndex:d.index,activeCoordinate:j}));return}var k=cxe(l),A=k==="left-to-right"?1:-1,T=f==="ArrowRight"?1:-1,M;if(x){var B=hx(l),L=mx(l),F=T*A,I=ee=>({active:!1,index:String(ee),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(M=-1,F>0){for(var q=0;q<v.length;q++)if(iv(I(q),v,B,L)!=null){M=q;break}}else for(var P=v.length-1;P>=0;P--)if(iv(I(P),v,B,L)!=null){M=P;break}if(M<0)return}else{M=g+T*A;var R=(y==null?void 0:y.length)||v.length;if(R===0||M>=R||M<0)return}var K=dw(l,w,"hover",String(M));t.dispatch(uw({active:!0,activeIndex:M.toString(),activeCoordinate:K}))}finally{bp=null,ym=null}};if(!s){o();return}n==="raf"?bp=requestAnimationFrame(o):typeof n=="number"&&ym===null&&(o(),sb=null,ym=setTimeout(()=>{sb?o():(ym=null,bp=null)},n))}});V5.startListening({actionCreator:Dq,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:a}=r.tooltip;if(!a.active&&a.index==null){var s="0",o=P1(r,r.tooltip.settings.shared),l=dw(r,o,"hover",String(s));t.dispatch(uw({active:!0,activeIndex:s,activeCoordinate:l}))}}}});V5.startListening({actionCreator:Oq,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:a}=r.tooltip;a.active&&t.dispatch(uw({active:!1,activeIndex:a.index,activeCoordinate:a.coordinate}))}}});function Rq(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(r,n)=>{if(n==="currentTarget")return t;var a=Reflect.get(r,n);return typeof a=="function"?a.bind(r):a}})}var Ol=xl("externalEvent"),Mq=p1(),ob=new Map,zg=new Map,NS=new Map;Mq.startListening({actionCreator:Ol,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){var a=n.type,s=Rq(n);NS.set(a,{handler:r,reactEvent:s});var o=ob.get(a);o!==void 0&&(cancelAnimationFrame(o),ob.delete(a));var l=t.getState(),{throttleDelay:u,throttledEvents:d}=l.eventSettings,f=d,m=f==="all"||(f==null?void 0:f.includes(a)),g=zg.get(a);g!==void 0&&(typeof u!="number"||!m)&&(clearTimeout(g),zg.delete(a));var x=()=>{var w=NS.get(a);try{if(!w)return;var{handler:j,reactEvent:k}=w,A=t.getState(),T={activeCoordinate:uge(A),activeDataKey:O_(A),activeIndex:Sh(A),activeLabel:pV(A),activeTooltipIndex:Sh(A),isTooltipActive:dge(A)};j&&j(T,k)}finally{ob.delete(a),zg.delete(a),NS.delete(a)}};if(!m){x();return}if(u==="raf"){var y=requestAnimationFrame(x);ob.set(a,y)}else if(typeof u=="number"){if(!zg.has(a)){x();var v=setTimeout(x,u);zg.set(a,v)}}else x()}}});var xje=nt([Mx],e=>e.tooltipItemPayloads),gje=nt([xje,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(s=>s.settings.graphicalItemId===r);if(n!=null){var{getPosition:a}=n;if(a!=null)return a(t)}}}),Lq=xl("touchMove"),Iq=p1(),bm=null,Qf=null,iI=null,Ug=null;Iq.startListening({actionCreator:Lq,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){Ug=Rq(r);var n=t.getState(),{throttleDelay:a,throttledEvents:s}=n.eventSettings,o=s==="all"||s.includes("touchmove");bm!==null&&(cancelAnimationFrame(bm),bm=null),Qf!==null&&(typeof a!="number"||!o)&&(clearTimeout(Qf),Qf=null),iI=Array.from(r.touches).map(u=>rE({clientX:u.clientX,clientY:u.clientY,currentTarget:r.currentTarget}));var l=()=>{if(Ug!=null){var u=t.getState(),d=P1(u,u.tooltip.settings.shared);if(d==="axis"){var f,m=(f=iI)===null||f===void 0?void 0:f[0];if(m==null){bm=null,Qf=null;return}var g=tE(u,m);(g==null?void 0:g.activeIndex)!=null&&t.dispatch(rV({activeIndex:g.activeIndex,activeDataKey:void 0,activeCoordinate:g.activeCoordinate}))}else if(d==="item"){var x,y=Ug.touches[0];if(document.elementFromPoint==null||y==null)return;var v=document.elementFromPoint(y.clientX,y.clientY);if(!v||!v.getAttribute)return;var w=v.getAttribute($U),j=(x=v.getAttribute(HU))!==null&&x!==void 0?x:void 0,k=y0(u).find(M=>M.id===j);if(w==null||k==null||j==null)return;var{dataKey:A}=k,T=gje(u,w,j);t.dispatch(eV({activeDataKey:A,activeIndex:w,activeCoordinate:T,activeGraphicalItemId:j}))}bm=null,Qf=null}};if(!o){l();return}a==="raf"?bm=requestAnimationFrame(l):typeof a=="number"&&Qf===null&&(l(),Ug=null,Qf=setTimeout(()=>{Ug?l():(Qf=null,bm=null)},a))}}});var nE={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},Fq=Ks({name:"eventSettings",initialState:nE,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:vje}=Fq.actions,yje=Fq.reducer,bje=cU({brush:Ibe,cartesianAxis:bbe,chartData:lve,errorBars:L2e,eventSettings:yje,graphicalItems:Aye,layout:nue,legend:cde,options:nve,polarAxis:F1e,polarOptions:pje,referenceElements:Ube,renderedTicks:a2e,rootProps:uje,tooltip:wxe,zIndex:qge}),wje=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return _ce({reducer:bje,preloadedState:t,middleware:n=>{var a;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((a="es6")!==null&&a!==void 0?a:"")}).concat([Cq.middleware,_q.middleware,V5.middleware,Mq.middleware,Iq.middleware])},enhancers:n=>{var a=n;return typeof n=="function"&&(a=n()),a.concat(SU({type:"raf"}))},devTools:{serialize:{replacer:cje},name:"recharts-".concat(r)}})};function Bq(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,a=hs(),s=N.useRef(null);if(a)return r;s.current==null&&(s.current=wje(t,n));var o=pC;return N.createElement(Ade,{context:o,store:s.current},r)}function jje(e){var{layout:t,margin:r}=e,n=Zn(),a=hs();return N.useEffect(()=>{a||(n(eue(t)),n(Qce(r)))},[n,a,t,r]),null}var zq=N.memo(jje,x0);function Uq(e){var t=Zn();return N.useEffect(()=>{t(dje(e))},[t,e]),null}var Nje=e=>{var t=Zn();return N.useEffect(()=>{t(vje(e))},[t,e]),null},$q=N.memo(Nje,x0);function sI(e){var{zIndex:t,isPanorama:r}=e,n=N.useRef(null),a=Zn();return N.useLayoutEffect(()=>(n.current&&a(Hge({zIndex:t,element:n.current,isPanorama:r})),()=>{a(Vge({zIndex:t,isPanorama:r}))}),[a,t,r]),N.createElement("g",{tabIndex:-1,ref:n,className:"recharts-zIndex-layer_".concat(t)})}function oI(e){var{children:t,isPanorama:r}=e,n=ir(Rge);if(!n||n.length===0)return t;var a=n.filter(o=>o<0),s=n.filter(o=>o>0);return N.createElement(N.Fragment,null,a.map(o=>N.createElement(sI,{key:o,zIndex:o,isPanorama:r})),t,s.map(o=>N.createElement(sI,{key:o,zIndex:o,isPanorama:r})))}var Sje=["children"];function Aje(e,t){if(e==null)return{};var r,n,a=kje(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function kje(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function bw(){return bw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bw.apply(null,arguments)}var Cje={width:"100%",height:"100%",display:"block"},_je=N.forwardRef((e,t)=>{var r=AC(),n=kC(),a=o$();if(!$u(r)||!$u(n))return null;var{children:s,otherAttributes:o,title:l,desc:u}=e,d,f;return o!=null&&(typeof o.tabIndex=="number"?d=o.tabIndex:d=a?0:void 0,typeof o.role=="string"?f=o.role:f=a?"application":void 0),N.createElement(iC,bw({},o,{title:l,desc:u,role:f,tabIndex:d,width:r,height:n,style:Cje,ref:t}),s)}),Eje=e=>{var{children:t}=e,r=ir(f5);if(!r)return null;var{width:n,height:a,y:s,x:o}=r;return N.createElement(iC,{width:n,height:a,x:o,y:s},t)},lI=N.forwardRef((e,t)=>{var{children:r}=e,n=Aje(e,Sje),a=hs();return a?N.createElement(Eje,null,N.createElement(oI,{isPanorama:!0},r)):N.createElement(_je,bw({ref:t},n),N.createElement(oI,{isPanorama:!1},r))});function Tje(){var e=Zn(),[t,r]=N.useState(null),n=ir(yue);return N.useEffect(()=>{if(t!=null){var a=t.getBoundingClientRect(),s=a.width/t.offsetWidth;Kr(s)&&s!==n&&e(rue(s))}},[t,e,n]),r}function cI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Pje(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cI(Object(r),!0).forEach(function(n){Dje(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cI(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Dje(e,t,r){return(t=Oje(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Oje(e){var t=Rje(e,"string");return typeof t=="symbol"?t:t+""}function Rje(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vh(){return vh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vh.apply(null,arguments)}var Mje=()=>(gve(),null);function ww(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Lje=N.forwardRef((e,t)=>{var r,n,a=N.useRef(null),[s,o]=N.useState({containerWidth:ww((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:ww((n=e.style)===null||n===void 0?void 0:n.height)}),l=N.useCallback((d,f)=>{o(m=>{var g=Math.round(d),x=Math.round(f);return m.containerWidth===g&&m.containerHeight===x?m:{containerWidth:g,containerHeight:x}})},[]),u=N.useCallback(d=>{if(typeof t=="function"&&t(d),a.current!=null&&(a.current.disconnect(),a.current=null),d!=null&&typeof ResizeObserver<"u"){var{width:f,height:m}=d.getBoundingClientRect();l(f,m);var g=y=>{var v=y[0];if(v!=null){var{width:w,height:j}=v.contentRect;l(w,j)}},x=new ResizeObserver(g);x.observe(d),a.current=x}},[t,l]);return N.useEffect(()=>()=>{var d=a.current;d!=null&&d.disconnect()},[l]),N.createElement(N.Fragment,null,N.createElement(g1,{width:s.containerWidth,height:s.containerHeight}),N.createElement("div",vh({ref:u},e)))}),Ije=N.forwardRef((e,t)=>{var{width:r,height:n}=e,[a,s]=N.useState({containerWidth:ww(r),containerHeight:ww(n)}),o=N.useCallback((u,d)=>{s(f=>{var m=Math.round(u),g=Math.round(d);return f.containerWidth===m&&f.containerHeight===g?f:{containerWidth:m,containerHeight:g}})},[]),l=N.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null){var{width:d,height:f}=u.getBoundingClientRect();o(d,f)}},[t,o]);return N.createElement(N.Fragment,null,N.createElement(g1,{width:a.containerWidth,height:a.containerHeight}),N.createElement("div",vh({ref:l},e)))}),Fje=N.forwardRef((e,t)=>{var{width:r,height:n}=e;return N.createElement(N.Fragment,null,N.createElement(g1,{width:r,height:n}),N.createElement("div",vh({ref:t},e)))}),Bje=N.forwardRef((e,t)=>{var{width:r,height:n}=e;return typeof r=="string"||typeof n=="string"?N.createElement(Ije,vh({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?N.createElement(Fje,vh({},e,{width:r,height:n,ref:t})):N.createElement(N.Fragment,null,N.createElement(g1,{width:r,height:n}),N.createElement("div",vh({ref:t},e)))});function zje(e){return e?Lje:Bje}var Uje=N.forwardRef((e,t)=>{var{children:r,className:n,height:a,onClick:s,onContextMenu:o,onDoubleClick:l,onMouseDown:u,onMouseEnter:d,onMouseLeave:f,onMouseMove:m,onMouseUp:g,onTouchEnd:x,onTouchMove:y,onTouchStart:v,style:w,width:j,responsive:k,dispatchTouchEvents:A=!0}=e,T=N.useRef(null),M=Zn(),[B,L]=N.useState(null),[F,I]=N.useState(null),q=Tje(),P=NC(),R=(P==null?void 0:P.width)>0?P.width:j,K=(P==null?void 0:P.height)>0?P.height:a,ee=N.useCallback(fe=>{q(fe),typeof t=="function"&&t(fe),L(fe),I(fe),fe!=null&&(T.current=fe)},[q,t,L,I]),se=N.useCallback(fe=>{M(kq(fe)),M(Ol({handler:s,reactEvent:fe}))},[M,s]),Z=N.useCallback(fe=>{M($A(fe)),M(Ol({handler:d,reactEvent:fe}))},[M,d]),ne=N.useCallback(fe=>{M(tV()),M(Ol({handler:f,reactEvent:fe}))},[M,f]),X=N.useCallback(fe=>{M($A(fe)),M(Ol({handler:m,reactEvent:fe}))},[M,m]),le=N.useCallback(()=>{M(Dq())},[M]),Ae=N.useCallback(()=>{M(Oq())},[M]),ce=N.useCallback(fe=>{M(Pq(fe.key))},[M]),D=N.useCallback(fe=>{M(Ol({handler:o,reactEvent:fe}))},[M,o]),H=N.useCallback(fe=>{M(Ol({handler:l,reactEvent:fe}))},[M,l]),G=N.useCallback(fe=>{M(Ol({handler:u,reactEvent:fe}))},[M,u]),E=N.useCallback(fe=>{M(Ol({handler:g,reactEvent:fe}))},[M,g]),re=N.useCallback(fe=>{M(Ol({handler:v,reactEvent:fe}))},[M,v]),he=N.useCallback(fe=>{A&&M(Lq(fe)),M(Ol({handler:y,reactEvent:fe}))},[M,A,y]),oe=N.useCallback(fe=>{M(Ol({handler:x,reactEvent:fe}))},[M,x]),z=zje(k);return N.createElement(SV.Provider,{value:B},N.createElement(Sz.Provider,{value:F},N.createElement(z,{width:R??(w==null?void 0:w.width),height:K??(w==null?void 0:w.height),className:mn("recharts-wrapper",n),style:Pje({position:"relative",cursor:"default",width:R,height:K},w),onClick:se,onContextMenu:D,onDoubleClick:H,onFocus:le,onBlur:Ae,onKeyDown:ce,onMouseDown:G,onMouseEnter:Z,onMouseLeave:ne,onMouseMove:X,onMouseUp:E,onTouchEnd:oe,onTouchMove:he,onTouchStart:re,ref:ee},N.createElement(Mje,null),r)))}),$je=["width","height","responsive","children","className","style","compact","title","desc"];function Hje(e,t){if(e==null)return{};var r,n,a=Vje(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Vje(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Hq=N.forwardRef((e,t)=>{var{width:r,height:n,responsive:a,children:s,className:o,style:l,compact:u,title:d,desc:f}=e,m=Hje(e,$je),g=fo(m);return u?N.createElement(N.Fragment,null,N.createElement(g1,{width:r,height:n}),N.createElement(lI,{otherAttributes:g,title:d,desc:f},s)):N.createElement(Uje,{className:o,style:l,width:r,height:n,responsive:a??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},N.createElement(lI,{otherAttributes:g,title:d,desc:f,ref:t},N.createElement(Hbe,null,s)))});function HA(){return HA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},HA.apply(null,arguments)}function uI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function qje(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uI(Object(r),!0).forEach(function(n){Wje(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uI(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wje(e,t,r){return(t=Gje(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gje(e){var t=Yje(e,"string");return typeof t=="symbol"?t:t+""}function Yje(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Kje={top:5,right:5,bottom:5,left:5},Xje=qje({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:Kje,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},nE),aE=N.forwardRef(function(t,r){var n,a=mi(t.categoricalChartProps,Xje),{chartName:s,defaultTooltipEventType:o,validateTooltipEventTypes:l,tooltipPayloadSearcher:u,categoricalChartProps:d}=t,f={chartName:s,defaultTooltipEventType:o,validateTooltipEventTypes:l,tooltipPayloadSearcher:u,eventEmitter:void 0};return N.createElement(Bq,{preloadedState:{options:f},reduxStoreName:(n=d.id)!==null&&n!==void 0?n:s},N.createElement(ZV,{chartData:d.data}),N.createElement(zq,{layout:a.layout,margin:a.margin}),N.createElement($q,{throttleDelay:a.throttleDelay,throttledEvents:a.throttledEvents}),N.createElement(Uq,{baseValue:a.baseValue,accessibilityLayer:a.accessibilityLayer,barCategoryGap:a.barCategoryGap,maxBarSize:a.maxBarSize,stackOffset:a.stackOffset,barGap:a.barGap,barSize:a.barSize,syncId:a.syncId,syncMethod:a.syncMethod,className:a.className,reverseStackOrder:a.reverseStackOrder}),N.createElement(Hq,HA({},a,{ref:r})))}),Zje=["axis"],Jje=N.forwardRef((e,t)=>N.createElement(aE,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Zje,tooltipPayloadSearcher:R5,categoricalChartProps:e,ref:t})),Qje=["axis","item"],ov=N.forwardRef((e,t)=>N.createElement(aE,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Qje,tooltipPayloadSearcher:R5,categoricalChartProps:e,ref:t}));function eNe(e){var t=Zn();return N.useEffect(()=>{t(mje(e))},[t,e]),null}var tNe=["layout"];function VA(){return VA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},VA.apply(null,arguments)}function rNe(e,t){if(e==null)return{};var r,n,a=nNe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function nNe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function dI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function aNe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dI(Object(r),!0).forEach(function(n){iNe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dI(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function iNe(e,t,r){return(t=sNe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sNe(e){var t=oNe(e,"string");return typeof t=="symbol"?t:t+""}function oNe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var lNe={top:5,right:5,bottom:5,left:5},Vq=aNe({accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:lNe,reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},nE),cNe=N.forwardRef(function(t,r){var n,a=mi(t.categoricalChartProps,Vq),{layout:s}=a,o=rNe(a,tNe),{chartName:l,defaultTooltipEventType:u,validateTooltipEventTypes:d,tooltipPayloadSearcher:f}=t,m={chartName:l,defaultTooltipEventType:u,validateTooltipEventTypes:d,tooltipPayloadSearcher:f,eventEmitter:void 0};return N.createElement(Bq,{preloadedState:{options:m},reduxStoreName:(n=a.id)!==null&&n!==void 0?n:l},N.createElement(ZV,{chartData:a.data}),N.createElement(zq,{layout:s,margin:a.margin}),N.createElement($q,{throttleDelay:a.throttleDelay,throttledEvents:a.throttledEvents}),N.createElement(Uq,{baseValue:void 0,accessibilityLayer:a.accessibilityLayer,barCategoryGap:a.barCategoryGap,maxBarSize:a.maxBarSize,stackOffset:a.stackOffset,barGap:a.barGap,barSize:a.barSize,syncId:a.syncId,syncMethod:a.syncMethod,className:a.className,reverseStackOrder:a.reverseStackOrder}),N.createElement(eNe,{cx:a.cx,cy:a.cy,startAngle:a.startAngle,endAngle:a.endAngle,innerRadius:a.innerRadius,outerRadius:a.outerRadius}),N.createElement(Hq,VA({},o,{ref:r})))});function fI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function hI(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fI(Object(r),!0).forEach(function(n){uNe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fI(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function uNe(e,t,r){return(t=dNe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dNe(e){var t=fNe(e,"string");return typeof t=="symbol"?t:t+""}function fNe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hNe=["item"],mNe=hI(hI({},Vq),{},{layout:"centric",startAngle:0,endAngle:360}),qA=N.forwardRef((e,t)=>{var r=mi(e,mNe);return N.createElement(cNe,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:hNe,tooltipPayloadSearcher:R5,categoricalChartProps:r,ref:t})}),pNe=["axis"],xNe=N.forwardRef((e,t)=>N.createElement(aE,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:pNe,tooltipPayloadSearcher:R5,categoricalChartProps:e,ref:t}));const mI=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6"];function gNe(){const{projects:e,tasks:t,expenses:r,engineers:n}=ca(),{profile:a,hasPermission:s,logout:o}=la(),l=mo(),u=N.useMemo(()=>a?s("projects.view_all")||s("tasks.view_all")||a.uid==="admin-123":!1,[a,s]),d=N.useMemo(()=>u?e:e.filter(J=>J.assignedTo===(a==null?void 0:a.name)||J.assignedEmail===(a==null?void 0:a.email)||J.assignedRole===(a==null?void 0:a.role)),[e,u,a]),f=N.useMemo(()=>u?t:t.filter(J=>J.assignee===(a==null?void 0:a.name)||J.assignee===(a==null?void 0:a.email)),[t,u,a]),m=()=>{o(),l("/login")},[g,x]=Mt.useState(!1),[y,v]=Mt.useState(!1),[w,j]=Mt.useState(!1),[k,A]=Mt.useState(!1),[T,M]=Mt.useState(!1),[B,L]=Mt.useState(!1),[F,I]=Mt.useState(!1),[q,P]=Mt.useState(!1),[R,K]=Mt.useState(!1),[ee,se]=Mt.useState(!1),Z=J=>{if(!J)return 0;const ve=J.match(/(\d+)h/),Oe=J.match(/(\d+)m/),xe=ve?parseInt(ve[1]):0,qe=Oe?parseInt(Oe[1]):0;return xe+qe/60},ne=J=>{if(!J)return"-";try{const ve=new Date(J);return isNaN(ve.getTime())?J:ve.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})}catch{return J}},X=N.useMemo(()=>{let J=0,ve=0,Oe=0,xe=0,qe=0,me=0,Ge=0;const Be=new Date,it=`${Be.getFullYear()}-${(Be.getMonth()+1).toString().padStart(2,"0")}`,st=new Date(Be.getFullYear(),Be.getMonth()-1,1),Ve=`${st.getFullYear()}-${(st.getMonth()+1).toString().padStart(2,"0")}`,te=new Map;for(let It=5;It>=0;It--){const Rr=new Date(Be.getFullYear(),Be.getMonth()-It,1),kr=`${Rr.getFullYear()}-${(Rr.getMonth()+1).toString().padStart(2,"0")}`;te.set(kr,{revenue:0,expenses:0})}const Ue=new Map;d.forEach(It=>{const Rr=Z(It.totalTime),kr=(It.hourlyRate||0)*Rr,qr=It.totalAmount&&It.totalAmount>0?It.totalAmount:kr+(It.travelCost||0)+(It.materialCost||0)+(It.halfDayRate||0)+(It.fullDayRate||0)+(It.monthlyRate||0),Xr=(It.clientHourlyRate||0)*Rr,Zr=It.clientTotalAmount&&It.clientTotalAmount>0?It.clientTotalAmount:Xr+(It.clientTravelCost||0)+(It.clientMaterialCost||0)+(It.clientHalfDayRate||0)+(It.clientFullDayRate||0)+(It.clientMonthlyRate||0);J+=Zr,ve+=qr;const ye=It.issuedMonth||(It.issueDate?It.issueDate.substring(0,7):"");if(ye===Ve&&(qe+=Zr,me+=qr),It.clientInvoiceStatus!=="Paid"&&(Oe+=Zr),It.engineerInvoiceStatus!=="Paid"&&(xe+=qr),te.has(ye)){const Ie=te.get(ye);Ie.revenue+=Zr,Ie.expenses+=qr}It.assignedTo&&Ue.set(It.assignedTo,(Ue.get(It.assignedTo)||0)+1)});const ot=r.reduce((It,Rr)=>It+(Rr.amount||0),0);r.forEach(It=>{(It.date||"").substring(0,7)===Ve&&(Ge+=It.amount||0)});const vt=J-ve-ot,_t=qe-me-Ge,qt=(It,Rr)=>{if(Rr===0)return It>0?"+100%":"0%";const kr=(It-Rr)/Rr*100;return`${kr>=0?"+":""}${kr.toFixed(1)}%`},Ft=Array.from(te.entries()).map(([It,Rr])=>{const kr=(It||"").split("-");if(kr.length<2)return{name:It,value:Rr.revenue};const[qr,Xr]=kr;return{name:new Date(parseInt(qr),parseInt(Xr)-1).toLocaleString("default",{month:"short"}),value:Rr.revenue}}),Dt=Array.from(Ue.entries()).map(([It,Rr])=>({name:It,value:Rr})).sort((It,Rr)=>Rr.value-It.value).slice(0,5),Rt=d.filter(It=>It.status==="Completed").length,wr=d.filter(It=>It.status!=="Completed").length,gr=d.filter(It=>It.status==="Completed"&&(It.completedDate||"").substring(0,7)===it).length,Er=d.filter(It=>It.clientInvoiceStatus!=="Paid"&&It.clientTotalAmount&&It.clientTotalAmount>0).length,Ur=d.filter(It=>It.engineerInvoiceStatus!=="Paid"&&It.totalAmount&&It.totalAmount>0).length,Ht=new Set;return d.forEach(It=>{It.assignedTo&&Ht.add(It.assignedTo)}),f.forEach(It=>{It.assignee&&Ht.add(It.assignee)}),{companyRevenue:J,engineerExpenses:ve,companyExpenses:ot,netProfit:vt,pendingClientPayment:Oe,pendingEngineerPayment:xe,completedProjects:Rt,pendingProjects:wr,totalEmployees:Ht.size,totalEngineers:n.length,revenueChartData:Ft,performanceData:Dt,completedThisMonth:gr,pendingClientCount:Er,pendingEngineerCount:Ur,changes:{revenue:qt(J,qe),engExpenses:qt(ve,me),compExpenses:qt(ot,Ge),profit:qt(vt,_t)}}},[d,f,r,n]),le=N.useMemo(()=>{const J=[];return d.slice(0,3).forEach(ve=>{J.push({id:`p-${ve.id}`,action:`Project ${ve.name} updated`,time:"Recently",color:ve.status==="Completed"?"bg-green-500":"bg-blue-500"})}),f.slice(0,2).forEach(ve=>{J.push({id:`t-${ve.id}`,action:`Task ${ve.title} assigned`,time:"Recently",color:"bg-purple-500"})}),J.slice(0,5)},[d,f]),Ae=N.useMemo(()=>d.filter(J=>J.status==="Pending"||J.status==="Planning").slice(0,3).map(J=>({id:J.id,type:"Project Approval",user:J.client||"New Client",date:ne(J.issueDate)})),[d]),ce=N.useMemo(()=>f.filter(J=>J.status!=="Completed").slice(0,3).map(J=>({id:J.id,task:J.title,due:ne(J.dueDate),priority:J.status==="In Progress"?"High":"Medium"})),[f]),D=(J,ve)=>{De.info(`Reviewing ${J} for ${ve}`,{description:"Loading document details..."})},H=J=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:"compact",maximumFractionDigits:3}).format(J),G=J=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(J),E=N.useMemo(()=>d.map(J=>{const ve=Z(J.totalTime),Oe=(J.clientHourlyRate||0)*ve,xe=J.clientTotalAmount&&J.clientTotalAmount>0?J.clientTotalAmount:Oe+(J.clientTravelCost||0)+(J.clientMaterialCost||0)+(J.clientHalfDayRate||0)+(J.clientFullDayRate||0)+(J.clientMonthlyRate||0);return{id:J.id,name:J.name,client:J.client,amount:xe,date:J.issueDate||J.deadline,status:J.clientInvoiceStatus||"Unpaid"}}).filter(J=>J.amount>0).sort((J,ve)=>new Date(ve.date).getTime()-new Date(J.date).getTime()),[d]),re=N.useMemo(()=>d.map(J=>{const ve=Z(J.totalTime),Oe=(J.hourlyRate||0)*ve,xe=J.totalAmount&&J.totalAmount>0?J.totalAmount:Oe+(J.travelCost||0)+(J.materialCost||0)+(J.halfDayRate||0)+(J.fullDayRate||0)+(J.monthlyRate||0);return{id:J.id,name:J.name,engineer:J.assignedTo||"Unassigned",amount:xe,date:J.issueDate||J.deadline,status:J.engineerInvoiceStatus||"Unpaid"}}).filter(J=>J.amount>0).sort((J,ve)=>new Date(ve.date).getTime()-new Date(J.date).getTime()),[d]),he=N.useMemo(()=>r.map(J=>({id:J.id,description:J.description,category:J.category,amount:J.amount||0,date:J.date,status:J.status||"Pending"})).sort((J,ve)=>new Date(ve.date).getTime()-new Date(J.date).getTime()),[r]),oe=N.useMemo(()=>d.map(J=>{const ve=Z(J.totalTime),Oe=(J.clientHourlyRate||0)*ve,xe=J.clientTotalAmount&&J.clientTotalAmount>0?J.clientTotalAmount:Oe+(J.clientTravelCost||0)+(J.clientMaterialCost||0)+(J.clientHalfDayRate||0)+(J.clientFullDayRate||0)+(J.clientMonthlyRate||0),qe=(J.hourlyRate||0)*ve,me=J.totalAmount&&J.totalAmount>0?J.totalAmount:qe+(J.travelCost||0)+(J.materialCost||0)+(J.halfDayRate||0)+(J.fullDayRate||0)+(J.monthlyRate||0),Ge=xe-me;return{id:J.id,name:J.name,revenue:xe,expense:me,profit:Ge,date:J.issueDate||J.deadline,status:J.status}}).filter(J=>J.revenue>0||J.expense>0).sort((J,ve)=>new Date(ve.date).getTime()-new Date(J.date).getTime()),[d]),z=N.useMemo(()=>d.map(J=>{const ve=Z(J.totalTime),Oe=(J.clientHourlyRate||0)*ve,xe=J.clientTotalAmount&&J.clientTotalAmount>0?J.clientTotalAmount:Oe+(J.clientTravelCost||0)+(J.clientMaterialCost||0)+(J.clientHalfDayRate||0)+(J.clientFullDayRate||0)+(J.clientMonthlyRate||0);return{id:J.id,name:J.name,client:J.client,amount:xe,date:J.issueDate||J.deadline,status:J.clientInvoiceStatus||"Unpaid"}}).filter(J=>J.amount>0&&J.status!=="Paid").sort((J,ve)=>new Date(ve.date).getTime()-new Date(J.date).getTime()),[d]),fe=N.useMemo(()=>d.map(J=>{const ve=Z(J.totalTime),Oe=(J.hourlyRate||0)*ve,xe=J.totalAmount&&J.totalAmount>0?J.totalAmount:Oe+(J.travelCost||0)+(J.materialCost||0)+(J.halfDayRate||0)+(J.fullDayRate||0)+(J.monthlyRate||0);return{id:J.id,name:J.name,engineer:J.assignedTo||"Unassigned",amount:xe,date:J.issueDate||J.deadline,status:J.engineerInvoiceStatus||"Unpaid"}}).filter(J=>J.amount>0&&J.status!=="Paid").sort((J,ve)=>new Date(ve.date).getTime()-new Date(J.date).getTime()),[d]),de=N.useMemo(()=>d.filter(J=>J.status==="Completed").map(J=>({id:J.id,name:J.name,client:J.client,engineer:J.assignedTo||"Unassigned",date:J.deadline||J.issueDate,revenue:J.clientTotalAmount||0})).sort((J,ve)=>new Date(ve.date).getTime()-new Date(J.date).getTime()),[d]),W=N.useMemo(()=>d.filter(J=>J.status!=="Completed").map(J=>({id:J.id,name:J.name,client:J.client,engineer:J.assignedTo||"Unassigned",date:J.deadline||J.issueDate,status:J.status})).sort((J,ve)=>new Date(ve.date).getTime()-new Date(J.date).getTime()),[d]),ae=N.useMemo(()=>{const J=new Map;return d.forEach(ve=>{if(ve.assignedTo){const Oe=J.get(ve.assignedTo)||{projects:0,tasks:0};J.set(ve.assignedTo,{...Oe,projects:Oe.projects+1})}}),f.forEach(ve=>{if(ve.assignee){const Oe=J.get(ve.assignee)||{projects:0,tasks:0};J.set(ve.assignee,{...Oe,tasks:Oe.tasks+1})}}),Array.from(J.entries()).map(([ve,Oe])=>({name:ve,...Oe,total:Oe.projects+Oe.tasks})).sort((ve,Oe)=>Oe.total-ve.total)},[d,f]),_e=N.useMemo(()=>n.map(J=>{const ve=d.filter(Oe=>Oe.assignedTo===J.name&&Oe.status!=="Completed").length;return{id:J.id,name:J.name,specialization:J.specialization||"General",activeProjects:ve,email:J.email||"N/A"}}).sort((J,ve)=>ve.activeProjects-J.activeProjects),[n,d]),ue=()=>{const ve=[["Project ID","Project Name","Client","Amount","Date","Status"].join(","),...E.map(me=>[me.id,`"${me.name}"`,`"${me.client}"`,me.amount.toFixed(2),me.date,me.status].join(","))].join(`
`),Oe=new Blob([ve],{type:"text/csv;charset=utf-8;"}),xe=document.createElement("a"),qe=URL.createObjectURL(Oe);xe.setAttribute("href",qe),xe.setAttribute("download",`company_revenue_${new Date().toISOString().split("T")[0]}.csv`),xe.style.visibility="hidden",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),De.success("Revenue report downloaded successfully")},ke=()=>{const ve=[["Project ID","Project Name","Engineer","Amount","Date","Status"].join(","),...re.map(me=>[me.id,`"${me.name}"`,`"${me.engineer}"`,me.amount.toFixed(2),me.date,me.status].join(","))].join(`
`),Oe=new Blob([ve],{type:"text/csv;charset=utf-8;"}),xe=document.createElement("a"),qe=URL.createObjectURL(Oe);xe.setAttribute("href",qe),xe.setAttribute("download",`engineer_expenses_${new Date().toISOString().split("T")[0]}.csv`),xe.style.visibility="hidden",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),De.success("Engineer expenses report downloaded successfully")},$e=()=>{const ve=[["Expense ID","Description","Category","Amount","Date","Status"].join(","),...he.map(me=>[me.id,`"${me.description}"`,`"${me.category}"`,me.amount.toFixed(2),me.date,me.status].join(","))].join(`
`),Oe=new Blob([ve],{type:"text/csv;charset=utf-8;"}),xe=document.createElement("a"),qe=URL.createObjectURL(Oe);xe.setAttribute("href",qe),xe.setAttribute("download",`company_expenses_${new Date().toISOString().split("T")[0]}.csv`),xe.style.visibility="hidden",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),De.success("Company expenses report downloaded successfully")},Je=()=>{const ve=[["Project ID","Project Name","Revenue","Engineer Expense","Net Profit","Date","Status"].join(","),...oe.map(me=>[me.id,`"${me.name}"`,me.revenue.toFixed(2),me.expense.toFixed(2),me.profit.toFixed(2),me.date,me.status].join(","))].join(`
`),Oe=new Blob([ve],{type:"text/csv;charset=utf-8;"}),xe=document.createElement("a"),qe=URL.createObjectURL(Oe);xe.setAttribute("href",qe),xe.setAttribute("download",`net_profit_report_${new Date().toISOString().split("T")[0]}.csv`),xe.style.visibility="hidden",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),De.success("Net profit report downloaded successfully")},Xe=()=>{const ve=[["Project ID","Project Name","Client","Amount","Date","Status"].join(","),...z.map(me=>[me.id,`"${me.name}"`,`"${me.client}"`,me.amount.toFixed(2),me.date,me.status].join(","))].join(`
`),Oe=new Blob([ve],{type:"text/csv;charset=utf-8;"}),xe=document.createElement("a"),qe=URL.createObjectURL(Oe);xe.setAttribute("href",qe),xe.setAttribute("download",`pending_client_payments_${new Date().toISOString().split("T")[0]}.csv`),xe.style.visibility="hidden",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),De.success("Pending client payments report downloaded successfully")},Ne=()=>{const ve=[["Project ID","Project Name","Engineer","Amount","Date","Status"].join(","),...fe.map(me=>[me.id,`"${me.name}"`,`"${me.engineer}"`,me.amount.toFixed(2),me.date,me.status].join(","))].join(`
`),Oe=new Blob([ve],{type:"text/csv;charset=utf-8;"}),xe=document.createElement("a"),qe=URL.createObjectURL(Oe);xe.setAttribute("href",qe),xe.setAttribute("download",`pending_engineer_payments_${new Date().toISOString().split("T")[0]}.csv`),xe.style.visibility="hidden",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),De.success("Pending engineer payments report downloaded successfully")},Ye=()=>{const ve=[["Project ID","Project Name","Client","Engineer","Completion Date","Revenue"].join(","),...de.map(me=>[me.id,`"${me.name}"`,`"${me.client}"`,`"${me.engineer}"`,me.date,me.revenue.toFixed(2)].join(","))].join(`
`),Oe=new Blob([ve],{type:"text/csv;charset=utf-8;"}),xe=document.createElement("a"),qe=URL.createObjectURL(Oe);xe.setAttribute("href",qe),xe.setAttribute("download",`completed_projects_${new Date().toISOString().split("T")[0]}.csv`),xe.style.visibility="hidden",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),De.success("Completed projects report downloaded successfully")},at=()=>{const ve=[["Project ID","Project Name","Client","Engineer","Deadline","Status"].join(","),...W.map(me=>[me.id,`"${me.name}"`,`"${me.client}"`,`"${me.engineer}"`,me.date,me.status].join(","))].join(`
`),Oe=new Blob([ve],{type:"text/csv;charset=utf-8;"}),xe=document.createElement("a"),qe=URL.createObjectURL(Oe);xe.setAttribute("href",qe),xe.setAttribute("download",`pending_projects_${new Date().toISOString().split("T")[0]}.csv`),xe.style.visibility="hidden",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),De.success("Pending projects report downloaded successfully")},Y=()=>{const ve=[["Employee Name","Active Projects","Active Tasks","Total Involvement"].join(","),...ae.map(me=>[`"${me.name}"`,me.projects,me.tasks,me.total].join(","))].join(`
`),Oe=new Blob([ve],{type:"text/csv;charset=utf-8;"}),xe=document.createElement("a"),qe=URL.createObjectURL(Oe);xe.setAttribute("href",qe),xe.setAttribute("download",`employees_report_${new Date().toISOString().split("T")[0]}.csv`),xe.style.visibility="hidden",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),De.success("Employees report downloaded successfully")},we=()=>{const ve=[["Engineer ID","Name","Specialization","Active Projects","Email"].join(","),..._e.map(me=>[me.id,`"${me.name}"`,`"${me.specialization}"`,me.activeProjects,`"${me.email}"`].join(","))].join(`
`),Oe=new Blob([ve],{type:"text/csv;charset=utf-8;"}),xe=document.createElement("a"),qe=URL.createObjectURL(Oe);xe.setAttribute("href",qe),xe.setAttribute("download",`engineers_report_${new Date().toISOString().split("T")[0]}.csv`),xe.style.visibility="hidden",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),De.success("Engineers report downloaded successfully")};return s("dashboard.view")?i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:u?"Management Dashboard":"Employee Dashboard"}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Welcome back, ",(a==null?void 0:a.name)||"User",". Here's what's happening today."]})]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[i.jsx(Ui,{size:16}),"Last updated: Just now"]})]}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4 xl:grid-cols-5",children:[s("finance.view")&&i.jsx(bu,{title:"Company Revenue",value:H(X.companyRevenue),change:X.changes.revenue,trend:X.changes.revenue.startsWith("+")?"up":"down",icon:Fo,onClick:()=>x(!0),actions:[{icon:xu,label:"View",onClick:J=>{J.stopPropagation(),x(!0)}},{icon:Nr,label:"Download",onClick:J=>{J.stopPropagation(),ue()}}]}),s("finance.view")&&i.jsx(bu,{title:"Engineers Expenses",value:H(X.engineerExpenses),change:X.changes.engExpenses,trend:X.changes.engExpenses.startsWith("+")?"up":"down",icon:ds,onClick:()=>v(!0),actions:[{icon:xu,label:"View",onClick:J=>{J.stopPropagation(),v(!0)}},{icon:Nr,label:"Download",onClick:J=>{J.stopPropagation(),ke()}}]}),s("finance.view")&&i.jsx(bu,{title:"Company Expenses",value:H(X.companyExpenses),change:X.changes.compExpenses,trend:X.changes.compExpenses.startsWith("+")?"up":"down",icon:ds,onClick:()=>j(!0),actions:[{icon:xu,label:"View",onClick:J=>{J.stopPropagation(),j(!0)}},{icon:Nr,label:"Download",onClick:J=>{J.stopPropagation(),$e()}}]}),s("finance.view")&&i.jsx(bu,{title:"Net Profit",value:H(X.netProfit),change:X.changes.profit,trend:X.changes.profit.startsWith("+")?"up":"down",icon:Fo,onClick:()=>A(!0),actions:[{icon:xu,label:"View",onClick:J=>{J.stopPropagation(),A(!0)}},{icon:Nr,label:"Download",onClick:J=>{J.stopPropagation(),Je()}}]}),s("finance.view")&&i.jsx(bu,{title:"Pending Client Pmt",value:H(X.pendingClientPayment),change:`${X.pendingClientCount} invoices`,trend:"down",icon:Ui,onClick:()=>M(!0),actions:[{icon:xu,label:"View",onClick:J=>{J.stopPropagation(),M(!0)}},{icon:Nr,label:"Download",onClick:J=>{J.stopPropagation(),Xe()}}]}),s("finance.view")&&i.jsx(bu,{title:"Pending Engineer Pmt",value:H(X.pendingEngineerPayment),change:`${X.pendingEngineerCount} invoices`,trend:"down",icon:Ui,onClick:()=>L(!0),actions:[{icon:xu,label:"View",onClick:J=>{J.stopPropagation(),L(!0)}},{icon:Nr,label:"Download",onClick:J=>{J.stopPropagation(),Ne()}}]}),s("projects.view")&&i.jsx(bu,{title:"Completed Projects",value:X.completedProjects.toString(),change:`+${X.completedThisMonth} this month`,trend:"up",icon:Ec,onClick:()=>I(!0),actions:[{icon:xu,label:"View",onClick:J=>{J.stopPropagation(),I(!0)}},{icon:Nr,label:"Download",onClick:J=>{J.stopPropagation(),Ye()}}]}),s("projects.view")&&i.jsx(bu,{title:"Pending Projects",value:X.pendingProjects.toString(),change:`${X.pendingProjects} active`,trend:"up",icon:Ni,onClick:()=>P(!0),actions:[{icon:xu,label:"View",onClick:J=>{J.stopPropagation(),P(!0)}},{icon:Nr,label:"Download",onClick:J=>{J.stopPropagation(),at()}}]}),s("hr.view")&&i.jsx(bu,{title:"Total Employees",value:X.totalEmployees.toString(),change:"Active team",trend:"up",icon:Hn,onClick:()=>K(!0),actions:[{icon:xu,label:"View",onClick:J=>{J.stopPropagation(),K(!0)}},{icon:Nr,label:"Download",onClick:J=>{J.stopPropagation(),Y()}}]}),s("hr.view")&&i.jsx(bu,{title:"Total Engineers",value:X.totalEngineers.toString(),change:"Specialists",trend:"up",icon:Hn,onClick:()=>se(!0),actions:[{icon:xu,label:"View",onClick:J=>{J.stopPropagation(),se(!0)}},{icon:Nr,label:"Download",onClick:J=>{J.stopPropagation(),we()}}]})]}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-7",children:[s("finance.view")&&i.jsxs("div",{className:"col-span-4 rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("h3",{className:"font-semibold",children:"Revenue Overview"}),i.jsxs("select",{onChange:J=>De.info(`Switching view to: ${J.target.value}`),className:"bg-transparent text-sm text-muted-foreground outline-none",children:[i.jsx("option",{children:"Last 6 Months"}),i.jsx("option",{children:"Last Year"})]})]}),i.jsx("div",{className:"h-[300px] w-full",children:i.jsx(_u,{width:"100%",height:"100%",children:i.jsxs(xNe,{data:X.revenueChartData,children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:"colorValue",x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),i.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]})}),i.jsx(Mm,{strokeDasharray:"3 3",vertical:!1,stroke:"rgba(255,255,255,0.1)"}),i.jsx(uh,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fontSize:12}}),i.jsx(dh,{axisLine:!1,tickLine:!1,tick:{fontSize:12},tickFormatter:J=>H(J)}),i.jsx(Eu,{contentStyle:{backgroundColor:"#1e293b",border:"none",borderRadius:"8px",color:"#fff"},itemStyle:{color:"#fff"}}),i.jsx(bq,{type:"monotone",dataKey:"value",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorValue)"})]})})})]}),s("hr.view")&&i.jsxs("div",{className:tt("rounded-xl border border-border bg-card p-6 shadow-sm",s("finance.view")?"col-span-3":"col-span-7"),children:[i.jsx("h3",{className:"mb-4 font-semibold",children:"Engineer Project Distribution"}),i.jsx("div",{className:"h-[300px] w-full",children:i.jsx(_u,{width:"100%",height:"100%",children:i.jsxs(ov,{data:X.performanceData,layout:"vertical",children:[i.jsx(uh,{type:"number",hide:!0}),i.jsx(dh,{dataKey:"name",type:"category",axisLine:!1,tickLine:!1,tick:{fontSize:12},width:80}),i.jsx(Eu,{cursor:{fill:"transparent"},contentStyle:{backgroundColor:"#1e293b",border:"none",borderRadius:"8px",color:"#fff"}}),i.jsx(Bd,{dataKey:"value",radius:[0,4,4,0],children:X.performanceData.map((J,ve)=>i.jsx(Wd,{fill:mI[ve%mI.length]},`cell-${ve}`))})]})})})]})]}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[s("projects.view")&&i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"mb-4 font-semibold",children:"Pending Project Approvals"}),i.jsx("div",{className:"space-y-4",children:Ae.length>0?Ae.map(J=>i.jsxs("div",{className:"flex items-center justify-between border-b border-border pb-3 last:border-0 last:pb-0",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:J.type}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[J.user," • ",J.date]})]}),i.jsx("button",{onClick:()=>D(J.type,J.user),className:"text-xs font-medium text-primary hover:underline",children:"Review"})]},J.id)):i.jsx("p",{className:"text-sm text-muted-foreground",children:"No pending approvals"})})]}),s("projects.view")&&i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"mb-4 font-semibold",children:"Recent Activity"}),i.jsx("div",{className:"space-y-4",children:le.length>0?le.map(J=>i.jsxs("div",{className:"flex gap-3 cursor-pointer hover:bg-accent/50 p-1 rounded-lg transition-colors",onClick:()=>De.info(`Viewing details for: ${J.action}`),children:[i.jsx("div",{className:tt("mt-1.5 h-2 w-2 shrink-0 rounded-full",J.color)}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:J.action}),i.jsx("p",{className:"text-xs text-muted-foreground",children:J.time})]})]},J.id)):i.jsx("p",{className:"text-sm text-muted-foreground",children:"No recent activity"})})]}),s("projects.view")&&i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"mb-4 font-semibold",children:"Upcoming Tasks"}),i.jsx("div",{className:"space-y-4",children:ce.length>0?ce.map(J=>i.jsxs("div",{className:"flex items-center justify-between cursor-pointer hover:bg-accent/50 p-1 rounded-lg transition-colors",onClick:()=>De.info(`Opening task: ${J.task}`),children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-accent",children:i.jsx(Ec,{size:16,className:"text-muted-foreground"})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:J.task}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Due: ",J.due]})]})]}),i.jsx("span",{className:tt("rounded-full px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",J.priority==="High"?"bg-red-500/10 text-red-500":"bg-yellow-500/10 text-yellow-500"),children:J.priority})]},J.id)):i.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming tasks"})})]})]}),i.jsx(on,{children:g&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-4xl max-h-[80vh] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(ev,{size:20})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"Revenue Database"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Detailed breakdown of all client revenue"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:ue,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary/20 transition-all hover:scale-105 active:scale-95 cursor-pointer text-sm font-medium shadow-sm hover:shadow",children:[i.jsx(Nr,{size:16}),"Download CSV"]}),i.jsx("button",{onClick:()=>x(!1),className:"p-2 hover:bg-accent rounded-full transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto p-6",children:i.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 text-muted-foreground font-medium",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3",children:"Project"}),i.jsx("th",{className:"px-4 py-3",children:"Client"}),i.jsx("th",{className:"px-4 py-3",children:"Date"}),i.jsx("th",{className:"px-4 py-3",children:"Status"}),i.jsx("th",{className:"px-4 py-3 text-right",children:"Amount"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:E.length>0?E.map(J=>i.jsxs("tr",{className:"hover:bg-accent/5 transition-colors",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Tn,{size:14,className:"text-primary"}),i.jsx("span",{className:"font-medium",children:J.name})]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:J.client}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[i.jsx(Lo,{size:12}),J.date]})}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",J.status==="Paid"?"bg-green-500/10 text-green-500":"bg-yellow-500/10 text-yellow-500"),children:J.status})}),i.jsx("td",{className:"px-4 py-4 text-right font-bold text-primary",children:G(J.amount)})]},J.id)):i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-muted-foreground",children:"No revenue data found"})})})]})})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Total Revenue: "}),i.jsx("span",{className:"font-bold text-lg text-primary",children:G(X.companyRevenue)})]}),i.jsx("button",{onClick:()=>x(!1),className:"px-6 py-2 rounded-lg bg-accent hover:bg-accent/80 transition-colors text-sm font-medium",children:"Close"})]})]})})}),i.jsx(on,{children:y&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-4xl max-h-[80vh] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(ev,{size:20})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"Engineer Expenses Database"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Detailed breakdown of all engineer-related costs"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:ke,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary/20 transition-all hover:scale-105 active:scale-95 cursor-pointer text-sm font-medium shadow-sm hover:shadow",children:[i.jsx(Nr,{size:16}),"Download CSV"]}),i.jsx("button",{onClick:()=>v(!1),className:"p-2 hover:bg-accent rounded-full transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto p-6",children:i.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 text-muted-foreground font-medium",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3",children:"Project"}),i.jsx("th",{className:"px-4 py-3",children:"Engineer"}),i.jsx("th",{className:"px-4 py-3",children:"Date"}),i.jsx("th",{className:"px-4 py-3",children:"Status"}),i.jsx("th",{className:"px-4 py-3 text-right",children:"Amount"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:re.length>0?re.map(J=>i.jsxs("tr",{className:"hover:bg-accent/5 transition-colors",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Tn,{size:14,className:"text-primary"}),i.jsx("span",{className:"font-medium",children:J.name})]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:J.engineer}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[i.jsx(Lo,{size:12}),ne(J.date)]})}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",J.status==="Paid"?"bg-green-500/10 text-green-500":"bg-yellow-500/10 text-yellow-500"),children:J.status})}),i.jsx("td",{className:"px-4 py-4 text-right font-bold text-primary",children:G(J.amount)})]},J.id)):i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-muted-foreground",children:"No engineer expense data found"})})})]})})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Total Engineer Expenses: "}),i.jsx("span",{className:"font-bold text-lg text-primary",children:G(X.engineerExpenses)})]}),i.jsx("button",{onClick:()=>v(!1),className:"px-6 py-2 rounded-lg bg-accent hover:bg-accent/80 transition-colors text-sm font-medium",children:"Close"})]})]})})}),i.jsx(on,{children:w&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-4xl max-h-[80vh] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(ev,{size:20})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"Company Expenses Database"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Detailed breakdown of all general company expenses"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:$e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary/20 transition-all hover:scale-105 active:scale-95 cursor-pointer text-sm font-medium shadow-sm hover:shadow",children:[i.jsx(Nr,{size:16}),"Download CSV"]}),i.jsx("button",{onClick:()=>j(!1),className:"p-2 hover:bg-accent rounded-full transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto p-6",children:i.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 text-muted-foreground font-medium",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3",children:"Description"}),i.jsx("th",{className:"px-4 py-3",children:"Category"}),i.jsx("th",{className:"px-4 py-3",children:"Date"}),i.jsx("th",{className:"px-4 py-3",children:"Status"}),i.jsx("th",{className:"px-4 py-3 text-right",children:"Amount"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:he.length>0?he.map(J=>i.jsxs("tr",{className:"hover:bg-accent/5 transition-colors",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Tn,{size:14,className:"text-primary"}),i.jsx("span",{className:"font-medium",children:J.description})]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:J.category}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[i.jsx(Lo,{size:12}),ne(J.date)]})}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",J.status==="Approved"?"bg-green-500/10 text-green-500":"bg-yellow-500/10 text-yellow-500"),children:J.status})}),i.jsx("td",{className:"px-4 py-4 text-right font-bold text-primary",children:G(J.amount)})]},J.id)):i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-muted-foreground",children:"No company expense data found"})})})]})})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Total Company Expenses: "}),i.jsx("span",{className:"font-bold text-lg text-primary",children:G(X.companyExpenses)})]}),i.jsx("button",{onClick:()=>j(!1),className:"px-6 py-2 rounded-lg bg-accent hover:bg-accent/80 transition-colors text-sm font-medium",children:"Close"})]})]})})}),i.jsx(on,{children:k&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-5xl max-h-[80vh] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(Fo,{size:20})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"Net Profit Analysis"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Project-by-project breakdown of profit margins"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:Je,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary/20 transition-all hover:scale-105 active:scale-95 cursor-pointer text-sm font-medium shadow-sm hover:shadow",children:[i.jsx(Nr,{size:16}),"Download CSV"]}),i.jsx("button",{onClick:()=>A(!1),className:"p-2 hover:bg-accent rounded-full transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto p-6",children:i.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 text-muted-foreground font-medium",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3",children:"Project"}),i.jsx("th",{className:"px-4 py-3 text-right",children:"Revenue"}),i.jsx("th",{className:"px-4 py-3 text-right",children:"Eng. Cost"}),i.jsx("th",{className:"px-4 py-3 text-right",children:"Profit"}),i.jsx("th",{className:"px-4 py-3",children:"Date"}),i.jsx("th",{className:"px-4 py-3",children:"Status"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:oe.length>0?oe.map(J=>i.jsxs("tr",{className:"hover:bg-accent/5 transition-colors",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Tn,{size:14,className:"text-primary"}),i.jsx("span",{className:"font-medium",children:J.name})]})}),i.jsx("td",{className:"px-4 py-4 text-right text-green-500 font-medium",children:G(J.revenue)}),i.jsx("td",{className:"px-4 py-4 text-right text-red-500 font-medium",children:G(J.expense)}),i.jsx("td",{className:tt("px-4 py-4 text-right font-bold",J.profit>=0?"text-primary":"text-red-600"),children:G(J.profit)}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[i.jsx(Lo,{size:12}),J.date]})}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",J.status==="Completed"?"bg-green-500/10 text-green-500":"bg-blue-500/10 text-blue-500"),children:J.status})})]},J.id)):i.jsx("tr",{children:i.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-muted-foreground",children:"No profit data found"})})})]})})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex flex-col gap-4",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"p-4 rounded-xl bg-card border border-border",children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Total Revenue"}),i.jsx("p",{className:"text-xl font-bold text-green-500",children:G(X.companyRevenue)})]}),i.jsxs("div",{className:"p-4 rounded-xl bg-card border border-border",children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Total Expenses (Eng + Co)"}),i.jsx("p",{className:"text-xl font-bold text-red-500",children:G(X.engineerExpenses+X.companyExpenses)})]}),i.jsxs("div",{className:"p-4 rounded-xl bg-card border border-border",children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Net Profit"}),i.jsx("p",{className:"text-xl font-bold text-primary",children:G(X.netProfit)})]})]}),i.jsx("div",{className:"flex items-center justify-end",children:i.jsx("button",{onClick:()=>A(!1),className:"px-6 py-2 rounded-lg bg-accent hover:bg-accent/80 transition-colors text-sm font-medium",children:"Close"})})]})]})})}),i.jsx(on,{children:T&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-4xl max-h-[80vh] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(Ui,{size:20})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"Pending Client Payments"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Detailed list of all unpaid client invoices"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:Xe,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary/20 transition-all hover:scale-105 active:scale-95 cursor-pointer text-sm font-medium shadow-sm hover:shadow",children:[i.jsx(Nr,{size:16}),"Download CSV"]}),i.jsx("button",{onClick:()=>M(!1),className:"p-2 hover:bg-accent rounded-full transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto p-6",children:i.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 text-muted-foreground font-medium",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3",children:"Project"}),i.jsx("th",{className:"px-4 py-3",children:"Client"}),i.jsx("th",{className:"px-4 py-3 text-right",children:"Amount"}),i.jsx("th",{className:"px-4 py-3",children:"Due Date"}),i.jsx("th",{className:"px-4 py-3",children:"Status"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:z.length>0?z.map(J=>i.jsxs("tr",{className:"hover:bg-accent/5 transition-colors",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Tn,{size:14,className:"text-primary"}),i.jsx("span",{className:"font-medium",children:J.name})]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:J.client}),i.jsx("td",{className:"px-4 py-4 text-right font-bold text-primary",children:G(J.amount)}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[i.jsx(Lo,{size:12}),ne(J.date)]})}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider bg-yellow-500/10 text-yellow-500"),children:J.status})})]},J.id)):i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-muted-foreground",children:"No pending client payments found"})})})]})})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Total Pending: "}),i.jsx("span",{className:"font-bold text-lg text-primary",children:G(X.pendingClientPayment)})]}),i.jsx("button",{onClick:()=>M(!1),className:"px-6 py-2 rounded-lg bg-accent hover:bg-accent/80 transition-colors text-sm font-medium",children:"Close"})]})]})})}),i.jsx(on,{children:B&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-4xl max-h-[80vh] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(Ui,{size:20})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"Pending Engineer Payments"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Detailed list of all unpaid engineer invoices"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:Ne,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary/20 transition-all hover:scale-105 active:scale-95 cursor-pointer text-sm font-medium shadow-sm hover:shadow",children:[i.jsx(Nr,{size:16}),"Download CSV"]}),i.jsx("button",{onClick:()=>L(!1),className:"p-2 hover:bg-accent rounded-full transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto p-6",children:i.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 text-muted-foreground font-medium",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3",children:"Project"}),i.jsx("th",{className:"px-4 py-3",children:"Engineer"}),i.jsx("th",{className:"px-4 py-3 text-right",children:"Amount"}),i.jsx("th",{className:"px-4 py-3",children:"Due Date"}),i.jsx("th",{className:"px-4 py-3",children:"Status"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:fe.length>0?fe.map(J=>i.jsxs("tr",{className:"hover:bg-accent/5 transition-colors",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Tn,{size:14,className:"text-primary"}),i.jsx("span",{className:"font-medium",children:J.name})]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:J.engineer}),i.jsx("td",{className:"px-4 py-4 text-right font-bold text-primary",children:G(J.amount)}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[i.jsx(Lo,{size:12}),ne(J.date)]})}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider bg-yellow-500/10 text-yellow-500"),children:J.status})})]},J.id)):i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-muted-foreground",children:"No pending engineer payments found"})})})]})})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Total Pending: "}),i.jsx("span",{className:"font-bold text-lg text-primary",children:G(X.pendingEngineerPayment)})]}),i.jsx("button",{onClick:()=>L(!1),className:"px-6 py-2 rounded-lg bg-accent hover:bg-accent/80 transition-colors text-sm font-medium",children:"Close"})]})]})})}),i.jsx(on,{children:F&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-4xl max-h-[80vh] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(Ec,{size:20})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"Completed Projects"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Historical record of all successfully delivered projects"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:Ye,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary/20 transition-all hover:scale-105 active:scale-95 cursor-pointer text-sm font-medium shadow-sm hover:shadow",children:[i.jsx(Nr,{size:16}),"Download CSV"]}),i.jsx("button",{onClick:()=>I(!1),className:"p-2 hover:bg-accent rounded-full transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto p-6",children:i.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 text-muted-foreground font-medium",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3",children:"Project"}),i.jsx("th",{className:"px-4 py-3",children:"Client"}),i.jsx("th",{className:"px-4 py-3",children:"Engineer"}),i.jsx("th",{className:"px-4 py-3",children:"Completion Date"}),i.jsx("th",{className:"px-4 py-3 text-right",children:"Revenue"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:de.length>0?de.map(J=>i.jsxs("tr",{className:"hover:bg-accent/5 transition-colors",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Tn,{size:14,className:"text-primary"}),i.jsx("span",{className:"font-medium",children:J.name})]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:J.client}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:J.engineer}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[i.jsx(Lo,{size:12}),ne(J.date)]})}),i.jsx("td",{className:"px-4 py-4 text-right font-bold text-primary",children:G(J.revenue)})]},J.id)):i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-muted-foreground",children:"No completed projects found"})})})]})})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Total Completed: "}),i.jsxs("span",{className:"font-bold text-lg text-primary",children:[X.completedProjects," Projects"]})]}),i.jsx("button",{onClick:()=>I(!1),className:"px-6 py-2 rounded-lg bg-accent hover:bg-accent/80 transition-colors text-sm font-medium",children:"Close"})]})]})})}),i.jsx(on,{children:q&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-4xl max-h-[80vh] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(Ni,{size:20})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"Pending Projects"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Overview of all active and upcoming projects"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:at,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary/20 transition-all hover:scale-105 active:scale-95 cursor-pointer text-sm font-medium shadow-sm hover:shadow",children:[i.jsx(Nr,{size:16}),"Download CSV"]}),i.jsx("button",{onClick:()=>P(!1),className:"p-2 hover:bg-accent rounded-full transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto p-6",children:i.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 text-muted-foreground font-medium",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3",children:"Project"}),i.jsx("th",{className:"px-4 py-3",children:"Client"}),i.jsx("th",{className:"px-4 py-3",children:"Engineer"}),i.jsx("th",{className:"px-4 py-3",children:"Deadline"}),i.jsx("th",{className:"px-4 py-3",children:"Status"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:W.length>0?W.map(J=>i.jsxs("tr",{className:"hover:bg-accent/5 transition-colors",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Tn,{size:14,className:"text-primary"}),i.jsx("span",{className:"font-medium",children:J.name})]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:J.client}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:J.engineer}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[i.jsx(Lo,{size:12}),ne(J.date)]})}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",J.status==="In Progress"?"bg-blue-500/10 text-blue-500":"bg-yellow-500/10 text-yellow-500"),children:J.status})})]},J.id)):i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-muted-foreground",children:"No pending projects found"})})})]})})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Total Pending: "}),i.jsxs("span",{className:"font-bold text-lg text-primary",children:[X.pendingProjects," Projects"]})]}),i.jsx("button",{onClick:()=>P(!1),className:"px-6 py-2 rounded-lg bg-accent hover:bg-accent/80 transition-colors text-sm font-medium",children:"Close"})]})]})})}),i.jsx(on,{children:R&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-4xl max-h-[80vh] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(Hn,{size:20})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"Employees Directory"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"List of all active contributors across projects and tasks"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:Y,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary/20 transition-all hover:scale-105 active:scale-95 cursor-pointer text-sm font-medium shadow-sm hover:shadow",children:[i.jsx(Nr,{size:16}),"Download CSV"]}),i.jsx("button",{onClick:()=>K(!1),className:"p-2 hover:bg-accent rounded-full transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto p-6",children:i.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 text-muted-foreground font-medium",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3",children:"Employee Name"}),i.jsx("th",{className:"px-4 py-3 text-center",children:"Active Projects"}),i.jsx("th",{className:"px-4 py-3 text-center",children:"Active Tasks"}),i.jsx("th",{className:"px-4 py-3 text-right",children:"Total Involvement"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:ae.length>0?ae.map((J,ve)=>i.jsxs("tr",{className:"hover:bg-accent/5 transition-colors",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center text-primary text-xs font-bold",children:J.name.charAt(0)}),i.jsx("span",{className:"font-medium",children:J.name})]})}),i.jsx("td",{className:"px-4 py-4 text-center text-muted-foreground",children:J.projects}),i.jsx("td",{className:"px-4 py-4 text-center text-muted-foreground",children:J.tasks}),i.jsx("td",{className:"px-4 py-4 text-right font-bold text-primary",children:J.total})]},ve)):i.jsx("tr",{children:i.jsx("td",{colSpan:4,className:"px-4 py-8 text-center text-muted-foreground",children:"No employee data found"})})})]})})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Total Active Employees: "}),i.jsx("span",{className:"font-bold text-lg text-primary",children:X.totalEmployees})]}),i.jsx("button",{onClick:()=>K(!1),className:"px-6 py-2 rounded-lg bg-accent hover:bg-accent/80 transition-colors text-sm font-medium",children:"Close"})]})]})})}),i.jsx(on,{children:ee&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-4xl max-h-[80vh] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(Hn,{size:20})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"Engineers Directory"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"List of all registered engineers and their current workload"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:we,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary/20 transition-all hover:scale-105 active:scale-95 cursor-pointer text-sm font-medium shadow-sm hover:shadow",children:[i.jsx(Nr,{size:16}),"Download CSV"]}),i.jsx("button",{onClick:()=>se(!1),className:"p-2 hover:bg-accent rounded-full transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto p-6",children:i.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 text-muted-foreground font-medium",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3",children:"Engineer Name"}),i.jsx("th",{className:"px-4 py-3",children:"Specialization"}),i.jsx("th",{className:"px-4 py-3",children:"Email"}),i.jsx("th",{className:"px-4 py-3 text-right",children:"Active Projects"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:_e.length>0?_e.map(J=>i.jsxs("tr",{className:"hover:bg-accent/5 transition-colors",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center text-primary text-xs font-bold",children:J.name.charAt(0)}),i.jsx("span",{className:"font-medium",children:J.name})]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:J.specialization}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:J.email}),i.jsx("td",{className:"px-4 py-4 text-right font-bold text-primary",children:J.activeProjects})]},J.id)):i.jsx("tr",{children:i.jsx("td",{colSpan:4,className:"px-4 py-8 text-center text-muted-foreground",children:"No engineer data found"})})})]})})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Total Registered Engineers: "}),i.jsx("span",{className:"font-bold text-lg text-primary",children:X.totalEngineers})]}),i.jsx("button",{onClick:()=>se(!1),className:"px-6 py-2 rounded-lg bg-accent hover:bg-accent/80 transition-colors text-sm font-medium",children:"Close"})]})]})})})]}):i.jsxs("div",{className:"flex h-[80vh] flex-col items-center justify-center text-center p-6",children:[i.jsx("div",{className:"h-20 w-20 rounded-full bg-muted flex items-center justify-center mb-6",children:i.jsx(yh,{size:40,className:"text-muted-foreground"})}),i.jsx("h2",{className:"text-2xl font-bold tracking-tight mb-2",children:"Access Restricted"}),i.jsx("p",{className:"text-muted-foreground max-w-md mx-auto mb-8",children:"You do not have permission to view the Dashboard. Please contact your system administrator to request access."}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[i.jsx("button",{onClick:()=>l("/profile"),className:"px-6 py-2 bg-primary text-primary-foreground rounded-lg font-semibold hover:bg-primary/90 transition-all",children:"Go to My Profile"}),i.jsx("button",{onClick:m,className:"px-6 py-2 border border-border bg-card hover:bg-accent rounded-lg font-semibold transition-all",children:"Logout"})]})]})}function bu({title:e,value:t,change:r,trend:n,icon:a,onClick:s,actions:o}){return i.jsxs("div",{onClick:s,className:"rounded-xl border border-border bg-card p-6 shadow-sm transition-all hover:shadow-md cursor-pointer group relative overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"rounded-lg bg-primary/10 p-2 text-primary group-hover:bg-primary group-hover:text-primary-foreground transition-colors",children:i.jsx(a,{size:20})}),i.jsxs("div",{className:tt("flex items-center gap-0.5 text-xs font-medium",n==="up"?"text-green-500":"text-red-500"),children:[n==="up"?i.jsx(jv,{size:14}):i.jsx(bv,{size:14}),r]})]}),i.jsxs("div",{className:"mt-4",children:[i.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:e}),i.jsx("h4",{className:"text-2xl font-bold",children:t})]}),o&&i.jsx("div",{className:"mt-4 pt-4 border-t border-border flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity",children:o.map((l,u)=>i.jsxs("button",{onClick:l.onClick,className:"flex items-center gap-1.5 px-2 py-1 rounded-md bg-accent hover:bg-accent/80 text-[10px] font-bold uppercase tracking-wider transition-all hover:scale-105 active:scale-95 cursor-pointer shadow-sm hover:shadow",children:[i.jsx(l.icon,{size:12}),l.label]},u))})]})}function vNe(){const[e,t]=N.useState(""),[r,n]=N.useState(""),[a,s]=N.useState(!1),o=mo(),{login:l}=la(),u=async d=>{if(d.preventDefault(),!e||!r){De.error("Please enter both username and password");return}s(!0);try{await l(e,r),De.success("Successfully logged in!"),o("/")}catch(f){De.error(f.message||"Invalid username or password")}finally{s(!1)}};return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-md space-y-8 rounded-3xl bg-card p-8 shadow-xl border border-border",children:[i.jsxs("div",{className:"text-center space-y-2",children:[i.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10 text-primary mb-4",children:i.jsx(Pu,{size:32})}),i.jsx("h1",{className:"text-3xl font-bold tracking-tight text-foreground",children:"System Login"}),i.jsx("p",{className:"text-muted-foreground",children:"Enter your credentials to access the control panel"})]}),i.jsxs("form",{onSubmit:u,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-foreground/80",children:"Username"}),i.jsxs("div",{className:"relative",children:[i.jsx(Gl,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",value:e,onChange:d=>t(d.target.value),placeholder:"e.g. admin",className:"w-full h-12 pl-10 rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all text-foreground"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("label",{className:"text-sm font-medium text-foreground/80",children:"Password"})}),i.jsxs("div",{className:"relative",children:[i.jsx(yh,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"password",value:r,onChange:d=>n(d.target.value),placeholder:"••••••••",className:"w-full h-12 pl-10 rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all text-foreground"})]})]}),i.jsxs("button",{type:"submit",disabled:a,className:"w-full h-12 rounded-xl bg-primary text-sm font-semibold text-white shadow-lg shadow-primary/20 hover:bg-primary/90 transition-all disabled:opacity-50 flex items-center justify-center gap-2",children:[a?i.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-white/30 border-t-white"}):i.jsx(Fee,{size:18}),"Login to Dashboard"]})]}),i.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["Don't have an account?"," ",i.jsx(tx,{to:"/signup",className:"font-semibold text-primary hover:underline",children:"Sign Up"})]}),i.jsx("p",{className:"text-center text-xs text-slate-400",children:"Authorized Personnel Only. All access is logged and monitored."})]})})}function yNe(){const{systemUsers:e,updateSystemUsers:t}=la(),[r,n]=N.useState(""),[a,s]=N.useState(""),[o,l]=N.useState(""),[u,d]=N.useState(!1),f=mo(),m=async g=>{if(g.preventDefault(),!r||!a||!o){De.error("Please fill in all fields");return}if(a.length<6){De.error("Password must be at least 6 characters");return}d(!0);try{if(e.some(v=>v.email===r)){De.error("This email is already registered."),d(!1);return}const x=crypto.randomUUID().split("-")[0],y={uid:x,id:x,tenantId:"default-tenant",name:o,email:r,username:r.split("@")[0],password:a,role:r==="alimofasher@gmail.com"?"Administrator":"Employee",status:"Active",createdAt:new Date().toISOString()};await t([...e,y]),De.success("Account created successfully! You can now log in."),f("/login")}catch(x){console.error("Sign up error:",x),De.error("Failed to create account")}finally{d(!1)}};return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-md space-y-8 rounded-3xl bg-card p-8 shadow-xl border border-border",children:[i.jsxs("div",{className:"text-center space-y-2",children:[i.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10 text-primary mb-4",children:i.jsx(Oh,{size:32})}),i.jsx("h1",{className:"text-3xl font-bold tracking-tight text-foreground",children:"Create Account"}),i.jsx("p",{className:"text-muted-foreground",children:"Join our local platform today"})]}),i.jsx("div",{className:"space-y-4",children:i.jsxs("form",{onSubmit:m,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-foreground/80",children:"Full Name"}),i.jsxs("div",{className:"relative",children:[i.jsx(ls,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",value:o,onChange:g=>l(g.target.value),placeholder:"John Doe",className:"w-full h-12 pl-10 rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all text-foreground"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-foreground/80",children:"Email Address"}),i.jsxs("div",{className:"relative",children:[i.jsx(Gl,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"email",value:r,onChange:g=>n(g.target.value),placeholder:"admin@company.com",className:"w-full h-12 pl-10 rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all text-foreground"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-foreground/80",children:"Password"}),i.jsxs("div",{className:"relative",children:[i.jsx(yh,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"password",value:a,onChange:g=>s(g.target.value),placeholder:"••••••••",className:"w-full h-12 pl-10 rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all text-foreground"})]})]}),i.jsxs("button",{type:"submit",disabled:u,className:"w-full h-12 rounded-xl bg-primary text-sm font-semibold text-white shadow-lg shadow-primary/20 hover:bg-primary/90 transition-all disabled:opacity-50 flex items-center justify-center gap-2",children:[u?i.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-white/30 border-t-white"}):i.jsx(Pu,{size:18}),"Create Account"]})]})}),i.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["Already have an account?"," ",i.jsx(tx,{to:"/login",className:"font-semibold text-primary hover:underline",children:"Sign In"})]})]})})}const bNe="modulepreload",wNe=function(e){return"/"+e},pI={},SS=function(t,r,n){let a=Promise.resolve();if(r&&r.length>0){let o=function(d){return Promise.all(d.map(f=>Promise.resolve(f).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=o(r.map(d=>{if(d=wNe(d),d in pI)return;pI[d]=!0;const f=d.endsWith(".css"),m=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":bNe,f||(g.as="script"),g.crossOrigin="",g.href=d,u&&g.setAttribute("nonce",u),document.head.appendChild(g),f)return new Promise((x,y)=>{g.addEventListener("load",x),g.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return a.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};function Un(e){"@babel/helpers - typeof";return Un=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(e)}var Lc=Uint8Array,fl=Uint16Array,iE=Int32Array,sE=new Lc([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),oE=new Lc([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),xI=new Lc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qq=function(e,t){for(var r=new fl(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var a=new iE(r[30]),n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)a[s]=s-r[n]<<5|n;return{b:r,r:a}},Wq=qq(sE,2),jNe=Wq.b,WA=Wq.r;jNe[28]=258,WA[258]=28;var NNe=qq(oE,0),gI=NNe.r,GA=new fl(32768);for(var wa=0;wa<32768;++wa){var eh=(wa&43690)>>1|(wa&21845)<<1;eh=(eh&52428)>>2|(eh&13107)<<2,eh=(eh&61680)>>4|(eh&3855)<<4,GA[wa]=((eh&65280)>>8|(eh&255)<<8)>>1}var lv=(function(e,t,r){for(var n=e.length,a=0,s=new fl(t);a<n;++a)e[a]&&++s[e[a]-1];var o=new fl(t);for(a=1;a<t;++a)o[a]=o[a-1]+s[a-1]<<1;var l;if(r){l=new fl(1<<t);var u=15-t;for(a=0;a<n;++a)if(e[a])for(var d=a<<4|e[a],f=t-e[a],m=o[e[a]-1]++<<f,g=m|(1<<f)-1;m<=g;++m)l[GA[m]>>u]=d}else for(l=new fl(n),a=0;a<n;++a)e[a]&&(l[a]=GA[o[e[a]-1]++]>>15-e[a]);return l}),s0=new Lc(288);for(var wa=0;wa<144;++wa)s0[wa]=8;for(var wa=144;wa<256;++wa)s0[wa]=9;for(var wa=256;wa<280;++wa)s0[wa]=7;for(var wa=280;wa<288;++wa)s0[wa]=8;var jw=new Lc(32);for(var wa=0;wa<32;++wa)jw[wa]=5;var SNe=lv(s0,9,0),ANe=lv(jw,5,0),Gq=function(e){return(e+7)/8|0},kNe=function(e,t,r){return(r==null||r>e.length)&&(r=e.length),new Lc(e.subarray(t,r))},Rd=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8},$g=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16},AS=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var a=r.length,s=r.slice();if(!a)return{t:Kq,l:0};if(a==1){var o=new Lc(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(M,B){return M.f-B.f}),r.push({s:-1,f:25001});var l=r[0],u=r[1],d=0,f=1,m=2;for(r[0]={s:-1,f:l.f+u.f,l,r:u};f!=a-1;)l=r[r[d].f<r[m].f?d++:m++],u=r[d!=f&&r[d].f<r[m].f?d++:m++],r[f++]={s:-1,f:l.f+u.f,l,r:u};for(var g=s[0].s,n=1;n<a;++n)s[n].s>g&&(g=s[n].s);var x=new fl(g+1),y=YA(r[f-1],x,0);if(y>t){var n=0,v=0,w=y-t,j=1<<w;for(s.sort(function(B,L){return x[L.s]-x[B.s]||B.f-L.f});n<a;++n){var k=s[n].s;if(x[k]>t)v+=j-(1<<y-x[k]),x[k]=t;else break}for(v>>=w;v>0;){var A=s[n].s;x[A]<t?v-=1<<t-x[A]++-1:++n}for(;n>=0&&v;--n){var T=s[n].s;x[T]==t&&(--x[T],++v)}y=t}return{t:new Lc(x),l:y}},YA=function(e,t,r){return e.s==-1?Math.max(YA(e.l,t,r+1),YA(e.r,t,r+1)):t[e.s]=r},vI=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new fl(++t),n=0,a=e[0],s=1,o=function(u){r[n++]=u},l=1;l<=t;++l)if(e[l]==a&&l!=t)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=e[l]}return{c:r.subarray(0,n),n:t}},Hg=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Yq=function(e,t,r){var n=r.length,a=Gq(t+2);e[a]=n&255,e[a+1]=n>>8,e[a+2]=e[a]^255,e[a+3]=e[a+1]^255;for(var s=0;s<n;++s)e[a+s+4]=r[s];return(a+4+n)*8},yI=function(e,t,r,n,a,s,o,l,u,d,f){Rd(t,f++,r),++a[256];for(var m=AS(a,15),g=m.t,x=m.l,y=AS(s,15),v=y.t,w=y.l,j=vI(g),k=j.c,A=j.n,T=vI(v),M=T.c,B=T.n,L=new fl(19),F=0;F<k.length;++F)++L[k[F]&31];for(var F=0;F<M.length;++F)++L[M[F]&31];for(var I=AS(L,7),q=I.t,P=I.l,R=19;R>4&&!q[xI[R-1]];--R);var K=d+5<<3,ee=Hg(a,s0)+Hg(s,jw)+o,se=Hg(a,g)+Hg(s,v)+o+14+3*R+Hg(L,q)+2*L[16]+3*L[17]+7*L[18];if(u>=0&&K<=ee&&K<=se)return Yq(t,f,e.subarray(u,u+d));var Z,ne,X,le;if(Rd(t,f,1+(se<ee)),f+=2,se<ee){Z=lv(g,x,0),ne=g,X=lv(v,w,0),le=v;var Ae=lv(q,P,0);Rd(t,f,A-257),Rd(t,f+5,B-1),Rd(t,f+10,R-4),f+=14;for(var F=0;F<R;++F)Rd(t,f+3*F,q[xI[F]]);f+=3*R;for(var ce=[k,M],D=0;D<2;++D)for(var H=ce[D],F=0;F<H.length;++F){var G=H[F]&31;Rd(t,f,Ae[G]),f+=q[G],G>15&&(Rd(t,f,H[F]>>5&127),f+=H[F]>>12)}}else Z=SNe,ne=s0,X=ANe,le=jw;for(var F=0;F<l;++F){var E=n[F];if(E>255){var G=E>>18&31;$g(t,f,Z[G+257]),f+=ne[G+257],G>7&&(Rd(t,f,E>>23&31),f+=sE[G]);var re=E&31;$g(t,f,X[re]),f+=le[re],re>3&&($g(t,f,E>>5&8191),f+=oE[re])}else $g(t,f,Z[E]),f+=ne[E]}return $g(t,f,Z[256]),f+ne[256]},CNe=new iE([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Kq=new Lc(0),_Ne=function(e,t,r,n,a,s){var o=s.z||e.length,l=new Lc(n+o+5*(1+Math.ceil(o/7e3))+a),u=l.subarray(n,l.length-a),d=s.l,f=(s.r||0)&7;if(t){f&&(u[0]=s.r>>3);for(var m=CNe[t-1],g=m>>13,x=m&8191,y=(1<<r)-1,v=s.p||new fl(32768),w=s.h||new fl(y+1),j=Math.ceil(r/3),k=2*j,A=function(_e){return(e[_e]^e[_e+1]<<j^e[_e+2]<<k)&y},T=new iE(25e3),M=new fl(288),B=new fl(32),L=0,F=0,I=s.i||0,q=0,P=s.w||0,R=0;I+2<o;++I){var K=A(I),ee=I&32767,se=w[K];if(v[ee]=se,w[K]=ee,P<=I){var Z=o-I;if((L>7e3||q>24576)&&(Z>423||!d)){f=yI(e,u,0,T,M,B,F,q,R,I-R,f),q=L=F=0,R=I;for(var ne=0;ne<286;++ne)M[ne]=0;for(var ne=0;ne<30;++ne)B[ne]=0}var X=2,le=0,Ae=x,ce=ee-se&32767;if(Z>2&&K==A(I-ce))for(var D=Math.min(g,Z)-1,H=Math.min(32767,I),G=Math.min(258,Z);ce<=H&&--Ae&&ee!=se;){if(e[I+X]==e[I+X-ce]){for(var E=0;E<G&&e[I+E]==e[I+E-ce];++E);if(E>X){if(X=E,le=ce,E>D)break;for(var re=Math.min(ce,E-2),he=0,ne=0;ne<re;++ne){var oe=I-ce+ne&32767,z=v[oe],fe=oe-z&32767;fe>he&&(he=fe,se=oe)}}}ee=se,se=v[ee],ce+=ee-se&32767}if(le){T[q++]=268435456|WA[X]<<18|gI[le];var de=WA[X]&31,W=gI[le]&31;F+=sE[de]+oE[W],++M[257+de],++B[W],P=I+X,++L}else T[q++]=e[I],++M[e[I]]}}for(I=Math.max(I,P);I<o;++I)T[q++]=e[I],++M[e[I]];f=yI(e,u,d,T,M,B,F,q,R,I-R,f),d||(s.r=f&7|u[f/8|0]<<3,f-=7,s.h=w,s.p=v,s.i=I,s.w=P)}else{for(var I=s.w||0;I<o+d;I+=65535){var ae=I+65535;ae>=o&&(u[f/8|0]=d,ae=o),f=Yq(u,f+1,e.subarray(I,ae))}s.i=o}return kNe(l,0,n+Gq(f)+a)},Xq=function(){var e=1,t=0;return{p:function(r){for(var n=e,a=t,s=r.length|0,o=0;o!=s;){for(var l=Math.min(o+2655,s);o<l;++o)a+=n+=r[o];n=(n&65535)+15*(n>>16),a=(a&65535)+15*(a>>16)}e=n,t=a},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},ENe=function(e,t,r,n,a){if(!a&&(a={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new Lc(s.length+e.length);o.set(s),o.set(e,s.length),e=o,a.w=s.length}return _Ne(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,a)},Zq=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},TNe=function(e,t){var r=t.level,n=r==0?0:r<6?1:r==9?3:2;if(e[0]=120,e[1]=n<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var a=Xq();a.p(t.dictionary),Zq(e,2,a.d())}};function KA(e,t){t||(t={});var r=Xq();r.p(e);var n=ENe(e,t,t.dictionary?6:2,4);return TNe(n,t),Zq(n,n.length-4,r.d()),n}var PNe=typeof TextDecoder<"u"&&new TextDecoder,DNe=0;try{PNe.decode(Kq,{stream:!0}),DNe=1}catch{}function ONe(e){if(Array.isArray(e))return e}function RNe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,s,o,l=[],u=!0,d=!1;try{if(s=(r=r.call(e)).next,t!==0)for(;!(u=(n=s.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(f){d=!0,a=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function bI(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function MNe(e,t){if(e){if(typeof e=="string")return bI(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?bI(e,t):void 0}}function LNe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wI(e,t){return ONe(e)||RNe(e,t)||MNe(e,t)||LNe()}function jI(e,t="utf8"){return new TextDecoder(t).decode(e)}const INe=new TextEncoder;function FNe(e){return INe.encode(e)}const BNe=1024*8,zNe=(()=>{const e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),kS={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class lE{constructor(t=BNe,r={}){En(this,"buffer");En(this,"byteLength");En(this,"byteOffset");En(this,"length");En(this,"offset");En(this,"lastWrittenByte");En(this,"littleEndian");En(this,"_data");En(this,"_mark");En(this,"_marks");let n=!1;typeof t=="number"?t=new ArrayBuffer(t):(n=!0,this.lastWrittenByte=t.byteLength);const a=r.offset?r.offset>>>0:0,s=t.byteLength-a;let o=a;(ArrayBuffer.isView(t)||t instanceof lE)&&(t.byteLength!==t.buffer.byteLength&&(o=t.byteOffset+a),t=t.buffer),n?this.lastWrittenByte=s:this.lastWrittenByte=0,this.buffer=t,this.length=s,this.byteLength=s,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,s),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(t===void 0)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){const n=(this.offset+t)*2,a=new Uint8Array(n);a.set(new Uint8Array(this.buffer)),this.buffer=a.buffer,this.length=n,this.byteLength=n,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,r){const n=kS[r].BYTES_PER_ELEMENT*t,a=this.byteOffset+this.offset,s=this.buffer.slice(a,a+n);if(this.littleEndian===zNe&&r!=="uint8"&&r!=="int8"){const l=new Uint8Array(this.buffer.slice(a,a+n));l.reverse();const u=new kS[r](l.buffer);return this.offset+=n,u.reverse(),u}const o=new kS[r](s);return this.offset+=n,o}readInt16(){const t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){const t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){const t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){const t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){const t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){const t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){const t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){const t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let r="";for(let n=0;n<t;n++)r+=this.readChar();return r}readUtf8(t=1){return jI(this.readBytes(t))}decodeText(t=1,r="utf8"){return jI(this.readBytes(t),r)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let r=0;r<t.length;r++)this._data.setUint8(this.offset++,t[r]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let r=0;r<t.length;r++)this.writeUint8(t.charCodeAt(r));return this}writeUtf8(t){return this.writeBytes(FNe(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function Lx(e){let t=e.length;for(;--t>=0;)e[t]=0}const UNe=3,$Ne=258,Jq=29,HNe=256,VNe=HNe+1+Jq,Qq=30,qNe=512,WNe=new Array((VNe+2)*2);Lx(WNe);const GNe=new Array(Qq*2);Lx(GNe);const YNe=new Array(qNe);Lx(YNe);const KNe=new Array($Ne-UNe+1);Lx(KNe);const XNe=new Array(Jq);Lx(XNe);const ZNe=new Array(Qq);Lx(ZNe);const JNe=(e,t,r,n)=>{let a=e&65535|0,s=e>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do a=a+t[n++]|0,s=s+a|0;while(--o);a%=65521,s%=65521}return a|s<<16|0};var XA=JNe;const QNe=()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t},e4e=new Uint32Array(QNe()),t4e=(e,t,r,n)=>{const a=e4e,s=n+r;e^=-1;for(let o=n;o<s;o++)e=e>>>8^a[(e^t[o])&255];return e^-1};var wu=t4e,ZA={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},eW={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const r4e=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n4e=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(const n in r)r4e(r,n)&&(e[n]=r[n])}}return e},a4e=e=>{let t=0;for(let n=0,a=e.length;n<a;n++)t+=e[n].length;const r=new Uint8Array(t);for(let n=0,a=0,s=e.length;n<s;n++){let o=e[n];r.set(o,a),a+=o.length}return r},tW={assign:n4e,flattenChunks:a4e};let rW=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{rW=!1}const Vv=new Uint8Array(256);for(let e=0;e<256;e++)Vv[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Vv[254]=Vv[254]=1;var i4e=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,r,n,a,s,o=e.length,l=0;for(a=0;a<o;a++)r=e.charCodeAt(a),(r&64512)===55296&&a+1<o&&(n=e.charCodeAt(a+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),a++)),l+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(l),s=0,a=0;s<l;a++)r=e.charCodeAt(a),(r&64512)===55296&&a+1<o&&(n=e.charCodeAt(a+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),a++)),r<128?t[s++]=r:r<2048?(t[s++]=192|r>>>6,t[s++]=128|r&63):r<65536?(t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|r&63):(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|r&63);return t};const s4e=(e,t)=>{if(t<65534&&e.subarray&&rW)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r};var o4e=(e,t)=>{const r=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let n,a;const s=new Array(r*2);for(a=0,n=0;n<r;){let o=e[n++];if(o<128){s[a++]=o;continue}let l=Vv[o];if(l>4){s[a++]=65533,n+=l-1;continue}for(o&=l===2?31:l===3?15:7;l>1&&n<r;)o=o<<6|e[n++]&63,l--;if(l>1){s[a++]=65533;continue}o<65536?s[a++]=o:(o-=65536,s[a++]=55296|o>>10&1023,s[a++]=56320|o&1023)}return s4e(s,a)},l4e=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let r=t-1;for(;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+Vv[e[r]]>t?r:t},JA={string2buf:i4e,buf2string:o4e,utf8border:l4e};function c4e(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var u4e=c4e;const lb=16209,d4e=16191;var f4e=function(t,r){let n,a,s,o,l,u,d,f,m,g,x,y,v,w,j,k,A,T,M,B,L,F,I,q;const P=t.state;n=t.next_in,I=t.input,a=n+(t.avail_in-5),s=t.next_out,q=t.output,o=s-(r-t.avail_out),l=s+(t.avail_out-257),u=P.dmax,d=P.wsize,f=P.whave,m=P.wnext,g=P.window,x=P.hold,y=P.bits,v=P.lencode,w=P.distcode,j=(1<<P.lenbits)-1,k=(1<<P.distbits)-1;e:do{y<15&&(x+=I[n++]<<y,y+=8,x+=I[n++]<<y,y+=8),A=v[x&j];t:for(;;){if(T=A>>>24,x>>>=T,y-=T,T=A>>>16&255,T===0)q[s++]=A&65535;else if(T&16){M=A&65535,T&=15,T&&(y<T&&(x+=I[n++]<<y,y+=8),M+=x&(1<<T)-1,x>>>=T,y-=T),y<15&&(x+=I[n++]<<y,y+=8,x+=I[n++]<<y,y+=8),A=w[x&k];r:for(;;){if(T=A>>>24,x>>>=T,y-=T,T=A>>>16&255,T&16){if(B=A&65535,T&=15,y<T&&(x+=I[n++]<<y,y+=8,y<T&&(x+=I[n++]<<y,y+=8)),B+=x&(1<<T)-1,B>u){t.msg="invalid distance too far back",P.mode=lb;break e}if(x>>>=T,y-=T,T=s-o,B>T){if(T=B-T,T>f&&P.sane){t.msg="invalid distance too far back",P.mode=lb;break e}if(L=0,F=g,m===0){if(L+=d-T,T<M){M-=T;do q[s++]=g[L++];while(--T);L=s-B,F=q}}else if(m<T){if(L+=d+m-T,T-=m,T<M){M-=T;do q[s++]=g[L++];while(--T);if(L=0,m<M){T=m,M-=T;do q[s++]=g[L++];while(--T);L=s-B,F=q}}}else if(L+=m-T,T<M){M-=T;do q[s++]=g[L++];while(--T);L=s-B,F=q}for(;M>2;)q[s++]=F[L++],q[s++]=F[L++],q[s++]=F[L++],M-=3;M&&(q[s++]=F[L++],M>1&&(q[s++]=F[L++]))}else{L=s-B;do q[s++]=q[L++],q[s++]=q[L++],q[s++]=q[L++],M-=3;while(M>2);M&&(q[s++]=q[L++],M>1&&(q[s++]=q[L++]))}}else if((T&64)===0){A=w[(A&65535)+(x&(1<<T)-1)];continue r}else{t.msg="invalid distance code",P.mode=lb;break e}break}}else if((T&64)===0){A=v[(A&65535)+(x&(1<<T)-1)];continue t}else if(T&32){P.mode=d4e;break e}else{t.msg="invalid literal/length code",P.mode=lb;break e}break}}while(n<a&&s<l);M=y>>3,n-=M,y-=M<<3,x&=(1<<y)-1,t.next_in=n,t.next_out=s,t.avail_in=n<a?5+(a-n):5-(n-a),t.avail_out=s<l?257+(l-s):257-(s-l),P.hold=x,P.bits=y};const wp=15,NI=852,SI=592,AI=0,CS=1,kI=2,h4e=new Uint16Array([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,0,0]),m4e=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),p4e=new Uint16Array([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,0,0]),x4e=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),g4e=(e,t,r,n,a,s,o,l)=>{const u=l.bits;let d=0,f=0,m=0,g=0,x=0,y=0,v=0,w=0,j=0,k=0,A,T,M,B,L,F=null,I;const q=new Uint16Array(wp+1),P=new Uint16Array(wp+1);let R=null,K,ee,se;for(d=0;d<=wp;d++)q[d]=0;for(f=0;f<n;f++)q[t[r+f]]++;for(x=u,g=wp;g>=1&&q[g]===0;g--);if(x>g&&(x=g),g===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,l.bits=1,0;for(m=1;m<g&&q[m]===0;m++);for(x<m&&(x=m),w=1,d=1;d<=wp;d++)if(w<<=1,w-=q[d],w<0)return-1;if(w>0&&(e===AI||g!==1))return-1;for(P[1]=0,d=1;d<wp;d++)P[d+1]=P[d]+q[d];for(f=0;f<n;f++)t[r+f]!==0&&(o[P[t[r+f]]++]=f);if(e===AI?(F=R=o,I=20):e===CS?(F=h4e,R=m4e,I=257):(F=p4e,R=x4e,I=0),k=0,f=0,d=m,L=s,y=x,v=0,M=-1,j=1<<x,B=j-1,e===CS&&j>NI||e===kI&&j>SI)return 1;for(;;){K=d-v,o[f]+1<I?(ee=0,se=o[f]):o[f]>=I?(ee=R[o[f]-I],se=F[o[f]-I]):(ee=96,se=0),A=1<<d-v,T=1<<y,m=T;do T-=A,a[L+(k>>v)+T]=K<<24|ee<<16|se|0;while(T!==0);for(A=1<<d-1;k&A;)A>>=1;if(A!==0?(k&=A-1,k+=A):k=0,f++,--q[d]===0){if(d===g)break;d=t[r+o[f]]}if(d>x&&(k&B)!==M){for(v===0&&(v=x),L+=m,y=d-v,w=1<<y;y+v<g&&(w-=q[y+v],!(w<=0));)y++,w<<=1;if(j+=1<<y,e===CS&&j>NI||e===kI&&j>SI)return 1;M=k&B,a[M]=x<<24|y<<16|L-s|0}}return k!==0&&(a[L+k]=d-v<<24|64<<16|0),l.bits=x,0};var cv=g4e;const v4e=0,nW=1,aW=2,{Z_FINISH:CI,Z_BLOCK:y4e,Z_TREES:cb,Z_OK:o0,Z_STREAM_END:b4e,Z_NEED_DICT:w4e,Z_STREAM_ERROR:Kl,Z_DATA_ERROR:iW,Z_MEM_ERROR:sW,Z_BUF_ERROR:j4e,Z_DEFLATED:_I}=eW,q5=16180,EI=16181,TI=16182,PI=16183,DI=16184,OI=16185,RI=16186,MI=16187,LI=16188,II=16189,Nw=16190,Md=16191,_S=16192,FI=16193,ES=16194,BI=16195,zI=16196,UI=16197,$I=16198,ub=16199,db=16200,HI=16201,VI=16202,qI=16203,WI=16204,GI=16205,TS=16206,YI=16207,KI=16208,Pa=16209,oW=16210,lW=16211,N4e=852,S4e=592,A4e=15,k4e=A4e,XI=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function C4e(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const b0=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<q5||t.mode>lW?1:0},cW=e=>{if(b0(e))return Kl;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=q5,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(N4e),t.distcode=t.distdyn=new Int32Array(S4e),t.sane=1,t.back=-1,o0},uW=e=>{if(b0(e))return Kl;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,cW(e)},dW=(e,t)=>{let r;if(b0(e))return Kl;const n=e.state;return t<0?(r=0,t=-t):(r=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Kl:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,uW(e))},fW=(e,t)=>{if(!e)return Kl;const r=new C4e;e.state=r,r.strm=e,r.window=null,r.mode=q5;const n=dW(e,t);return n!==o0&&(e.state=null),n},_4e=e=>fW(e,k4e);let ZI=!0,PS,DS;const E4e=e=>{if(ZI){PS=new Int32Array(512),DS=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(cv(nW,e.lens,0,288,PS,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;cv(aW,e.lens,0,32,DS,0,e.work,{bits:5}),ZI=!1}e.lencode=PS,e.lenbits=9,e.distcode=DS,e.distbits=5},hW=(e,t,r,n)=>{let a;const s=e.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),n>=s.wsize?(s.window.set(t.subarray(r-s.wsize,r),0),s.wnext=0,s.whave=s.wsize):(a=s.wsize-s.wnext,a>n&&(a=n),s.window.set(t.subarray(r-n,r-n+a),s.wnext),n-=a,n?(s.window.set(t.subarray(r-n,r),0),s.wnext=n,s.whave=s.wsize):(s.wnext+=a,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=a))),0},T4e=(e,t)=>{let r,n,a,s,o,l,u,d,f,m,g,x,y,v,w=0,j,k,A,T,M,B,L,F;const I=new Uint8Array(4);let q,P;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(b0(e)||!e.output||!e.input&&e.avail_in!==0)return Kl;r=e.state,r.mode===Md&&(r.mode=_S),o=e.next_out,a=e.output,u=e.avail_out,s=e.next_in,n=e.input,l=e.avail_in,d=r.hold,f=r.bits,m=l,g=u,F=o0;e:for(;;)switch(r.mode){case q5:if(r.wrap===0){r.mode=_S;break}for(;f<16;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}if(r.wrap&2&&d===35615){r.wbits===0&&(r.wbits=15),r.check=0,I[0]=d&255,I[1]=d>>>8&255,r.check=wu(r.check,I,2,0),d=0,f=0,r.mode=EI;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((d&255)<<8)+(d>>8))%31){e.msg="incorrect header check",r.mode=Pa;break}if((d&15)!==_I){e.msg="unknown compression method",r.mode=Pa;break}if(d>>>=4,f-=4,L=(d&15)+8,r.wbits===0&&(r.wbits=L),L>15||L>r.wbits){e.msg="invalid window size",r.mode=Pa;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=d&512?II:Md,d=0,f=0;break;case EI:for(;f<16;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}if(r.flags=d,(r.flags&255)!==_I){e.msg="unknown compression method",r.mode=Pa;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=Pa;break}r.head&&(r.head.text=d>>8&1),r.flags&512&&r.wrap&4&&(I[0]=d&255,I[1]=d>>>8&255,r.check=wu(r.check,I,2,0)),d=0,f=0,r.mode=TI;case TI:for(;f<32;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}r.head&&(r.head.time=d),r.flags&512&&r.wrap&4&&(I[0]=d&255,I[1]=d>>>8&255,I[2]=d>>>16&255,I[3]=d>>>24&255,r.check=wu(r.check,I,4,0)),d=0,f=0,r.mode=PI;case PI:for(;f<16;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}r.head&&(r.head.xflags=d&255,r.head.os=d>>8),r.flags&512&&r.wrap&4&&(I[0]=d&255,I[1]=d>>>8&255,r.check=wu(r.check,I,2,0)),d=0,f=0,r.mode=DI;case DI:if(r.flags&1024){for(;f<16;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}r.length=d,r.head&&(r.head.extra_len=d),r.flags&512&&r.wrap&4&&(I[0]=d&255,I[1]=d>>>8&255,r.check=wu(r.check,I,2,0)),d=0,f=0}else r.head&&(r.head.extra=null);r.mode=OI;case OI:if(r.flags&1024&&(x=r.length,x>l&&(x=l),x&&(r.head&&(L=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(s,s+x),L)),r.flags&512&&r.wrap&4&&(r.check=wu(r.check,n,x,s)),l-=x,s+=x,r.length-=x),r.length))break e;r.length=0,r.mode=RI;case RI:if(r.flags&2048){if(l===0)break e;x=0;do L=n[s+x++],r.head&&L&&r.length<65536&&(r.head.name+=String.fromCharCode(L));while(L&&x<l);if(r.flags&512&&r.wrap&4&&(r.check=wu(r.check,n,x,s)),l-=x,s+=x,L)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=MI;case MI:if(r.flags&4096){if(l===0)break e;x=0;do L=n[s+x++],r.head&&L&&r.length<65536&&(r.head.comment+=String.fromCharCode(L));while(L&&x<l);if(r.flags&512&&r.wrap&4&&(r.check=wu(r.check,n,x,s)),l-=x,s+=x,L)break e}else r.head&&(r.head.comment=null);r.mode=LI;case LI:if(r.flags&512){for(;f<16;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}if(r.wrap&4&&d!==(r.check&65535)){e.msg="header crc mismatch",r.mode=Pa;break}d=0,f=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Md;break;case II:for(;f<32;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}e.adler=r.check=XI(d),d=0,f=0,r.mode=Nw;case Nw:if(r.havedict===0)return e.next_out=o,e.avail_out=u,e.next_in=s,e.avail_in=l,r.hold=d,r.bits=f,w4e;e.adler=r.check=1,r.mode=Md;case Md:if(t===y4e||t===cb)break e;case _S:if(r.last){d>>>=f&7,f-=f&7,r.mode=TS;break}for(;f<3;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}switch(r.last=d&1,d>>>=1,f-=1,d&3){case 0:r.mode=FI;break;case 1:if(E4e(r),r.mode=ub,t===cb){d>>>=2,f-=2;break e}break;case 2:r.mode=zI;break;case 3:e.msg="invalid block type",r.mode=Pa}d>>>=2,f-=2;break;case FI:for(d>>>=f&7,f-=f&7;f<32;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}if((d&65535)!==(d>>>16^65535)){e.msg="invalid stored block lengths",r.mode=Pa;break}if(r.length=d&65535,d=0,f=0,r.mode=ES,t===cb)break e;case ES:r.mode=BI;case BI:if(x=r.length,x){if(x>l&&(x=l),x>u&&(x=u),x===0)break e;a.set(n.subarray(s,s+x),o),l-=x,s+=x,u-=x,o+=x,r.length-=x;break}r.mode=Md;break;case zI:for(;f<14;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}if(r.nlen=(d&31)+257,d>>>=5,f-=5,r.ndist=(d&31)+1,d>>>=5,f-=5,r.ncode=(d&15)+4,d>>>=4,f-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Pa;break}r.have=0,r.mode=UI;case UI:for(;r.have<r.ncode;){for(;f<3;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}r.lens[R[r.have++]]=d&7,d>>>=3,f-=3}for(;r.have<19;)r.lens[R[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,q={bits:r.lenbits},F=cv(v4e,r.lens,0,19,r.lencode,0,r.work,q),r.lenbits=q.bits,F){e.msg="invalid code lengths set",r.mode=Pa;break}r.have=0,r.mode=$I;case $I:for(;r.have<r.nlen+r.ndist;){for(;w=r.lencode[d&(1<<r.lenbits)-1],j=w>>>24,k=w>>>16&255,A=w&65535,!(j<=f);){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}if(A<16)d>>>=j,f-=j,r.lens[r.have++]=A;else{if(A===16){for(P=j+2;f<P;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}if(d>>>=j,f-=j,r.have===0){e.msg="invalid bit length repeat",r.mode=Pa;break}L=r.lens[r.have-1],x=3+(d&3),d>>>=2,f-=2}else if(A===17){for(P=j+3;f<P;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}d>>>=j,f-=j,L=0,x=3+(d&7),d>>>=3,f-=3}else{for(P=j+7;f<P;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}d>>>=j,f-=j,L=0,x=11+(d&127),d>>>=7,f-=7}if(r.have+x>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Pa;break}for(;x--;)r.lens[r.have++]=L}}if(r.mode===Pa)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=Pa;break}if(r.lenbits=9,q={bits:r.lenbits},F=cv(nW,r.lens,0,r.nlen,r.lencode,0,r.work,q),r.lenbits=q.bits,F){e.msg="invalid literal/lengths set",r.mode=Pa;break}if(r.distbits=6,r.distcode=r.distdyn,q={bits:r.distbits},F=cv(aW,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,q),r.distbits=q.bits,F){e.msg="invalid distances set",r.mode=Pa;break}if(r.mode=ub,t===cb)break e;case ub:r.mode=db;case db:if(l>=6&&u>=258){e.next_out=o,e.avail_out=u,e.next_in=s,e.avail_in=l,r.hold=d,r.bits=f,f4e(e,g),o=e.next_out,a=e.output,u=e.avail_out,s=e.next_in,n=e.input,l=e.avail_in,d=r.hold,f=r.bits,r.mode===Md&&(r.back=-1);break}for(r.back=0;w=r.lencode[d&(1<<r.lenbits)-1],j=w>>>24,k=w>>>16&255,A=w&65535,!(j<=f);){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}if(k&&(k&240)===0){for(T=j,M=k,B=A;w=r.lencode[B+((d&(1<<T+M)-1)>>T)],j=w>>>24,k=w>>>16&255,A=w&65535,!(T+j<=f);){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}d>>>=T,f-=T,r.back+=T}if(d>>>=j,f-=j,r.back+=j,r.length=A,k===0){r.mode=GI;break}if(k&32){r.back=-1,r.mode=Md;break}if(k&64){e.msg="invalid literal/length code",r.mode=Pa;break}r.extra=k&15,r.mode=HI;case HI:if(r.extra){for(P=r.extra;f<P;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}r.length+=d&(1<<r.extra)-1,d>>>=r.extra,f-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=VI;case VI:for(;w=r.distcode[d&(1<<r.distbits)-1],j=w>>>24,k=w>>>16&255,A=w&65535,!(j<=f);){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}if((k&240)===0){for(T=j,M=k,B=A;w=r.distcode[B+((d&(1<<T+M)-1)>>T)],j=w>>>24,k=w>>>16&255,A=w&65535,!(T+j<=f);){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}d>>>=T,f-=T,r.back+=T}if(d>>>=j,f-=j,r.back+=j,k&64){e.msg="invalid distance code",r.mode=Pa;break}r.offset=A,r.extra=k&15,r.mode=qI;case qI:if(r.extra){for(P=r.extra;f<P;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}r.offset+=d&(1<<r.extra)-1,d>>>=r.extra,f-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Pa;break}r.mode=WI;case WI:if(u===0)break e;if(x=g-u,r.offset>x){if(x=r.offset-x,x>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Pa;break}x>r.wnext?(x-=r.wnext,y=r.wsize-x):y=r.wnext-x,x>r.length&&(x=r.length),v=r.window}else v=a,y=o-r.offset,x=r.length;x>u&&(x=u),u-=x,r.length-=x;do a[o++]=v[y++];while(--x);r.length===0&&(r.mode=db);break;case GI:if(u===0)break e;a[o++]=r.length,u--,r.mode=db;break;case TS:if(r.wrap){for(;f<32;){if(l===0)break e;l--,d|=n[s++]<<f,f+=8}if(g-=u,e.total_out+=g,r.total+=g,r.wrap&4&&g&&(e.adler=r.check=r.flags?wu(r.check,a,g,o-g):XA(r.check,a,g,o-g)),g=u,r.wrap&4&&(r.flags?d:XI(d))!==r.check){e.msg="incorrect data check",r.mode=Pa;break}d=0,f=0}r.mode=YI;case YI:if(r.wrap&&r.flags){for(;f<32;){if(l===0)break e;l--,d+=n[s++]<<f,f+=8}if(r.wrap&4&&d!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=Pa;break}d=0,f=0}r.mode=KI;case KI:F=b4e;break e;case Pa:F=iW;break e;case oW:return sW;case lW:default:return Kl}return e.next_out=o,e.avail_out=u,e.next_in=s,e.avail_in=l,r.hold=d,r.bits=f,(r.wsize||g!==e.avail_out&&r.mode<Pa&&(r.mode<TS||t!==CI))&&hW(e,e.output,e.next_out,g-e.avail_out),m-=e.avail_in,g-=e.avail_out,e.total_in+=m,e.total_out+=g,r.total+=g,r.wrap&4&&g&&(e.adler=r.check=r.flags?wu(r.check,a,g,e.next_out-g):XA(r.check,a,g,e.next_out-g)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Md?128:0)+(r.mode===ub||r.mode===ES?256:0),(m===0&&g===0||t===CI)&&F===o0&&(F=j4e),F},P4e=e=>{if(b0(e))return Kl;let t=e.state;return t.window&&(t.window=null),e.state=null,o0},D4e=(e,t)=>{if(b0(e))return Kl;const r=e.state;return(r.wrap&2)===0?Kl:(r.head=t,t.done=!1,o0)},O4e=(e,t)=>{const r=t.length;let n,a,s;return b0(e)||(n=e.state,n.wrap!==0&&n.mode!==Nw)?Kl:n.mode===Nw&&(a=1,a=XA(a,t,r,0),a!==n.check)?iW:(s=hW(e,t,r,r),s?(n.mode=oW,sW):(n.havedict=1,o0))};var R4e=uW,M4e=dW,L4e=cW,I4e=_4e,F4e=fW,B4e=T4e,z4e=P4e,U4e=D4e,$4e=O4e,H4e="pako inflate (from Nodeca project)",Id={inflateReset:R4e,inflateReset2:M4e,inflateResetKeep:L4e,inflateInit:I4e,inflateInit2:F4e,inflate:B4e,inflateEnd:z4e,inflateGetHeader:U4e,inflateSetDictionary:$4e,inflateInfo:H4e};function V4e(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var q4e=V4e;const mW=Object.prototype.toString,{Z_NO_FLUSH:W4e,Z_FINISH:G4e,Z_OK:qv,Z_STREAM_END:OS,Z_NEED_DICT:RS,Z_STREAM_ERROR:Y4e,Z_DATA_ERROR:JI,Z_MEM_ERROR:K4e}=eW;function R1(e){this.options=tW.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u4e,this.strm.avail_out=0;let r=Id.inflateInit2(this.strm,t.windowBits);if(r!==qv)throw new Error(ZA[r]);if(this.header=new q4e,Id.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=JA.string2buf(t.dictionary):mW.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Id.inflateSetDictionary(this.strm,t.dictionary),r!==qv)))throw new Error(ZA[r])}R1.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize,a=this.options.dictionary;let s,o,l;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?G4e:W4e,mW.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),s=Id.inflate(r,o),s===RS&&a&&(s=Id.inflateSetDictionary(r,a),s===qv?s=Id.inflate(r,o):s===JI&&(s=RS));r.avail_in>0&&s===OS&&r.state.wrap>0&&e[r.next_in]!==0;)Id.inflateReset(r),s=Id.inflate(r,o);switch(s){case Y4e:case JI:case RS:case K4e:return this.onEnd(s),this.ended=!0,!1}if(l=r.avail_out,r.next_out&&(r.avail_out===0||s===OS))if(this.options.to==="string"){let u=JA.utf8border(r.output,r.next_out),d=r.next_out-u,f=JA.buf2string(r.output,u);r.next_out=d,r.avail_out=n-d,d&&r.output.set(r.output.subarray(u,u+d),0),this.onData(f)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(s===qv&&l===0)){if(s===OS)return s=Id.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};R1.prototype.onData=function(e){this.chunks.push(e)};R1.prototype.onEnd=function(e){e===qv&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=tW.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function X4e(e,t){const r=new R1(t);if(r.push(e),r.err)throw r.msg||ZA[r.err];return r.result}var Z4e=R1,J4e=X4e,Q4e={Inflate:Z4e,inflate:J4e};const{Inflate:eSe,inflate:tSe}=Q4e;var QI=eSe,rSe=tSe;const pW=[];for(let e=0;e<256;e++){let t=e;for(let r=0;r<8;r++)t&1?t=3988292384^t>>>1:t=t>>>1;pW[e]=t}const eF=4294967295;function nSe(e,t,r){let n=e;for(let a=0;a<r;a++)n=pW[(n^t[a])&255]^n>>>8;return n}function aSe(e,t){return(nSe(eF,e,t)^eF)>>>0}function tF(e,t,r){const n=e.readUint32(),a=aSe(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(a!==n)throw new Error(`CRC mismatch for chunk ${r}. Expected ${n}, found ${a}`)}function xW(e,t,r){for(let n=0;n<r;n++)t[n]=e[n]}function gW(e,t,r,n){let a=0;for(;a<n;a++)t[a]=e[a];for(;a<r;a++)t[a]=e[a]+t[a-n]&255}function vW(e,t,r,n){let a=0;if(r.length===0)for(;a<n;a++)t[a]=e[a];else for(;a<n;a++)t[a]=e[a]+r[a]&255}function yW(e,t,r,n,a){let s=0;if(r.length===0){for(;s<a;s++)t[s]=e[s];for(;s<n;s++)t[s]=e[s]+(t[s-a]>>1)&255}else{for(;s<a;s++)t[s]=e[s]+(r[s]>>1)&255;for(;s<n;s++)t[s]=e[s]+(t[s-a]+r[s]>>1)&255}}function bW(e,t,r,n,a){let s=0;if(r.length===0){for(;s<a;s++)t[s]=e[s];for(;s<n;s++)t[s]=e[s]+t[s-a]&255}else{for(;s<a;s++)t[s]=e[s]+r[s]&255;for(;s<n;s++)t[s]=e[s]+iSe(t[s-a],r[s],r[s-a])&255}}function iSe(e,t,r){const n=e+t-r,a=Math.abs(n-e),s=Math.abs(n-t),o=Math.abs(n-r);return a<=s&&a<=o?e:s<=o?t:r}function sSe(e,t,r,n,a,s){switch(e){case 0:xW(t,r,a);break;case 1:gW(t,r,a,s);break;case 2:vW(t,r,n,a);break;case 3:yW(t,r,n,a,s);break;case 4:bW(t,r,n,a,s);break;default:throw new Error(`Unsupported filter: ${e}`)}}const oSe=new Uint16Array([255]),lSe=new Uint8Array(oSe.buffer),cSe=lSe[0]===255;function uSe(e){const{data:t,width:r,height:n,channels:a,depth:s}=e,o=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],l=Math.ceil(s/8)*a,u=new Uint8Array(n*r*l);let d=0;for(let f=0;f<7;f++){const m=o[f],g=Math.ceil((r-m.x)/m.xStep),x=Math.ceil((n-m.y)/m.yStep);if(g<=0||x<=0)continue;const y=g*l,v=new Uint8Array(y);for(let w=0;w<x;w++){const j=t[d++],k=t.subarray(d,d+y);d+=y;const A=new Uint8Array(y);sSe(j,k,A,v,y,l),v.set(A);for(let T=0;T<g;T++){const M=m.x+T*m.xStep,B=m.y+w*m.yStep;if(!(M>=r||B>=n))for(let L=0;L<l;L++)u[(B*r+M)*l+L]=A[T*l+L]}}}if(s===16){const f=new Uint16Array(u.buffer);if(cSe)for(let m=0;m<f.length;m++)f[m]=dSe(f[m]);return f}else return u}function dSe(e){return(e&255)<<8|e>>8&255}const fSe=new Uint16Array([255]),hSe=new Uint8Array(fSe.buffer),mSe=hSe[0]===255,pSe=new Uint8Array(0);function rF(e){const{data:t,width:r,height:n,channels:a,depth:s}=e,o=Math.ceil(s/8)*a,l=Math.ceil(s/8*a*r),u=new Uint8Array(n*l);let d=pSe,f=0,m,g;for(let x=0;x<n;x++){switch(m=t.subarray(f+1,f+1+l),g=u.subarray(x*l,(x+1)*l),t[f]){case 0:xW(m,g,l);break;case 1:gW(m,g,l,o);break;case 2:vW(m,g,d,l);break;case 3:yW(m,g,d,l,o);break;case 4:bW(m,g,d,l,o);break;default:throw new Error(`Unsupported filter: ${t[f]}`)}d=g,f+=l+1}if(s===16){const x=new Uint16Array(u.buffer);if(mSe)for(let y=0;y<x.length;y++)x[y]=xSe(x[y]);return x}else return u}function xSe(e){return(e&255)<<8|e>>8&255}const t2=Uint8Array.of(137,80,78,71,13,10,26,10);function nF(e){if(!gSe(e.readBytes(t2.length)))throw new Error("wrong PNG signature")}function gSe(e){if(e.length<t2.length)return!1;for(let t=0;t<t2.length;t++)if(e[t]!==t2[t])return!1;return!0}const vSe="tEXt",ySe=0,wW=new TextDecoder("latin1");function bSe(e){if(jSe(e),e.length===0||e.length>79)throw new Error("keyword length must be between 1 and 79")}const wSe=/^[\u0000-\u00FF]*$/;function jSe(e){if(!wSe.test(e))throw new Error("invalid latin1 text")}function NSe(e,t,r){const n=jW(t);e[n]=SSe(t,r-n.length-1)}function jW(e){for(e.mark();e.readByte()!==ySe;);const t=e.offset;e.reset();const r=wW.decode(e.readBytes(t-e.offset-1));return e.skip(1),bSe(r),r}function SSe(e,t){return wW.decode(e.readBytes(t))}const il={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},MS={UNKNOWN:-1,DEFLATE:0},aF={UNKNOWN:-1,ADAPTIVE:0},LS={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},fb={NONE:0,BACKGROUND:1,PREVIOUS:2},IS={SOURCE:0,OVER:1};class ASe extends lE{constructor(r,n={}){super(r);En(this,"_checkCrc");En(this,"_inflator");En(this,"_png");En(this,"_apng");En(this,"_end");En(this,"_hasPalette");En(this,"_palette");En(this,"_hasTransparency");En(this,"_transparency");En(this,"_compressionMethod");En(this,"_filterMethod");En(this,"_interlaceMethod");En(this,"_colorType");En(this,"_isAnimated");En(this,"_numberOfFrames");En(this,"_numberOfPlays");En(this,"_frames");En(this,"_writingDataChunks");const{checkCrc:a=!1}=n;this._checkCrc=a,this._inflator=new QI,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=MS.UNKNOWN,this._filterMethod=aF.UNKNOWN,this._interlaceMethod=LS.UNKNOWN,this._colorType=il.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(nF(this);!this._end;){const r=this.readUint32(),n=this.readChars(4);this.decodeChunk(r,n)}return this.decodeImage(),this._png}decodeApng(){for(nF(this);!this._end;){const r=this.readUint32(),n=this.readChars(4);this.decodeApngChunk(r,n)}return this.decodeApngImage(),this._apng}decodeChunk(r,n){const a=this.offset;switch(n){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(r);break;case"IDAT":this.decodeIDAT(r);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(r);break;case"iCCP":this.decodeiCCP(r);break;case vSe:NSe(this._png.text,this,r);break;case"pHYs":this.decodepHYs();break;default:this.skip(r);break}if(this.offset-a!==r)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?tF(this,r+4,n):this.skip(4)}decodeApngChunk(r,n){const a=this.offset;switch(n!=="fdAT"&&n!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),n){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(r);break;default:this.decodeChunk(r,n),this.offset=a+r;break}if(this.offset-a!==r)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?tF(this,r+4,n):this.skip(4)}decodeIHDR(){const r=this._png;r.width=this.readUint32(),r.height=this.readUint32(),r.depth=kSe(this.readUint8());const n=this.readUint8();this._colorType=n;let a;switch(n){case il.GREYSCALE:a=1;break;case il.TRUECOLOUR:a=3;break;case il.INDEXED_COLOUR:a=1;break;case il.GREYSCALE_ALPHA:a=2;break;case il.TRUECOLOUR_ALPHA:a=4;break;case il.UNKNOWN:default:throw new Error(`Unknown color type: ${n}`)}if(this._png.channels=a,this._compressionMethod=this.readUint8(),this._compressionMethod!==MS.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const r={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(r)}decodePLTE(r){if(r%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${r}`);const n=r/3;this._hasPalette=!0;const a=[];this._palette=a;for(let s=0;s<n;s++)a.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(r){this._writingDataChunks=!0;const n=r,a=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,a,n)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(r)}decodeFDAT(r){this._writingDataChunks=!0;let n=r,a=this.offset+this.byteOffset;if(a+=4,n-=4,this._inflator.push(new Uint8Array(this.buffer,a,n)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(r)}decodetRNS(r){switch(this._colorType){case il.GREYSCALE:case il.TRUECOLOUR:{if(r%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${r}`);if(r/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${r/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(r/2);for(let n=0;n<r/2;n++)this._transparency[n]=this.readUint16();break}case il.INDEXED_COLOUR:{if(r>this._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${r} vs ${this._palette.length})`);let n=0;for(;n<r;n++){const a=this.readByte();this._palette[n].push(a)}for(;n<this._palette.length;n++)this._palette[n].push(255);break}case il.UNKNOWN:case il.GREYSCALE_ALPHA:case il.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(r){const n=jW(this),a=this.readUint8();if(a!==MS.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${a}`);const s=this.readBytes(r-n.length-2);this._png.iccEmbeddedProfile={name:n,profile:rSe(s)}}decodepHYs(){const r=this.readUint32(),n=this.readUint32(),a=this.readByte();this._png.resolution={x:r,y:n,unit:a}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let r=0;r<this._numberOfFrames;r++){const n={sequenceNumber:this._frames[r].sequenceNumber,delayNumber:this._frames[r].delayNumber,delayDenominator:this._frames[r].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},a=this._frames.at(r);if(a){if(a.data=rF({data:a.data,width:a.width,height:a.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),r===0||a.xOffset===0&&a.yOffset===0&&a.width===this._png.width&&a.height===this._png.height)n.data=a.data;else{const s=this._apng.frames.at(r-1);this.disposeFrame(a,s,n),this.addFrameDataToCanvas(n,a)}this._apng.frames.push(n)}}return this._apng}disposeFrame(r,n,a){switch(r.disposeOp){case fb.NONE:break;case fb.BACKGROUND:for(let s=0;s<this._png.height;s++)for(let o=0;o<this._png.width;o++){const l=(s*r.width+o)*this._png.channels;for(let u=0;u<this._png.channels;u++)a.data[l+u]=0}break;case fb.PREVIOUS:a.data.set(n.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(r,n){const a=1<<this._png.depth,s=(o,l)=>{const u=((o+n.yOffset)*this._png.width+n.xOffset+l)*this._png.channels,d=(o*n.width+l)*this._png.channels;return{index:u,frameIndex:d}};switch(n.blendOp){case IS.SOURCE:for(let o=0;o<n.height;o++)for(let l=0;l<n.width;l++){const{index:u,frameIndex:d}=s(o,l);for(let f=0;f<this._png.channels;f++)r.data[u+f]=n.data[d+f]}break;case IS.OVER:for(let o=0;o<n.height;o++)for(let l=0;l<n.width;l++){const{index:u,frameIndex:d}=s(o,l);for(let f=0;f<this._png.channels;f++){const m=n.data[d+this._png.channels-1]/a,g=f%(this._png.channels-1)===0?1:n.data[d+f],x=Math.floor(m*g+(1-m)*r.data[u+f]);r.data[u+f]+=x}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){var n;if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);const r=this._isAnimated?((n=this._frames)==null?void 0:n.at(0)).data:this._inflator.result;if(this._filterMethod!==aF.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===LS.NO_INTERLACE)this._png.data=rF({data:r,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===LS.ADAM7)this._png.data=uSe({data:r,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const r=this._inflator.result,n=this._frames.at(-1);n?n.data=r:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:fb.NONE,blendOp:IS.SOURCE,data:r}),this._inflator=new QI,this._writingDataChunks=!1}}function kSe(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw new Error(`invalid bit depth: ${e}`);return e}var iF;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.METRE=1]="METRE"})(iF||(iF={}));function CSe(e,t){return new ASe(e,t).decode()}var Or=(function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this})();function FS(){Or.console&&typeof Or.console.log=="function"&&Or.console.log.apply(Or.console,arguments)}var na={log:FS,warn:function(e){Or.console&&(typeof Or.console.warn=="function"?Or.console.warn.apply(Or.console,arguments):FS.call(null,arguments))},error:function(e){Or.console&&(typeof Or.console.error=="function"?Or.console.error.apply(Or.console,arguments):FS(e))}};function BS(e,t,r){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){km(n.response,t,r)},n.onerror=function(){na.error("could not download file")},n.send()}function sF(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function hb(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var km=Or.saveAs||((typeof window>"u"?"undefined":Un(window))!=="object"||window!==Or?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(e,t,r){var n=Or.URL||Or.webkitURL,a=document.createElement("a");t=t||e.name||"download",a.download=t,a.rel="noopener",typeof e=="string"?(a.href=e,a.origin!==location.origin?sF(a.href)?BS(e,t,r):hb(a,a.target="_blank"):hb(a)):(a.href=n.createObjectURL(e),setTimeout(function(){n.revokeObjectURL(a.href)},4e4),setTimeout(function(){hb(a)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,r){if(t=t||e.name||"download",typeof e=="string")if(sF(e))BS(e,t,r);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){hb(n)})}else navigator.msSaveOrOpenBlob((function(a,s){return s===void 0?s={autoBom:!1}:Un(s)!=="object"&&(na.warn("Deprecated: Expected third argument to be a object"),s={autoBom:!s}),s.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a})(e,r),t)}:function(e,t,r,n){if((n=n||open("","_blank"))&&(n.document.title=n.document.body.innerText="downloading..."),typeof e=="string")return BS(e,t,r);var a=e.type==="application/octet-stream",s=/constructor/i.test(Or.HTMLElement)||Or.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||a&&s)&&(typeof FileReader>"u"?"undefined":Un(FileReader))==="object"){var l=new FileReader;l.onloadend=function(){var f=l.result;f=o?f:f.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=f:location=f,n=null},l.readAsDataURL(e)}else{var u=Or.URL||Or.webkitURL,d=u.createObjectURL(e);n?n.location=d:location.href=d,n=null,setTimeout(function(){u.revokeObjectURL(d)},4e4)}});/**
 * A class to parse color values
 * @author Stoyan Stefanov <sstoo@gmail.com>
 * {@link   http://www.phpied.com/rgb-color-parser-in-javascript/}
 * @license Use it if you like it
 */function NW(e){var t;e=e||"",this.ok=!1,e.charAt(0)=="#"&&(e=e.substr(1,6)),e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[e=(e=e.replace(/ /g,"")).toLowerCase()]||e;for(var r=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(l){return[parseInt(l[1]),parseInt(l[2]),parseInt(l[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(l){return[parseInt(l[1],16),parseInt(l[2],16),parseInt(l[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(l){return[parseInt(l[1]+l[1],16),parseInt(l[2]+l[2],16),parseInt(l[3]+l[3],16)]}}],n=0;n<r.length;n++){var a=r[n].re,s=r[n].process,o=a.exec(e);o&&(t=s(o),this.r=t[0],this.g=t[1],this.b=t[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var l=this.r.toString(16),u=this.g.toString(16),d=this.b.toString(16);return l.length==1&&(l="0"+l),u.length==1&&(u="0"+u),d.length==1&&(d="0"+d),"#"+l+u+d}}var r2=Or.atob.bind(Or),oF=Or.btoa.bind(Or);/**
 * @license
 * Joseph Myers does not specify a particular license for his work.
 *
 * Author: Joseph Myers
 * Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js
 *
 * Modified by: Owen Leong
 */function zS(e,t){var r=e[0],n=e[1],a=e[2],s=e[3];r=Rs(r,n,a,s,t[0],7,-680876936),s=Rs(s,r,n,a,t[1],12,-389564586),a=Rs(a,s,r,n,t[2],17,606105819),n=Rs(n,a,s,r,t[3],22,-1044525330),r=Rs(r,n,a,s,t[4],7,-176418897),s=Rs(s,r,n,a,t[5],12,1200080426),a=Rs(a,s,r,n,t[6],17,-1473231341),n=Rs(n,a,s,r,t[7],22,-45705983),r=Rs(r,n,a,s,t[8],7,1770035416),s=Rs(s,r,n,a,t[9],12,-1958414417),a=Rs(a,s,r,n,t[10],17,-42063),n=Rs(n,a,s,r,t[11],22,-1990404162),r=Rs(r,n,a,s,t[12],7,1804603682),s=Rs(s,r,n,a,t[13],12,-40341101),a=Rs(a,s,r,n,t[14],17,-1502002290),r=Ms(r,n=Rs(n,a,s,r,t[15],22,1236535329),a,s,t[1],5,-165796510),s=Ms(s,r,n,a,t[6],9,-1069501632),a=Ms(a,s,r,n,t[11],14,643717713),n=Ms(n,a,s,r,t[0],20,-373897302),r=Ms(r,n,a,s,t[5],5,-701558691),s=Ms(s,r,n,a,t[10],9,38016083),a=Ms(a,s,r,n,t[15],14,-660478335),n=Ms(n,a,s,r,t[4],20,-405537848),r=Ms(r,n,a,s,t[9],5,568446438),s=Ms(s,r,n,a,t[14],9,-1019803690),a=Ms(a,s,r,n,t[3],14,-187363961),n=Ms(n,a,s,r,t[8],20,1163531501),r=Ms(r,n,a,s,t[13],5,-1444681467),s=Ms(s,r,n,a,t[2],9,-51403784),a=Ms(a,s,r,n,t[7],14,1735328473),r=Ls(r,n=Ms(n,a,s,r,t[12],20,-1926607734),a,s,t[5],4,-378558),s=Ls(s,r,n,a,t[8],11,-2022574463),a=Ls(a,s,r,n,t[11],16,1839030562),n=Ls(n,a,s,r,t[14],23,-35309556),r=Ls(r,n,a,s,t[1],4,-1530992060),s=Ls(s,r,n,a,t[4],11,1272893353),a=Ls(a,s,r,n,t[7],16,-155497632),n=Ls(n,a,s,r,t[10],23,-1094730640),r=Ls(r,n,a,s,t[13],4,681279174),s=Ls(s,r,n,a,t[0],11,-358537222),a=Ls(a,s,r,n,t[3],16,-722521979),n=Ls(n,a,s,r,t[6],23,76029189),r=Ls(r,n,a,s,t[9],4,-640364487),s=Ls(s,r,n,a,t[12],11,-421815835),a=Ls(a,s,r,n,t[15],16,530742520),r=Is(r,n=Ls(n,a,s,r,t[2],23,-995338651),a,s,t[0],6,-198630844),s=Is(s,r,n,a,t[7],10,1126891415),a=Is(a,s,r,n,t[14],15,-1416354905),n=Is(n,a,s,r,t[5],21,-57434055),r=Is(r,n,a,s,t[12],6,1700485571),s=Is(s,r,n,a,t[3],10,-1894986606),a=Is(a,s,r,n,t[10],15,-1051523),n=Is(n,a,s,r,t[1],21,-2054922799),r=Is(r,n,a,s,t[8],6,1873313359),s=Is(s,r,n,a,t[15],10,-30611744),a=Is(a,s,r,n,t[6],15,-1560198380),n=Is(n,a,s,r,t[13],21,1309151649),r=Is(r,n,a,s,t[4],6,-145523070),s=Is(s,r,n,a,t[11],10,-1120210379),a=Is(a,s,r,n,t[2],15,718787259),n=Is(n,a,s,r,t[9],21,-343485551),e[0]=fh(r,e[0]),e[1]=fh(n,e[1]),e[2]=fh(a,e[2]),e[3]=fh(s,e[3])}function W5(e,t,r,n,a,s){return t=fh(fh(t,e),fh(n,s)),fh(t<<a|t>>>32-a,r)}function Rs(e,t,r,n,a,s,o){return W5(t&r|~t&n,e,t,a,s,o)}function Ms(e,t,r,n,a,s,o){return W5(t&n|r&~n,e,t,a,s,o)}function Ls(e,t,r,n,a,s,o){return W5(t^r^n,e,t,a,s,o)}function Is(e,t,r,n,a,s,o){return W5(r^(t|~n),e,t,a,s,o)}function SW(e){var t,r=e.length,n=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)zS(n,_Se(e.substring(t-64,t)));e=e.substring(t-64);var a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<e.length;t++)a[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(zS(n,a),t=0;t<16;t++)a[t]=0;return a[14]=8*r,zS(n,a),n}function _Se(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}var lF="0123456789abcdef".split("");function ESe(e){for(var t="",r=0;r<4;r++)t+=lF[e>>8*r+4&15]+lF[e>>8*r&15];return t}function TSe(e){return String.fromCharCode(255&e,(65280&e)>>8,(16711680&e)>>16,(4278190080&e)>>24)}function QA(e){return SW(e).map(TSe).join("")}var PSe=(function(e){for(var t=0;t<e.length;t++)e[t]=ESe(e[t]);return e.join("")})(SW("hello"))!="5d41402abc4b2a76b9719d911017c592";function fh(e,t){if(PSe){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}return e+t&4294967295}/**
 * @license
 * FPDF is released under a permissive license: there is no usage restriction.
 * You may embed it freely in your application (commercial or not), with or
 * without modifications.
 *
 * Reference: http://www.fpdf.org/en/script/script37.php
 */function ek(e,t){var r,n,a,s;if(e!==r){for(var o=(a=e,s=1+(256/e.length|0),new Array(s+1).join(a)),l=[],u=0;u<256;u++)l[u]=u;var d=0;for(u=0;u<256;u++){var f=l[u];d=(d+f+o.charCodeAt(u))%256,l[u]=l[d],l[d]=f}r=e,n=l}else l=n;var m=t.length,g=0,x=0,y="";for(u=0;u<m;u++)x=(x+(f=l[g=(g+1)%256]))%256,l[g]=l[x],l[x]=f,o=l[(l[g]+l[x])%256],y+=String.fromCharCode(t.charCodeAt(u)^o);return y}/**
 * @license
 * Licensed under the MIT License.
 * http://opensource.org/licenses/mit-license
 * Author: Owen Leong (@owenl131)
 * Date: 15 Oct 2020
 * References:
 * https://www.cs.cmu.edu/~dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt
 * https://github.com/foliojs/pdfkit/blob/master/lib/security.js
 * http://www.fpdf.org/en/script/script37.php
 */var cF={print:4,modify:8,copy:16,"annot-forms":32};function Tp(e,t,r,n){this.v=1,this.r=2;var a=192;e.forEach(function(l){if(cF.perm!==void 0)throw new Error("Invalid permission: "+l);a+=cF[l]}),this.padding="(¿N^NuAd\0NVÿú\b..\0¶Ðh>/\f©þdSiz";var s=(t+this.padding).substr(0,32),o=(r+this.padding).substr(0,32);this.O=this.processOwnerPassword(s,o),this.P=-(1+(255^a)),this.encryptionKey=QA(s+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(n)).substr(0,5),this.U=ek(this.encryptionKey,this.padding)}function Pp(e){if(/[^\u0000-\u00ff]/.test(e))throw new Error("Invalid PDF Name Object: "+e+", Only accept ASCII characters.");for(var t="",r=e.length,n=0;n<r;n++){var a=e.charCodeAt(n);t+=a<33||a===35||a===37||a===40||a===41||a===47||a===60||a===62||a===91||a===93||a===123||a===125||a>126?"#"+("0"+a.toString(16)).slice(-2):e[n]}return t}function uF(e){if(Un(e)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(r,n,a){if(a=a||!1,typeof r!="string"||typeof n!="function"||typeof a!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(r)||(t[r]={});var s=Math.random().toString(35);return t[r][s]=[n,!!a],s},this.unsubscribe=function(r){for(var n in t)if(t[n][r])return delete t[n][r],Object.keys(t[n]).length===0&&delete t[n],!0;return!1},this.publish=function(r){if(t.hasOwnProperty(r)){var n=Array.prototype.slice.call(arguments,1),a=[];for(var s in t[r]){var o=t[r][s];try{o[0].apply(e,n)}catch(l){Or.console&&na.error("jsPDF PubSub Error",l.message,l)}o[1]&&a.push(s)}a.length&&a.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function Sw(e){if(!(this instanceof Sw))return new Sw(e);var t="opacity,stroke-opacity".split(",");for(var r in e)e.hasOwnProperty(r)&&t.indexOf(r)>=0&&(this[r]=e[r]);this.id="",this.objectNumber=-1}function AW(e,t){this.gState=e,this.matrix=t,this.id="",this.objectNumber=-1}function Cm(e,t,r,n,a){if(!(this instanceof Cm))return new Cm(e,t,r,n,a);this.type=e==="axial"?2:3,this.coords=t,this.colors=r,AW.call(this,n,a)}function Bp(e,t,r,n,a){if(!(this instanceof Bp))return new Bp(e,t,r,n,a);this.boundingBox=e,this.xStep=t,this.yStep=r,this.stream="",this.cloneIndex=0,AW.call(this,n,a)}function tr(e){var t,r=typeof arguments[0]=="string"?arguments[0]:"p",n=arguments[1],a=arguments[2],s=arguments[3],o=[],l=1,u=16,d="S",f=null;Un(e=e||{})==="object"&&(r=e.orientation,n=e.unit||n,a=e.format||a,s=e.compress||e.compressPdf||s,(f=e.encryption||null)!==null&&(f.userPassword=f.userPassword||"",f.ownerPassword=f.ownerPassword||"",f.userPermissions=f.userPermissions||[]),l=typeof e.userUnit=="number"?Math.abs(e.userUnit):1,e.precision!==void 0&&(t=e.precision),e.floatPrecision!==void 0&&(u=e.floatPrecision),d=e.defaultPathOperation||"S"),o=e.filters||(s===!0?["FlateEncode"]:o),n=n||"mm",r=(""+(r||"P")).toLowerCase();var m=e.putOnlyUsedFonts||!1,g={},x={internal:{},__private__:{}};x.__private__.PubSub=uF;var y="1.3",v=x.__private__.getPdfVersion=function(){return y};x.__private__.setPdfVersion=function(U){y=U};var w={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};x.__private__.getPageFormats=function(){return w};var j=x.__private__.getPageFormat=function(U){return w[U]};a=a||"a4";var k="compat",A="advanced",T=k;function M(){this.saveGraphicsState(),ue(new Ht(me,0,0,-me,0,ad()*me).toString()+" cm"),this.setFontSize(this.getFontSize()/me),d="n",T=A}function B(){this.restoreGraphicsState(),d="S",T=k}var L=x.__private__.combineFontStyleAndFontWeight=function(U,pe){if(U=="bold"&&pe=="normal"||U=="bold"&&pe==400||U=="normal"&&pe=="italic"||U=="bold"&&pe=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return pe&&(U=pe==400||pe==="normal"?U==="italic"?"italic":"normal":pe!=700&&pe!=="bold"||U!=="normal"?(pe==700?"bold":pe)+""+U:"bold"),U};x.advancedAPI=function(U){var pe=T===k;return pe&&M.call(this),typeof U!="function"||(U(this),pe&&B.call(this)),this},x.compatAPI=function(U){var pe=T===A;return pe&&B.call(this),typeof U!="function"||(U(this),pe&&M.call(this)),this},x.isAdvancedAPI=function(){return T===A};var F,I=function(U){if(T!==A)throw new Error(U+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},q=x.roundToPrecision=x.__private__.roundToPrecision=function(U,pe){var Me=t||pe;if(isNaN(U)||isNaN(Me))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return U.toFixed(Me).replace(/0+$/,"")};F=x.hpf=x.__private__.hpf=typeof u=="number"?function(U){if(isNaN(U))throw new Error("Invalid argument passed to jsPDF.hpf");return q(U,u)}:u==="smart"?function(U){if(isNaN(U))throw new Error("Invalid argument passed to jsPDF.hpf");return q(U,U>-1&&U<1?16:5)}:function(U){if(isNaN(U))throw new Error("Invalid argument passed to jsPDF.hpf");return q(U,16)};var P=x.f2=x.__private__.f2=function(U){if(isNaN(U))throw new Error("Invalid argument passed to jsPDF.f2");return q(U,2)},R=x.__private__.f3=function(U){if(isNaN(U))throw new Error("Invalid argument passed to jsPDF.f3");return q(U,3)},K=x.scale=x.__private__.scale=function(U){if(isNaN(U))throw new Error("Invalid argument passed to jsPDF.scale");return T===k?U*me:T===A?U:void 0},ee=function(U){return K((function(pe){return T===k?ad()-pe:T===A?pe:void 0})(U))};x.__private__.setPrecision=x.setPrecision=function(U){typeof parseInt(U,10)=="number"&&(t=parseInt(U,10))};var se,Z="00000000000000000000000000000000",ne=x.__private__.getFileId=function(){return Z},X=x.__private__.setFileId=function(U){return Z=U!==void 0&&/^[a-fA-F0-9]{32}$/.test(U)?U.toUpperCase():Z.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),f!==null&&(ai=new Tp(f.userPermissions,f.userPassword,f.ownerPassword,Z)),Z};x.setFileId=function(U){return X(U),this},x.getFileId=function(){return ne()};var le=x.__private__.convertDateToPDFDate=function(U){var pe=U.getTimezoneOffset(),Me=pe<0?"+":"-",We=Math.floor(Math.abs(pe/60)),et=Math.abs(pe%60),Nt=[Me,G(We),"'",G(et),"'"].join("");return["D:",U.getFullYear(),G(U.getMonth()+1),G(U.getDate()),G(U.getHours()),G(U.getMinutes()),G(U.getSeconds()),Nt].join("")},Ae=x.__private__.convertPDFDateToDate=function(U){var pe=parseInt(U.substr(2,4),10),Me=parseInt(U.substr(6,2),10)-1,We=parseInt(U.substr(8,2),10),et=parseInt(U.substr(10,2),10),Nt=parseInt(U.substr(12,2),10),Pt=parseInt(U.substr(14,2),10);return new Date(pe,Me,We,et,Nt,Pt,0)},ce=x.__private__.setCreationDate=function(U){var pe;if(U===void 0&&(U=new Date),U instanceof Date)pe=le(U);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(U))throw new Error("Invalid argument passed to jsPDF.setCreationDate");pe=U}return se=pe},D=x.__private__.getCreationDate=function(U){var pe=se;return U==="jsDate"&&(pe=Ae(se)),pe};x.setCreationDate=function(U){return ce(U),this},x.getCreationDate=function(U){return D(U)};var H,G=x.__private__.padd2=function(U){return("0"+parseInt(U)).slice(-2)},E=x.__private__.padd2Hex=function(U){return("00"+(U=U.toString())).substr(U.length)},re=0,he=[],oe=[],z=0,fe=[],de=[],W=!1,ae=oe;x.__private__.setCustomOutputDestination=function(U){W=!0,ae=U};var _e=function(U){W||(ae=U)};x.__private__.resetCustomOutputDestination=function(){W=!1,ae=oe};var ue=x.__private__.out=function(U){return U=U.toString(),z+=U.length+1,ae.push(U),ae},ke=x.__private__.write=function(U){return ue(arguments.length===1?U.toString():Array.prototype.join.call(arguments," "))},$e=x.__private__.getArrayBuffer=function(U){for(var pe=U.length,Me=new ArrayBuffer(pe),We=new Uint8Array(Me);pe--;)We[pe]=U.charCodeAt(pe);return Me},Je=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];x.__private__.getStandardFonts=function(){return Je};var Xe=e.fontSize||16;x.__private__.setFontSize=x.setFontSize=function(U){return Xe=T===A?U/me:U,this};var Ne,Ye=x.__private__.getFontSize=x.getFontSize=function(){return T===k?Xe:Xe*me},at=e.R2L||!1;x.__private__.setR2L=x.setR2L=function(U){return at=U,this},x.__private__.getR2L=x.getR2L=function(){return at};var Y,we=x.__private__.setZoomMode=function(U){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(U))Ne=U;else if(isNaN(U)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(U)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+U+'" is not recognized.');Ne=U}else Ne=parseInt(U,10)};x.__private__.getZoomMode=function(){return Ne};var J,ve=x.__private__.setPageMode=function(U){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(U)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+U+'" is not recognized.');Y=U};x.__private__.getPageMode=function(){return Y};var Oe=x.__private__.setLayoutMode=function(U){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(U)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+U+'" is not recognized.');J=U};x.__private__.getLayoutMode=function(){return J},x.__private__.setDisplayMode=x.setDisplayMode=function(U,pe,Me){return we(U),Oe(pe),ve(Me),this};var xe={title:"",subject:"",author:"",keywords:"",creator:""};x.__private__.getDocumentProperty=function(U){if(Object.keys(xe).indexOf(U)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return xe[U]},x.__private__.getDocumentProperties=function(){return xe},x.__private__.setDocumentProperties=x.setProperties=x.setDocumentProperties=function(U){for(var pe in xe)xe.hasOwnProperty(pe)&&U[pe]&&(xe[pe]=U[pe]);return this},x.__private__.setDocumentProperty=function(U,pe){if(Object.keys(xe).indexOf(U)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return xe[U]=pe};var qe,me,Ge,Be,it,st={},Ve={},te=[],Ue={},ot={},vt={},_t={},qt=null,Ft=0,Dt=[],Rt=new uF(x),wr=e.hotfixes||[],gr={},Er={},Ur=[],Ht=function U(pe,Me,We,et,Nt,Pt){if(!(this instanceof U))return new U(pe,Me,We,et,Nt,Pt);isNaN(pe)&&(pe=1),isNaN(Me)&&(Me=0),isNaN(We)&&(We=0),isNaN(et)&&(et=1),isNaN(Nt)&&(Nt=0),isNaN(Pt)&&(Pt=0),this._matrix=[pe,Me,We,et,Nt,Pt]};Object.defineProperty(Ht.prototype,"sx",{get:function(){return this._matrix[0]},set:function(U){this._matrix[0]=U}}),Object.defineProperty(Ht.prototype,"shy",{get:function(){return this._matrix[1]},set:function(U){this._matrix[1]=U}}),Object.defineProperty(Ht.prototype,"shx",{get:function(){return this._matrix[2]},set:function(U){this._matrix[2]=U}}),Object.defineProperty(Ht.prototype,"sy",{get:function(){return this._matrix[3]},set:function(U){this._matrix[3]=U}}),Object.defineProperty(Ht.prototype,"tx",{get:function(){return this._matrix[4]},set:function(U){this._matrix[4]=U}}),Object.defineProperty(Ht.prototype,"ty",{get:function(){return this._matrix[5]},set:function(U){this._matrix[5]=U}}),Object.defineProperty(Ht.prototype,"a",{get:function(){return this._matrix[0]},set:function(U){this._matrix[0]=U}}),Object.defineProperty(Ht.prototype,"b",{get:function(){return this._matrix[1]},set:function(U){this._matrix[1]=U}}),Object.defineProperty(Ht.prototype,"c",{get:function(){return this._matrix[2]},set:function(U){this._matrix[2]=U}}),Object.defineProperty(Ht.prototype,"d",{get:function(){return this._matrix[3]},set:function(U){this._matrix[3]=U}}),Object.defineProperty(Ht.prototype,"e",{get:function(){return this._matrix[4]},set:function(U){this._matrix[4]=U}}),Object.defineProperty(Ht.prototype,"f",{get:function(){return this._matrix[5]},set:function(U){this._matrix[5]=U}}),Object.defineProperty(Ht.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Ht.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Ht.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Ht.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),Ht.prototype.join=function(U){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(F).join(U)},Ht.prototype.multiply=function(U){var pe=U.sx*this.sx+U.shy*this.shx,Me=U.sx*this.shy+U.shy*this.sy,We=U.shx*this.sx+U.sy*this.shx,et=U.shx*this.shy+U.sy*this.sy,Nt=U.tx*this.sx+U.ty*this.shx+this.tx,Pt=U.tx*this.shy+U.ty*this.sy+this.ty;return new Ht(pe,Me,We,et,Nt,Pt)},Ht.prototype.decompose=function(){var U=this.sx,pe=this.shy,Me=this.shx,We=this.sy,et=this.tx,Nt=this.ty,Pt=Math.sqrt(U*U+pe*pe),rr=(U/=Pt)*Me+(pe/=Pt)*We;Me-=U*rr,We-=pe*rr;var or=Math.sqrt(Me*Me+We*We);return rr/=or,U*(We/=or)<pe*(Me/=or)&&(U=-U,pe=-pe,rr=-rr,Pt=-Pt),{scale:new Ht(Pt,0,0,or,0,0),translate:new Ht(1,0,0,1,et,Nt),rotate:new Ht(U,pe,-pe,U,0,0),skew:new Ht(1,0,rr,1,0,0)}},Ht.prototype.toString=function(U){return this.join(" ")},Ht.prototype.inversed=function(){var U=this.sx,pe=this.shy,Me=this.shx,We=this.sy,et=this.tx,Nt=this.ty,Pt=1/(U*We-pe*Me),rr=We*Pt,or=-pe*Pt,Pr=-Me*Pt,Mr=U*Pt;return new Ht(rr,or,Pr,Mr,-rr*et-Pr*Nt,-or*et-Mr*Nt)},Ht.prototype.applyToPoint=function(U){var pe=U.x*this.sx+U.y*this.shx+this.tx,Me=U.x*this.shy+U.y*this.sy+this.ty;return new rd(pe,Me)},Ht.prototype.applyToRectangle=function(U){var pe=this.applyToPoint(U),Me=this.applyToPoint(new rd(U.x+U.w,U.y+U.h));return new nd(pe.x,pe.y,Me.x-pe.x,Me.y-pe.y)},Ht.prototype.clone=function(){var U=this.sx,pe=this.shy,Me=this.shx,We=this.sy,et=this.tx,Nt=this.ty;return new Ht(U,pe,Me,We,et,Nt)},x.Matrix=Ht;var It=x.matrixMult=function(U,pe){return pe.multiply(U)},Rr=new Ht(1,0,0,1,0,0);x.unitMatrix=x.identityMatrix=Rr;var kr=function(U,pe){if(!ot[U]){var Me=(pe instanceof Cm?"Sh":"P")+(Object.keys(Ue).length+1).toString(10);pe.id=Me,ot[U]=Me,Ue[Me]=pe,Rt.publish("addPattern",pe)}};x.ShadingPattern=Cm,x.TilingPattern=Bp,x.addShadingPattern=function(U,pe){return I("addShadingPattern()"),kr(U,pe),this},x.beginTilingPattern=function(U){I("beginTilingPattern()"),nc(U.boundingBox[0],U.boundingBox[1],U.boundingBox[2]-U.boundingBox[0],U.boundingBox[3]-U.boundingBox[1],U.matrix)},x.endTilingPattern=function(U,pe){I("endTilingPattern()"),pe.stream=de[H].join(`
`),kr(U,pe),Rt.publish("endTilingPattern",pe),Ur.pop().restore()};var qr,Xr=x.__private__.newObject=function(){var U=Zr();return ye(U,!0),U},Zr=x.__private__.newObjectDeferred=function(){return re++,he[re]=function(){return z},re},ye=function(U,pe){return pe=typeof pe=="boolean"&&pe,he[U]=z,pe&&ue(U+" 0 obj"),U},Ie=x.__private__.newAdditionalObject=function(){var U={objId:Zr(),content:""};return fe.push(U),U},Ee=Zr(),Te=Zr(),Re=x.__private__.decodeColorString=function(U){var pe=U.split(" ");if(pe.length!==2||pe[1]!=="g"&&pe[1]!=="G")pe.length!==5||pe[4]!=="k"&&pe[4]!=="K"||(pe=[(1-pe[0])*(1-pe[3]),(1-pe[1])*(1-pe[3]),(1-pe[2])*(1-pe[3]),"r"]);else{var Me=parseFloat(pe[0]);pe=[Me,Me,Me,"r"]}for(var We="#",et=0;et<3;et++)We+=("0"+Math.floor(255*parseFloat(pe[et])).toString(16)).slice(-2);return We},ze=x.__private__.encodeColorString=function(U){var pe;typeof U=="string"&&(U={ch1:U});var Me=U.ch1,We=U.ch2,et=U.ch3,Nt=U.ch4,Pt=U.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof Me=="string"&&Me.charAt(0)!=="#"){var rr=new NW(Me);if(rr.ok)Me=rr.toHex();else if(!/^\d*\.?\d*$/.test(Me))throw new Error('Invalid color "'+Me+'" passed to jsPDF.encodeColorString.')}if(typeof Me=="string"&&/^#[0-9A-Fa-f]{3}$/.test(Me)&&(Me="#"+Me[1]+Me[1]+Me[2]+Me[2]+Me[3]+Me[3]),typeof Me=="string"&&/^#[0-9A-Fa-f]{6}$/.test(Me)){var or=parseInt(Me.substr(1),16);Me=or>>16&255,We=or>>8&255,et=255&or}if(We===void 0||Nt===void 0&&Me===We&&We===et)pe=typeof Me=="string"?Me+" "+Pt[0]:U.precision===2?P(Me/255)+" "+Pt[0]:R(Me/255)+" "+Pt[0];else if(Nt===void 0||Un(Nt)==="object"){if(Nt&&!isNaN(Nt.a)&&Nt.a===0)return["1.","1.","1.",Pt[1]].join(" ");pe=typeof Me=="string"?[Me,We,et,Pt[1]].join(" "):U.precision===2?[P(Me/255),P(We/255),P(et/255),Pt[1]].join(" "):[R(Me/255),R(We/255),R(et/255),Pt[1]].join(" ")}else pe=typeof Me=="string"?[Me,We,et,Nt,Pt[2]].join(" "):U.precision===2?[P(Me),P(We),P(et),P(Nt),Pt[2]].join(" "):[R(Me),R(We),R(et),R(Nt),Pt[2]].join(" ");return pe},ct=x.__private__.getFilters=function(){return o},bt=x.__private__.putStream=function(U){var pe=(U=U||{}).data||"",Me=U.filters||ct(),We=U.alreadyAppliedFilters||[],et=U.addLength1||!1,Nt=pe.length,Pt=U.objectId,rr=function(Jn){return Jn};if(f!==null&&Pt===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");f!==null&&(rr=ai.encryptor(Pt,0));var or={};Me===!0&&(Me=["FlateEncode"]);var Pr=U.additionalKeyValues||[],Mr=(or=tr.API.processDataByFilters!==void 0?tr.API.processDataByFilters(pe,Me):{data:pe,reverseChain:[]}).reverseChain+(Array.isArray(We)?We.join(" "):We.toString());if(or.data.length!==0&&(Pr.push({key:"Length",value:or.data.length}),et===!0&&Pr.push({key:"Length1",value:Nt})),Mr.length!=0)if(Mr.split("/").length-1==1)Pr.push({key:"Filter",value:Mr});else{Pr.push({key:"Filter",value:"["+Mr+"]"});for(var en=0;en<Pr.length;en+=1)if(Pr[en].key==="DecodeParms"){for(var $a=[],Mn=0;Mn<or.reverseChain.split("/").length-1;Mn+=1)$a.push("null");$a.push(Pr[en].value),Pr[en].value="["+$a.join(" ")+"]"}}ue("<<");for(var Dn=0;Dn<Pr.length;Dn++)ue("/"+Pr[Dn].key+" "+Pr[Dn].value);ue(">>"),or.data.length!==0&&(ue("stream"),ue(rr(or.data)),ue("endstream"))},dt=x.__private__.putPage=function(U){var pe=U.number,Me=U.data,We=U.objId,et=U.contentsObjId;ye(We,!0),ue("<</Type /Page"),ue("/Parent "+U.rootDictionaryObjId+" 0 R"),ue("/Resources "+U.resourceDictionaryObjId+" 0 R"),ue("/MediaBox ["+parseFloat(F(U.mediaBox.bottomLeftX))+" "+parseFloat(F(U.mediaBox.bottomLeftY))+" "+F(U.mediaBox.topRightX)+" "+F(U.mediaBox.topRightY)+"]"),U.cropBox!==null&&ue("/CropBox ["+F(U.cropBox.bottomLeftX)+" "+F(U.cropBox.bottomLeftY)+" "+F(U.cropBox.topRightX)+" "+F(U.cropBox.topRightY)+"]"),U.bleedBox!==null&&ue("/BleedBox ["+F(U.bleedBox.bottomLeftX)+" "+F(U.bleedBox.bottomLeftY)+" "+F(U.bleedBox.topRightX)+" "+F(U.bleedBox.topRightY)+"]"),U.trimBox!==null&&ue("/TrimBox ["+F(U.trimBox.bottomLeftX)+" "+F(U.trimBox.bottomLeftY)+" "+F(U.trimBox.topRightX)+" "+F(U.trimBox.topRightY)+"]"),U.artBox!==null&&ue("/ArtBox ["+F(U.artBox.bottomLeftX)+" "+F(U.artBox.bottomLeftY)+" "+F(U.artBox.topRightX)+" "+F(U.artBox.topRightY)+"]"),typeof U.userUnit=="number"&&U.userUnit!==1&&ue("/UserUnit "+U.userUnit),Rt.publish("putPage",{objId:We,pageContext:Dt[pe],pageNumber:pe,page:Me}),ue("/Contents "+et+" 0 R"),ue(">>"),ue("endobj");var Nt=Me.join(`
`);return T===A&&(Nt+=`
Q`),ye(et,!0),bt({data:Nt,filters:ct(),objectId:et}),ue("endobj"),We},ft=x.__private__.putPages=function(){var U,pe,Me=[];for(U=1;U<=Ft;U++)Dt[U].objId=Zr(),Dt[U].contentsObjId=Zr();for(U=1;U<=Ft;U++)Me.push(dt({number:U,data:de[U],objId:Dt[U].objId,contentsObjId:Dt[U].contentsObjId,mediaBox:Dt[U].mediaBox,cropBox:Dt[U].cropBox,bleedBox:Dt[U].bleedBox,trimBox:Dt[U].trimBox,artBox:Dt[U].artBox,userUnit:Dt[U].userUnit,rootDictionaryObjId:Ee,resourceDictionaryObjId:Te}));ye(Ee,!0),ue("<</Type /Pages");var We="/Kids [";for(pe=0;pe<Ft;pe++)We+=Me[pe]+" 0 R ";ue(We+"]"),ue("/Count "+Ft),ue(">>"),ue("endobj"),Rt.publish("postPutPages")},mt=function(U){Rt.publish("putFont",{font:U,out:ue,newObject:Xr,putStream:bt}),U.isAlreadyPutted!==!0&&(U.objectNumber=Xr(),ue("<<"),ue("/Type /Font"),ue("/BaseFont /"+Pp(U.postScriptName)),ue("/Subtype /Type1"),typeof U.encoding=="string"&&ue("/Encoding /"+U.encoding),ue("/FirstChar 32"),ue("/LastChar 255"),ue(">>"),ue("endobj"))},Lt=function(U){U.objectNumber=Xr();var pe=[];pe.push({key:"Type",value:"/XObject"}),pe.push({key:"Subtype",value:"/Form"}),pe.push({key:"BBox",value:"["+[F(U.x),F(U.y),F(U.x+U.width),F(U.y+U.height)].join(" ")+"]"}),pe.push({key:"Matrix",value:"["+U.matrix.toString()+"]"});var Me=U.pages[1].join(`
`);bt({data:Me,additionalKeyValues:pe,objectId:U.objectNumber}),ue("endobj")},Vt=function(U,pe){pe||(pe=21);var Me=Xr(),We=(function(Pt,rr){var or,Pr=[],Mr=1/(rr-1);for(or=0;or<1;or+=Mr)Pr.push(or);if(Pr.push(1),Pt[0].offset!=0){var en={offset:0,color:Pt[0].color};Pt.unshift(en)}if(Pt[Pt.length-1].offset!=1){var $a={offset:1,color:Pt[Pt.length-1].color};Pt.push($a)}for(var Mn="",Dn=0,Jn=0;Jn<Pr.length;Jn++){for(or=Pr[Jn];or>Pt[Dn+1].offset;)Dn++;var da=Pt[Dn].offset,fa=(or-da)/(Pt[Dn+1].offset-da),Ki=Pt[Dn].color,oc=Pt[Dn+1].color;Mn+=E(Math.round((1-fa)*Ki[0]+fa*oc[0]).toString(16))+E(Math.round((1-fa)*Ki[1]+fa*oc[1]).toString(16))+E(Math.round((1-fa)*Ki[2]+fa*oc[2]).toString(16))}return Mn.trim()})(U.colors,pe),et=[];et.push({key:"FunctionType",value:"0"}),et.push({key:"Domain",value:"[0.0 1.0]"}),et.push({key:"Size",value:"["+pe+"]"}),et.push({key:"BitsPerSample",value:"8"}),et.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),et.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),bt({data:We,additionalKeyValues:et,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:Me}),ue("endobj"),U.objectNumber=Xr(),ue("<< /ShadingType "+U.type),ue("/ColorSpace /DeviceRGB");var Nt="/Coords ["+F(parseFloat(U.coords[0]))+" "+F(parseFloat(U.coords[1]))+" ";U.type===2?Nt+=F(parseFloat(U.coords[2]))+" "+F(parseFloat(U.coords[3])):Nt+=F(parseFloat(U.coords[2]))+" "+F(parseFloat(U.coords[3]))+" "+F(parseFloat(U.coords[4]))+" "+F(parseFloat(U.coords[5])),ue(Nt+="]"),U.matrix&&ue("/Matrix ["+U.matrix.toString()+"]"),ue("/Function "+Me+" 0 R"),ue("/Extend [true true]"),ue(">>"),ue("endobj")},Xt=function(U,pe){var Me=Zr(),We=Xr();pe.push({resourcesOid:Me,objectOid:We}),U.objectNumber=We;var et=[];et.push({key:"Type",value:"/Pattern"}),et.push({key:"PatternType",value:"1"}),et.push({key:"PaintType",value:"1"}),et.push({key:"TilingType",value:"1"}),et.push({key:"BBox",value:"["+U.boundingBox.map(F).join(" ")+"]"}),et.push({key:"XStep",value:F(U.xStep)}),et.push({key:"YStep",value:F(U.yStep)}),et.push({key:"Resources",value:Me+" 0 R"}),U.matrix&&et.push({key:"Matrix",value:"["+U.matrix.toString()+"]"}),bt({data:U.stream,additionalKeyValues:et,objectId:U.objectNumber}),ue("endobj")},$t=function(U){for(var pe in U.objectNumber=Xr(),ue("<<"),U)switch(pe){case"opacity":ue("/ca "+P(U[pe]));break;case"stroke-opacity":ue("/CA "+P(U[pe]))}ue(">>"),ue("endobj")},Gt=function(U){ye(U.resourcesOid,!0),ue("<<"),ue("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),(function(){for(var pe in ue("/Font <<"),st)st.hasOwnProperty(pe)&&(m===!1||m===!0&&g.hasOwnProperty(pe))&&ue("/"+pe+" "+st[pe].objectNumber+" 0 R");ue(">>")})(),(function(){if(Object.keys(Ue).length>0){for(var pe in ue("/Shading <<"),Ue)Ue.hasOwnProperty(pe)&&Ue[pe]instanceof Cm&&Ue[pe].objectNumber>=0&&ue("/"+pe+" "+Ue[pe].objectNumber+" 0 R");Rt.publish("putShadingPatternDict"),ue(">>")}})(),(function(pe){if(Object.keys(Ue).length>0){for(var Me in ue("/Pattern <<"),Ue)Ue.hasOwnProperty(Me)&&Ue[Me]instanceof x.TilingPattern&&Ue[Me].objectNumber>=0&&Ue[Me].objectNumber<pe&&ue("/"+Me+" "+Ue[Me].objectNumber+" 0 R");Rt.publish("putTilingPatternDict"),ue(">>")}})(U.objectOid),(function(){if(Object.keys(vt).length>0){var pe;for(pe in ue("/ExtGState <<"),vt)vt.hasOwnProperty(pe)&&vt[pe].objectNumber>=0&&ue("/"+pe+" "+vt[pe].objectNumber+" 0 R");Rt.publish("putGStateDict"),ue(">>")}})(),(function(){for(var pe in ue("/XObject <<"),gr)gr.hasOwnProperty(pe)&&gr[pe].objectNumber>=0&&ue("/"+pe+" "+gr[pe].objectNumber+" 0 R");Rt.publish("putXobjectDict"),ue(">>")})(),ue(">>"),ue("endobj")},er=function(U){Ve[U.fontName]=Ve[U.fontName]||{},Ve[U.fontName][U.fontStyle]=U.id},An=function(U,pe,Me,We,et){var Nt={id:"F"+(Object.keys(st).length+1).toString(10),postScriptName:U,fontName:pe,fontStyle:Me,encoding:We,isStandardFont:et||!1,metadata:{}};return Rt.publish("addFont",{font:Nt,instance:this}),st[Nt.id]=Nt,er(Nt),Nt.id},Wr=x.__private__.pdfEscape=x.pdfEscape=function(U,pe){return(function(Me,We){var et,Nt,Pt,rr,or,Pr,Mr,en,$a;if(Pt=(We=We||{}).sourceEncoding||"Unicode",or=We.outputEncoding,(We.autoencode||or)&&st[qe].metadata&&st[qe].metadata[Pt]&&st[qe].metadata[Pt].encoding&&(rr=st[qe].metadata[Pt].encoding,!or&&st[qe].encoding&&(or=st[qe].encoding),!or&&rr.codePages&&(or=rr.codePages[0]),typeof or=="string"&&(or=rr[or]),or)){for(Mr=!1,Pr=[],et=0,Nt=Me.length;et<Nt;et++)(en=or[Me.charCodeAt(et)])?Pr.push(String.fromCharCode(en)):Pr.push(Me[et]),Pr[et].charCodeAt(0)>>8&&(Mr=!0);Me=Pr.join("")}for(et=Me.length;Mr===void 0&&et!==0;)Me.charCodeAt(et-1)>>8&&(Mr=!0),et--;if(!Mr)return Me;for(Pr=We.noBOM?[]:[254,255],et=0,Nt=Me.length;et<Nt;et++){if(($a=(en=Me.charCodeAt(et))>>8)>>8)throw new Error("Character at position "+et+" of string '"+Me+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");Pr.push($a),Pr.push(en-($a<<8))}return String.fromCharCode.apply(void 0,Pr)})(U,pe).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Pn=x.__private__.beginPage=function(U){de[++Ft]=[],Dt[Ft]={objId:0,contentsObjId:0,userUnit:Number(l),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(U[0]),topRightY:Number(U[1])}},qo(Ft),_e(de[H])},xs=function(U,pe){var Me,We,et;switch(r=pe||r,typeof U=="string"&&(Me=j(U.toLowerCase()),Array.isArray(Me)&&(We=Me[0],et=Me[1])),Array.isArray(U)&&(We=U[0]*me,et=U[1]*me),isNaN(We)&&(We=a[0],et=a[1]),(We>14400||et>14400)&&(na.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),We=Math.min(14400,We),et=Math.min(14400,et)),a=[We,et],r.substr(0,1)){case"l":et>We&&(a=[et,We]);break;case"p":We>et&&(a=[et,We])}Pn(a),Kh(jr),ue(tc),Zo!==0&&ue(Zo+" J"),Jo!==0&&ue(Jo+" j"),Rt.publish("addPage",{pageNumber:Ft})},Vo=function(U){U>0&&U<=Ft&&(de.splice(U,1),Dt.splice(U,1),Ft--,H>Ft&&(H=Ft),this.setPage(H))},qo=function(U){U>0&&U<=Ft&&(H=U)},Zs=x.__private__.getNumberOfPages=x.getNumberOfPages=function(){return de.length-1},Hc=function(U,pe,Me){var We,et=void 0;return Me=Me||{},U=U!==void 0?U:st[qe].fontName,pe=pe!==void 0?pe:st[qe].fontStyle,We=U.toLowerCase(),Ve[We]!==void 0&&Ve[We][pe]!==void 0?et=Ve[We][pe]:Ve[U]!==void 0&&Ve[U][pe]!==void 0?et=Ve[U][pe]:Me.disableWarning===!1&&na.warn("Unable to look up font label for font '"+U+"', '"+pe+"'. Refer to getFontList() for available fonts."),et||Me.noFallback||(et=Ve.times[pe])==null&&(et=Ve.times.normal),et},ua=x.__private__.putInfo=function(){var U=Xr(),pe=function(We){return We};for(var Me in f!==null&&(pe=ai.encryptor(U,0)),ue("<<"),ue("/Producer ("+Wr(pe("jsPDF "+tr.version))+")"),xe)xe.hasOwnProperty(Me)&&xe[Me]&&ue("/"+Me.substr(0,1).toUpperCase()+Me.substr(1)+" ("+Wr(pe(xe[Me]))+")");ue("/CreationDate ("+Wr(pe(se))+")"),ue(">>"),ue("endobj")},Ql=x.__private__.putCatalog=function(U){var pe=(U=U||{}).rootDictionaryObjId||Ee;switch(Xr(),ue("<<"),ue("/Type /Catalog"),ue("/Pages "+pe+" 0 R"),Ne||(Ne="fullwidth"),Ne){case"fullwidth":ue("/OpenAction [3 0 R /FitH null]");break;case"fullheight":ue("/OpenAction [3 0 R /FitV null]");break;case"fullpage":ue("/OpenAction [3 0 R /Fit]");break;case"original":ue("/OpenAction [3 0 R /XYZ null null 1]");break;default:var Me=""+Ne;Me.substr(Me.length-1)==="%"&&(Ne=parseInt(Ne)/100),typeof Ne=="number"&&ue("/OpenAction [3 0 R /XYZ null null "+P(Ne)+"]")}switch(J||(J="continuous"),J){case"continuous":ue("/PageLayout /OneColumn");break;case"single":ue("/PageLayout /SinglePage");break;case"two":case"twoleft":ue("/PageLayout /TwoColumnLeft");break;case"tworight":ue("/PageLayout /TwoColumnRight")}Y&&ue("/PageMode /"+Y),Rt.publish("putCatalog"),ue(">>"),ue("endobj")},Wo=x.__private__.putTrailer=function(){ue("trailer"),ue("<<"),ue("/Size "+(re+1)),ue("/Root "+re+" 0 R"),ue("/Info "+(re-1)+" 0 R"),f!==null&&ue("/Encrypt "+ai.oid+" 0 R"),ue("/ID [ <"+Z+"> <"+Z+"> ]"),ue(">>")},pn=x.__private__.putHeader=function(){ue("%PDF-"+y),ue("%ºß¬à")},Vh=x.__private__.putXRef=function(){var U="0000000000";ue("xref"),ue("0 "+(re+1)),ue("0000000000 65535 f ");for(var pe=1;pe<=re;pe++)typeof he[pe]=="function"?ue((U+he[pe]()).slice(-10)+" 00000 n "):he[pe]!==void 0?ue((U+he[pe]).slice(-10)+" 00000 n "):ue("0000000000 00000 n ")},bl=x.__private__.buildDocument=function(){var U;re=0,z=0,oe=[],he=[],fe=[],Ee=Zr(),Te=Zr(),_e(oe),Rt.publish("buildDocument"),pn(),ft(),(function(){Rt.publish("putAdditionalObjects");for(var Me=0;Me<fe.length;Me++){var We=fe[Me];ye(We.objId,!0),ue(We.content),ue("endobj")}Rt.publish("postPutAdditionalObjects")})(),U=[],(function(){for(var Me in st)st.hasOwnProperty(Me)&&(m===!1||m===!0&&g.hasOwnProperty(Me))&&mt(st[Me])})(),(function(){var Me;for(Me in vt)vt.hasOwnProperty(Me)&&$t(vt[Me])})(),(function(){for(var Me in gr)gr.hasOwnProperty(Me)&&Lt(gr[Me])})(),(function(Me){var We;for(We in Ue)Ue.hasOwnProperty(We)&&(Ue[We]instanceof Cm?Vt(Ue[We]):Ue[We]instanceof Bp&&Xt(Ue[We],Me))})(U),Rt.publish("putResources"),U.forEach(Gt),Gt({resourcesOid:Te,objectOid:Number.MAX_SAFE_INTEGER}),Rt.publish("postPutResources"),f!==null&&(ai.oid=Xr(),ue("<<"),ue("/Filter /Standard"),ue("/V "+ai.v),ue("/R "+ai.r),ue("/U <"+ai.toHexString(ai.U)+">"),ue("/O <"+ai.toHexString(ai.O)+">"),ue("/P "+ai.P),ue(">>"),ue("endobj")),ua(),Ql();var pe=z;return Vh(),Wo(),ue("startxref"),ue(""+pe),ue("%%EOF"),_e(de[H]),oe.join(`
`)},Vc=x.__private__.getBlob=function(U){return new Blob([$e(U)],{type:"application/pdf"})},xf=function(U){for(;U.firstChild;)U.removeChild(U.firstChild)},Gi=function(U){var pe,Me=U.document,We=Me.documentElement,et=Me.head,Nt=Me.body;return et||(et=Me.createElement("head"),We.appendChild(et)),Nt||(Nt=Me.createElement("body"),We.appendChild(Nt)),xf(et),xf(Nt),(pe=Me.createElement("style")).appendChild(Me.createTextNode("html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}")),et.appendChild(pe),{document:Me,body:Nt}},gf=x.output=x.__private__.output=(qr=function(U,pe){switch(typeof(pe=pe||{})=="string"?pe={filename:pe}:pe.filename=pe.filename||"generated.pdf",U){case void 0:return bl();case"save":x.save(pe.filename);break;case"arraybuffer":return $e(bl());case"blob":return Vc(bl());case"bloburi":case"bloburl":if(Or.URL!==void 0&&typeof Or.URL.createObjectURL=="function")return Or.URL&&Or.URL.createObjectURL(Vc(bl()))||void 0;na.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var Me="",We=bl();try{Me=oF(We)}catch{Me=oF(unescape(encodeURIComponent(We)))}return"data:application/pdf;filename="+encodeURIComponent(pe.filename)+";base64,"+Me;case"pdfobjectnewwindow":if(Object.prototype.toString.call(Or)==="[object Window]"){var et="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",Nt=!pe.pdfObjectUrl;Nt||(et=pe.pdfObjectUrl);var Pt=Or.open();if(Pt!==null){var rr=Gi(Pt),or=rr.document.createElement("script"),Pr=this;or.src=et,Nt&&(or.integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==",or.crossOrigin="anonymous"),or.onload=function(){Pt.PDFObject.embed(Pr.output("dataurlstring"),pe)},rr.body.appendChild(or)}return Pt}throw new Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if(Object.prototype.toString.call(Or)==="[object Window]"){var Mr=pe.pdfJsUrl||"examples/PDF.js/web/viewer.html",en=Or.open();if(en!==null){var $a=Gi(en),Mn=$a.document.createElement("iframe"),Dn=Mr.indexOf("?")===-1?"?":"&";Pr=this,Mn.id="pdfViewer",Mn.width="500px",Mn.height="400px",Mn.src=Mr+Dn+"file=&downloadName="+encodeURIComponent(pe.filename),Mn.onload=function(){en.document.title=pe.filename,Mn.contentWindow.PDFViewerApplication.open(Pr.output("bloburl"))},$a.body.appendChild(Mn)}return en}throw new Error("The option pdfjsnewwindow just works in a browser-environment.");case"dataurlnewwindow":if(Object.prototype.toString.call(Or)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var Jn=Or.open();if(Jn!==null){var da=Gi(Jn),fa=da.document.createElement("iframe");fa.src=this.output("datauristring",pe),da.body.appendChild(fa),Jn.document.title=pe.filename}if(Jn||typeof safari>"u")return Jn;break;case"datauri":case"dataurl":return Or.document.location.href=this.output("datauristring",pe);default:return null}},qr.foo=function(){try{return qr.apply(this,arguments)}catch(Me){var U=Me.stack||"";~U.indexOf(" at ")&&(U=U.split(" at ")[1]);var pe="Error in function "+U.split(`
`)[0].split("<")[0]+": "+Me.message;if(!Or.console)throw new Error(pe);Or.console.error(pe,Me),Or.alert&&alert(pe)}},qr.foo.bar=qr,qr.foo),Ua=function(U){return Array.isArray(wr)===!0&&wr.indexOf(U)>-1};switch(n){case"pt":me=1;break;case"mm":me=72/25.4;break;case"cm":me=72/2.54;break;case"in":me=72;break;case"px":me=Ua("px_scaling")==1?.75:96/72;break;case"pc":case"em":me=12;break;case"ex":me=6;break;default:if(typeof n!="number")throw new Error("Invalid unit: "+n);me=n}var ai=null;ce(),X();var qh=x.__private__.getPageInfo=x.getPageInfo=function(U){if(isNaN(U)||U%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:Dt[U].objId,pageNumber:U,pageContext:Dt[U]}},Wh=x.__private__.getPageInfoByObjId=function(U){if(isNaN(U)||U%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var pe in Dt)if(Dt[pe].objId===U)break;return qh(pe)},qc=x.__private__.getCurrentPageInfo=x.getCurrentPageInfo=function(){return{objId:Dt[H].objId,pageNumber:H,pageContext:Dt[H]}};x.addPage=function(){return xs.apply(this,arguments),this},x.setPage=function(){return qo.apply(this,arguments),_e.call(this,de[H]),this},x.insertPage=function(U){return this.addPage(),this.movePage(H,U),this},x.movePage=function(U,pe){var Me,We;if(U>pe){Me=de[U],We=Dt[U];for(var et=U;et>pe;et--)de[et]=de[et-1],Dt[et]=Dt[et-1];de[pe]=Me,Dt[pe]=We,this.setPage(pe)}else if(U<pe){Me=de[U],We=Dt[U];for(var Nt=U;Nt<pe;Nt++)de[Nt]=de[Nt+1],Dt[Nt]=Dt[Nt+1];de[pe]=Me,Dt[pe]=We,this.setPage(pe)}return this},x.deletePage=function(){return Vo.apply(this,arguments),this},x.__private__.text=x.text=function(U,pe,Me,We,et){var Nt,Pt,rr,or,Pr,Mr,en,$a,Mn,Dn=(We=We||{}).scope||this;if(typeof U=="number"&&typeof pe=="number"&&(typeof Me=="string"||Array.isArray(Me))){var Jn=Me;Me=pe,pe=U,U=Jn}if(arguments[3]instanceof Ht==0?(rr=arguments[4],or=arguments[5],Un(en=arguments[3])==="object"&&en!==null||(typeof rr=="string"&&(or=rr,rr=null),typeof en=="string"&&(or=en,en=null),typeof en=="number"&&(rr=en,en=null),We={flags:en,angle:rr,align:or})):(I("The transform parameter of text() with a Matrix value"),Mn=et),isNaN(pe)||isNaN(Me)||U==null)throw new Error("Invalid arguments passed to jsPDF.text");if(U.length===0)return Dn;var da,fa="",Ki=typeof We.lineHeightFactor=="number"?We.lineHeightFactor:go,oc=Dn.internal.scaleFactor;function Jh(xn){return xn=xn.split("	").join(Array(We.TabLen||9).join(" ")),Wr(xn,en)}function lc(xn){for(var On,ka=xn.concat(),Qn=[],Sl=ka.length;Sl--;)typeof(On=ka.shift())=="string"?Qn.push(On):Array.isArray(xn)&&(On.length===1||On[1]===void 0&&On[2]===void 0)?Qn.push(On[0]):Qn.push([On[0],On[1],On[2]]);return Qn}function Qo(xn,On){var ka;if(typeof xn=="string")ka=On(xn)[0];else if(Array.isArray(xn)){for(var Qn,Sl,kf=xn.concat(),pd=[],R0=kf.length;R0--;)typeof(Qn=kf.shift())=="string"?pd.push(On(Qn)[0]):Array.isArray(Qn)&&typeof Qn[0]=="string"&&(Sl=On(Qn[0],Qn[1],Qn[2]),pd.push([Sl[0],Sl[1],Sl[2]]));ka=pd}return ka}var Gc=!1,Yc=!0;if(typeof U=="string")Gc=!0;else if(Array.isArray(U)){var id=U.concat();Pt=[];for(var sd,ki=id.length;ki--;)(typeof(sd=id.shift())!="string"||Array.isArray(sd)&&typeof sd[0]!="string")&&(Yc=!1);Gc=Yc}if(Gc===!1)throw new Error('Type of text must be string or Array. "'+U+'" is not recognized.');typeof U=="string"&&(U=U.match(/[\r?\n]/)?U.split(/\r\n|\r|\n/g):[U]);var Kc=Xe/Dn.internal.scaleFactor,vo=Kc*(Ki-1);switch(We.baseline){case"bottom":Me-=vo;break;case"top":Me+=Kc-vo;break;case"hanging":Me+=Kc-2*vo;break;case"middle":Me+=Kc/2-vo}if((Mr=We.maxWidth||0)>0&&(typeof U=="string"?U=Dn.splitTextToSize(U,Mr):Object.prototype.toString.call(U)==="[object Array]"&&(U=U.reduce(function(xn,On){return xn.concat(Dn.splitTextToSize(On,Mr))},[]))),Nt={text:U,x:pe,y:Me,options:We,mutex:{pdfEscape:Wr,activeFontKey:qe,fonts:st,activeFontSize:Xe}},Rt.publish("preProcessText",Nt),U=Nt.text,rr=(We=Nt.options).angle,Mn instanceof Ht==0&&rr&&typeof rr=="number"){rr*=Math.PI/180,We.rotationDirection===0&&(rr=-rr),T===A&&(rr=-rr);var Qh=Math.cos(rr),Nl=Math.sin(rr);Mn=new Ht(Qh,Nl,-Nl,Qh,0,0)}else rr&&rr instanceof Ht&&(Mn=rr);T!==A||Mn||(Mn=Rr),(Pr=We.charSpace||td)!==void 0&&(fa+=F(K(Pr))+` Tc
`,this.setCharSpace(this.getCharSpace()||0)),($a=We.horizontalScale)!==void 0&&(fa+=F(100*$a)+` Tz
`),We.lang;var gs=-1,em=We.renderingMode!==void 0?We.renderingMode:We.stroke,od=Dn.internal.getCurrentPageInfo().pageContext;switch(em){case 0:case!1:case"fill":gs=0;break;case 1:case!0:case"stroke":gs=1;break;case 2:case"fillThenStroke":gs=2;break;case 3:case"invisible":gs=3;break;case 4:case"fillAndAddForClipping":gs=4;break;case 5:case"strokeAndAddPathForClipping":gs=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":gs=6;break;case 7:case"addToPathForClipping":gs=7}var Xc=od.usedRenderingMode!==void 0?od.usedRenderingMode:-1;gs!==-1?fa+=gs+` Tr
`:Xc!==-1&&(fa+=`0 Tr
`),gs!==-1&&(od.usedRenderingMode=gs),or=We.align||"left";var Xi,ld=Xe*Ki,Zc=Dn.internal.pageSize.getWidth(),cd=st[qe];Pr=We.charSpace||td,Mr=We.maxWidth||0,en=Object.assign({autoencode:!0,noBOM:!0},We.flags);var Jc=[],ud=function(xn){return Dn.getStringUnitWidth(xn,{font:cd,charSpace:Pr,fontSize:Xe,doKerning:!1})*Xe/oc};if(Object.prototype.toString.call(U)==="[object Array]"){var Ci;Pt=lc(U),or!=="left"&&(Xi=Pt.map(ud));var vs,dd=0;if(or==="right"){pe-=Xi[0],U=[],ki=Pt.length;for(var cc=0;cc<ki;cc++)cc===0?(vs=Xo(pe),Ci=Js(Me)):(vs=K(dd-Xi[cc]),Ci=-ld),U.push([Pt[cc],vs,Ci]),dd=Xi[cc]}else if(or==="center"){pe-=Xi[0]/2,U=[],ki=Pt.length;for(var Qc=0;Qc<ki;Qc++)Qc===0?(vs=Xo(pe),Ci=Js(Me)):(vs=K((dd-Xi[Qc])/2),Ci=-ld),U.push([Pt[Qc],vs,Ci]),dd=Xi[Qc]}else if(or==="left"){U=[],ki=Pt.length;for(var Nf=0;Nf<ki;Nf++)U.push(Pt[Nf])}else if(or==="justify"&&cd.encoding==="Identity-H"){U=[],ki=Pt.length,Mr=Mr!==0?Mr:Zc;for(var fd=0,Ha=0;Ha<ki;Ha++)if(Ci=Ha===0?Js(Me):-ld,vs=Ha===0?Xo(pe):fd,Ha<ki-1){var Hx=K((Mr-Xi[Ha])/(Pt[Ha].split(" ").length-1)),Aa=Pt[Ha].split(" ");U.push([Aa[0]+" ",vs,Ci]),fd=0;for(var ys=1;ys<Aa.length;ys++){var eu=(ud(Aa[ys-1]+" "+Aa[ys])-ud(Aa[ys]))*oc+Hx;ys==Aa.length-1?U.push([Aa[ys],eu,0]):U.push([Aa[ys]+" ",eu,0]),fd-=eu}}else U.push([Pt[Ha],vs,Ci]);U.push(["",fd,0])}else{if(or!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(U=[],ki=Pt.length,Mr=Mr!==0?Mr:Zc,Ha=0;Ha<ki;Ha++){Ci=Ha===0?Js(Me):-ld,vs=Ha===0?Xo(pe):0;var Sf=Pt[Ha].split(" ").length-1,Af=Sf>0?(Mr-Xi[Ha])/Sf:0;Ha<ki-1?Jc.push(F(K(Af))):Jc.push(0),U.push([Pt[Ha],vs,Ci])}}}(typeof We.R2L=="boolean"?We.R2L:at)===!0&&(U=Qo(U,function(xn,On,ka){return[xn.split("").reverse().join(""),On,ka]})),Nt={text:U,x:pe,y:Me,options:We,mutex:{pdfEscape:Wr,activeFontKey:qe,fonts:st,activeFontSize:Xe}},Rt.publish("postProcessText",Nt),U=Nt.text,da=Nt.mutex.isHex||!1;var hd=st[qe].encoding;hd!=="WinAnsiEncoding"&&hd!=="StandardEncoding"||(U=Qo(U,function(xn,On,ka){return[Jh(xn),On,ka]})),Pt=lc(U),U=[];for(var uc,md,eo,el=Array.isArray(Pt[0])?1:0,yo="",tu=function(xn,On,ka){var Qn="";return ka instanceof Ht?(ka=typeof We.angle=="number"?It(ka,new Ht(1,0,0,1,xn,On)):It(new Ht(1,0,0,1,xn,On),ka),T===A&&(ka=It(new Ht(1,0,0,-1,0,0),ka)),Qn=ka.join(" ")+` Tm
`):Qn=F(xn)+" "+F(On)+` Td
`,Qn},_i=0;_i<Pt.length;_i++){switch(yo="",el){case 1:eo=(da?"<":"(")+Pt[_i][0]+(da?">":")"),uc=parseFloat(Pt[_i][1]),md=parseFloat(Pt[_i][2]);break;case 0:eo=(da?"<":"(")+Pt[_i]+(da?">":")"),uc=Xo(pe),md=Js(Me)}Jc!==void 0&&Jc[_i]!==void 0&&(yo=Jc[_i]+` Tw
`),_i===0?U.push(yo+tu(uc,md,Mn)+eo):el===0?U.push(yo+eo):el===1&&U.push(yo+tu(uc,md,Mn)+eo)}U=el===0?U.join(` Tj
T* `):U.join(` Tj
`),U+=` Tj
`;var Zi=`BT
/`;return Zi+=qe+" "+Xe+` Tf
`,Zi+=F(Xe*Ki)+` TL
`,Zi+=Qs+`
`,Zi+=fa,Zi+=U,ue(Zi+="ET"),g[qe]=!0,Dn};var _0=x.__private__.clip=x.clip=function(U){return ue(U==="evenodd"?"W*":"W"),this};x.clipEvenOdd=function(){return _0("evenodd")},x.__private__.discardPath=x.discardPath=function(){return ue("n"),this};var Go=x.__private__.isValidStyle=function(U){var pe=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(U)!==-1&&(pe=!0),pe};x.__private__.setDefaultPathOperation=x.setDefaultPathOperation=function(U){return Go(U)&&(d=U),this};var ec=x.__private__.getStyle=x.getStyle=function(U){var pe=d;switch(U){case"D":case"S":pe="S";break;case"F":pe="f";break;case"FD":case"DF":pe="B";break;case"f":case"f*":case"B":case"B*":pe=U}return pe},vf=x.close=function(){return ue("h"),this};x.stroke=function(){return ue("S"),this},x.fill=function(U){return Qu("f",U),this},x.fillEvenOdd=function(U){return Qu("f*",U),this},x.fillStroke=function(U){return Qu("B",U),this},x.fillStrokeEvenOdd=function(U){return Qu("B*",U),this};var Qu=function(U,pe){Un(pe)==="object"?Ux(pe,U):ue(U)},yf=function(U){U===null||T===A&&U===void 0||(U=ec(U),ue(U))};function Gh(U,pe,Me,We,et){var Nt=new Bp(pe||this.boundingBox,Me||this.xStep,We||this.yStep,this.gState,et||this.matrix);Nt.stream=this.stream;var Pt=U+"$$"+this.cloneIndex+++"$$";return kr(Pt,Nt),Nt}var Ux=function(U,pe){var Me=ot[U.key],We=Ue[Me];if(We instanceof Cm)ue("q"),ue($x(pe)),We.gState&&x.setGState(We.gState),ue(U.matrix.toString()+" cm"),ue("/"+Me+" sh"),ue("Q");else if(We instanceof Bp){var et=new Ht(1,0,0,-1,0,ad());U.matrix&&(et=et.multiply(U.matrix||Rr),Me=Gh.call(We,U.key,U.boundingBox,U.xStep,U.yStep,et).id),ue("q"),ue("/Pattern cs"),ue("/"+Me+" scn"),We.gState&&x.setGState(We.gState),ue(pe),ue("Q")}},$x=function(U){switch(U){case"f":case"F":case"n":return"W n";case"f*":return"W* n";case"B":case"S":return"W S";case"B*":return"W* S"}},Yo=x.moveTo=function(U,pe){return ue(F(K(U))+" "+F(ee(pe))+" m"),this},xo=x.lineTo=function(U,pe){return ue(F(K(U))+" "+F(ee(pe))+" l"),this},wl=x.curveTo=function(U,pe,Me,We,et,Nt){return ue([F(K(U)),F(ee(pe)),F(K(Me)),F(ee(We)),F(K(et)),F(ee(Nt)),"c"].join(" ")),this};x.__private__.line=x.line=function(U,pe,Me,We,et){if(isNaN(U)||isNaN(pe)||isNaN(Me)||isNaN(We)||!Go(et))throw new Error("Invalid arguments passed to jsPDF.line");return T===k?this.lines([[Me-U,We-pe]],U,pe,[1,1],et||"S"):this.lines([[Me-U,We-pe]],U,pe,[1,1]).stroke()},x.__private__.lines=x.lines=function(U,pe,Me,We,et,Nt){var Pt,rr,or,Pr,Mr,en,$a,Mn,Dn,Jn,da,fa;if(typeof U=="number"&&(fa=Me,Me=pe,pe=U,U=fa),We=We||[1,1],Nt=Nt||!1,isNaN(pe)||isNaN(Me)||!Array.isArray(U)||!Array.isArray(We)||!Go(et)||typeof Nt!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(Yo(pe,Me),Pt=We[0],rr=We[1],Pr=U.length,Jn=pe,da=Me,or=0;or<Pr;or++)(Mr=U[or]).length===2?(Jn=Mr[0]*Pt+Jn,da=Mr[1]*rr+da,xo(Jn,da)):(en=Mr[0]*Pt+Jn,$a=Mr[1]*rr+da,Mn=Mr[2]*Pt+Jn,Dn=Mr[3]*rr+da,Jn=Mr[4]*Pt+Jn,da=Mr[5]*rr+da,wl(en,$a,Mn,Dn,Jn,da));return Nt&&vf(),yf(et),this},x.path=function(U){for(var pe=0;pe<U.length;pe++){var Me=U[pe],We=Me.c;switch(Me.op){case"m":Yo(We[0],We[1]);break;case"l":xo(We[0],We[1]);break;case"c":wl.apply(this,We);break;case"h":vf()}}return this},x.__private__.rect=x.rect=function(U,pe,Me,We,et){if(isNaN(U)||isNaN(pe)||isNaN(Me)||isNaN(We)||!Go(et))throw new Error("Invalid arguments passed to jsPDF.rect");return T===k&&(We=-We),ue([F(K(U)),F(ee(pe)),F(K(Me)),F(K(We)),"re"].join(" ")),yf(et),this},x.__private__.triangle=x.triangle=function(U,pe,Me,We,et,Nt,Pt){if(isNaN(U)||isNaN(pe)||isNaN(Me)||isNaN(We)||isNaN(et)||isNaN(Nt)||!Go(Pt))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[Me-U,We-pe],[et-Me,Nt-We],[U-et,pe-Nt]],U,pe,[1,1],Pt,!0),this},x.__private__.roundedRect=x.roundedRect=function(U,pe,Me,We,et,Nt,Pt){if(isNaN(U)||isNaN(pe)||isNaN(Me)||isNaN(We)||isNaN(et)||isNaN(Nt)||!Go(Pt))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var rr=4/3*(Math.SQRT2-1);return et=Math.min(et,.5*Me),Nt=Math.min(Nt,.5*We),this.lines([[Me-2*et,0],[et*rr,0,et,Nt-Nt*rr,et,Nt],[0,We-2*Nt],[0,Nt*rr,-et*rr,Nt,-et,Nt],[2*et-Me,0],[-et*rr,0,-et,-Nt*rr,-et,-Nt],[0,2*Nt-We],[0,-Nt*rr,et*rr,-Nt,et,-Nt]],U+et,pe,[1,1],Pt,!0),this},x.__private__.ellipse=x.ellipse=function(U,pe,Me,We,et){if(isNaN(U)||isNaN(pe)||isNaN(Me)||isNaN(We)||!Go(et))throw new Error("Invalid arguments passed to jsPDF.ellipse");var Nt=4/3*(Math.SQRT2-1)*Me,Pt=4/3*(Math.SQRT2-1)*We;return Yo(U+Me,pe),wl(U+Me,pe-Pt,U+Nt,pe-We,U,pe-We),wl(U-Nt,pe-We,U-Me,pe-Pt,U-Me,pe),wl(U-Me,pe+Pt,U-Nt,pe+We,U,pe+We),wl(U+Nt,pe+We,U+Me,pe+Pt,U+Me,pe),yf(et),this},x.__private__.circle=x.circle=function(U,pe,Me,We){if(isNaN(U)||isNaN(pe)||isNaN(Me)||!Go(We))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(U,pe,Me,Me,We)},x.setFont=function(U,pe,Me){return Me&&(pe=L(pe,Me)),qe=Hc(U,pe,{disableWarning:!1}),this};var Yh=x.__private__.getFont=x.getFont=function(){return st[Hc.apply(x,arguments)]};x.__private__.getFontList=x.getFontList=function(){var U,pe,Me={};for(U in Ve)if(Ve.hasOwnProperty(U))for(pe in Me[U]=[],Ve[U])Ve[U].hasOwnProperty(pe)&&Me[U].push(pe);return Me},x.addFont=function(U,pe,Me,We,et){var Nt=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&Nt.indexOf(arguments[3])!==-1?et=arguments[3]:arguments[3]&&Nt.indexOf(arguments[3])==-1&&(Me=L(Me,We)),An.call(this,U,pe,Me,et=et||"Identity-H")};var go,jr=e.lineWidth||.200025,E0=x.__private__.getLineWidth=x.getLineWidth=function(){return jr},Kh=x.__private__.setLineWidth=x.setLineWidth=function(U){return jr=U,ue(F(K(U))+" w"),this};x.__private__.setLineDash=tr.API.setLineDash=tr.API.setLineDashPattern=function(U,pe){if(U=U||[],pe=pe||0,isNaN(pe)||!Array.isArray(U))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return U=U.map(function(Me){return F(K(Me))}).join(" "),pe=F(K(pe)),ue("["+U+"] "+pe+" d"),this};var T0=x.__private__.getLineHeight=x.getLineHeight=function(){return Xe*go};x.__private__.getLineHeight=x.getLineHeight=function(){return Xe*go};var ed=x.__private__.setLineHeightFactor=x.setLineHeightFactor=function(U){return typeof(U=U||1.15)=="number"&&(go=U),this},Ko=x.__private__.getLineHeightFactor=x.getLineHeightFactor=function(){return go};ed(e.lineHeight);var Xo=x.__private__.getHorizontalCoordinate=function(U){return K(U)},Js=x.__private__.getVerticalCoordinate=function(U){return T===A?U:Dt[H].mediaBox.topRightY-Dt[H].mediaBox.bottomLeftY-K(U)},jl=x.__private__.getHorizontalCoordinateString=x.getHorizontalCoordinateString=function(U){return F(Xo(U))},Xh=x.__private__.getVerticalCoordinateString=x.getVerticalCoordinateString=function(U){return F(Js(U))},tc=e.strokeColor||"0 G";x.__private__.getStrokeColor=x.getDrawColor=function(){return Re(tc)},x.__private__.setStrokeColor=x.setDrawColor=function(U,pe,Me,We){return tc=ze({ch1:U,ch2:pe,ch3:Me,ch4:We,pdfColorType:"draw",precision:2}),ue(tc),this};var bf=e.fillColor||"0 g";x.__private__.getFillColor=x.getFillColor=function(){return Re(bf)},x.__private__.setFillColor=x.setFillColor=function(U,pe,Me,We){return bf=ze({ch1:U,ch2:pe,ch3:Me,ch4:We,pdfColorType:"fill",precision:2}),ue(bf),this};var Qs=e.textColor||"0 g",wf=x.__private__.getTextColor=x.getTextColor=function(){return Re(Qs)};x.__private__.setTextColor=x.setTextColor=function(U,pe,Me,We){return Qs=ze({ch1:U,ch2:pe,ch3:Me,ch4:We,pdfColorType:"text",precision:3}),this};var td=e.charSpace,Yi=x.__private__.getCharSpace=x.getCharSpace=function(){return parseFloat(td||0)};x.__private__.setCharSpace=x.setCharSpace=function(U){if(isNaN(U))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return td=U,this};var Zo=0;x.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},x.__private__.setLineCap=x.setLineCap=function(U){var pe=x.CapJoinStyles[U];if(pe===void 0)throw new Error("Line cap style of '"+U+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Zo=pe,ue(pe+" J"),this};var Jo=0;x.__private__.setLineJoin=x.setLineJoin=function(U){var pe=x.CapJoinStyles[U];if(pe===void 0)throw new Error("Line join style of '"+U+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Jo=pe,ue(pe+" j"),this},x.__private__.setLineMiterLimit=x.__private__.setMiterLimit=x.setLineMiterLimit=x.setMiterLimit=function(U){if(U=U||0,isNaN(U))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return ue(F(K(U))+" M"),this},x.GState=Sw,x.setGState=function(U){(U=typeof U=="string"?vt[_t[U]]:rc(null,U)).equals(qt)||(ue("/"+U.id+" gs"),qt=U)};var rc=function(U,pe){if(!U||!_t[U]){var Me=!1;for(var We in vt)if(vt.hasOwnProperty(We)&&vt[We].equals(pe)){Me=!0;break}if(Me)pe=vt[We];else{var et="GS"+(Object.keys(vt).length+1).toString(10);vt[et]=pe,pe.id=et}return U&&(_t[U]=pe.id),Rt.publish("addGState",pe),pe}};x.addGState=function(U,pe){return rc(U,pe),this},x.saveGraphicsState=function(){return ue("q"),te.push({key:qe,size:Xe,color:Qs}),this},x.restoreGraphicsState=function(){ue("Q");var U=te.pop();return qe=U.key,Xe=U.size,Qs=U.color,qt=null,this},x.setCurrentTransformationMatrix=function(U){return ue(U.toString()+" cm"),this},x.comment=function(U){return ue("#"+U),this};var rd=function(U,pe){var Me=U||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return Me},set:function(Nt){isNaN(Nt)||(Me=parseFloat(Nt))}});var We=pe||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return We},set:function(Nt){isNaN(Nt)||(We=parseFloat(Nt))}});var et="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return et},set:function(Nt){et=Nt.toString()}}),this},nd=function(U,pe,Me,We){rd.call(this,U,pe),this.type="rect";var et=Me||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return et},set:function(Pt){isNaN(Pt)||(et=parseFloat(Pt))}});var Nt=We||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return Nt},set:function(Pt){isNaN(Pt)||(Nt=parseFloat(Pt))}}),this},Wc=function(){this.page=Ft,this.currentPage=H,this.pages=de.slice(0),this.pagesContext=Dt.slice(0),this.x=Ge,this.y=Be,this.matrix=it,this.width=Zh(H),this.height=sc(H),this.outputDestination=ae,this.id="",this.objectNumber=-1};Wc.prototype.restore=function(){Ft=this.page,H=this.currentPage,Dt=this.pagesContext,de=this.pages,Ge=this.x,Be=this.y,it=this.matrix,ic(H,this.width),P0(H,this.height),ae=this.outputDestination};var nc=function(U,pe,Me,We,et){Ur.push(new Wc),Ft=H=0,de=[],Ge=U,Be=pe,it=et,Pn([Me,We])};for(var ac in x.beginFormObject=function(U,pe,Me,We,et){return nc(U,pe,Me,We,et),this},x.endFormObject=function(U){return(function(pe){if(Er[pe])Ur.pop().restore();else{var Me=new Wc,We="Xo"+(Object.keys(gr).length+1).toString(10);Me.id=We,Er[pe]=We,gr[We]=Me,Rt.publish("addFormObject",Me),Ur.pop().restore()}})(U),this},x.doFormObject=function(U,pe){var Me=gr[Er[U]];return ue("q"),ue(pe.toString()+" cm"),ue("/"+Me.id+" Do"),ue("Q"),this},x.getFormObject=function(U){var pe=gr[Er[U]];return{x:pe.x,y:pe.y,width:pe.width,height:pe.height,matrix:pe.matrix}},x.save=function(U,pe){return U=U||"generated.pdf",(pe=pe||{}).returnPromise=pe.returnPromise||!1,pe.returnPromise===!1?(km(Vc(bl()),U),typeof km.unload=="function"&&Or.setTimeout&&setTimeout(km.unload,911),this):new Promise(function(Me,We){try{var et=km(Vc(bl()),U);typeof km.unload=="function"&&Or.setTimeout&&setTimeout(km.unload,911),Me(et)}catch(Nt){We(Nt.message)}})},tr.API)tr.API.hasOwnProperty(ac)&&(ac==="events"&&tr.API.events.length?(function(U,pe){var Me,We,et;for(et=pe.length-1;et!==-1;et--)Me=pe[et][0],We=pe[et][1],U.subscribe.apply(U,[Me].concat(typeof We=="function"?[We]:We))})(Rt,tr.API.events):x[ac]=tr.API[ac]);function Zh(U){return Dt[U].mediaBox.topRightX-Dt[U].mediaBox.bottomLeftX}function ic(U,pe){Dt[U].mediaBox.topRightX=pe+Dt[U].mediaBox.bottomLeftX}function sc(U){return Dt[U].mediaBox.topRightY-Dt[U].mediaBox.bottomLeftY}function P0(U,pe){Dt[U].mediaBox.topRightY=pe+Dt[U].mediaBox.bottomLeftY}var jf=x.getPageWidth=function(U){return Zh(U=U||H)/me},D0=x.setPageWidth=function(U,pe){ic(U,pe*me)},ad=x.getPageHeight=function(U){return sc(U=U||H)/me},O0=x.setPageHeight=function(U,pe){P0(U,pe*me)};return x.internal={pdfEscape:Wr,getStyle:ec,getFont:Yh,getFontSize:Ye,getCharSpace:Yi,getTextColor:wf,getLineHeight:T0,getLineHeightFactor:Ko,getLineWidth:E0,write:ke,getHorizontalCoordinate:Xo,getVerticalCoordinate:Js,getCoordinateString:jl,getVerticalCoordinateString:Xh,collections:{},newObject:Xr,newAdditionalObject:Ie,newObjectDeferred:Zr,newObjectDeferredBegin:ye,getFilters:ct,putStream:bt,events:Rt,scaleFactor:me,pageSize:{getWidth:function(){return jf(H)},setWidth:function(U){D0(H,U)},getHeight:function(){return ad(H)},setHeight:function(U){O0(H,U)}},encryptionOptions:f,encryption:ai,getEncryptor:function(U){return f!==null?ai.encryptor(U,0):function(pe){return pe}},output:gf,getNumberOfPages:Zs,get pages(){return de},out:ue,f2:P,f3:R,getPageInfo:qh,getPageInfoByObjId:Wh,getCurrentPageInfo:qc,getPDFVersion:v,Point:rd,Rectangle:nd,Matrix:Ht,hasHotfix:Ua},Object.defineProperty(x.internal.pageSize,"width",{get:function(){return jf(H)},set:function(U){D0(H,U)},enumerable:!0,configurable:!0}),Object.defineProperty(x.internal.pageSize,"height",{get:function(){return ad(H)},set:function(U){O0(H,U)},enumerable:!0,configurable:!0}),(function(U){for(var pe=0,Me=Je.length;pe<Me;pe++){var We=An.call(this,U[pe][0],U[pe][1],U[pe][2],Je[pe][3],!0);m===!1&&(g[We]=!0);var et=U[pe][0].split("-");er({id:We,fontName:et[0],fontStyle:et[1]||""})}Rt.publish("addFonts",{fonts:st,dictionary:Ve})}).call(x,Je),qe="F1",xs(a,r),Rt.publish("initialized"),x}Tp.prototype.lsbFirstWord=function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)},Tp.prototype.toHexString=function(e){return e.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},Tp.prototype.hexToBytes=function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(String.fromCharCode(parseInt(e.substr(r,2),16)));return t.join("")},Tp.prototype.processOwnerPassword=function(e,t){return ek(QA(t).substr(0,5),e)},Tp.prototype.encryptor=function(e,t){var r=QA(this.encryptionKey+String.fromCharCode(255&e,e>>8&255,e>>16&255,255&t,t>>8&255)).substr(0,10);return function(n){return ek(r,n)}},Sw.prototype.equals=function(e){var t,r="id,objectNumber,equals";if(!e||Un(e)!==Un(this))return!1;var n=0;for(t in this)if(!(r.indexOf(t)>=0)){if(this.hasOwnProperty(t)&&!e.hasOwnProperty(t)||this[t]!==e[t])return!1;n++}for(t in e)e.hasOwnProperty(t)&&r.indexOf(t)<0&&n--;return n===0},tr.API={events:[]},tr.version="4.2.1";var Xa=tr.API,cE=1,w0=function(e){return e.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},jp=function(e){return e.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},l0=function(e){return e.toString().replace(/#/g,"#23").replace(/[\s\n\r()<>[\]{}\/%]/g,function(t){var r=t.charCodeAt(0).toString(16).toUpperCase();return"#"+(r.length===1?"0"+r:r)})},Fr=function(e){return e.toFixed(2)},th=function(e){return e.toFixed(5)};Xa.__acroform__={};var Ho=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},dF=function(e){return e*cE},Nu=function(e){var t=new CW,r=fr.internal.getHeight(e)||0,n=fr.internal.getWidth(e)||0;return t.BBox=[0,0,Number(Fr(n)),Number(Fr(r))],t},DSe=Xa.__acroform__.setBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return e|1<<t},OSe=Xa.__acroform__.clearBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return e&~(1<<t)},RSe=Xa.__acroform__.getBit=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return e&1<<t?1:0},ci=Xa.__acroform__.getBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return RSe(e,t-1)},ui=Xa.__acroform__.setBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return DSe(e,t-1)},di=Xa.__acroform__.clearBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return OSe(e,t-1)},MSe=Xa.__acroform__.calculateCoordinates=function(e,t){var r=t.internal.getHorizontalCoordinate,n=t.internal.getVerticalCoordinate,a=e[0],s=e[1],o=e[2],l=e[3],u={};return u.lowerLeft_X=r(a)||0,u.lowerLeft_Y=n(s+l)||0,u.upperRight_X=r(a+o)||0,u.upperRight_Y=n(s)||0,[Number(Fr(u.lowerLeft_X)),Number(Fr(u.lowerLeft_Y)),Number(Fr(u.upperRight_X)),Number(Fr(u.upperRight_Y))]},LSe=function(e){if(e.appearanceStreamContent)return e.appearanceStreamContent;if(e.V||e.DV){var t=[],r=e._V||e.DV,n=tk(e,r),a=e.scope.internal.getFont(e.fontName,e.fontStyle).id;t.push("/Tx BMC"),t.push("q"),t.push("BT"),t.push(e.scope.__private__.encodeColorString(e.color)),t.push("/"+a+" "+Fr(n.fontSize)+" Tf"),t.push("1 0 0 1 0 0 Tm"),t.push(n.text),t.push("ET"),t.push("Q"),t.push("EMC");var s=Nu(e);return s.scope=e.scope,s.stream=t.join(`
`),s}},tk=function(e,t){var r=e.fontSize===0?e.maxFontSize:e.fontSize,n={text:"",fontSize:""},a=(t=(t=t.substr(0,1)=="("?t.substr(1):t).substr(t.length-1)==")"?t.substr(0,t.length-1):t).split(" ");a=e.multiline?a.map(function(P){return P.split(`
`)}):a.map(function(P){return[P]});var s=r,o=fr.internal.getHeight(e)||0;o=o<0?-o:o;var l=fr.internal.getWidth(e)||0;l=l<0?-l:l;var u=function(P,R,K){if(P+1<a.length){var ee=R+" "+a[P+1][0];return mb(ee,e,K).width<=l-4}return!1};s++;e:for(;s>0;){t="",s--;var d,f,m=mb("3",e,s).height,g=e.multiline?o-s:(o-m)/2,x=g+=2,y=0,v=0,w=0;if(s<=0){t=`(...) Tj
`,t+="% Width of Text: "+mb(t,e,s=12).width+", FieldWidth:"+l+`
`;break}for(var j="",k=0,A=0;A<a.length;A++)if(a.hasOwnProperty(A)){var T=!1;if(a[A].length!==1&&w!==a[A].length-1){if((m+2)*(k+2)+2>o)continue e;j+=a[A][w],T=!0,v=A,A--}else{j=(j+=a[A][w]+" ").substr(j.length-1)==" "?j.substr(0,j.length-1):j;var M=parseInt(A),B=u(M,j,s),L=A>=a.length-1;if(B&&!L){j+=" ",w=0;continue}if(B||L){if(L)v=M;else if(e.multiline&&(m+2)*(k+2)+2>o)continue e}else{if(!e.multiline||(m+2)*(k+2)+2>o)continue e;v=M}}for(var F="",I=y;I<=v;I++){var q=a[I];if(e.multiline){if(I===v){F+=q[w]+" ",w=(w+1)%q.length;continue}if(I===y){F+=q[q.length-1]+" ";continue}}F+=q[0]+" "}switch(F=F.substr(F.length-1)==" "?F.substr(0,F.length-1):F,f=mb(F,e,s).width,e.textAlign){case"right":d=l-f-2;break;case"center":d=(l-f)/2;break;default:d=2}t+=Fr(d)+" "+Fr(x)+` Td
`,t+="("+w0(F)+`) Tj
`,t+=-Fr(d)+` 0 Td
`,x=-(s+2),f=0,y=T?v:v+1,k++,j=""}break}return n.text=t,n.fontSize=s,n},mb=function(e,t,r){var n=t.scope.internal.getFont(t.fontName,t.fontStyle),a=t.scope.getStringUnitWidth(e,{font:n,fontSize:parseFloat(r),charSpace:0})*parseFloat(r);return{height:t.scope.getStringUnitWidth("3",{font:n,fontSize:parseFloat(r),charSpace:0})*parseFloat(r)*1.5,width:a}},ISe={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},FSe=function(e,t){var r={type:"reference",object:e};t.internal.getPageInfo(e.page).pageContext.annotations.find(function(n){return n.type===r.type&&n.object===r.object})===void 0&&t.internal.getPageInfo(e.page).pageContext.annotations.push(r)},BSe=function(e,t){if(t.scope=e,e.internal!==void 0&&(e.internal.acroformPlugin===void 0||e.internal.acroformPlugin.isInitialized===!1)){if(Uc.FieldNum=0,e.internal.acroformPlugin=JSON.parse(JSON.stringify(ISe)),e.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");cE=e.internal.scaleFactor,e.internal.acroformPlugin.acroFormDictionaryRoot=new _W,e.internal.acroformPlugin.acroFormDictionaryRoot.scope=e,e.internal.acroformPlugin.acroFormDictionaryRoot._eventID=e.internal.events.subscribe("postPutResources",function(){(function(r){r.internal.events.unsubscribe(r.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete r.internal.acroformPlugin.acroFormDictionaryRoot._eventID,r.internal.acroformPlugin.printedOut=!0})(e)}),e.internal.events.subscribe("buildDocument",function(){(function(r){r.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var n=r.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var a in n)if(n.hasOwnProperty(a)){var s=n[a];s.objId=void 0,s.hasAnnotation&&FSe(s,r)}})(e)}),e.internal.events.subscribe("putCatalog",function(){(function(r){if(r.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");r.internal.write("/AcroForm "+r.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(e)}),e.internal.events.subscribe("postPutPages",function(r){(function(n,a){var s=!n;for(var o in n||(a.internal.newObjectDeferredBegin(a.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),a.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),n=n||a.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(n.hasOwnProperty(o)){var l=n[o],u=[],d=l.Rect;if(l.Rect&&(l.Rect=MSe(l.Rect,a)),a.internal.newObjectDeferredBegin(l.objId,!0),l.DA=fr.createDefaultAppearanceStream(l),Un(l)==="object"&&typeof l.getKeyValueListForStream=="function"&&(u=l.getKeyValueListForStream()),l.Rect=d,l.hasAppearanceStream&&!l.appearanceStreamContent){var f=LSe(l);u.push({key:"AP",value:"<</N "+f+">>"}),a.internal.acroformPlugin.xForms.push(f)}if(l.appearanceStreamContent){var m="";for(var g in l.appearanceStreamContent)if(l.appearanceStreamContent.hasOwnProperty(g)){var x=l.appearanceStreamContent[g];if(m+="/"+g+" ",m+="<<",Object.keys(x).length>=1||Array.isArray(x)){for(var o in x)if(x.hasOwnProperty(o)){var y=x[o];typeof y=="function"&&(y=y.call(a,l)),m+="/"+o+" "+y+" ",a.internal.acroformPlugin.xForms.indexOf(y)>=0||a.internal.acroformPlugin.xForms.push(y)}}else typeof(y=x)=="function"&&(y=y.call(a,l)),m+="/"+o+" "+y,a.internal.acroformPlugin.xForms.indexOf(y)>=0||a.internal.acroformPlugin.xForms.push(y);m+=">>"}u.push({key:"AP",value:`<<
`+m+">>"})}a.internal.putStream({additionalKeyValues:u,objectId:l.objId}),a.internal.out("endobj")}s&&(function(v,w){for(var j in v)if(v.hasOwnProperty(j)){var k=j,A=v[j];w.internal.newObjectDeferredBegin(A.objId,!0),Un(A)==="object"&&typeof A.putStream=="function"&&A.putStream(),delete v[k]}})(a.internal.acroformPlugin.xForms,a)})(r,e)}),e.internal.acroformPlugin.isInitialized=!0}},kW=Xa.__acroform__.arrayToPdfArray=function(e,t,r){var n=function(o){return o};if(Array.isArray(e)){for(var a="[",s=0;s<e.length;s++)switch(s!==0&&(a+=" "),Un(e[s])){case"boolean":case"number":case"object":a+=e[s].toString();break;case"string":e[s].substr(0,1)==="/"?a+="/"+l0(e[s].substr(1)):(t!==void 0&&r&&(n=r.internal.getEncryptor(t)),a+="("+w0(n(e[s].toString()))+")")}return a+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},US=function(e,t,r){var n=function(a){return a};return t!==void 0&&r&&(n=r.internal.getEncryptor(t)),(e=e||"").toString(),"("+w0(n(e))+")"},Ru=function(){this._objId=void 0,this._scope=void 0,Object.defineProperty(this,"objId",{get:function(){if(this._objId===void 0){if(this.scope===void 0)return;this._objId=this.scope.internal.newObjectDeferred()}return this._objId},set:function(e){this._objId=e}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};Ru.prototype.toString=function(){return this.objId+" 0 R"},Ru.prototype.putStream=function(){var e=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:e,objectId:this.objId}),this.scope.internal.out("endobj")},Ru.prototype.getKeyValueListForStream=function(){var e=[],t=Object.getOwnPropertyNames(this).filter(function(s){return s!="content"&&s!="appearanceStreamContent"&&s!="scope"&&s!="objId"&&s.substring(0,1)!="_"});for(var r in t)if(Object.getOwnPropertyDescriptor(this,t[r]).configurable===!1){var n=t[r],a=this[n];a&&(Array.isArray(a)?e.push({key:n,value:kW(a,this.objId,this.scope)}):a instanceof Ru?(a.scope=this.scope,e.push({key:n,value:a.objId+" 0 R"})):typeof a!="function"&&e.push({key:n,value:a}))}return e};var CW=function(){Ru.call(this),Object.defineProperty(this,"Type",{value:"/XObject",configurable:!1,writable:!0}),Object.defineProperty(this,"Subtype",{value:"/Form",configurable:!1,writable:!0}),Object.defineProperty(this,"FormType",{value:1,configurable:!1,writable:!0});var e,t=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return t},set:function(r){t=r}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(r){e=r.trim()},get:function(){return e||null}})};Ho(CW,Ru);var _W=function(){Ru.call(this);var e,t=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return t.length>0?t:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return t}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(e){var r=function(n){return n};return this.scope&&(r=this.scope.internal.getEncryptor(this.objId)),"("+w0(r(e))+")"}},set:function(r){e=r}})};Ho(_W,Ru);var Uc=function e(){Ru.call(this);var t=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return t},set:function(j){if(isNaN(j))throw new Error('Invalid value "'+j+'" for attribute F supplied.');t=j}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!ci(t,3)},set:function(j){j?this.F=ui(t,3):this.F=di(t,3)}});var r=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return r},set:function(j){if(isNaN(j))throw new Error('Invalid value "'+j+'" for attribute Ff supplied.');r=j}});var n=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(n.length!==0)return n},set:function(j){n=j!==void 0?j:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[0])?0:n[0]},set:function(j){n[0]=j}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[1])?0:n[1]},set:function(j){n[1]=j}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[2])?0:n[2]},set:function(j){n[2]=j}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[3])?0:n[3]},set:function(j){n[3]=j}});var a="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return a},set:function(j){switch(j){case"/Btn":case"/Tx":case"/Ch":case"/Sig":a=j;break;default:throw new Error('Invalid value "'+j+'" for attribute FT supplied.')}}});var s=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!s||s.length<1){if(this instanceof Aw)return;s="FieldObject"+e.FieldNum++}var j=function(k){return k};return this.scope&&(j=this.scope.internal.getEncryptor(this.objId)),"("+w0(j(s))+")"},set:function(j){s=j.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return s},set:function(j){s=j}});var o="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return o},set:function(j){o=j}});var l="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return l},set:function(j){l=j}});var u=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return u},set:function(j){u=j}});var d=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return d===void 0?50/cE:d},set:function(j){d=j}});var f="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return f},set:function(j){f=j}});var m="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!m||this instanceof Aw||this instanceof Hm))return US(m,this.objId,this.scope)},set:function(j){j=j.toString(),m=j}});var g=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(g)return this instanceof ss==0?US(g,this.objId,this.scope):g},set:function(j){j=j.toString(),g=this instanceof ss==0?j.substr(0,1)==="("?jp(j.substr(1,j.length-2)):jp(j):j}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof ss==1?jp(g.substr(1,g.length-1)):g},set:function(j){j=j.toString(),g=this instanceof ss==1?"/"+l0(j):j}});var x=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(x)return x},set:function(j){this.V=j}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(x)return this instanceof ss==0?US(x,this.objId,this.scope):x},set:function(j){j=j.toString(),x=this instanceof ss==0?j.substr(0,1)==="("?jp(j.substr(1,j.length-2)):jp(j):j}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof ss==1?jp(x.substr(1,x.length-1)):x},set:function(j){j=j.toString(),x=this instanceof ss==1?"/"+l0(j):j}}),Object.defineProperty(this,"hasAnnotation",{enumerable:!0,configurable:!0,get:function(){return this.Rect}}),Object.defineProperty(this,"Type",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Widget":null}});var y,v=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return v},set:function(j){j=!!j,v=j}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(y)return y},set:function(j){y=j}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,1)},set:function(j){j?this.Ff=ui(this.Ff,1):this.Ff=di(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,2)},set:function(j){j?this.Ff=ui(this.Ff,2):this.Ff=di(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,3)},set:function(j){j?this.Ff=ui(this.Ff,3):this.Ff=di(this.Ff,3)}});var w=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(w!==null)return w},set:function(j){if([0,1,2].indexOf(j)===-1)throw new Error('Invalid value "'+j+'" for attribute Q supplied.');w=j}}),Object.defineProperty(this,"textAlign",{get:function(){var j;switch(w){case 0:default:j="left";break;case 1:j="center";break;case 2:j="right"}return j},configurable:!0,enumerable:!0,set:function(j){switch(j){case"right":case 2:w=2;break;case"center":case 1:w=1;break;default:w=0}}})};Ho(Uc,Ru);var Wp=function(){Uc.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var e=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return e},set:function(r){e=r}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return e},set:function(r){e=r}});var t=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return kW(t,this.objId,this.scope)},set:function(r){var n,a;a=[],typeof(n=r)=="string"&&(a=(function(s,o,l){l||(l=1);for(var u,d=[];u=o.exec(s);)d.push(u[l]);return d})(n,/\((.*?)\)/g)),t=a}}),this.getOptions=function(){return t},this.setOptions=function(r){t=r,this.sort&&t.sort()},this.addOption=function(r){r=(r=r||"").toString(),t.push(r),this.sort&&t.sort()},this.removeOption=function(r,n){for(n=n||!1,r=(r=r||"").toString();t.indexOf(r)!==-1&&(t.splice(t.indexOf(r),1),n!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,18)},set:function(r){r?this.Ff=ui(this.Ff,18):this.Ff=di(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,19)},set:function(r){this.combo===!0&&(r?this.Ff=ui(this.Ff,19):this.Ff=di(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,20)},set:function(r){r?(this.Ff=ui(this.Ff,20),t.sort()):this.Ff=di(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,22)},set:function(r){r?this.Ff=ui(this.Ff,22):this.Ff=di(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,23)},set:function(r){r?this.Ff=ui(this.Ff,23):this.Ff=di(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,27)},set:function(r){r?this.Ff=ui(this.Ff,27):this.Ff=di(this.Ff,27)}}),this.hasAppearanceStream=!1};Ho(Wp,Uc);var Gp=function(){Wp.call(this),this.fontName="helvetica",this.combo=!1};Ho(Gp,Wp);var Yp=function(){Gp.call(this),this.combo=!0};Ho(Yp,Gp);var n2=function(){Yp.call(this),this.edit=!0};Ho(n2,Yp);var ss=function(){Uc.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,15)},set:function(r){r?this.Ff=ui(this.Ff,15):this.Ff=di(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,16)},set:function(r){r?this.Ff=ui(this.Ff,16):this.Ff=di(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,17)},set:function(r){r?this.Ff=ui(this.Ff,17):this.Ff=di(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,26)},set:function(r){r?this.Ff=ui(this.Ff,26):this.Ff=di(this.Ff,26)}});var e,t={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var r=function(s){return s};if(this.scope&&(r=this.scope.internal.getEncryptor(this.objId)),Object.keys(t).length!==0){var n,a=[];for(n in a.push("<<"),t)a.push("/"+n+" ("+w0(r(t[n]))+")");return a.push(">>"),a.join(`
`)}},set:function(r){Un(r)==="object"&&(t=r)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return t.CA||""},set:function(r){typeof r=="string"&&(t.CA=r)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return e},set:function(r){var n=r==null?"":r.toString();n.substr(0,1)==="/"&&(n=n.substr(1)),e="/"+l0(n)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(r){e="/"+l0(r)}})};Ho(ss,Uc);var a2=function(){ss.call(this),this.pushButton=!0};Ho(a2,ss);var Kp=function(){ss.call(this),this.radio=!0,this.pushButton=!1;var e=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t!==void 0?t:[]}})};Ho(Kp,ss);var Aw=function(){var e,t;Uc.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return e},set:function(a){e=a}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(a){t=a}});var r,n={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var a=function(l){return l};this.scope&&(a=this.scope.internal.getEncryptor(this.objId));var s,o=[];for(s in o.push("<<"),n)o.push("/"+s+" ("+w0(a(n[s]))+")");return o.push(">>"),o.join(`
`)},set:function(a){Un(a)==="object"&&(n=a)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return n.CA||""},set:function(a){typeof a=="string"&&(n.CA=a)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return r},set:function(a){var s=a==null?"":a.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),r="/"+l0(s)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return r.substr(1,r.length-1)},set:function(a){var s=a==null?"":a.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),r="/"+l0(s)}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=fr.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};Ho(Aw,Uc),Kp.prototype.setAppearance=function(e){if(!("createAppearanceStream"in e)||!("getCA"in e))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var t in this.Kids)if(this.Kids.hasOwnProperty(t)){var r=this.Kids[t];r.appearanceStreamContent=e.createAppearanceStream(r.optionName),r.caption=e.getCA()}},Kp.prototype.createOption=function(e){var t=new Aw;return t.Parent=this,t.optionName=e,this.Kids.push(t),zSe.call(this.scope,t),t};var i2=function(){ss.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=fr.CheckBox.createAppearanceStream()};Ho(i2,ss);var Hm=function(){Uc.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,13)},set:function(t){t?this.Ff=ui(this.Ff,13):this.Ff=di(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,21)},set:function(t){t?this.Ff=ui(this.Ff,21):this.Ff=di(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,23)},set:function(t){t?this.Ff=ui(this.Ff,23):this.Ff=di(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,24)},set:function(t){t?this.Ff=ui(this.Ff,24):this.Ff=di(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,25)},set:function(t){t?this.Ff=ui(this.Ff,25):this.Ff=di(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,26)},set:function(t){t?this.Ff=ui(this.Ff,26):this.Ff=di(this.Ff,26)}});var e=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return e},set:function(t){Number.isInteger(t)&&(e=t)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};Ho(Hm,Uc);var s2=function(){Hm.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!ci(this.Ff,14)},set:function(e){e?this.Ff=ui(this.Ff,14):this.Ff=di(this.Ff,14)}}),this.password=!0};Ho(s2,Hm);var fr={CheckBox:{createAppearanceStream:function(){return{N:{On:fr.CheckBox.YesNormal},D:{On:fr.CheckBox.YesPushDown,Off:fr.CheckBox.OffPushDown}}},YesPushDown:function(e){var t=Nu(e);t.scope=e.scope;var r=[],n=e.scope.internal.getFont(e.fontName,e.fontStyle).id,a=e.scope.__private__.encodeColorString(e.color),s=tk(e,e.caption);return r.push("0.749023 g"),r.push("0 0 "+Fr(fr.internal.getWidth(e))+" "+Fr(fr.internal.getHeight(e))+" re"),r.push("f"),r.push("BMC"),r.push("q"),r.push("0 0 1 rg"),r.push("/"+n+" "+Fr(s.fontSize)+" Tf "+a),r.push("BT"),r.push(s.text),r.push("ET"),r.push("Q"),r.push("EMC"),t.stream=r.join(`
`),t},YesNormal:function(e){var t=Nu(e);t.scope=e.scope;var r=e.scope.internal.getFont(e.fontName,e.fontStyle).id,n=e.scope.__private__.encodeColorString(e.color),a=[],s=fr.internal.getHeight(e),o=fr.internal.getWidth(e),l=tk(e,e.caption);return a.push("1 g"),a.push("0 0 "+Fr(o)+" "+Fr(s)+" re"),a.push("f"),a.push("q"),a.push("0 0 1 rg"),a.push("0 0 "+Fr(o-1)+" "+Fr(s-1)+" re"),a.push("W"),a.push("n"),a.push("0 g"),a.push("BT"),a.push("/"+r+" "+Fr(l.fontSize)+" Tf "+n),a.push(l.text),a.push("ET"),a.push("Q"),t.stream=a.join(`
`),t},OffPushDown:function(e){var t=Nu(e);t.scope=e.scope;var r=[];return r.push("0.749023 g"),r.push("0 0 "+Fr(fr.internal.getWidth(e))+" "+Fr(fr.internal.getHeight(e))+" re"),r.push("f"),t.stream=r.join(`
`),t}},RadioButton:{Circle:{createAppearanceStream:function(e){var t={D:{Off:fr.RadioButton.Circle.OffPushDown},N:{}};return t.N[e]=fr.RadioButton.Circle.YesNormal,t.D[e]=fr.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(e){var t=Nu(e);t.scope=e.scope;var r=[],n=fr.internal.getWidth(e)<=fr.internal.getHeight(e)?fr.internal.getWidth(e)/4:fr.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var a=fr.internal.Bezier_C,s=Number((n*a).toFixed(5));return r.push("q"),r.push("1 0 0 1 "+th(fr.internal.getWidth(e)/2)+" "+th(fr.internal.getHeight(e)/2)+" cm"),r.push(n+" 0 m"),r.push(n+" "+s+" "+s+" "+n+" 0 "+n+" c"),r.push("-"+s+" "+n+" -"+n+" "+s+" -"+n+" 0 c"),r.push("-"+n+" -"+s+" -"+s+" -"+n+" 0 -"+n+" c"),r.push(s+" -"+n+" "+n+" -"+s+" "+n+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
`),t},YesPushDown:function(e){var t=Nu(e);t.scope=e.scope;var r=[],n=fr.internal.getWidth(e)<=fr.internal.getHeight(e)?fr.internal.getWidth(e)/4:fr.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var a=Number((2*n).toFixed(5)),s=Number((a*fr.internal.Bezier_C).toFixed(5)),o=Number((n*fr.internal.Bezier_C).toFixed(5));return r.push("0.749023 g"),r.push("q"),r.push("1 0 0 1 "+th(fr.internal.getWidth(e)/2)+" "+th(fr.internal.getHeight(e)/2)+" cm"),r.push(a+" 0 m"),r.push(a+" "+s+" "+s+" "+a+" 0 "+a+" c"),r.push("-"+s+" "+a+" -"+a+" "+s+" -"+a+" 0 c"),r.push("-"+a+" -"+s+" -"+s+" -"+a+" 0 -"+a+" c"),r.push(s+" -"+a+" "+a+" -"+s+" "+a+" 0 c"),r.push("f"),r.push("Q"),r.push("0 g"),r.push("q"),r.push("1 0 0 1 "+th(fr.internal.getWidth(e)/2)+" "+th(fr.internal.getHeight(e)/2)+" cm"),r.push(n+" 0 m"),r.push(n+" "+o+" "+o+" "+n+" 0 "+n+" c"),r.push("-"+o+" "+n+" -"+n+" "+o+" -"+n+" 0 c"),r.push("-"+n+" -"+o+" -"+o+" -"+n+" 0 -"+n+" c"),r.push(o+" -"+n+" "+n+" -"+o+" "+n+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
`),t},OffPushDown:function(e){var t=Nu(e);t.scope=e.scope;var r=[],n=fr.internal.getWidth(e)<=fr.internal.getHeight(e)?fr.internal.getWidth(e)/4:fr.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var a=Number((2*n).toFixed(5)),s=Number((a*fr.internal.Bezier_C).toFixed(5));return r.push("0.749023 g"),r.push("q"),r.push("1 0 0 1 "+th(fr.internal.getWidth(e)/2)+" "+th(fr.internal.getHeight(e)/2)+" cm"),r.push(a+" 0 m"),r.push(a+" "+s+" "+s+" "+a+" 0 "+a+" c"),r.push("-"+s+" "+a+" -"+a+" "+s+" -"+a+" 0 c"),r.push("-"+a+" -"+s+" -"+s+" -"+a+" 0 -"+a+" c"),r.push(s+" -"+a+" "+a+" -"+s+" "+a+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
`),t}},Cross:{createAppearanceStream:function(e){var t={D:{Off:fr.RadioButton.Cross.OffPushDown},N:{}};return t.N[e]=fr.RadioButton.Cross.YesNormal,t.D[e]=fr.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(e){var t=Nu(e);t.scope=e.scope;var r=[],n=fr.internal.calculateCross(e);return r.push("q"),r.push("1 1 "+Fr(fr.internal.getWidth(e)-2)+" "+Fr(fr.internal.getHeight(e)-2)+" re"),r.push("W"),r.push("n"),r.push(Fr(n.x1.x)+" "+Fr(n.x1.y)+" m"),r.push(Fr(n.x2.x)+" "+Fr(n.x2.y)+" l"),r.push(Fr(n.x4.x)+" "+Fr(n.x4.y)+" m"),r.push(Fr(n.x3.x)+" "+Fr(n.x3.y)+" l"),r.push("s"),r.push("Q"),t.stream=r.join(`
`),t},YesPushDown:function(e){var t=Nu(e);t.scope=e.scope;var r=fr.internal.calculateCross(e),n=[];return n.push("0.749023 g"),n.push("0 0 "+Fr(fr.internal.getWidth(e))+" "+Fr(fr.internal.getHeight(e))+" re"),n.push("f"),n.push("q"),n.push("1 1 "+Fr(fr.internal.getWidth(e)-2)+" "+Fr(fr.internal.getHeight(e)-2)+" re"),n.push("W"),n.push("n"),n.push(Fr(r.x1.x)+" "+Fr(r.x1.y)+" m"),n.push(Fr(r.x2.x)+" "+Fr(r.x2.y)+" l"),n.push(Fr(r.x4.x)+" "+Fr(r.x4.y)+" m"),n.push(Fr(r.x3.x)+" "+Fr(r.x3.y)+" l"),n.push("s"),n.push("Q"),t.stream=n.join(`
`),t},OffPushDown:function(e){var t=Nu(e);t.scope=e.scope;var r=[];return r.push("0.749023 g"),r.push("0 0 "+Fr(fr.internal.getWidth(e))+" "+Fr(fr.internal.getHeight(e))+" re"),r.push("f"),t.stream=r.join(`
`),t}}},createDefaultAppearanceStream:function(e){var t=e.scope.internal.getFont(e.fontName,e.fontStyle).id,r=e.scope.__private__.encodeColorString(e.color);return"/"+t+" "+e.fontSize+" Tf "+r}};fr.internal={Bezier_C:.551915024494,calculateCross:function(e){var t=fr.internal.getWidth(e),r=fr.internal.getHeight(e),n=Math.min(t,r);return{x1:{x:(t-n)/2,y:(r-n)/2+n},x2:{x:(t-n)/2+n,y:(r-n)/2},x3:{x:(t-n)/2,y:(r-n)/2},x4:{x:(t-n)/2+n,y:(r-n)/2+n}}}},fr.internal.getWidth=function(e){var t=0;return Un(e)==="object"&&(t=dF(e.Rect[2])),t},fr.internal.getHeight=function(e){var t=0;return Un(e)==="object"&&(t=dF(e.Rect[3])),t};var zSe=Xa.addField=function(e){if(BSe(this,e),!(e instanceof Uc))throw new Error("Invalid argument passed to jsPDF.addField.");var t;return(t=e).scope.internal.acroformPlugin.printedOut&&(t.scope.internal.acroformPlugin.printedOut=!1,t.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),t.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t),e.page=e.scope.internal.getCurrentPageInfo().pageNumber,this};Xa.AcroFormChoiceField=Wp,Xa.AcroFormListBox=Gp,Xa.AcroFormComboBox=Yp,Xa.AcroFormEditBox=n2,Xa.AcroFormButton=ss,Xa.AcroFormPushButton=a2,Xa.AcroFormRadioButton=Kp,Xa.AcroFormCheckBox=i2,Xa.AcroFormTextField=Hm,Xa.AcroFormPasswordField=s2,Xa.AcroFormAppearance=fr,Xa.AcroForm={ChoiceField:Wp,ListBox:Gp,ComboBox:Yp,EditBox:n2,Button:ss,PushButton:a2,RadioButton:Kp,CheckBox:i2,TextField:Hm,PasswordField:s2,Appearance:fr},tr.AcroForm={ChoiceField:Wp,ListBox:Gp,ComboBox:Yp,EditBox:n2,Button:ss,PushButton:a2,RadioButton:Kp,CheckBox:i2,TextField:Hm,PasswordField:s2,Appearance:fr};tr.AcroForm;function EW(e){return e.reduce(function(t,r,n){return t[r]=n,t},{})}(function(e){var t="addImage_";e.__addimage__={};var r="UNKNOWN",n={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},a=e.__addimage__.getImageFileTypeByImageData=function(P,R){var K,ee,se,Z,ne,X=r;if((R=R||r)==="RGBA"||P.data!==void 0&&P.data instanceof Uint8ClampedArray&&"height"in P&&"width"in P)return"RGBA";if(B(P))for(ne in n)for(se=n[ne],K=0;K<se.length;K+=1){for(Z=!0,ee=0;ee<se[K].length;ee+=1)if(se[K][ee]!==void 0&&se[K][ee]!==P[ee]){Z=!1;break}if(Z===!0){X=ne;break}}else for(ne in n)for(se=n[ne],K=0;K<se.length;K+=1){for(Z=!0,ee=0;ee<se[K].length;ee+=1)if(se[K][ee]!==void 0&&se[K][ee]!==P.charCodeAt(ee)){Z=!1;break}if(Z===!0){X=ne;break}}return X===r&&R!==r&&(X=R),X},s=function P(R){for(var K=this.internal.write,ee=this.internal.putStream,se=(0,this.internal.getFilters)();se.indexOf("FlateEncode")!==-1;)se.splice(se.indexOf("FlateEncode"),1);R.objectId=this.internal.newObject();var Z=[];if(Z.push({key:"Type",value:"/XObject"}),Z.push({key:"Subtype",value:"/Image"}),Z.push({key:"Width",value:R.width}),Z.push({key:"Height",value:R.height}),R.colorSpace===j.INDEXED?Z.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(R.palette.length/3-1)+" "+("sMask"in R&&R.sMask!==void 0?R.objectId+2:R.objectId+1)+" 0 R]"}):(Z.push({key:"ColorSpace",value:"/"+R.colorSpace}),R.colorSpace===j.DEVICE_CMYK&&Z.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),Z.push({key:"BitsPerComponent",value:R.bitsPerComponent}),"decodeParameters"in R&&R.decodeParameters!==void 0&&Z.push({key:"DecodeParms",value:"<<"+R.decodeParameters+">>"}),"transparency"in R&&Array.isArray(R.transparency)&&R.transparency.length>0){for(var ne="",X=0,le=R.transparency.length;X<le;X++)ne+=R.transparency[X]+" "+R.transparency[X]+" ";Z.push({key:"Mask",value:"["+ne+"]"})}R.sMask!==void 0&&Z.push({key:"SMask",value:R.objectId+1+" 0 R"});var Ae=R.filter!==void 0?["/"+R.filter]:void 0;if(ee({data:R.data,additionalKeyValues:Z,alreadyAppliedFilters:Ae,objectId:R.objectId}),K("endobj"),"sMask"in R&&R.sMask!==void 0){var ce,D=(ce=R.sMaskBitsPerComponent)!==null&&ce!==void 0?ce:R.bitsPerComponent,H={width:R.width,height:R.height,colorSpace:"DeviceGray",bitsPerComponent:D,data:R.sMask};"filter"in R&&(H.decodeParameters="/Predictor ".concat(R.predictor," /Colors 1 /BitsPerComponent ").concat(D," /Columns ").concat(R.width),H.filter=R.filter),P.call(this,H)}if(R.colorSpace===j.INDEXED){var G=this.internal.newObject();ee({data:F(new Uint8Array(R.palette)),objectId:G}),K("endobj")}},o=function(){var P=this.internal.collections[t+"images"];for(var R in P)s.call(this,P[R])},l=function(){var P,R=this.internal.collections[t+"images"],K=this.internal.write;for(var ee in R)K("/I"+(P=R[ee]).index,P.objectId,"0","R")},u=function(){this.internal.collections[t+"images"]||(this.internal.collections[t+"images"]={},this.internal.events.subscribe("putResources",o),this.internal.events.subscribe("putXobjectDict",l))},d=function(){var P=this.internal.collections[t+"images"];return u.call(this),P},f=function(){return Object.keys(this.internal.collections[t+"images"]).length},m=function(P){return typeof e["process"+P.toUpperCase()]=="function"},g=function(P){return Un(P)==="object"&&P.nodeType===1},x=function(P,R){if(P.nodeName==="IMG"&&P.hasAttribute("src")){var K=""+P.getAttribute("src");if(K.indexOf("data:image/")===0)return r2(unescape(K).split("base64,").pop());var ee=e.loadFile(K,!0);if(ee!==void 0)return ee}if(P.nodeName==="CANVAS"){if(P.width===0||P.height===0)throw new Error("Given canvas must have data. Canvas width: "+P.width+", height: "+P.height);var se;switch(R){case"PNG":se="image/png";break;case"WEBP":se="image/webp";break;default:se="image/jpeg"}return r2(P.toDataURL(se,1).split("base64,").pop())}},y=function(P){var R=this.internal.collections[t+"images"];if(R){for(var K in R)if(P===R[K].alias)return R[K]}},v=function(P,R,K){return P||R||(P=-96,R=-96),P<0&&(P=-1*K.width*72/P/this.internal.scaleFactor),R<0&&(R=-1*K.height*72/R/this.internal.scaleFactor),P===0&&(P=R*K.width/K.height),R===0&&(R=P*K.height/K.width),[P,R]},w=function(P,R,K,ee,se,Z){var ne=v.call(this,K,ee,se),X=this.internal.getCoordinateString,le=this.internal.getVerticalCoordinateString,Ae=d.call(this);if(K=ne[0],ee=ne[1],Ae[se.index]=se,Z){Z*=Math.PI/180;var ce=Math.cos(Z),D=Math.sin(Z),H=function(E){return E.toFixed(4)},G=[H(ce),H(D),H(-1*D),H(ce),0,0,"cm"]}this.internal.write("q"),Z?(this.internal.write([1,"0","0",1,X(P),le(R+ee),"cm"].join(" ")),this.internal.write(G.join(" ")),this.internal.write([X(K),"0","0",X(ee),"0","0","cm"].join(" "))):this.internal.write([X(K),"0","0",X(ee),X(P),le(R+ee),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+se.index+" Do"),this.internal.write("Q")},j=e.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"};e.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"};var k=e.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},A=e.__addimage__.sHashCode=function(P){var R,K,ee=0;if(typeof P=="string")for(K=P.length,R=0;R<K;R++)ee=(ee<<5)-ee+P.charCodeAt(R),ee|=0;else if(B(P))for(K=P.byteLength/2,R=0;R<K;R++)ee=(ee<<5)-ee+P[R],ee|=0;return ee},T=e.__addimage__.validateStringAsBase64=function(P){(P=P||"").toString().trim();var R=!0;return P.length===0&&(R=!1),P.length%4!=0&&(R=!1),/^[A-Za-z0-9+/]+$/.test(P.substr(0,P.length-2))===!1&&(R=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(P.substr(-2))===!1&&(R=!1),R},M=e.__addimage__.extractImageFromDataUrl=function(P){if(P==null||!(P=P.trim()).startsWith("data:"))return null;var R=P.indexOf(",");return R<0?null:P.substring(0,R).trim().endsWith("base64")?P.substring(R+1):null};e.__addimage__.isArrayBuffer=function(P){return P instanceof ArrayBuffer};var B=e.__addimage__.isArrayBufferView=function(P){return P instanceof Int8Array||P instanceof Uint8Array||P instanceof Uint8ClampedArray||P instanceof Int16Array||P instanceof Uint16Array||P instanceof Int32Array||P instanceof Uint32Array||P instanceof Float32Array||P instanceof Float64Array},L=e.__addimage__.binaryStringToUint8Array=function(P){for(var R=P.length,K=new Uint8Array(R),ee=0;ee<R;ee++)K[ee]=P.charCodeAt(ee);return K},F=e.__addimage__.arrayBufferToBinaryString=function(P){for(var R="",K=B(P)?P:new Uint8Array(P),ee=0;ee<K.length;ee+=8192)R+=String.fromCharCode.apply(null,K.subarray(ee,ee+8192));return R};e.addImage=function(){var P,R,K,ee,se,Z,ne,X,le;if(typeof arguments[1]=="number"?(R=r,K=arguments[1],ee=arguments[2],se=arguments[3],Z=arguments[4],ne=arguments[5],X=arguments[6],le=arguments[7]):(R=arguments[1],K=arguments[2],ee=arguments[3],se=arguments[4],Z=arguments[5],ne=arguments[6],X=arguments[7],le=arguments[8]),Un(P=arguments[0])==="object"&&!g(P)&&"imageData"in P){var Ae=P;P=Ae.imageData,R=Ae.format||R||r,K=Ae.x||K||0,ee=Ae.y||ee||0,se=Ae.w||Ae.width||se,Z=Ae.h||Ae.height||Z,ne=Ae.alias||ne,X=Ae.compression||X,le=Ae.rotation||Ae.angle||le}var ce=this.internal.getFilters();if(X===void 0&&ce.indexOf("FlateEncode")!==-1&&(X="SLOW"),isNaN(K)||isNaN(ee))throw new Error("Invalid coordinates passed to jsPDF.addImage");u.call(this);var D=I.call(this,P,R,ne,X);return w.call(this,K,ee,se,Z,D,le),this};var I=function(P,R,K,ee){var se,Z,ne;if(typeof P=="string"&&a(P)===r){P=unescape(P);var X=q(P,!1);(X!==""||(X=e.loadFile(P,!0))!==void 0)&&(P=X)}if(g(P)&&(P=x(P,R)),R=a(P,R),!m(R))throw new Error("addImage does not support files of type '"+R+"', please ensure that a plugin for '"+R+"' support is added.");if(((ne=K)==null||ne.length===0)&&(K=(function(le){return typeof le=="string"||B(le)?A(le):B(le.data)?A(le.data):null})(P)),(se=y.call(this,K))||(P instanceof Uint8Array||R==="RGBA"||(Z=P,P=L(P)),se=this["process"+R.toUpperCase()](P,f.call(this),K,(function(le){return le&&typeof le=="string"&&(le=le.toUpperCase()),le in e.image_compression?le:k.NONE})(ee),Z)),!se)throw new Error("An unknown error occurred whilst processing the image.");return se},q=e.__addimage__.convertBase64ToBinaryString=function(P,R){R=typeof R!="boolean"||R;var K,ee="";if(typeof P=="string"){var se;K=(se=M(P))!==null&&se!==void 0?se:P;try{ee=r2(K)}catch(Z){if(R)throw T(K)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+Z.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return ee};e.getImageProperties=function(P){var R,K,ee="";if(g(P)&&(P=x(P)),typeof P=="string"&&a(P)===r&&((ee=q(P,!1))===""&&(ee=e.loadFile(P)||""),P=ee),K=a(P),!m(K))throw new Error("addImage does not support files of type '"+K+"', please ensure that a plugin for '"+K+"' support is added.");if(P instanceof Uint8Array||(P=L(P)),!(R=this["process"+K.toUpperCase()](P)))throw new Error("An unknown error occurred whilst processing the image");return R.fileType=K,R}})(tr.API),(function(e){var t=function(r){if(r!==void 0&&r!="")return!0};tr.API.events.push(["addPage",function(r){this.internal.getPageInfo(r.pageNumber).pageContext.annotations=[]}]),e.events.push(["putPage",function(r){for(var n,a,s,o=this.internal.getCoordinateString,l=this.internal.getVerticalCoordinateString,u=this.internal.getPageInfoByObjId(r.objId),d=r.pageContext.annotations,f=!1,m=0;m<d.length&&!f;m++)switch((n=d[m]).type){case"link":(t(n.options.url)||t(n.options.pageNumber))&&(f=!0);break;case"reference":case"text":case"freetext":f=!0}if(f!=0){this.internal.write("/Annots [");for(var g=0;g<d.length;g++){n=d[g];var x=this.internal.pdfEscape,y=this.internal.getEncryptor(r.objId);switch(n.type){case"reference":this.internal.write(" "+n.object.objId+" 0 R ");break;case"text":var v=this.internal.newAdditionalObject(),w=this.internal.newAdditionalObject(),j=this.internal.getEncryptor(v.objId),k=n.title||"Note";s="<</Type /Annot /Subtype /Text "+(a="/Rect ["+o(n.bounds.x)+" "+l(n.bounds.y+n.bounds.h)+" "+o(n.bounds.x+n.bounds.w)+" "+l(n.bounds.y)+"] ")+"/Contents ("+x(j(n.contents))+")",s+=" /Popup "+w.objId+" 0 R",s+=" /P "+u.objId+" 0 R",s+=" /T ("+x(j(k))+") >>",v.content=s;var A=v.objId+" 0 R";s="<</Type /Annot /Subtype /Popup "+(a="/Rect ["+o(n.bounds.x+30)+" "+l(n.bounds.y+n.bounds.h)+" "+o(n.bounds.x+n.bounds.w+30)+" "+l(n.bounds.y)+"] ")+" /Parent "+A,n.open&&(s+=" /Open true"),s+=" >>",w.content=s,this.internal.write(v.objId,"0 R",w.objId,"0 R");break;case"freetext":a="/Rect ["+o(n.bounds.x)+" "+l(n.bounds.y)+" "+o(n.bounds.x+n.bounds.w)+" "+l(n.bounds.y+n.bounds.h)+"] ";var T="font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+(n.color||"#000000");s="<</Type /Annot /Subtype /FreeText "+a+"/Contents ("+x(y(n.contents))+")",s+=" /DS("+x(y(T))+")",s+=" /Border [0 0 0]",s+=" >>",this.internal.write(s);break;case"link":if(n.options.name){var M=this.annotations._nameMap[n.options.name];n.options.pageNumber=M.page,n.options.top=M.y}else n.options.top||(n.options.top=0);if(a="/Rect ["+n.finalBounds.x+" "+n.finalBounds.y+" "+n.finalBounds.w+" "+n.finalBounds.h+"] ",s="",n.options.url)s="<</Type /Annot /Subtype /Link "+a+"/Border [0 0 0] /A <</S /URI /URI ("+x(y(n.options.url))+") >>";else if(n.options.pageNumber)switch(s="<</Type /Annot /Subtype /Link "+a+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(n.options.pageNumber).objId+" 0 R",n.options.magFactor=n.options.magFactor||"XYZ",n.options.magFactor){case"Fit":s+=" /Fit]";break;case"FitH":s+=" /FitH "+n.options.top+"]";break;case"FitV":n.options.left=n.options.left||0,s+=" /FitV "+n.options.left+"]";break;default:var B=l(n.options.top);n.options.left=n.options.left||0,n.options.zoom===void 0&&(n.options.zoom=0),s+=" /XYZ "+n.options.left+" "+B+" "+n.options.zoom+"]"}s!=""&&(s+=" >>",this.internal.write(s))}}this.internal.write("]")}}]),e.createAnnotation=function(r){var n=this.internal.getCurrentPageInfo();switch(r.type){case"link":this.link(r.bounds.x,r.bounds.y,r.bounds.w,r.bounds.h,r);break;case"text":case"freetext":n.pageContext.annotations.push(r)}},e.link=function(r,n,a,s,o){var l=this.internal.getCurrentPageInfo(),u=this.internal.getCoordinateString,d=this.internal.getVerticalCoordinateString;l.pageContext.annotations.push({finalBounds:{x:u(r),y:d(n),w:u(r+a),h:d(n+s)},options:o,type:"link"})},e.textWithLink=function(r,n,a,s){var o,l,u=this.getTextWidth(r),d=this.internal.getLineHeight()/this.internal.scaleFactor;if(s.maxWidth!==void 0){l=s.maxWidth;var f=this.splitTextToSize(r,l).length;o=Math.ceil(d*f)}else l=u,o=d;return this.text(r,n,a,s),a+=.2*d,s.align==="center"&&(n-=u/2),s.align==="right"&&(n-=u),this.link(n,a-d,l,o,s),u},e.getTextWidth=function(r){var n=this.internal.getFontSize();return this.getStringUnitWidth(r)*n/this.internal.scaleFactor}})(tr.API),(function(e){var t={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},r={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},n={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},a=[1570,1571,1573,1575];e.__arabicParser__={};var s=e.__arabicParser__.isInArabicSubstitutionA=function(v){return t[v.charCodeAt(0)]!==void 0},o=e.__arabicParser__.isArabicLetter=function(v){return typeof v=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(v)},l=e.__arabicParser__.isArabicEndLetter=function(v){return o(v)&&s(v)&&t[v.charCodeAt(0)].length<=2},u=e.__arabicParser__.isArabicAlfLetter=function(v){return o(v)&&a.indexOf(v.charCodeAt(0))>=0};e.__arabicParser__.arabicLetterHasIsolatedForm=function(v){return o(v)&&s(v)&&t[v.charCodeAt(0)].length>=1};var d=e.__arabicParser__.arabicLetterHasFinalForm=function(v){return o(v)&&s(v)&&t[v.charCodeAt(0)].length>=2};e.__arabicParser__.arabicLetterHasInitialForm=function(v){return o(v)&&s(v)&&t[v.charCodeAt(0)].length>=3};var f=e.__arabicParser__.arabicLetterHasMedialForm=function(v){return o(v)&&s(v)&&t[v.charCodeAt(0)].length==4},m=e.__arabicParser__.resolveLigatures=function(v){var w=0,j=r,k="",A=0;for(w=0;w<v.length;w+=1)j[v.charCodeAt(w)]!==void 0?(A++,typeof(j=j[v.charCodeAt(w)])=="number"&&(k+=String.fromCharCode(j),j=r,A=0),w===v.length-1&&(j=r,k+=v.charAt(w-(A-1)),w-=A-1,A=0)):(j=r,k+=v.charAt(w-A),w-=A,A=0);return k};e.__arabicParser__.isArabicDiacritic=function(v){return v!==void 0&&n[v.charCodeAt(0)]!==void 0};var g=e.__arabicParser__.getCorrectForm=function(v,w,j){return o(v)?s(v)===!1?-1:!d(v)||!o(w)&&!o(j)||!o(j)&&l(w)||l(v)&&!o(w)||l(v)&&u(w)||l(v)&&l(w)?0:f(v)&&o(w)&&!l(w)&&o(j)&&d(j)?3:l(v)||!o(j)?1:2:-1},x=function(v){var w=0,j=0,k=0,A="",T="",M="",B=(v=v||"").split("\\s+"),L=[];for(w=0;w<B.length;w+=1){for(L.push(""),j=0;j<B[w].length;j+=1)A=B[w][j],T=B[w][j-1],M=B[w][j+1],o(A)?(k=g(A,T,M),L[w]+=k!==-1?String.fromCharCode(t[A.charCodeAt(0)][k]):A):L[w]+=A;L[w]=m(L[w])}return L.join(" ")},y=e.__arabicParser__.processArabic=e.processArabic=function(){var v,w=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,j=[];if(Array.isArray(w)){var k=0;for(j=[],k=0;k<w.length;k+=1)Array.isArray(w[k])?j.push([x(w[k][0]),w[k][1],w[k][2]]):j.push([x(w[k])]);v=j}else v=x(w);return typeof arguments[0]=="string"?v:(arguments[0].text=v,arguments[0])};e.events.push(["preProcessText",y])})(tr.API),tr.API.autoPrint=function(e){var t;return(e=e||{}).variant=e.variant||"non-conform",e.variant==="javascript"?this.addJS("print({});"):(this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /Named"),this.internal.out("/Type /Action"),this.internal.out("/N /Print"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.out("/OpenAction "+t+" 0 R")})),this},(function(e){var t=function(){var r=void 0;Object.defineProperty(this,"pdf",{get:function(){return r},set:function(l){r=l}});var n=150;Object.defineProperty(this,"width",{get:function(){return n},set:function(l){n=isNaN(l)||Number.isInteger(l)===!1||l<0?150:l,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=n+1)}});var a=300;Object.defineProperty(this,"height",{get:function(){return a},set:function(l){a=isNaN(l)||Number.isInteger(l)===!1||l<0?300:l,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=a+1)}});var s=[];Object.defineProperty(this,"childNodes",{get:function(){return s},set:function(l){s=l}});var o={};Object.defineProperty(this,"style",{get:function(){return o},set:function(l){o=l}}),Object.defineProperty(this,"parentNode",{})};t.prototype.getContext=function(r,n){var a;if((r=r||"2d")!=="2d")return null;for(a in n)this.pdf.context2d.hasOwnProperty(a)&&(this.pdf.context2d[a]=n[a]);return this.pdf.context2d._canvas=this,this.pdf.context2d},t.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},e.events.push(["initialized",function(){this.canvas=new t,this.canvas.pdf=this}])})(tr.API),(function(e){var t={left:0,top:0,bottom:0,right:0},r=!1,n=function(){this.internal.__cell__===void 0&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},t),this.internal.__cell__.margins.width=this.getPageWidth(),a.call(this))},a=function(){this.internal.__cell__.lastCell=new s,this.internal.__cell__.pages=1},s=function(){var u=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return u},set:function(v){u=v}});var d=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return d},set:function(v){d=v}});var f=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return f},set:function(v){f=v}});var m=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return m},set:function(v){m=v}});var g=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return g},set:function(v){g=v}});var x=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return x},set:function(v){x=v}});var y=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return y},set:function(v){y=v}}),this};s.prototype.clone=function(){return new s(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},s.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},e.setHeaderFunction=function(u){return n.call(this),this.internal.__cell__.headerFunction=typeof u=="function"?u:void 0,this},e.getTextDimensions=function(u,d){n.call(this);var f=(d=d||{}).fontSize||this.getFontSize(),m=d.font||this.getFont(),g=d.scaleFactor||this.internal.scaleFactor,x=0,y=0,v=0,w=this;if(!Array.isArray(u)&&typeof u!="string"){if(typeof u!="number")throw new Error("getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.");u=String(u)}var j=d.maxWidth;j>0?typeof u=="string"?u=this.splitTextToSize(u,j):Object.prototype.toString.call(u)==="[object Array]"&&(u=u.reduce(function(A,T){return A.concat(w.splitTextToSize(T,j))},[])):u=Array.isArray(u)?u:[u];for(var k=0;k<u.length;k++)x<(v=this.getStringUnitWidth(u[k],{font:m})*f)&&(x=v);return x!==0&&(y=u.length),{w:x/=g,h:Math.max((y*f*this.getLineHeightFactor()-f*(this.getLineHeightFactor()-1))/g,0)}},e.cellAddPage=function(){n.call(this),this.addPage();var u=this.internal.__cell__.margins||t;return this.internal.__cell__.lastCell=new s(u.left,u.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var o=e.cell=function(){var u;u=arguments[0]instanceof s?arguments[0]:new s(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]),n.call(this);var d=this.internal.__cell__.lastCell,f=this.internal.__cell__.padding,m=this.internal.__cell__.margins||t,g=this.internal.__cell__.tableHeaderRow,x=this.internal.__cell__.printHeaders;return d.lineNumber!==void 0&&(d.lineNumber===u.lineNumber?(u.x=(d.x||0)+(d.width||0),u.y=d.y||0):d.y+d.height+u.height+m.bottom>this.getPageHeight()?(this.cellAddPage(),u.y=m.top,x&&g&&(this.printHeaderRow(u.lineNumber,!0),u.y+=g[0].height)):u.y=d.y+d.height||u.y),u.text[0]!==void 0&&(this.rect(u.x,u.y,u.width,u.height,r===!0?"FD":void 0),u.align==="right"?this.text(u.text,u.x+u.width-f,u.y+f,{align:"right",baseline:"top"}):u.align==="center"?this.text(u.text,u.x+u.width/2,u.y+f,{align:"center",baseline:"top",maxWidth:u.width-f-f}):this.text(u.text,u.x+f,u.y+f,{align:"left",baseline:"top",maxWidth:u.width-f-f})),this.internal.__cell__.lastCell=u,this};e.table=function(u,d,f,m,g){if(n.call(this),!f)throw new Error("No data for PDF table.");var x,y,v,w,j=[],k=[],A=[],T={},M={},B=[],L=[],F=(g=g||{}).autoSize||!1,I=g.printHeaders!==!1,q=g.css&&g.css["font-size"]!==void 0?16*g.css["font-size"]:g.fontSize||12,P=g.margins||Object.assign({width:this.getPageWidth()},t),R=typeof g.padding=="number"?g.padding:3,K=g.headerBackgroundColor||"#c8c8c8",ee=g.headerTextColor||"#000";if(a.call(this),this.internal.__cell__.printHeaders=I,this.internal.__cell__.margins=P,this.internal.__cell__.table_font_size=q,this.internal.__cell__.padding=R,this.internal.__cell__.headerBackgroundColor=K,this.internal.__cell__.headerTextColor=ee,this.setFontSize(q),m==null)k=j=Object.keys(f[0]),A=j.map(function(){return"left"});else if(Array.isArray(m)&&Un(m[0])==="object")for(j=m.map(function(Ae){return Ae.name}),k=m.map(function(Ae){return Ae.prompt||Ae.name||""}),A=m.map(function(Ae){return Ae.align||"left"}),x=0;x<m.length;x+=1)M[m[x].name]=.7499990551181103*m[x].width;else Array.isArray(m)&&typeof m[0]=="string"&&(k=j=m,A=j.map(function(){return"left"}));if(F||Array.isArray(m)&&typeof m[0]=="string")for(x=0;x<j.length;x+=1){for(T[w=j[x]]=f.map(function(Ae){return Ae[w]}),this.setFont(void 0,"bold"),B.push(this.getTextDimensions(k[x],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),y=T[w],this.setFont(void 0,"normal"),v=0;v<y.length;v+=1)B.push(this.getTextDimensions(y[v],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);M[w]=Math.max.apply(null,B)+R+R,B=[]}if(I){var se={};for(x=0;x<j.length;x+=1)se[j[x]]={},se[j[x]].text=k[x],se[j[x]].align=A[x];var Z=l.call(this,se,M);L=j.map(function(Ae){return new s(u,d,M[Ae],Z,se[Ae].text,void 0,se[Ae].align)}),this.setTableHeaderRow(L),this.printHeaderRow(1,!1)}var ne=m.reduce(function(Ae,ce){return Ae[ce.name]=ce.align,Ae},{});for(x=0;x<f.length;x+=1){"rowStart"in g&&g.rowStart instanceof Function&&g.rowStart({row:x,data:f[x]},this);var X=l.call(this,f[x],M);for(v=0;v<j.length;v+=1){var le=f[x][j[v]];"cellStart"in g&&g.cellStart instanceof Function&&g.cellStart({row:x,col:v,data:le},this),o.call(this,new s(u,d,M[j[v]],X,le,x+2,ne[j[v]]))}}return this.internal.__cell__.table_x=u,this.internal.__cell__.table_y=d,this};var l=function(u,d){var f=this.internal.__cell__.padding,m=this.internal.__cell__.table_font_size,g=this.internal.scaleFactor;return Object.keys(u).map(function(x){var y=u[x];return this.splitTextToSize(y.hasOwnProperty("text")?y.text:y,d[x]-f-f)},this).map(function(x){return this.getLineHeightFactor()*x.length*m/g+f+f},this).reduce(function(x,y){return Math.max(x,y)},0)};e.setTableHeaderRow=function(u){n.call(this),this.internal.__cell__.tableHeaderRow=u},e.printHeaderRow=function(u,d){if(n.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var f;if(r=!0,typeof this.internal.__cell__.headerFunction=="function"){var m=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new s(m[0],m[1],m[2],m[3],void 0,-1)}this.setFont(void 0,"bold");for(var g=[],x=0;x<this.internal.__cell__.tableHeaderRow.length;x+=1){f=this.internal.__cell__.tableHeaderRow[x].clone(),d&&(f.y=this.internal.__cell__.margins.top||0,g.push(f)),f.lineNumber=u;var y=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),o.call(this,f),this.setTextColor(y)}g.length>0&&this.setTableHeaderRow(g),this.setFont(void 0,"normal"),r=!1}})(tr.API);var TW={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},PW=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],rk=EW(PW),DW=[100,200,300,400,500,600,700,800,900],USe=EW(DW);function $S(e){var t=e.family.replace(/"|'/g,"").toLowerCase(),r=(function(s){return TW[s=s||"normal"]?s:"normal"})(e.style),n=(function(s){return s?typeof s=="number"?s>=100&&s<=900&&s%100==0?s:400:/^\d00$/.test(s)?parseInt(s):s==="bold"?700:400:400})(e.weight),a=(function(s){return typeof rk[s=s||"normal"]=="number"?s:"normal"})(e.stretch);return{family:t,style:r,weight:n,stretch:a,src:e.src||[],ref:e.ref||{name:t,style:[a,r,n].join(" ")}}}function fF(e,t,r,n){var a;for(a=r;a>=0&&a<t.length;a+=n)if(e[t[a]])return e[t[a]];for(a=r;a>=0&&a<t.length;a-=n)if(e[t[a]])return e[t[a]]}var $Se={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},hF={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function mF(e){return[e.stretch,e.style,e.weight,e.family].join(" ")}function pF(e){return e.trimLeft()}function HSe(e,t){for(var r=0;r<e.length;){if(e.charAt(r)===t)return[e.substring(0,r),e.substring(r+1)];r+=1}return null}function VSe(e){var t=e.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return t===null?null:[t[0],e.substring(t[0].length)]}var Np,pb,xF,gF,vF,HS=["times"];function yF(e,t,r,n,a){var s=4,o=wF;switch(a){case tr.API.image_compression.FAST:s=1,o=bF;break;case tr.API.image_compression.MEDIUM:s=6,o=jF;break;case tr.API.image_compression.SLOW:s=9,o=NF}e=(function(u,d,f,m){for(var g,x=u.length/d,y=new Uint8Array(u.length+x),v=[qSe,bF,wF,jF,NF],w=0;w<x;w+=1){var j=w*d,k=u.subarray(j,j+d);if(m)y.set(m(k,f,g),j+w);else{for(var A=v.length,T=[],M=0;M<A;M+=1)T[M]=v[M](k,f,g);var B=GSe(T.concat());y.set(T[B],j+w)}g=k}return y})(e,t,Math.ceil(r*n/8),o);var l=KA(e,{level:s});return tr.API.__addimage__.arrayBufferToBinaryString(l)}function qSe(e){var t=Array.apply([],e);return t.unshift(0),t}function bF(e,t){var r=e.length,n=[];n[0]=1;for(var a=0;a<r;a+=1){var s=e[a-t]||0;n[a+1]=e[a]-s+256&255}return n}function wF(e,t,r){var n=e.length,a=[];a[0]=2;for(var s=0;s<n;s+=1){var o=r&&r[s]||0;a[s+1]=e[s]-o+256&255}return a}function jF(e,t,r){var n=e.length,a=[];a[0]=3;for(var s=0;s<n;s+=1){var o=e[s-t]||0,l=r&&r[s]||0;a[s+1]=e[s]+256-(o+l>>>1)&255}return a}function NF(e,t,r){var n=e.length,a=[];a[0]=4;for(var s=0;s<n;s+=1){var o=WSe(e[s-t]||0,r&&r[s]||0,r&&r[s-t]||0);a[s+1]=e[s]-o+256&255}return a}function WSe(e,t,r){if(e===t&&t===r)return e;var n=Math.abs(t-r),a=Math.abs(e-r),s=Math.abs(e+t-r-r);return n<=a&&n<=s?e:a<=s?t:r}function GSe(e){var t=e.map(function(r){return r.reduce(function(n,a){return n+Math.abs(a)},0)});return t.indexOf(Math.min.apply(null,t))}function VS(e,t,r){var n=t*r,a=Math.floor(n/8),s=16-(n-8*a+r),o=(1<<r)-1;return OW(e,a)>>s&o}function SF(e,t,r,n){var a=r*n,s=Math.floor(a/8),o=16-(a-8*s+n),l=(1<<n)-1,u=(t&l)<<o;(function(d,f,m){if(f+1<d.byteLength)d.setUint16(f,m,!1);else{var g=m>>8&255;d.setUint8(f,g)}})(e,s,OW(e,s)&~(l<<o)&65535|u)}function OW(e,t){return t+1<e.byteLength?e.getUint16(t,!1):e.getUint8(t)<<8}function YSe(e){var t=0;if(e[t++]!==71||e[t++]!==73||e[t++]!==70||e[t++]!==56||(e[t++]+1&253)!=56||e[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var r=e[t++]|e[t++]<<8,n=e[t++]|e[t++]<<8,a=e[t++],s=a>>7,o=1<<1+(7&a);e[t++],e[t++];var l=null,u=null;s&&(l=t,u=o,t+=3*o);var d=!0,f=[],m=0,g=null,x=0,y=null;for(this.width=r,this.height=n;d&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(e[t]!==11||e[t+1]==78&&e[t+2]==69&&e[t+3]==84&&e[t+4]==83&&e[t+5]==67&&e[t+6]==65&&e[t+7]==80&&e[t+8]==69&&e[t+9]==50&&e[t+10]==46&&e[t+11]==48&&e[t+12]==3&&e[t+13]==1&&e[t+16]==0)t+=14,y=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((P=e[t++])>=0))throw Error("Invalid block size");if(P===0)break;t+=P}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw new Error("Invalid graphics extension block.");var v=e[t++];m=e[t++]|e[t++]<<8,g=e[t++],1&v||(g=null),x=v>>2&7,t++;break;case 254:for(;;){if(!((P=e[t++])>=0))throw Error("Invalid block size");if(P===0)break;t+=P}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var w=e[t++]|e[t++]<<8,j=e[t++]|e[t++]<<8,k=e[t++]|e[t++]<<8,A=e[t++]|e[t++]<<8,T=e[t++],M=T>>6&1,B=1<<1+(7&T),L=l,F=u,I=!1;T>>7&&(I=!0,L=t,F=B,t+=3*B);var q=t;for(t++;;){var P;if(!((P=e[t++])>=0))throw Error("Invalid block size");if(P===0)break;t+=P}f.push({x:w,y:j,width:k,height:A,has_local_palette:I,palette_offset:L,palette_size:F,data_offset:q,data_length:t-q,transparent_index:g,interlaced:!!M,delay:m,disposal:x});break;case 59:d=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return f.length},this.loopCount=function(){return y},this.frameInfo=function(R){if(R<0||R>=f.length)throw new Error("Frame index out of range.");return f[R]},this.decodeAndBlitFrameBGRA=function(R,K){var ee=this.frameInfo(R),se=ee.width*ee.height;if(se>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var Z=new Uint8Array(se);AF(e,ee.data_offset,Z,se);var ne=ee.palette_offset,X=ee.transparent_index;X===null&&(X=256);var le=ee.width,Ae=r-le,ce=le,D=4*(ee.y*r+ee.x),H=4*((ee.y+ee.height)*r+ee.x),G=D,E=4*Ae;ee.interlaced===!0&&(E+=4*r*7);for(var re=8,he=0,oe=Z.length;he<oe;++he){var z=Z[he];if(ce===0&&(ce=le,(G+=E)>=H&&(E=4*Ae+4*r*(re-1),G=D+(le+Ae)*(re<<1),re>>=1)),z===X)G+=4;else{var fe=e[ne+3*z],de=e[ne+3*z+1],W=e[ne+3*z+2];K[G++]=W,K[G++]=de,K[G++]=fe,K[G++]=255}--ce}},this.decodeAndBlitFrameRGBA=function(R,K){var ee=this.frameInfo(R),se=ee.width*ee.height;if(se>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var Z=new Uint8Array(se);AF(e,ee.data_offset,Z,se);var ne=ee.palette_offset,X=ee.transparent_index;X===null&&(X=256);var le=ee.width,Ae=r-le,ce=le,D=4*(ee.y*r+ee.x),H=4*((ee.y+ee.height)*r+ee.x),G=D,E=4*Ae;ee.interlaced===!0&&(E+=4*r*7);for(var re=8,he=0,oe=Z.length;he<oe;++he){var z=Z[he];if(ce===0&&(ce=le,(G+=E)>=H&&(E=4*Ae+4*r*(re-1),G=D+(le+Ae)*(re<<1),re>>=1)),z===X)G+=4;else{var fe=e[ne+3*z],de=e[ne+3*z+1],W=e[ne+3*z+2];K[G++]=fe,K[G++]=de,K[G++]=W,K[G++]=255}--ce}}}function AF(e,t,r,n){for(var a=e[t++],s=1<<a,o=s+1,l=o+1,u=a+1,d=(1<<u)-1,f=0,m=0,g=0,x=e[t++],y=new Int32Array(4096),v=null;;){for(;f<16&&x!==0;)m|=e[t++]<<f,f+=8,x===1?x=e[t++]:--x;if(f<u)break;var w=m&d;if(m>>=u,f-=u,w!==s){if(w===o)break;for(var j=w<l?w:v,k=0,A=j;A>s;)A=y[A]>>8,++k;var T=A;if(g+k+(j!==w?1:0)>n)return void na.log("Warning, gif stream longer than expected.");r[g++]=T;var M=g+=k;for(j!==w&&(r[g++]=T),A=j;k--;)A=y[A],r[--M]=255&A,A>>=8;v!==null&&l<4096&&(y[l++]=v<<8|T,l>=d+1&&u<12&&(++u,d=d<<1|1)),v=w}else l=o+1,d=(1<<(u=a+1))-1,v=null}return g!==n&&na.log("Warning, gif stream shorter than expected."),r}/**
 * @license
  Copyright (c) 2008, Adobe Systems Incorporated
  All rights reserved.

  Redistribution and use in source and binary forms, with or without 
  modification, are permitted provided that the following conditions are
  met:

  * Redistributions of source code must retain the above copyright notice, 
    this list of conditions and the following disclaimer.
  
  * Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the 
    documentation and/or other materials provided with the distribution.
  
  * Neither the name of Adobe Systems Incorporated nor the names of its 
    contributors may be used to endorse or promote products derived from 
    this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/function qS(e){var t,r,n,a,s,o=Math.floor,l=new Array(64),u=new Array(64),d=new Array(64),f=new Array(64),m=new Array(65535),g=new Array(65535),x=new Array(64),y=new Array(64),v=[],w=0,j=7,k=new Array(64),A=new Array(64),T=new Array(64),M=new Array(256),B=new Array(2048),L=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],F=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],I=[0,1,2,3,4,5,6,7,8,9,10,11],q=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],P=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],R=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],K=[0,1,2,3,4,5,6,7,8,9,10,11],ee=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],se=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function Z(D,H){for(var G=0,E=0,re=new Array,he=1;he<=16;he++){for(var oe=1;oe<=D[he];oe++)re[H[E]]=[],re[H[E]][0]=G,re[H[E]][1]=he,E++,G++;G*=2}return re}function ne(D){for(var H=D[0],G=D[1]-1;G>=0;)H&1<<G&&(w|=1<<j),G--,--j<0&&(w==255?(X(255),X(0)):X(w),j=7,w=0)}function X(D){v.push(D)}function le(D){X(D>>8&255),X(255&D)}function Ae(D,H,G,E,re){for(var he,oe=re[0],z=re[240],fe=(function(Xe,Ne){var Ye,at,Y,we,J,ve,Oe,xe,qe,me,Ge=0;for(qe=0;qe<8;++qe){Ye=Xe[Ge],at=Xe[Ge+1],Y=Xe[Ge+2],we=Xe[Ge+3],J=Xe[Ge+4],ve=Xe[Ge+5],Oe=Xe[Ge+6];var Be=Ye+(xe=Xe[Ge+7]),it=Ye-xe,st=at+Oe,Ve=at-Oe,te=Y+ve,Ue=Y-ve,ot=we+J,vt=we-J,_t=Be+ot,qt=Be-ot,Ft=st+te,Dt=st-te;Xe[Ge]=_t+Ft,Xe[Ge+4]=_t-Ft;var Rt=.707106781*(Dt+qt);Xe[Ge+2]=qt+Rt,Xe[Ge+6]=qt-Rt;var wr=.382683433*((_t=vt+Ue)-(Dt=Ve+it)),gr=.5411961*_t+wr,Er=1.306562965*Dt+wr,Ur=.707106781*(Ft=Ue+Ve),Ht=it+Ur,It=it-Ur;Xe[Ge+5]=It+gr,Xe[Ge+3]=It-gr,Xe[Ge+1]=Ht+Er,Xe[Ge+7]=Ht-Er,Ge+=8}for(Ge=0,qe=0;qe<8;++qe){Ye=Xe[Ge],at=Xe[Ge+8],Y=Xe[Ge+16],we=Xe[Ge+24],J=Xe[Ge+32],ve=Xe[Ge+40],Oe=Xe[Ge+48];var Rr=Ye+(xe=Xe[Ge+56]),kr=Ye-xe,qr=at+Oe,Xr=at-Oe,Zr=Y+ve,ye=Y-ve,Ie=we+J,Ee=we-J,Te=Rr+Ie,Re=Rr-Ie,ze=qr+Zr,ct=qr-Zr;Xe[Ge]=Te+ze,Xe[Ge+32]=Te-ze;var bt=.707106781*(ct+Re);Xe[Ge+16]=Re+bt,Xe[Ge+48]=Re-bt;var dt=.382683433*((Te=Ee+ye)-(ct=Xr+kr)),ft=.5411961*Te+dt,mt=1.306562965*ct+dt,Lt=.707106781*(ze=ye+Xr),Vt=kr+Lt,Xt=kr-Lt;Xe[Ge+40]=Xt+ft,Xe[Ge+24]=Xt-ft,Xe[Ge+8]=Vt+mt,Xe[Ge+56]=Vt-mt,Ge++}for(qe=0;qe<64;++qe)me=Xe[qe]*Ne[qe],x[qe]=me>0?me+.5|0:me-.5|0;return x})(D,H),de=0;de<64;++de)y[L[de]]=fe[de];var W=y[0]-G;G=y[0],W==0?ne(E[0]):(ne(E[g[he=32767+W]]),ne(m[he]));for(var ae=63;ae>0&&y[ae]==0;)ae--;if(ae==0)return ne(oe),G;for(var _e,ue=1;ue<=ae;){for(var ke=ue;y[ue]==0&&ue<=ae;)++ue;var $e=ue-ke;if($e>=16){_e=$e>>4;for(var Je=1;Je<=_e;++Je)ne(z);$e&=15}he=32767+y[ue],ne(re[($e<<4)+g[he]]),ne(m[he]),ue++}return ae!=63&&ne(oe),G}function ce(D){D=Math.min(Math.max(D,1),100),s!=D&&((function(H){for(var G=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],E=0;E<64;E++){var re=o((G[E]*H+50)/100);re=Math.min(Math.max(re,1),255),l[L[E]]=re}for(var he=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],oe=0;oe<64;oe++){var z=o((he[oe]*H+50)/100);z=Math.min(Math.max(z,1),255),u[L[oe]]=z}for(var fe=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],de=0,W=0;W<8;W++)for(var ae=0;ae<8;ae++)d[de]=1/(l[L[de]]*fe[W]*fe[ae]*8),f[de]=1/(u[L[de]]*fe[W]*fe[ae]*8),de++})(D<50?Math.floor(5e3/D):Math.floor(200-2*D)),s=D)}this.encode=function(D,H){H&&ce(H),v=new Array,w=0,j=7,le(65496),le(65504),le(16),X(74),X(70),X(73),X(70),X(0),X(1),X(1),X(0),le(1),le(1),X(0),X(0),(function(){le(65499),le(132),X(0);for(var at=0;at<64;at++)X(l[at]);X(1);for(var Y=0;Y<64;Y++)X(u[Y])})(),(function(at,Y){le(65472),le(17),X(8),le(Y),le(at),X(3),X(1),X(17),X(0),X(2),X(17),X(1),X(3),X(17),X(1)})(D.width,D.height),(function(){le(65476),le(418),X(0);for(var at=0;at<16;at++)X(F[at+1]);for(var Y=0;Y<=11;Y++)X(I[Y]);X(16);for(var we=0;we<16;we++)X(q[we+1]);for(var J=0;J<=161;J++)X(P[J]);X(1);for(var ve=0;ve<16;ve++)X(R[ve+1]);for(var Oe=0;Oe<=11;Oe++)X(K[Oe]);X(17);for(var xe=0;xe<16;xe++)X(ee[xe+1]);for(var qe=0;qe<=161;qe++)X(se[qe])})(),le(65498),le(12),X(3),X(1),X(0),X(2),X(17),X(3),X(17),X(0),X(63),X(0);var G=0,E=0,re=0;w=0,j=7,this.encode.displayName="_encode_";for(var he,oe,z,fe,de,W,ae,_e,ue,ke=D.data,$e=D.width,Je=D.height,Xe=4*$e,Ne=0;Ne<Je;){for(he=0;he<Xe;){for(de=Xe*Ne+he,ae=-1,_e=0,ue=0;ue<64;ue++)W=de+(_e=ue>>3)*Xe+(ae=4*(7&ue)),Ne+_e>=Je&&(W-=Xe*(Ne+1+_e-Je)),he+ae>=Xe&&(W-=he+ae-Xe+4),oe=ke[W++],z=ke[W++],fe=ke[W++],k[ue]=(B[oe]+B[z+256|0]+B[fe+512|0]>>16)-128,A[ue]=(B[oe+768|0]+B[z+1024|0]+B[fe+1280|0]>>16)-128,T[ue]=(B[oe+1280|0]+B[z+1536|0]+B[fe+1792|0]>>16)-128;G=Ae(k,d,G,t,n),E=Ae(A,f,E,r,a),re=Ae(T,f,re,r,a),he+=32}Ne+=8}if(j>=0){var Ye=[];Ye[1]=j+1,Ye[0]=(1<<j+1)-1,ne(Ye)}return le(65497),new Uint8Array(v)},e=e||50,(function(){for(var D=String.fromCharCode,H=0;H<256;H++)M[H]=D(H)})(),t=Z(F,I),r=Z(R,K),n=Z(q,P),a=Z(ee,se),(function(){for(var D=1,H=2,G=1;G<=15;G++){for(var E=D;E<H;E++)g[32767+E]=G,m[32767+E]=[],m[32767+E][1]=G,m[32767+E][0]=E;for(var re=-(H-1);re<=-D;re++)g[32767+re]=G,m[32767+re]=[],m[32767+re][1]=G,m[32767+re][0]=H-1+re;D<<=1,H<<=1}})(),(function(){for(var D=0;D<256;D++)B[D]=19595*D,B[D+256|0]=38470*D,B[D+512|0]=7471*D+32768,B[D+768|0]=-11059*D,B[D+1024|0]=-21709*D,B[D+1280|0]=32768*D+8421375,B[D+1536|0]=-27439*D,B[D+1792|0]=-5329*D})(),ce(e)}/**
 * @license
 * Copyright (c) 2017 Aras Abbasi
 *
 * Licensed under the MIT License.
 * http://opensource.org/licenses/mit-license
 */function bc(e,t){if(this.pos=0,this.buffer=e,this.datav=new DataView(e.buffer),this.is_with_alpha=!!t,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,["BM","BA","CI","CP","IC","PT"].indexOf(this.flag)===-1)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}function kF(e){function t(I){if(!I)throw Error("assert :P")}function r(I,q,P){for(var R=0;4>R;R++)if(I[q+R]!=P.charCodeAt(R))return!0;return!1}function n(I,q,P,R,K){for(var ee=0;ee<K;ee++)I[q+ee]=P[R+ee]}function a(I,q,P,R){for(var K=0;K<R;K++)I[q+K]=P}function s(I){return new Int32Array(I)}function o(I,q){for(var P=[],R=0;R<I;R++)P.push(new q);return P}function l(I,q){var P=[];return(function R(K,ee,se){for(var Z=se[ee],ne=0;ne<Z&&(K.push(se.length>ee+1?[]:new q),!(se.length<ee+1));ne++)R(K[ne],ee+1,se)})(P,0,I),P}var u=function(){var I=this;function q(S,_){for(var V=1<<_-1>>>0;S&V;)V>>>=1;return V?(S&V-1)+V:S}function P(S,_,V,Q,ge){t(!(Q%V));do S[_+(Q-=V)]=ge;while(0<Q)}function R(S,_,V,Q,ge){if(t(2328>=ge),512>=ge)var be=s(512);else if((be=s(ge))==null)return 0;return(function(je,Ce,Pe,Fe,Ke,ht){var Le,Qe,lt=Ce,jt=1<<Pe,ut=s(16),wt=s(16);for(t(Ke!=0),t(Fe!=null),t(je!=null),t(0<Pe),Qe=0;Qe<Ke;++Qe){if(15<Fe[Qe])return 0;++ut[Fe[Qe]]}if(ut[0]==Ke)return 0;for(wt[1]=0,Le=1;15>Le;++Le){if(ut[Le]>1<<Le)return 0;wt[Le+1]=wt[Le]+ut[Le]}for(Qe=0;Qe<Ke;++Qe)Le=Fe[Qe],0<Fe[Qe]&&(ht[wt[Le]++]=Qe);if(wt[15]==1)return(Fe=new K).g=0,Fe.value=ht[0],P(je,lt,1,jt,Fe),jt;var kt,zt=-1,Tt=jt-1,cr=0,Jt=1,Dr=1,nr=1<<Pe;for(Qe=0,Le=1,Ke=2;Le<=Pe;++Le,Ke<<=1){if(Jt+=Dr<<=1,0>(Dr-=ut[Le]))return 0;for(;0<ut[Le];--ut[Le])(Fe=new K).g=Le,Fe.value=ht[Qe++],P(je,lt+cr,Ke,nr,Fe),cr=q(cr,Le)}for(Le=Pe+1,Ke=2;15>=Le;++Le,Ke<<=1){if(Jt+=Dr<<=1,0>(Dr-=ut[Le]))return 0;for(;0<ut[Le];--ut[Le]){if(Fe=new K,(cr&Tt)!=zt){for(lt+=nr,kt=1<<(zt=Le)-Pe;15>zt&&!(0>=(kt-=ut[zt]));)++zt,kt<<=1;jt+=nr=1<<(kt=zt-Pe),je[Ce+(zt=cr&Tt)].g=kt+Pe,je[Ce+zt].value=lt-Ce-zt}Fe.g=Le-Pe,Fe.value=ht[Qe++],P(je,lt+(cr>>Pe),Ke,nr,Fe),cr=q(cr,Le)}}return Jt!=2*wt[15]-1?0:jt})(S,_,V,Q,ge,be)}function K(){this.value=this.g=0}function ee(){this.value=this.g=0}function se(){this.G=o(5,K),this.H=s(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=o(cd,ee)}function Z(S,_,V,Q){t(S!=null),t(_!=null),t(2147483648>Q),S.Ca=254,S.I=0,S.b=-8,S.Ka=0,S.oa=_,S.pa=V,S.Jd=_,S.Yc=V+Q,S.Zc=4<=Q?V+Q-4+1:V,oe(S)}function ne(S,_){for(var V=0;0<_--;)V|=fe(S,128)<<_;return V}function X(S,_){var V=ne(S,_);return z(S)?-V:V}function le(S,_,V,Q){var ge,be=0;for(t(S!=null),t(_!=null),t(4294967288>Q),S.Sb=Q,S.Ra=0,S.u=0,S.h=0,4<Q&&(Q=4),ge=0;ge<Q;++ge)be+=_[V+ge]<<8*ge;S.Ra=be,S.bb=Q,S.oa=_,S.pa=V}function Ae(S){for(;8<=S.u&&S.bb<S.Sb;)S.Ra>>>=8,S.Ra+=S.oa[S.pa+S.bb]<<Ci-8>>>0,++S.bb,S.u-=8;E(S)&&(S.h=1,S.u=0)}function ce(S,_){if(t(0<=_),!S.h&&_<=ud){var V=G(S)&Jc[_];return S.u+=_,Ae(S),V}return S.h=1,S.u=0}function D(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function H(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function G(S){return S.Ra>>>(S.u&Ci-1)>>>0}function E(S){return t(S.bb<=S.Sb),S.h||S.bb==S.Sb&&S.u>Ci}function re(S,_){S.u=_,S.h=E(S)}function he(S){S.u>=vs&&(t(S.u>=vs),Ae(S))}function oe(S){t(S!=null&&S.oa!=null),S.pa<S.Zc?(S.I=(S.oa[S.pa++]|S.I<<8)>>>0,S.b+=8):(t(S!=null&&S.oa!=null),S.pa<S.Yc?(S.b+=8,S.I=S.oa[S.pa++]|S.I<<8):S.Ka?S.b=0:(S.I<<=8,S.b+=8,S.Ka=1))}function z(S){return ne(S,1)}function fe(S,_){var V=S.Ca;0>S.b&&oe(S);var Q=S.b,ge=V*_>>>8,be=(S.I>>>Q>ge)+0;for(be?(V-=ge,S.I-=ge+1<<Q>>>0):V=ge+1,Q=V,ge=0;256<=Q;)ge+=8,Q>>=8;return Q=7^ge+dd[Q],S.b-=Q,S.Ca=(V<<Q)-1,be}function de(S,_,V){S[_+0]=V>>24&255,S[_+1]=V>>16&255,S[_+2]=V>>8&255,S[_+3]=255&V}function W(S,_){return S[_+0]|S[_+1]<<8}function ae(S,_){return W(S,_)|S[_+2]<<16}function _e(S,_){return W(S,_)|W(S,_+2)<<16}function ue(S,_){var V=1<<_;return t(S!=null),t(0<_),S.X=s(V),S.X==null?0:(S.Mb=32-_,S.Xa=_,1)}function ke(S,_){t(S!=null),t(_!=null),t(S.Xa==_.Xa),n(_.X,0,S.X,0,1<<_.Xa)}function $e(){this.X=[],this.Xa=this.Mb=0}function Je(S,_,V,Q){t(V!=null),t(Q!=null);var ge=V[0],be=Q[0];return ge==0&&(ge=(S*be+_/2)/_),be==0&&(be=(_*ge+S/2)/S),0>=ge||0>=be?0:(V[0]=ge,Q[0]=be,1)}function Xe(S,_){return S+(1<<_)-1>>>_}function Ne(S,_){return((4278255360&S)+(4278255360&_)>>>0&4278255360)+((16711935&S)+(16711935&_)>>>0&16711935)>>>0}function Ye(S,_){I[_]=function(V,Q,ge,be,je,Ce,Pe){var Fe;for(Fe=0;Fe<je;++Fe){var Ke=I[S](Ce[Pe+Fe-1],ge,be+Fe);Ce[Pe+Fe]=Ne(V[Q+Fe],Ke)}}}function at(){this.ud=this.hd=this.jd=0}function Y(S,_){return((4278124286&(S^_))>>>1)+(S&_)>>>0}function we(S){return 0<=S&&256>S?S:0>S?0:255<S?255:void 0}function J(S,_){return we(S+(S-_+.5>>1))}function ve(S,_,V){return Math.abs(_-V)-Math.abs(S-V)}function Oe(S,_,V,Q,ge,be,je){for(Q=be[je-1],V=0;V<ge;++V)be[je+V]=Q=Ne(S[_+V],Q)}function xe(S,_,V,Q,ge){var be;for(be=0;be<V;++be){var je=S[_+be],Ce=je>>8&255,Pe=16711935&(Pe=(Pe=16711935&je)+((Ce<<16)+Ce));Q[ge+be]=(4278255360&je)+Pe>>>0}}function qe(S,_){_.jd=255&S,_.hd=S>>8&255,_.ud=S>>16&255}function me(S,_,V,Q,ge,be){var je;for(je=0;je<Q;++je){var Ce=_[V+je],Pe=Ce>>>8,Fe=Ce,Ke=255&(Ke=(Ke=Ce>>>16)+((S.jd<<24>>24)*(Pe<<24>>24)>>>5));Fe=255&(Fe=(Fe+=(S.hd<<24>>24)*(Pe<<24>>24)>>>5)+((S.ud<<24>>24)*(Ke<<24>>24)>>>5)),ge[be+je]=(4278255360&Ce)+(Ke<<16)+Fe}}function Ge(S,_,V,Q,ge){I[_]=function(be,je,Ce,Pe,Fe,Ke,ht,Le,Qe){for(Pe=ht;Pe<Le;++Pe)for(ht=0;ht<Qe;++ht)Fe[Ke++]=ge(Ce[Q(be[je++])])},I[S]=function(be,je,Ce,Pe,Fe,Ke,ht){var Le=8>>be.b,Qe=be.Ea,lt=be.K[0],jt=be.w;if(8>Le)for(be=(1<<be.b)-1,jt=(1<<Le)-1;je<Ce;++je){var ut,wt=0;for(ut=0;ut<Qe;++ut)ut&be||(wt=Q(Pe[Fe++])),Ke[ht++]=ge(lt[wt&jt]),wt>>=Le}else I["VP8LMapColor"+V](Pe,Fe,lt,jt,Ke,ht,je,Ce,Qe)}}function Be(S,_,V,Q,ge){for(V=_+V;_<V;){var be=S[_++];Q[ge++]=be>>16&255,Q[ge++]=be>>8&255,Q[ge++]=255&be}}function it(S,_,V,Q,ge){for(V=_+V;_<V;){var be=S[_++];Q[ge++]=be>>16&255,Q[ge++]=be>>8&255,Q[ge++]=255&be,Q[ge++]=be>>24&255}}function st(S,_,V,Q,ge){for(V=_+V;_<V;){var be=(je=S[_++])>>16&240|je>>12&15,je=240&je|je>>28&15;Q[ge++]=be,Q[ge++]=je}}function Ve(S,_,V,Q,ge){for(V=_+V;_<V;){var be=(je=S[_++])>>16&248|je>>13&7,je=je>>5&224|je>>3&31;Q[ge++]=be,Q[ge++]=je}}function te(S,_,V,Q,ge){for(V=_+V;_<V;){var be=S[_++];Q[ge++]=255&be,Q[ge++]=be>>8&255,Q[ge++]=be>>16&255}}function Ue(S,_,V,Q,ge,be){if(be==0)for(V=_+V;_<V;)de(Q,((be=S[_++])[0]>>24|be[1]>>8&65280|be[2]<<8&16711680|be[3]<<24)>>>0),ge+=32;else n(Q,ge,S,_,V)}function ot(S,_){I[_][0]=I[S+"0"],I[_][1]=I[S+"1"],I[_][2]=I[S+"2"],I[_][3]=I[S+"3"],I[_][4]=I[S+"4"],I[_][5]=I[S+"5"],I[_][6]=I[S+"6"],I[_][7]=I[S+"7"],I[_][8]=I[S+"8"],I[_][9]=I[S+"9"],I[_][10]=I[S+"10"],I[_][11]=I[S+"11"],I[_][12]=I[S+"12"],I[_][13]=I[S+"13"],I[_][14]=I[S+"0"],I[_][15]=I[S+"0"]}function vt(S){return S==sm||S==B0||S==_f||S==z0}function _t(){this.eb=[],this.size=this.A=this.fb=0}function qt(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function Ft(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new _t,this.f.kb=new qt,this.sd=null}function Dt(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function Rt(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function wr(S){return alert("todo:WebPSamplerProcessPlane"),S.T}function gr(S,_){var V=S.T,Q=_.ba.f.RGBA,ge=Q.eb,be=Q.fb+S.ka*Q.A,je=Pi[_.ba.S],Ce=S.y,Pe=S.O,Fe=S.f,Ke=S.N,ht=S.ea,Le=S.W,Qe=_.cc,lt=_.dc,jt=_.Mc,ut=_.Nc,wt=S.ka,kt=S.ka+S.T,zt=S.U,Tt=zt+1>>1;for(wt==0?je(Ce,Pe,null,null,Fe,Ke,ht,Le,Fe,Ke,ht,Le,ge,be,null,null,zt):(je(_.ec,_.fc,Ce,Pe,Qe,lt,jt,ut,Fe,Ke,ht,Le,ge,be-Q.A,ge,be,zt),++V);wt+2<kt;wt+=2)Qe=Fe,lt=Ke,jt=ht,ut=Le,Ke+=S.Rc,Le+=S.Rc,be+=2*Q.A,je(Ce,(Pe+=2*S.fa)-S.fa,Ce,Pe,Qe,lt,jt,ut,Fe,Ke,ht,Le,ge,be-Q.A,ge,be,zt);return Pe+=S.fa,S.j+kt<S.o?(n(_.ec,_.fc,Ce,Pe,zt),n(_.cc,_.dc,Fe,Ke,Tt),n(_.Mc,_.Nc,ht,Le,Tt),V--):1&kt||je(Ce,Pe,null,null,Fe,Ke,ht,Le,Fe,Ke,ht,Le,ge,be+Q.A,null,null,zt),V}function Er(S,_,V){var Q=S.F,ge=[S.J];if(Q!=null){var be=S.U,je=_.ba.S,Ce=je==im||je==_f;_=_.ba.f.RGBA;var Pe=[0],Fe=S.ka;Pe[0]=S.T,S.Kb&&(Fe==0?--Pe[0]:(--Fe,ge[0]-=S.width),S.j+S.ka+S.T==S.o&&(Pe[0]=S.o-S.j-Fe));var Ke=_.eb;Fe=_.fb+Fe*_.A,S=tm(Q,ge[0],S.width,be,Pe,Ke,Fe+(Ce?0:3),_.A),t(V==Pe),S&&vt(je)&&xd(Ke,Fe,Ce,be,Pe,_.A)}return 0}function Ur(S){var _=S.ma,V=_.ba.S,Q=11>V,ge=V==Qi||V==wo||V==im||V==Cf||V==12||vt(V);if(_.memory=null,_.Ib=null,_.Jb=null,_.Nd=null,!Xi(_.Oa,S,ge?11:12))return 0;if(ge&&vt(V)&&oc(),S.da)alert("todo:use_scaling");else{if(Q){if(_.Ib=wr,S.Kb){if(V=S.U+1>>1,_.memory=s(S.U+2*V),_.memory==null)return 0;_.ec=_.memory,_.fc=0,_.cc=_.ec,_.dc=_.fc+S.U,_.Mc=_.cc,_.Nc=_.dc+V,_.Ib=gr,oc()}}else alert("todo:EmitYUV");ge&&(_.Jb=Er,Q&&fa())}if(Q&&!lu){for(S=0;256>S;++S)Di[S]=89858*(S-128)+Pf>>Co,nj[S]=-22014*(S-128)+Pf,G1[S]=-45773*(S-128),q0[S]=113618*(S-128)+Pf>>Co;for(S=bd;S<ou;++S)_=76283*(S-16)+Pf>>Co,aj[S-bd]=ua(_,255),ij[S-bd]=ua(_+8>>4,15);lu=1}return 1}function Ht(S){var _=S.ma,V=S.U,Q=S.T;return t(!(1&S.ka)),0>=V||0>=Q?0:(V=_.Ib(S,_),_.Jb!=null&&_.Jb(S,_,V),_.Dc+=V,1)}function It(S){S.ma.memory=null}function Rr(S,_,V,Q){return ce(S,8)!=47?0:(_[0]=ce(S,14)+1,V[0]=ce(S,14)+1,Q[0]=ce(S,1),ce(S,3)!=0?0:!S.h)}function kr(S,_){if(4>S)return S+1;var V=S-2>>1;return(2+(1&S)<<V)+ce(_,V)+1}function qr(S,_){return 120<_?_-120:1<=(V=((V=No[_-1])>>4)*S+(8-(15&V)))?V:1;var V}function Xr(S,_,V){var Q=G(V),ge=S[_+=255&Q].g-8;return 0<ge&&(re(V,V.u+8),Q=G(V),_+=S[_].value,_+=Q&(1<<ge)-1),re(V,V.u+S[_].g),S[_].value}function Zr(S,_,V){return V.g+=S.g,V.value+=S.value<<_>>>0,t(8>=V.g),S.g}function ye(S,_,V){var Q=S.xc;return t((_=Q==0?0:S.vc[S.md*(V>>Q)+(_>>Q)])<S.Wb),S.Ya[_]}function Ie(S,_,V,Q){var ge=S.ab,be=S.c*_,je=S.C;_=je+_;var Ce=V,Pe=Q;for(Q=S.Ta,V=S.Ua;0<ge--;){var Fe=S.gc[ge],Ke=je,ht=_,Le=Ce,Qe=Pe,lt=(Pe=Q,Ce=V,Fe.Ea);switch(t(Ke<ht),t(ht<=Fe.nc),Fe.hc){case 2:Nf(Le,Qe,(ht-Ke)*lt,Pe,Ce);break;case 0:var jt=Ke,ut=ht,wt=Pe,kt=Ce,zt=(nr=Fe).Ea;jt==0&&(cc(Le,Qe,null,null,1,wt,kt),Oe(Le,Qe+1,0,0,zt-1,wt,kt+1),Qe+=zt,kt+=zt,++jt);for(var Tt=1<<nr.b,cr=Tt-1,Jt=Xe(zt,nr.b),Dr=nr.K,nr=nr.w+(jt>>nr.b)*Jt;jt<ut;){var Jr=Dr,ta=nr,Lr=1;for(Qc(Le,Qe,wt,kt-zt,1,wt,kt);Lr<zt;){var Qt=(Lr&~cr)+Tt;Qt>zt&&(Qt=zt),(0,ys[Jr[ta++]>>8&15])(Le,Qe+ +Lr,wt,kt+Lr-zt,Qt-Lr,wt,kt+Lr),Lr=Qt}Qe+=zt,kt+=zt,++jt&cr||(nr+=Jt)}ht!=Fe.nc&&n(Pe,Ce-lt,Pe,Ce+(ht-Ke-1)*lt,lt);break;case 1:for(lt=Le,ut=Qe,zt=(Le=Fe.Ea)-(kt=Le&~(wt=(Qe=1<<Fe.b)-1)),jt=Xe(Le,Fe.b),Tt=Fe.K,Fe=Fe.w+(Ke>>Fe.b)*jt;Ke<ht;){for(cr=Tt,Jt=Fe,Dr=new at,nr=ut+kt,Jr=ut+Le;ut<nr;)qe(cr[Jt++],Dr),eu(Dr,lt,ut,Qe,Pe,Ce),ut+=Qe,Ce+=Qe;ut<Jr&&(qe(cr[Jt++],Dr),eu(Dr,lt,ut,zt,Pe,Ce),ut+=zt,Ce+=zt),++Ke&wt||(Fe+=jt)}break;case 3:if(Le==Pe&&Qe==Ce&&0<Fe.b){for(ut=Pe,Le=lt=Ce+(ht-Ke)*lt-(kt=(ht-Ke)*Xe(Fe.Ea,Fe.b)),Qe=Pe,wt=Ce,jt=[],kt=(zt=kt)-1;0<=kt;--kt)jt[kt]=Qe[wt+kt];for(kt=zt-1;0<=kt;--kt)ut[Le+kt]=jt[kt];fd(Fe,Ke,ht,Pe,lt,Pe,Ce)}else fd(Fe,Ke,ht,Le,Qe,Pe,Ce)}Ce=Q,Pe=V}Pe!=V&&n(Q,V,Ce,Pe,be)}function Ee(S,_){var V=S.V,Q=S.Ba+S.c*S.C,ge=_-S.C;if(t(_<=S.l.o),t(16>=ge),0<ge){var be=S.l,je=S.Ta,Ce=S.Ua,Pe=be.width;if(Ie(S,ge,V,Q),ge=Ce=[Ce],t((V=S.C)<(Q=_)),t(be.v<be.va),Q>be.o&&(Q=be.o),V<be.j){var Fe=be.j-V;V=be.j,ge[0]+=Fe*Pe}if(V>=Q?V=0:(ge[0]+=4*be.v,be.ka=V-be.j,be.U=be.va-be.v,be.T=Q-V,V=1),V){if(Ce=Ce[0],11>(V=S.ca).S){var Ke=V.f.RGBA,ht=(Q=V.S,ge=be.U,be=be.T,Fe=Ke.eb,Ke.A),Le=be;for(Ke=Ke.fb+S.Ma*Ke.A;0<Le--;){var Qe=je,lt=Ce,jt=ge,ut=Fe,wt=Ke;switch(Q){case I0:Sf(Qe,lt,jt,ut,wt);break;case Qi:Af(Qe,lt,jt,ut,wt);break;case sm:Af(Qe,lt,jt,ut,wt),xd(ut,wt,0,jt,1,0);break;case F0:md(Qe,lt,jt,ut,wt);break;case wo:Ue(Qe,lt,jt,ut,wt,1);break;case B0:Ue(Qe,lt,jt,ut,wt,1),xd(ut,wt,0,jt,1,0);break;case im:Ue(Qe,lt,jt,ut,wt,0);break;case _f:Ue(Qe,lt,jt,ut,wt,0),xd(ut,wt,1,jt,1,0);break;case Cf:hd(Qe,lt,jt,ut,wt);break;case z0:hd(Qe,lt,jt,ut,wt),bo(ut,wt,jt,1,0);break;case ru:uc(Qe,lt,jt,ut,wt);break;default:t(0)}Ce+=Pe,Ke+=ht}S.Ma+=be}else alert("todo:EmitRescaledRowsYUVA");t(S.Ma<=V.height)}}S.C=_,t(S.C<=S.i)}function Te(S){var _;if(0<S.ua)return 0;for(_=0;_<S.Wb;++_){var V=S.Ya[_].G,Q=S.Ya[_].H;if(0<V[1][Q[1]+0].g||0<V[2][Q[2]+0].g||0<V[3][Q[3]+0].g)return 0}return 1}function Re(S,_,V,Q,ge,be){if(S.Z!=0){var je=S.qd,Ce=S.rd;for(t(fc[S.Z]!=null);_<V;++_)fc[S.Z](je,Ce,Q,ge,Q,ge,be),je=Q,Ce=ge,ge+=be;S.qd=je,S.rd=Ce}}function ze(S,_){var V=S.l.ma,Q=V.Z==0||V.Z==1?S.l.j:S.C;if(Q=S.C<Q?Q:S.C,t(_<=S.l.o),_>Q){var ge=S.l.width,be=V.ca,je=V.tb+ge*Q,Ce=S.V,Pe=S.Ba+S.c*Q,Fe=S.gc;t(S.ab==1),t(Fe[0].hc==3),Hx(Fe[0],Q,_,Ce,Pe,be,je),Re(V,Q,_,be,je,ge)}S.C=S.Ma=_}function ct(S,_,V,Q,ge,be,je){var Ce=S.$/Q,Pe=S.$%Q,Fe=S.m,Ke=S.s,ht=V+S.$,Le=ht;ge=V+Q*ge;var Qe=V+Q*be,lt=280+Ke.ua,jt=S.Pb?Ce:16777216,ut=0<Ke.ua?Ke.Wa:null,wt=Ke.wc,kt=ht<Qe?ye(Ke,Pe,Ce):null;t(S.C<be),t(Qe<=ge);var zt=!1;e:for(;;){for(;zt||ht<Qe;){var Tt=0;if(Ce>=jt){var cr=ht-V;t((jt=S).Pb),jt.wd=jt.m,jt.xd=cr,0<jt.s.ua&&ke(jt.s.Wa,jt.s.vb),jt=Ce+nu}if(Pe&wt||(kt=ye(Ke,Pe,Ce)),t(kt!=null),kt.Qb&&(_[ht]=kt.qb,zt=!0),!zt)if(he(Fe),kt.jc){Tt=Fe,cr=_;var Jt=ht,Dr=kt.pd[G(Tt)&cd-1];t(kt.jc),256>Dr.g?(re(Tt,Tt.u+Dr.g),cr[Jt]=Dr.value,Tt=0):(re(Tt,Tt.u+Dr.g-256),t(256<=Dr.value),Tt=Dr.value),Tt==0&&(zt=!0)}else Tt=Xr(kt.G[0],kt.H[0],Fe);if(Fe.h)break;if(zt||256>Tt){if(!zt)if(kt.nd)_[ht]=(kt.qb|Tt<<8)>>>0;else{if(he(Fe),zt=Xr(kt.G[1],kt.H[1],Fe),he(Fe),cr=Xr(kt.G[2],kt.H[2],Fe),Jt=Xr(kt.G[3],kt.H[3],Fe),Fe.h)break;_[ht]=(Jt<<24|zt<<16|Tt<<8|cr)>>>0}if(zt=!1,++ht,++Pe>=Q&&(Pe=0,++Ce,je!=null&&Ce<=be&&!(Ce%16)&&je(S,Ce),ut!=null))for(;Le<ht;)Tt=_[Le++],ut.X[(506832829*Tt&4294967295)>>>ut.Mb]=Tt}else if(280>Tt){if(Tt=kr(Tt-256,Fe),cr=Xr(kt.G[4],kt.H[4],Fe),he(Fe),cr=qr(Q,cr=kr(cr,Fe)),Fe.h)break;if(ht-V<cr||ge-ht<Tt)break e;for(Jt=0;Jt<Tt;++Jt)_[ht+Jt]=_[ht+Jt-cr];for(ht+=Tt,Pe+=Tt;Pe>=Q;)Pe-=Q,++Ce,je!=null&&Ce<=be&&!(Ce%16)&&je(S,Ce);if(t(ht<=ge),Pe&wt&&(kt=ye(Ke,Pe,Ce)),ut!=null)for(;Le<ht;)Tt=_[Le++],ut.X[(506832829*Tt&4294967295)>>>ut.Mb]=Tt}else{if(!(Tt<lt))break e;for(zt=Tt-280,t(ut!=null);Le<ht;)Tt=_[Le++],ut.X[(506832829*Tt&4294967295)>>>ut.Mb]=Tt;Tt=ht,t(!(zt>>>(cr=ut).Xa)),_[Tt]=cr.X[zt],zt=!0}zt||t(Fe.h==E(Fe))}if(S.Pb&&Fe.h&&ht<ge)t(S.m.h),S.a=5,S.m=S.wd,S.$=S.xd,0<S.s.ua&&ke(S.s.vb,S.s.Wa);else{if(Fe.h)break e;je!=null&&je(S,Ce>be?be:Ce),S.a=0,S.$=ht-V}return 1}return S.a=3,0}function bt(S){t(S!=null),S.vc=null,S.yc=null,S.Ya=null;var _=S.Wa;_!=null&&(_.X=null),S.vb=null,t(S!=null)}function dt(){var S=new rr;return S==null?null:(S.a=0,S.xb=Gx,ot("Predictor","VP8LPredictors"),ot("Predictor","VP8LPredictors_C"),ot("PredictorAdd","VP8LPredictorsAdd"),ot("PredictorAdd","VP8LPredictorsAdd_C"),Nf=xe,eu=me,Sf=Be,Af=it,hd=st,uc=Ve,md=te,I.VP8LMapColor32b=Ha,I.VP8LMapColor8b=Aa,S)}function ft(S,_,V,Q,ge){var be=1,je=[S],Ce=[_],Pe=Q.m,Fe=Q.s,Ke=null,ht=0;e:for(;;){if(V)for(;be&&ce(Pe,1);){var Le=je,Qe=Ce,lt=Q,jt=1,ut=lt.m,wt=lt.gc[lt.ab],kt=ce(ut,2);if(lt.Oc&1<<kt)be=0;else{switch(lt.Oc|=1<<kt,wt.hc=kt,wt.Ea=Le[0],wt.nc=Qe[0],wt.K=[null],++lt.ab,t(4>=lt.ab),kt){case 0:case 1:wt.b=ce(ut,3)+2,jt=ft(Xe(wt.Ea,wt.b),Xe(wt.nc,wt.b),0,lt,wt.K),wt.K=wt.K[0];break;case 3:var zt,Tt=ce(ut,8)+1,cr=16<Tt?0:4<Tt?1:2<Tt?2:3;if(Le[0]=Xe(wt.Ea,cr),wt.b=cr,zt=jt=ft(Tt,1,0,lt,wt.K)){var Jt,Dr=Tt,nr=wt,Jr=1<<(8>>nr.b),ta=s(Jr);if(ta==null)zt=0;else{var Lr=nr.K[0],Qt=nr.w;for(ta[0]=nr.K[0][0],Jt=1;Jt<1*Dr;++Jt)ta[Jt]=Ne(Lr[Qt+Jt],ta[Jt-1]);for(;Jt<4*Jr;++Jt)ta[Jt]=0;nr.K[0]=null,nr.K[0]=ta,zt=1}}jt=zt;break;case 2:break;default:t(0)}be=jt}}if(je=je[0],Ce=Ce[0],be&&ce(Pe,1)&&!(be=1<=(ht=ce(Pe,4))&&11>=ht)){Q.a=3;break e}var Kt;if(Kt=be)t:{var ha,Sr,Br,kn=Q,ii=je,Oi=Ce,qn=ht,Va=V,es=kn.m,qa=kn.s,Vr=[null],dn=1,ma=0,gn=So[qn];r:for(;;){if(Va&&ce(es,1)){var si=ce(es,3)+2,pa=Xe(ii,si),fn=Xe(Oi,si),La=pa*fn;if(!ft(pa,fn,0,kn,Vr))break r;for(Vr=Vr[0],qa.xc=si,ha=0;ha<La;++ha){var Cn=Vr[ha]>>8&65535;Vr[ha]=Cn,Cn>=dn&&(dn=Cn+1)}}if(es.h)break r;for(Sr=0;5>Sr;++Sr){var Wa=vd[Sr];!Sr&&0<qn&&(Wa+=1<<qn),ma<Wa&&(ma=Wa)}var Ga=o(dn*gn,K),Ln=dn,ln=o(Ln,se);if(ln==null)var ts=null;else t(65536>=Ln),ts=ln;var _a=s(ma);if(ts==null||_a==null||Ga==null){kn.a=1;break r}var pr=Ga;for(ha=Br=0;ha<dn;++ha){var vr=ts[ha],hn=vr.G,Ds=vr.H,_o=0,ws=1,Ya=0;for(Sr=0;5>Sr;++Sr){Wa=vd[Sr],hn[Sr]=pr,Ds[Sr]=Br,!Sr&&0<qn&&(Wa+=1<<qn);a:{var cu,uu=Wa,G0=kn,Wn=_a,Kx=pr,Xx=Br,Y0=0,hc=G0.m,sj=ce(hc,1);if(a(Wn,0,0,uu),sj){var Zx=ce(hc,1)+1,Jx=ce(hc,1),K0=ce(hc,Jx==0?1:8);Wn[K0]=1,Zx==2&&(Wn[K0=ce(hc,8)]=1);var xi=1}else{var Ea=s(19),um=ce(hc,4)+4;if(19<um){G0.a=3;var du=0;break a}for(cu=0;cu<um;++cu)Ea[om[cu]]=ce(hc,3);var Of=void 0,wd=void 0,kl=G0,X0=Ea,Rf=uu,Z0=Wn,J0=0,mc=kl.m,Qx=8,eg=o(128,K);n:for(;R(eg,0,7,X0,19);){if(ce(mc,1)){var Y1=2+2*ce(mc,3);if((Of=2+ce(mc,Y1))>Rf)break n}else Of=Rf;for(wd=0;wd<Rf&&Of--;){he(mc);var tg=eg[0+(127&G(mc))];re(mc,mc.u+tg.g);var fu=tg.value;if(16>fu)Z0[wd++]=fu,fu!=0&&(Qx=fu);else{var K1=fu==16,X1=fu-16,Z1=Ef[X1],rg=ce(mc,jo[X1])+Z1;if(wd+rg>Rf)break n;for(var J1=K1?Qx:0;0<rg--;)Z0[wd++]=J1}}J0=1;break n}J0||(kl.a=3),xi=J0}(xi=xi&&!hc.h)&&(Y0=R(Kx,Xx,8,Wn,uu)),xi&&Y0!=0?du=Y0:(G0.a=3,du=0)}if(du==0)break r;if(ws&&U0[Sr]==1&&(ws=pr[Br].g==0),_o+=pr[Br].g,Br+=du,3>=Sr){var jd,Q0=_a[0];for(jd=1;jd<Wa;++jd)_a[jd]>Q0&&(Q0=_a[jd]);Ya+=Q0}}if(vr.nd=ws,vr.Qb=0,ws&&(vr.qb=(hn[3][Ds[3]+0].value<<24|hn[1][Ds[1]+0].value<<16|hn[2][Ds[2]+0].value)>>>0,_o==0&&256>hn[0][Ds[0]+0].value&&(vr.Qb=1,vr.qb+=hn[0][Ds[0]+0].value<<8)),vr.jc=!vr.Qb&&6>Ya,vr.jc){var dm,Cl=vr;for(dm=0;dm<cd;++dm){var pc=dm,xc=Cl.pd[pc],ep=Cl.G[0][Cl.H[0]+pc];256<=ep.value?(xc.g=ep.g+256,xc.value=ep.value):(xc.g=0,xc.value=0,pc>>=Zr(ep,8,xc),pc>>=Zr(Cl.G[1][Cl.H[1]+pc],16,xc),pc>>=Zr(Cl.G[2][Cl.H[2]+pc],0,xc),Zr(Cl.G[3][Cl.H[3]+pc],24,xc))}}}qa.vc=Vr,qa.Wb=dn,qa.Ya=ts,qa.yc=Ga,Kt=1;break t}Kt=0}if(!(be=Kt)){Q.a=3;break e}if(0<ht){if(Fe.ua=1<<ht,!ue(Fe.Wa,ht)){Q.a=1,be=0;break e}}else Fe.ua=0;var tp=Q,Nd=je,Q1=Ce,Mf=tp.s,Lf=Mf.xc;if(tp.c=Nd,tp.i=Q1,Mf.md=Xe(Nd,Lf),Mf.wc=Lf==0?-1:(1<<Lf)-1,V){Q.xb=au;break e}if((Ke=s(je*Ce))==null){Q.a=1,be=0;break e}be=(be=ct(Q,Ke,0,je,Ce,Ce,null))&&!Pe.h;break e}return be?(ge!=null?ge[0]=Ke:(t(Ke==null),t(V)),Q.$=0,V||bt(Fe)):bt(Fe),be}function mt(S,_){var V=S.c*S.i,Q=V+_+16*_;return t(S.c<=_),S.V=s(Q),S.V==null?(S.Ta=null,S.Ua=0,S.a=1,0):(S.Ta=S.V,S.Ua=S.Ba+V+_,1)}function Lt(S,_){var V=S.C,Q=_-V,ge=S.V,be=S.Ba+S.c*V;for(t(_<=S.l.o);0<Q;){var je=16<Q?16:Q,Ce=S.l.ma,Pe=S.l.width,Fe=Pe*je,Ke=Ce.ca,ht=Ce.tb+Pe*V,Le=S.Ta,Qe=S.Ua;Ie(S,je,ge,be),to(Le,Qe,Ke,ht,Fe),Re(Ce,V,V+je,Ke,ht,Pe),Q-=je,ge+=je*S.c,V+=je}t(V==_),S.C=S.Ma=_}function Vt(){this.ub=this.yd=this.td=this.Rb=0}function Xt(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function $t(){this.Fb=this.Bb=this.Cb=0,this.Zb=s(4),this.Lb=s(4)}function Gt(){this.Yb=(function(){var S=[];return(function _(V,Q,ge){for(var be=ge[Q],je=0;je<be&&(V.push(ge.length>Q+1?[]:0),!(ge.length<Q+1));je++)_(V[je],Q+1,ge)})(S,0,[3,11]),S})()}function er(){this.jb=s(3),this.Wc=l([4,8],Gt),this.Xc=l([4,17],Gt)}function An(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new s(4),this.od=new s(4)}function Wr(){this.ld=this.La=this.dd=this.tc=0}function Pn(){this.Na=this.la=0}function xs(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Vo(){this.ad=s(384),this.Za=0,this.Ob=s(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function qo(){this.uc=this.M=this.Nb=0,this.wa=Array(new Wr),this.Y=0,this.ya=Array(new Vo),this.aa=0,this.l=new Ql}function Zs(){this.y=s(16),this.f=s(8),this.ea=s(8)}function Hc(){this.cb=this.a=0,this.sc="",this.m=new D,this.Od=new Vt,this.Kc=new Xt,this.ed=new An,this.Qa=new $t,this.Ic=this.$c=this.Aa=0,this.D=new qo,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=o(8,D),this.ia=0,this.pb=o(4,xs),this.Pa=new er,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Zs),this.Hd=0,this.rb=Array(new Pn),this.sb=0,this.wa=Array(new Wr),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new Vo),this.L=this.aa=0,this.gd=l([4,2],Wr),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function ua(S,_){return 0>S?0:S>_?_:S}function Ql(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function Wo(){var S=new Hc;return S!=null&&(S.a=0,S.sc="OK",S.cb=0,S.Xb=0,ro||(ro=Vc)),S}function pn(S,_,V){return S.a==0&&(S.a=_,S.sc=V,S.cb=0),0}function Vh(S,_,V){return 3<=V&&S[_+0]==157&&S[_+1]==1&&S[_+2]==42}function bl(S,_){if(S==null)return 0;if(S.a=0,S.sc="OK",_==null)return pn(S,2,"null VP8Io passed to VP8GetHeaders()");var V=_.data,Q=_.w,ge=_.ha;if(4>ge)return pn(S,7,"Truncated header.");var be=V[Q+0]|V[Q+1]<<8|V[Q+2]<<16,je=S.Od;if(je.Rb=!(1&be),je.td=be>>1&7,je.yd=be>>4&1,je.ub=be>>5,3<je.td)return pn(S,3,"Incorrect keyframe parameters.");if(!je.yd)return pn(S,4,"Frame not displayable.");Q+=3,ge-=3;var Ce=S.Kc;if(je.Rb){if(7>ge)return pn(S,7,"cannot parse picture header");if(!Vh(V,Q,ge))return pn(S,3,"Bad code word");Ce.c=16383&(V[Q+4]<<8|V[Q+3]),Ce.Td=V[Q+4]>>6,Ce.i=16383&(V[Q+6]<<8|V[Q+5]),Ce.Ud=V[Q+6]>>6,Q+=7,ge-=7,S.za=Ce.c+15>>4,S.Ub=Ce.i+15>>4,_.width=Ce.c,_.height=Ce.i,_.Da=0,_.j=0,_.v=0,_.va=_.width,_.o=_.height,_.da=0,_.ib=_.width,_.hb=_.height,_.U=_.width,_.T=_.height,a((be=S.Pa).jb,0,255,be.jb.length),t((be=S.Qa)!=null),be.Cb=0,be.Bb=0,be.Fb=1,a(be.Zb,0,0,be.Zb.length),a(be.Lb,0,0,be.Lb)}if(je.ub>ge)return pn(S,7,"bad partition length");Z(be=S.m,V,Q,je.ub),Q+=je.ub,ge-=je.ub,je.Rb&&(Ce.Ld=z(be),Ce.Kd=z(be)),Ce=S.Qa;var Pe,Fe=S.Pa;if(t(be!=null),t(Ce!=null),Ce.Cb=z(be),Ce.Cb){if(Ce.Bb=z(be),z(be)){for(Ce.Fb=z(be),Pe=0;4>Pe;++Pe)Ce.Zb[Pe]=z(be)?X(be,7):0;for(Pe=0;4>Pe;++Pe)Ce.Lb[Pe]=z(be)?X(be,6):0}if(Ce.Bb)for(Pe=0;3>Pe;++Pe)Fe.jb[Pe]=z(be)?ne(be,8):255}else Ce.Bb=0;if(be.Ka)return pn(S,3,"cannot parse segment header");if((Ce=S.ed).zd=z(be),Ce.Tb=ne(be,6),Ce.wb=ne(be,3),Ce.Pc=z(be),Ce.Pc&&z(be)){for(Fe=0;4>Fe;++Fe)z(be)&&(Ce.vd[Fe]=X(be,6));for(Fe=0;4>Fe;++Fe)z(be)&&(Ce.od[Fe]=X(be,6))}if(S.L=Ce.Tb==0?0:Ce.zd?1:2,be.Ka)return pn(S,3,"cannot parse filter header");var Ke=ge;if(ge=Pe=Q,Q=Pe+Ke,Ce=Ke,S.Xb=(1<<ne(S.m,2))-1,Ke<3*(Fe=S.Xb))V=7;else{for(Pe+=3*Fe,Ce-=3*Fe,Ke=0;Ke<Fe;++Ke){var ht=V[ge+0]|V[ge+1]<<8|V[ge+2]<<16;ht>Ce&&(ht=Ce),Z(S.Jc[+Ke],V,Pe,ht),Pe+=ht,Ce-=ht,ge+=3}Z(S.Jc[+Fe],V,Pe,Ce),V=Pe<Q?0:5}if(V!=0)return pn(S,V,"cannot parse partitions");for(V=ne(Pe=S.m,7),ge=z(Pe)?X(Pe,4):0,Q=z(Pe)?X(Pe,4):0,Ce=z(Pe)?X(Pe,4):0,Fe=z(Pe)?X(Pe,4):0,Pe=z(Pe)?X(Pe,4):0,Ke=S.Qa,ht=0;4>ht;++ht){if(Ke.Cb){var Le=Ke.Zb[ht];Ke.Fb||(Le+=V)}else{if(0<ht){S.pb[ht]=S.pb[0];continue}Le=V}var Qe=S.pb[ht];Qe.Sc[0]=Ao[ua(Le+ge,127)],Qe.Sc[1]=ko[ua(Le+0,127)],Qe.Eb[0]=2*Ao[ua(Le+Q,127)],Qe.Eb[1]=101581*ko[ua(Le+Ce,127)]>>16,8>Qe.Eb[1]&&(Qe.Eb[1]=8),Qe.Qc[0]=Ao[ua(Le+Fe,117)],Qe.Qc[1]=ko[ua(Le+Pe,127)],Qe.lc=Le+Pe}if(!je.Rb)return pn(S,4,"Not a key frame.");for(z(be),je=S.Pa,V=0;4>V;++V){for(ge=0;8>ge;++ge)for(Q=0;3>Q;++Q)for(Ce=0;11>Ce;++Ce)Fe=fe(be,ea[V][ge][Q][Ce])?ne(be,8):W1[V][ge][Q][Ce],je.Wc[V][ge].Yb[Q][Ce]=Fe;for(ge=0;17>ge;++ge)je.Xc[V][ge]=je.Wc[V][tn[ge]]}return S.kc=z(be),S.kc&&(S.Bd=ne(be,8)),S.cb=1}function Vc(S,_,V,Q,ge,be,je){var Ce=_[ge].Yb[V];for(V=0;16>ge;++ge){if(!fe(S,Ce[V+0]))return ge;for(;!fe(S,Ce[V+1]);)if(Ce=_[++ge].Yb[0],V=0,ge==16)return 16;var Pe=_[ge+1].Yb;if(fe(S,Ce[V+2])){var Fe=S,Ke=0;if(fe(Fe,(Le=Ce)[(ht=V)+3]))if(fe(Fe,Le[ht+6])){for(Ce=0,ht=2*(Ke=fe(Fe,Le[ht+8]))+(Le=fe(Fe,Le[ht+9+Ke])),Ke=0,Le=q1[ht];Le[Ce];++Ce)Ke+=Ke+fe(Fe,Le[Ce]);Ke+=3+(8<<ht)}else fe(Fe,Le[ht+7])?(Ke=7+2*fe(Fe,165),Ke+=fe(Fe,145)):Ke=5+fe(Fe,159);else Ke=fe(Fe,Le[ht+4])?3+fe(Fe,Le[ht+5]):2;Ce=Pe[2]}else Ke=1,Ce=Pe[1];Pe=je+Wx[ge],0>(Fe=S).b&&oe(Fe);var ht,Le=Fe.b,Qe=(ht=Fe.Ca>>1)-(Fe.I>>Le)>>31;--Fe.b,Fe.Ca+=Qe,Fe.Ca|=1,Fe.I-=(ht+1&Qe)<<Le,be[Pe]=((Ke^Qe)-Qe)*Q[(0<ge)+0]}return 16}function xf(S){var _=S.rb[S.sb-1];_.la=0,_.Na=0,a(S.zc,0,0,S.zc.length),S.ja=0}function Gi(S,_,V,Q,ge){ge=S[_+V+32*Q]+(ge>>3),S[_+V+32*Q]=-256&ge?0>ge?0:255:ge}function gf(S,_,V,Q,ge,be){Gi(S,_,0,V,Q+ge),Gi(S,_,1,V,Q+be),Gi(S,_,2,V,Q-be),Gi(S,_,3,V,Q-ge)}function Ua(S){return(20091*S>>16)+S}function ai(S,_,V,Q){var ge,be=0,je=s(16);for(ge=0;4>ge;++ge){var Ce=S[_+0]+S[_+8],Pe=S[_+0]-S[_+8],Fe=(35468*S[_+4]>>16)-Ua(S[_+12]),Ke=Ua(S[_+4])+(35468*S[_+12]>>16);je[be+0]=Ce+Ke,je[be+1]=Pe+Fe,je[be+2]=Pe-Fe,je[be+3]=Ce-Ke,be+=4,_++}for(ge=be=0;4>ge;++ge)Ce=(S=je[be+0]+4)+je[be+8],Pe=S-je[be+8],Fe=(35468*je[be+4]>>16)-Ua(je[be+12]),Gi(V,Q,0,0,Ce+(Ke=Ua(je[be+4])+(35468*je[be+12]>>16))),Gi(V,Q,1,0,Pe+Fe),Gi(V,Q,2,0,Pe-Fe),Gi(V,Q,3,0,Ce-Ke),be++,Q+=32}function qh(S,_,V,Q){var ge=S[_+0]+4,be=35468*S[_+4]>>16,je=Ua(S[_+4]),Ce=35468*S[_+1]>>16;gf(V,Q,0,ge+je,S=Ua(S[_+1]),Ce),gf(V,Q,1,ge+be,S,Ce),gf(V,Q,2,ge-be,S,Ce),gf(V,Q,3,ge-je,S,Ce)}function Wh(S,_,V,Q,ge){ai(S,_,V,Q),ge&&ai(S,_+16,V,Q+4)}function qc(S,_,V,Q){el(S,_+0,V,Q,1),el(S,_+32,V,Q+128,1)}function _0(S,_,V,Q){var ge;for(S=S[_+0]+4,ge=0;4>ge;++ge)for(_=0;4>_;++_)Gi(V,Q,_,ge,S)}function Go(S,_,V,Q){S[_+0]&&_i(S,_+0,V,Q),S[_+16]&&_i(S,_+16,V,Q+4),S[_+32]&&_i(S,_+32,V,Q+128),S[_+48]&&_i(S,_+48,V,Q+128+4)}function ec(S,_,V,Q){var ge,be=s(16);for(ge=0;4>ge;++ge){var je=S[_+0+ge]+S[_+12+ge],Ce=S[_+4+ge]+S[_+8+ge],Pe=S[_+4+ge]-S[_+8+ge],Fe=S[_+0+ge]-S[_+12+ge];be[0+ge]=je+Ce,be[8+ge]=je-Ce,be[4+ge]=Fe+Pe,be[12+ge]=Fe-Pe}for(ge=0;4>ge;++ge)je=(S=be[0+4*ge]+3)+be[3+4*ge],Ce=be[1+4*ge]+be[2+4*ge],Pe=be[1+4*ge]-be[2+4*ge],Fe=S-be[3+4*ge],V[Q+0]=je+Ce>>3,V[Q+16]=Fe+Pe>>3,V[Q+32]=je-Ce>>3,V[Q+48]=Fe-Pe>>3,Q+=64}function vf(S,_,V){var Q,ge=_-32,be=Ji,je=255-S[ge-1];for(Q=0;Q<V;++Q){var Ce,Pe=be,Fe=je+S[_-1];for(Ce=0;Ce<V;++Ce)S[_+Ce]=Pe[Fe+S[ge+Ce]];_+=32}}function Qu(S,_){vf(S,_,4)}function yf(S,_){vf(S,_,8)}function Gh(S,_){vf(S,_,16)}function Ux(S,_){var V;for(V=0;16>V;++V)n(S,_+32*V,S,_-32,16)}function $x(S,_){var V;for(V=16;0<V;--V)a(S,_,S[_-1],16),_+=32}function Yo(S,_,V){var Q;for(Q=0;16>Q;++Q)a(_,V+32*Q,S,16)}function xo(S,_){var V,Q=16;for(V=0;16>V;++V)Q+=S[_-1+32*V]+S[_+V-32];Yo(Q>>5,S,_)}function wl(S,_){var V,Q=8;for(V=0;16>V;++V)Q+=S[_-1+32*V];Yo(Q>>4,S,_)}function Yh(S,_){var V,Q=8;for(V=0;16>V;++V)Q+=S[_+V-32];Yo(Q>>4,S,_)}function go(S,_){Yo(128,S,_)}function jr(S,_,V){return S+2*_+V+2>>2}function E0(S,_){var V,Q=_-32;for(Q=new Uint8Array([jr(S[Q-1],S[Q+0],S[Q+1]),jr(S[Q+0],S[Q+1],S[Q+2]),jr(S[Q+1],S[Q+2],S[Q+3]),jr(S[Q+2],S[Q+3],S[Q+4])]),V=0;4>V;++V)n(S,_+32*V,Q,0,Q.length)}function Kh(S,_){var V=S[_-1],Q=S[_-1+32],ge=S[_-1+64],be=S[_-1+96];de(S,_+0,16843009*jr(S[_-1-32],V,Q)),de(S,_+32,16843009*jr(V,Q,ge)),de(S,_+64,16843009*jr(Q,ge,be)),de(S,_+96,16843009*jr(ge,be,be))}function T0(S,_){var V,Q=4;for(V=0;4>V;++V)Q+=S[_+V-32]+S[_-1+32*V];for(Q>>=3,V=0;4>V;++V)a(S,_+32*V,Q,4)}function ed(S,_){var V=S[_-1+0],Q=S[_-1+32],ge=S[_-1+64],be=S[_-1-32],je=S[_+0-32],Ce=S[_+1-32],Pe=S[_+2-32],Fe=S[_+3-32];S[_+0+96]=jr(Q,ge,S[_-1+96]),S[_+1+96]=S[_+0+64]=jr(V,Q,ge),S[_+2+96]=S[_+1+64]=S[_+0+32]=jr(be,V,Q),S[_+3+96]=S[_+2+64]=S[_+1+32]=S[_+0+0]=jr(je,be,V),S[_+3+64]=S[_+2+32]=S[_+1+0]=jr(Ce,je,be),S[_+3+32]=S[_+2+0]=jr(Pe,Ce,je),S[_+3+0]=jr(Fe,Pe,Ce)}function Ko(S,_){var V=S[_+1-32],Q=S[_+2-32],ge=S[_+3-32],be=S[_+4-32],je=S[_+5-32],Ce=S[_+6-32],Pe=S[_+7-32];S[_+0+0]=jr(S[_+0-32],V,Q),S[_+1+0]=S[_+0+32]=jr(V,Q,ge),S[_+2+0]=S[_+1+32]=S[_+0+64]=jr(Q,ge,be),S[_+3+0]=S[_+2+32]=S[_+1+64]=S[_+0+96]=jr(ge,be,je),S[_+3+32]=S[_+2+64]=S[_+1+96]=jr(be,je,Ce),S[_+3+64]=S[_+2+96]=jr(je,Ce,Pe),S[_+3+96]=jr(Ce,Pe,Pe)}function Xo(S,_){var V=S[_-1+0],Q=S[_-1+32],ge=S[_-1+64],be=S[_-1-32],je=S[_+0-32],Ce=S[_+1-32],Pe=S[_+2-32],Fe=S[_+3-32];S[_+0+0]=S[_+1+64]=be+je+1>>1,S[_+1+0]=S[_+2+64]=je+Ce+1>>1,S[_+2+0]=S[_+3+64]=Ce+Pe+1>>1,S[_+3+0]=Pe+Fe+1>>1,S[_+0+96]=jr(ge,Q,V),S[_+0+64]=jr(Q,V,be),S[_+0+32]=S[_+1+96]=jr(V,be,je),S[_+1+32]=S[_+2+96]=jr(be,je,Ce),S[_+2+32]=S[_+3+96]=jr(je,Ce,Pe),S[_+3+32]=jr(Ce,Pe,Fe)}function Js(S,_){var V=S[_+0-32],Q=S[_+1-32],ge=S[_+2-32],be=S[_+3-32],je=S[_+4-32],Ce=S[_+5-32],Pe=S[_+6-32],Fe=S[_+7-32];S[_+0+0]=V+Q+1>>1,S[_+1+0]=S[_+0+64]=Q+ge+1>>1,S[_+2+0]=S[_+1+64]=ge+be+1>>1,S[_+3+0]=S[_+2+64]=be+je+1>>1,S[_+0+32]=jr(V,Q,ge),S[_+1+32]=S[_+0+96]=jr(Q,ge,be),S[_+2+32]=S[_+1+96]=jr(ge,be,je),S[_+3+32]=S[_+2+96]=jr(be,je,Ce),S[_+3+64]=jr(je,Ce,Pe),S[_+3+96]=jr(Ce,Pe,Fe)}function jl(S,_){var V=S[_-1+0],Q=S[_-1+32],ge=S[_-1+64],be=S[_-1+96];S[_+0+0]=V+Q+1>>1,S[_+2+0]=S[_+0+32]=Q+ge+1>>1,S[_+2+32]=S[_+0+64]=ge+be+1>>1,S[_+1+0]=jr(V,Q,ge),S[_+3+0]=S[_+1+32]=jr(Q,ge,be),S[_+3+32]=S[_+1+64]=jr(ge,be,be),S[_+3+64]=S[_+2+64]=S[_+0+96]=S[_+1+96]=S[_+2+96]=S[_+3+96]=be}function Xh(S,_){var V=S[_-1+0],Q=S[_-1+32],ge=S[_-1+64],be=S[_-1+96],je=S[_-1-32],Ce=S[_+0-32],Pe=S[_+1-32],Fe=S[_+2-32];S[_+0+0]=S[_+2+32]=V+je+1>>1,S[_+0+32]=S[_+2+64]=Q+V+1>>1,S[_+0+64]=S[_+2+96]=ge+Q+1>>1,S[_+0+96]=be+ge+1>>1,S[_+3+0]=jr(Ce,Pe,Fe),S[_+2+0]=jr(je,Ce,Pe),S[_+1+0]=S[_+3+32]=jr(V,je,Ce),S[_+1+32]=S[_+3+64]=jr(Q,V,je),S[_+1+64]=S[_+3+96]=jr(ge,Q,V),S[_+1+96]=jr(be,ge,Q)}function tc(S,_){var V;for(V=0;8>V;++V)n(S,_+32*V,S,_-32,8)}function bf(S,_){var V;for(V=0;8>V;++V)a(S,_,S[_-1],8),_+=32}function Qs(S,_,V){var Q;for(Q=0;8>Q;++Q)a(_,V+32*Q,S,8)}function wf(S,_){var V,Q=8;for(V=0;8>V;++V)Q+=S[_+V-32]+S[_-1+32*V];Qs(Q>>4,S,_)}function td(S,_){var V,Q=4;for(V=0;8>V;++V)Q+=S[_+V-32];Qs(Q>>3,S,_)}function Yi(S,_){var V,Q=4;for(V=0;8>V;++V)Q+=S[_-1+32*V];Qs(Q>>3,S,_)}function Zo(S,_){Qs(128,S,_)}function Jo(S,_,V){var Q=S[_-V],ge=S[_+0],be=3*(ge-Q)+dc[1020+S[_-2*V]-S[_+V]],je=am[112+(be+4>>3)];S[_-V]=Ji[255+Q+am[112+(be+3>>3)]],S[_+0]=Ji[255+ge-je]}function rc(S,_,V,Q){var ge=S[_+0],be=S[_+V];return Ei[255+S[_-2*V]-S[_-V]]>Q||Ei[255+be-ge]>Q}function rd(S,_,V,Q){return 4*Ei[255+S[_-V]-S[_+0]]+Ei[255+S[_-2*V]-S[_+V]]<=Q}function nd(S,_,V,Q,ge){var be=S[_-3*V],je=S[_-2*V],Ce=S[_-V],Pe=S[_+0],Fe=S[_+V],Ke=S[_+2*V],ht=S[_+3*V];return 4*Ei[255+Ce-Pe]+Ei[255+je-Fe]>Q?0:Ei[255+S[_-4*V]-be]<=ge&&Ei[255+be-je]<=ge&&Ei[255+je-Ce]<=ge&&Ei[255+ht-Ke]<=ge&&Ei[255+Ke-Fe]<=ge&&Ei[255+Fe-Pe]<=ge}function Wc(S,_,V,Q){var ge=2*Q+1;for(Q=0;16>Q;++Q)rd(S,_+Q,V,ge)&&Jo(S,_+Q,V)}function nc(S,_,V,Q){var ge=2*Q+1;for(Q=0;16>Q;++Q)rd(S,_+Q*V,1,ge)&&Jo(S,_+Q*V,1)}function ac(S,_,V,Q){var ge;for(ge=3;0<ge;--ge)Wc(S,_+=4*V,V,Q)}function Zh(S,_,V,Q){var ge;for(ge=3;0<ge;--ge)nc(S,_+=4,V,Q)}function ic(S,_,V,Q,ge,be,je,Ce){for(be=2*be+1;0<ge--;){if(nd(S,_,V,be,je))if(rc(S,_,V,Ce))Jo(S,_,V);else{var Pe=S,Fe=_,Ke=V,ht=Pe[Fe-2*Ke],Le=Pe[Fe-Ke],Qe=Pe[Fe+0],lt=Pe[Fe+Ke],jt=Pe[Fe+2*Ke],ut=27*(kt=dc[1020+3*(Qe-Le)+dc[1020+ht-lt]])+63>>7,wt=18*kt+63>>7,kt=9*kt+63>>7;Pe[Fe-3*Ke]=Ji[255+Pe[Fe-3*Ke]+kt],Pe[Fe-2*Ke]=Ji[255+ht+wt],Pe[Fe-Ke]=Ji[255+Le+ut],Pe[Fe+0]=Ji[255+Qe-ut],Pe[Fe+Ke]=Ji[255+lt-wt],Pe[Fe+2*Ke]=Ji[255+jt-kt]}_+=Q}}function sc(S,_,V,Q,ge,be,je,Ce){for(be=2*be+1;0<ge--;){if(nd(S,_,V,be,je))if(rc(S,_,V,Ce))Jo(S,_,V);else{var Pe=S,Fe=_,Ke=V,ht=Pe[Fe-Ke],Le=Pe[Fe+0],Qe=Pe[Fe+Ke],lt=am[112+(4+(jt=3*(Le-ht))>>3)],jt=am[112+(jt+3>>3)],ut=lt+1>>1;Pe[Fe-2*Ke]=Ji[255+Pe[Fe-2*Ke]+ut],Pe[Fe-Ke]=Ji[255+ht+jt],Pe[Fe+0]=Ji[255+Le-lt],Pe[Fe+Ke]=Ji[255+Qe-ut]}_+=Q}}function P0(S,_,V,Q,ge,be){ic(S,_,V,1,16,Q,ge,be)}function jf(S,_,V,Q,ge,be){ic(S,_,1,V,16,Q,ge,be)}function D0(S,_,V,Q,ge,be){var je;for(je=3;0<je;--je)sc(S,_+=4*V,V,1,16,Q,ge,be)}function ad(S,_,V,Q,ge,be){var je;for(je=3;0<je;--je)sc(S,_+=4,1,V,16,Q,ge,be)}function O0(S,_,V,Q,ge,be,je,Ce){ic(S,_,ge,1,8,be,je,Ce),ic(V,Q,ge,1,8,be,je,Ce)}function U(S,_,V,Q,ge,be,je,Ce){ic(S,_,1,ge,8,be,je,Ce),ic(V,Q,1,ge,8,be,je,Ce)}function pe(S,_,V,Q,ge,be,je,Ce){sc(S,_+4*ge,ge,1,8,be,je,Ce),sc(V,Q+4*ge,ge,1,8,be,je,Ce)}function Me(S,_,V,Q,ge,be,je,Ce){sc(S,_+4,1,ge,8,be,je,Ce),sc(V,Q+4,1,ge,8,be,je,Ce)}function We(){this.ba=new Ft,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new Rt,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function et(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function Nt(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function Pt(){this.ua=0,this.Wa=new $e,this.vb=new $e,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new se,this.yc=new K}function rr(){this.xb=this.a=0,this.l=new Ql,this.ca=new Ft,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new H,this.Pb=0,this.wd=new H,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new Pt,this.ab=0,this.gc=o(4,Nt),this.Oc=0}function or(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Ql,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function Pr(S,_,V,Q,ge,be,je){for(S=S==null?0:S[_+0],_=0;_<je;++_)ge[be+_]=S+V[Q+_]&255,S=ge[be+_]}function Mr(S,_,V,Q,ge,be,je){var Ce;if(S==null)Pr(null,null,V,Q,ge,be,je);else for(Ce=0;Ce<je;++Ce)ge[be+Ce]=S[_+Ce]+V[Q+Ce]&255}function en(S,_,V,Q,ge,be,je){if(S==null)Pr(null,null,V,Q,ge,be,je);else{var Ce,Pe=S[_+0],Fe=Pe,Ke=Pe;for(Ce=0;Ce<je;++Ce)Fe=Ke+(Pe=S[_+Ce])-Fe,Ke=V[Q+Ce]+(-256&Fe?0>Fe?0:255:Fe)&255,Fe=Pe,ge[be+Ce]=Ke}}function $a(S,_,V,Q){var ge=_.width,be=_.o;if(t(S!=null&&_!=null),0>V||0>=Q||V+Q>be)return null;if(!S.Cc){if(S.ga==null){var je;if(S.ga=new or,(je=S.ga==null)||(je=_.width*_.o,t(S.Gb.length==0),S.Gb=s(je),S.Uc=0,S.Gb==null?je=0:(S.mb=S.Gb,S.nb=S.Uc,S.rc=null,je=1),je=!je),!je){je=S.ga;var Ce=S.Fa,Pe=S.P,Fe=S.qc,Ke=S.mb,ht=S.nb,Le=Pe+1,Qe=Fe-1,lt=je.l;if(t(Ce!=null&&Ke!=null&&_!=null),fc[0]=null,fc[1]=Pr,fc[2]=Mr,fc[3]=en,je.ca=Ke,je.tb=ht,je.c=_.width,je.i=_.height,t(0<je.c&&0<je.i),1>=Fe)_=0;else if(je.$a=3&Ce[Pe+0],je.Z=Ce[Pe+0]>>2&3,je.Lc=Ce[Pe+0]>>4&3,Pe=Ce[Pe+0]>>6&3,0>je.$a||1<je.$a||4<=je.Z||1<je.Lc||Pe)_=0;else if(lt.put=Ht,lt.ac=Ur,lt.bc=It,lt.ma=je,lt.width=_.width,lt.height=_.height,lt.Da=_.Da,lt.v=_.v,lt.va=_.va,lt.j=_.j,lt.o=_.o,je.$a)e:{t(je.$a==1),_=dt();t:for(;;){if(_==null){_=0;break e}if(t(je!=null),je.mc=_,_.c=je.c,_.i=je.i,_.l=je.l,_.l.ma=je,_.l.width=je.c,_.l.height=je.i,_.a=0,le(_.m,Ce,Le,Qe),!ft(je.c,je.i,1,_,null)||(_.ab==1&&_.gc[0].hc==3&&Te(_.s)?(je.ic=1,Ce=_.c*_.i,_.Ta=null,_.Ua=0,_.V=s(Ce),_.Ba=0,_.V==null?(_.a=1,_=0):_=1):(je.ic=0,_=mt(_,je.c)),!_))break t;_=1;break e}je.mc=null,_=0}else _=Qe>=je.c*je.i;je=!_}if(je)return null;S.ga.Lc!=1?S.Ga=0:Q=be-V}t(S.ga!=null),t(V+Q<=be);e:{if(_=(Ce=S.ga).c,be=Ce.l.o,Ce.$a==0){if(Le=S.rc,Qe=S.Vc,lt=S.Fa,Pe=S.P+1+V*_,Fe=S.mb,Ke=S.nb+V*_,t(Pe<=S.P+S.qc),Ce.Z!=0)for(t(fc[Ce.Z]!=null),je=0;je<Q;++je)fc[Ce.Z](Le,Qe,lt,Pe,Fe,Ke,_),Le=Fe,Qe=Ke,Ke+=_,Pe+=_;else for(je=0;je<Q;++je)n(Fe,Ke,lt,Pe,_),Le=Fe,Qe=Ke,Ke+=_,Pe+=_;S.rc=Le,S.Vc=Qe}else{if(t(Ce.mc!=null),_=V+Q,t((je=Ce.mc)!=null),t(_<=je.i),je.C>=_)_=1;else if(Ce.ic||fa(),Ce.ic){Ce=je.V,Le=je.Ba,Qe=je.c;var jt=je.i,ut=(lt=1,Pe=je.$/Qe,Fe=je.$%Qe,Ke=je.m,ht=je.s,je.$),wt=Qe*jt,kt=Qe*_,zt=ht.wc,Tt=ut<kt?ye(ht,Fe,Pe):null;t(ut<=wt),t(_<=jt),t(Te(ht));t:for(;;){for(;!Ke.h&&ut<kt;){if(Fe&zt||(Tt=ye(ht,Fe,Pe)),t(Tt!=null),he(Ke),256>(jt=Xr(Tt.G[0],Tt.H[0],Ke)))Ce[Le+ut]=jt,++ut,++Fe>=Qe&&(Fe=0,++Pe<=_&&!(Pe%16)&&ze(je,Pe));else{if(!(280>jt)){lt=0;break t}jt=kr(jt-256,Ke);var cr,Jt=Xr(Tt.G[4],Tt.H[4],Ke);if(he(Ke),!(ut>=(Jt=qr(Qe,Jt=kr(Jt,Ke)))&&wt-ut>=jt)){lt=0;break t}for(cr=0;cr<jt;++cr)Ce[Le+ut+cr]=Ce[Le+ut+cr-Jt];for(ut+=jt,Fe+=jt;Fe>=Qe;)Fe-=Qe,++Pe<=_&&!(Pe%16)&&ze(je,Pe);ut<kt&&Fe&zt&&(Tt=ye(ht,Fe,Pe))}t(Ke.h==E(Ke))}ze(je,Pe>_?_:Pe);break t}!lt||Ke.h&&ut<wt?(lt=0,je.a=Ke.h?5:3):je.$=ut,_=lt}else _=ct(je,je.V,je.Ba,je.c,je.i,_,Lt);if(!_){Q=0;break e}}V+Q>=be&&(S.Cc=1),Q=1}if(!Q)return null;if(S.Cc&&((Q=S.ga)!=null&&(Q.mc=null),S.ga=null,0<S.Ga))return alert("todo:WebPDequantizeLevels"),null}return S.nb+V*ge}function Mn(S,_,V,Q,ge,be){for(;0<ge--;){var je,Ce=S,Pe=_+(V?1:0),Fe=S,Ke=_+(V?0:3);for(je=0;je<Q;++je){var ht=Fe[Ke+4*je];ht!=255&&(ht*=32897,Ce[Pe+4*je+0]=Ce[Pe+4*je+0]*ht>>23,Ce[Pe+4*je+1]=Ce[Pe+4*je+1]*ht>>23,Ce[Pe+4*je+2]=Ce[Pe+4*je+2]*ht>>23)}_+=be}}function Dn(S,_,V,Q,ge){for(;0<Q--;){var be;for(be=0;be<V;++be){var je=S[_+2*be+0],Ce=15&(Fe=S[_+2*be+1]),Pe=4369*Ce,Fe=(240&Fe|Fe>>4)*Pe>>16;S[_+2*be+0]=(240&je|je>>4)*Pe>>16&240|(15&je|je<<4)*Pe>>16>>4&15,S[_+2*be+1]=240&Fe|Ce}_+=ge}}function Jn(S,_,V,Q,ge,be,je,Ce){var Pe,Fe,Ke=255;for(Fe=0;Fe<ge;++Fe){for(Pe=0;Pe<Q;++Pe){var ht=S[_+Pe];be[je+4*Pe]=ht,Ke&=ht}_+=V,je+=Ce}return Ke!=255}function da(S,_,V,Q,ge){var be;for(be=0;be<ge;++be)V[Q+be]=S[_+be]>>8}function fa(){xd=Mn,bo=Dn,tm=Jn,to=da}function Ki(S,_,V){I[S]=function(Q,ge,be,je,Ce,Pe,Fe,Ke,ht,Le,Qe,lt,jt,ut,wt,kt,zt){var Tt,cr=zt-1>>1,Jt=Ce[Pe+0]|Fe[Ke+0]<<16,Dr=ht[Le+0]|Qe[lt+0]<<16;t(Q!=null);var nr=3*Jt+Dr+131074>>2;for(_(Q[ge+0],255&nr,nr>>16,jt,ut),be!=null&&(nr=3*Dr+Jt+131074>>2,_(be[je+0],255&nr,nr>>16,wt,kt)),Tt=1;Tt<=cr;++Tt){var Jr=Ce[Pe+Tt]|Fe[Ke+Tt]<<16,ta=ht[Le+Tt]|Qe[lt+Tt]<<16,Lr=Jt+Jr+Dr+ta+524296,Qt=Lr+2*(Jr+Dr)>>3;nr=Qt+Jt>>1,Jt=(Lr=Lr+2*(Jt+ta)>>3)+Jr>>1,_(Q[ge+2*Tt-1],255&nr,nr>>16,jt,ut+(2*Tt-1)*V),_(Q[ge+2*Tt-0],255&Jt,Jt>>16,jt,ut+(2*Tt-0)*V),be!=null&&(nr=Lr+Dr>>1,Jt=Qt+ta>>1,_(be[je+2*Tt-1],255&nr,nr>>16,wt,kt+(2*Tt-1)*V),_(be[je+2*Tt+0],255&Jt,Jt>>16,wt,kt+(2*Tt+0)*V)),Jt=Jr,Dr=ta}1&zt||(nr=3*Jt+Dr+131074>>2,_(Q[ge+zt-1],255&nr,nr>>16,jt,ut+(zt-1)*V),be!=null&&(nr=3*Dr+Jt+131074>>2,_(be[je+zt-1],255&nr,nr>>16,wt,kt+(zt-1)*V)))}}function oc(){Pi[I0]=yd,Pi[Qi]=Tf,Pi[F0]=Yx,Pi[wo]=H0,Pi[im]=iu,Pi[Cf]=Al,Pi[ru]=su,Pi[sm]=Tf,Pi[B0]=H0,Pi[_f]=iu,Pi[z0]=Al}function Jh(S){return S&-16384?0>S?0:255:S>>V0}function lc(S,_){return Jh((19077*S>>8)+(26149*_>>8)-14234)}function Qo(S,_,V){return Jh((19077*S>>8)-(6419*_>>8)-(13320*V>>8)+8708)}function Gc(S,_){return Jh((19077*S>>8)+(33050*_>>8)-17685)}function Yc(S,_,V,Q,ge){Q[ge+0]=lc(S,V),Q[ge+1]=Qo(S,_,V),Q[ge+2]=Gc(S,_)}function id(S,_,V,Q,ge){Q[ge+0]=Gc(S,_),Q[ge+1]=Qo(S,_,V),Q[ge+2]=lc(S,V)}function sd(S,_,V,Q,ge){var be=Qo(S,_,V);_=be<<3&224|Gc(S,_)>>3,Q[ge+0]=248&lc(S,V)|be>>5,Q[ge+1]=_}function ki(S,_,V,Q,ge){var be=240&Gc(S,_)|15;Q[ge+0]=240&lc(S,V)|Qo(S,_,V)>>4,Q[ge+1]=be}function Kc(S,_,V,Q,ge){Q[ge+0]=255,Yc(S,_,V,Q,ge+1)}function vo(S,_,V,Q,ge){id(S,_,V,Q,ge),Q[ge+3]=255}function Qh(S,_,V,Q,ge){Yc(S,_,V,Q,ge),Q[ge+3]=255}function Nl(S,_,V){I[S]=function(Q,ge,be,je,Ce,Pe,Fe,Ke,ht){for(var Le=Ke+(-2&ht)*V;Ke!=Le;)_(Q[ge+0],be[je+0],Ce[Pe+0],Fe,Ke),_(Q[ge+1],be[je+0],Ce[Pe+0],Fe,Ke+V),ge+=2,++je,++Pe,Ke+=2*V;1&ht&&_(Q[ge+0],be[je+0],Ce[Pe+0],Fe,Ke)}}function gs(S,_,V){return V==0?S==0?_==0?6:5:_==0?4:0:V}function em(S,_,V,Q,ge){switch(S>>>30){case 3:el(_,V,Q,ge,0);break;case 2:yo(_,V,Q,ge);break;case 1:_i(_,V,Q,ge)}}function od(S,_){var V,Q,ge=_.M,be=_.Nb,je=S.oc,Ce=S.pc+40,Pe=S.oc,Fe=S.pc+584,Ke=S.oc,ht=S.pc+600;for(V=0;16>V;++V)je[Ce+32*V-1]=129;for(V=0;8>V;++V)Pe[Fe+32*V-1]=129,Ke[ht+32*V-1]=129;for(0<ge?je[Ce-1-32]=Pe[Fe-1-32]=Ke[ht-1-32]=129:(a(je,Ce-32-1,127,21),a(Pe,Fe-32-1,127,9),a(Ke,ht-32-1,127,9)),Q=0;Q<S.za;++Q){var Le=_.ya[_.aa+Q];if(0<Q){for(V=-1;16>V;++V)n(je,Ce+32*V-4,je,Ce+32*V+12,4);for(V=-1;8>V;++V)n(Pe,Fe+32*V-4,Pe,Fe+32*V+4,4),n(Ke,ht+32*V-4,Ke,ht+32*V+4,4)}var Qe=S.Gd,lt=S.Hd+Q,jt=Le.ad,ut=Le.Hc;if(0<ge&&(n(je,Ce-32,Qe[lt].y,0,16),n(Pe,Fe-32,Qe[lt].f,0,8),n(Ke,ht-32,Qe[lt].ea,0,8)),Le.Za){var wt=je,kt=Ce-32+16;for(0<ge&&(Q>=S.za-1?a(wt,kt,Qe[lt].y[15],4):n(wt,kt,Qe[lt+1].y,0,4)),V=0;4>V;V++)wt[kt+128+V]=wt[kt+256+V]=wt[kt+384+V]=wt[kt+0+V];for(V=0;16>V;++V,ut<<=2)wt=je,kt=Ce+Ma[V],Ca[Le.Ob[V]](wt,kt),em(ut,jt,16*+V,wt,kt)}else if(wt=gs(Q,ge,Le.Ob[0]),bs[wt](je,Ce),ut!=0)for(V=0;16>V;++V,ut<<=2)em(ut,jt,16*+V,je,Ce+Ma[V]);for(V=Le.Gc,wt=gs(Q,ge,Le.Dd),tl[wt](Pe,Fe),tl[wt](Ke,ht),ut=jt,wt=Pe,kt=Fe,255&(Le=0|V)&&(170&Le?tu(ut,256,wt,kt):Zi(ut,256,wt,kt)),Le=Ke,ut=ht,255&(V>>=8)&&(170&V?tu(jt,320,Le,ut):Zi(jt,320,Le,ut)),ge<S.Ub-1&&(n(Qe[lt].y,0,je,Ce+480,16),n(Qe[lt].f,0,Pe,Fe+224,8),n(Qe[lt].ea,0,Ke,ht+224,8)),V=8*be*S.B,Qe=S.sa,lt=S.ta+16*Q+16*be*S.R,jt=S.qa,Le=S.ra+8*Q+V,ut=S.Ha,wt=S.Ia+8*Q+V,V=0;16>V;++V)n(Qe,lt+V*S.R,je,Ce+32*V,16);for(V=0;8>V;++V)n(jt,Le+V*S.B,Pe,Fe+32*V,8),n(ut,wt+V*S.B,Ke,ht+32*V,8)}}function Xc(S,_,V,Q,ge,be,je,Ce,Pe){var Fe=[0],Ke=[0],ht=0,Le=Pe!=null?Pe.kd:0,Qe=Pe??new et;if(S==null||12>V)return 7;Qe.data=S,Qe.w=_,Qe.ha=V,_=[_],V=[V],Qe.gb=[Qe.gb];e:{var lt=_,jt=V,ut=Qe.gb;if(t(S!=null),t(jt!=null),t(ut!=null),ut[0]=0,12<=jt[0]&&!r(S,lt[0],"RIFF")){if(r(S,lt[0]+8,"WEBP")){ut=3;break e}var wt=_e(S,lt[0]+4);if(12>wt||4294967286<wt){ut=3;break e}if(Le&&wt>jt[0]-8){ut=7;break e}ut[0]=wt,lt[0]+=12,jt[0]-=12}ut=0}if(ut!=0)return ut;for(wt=0<Qe.gb[0],V=V[0];;){e:{var kt=S;jt=_,ut=V;var zt=Fe,Tt=Ke,cr=lt=[0];if((nr=ht=[ht])[0]=0,8>ut[0])ut=7;else{if(!r(kt,jt[0],"VP8X")){if(_e(kt,jt[0]+4)!=10){ut=3;break e}if(18>ut[0]){ut=7;break e}var Jt=_e(kt,jt[0]+8),Dr=1+ae(kt,jt[0]+12);if(2147483648<=Dr*(kt=1+ae(kt,jt[0]+15))){ut=3;break e}cr!=null&&(cr[0]=Jt),zt!=null&&(zt[0]=Dr),Tt!=null&&(Tt[0]=kt),jt[0]+=18,ut[0]-=18,nr[0]=1}ut=0}}if(ht=ht[0],lt=lt[0],ut!=0)return ut;if(jt=!!(2&lt),!wt&&ht)return 3;if(be!=null&&(be[0]=!!(16&lt)),je!=null&&(je[0]=jt),Ce!=null&&(Ce[0]=0),je=Fe[0],lt=Ke[0],ht&&jt&&Pe==null){ut=0;break}if(4>V){ut=7;break}if(wt&&ht||!wt&&!ht&&!r(S,_[0],"ALPH")){V=[V],Qe.na=[Qe.na],Qe.P=[Qe.P],Qe.Sa=[Qe.Sa];e:{Jt=S,ut=_,wt=V;var nr=Qe.gb;zt=Qe.na,Tt=Qe.P,cr=Qe.Sa,Dr=22,t(Jt!=null),t(wt!=null),kt=ut[0];var Jr=wt[0];for(t(zt!=null),t(cr!=null),zt[0]=null,Tt[0]=null,cr[0]=0;;){if(ut[0]=kt,wt[0]=Jr,8>Jr){ut=7;break e}var ta=_e(Jt,kt+4);if(4294967286<ta){ut=3;break e}var Lr=8+ta+1&-2;if(Dr+=Lr,0<nr&&Dr>nr){ut=3;break e}if(!r(Jt,kt,"VP8 ")||!r(Jt,kt,"VP8L")){ut=0;break e}if(Jr[0]<Lr){ut=7;break e}r(Jt,kt,"ALPH")||(zt[0]=Jt,Tt[0]=kt+8,cr[0]=ta),kt+=Lr,Jr-=Lr}}if(V=V[0],Qe.na=Qe.na[0],Qe.P=Qe.P[0],Qe.Sa=Qe.Sa[0],ut!=0)break}V=[V],Qe.Ja=[Qe.Ja],Qe.xa=[Qe.xa];e:if(nr=S,ut=_,wt=V,zt=Qe.gb[0],Tt=Qe.Ja,cr=Qe.xa,Jt=ut[0],kt=!r(nr,Jt,"VP8 "),Dr=!r(nr,Jt,"VP8L"),t(nr!=null),t(wt!=null),t(Tt!=null),t(cr!=null),8>wt[0])ut=7;else{if(kt||Dr){if(nr=_e(nr,Jt+4),12<=zt&&nr>zt-12){ut=3;break e}if(Le&&nr>wt[0]-8){ut=7;break e}Tt[0]=nr,ut[0]+=8,wt[0]-=8,cr[0]=Dr}else cr[0]=5<=wt[0]&&nr[Jt+0]==47&&!(nr[Jt+4]>>5),Tt[0]=wt[0];ut=0}if(V=V[0],Qe.Ja=Qe.Ja[0],Qe.xa=Qe.xa[0],_=_[0],ut!=0)break;if(4294967286<Qe.Ja)return 3;if(Ce==null||jt||(Ce[0]=Qe.xa?2:1),je=[je],lt=[lt],Qe.xa){if(5>V){ut=7;break}Ce=je,Le=lt,jt=be,S==null||5>V?S=0:5<=V&&S[_+0]==47&&!(S[_+4]>>5)?(wt=[0],nr=[0],zt=[0],le(Tt=new H,S,_,V),Rr(Tt,wt,nr,zt)?(Ce!=null&&(Ce[0]=wt[0]),Le!=null&&(Le[0]=nr[0]),jt!=null&&(jt[0]=zt[0]),S=1):S=0):S=0}else{if(10>V){ut=7;break}Ce=lt,S==null||10>V||!Vh(S,_+3,V-3)?S=0:(Le=S[_+0]|S[_+1]<<8|S[_+2]<<16,jt=16383&(S[_+7]<<8|S[_+6]),S=16383&(S[_+9]<<8|S[_+8]),1&Le||3<(Le>>1&7)||!(Le>>4&1)||Le>>5>=Qe.Ja||!jt||!S?S=0:(je&&(je[0]=jt),Ce&&(Ce[0]=S),S=1))}if(!S||(je=je[0],lt=lt[0],ht&&(Fe[0]!=je||Ke[0]!=lt)))return 3;Pe!=null&&(Pe[0]=Qe,Pe.offset=_-Pe.w,t(4294967286>_-Pe.w),t(Pe.offset==Pe.ha-V));break}return ut==0||ut==7&&ht&&Pe==null?(be!=null&&(be[0]|=Qe.na!=null&&0<Qe.na.length),Q!=null&&(Q[0]=je),ge!=null&&(ge[0]=lt),0):ut}function Xi(S,_,V){var Q=_.width,ge=_.height,be=0,je=0,Ce=Q,Pe=ge;if(_.Da=S!=null&&0<S.Da,_.Da&&(Ce=S.cd,Pe=S.bd,be=S.v,je=S.j,11>V||(be&=-2,je&=-2),0>be||0>je||0>=Ce||0>=Pe||be+Ce>Q||je+Pe>ge))return 0;if(_.v=be,_.j=je,_.va=be+Ce,_.o=je+Pe,_.U=Ce,_.T=Pe,_.da=S!=null&&0<S.da,_.da){if(!Je(Ce,Pe,V=[S.ib],be=[S.hb]))return 0;_.ib=V[0],_.hb=be[0]}return _.ob=S!=null&&S.ob,_.Kb=S==null||!S.Sd,_.da&&(_.ob=_.ib<3*Q/4&&_.hb<3*ge/4,_.Kb=0),1}function ld(S){if(S==null)return 2;if(11>S.S){var _=S.f.RGBA;_.fb+=(S.height-1)*_.A,_.A=-_.A}else _=S.f.kb,S=S.height,_.O+=(S-1)*_.fa,_.fa=-_.fa,_.N+=(S-1>>1)*_.Ab,_.Ab=-_.Ab,_.W+=(S-1>>1)*_.Db,_.Db=-_.Db,_.F!=null&&(_.J+=(S-1)*_.lb,_.lb=-_.lb);return 0}function Zc(S,_,V,Q){if(Q==null||0>=S||0>=_)return 2;if(V!=null){if(V.Da){var ge=V.cd,be=V.bd,je=-2&V.v,Ce=-2&V.j;if(0>je||0>Ce||0>=ge||0>=be||je+ge>S||Ce+be>_)return 2;S=ge,_=be}if(V.da){if(!Je(S,_,ge=[V.ib],be=[V.hb]))return 2;S=ge[0],_=be[0]}}Q.width=S,Q.height=_;e:{var Pe=Q.width,Fe=Q.height;if(S=Q.S,0>=Pe||0>=Fe||!(S>=I0&&13>S))S=2;else{if(0>=Q.Rd&&Q.sd==null){je=be=ge=_=0;var Ke=(Ce=Pe*W0[S])*Fe;if(11>S||(be=(Fe+1)/2*(_=(Pe+1)/2),S==12&&(je=(ge=Pe)*Fe)),(Fe=s(Ke+2*be+je))==null){S=1;break e}Q.sd=Fe,11>S?((Pe=Q.f.RGBA).eb=Fe,Pe.fb=0,Pe.A=Ce,Pe.size=Ke):((Pe=Q.f.kb).y=Fe,Pe.O=0,Pe.fa=Ce,Pe.Fd=Ke,Pe.f=Fe,Pe.N=0+Ke,Pe.Ab=_,Pe.Cd=be,Pe.ea=Fe,Pe.W=0+Ke+be,Pe.Db=_,Pe.Ed=be,S==12&&(Pe.F=Fe,Pe.J=0+Ke+2*be),Pe.Tc=je,Pe.lb=ge)}if(_=1,ge=Q.S,be=Q.width,je=Q.height,ge>=I0&&13>ge)if(11>ge)S=Q.f.RGBA,_&=(Ce=Math.abs(S.A))*(je-1)+be<=S.size,_&=Ce>=be*W0[ge],_&=S.eb!=null;else{S=Q.f.kb,Ce=(be+1)/2,Ke=(je+1)/2,Pe=Math.abs(S.fa),Fe=Math.abs(S.Ab);var ht=Math.abs(S.Db),Le=Math.abs(S.lb),Qe=Le*(je-1)+be;_&=Pe*(je-1)+be<=S.Fd,_&=Fe*(Ke-1)+Ce<=S.Cd,_=(_&=ht*(Ke-1)+Ce<=S.Ed)&Pe>=be&Fe>=Ce&ht>=Ce,_&=S.y!=null,_&=S.f!=null,_&=S.ea!=null,ge==12&&(_&=Le>=be,_&=Qe<=S.Tc,_&=S.F!=null)}else _=0;S=_?0:2}}return S!=0||V!=null&&V.fd&&(S=ld(Q)),S}var cd=64,Jc=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],ud=24,Ci=32,vs=8,dd=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];Ye("Predictor0","PredictorAdd0"),I.Predictor0=function(){return 4278190080},I.Predictor1=function(S){return S},I.Predictor2=function(S,_,V){return _[V+0]},I.Predictor3=function(S,_,V){return _[V+1]},I.Predictor4=function(S,_,V){return _[V-1]},I.Predictor5=function(S,_,V){return Y(Y(S,_[V+1]),_[V+0])},I.Predictor6=function(S,_,V){return Y(S,_[V-1])},I.Predictor7=function(S,_,V){return Y(S,_[V+0])},I.Predictor8=function(S,_,V){return Y(_[V-1],_[V+0])},I.Predictor9=function(S,_,V){return Y(_[V+0],_[V+1])},I.Predictor10=function(S,_,V){return Y(Y(S,_[V-1]),Y(_[V+0],_[V+1]))},I.Predictor11=function(S,_,V){var Q=_[V+0];return 0>=ve(Q>>24&255,S>>24&255,(_=_[V-1])>>24&255)+ve(Q>>16&255,S>>16&255,_>>16&255)+ve(Q>>8&255,S>>8&255,_>>8&255)+ve(255&Q,255&S,255&_)?Q:S},I.Predictor12=function(S,_,V){var Q=_[V+0];return(we((S>>24&255)+(Q>>24&255)-((_=_[V-1])>>24&255))<<24|we((S>>16&255)+(Q>>16&255)-(_>>16&255))<<16|we((S>>8&255)+(Q>>8&255)-(_>>8&255))<<8|we((255&S)+(255&Q)-(255&_)))>>>0},I.Predictor13=function(S,_,V){var Q=_[V-1];return(J((S=Y(S,_[V+0]))>>24&255,Q>>24&255)<<24|J(S>>16&255,Q>>16&255)<<16|J(S>>8&255,Q>>8&255)<<8|J(255&S,255&Q))>>>0};var cc=I.PredictorAdd0;I.PredictorAdd1=Oe,Ye("Predictor2","PredictorAdd2"),Ye("Predictor3","PredictorAdd3"),Ye("Predictor4","PredictorAdd4"),Ye("Predictor5","PredictorAdd5"),Ye("Predictor6","PredictorAdd6"),Ye("Predictor7","PredictorAdd7"),Ye("Predictor8","PredictorAdd8"),Ye("Predictor9","PredictorAdd9"),Ye("Predictor10","PredictorAdd10"),Ye("Predictor11","PredictorAdd11"),Ye("Predictor12","PredictorAdd12"),Ye("Predictor13","PredictorAdd13");var Qc=I.PredictorAdd2;Ge("ColorIndexInverseTransform","MapARGB","32b",function(S){return S>>8&255},function(S){return S}),Ge("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(S){return S},function(S){return S>>8&255});var Nf,fd=I.ColorIndexInverseTransform,Ha=I.MapARGB,Hx=I.VP8LColorIndexInverseTransformAlpha,Aa=I.MapAlpha,ys=I.VP8LPredictorsAdd=[];ys.length=16,(I.VP8LPredictors=[]).length=16,(I.VP8LPredictorsAdd_C=[]).length=16,(I.VP8LPredictors_C=[]).length=16;var eu,Sf,Af,hd,uc,md,eo,el,yo,tu,_i,Zi,xn,On,ka,Qn,Sl,kf,pd,R0,H1,V1,Vx,qx,xd,bo,tm,to,gd=s(511),M0=s(2041),rm=s(225),nm=s(767),L0=0,dc=M0,am=rm,Ji=nm,Ei=gd,I0=0,Qi=1,F0=2,wo=3,im=4,Cf=5,ru=6,sm=7,B0=8,_f=9,z0=10,jo=[2,3,7],Ef=[3,3,11],vd=[280,256,256,256,40],U0=[0,1,1,1,0],om=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],No=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],So=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],nu=8,Ao=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],ko=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],ro=null,q1=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],Wx=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],$0=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],W1=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],Ti=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],ea=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],tn=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],bs=[],Ca=[],tl=[],au=1,Gx=2,fc=[],Pi=[];Ki("UpsampleRgbLinePair",Yc,3),Ki("UpsampleBgrLinePair",id,3),Ki("UpsampleRgbaLinePair",Qh,4),Ki("UpsampleBgraLinePair",vo,4),Ki("UpsampleArgbLinePair",Kc,4),Ki("UpsampleRgba4444LinePair",ki,2),Ki("UpsampleRgb565LinePair",sd,2);var yd=I.UpsampleRgbLinePair,Yx=I.UpsampleBgrLinePair,Tf=I.UpsampleRgbaLinePair,H0=I.UpsampleBgraLinePair,iu=I.UpsampleArgbLinePair,Al=I.UpsampleRgba4444LinePair,su=I.UpsampleRgb565LinePair,Co=16,Pf=1<<Co-1,bd=-227,ou=482,V0=6,lu=0,Di=s(256),q0=s(256),G1=s(256),nj=s(256),aj=s(ou-bd),ij=s(ou-bd);Nl("YuvToRgbRow",Yc,3),Nl("YuvToBgrRow",id,3),Nl("YuvToRgbaRow",Qh,4),Nl("YuvToBgraRow",vo,4),Nl("YuvToArgbRow",Kc,4),Nl("YuvToRgba4444Row",ki,2),Nl("YuvToRgb565Row",sd,2);var Ma=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Df=[0,2,8],lm=[8,7,6,4,4,2,2,2,1,1,1,1],cm=1;this.WebPDecodeRGBA=function(S,_,V,Q,ge){var be=Qi,je=new We,Ce=new Ft;je.ba=Ce,Ce.S=be,Ce.width=[Ce.width],Ce.height=[Ce.height];var Pe=Ce.width,Fe=Ce.height,Ke=new Dt;if(Ke==null||S==null)var ht=2;else t(Ke!=null),ht=Xc(S,_,V,Ke.width,Ke.height,Ke.Pd,Ke.Qd,Ke.format,null);if(ht!=0?Pe=0:(Pe!=null&&(Pe[0]=Ke.width[0]),Fe!=null&&(Fe[0]=Ke.height[0]),Pe=1),Pe){Ce.width=Ce.width[0],Ce.height=Ce.height[0],Q!=null&&(Q[0]=Ce.width),ge!=null&&(ge[0]=Ce.height);e:{if(Q=new Ql,(ge=new et).data=S,ge.w=_,ge.ha=V,ge.kd=1,_=[0],t(ge!=null),((S=Xc(ge.data,ge.w,ge.ha,null,null,null,_,null,ge))==0||S==7)&&_[0]&&(S=4),(_=S)==0){if(t(je!=null),Q.data=ge.data,Q.w=ge.w+ge.offset,Q.ha=ge.ha-ge.offset,Q.put=Ht,Q.ac=Ur,Q.bc=It,Q.ma=je,ge.xa){if((S=dt())==null){je=1;break e}if((function(Le,Qe){var lt=[0],jt=[0],ut=[0];t:for(;;){if(Le==null)return 0;if(Qe==null)return Le.a=2,0;if(Le.l=Qe,Le.a=0,le(Le.m,Qe.data,Qe.w,Qe.ha),!Rr(Le.m,lt,jt,ut)){Le.a=3;break t}if(Le.xb=Gx,Qe.width=lt[0],Qe.height=jt[0],!ft(lt[0],jt[0],1,Le,null))break t;return 1}return t(Le.a!=0),0})(S,Q)){if(Q=(_=Zc(Q.width,Q.height,je.Oa,je.ba))==0){t:{Q=S;r:for(;;){if(Q==null){Q=0;break t}if(t(Q.s.yc!=null),t(Q.s.Ya!=null),t(0<Q.s.Wb),t((V=Q.l)!=null),t((ge=V.ma)!=null),Q.xb!=0){if(Q.ca=ge.ba,Q.tb=ge.tb,t(Q.ca!=null),!Xi(ge.Oa,V,wo)){Q.a=2;break r}if(!mt(Q,V.width)||V.da)break r;if((V.da||vt(Q.ca.S))&&fa(),11>Q.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),Q.ca.f.kb.F!=null&&fa()),Q.Pb&&0<Q.s.ua&&Q.s.vb.X==null&&!ue(Q.s.vb,Q.s.Wa.Xa)){Q.a=1;break r}Q.xb=0}if(!ct(Q,Q.V,Q.Ba,Q.c,Q.i,V.o,Ee))break r;ge.Dc=Q.Ma,Q=1;break t}t(Q.a!=0),Q=0}Q=!Q}Q&&(_=S.a)}else _=S.a}else{if((S=new Wo)==null){je=1;break e}if(S.Fa=ge.na,S.P=ge.P,S.qc=ge.Sa,bl(S,Q)){if((_=Zc(Q.width,Q.height,je.Oa,je.ba))==0){if(S.Aa=0,V=je.Oa,t((ge=S)!=null),V!=null){if(0<(Pe=0>(Pe=V.Md)?0:100<Pe?255:255*Pe/100)){for(Fe=Ke=0;4>Fe;++Fe)12>(ht=ge.pb[Fe]).lc&&(ht.ia=Pe*lm[0>ht.lc?0:ht.lc]>>3),Ke|=ht.ia;Ke&&(alert("todo:VP8InitRandom"),ge.ia=1)}ge.Ga=V.Id,100<ge.Ga?ge.Ga=100:0>ge.Ga&&(ge.Ga=0)}(function(Le,Qe){if(Le==null)return 0;if(Qe==null)return pn(Le,2,"NULL VP8Io parameter in VP8Decode().");if(!Le.cb&&!bl(Le,Qe))return 0;if(t(Le.cb),Qe.ac==null||Qe.ac(Qe)){Qe.ob&&(Le.L=0);var lt=Df[Le.L];if(Le.L==2?(Le.yb=0,Le.zb=0):(Le.yb=Qe.v-lt>>4,Le.zb=Qe.j-lt>>4,0>Le.yb&&(Le.yb=0),0>Le.zb&&(Le.zb=0)),Le.Va=Qe.o+15+lt>>4,Le.Hb=Qe.va+15+lt>>4,Le.Hb>Le.za&&(Le.Hb=Le.za),Le.Va>Le.Ub&&(Le.Va=Le.Ub),0<Le.L){var jt=Le.ed;for(lt=0;4>lt;++lt){var ut;if(Le.Qa.Cb){var wt=Le.Qa.Lb[lt];Le.Qa.Fb||(wt+=jt.Tb)}else wt=jt.Tb;for(ut=0;1>=ut;++ut){var kt=Le.gd[lt][ut],zt=wt;if(jt.Pc&&(zt+=jt.vd[0],ut&&(zt+=jt.od[0])),0<(zt=0>zt?0:63<zt?63:zt)){var Tt=zt;0<jt.wb&&(Tt=4<jt.wb?Tt>>2:Tt>>1)>9-jt.wb&&(Tt=9-jt.wb),1>Tt&&(Tt=1),kt.dd=Tt,kt.tc=2*zt+Tt,kt.ld=40<=zt?2:15<=zt?1:0}else kt.tc=0;kt.La=ut}}}lt=0}else pn(Le,6,"Frame setup failed"),lt=Le.a;if(lt=lt==0){if(lt){Le.$c=0,0<Le.Aa||(Le.Ic=cm);t:{lt=Le.Ic,jt=4*(Tt=Le.za);var cr=32*Tt,Jt=Tt+1,Dr=0<Le.L?Tt*(0<Le.Aa?2:1):0,nr=(Le.Aa==2?2:1)*Tt;if((kt=jt+832+(ut=3*(16*lt+Df[Le.L])/2*cr)+(wt=Le.Fa!=null&&0<Le.Fa.length?Le.Kc.c*Le.Kc.i:0))!=kt)lt=0;else{if(kt>Le.Vb){if(Le.Vb=0,Le.Ec=s(kt),Le.Fc=0,Le.Ec==null){lt=pn(Le,1,"no memory during frame initialization.");break t}Le.Vb=kt}kt=Le.Ec,zt=Le.Fc,Le.Ac=kt,Le.Bc=zt,zt+=jt,Le.Gd=o(cr,Zs),Le.Hd=0,Le.rb=o(Jt+1,Pn),Le.sb=1,Le.wa=Dr?o(Dr,Wr):null,Le.Y=0,Le.D.Nb=0,Le.D.wa=Le.wa,Le.D.Y=Le.Y,0<Le.Aa&&(Le.D.Y+=Tt),t(!0),Le.oc=kt,Le.pc=zt,zt+=832,Le.ya=o(nr,Vo),Le.aa=0,Le.D.ya=Le.ya,Le.D.aa=Le.aa,Le.Aa==2&&(Le.D.aa+=Tt),Le.R=16*Tt,Le.B=8*Tt,Tt=(cr=Df[Le.L])*Le.R,cr=cr/2*Le.B,Le.sa=kt,Le.ta=zt+Tt,Le.qa=Le.sa,Le.ra=Le.ta+16*lt*Le.R+cr,Le.Ha=Le.qa,Le.Ia=Le.ra+8*lt*Le.B+cr,Le.$c=0,zt+=ut,Le.mb=wt?kt:null,Le.nb=wt?zt:null,t(zt+wt<=Le.Fc+Le.Vb),xf(Le),a(Le.Ac,Le.Bc,0,jt),lt=1}}if(lt){if(Qe.ka=0,Qe.y=Le.sa,Qe.O=Le.ta,Qe.f=Le.qa,Qe.N=Le.ra,Qe.ea=Le.Ha,Qe.Vd=Le.Ia,Qe.fa=Le.R,Qe.Rc=Le.B,Qe.F=null,Qe.J=0,!L0){for(lt=-255;255>=lt;++lt)gd[255+lt]=0>lt?-lt:lt;for(lt=-1020;1020>=lt;++lt)M0[1020+lt]=-128>lt?-128:127<lt?127:lt;for(lt=-112;112>=lt;++lt)rm[112+lt]=-16>lt?-16:15<lt?15:lt;for(lt=-255;510>=lt;++lt)nm[255+lt]=0>lt?0:255<lt?255:lt;L0=1}eo=ec,el=Wh,tu=qc,_i=_0,Zi=Go,yo=qh,xn=P0,On=jf,ka=O0,Qn=U,Sl=D0,kf=ad,pd=pe,R0=Me,H1=Wc,V1=nc,Vx=ac,qx=Zh,Ca[0]=T0,Ca[1]=Qu,Ca[2]=E0,Ca[3]=Kh,Ca[4]=ed,Ca[5]=Xo,Ca[6]=Ko,Ca[7]=Js,Ca[8]=Xh,Ca[9]=jl,bs[0]=xo,bs[1]=Gh,bs[2]=Ux,bs[3]=$x,bs[4]=wl,bs[5]=Yh,bs[6]=go,tl[0]=wf,tl[1]=yf,tl[2]=tc,tl[3]=bf,tl[4]=Yi,tl[5]=td,tl[6]=Zo,lt=1}else lt=0}lt&&(lt=(function(Jr,ta){for(Jr.M=0;Jr.M<Jr.Va;++Jr.M){var Lr,Qt=Jr.Jc[Jr.M&Jr.Xb],Kt=Jr.m,ha=Jr;for(Lr=0;Lr<ha.za;++Lr){var Sr=Kt,Br=ha,kn=Br.Ac,ii=Br.Bc+4*Lr,Oi=Br.zc,qn=Br.ya[Br.aa+Lr];if(Br.Qa.Bb?qn.$b=fe(Sr,Br.Pa.jb[0])?2+fe(Sr,Br.Pa.jb[2]):fe(Sr,Br.Pa.jb[1]):qn.$b=0,Br.kc&&(qn.Ad=fe(Sr,Br.Bd)),qn.Za=!fe(Sr,145)+0,qn.Za){var Va=qn.Ob,es=0;for(Br=0;4>Br;++Br){var qa,Vr=Oi[0+Br];for(qa=0;4>qa;++qa){Vr=Ti[kn[ii+qa]][Vr];for(var dn=$0[fe(Sr,Vr[0])];0<dn;)dn=$0[2*dn+fe(Sr,Vr[dn])];Vr=-dn,kn[ii+qa]=Vr}n(Va,es,kn,ii,4),es+=4,Oi[0+Br]=Vr}}else Vr=fe(Sr,156)?fe(Sr,128)?1:3:fe(Sr,163)?2:0,qn.Ob[0]=Vr,a(kn,ii,Vr,4),a(Oi,0,Vr,4);qn.Dd=fe(Sr,142)?fe(Sr,114)?fe(Sr,183)?1:3:2:0}if(ha.m.Ka)return pn(Jr,7,"Premature end-of-partition0 encountered.");for(;Jr.ja<Jr.za;++Jr.ja){if(ha=Qt,Sr=(Kt=Jr).rb[Kt.sb-1],kn=Kt.rb[Kt.sb+Kt.ja],Lr=Kt.ya[Kt.aa+Kt.ja],ii=Kt.kc?Lr.Ad:0)Sr.la=kn.la=0,Lr.Za||(Sr.Na=kn.Na=0),Lr.Hc=0,Lr.Gc=0,Lr.ia=0;else{var ma,gn;if(Sr=kn,kn=ha,ii=Kt.Pa.Xc,Oi=Kt.ya[Kt.aa+Kt.ja],qn=Kt.pb[Oi.$b],Br=Oi.ad,Va=0,es=Kt.rb[Kt.sb-1],Vr=qa=0,a(Br,Va,0,384),Oi.Za)var si=0,pa=ii[3];else{dn=s(16);var fn=Sr.Na+es.Na;if(fn=ro(kn,ii[1],fn,qn.Eb,0,dn,0),Sr.Na=es.Na=(0<fn)+0,1<fn)eo(dn,0,Br,Va);else{var La=dn[0]+3>>3;for(dn=0;256>dn;dn+=16)Br[Va+dn]=La}si=1,pa=ii[0]}var Cn=15&Sr.la,Wa=15&es.la;for(dn=0;4>dn;++dn){var Ga=1&Wa;for(La=gn=0;4>La;++La)Cn=Cn>>1|(Ga=(fn=ro(kn,pa,fn=Ga+(1&Cn),qn.Sc,si,Br,Va))>si)<<7,gn=gn<<2|(3<fn?3:1<fn?2:Br[Va+0]!=0),Va+=16;Cn>>=4,Wa=Wa>>1|Ga<<7,qa=(qa<<8|gn)>>>0}for(pa=Cn,si=Wa>>4,ma=0;4>ma;ma+=2){for(gn=0,Cn=Sr.la>>4+ma,Wa=es.la>>4+ma,dn=0;2>dn;++dn){for(Ga=1&Wa,La=0;2>La;++La)fn=Ga+(1&Cn),Cn=Cn>>1|(Ga=0<(fn=ro(kn,ii[2],fn,qn.Qc,0,Br,Va)))<<3,gn=gn<<2|(3<fn?3:1<fn?2:Br[Va+0]!=0),Va+=16;Cn>>=2,Wa=Wa>>1|Ga<<5}Vr|=gn<<4*ma,pa|=Cn<<4<<ma,si|=(240&Wa)<<ma}Sr.la=pa,es.la=si,Oi.Hc=qa,Oi.Gc=Vr,Oi.ia=43690&Vr?0:qn.ia,ii=!(qa|Vr)}if(0<Kt.L&&(Kt.wa[Kt.Y+Kt.ja]=Kt.gd[Lr.$b][Lr.Za],Kt.wa[Kt.Y+Kt.ja].La|=!ii),ha.Ka)return pn(Jr,7,"Premature end-of-file encountered.")}if(xf(Jr),Kt=ta,ha=1,Lr=(Qt=Jr).D,Sr=0<Qt.L&&Qt.M>=Qt.zb&&Qt.M<=Qt.Va,Qt.Aa==0)t:{if(Lr.M=Qt.M,Lr.uc=Sr,od(Qt,Lr),ha=1,Lr=(gn=Qt.D).Nb,Sr=(Vr=Df[Qt.L])*Qt.R,kn=Vr/2*Qt.B,dn=16*Lr*Qt.R,La=8*Lr*Qt.B,ii=Qt.sa,Oi=Qt.ta-Sr+dn,qn=Qt.qa,Br=Qt.ra-kn+La,Va=Qt.Ha,es=Qt.Ia-kn+La,Wa=(Cn=gn.M)==0,qa=Cn>=Qt.Va-1,Qt.Aa==2&&od(Qt,gn),gn.uc)for(Ga=(fn=Qt).D.M,t(fn.D.uc),gn=fn.yb;gn<fn.Hb;++gn){si=gn,pa=Ga;var Ln=(ln=(Ya=fn).D).Nb;ma=Ya.R;var ln=ln.wa[ln.Y+si],ts=Ya.sa,_a=Ya.ta+16*Ln*ma+16*si,pr=ln.dd,vr=ln.tc;if(vr!=0)if(t(3<=vr),Ya.L==1)0<si&&V1(ts,_a,ma,vr+4),ln.La&&qx(ts,_a,ma,vr),0<pa&&H1(ts,_a,ma,vr+4),ln.La&&Vx(ts,_a,ma,vr);else{var hn=Ya.B,Ds=Ya.qa,_o=Ya.ra+8*Ln*hn+8*si,ws=Ya.Ha,Ya=Ya.Ia+8*Ln*hn+8*si;Ln=ln.ld,0<si&&(On(ts,_a,ma,vr+4,pr,Ln),Qn(Ds,_o,ws,Ya,hn,vr+4,pr,Ln)),ln.La&&(kf(ts,_a,ma,vr,pr,Ln),R0(Ds,_o,ws,Ya,hn,vr,pr,Ln)),0<pa&&(xn(ts,_a,ma,vr+4,pr,Ln),ka(Ds,_o,ws,Ya,hn,vr+4,pr,Ln)),ln.La&&(Sl(ts,_a,ma,vr,pr,Ln),pd(Ds,_o,ws,Ya,hn,vr,pr,Ln))}}if(Qt.ia&&alert("todo:DitherRow"),Kt.put!=null){if(gn=16*Cn,Cn=16*(Cn+1),Wa?(Kt.y=Qt.sa,Kt.O=Qt.ta+dn,Kt.f=Qt.qa,Kt.N=Qt.ra+La,Kt.ea=Qt.Ha,Kt.W=Qt.Ia+La):(gn-=Vr,Kt.y=ii,Kt.O=Oi,Kt.f=qn,Kt.N=Br,Kt.ea=Va,Kt.W=es),qa||(Cn-=Vr),Cn>Kt.o&&(Cn=Kt.o),Kt.F=null,Kt.J=null,Qt.Fa!=null&&0<Qt.Fa.length&&gn<Cn&&(Kt.J=$a(Qt,Kt,gn,Cn-gn),Kt.F=Qt.mb,Kt.F==null&&Kt.F.length==0)){ha=pn(Qt,3,"Could not decode alpha data.");break t}gn<Kt.j&&(Vr=Kt.j-gn,gn=Kt.j,t(!(1&Vr)),Kt.O+=Qt.R*Vr,Kt.N+=Qt.B*(Vr>>1),Kt.W+=Qt.B*(Vr>>1),Kt.F!=null&&(Kt.J+=Kt.width*Vr)),gn<Cn&&(Kt.O+=Kt.v,Kt.N+=Kt.v>>1,Kt.W+=Kt.v>>1,Kt.F!=null&&(Kt.J+=Kt.v),Kt.ka=gn-Kt.j,Kt.U=Kt.va-Kt.v,Kt.T=Cn-gn,ha=Kt.put(Kt))}Lr+1!=Qt.Ic||qa||(n(Qt.sa,Qt.ta-Sr,ii,Oi+16*Qt.R,Sr),n(Qt.qa,Qt.ra-kn,qn,Br+8*Qt.B,kn),n(Qt.Ha,Qt.Ia-kn,Va,es+8*Qt.B,kn))}if(!ha)return pn(Jr,6,"Output aborted.")}return 1})(Le,Qe)),Qe.bc!=null&&Qe.bc(Qe),lt&=1}return lt?(Le.cb=0,lt):0})(S,Q)||(_=S.a)}}else _=S.a}_==0&&je.Oa!=null&&je.Oa.fd&&(_=ld(je.ba))}je=_}be=je!=0?null:11>be?Ce.f.RGBA.eb:Ce.f.kb.y}else be=null;return be};var W0=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function d(I,q){for(var P="",R=0;R<4;R++)P+=String.fromCharCode(I[q++]);return P}function f(I,q){return I[q+0]|I[q+1]<<8}function m(I,q){return(I[q+0]|I[q+1]<<8|I[q+2]<<16)>>>0}function g(I,q){return(I[q+0]|I[q+1]<<8|I[q+2]<<16|I[q+3]<<24)>>>0}new u;var x=[0],y=[0],v=[],w=new u,j=e,k=(function(I,q){var P={},R=0,K=!1,ee=0,se=0;if(P.frames=[],!(function(D,H){for(var G=0;G<4;G++)if(D[H+G]!="RIFF".charCodeAt(G))return!0;return!1})(I,q)){for(g(I,q+=4),q+=8;q<I.length;){var Z=d(I,q),ne=g(I,q+=4);q+=4;var X=ne+(1&ne);switch(Z){case"VP8 ":case"VP8L":P.frames[R]===void 0&&(P.frames[R]={}),(ce=P.frames[R]).src_off=K?se:q-8,ce.src_size=ee+ne+8,R++,K&&(K=!1,ee=0,se=0);break;case"VP8X":(ce=P.header={}).feature_flags=I[q];var le=q+4;ce.canvas_width=1+m(I,le),le+=3,ce.canvas_height=1+m(I,le),le+=3;break;case"ALPH":K=!0,ee=X+8,se=q-8;break;case"ANIM":(ce=P.header).bgcolor=g(I,q),le=q+4,ce.loop_count=f(I,le),le+=2;break;case"ANMF":var Ae,ce;(ce=P.frames[R]={}).offset_x=2*m(I,q),q+=3,ce.offset_y=2*m(I,q),q+=3,ce.width=1+m(I,q),q+=3,ce.height=1+m(I,q),q+=3,ce.duration=m(I,q),q+=3,Ae=I[q++],ce.dispose=1&Ae,ce.blend=Ae>>1&1}Z!="ANMF"&&(q+=X)}return P}})(j,0);k.response=j,k.rgbaoutput=!0,k.dataurl=!1;var A=k.header?k.header:null,T=k.frames?k.frames:null;if(A){A.loop_counter=A.loop_count,x=[A.canvas_height],y=[A.canvas_width];for(var M=0;M<T.length&&T[M].blend!=0;M++);}var B=T[0],L=w.WebPDecodeRGBA(j,B.src_off,B.src_size,y,x);B.rgba=L,B.imgwidth=y[0],B.imgheight=x[0];for(var F=0;F<y[0]*x[0]*4;F++)v[F]=L[F];return this.width=y,this.height=x,this.data=v,this}/** ====================================================================
 * @license
 * jsPDF XMP metadata plugin
 * Copyright (c) 2016 Jussi Utunen, u-jussi@suomi24.fi
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * ====================================================================
 */function KSe(){var e,t=this.internal.__metadata__.metadata,r=unescape(encodeURIComponent(t));e=this.internal.__metadata__.rawXml?r:'<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="'+this.internal.__metadata__.namespaceUri+'"><jspdf:metadata>'+r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")+"</jspdf:metadata></rdf:Description></rdf:RDF></x:xmpmeta>",this.internal.__metadata__.metadataObjectNumber=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+e.length+" >>"),this.internal.write("stream"),this.internal.write(e),this.internal.write("endstream"),this.internal.write("endobj")}function XSe(){this.internal.__metadata__.metadataObjectNumber&&this.internal.write("/Metadata "+this.internal.__metadata__.metadataObjectNumber+" 0 R")}(function(e){var t,r,n,a,s,o,l,u,d,f=function(D){return D=D||{},this.isStrokeTransparent=D.isStrokeTransparent||!1,this.strokeOpacity=D.strokeOpacity||1,this.strokeStyle=D.strokeStyle||"#000000",this.fillStyle=D.fillStyle||"#000000",this.isFillTransparent=D.isFillTransparent||!1,this.fillOpacity=D.fillOpacity||1,this.font=D.font||"10px sans-serif",this.textBaseline=D.textBaseline||"alphabetic",this.textAlign=D.textAlign||"left",this.lineWidth=D.lineWidth||1,this.lineJoin=D.lineJoin||"miter",this.lineCap=D.lineCap||"butt",this.path=D.path||[],this.transform=D.transform!==void 0?D.transform.clone():new u,this.globalCompositeOperation=D.globalCompositeOperation||"normal",this.globalAlpha=D.globalAlpha||1,this.clip_path=D.clip_path||[],this.currentPoint=D.currentPoint||new o,this.miterLimit=D.miterLimit||10,this.lastPoint=D.lastPoint||new o,this.lineDashOffset=D.lineDashOffset||0,this.lineDash=D.lineDash||[],this.margin=D.margin||[0,0,0,0],this.prevPageLastElemOffset=D.prevPageLastElemOffset||0,this.ignoreClearRect=typeof D.ignoreClearRect!="boolean"||D.ignoreClearRect,this};e.events.push(["initialized",function(){this.context2d=new m(this),t=this.internal.f2,r=this.internal.getCoordinateString,n=this.internal.getVerticalCoordinateString,a=this.internal.getHorizontalCoordinate,s=this.internal.getVerticalCoordinate,o=this.internal.Point,l=this.internal.Rectangle,u=this.internal.Matrix,d=new f}]);var m=function(D){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var H=D;Object.defineProperty(this,"pdf",{get:function(){return H}});var G=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return G},set:function(ue){G=!!ue}});var E=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return E},set:function(ue){E=!!ue}});var re=0;Object.defineProperty(this,"posX",{get:function(){return re},set:function(ue){isNaN(ue)||(re=ue)}});var he=0;Object.defineProperty(this,"posY",{get:function(){return he},set:function(ue){isNaN(ue)||(he=ue)}}),Object.defineProperty(this,"margin",{get:function(){return d.margin},set:function(ue){var ke;typeof ue=="number"?ke=[ue,ue,ue,ue]:((ke=new Array(4))[0]=ue[0],ke[1]=ue.length>=2?ue[1]:ke[0],ke[2]=ue.length>=3?ue[2]:ke[0],ke[3]=ue.length>=4?ue[3]:ke[1]),d.margin=ke}});var oe=!1;Object.defineProperty(this,"autoPaging",{get:function(){return oe},set:function(ue){oe=ue}});var z=0;Object.defineProperty(this,"lastBreak",{get:function(){return z},set:function(ue){z=ue}});var fe=[];Object.defineProperty(this,"pageBreaks",{get:function(){return fe},set:function(ue){fe=ue}}),Object.defineProperty(this,"ctx",{get:function(){return d},set:function(ue){ue instanceof f&&(d=ue)}}),Object.defineProperty(this,"path",{get:function(){return d.path},set:function(ue){d.path=ue}});var de=[];Object.defineProperty(this,"ctxStack",{get:function(){return de},set:function(ue){de=ue}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(ue){var ke;ke=g(ue),this.ctx.fillStyle=ke.style,this.ctx.isFillTransparent=ke.a===0,this.ctx.fillOpacity=ke.a,this.pdf.setFillColor(ke.r,ke.g,ke.b,{a:ke.a}),this.pdf.setTextColor(ke.r,ke.g,ke.b,{a:ke.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(ue){var ke=g(ue);this.ctx.strokeStyle=ke.style,this.ctx.isStrokeTransparent=ke.a===0,this.ctx.strokeOpacity=ke.a,ke.a===0?this.pdf.setDrawColor(255,255,255):(ke.a,this.pdf.setDrawColor(ke.r,ke.g,ke.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(ue){["butt","round","square"].indexOf(ue)!==-1&&(this.ctx.lineCap=ue,this.pdf.setLineCap(ue))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(ue){isNaN(ue)||(this.ctx.lineWidth=ue,this.pdf.setLineWidth(ue))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(ue){["bevel","round","miter"].indexOf(ue)!==-1&&(this.ctx.lineJoin=ue,this.pdf.setLineJoin(ue))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(ue){isNaN(ue)||(this.ctx.miterLimit=ue,this.pdf.setMiterLimit(ue))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(ue){this.ctx.textBaseline=ue}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(ue){["right","end","center","left","start"].indexOf(ue)!==-1&&(this.ctx.textAlign=ue)}});var W=null,ae=null,_e=null;Object.defineProperty(this,"fontFaces",{get:function(){return _e},set:function(ue){W=null,ae=null,_e=ue}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(ue){var ke;if(this.ctx.font=ue,(ke=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z0-9]+?)\s*$/i.exec(ue))!==null){var $e=ke[1];ke[2];var Je=ke[3],Xe=ke[4];ke[5];var Ne=ke[6],Ye=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(Xe)[2];Xe=Math.floor(Ye==="px"?parseFloat(Xe)*this.pdf.internal.scaleFactor:Ye==="em"?parseFloat(Xe)*this.pdf.getFontSize():parseFloat(Xe)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(Xe);var at=(function(Ge){var Be,it,st=[],Ve=Ge.trim();if(Ve==="")return HS;if(Ve in hF)return[hF[Ve]];for(;Ve!=="";){switch(it=null,Be=(Ve=pF(Ve)).charAt(0)){case'"':case"'":it=HSe(Ve.substring(1),Be);break;default:it=VSe(Ve)}if(it===null||(st.push(it[0]),(Ve=pF(it[1]))!==""&&Ve.charAt(0)!==","))return HS;Ve=Ve.replace(/^,/,"")}return st})(Ne);if(this.fontFaces){var Y=(function(Ge,Be){var it=Ge.getFontList(),st=JSON.stringify(it);if(W===null||ae!==st){var Ve=(function(te){var Ue=[];return Object.keys(te).forEach(function(ot){te[ot].forEach(function(vt){var _t=null;switch(vt){case"bold":_t={family:ot,weight:"bold"};break;case"italic":_t={family:ot,style:"italic"};break;case"bolditalic":_t={family:ot,weight:"bold",style:"italic"};break;case"":case"normal":_t={family:ot}}_t!==null&&(_t.ref={name:ot,style:vt},Ue.push(_t))})}),Ue})(it);W=(function(te){for(var Ue={},ot=0;ot<te.length;++ot){var vt=$S(te[ot]),_t=vt.family,qt=vt.stretch,Ft=vt.style,Dt=vt.weight;Ue[_t]=Ue[_t]||{},Ue[_t][qt]=Ue[_t][qt]||{},Ue[_t][qt][Ft]=Ue[_t][qt][Ft]||{},Ue[_t][qt][Ft][Dt]=vt}return Ue})(Ve.concat(Be)),ae=st}return W})(this.pdf,this.fontFaces),we=at.map(function(Ge){return{family:Ge,stretch:"normal",weight:Je,style:$e}}),J=(function(Ge,Be,it){for(var st=(it=it||{}).defaultFontFamily||"times",Ve=Object.assign({},$Se,it.genericFontFamilies||{}),te=null,Ue=null,ot=0;ot<Be.length;++ot)if(Ve[(te=$S(Be[ot])).family]&&(te.family=Ve[te.family]),Ge.hasOwnProperty(te.family)){Ue=Ge[te.family];break}if(!(Ue=Ue||Ge[st]))throw new Error("Could not find a font-family for the rule '"+mF(te)+"' and default family '"+st+"'.");if(Ue=(function(vt,_t){if(_t[vt])return _t[vt];var qt=rk[vt],Ft=qt<=rk.normal?-1:1,Dt=fF(_t,PW,qt,Ft);if(!Dt)throw new Error("Could not find a matching font-stretch value for "+vt);return Dt})(te.stretch,Ue),Ue=(function(vt,_t){if(_t[vt])return _t[vt];for(var qt=TW[vt],Ft=0;Ft<qt.length;++Ft)if(_t[qt[Ft]])return _t[qt[Ft]];throw new Error("Could not find a matching font-style for "+vt)})(te.style,Ue),!(Ue=(function(vt,_t){if(_t[vt])return _t[vt];if(vt===400&&_t[500])return _t[500];if(vt===500&&_t[400])return _t[400];var qt=USe[vt],Ft=fF(_t,DW,qt,vt<400?-1:1);if(!Ft)throw new Error("Could not find a matching font-weight for value "+vt);return Ft})(te.weight,Ue)))throw new Error("Failed to resolve a font for the rule '"+mF(te)+"'.");return Ue})(Y,we);this.pdf.setFont(J.ref.name,J.ref.style)}else{var ve="";(Je==="bold"||parseInt(Je,10)>=700||$e==="bold")&&(ve="bold"),$e==="italic"&&(ve+="italic"),ve.length===0&&(ve="normal");for(var Oe="",xe={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},qe=0;qe<at.length;qe++){if(this.pdf.internal.getFont(at[qe],ve,{noFallback:!0,disableWarning:!0})!==void 0){Oe=at[qe];break}if(ve==="bolditalic"&&this.pdf.internal.getFont(at[qe],"bold",{noFallback:!0,disableWarning:!0})!==void 0)Oe=at[qe],ve="bold";else if(this.pdf.internal.getFont(at[qe],"normal",{noFallback:!0,disableWarning:!0})!==void 0){Oe=at[qe],ve="normal";break}}if(Oe===""){for(var me=0;me<at.length;me++)if(xe[at[me]]){Oe=xe[at[me]];break}}Oe=Oe===""?"Times":Oe,this.pdf.setFont(Oe,ve)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(ue){this.ctx.globalCompositeOperation=ue}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(ue){this.ctx.globalAlpha=ue}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(ue){this.ctx.lineDashOffset=ue,ce.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(ue){this.ctx.lineDash=ue,ce.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(ue){this.ctx.ignoreClearRect=!!ue}})};m.prototype.setLineDash=function(D){this.lineDash=D},m.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},m.prototype.fill=function(){T.call(this,"fill",!1)},m.prototype.stroke=function(){T.call(this,"stroke",!1)},m.prototype.beginPath=function(){this.path=[{type:"begin"}]},m.prototype.moveTo=function(D,H){if(isNaN(D)||isNaN(H))throw na.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var G=this.ctx.transform.applyToPoint(new o(D,H));this.path.push({type:"mt",x:G.x,y:G.y}),this.ctx.lastPoint=new o(D,H)},m.prototype.closePath=function(){var D=new o(0,0),H=0;for(H=this.path.length-1;H!==-1;H--)if(this.path[H].type==="begin"&&Un(this.path[H+1])==="object"&&typeof this.path[H+1].x=="number"){D=new o(this.path[H+1].x,this.path[H+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new o(D.x,D.y)},m.prototype.lineTo=function(D,H){if(isNaN(D)||isNaN(H))throw na.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var G=this.ctx.transform.applyToPoint(new o(D,H));this.path.push({type:"lt",x:G.x,y:G.y}),this.ctx.lastPoint=new o(G.x,G.y)},m.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),T.call(this,null,!0)},m.prototype.quadraticCurveTo=function(D,H,G,E){if(isNaN(G)||isNaN(E)||isNaN(D)||isNaN(H))throw na.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var re=this.ctx.transform.applyToPoint(new o(G,E)),he=this.ctx.transform.applyToPoint(new o(D,H));this.path.push({type:"qct",x1:he.x,y1:he.y,x:re.x,y:re.y}),this.ctx.lastPoint=new o(re.x,re.y)},m.prototype.bezierCurveTo=function(D,H,G,E,re,he){if(isNaN(re)||isNaN(he)||isNaN(D)||isNaN(H)||isNaN(G)||isNaN(E))throw na.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var oe=this.ctx.transform.applyToPoint(new o(re,he)),z=this.ctx.transform.applyToPoint(new o(D,H)),fe=this.ctx.transform.applyToPoint(new o(G,E));this.path.push({type:"bct",x1:z.x,y1:z.y,x2:fe.x,y2:fe.y,x:oe.x,y:oe.y}),this.ctx.lastPoint=new o(oe.x,oe.y)},m.prototype.arc=function(D,H,G,E,re,he){if(isNaN(D)||isNaN(H)||isNaN(G)||isNaN(E)||isNaN(re))throw na.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(he=!!he,!this.ctx.transform.isIdentity){var oe=this.ctx.transform.applyToPoint(new o(D,H));D=oe.x,H=oe.y;var z=this.ctx.transform.applyToPoint(new o(0,G)),fe=this.ctx.transform.applyToPoint(new o(0,0));G=Math.sqrt(Math.pow(z.x-fe.x,2)+Math.pow(z.y-fe.y,2))}Math.abs(re-E)>=2*Math.PI&&(E=0,re=2*Math.PI),this.path.push({type:"arc",x:D,y:H,radius:G,startAngle:E,endAngle:re,counterclockwise:he})},m.prototype.arcTo=function(D,H,G,E,re){throw new Error("arcTo not implemented.")},m.prototype.rect=function(D,H,G,E){if(isNaN(D)||isNaN(H)||isNaN(G)||isNaN(E))throw na.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(D,H),this.lineTo(D+G,H),this.lineTo(D+G,H+E),this.lineTo(D,H+E),this.lineTo(D,H),this.lineTo(D+G,H),this.lineTo(D,H)},m.prototype.fillRect=function(D,H,G,E){if(isNaN(D)||isNaN(H)||isNaN(G)||isNaN(E))throw na.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!x.call(this)){var re={};this.lineCap!=="butt"&&(re.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(re.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(D,H,G,E),this.fill(),re.hasOwnProperty("lineCap")&&(this.lineCap=re.lineCap),re.hasOwnProperty("lineJoin")&&(this.lineJoin=re.lineJoin)}},m.prototype.strokeRect=function(D,H,G,E){if(isNaN(D)||isNaN(H)||isNaN(G)||isNaN(E))throw na.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");y.call(this)||(this.beginPath(),this.rect(D,H,G,E),this.stroke())},m.prototype.clearRect=function(D,H,G,E){if(isNaN(D)||isNaN(H)||isNaN(G)||isNaN(E))throw na.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(D,H,G,E))},m.prototype.save=function(D){D=typeof D!="boolean"||D;for(var H=this.pdf.internal.getCurrentPageInfo().pageNumber,G=0;G<this.pdf.internal.getNumberOfPages();G++)this.pdf.setPage(G+1),this.pdf.internal.out("q");if(this.pdf.setPage(H),D){this.ctx.fontSize=this.pdf.internal.getFontSize();var E=new f(this.ctx);this.ctxStack.push(this.ctx),this.ctx=E}},m.prototype.restore=function(D){D=typeof D!="boolean"||D;for(var H=this.pdf.internal.getCurrentPageInfo().pageNumber,G=0;G<this.pdf.internal.getNumberOfPages();G++)this.pdf.setPage(G+1),this.pdf.internal.out("Q");this.pdf.setPage(H),D&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin,this.lineDash=this.ctx.lineDash,this.lineDashOffset=this.ctx.lineDashOffset)},m.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var g=function(D){var H,G,E,re;if(D.isCanvasGradient===!0&&(D=D.getColor()),!D)return{r:0,g:0,b:0,a:0,style:D};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(D))H=0,G=0,E=0,re=0;else{var he=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(D);if(he!==null)H=parseInt(he[1]),G=parseInt(he[2]),E=parseInt(he[3]),re=1;else if((he=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(D))!==null)H=parseInt(he[1]),G=parseInt(he[2]),E=parseInt(he[3]),re=parseFloat(he[4]);else{if(re=1,typeof D=="string"&&D.charAt(0)!=="#"){var oe=new NW(D);D=oe.ok?oe.toHex():"#000000"}D.length===4?(H=D.substring(1,2),H+=H,G=D.substring(2,3),G+=G,E=D.substring(3,4),E+=E):(H=D.substring(1,3),G=D.substring(3,5),E=D.substring(5,7)),H=parseInt(H,16),G=parseInt(G,16),E=parseInt(E,16)}}return{r:H,g:G,b:E,a:re,style:D}},x=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},y=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};m.prototype.fillText=function(D,H,G,E){if(isNaN(H)||isNaN(G)||typeof D!="string")throw na.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(E=isNaN(E)?void 0:E,!x.call(this)){var re=X(this.ctx.transform.rotation),he=this.ctx.transform.scaleX;R.call(this,{text:D,x:H,y:G,scale:he,angle:re,align:this.textAlign,maxWidth:E})}},m.prototype.strokeText=function(D,H,G,E){if(isNaN(H)||isNaN(G)||typeof D!="string")throw na.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!y.call(this)){E=isNaN(E)?void 0:E;var re=X(this.ctx.transform.rotation),he=this.ctx.transform.scaleX;R.call(this,{text:D,x:H,y:G,scale:he,renderingMode:"stroke",angle:re,align:this.textAlign,maxWidth:E})}},m.prototype.measureText=function(D){if(typeof D!="string")throw na.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var H=this.pdf,G=this.pdf.internal.scaleFactor,E=H.internal.getFontSize(),re=H.getStringUnitWidth(D)*E/H.internal.scaleFactor;return new function(he){var oe=(he=he||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return oe}}),this}({width:re*=Math.round(96*G/72*1e4)/1e4})},m.prototype.scale=function(D,H){if(isNaN(D)||isNaN(H))throw na.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var G=new u(D,0,0,H,0,0);this.ctx.transform=this.ctx.transform.multiply(G)},m.prototype.rotate=function(D){if(isNaN(D))throw na.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var H=new u(Math.cos(D),Math.sin(D),-Math.sin(D),Math.cos(D),0,0);this.ctx.transform=this.ctx.transform.multiply(H)},m.prototype.translate=function(D,H){if(isNaN(D)||isNaN(H))throw na.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var G=new u(1,0,0,1,D,H);this.ctx.transform=this.ctx.transform.multiply(G)},m.prototype.transform=function(D,H,G,E,re,he){if(isNaN(D)||isNaN(H)||isNaN(G)||isNaN(E)||isNaN(re)||isNaN(he))throw na.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var oe=new u(D,H,G,E,re,he);this.ctx.transform=this.ctx.transform.multiply(oe)},m.prototype.setTransform=function(D,H,G,E,re,he){D=isNaN(D)?1:D,H=isNaN(H)?0:H,G=isNaN(G)?0:G,E=isNaN(E)?1:E,re=isNaN(re)?0:re,he=isNaN(he)?0:he,this.ctx.transform=new u(D,H,G,E,re,he)};var v=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};m.prototype.drawImage=function(D,H,G,E,re,he,oe,z,fe){var de=this.pdf.getImageProperties(D),W=1,ae=1,_e=1,ue=1;E!==void 0&&z!==void 0&&(_e=z/E,ue=fe/re,W=de.width/E*z/E,ae=de.height/re*fe/re),he===void 0&&(he=H,oe=G,H=0,G=0),E!==void 0&&z===void 0&&(z=E,fe=re),E===void 0&&z===void 0&&(z=de.width,fe=de.height);var ke=this.ctx.transform.decompose(),$e=X(ke.rotate.shx),Je=new u,Xe=(Je=(Je=(Je=Je.multiply(ke.translate)).multiply(ke.skew)).multiply(ke.scale)).applyToRectangle(new l(he-H*_e,oe-G*ue,E*W,re*ae));if(this.autoPaging){for(var Ne,Ye=w.call(this,Xe),at=[],Y=0;Y<Ye.length;Y+=1)at.indexOf(Ye[Y])===-1&&at.push(Ye[Y]);A(at);for(var we=at[0],J=at[at.length-1],ve=we;ve<J+1;ve++){this.pdf.setPage(ve);var Oe=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],xe=ve===1?this.posY+this.margin[0]:this.margin[0],qe=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],me=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],Ge=ve===1?0:qe+(ve-2)*me;if(this.ctx.clip_path.length!==0){var Be=this.path;Ne=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=k(Ne,this.posX+this.margin[3],-Ge+xe+this.ctx.prevPageLastElemOffset),M.call(this,"fill",!0),this.path=Be}var it=JSON.parse(JSON.stringify(Xe));it=k([it],this.posX+this.margin[3],-Ge+xe+this.ctx.prevPageLastElemOffset)[0];var st=(ve>we||ve<J)&&v.call(this);st&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Oe,me,null).clip().discardPath()),this.pdf.addImage(D,"JPEG",it.x,it.y,it.w,it.h,null,null,$e),st&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(D,"JPEG",Xe.x,Xe.y,Xe.w,Xe.h,null,null,$e)};var w=function(D,H,G){var E=[];H=H||this.pdf.internal.pageSize.width,G=G||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var re=this.posY+this.ctx.prevPageLastElemOffset;switch(D.type){default:case"mt":case"lt":E.push(Math.floor((D.y+re)/G)+1);break;case"arc":E.push(Math.floor((D.y+re-D.radius)/G)+1),E.push(Math.floor((D.y+re+D.radius)/G)+1);break;case"qct":var he=le(this.ctx.lastPoint.x,this.ctx.lastPoint.y,D.x1,D.y1,D.x,D.y);E.push(Math.floor((he.y+re)/G)+1),E.push(Math.floor((he.y+he.h+re)/G)+1);break;case"bct":var oe=Ae(this.ctx.lastPoint.x,this.ctx.lastPoint.y,D.x1,D.y1,D.x2,D.y2,D.x,D.y);E.push(Math.floor((oe.y+re)/G)+1),E.push(Math.floor((oe.y+oe.h+re)/G)+1);break;case"rect":E.push(Math.floor((D.y+re)/G)+1),E.push(Math.floor((D.y+D.h+re)/G)+1)}for(var z=0;z<E.length;z+=1)for(;this.pdf.internal.getNumberOfPages()<E[z];)j.call(this);return E},j=function(){var D=this.fillStyle,H=this.strokeStyle,G=this.font,E=this.lineCap,re=this.lineWidth,he=this.lineJoin;this.pdf.addPage(),this.fillStyle=D,this.strokeStyle=H,this.font=G,this.lineCap=E,this.lineWidth=re,this.lineJoin=he},k=function(D,H,G){for(var E=0;E<D.length;E++)switch(D[E].type){case"bct":D[E].x2+=H,D[E].y2+=G;case"qct":D[E].x1+=H,D[E].y1+=G;default:D[E].x+=H,D[E].y+=G}return D},A=function(D){return D.sort(function(H,G){return H-G})},T=function(D,H){var G=this.fillStyle,E=this.strokeStyle,re=this.lineCap,he=this.lineWidth,oe=Math.abs(he*this.ctx.transform.scaleX),z=this.lineJoin;if(this.autoPaging){for(var fe,de,W=JSON.parse(JSON.stringify(this.path)),ae=JSON.parse(JSON.stringify(this.path)),_e=[],ue=0;ue<ae.length;ue++)if(ae[ue].x!==void 0)for(var ke=w.call(this,ae[ue]),$e=0;$e<ke.length;$e+=1)_e.indexOf(ke[$e])===-1&&_e.push(ke[$e]);for(var Je=0;Je<_e.length;Je++)for(;this.pdf.internal.getNumberOfPages()<_e[Je];)j.call(this);A(_e);for(var Xe=_e[0],Ne=_e[_e.length-1],Ye=Xe;Ye<Ne+1;Ye++){this.pdf.setPage(Ye),this.fillStyle=G,this.strokeStyle=E,this.lineCap=re,this.lineWidth=oe,this.lineJoin=z;var at=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Y=Ye===1?this.posY+this.margin[0]:this.margin[0],we=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],J=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],ve=Ye===1?0:we+(Ye-2)*J;if(this.ctx.clip_path.length!==0){var Oe=this.path;fe=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=k(fe,this.posX+this.margin[3],-ve+Y+this.ctx.prevPageLastElemOffset),M.call(this,D,!0),this.path=Oe}if(de=JSON.parse(JSON.stringify(W)),this.path=k(de,this.posX+this.margin[3],-ve+Y+this.ctx.prevPageLastElemOffset),H===!1||Ye===0){var xe=(Ye>Xe||Ye<Ne)&&v.call(this);xe&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],at,J,null).clip().discardPath()),M.call(this,D,H),xe&&this.pdf.restoreGraphicsState()}this.lineWidth=he}this.path=W}else this.lineWidth=oe,M.call(this,D,H),this.lineWidth=he},M=function(D,H){if((D!=="stroke"||H||!y.call(this))&&(D==="stroke"||H||!x.call(this))){for(var G,E,re=[],he=this.path,oe=0;oe<he.length;oe++){var z=he[oe];switch(z.type){case"begin":re.push({begin:!0});break;case"close":re.push({close:!0});break;case"mt":re.push({start:z,deltas:[],abs:[]});break;case"lt":var fe=re.length;if(he[oe-1]&&!isNaN(he[oe-1].x)&&(G=[z.x-he[oe-1].x,z.y-he[oe-1].y],fe>0)){for(;fe>=0;fe--)if(re[fe-1].close!==!0&&re[fe-1].begin!==!0){re[fe-1].deltas.push(G),re[fe-1].abs.push(z);break}}break;case"bct":G=[z.x1-he[oe-1].x,z.y1-he[oe-1].y,z.x2-he[oe-1].x,z.y2-he[oe-1].y,z.x-he[oe-1].x,z.y-he[oe-1].y],re[re.length-1].deltas.push(G);break;case"qct":var de=he[oe-1].x+2/3*(z.x1-he[oe-1].x),W=he[oe-1].y+2/3*(z.y1-he[oe-1].y),ae=z.x+2/3*(z.x1-z.x),_e=z.y+2/3*(z.y1-z.y),ue=z.x,ke=z.y;G=[de-he[oe-1].x,W-he[oe-1].y,ae-he[oe-1].x,_e-he[oe-1].y,ue-he[oe-1].x,ke-he[oe-1].y],re[re.length-1].deltas.push(G);break;case"arc":re.push({deltas:[],abs:[],arc:!0}),Array.isArray(re[re.length-1].abs)&&re[re.length-1].abs.push(z)}}E=H?null:D==="stroke"?"stroke":"fill";for(var $e=!1,Je=0;Je<re.length;Je++)if(re[Je].arc)for(var Xe=re[Je].abs,Ne=0;Ne<Xe.length;Ne++){var Ye=Xe[Ne];Ye.type==="arc"?F.call(this,Ye.x,Ye.y,Ye.radius,Ye.startAngle,Ye.endAngle,Ye.counterclockwise,void 0,H,!$e):K.call(this,Ye.x,Ye.y),$e=!0}else if(re[Je].close===!0)this.pdf.internal.out("h"),$e=!1;else if(re[Je].begin!==!0){var at=re[Je].start.x,Y=re[Je].start.y;ee.call(this,re[Je].deltas,at,Y),$e=!0}E&&I.call(this,E),H&&q.call(this)}},B=function(D){var H=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,G=H*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return D-G;case"top":return D+H-G;case"hanging":return D+H-2*G;case"middle":return D+H/2-G;default:return D}},L=function(D){return D+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};m.prototype.createLinearGradient=function(){var D=function(){};return D.colorStops=[],D.addColorStop=function(H,G){this.colorStops.push([H,G])},D.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},D.isCanvasGradient=!0,D},m.prototype.createPattern=function(){return this.createLinearGradient()},m.prototype.createRadialGradient=function(){return this.createLinearGradient()};var F=function(D,H,G,E,re,he,oe,z,fe){for(var de=Z.call(this,G,E,re,he),W=0;W<de.length;W++){var ae=de[W];W===0&&(fe?P.call(this,ae.x1+D,ae.y1+H):K.call(this,ae.x1+D,ae.y1+H)),se.call(this,D,H,ae.x2,ae.y2,ae.x3,ae.y3,ae.x4,ae.y4)}z?q.call(this):I.call(this,oe)},I=function(D){switch(D){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},q=function(){this.pdf.clip(),this.pdf.discardPath()},P=function(D,H){this.pdf.internal.out(r(D)+" "+n(H)+" m")},R=function(D){var H;switch(D.align){case"right":case"end":H="right";break;case"center":H="center";break;default:H="left"}var G,E,re,he=this.pdf.getTextDimensions(D.text),oe=B.call(this,D.y),z=L.call(this,oe)-he.h,fe=this.ctx.transform.applyToPoint(new o(D.x,oe));if(this.autoPaging){var de=this.ctx.transform.decompose(),W=new u;W=(W=(W=W.multiply(de.translate)).multiply(de.skew)).multiply(de.scale);for(var ae=this.ctx.transform.applyToRectangle(new l(D.x,oe,he.w,he.h)),_e=W.applyToRectangle(new l(D.x,z,he.w,he.h)),ue=w.call(this,_e),ke=[],$e=0;$e<ue.length;$e+=1)ke.indexOf(ue[$e])===-1&&ke.push(ue[$e]);A(ke);for(var Je=ke[0],Xe=ke[ke.length-1],Ne=Je;Ne<Xe+1;Ne++){this.pdf.setPage(Ne);var Ye=Ne===1?this.posY+this.margin[0]:this.margin[0],at=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Y=this.pdf.internal.pageSize.height-this.margin[2],we=Y-this.margin[0],J=this.pdf.internal.pageSize.width-this.margin[1],ve=J-this.margin[3],Oe=Ne===1?0:at+(Ne-2)*we;if(this.ctx.clip_path.length!==0){var xe=this.path;G=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=k(G,this.posX+this.margin[3],-1*Oe+Ye),M.call(this,"fill",!0),this.path=xe}var qe=k([JSON.parse(JSON.stringify(_e))],this.posX+this.margin[3],-Oe+Ye+this.ctx.prevPageLastElemOffset)[0];D.scale>=.01&&(E=this.pdf.internal.getFontSize(),this.pdf.setFontSize(E*D.scale),re=this.lineWidth,this.lineWidth=re*D.scale);var me=this.autoPaging!=="text";if(me||qe.y+qe.h<=Y){if(me||qe.y>=Ye&&qe.x<=J){var Ge=me?D.text:this.pdf.splitTextToSize(D.text,D.maxWidth||J-qe.x)[0],Be=k([JSON.parse(JSON.stringify(ae))],this.posX+this.margin[3],-Oe+Ye+this.ctx.prevPageLastElemOffset)[0],it=me&&(Ne>Je||Ne<Xe)&&v.call(this);it&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],ve,we,null).clip().discardPath()),this.pdf.text(Ge,Be.x,Be.y,{angle:D.angle,align:H,renderingMode:D.renderingMode}),it&&this.pdf.restoreGraphicsState()}}else qe.y<Y&&(this.ctx.prevPageLastElemOffset+=Y-qe.y);D.scale>=.01&&(this.pdf.setFontSize(E),this.lineWidth=re)}}else D.scale>=.01&&(E=this.pdf.internal.getFontSize(),this.pdf.setFontSize(E*D.scale),re=this.lineWidth,this.lineWidth=re*D.scale),this.pdf.text(D.text,fe.x+this.posX,fe.y+this.posY,{angle:D.angle,align:H,renderingMode:D.renderingMode,maxWidth:D.maxWidth}),D.scale>=.01&&(this.pdf.setFontSize(E),this.lineWidth=re)},K=function(D,H,G,E){G=G||0,E=E||0,this.pdf.internal.out(r(D+G)+" "+n(H+E)+" l")},ee=function(D,H,G){return this.pdf.lines(D,H,G,null,null)},se=function(D,H,G,E,re,he,oe,z){this.pdf.internal.out([t(a(G+D)),t(s(E+H)),t(a(re+D)),t(s(he+H)),t(a(oe+D)),t(s(z+H)),"c"].join(" "))},Z=function(D,H,G,E){for(var re=2*Math.PI,he=Math.PI/2;H>G;)H-=re;var oe=Math.abs(G-H);oe<re&&E&&(oe=re-oe);for(var z=[],fe=E?-1:1,de=H;oe>1e-5;){var W=de+fe*Math.min(oe,he);z.push(ne.call(this,D,de,W)),oe-=Math.abs(W-de),de=W}return z},ne=function(D,H,G){var E=(G-H)/2,re=D*Math.cos(E),he=D*Math.sin(E),oe=re,z=-he,fe=oe*oe+z*z,de=fe+oe*re+z*he,W=4/3*(Math.sqrt(2*fe*de)-de)/(oe*he-z*re),ae=oe-W*z,_e=z+W*oe,ue=ae,ke=-_e,$e=E+H,Je=Math.cos($e),Xe=Math.sin($e);return{x1:D*Math.cos(H),y1:D*Math.sin(H),x2:ae*Je-_e*Xe,y2:ae*Xe+_e*Je,x3:ue*Je-ke*Xe,y3:ue*Xe+ke*Je,x4:D*Math.cos(G),y4:D*Math.sin(G)}},X=function(D){return 180*D/Math.PI},le=function(D,H,G,E,re,he){var oe=D+.5*(G-D),z=H+.5*(E-H),fe=re+.5*(G-re),de=he+.5*(E-he),W=Math.min(D,re,oe,fe),ae=Math.max(D,re,oe,fe),_e=Math.min(H,he,z,de),ue=Math.max(H,he,z,de);return new l(W,_e,ae-W,ue-_e)},Ae=function(D,H,G,E,re,he,oe,z){var fe,de,W,ae,_e,ue,ke,$e,Je,Xe,Ne,Ye,at,Y,we=G-D,J=E-H,ve=re-G,Oe=he-E,xe=oe-re,qe=z-he;for(de=0;de<41;de++)Je=(ke=(W=D+(fe=de/40)*we)+fe*((_e=G+fe*ve)-W))+fe*(_e+fe*(re+fe*xe-_e)-ke),Xe=($e=(ae=H+fe*J)+fe*((ue=E+fe*Oe)-ae))+fe*(ue+fe*(he+fe*qe-ue)-$e),de==0?(Ne=Je,Ye=Xe,at=Je,Y=Xe):(Ne=Math.min(Ne,Je),Ye=Math.min(Ye,Xe),at=Math.max(at,Je),Y=Math.max(Y,Xe));return new l(Math.round(Ne),Math.round(Ye),Math.round(at-Ne),Math.round(Y-Ye))},ce=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var D,H,G=(D=this.ctx.lineDash,H=this.ctx.lineDashOffset,JSON.stringify({lineDash:D,lineDashOffset:H}));this.prevLineDash!==G&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=G)}}})(tr.API),(function(e){var t=function(o){var l,u,d,f,m,g,x,y,v,w;for(u=[],d=0,f=(o+=l="\0\0\0\0".slice(o.length%4||4)).length;f>d;d+=4)(m=(o.charCodeAt(d)<<24)+(o.charCodeAt(d+1)<<16)+(o.charCodeAt(d+2)<<8)+o.charCodeAt(d+3))!==0?(g=(m=((m=((m=((m=(m-(w=m%85))/85)-(v=m%85))/85)-(y=m%85))/85)-(x=m%85))/85)%85,u.push(g+33,x+33,y+33,v+33,w+33)):u.push(122);return(function(j,k){for(var A=k;A>0;A--)j.pop()})(u,l.length),String.fromCharCode.apply(String,u)+"~>"},r=function(o){var l,u,d,f,m,g=String,x="length",y=255,v="charCodeAt",w="slice",j="replace";for(o[w](-2),o=o[w](0,-2)[j](/\s/g,"")[j]("z","!!!!!"),d=[],f=0,m=(o+=l="uuuuu"[w](o[x]%5||5))[x];m>f;f+=5)u=52200625*(o[v](f)-33)+614125*(o[v](f+1)-33)+7225*(o[v](f+2)-33)+85*(o[v](f+3)-33)+(o[v](f+4)-33),d.push(y&u>>24,y&u>>16,y&u>>8,y&u);return(function(k,A){for(var T=A;T>0;T--)k.pop()})(d,l[x]),g.fromCharCode.apply(g,d)},n=function(o){return o.split("").map(function(l){return("0"+l.charCodeAt().toString(16)).slice(-2)}).join("")+">"},a=function(o){var l=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((o=o.replace(/\s/g,"")).indexOf(">")!==-1&&(o=o.substr(0,o.indexOf(">"))),o.length%2&&(o+="0"),l.test(o)===!1)return"";for(var u="",d=0;d<o.length;d+=2)u+=String.fromCharCode("0x"+(o[d]+o[d+1]));return u},s=function(o){for(var l=new Uint8Array(o.length),u=o.length;u--;)l[u]=o.charCodeAt(u);return(l=KA(l)).reduce(function(d,f){return d+String.fromCharCode(f)},"")};e.processDataByFilters=function(o,l){var u=0,d=o||"",f=[];for(typeof(l=l||[])=="string"&&(l=[l]),u=0;u<l.length;u+=1)switch(l[u]){case"ASCII85Decode":case"/ASCII85Decode":d=r(d),f.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":d=t(d),f.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":d=a(d),f.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":d=n(d),f.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":d=s(d),f.push("/FlateDecode");break;default:throw new Error('The filter: "'+l[u]+'" is not implemented')}return{data:d,reverseChain:f.reverse().join(" ")}}})(tr.API),(function(e){e.loadFile=function(t,r,n){return(function(a,s,o){s=s!==!1,o=typeof o=="function"?o:function(){};var l=void 0;try{l=(function(u,d,f){var m=new XMLHttpRequest,g=0,x=function(y){var v=y.length,w=[],j=String.fromCharCode;for(g=0;g<v;g+=1)w.push(j(255&y.charCodeAt(g)));return w.join("")};if(m.open("GET",u,!d),m.overrideMimeType("text/plain; charset=x-user-defined"),d===!1&&(m.onload=function(){m.status===200?f(x(this.responseText)):f(void 0)}),m.send(null),d&&m.status===200)return x(m.responseText)})(a,s,o)}catch{}return l})(t,r,n)},e.allowFsRead=void 0,e.loadImageFile=e.loadFile})(tr.API),(function(e){function t(){return(Or.html2canvas?Promise.resolve(Or.html2canvas):SS(()=>import("./html2canvas.esm-QH1iLAAe.js"),[])).catch(function(l){return Promise.reject(new Error("Could not load html2canvas: "+l))}).then(function(l){return l.default?l.default:l})}function r(){return(Or.DOMPurify?Promise.resolve(Or.DOMPurify):SS(()=>import("./purify.es-BgtpMKW3.js"),[])).catch(function(l){return Promise.reject(new Error("Could not load dompurify: "+l))}).then(function(l){return l.default?l.default:l})}var n=function(l){var u=Un(l);return u==="undefined"?"undefined":u==="string"||l instanceof String?"string":u==="number"||l instanceof Number?"number":u==="function"||l instanceof Function?"function":l&&l.constructor===Array?"array":l&&l.nodeType===1?"element":u==="object"?"object":"unknown"},a=function(l,u){var d=document.createElement(l);for(var f in u.className&&(d.className=u.className),u.innerHTML&&u.dompurify&&(d.innerHTML=u.dompurify.sanitize(u.innerHTML)),u.style)d.style[f]=u.style[f];return d},s=function l(u,d){for(var f=u.nodeType===3?document.createTextNode(u.nodeValue):u.cloneNode(!1),m=u.firstChild;m;m=m.nextSibling)d!==!0&&m.nodeType===1&&m.nodeName==="SCRIPT"||f.appendChild(l(m,d));return u.nodeType===1&&(u.nodeName==="CANVAS"?(f.width=u.width,f.height=u.height,f.getContext("2d").drawImage(u,0,0)):u.nodeName!=="TEXTAREA"&&u.nodeName!=="SELECT"||(f.value=u.value),f.addEventListener("load",function(){f.scrollTop=u.scrollTop,f.scrollLeft=u.scrollLeft},!0)),f},o=function l(u){var d=Object.assign(l.convert(Promise.resolve()),JSON.parse(JSON.stringify(l.template))),f=l.convert(Promise.resolve(),d);return(f=f.setProgress(1,l,1,[l])).set(u)};(o.prototype=Object.create(Promise.prototype)).constructor=o,o.convert=function(l,u){return l.__proto__=u||o.prototype,l},o.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},o.prototype.from=function(l,u){return this.then(function(){switch(u=u||(function(d){switch(n(d)){case"string":return"string";case"element":return d.nodeName.toLowerCase()==="canvas"?"canvas":"element";default:return"unknown"}})(l),u){case"string":return this.then(r).then(function(d){return this.set({src:a("div",{innerHTML:l,dompurify:d})})});case"element":return this.set({src:l});case"canvas":return this.set({canvas:l});case"img":return this.set({img:l});default:return this.error("Unknown source type.")}})},o.prototype.to=function(l){switch(l){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},o.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then(function(){var l={position:"relative",display:"inline-block",width:(typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},u=s(this.prop.src,this.opt.html2canvas.javascriptEnabled);u.tagName==="BODY"&&(l.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=a("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=a("div",{className:"html2pdf__container",style:l}),this.prop.container.appendChild(u),this.prop.container.firstChild.appendChild(a("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"})},o.prototype.toCanvas=function(){var l=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(l).then(t).then(function(u){var d=Object.assign({},this.opt.html2canvas);return delete d.onrendered,u(this.prop.container,d)}).then(function(u){(this.opt.html2canvas.onrendered||function(){})(u),this.prop.canvas=u,document.body.removeChild(this.prop.overlay)})},o.prototype.toContext2d=function(){var l=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(l).then(t).then(function(u){var d=this.opt.jsPDF,f=this.opt.fontFaces,m=typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,g=Object.assign({async:!0,allowTaint:!0,scale:m,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete g.onrendered,d.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,d.context2d.posX=this.opt.x,d.context2d.posY=this.opt.y,d.context2d.margin=this.opt.margin,d.context2d.fontFaces=f,f)for(var x=0;x<f.length;++x){var y=f[x],v=y.src.find(function(w){return w.format==="truetype"});v&&d.addFont(v.url,y.ref.name,y.ref.style)}return g.windowHeight=g.windowHeight||0,g.windowHeight=g.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):g.windowHeight,d.context2d.save(!0),u(this.prop.container,g)}).then(function(u){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(u),this.prop.canvas=u,document.body.removeChild(this.prop.overlay)})},o.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then(function(){var l=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=l})},o.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then(function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF})},o.prototype.output=function(l,u,d){return(d=d||"pdf").toLowerCase()==="img"||d.toLowerCase()==="image"?this.outputImg(l,u):this.outputPdf(l,u)},o.prototype.outputPdf=function(l,u){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){return this.prop.pdf.output(l,u)})},o.prototype.outputImg=function(l){return this.thenList([function(){return this.prop.img||this.toImg()}]).then(function(){switch(l){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+l+'" is not supported.'}})},o.prototype.save=function(l){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(l?{filename:l}:null).then(function(){this.prop.pdf.save(this.opt.filename)})},o.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){this.prop.callback(this.prop.pdf)})},o.prototype.set=function(l){if(n(l)!=="object")return this;var u=Object.keys(l||{}).map(function(d){if(d in o.template.prop)return function(){this.prop[d]=l[d]};switch(d){case"margin":return this.setMargin.bind(this,l.margin);case"jsPDF":return function(){return this.opt.jsPDF=l.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,l.pageSize);default:return function(){this.opt[d]=l[d]}}},this);return this.then(function(){return this.thenList(u)})},o.prototype.get=function(l,u){return this.then(function(){var d=l in o.template.prop?this.prop[l]:this.opt[l];return u?u(d):d})},o.prototype.setMargin=function(l){return this.then(function(){switch(n(l)){case"number":l=[l,l,l,l];case"array":if(l.length===2&&(l=[l[0],l[1],l[0],l[1]]),l.length===4)break;default:return this.error("Invalid margin array.")}this.opt.margin=l}).then(this.setPageSize)},o.prototype.setPageSize=function(l){function u(d,f){return Math.floor(d*f/72*96)}return this.then(function(){(l=l||tr.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(l.inner={width:l.width-this.opt.margin[1]-this.opt.margin[3],height:l.height-this.opt.margin[0]-this.opt.margin[2]},l.inner.px={width:u(l.inner.width,l.k),height:u(l.inner.height,l.k)},l.inner.ratio=l.inner.height/l.inner.width),this.prop.pageSize=l})},o.prototype.setProgress=function(l,u,d,f){return l!=null&&(this.progress.val=l),u!=null&&(this.progress.state=u),d!=null&&(this.progress.n=d),f!=null&&(this.progress.stack=f),this.progress.ratio=this.progress.val/this.progress.state,this},o.prototype.updateProgress=function(l,u,d,f){return this.setProgress(l?this.progress.val+l:null,u||null,d?this.progress.n+d:null,f?this.progress.stack.concat(f):null)},o.prototype.then=function(l,u){var d=this;return this.thenCore(l,u,function(f,m){return d.updateProgress(null,null,1,[f]),Promise.prototype.then.call(this,function(g){return d.updateProgress(null,f),g}).then(f,m).then(function(g){return d.updateProgress(1),g})})},o.prototype.thenCore=function(l,u,d){d=d||Promise.prototype.then;var f=this;l&&(l=l.bind(f)),u&&(u=u.bind(f));var m=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?f:o.convert(Object.assign({},f),Promise.prototype),g=d.call(m,l,u);return o.convert(g,f.__proto__)},o.prototype.thenExternal=function(l,u){return Promise.prototype.then.call(this,l,u)},o.prototype.thenList=function(l){var u=this;return l.forEach(function(d){u=u.thenCore(d)}),u},o.prototype.catch=function(l){l&&(l=l.bind(this));var u=Promise.prototype.catch.call(this,l);return o.convert(u,this)},o.prototype.catchExternal=function(l){return Promise.prototype.catch.call(this,l)},o.prototype.error=function(l){return this.then(function(){throw new Error(l)})},o.prototype.using=o.prototype.set,o.prototype.saveAs=o.prototype.save,o.prototype.export=o.prototype.output,o.prototype.run=o.prototype.then,tr.getPageSize=function(l,u,d){if(Un(l)==="object"){var f=l;l=f.orientation,u=f.unit||u,d=f.format||d}u=u||"mm",d=d||"a4",l=(""+(l||"P")).toLowerCase();var m,g=(""+d).toLowerCase(),x={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(u){case"pt":m=1;break;case"mm":m=72/25.4;break;case"cm":m=72/2.54;break;case"in":m=72;break;case"px":m=.75;break;case"pc":case"em":m=12;break;case"ex":m=6;break;default:throw"Invalid unit: "+u}var y,v=0,w=0;if(x.hasOwnProperty(g))v=x[g][1]/m,w=x[g][0]/m;else try{v=d[1],w=d[0]}catch{throw new Error("Invalid format: "+d)}if(l==="p"||l==="portrait")l="p",w>v&&(y=w,w=v,v=y);else{if(l!=="l"&&l!=="landscape")throw"Invalid orientation: "+l;l="l",v>w&&(y=w,w=v,v=y)}return{width:w,height:v,unit:u,k:m,orientation:l}},e.html=function(l,u){(u=u||{}).callback=u.callback||function(){},u.html2canvas=u.html2canvas||{},u.html2canvas.canvas=u.html2canvas.canvas||this.canvas,u.jsPDF=u.jsPDF||this,u.fontFaces=u.fontFaces?u.fontFaces.map($S):null;var d=new o(u);return u.worker?d:d.from(l).doCallback()}})(tr.API),tr.API.addJS=function(e){var t,r,n=(function(a){for(var s="",o=0;o<a.length;o++){var l=a[o];if(l==="("||l===")"){for(var u=0,d=o-1;d>=0&&a[d]==="\\";d--)u++;s+=u%2==0?"\\"+l:l}else s+=l}return s})(e);return this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(t+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),r=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+n+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){t!==void 0&&r!==void 0&&this.internal.out("/Names <</JavaScript "+t+" 0 R>>")}),this},(function(e){var t;e.events.push(["postPutResources",function(){var r=this,n=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var a=r.outline.render().split(/\r\n/),s=0;s<a.length;s++){var o=a[s],l=n.exec(o);if(l!=null){var u=l[1];r.internal.newObjectDeferredBegin(u,!1)}r.internal.write(o)}if(this.outline.createNamedDestinations){var d=this.internal.pages.length,f=[];for(s=0;s<d;s++){var m=r.internal.newObject();f.push(m);var g=r.internal.getPageInfo(s+1);r.internal.write("<< /D["+g.objId+" 0 R /XYZ null null null]>> endobj")}var x=r.internal.newObject();for(r.internal.write("<< /Names [ "),s=0;s<f.length;s++)r.internal.write("(page_"+(s+1)+")"+f[s]+" 0 R");r.internal.write(" ] >>","endobj"),t=r.internal.newObject(),r.internal.write("<< /Dests "+x+" 0 R"),r.internal.write(">>","endobj")}}]),e.events.push(["putCatalog",function(){var r=this;r.outline.root.children.length>0&&(r.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&r.internal.write("/Names "+t+" 0 R"))}]),e.events.push(["initialized",function(){var r=this;r.outline={createNamedDestinations:!1,root:{children:[]}},r.outline.add=function(n,a,s){var o={title:a,options:s,children:[]};return n==null&&(n=this.root),n.children.push(o),o},r.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=r,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},r.outline.genIds_r=function(n){n.id=r.internal.newObjectDeferred();for(var a=0;a<n.children.length;a++)this.genIds_r(n.children[a])},r.outline.renderRoot=function(n){this.objStart(n),this.line("/Type /Outlines"),n.children.length>0&&(this.line("/First "+this.makeRef(n.children[0])),this.line("/Last "+this.makeRef(n.children[n.children.length-1]))),this.line("/Count "+this.count_r({count:0},n)),this.objEnd()},r.outline.renderItems=function(n){for(var a=this.ctx.pdf.internal.getVerticalCoordinateString,s=0;s<n.children.length;s++){var o=n.children[s];this.objStart(o),this.line("/Title "+this.makeString(o.title)),this.line("/Parent "+this.makeRef(n)),s>0&&this.line("/Prev "+this.makeRef(n.children[s-1])),s<n.children.length-1&&this.line("/Next "+this.makeRef(n.children[s+1])),o.children.length>0&&(this.line("/First "+this.makeRef(o.children[0])),this.line("/Last "+this.makeRef(o.children[o.children.length-1])));var l=this.count=this.count_r({count:0},o);if(l>0&&this.line("/Count "+l),o.options&&o.options.pageNumber){var u=r.internal.getPageInfo(o.options.pageNumber);this.line("/Dest ["+u.objId+" 0 R /XYZ 0 "+a(0)+" 0]")}this.objEnd()}for(var d=0;d<n.children.length;d++)this.renderItems(n.children[d])},r.outline.line=function(n){this.ctx.val+=n+`\r
`},r.outline.makeRef=function(n){return n.id+" 0 R"},r.outline.makeString=function(n){return"("+r.internal.pdfEscape(n)+")"},r.outline.objStart=function(n){this.ctx.val+=`\r
`+n.id+` 0 obj\r
<<\r
`},r.outline.objEnd=function(){this.ctx.val+=`>> \r
endobj\r
`},r.outline.count_r=function(n,a){for(var s=0;s<a.children.length;s++)n.count++,this.count_r(n,a.children[s]);return n.count}}])})(tr.API),(function(e){var t=[192,193,194,195,196,197,198,199];e.processJPEG=function(r,n,a,s,o,l){var u,d=this.decode.DCT_DECODE,f=null;if(typeof r=="string"||this.__addimage__.isArrayBuffer(r)||this.__addimage__.isArrayBufferView(r)){switch(r=o||r,r=this.__addimage__.isArrayBuffer(r)?new Uint8Array(r):r,u=(function(m){for(var g,x=256*m.charCodeAt(4)+m.charCodeAt(5),y=m.length,v={width:0,height:0,numcomponents:1},w=4;w<y;w+=2){if(w+=x,t.indexOf(m.charCodeAt(w+1))!==-1){g=256*m.charCodeAt(w+5)+m.charCodeAt(w+6),v={width:256*m.charCodeAt(w+7)+m.charCodeAt(w+8),height:g,numcomponents:m.charCodeAt(w+9)};break}x=256*m.charCodeAt(w+2)+m.charCodeAt(w+3)}return v})(r=this.__addimage__.isArrayBufferView(r)?this.__addimage__.arrayBufferToBinaryString(r):r),u.numcomponents){case 1:l=this.color_spaces.DEVICE_GRAY;break;case 4:l=this.color_spaces.DEVICE_CMYK;break;case 3:l=this.color_spaces.DEVICE_RGB}f={data:r,width:u.width,height:u.height,colorSpace:l,bitsPerComponent:8,filter:d,index:n,alias:a}}return f}})(tr.API),tr.API.processPNG=function(e,t,r,n){if(this.__addimage__.isArrayBuffer(e)&&(e=new Uint8Array(e)),this.__addimage__.isArrayBufferView(e)){var a,s=CSe(e,{checkCrc:!0}),o=s.width,l=s.height,u=s.channels,d=s.palette,f=s.depth;a=d&&u===1?(function(F){for(var I=F.width,q=F.height,P=F.data,R=F.palette,K=F.depth,ee=!1,se=[],Z=[],ne=void 0,X=!1,le=0,Ae=0;Ae<R.length;Ae++){var ce=wI(R[Ae],4),D=ce[0],H=ce[1],G=ce[2],E=ce[3];se.push(D,H,G),E!=null&&(E===0?(le++,Z.length<1&&Z.push(Ae)):E<255&&(X=!0))}if(X||le>1){ee=!0,Z=void 0;var re=I*q;ne=new Uint8Array(re);for(var he=new DataView(P.buffer),oe=0;oe<re;oe++){var z=VS(he,oe,K),fe=wI(R[z],4)[3];ne[oe]=fe}}else le===0&&(Z=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:ee?8:void 0,colorBytes:P,alphaBytes:ne,needSMask:ee,palette:se,mask:Z}})(s):u===2||u===4?(function(F){for(var I=F.data,q=F.width,P=F.height,R=F.channels,K=F.depth,ee=R===2?"DeviceGray":"DeviceRGB",se=R-1,Z=q*P,ne=se,X=Z*ne,le=1*Z,Ae=Math.ceil(X*K/8),ce=Math.ceil(le*K/8),D=new Uint8Array(Ae),H=new Uint8Array(ce),G=new DataView(I.buffer),E=new DataView(D.buffer),re=new DataView(H.buffer),he=!1,oe=0;oe<Z;oe++){for(var z=oe*R,fe=0;fe<ne;fe++)SF(E,VS(G,z+fe,K),oe*ne+fe,K);var de=VS(G,z+ne,K);de<(1<<K)-1&&(he=!0),SF(re,de,1*oe,K)}return{colorSpace:ee,colorsPerPixel:se,sMaskBitsPerComponent:he?K:void 0,colorBytes:D,alphaBytes:H,needSMask:he}})(s):(function(F){var I=F.data,q=F.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:q,colorsPerPixel:q==="DeviceGray"?1:3,colorBytes:I instanceof Uint16Array?(function(P){for(var R=P.length,K=new Uint8Array(2*R),ee=new DataView(K.buffer,K.byteOffset,K.byteLength),se=0;se<R;se++)ee.setUint16(2*se,P[se],!1);return K})(I):I,needSMask:!1}})(s);var m,g,x,y=a,v=y.colorSpace,w=y.colorsPerPixel,j=y.sMaskBitsPerComponent,k=y.colorBytes,A=y.alphaBytes,T=y.needSMask,M=y.palette,B=y.mask,L=null;return n!==tr.API.image_compression.NONE&&typeof KA=="function"?(L=(function(F){var I;switch(F){case tr.API.image_compression.FAST:I=11;break;case tr.API.image_compression.MEDIUM:I=13;break;case tr.API.image_compression.SLOW:I=14;break;default:I=12}return I})(n),m=this.decode.FLATE_DECODE,g="/Predictor ".concat(L," /Colors ").concat(w," /BitsPerComponent ").concat(f," /Columns ").concat(o),e=yF(k,Math.ceil(o*w*f/8),w,f,n),T&&(x=yF(A,Math.ceil(o*j/8),1,j,n))):(m=void 0,g=void 0,e=k,T&&(x=A)),(this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e))&&(e=this.__addimage__.arrayBufferToBinaryString(e)),(x&&this.__addimage__.isArrayBuffer(x)||this.__addimage__.isArrayBufferView(x))&&(x=this.__addimage__.arrayBufferToBinaryString(x)),{alias:r,data:e,index:t,filter:m,decodeParameters:g,transparency:B,palette:M,sMask:x,predictor:L,width:o,height:l,bitsPerComponent:f,sMaskBitsPerComponent:j,colorSpace:v}}},(function(e){e.processGIF89A=function(t,r,n,a){var s=new YSe(t),o=s.width,l=s.height,u=[];s.decodeAndBlitFrameRGBA(0,u);var d={data:u,width:o,height:l},f=new qS(100).encode(d,100);return e.processJPEG.call(this,f,r,n,a)},e.processGIF87A=e.processGIF89A})(tr.API),bc.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var e=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(e);for(var t=0;t<e;t++){var r=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:a,green:n,blue:r,quad:s}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},bc.prototype.parseBGR=function(){this.pos=this.offset;var e="bit"+this.bitPP,t=this.width*this.height*4;if(t>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");this.data=new Uint8Array(t);try{this[e]()}catch(r){na.log("bit decode error:"+r)}},bc.prototype.bit1=function(){var e,t=Math.ceil(this.width/8),r=t%4;for(e=this.height-1;e>=0;e--){for(var n=this.bottom_up?e:this.height-1-e,a=0;a<t;a++)for(var s=this.datav.getUint8(this.pos++,!0),o=n*this.width*4+8*a*4,l=0;l<8&&8*a+l<this.width;l++){var u=this.palette[s>>7-l&1];this.data[o+4*l]=u.blue,this.data[o+4*l+1]=u.green,this.data[o+4*l+2]=u.red,this.data[o+4*l+3]=255}r!==0&&(this.pos+=4-r)}},bc.prototype.bit4=function(){for(var e=Math.ceil(this.width/2),t=e%4,r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,a=0;a<e;a++){var s=this.datav.getUint8(this.pos++,!0),o=n*this.width*4+2*a*4,l=s>>4,u=15&s,d=this.palette[l];if(this.data[o]=d.blue,this.data[o+1]=d.green,this.data[o+2]=d.red,this.data[o+3]=255,2*a+1>=this.width)break;d=this.palette[u],this.data[o+4]=d.blue,this.data[o+4+1]=d.green,this.data[o+4+2]=d.red,this.data[o+4+3]=255}t!==0&&(this.pos+=4-t)}},bc.prototype.bit8=function(){for(var e=this.width%4,t=this.height-1;t>=0;t--){for(var r=this.bottom_up?t:this.height-1-t,n=0;n<this.width;n++){var a=this.datav.getUint8(this.pos++,!0),s=r*this.width*4+4*n;if(a<this.palette.length){var o=this.palette[a];this.data[s]=o.red,this.data[s+1]=o.green,this.data[s+2]=o.blue,this.data[s+3]=255}else this.data[s]=255,this.data[s+1]=255,this.data[s+2]=255,this.data[s+3]=255}e!==0&&(this.pos+=4-e)}},bc.prototype.bit15=function(){for(var e=this.width%3,t=parseInt("11111",2),r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,a=0;a<this.width;a++){var s=this.datav.getUint16(this.pos,!0);this.pos+=2;var o=(s&t)/t*255|0,l=(s>>5&t)/t*255|0,u=(s>>10&t)/t*255|0,d=s>>15?255:0,f=n*this.width*4+4*a;this.data[f]=u,this.data[f+1]=l,this.data[f+2]=o,this.data[f+3]=d}this.pos+=e}},bc.prototype.bit16=function(){for(var e=this.width%3,t=parseInt("11111",2),r=parseInt("111111",2),n=this.height-1;n>=0;n--){for(var a=this.bottom_up?n:this.height-1-n,s=0;s<this.width;s++){var o=this.datav.getUint16(this.pos,!0);this.pos+=2;var l=(o&t)/t*255|0,u=(o>>5&r)/r*255|0,d=(o>>11)/t*255|0,f=a*this.width*4+4*s;this.data[f]=d,this.data[f+1]=u,this.data[f+2]=l,this.data[f+3]=255}this.pos+=e}},bc.prototype.bit24=function(){for(var e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,r=0;r<this.width;r++){var n=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),o=t*this.width*4+4*r;this.data[o]=s,this.data[o+1]=a,this.data[o+2]=n,this.data[o+3]=255}this.pos+=this.width%4}},bc.prototype.bit32=function(){for(var e=this.height-1;e>=0;e--)for(var t=this.bottom_up?e:this.height-1-e,r=0;r<this.width;r++){var n=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),l=t*this.width*4+4*r;this.data[l]=s,this.data[l+1]=a,this.data[l+2]=n,this.data[l+3]=o}},bc.prototype.getData=function(){return this.data},(function(e){e.processBMP=function(t,r,n,a){var s=new bc(t,!1),o=s.width,l=s.height,u={data:s.getData(),width:o,height:l},d=new qS(100).encode(u,100);return e.processJPEG.call(this,d,r,n,a)}})(tr.API),kF.prototype.getData=function(){return this.data},(function(e){e.processWEBP=function(t,r,n,a){var s=new kF(t),o=s.width,l=s.height,u={data:s.getData(),width:o,height:l},d=new qS(100).encode(u,100);return e.processJPEG.call(this,d,r,n,a)}})(tr.API),tr.API.processRGBA=function(e,t,r){for(var n=e.data,a=n.length,s=new Uint8Array(a/4*3),o=new Uint8Array(a/4),l=0,u=0,d=0;d<a;d+=4){var f=n[d],m=n[d+1],g=n[d+2],x=n[d+3];s[l++]=f,s[l++]=m,s[l++]=g,o[u++]=x}var y=this.__addimage__.arrayBufferToBinaryString(s);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:y,index:t,alias:r,colorSpace:"DeviceRGB",bitsPerComponent:8,width:e.width,height:e.height}},tr.API.setLanguage=function(e){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[e]!==void 0&&(this.internal.languageSettings.languageCode=e,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},Np=tr.API,pb=Np.getCharWidthsArray=function(e,t){var r,n,a=(t=t||{}).font||this.internal.getFont(),s=t.fontSize||this.internal.getFontSize(),o=t.charSpace||this.internal.getCharSpace(),l=t.widths?t.widths:a.metadata.Unicode.widths,u=l.fof?l.fof:1,d=t.kerning?t.kerning:a.metadata.Unicode.kerning,f=d.fof?d.fof:1,m=t.doKerning!==!1,g=0,x=e.length,y=0,v=l[0]||u,w=[];for(r=0;r<x;r++)n=e.charCodeAt(r),typeof a.metadata.widthOfString=="function"?w.push((a.metadata.widthOfGlyph(a.metadata.characterToGlyph(n))+o*(1e3/s)||0)/1e3):(g=m&&Un(d[n])==="object"&&!isNaN(parseInt(d[n][y],10))?d[n][y]/f:0,w.push((l[n]||v)/u+g)),y=n;return w},xF=Np.getStringUnitWidth=function(e,t){var r=(t=t||{}).fontSize||this.internal.getFontSize(),n=t.font||this.internal.getFont(),a=t.charSpace||this.internal.getCharSpace();return Np.processArabic&&(e=Np.processArabic(e)),typeof n.metadata.widthOfString=="function"?n.metadata.widthOfString(e,r,a)/r:pb.apply(this,arguments).reduce(function(s,o){return s+o},0)},gF=function(e,t,r,n){for(var a=[],s=0,o=e.length,l=0;s!==o&&l+t[s]<r;)l+=t[s],s++;a.push(e.slice(0,s));var u=s;for(l=0;s!==o;)l+t[s]>n&&(a.push(e.slice(u,s)),l=0,u=s),l+=t[s],s++;return u!==s&&a.push(e.slice(u,s)),a},vF=function(e,t,r){r||(r={});var n,a,s,o,l,u,d,f=[],m=[f],g=r.textIndent||0,x=0,y=0,v=e.split(" "),w=pb.apply(this,[" ",r])[0];if(u=r.lineIndent===-1?v[0].length+2:r.lineIndent||0){var j=Array(u).join(" "),k=[];v.map(function(T){(T=T.split(/\s*\n/)).length>1?k=k.concat(T.map(function(M,B){return(B&&M.length?`
`:"")+M})):k.push(T[0])}),v=k,u=xF.apply(this,[j,r])}for(s=0,o=v.length;s<o;s++){var A=0;if(n=v[s],u&&n[0]==`
`&&(n=n.substr(1),A=1),g+x+(y=(a=pb.apply(this,[n,r])).reduce(function(T,M){return T+M},0))>t||A){if(y>t){for(l=gF.apply(this,[n,a,t-(g+x),t]),f.push(l.shift()),f=[l.pop()];l.length;)m.push([l.shift()]);y=a.slice(n.length-(f[0]?f[0].length:0)).reduce(function(T,M){return T+M},0)}else f=[n];m.push(f),g=y+u,x=w}else f.push(n),g+=x+y,x=w}return d=u?function(T,M){return(M?j:"")+T.join(" ")}:function(T){return T.join(" ")},m.map(d)},Np.splitTextToSize=function(e,t,r){var n,a=(r=r||{}).fontSize||this.internal.getFontSize(),s=(function(f){if(f.widths&&f.kerning)return{widths:f.widths,kerning:f.kerning};var m=this.internal.getFont(f.fontName,f.fontStyle),g="Unicode";return m.metadata[g]?{widths:m.metadata[g].widths||{0:1},kerning:m.metadata[g].kerning||{}}:{font:m.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,r);n=Array.isArray(e)?e:String(e).split(/\r?\n/);var o=1*this.internal.scaleFactor*t/a;s.textIndent=r.textIndent?1*r.textIndent*this.internal.scaleFactor/a:0,s.lineIndent=r.lineIndent;var l,u,d=[];for(l=0,u=n.length;l<u;l++)d=d.concat(vF.apply(this,[n[l],o,s]));return d},(function(e){e.__fontmetrics__=e.__fontmetrics__||{};for(var t="0123456789abcdef",r="klmnopqrstuvwxyz",n={},a={},s=0;s<16;s++)n[r[s]]=t[s],a[t[s]]=r[s];var o=function(g){return"0x"+parseInt(g,10).toString(16)},l=e.__fontmetrics__.compress=function(g){var x,y,v,w,j=["{"];for(var k in g){if(x=g[k],isNaN(parseInt(k,10))?y="'"+k+"'":(k=parseInt(k,10),y=(y=o(k).slice(2)).slice(0,-1)+a[y.slice(-1)]),typeof x=="number")x<0?(v=o(x).slice(3),w="-"):(v=o(x).slice(2),w=""),v=w+v.slice(0,-1)+a[v.slice(-1)];else{if(Un(x)!=="object")throw new Error("Don't know what to do with value type "+Un(x)+".");v=l(x)}j.push(y+v)}return j.push("}"),j.join("")},u=e.__fontmetrics__.uncompress=function(g){if(typeof g!="string")throw new Error("Invalid argument passed to uncompress.");for(var x,y,v,w,j={},k=1,A=j,T=[],M="",B="",L=g.length-1,F=1;F<L;F+=1)(w=g[F])=="'"?x?(v=x.join(""),x=void 0):x=[]:x?x.push(w):w=="{"?(T.push([A,v]),A={},v=void 0):w=="}"?((y=T.pop())[0][y[1]]=A,v=void 0,A=y[0]):w=="-"?k=-1:v===void 0?n.hasOwnProperty(w)?(M+=n[w],v=parseInt(M,16)*k,k=1,M=""):M+=w:n.hasOwnProperty(w)?(B+=n[w],A[v]=parseInt(B,16)*k,k=1,v=void 0,B=""):B+=w;return j},d={codePages:["WinAnsiEncoding"],WinAnsiEncoding:u("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},f={Unicode:{Courier:d,"Courier-Bold":d,"Courier-BoldOblique":d,"Courier-Oblique":d,Helvetica:d,"Helvetica-Bold":d,"Helvetica-BoldOblique":d,"Helvetica-Oblique":d,"Times-Roman":d,"Times-Bold":d,"Times-BoldItalic":d,"Times-Italic":d}},m={Unicode:{"Courier-Oblique":u("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":u("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":u("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:u("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":u("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":u("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:u("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:u("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":u("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:u("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":u("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":u("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":u("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":u("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};e.events.push(["addFont",function(g){var x=g.font,y=m.Unicode[x.postScriptName];y&&(x.metadata.Unicode={},x.metadata.Unicode.widths=y.widths,x.metadata.Unicode.kerning=y.kerning);var v=f.Unicode[x.postScriptName];v&&(x.metadata.Unicode.encoding=v,x.encoding=v.codePages[0])}])})(tr.API),(function(e){var t=function(r){for(var n=r.length,a=new Uint8Array(n),s=0;s<n;s++)a[s]=r.charCodeAt(s);return a};e.API.events.push(["addFont",function(r){var n=void 0,a=r.font,s=r.instance;if(!a.isStandardFont){if(s===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+a.postScriptName+"').");if(typeof(n=s.existsFileInVFS(a.postScriptName)===!1?s.loadFile(a.postScriptName):s.getFileFromVFS(a.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+a.postScriptName+"').");(function(o,l){l=/^\x00\x01\x00\x00/.test(l)?t(l):t(r2(l)),o.metadata=e.API.TTFFont.open(l),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(a,n)}}])})(tr),tr.API.addSvgAsImage=function(e,t,r,n,a,s,o,l){if(isNaN(t)||isNaN(r))throw na.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(a))throw na.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var u=document.createElement("canvas");u.width=n,u.height=a;var d=u.getContext("2d");d.fillStyle="#fff",d.fillRect(0,0,u.width,u.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},m=this;return(Or.canvg?Promise.resolve(Or.canvg):SS(()=>import("./index.es-42NIQ0ix.js"),[])).catch(function(g){return Promise.reject(new Error("Could not load canvg: "+g))}).then(function(g){return g.default?g.default:g}).then(function(g){return g.fromString(d,e,f)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(g){return g.render(f)}).then(function(){m.addImage(u.toDataURL("image/jpeg",1),t,r,n,a,o,l)})},tr.API.putTotalPages=function(e){var t,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,"g"),r=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var a=0;a<this.internal.pages[n].length;a++)this.internal.pages[n][a]=this.internal.pages[n][a].replace(t,r);return this},tr.API.viewerPreferences=function(e,t){var r;e=e||{},t=t||!1;var n,a,s,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},l=Object.keys(o),u=[],d=0,f=0,m=0;function g(y,v){var w,j=!1;for(w=0;w<y.length;w+=1)y[w]===v&&(j=!0);return j}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),r=this.internal.viewerpreferences.configuration,e==="reset"||t===!0){var x=l.length;for(m=0;m<x;m+=1)r[l[m]].value=r[l[m]].defaultValue,r[l[m]].explicitSet=!1}if(Un(e)==="object"){for(a in e)if(s=e[a],g(l,a)&&s!==void 0){if(r[a].type==="boolean"&&typeof s=="boolean")r[a].value=s;else if(r[a].type==="name"&&g(r[a].valueSet,s))r[a].value=s;else if(r[a].type==="integer"&&Number.isInteger(s))r[a].value=s;else if(r[a].type==="array"){for(d=0;d<s.length;d+=1)if(n=!0,s[d].length===1&&typeof s[d][0]=="number")u.push(String(s[d]-1));else if(s[d].length>1){for(f=0;f<s[d].length;f+=1)typeof s[d][f]!="number"&&(n=!1);n===!0&&u.push([s[d][0]-1,s[d][1]-1].join(" "))}r[a].value="["+u.join(" ")+"]"}else r[a].value=r[a].defaultValue;r[a].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var y,v=[];for(y in r)r[y].explicitSet===!0&&(r[y].type==="name"?v.push("/"+y+" /"+r[y].value):v.push("/"+y+" "+r[y].value));v.length!==0&&this.internal.write(`/ViewerPreferences
<<
`+v.join(`
`)+`
>>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=r,this},tr.API.addMetadata=function(e,t){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:e,namespaceUri:t??"http://jspdf.default.namespaceuri/",rawXml:typeof t=="boolean"&&t},this.internal.events.subscribe("putCatalog",XSe),this.internal.events.subscribe("postPutResources",KSe)),this},(function(e){var t=e.API,r=t.pdfEscape16=function(s,o){for(var l,u=o.metadata.Unicode.widths,d=["","0","00","000","0000"],f=[""],m=0,g=s.length;m<g;++m){if(l=o.metadata.characterToGlyph(s.charCodeAt(m)),o.metadata.glyIdsUsed.push(l),o.metadata.toUnicode[l]=s.charCodeAt(m),u.indexOf(l)==-1&&(u.push(l),u.push([parseInt(o.metadata.widthOfGlyph(l),10)])),l=="0")return f.join("");l=l.toString(16),f.push(d[4-l.length],l)}return f.join("")},n=function(s){var o,l,u,d,f,m,g;for(f=`/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo <<
  /Registry (Adobe)
  /Ordering (UCS)
  /Supplement 0
>> def
/CMapName /Adobe-Identity-UCS def
/CMapType 2 def
1 begincodespacerange
<0000><ffff>
endcodespacerange`,u=[],m=0,g=(l=Object.keys(s).sort(function(x,y){return x-y})).length;m<g;m++)o=l[m],u.length>=100&&(f+=`
`+u.length+` beginbfchar
`+u.join(`
`)+`
endbfchar`,u=[]),s[o]!==void 0&&s[o]!==null&&typeof s[o].toString=="function"&&(d=("0000"+s[o].toString(16)).slice(-4),o=("0000"+(+o).toString(16)).slice(-4),u.push("<"+o+"><"+d+">"));return u.length&&(f+=`
`+u.length+` beginbfchar
`+u.join(`
`)+`
endbfchar
`),f+`endcmap
CMapName currentdict /CMap defineresource pop
end
end`};t.events.push(["putFont",function(s){(function(o){var l=o.font,u=o.out,d=o.newObject,f=o.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="Identity-H"){for(var m=l.metadata.Unicode.widths,g=l.metadata.subset.encode(l.metadata.glyIdsUsed,1),x="",y=0;y<g.length;y++)x+=String.fromCharCode(g[y]);var v=d();f({data:x,addLength1:!0,objectId:v}),u("endobj");var w=d();f({data:n(l.metadata.toUnicode),addLength1:!0,objectId:w}),u("endobj");var j=d();u("<<"),u("/Type /FontDescriptor"),u("/FontName /"+Pp(l.fontName)),u("/FontFile2 "+v+" 0 R"),u("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),u("/Flags "+l.metadata.flags),u("/StemV "+l.metadata.stemV),u("/ItalicAngle "+l.metadata.italicAngle),u("/Ascent "+l.metadata.ascender),u("/Descent "+l.metadata.decender),u("/CapHeight "+l.metadata.capHeight),u(">>"),u("endobj");var k=d();u("<<"),u("/Type /Font"),u("/BaseFont /"+Pp(l.fontName)),u("/FontDescriptor "+j+" 0 R"),u("/W "+e.API.PDFObject.convert(m)),u("/CIDToGIDMap /Identity"),u("/DW 1000"),u("/Subtype /CIDFontType2"),u("/CIDSystemInfo"),u("<<"),u("/Supplement 0"),u("/Registry (Adobe)"),u("/Ordering ("+l.encoding+")"),u(">>"),u(">>"),u("endobj"),l.objectNumber=d(),u("<<"),u("/Type /Font"),u("/Subtype /Type0"),u("/ToUnicode "+w+" 0 R"),u("/BaseFont /"+Pp(l.fontName)),u("/Encoding /"+l.encoding),u("/DescendantFonts ["+k+" 0 R]"),u(">>"),u("endobj"),l.isAlreadyPutted=!0}})(s)}]),t.events.push(["putFont",function(s){(function(o){var l=o.font,u=o.out,d=o.newObject,f=o.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="WinAnsiEncoding"){for(var m=l.metadata.rawData,g="",x=0;x<m.length;x++)g+=String.fromCharCode(m[x]);var y=d();f({data:g,addLength1:!0,objectId:y}),u("endobj");var v=d();f({data:n(l.metadata.toUnicode),addLength1:!0,objectId:v}),u("endobj");var w=d();u("<<"),u("/Descent "+l.metadata.decender),u("/CapHeight "+l.metadata.capHeight),u("/StemV "+l.metadata.stemV),u("/Type /FontDescriptor"),u("/FontFile2 "+y+" 0 R"),u("/Flags 96"),u("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),u("/FontName /"+Pp(l.fontName)),u("/ItalicAngle "+l.metadata.italicAngle),u("/Ascent "+l.metadata.ascender),u(">>"),u("endobj"),l.objectNumber=d();for(var j=0;j<l.metadata.hmtx.widths.length;j++)l.metadata.hmtx.widths[j]=parseInt(l.metadata.hmtx.widths[j]*(1e3/l.metadata.head.unitsPerEm));u("<</Subtype/TrueType/Type/Font/ToUnicode "+v+" 0 R/BaseFont/"+Pp(l.fontName)+"/FontDescriptor "+w+" 0 R/Encoding/"+l.encoding+" /FirstChar 29 /LastChar 255 /Widths "+e.API.PDFObject.convert(l.metadata.hmtx.widths)+">>"),u("endobj"),l.isAlreadyPutted=!0}})(s)}]);var a=function(s){var o,l=s.text||"",u=s.x,d=s.y,f=s.options||{},m=s.mutex||{},g=m.pdfEscape,x=m.activeFontKey,y=m.fonts,v=x,w="",j=0,k="",A=y[v].encoding;if(y[v].encoding!=="Identity-H")return{text:l,x:u,y:d,options:f,mutex:m};for(k=l,v=x,Array.isArray(l)&&(k=l[0]),j=0;j<k.length;j+=1)y[v].metadata.hasOwnProperty("cmap")&&(o=y[v].metadata.cmap.unicode.codeMap[k[j].charCodeAt(0)]),o||k[j].charCodeAt(0)<256&&y[v].metadata.hasOwnProperty("Unicode")?w+=k[j]:w+="";var T="";return parseInt(v.slice(1))<14||A==="WinAnsiEncoding"?T=g(w,v).split("").map(function(M){return M.charCodeAt(0).toString(16)}).join(""):A==="Identity-H"&&(T=r(w,y[v])),m.isHex=!0,{text:T,x:u,y:d,options:f,mutex:m}};t.events.push(["postProcessText",function(s){var o=s.text||"",l=[],u={text:o,x:s.x,y:s.y,options:s.options,mutex:s.mutex};if(Array.isArray(o)){var d=0;for(d=0;d<o.length;d+=1)Array.isArray(o[d])&&o[d].length===3?l.push([a(Object.assign({},u,{text:o[d][0]})).text,o[d][1],o[d][2]]):l.push(a(Object.assign({},u,{text:o[d]})).text);s.text=l}else s.text=a(Object.assign({},u,{text:o})).text}])})(tr),(function(e){var t=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};e.existsFileInVFS=function(r){return t.call(this),this.internal.vFS[r]!==void 0},e.addFileToVFS=function(r,n){return t.call(this),this.internal.vFS[r]=n,this},e.getFileFromVFS=function(r){return t.call(this),this.internal.vFS[r]!==void 0?this.internal.vFS[r]:null}})(tr.API),(function(e){e.__bidiEngine__=e.prototype.__bidiEngine__=function(n){var a,s,o,l,u,d,f,m=t,g=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],x=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],y={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},v={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},w=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],j=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),k=!1,A=0;this.__bidiEngine__={};var T=function(P){var R=P.charCodeAt(),K=R>>8,ee=v[K];return ee!==void 0?m[256*ee+(255&R)]:K===252||K===253?"AL":j.test(K)?"L":K===8?"R":"N"},M=function(P){for(var R,K=0;K<P.length;K++){if((R=T(P.charAt(K)))==="L")return!1;if(R==="R")return!0}return!1},B=function(P,R,K,ee){var se,Z,ne,X,le=R[ee];switch(le){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":k=!1;break;case"N":case"AN":break;case"EN":k&&(le="AN");break;case"AL":k=!0,le="R";break;case"WS":case"BN":le="N";break;case"CS":ee<1||ee+1>=R.length||(se=K[ee-1])!=="EN"&&se!=="AN"||(Z=R[ee+1])!=="EN"&&Z!=="AN"?le="N":k&&(Z="AN"),le=Z===se?Z:"N";break;case"ES":le=(se=ee>0?K[ee-1]:"B")==="EN"&&ee+1<R.length&&R[ee+1]==="EN"?"EN":"N";break;case"ET":if(ee>0&&K[ee-1]==="EN"){le="EN";break}if(k){le="N";break}for(ne=ee+1,X=R.length;ne<X&&R[ne]==="ET";)ne++;le=ne<X&&R[ne]==="EN"?"EN":"N";break;case"NSM":if(o&&!l){for(X=R.length,ne=ee+1;ne<X&&R[ne]==="NSM";)ne++;if(ne<X){var Ae=P[ee],ce=Ae>=1425&&Ae<=2303||Ae===64286;if(se=R[ne],ce&&(se==="R"||se==="AL")){le="R";break}}}le=ee<1||(se=R[ee-1])==="B"?"N":K[ee-1];break;case"B":k=!1,a=!0,le=A;break;case"S":s=!0,le="N"}return le},L=function(P,R,K){var ee=P.split("");return K&&F(ee,K,{hiLevel:A}),ee.reverse(),R&&R.reverse(),ee.join("")},F=function(P,R,K){var ee,se,Z,ne,X,le=-1,Ae=P.length,ce=0,D=[],H=A?x:g,G=[];for(k=!1,a=!1,s=!1,se=0;se<Ae;se++)G[se]=T(P[se]);for(Z=0;Z<Ae;Z++){if(X=ce,D[Z]=B(P,G,D,Z),ee=240&(ce=H[X][y[D[Z]]]),ce&=15,R[Z]=ne=H[ce][5],ee>0)if(ee===16){for(se=le;se<Z;se++)R[se]=1;le=-1}else le=-1;if(H[ce][6])le===-1&&(le=Z);else if(le>-1){for(se=le;se<Z;se++)R[se]=ne;le=-1}G[Z]==="B"&&(R[Z]=0),K.hiLevel|=ne}s&&(function(E,re,he){for(var oe=0;oe<he;oe++)if(E[oe]==="S"){re[oe]=A;for(var z=oe-1;z>=0&&E[z]==="WS";z--)re[z]=A}})(G,R,Ae)},I=function(P,R,K,ee,se){if(!(se.hiLevel<P)){if(P===1&&A===1&&!a)return R.reverse(),void(K&&K.reverse());for(var Z,ne,X,le,Ae=R.length,ce=0;ce<Ae;){if(ee[ce]>=P){for(X=ce+1;X<Ae&&ee[X]>=P;)X++;for(le=ce,ne=X-1;le<ne;le++,ne--)Z=R[le],R[le]=R[ne],R[ne]=Z,K&&(Z=K[le],K[le]=K[ne],K[ne]=Z);ce=X}ce++}}},q=function(P,R,K){var ee=P.split(""),se={hiLevel:A};return K||(K=[]),F(ee,K,se),(function(Z,ne,X){if(X.hiLevel!==0&&f)for(var le,Ae=0;Ae<Z.length;Ae++)ne[Ae]===1&&(le=w.indexOf(Z[Ae]))>=0&&(Z[Ae]=w[le+1])})(ee,K,se),I(2,ee,R,K,se),I(1,ee,R,K,se),ee.join("")};return this.__bidiEngine__.doBidiReorder=function(P,R,K){if((function(se,Z){if(Z)for(var ne=0;ne<se.length;ne++)Z[ne]=ne;l===void 0&&(l=M(se)),d===void 0&&(d=M(se))})(P,R),o||!u||d)if(o&&u&&l^d)A=l?1:0,P=L(P,R,K);else if(!o&&u&&d)A=l?1:0,P=q(P,R,K),P=L(P,R);else if(!o||l||u||d){if(o&&!u&&l^d)P=L(P,R),l?(A=0,P=q(P,R,K)):(A=1,P=q(P,R,K),P=L(P,R));else if(o&&l&&!u&&d)A=1,P=q(P,R,K),P=L(P,R);else if(!o&&!u&&l^d){var ee=f;l?(A=1,P=q(P,R,K),A=0,f=!1,P=q(P,R,K),f=ee):(A=0,P=q(P,R,K),P=L(P,R),A=1,f=!1,P=q(P,R,K),f=ee,P=L(P,R))}}else A=0,P=q(P,R,K);else A=l?1:0,P=q(P,R,K);return P},this.__bidiEngine__.setOptions=function(P){P&&(o=P.isInputVisual,u=P.isOutputVisual,l=P.isInputRtl,d=P.isOutputRtl,f=P.isSymmetricSwapping)},this.__bidiEngine__.setOptions(n),this.__bidiEngine__};var t=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],r=new e.__bidiEngine__({isInputVisual:!0});e.API.events.push(["postProcessText",function(n){var a=n.text;n.x,n.y;var s=n.options||{};n.mutex,s.lang;var o=[];if(s.isInputVisual=typeof s.isInputVisual!="boolean"||s.isInputVisual,r.setOptions(s),Object.prototype.toString.call(a)==="[object Array]"){var l=0;for(o=[],l=0;l<a.length;l+=1)Object.prototype.toString.call(a[l])==="[object Array]"?o.push([r.doBidiReorder(a[l][0]),a[l][1],a[l][2]]):o.push([r.doBidiReorder(a[l])]);n.text=o}else n.text=r.doBidiReorder(a);r.setOptions({isInputVisual:!0})}])})(tr),tr.API.TTFFont=(function(){function e(t){var r;if(this.rawData=t,r=this.contents=new Ch(t),this.contents.pos=4,r.readString(4)==="ttcf")throw new Error("TTCF not supported.");r.pos=0,this.parse(),this.subset=new d3e(this),this.registerTTF()}return e.open=function(t){return new e(t)},e.prototype.parse=function(){return this.directory=new ZSe(this.contents),this.head=new QSe(this),this.name=new a3e(this),this.cmap=new RW(this),this.toUnicode={},this.hhea=new e3e(this),this.maxp=new i3e(this),this.hmtx=new s3e(this),this.post=new r3e(this),this.os2=new t3e(this),this.loca=new u3e(this),this.glyf=new o3e(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},e.prototype.registerTTF=function(){var t,r,n,a,s;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var o,l,u,d;for(d=[],o=0,l=(u=this.bbox).length;o<l;o++)t=u[o],d.push(Math.round(t*this.scaleFactor));return d}).call(this),this.stemV=0,this.post.exists?(n=255&(a=this.post.italic_angle),32768&(r=a>>16)&&(r=-(1+(65535^r))),this.italicAngle=+(r+"."+n)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(s=this.familyClass)===1||s===2||s===3||s===4||s===5||s===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},e.prototype.characterToGlyph=function(t){var r;return((r=this.cmap.unicode)!=null?r.codeMap[t]:void 0)||0},e.prototype.widthOfGlyph=function(t){var r;return r=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*r},e.prototype.widthOfString=function(t,r,n){var a,s,o,l;for(o=0,s=0,l=(t=""+t).length;0<=l?s<l:s>l;s=0<=l?++s:--s)a=t.charCodeAt(s),o+=this.widthOfGlyph(this.characterToGlyph(a))+n*(1e3/r)||0;return o*(r/1e3)},e.prototype.lineHeight=function(t,r){var n;return r==null&&(r=!1),n=r?this.lineGap:0,(this.ascender+n-this.decender)/1e3*t},e})();var $c,Ch=(function(){function e(t){this.data=t??[],this.pos=0,this.length=this.data.length}return e.prototype.readByte=function(){return this.data[this.pos++]},e.prototype.writeByte=function(t){return this.data[this.pos++]=t},e.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},e.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=2147483648?t-4294967296:t},e.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},e.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},e.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},e.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},e.prototype.readString=function(t){var r,n;for(n=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)n[r]=String.fromCharCode(this.readByte());return n.join("")},e.prototype.writeString=function(t){var r,n,a;for(a=[],r=0,n=t.length;0<=n?r<n:r>n;r=0<=n?++r:--r)a.push(this.writeByte(t.charCodeAt(r)));return a},e.prototype.readShort=function(){return this.readInt16()},e.prototype.writeShort=function(t){return this.writeInt16(t)},e.prototype.readLongLong=function(){var t,r,n,a,s,o,l,u;return t=this.readByte(),r=this.readByte(),n=this.readByte(),a=this.readByte(),s=this.readByte(),o=this.readByte(),l=this.readByte(),u=this.readByte(),128&t?-1*(72057594037927940*(255^t)+281474976710656*(255^r)+1099511627776*(255^n)+4294967296*(255^a)+16777216*(255^s)+65536*(255^o)+256*(255^l)+(255^u)+1):72057594037927940*t+281474976710656*r+1099511627776*n+4294967296*a+16777216*s+65536*o+256*l+u},e.prototype.writeLongLong=function(t){var r,n;return r=Math.floor(t/4294967296),n=4294967295&t,this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r),this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n)},e.prototype.readInt=function(){return this.readInt32()},e.prototype.writeInt=function(t){return this.writeInt32(t)},e.prototype.read=function(t){var r,n;for(r=[],n=0;0<=t?n<t:n>t;n=0<=t?++n:--n)r.push(this.readByte());return r},e.prototype.write=function(t){var r,n,a,s;for(s=[],n=0,a=t.length;n<a;n++)r=t[n],s.push(this.writeByte(r));return s},e})(),ZSe=(function(){var e;function t(r){var n,a,s;for(this.scalarType=r.readInt(),this.tableCount=r.readShort(),this.searchRange=r.readShort(),this.entrySelector=r.readShort(),this.rangeShift=r.readShort(),this.tables={},a=0,s=this.tableCount;0<=s?a<s:a>s;a=0<=s?++a:--a)n={tag:r.readString(4),checksum:r.readInt(),offset:r.readInt(),length:r.readInt()},this.tables[n.tag]=n}return t.prototype.encode=function(r){var n,a,s,o,l,u,d,f,m,g,x,y,v;for(v in x=Object.keys(r).length,u=Math.log(2),m=16*Math.floor(Math.log(x)/u),o=Math.floor(m/u),f=16*x-m,(a=new Ch).writeInt(this.scalarType),a.writeShort(x),a.writeShort(m),a.writeShort(o),a.writeShort(f),s=16*x,d=a.pos+s,l=null,y=[],r)for(g=r[v],a.writeString(v),a.writeInt(e(g)),a.writeInt(d),a.writeInt(g.length),y=y.concat(g),v==="head"&&(l=d),d+=g.length;d%4;)y.push(0),d++;return a.write(y),n=2981146554-e(a.data),a.pos=l+8,a.writeUInt32(n),a.data},e=function(r){var n,a,s,o;for(r=MW.call(r);r.length%4;)r.push(0);for(s=new Ch(r),a=0,n=0,o=r.length;n<o;n=n+=4)a+=s.readUInt32();return 4294967295&a},t})(),JSe={}.hasOwnProperty,Xu=function(e,t){for(var r in t)JSe.call(t,r)&&(e[r]=t[r]);function n(){this.constructor=e}return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e};$c=(function(){function e(t){var r;this.file=t,r=this.file.directory.tables[this.tag],this.exists=!!r,r&&(this.offset=r.offset,this.length=r.length,this.parse(this.file.contents))}return e.prototype.parse=function(){},e.prototype.encode=function(){},e.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},e})();var QSe=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Xu(e,$c),e.prototype.tag="head",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.revision=t.readInt(),this.checkSumAdjustment=t.readInt(),this.magicNumber=t.readInt(),this.flags=t.readShort(),this.unitsPerEm=t.readShort(),this.created=t.readLongLong(),this.modified=t.readLongLong(),this.xMin=t.readShort(),this.yMin=t.readShort(),this.xMax=t.readShort(),this.yMax=t.readShort(),this.macStyle=t.readShort(),this.lowestRecPPEM=t.readShort(),this.fontDirectionHint=t.readShort(),this.indexToLocFormat=t.readShort(),this.glyphDataFormat=t.readShort()},e.prototype.encode=function(t){var r;return(r=new Ch).writeInt(this.version),r.writeInt(this.revision),r.writeInt(this.checkSumAdjustment),r.writeInt(this.magicNumber),r.writeShort(this.flags),r.writeShort(this.unitsPerEm),r.writeLongLong(this.created),r.writeLongLong(this.modified),r.writeShort(this.xMin),r.writeShort(this.yMin),r.writeShort(this.xMax),r.writeShort(this.yMax),r.writeShort(this.macStyle),r.writeShort(this.lowestRecPPEM),r.writeShort(this.fontDirectionHint),r.writeShort(t),r.writeShort(this.glyphDataFormat),r.data},e})(),CF=(function(){function e(t,r){var n,a,s,o,l,u,d,f,m,g,x,y,v,w,j,k,A;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=r+t.readInt(),m=t.pos,t.pos=this.offset,this.format=t.readUInt16(),this.length=t.readUInt16(),this.language=t.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(u=0;u<256;++u)this.codeMap[u]=t.readByte();break;case 4:for(x=t.readUInt16(),g=x/2,t.pos+=6,s=(function(){var T,M;for(M=[],u=T=0;0<=g?T<g:T>g;u=0<=g?++T:--T)M.push(t.readUInt16());return M})(),t.pos+=2,v=(function(){var T,M;for(M=[],u=T=0;0<=g?T<g:T>g;u=0<=g?++T:--T)M.push(t.readUInt16());return M})(),d=(function(){var T,M;for(M=[],u=T=0;0<=g?T<g:T>g;u=0<=g?++T:--T)M.push(t.readUInt16());return M})(),f=(function(){var T,M;for(M=[],u=T=0;0<=g?T<g:T>g;u=0<=g?++T:--T)M.push(t.readUInt16());return M})(),a=(this.length-t.pos+this.offset)/2,l=(function(){var T,M;for(M=[],u=T=0;0<=a?T<a:T>a;u=0<=a?++T:--T)M.push(t.readUInt16());return M})(),u=j=0,A=s.length;j<A;u=++j)for(w=s[u],n=k=y=v[u];y<=w?k<=w:k>=w;n=y<=w?++k:--k)f[u]===0?o=n+d[u]:(o=l[f[u]/2+(n-y)-(g-u)]||0)!==0&&(o+=d[u]),this.codeMap[n]=65535&o}t.pos=m}return e.encode=function(t,r){var n,a,s,o,l,u,d,f,m,g,x,y,v,w,j,k,A,T,M,B,L,F,I,q,P,R,K,ee,se,Z,ne,X,le,Ae,ce,D,H,G,E,re,he,oe,z,fe,de,W;switch(ee=new Ch,o=Object.keys(t).sort(function(ae,_e){return ae-_e}),r){case"macroman":for(v=0,w=(function(){var ae=[];for(y=0;y<256;++y)ae.push(0);return ae})(),k={0:0},s={},se=0,le=o.length;se<le;se++)k[z=t[a=o[se]]]==null&&(k[z]=++v),s[a]={old:t[a],new:k[t[a]]},w[a]=k[t[a]];return ee.writeUInt16(1),ee.writeUInt16(0),ee.writeUInt32(12),ee.writeUInt16(0),ee.writeUInt16(262),ee.writeUInt16(0),ee.write(w),{charMap:s,subtable:ee.data,maxGlyphID:v+1};case"unicode":for(R=[],m=[],A=0,k={},n={},j=d=null,Z=0,Ae=o.length;Z<Ae;Z++)k[M=t[a=o[Z]]]==null&&(k[M]=++A),n[a]={old:M,new:k[M]},l=k[M]-a,j!=null&&l===d||(j&&m.push(j),R.push(a),d=l),j=a;for(j&&m.push(j),m.push(65535),R.push(65535),q=2*(I=R.length),F=2*Math.pow(Math.log(I)/Math.LN2,2),g=Math.log(F/2)/Math.LN2,L=2*I-F,u=[],B=[],x=[],y=ne=0,ce=R.length;ne<ce;y=++ne){if(P=R[y],f=m[y],P===65535){u.push(0),B.push(0);break}if(P-(K=n[P].new)>=32768)for(u.push(0),B.push(2*(x.length+I-y)),a=X=P;P<=f?X<=f:X>=f;a=P<=f?++X:--X)x.push(n[a].new);else u.push(K-P),B.push(0)}for(ee.writeUInt16(3),ee.writeUInt16(1),ee.writeUInt32(12),ee.writeUInt16(4),ee.writeUInt16(16+8*I+2*x.length),ee.writeUInt16(0),ee.writeUInt16(q),ee.writeUInt16(F),ee.writeUInt16(g),ee.writeUInt16(L),he=0,D=m.length;he<D;he++)a=m[he],ee.writeUInt16(a);for(ee.writeUInt16(0),oe=0,H=R.length;oe<H;oe++)a=R[oe],ee.writeUInt16(a);for(fe=0,G=u.length;fe<G;fe++)l=u[fe],ee.writeUInt16(l);for(de=0,E=B.length;de<E;de++)T=B[de],ee.writeUInt16(T);for(W=0,re=x.length;W<re;W++)v=x[W],ee.writeUInt16(v);return{charMap:n,subtable:ee.data,maxGlyphID:A+1}}},e})(),RW=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Xu(e,$c),e.prototype.tag="cmap",e.prototype.parse=function(t){var r,n,a;for(t.pos=this.offset,this.version=t.readUInt16(),a=t.readUInt16(),this.tables=[],this.unicode=null,n=0;0<=a?n<a:n>a;n=0<=a?++n:--n)r=new CF(t,this.offset),this.tables.push(r),r.isUnicode&&this.unicode==null&&(this.unicode=r);return!0},e.encode=function(t,r){var n,a;return r==null&&(r="macroman"),n=CF.encode(t,r),(a=new Ch).writeUInt16(0),a.writeUInt16(1),n.table=a.data.concat(n.subtable),n},e})(),e3e=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Xu(e,$c),e.prototype.tag="hhea",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.ascender=t.readShort(),this.decender=t.readShort(),this.lineGap=t.readShort(),this.advanceWidthMax=t.readShort(),this.minLeftSideBearing=t.readShort(),this.minRightSideBearing=t.readShort(),this.xMaxExtent=t.readShort(),this.caretSlopeRise=t.readShort(),this.caretSlopeRun=t.readShort(),this.caretOffset=t.readShort(),t.pos+=8,this.metricDataFormat=t.readShort(),this.numberOfMetrics=t.readUInt16()},e})(),t3e=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Xu(e,$c),e.prototype.tag="OS/2",e.prototype.parse=function(t){if(t.pos=this.offset,this.version=t.readUInt16(),this.averageCharWidth=t.readShort(),this.weightClass=t.readUInt16(),this.widthClass=t.readUInt16(),this.type=t.readShort(),this.ySubscriptXSize=t.readShort(),this.ySubscriptYSize=t.readShort(),this.ySubscriptXOffset=t.readShort(),this.ySubscriptYOffset=t.readShort(),this.ySuperscriptXSize=t.readShort(),this.ySuperscriptYSize=t.readShort(),this.ySuperscriptXOffset=t.readShort(),this.ySuperscriptYOffset=t.readShort(),this.yStrikeoutSize=t.readShort(),this.yStrikeoutPosition=t.readShort(),this.familyClass=t.readShort(),this.panose=(function(){var r,n;for(n=[],r=0;r<10;++r)n.push(t.readByte());return n})(),this.charRange=(function(){var r,n;for(n=[],r=0;r<4;++r)n.push(t.readInt());return n})(),this.vendorID=t.readString(4),this.selection=t.readShort(),this.firstCharIndex=t.readShort(),this.lastCharIndex=t.readShort(),this.version>0&&(this.ascent=t.readShort(),this.descent=t.readShort(),this.lineGap=t.readShort(),this.winAscent=t.readShort(),this.winDescent=t.readShort(),this.codePageRange=(function(){var r,n;for(n=[],r=0;r<2;r=++r)n.push(t.readInt());return n})(),this.version>1))return this.xHeight=t.readShort(),this.capHeight=t.readShort(),this.defaultChar=t.readShort(),this.breakChar=t.readShort(),this.maxContext=t.readShort()},e})(),r3e=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Xu(e,$c),e.prototype.tag="post",e.prototype.parse=function(t){var r,n,a;switch(t.pos=this.offset,this.format=t.readInt(),this.italicAngle=t.readInt(),this.underlinePosition=t.readShort(),this.underlineThickness=t.readShort(),this.isFixedPitch=t.readInt(),this.minMemType42=t.readInt(),this.maxMemType42=t.readInt(),this.minMemType1=t.readInt(),this.maxMemType1=t.readInt(),this.format){case 65536:case 196608:break;case 131072:var s;for(n=t.readUInt16(),this.glyphNameIndex=[],s=0;0<=n?s<n:s>n;s=0<=n?++s:--s)this.glyphNameIndex.push(t.readUInt16());for(this.names=[],a=[];t.pos<this.offset+this.length;)r=t.readByte(),a.push(this.names.push(t.readString(r)));return a;case 151552:return n=t.readUInt16(),this.offsets=t.read(n);case 262144:return this.map=(function(){var o,l,u;for(u=[],s=o=0,l=this.file.maxp.numGlyphs;0<=l?o<l:o>l;s=0<=l?++o:--o)u.push(t.readUInt32());return u}).call(this)}},e})(),n3e=function(e,t){this.raw=e,this.length=e.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},a3e=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Xu(e,$c),e.prototype.tag="name",e.prototype.parse=function(t){var r,n,a,s,o,l,u,d,f,m,g;for(t.pos=this.offset,t.readShort(),r=t.readShort(),l=t.readShort(),n=[],s=0;0<=r?s<r:s>r;s=0<=r?++s:--s)n.push({platformID:t.readShort(),encodingID:t.readShort(),languageID:t.readShort(),nameID:t.readShort(),length:t.readShort(),offset:this.offset+l+t.readShort()});for(u={},s=f=0,m=n.length;f<m;s=++f)a=n[s],t.pos=a.offset,d=t.readString(a.length),o=new n3e(d,a),u[g=a.nameID]==null&&(u[g]=[]),u[a.nameID].push(o);this.strings=u,this.copyright=u[0],this.fontFamily=u[1],this.fontSubfamily=u[2],this.uniqueSubfamily=u[3],this.fontName=u[4],this.version=u[5];try{this.postscriptName=u[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=u[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=u[7],this.manufacturer=u[8],this.designer=u[9],this.description=u[10],this.vendorUrl=u[11],this.designerUrl=u[12],this.license=u[13],this.licenseUrl=u[14],this.preferredFamily=u[15],this.preferredSubfamily=u[17],this.compatibleFull=u[18],this.sampleText=u[19]},e})(),i3e=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Xu(e,$c),e.prototype.tag="maxp",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.numGlyphs=t.readUInt16(),this.maxPoints=t.readUInt16(),this.maxContours=t.readUInt16(),this.maxCompositePoints=t.readUInt16(),this.maxComponentContours=t.readUInt16(),this.maxZones=t.readUInt16(),this.maxTwilightPoints=t.readUInt16(),this.maxStorage=t.readUInt16(),this.maxFunctionDefs=t.readUInt16(),this.maxInstructionDefs=t.readUInt16(),this.maxStackElements=t.readUInt16(),this.maxSizeOfInstructions=t.readUInt16(),this.maxComponentElements=t.readUInt16(),this.maxComponentDepth=t.readUInt16()},e})(),s3e=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Xu(e,$c),e.prototype.tag="hmtx",e.prototype.parse=function(t){var r,n,a,s,o,l,u;for(t.pos=this.offset,this.metrics=[],r=0,l=this.file.hhea.numberOfMetrics;0<=l?r<l:r>l;r=0<=l?++r:--r)this.metrics.push({advance:t.readUInt16(),lsb:t.readInt16()});for(a=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var d,f;for(f=[],r=d=0;0<=a?d<a:d>a;r=0<=a?++d:--d)f.push(t.readInt16());return f})(),this.widths=(function(){var d,f,m,g;for(g=[],d=0,f=(m=this.metrics).length;d<f;d++)s=m[d],g.push(s.advance);return g}).call(this),n=this.widths[this.widths.length-1],u=[],r=o=0;0<=a?o<a:o>a;r=0<=a?++o:--o)u.push(this.widths.push(n));return u},e.prototype.forGlyph=function(t){return t in this.metrics?this.metrics[t]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[t-this.metrics.length]}},e})(),MW=[].slice,o3e=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Xu(e,$c),e.prototype.tag="glyf",e.prototype.parse=function(){return this.cache={}},e.prototype.glyphFor=function(t){var r,n,a,s,o,l,u,d,f,m;return t in this.cache?this.cache[t]:(s=this.file.loca,r=this.file.contents,n=s.indexOf(t),(a=s.lengthOf(t))===0?this.cache[t]=null:(r.pos=this.offset+n,o=(l=new Ch(r.read(a))).readShort(),d=l.readShort(),m=l.readShort(),u=l.readShort(),f=l.readShort(),this.cache[t]=o===-1?new c3e(l,d,m,u,f):new l3e(l,o,d,m,u,f),this.cache[t]))},e.prototype.encode=function(t,r,n){var a,s,o,l,u;for(o=[],s=[],l=0,u=r.length;l<u;l++)a=t[r[l]],s.push(o.length),a&&(o=o.concat(a.encode(n)));return s.push(o.length),{table:o,offsets:s}},e})(),l3e=(function(){function e(t,r,n,a,s,o){this.raw=t,this.numberOfContours=r,this.xMin=n,this.yMin=a,this.xMax=s,this.yMax=o,this.compound=!1}return e.prototype.encode=function(){return this.raw.data},e})(),c3e=(function(){function e(t,r,n,a,s){var o,l;for(this.raw=t,this.xMin=r,this.yMin=n,this.xMax=a,this.yMax=s,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],o=this.raw;l=o.readShort(),this.glyphOffsets.push(o.pos),this.glyphIDs.push(o.readUInt16()),32&l;)o.pos+=1&l?4:2,128&l?o.pos+=8:64&l?o.pos+=4:8&l&&(o.pos+=2)}return e.prototype.encode=function(){var t,r,n;for(r=new Ch(MW.call(this.raw.data)),t=0,n=this.glyphIDs.length;t<n;++t)r.pos=this.glyphOffsets[t];return r.data},e})(),u3e=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Xu(e,$c),e.prototype.tag="loca",e.prototype.parse=function(t){var r,n;return t.pos=this.offset,r=this.file.head.indexToLocFormat,this.offsets=r===0?(function(){var a,s;for(s=[],n=0,a=this.length;n<a;n+=2)s.push(2*t.readUInt16());return s}).call(this):(function(){var a,s;for(s=[],n=0,a=this.length;n<a;n+=4)s.push(t.readUInt32());return s}).call(this)},e.prototype.indexOf=function(t){return this.offsets[t]},e.prototype.lengthOf=function(t){return this.offsets[t+1]-this.offsets[t]},e.prototype.encode=function(t,r){for(var n=new Uint32Array(this.offsets.length),a=0,s=0,o=0;o<n.length;++o)if(n[o]=a,s<r.length&&r[s]==o){++s,n[o]=a;var l=this.offsets[o],u=this.offsets[o+1]-l;u>0&&(a+=u)}for(var d=new Array(4*n.length),f=0;f<n.length;++f)d[4*f+3]=255&n[f],d[4*f+2]=(65280&n[f])>>8,d[4*f+1]=(16711680&n[f])>>16,d[4*f]=(4278190080&n[f])>>24;return d},e})(),d3e=(function(){function e(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return e.prototype.generateCmap=function(){var t,r,n,a,s;for(r in a=this.font.cmap.tables[0].codeMap,t={},s=this.subset)n=s[r],t[r]=a[n];return t},e.prototype.glyphsFor=function(t){var r,n,a,s,o,l,u;for(a={},o=0,l=t.length;o<l;o++)a[s=t[o]]=this.font.glyf.glyphFor(s);for(s in r=[],a)(n=a[s])!=null&&n.compound&&r.push.apply(r,n.glyphIDs);if(r.length>0)for(s in u=this.glyphsFor(r))n=u[s],a[s]=n;return a},e.prototype.encode=function(t,r){var n,a,s,o,l,u,d,f,m,g,x,y,v,w,j;for(a in n=RW.encode(this.generateCmap(),"unicode"),o=this.glyphsFor(t),x={0:0},j=n.charMap)x[(u=j[a]).old]=u.new;for(y in g=n.maxGlyphID,o)y in x||(x[y]=g++);return f=(function(k){var A,T;for(A in T={},k)T[k[A]]=A;return T})(x),m=Object.keys(f).sort(function(k,A){return k-A}),v=(function(){var k,A,T;for(T=[],k=0,A=m.length;k<A;k++)l=m[k],T.push(f[l]);return T})(),s=this.font.glyf.encode(o,v,x),d=this.font.loca.encode(s.offsets,v),w={cmap:this.font.cmap.raw(),glyf:s.table,loca:d,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(r)},this.font.os2.exists&&(w["OS/2"]=this.font.os2.raw()),this.font.directory.encode(w)},e})();tr.API.PDFObject=(function(){var e;function t(){}return e=function(r,n){return(Array(n+1).join("0")+r).slice(-n)},t.convert=function(r){var n,a,s,o;if(Array.isArray(r))return"["+(function(){var l,u,d;for(d=[],l=0,u=r.length;l<u;l++)n=r[l],d.push(t.convert(n));return d})().join(" ")+"]";if(typeof r=="string")return"/"+r;if(r!=null&&r.isString)return"("+r+")";if(r instanceof Date)return"(D:"+e(r.getUTCFullYear(),4)+e(r.getUTCMonth(),2)+e(r.getUTCDate(),2)+e(r.getUTCHours(),2)+e(r.getUTCMinutes(),2)+e(r.getUTCSeconds(),2)+"Z)";if({}.toString.call(r)==="[object Object]"){for(a in s=["<<"],r)o=r[a],s.push("/"+a+" "+t.convert(o));return s.push(">>"),s.join(`
`)}return""+r},t})();function LW(e,t,r,n,a){n=n||{};var s=1.15,o=a.internal.scaleFactor,l=a.internal.getFontSize()/o,u=a.getLineHeightFactor?a.getLineHeightFactor():s,d=l*u,f=/\r\n|\r|\n/g,m="",g=1;if((n.valign==="middle"||n.valign==="bottom"||n.halign==="center"||n.halign==="right")&&(m=typeof e=="string"?e.split(f):e,g=m.length||1),r+=l*(2-s),n.valign==="middle"?r-=g/2*d:n.valign==="bottom"&&(r-=g*d),n.halign==="center"||n.halign==="right"){var x=l;if(n.halign==="center"&&(x*=.5),m&&g>=1){for(var y=0;y<m.length;y++)a.text(m[y],t-a.getStringUnitWidth(m[y])*x,r),r+=d;return a}t-=a.getStringUnitWidth(e)*x}return n.halign==="justify"?a.text(e,t,r,{maxWidth:n.maxWidth||100,align:"justify"}):a.text(e,t,r),a}var _F={},Xp=(function(){function e(t){this.jsPDFDocument=t,this.userStyles={textColor:t.getTextColor?this.jsPDFDocument.getTextColor():0,fontSize:t.internal.getFontSize(),fontStyle:t.internal.getFont().fontStyle,font:t.internal.getFont().fontName,lineWidth:t.getLineWidth?this.jsPDFDocument.getLineWidth():0,lineColor:t.getDrawColor?this.jsPDFDocument.getDrawColor():0}}return e.setDefaults=function(t,r){r===void 0&&(r=null),r?r.__autoTableDocumentDefaults=t:_F=t},e.unifyColor=function(t){return Array.isArray(t)?t:typeof t=="number"?[t,t,t]:typeof t=="string"?[t]:null},e.prototype.applyStyles=function(t,r){var n,a,s;r===void 0&&(r=!1),t.fontStyle&&this.jsPDFDocument.setFontStyle&&this.jsPDFDocument.setFontStyle(t.fontStyle);var o=this.jsPDFDocument.internal.getFont(),l=o.fontStyle,u=o.fontName;if(t.font&&(u=t.font),t.fontStyle){l=t.fontStyle;var d=this.getFontList()[u];d&&d.indexOf(l)===-1&&this.jsPDFDocument.setFontStyle&&(this.jsPDFDocument.setFontStyle(d[0]),l=d[0])}if(this.jsPDFDocument.setFont(u,l),t.fontSize&&this.jsPDFDocument.setFontSize(t.fontSize),!r){var f=e.unifyColor(t.fillColor);f&&(n=this.jsPDFDocument).setFillColor.apply(n,f),f=e.unifyColor(t.textColor),f&&(a=this.jsPDFDocument).setTextColor.apply(a,f),f=e.unifyColor(t.lineColor),f&&(s=this.jsPDFDocument).setDrawColor.apply(s,f),typeof t.lineWidth=="number"&&this.jsPDFDocument.setLineWidth(t.lineWidth)}},e.prototype.splitTextToSize=function(t,r,n){return this.jsPDFDocument.splitTextToSize(t,r,n)},e.prototype.rect=function(t,r,n,a,s){return this.jsPDFDocument.rect(t,r,n,a,s)},e.prototype.getLastAutoTable=function(){return this.jsPDFDocument.lastAutoTable||null},e.prototype.getTextWidth=function(t){return this.jsPDFDocument.getTextWidth(t)},e.prototype.getDocument=function(){return this.jsPDFDocument},e.prototype.setPage=function(t){this.jsPDFDocument.setPage(t)},e.prototype.addPage=function(){return this.jsPDFDocument.addPage()},e.prototype.getFontList=function(){return this.jsPDFDocument.getFontList()},e.prototype.getGlobalOptions=function(){return _F||{}},e.prototype.getDocumentOptions=function(){return this.jsPDFDocument.__autoTableDocumentDefaults||{}},e.prototype.pageSize=function(){var t=this.jsPDFDocument.internal.pageSize;return t.width==null&&(t={width:t.getWidth(),height:t.getHeight()}),t},e.prototype.scaleFactor=function(){return this.jsPDFDocument.internal.scaleFactor},e.prototype.getLineHeightFactor=function(){var t=this.jsPDFDocument;return t.getLineHeightFactor?t.getLineHeightFactor():1.15},e.prototype.getLineHeight=function(t){return t/this.scaleFactor()*this.getLineHeightFactor()},e.prototype.pageNumber=function(){var t=this.jsPDFDocument.internal.getCurrentPageInfo();return t?t.pageNumber:this.jsPDFDocument.internal.getNumberOfPages()},e})(),nk=function(e,t){return nk=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},nk(e,t)};function IW(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");nk(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var FW=(function(e){IW(t,e);function t(r){var n=e.call(this)||this;return n._element=r,n}return t})(Array);function f3e(e){return{font:"helvetica",fontStyle:"normal",overflow:"linebreak",fillColor:!1,textColor:20,halign:"left",valign:"top",fontSize:10,cellPadding:5/e,lineColor:200,lineWidth:0,cellWidth:"auto",minCellHeight:0,minCellWidth:0}}function h3e(e){var t={striped:{table:{fillColor:255,textColor:80,fontStyle:"normal"},head:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},body:{},foot:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1},head:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},body:{},foot:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},alternateRow:{}},plain:{head:{fontStyle:"bold"},foot:{fontStyle:"bold"}}};return t[e]}function kw(e,t,r){r.applyStyles(t,!0);var n=Array.isArray(e)?e:[e],a=n.map(function(s){return r.getTextWidth(s)}).reduce(function(s,o){return Math.max(s,o)},0);return a}function BW(e,t,r,n){var a=t.settings.tableLineWidth,s=t.settings.tableLineColor;e.applyStyles({lineWidth:a,lineColor:s});var o=zW(a,!1);o&&e.rect(r.x,r.y,t.getWidth(e.pageSize().width),n.y-r.y,o)}function zW(e,t){var r=e>0,n=t||t===0;return r&&n?"DF":r?"S":n?"F":null}function G5(e,t){var r,n,a,s;if(e=e||t,Array.isArray(e)){if(e.length>=4)return{top:e[0],right:e[1],bottom:e[2],left:e[3]};if(e.length===3)return{top:e[0],right:e[1],bottom:e[2],left:e[1]};if(e.length===2)return{top:e[0],right:e[1],bottom:e[0],left:e[1]};e.length===1?e=e[0]:e=t}return typeof e=="object"?(typeof e.vertical=="number"&&(e.top=e.vertical,e.bottom=e.vertical),typeof e.horizontal=="number"&&(e.right=e.horizontal,e.left=e.horizontal),{left:(r=e.left)!==null&&r!==void 0?r:t,top:(n=e.top)!==null&&n!==void 0?n:t,right:(a=e.right)!==null&&a!==void 0?a:t,bottom:(s=e.bottom)!==null&&s!==void 0?s:t}):(typeof e!="number"&&(e=t),{top:e,right:e,bottom:e,left:e})}function UW(e,t){var r=G5(t.settings.margin,0);return e.pageSize().width-(r.left+r.right)}function m3e(e,t,r,n,a){var s={},o=1.3333333333333333,l=WS(t,function(A){return a.getComputedStyle(A).backgroundColor});l!=null&&(s.fillColor=l);var u=WS(t,function(A){return a.getComputedStyle(A).color});u!=null&&(s.textColor=u);var d=x3e(n,r);d&&(s.cellPadding=d);var f="borderTopColor",m=o*r,g=n.borderTopWidth;if(n.borderBottomWidth===g&&n.borderRightWidth===g&&n.borderLeftWidth===g){var x=(parseFloat(g)||0)/m;x&&(s.lineWidth=x)}else s.lineWidth={top:(parseFloat(n.borderTopWidth)||0)/m,right:(parseFloat(n.borderRightWidth)||0)/m,bottom:(parseFloat(n.borderBottomWidth)||0)/m,left:(parseFloat(n.borderLeftWidth)||0)/m},s.lineWidth.top||(s.lineWidth.right?f="borderRightColor":s.lineWidth.bottom?f="borderBottomColor":s.lineWidth.left&&(f="borderLeftColor"));var y=WS(t,function(A){return a.getComputedStyle(A)[f]});y!=null&&(s.lineColor=y);var v=["left","right","center","justify"];v.indexOf(n.textAlign)!==-1&&(s.halign=n.textAlign),v=["middle","bottom","top"],v.indexOf(n.verticalAlign)!==-1&&(s.valign=n.verticalAlign);var w=parseInt(n.fontSize||"");isNaN(w)||(s.fontSize=w/o);var j=p3e(n);j&&(s.fontStyle=j);var k=(n.fontFamily||"").toLowerCase();return e.indexOf(k)!==-1&&(s.font=k),s}function p3e(e){var t="";return(e.fontWeight==="bold"||e.fontWeight==="bolder"||parseInt(e.fontWeight)>=700)&&(t="bold"),(e.fontStyle==="italic"||e.fontStyle==="oblique")&&(t+="italic"),t}function WS(e,t){var r=$W(e,t);if(!r)return null;var n=r.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d*))?\)$/);if(!n||!Array.isArray(n))return null;var a=[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])],s=parseInt(n[4]);return s===0||isNaN(a[0])||isNaN(a[1])||isNaN(a[2])?null:a}function $W(e,t){var r=t(e);return r==="rgba(0, 0, 0, 0)"||r==="transparent"||r==="initial"||r==="inherit"?e.parentElement==null?null:$W(e.parentElement,t):r}function x3e(e,t){var r=[e.paddingTop,e.paddingRight,e.paddingBottom,e.paddingLeft],n=96/(72/t),a=(parseInt(e.lineHeight)-parseInt(e.fontSize))/t/2,s=r.map(function(l){return parseInt(l||"0")/n}),o=G5(s,0);return a>o.top&&(o.top=a),a>o.bottom&&(o.bottom=a),o}function HW(e,t,r,n,a){var s,o;n===void 0&&(n=!1),a===void 0&&(a=!1);var l;typeof t=="string"?l=r.document.querySelector(t):l=t;var u=Object.keys(e.getFontList()),d=e.scaleFactor(),f=[],m=[],g=[];if(!l)return console.error("Html table could not be found with input: ",t),{head:f,body:m,foot:g};for(var x=0;x<l.rows.length;x++){var y=l.rows[x],v=(o=(s=y==null?void 0:y.parentElement)===null||s===void 0?void 0:s.tagName)===null||o===void 0?void 0:o.toLowerCase(),w=g3e(u,d,r,y,n,a);w&&(v==="thead"?f.push(w):v==="tfoot"?g.push(w):m.push(w))}return{head:f,body:m,foot:g}}function g3e(e,t,r,n,a,s){for(var o=new FW(n),l=0;l<n.cells.length;l++){var u=n.cells[l],d=r.getComputedStyle(u);if(a||d.display!=="none"){var f=void 0;s&&(f=m3e(e,u,t,d,r)),o.push({rowSpan:u.rowSpan,colSpan:u.colSpan,styles:f,_element:u,content:v3e(u)})}}var m=r.getComputedStyle(n);if(o.length>0&&(a||m.display!=="none"))return o}function v3e(e){var t=e.cloneNode(!0);return t.innerHTML=t.innerHTML.replace(/\n/g,"").replace(/ +/g," "),t.innerHTML=t.innerHTML.split(/<br.*?>/).map(function(r){return r.trim()}).join(`
`),t.innerText||t.textContent||""}function y3e(e,t,r){for(var n=0,a=[e,t,r];n<a.length;n++){var s=a[n];s&&typeof s!="object"&&console.error("The options parameter should be of type object, is: "+typeof s),s.startY&&typeof s.startY!="number"&&(console.error("Invalid value for startY option",s.startY),delete s.startY)}}function Hd(e,t,r,n,a){if(e==null)throw new TypeError("Cannot convert undefined or null to object");for(var s=Object(e),o=1;o<arguments.length;o++){var l=arguments[o];if(l!=null)for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(s[u]=l[u])}return s}function VW(e,t){var r=new Xp(e),n=r.getDocumentOptions(),a=r.getGlobalOptions();y3e(a,n,t);var s=Hd({},a,n,t),o;typeof window<"u"&&(o=window);var l=b3e(a,n,t),u=w3e(a,n,t),d=j3e(r,s),f=S3e(r,s,o);return{id:t.tableId,content:f,hooks:u,styles:l,settings:d}}function b3e(e,t,r){for(var n={styles:{},headStyles:{},bodyStyles:{},footStyles:{},alternateRowStyles:{},columnStyles:{}},a=function(u){if(u==="columnStyles"){var d=e[u],f=t[u],m=r[u];n.columnStyles=Hd({},d,f,m)}else{var g=[e,t,r],x=g.map(function(y){return y[u]||{}});n[u]=Hd({},x[0],x[1],x[2])}},s=0,o=Object.keys(n);s<o.length;s++){var l=o[s];a(l)}return n}function w3e(e,t,r){for(var n=[e,t,r],a={didParseCell:[],willDrawCell:[],didDrawCell:[],willDrawPage:[],didDrawPage:[]},s=0,o=n;s<o.length;s++){var l=o[s];l.didParseCell&&a.didParseCell.push(l.didParseCell),l.willDrawCell&&a.willDrawCell.push(l.willDrawCell),l.didDrawCell&&a.didDrawCell.push(l.didDrawCell),l.willDrawPage&&a.willDrawPage.push(l.willDrawPage),l.didDrawPage&&a.didDrawPage.push(l.didDrawPage)}return a}function j3e(e,t){var r,n,a,s,o,l,u,d,f,m,g,x,y=G5(t.margin,40/e.scaleFactor()),v=(r=N3e(e,t.startY))!==null&&r!==void 0?r:y.top,w;t.showFoot===!0?w="everyPage":t.showFoot===!1?w="never":w=(n=t.showFoot)!==null&&n!==void 0?n:"everyPage";var j;t.showHead===!0?j="everyPage":t.showHead===!1?j="never":j=(a=t.showHead)!==null&&a!==void 0?a:"everyPage";var k=(s=t.useCss)!==null&&s!==void 0?s:!1,A=t.theme||(k?"plain":"striped"),T=!!t.horizontalPageBreak,M=(o=t.horizontalPageBreakRepeat)!==null&&o!==void 0?o:null;return{includeHiddenHtml:(l=t.includeHiddenHtml)!==null&&l!==void 0?l:!1,useCss:k,theme:A,startY:v,margin:y,pageBreak:(u=t.pageBreak)!==null&&u!==void 0?u:"auto",rowPageBreak:(d=t.rowPageBreak)!==null&&d!==void 0?d:"auto",tableWidth:(f=t.tableWidth)!==null&&f!==void 0?f:"auto",showHead:j,showFoot:w,tableLineWidth:(m=t.tableLineWidth)!==null&&m!==void 0?m:0,tableLineColor:(g=t.tableLineColor)!==null&&g!==void 0?g:200,horizontalPageBreak:T,horizontalPageBreakRepeat:M,horizontalPageBreakBehaviour:(x=t.horizontalPageBreakBehaviour)!==null&&x!==void 0?x:"afterAllRows"}}function N3e(e,t){var r=e.getLastAutoTable(),n=e.scaleFactor(),a=e.pageNumber(),s=!1;if(r&&r.startPageNumber){var o=r.startPageNumber+r.pageNumber-1;s=o===a}return typeof t=="number"?t:(t==null||t===!1)&&s&&(r==null?void 0:r.finalY)!=null?r.finalY+20/n:null}function S3e(e,t,r){var n=t.head||[],a=t.body||[],s=t.foot||[];if(t.html){var o=t.includeHiddenHtml;if(r){var l=HW(e,t.html,r,o,t.useCss)||{};n=l.head||n,a=l.body||n,s=l.foot||n}else console.error("Cannot parse html in non browser environment")}var u=t.columns||A3e(n,a,s);return{columns:u,head:n,body:a,foot:s}}function A3e(e,t,r){var n=e[0]||t[0]||r[0]||[],a=[];return Object.keys(n).filter(function(s){return s!=="_element"}).forEach(function(s){var o=1,l;Array.isArray(n)?l=n[parseInt(s)]:l=n[s],typeof l=="object"&&!Array.isArray(l)&&(o=(l==null?void 0:l.colSpan)||1);for(var u=0;u<o;u++){var d=void 0;Array.isArray(n)?d=a.length:d=s+(u>0?"_".concat(u):"");var f={dataKey:d};a.push(f)}}),a}var ak=(function(){function e(t,r,n){this.table=r,this.pageNumber=r.pageNumber,this.settings=r.settings,this.cursor=n,this.doc=t.getDocument()}return e})(),k3e=(function(e){IW(t,e);function t(r,n,a,s,o,l){var u=e.call(this,r,n,l)||this;return u.cell=a,u.row=s,u.column=o,u.section=s.section,u}return t})(ak),C3e=(function(){function e(t,r){this.pageNumber=1,this.id=t.id,this.settings=t.settings,this.styles=t.styles,this.hooks=t.hooks,this.columns=r.columns,this.head=r.head,this.body=r.body,this.foot=r.foot}return e.prototype.getHeadHeight=function(t){return this.head.reduce(function(r,n){return r+n.getMaxCellHeight(t)},0)},e.prototype.getFootHeight=function(t){return this.foot.reduce(function(r,n){return r+n.getMaxCellHeight(t)},0)},e.prototype.allRows=function(){return this.head.concat(this.body).concat(this.foot)},e.prototype.callCellHooks=function(t,r,n,a,s,o){for(var l=0,u=r;l<u.length;l++){var d=u[l],f=new k3e(t,this,n,a,s,o),m=d(f)===!1;if(n.text=Array.isArray(n.text)?n.text:[n.text],m)return!1}return!0},e.prototype.callEndPageHooks=function(t,r){t.applyStyles(t.userStyles);for(var n=0,a=this.hooks.didDrawPage;n<a.length;n++){var s=a[n];s(new ak(t,this,r))}},e.prototype.callWillDrawPageHooks=function(t,r){for(var n=0,a=this.hooks.willDrawPage;n<a.length;n++){var s=a[n];s(new ak(t,this,r))}},e.prototype.getWidth=function(t){if(typeof this.settings.tableWidth=="number")return this.settings.tableWidth;if(this.settings.tableWidth==="wrap"){var r=this.columns.reduce(function(a,s){return a+s.wrappedWidth},0);return r}else{var n=this.settings.margin;return t-n.left-n.right}},e})(),qW=(function(){function e(t,r,n,a,s){s===void 0&&(s=!1),this.height=0,this.raw=t,t instanceof FW&&(this.raw=t._element,this.element=t._element),this.index=r,this.section=n,this.cells=a,this.spansMultiplePages=s}return e.prototype.getMaxCellHeight=function(t){var r=this;return t.reduce(function(n,a){var s;return Math.max(n,((s=r.cells[a.index])===null||s===void 0?void 0:s.height)||0)},0)},e.prototype.hasRowSpan=function(t){var r=this;return t.filter(function(n){var a=r.cells[n.index];return a?a.rowSpan>1:!1}).length>0},e.prototype.canEntireRowFit=function(t,r){return this.getMaxCellHeight(r)<=t},e.prototype.getMinimumRowHeight=function(t,r){var n=this;return t.reduce(function(a,s){var o=n.cells[s.index];if(!o)return 0;var l=r.getLineHeight(o.styles.fontSize),u=o.padding("vertical"),d=u+l;return d>a?d:a},0)},e})(),WW=(function(){function e(t,r,n){var a;this.contentHeight=0,this.contentWidth=0,this.wrappedWidth=0,this.minReadableWidth=0,this.minWidth=0,this.width=0,this.height=0,this.x=0,this.y=0,this.styles=r,this.section=n,this.raw=t;var s=t;t!=null&&typeof t=="object"&&!Array.isArray(t)?(this.rowSpan=t.rowSpan||1,this.colSpan=t.colSpan||1,s=(a=t.content)!==null&&a!==void 0?a:t,t._element&&(this.raw=t._element)):(this.rowSpan=1,this.colSpan=1);var o=s!=null?""+s:"",l=/\r\n|\r|\n/g;this.text=o.split(l)}return e.prototype.getTextPos=function(){var t;if(this.styles.valign==="top")t=this.y+this.padding("top");else if(this.styles.valign==="bottom")t=this.y+this.height-this.padding("bottom");else{var r=this.height-this.padding("vertical");t=this.y+r/2+this.padding("top")}var n;if(this.styles.halign==="right")n=this.x+this.width-this.padding("right");else if(this.styles.halign==="center"){var a=this.width-this.padding("horizontal");n=this.x+a/2+this.padding("left")}else n=this.x+this.padding("left");return{x:n,y:t}},e.prototype.getContentHeight=function(t,r){r===void 0&&(r=1.15);var n=Array.isArray(this.text)?this.text.length:1,a=this.styles.fontSize/t*r,s=n*a+this.padding("vertical");return Math.max(s,this.styles.minCellHeight)},e.prototype.padding=function(t){var r=G5(this.styles.cellPadding,0);return t==="vertical"?r.top+r.bottom:t==="horizontal"?r.left+r.right:r[t]},e})(),_3e=(function(){function e(t,r,n){this.wrappedWidth=0,this.minReadableWidth=0,this.minWidth=0,this.width=0,this.dataKey=t,this.raw=r,this.index=n}return e.prototype.getMaxCustomCellWidth=function(t){for(var r=0,n=0,a=t.allRows();n<a.length;n++){var s=a[n],o=s.cells[this.index];o&&typeof o.styles.cellWidth=="number"&&(r=Math.max(r,o.styles.cellWidth))}return r},e})();function E3e(e,t){T3e(e,t);var r=[],n=0;t.columns.forEach(function(s){var o=s.getMaxCustomCellWidth(t);o?s.width=o:(s.width=s.wrappedWidth,r.push(s)),n+=s.width});var a=t.getWidth(e.pageSize().width)-n;a&&(a=ik(r,a,function(s){return Math.max(s.minReadableWidth,s.minWidth)})),a&&(a=ik(r,a,function(s){return s.minWidth})),a=Math.abs(a),!t.settings.horizontalPageBreak&&a>.1/e.scaleFactor()&&(a=a<1?a:Math.round(a),console.log("Of the table content, ".concat(a," units width could not fit page"))),D3e(t),O3e(t,e),P3e(t)}function T3e(e,t){var r=e.scaleFactor(),n=t.settings.horizontalPageBreak,a=UW(e,t);t.allRows().forEach(function(s){for(var o=0,l=t.columns;o<l.length;o++){var u=l[o],d=s.cells[u.index];if(d){var f=t.hooks.didParseCell;t.callCellHooks(e,f,d,s,u,null);var m=d.padding("horizontal");d.contentWidth=kw(d.text,d.styles,e)+m;var g=kw(d.text.join(" ").split(/[^\S\u00A0]+/),d.styles,e);if(d.minReadableWidth=g+d.padding("horizontal"),typeof d.styles.cellWidth=="number")d.minWidth=d.styles.cellWidth,d.wrappedWidth=d.styles.cellWidth;else if(d.styles.cellWidth==="wrap"||n===!0)d.contentWidth>a?(d.minWidth=a,d.wrappedWidth=a):(d.minWidth=d.contentWidth,d.wrappedWidth=d.contentWidth);else{var x=10/r;d.minWidth=d.styles.minCellWidth||x,d.wrappedWidth=d.contentWidth,d.minWidth>d.wrappedWidth&&(d.wrappedWidth=d.minWidth)}}}}),t.allRows().forEach(function(s){for(var o=0,l=t.columns;o<l.length;o++){var u=l[o],d=s.cells[u.index];if(d&&d.colSpan===1)u.wrappedWidth=Math.max(u.wrappedWidth,d.wrappedWidth),u.minWidth=Math.max(u.minWidth,d.minWidth),u.minReadableWidth=Math.max(u.minReadableWidth,d.minReadableWidth);else{var f=t.styles.columnStyles[u.dataKey]||t.styles.columnStyles[u.index]||{},m=f.cellWidth||f.minCellWidth;m&&typeof m=="number"&&(u.minWidth=m,u.wrappedWidth=m)}d&&(d.colSpan>1&&!u.minWidth&&(u.minWidth=d.minWidth),d.colSpan>1&&!u.wrappedWidth&&(u.wrappedWidth=d.minWidth))}})}function ik(e,t,r){for(var n=t,a=e.reduce(function(x,y){return x+y.wrappedWidth},0),s=0;s<e.length;s++){var o=e[s],l=o.wrappedWidth/a,u=n*l,d=o.width+u,f=r(o),m=d<f?f:d;t-=m-o.width,o.width=m}if(t=Math.round(t*1e10)/1e10,t){var g=e.filter(function(x){return t<0?x.width>r(x):!0});g.length&&(t=ik(g,t,r))}return t}function P3e(e){for(var t={},r=1,n=e.allRows(),a=0;a<n.length;a++)for(var s=n[a],o=0,l=e.columns;o<l.length;o++){var u=l[o],d=t[u.index];if(r>1)r--,delete s.cells[u.index];else if(d)d.cell.height+=s.height,r=d.cell.colSpan,delete s.cells[u.index],d.left--,d.left<=1&&delete t[u.index];else{var f=s.cells[u.index];if(!f)continue;if(f.height=s.height,f.rowSpan>1){var m=n.length-a,g=f.rowSpan>m?m:f.rowSpan;t[u.index]={cell:f,left:g,row:s}}}}}function D3e(e){for(var t=e.allRows(),r=0;r<t.length;r++)for(var n=t[r],a=null,s=0,o=0,l=0;l<e.columns.length;l++){var u=e.columns[l];if(o-=1,o>1&&e.columns[l+1])s+=u.width,delete n.cells[u.index];else if(a){var d=a;delete n.cells[u.index],a=null,d.width=u.width+s}else{var d=n.cells[u.index];if(!d)continue;if(o=d.colSpan,s=0,d.colSpan>1){a=d,s+=u.width;continue}d.width=u.width+s}}}function O3e(e,t){for(var r={count:0,height:0},n=0,a=e.allRows();n<a.length;n++){for(var s=a[n],o=0,l=e.columns;o<l.length;o++){var u=l[o],d=s.cells[u.index];if(d){t.applyStyles(d.styles,!0);var f=d.width-d.padding("horizontal");if(d.styles.overflow==="linebreak")d.text=t.splitTextToSize(d.text,f+1/t.scaleFactor(),{fontSize:d.styles.fontSize});else if(d.styles.overflow==="ellipsize")d.text=EF(d.text,f,d.styles,t,"...");else if(d.styles.overflow==="hidden")d.text=EF(d.text,f,d.styles,t,"");else if(typeof d.styles.overflow=="function"){var m=d.styles.overflow(d.text,f);typeof m=="string"?d.text=[m]:d.text=m}d.contentHeight=d.getContentHeight(t.scaleFactor(),t.getLineHeightFactor());var g=d.contentHeight/d.rowSpan;d.rowSpan>1&&r.count*r.height<g*d.rowSpan?r={height:g,count:d.rowSpan}:r&&r.count>0&&r.height>g&&(g=r.height),g>s.height&&(s.height=g)}}r.count--}}function EF(e,t,r,n,a){return e.map(function(s){return R3e(s,t,r,n,a)})}function R3e(e,t,r,n,a){var s=1e4*n.scaleFactor();if(t=Math.ceil(t*s)/s,t>=kw(e,r,n))return e;for(;t<kw(e+a,r,n)&&!(e.length<=1);)e=e.substring(0,e.length-1);return e.trim()+a}function GW(e,t){var r=new Xp(e),n=M3e(t,r.scaleFactor()),a=new C3e(t,n);return E3e(r,a),r.applyStyles(r.userStyles),a}function M3e(e,t){var r=e.content,n=I3e(r.columns);if(r.head.length===0){var a=TF(n,"head");a&&r.head.push(a)}if(r.foot.length===0){var a=TF(n,"foot");a&&r.foot.push(a)}var s=e.settings.theme,o=e.styles;return{columns:n,head:GS("head",r.head,n,o,s,t),body:GS("body",r.body,n,o,s,t),foot:GS("foot",r.foot,n,o,s,t)}}function GS(e,t,r,n,a,s){var o={},l=t.map(function(u,d){for(var f=0,m={},g=0,x=0,y=0,v=r;y<v.length;y++){var w=v[y];if(o[w.index]==null||o[w.index].left===0)if(x===0){var j=void 0;Array.isArray(u)?j=u[w.index-g-f]:j=u[w.dataKey];var k={};typeof j=="object"&&!Array.isArray(j)&&(k=(j==null?void 0:j.styles)||{});var A=F3e(e,w,d,a,n,s,k),T=new WW(j,A,e);m[w.dataKey]=T,m[w.index]=T,x=T.colSpan-1,o[w.index]={left:T.rowSpan-1,times:x}}else x--,g++;else o[w.index].left--,x=o[w.index].times,f++}return new qW(u,d,e,m)});return l}function TF(e,t){var r={};return e.forEach(function(n){if(n.raw!=null){var a=L3e(t,n.raw);a!=null&&(r[n.dataKey]=a)}}),Object.keys(r).length>0?r:null}function L3e(e,t){if(e==="head"){if(typeof t=="object")return t.header||null;if(typeof t=="string"||typeof t=="number")return t}else if(e==="foot"&&typeof t=="object")return t.footer;return null}function I3e(e){return e.map(function(t,r){var n,a;return typeof t=="object"?a=(n=t.dataKey)!==null&&n!==void 0?n:r:a=r,new _3e(a,t,r)})}function F3e(e,t,r,n,a,s,o){var l=h3e(n),u;e==="head"?u=a.headStyles:e==="body"?u=a.bodyStyles:e==="foot"&&(u=a.footStyles);var d=Hd({},l.table,l[e],a.styles,u),f=a.columnStyles[t.dataKey]||a.columnStyles[t.index]||{},m=e==="body"?f:{},g=e==="body"&&r%2===0?Hd({},l.alternateRow,a.alternateRowStyles):{},x=f3e(s),y=Hd({},x,d,g,m);return Hd(y,o)}function B3e(e,t,r){var n;r===void 0&&(r={});var a=UW(e,t),s=new Map,o=[],l=[],u=[];Array.isArray(t.settings.horizontalPageBreakRepeat)?u=t.settings.horizontalPageBreakRepeat:(typeof t.settings.horizontalPageBreakRepeat=="string"||typeof t.settings.horizontalPageBreakRepeat=="number")&&(u=[t.settings.horizontalPageBreakRepeat]),u.forEach(function(g){var x=t.columns.find(function(y){return y.dataKey===g||y.index===g});x&&!s.has(x.index)&&(s.set(x.index,!0),o.push(x.index),l.push(t.columns[x.index]),a-=x.wrappedWidth)});for(var d=!0,f=(n=r==null?void 0:r.start)!==null&&n!==void 0?n:0;f<t.columns.length;){if(s.has(f)){f++;continue}var m=t.columns[f].wrappedWidth;if(d||a>=m)d=!1,o.push(f),l.push(t.columns[f]),a-=m;else break;f++}return{colIndexes:o,columns:l,lastIndex:f-1}}function z3e(e,t){for(var r=[],n=0;n<t.columns.length;n++){var a=B3e(e,t,{start:n});a.columns.length&&(r.push(a),n=a.lastIndex)}return r}function YW(e,t){var r=t.settings,n=r.startY,a=r.margin,s={x:a.left,y:n},o=t.getHeadHeight(t.columns)+t.getFootHeight(t.columns),l=n+a.bottom+o;if(r.pageBreak==="avoid"){var u=t.body,d=u.reduce(function(g,x){return g+x.height},0);l+=d}var f=new Xp(e);(r.pageBreak==="always"||r.startY!=null&&l>f.pageSize().height)&&(XW(f),s.y=a.top),t.callWillDrawPageHooks(f,s);var m=Hd({},s);t.startPageNumber=f.pageNumber(),r.horizontalPageBreak?U3e(f,t,m,s):(f.applyStyles(f.userStyles),(r.showHead==="firstPage"||r.showHead==="everyPage")&&t.head.forEach(function(g){return rf(f,t,g,s,t.columns)}),f.applyStyles(f.userStyles),t.body.forEach(function(g,x){var y=x===t.body.length-1;Cw(f,t,g,y,m,s,t.columns)}),f.applyStyles(f.userStyles),(r.showFoot==="lastPage"||r.showFoot==="everyPage")&&t.foot.forEach(function(g){return rf(f,t,g,s,t.columns)})),BW(f,t,m,s),t.callEndPageHooks(f,s),t.finalY=s.y,e.lastAutoTable=t,f.applyStyles(f.userStyles)}function U3e(e,t,r,n){var a=z3e(e,t),s=t.settings;if(s.horizontalPageBreakBehaviour==="afterAllRows")a.forEach(function(d,f){e.applyStyles(e.userStyles),f>0?uv(e,t,r,n,d.columns,!0):PF(e,t,n,d.columns),$3e(e,t,r,n,d.columns),YS(e,t,n,d.columns)});else for(var o=-1,l=a[0],u=function(){var d=o;if(l){e.applyStyles(e.userStyles);var f=l.columns;o>=0?uv(e,t,r,n,f,!0):PF(e,t,n,f),d=DF(e,t,o+1,n,f),YS(e,t,n,f)}var m=d-o;a.slice(1).forEach(function(g){e.applyStyles(e.userStyles),uv(e,t,r,n,g.columns,!0),DF(e,t,o+1,n,g.columns,m),YS(e,t,n,g.columns)}),o=d};o<t.body.length-1;)u()}function PF(e,t,r,n){var a=t.settings;e.applyStyles(e.userStyles),(a.showHead==="firstPage"||a.showHead==="everyPage")&&t.head.forEach(function(s){return rf(e,t,s,r,n)})}function $3e(e,t,r,n,a){e.applyStyles(e.userStyles),t.body.forEach(function(s,o){var l=o===t.body.length-1;Cw(e,t,s,l,r,n,a)})}function DF(e,t,r,n,a,s){e.applyStyles(e.userStyles),s=s??t.body.length;var o=Math.min(r+s,t.body.length),l=-1;return t.body.slice(r,o).forEach(function(u,d){var f=r+d===t.body.length-1,m=KW(e,t,f,n);u.canEntireRowFit(m,a)&&(rf(e,t,u,n,a),l=r+d)}),l}function YS(e,t,r,n){var a=t.settings;e.applyStyles(e.userStyles),(a.showFoot==="lastPage"||a.showFoot==="everyPage")&&t.foot.forEach(function(s){return rf(e,t,s,r,n)})}function H3e(e,t,r){var n=r.getLineHeight(e.styles.fontSize),a=e.padding("vertical"),s=Math.floor((t-a)/n);return Math.max(0,s)}function V3e(e,t,r,n){var a={};e.spansMultiplePages=!0,e.height=0;for(var s=0,o=0,l=r.columns;o<l.length;o++){var u=l[o],d=e.cells[u.index];if(d){Array.isArray(d.text)||(d.text=[d.text]);var f=new WW(d.raw,d.styles,d.section);f=Hd(f,d),f.text=[];var m=H3e(d,t,n);d.text.length>m&&(f.text=d.text.splice(m,d.text.length));var g=n.scaleFactor(),x=n.getLineHeightFactor();d.contentHeight=d.getContentHeight(g,x),d.contentHeight>=t&&(d.contentHeight=t,f.styles.minCellHeight-=t),d.contentHeight>e.height&&(e.height=d.contentHeight),f.contentHeight=f.getContentHeight(g,x),f.contentHeight>s&&(s=f.contentHeight),a[u.index]=f}}var y=new qW(e.raw,-1,e.section,a,!0);y.height=s;for(var v=0,w=r.columns;v<w.length;v++){var u=w[v],f=y.cells[u.index];f&&(f.height=y.height);var d=e.cells[u.index];d&&(d.height=e.height)}return y}function q3e(e,t,r,n){var a=e.pageSize().height,s=n.settings.margin,o=s.top+s.bottom,l=a-o;t.section==="body"&&(l-=n.getHeadHeight(n.columns)+n.getFootHeight(n.columns));var u=t.getMinimumRowHeight(n.columns,e),d=u<r;if(u>l)return console.log("Will not be able to print row ".concat(t.index," correctly since it's minimum height is larger than page height")),!0;if(!d)return!1;var f=t.hasRowSpan(n.columns),m=t.getMaxCellHeight(n.columns)>l;return m?(f&&console.log("The content of row ".concat(t.index," will not be drawn correctly since drawing rows with a height larger than the page height and has cells with rowspans is not supported.")),!0):!(f||n.settings.rowPageBreak==="avoid")}function Cw(e,t,r,n,a,s,o){var l=KW(e,t,n,s);if(r.canEntireRowFit(l,o))rf(e,t,r,s,o);else if(q3e(e,r,l,t)){var u=V3e(r,l,t,e);rf(e,t,r,s,o),uv(e,t,a,s,o),Cw(e,t,u,n,a,s,o)}else uv(e,t,a,s,o),Cw(e,t,r,n,a,s,o)}function rf(e,t,r,n,a){n.x=t.settings.margin.left;for(var s=0,o=a;s<o.length;s++){var l=o[s],u=r.cells[l.index];if(!u){n.x+=l.width;continue}e.applyStyles(u.styles),u.x=n.x,u.y=n.y;var d=t.callCellHooks(e,t.hooks.willDrawCell,u,r,l,n);if(d===!1){n.x+=l.width;continue}W3e(e,u,n);var f=u.getTextPos();LW(u.text,f.x,f.y,{halign:u.styles.halign,valign:u.styles.valign,maxWidth:Math.ceil(u.width-u.padding("left")-u.padding("right"))},e.getDocument()),t.callCellHooks(e,t.hooks.didDrawCell,u,r,l,n),n.x+=l.width}n.y+=r.height}function W3e(e,t,r){var n=t.styles;if(e.getDocument().setFillColor(e.getDocument().getFillColor()),typeof n.lineWidth=="number"){var a=zW(n.lineWidth,n.fillColor);a&&e.rect(t.x,r.y,t.width,t.height,a)}else typeof n.lineWidth=="object"&&(n.fillColor&&e.rect(t.x,r.y,t.width,t.height,"F"),G3e(e,t,r,n.lineWidth))}function G3e(e,t,r,n){var a,s,o,l;n.top&&(a=r.x,s=r.y,o=r.x+t.width,l=r.y,n.right&&(o+=.5*n.right),n.left&&(a-=.5*n.left),u(n.top,a,s,o,l)),n.bottom&&(a=r.x,s=r.y+t.height,o=r.x+t.width,l=r.y+t.height,n.right&&(o+=.5*n.right),n.left&&(a-=.5*n.left),u(n.bottom,a,s,o,l)),n.left&&(a=r.x,s=r.y,o=r.x,l=r.y+t.height,n.top&&(s-=.5*n.top),n.bottom&&(l+=.5*n.bottom),u(n.left,a,s,o,l)),n.right&&(a=r.x+t.width,s=r.y,o=r.x+t.width,l=r.y+t.height,n.top&&(s-=.5*n.top),n.bottom&&(l+=.5*n.bottom),u(n.right,a,s,o,l));function u(d,f,m,g,x){e.getDocument().setLineWidth(d),e.getDocument().line(f,m,g,x,"S")}}function KW(e,t,r,n){var a=t.settings.margin.bottom,s=t.settings.showFoot;return(s==="everyPage"||s==="lastPage"&&r)&&(a+=t.getFootHeight(t.columns)),e.pageSize().height-n.y-a}function uv(e,t,r,n,a,s){a===void 0&&(a=[]),s===void 0&&(s=!1),e.applyStyles(e.userStyles),t.settings.showFoot==="everyPage"&&!s&&t.foot.forEach(function(l){return rf(e,t,l,n,a)}),t.callEndPageHooks(e,n);var o=t.settings.margin;BW(e,t,r,n),XW(e),t.pageNumber++,n.x=o.left,n.y=o.top,r.y=o.top,t.callWillDrawPageHooks(e,n),t.settings.showHead==="everyPage"&&(t.head.forEach(function(l){return rf(e,t,l,n,a)}),e.applyStyles(e.userStyles))}function XW(e){var t=e.pageNumber();e.setPage(t+1);var r=e.pageNumber();return r===t?(e.addPage(),!0):!1}function Y3e(e){e.API.autoTable=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t[0],a=VW(this,n),s=GW(this,a);return YW(this,s),this},e.API.lastAutoTable=!1,e.API.autoTableText=function(t,r,n,a){LW(t,r,n,a,this)},e.API.autoTableSetDefaults=function(t){return Xp.setDefaults(t,this),this},e.autoTableSetDefaults=function(t,r){Xp.setDefaults(t,r)},e.API.autoTableHtmlToJson=function(t,r){var n;if(r===void 0&&(r=!1),typeof window>"u")return console.error("Cannot run autoTableHtmlToJson in non browser environment"),null;var a=new Xp(this),s=HW(a,t,window,r,!1),o=s.head,l=s.body,u=((n=o[0])===null||n===void 0?void 0:n.map(function(d){return d.content}))||[];return{columns:u,rows:l,data:l}}}var KS;function zd(e,t){var r=VW(e,t),n=GW(e,r);YW(e,n)}try{if(typeof window<"u"&&window){var OF=window,RF=OF.jsPDF||((KS=OF.jspdf)===null||KS===void 0?void 0:KS.jsPDF);RF&&Y3e(RF)}}catch(e){console.error("Could not apply autoTable plugin",e)}function K3e(){const{engineers:e,addEngineer:t,updateEngineer:r,deleteEngineer:n,projects:a}=ca(),{hasPermission:s}=la(),o=mo(),[l,u]=sf(),[d,f]=N.useState("");N.useEffect(()=>{if(l.get("create")==="true"){G();const _e=new URLSearchParams(l);_e.delete("create"),u(_e,{replace:!0})}},[l,u]);const[m,g]=N.useState(null),[x,y]=N.useState({top:0,left:0}),[v,w]=N.useState(!1),[j,k]=N.useState(!1),[A,T]=N.useState(!1),[M,B]=N.useState(null),[L,F]=N.useState(null),[I,q]=N.useState({name:"",role:"",department:"",email:"",status:"Active",type:"Internal"}),[P,R]=N.useState(!1),[K,ee]=N.useState(!1),[se,Z]=N.useState(!1),[ne,X]=N.useState("All"),[le,Ae]=N.useState("All"),ce=N.useRef(null),D=N.useRef(null),H=N.useRef(null);N.useEffect(()=>{const ae=_e=>{ce.current&&!ce.current.contains(_e.target)&&g(null),D.current&&!D.current.contains(_e.target)&&R(!1),H.current&&!H.current.contains(_e.target)&&Z(!1)};return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[]);const G=()=>{B(null),q({name:"",role:"",department:"",email:"",status:"Active",type:"Internal"}),w(!0)},E=ae=>{B(ae),q({name:ae.name,role:ae.role,department:ae.department,email:ae.email,status:ae.status,type:ae.type||"Internal"}),w(!0),g(null)},re=ae=>{F(ae),T(!0),g(null)},he=async ae=>{if(ae.preventDefault(),!j){k(!0);try{if(M)await r(M.id,I),De.success(I.type==="External"?"Moved to External Engineers":"Employee updated successfully"),I.type==="External"&&o("/engineers");else{const _e=`EMP${String(e.length+1).padStart(3,"0")}`;await t({id:_e,...I,workedDays:0,phone:"",experience:"Junior"}),I.type==="External"?(De.success("External staff added to Engineers page"),o("/engineers")):De.success("Employee added successfully")}w(!1)}catch(_e){console.error("[Employees] Submit error:",_e)}finally{k(!1)}}},oe=async(ae,_e)=>{if(!j){k(!0);try{await n(ae),De.error("Employee deleted",{description:`${_e} has been removed from the directory.`}),g(null)}catch{De.error("Failed to delete employee")}finally{k(!1)}}},z=async(ae,_e)=>{if(j)return;k(!0);const ue=_e==="Active"?"On Leave":"Active";try{await r(ae,{status:ue}),De.info(`Status updated to ${ue}`),g(null)}catch{De.error("Failed to update status")}finally{k(!1)}},fe=ae=>{try{const _e={id:"Employee ID",name:"Full Name",role:"Role/Designation",department:"Department",email:"Email Address",phone:"Phone Number",status:"Status",experience:"Experience Level",type:"Employment Type",workedDays:"Worked Days",skills:"Skills"},ue=Object.keys(_e),ke=ue.map(at=>_e[at]).join(","),$e=ue.map(at=>{const Y=ae[at];let we="";return Array.isArray(Y)?we=Y.join(" | "):Y!=null&&(we=String(Y)),we.includes(",")||we.includes(`
`)||we.includes('"')?`"${we.replace(/"/g,'""')}"`:we}).join(","),Je=`${ke}
${$e}`,Xe=new Blob([Je],{type:"text/csv;charset=utf-8;"}),Ne=URL.createObjectURL(Xe),Ye=document.createElement("a");Ye.setAttribute("href",Ne),Ye.setAttribute("download",`${ae.name.replace(/\s+/g,"_")}_details.csv`),document.body.appendChild(Ye),Ye.click(),Ye.remove(),URL.revokeObjectURL(Ne),De.success(`Downloading details for ${ae.name} as CSV`),g(null)}catch(_e){console.error("Download Error:",_e),De.error("Failed to download employee details")}},de=()=>{try{const ae=new tr;ae.setFontSize(22),ae.setTextColor(30,41,59),ae.text("Monthly Attendance Report",14,22),ae.setFontSize(10),ae.setTextColor(100,116,139),ae.text(`Generated on: ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`,14,30);const _e=e.length,ue=e.reduce((Xe,Ne)=>Xe+(Ne.workedDays||0),0),ke=_e>0?(ue/_e).toFixed(1):0;ae.setFontSize(12),ae.setTextColor(51,65,85),ae.text(`Total Employees: ${_e}`,14,42),ae.text(`Total Days Worked: ${ue}`,14,48),ae.text(`Avg. Attendance: ${ke} days`,14,54);const Je=e.filter(Xe=>Xe.type==="Internal").sort((Xe,Ne)=>(Ne.workedDays||0)-(Xe.workedDays||0)).map(Xe=>[Xe.name,Xe.department,Xe.workedDays||0]);zd(ae,{startY:65,head:[["Employee Name","Department","Days Worked"]],body:Je,theme:"striped",headStyles:{fillColor:[59,130,246],textColor:[255,255,255],fontSize:11,fontStyle:"bold"},bodyStyles:{fontSize:10,textColor:[71,85,105]},alternateRowStyles:{fillColor:[248,250,252]},margin:{top:65}}),ae.save(`Attendance_Report_${new Date().toISOString().split("T")[0]}.pdf`),De.success("Report exported successfully",{description:"The monthly report has been downloaded as PDF."}),ee(!1)}catch(ae){console.error("PDF Export Error:",ae),De.error("Failed to export PDF")}},W=e.filter(ae=>{const _e=ae.name.toLowerCase().includes(d.toLowerCase())||ae.id.toLowerCase().includes(d.toLowerCase())||ae.department.toLowerCase().includes(d.toLowerCase()),ue=ne==="All"||ae.department===ne,ke=le==="All"||ae.status===le,$e=ae.type==="Internal";return _e&&ue&&ke&&$e});return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Employee Directory"}),i.jsx("p",{className:"text-muted-foreground",children:"Manage and view all employees across the organization."})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[s("hr.edit")&&i.jsxs("div",{className:"relative",ref:D,children:[i.jsxs("button",{onClick:()=>R(!P),className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(zP,{size:18}),"Attend",i.jsx(Nv,{size:14,className:tt("transition-transform duration-200",P&&"rotate-180")})]}),P&&i.jsxs("div",{className:"absolute right-0 mt-2 z-50 w-56 max-h-64 overflow-y-auto rounded-xl border border-border bg-card p-1 shadow-lg animate-in fade-in slide-in-from-top-2 duration-200",children:[i.jsx("div",{className:"px-3 py-2 text-xs font-semibold text-muted-foreground border-b border-border mb-1",children:"Mark Attendance"}),e.map(ae=>i.jsxs("button",{disabled:j,onClick:async()=>{if(!j){k(!0);try{await r(ae.id,{workedDays:(ae.workedDays||0)+1}),De.success("Attendance marked",{description:`Attendance recorded for ${ae.name} (${ae.id})`}),R(!1)}catch{De.error("Failed to mark attendance")}finally{k(!1)}}},className:"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm hover:bg-accent transition-colors disabled:opacity-50",children:[i.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center text-[10px] font-bold text-primary",children:ae.name.charAt(0)}),i.jsx("span",{className:"truncate",children:ae.name})]},ae.id))]})]}),s("hr.export")&&i.jsxs("button",{onClick:()=>ee(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx($P,{size:18}),"Monthly Report"]}),s("hr.create")&&i.jsxs("button",{onClick:G,className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[i.jsx(Oh,{size:18}),"Add Employee"]})]})]}),K&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx($P,{className:"text-primary",size:24}),i.jsx("h3",{className:"text-xl font-bold",children:"Monthly Attendance Report"})]}),i.jsx("button",{onClick:()=>ee(!1),className:"rounded-md p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Total Employees"}),i.jsx("p",{className:"text-2xl font-bold",children:e.filter(ae=>ae.type==="Internal").length})]}),i.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Total Days Worked"}),i.jsx("p",{className:"text-2xl font-bold text-primary",children:e.filter(ae=>ae.type==="Internal").reduce((ae,_e)=>ae+(_e.workedDays||0),0)})]}),i.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Avg. Attendance"}),i.jsx("p",{className:"text-2xl font-bold",children:e.filter(ae=>ae.type==="Internal").length>0?(e.filter(ae=>ae.type==="Internal").reduce((ae,_e)=>ae+(_e.workedDays||0),0)/e.filter(ae=>ae.type==="Internal").length).toFixed(1):0})]})]}),i.jsx("div",{className:"rounded-lg border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-2 font-semibold",children:"Employee"}),i.jsx("th",{className:"px-4 py-2 font-semibold",children:"Department"}),i.jsx("th",{className:"px-4 py-2 font-semibold text-right",children:"Days Worked"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:e.filter(ae=>ae.type==="Internal").sort((ae,_e)=>(_e.workedDays||0)-(ae.workedDays||0)).map(ae=>i.jsxs("tr",{className:"hover:bg-accent/50 transition-colors",children:[i.jsx("td",{className:"px-4 py-3 font-medium",children:ae.name}),i.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:ae.department}),i.jsx("td",{className:"px-4 py-3 text-right font-bold text-primary",children:ae.workedDays||0})]},ae.id))})]})})]}),i.jsx("div",{className:"mt-8 flex justify-end",children:i.jsx("button",{onClick:de,className:"rounded-lg bg-primary px-6 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:"Export PDF"})})]})}),A&&L&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-lg rounded-xl border border-border bg-card p-8 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[i.jsx("h3",{className:"text-xl font-bold",children:"Employee Profile"}),i.jsx("button",{onClick:()=>T(!1),className:"rounded-md p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("div",{className:"flex items-center gap-6 mb-8",children:[i.jsx("div",{className:"h-24 w-24 rounded-full bg-primary/10 flex items-center justify-center text-primary text-3xl font-bold",children:L.name.charAt(0)}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-2xl font-bold",children:L.name}),i.jsxs("p",{className:"text-muted-foreground",children:[L.role," • ",L.department]}),i.jsx("span",{className:tt("mt-2 inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium uppercase tracking-wider",L.status==="Active"?"bg-green-500/10 text-green-500":"bg-yellow-500/10 text-yellow-500"),children:L.status})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Employee ID"}),i.jsx("p",{className:"font-mono",children:L.id})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Email Address"}),i.jsxs("p",{className:"flex items-center gap-2",children:[i.jsx(Gl,{size:14,className:"text-muted-foreground"}),L.email]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Phone Number"}),i.jsxs("p",{className:"flex items-center gap-2",children:[i.jsx(rx,{size:14,className:"text-muted-foreground"}),"+1 (555) 000-0000"]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Location"}),i.jsxs("p",{className:"flex items-center gap-2",children:[i.jsx(P9,{size:14,className:"text-muted-foreground"}),"San Francisco, CA"]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Worked Days"}),i.jsxs("p",{className:"flex items-center gap-2 font-bold text-primary",children:[i.jsx(zP,{size:14}),L.workedDays||0," Days"]})]})]}),i.jsxs("div",{className:"mt-8 pt-6 border-t border-border",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-4",children:"Assigned Projects"}),i.jsx("div",{className:"space-y-3",children:a.filter(ae=>ae.assignedTo===L.name).length>0?a.filter(ae=>ae.assignedTo===L.name).map(ae=>i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border bg-muted/20",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold",children:ae.name}),i.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:ae.client})]}),i.jsx("span",{className:tt("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase",ae.status==="Active"?"bg-blue-500/10 text-blue-500":"bg-muted text-muted-foreground"),children:ae.status})]},ae.id)):i.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No projects assigned yet."})})]}),i.jsxs("div",{className:"mt-8 pt-6 border-t border-border flex gap-3",children:[i.jsxs("button",{onClick:()=>{T(!1),E(L)},className:"flex-1 flex items-center justify-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[i.jsx(Ps,{size:16}),"Edit Profile"]}),i.jsx("button",{onClick:()=>T(!1),className:"flex-1 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Close"})]})]})}),v&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("h3",{className:"text-lg font-semibold",children:M?"Edit Employee":"Add New Employee"}),i.jsx("button",{onClick:()=>w(!1),className:"rounded-md p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:he,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Full Name"}),i.jsx("input",{type:"text",required:!0,placeholder:"e.g. John Doe",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:I.name||"",onChange:ae=>q(_e=>({..._e,name:ae.target.value}))})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Department"}),i.jsx("input",{type:"text",required:!0,placeholder:"e.g. Engineering",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:I.department||"",onChange:ae=>q(_e=>({..._e,department:ae.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Role"}),i.jsx("input",{type:"text",required:!0,placeholder:"e.g. Developer",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:I.role||"",onChange:ae=>q(_e=>({..._e,role:ae.target.value}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Employment Type"}),i.jsxs("select",{className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50 [&>option]:bg-background [&>option]:text-foreground",value:I.type||"Internal",onChange:ae=>q(_e=>({..._e,type:ae.target.value})),children:[i.jsx("option",{value:"Internal",children:"Internal (Employee)"}),i.jsx("option",{value:"External",children:"External (Contractor)"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Status"}),i.jsxs("select",{className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:I.status||"Active",onChange:ae=>q(_e=>({..._e,status:ae.target.value})),children:[i.jsx("option",{value:"Active",children:"Active"}),i.jsx("option",{value:"On Leave",children:"On Leave"}),i.jsx("option",{value:"Pending Approval",children:"Pending Approval"})]})]})]}),i.jsxs("div",{className:"flex gap-3 pt-4",children:[i.jsx("button",{type:"button",onClick:()=>w(!1),className:"flex-1 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",disabled:j,className:tt("flex-1 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",j&&"opacity-50 cursor-not-allowed"),children:j?i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Saving..."]}):M?"Update":"Create"})]})]})]})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[i.jsxs("div",{className:"relative flex-1 min-w-[300px]",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search employees by name, ID or department...",value:d,onChange:ae=>f(ae.target.value),className:"h-10 w-full rounded-lg border border-border bg-card pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"relative",ref:H,children:[i.jsxs("button",{onClick:()=>Z(!se),className:tt("flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium transition-colors hover:bg-accent",(ne!=="All"||le!=="All")&&"border-primary text-primary"),children:[i.jsx(Oc,{size:18}),"Filters",(ne!=="All"||le!=="All")&&i.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:[ne,le].filter(ae=>ae!=="All").length})]}),se&&i.jsxs("div",{className:"absolute right-0 mt-2 z-50 w-64 rounded-xl border border-border bg-card p-4 shadow-lg animate-in fade-in slide-in-from-top-2 duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h4",{className:"font-bold text-sm",children:"Filter Options"}),i.jsx("button",{onClick:()=>{X("All"),Ae("All")},className:"text-[10px] font-bold uppercase tracking-wider text-primary hover:underline",children:"Reset"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Department"}),i.jsxs("select",{value:ne,onChange:ae=>X(ae.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Departments"}),Array.from(new Set(e.map(ae=>ae.department))).filter(Boolean).sort().map(ae=>i.jsx("option",{value:ae,children:ae},ae))]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Status"}),i.jsxs("select",{value:le,onChange:ae=>Ae(ae.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Statuses"}),i.jsx("option",{value:"Active",children:"Active"}),i.jsx("option",{value:"On Leave",children:"On Leave"}),i.jsx("option",{value:"Pending Approval",children:"Pending Approval"})]})]})]})]})]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-card shadow-sm overflow-hidden",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Employee"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"ID"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Department"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Role"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Worked Days"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Status"}),i.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),i.jsxs("tbody",{className:"divide-y divide-border",children:[W.map(ae=>i.jsxs("tr",{className:"hover:bg-accent/50 transition-colors group",children:[i.jsx("td",{className:"px-6 py-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold group-hover:bg-primary group-hover:text-primary-foreground transition-colors",children:ae.name.charAt(0)}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium",children:ae.name}),i.jsx("p",{className:"text-xs text-muted-foreground",children:ae.email})]})]})}),i.jsx("td",{className:"px-6 py-4 text-muted-foreground font-mono text-xs",children:ae.id}),i.jsx("td",{className:"px-6 py-4",children:ae.department}),i.jsx("td",{className:"px-6 py-4",children:ae.role}),i.jsx("td",{className:"px-6 py-4 font-medium text-center",children:i.jsx("span",{className:"inline-flex items-center justify-center h-8 w-8 rounded-full bg-primary/5 text-primary border border-primary/10",children:ae.workedDays||0})}),i.jsx("td",{className:"px-6 py-4",children:i.jsx("span",{className:tt("inline-flex items-center rounded-full px-2 py-1 text-[10px] font-bold uppercase tracking-wider",ae.status==="Active"?"bg-green-500/10 text-green-500":ae.status==="Pending Approval"?"bg-orange-500/10 text-orange-500":"bg-yellow-500/10 text-yellow-500"),children:ae.status})}),i.jsxs("td",{className:"px-6 py-4 text-right relative",children:[i.jsx("button",{onClick:_e=>{const ue=_e.currentTarget.getBoundingClientRect();y({top:ue.bottom+window.scrollY,left:ue.right+window.scrollX-192}),g(m===ae.id?null:ae.id)},className:tt("rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",m===ae.id&&"bg-accent text-foreground"),children:i.jsx(k9,{size:18})}),m===ae.id&&jx.createPortal(i.jsxs("div",{ref:ce,style:{position:"absolute",top:x.top,left:x.left,zIndex:9999},className:"w-48 rounded-lg border border-border bg-card p-1 shadow-lg animate-in fade-in zoom-in duration-150",children:[i.jsxs("button",{onClick:()=>re(ae),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm hover:bg-accent transition-colors",children:[i.jsx(ls,{size:16,className:"text-muted-foreground"}),"View Details"]}),s("hr.export")&&i.jsxs("button",{onClick:()=>fe(ae),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:16,className:"text-muted-foreground"}),"Download Details"]}),s("hr.edit")&&i.jsxs(i.Fragment,{children:[ae.status==="Pending Approval"&&i.jsxs("button",{disabled:j,onClick:async()=>{k(!0);try{await r(ae.id,{status:"Active"}),De.success(`${ae.name} approved successfully`),g(null)}catch{De.error("Failed to approve employee")}finally{k(!1)}},className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-green-600 hover:bg-green-50 transition-colors disabled:opacity-50",children:[i.jsx(bh,{size:16}),"Approve Employee"]}),i.jsxs("button",{onClick:()=>E(ae),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm hover:bg-accent transition-colors",children:[i.jsx(Ps,{size:16,className:"text-muted-foreground"}),"Edit Details"]}),i.jsxs("button",{onClick:()=>z(ae.id,ae.status),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm hover:bg-accent transition-colors",children:[i.jsx(bh,{size:16,className:"text-muted-foreground"}),"Change Status"]})]}),s("hr.delete")&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-1 border-t border-border"}),i.jsxs("button",{onClick:()=>oe(ae.id,ae.name),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-destructive hover:bg-destructive/10 transition-colors",children:[i.jsx(aa,{size:16}),"Delete Employee"]})]})]}),document.body)]})]},ae.id)),W.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-muted-foreground",children:"No employees found matching your search."})})]})]})})})]})}function X3e(){const{departments:e,addDepartment:t,updateDepartment:r,deleteDepartment:n,engineers:a}=ca(),{hasPermission:s}=la(),[o,l]=N.useState("hierarchy"),[u,d]=N.useState(!1),[f,m]=N.useState(!1),[g,x]=N.useState(!1),[y,v]=N.useState(!1),[w,j]=N.useState(null),[k,A]=N.useState(null),[T,M]=N.useState({name:"",manager:"",parentId:""}),B=N.useMemo(()=>{const P=new Map,R=[];return e.forEach(K=>{P.set(K.id,{...K,children:[]})}),e.forEach(K=>{const ee=P.get(K.id);K.parentId&&P.has(K.parentId)?P.get(K.parentId).children.push(ee):R.push(ee)}),R.length>1?{id:"ROOT",name:"MA IT TECH SERVICES",type:"Company",children:R}:R[0]||{id:"EMPTY",name:"No Data",type:"Company",children:[]}},[e]),L=async P=>{if(P.preventDefault(),!(!T.name||g)){x(!0);try{if(w)await r(w.id,T),De.success("Department updated successfully");else{const R=`DEP-${Math.random().toString(36).substr(2,5).toUpperCase()}`;await t({...T,id:R,teams:0}),De.success("Department added successfully")}M({name:"",manager:"",parentId:""}),j(null),d(!1)}catch(R){console.error("Save department error:",R)}finally{x(!1)}}},F=P=>{j(P),M({name:P.name,manager:P.manager,parentId:P.parentId||""}),d(!0)},I=(P,R)=>{P==="ROOT"||P==="EMPTY"||(A({id:P,name:R}),m(!0))},q=async()=>{if(k){v(!0);try{await n(k.id),De.success("Department deleted"),m(!1),A(null)}catch{De.error("Failed to delete department")}finally{v(!1)}}};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Organization Structure"}),i.jsx("p",{className:"text-muted-foreground",children:"Visualize and manage the company hierarchy and departments."})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("div",{className:"flex p-1 rounded-lg bg-muted border border-border mr-4",children:[i.jsx("button",{onClick:()=>l("hierarchy"),className:tt("px-4 py-1.5 text-sm font-medium rounded-md transition-all",o==="hierarchy"?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Hierarchy"}),i.jsx("button",{onClick:()=>l("roles"),className:tt("px-4 py-1.5 text-sm font-medium rounded-md transition-all",o==="roles"?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Roles & Permissions"})]}),s("hr.create")&&i.jsxs("button",{onClick:()=>d(!0),className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[i.jsx(zi,{size:18}),"Add Department"]})]})]}),u&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("h3",{className:"text-lg font-semibold",children:w?"Edit Department":"Add New Department"}),i.jsx("button",{onClick:()=>{d(!1),j(null)},className:"rounded-md p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:L,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Department Name"}),i.jsx("input",{type:"text",autoFocus:!0,required:!0,placeholder:"e.g. Product Design",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:T.name,onChange:P=>M(R=>({...R,name:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Department Manager"}),i.jsx("input",{type:"text",placeholder:"e.g. John Doe",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:T.manager,onChange:P=>M(R=>({...R,manager:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Parent Department (Optional)"}),i.jsxs("select",{className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:T.parentId,onChange:P=>M(R=>({...R,parentId:P.target.value})),children:[i.jsx("option",{value:"",children:"None (Top Level)"}),e.filter(P=>P.id!==(w==null?void 0:w.id)).map(P=>i.jsx("option",{value:P.id,children:P.name},P.id))]})]}),i.jsxs("div",{className:"flex gap-3 pt-4",children:[i.jsx("button",{type:"button",onClick:()=>{d(!1),j(null)},className:"flex-1 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",disabled:g,className:"flex-1 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:g?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Saving..."]}):w?"Update":"Create"})]})]})]})}),f&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Confirm Deletion"}),i.jsx("button",{onClick:()=>m(!1),className:"rounded-md p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Are you sure you want to delete the ",i.jsxs("span",{className:"font-bold text-foreground",children:['"',k==null?void 0:k.name,'"']})," department?"]}),i.jsx("p",{className:"text-xs text-muted-foreground bg-accent/50 p-3 rounded-lg",children:"Note: This will not delete sub-departments, but they will become top-level nodes in the hierarchy."}),i.jsxs("div",{className:"flex gap-3 pt-2",children:[i.jsx("button",{onClick:()=>m(!1),disabled:y,className:"flex-1 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors disabled:opacity-50",children:"Cancel"}),i.jsx("button",{onClick:q,disabled:y,className:"flex-1 rounded-lg bg-destructive px-4 py-2 text-sm font-medium text-destructive-foreground hover:bg-destructive/90 transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:y?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Deleting..."]}):"Delete"})]})]})]})}),o==="hierarchy"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-4",children:[i.jsx("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"rounded-lg bg-blue-500/10 p-3 text-blue-500",children:i.jsx(zi,{size:24})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Departments"}),i.jsx("h4",{className:"text-2xl font-bold",children:e.length})]})]})}),i.jsx("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"rounded-lg bg-green-500/10 p-3 text-green-500",children:i.jsx(D9,{size:24})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Teams"}),i.jsx("h4",{className:"text-2xl font-bold",children:e.reduce((P,R)=>P+(R.teams||0),0)})]})]})}),i.jsx("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"rounded-lg bg-purple-500/10 p-3 text-purple-500",children:i.jsx(ax,{size:24})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Internal Engineers"}),i.jsx("h4",{className:"text-2xl font-bold",children:a.filter(P=>P.type==="Internal").length})]})]})}),i.jsx("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"rounded-lg bg-orange-500/10 p-3 text-orange-500",children:i.jsx(Hn,{size:24})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"External Engineers"}),i.jsx("h4",{className:"text-2xl font-bold",children:a.filter(P=>P.type==="External").length})]})]})})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-8 shadow-sm overflow-x-auto",children:[i.jsx("h3",{className:"mb-8 text-lg font-semibold",children:"Hierarchy Tree"}),i.jsx("div",{className:"min-w-[600px] max-w-4xl mx-auto",children:i.jsx(ZW,{node:B,isRoot:!0,onEdit:F,onDelete:I})})]})]}):i.jsx(Z3e,{})]})}const ZW=({node:e,isRoot:t=!1,onEdit:r,onDelete:n})=>{const{hasPermission:a}=la(),[s,o]=Mt.useState(!0),l=e.children&&e.children.length>0,u=e.id==="ROOT"||e.id==="EMPTY";return i.jsxs("div",{className:tt("relative",!t&&"ml-8 mt-4"),children:[!t&&i.jsx("div",{className:"absolute -left-4 top-4 h-px w-4 bg-border"}),i.jsxs("div",{className:tt("group relative flex items-center gap-4 rounded-xl border border-border p-4 transition-all hover:border-primary/50 hover:shadow-md",t?"bg-primary/5 border-primary/20":"bg-card"),children:[i.jsx("div",{className:tt("flex h-10 w-10 items-center justify-center rounded-lg",e.type==="Company"||t?"bg-primary text-primary-foreground":"bg-blue-500/10 text-blue-500"),children:e.type==="Company"||t?i.jsx(zi,{size:20}):i.jsx(D9,{size:20})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-sm font-bold",children:e.name}),i.jsx("p",{className:"text-xs text-muted-foreground",children:e.manager&&`Manager: ${e.manager}`})]}),i.jsx("div",{className:"flex items-center gap-1",children:!u&&i.jsxs(i.Fragment,{children:[a("hr.edit")&&i.jsx("button",{onClick:()=>r(e),className:"p-2 hover:bg-accent rounded-lg text-muted-foreground transition-colors",title:"Edit Department",children:i.jsx(Ps,{size:16})}),a("hr.delete")&&i.jsx("button",{onClick:()=>n(e.id,e.name),className:"p-2 hover:bg-destructive/10 rounded-lg text-destructive transition-colors",title:"Delete Department",children:i.jsx(aa,{size:16})})]})}),l&&i.jsx("button",{onClick:()=>o(!s),className:"rounded-md p-1 hover:bg-accent transition-colors",children:i.jsx(Io,{size:18,className:tt("transition-transform",s&&"rotate-90")})})]}),l&&s&&i.jsx("div",{className:"relative border-l border-border ml-5 mt-2",children:e.children.map((d,f)=>i.jsx(ZW,{node:d,onEdit:r,onDelete:n},d.id||f))})]})};function Z3e(){const e=[{name:"Admin",permissions:["All Access","User Management","Financials"]},{name:"Manager",permissions:["Project Management","Team Lead","Reports"]},{name:"Engineer",permissions:["Task Management","Time Logging","Project View"]},{name:"Sales",permissions:["Lead Management","CRM Access","Client View"]},{name:"HR",permissions:["Recruitment","Employee Directory","Organization"]}];return i.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-bold mb-6 flex items-center gap-2",children:[i.jsx(bh,{className:"text-primary"}),"Roles Definition"]}),i.jsx("div",{className:"space-y-4",children:e.map(t=>i.jsxs("div",{className:"p-4 rounded-lg border border-border bg-muted/20 hover:bg-muted/30 transition-colors",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"font-bold",children:t.name}),i.jsx("button",{className:"text-xs text-primary hover:underline",children:"Edit Role"})]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:t.permissions.map(r=>i.jsx("span",{className:"px-2 py-0.5 rounded bg-primary/10 text-primary text-[10px] font-bold uppercase",children:r},r))})]},t.name))})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-bold mb-6 flex items-center gap-2",children:[i.jsx(ax,{className:"text-green-500"}),"Access Permissions Matrix"]}),i.jsxs("div",{className:"space-y-4",children:[["Create Project","Delete Employee","View Financials","Approve Time"].map(t=>i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border",children:[i.jsx("span",{className:"text-sm font-medium",children:t}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500",title:"Admin"}),i.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500",title:"Manager"}),i.jsx("span",{className:"h-2 w-2 rounded-full bg-muted",title:"Engineer"})]})]},t)),i.jsx("button",{className:"w-full py-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground hover:bg-accent transition-colors",children:"Add New Permission"})]})]})]})}function J3e(){var Je,Xe;const{projects:e,addProject:t,updateProject:r,deleteProject:n,clients:a,engineers:s,tasks:o,companySettings:l,currencies:u}=ca(),{profile:d,hasPermission:f}=la(),m=N.useMemo(()=>d?f("projects.view_all")||d.uid==="admin-123":!1,[d,f]),g=N.useMemo(()=>m?e:e.filter(Ne=>Ne.assignedTo===(d==null?void 0:d.name)||Ne.assignedEmail===(d==null?void 0:d.email)||Ne.assignedRole===(d==null?void 0:d.role)),[e,m,d]),x=Ne=>{if(!Ne)return"$";const Ye=u.find(at=>at.code===Ne);return Ye?Ye.symbol:"$"},y=N.useMemo(()=>{const Ne=g.length,Ye=g.filter(we=>["Active","Work In Progress","Scheduled"].includes(we.status)).length,at=g.filter(we=>we.status==="Completed").length,Y=g.reduce((we,J)=>we+(J.clientTotalAmount||0),0);return{total:Ne,active:Ye,completed:at,totalValue:Y}},[g]),[v,w]=sf(),j=v.get("search")||"",k=v.get("status")||"All",[A,T]=N.useState(j),[M,B]=N.useState(k);N.useEffect(()=>{const Ne=v.get("search"),Ye=v.get("status"),at=v.get("create");if(Ne&&T(Ne),Ye&&B(Ye),at==="true"){q(!0);const Y=new URLSearchParams(v);Y.delete("create"),w(Y,{replace:!0})}},[v,w]),N.useEffect(()=>{const Ne=Ye=>{he.current&&!he.current.contains(Ye.target)&&Ae(!1)};return document.addEventListener("mousedown",Ne),()=>document.removeEventListener("mousedown",Ne)},[]);const[L,F]=N.useState(!1),[I,q]=N.useState(!1),[P,R]=N.useState(!1),[K,ee]=N.useState("general"),[se,Z]=N.useState(null),[ne,X]=N.useState(null),[le,Ae]=N.useState(!1),[ce,D]=N.useState("All"),[H,G]=N.useState("All"),[E,re]=N.useState({name:"",client:"",deadline:"",team:1,status:"Planning",description:"",currency:"USD",ticketId:"",personName:"",email:"",contactNumber:"",assignedEmail:"",assignedContactNumber:"",hourlyRate:0,halfDayRate:0,fullDayRate:0,monthlyRate:0,travelCost:0,materialCost:0,totalAmount:0,clientHourlyRate:0,clientHalfDayRate:0,clientFullDayRate:0,clientMonthlyRate:0,clientTravelCost:0,clientMaterialCost:0,clientTotalAmount:0,taxRate:20,taxAmount:0,assignedTo:"",assignedRole:"",timeIn:"",timeOut:"",totalTime:"",totalDays:0,completedDate:"",engineerInvoiceStatus:"Unpaid",clientInvoiceStatus:"Unpaid",files:[]}),he=Mt.useRef(null),oe=async Ne=>{if(Ne.preventDefault(),!P){if(!E.name||!E.client||!E.deadline){De.error("Please fill in all required fields");return}R(!0);try{if(se)await r(se,E),De.success("Project updated successfully");else{const at={id:`PRJ-${Math.random().toString(36).substr(2,5).toUpperCase()}`,name:E.name||"",client:E.client||"",deadline:E.deadline||"",team:E.team||1,status:E.status||"Planning",...E};await t(at),De.success("Project created successfully",{description:`${at.name} has been added to your portfolio.`})}q(!1),Z(null),re({name:"",client:"",deadline:"",team:1,status:"Planning",description:"",currency:"USD",ticketId:"",personName:"",email:"",contactNumber:"",hourlyRate:0,halfDayRate:0,fullDayRate:0,monthlyRate:0,travelCost:0,materialCost:0,totalAmount:0,clientHourlyRate:0,clientHalfDayRate:0,clientFullDayRate:0,clientMonthlyRate:0,clientTravelCost:0,clientMaterialCost:0,clientTotalAmount:0,assignedTo:"",assignedRole:"",assignedEmail:"",assignedContactNumber:"",timeIn:"",timeOut:"",totalTime:"",completedDate:"",engineerInvoiceStatus:"Unpaid",clientInvoiceStatus:"Unpaid"})}catch(Ye){console.error("Project save error:",Ye)}finally{R(!1)}}},z=Ne=>{Z(Ne.id),re({...Ne}),q(!0)},fe=async Ne=>{if(!P){R(!0);try{await n(Ne),De.success("Project deleted successfully")}catch(Ye){console.error("Delete project error:",Ye)}finally{R(!1)}}},de=async(Ne,Ye)=>{if(P)return;R(!0);const at={status:Ye};["Completed","Accepted","Rejected"].includes(Ye)&&(at.completedDate=new Date().toISOString().split("T")[0]);try{await r(Ne,at),X(null),De.success(`Project ${Ye.toLowerCase()} successfully`)}catch(Y){console.error("Status update error:",Y)}finally{R(!1)}};N.useEffect(()=>{if(E.timeIn&&E.timeOut){const[Ne,Ye]=E.timeIn.split(":").map(Number),[at,Y]=E.timeOut.split(":").map(Number);let we=at*60+Y-(Ne*60+Ye);we<0&&(we+=1440);const J=E.totalDays&&E.totalDays>0?E.totalDays:1,ve=we*J,Oe=Math.floor(ve/60),xe=ve%60;re(qe=>({...qe,totalTime:`${Oe}h ${xe}m`}))}},[E.timeIn,E.timeOut,E.totalDays]),N.useEffect(()=>{const Ye=(ve=>{if(!ve)return 0;const Oe=ve.match(/(\d+)h/),xe=ve.match(/(\d+)m/),qe=Oe?parseInt(Oe[1]):0,me=xe?parseInt(xe[1]):0;return qe+me/60})(E.totalTime),at=(E.hourlyRate||0)*Ye,Y=(E.clientHourlyRate||0)*Ye,we=at+(E.travelCost||0)+(E.materialCost||0)+(E.halfDayRate||0)+(E.fullDayRate||0)+(E.monthlyRate||0),J=Y+(E.clientTravelCost||0)+(E.clientMaterialCost||0)+(E.clientHalfDayRate||0)+(E.clientFullDayRate||0)+(E.clientMonthlyRate||0);re(ve=>({...ve,totalAmount:parseFloat(we.toFixed(2)),clientTotalAmount:parseFloat(J.toFixed(2)),taxAmount:0}))},[E.hourlyRate,E.totalTime,E.travelCost,E.materialCost,E.halfDayRate,E.fullDayRate,E.monthlyRate,E.clientHourlyRate,E.clientTravelCost,E.clientMaterialCost,E.clientHalfDayRate,E.clientFullDayRate,E.clientMonthlyRate]);const W=g.filter(Ne=>{const Ye=Ne.name.toLowerCase().includes(A.toLowerCase())||Ne.client.toLowerCase().includes(A.toLowerCase())||Ne.id.toLowerCase().includes(A.toLowerCase()),at=M==="All"||Ne.status===M,Y=ce==="All"||Ne.client===ce,we=H==="All"||Ne.assignedTo===H,J=Ye&&at&&Y&&we;if(L)return J;const ve=["Completed","Rejected","Cancelled"];return ve.includes(M)?J:J&&!ve.includes(Ne.status)}),ae=async Ne=>{const Ye=Ne.target.files;if(!Ye)return;const at=Array.from(Ye).map(async we=>{const J=new FormData;J.append("file",we);try{const ve=await fetch("/api/upload",{method:"POST",body:J});if(!ve.ok)throw new Error("Upload failed");return await ve.json()}catch(ve){return console.error("Upload error:",ve),De.error(`Failed to upload ${we.name}`),null}}),Y=(await Promise.all(at)).filter(we=>we!==null);Y.length>0&&(re(we=>({...we,files:[...we.files||[],...Y]})),De.success(`${Y.length} file(s) uploaded successfully`))},_e=Ne=>{re(Ye=>({...Ye,files:(Ye.files||[]).filter((at,Y)=>Y!==Ne)}))},ue=()=>{if(W.length===0){De.error("No projects to export");return}const at=[["ID","Name","Client","Deadline","Status","Total Amount","Assigned To"].join(","),...W.map(ve=>[`"${ve.id}"`,`"${ve.name}"`,`"${ve.client}"`,`"${ve.deadline}"`,`"${ve.status}"`,ve.totalAmount.toFixed(2),`"${ve.assignedTo||""}"`].join(","))].join(`
`),Y=new Blob([at],{type:"text/csv;charset=utf-8;"}),we=URL.createObjectURL(Y),J=document.createElement("a");J.setAttribute("href",we),J.setAttribute("download",`projects_export_${new Date().toISOString().split("T")[0]}.csv`),J.style.visibility="hidden",document.body.appendChild(J),J.click(),document.body.removeChild(J),De.success("Projects exported successfully")},ke=Ne=>{var Y;const Ye=(Y=Ne.target.files)==null?void 0:Y[0];if(!Ye||P)return;R(!0);const at=new FileReader;at.onload=async we=>{var J;try{const Oe=((J=we.target)==null?void 0:J.result).split(`
`).filter(Ge=>Ge.trim()!=="");if(Oe.length<2){De.error("Invalid CSV file format");return}const xe=[];for(let Ge=1;Ge<Oe.length;Ge++){const Be=Oe[Ge].match(/(".*?"|[^",\s]+)(?=\s*,|\s*$)/g);if(!Be||Be.length<6)continue;const it=Ve=>Ve.replace(/^"|"$/g,"").trim(),st={id:it(Be[0]),name:it(Be[1]),client:it(Be[2]),deadline:it(Be[3]),status:it(Be[4]),totalAmount:parseFloat(it(Be[5]))||0,assignedTo:it(Be[6])||"",issueDate:new Date().toISOString().split("T")[0],team:1};xe.push(st)}if(xe.length===0){De.error("No valid data found in CSV");return}const qe=new Set(g.map(Ge=>Ge.id)),me=xe.filter(Ge=>!qe.has(Ge.id));if(me.length===0)De.info("All records in CSV already exist");else{for(const Ge of me)await t(Ge);De.success(`Successfully imported ${me.length} new projects`)}}catch(ve){console.error("Import error:",ve),De.error("Failed to parse CSV file")}finally{R(!1),Ne.target&&(Ne.target.value="")}},at.readAsText(Ye)},$e=Ne=>{if(!Ne)return"-";try{const Ye=new Date(Ne);return isNaN(Ye.getTime())?Ne:Ye.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})}catch{return Ne}};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Projects"}),i.jsx("p",{className:"text-muted-foreground",children:"Monitor and manage all active and upcoming projects."})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[f("projects.create")&&i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"file",accept:".csv",className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",onChange:ke}),i.jsxs("button",{className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(co,{size:18}),"Import CSV"]})]}),f("projects.export")&&i.jsxs("button",{onClick:ue,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:18}),"Export CSV"]}),f("projects.create")&&i.jsxs("button",{onClick:()=>{Z(null),re({name:"",client:"",deadline:"",issueDate:new Date().toISOString().split("T")[0],team:1,status:"Planning",description:"",currency:"USD",ticketId:"",personName:"",email:"",contactNumber:"",hourlyRate:0,halfDayRate:0,fullDayRate:0,monthlyRate:0,travelCost:0,materialCost:0,totalAmount:0,clientHourlyRate:0,clientHalfDayRate:0,clientFullDayRate:0,clientMonthlyRate:0,clientTravelCost:0,clientMaterialCost:0,clientTotalAmount:0,taxRate:l.vatTaxRate||20,taxAmount:0,assignedTo:"",assignedRole:"",assignedEmail:"",assignedContactNumber:"",timeIn:"",timeOut:"",totalTime:"",completedDate:"",engineerInvoiceStatus:"Unpaid",clientInvoiceStatus:"Unpaid"}),q(!0)},className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors shadow-sm",children:[i.jsx($n,{size:18}),"Create Project"]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[i.jsx(xb,{title:"Total Projects",value:y.total,icon:Ni,colorClass:"bg-blue-500/10 text-blue-500"}),i.jsx(xb,{title:"Active Projects",value:y.active,icon:Ui,colorClass:"bg-orange-500/10 text-orange-500"}),i.jsx(xb,{title:"Completed",value:y.completed,icon:Hl,colorClass:"bg-emerald-500/10 text-emerald-500"}),i.jsx(xb,{title:"Total Value",value:`$${y.totalValue.toLocaleString()}`,icon:ds,colorClass:"bg-primary/10 text-primary"})]}),i.jsx(on,{children:I&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4 overflow-y-auto",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"w-full max-w-4xl rounded-2xl border border-border bg-card shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[i.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:i.jsx(Ni,{size:24})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:se?"Edit Project":"Create New Project"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:se?`Updating project ${se}`:"Define the scope and details of your new venture"})]})]}),i.jsx("button",{onClick:()=>{q(!1),Z(null)},className:"rounded-full p-2 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsx("div",{className:"flex items-center gap-1 p-2 bg-muted/20 border-b border-border overflow-x-auto no-scrollbar",children:[{id:"general",label:"General Info",icon:Tn},{id:"contacts",label:"Contacts",icon:Hn},{id:"financials",label:"Financials",icon:ds},{id:"execution",label:"Execution",icon:h2}].map(Ne=>i.jsxs("button",{onClick:()=>ee(Ne.id),className:tt("flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all whitespace-nowrap",K===Ne.id?"bg-background text-primary shadow-sm border border-border":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[i.jsx(Ne.icon,{size:16}),Ne.label]},Ne.id))}),i.jsx("form",{onSubmit:oe,className:"flex-1 overflow-y-auto p-8 space-y-8",children:i.jsx(on,{mode:"wait",children:i.jsxs(ar.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:{duration:.2},className:"space-y-8",children:[K==="general"&&i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-primary rounded-full"}),"Core Identity"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Project Name *"}),i.jsx("input",{type:"text",placeholder:"e.g. Cloud Migration Alpha",value:E.name||"",onChange:Ne=>re({...E,name:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Company / Client *"}),i.jsxs("select",{value:E.client||"",onChange:Ne=>{const Ye=Ne.target.value,at=a.find(Y=>Y.name===Ye);re(at?{...E,client:Ye,personName:at.contactPerson,email:at.email,contactNumber:at.phone}:{...E,client:Ye})},className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",required:!0,children:[i.jsx("option",{value:"",disabled:!0,children:"Select a client"}),a.map(Ne=>i.jsx("option",{value:Ne.name,children:Ne.name},Ne.id)),i.jsx("option",{value:"Other",children:"Other / New Client"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Project Status"}),i.jsxs("select",{value:E.status||"Planning",onChange:Ne=>re({...E,status:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"Planning",children:"Planning"}),i.jsx("option",{value:"Active",children:"Active"}),i.jsx("option",{value:"Work In Progress",children:"Work In Progress"}),i.jsx("option",{value:"Pending",children:"Pending"}),i.jsx("option",{value:"Scheduled",children:"Scheduled"}),i.jsx("option",{value:"Completed",children:"Completed"}),i.jsx("option",{value:"Cancelled",children:"Cancelled"})]})]})]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-primary rounded-full"}),"Timeline"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Issue Date"}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("input",{type:"date",value:E.issueDate||"",onChange:Ne=>re({...E,issueDate:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"}),E.issueDate&&i.jsx("p",{className:"text-[10px] text-primary font-medium px-1",children:$e(E.issueDate)})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Deadline *"}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("input",{type:"date",value:E.deadline||"",onChange:Ne=>re({...E,deadline:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0}),E.deadline&&i.jsx("p",{className:"text-[10px] text-primary font-medium px-1",children:$e(E.deadline)})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Ticket / Reference ID"}),i.jsxs("div",{className:"relative",children:[i.jsx(_9,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),i.jsx("input",{type:"text",placeholder:"e.g. TIC-12345",value:E.ticketId||"",onChange:Ne=>re({...E,ticketId:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]})]})]})]}),K==="contacts"&&i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-12",children:[i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-blue-500 rounded-full"}),"Client Contact"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Select Client (Auto-fill)"}),i.jsxs("select",{value:E.client||"",onChange:Ne=>{const Ye=Ne.target.value,at=a.find(Y=>Y.name===Ye);re(at?{...E,client:Ye,personName:at.contactPerson,email:at.email,contactNumber:at.phone}:{...E,client:Ye})},className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"",disabled:!0,children:"Choose a client"}),a.map(Ne=>i.jsx("option",{value:Ne.name,children:Ne.name},Ne.id)),i.jsx("option",{value:"Other",children:"Other / New Client"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Point of Contact"}),i.jsx("input",{type:"text",placeholder:"Full Name",value:E.personName||"",onChange:Ne=>re({...E,personName:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Email Address"}),i.jsx("input",{type:"email",placeholder:"client@example.com",value:E.email||"",onChange:Ne=>re({...E,email:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Phone Number"}),i.jsx("input",{type:"tel",placeholder:"+1 (555) 000-0000",value:E.contactNumber||"",onChange:Ne=>re({...E,contactNumber:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-emerald-500 rounded-full"}),"Assigned Member"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Select Engineer"}),i.jsxs("select",{value:E.assignedTo||"",onChange:Ne=>{const Ye=s.find(at=>at.name===Ne.target.value);re({...E,assignedTo:Ne.target.value,assignedRole:(Ye==null?void 0:Ye.role)||E.assignedRole,assignedEmail:(Ye==null?void 0:Ye.email)||E.assignedEmail,assignedContactNumber:(Ye==null?void 0:Ye.phone)||E.assignedContactNumber})},className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"",children:"Unassigned"}),s.map(Ne=>i.jsxs("option",{value:Ne.name,children:[Ne.name," (",Ne.role,")"]},Ne.id))]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Internal Role"}),i.jsx("input",{type:"text",placeholder:"e.g. Lead Engineer",value:E.assignedRole||"",onChange:Ne=>re({...E,assignedRole:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Internal Email"}),i.jsx("input",{type:"email",placeholder:"alex@company.com",value:E.assignedEmail||"",onChange:Ne=>re({...E,assignedEmail:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]})]})]}),K==="financials"&&i.jsxs("div",{className:"space-y-8",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-primary rounded-full"}),"Rate Configuration"]}),i.jsxs("div",{className:"flex items-center gap-3 px-3 py-1.5 rounded-lg bg-muted/50 border border-border",children:[i.jsx("span",{className:"text-xs font-bold text-muted-foreground",children:"Currency:"}),i.jsxs("select",{value:E.currency||"USD",onChange:Ne=>re({...E,currency:Ne.target.value}),className:"bg-card/50 border border-border/50 rounded px-1.5 py-0.5 text-xs font-bold focus:outline-none cursor-pointer text-foreground [&>option]:bg-card [&>option]:text-foreground",children:[!u.some(Ne=>Ne.code==="USD")&&i.jsx("option",{value:"USD",children:"USD"}),!u.some(Ne=>Ne.code==="EUR")&&i.jsx("option",{value:"EUR",children:"EUR"}),!u.some(Ne=>Ne.code==="GBP")&&i.jsx("option",{value:"GBP",children:"GBP"}),!u.some(Ne=>Ne.code==="CAD")&&i.jsx("option",{value:"CAD",children:"CAD"}),u.map(Ne=>i.jsx("option",{value:Ne.code,children:Ne.code},Ne.code))]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12",children:[i.jsx("div",{className:"space-y-6",children:i.jsxs("div",{className:"p-4 rounded-2xl bg-blue-500/5 border border-blue-500/10",children:[i.jsxs("h4",{className:"text-xs font-bold uppercase tracking-wider text-blue-500 mb-4 flex items-center gap-2",children:[i.jsx(zi,{size:14}),"Client Billing Rates"]}),i.jsx("div",{className:"grid grid-cols-2 gap-4",children:[{id:"clientHourlyRate",label:"Hourly"},{id:"clientHalfDayRate",label:"Half-Day"},{id:"clientFullDayRate",label:"Full-Day"},{id:"clientMonthlyRate",label:"Monthly"},{id:"clientTravelCost",label:"Travel"},{id:"clientMaterialCost",label:"Materials"}].map(Ne=>i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground",children:Ne.label}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-xs",children:x(E.currency)}),i.jsx("input",{type:"number",value:E[Ne.id]||0,onChange:Ye=>re({...E,[Ne.id]:parseFloat(Ye.target.value)||0}),className:"h-10 w-full rounded-xl border border-border bg-background pl-8 pr-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]},Ne.id))}),i.jsx("div",{className:"mt-4 pt-4 border-t border-blue-500/10",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-bold text-blue-500",children:"Total Client Value"}),i.jsxs("span",{className:"text-2xl font-black text-blue-600",children:[x(E.currency),(Je=E.clientTotalAmount)==null?void 0:Je.toLocaleString()]})]})})]})}),i.jsx("div",{className:"space-y-6",children:i.jsxs("div",{className:"p-4 rounded-2xl bg-emerald-500/5 border border-emerald-500/10",children:[i.jsxs("h4",{className:"text-xs font-bold uppercase tracking-wider text-emerald-500 mb-4 flex items-center gap-2",children:[i.jsx(ax,{size:14}),"Engineer Payout Rates"]}),i.jsx("div",{className:"grid grid-cols-2 gap-4",children:[{id:"hourlyRate",label:"Hourly"},{id:"halfDayRate",label:"Half-Day"},{id:"fullDayRate",label:"Full-Day"},{id:"monthlyRate",label:"Monthly"},{id:"travelCost",label:"Travel"},{id:"materialCost",label:"Materials"}].map(Ne=>i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground",children:Ne.label}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-xs",children:x(E.currency)}),i.jsx("input",{type:"number",value:E[Ne.id]||0,onChange:Ye=>re({...E,[Ne.id]:parseFloat(Ye.target.value)||0}),className:"h-10 w-full rounded-xl border border-border bg-background pl-8 pr-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]},Ne.id))}),i.jsx("div",{className:"mt-6 pt-4 border-t border-emerald-500/10",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-bold text-emerald-500",children:"Total Engineer Cost"}),i.jsxs("span",{className:"text-xl font-bold text-emerald-500",children:[x(E.currency),(Xe=E.totalAmount)==null?void 0:Xe.toLocaleString()]})]})})]})})]})]}),K==="execution"&&i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-12",children:[i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-orange-500 rounded-full"}),"Work Schedule"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Time In"}),i.jsx("input",{type:"time",value:E.timeIn||"",onChange:Ne=>re({...E,timeIn:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Time Out"}),i.jsx("input",{type:"time",value:E.timeOut||"",onChange:Ne=>re({...E,timeOut:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Total Time"}),i.jsx("input",{type:"text",placeholder:"e.g. 8h 30m",value:E.totalTime||"",readOnly:!0,className:"h-11 w-full rounded-xl border border-border bg-muted/50 px-4 text-sm font-bold text-primary cursor-not-allowed"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Team Size"}),i.jsx("input",{type:"number",min:"1",value:E.team||1,onChange:Ne=>re({...E,team:parseInt(Ne.target.value)||1}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Total Days (for Monthly Assignment)"}),i.jsx("input",{type:"number",min:"0",placeholder:"e.g. 22",value:E.totalDays||"",onChange:Ne=>re({...E,totalDays:parseInt(Ne.target.value)||0}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Completed Date"}),i.jsx("input",{type:"date",value:E.completedDate||"",onChange:Ne=>re({...E,completedDate:Ne.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]})]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-primary rounded-full"}),"Project Scope & Attachments"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Description & Requirements"}),i.jsx("textarea",{placeholder:"Outline the key deliverables and constraints...",value:E.description||"",onChange:Ne=>re({...E,description:Ne.target.value}),className:"min-h-[120px] w-full rounded-xl border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 resize-none"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[i.jsx(O9,{size:16,className:"text-primary"}),"Attachments"]}),i.jsxs("label",{className:"cursor-pointer flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary text-xs font-bold hover:bg-primary/20 transition-all",children:[i.jsx(co,{size:14}),"Upload File",i.jsx("input",{type:"file",multiple:!0,className:"hidden",onChange:ae})]})]}),i.jsx("div",{className:"space-y-2 max-h-[150px] overflow-y-auto pr-2 custom-scrollbar",children:E.files&&E.files.length>0?E.files.map((Ne,Ye)=>i.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-muted/30 border border-border group",children:[i.jsxs("div",{className:"flex items-center gap-3 overflow-hidden",children:[i.jsx("div",{className:"p-1.5 rounded bg-background border border-border text-muted-foreground",children:i.jsx(d2,{size:14})}),i.jsxs("div",{className:"flex flex-col overflow-hidden",children:[i.jsx("span",{className:"text-xs font-medium truncate",children:Ne.name}),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:Ne.size})]})]}),i.jsx("button",{type:"button",onClick:()=>_e(Ye),className:"p-1 text-muted-foreground hover:text-destructive transition-colors opacity-0 group-hover:opacity-100",children:i.jsx(aa,{size:14})})]},Ye)):i.jsxs("div",{className:"flex flex-col items-center justify-center py-6 border-2 border-dashed border-border rounded-xl bg-muted/10",children:[i.jsx(co,{size:24,className:"text-muted-foreground/30 mb-2"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"No files uploaded yet"})]})})]})]})]})]})]},K)})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[i.jsx("div",{className:"flex items-center gap-4",children:i.jsx("div",{className:"flex -space-x-2",children:["general","contacts","financials","execution"].map((Ne,Ye)=>i.jsx("div",{className:tt("h-2 w-8 rounded-full transition-all duration-300",K===Ne?"bg-primary w-12":"bg-muted-foreground/20")},Ne))})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{type:"button",onClick:()=>{q(!1),Z(null)},className:"px-6 py-2.5 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"}),i.jsx("button",{onClick:oe,disabled:P,className:"px-8 py-2.5 bg-primary text-primary-foreground rounded-xl text-sm font-bold hover:bg-primary/90 transition-all shadow-lg shadow-primary/20 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:P?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Processing..."]}):se?"Update Project":"Launch Project"})]})]})]})})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[i.jsxs("div",{className:"relative flex-1 min-w-[300px]",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search projects by name, client or ID...",value:A,onChange:Ne=>T(Ne.target.value),className:"h-10 w-full rounded-lg border border-border bg-card pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"flex items-center gap-2 bg-card border border-border rounded-lg px-3 py-1.5 shadow-sm",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"View All Projects"}),i.jsx("button",{onClick:()=>F(!L),className:tt("relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none",L?"bg-primary":"bg-muted"),children:i.jsx("span",{className:tt("inline-block h-3.5 w-3.5 transform rounded-full bg-background shadow-sm transition-transform",L?"translate-x-5":"translate-x-1")})})]}),i.jsxs("div",{className:"relative",ref:he,children:[i.jsxs("button",{onClick:()=>Ae(!le),className:tt("flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium transition-colors hover:bg-accent",(M!=="All"||ce!=="All"||H!=="All")&&"border-primary text-primary"),children:[i.jsx(Oc,{size:18}),"Filters",(M!=="All"||ce!=="All"||H!=="All")&&i.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:[M,ce,H].filter(Ne=>Ne!=="All").length})]}),le&&i.jsxs("div",{className:"absolute right-0 mt-2 z-50 w-72 rounded-xl border border-border bg-card p-4 shadow-lg animate-in fade-in slide-in-from-top-2 duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h4",{className:"font-bold text-sm",children:"Filter Projects"}),i.jsx("button",{onClick:()=>{B("All"),D("All"),G("All")},className:"text-[10px] font-bold uppercase tracking-wider text-primary hover:underline",children:"Reset"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Status"}),i.jsxs("select",{value:M,onChange:Ne=>B(Ne.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Statuses"}),i.jsx("option",{value:"Planning",children:"Planning"}),i.jsx("option",{value:"Scheduled",children:"Scheduled"}),i.jsx("option",{value:"Work In Progress",children:"Work In Progress"}),i.jsx("option",{value:"Completed",children:"Completed"}),i.jsx("option",{value:"On Hold",children:"On Hold"}),i.jsx("option",{value:"Cancelled",children:"Cancelled"}),i.jsx("option",{value:"Rejected",children:"Rejected"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Client"}),i.jsxs("select",{value:ce,onChange:Ne=>D(Ne.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Clients"}),a.map(Ne=>i.jsx("option",{value:Ne.name,children:Ne.name},Ne.id))]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Assigned To"}),i.jsxs("select",{value:H,onChange:Ne=>G(Ne.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Engineers"}),s.map(Ne=>i.jsx("option",{value:Ne.name,children:Ne.name},Ne.id))]})]})]})]})]})]}),L?i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Project ID"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Project Name"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Client"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Project Status"}),i.jsx("th",{className:"px-4 py-3 font-medium text-center",children:"Team"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Assign"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Role"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Time"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Deadline"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Completed"}),i.jsx("th",{className:"px-4 py-3 font-medium text-right",children:"Actions"})]})}),i.jsxs("tbody",{className:"divide-y divide-border",children:[W.map(Ne=>i.jsxs("tr",{className:"hover:bg-accent/30 transition-colors group",children:[i.jsx("td",{className:"px-4 py-4 font-mono text-xs text-muted-foreground",children:Ne.id}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("p",{className:"font-medium group-hover:text-primary transition-colors",children:Ne.name})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:Ne.client}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("rounded-full px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",Ne.status==="In Progress"?"bg-blue-500/10 text-blue-500":Ne.status==="Completed"?"bg-green-500/10 text-green-500":Ne.status==="Accepted"?"bg-emerald-500/10 text-emerald-500":Ne.status==="Rejected"?"bg-rose-500/10 text-rose-500":"bg-yellow-500/10 text-yellow-500"),children:Ne.status})}),i.jsx("td",{className:"px-4 py-4 text-center text-muted-foreground",children:Ne.team}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold text-[10px]",children:Ne.assignedTo?Ne.assignedTo.split(" ").map(Ye=>Ye[0]).join(""):"?"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:Ne.assignedTo||"Unassigned"})]})}),i.jsx("td",{className:"px-4 py-4 text-xs text-muted-foreground",children:Ne.assignedRole||"-"}),i.jsx("td",{className:"px-4 py-4",children:Ne.totalTime?i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs font-bold text-primary",children:Ne.totalTime}),i.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[Ne.timeIn," - ",Ne.timeOut]})]}):i.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Not set"})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:$e(Ne.deadline)}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:$e(Ne.completedDate)}),i.jsx("td",{className:"px-4 py-4 text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[f("projects.edit")&&i.jsx("button",{onClick:()=>z(Ne),className:"p-1 hover:bg-accent rounded-md text-muted-foreground transition-colors",title:"Edit Project",children:i.jsx(Tn,{size:16})}),f("projects.delete")&&i.jsx("button",{disabled:P,onClick:()=>fe(Ne.id),className:"p-1 hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50",title:"Delete Project",children:i.jsx(aa,{size:16})})]})})]},Ne.id)),W.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:7,className:"py-12 text-center text-muted-foreground",children:"No projects found matching your search."})})]})]})})}):i.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-3",children:[W.map(Ne=>i.jsxs("div",{className:"group rounded-xl border border-border bg-card p-6 shadow-sm transition-all hover:border-primary/50 hover:shadow-md",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("span",{className:tt("rounded-full px-2 py-1 text-[10px] font-bold uppercase tracking-wider",Ne.status==="In Progress"?"bg-blue-500/10 text-blue-500":Ne.status==="Completed"?"bg-green-500/10 text-green-500":Ne.status==="Accepted"?"bg-emerald-500/10 text-emerald-500":Ne.status==="Rejected"?"bg-rose-500/10 text-rose-500":"bg-yellow-500/10 text-yellow-500"),children:Ne.status}),i.jsxs("div",{className:"flex items-center gap-1",children:[f("projects.edit")&&i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>X(ne===Ne.id?null:Ne.id),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium hover:bg-accent text-muted-foreground transition-colors",title:"Change Project Status",children:["Project Status",i.jsx(Nv,{size:14,className:tt("transition-transform",ne===Ne.id&&"rotate-180")})]}),ne===Ne.id&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>X(null)}),i.jsxs("div",{className:"absolute right-0 top-full mt-1 w-32 rounded-lg border border-border bg-card p-1 shadow-lg z-20 animate-in fade-in zoom-in duration-200",children:[i.jsxs("button",{disabled:P,onClick:()=>de(Ne.id,"Accepted"),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs hover:bg-emerald-500/10 hover:text-emerald-500 transition-colors disabled:opacity-50",children:[i.jsx(ph,{size:14}),"Accept"]}),i.jsxs("button",{disabled:P,onClick:()=>de(Ne.id,"Rejected"),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs hover:bg-rose-500/10 hover:text-rose-500 transition-colors disabled:opacity-50",children:[i.jsx(xr,{size:14}),"Reject"]})]})]})]}),f("projects.edit")&&i.jsx("button",{onClick:()=>z(Ne),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",title:"Edit Project",children:i.jsx(Tn,{size:16})}),f("projects.delete")&&i.jsx("button",{disabled:P,onClick:()=>fe(Ne.id),className:"rounded-md p-1 hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50",title:"Delete Project",children:i.jsx(aa,{size:16})})]})]}),i.jsxs("div",{className:"flex items-start justify-between mb-1",children:[i.jsx("h3",{className:"text-lg font-bold group-hover:text-primary transition-colors leading-tight",children:Ne.name}),i.jsx("span",{className:"text-[10px] font-mono text-muted-foreground bg-muted px-1.5 py-0.5 rounded shrink-0 ml-2",children:Ne.id})]}),i.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:["Client: ",Ne.client]}),i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold text-[10px]",children:Ne.assignedTo?Ne.assignedTo.split(" ").map(Ye=>Ye[0]).join(""):"?"}),i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assigned to: ",i.jsx("span",{className:"font-medium text-foreground",children:Ne.assignedTo||"Unassigned"})]}),Ne.assignedRole&&i.jsx("span",{className:"text-[10px] text-primary font-medium",children:Ne.assignedRole})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"py-3 border-t border-border/50",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Tasks"}),i.jsxs("span",{className:"text-[10px] font-medium text-primary",children:[o.filter(Ye=>Ye.projectId===Ne.id&&Ye.status==="Completed").length,"/",o.filter(Ye=>Ye.projectId===Ne.id).length," Done"]})]}),i.jsx("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:i.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${o.filter(Ye=>Ye.projectId===Ne.id).length>0?o.filter(Ye=>Ye.projectId===Ne.id&&Ye.status==="Completed").length/o.filter(Ye=>Ye.projectId===Ne.id).length*100:0}%`}})})]}),(Ne.hourlyRate>0||Ne.halfDayRate>0||Ne.fullDayRate>0||Ne.monthlyRate>0||Ne.travelCost>0||Ne.materialCost>0)&&i.jsxs("div",{className:"grid grid-cols-2 gap-y-1.5 gap-x-4 py-3 border-t border-border/50",children:[Ne.hourlyRate>0&&i.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[i.jsx("span",{className:"text-muted-foreground uppercase font-semibold",children:"Hourly"}),i.jsxs("span",{className:"font-bold text-primary",children:[x(Ne.currency),Ne.hourlyRate]})]}),Ne.halfDayRate>0&&i.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[i.jsx("span",{className:"text-muted-foreground uppercase font-semibold",children:"Half-Day"}),i.jsxs("span",{className:"font-bold text-primary",children:[x(Ne.currency),Ne.halfDayRate]})]}),Ne.fullDayRate>0&&i.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[i.jsx("span",{className:"text-muted-foreground uppercase font-semibold",children:"Full-Day"}),i.jsxs("span",{className:"font-bold text-primary",children:[x(Ne.currency),Ne.fullDayRate]})]}),Ne.monthlyRate>0&&i.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[i.jsx("span",{className:"text-muted-foreground uppercase font-semibold",children:"Monthly"}),i.jsxs("span",{className:"font-bold text-primary",children:[x(Ne.currency),Ne.monthlyRate]})]}),Ne.travelCost>0&&i.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[i.jsx("span",{className:"text-muted-foreground uppercase font-semibold",children:"Travel"}),i.jsxs("span",{className:"font-bold text-primary",children:[x(Ne.currency),Ne.travelCost]})]}),Ne.materialCost>0&&i.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[i.jsx("span",{className:"text-muted-foreground uppercase font-semibold",children:"Material"}),i.jsxs("span",{className:"font-bold text-primary",children:[x(Ne.currency),Ne.materialCost]})]}),Ne.totalAmount>0&&i.jsxs("div",{className:"flex items-center justify-between text-[10px] pt-1 border-t border-border/30 mt-1 col-span-2",children:[i.jsx("span",{className:"text-primary uppercase font-bold",children:"Total Amount"}),i.jsxs("span",{className:"font-extrabold text-primary text-xs",children:[x(Ne.currency),Ne.totalAmount.toLocaleString()]})]})]}),i.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[i.jsx(Hn,{size:14}),Ne.team]}),i.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[i.jsx(Lo,{size:14}),$e(Ne.deadline)]}),Ne.completedDate&&i.jsxs("div",{className:"flex items-center gap-1 text-xs text-emerald-500 font-medium",children:[i.jsx(Hl,{size:14}),$e(Ne.completedDate)]})]}),Ne.totalTime&&i.jsxs("div",{className:"flex items-center gap-1 text-xs font-bold text-primary",children:[i.jsx(h2,{size:14}),Ne.totalTime]})]})]})]},Ne.id)),W.length===0&&i.jsx("div",{className:"col-span-full py-12 text-center text-muted-foreground",children:"No projects found matching your search."})]})]})}function xb({title:e,value:t,icon:r,colorClass:n}){return i.jsx(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"rounded-xl border border-border bg-card p-6 shadow-sm hover:shadow-md transition-all",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:tt("p-3 rounded-lg",n),children:i.jsx(r,{size:24})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:e}),i.jsx("h3",{className:"text-2xl font-bold tracking-tight",children:t})]})]})})}function Q3e(){const{profile:e}=la(),[t,r]=N.useState("profile"),[n,a]=N.useState(!1),s=()=>{a(!0),setTimeout(()=>{a(!1),De.success("Settings updated successfully")},1e3)};return i.jsxs("div",{className:"max-w-5xl mx-auto space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"User Profile Settings"}),i.jsx("p",{className:"text-muted-foreground",children:"Manage your personal information, security, and preferences."})]}),i.jsx("button",{onClick:s,disabled:n,className:"flex items-center gap-2 rounded-lg bg-primary px-6 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-all disabled:opacity-50",children:n?"Saving...":i.jsxs(i.Fragment,{children:[i.jsx(b3,{size:18})," Save Changes"]})})]}),i.jsxs("div",{className:"grid gap-6 md:grid-cols-[240px_1fr]",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx(gb,{active:t==="profile",onClick:()=>r("profile"),icon:ls,label:"Basic Info"}),i.jsx(gb,{active:t==="security",onClick:()=>r("security"),icon:yh,label:"Security & Password"}),i.jsx(gb,{active:t==="notifications",onClick:()=>r("notifications"),icon:c2,label:"Notification Prefs"}),i.jsx(gb,{active:t==="activity",onClick:()=>r("activity"),icon:Ck,label:"Activity Logs"})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[t==="profile"&&i.jsx(eAe,{}),t==="security"&&i.jsx(tAe,{}),t==="notifications"&&i.jsx(rAe,{}),t==="activity"&&i.jsx(nAe,{})]})]})]})}function gb({active:e,onClick:t,icon:r,label:n}){return i.jsxs("button",{onClick:t,className:tt("flex items-center gap-3 rounded-lg px-4 py-2.5 text-sm font-medium transition-all",e?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[i.jsx(r,{size:18}),n]})}function eAe(){const{profile:e}=la(),t=e!=null&&e.name?e.name.split(" ").map(r=>r[0]).join(""):"JD";return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center gap-6 pb-6 border-b border-border",children:[i.jsxs("div",{className:"relative group",children:[i.jsx("div",{className:"h-24 w-24 rounded-full bg-primary/10 flex items-center justify-center text-primary text-3xl font-bold border-2 border-border overflow-hidden",children:e!=null&&e.photoURL?i.jsx("img",{src:e.photoURL,alt:e.name,className:"h-full w-full object-cover",referrerPolicy:"no-referrer"}):t}),i.jsx("button",{className:"absolute inset-0 flex items-center justify-center bg-black/40 text-white opacity-0 group-hover:opacity-100 transition-opacity rounded-full",children:i.jsx(A9,{size:24})})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold",children:"Profile Picture"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"JPG, GIF or PNG. Max size of 2MB."}),i.jsxs("div",{className:"mt-2 flex gap-2",children:[i.jsx("button",{className:"text-xs font-medium text-primary hover:underline",children:"Upload New"}),i.jsx("button",{className:"text-xs font-medium text-destructive hover:underline",children:"Remove"})]})]})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Full Name"}),i.jsx("input",{type:"text",defaultValue:(e==null?void 0:e.name)||"",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Role"}),i.jsx("input",{type:"text",defaultValue:(e==null?void 0:e.role)||"",disabled:!0,className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-muted-foreground cursor-not-allowed"})]}),i.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Email Address"}),i.jsxs("div",{className:"relative",children:[i.jsx(Gl,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),i.jsx("input",{type:"email",defaultValue:(e==null?void 0:e.email)||"",className:"w-full rounded-lg border border-border bg-background pl-10 pr-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]})]})]})}function tAe(){const{profile:e}=la(),[t,r]=N.useState(""),[n,a]=N.useState(""),[s,o]=N.useState(""),[l,u]=N.useState(!1),d=async()=>{if(!t||!n||!s){De.error("Please fill in all password fields");return}if(n!==s){De.error("New passwords do not match");return}if(n.length<6){De.error("Password must be at least 6 characters");return}u(!0);try{const f=await Bt.getUser();f&&f.username==="admin"?De.success("Password updated successfully (Server)"):De.success("Password updated successfully"),r(""),a(""),o("")}catch(f){console.error(f),De.error("Failed to update password. Please try again.")}finally{u(!1)}};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[i.jsx(yh,{size:20,className:"text-primary"}),"Change Password"]}),i.jsxs("div",{className:"grid gap-4 max-w-md",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Current Password"}),i.jsx("input",{type:"password",value:t,onChange:f=>r(f.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"New Password"}),i.jsx("input",{type:"password",value:n,onChange:f=>a(f.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Confirm New Password"}),i.jsx("input",{type:"password",value:s,onChange:f=>o(f.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsx("button",{onClick:d,disabled:l,className:"w-fit rounded-lg bg-primary text-primary-foreground px-4 py-2 text-sm font-medium hover:bg-primary/90 transition-colors disabled:opacity-50",children:l?"Updating...":"Update Password"})]})]}),i.jsxs("div",{className:"pt-6 border-t border-border space-y-4",children:[i.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[i.jsx(Pu,{size:20,className:"text-primary"}),"Two-Factor Authentication"]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border border-border bg-accent/30",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(ute,{size:20})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:"Authenticator App"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Use an app like Google Authenticator or Authy."})]})]}),i.jsx("button",{className:"text-sm font-medium text-primary hover:underline",children:"Setup"})]})]})]})}function rAe(){return i.jsxs("div",{className:"space-y-6",children:[i.jsx("h3",{className:"text-lg font-semibold",children:"Notification Preferences"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(vb,{title:"Email Notifications",description:"Receive daily summaries and critical alerts via email.",defaultChecked:!0}),i.jsx(vb,{title:"Push Notifications",description:"Get real-time updates on your desktop or mobile device.",defaultChecked:!0}),i.jsx(vb,{title:"Project Updates",description:"Notifications for tasks assigned to you or your projects.",defaultChecked:!0}),i.jsx(vb,{title:"Marketing & News",description:"Occasional updates about new features and company news.",defaultChecked:!1})]})]})}function vb({title:e,description:t,defaultChecked:r}){const[n,a]=N.useState(r);return i.jsxs("div",{className:"flex items-start justify-between p-4 rounded-lg border border-border bg-accent/10",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx("p",{className:"text-sm font-medium",children:e}),i.jsx("p",{className:"text-xs text-muted-foreground max-w-md",children:t})]}),i.jsx("button",{onClick:()=>a(!n),className:tt("relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none",n?"bg-primary":"bg-muted"),children:i.jsx("span",{className:tt("pointer-events-none inline-block h-5 w-5 transform rounded-full bg-background shadow ring-0 transition duration-200 ease-in-out",n?"translate-x-5":"translate-x-0")})})]})}function nAe(){const e=[{id:1,action:"Logged in from New Device",location:"San Francisco, CA",time:"10 mins ago",icon:Km},{id:2,action:"Password Changed",location:"Account Settings",time:"2 days ago",icon:yh},{id:3,action:"Updated Profile Picture",location:"Basic Info",time:"1 week ago",icon:A9},{id:4,action:"Enabled 2FA",location:"Security Settings",time:"2 weeks ago",icon:Pu}];return i.jsxs("div",{className:"space-y-6",children:[i.jsx("h3",{className:"text-lg font-semibold",children:"Recent Activity"}),i.jsx("div",{className:"space-y-4",children:e.map(t=>i.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg hover:bg-accent/50 transition-colors",children:[i.jsx("div",{className:"h-10 w-10 rounded-full bg-accent flex items-center justify-center text-muted-foreground",children:i.jsx(t.icon,{size:18})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-sm font-medium",children:t.action}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.location," • ",t.time]})]}),i.jsx("button",{className:"text-xs font-medium text-muted-foreground hover:text-primary",children:"Details"})]},t.id))}),i.jsx("button",{className:"w-full py-2 text-sm font-medium text-muted-foreground hover:text-primary border border-dashed border-border rounded-lg transition-colors",children:"View Full History"})]})}function aAe(){var st,Ve;const{projects:e,updateProject:t,deleteProject:r,tasks:n,addTask:a,updateTask:s,deleteTask:o,clients:l,engineers:u,currencies:d}=ca(),{profile:f,hasPermission:m}=la(),g=N.useMemo(()=>f?m("tasks.view_all")||m("projects.view_all")||f.uid==="admin-123":!1,[f,m]),x=N.useMemo(()=>g?e:e.filter(te=>te.assignedTo===(f==null?void 0:f.name)||te.assignedEmail===(f==null?void 0:f.email)||te.assignedRole===(f==null?void 0:f.role)),[e,g,f]),y=N.useMemo(()=>g?n:n.filter(te=>te.assignee===(f==null?void 0:f.name)||te.assignee===(f==null?void 0:f.email)),[n,g,f]),v=te=>{if(!te)return"$";const Ue=d.find(ot=>ot.code===te);return Ue?Ue.symbol:"$"},[w,j]=sf(),[k,A]=N.useState("");N.useEffect(()=>{if(w.get("create")==="true"){ue(!0);const Ue=new URLSearchParams(w);Ue.delete("create"),j(Ue,{replace:!0})}},[w,j]);const[T,M]=N.useState("timesheets"),[B,L]=N.useState("general"),[F,I]=N.useState(!1),[q,P]=N.useState(!1),[R,K]=N.useState(!1),[ee,se]=N.useState(!1),[Z,ne]=N.useState("All"),[X,le]=N.useState("All"),[Ae,ce]=N.useState("All"),[D,H]=N.useState("All"),[G,E]=N.useState(!1),[re,he]=N.useState(null),[oe,z]=N.useState({name:"",client:"",deadline:"",team:1,status:"Planning",description:"",currency:"USD",ticketId:"",personName:"",email:"",contactNumber:"",hourlyRate:0,halfDayRate:0,fullDayRate:0,monthlyRate:0,travelCost:0,materialCost:0,totalAmount:0,clientHourlyRate:0,clientHalfDayRate:0,clientFullDayRate:0,clientMonthlyRate:0,clientTravelCost:0,clientMaterialCost:0,clientTotalAmount:0,assignedTo:"",assignedRole:"",assignedEmail:"",assignedContactNumber:"",timeIn:"",timeOut:"",totalTime:"",completedDate:"",files:[]}),[fe,de]=N.useState(!1),[W,ae]=N.useState(null),[_e,ue]=N.useState(!1),[ke,$e]=N.useState(null),[Je,Xe]=N.useState({title:"",projectId:"",status:"To Do",dueDate:new Date().toISOString().split("T")[0],assignee:"",timeLogged:"",approvalStatus:"Pending"}),Ne=te=>{ae(te),de(!0)},Ye=async()=>{if(W&&!ee){se(!0);try{await r(W.id),De.success("Project and associated data deleted successfully"),de(!1),ae(null)}catch(te){console.error("Delete project error:",te)}finally{se(!1)}}},at=te=>{he(te.id),z({...te}),E(!0)},Y=async te=>{if(te.preventDefault(),re&&!ee){se(!0);try{await t(re,oe),De.success("Project data updated successfully"),E(!1),he(null)}catch(Ue){console.error("Update project error:",Ue)}finally{se(!1)}}},we=async te=>{if(te.preventDefault(),!ee){if(!Je.title||!Je.projectId){De.error("Please fill in all required fields");return}se(!0);try{ke?(await s(ke,Je),De.success("Task updated successfully")):(await a({...Je,id:`TASK-${Date.now()}`}),De.success("Task created successfully")),ue(!1),$e(null),Xe({title:"",projectId:"",status:"To Do",dueDate:new Date().toISOString().split("T")[0],approvalStatus:"Pending",timeLogged:""})}catch(Ue){console.error("Task save error:",Ue)}finally{se(!1)}}},J=()=>{const te=x.flatMap(Dt=>Dt.tasks||[]);if(te.length===0){De.error("No tasks to export");return}const vt=[["ID","Title","Project","Status","Due Date","Assignee","Time Logged"].join(","),...te.map(Dt=>{var Rt;return[`"${Dt.id}"`,`"${Dt.title}"`,`"${((Rt=x.find(wr=>wr.id===Dt.projectId))==null?void 0:Rt.name)||Dt.projectId}"`,`"${Dt.status}"`,`"${Dt.dueDate}"`,`"${Dt.assignee||""}"`,`"${Dt.timeLogged||""}"`].join(",")})].join(`
`),_t=new Blob([vt],{type:"text/csv;charset=utf-8;"}),qt=URL.createObjectURL(_t),Ft=document.createElement("a");Ft.setAttribute("href",qt),Ft.setAttribute("download",`tasks_export_${new Date().toISOString().split("T")[0]}.csv`),Ft.style.visibility="hidden",document.body.appendChild(Ft),Ft.click(),document.body.removeChild(Ft),De.success("Tasks exported successfully")},ve=te=>{var vt;const Ue=(vt=te.target.files)==null?void 0:vt[0];if(!Ue||ee)return;se(!0);const ot=new FileReader;ot.onload=async _t=>{var qt;try{const Dt=((qt=_t.target)==null?void 0:qt.result).split(`
`).filter(gr=>gr.trim()!=="");if(Dt.length<2){De.error("Invalid CSV file format");return}const Rt=[];for(let gr=1;gr<Dt.length;gr++){const Er=Dt[gr].match(/(".*?"|[^",\s]+)(?=\s*,|\s*$)/g);if(!Er||Er.length<6)continue;const Ur=kr=>kr.replace(/^"|"$/g,"").trim(),Ht=Ur(Er[2]),It=x.find(kr=>kr.name===Ht||kr.id===Ht);if(!It)continue;const Rr={id:Ur(Er[0]),title:Ur(Er[1]),projectId:It.id,status:Ur(Er[3]),dueDate:Ur(Er[4]),assignee:Ur(Er[5]),timeLogged:Ur(Er[6])||"",approvalStatus:"Pending"};Rt.push(Rr)}if(Rt.length===0){De.error("No valid tasks found (ensure project names match)");return}let wr=0;for(const gr of Rt){const Er=x.find(Ur=>Ur.id===gr.projectId);if(Er){const Ur=Er.tasks||[];Ur.some(Ht=>Ht.id===gr.id)||(await t(Er.id,{tasks:[...Ur,gr]}),wr++)}}wr===0?De.info("All tasks in CSV already exist"):De.success(`Successfully imported ${wr} new tasks`)}catch(Ft){console.error("Import error:",Ft),De.error("Failed to parse CSV file")}finally{se(!1),te.target&&(te.target.value="")}},ot.readAsText(Ue)},Oe=te=>{const Ue=x.find(ot=>ot.id===te.projectId);$e(te.id),Xe({...te,timeLogged:(Ue==null?void 0:Ue.totalTime)||te.timeLogged}),ue(!0)};N.useEffect(()=>{if(oe.timeIn&&oe.timeOut){const[te,Ue]=oe.timeIn.split(":").map(Number),[ot,vt]=oe.timeOut.split(":").map(Number);let _t=ot*60+vt-(te*60+Ue);_t<0&&(_t+=1440);const qt=oe.totalDays&&oe.totalDays>0?oe.totalDays:1,Ft=_t*qt,Dt=Math.floor(Ft/60),Rt=Ft%60;z(wr=>({...wr,totalTime:`${Dt}h ${Rt}m`}))}},[oe.timeIn,oe.timeOut,oe.totalDays]),N.useEffect(()=>{const Ue=(Ft=>{if(!Ft)return 0;const Dt=Ft.match(/(\d+)h/),Rt=Ft.match(/(\d+)m/),wr=Dt?parseInt(Dt[1]):0,gr=Rt?parseInt(Rt[1]):0;return wr+gr/60})(oe.totalTime),ot=(oe.hourlyRate||0)*Ue,vt=(oe.clientHourlyRate||0)*Ue,_t=ot+(oe.travelCost||0)+(oe.materialCost||0)+(oe.halfDayRate||0)+(oe.fullDayRate||0)+(oe.monthlyRate||0),qt=vt+(oe.clientTravelCost||0)+(oe.clientMaterialCost||0)+(oe.clientHalfDayRate||0)+(oe.clientFullDayRate||0)+(oe.clientMonthlyRate||0);z(Ft=>({...Ft,totalAmount:parseFloat(_t.toFixed(2)),clientTotalAmount:parseFloat(qt.toFixed(2))}))},[oe.hourlyRate,oe.totalTime,oe.travelCost,oe.materialCost,oe.halfDayRate,oe.fullDayRate,oe.monthlyRate,oe.clientHourlyRate,oe.clientTravelCost,oe.clientMaterialCost,oe.clientHalfDayRate,oe.clientFullDayRate,oe.clientMonthlyRate]);const xe=te=>x.find(Ue=>Ue.id===te),qe=te=>{if(!te)return"-";try{const Ue=new Date(te);return isNaN(Ue.getTime())?te:Ue.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})}catch{return te}},me=x.filter(te=>{const Ue=te.name.toLowerCase().includes(k.toLowerCase())||te.client.toLowerCase().includes(k.toLowerCase())||te.id.toLowerCase().includes(k.toLowerCase())||te.assignedTo&&te.assignedTo.toLowerCase().includes(k.toLowerCase()),ot=Z==="All"||te.status===Z,vt=Ae==="All"||te.client===Ae;return F?Ue&&ot&&vt:Ue&&ot&&vt&&!["Completed","Rejected","Cancelled"].includes(te.status)}),Ge=y.filter(te=>{const Ue=x.find(qt=>qt.id===te.projectId),ot=te.title.toLowerCase().includes(k.toLowerCase())||Ue&&Ue.name.toLowerCase().includes(k.toLowerCase())||te.assignee&&te.assignee.toLowerCase().includes(k.toLowerCase()),vt=X==="All"||te.status===X,_t=D==="All"||te.projectId===D;return ot&&vt&&_t}),Be=async te=>{const Ue=te.target.files;if(!Ue)return;const ot=Array.from(Ue).map(async _t=>{const qt=new FormData;qt.append("file",_t);try{const Ft=await fetch("/api/upload",{method:"POST",body:qt});if(!Ft.ok)throw new Error("Upload failed");return await Ft.json()}catch(Ft){return console.error("Upload error:",Ft),De.error(`Failed to upload ${_t.name}`),null}}),vt=(await Promise.all(ot)).filter(_t=>_t!==null);vt.length>0&&(z(_t=>({..._t,files:[..._t.files||[],...vt]})),De.success(`${vt.length} file(s) uploaded successfully`))},it=te=>{z(Ue=>({...Ue,files:(Ue.files||[]).filter((ot,vt)=>vt!==te)}))};return i.jsxs("div",{className:"space-y-6",children:[i.jsx(on,{children:G&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4 overflow-y-auto",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"w-full max-w-4xl rounded-2xl border border-border bg-card shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[i.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:i.jsx(AN,{size:24})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Project Data"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Update details for project associated with this task."})]})]}),i.jsx("button",{onClick:()=>{E(!1),he(null)},className:"rounded-full p-2 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsx("div",{className:"flex items-center gap-1 p-2 bg-muted/20 border-b border-border overflow-x-auto no-scrollbar",children:[{id:"general",label:"General Info",icon:Tn},{id:"contacts",label:"Contacts",icon:Hn},{id:"financials",label:"Financials",icon:ds},{id:"execution",label:"Execution",icon:h2}].map(te=>i.jsxs("button",{onClick:()=>L(te.id),className:tt("flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all whitespace-nowrap",B===te.id?"bg-background text-primary shadow-sm border border-border":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[i.jsx(te.icon,{size:16}),te.label]},te.id))}),i.jsx("form",{onSubmit:Y,className:"flex-1 overflow-y-auto p-8 space-y-8",children:i.jsx(on,{mode:"wait",children:i.jsxs(ar.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:{duration:.2},className:"space-y-8",children:[B==="general"&&i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-primary rounded-full"}),"Core Identity"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Project Name *"}),i.jsx("input",{type:"text",placeholder:"e.g. Cloud Migration Alpha",value:oe.name||"",onChange:te=>z({...oe,name:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Company / Client *"}),i.jsxs("select",{value:oe.client||"",onChange:te=>{const Ue=te.target.value,ot=l.find(vt=>vt.name===Ue);z(ot?{...oe,client:Ue,personName:ot.contactPerson,email:ot.email,contactNumber:ot.phone}:{...oe,client:Ue})},className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",required:!0,children:[i.jsx("option",{value:"",disabled:!0,children:"Select a client"}),l.map(te=>i.jsx("option",{value:te.name,children:te.name},te.id)),i.jsx("option",{value:"Other",children:"Other / New Client"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Project Status"}),i.jsxs("select",{value:oe.status||"Planning",onChange:te=>{const Ue=te.target.value,ot={status:Ue};["Completed","Accepted","Rejected"].includes(Ue)&&!oe.completedDate&&(ot.completedDate=new Date().toISOString().split("T")[0]),z({...oe,...ot})},className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"Planning",children:"Planning"}),i.jsx("option",{value:"Active",children:"Active"}),i.jsx("option",{value:"Work In Progress",children:"Work In Progress"}),i.jsx("option",{value:"Pending",children:"Pending"}),i.jsx("option",{value:"Scheduled",children:"Scheduled"}),i.jsx("option",{value:"Completed",children:"Completed"}),i.jsx("option",{value:"Cancelled",children:"Cancelled"}),i.jsx("option",{value:"Accepted",children:"Accepted"}),i.jsx("option",{value:"Rejected",children:"Rejected"})]})]})]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-primary rounded-full"}),"Timeline"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Deadline *"}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("input",{type:"date",value:oe.deadline||"",onChange:te=>z({...oe,deadline:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0}),oe.deadline&&i.jsx("p",{className:"text-[10px] text-primary font-medium px-1",children:qe(oe.deadline)})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Completed Date"}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("input",{type:"date",value:oe.completedDate||"",onChange:te=>z({...oe,completedDate:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"}),oe.completedDate&&i.jsx("p",{className:"text-[10px] text-primary font-medium px-1",children:qe(oe.completedDate)})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Ticket / Reference ID"}),i.jsxs("div",{className:"relative",children:[i.jsx(_9,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),i.jsx("input",{type:"text",placeholder:"e.g. TIC-12345",value:oe.ticketId||"",onChange:te=>z({...oe,ticketId:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]})]})]})]}),B==="contacts"&&i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-12",children:[i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-blue-500 rounded-full"}),"Client Contact"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Select Client (Auto-fill)"}),i.jsxs("select",{value:oe.client||"",onChange:te=>{const Ue=te.target.value,ot=l.find(vt=>vt.name===Ue);z(ot?{...oe,client:Ue,personName:ot.contactPerson,email:ot.email,contactNumber:ot.phone}:{...oe,client:Ue})},className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"",disabled:!0,children:"Choose a client"}),l.map(te=>i.jsx("option",{value:te.name,children:te.name},te.id)),i.jsx("option",{value:"Other",children:"Other / New Client"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Point of Contact"}),i.jsx("input",{type:"text",placeholder:"Full Name",value:oe.personName||"",onChange:te=>z({...oe,personName:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Email Address"}),i.jsx("input",{type:"email",placeholder:"client@example.com",value:oe.email||"",onChange:te=>z({...oe,email:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Phone Number"}),i.jsx("input",{type:"tel",placeholder:"+1 (555) 000-0000",value:oe.contactNumber||"",onChange:te=>z({...oe,contactNumber:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-emerald-500 rounded-full"}),"Assigned Member"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Select Engineer"}),i.jsxs("select",{value:oe.assignedTo||"",onChange:te=>{const Ue=u.find(ot=>ot.name===te.target.value);z({...oe,assignedTo:te.target.value,assignedRole:(Ue==null?void 0:Ue.role)||oe.assignedRole,assignedEmail:(Ue==null?void 0:Ue.email)||oe.assignedEmail,assignedContactNumber:(Ue==null?void 0:Ue.phone)||oe.assignedContactNumber})},className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"",children:"Unassigned"}),u.map(te=>i.jsxs("option",{value:te.name,children:[te.name," (",te.role,")"]},te.id))]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Internal Role"}),i.jsx("input",{type:"text",placeholder:"e.g. Lead Engineer",value:oe.assignedRole||"",onChange:te=>z({...oe,assignedRole:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Internal Email"}),i.jsx("input",{type:"email",placeholder:"alex@company.com",value:oe.assignedEmail||"",onChange:te=>z({...oe,assignedEmail:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]})]})]}),B==="financials"&&i.jsxs("div",{className:"space-y-8",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-primary rounded-full"}),"Rate Configuration"]}),i.jsxs("div",{className:"flex items-center gap-3 px-3 py-1.5 rounded-lg bg-muted/50 border border-border",children:[i.jsx("span",{className:"text-xs font-bold text-muted-foreground",children:"Currency:"}),i.jsxs("select",{value:oe.currency||"USD",onChange:te=>z({...oe,currency:te.target.value}),className:"bg-transparent text-xs font-bold focus:outline-none cursor-pointer",children:[!d.some(te=>te.code==="USD")&&i.jsx("option",{value:"USD",children:"USD"}),!d.some(te=>te.code==="EUR")&&i.jsx("option",{value:"EUR",children:"EUR"}),!d.some(te=>te.code==="GBP")&&i.jsx("option",{value:"GBP",children:"GBP"}),!d.some(te=>te.code==="CAD")&&i.jsx("option",{value:"CAD",children:"CAD"}),d.map(te=>i.jsx("option",{value:te.code,children:te.code},te.code))]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12",children:[i.jsx("div",{className:"space-y-6",children:i.jsxs("div",{className:"p-4 rounded-2xl bg-blue-500/5 border border-blue-500/10",children:[i.jsxs("h4",{className:"text-xs font-bold uppercase tracking-wider text-blue-500 mb-4 flex items-center gap-2",children:[i.jsx(zi,{size:14}),"Client Billing Rates"]}),i.jsx("div",{className:"grid grid-cols-2 gap-4",children:[{id:"clientHourlyRate",label:"Hourly"},{id:"clientHalfDayRate",label:"Half-Day"},{id:"clientFullDayRate",label:"Full-Day"},{id:"clientMonthlyRate",label:"Monthly"},{id:"clientTravelCost",label:"Travel"},{id:"clientMaterialCost",label:"Materials"}].map(te=>i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground",children:te.label}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-xs",children:v(oe.currency)}),i.jsx("input",{type:"number",value:oe[te.id]||0,onChange:Ue=>z({...oe,[te.id]:parseFloat(Ue.target.value)||0}),className:"h-10 w-full rounded-xl border border-border bg-background pl-8 pr-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]},te.id))}),i.jsx("div",{className:"mt-6 pt-4 border-t border-blue-500/10",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-bold text-blue-500",children:"Total Client Value"}),i.jsxs("span",{className:"text-xl font-bold text-blue-500",children:[v(oe.currency),(st=oe.clientTotalAmount)==null?void 0:st.toLocaleString()]})]})})]})}),i.jsx("div",{className:"space-y-6",children:i.jsxs("div",{className:"p-4 rounded-2xl bg-emerald-500/5 border border-emerald-500/10",children:[i.jsxs("h4",{className:"text-xs font-bold uppercase tracking-wider text-emerald-500 mb-4 flex items-center gap-2",children:[i.jsx(ax,{size:14}),"Engineer Payout Rates"]}),i.jsx("div",{className:"grid grid-cols-2 gap-4",children:[{id:"hourlyRate",label:"Hourly"},{id:"halfDayRate",label:"Half-Day"},{id:"fullDayRate",label:"Full-Day"},{id:"monthlyRate",label:"Monthly"},{id:"travelCost",label:"Travel"},{id:"materialCost",label:"Materials"}].map(te=>i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground",children:te.label}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-xs",children:v(oe.currency)}),i.jsx("input",{type:"number",value:oe[te.id]||0,onChange:Ue=>z({...oe,[te.id]:parseFloat(Ue.target.value)||0}),className:"h-10 w-full rounded-xl border border-border bg-background pl-8 pr-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]},te.id))}),i.jsx("div",{className:"mt-6 pt-4 border-t border-emerald-500/10",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-bold text-emerald-500",children:"Total Engineer Cost"}),i.jsxs("span",{className:"text-xl font-bold text-emerald-500",children:[v(oe.currency),(Ve=oe.totalAmount)==null?void 0:Ve.toLocaleString()]})]})})]})})]})]}),B==="execution"&&i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-12",children:[i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-orange-500 rounded-full"}),"Work Schedule"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Time In"}),i.jsx("input",{type:"time",value:oe.timeIn||"",onChange:te=>z({...oe,timeIn:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Time Out"}),i.jsx("input",{type:"time",value:oe.timeOut||"",onChange:te=>z({...oe,timeOut:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Total Time"}),i.jsx("input",{type:"text",placeholder:"e.g. 8h 30m",value:oe.totalTime||"",readOnly:!0,className:"h-11 w-full rounded-xl border border-border bg-muted/50 px-4 text-sm font-bold text-primary cursor-not-allowed"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Team Size"}),i.jsx("input",{type:"number",min:"1",value:oe.team||1,onChange:te=>z({...oe,team:parseInt(te.target.value)||1}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Total Days (for Monthly Assignment)"}),i.jsx("input",{type:"number",min:"0",placeholder:"e.g. 22",value:oe.totalDays||"",onChange:te=>z({...oe,totalDays:parseInt(te.target.value)||0}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Completed Date"}),i.jsx("input",{type:"date",value:oe.completedDate||"",onChange:te=>z({...oe,completedDate:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]})]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2",children:[i.jsx("span",{className:"h-1 w-4 bg-primary rounded-full"}),"Project Scope & Attachments"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Description & Requirements"}),i.jsx("textarea",{placeholder:"Outline the key deliverables and constraints...",value:oe.description||"",onChange:te=>z({...oe,description:te.target.value}),className:"min-h-[120px] w-full rounded-xl border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 resize-none"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[i.jsx(O9,{size:16,className:"text-primary"}),"Attachments"]}),i.jsxs("label",{className:"cursor-pointer flex items-center gap-2 px-3 py-1.5 rounded-lg bg-primary/10 text-primary text-xs font-bold hover:bg-primary/20 transition-all",children:[i.jsx(co,{size:14}),"Upload File",i.jsx("input",{type:"file",multiple:!0,className:"hidden",onChange:Be})]})]}),i.jsx("div",{className:"space-y-2 max-h-[150px] overflow-y-auto pr-2 custom-scrollbar",children:oe.files&&oe.files.length>0?oe.files.map((te,Ue)=>i.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-muted/30 border border-border group",children:[i.jsxs("div",{className:"flex items-center gap-3 overflow-hidden",children:[i.jsx("div",{className:"p-1.5 rounded bg-background border border-border text-muted-foreground",children:i.jsx(d2,{size:14})}),i.jsxs("div",{className:"flex flex-col overflow-hidden",children:[i.jsx("span",{className:"text-xs font-medium truncate",children:te.name}),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:te.size})]})]}),i.jsx("button",{type:"button",onClick:()=>it(Ue),className:"p-1 text-muted-foreground hover:text-destructive transition-colors opacity-0 group-hover:opacity-100",children:i.jsx(aa,{size:14})})]},Ue)):i.jsxs("div",{className:"flex flex-col items-center justify-center py-6 border-2 border-dashed border-border rounded-xl bg-muted/10",children:[i.jsx(co,{size:24,className:"text-muted-foreground/30 mb-2"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"No files uploaded yet"})]})})]})]})]})]})]},B)})}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[i.jsx("div",{className:"flex items-center gap-4",children:i.jsx("div",{className:"flex -space-x-2",children:["general","contacts","financials","execution"].map((te,Ue)=>i.jsx("div",{className:tt("h-2 w-8 rounded-full transition-all duration-300",B===te?"bg-primary w-12":"bg-muted-foreground/20")},te))})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{type:"button",onClick:()=>{E(!1),he(null)},className:"px-6 py-2.5 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:"Discard"}),i.jsx("button",{onClick:Y,className:"px-8 py-2.5 bg-primary text-primary-foreground rounded-xl text-sm font-bold hover:bg-primary/90 transition-all shadow-lg shadow-primary/20 active:scale-95",children:"Save Changes"})]})]})]})})}),_e&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card shadow-2xl animate-in fade-in zoom-in duration-200 overflow-hidden",children:[i.jsxs("div",{className:"bg-primary/5 border-b border-border p-6 flex items-center justify-between",children:[i.jsx("h2",{className:"text-xl font-bold",children:ke?"Edit Task":"Add New Task"}),i.jsx("button",{onClick:()=>{ue(!1),$e(null)},className:"rounded-full p-2 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:we,className:"p-6 space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Task Title *"}),i.jsx("input",{type:"text",placeholder:"e.g. Design UI Mockups",value:Je.title||"",onChange:te=>Xe({...Je,title:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Project *"}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:Je.projectId||"",onChange:te=>{const Ue=te.target.value,ot=x.find(vt=>vt.id===Ue);Xe({...Je,projectId:Ue,timeLogged:(ot==null?void 0:ot.totalTime)||Je.timeLogged})},className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all appearance-none cursor-pointer",required:!0,children:[i.jsx("option",{value:"",disabled:!0,children:"Select a project"}),x.map(te=>i.jsx("option",{value:te.id,children:te.name},te.id))]}),i.jsx(Io,{className:"absolute right-4 top-1/2 -translate-y-1/2 rotate-90 text-muted-foreground pointer-events-none",size:14})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Due Date *"}),i.jsx("input",{type:"date",value:Je.dueDate||"",onChange:te=>Xe({...Je,dueDate:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Status"}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:Je.status||"To Do",onChange:te=>Xe({...Je,status:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all appearance-none cursor-pointer",children:[i.jsx("option",{value:"To Do",children:"To Do"}),i.jsx("option",{value:"In Progress",children:"In Progress"}),i.jsx("option",{value:"Completed",children:"Completed"})]}),i.jsx(Io,{className:"absolute right-4 top-1/2 -translate-y-1/2 rotate-90 text-muted-foreground pointer-events-none",size:14})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Assignee"}),i.jsxs("div",{className:"relative",children:[i.jsx(ls,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground",size:14}),i.jsxs("select",{value:Je.assignee||"",onChange:te=>Xe({...Je,assignee:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 pl-11 pr-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all appearance-none cursor-pointer",children:[i.jsx("option",{value:"",children:"Unassigned"}),u.map(te=>i.jsx("option",{value:te.name,children:te.name},te.id))]}),i.jsx(Io,{className:"absolute right-4 top-1/2 -translate-y-1/2 rotate-90 text-muted-foreground pointer-events-none",size:14})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Time Logged"}),i.jsxs("div",{className:"relative",children:[i.jsx(Ui,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground",size:14}),i.jsx("input",{type:"text",placeholder:"e.g. 4h 30m",value:Je.timeLogged||"",onChange:te=>Xe({...Je,timeLogged:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 pl-11 pr-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Approval"}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:Je.approvalStatus||"Pending",onChange:te=>Xe({...Je,approvalStatus:te.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all appearance-none cursor-pointer",children:[i.jsx("option",{value:"Pending",children:"Pending"}),i.jsx("option",{value:"Approved",children:"Approved"}),i.jsx("option",{value:"Rejected",children:"Rejected"})]}),i.jsx(Io,{className:"absolute right-4 top-1/2 -translate-y-1/2 rotate-90 text-muted-foreground pointer-events-none",size:14})]})]})]}),i.jsxs("div",{className:"pt-4 flex items-center gap-3",children:[i.jsx("button",{type:"button",onClick:()=>{ue(!1),$e(null)},className:"flex-1 h-11 text-sm font-bold border border-border rounded-xl hover:bg-accent transition-all",children:"Cancel"}),i.jsx("button",{type:"submit",className:"flex-1 h-11 bg-primary text-sm font-bold text-primary-foreground rounded-xl hover:bg-primary/90 transition-all shadow-sm",children:ke?"Update Task":"Create Task"})]})]})]})}),fe&&i.jsx("div",{className:"fixed inset-0 z-[110] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-2xl animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4 text-destructive",children:[i.jsx("div",{className:"p-2 rounded-full bg-destructive/10",children:i.jsx(pl,{size:24})}),i.jsx("h2",{className:"text-xl font-bold",children:"Confirm Deletion"})]}),i.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Are you sure you want to delete this project? This will also delete all associated timesheet and financial data. This action cannot be undone."}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:()=>{de(!1),ae(null)},className:"flex-1 px-4 py-2 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{onClick:Ye,className:"flex-1 bg-destructive px-4 py-2 text-sm font-medium text-destructive-foreground rounded-lg hover:bg-destructive/90 transition-colors shadow-sm",children:"Delete"})]})]})}),i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Tasks & Timesheets"}),i.jsx("p",{className:"text-muted-foreground",children:"Monitor and manage all active and upcoming projects."})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"file",accept:".csv",className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",onChange:ve}),i.jsxs("button",{className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(co,{size:18}),"Import CSV"]})]}),i.jsxs("button",{onClick:J,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:18}),"Export CSV"]})]})]}),i.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted/50 rounded-xl w-fit",children:[i.jsx("button",{onClick:()=>M("timesheets"),className:tt("px-6 py-2 text-sm font-bold rounded-lg transition-all",T==="timesheets"?"bg-background text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Project Timesheets"}),i.jsx("button",{onClick:()=>M("tasks"),className:tt("px-6 py-2 text-sm font-bold rounded-lg transition-all",T==="tasks"?"bg-background text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Project Tasks"})]}),i.jsx("div",{className:"space-y-4",children:T==="timesheets"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[i.jsxs("div",{className:"relative flex-1 min-w-[300px]",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search projects by name, client or ID...",value:k,onChange:te=>A(te.target.value),className:"h-10 w-full rounded-lg border border-border bg-card pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>P(!q),className:tt("flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",(Z!=="All"||Ae!=="All")&&"border-primary text-primary"),children:[i.jsx(Oc,{size:18}),"Filters",(Z!=="All"||Ae!=="All")&&i.jsx("span",{className:"ml-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:[Z,Ae].filter(te=>te!=="All").length}),i.jsx(Nv,{size:14,className:tt("ml-1 transition-transform",q&&"rotate-180")})]}),q&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-[40]",onClick:()=>P(!1)}),i.jsx("div",{className:"absolute right-0 mt-2 w-64 rounded-xl border border-border bg-card p-4 shadow-xl z-[50] animate-in fade-in slide-in-from-top-2 duration-200",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Status"}),i.jsxs("select",{value:Z,onChange:te=>ne(te.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Statuses"}),i.jsx("option",{value:"Planning",children:"Planning"}),i.jsx("option",{value:"Active",children:"Active"}),i.jsx("option",{value:"Work In Progress",children:"Work In Progress"}),i.jsx("option",{value:"Pending",children:"Pending"}),i.jsx("option",{value:"Scheduled",children:"Scheduled"}),i.jsx("option",{value:"Completed",children:"Completed"}),i.jsx("option",{value:"Cancelled",children:"Cancelled"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Client"}),i.jsxs("select",{value:Ae,onChange:te=>ce(te.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Clients"}),Array.from(new Set(x.map(te=>te.client))).sort().map(te=>i.jsx("option",{value:te,children:te},te))]})]}),(Z!=="All"||Ae!=="All")&&i.jsx("button",{onClick:()=>{ne("All"),ce("All")},className:"w-full rounded-lg bg-muted py-2 text-xs font-medium hover:bg-muted/80 transition-colors",children:"Clear All Filters"})]})})]})]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Project ID"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Project Name"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Client"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Project Status"}),i.jsx("th",{className:"px-4 py-3 font-medium text-center",children:"Team"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Assign"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Role"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Time"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Deadline"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Completed"}),i.jsx("th",{className:"px-4 py-3 font-medium text-right",children:"Actions"})]})}),i.jsxs("tbody",{className:"divide-y divide-border",children:[me.map(te=>i.jsxs("tr",{className:"hover:bg-accent/30 transition-colors group",children:[i.jsx("td",{className:"px-4 py-4 font-mono text-xs text-muted-foreground",children:te.id}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("p",{className:"font-medium group-hover:text-primary transition-colors",children:te.name})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:te.client}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("rounded-full px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",te.status==="Active"||te.status==="Work In Progress"?"bg-blue-500/10 text-blue-500":te.status==="Completed"?"bg-green-500/10 text-green-500":te.status==="Accepted"?"bg-emerald-500/10 text-emerald-500":te.status==="Rejected"?"bg-rose-500/10 text-rose-500":"bg-yellow-500/10 text-yellow-500"),children:te.status})}),i.jsx("td",{className:"px-4 py-4 text-center text-muted-foreground",children:te.team}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold text-[10px]",children:te.assignedTo?te.assignedTo.split(" ").map(Ue=>Ue[0]).join(""):"?"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:te.assignedTo||"Unassigned"})]})}),i.jsx("td",{className:"px-4 py-4 text-xs text-muted-foreground",children:te.assignedRole||"-"}),i.jsx("td",{className:"px-4 py-4",children:te.totalTime?i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs font-bold text-primary",children:te.totalTime}),i.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[te.timeIn," - ",te.timeOut]})]}):i.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Not set"})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:qe(te.deadline)}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:qe(te.completedDate)}),i.jsx("td",{className:"px-4 py-4 text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsx("button",{onClick:()=>at(te),className:"p-1 hover:bg-accent rounded-md text-muted-foreground transition-colors",title:"Edit Project",children:i.jsx(AN,{size:16})}),i.jsx("button",{onClick:()=>Ne(te),className:"p-1 hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",title:"Delete Project",children:i.jsx(aa,{size:16})})]})})]},te.id)),me.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:12,className:"py-12 text-center text-muted-foreground",children:"No projects found matching your search."})})]})]})})})]}):i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[i.jsxs("div",{className:"relative flex-1 min-w-[300px]",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search tasks by title, project or assignee...",value:k,onChange:te=>A(te.target.value),className:"h-10 w-full rounded-lg border border-border bg-card pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>K(!R),className:tt("flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",(X!=="All"||D!=="All")&&"border-primary text-primary"),children:[i.jsx(Oc,{size:18}),"Filters",(X!=="All"||D!=="All")&&i.jsx("span",{className:"ml-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:[X,D].filter(te=>te!=="All").length}),i.jsx(Nv,{size:14,className:tt("ml-1 transition-transform",R&&"rotate-180")})]}),R&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-[40]",onClick:()=>K(!1)}),i.jsx("div",{className:"absolute right-0 mt-2 w-64 rounded-xl border border-border bg-card p-4 shadow-xl z-[50] animate-in fade-in slide-in-from-top-2 duration-200",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Status"}),i.jsxs("select",{value:X,onChange:te=>le(te.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Statuses"}),i.jsx("option",{value:"To Do",children:"To Do"}),i.jsx("option",{value:"In Progress",children:"In Progress"}),i.jsx("option",{value:"Completed",children:"Completed"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Project"}),i.jsxs("select",{value:D,onChange:te=>H(te.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Projects"}),x.map(te=>i.jsx("option",{value:te.id,children:te.name},te.id))]})]}),(X!=="All"||D!=="All")&&i.jsx("button",{onClick:()=>{le("All"),H("All")},className:"w-full rounded-lg bg-muted py-2 text-xs font-medium hover:bg-muted/80 transition-colors",children:"Clear All Filters"})]})})]})]}),i.jsxs("button",{onClick:()=>ue(!0),className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors shadow-sm ml-auto",children:[i.jsx($n,{size:18}),"Add Task"]})]}),i.jsx("div",{className:"grid gap-4",children:Ge.length>0?Ge.map(te=>{const Ue=xe(te.projectId);return i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-xl border border-border bg-card hover:border-primary/50 transition-all group",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:tt("h-10 w-10 rounded-full flex items-center justify-center",te.status==="Completed"?"bg-green-500/10 text-green-500":te.status==="In Progress"?"bg-blue-500/10 text-blue-500":"bg-yellow-500/10 text-yellow-500"),children:te.status==="Completed"?i.jsx(Hl,{size:20}):i.jsx(h2,{size:20})}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold group-hover:text-primary transition-colors",children:te.title}),i.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground mt-1",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(zi,{size:12}),(Ue==null?void 0:Ue.name)||"Unknown Project"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(Ui,{size:12}),"Due: ",te.dueDate]}),te.assignee&&i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(ls,{size:12}),te.assignee]}),te.timeLogged&&i.jsxs("span",{className:"flex items-center gap-1 text-primary font-bold",children:[i.jsx(Ui,{size:12}),te.timeLogged]}),te.approvalStatus&&i.jsx("span",{className:tt("flex items-center gap-1 font-bold px-1.5 py-0.5 rounded text-[10px] uppercase tracking-wider",te.approvalStatus==="Approved"?"bg-emerald-500/10 text-emerald-500":te.approvalStatus==="Rejected"?"bg-rose-500/10 text-rose-500":"bg-yellow-500/10 text-yellow-500"),children:te.approvalStatus})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:()=>Oe(te),className:"p-1.5 hover:bg-accent text-muted-foreground transition-colors rounded-md",children:i.jsx(AN,{size:16})}),i.jsxs("select",{value:te.status,onChange:ot=>s(te.id,{status:ot.target.value}),className:"text-xs font-medium bg-muted border-none rounded-md px-2 py-1 focus:ring-1 focus:ring-primary/20 cursor-pointer",children:[i.jsx("option",{value:"To Do",children:"To Do"}),i.jsx("option",{value:"In Progress",children:"In Progress"}),i.jsx("option",{value:"Completed",children:"Completed"})]}),i.jsx("button",{onClick:()=>o(te.id),className:"p-1.5 hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors rounded-md",children:i.jsx(aa,{size:16})})]})]},te.id)}):i.jsx("div",{className:"py-12 text-center text-muted-foreground border-2 border-dashed border-border rounded-xl",children:"No tasks found. Start by adding a task to a project."})})]})})]})}function iAe(){var ce;const[e]=sf(),{clients:t,projects:r,tasks:n,addClient:a,updateClient:s,deleteClient:o}=ca(),{hasPermission:l}=la(),[u,d]=N.useState(e.get("search")||"");N.useEffect(()=>{const D=e.get("search");D&&d(D)},[e]);const[f,m]=N.useState(!1),[g,x]=N.useState("grid"),[y,v]=N.useState(null),[w,j]=N.useState(null),[k,A]=N.useState("All"),[T,M]=N.useState(!1),[B,L]=N.useState(null),[F,I]=N.useState(!1),[q,P]=N.useState({name:"",industry:"",contactPerson:"",email:"",phone:"",status:"Onboarding",projects:0,revenue:0,website:"",contacts:[]}),R=()=>{if(t.length===0){De.error("No clients to export");return}const G=[["ID","Name","Industry","Contact Person","Email","Phone","Status","Website"].join(","),...t.map(oe=>[`"${oe.id}"`,`"${oe.name}"`,`"${oe.industry}"`,`"${oe.contactPerson}"`,`"${oe.email}"`,`"${oe.phone}"`,`"${oe.status}"`,`"${oe.website||""}"`].join(","))].join(`
`),E=new Blob([G],{type:"text/csv;charset=utf-8;"}),re=URL.createObjectURL(E),he=document.createElement("a");he.setAttribute("href",re),he.setAttribute("download",`clients_export_${new Date().toISOString().split("T")[0]}.csv`),he.style.visibility="hidden",document.body.appendChild(he),he.click(),document.body.removeChild(he),De.success("Clients exported successfully")},K=D=>{var E;const H=(E=D.target.files)==null?void 0:E[0];if(!H||F)return;I(!0);const G=new FileReader;G.onload=async re=>{var he;try{const z=((he=re.target)==null?void 0:he.result).split(`
`).filter(ae=>ae.trim()!=="");if(z.length<2){De.error("Invalid CSV file format");return}const fe=[];for(let ae=1;ae<z.length;ae++){const _e=z[ae].match(/(".*?"|[^",\s]+)(?=\s*,|\s*$)/g);if(!_e||_e.length<7)continue;const ue=$e=>$e.replace(/^"|"$/g,"").trim(),ke={id:ue(_e[0]),name:ue(_e[1]),industry:ue(_e[2]),contactPerson:ue(_e[3]),email:ue(_e[4]),phone:ue(_e[5]),status:ue(_e[6]),website:_e[7]?ue(_e[7]):"",projects:0,revenue:0,contacts:[]};fe.push(ke)}if(fe.length===0){De.error("No valid data found in CSV");return}const de=new Set(t.map(ae=>ae.id)),W=fe.filter(ae=>!de.has(ae.id));if(W.length===0)De.info("All records in CSV already exist");else{for(const ae of W)await a(ae);De.success(`Successfully imported ${W.length} new clients`)}}catch(oe){console.error("Import error:",oe),De.error("Failed to parse CSV file")}finally{I(!1),D.target&&(D.target.value="")}},G.readAsText(H)},se=N.useMemo(()=>t.map(D=>{const H=r.filter(E=>E.client===D.name),G=H.reduce((E,re)=>E+(re.clientTotalAmount||0),0);return{...D,projectsCount:H.length,actualRevenue:G>0?G:D.revenue}}),[t,r]).filter(D=>{const H=D.name.toLowerCase().includes(u.toLowerCase())||D.industry.toLowerCase().includes(u.toLowerCase())||D.id.toLowerCase().includes(u.toLowerCase()),G=k==="All"||D.status===k;return H&&G}),Z=N.useMemo(()=>{const D=t.length,H=r.filter(he=>he.status!=="Completed"&&he.status!=="Cancelled").length,G=r.reduce((he,oe)=>he+(oe.clientTotalAmount||0),0),E=t.filter(he=>he.status==="Active").length,re=D>0?Math.round(E/D*100):0;return{totalClients:D,activeProjects:H,totalRevenue:G,retentionRate:re}},[t,r]),ne=async D=>{if(D.preventDefault(),!F){I(!0);try{if(w)await s(w.id,q),De.success("Client updated successfully");else{const H={id:`CL-${Math.floor(Math.random()*1e4).toString().padStart(3,"0")}`,name:q.name||"New Client",industry:q.industry||"Consulting",contactPerson:q.contactPerson||"",email:q.email||"",phone:q.phone||"",status:q.status||"Onboarding",projects:0,revenue:Number(q.revenue)||0,website:q.website,contacts:[]};await a(H),De.success("Client added successfully")}m(!1),j(null),P({name:"",industry:"",contactPerson:"",email:"",phone:"",status:"Onboarding",projects:0,revenue:0,website:"",contacts:[]})}catch(H){console.error("Save client error:",H)}finally{I(!1)}}},X=D=>{const{projectsCount:H,actualRevenue:G,...E}=D;j(E),P(E),m(!0)},le=D=>{L(D),M(!0)},Ae=async()=>{if(B&&!F){I(!0);try{await o(B),De.success("Client deleted"),(y==null?void 0:y.id)===B&&v(null),M(!1),L(null)}catch(D){console.error("Delete client error:",D)}finally{I(!1)}}};return i.jsxs("div",{className:"space-y-6 pb-12",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Client Management"}),i.jsx("p",{className:"text-muted-foreground",children:"Maintain relationships and track client-specific metrics."})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[l("crm.create")&&i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"file",accept:".csv",className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",onChange:K}),i.jsxs("button",{className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(co,{size:18}),"Import CSV"]})]}),l("crm.export")&&i.jsxs("button",{onClick:R,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:18}),"Export CSV"]}),l("crm.create")&&i.jsxs("button",{onClick:()=>m(!0),className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors w-fit shadow-sm",children:[i.jsx($n,{size:18}),"Add New Client"]})]})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(yb,{title:"Total Clients",value:Z.totalClients.toString(),icon:Hn,trend:"Total registered",trendColor:"text-muted-foreground"}),i.jsx(yb,{title:"Active Projects",value:Z.activeProjects.toString(),icon:Ni,trend:"Current workload"}),i.jsx(yb,{title:"Total Revenue",value:`$${Z.totalRevenue.toLocaleString()}`,icon:ds,trend:"+12% from Q3",trendColor:"text-green-500"}),i.jsx(yb,{title:"Retention Rate",value:`${Z.retentionRate}%`,icon:ax,trend:"Active status ratio",trendColor:"text-blue-500"})]}),i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center justify-between bg-card p-4 rounded-xl border border-border shadow-sm",children:[i.jsxs("div",{className:"flex flex-1 items-center gap-4 max-w-2xl",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search by name, industry, or ID...",value:u,onChange:D=>d(D.target.value),className:"h-10 w-full rounded-lg border border-border bg-background pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("select",{value:k,onChange:D=>A(D.target.value),className:"h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer min-w-[120px]",children:[i.jsx("option",{value:"All",children:"All Status"}),i.jsx("option",{value:"Active",children:"Active"}),i.jsx("option",{value:"Onboarding",children:"Onboarding"}),i.jsx("option",{value:"Inactive",children:"Inactive"})]})]}),i.jsxs("div",{className:"flex items-center gap-2 border-l border-border pl-4 ml-4",children:[i.jsx("button",{onClick:()=>x("grid"),className:tt("p-2 rounded-lg transition-colors",g==="grid"?"bg-primary text-primary-foreground":"hover:bg-accent text-muted-foreground"),title:"Grid View",children:i.jsx(E9,{size:20})}),i.jsx("button",{onClick:()=>x("table"),className:tt("p-2 rounded-lg transition-colors",g==="table"?"bg-primary text-primary-foreground":"hover:bg-accent text-muted-foreground"),title:"Table View",children:i.jsx(y3,{size:20})})]})]}),g==="grid"?i.jsx("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-3",children:se.map(D=>i.jsxs(ar.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"group relative rounded-xl border border-border bg-card p-6 shadow-sm hover:shadow-md transition-all",children:[i.jsxs("div",{className:"flex items-start justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"h-12 w-12 rounded-lg bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(zi,{size:24})}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold group-hover:text-primary transition-colors",children:D.name}),i.jsx("p",{className:"text-xs text-muted-foreground",children:D.industry})]})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[l("crm.edit")&&i.jsx("button",{onClick:H=>{H.stopPropagation(),X(D)},className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground transition-colors",children:i.jsx(Ps,{size:16})}),l("crm.delete")&&i.jsx("button",{onClick:H=>{H.stopPropagation(),le(D.id)},className:"p-1.5 hover:bg-destructive/10 rounded-md text-destructive transition-colors",children:i.jsx(aa,{size:16})})]})]}),i.jsxs("div",{className:"space-y-3 mb-6",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[i.jsx(Gl,{size:14}),i.jsx("span",{className:"truncate",children:D.email})]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[i.jsx(rx,{size:14}),i.jsx("span",{children:D.phone})]}),D.website&&i.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[i.jsx(Km,{size:14}),i.jsxs("a",{href:D.website.startsWith("http")?D.website:`https://${D.website}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",onClick:H=>H.stopPropagation(),children:["Website ",i.jsx(C9,{size:12})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 border-t border-border",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Projects"}),i.jsx("p",{className:"font-semibold text-lg",children:D.projectsCount})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Revenue"}),i.jsxs("p",{className:"font-semibold text-lg",children:["$",D.actualRevenue.toLocaleString()]})]})]}),i.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[i.jsx("span",{className:tt("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",D.status==="Active"?"bg-green-500/10 text-green-500":D.status==="Onboarding"?"bg-blue-500/10 text-blue-500":"bg-muted text-muted-foreground"),children:D.status}),i.jsxs("button",{onClick:()=>v(D),className:"text-xs font-medium text-primary hover:underline flex items-center gap-1",children:["View Details",i.jsx(Io,{size:14})]})]})]},D.id))}):i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Client"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Industry"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Contact"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Projects"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Revenue"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),i.jsx("th",{className:"px-4 py-3 font-medium text-right",children:"Actions"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:se.map(D=>i.jsxs("tr",{className:"hover:bg-accent/30 transition-colors cursor-pointer group",onClick:()=>v(D),children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-8 w-8 rounded bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(zi,{size:16})}),i.jsx("span",{className:"font-medium",children:D.name})]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:D.industry}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{children:D.contactPerson}),i.jsx("span",{className:"text-xs text-muted-foreground",children:D.email})]})}),i.jsx("td",{className:"px-4 py-4 font-medium",children:D.projectsCount}),i.jsxs("td",{className:"px-4 py-4 font-medium",children:["$",D.actualRevenue.toLocaleString()]}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium",D.status==="Active"?"bg-green-500/10 text-green-500":D.status==="Onboarding"?"bg-blue-500/10 text-blue-500":"bg-muted text-muted-foreground"),children:D.status})}),i.jsx("td",{className:"px-4 py-4 text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-2",onClick:H=>H.stopPropagation(),children:[l("crm.edit")&&i.jsx("button",{onClick:()=>X(D),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground transition-colors",children:i.jsx(Ps,{size:16})}),l("crm.delete")&&i.jsx("button",{onClick:()=>le(D.id),className:"p-1.5 hover:bg-destructive/10 rounded-md text-destructive transition-colors",children:i.jsx(aa,{size:16})})]})})]},D.id))})]})})}),i.jsx(on,{children:y&&i.jsxs(i.Fragment,{children:[i.jsx(ar.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>v(null),className:"fixed inset-0 bg-background/80 backdrop-blur-sm z-[110]"}),i.jsx(ar.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:25,stiffness:200},className:"fixed right-0 top-0 bottom-0 w-full max-w-xl bg-card border-l border-border z-[120] shadow-2xl overflow-y-auto",children:i.jsxs("div",{className:"p-6",children:[i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"h-14 w-14 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(zi,{size:32})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold",children:y.name}),i.jsx("p",{className:"text-muted-foreground",children:y.industry})]})]}),i.jsx("button",{onClick:()=>v(null),className:"p-2 hover:bg-accent rounded-full text-muted-foreground transition-colors",children:i.jsx(xr,{size:24})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-6 mb-8",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground",children:"Contact Information"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsx(ax,{size:16,className:"text-primary"}),i.jsx("span",{children:y.contactPerson})]}),i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsx(Gl,{size:16,className:"text-primary"}),i.jsx("span",{children:y.email})]}),i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsx(rx,{size:16,className:"text-primary"}),i.jsx("span",{children:y.phone})]}),y.website&&i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsx(Km,{size:16,className:"text-primary"}),i.jsx("a",{href:`https://${y.website}`,target:"_blank",rel:"noreferrer",className:"text-primary hover:underline",children:y.website})]})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground",children:"Account Status"}),i.jsxs("div",{className:"space-y-3 text-sm",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Status"}),i.jsx("span",{className:tt("px-2 py-0.5 rounded-full text-xs font-medium",y.status==="Active"?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"),children:y.status})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Total Revenue"}),i.jsxs("span",{className:"font-bold text-lg",children:["$",r.filter(D=>D.client===y.name).reduce((D,H)=>D+(H.clientTotalAmount||0),0).toLocaleString()]})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Client Since"}),i.jsx("span",{className:"font-medium",children:"Jan 2024"})]})]})]})]}),i.jsxs("div",{className:"space-y-6 mb-8",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"text-lg font-bold",children:"Client Contacts"}),l("crm.edit")&&i.jsxs("button",{disabled:F,onClick:async()=>{if(F)return;const D=prompt("Contact Name:");if(!D)return;const H=prompt("Role:"),G=prompt("Email:"),E=prompt("Phone:");if(D&&G){I(!0);const re={id:`CON-${Math.random().toString(36).substr(2,5).toUpperCase()}`,name:D,role:H||"",email:G,phone:E||""},he=[...y.contacts||[],re];try{await s(y.id,{contacts:he}),v({...y,contacts:he}),De.success("Contact added")}catch(oe){console.error("Add contact error:",oe)}finally{I(!1)}}},className:"flex items-center gap-1 text-xs font-medium text-primary hover:underline disabled:opacity-50",children:[i.jsx($n,{size:14}),F?"Adding...":"Add Contact"]})]}),i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{className:"p-3 rounded-lg border border-primary/20 bg-primary/5",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsx("p",{className:"text-sm font-bold",children:y.contactPerson}),i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-primary text-primary-foreground font-bold uppercase",children:"Primary"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:y.email}),i.jsx("p",{className:"text-xs text-muted-foreground",children:y.phone})]}),(ce=y.contacts)==null?void 0:ce.map(D=>i.jsxs("div",{className:"p-3 rounded-lg border border-border bg-muted/20 group",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold",children:D.name}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:D.role})]}),l("crm.edit")&&i.jsx("button",{disabled:F,onClick:async()=>{var G;if(F)return;const H=(G=y.contacts)==null?void 0:G.filter(E=>E.id!==D.id);I(!0);try{await s(y.id,{contacts:H}),v({...y,contacts:H}),De.error("Contact removed")}catch(E){console.error("Remove contact error:",E)}finally{I(!1)}},className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-destructive/10 rounded text-destructive transition-all disabled:opacity-50",children:i.jsx(aa,{size:12})})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:D.email}),i.jsx("p",{className:"text-xs text-muted-foreground",children:D.phone})]},D.id))]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"text-lg font-bold",children:"Associated Projects"}),i.jsxs("span",{className:"text-xs font-medium bg-muted px-2 py-1 rounded-md",children:[r.filter(D=>D.client===y.name).length," Total"]})]}),i.jsx("div",{className:"space-y-3",children:r.filter(D=>D.client===y.name).length>0?r.filter(D=>D.client===y.name).map(D=>i.jsxs("div",{className:"p-4 rounded-xl border border-border bg-accent/20 hover:bg-accent/40 transition-colors",children:[i.jsxs("div",{className:"flex items-start justify-between mb-2",children:[i.jsxs("div",{children:[i.jsx("p",{className:"font-bold text-sm",children:D.name}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:D.id})]}),i.jsx("span",{className:tt("text-[10px] px-2 py-0.5 rounded-full font-medium",D.status==="Completed"?"bg-green-500/10 text-green-500":"bg-blue-500/10 text-blue-500"),children:D.status})]}),i.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(Lo,{size:12}),i.jsxs("span",{children:["Due ",D.deadline]})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(ds,{size:12}),i.jsxs("span",{className:"font-medium text-foreground",children:["$",(D.clientTotalAmount||0).toLocaleString()]})]})]})]},D.id)):i.jsxs("div",{className:"text-center py-12 border-2 border-dashed border-border rounded-xl",children:[i.jsx(Ni,{className:"mx-auto text-muted-foreground mb-2",size:32}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"No projects found for this client."})]})})]}),i.jsxs("div",{className:"mt-12 pt-6 border-t border-border flex items-center gap-4",children:[l("crm.edit")&&i.jsxs("button",{onClick:()=>X(y),className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-lg border border-border hover:bg-accent transition-colors text-sm font-medium",children:[i.jsx(Ps,{size:16}),"Edit Profile"]}),l("crm.delete")&&i.jsxs("button",{onClick:()=>le(y.id),className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-lg border border-destructive/20 text-destructive hover:bg-destructive/10 transition-colors text-sm font-medium",children:[i.jsx(aa,{size:16}),"Delete Client"]})]})]})})]})}),f&&i.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-2xl animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:w?"Edit Client":"Add New Client"}),i.jsx("button",{onClick:()=>{m(!1),j(null),P({name:"",industry:"",contactPerson:"",email:"",phone:"",status:"Onboarding",projects:0,revenue:0,website:""})},className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:ne,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Company Name *"}),i.jsx("input",{type:"text",placeholder:"e.g. TechFlow Solutions",value:q.name||"",onChange:D=>P({...q,name:D.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Industry *"}),i.jsx("input",{type:"text",placeholder:"e.g. Technology",value:q.industry||"",onChange:D=>P({...q,industry:D.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Contact Person *"}),i.jsx("input",{type:"text",placeholder:"e.g. John Doe",value:q.contactPerson||"",onChange:D=>P({...q,contactPerson:D.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Email *"}),i.jsx("input",{type:"email",placeholder:"contact@company.com",value:q.email||"",onChange:D=>P({...q,email:D.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Phone *"}),i.jsx("input",{type:"tel",placeholder:"+1 (555) 000-0000",value:q.phone||"",onChange:D=>P({...q,phone:D.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Status"}),i.jsxs("select",{value:q.status||"Onboarding",onChange:D=>P({...q,status:D.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"Active",children:"Active"}),i.jsx("option",{value:"Onboarding",children:"Onboarding"}),i.jsx("option",{value:"Inactive",children:"Inactive"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Initial Revenue ($)"}),i.jsx("input",{type:"number",placeholder:"0.00",value:q.revenue??0,onChange:D=>P({...q,revenue:parseFloat(D.target.value)||0}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Website"}),i.jsx("input",{type:"text",placeholder:"www.company.com",value:q.website||"",onChange:D=>P({...q,website:D.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"pt-4 flex items-center gap-3",children:[i.jsx("button",{type:"button",onClick:()=>{m(!1),j(null),P({name:"",industry:"",contactPerson:"",email:"",phone:"",status:"Onboarding",projects:0,revenue:0,website:""})},className:"flex-1 px-4 py-2 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",disabled:F,className:"flex-1 bg-primary px-4 py-2 text-sm font-medium text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors shadow-sm disabled:opacity-50 flex items-center justify-center gap-2",children:F?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Processing..."]}):w?"Update Client":"Add Client"})]})]})]})}),T&&i.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-2xl animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4 text-destructive",children:[i.jsx("div",{className:"p-2 rounded-full bg-destructive/10",children:i.jsx(pl,{size:24})}),i.jsx("h2",{className:"text-xl font-bold",children:"Confirm Deletion"})]}),i.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Are you sure you want to delete this client? This will not delete their associated projects, but the client record will be permanently removed."}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:()=>{M(!1),L(null)},className:"flex-1 px-4 py-2 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{onClick:Ae,disabled:F,className:"flex-1 bg-destructive px-4 py-2 text-sm font-medium text-destructive-foreground rounded-lg hover:bg-destructive/90 transition-colors shadow-sm disabled:opacity-50 flex items-center justify-center gap-2",children:F?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-destructive-foreground border-t-transparent"}),"Deleting..."]}):"Delete"})]})]})})]})}function yb({title:e,value:t,icon:r,trend:n,trendColor:a="text-muted-foreground"}){return i.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm",children:[i.jsx("div",{className:"flex items-center justify-between mb-2",children:i.jsx("div",{className:"p-2 rounded-lg bg-accent text-muted-foreground",children:i.jsx(r,{size:18})})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:e}),i.jsx("p",{className:"text-2xl font-bold",children:t}),i.jsx("p",{className:tt("text-xs mt-1",a),children:n})]})]})}function sAe(){const{projects:e,addProject:t,updateProject:r,deleteProject:n,clients:a,addClient:s}=ca(),{hasPermission:o}=la(),[l,u]=sf(),[d,f]=N.useState("");N.useEffect(()=>{if(l.get("create")==="true"){T(!0);const W=new URLSearchParams(l);W.delete("create"),u(W,{replace:!0})}},[l,u]);const[m,g]=N.useState("list"),[x,y]=N.useState(null),[v,w]=N.useState(!1),[j,k]=N.useState(null),[A,T]=N.useState(!1),[M,B]=N.useState(null),[L,F]=N.useState({name:"",client:"",status:"Planning",deadline:new Date(Date.now()+720*60*60*1e3).toISOString().split("T")[0],clientTotalAmount:0,assignedTo:"Unassigned"}),[I,q]=N.useState(!1),[P,R]=N.useState("All"),[K,ee]=N.useState("All"),se=N.useRef(null),[Z,ne]=N.useState(!1),X=N.useRef(null);N.useEffect(()=>{const de=W=>{se.current&&!se.current.contains(W.target)&&y(null),X.current&&!X.current.contains(W.target)&&q(!1)};return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[]);const le=async(de,W)=>{if(!Z){ne(!0);try{let ae="Planning";switch(W){case"Lead":ae="Planning";break;case"Qualified":ae="Pending";break;case"Proposal":ae="In Progress";break;case"Negotiation":ae="Active";break;case"Closed Won":ae="Active";break;case"Closed Lost":ae="Cancelled";break}const _e=e.find(ue=>ue.id===de);if(W==="Closed Won"&&_e&&!a.some(ke=>ke.name===_e.client)){const ke={id:`CL-${Math.floor(Math.random()*1e4).toString().padStart(3,"0")}`,name:_e.client,industry:"Consulting",contactPerson:_e.personName||"",email:_e.email||"",phone:_e.contactNumber||"",status:"Active",projects:1,revenue:_e.clientTotalAmount||0};await s(ke),De.info(`New client "${_e.client}" created`)}await r(de,{status:ae}),y(null),De.success(`Deal moved to ${W}`)}catch{De.error("Failed to update deal stage")}finally{ne(!1)}}},Ae=(de,W)=>{k({id:de,name:W}),w(!0),y(null)},ce=async()=>{if(j&&!Z){ne(!0);try{await n(j.id),De.error("Deal deleted"),w(!1),k(null)}catch{De.error("Failed to delete deal")}finally{ne(!1)}}},D=async de=>{if(de.preventDefault(),!Z){if(!L.name||!L.client){De.error("Please fill in all required fields");return}ne(!0);try{if(M)await r(M,L),De.success("Deal updated successfully");else{const W=`PRJ${Math.floor(Math.random()*1e3).toString().padStart(3,"0")}`;await t({...L,id:W,clientStatus:L.status,team:1,issueDate:new Date().toISOString().split("T")[0],issuedMonth:new Date().toISOString().substring(0,7),engineerInvoiceStatus:"Unpaid",clientInvoiceStatus:"Unpaid"}),De.success("New deal added to pipeline")}T(!1),B(null),F({name:"",client:"",status:"Planning",deadline:new Date(Date.now()+720*60*60*1e3).toISOString().split("T")[0],clientTotalAmount:0,assignedTo:"Unassigned"})}catch{De.error("Failed to save deal")}finally{ne(!1)}}},H=de=>{const W=e.find(ae=>ae.id===de.id);W&&(B(W.id),F({...W}),T(!0),y(null))},G=de=>{if(!de)return 0;const W=de.match(/(\d+)h/),ae=de.match(/(\d+)m/),_e=W?parseInt(W[1]):0,ue=ae?parseInt(ae[1]):0;return _e+ue/60},E=N.useMemo(()=>e.map(de=>{const W=G(de.totalTime),ae=(de.clientHourlyRate||0)*W,_e=de.clientTotalAmount&&de.clientTotalAmount>0?de.clientTotalAmount:ae+(de.clientTravelCost||0)+(de.clientMaterialCost||0)+(de.clientHalfDayRate||0)+(de.clientFullDayRate||0)+(de.clientMonthlyRate||0);let ue="Lead",ke=20;switch(de.status){case"Planning":ue="Lead",ke=20;break;case"Pending":ue="Qualified",ke=40;break;case"In Progress":ue="Proposal",ke=60;break;case"Work In Progress":case"Active":ue="Negotiation",ke=80;break;case"Completed":ue="Closed Won",ke=100;break;case"Cancelled":ue="Closed Lost",ke=0;break;default:ue="Lead",ke=20}return{id:de.id,name:de.name,company:de.client,value:`$${_e.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}`,numericValue:_e,stage:ue,probability:ke,expectedClose:de.deadline,owner:de.assignedTo||"Unassigned"}}),[e]),re=()=>{if(e.length===0){De.error("No deals to export");return}const ae=[["ID","Name","Client","Status","Deadline","Value","Assigned To"].join(","),...e.map($e=>{var Je;return[`"${$e.id}"`,`"${$e.name}"`,`"${$e.client}"`,`"${$e.status}"`,`"${$e.deadline}"`,((Je=$e.clientTotalAmount)==null?void 0:Je.toFixed(2))||"0.00",`"${$e.assignedTo||""}"`].join(",")})].join(`
`),_e=new Blob([ae],{type:"text/csv;charset=utf-8;"}),ue=URL.createObjectURL(_e),ke=document.createElement("a");ke.setAttribute("href",ue),ke.setAttribute("download",`crm_deals_export_${new Date().toISOString().split("T")[0]}.csv`),ke.style.visibility="hidden",document.body.appendChild(ke),ke.click(),document.body.removeChild(ke),De.success("CRM deals exported successfully")},he=de=>{var _e;const W=(_e=de.target.files)==null?void 0:_e[0];if(!W||Z)return;ne(!0);const ae=new FileReader;ae.onload=async ue=>{var ke;try{const Je=((ke=ue.target)==null?void 0:ke.result).split(`
`).filter(at=>at.trim()!=="");if(Je.length<2){De.error("Invalid CSV file format");return}const Xe=[];for(let at=1;at<Je.length;at++){const Y=Je[at].match(/(".*?"|[^",\s]+)(?=\s*,|\s*$)/g);if(!Y||Y.length<6)continue;const we=ve=>ve.replace(/^"|"$/g,"").trim(),J={id:we(Y[0]),name:we(Y[1]),client:we(Y[2]),status:we(Y[3]),deadline:we(Y[4]),clientTotalAmount:parseFloat(we(Y[5]))||0,assignedTo:we(Y[6])||"Unassigned",issueDate:new Date().toISOString().split("T")[0],team:1};Xe.push(J)}if(Xe.length===0){De.error("No valid data found in CSV");return}const Ne=new Set(e.map(at=>at.id)),Ye=Xe.filter(at=>!Ne.has(at.id));if(Ye.length===0)De.info("All records in CSV already exist");else{for(const at of Ye)await t(at);De.success(`Successfully imported ${Ye.length} new deals`)}}catch($e){console.error("Import error:",$e),De.error("Failed to parse CSV file")}finally{ne(!1),de.target&&(de.target.value="")}},ae.readAsText(W)},oe=N.useMemo(()=>{let de=0,W=0,ae=0,_e=0;E.forEach(ke=>{ke.stage!=="Closed Won"&&ke.stage!=="Closed Lost"&&(de+=ke.numericValue,W+=ke.numericValue*ke.probability/100),ke.stage==="Closed Won"&&ae++,(ke.stage==="Lead"||ke.stage==="Qualified")&&_e++});const ue=E.length>0?ae/E.length*100:0;return{totalPipeline:de,weightedForecast:W,conversionRate:ue,activeLeadsCount:_e}},[E]),z=E.filter(de=>{const W=de.name.toLowerCase().includes(d.toLowerCase())||de.company.toLowerCase().includes(d.toLowerCase())||de.id.toLowerCase().includes(d.toLowerCase()),ae=P==="All"||de.stage===P,_e=K==="All"||de.owner===K;return W&&ae&&_e}),fe=()=>{B(null),F({name:"",client:"",status:"Planning",deadline:new Date(Date.now()+720*60*60*1e3).toISOString().split("T")[0],clientTotalAmount:0,assignedTo:"Unassigned"}),T(!0)};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"CRM & Sales"}),i.jsx("p",{className:"text-muted-foreground",children:"Track leads, manage deals, and monitor your sales pipeline."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[o("crm.create")&&i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"file",accept:".csv",className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",onChange:he}),i.jsxs("button",{className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(co,{size:18}),"Import CSV"]})]}),o("crm.export")&&i.jsxs("button",{onClick:re,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:18}),"Export CSV"]}),i.jsx("button",{onClick:()=>g(m==="list"?"pipeline":"list"),className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:m==="list"?"Pipeline View":"List View"}),o("crm.create")&&i.jsxs("button",{onClick:fe,className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[i.jsx($n,{size:18}),"Add Deal"]})]})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(bb,{title:"Total Pipeline",value:`$${oe.totalPipeline.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}`,icon:xh,trend:"+15% vs last month",trendColor:"text-green-500"}),i.jsx(bb,{title:"Weighted Forecast",value:`$${oe.weightedForecast.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}`,icon:ds,trend:"Based on probability"}),i.jsx(bb,{title:"Conversion Rate",value:`${oe.conversionRate.toFixed(1)}%`,icon:Fo,trend:"+2% from Q3",trendColor:"text-green-500"}),i.jsx(bb,{title:"Active Leads",value:oe.activeLeadsCount.toString(),icon:Hn,trend:"Open opportunities",trendColor:"text-blue-500"})]}),i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center justify-between",children:[i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search deals, companies, owners...",value:d,onChange:de=>f(de.target.value),className:"h-10 w-full rounded-lg border border-border bg-background pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"relative",ref:X,children:[i.jsxs("button",{onClick:()=>q(!I),className:tt("flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium transition-colors hover:bg-accent",(P!=="All"||K!=="All")&&"border-primary text-primary"),children:[i.jsx(Oc,{size:18}),"Filters",(P!=="All"||K!=="All")&&i.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:[P,K].filter(de=>de!=="All").length})]}),I&&i.jsxs("div",{className:"absolute right-0 mt-2 z-50 w-64 rounded-xl border border-border bg-card p-4 shadow-lg animate-in fade-in slide-in-from-top-2 duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h4",{className:"font-bold text-sm",children:"Filter Deals"}),i.jsx("button",{onClick:()=>{R("All"),ee("All")},className:"text-[10px] font-bold uppercase tracking-wider text-primary hover:underline",children:"Reset"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Stage"}),i.jsxs("select",{value:P,onChange:de=>R(de.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Stages"}),i.jsx("option",{value:"Lead",children:"Lead"}),i.jsx("option",{value:"Qualified",children:"Qualified"}),i.jsx("option",{value:"Proposal",children:"Proposal"}),i.jsx("option",{value:"Negotiation",children:"Negotiation"}),i.jsx("option",{value:"Closed Won",children:"Closed Won"}),i.jsx("option",{value:"Closed Lost",children:"Closed Lost"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Owner"}),i.jsxs("select",{value:K,onChange:de=>ee(de.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Owners"}),Array.from(new Set(E.map(de=>de.owner))).map(de=>i.jsx("option",{value:de,children:de},de))]})]})]})]})]})]}),m==="list"?i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Deal Name"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Company"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Value"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Stage"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Probability"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Expected Close"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Owner"}),i.jsx("th",{className:"px-4 py-3 font-medium"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:z.map(de=>i.jsxs("tr",{className:"hover:bg-accent/30 transition-colors group",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"font-medium group-hover:text-primary transition-colors",children:de.name}),i.jsx("p",{className:"text-xs text-muted-foreground",children:de.id})]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:de.company}),i.jsx("td",{className:"px-4 py-4 font-semibold",children:de.value}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium",de.stage==="Closed Won"?"bg-green-500/10 text-green-500":de.stage==="Closed Lost"?"bg-red-500/10 text-red-500":de.stage==="Negotiation"?"bg-blue-500/10 text-blue-500":"bg-muted text-muted-foreground"),children:de.stage})}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-1.5 w-16 rounded-full bg-muted overflow-hidden",children:i.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${de.probability}%`}})}),i.jsxs("span",{className:"text-xs font-medium",children:[de.probability,"%"]})]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:de.expectedClose}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:de.owner}),i.jsx("td",{className:"px-4 py-4 text-right",children:i.jsxs("div",{className:"relative inline-block",children:[i.jsx("button",{onClick:()=>y(x===de.id?null:de.id),className:"p-1 hover:bg-accent rounded-md text-muted-foreground transition-colors",children:i.jsx(Ym,{size:18})}),x===de.id&&i.jsxs("div",{ref:se,className:"absolute right-0 top-8 z-50 w-48 rounded-lg border border-border bg-card p-1 shadow-lg animate-in fade-in zoom-in duration-150",children:[o("crm.edit")&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:()=>H(de),className:"flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-left text-xs hover:bg-accent transition-colors",children:[i.jsx(Ps,{size:14,className:"text-muted-foreground"}),"Edit Deal"]}),i.jsx("div",{className:"my-1 border-t border-border"}),i.jsx("p",{className:"px-3 py-1.5 text-[10px] font-bold uppercase text-muted-foreground tracking-wider",children:"Move to Stage"}),["Lead","Qualified","Proposal","Negotiation","Closed Won","Closed Lost"].map(W=>i.jsxs("button",{disabled:Z,onClick:()=>le(de.id,W),className:tt("flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-left text-xs hover:bg-accent transition-colors disabled:opacity-50",de.stage===W&&"bg-primary/10 text-primary font-medium"),children:[i.jsx(wv,{size:14,className:"text-muted-foreground"}),W]},W)),i.jsx("div",{className:"my-1 border-t border-border"})]}),o("crm.delete")&&i.jsxs("button",{disabled:Z,onClick:()=>Ae(de.id,de.name),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-xs text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-50",children:[i.jsx(aa,{size:14}),"Delete Deal"]})]})]})})]},de.id))})]})})}):i.jsx("div",{className:"grid gap-6 md:grid-cols-3 xl:grid-cols-4 overflow-x-auto pb-4",children:["Lead","Qualified","Proposal","Negotiation","Closed Won"].map(de=>i.jsxs("div",{className:"min-w-[280px] space-y-4",children:[i.jsx("div",{className:"flex items-center justify-between px-2",children:i.jsxs("h3",{className:"font-semibold text-sm flex items-center gap-2",children:[de,i.jsx("span",{className:"text-xs font-normal text-muted-foreground bg-muted px-2 py-0.5 rounded-full",children:E.filter(W=>W.stage===de).length})]})}),i.jsx("div",{className:"space-y-3",children:E.filter(W=>W.stage===de).map(W=>i.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm hover:shadow-md transition-all cursor-pointer group",onClick:()=>De.info(`Opening deal: ${W.name}`),children:[i.jsxs("div",{className:"flex items-start justify-between mb-2",children:[i.jsx("p",{className:"font-medium text-sm group-hover:text-primary transition-colors",children:W.name}),i.jsxs("div",{className:"relative",children:[i.jsx("button",{onClick:ae=>{ae.stopPropagation(),y(x===W.id?null:W.id)},className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(Ym,{size:14})}),x===W.id&&i.jsxs("div",{ref:se,className:"absolute right-0 top-6 z-50 w-48 rounded-lg border border-border bg-card p-1 shadow-lg animate-in fade-in zoom-in duration-150",children:[i.jsxs("button",{onClick:ae=>{ae.stopPropagation(),H(W)},className:"flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-left text-xs hover:bg-accent transition-colors",children:[i.jsx(Ps,{size:14,className:"text-muted-foreground"}),"Edit Deal"]}),i.jsx("div",{className:"my-1 border-t border-border"}),i.jsx("p",{className:"px-3 py-1.5 text-[10px] font-bold uppercase text-muted-foreground tracking-wider",children:"Move to Stage"}),["Lead","Qualified","Proposal","Negotiation","Closed Won","Closed Lost"].map(ae=>i.jsxs("button",{disabled:Z,onClick:_e=>{_e.stopPropagation(),le(W.id,ae)},className:tt("flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-left text-xs hover:bg-accent transition-colors disabled:opacity-50",W.stage===ae&&"bg-primary/10 text-primary font-medium"),children:[i.jsx(wv,{size:14,className:"text-muted-foreground"}),ae]},ae)),i.jsx("div",{className:"my-1 border-t border-border"}),i.jsxs("button",{disabled:Z,onClick:ae=>{ae.stopPropagation(),Ae(W.id,W.name)},className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-xs text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-50",children:[i.jsx(aa,{size:14}),"Delete Deal"]})]})]})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:W.company}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("p",{className:"font-bold text-sm",children:W.value}),i.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[i.jsx(Ui,{size:10}),i.jsx("span",{children:W.expectedClose})]})]}),i.jsx("div",{className:"mt-3 pt-3 border-t border-border",children:i.jsxs("p",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[i.jsx(Hn,{size:10}),W.owner]})})]},W.id))})]},de))}),A&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card shadow-2xl animate-in fade-in zoom-in duration-200 overflow-hidden",children:[i.jsxs("div",{className:"bg-primary/5 border-b border-border p-6 flex items-center justify-between",children:[i.jsx("h2",{className:"text-xl font-bold",children:M?"Edit Deal":"Add New Deal"}),i.jsx("button",{onClick:()=>{T(!1),B(null)},className:"rounded-full p-2 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:D,className:"p-6 space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Deal Name *"}),i.jsx("input",{type:"text",placeholder:"e.g. Website Redesign",value:L.name||"",onChange:de=>F({...L,name:de.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Company *"}),i.jsx("input",{type:"text",placeholder:"e.g. TechCorp",value:L.client||"",onChange:de=>F({...L,client:de.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all",required:!0})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Deal Value ($)"}),i.jsx("input",{type:"number",placeholder:"0",value:L.clientTotalAmount??0,onChange:de=>F({...L,clientTotalAmount:parseFloat(de.target.value)||0}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Stage"}),i.jsxs("select",{value:L.status||"Planning",onChange:de=>F({...L,status:de.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all appearance-none cursor-pointer",children:[i.jsx("option",{value:"Planning",children:"Lead"}),i.jsx("option",{value:"Pending",children:"Qualified"}),i.jsx("option",{value:"In Progress",children:"Proposal"}),i.jsx("option",{value:"Active",children:"Negotiation"}),i.jsx("option",{value:"Completed",children:"Closed Won"}),i.jsx("option",{value:"Cancelled",children:"Closed Lost"})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Expected Close"}),i.jsx("input",{type:"date",value:L.deadline||"",onChange:de=>F({...L,deadline:de.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Owner"}),i.jsx("input",{type:"text",placeholder:"e.g. John Doe",value:L.assignedTo||"",onChange:de=>F({...L,assignedTo:de.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 focus:bg-background transition-all"})]})]}),i.jsxs("div",{className:"pt-4 flex items-center gap-3",children:[i.jsx("button",{type:"button",disabled:Z,onClick:()=>{T(!1),B(null)},className:"flex-1 h-11 text-sm font-bold border border-border rounded-xl hover:bg-accent transition-all disabled:opacity-50",children:"Cancel"}),i.jsx("button",{type:"submit",disabled:Z,className:"flex-1 h-11 bg-primary text-sm font-bold text-primary-foreground rounded-xl hover:bg-primary/90 transition-all shadow-sm disabled:opacity-50",children:Z?"Saving...":M?"Update Deal":"Create Deal"})]})]})]})}),v&&i.jsx("div",{className:"fixed inset-0 z-[110] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsx("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card shadow-2xl animate-in fade-in zoom-in duration-200 overflow-hidden",children:i.jsxs("div",{className:"p-6 space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3 text-destructive",children:[i.jsx("div",{className:"p-2 rounded-full bg-destructive/10",children:i.jsx(pl,{size:24})}),i.jsx("h2",{className:"text-xl font-bold",children:"Delete Deal"})]}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Are you sure you want to delete the deal ",i.jsxs("span",{className:"font-bold text-foreground",children:['"',j==null?void 0:j.name,'"']}),"? This action cannot be undone."]}),i.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[i.jsx("button",{onClick:()=>{w(!1),k(null)},className:"flex-1 h-11 text-sm font-bold border border-border rounded-xl hover:bg-accent transition-all",children:"Cancel"}),i.jsx("button",{onClick:ce,disabled:Z,className:"flex-1 h-11 bg-destructive text-sm font-bold text-destructive-foreground rounded-xl hover:bg-destructive/90 transition-all shadow-sm disabled:opacity-50",children:Z?"Deleting...":"Delete Deal"})]})]})})})]})}function bb({title:e,value:t,icon:r,trend:n,trendColor:a="text-muted-foreground"}){return i.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm",children:[i.jsx("div",{className:"flex items-center justify-between mb-2",children:i.jsx("div",{className:"p-2 rounded-lg bg-accent text-muted-foreground",children:i.jsx(r,{size:18})})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:e}),i.jsx("p",{className:"text-2xl font-bold",children:t}),i.jsx("p",{className:tt("text-xs mt-1",a),children:n})]})]})}function oAe(){const{jobs:e,candidates:t,addJob:r,updateJob:n,deleteJob:a,addCandidate:s,updateCandidate:o,deleteCandidate:l,addEngineer:u}=ca(),{hasPermission:d}=la(),f=mo(),[m,g]=sf(),[x,y]=N.useState("jobs");N.useEffect(()=>{if(m.get("create")==="true"){R(!0),y("candidates");const _e=new URLSearchParams(m);_e.delete("create"),g(_e,{replace:!0})}},[m,g]);const[v,w]=N.useState(""),[j,k]=N.useState("All"),[A,T]=N.useState("All"),[M,B]=N.useState(null),[L,F]=N.useState(null),[I,q]=N.useState(!1),[P,R]=N.useState(!1),[K,ee]=N.useState({title:"",department:"",location:"",type:"Full-time",status:"Draft"}),[se,Z]=N.useState({name:"",role:"",experience:"",status:"Applied",email:""}),[ne,X]=N.useState(!1),le=N.useRef(null);N.useEffect(()=>{const ae=_e=>{le.current&&!le.current.contains(_e.target)&&B(null)};return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[]);const Ae=()=>{F(null),ee({title:"",department:"",location:"",type:"Full-time",status:"Draft"}),q(!0)},ce=ae=>{F(ae.id),ee({title:ae.title,department:ae.department,location:ae.location,type:ae.type,status:ae.status}),q(!0),B(null)},D=async ae=>{if(ae.preventDefault(),!ne){X(!0);try{if(L)await n(L,K),De.success("Job opening updated successfully");else{const _e={id:`JOB-00${e.length+1}`,...K,applicants:0,postedDate:new Date().toISOString().split("T")[0]};await r(_e),De.success(K.status==="Open"?"Job opening posted successfully":"Job opening created as draft")}q(!1),F(null)}catch{De.error(L?"Failed to update job":"Failed to post job")}finally{X(!1)}}},H=()=>{Z({name:"",role:"",experience:"",status:"Applied",email:""}),R(!0)},G=async ae=>{if(ae.preventDefault(),!ne){X(!0);try{const _e={id:`CAN-00${t.length+1}`,...se,appliedDate:new Date().toISOString().split("T")[0]};await s(_e),R(!1),De.success(`Candidate ${se.name} added successfully`)}catch{De.error("Failed to add candidate")}finally{X(!1)}}},E=()=>{if(t.length===0){De.error("No candidates to export");return}const ue=[["ID","Name","Role","Experience","Status","Email"].join(","),...t.map(Xe=>[`"${Xe.id}"`,`"${Xe.name}"`,`"${Xe.role}"`,`"${Xe.experience}"`,`"${Xe.status}"`,`"${Xe.email}"`].join(","))].join(`
`),ke=new Blob([ue],{type:"text/csv;charset=utf-8;"}),$e=URL.createObjectURL(ke),Je=document.createElement("a");Je.setAttribute("href",$e),Je.setAttribute("download",`candidates_export_${new Date().toISOString().split("T")[0]}.csv`),Je.style.visibility="hidden",document.body.appendChild(Je),Je.click(),document.body.removeChild(Je),De.success("Candidates exported successfully")},re=ae=>{var ke;const _e=(ke=ae.target.files)==null?void 0:ke[0];if(!_e||ne)return;X(!0);const ue=new FileReader;ue.onload=async $e=>{var Je;try{const Ne=((Je=$e.target)==null?void 0:Je.result).split(`
`).filter(we=>we.trim()!=="");if(Ne.length<2){De.error("Invalid CSV file format");return}const Ye=[];for(let we=1;we<Ne.length;we++){const J=Ne[we].match(/(".*?"|[^",\s]+)(?=\s*,|\s*$)/g);if(!J||J.length<5)continue;const ve=xe=>xe.replace(/^"|"$/g,"").trim(),Oe={id:ve(J[0]),name:ve(J[1]),role:ve(J[2]),experience:ve(J[3]),status:ve(J[4]),email:ve(J[5])||"",appliedDate:new Date().toISOString().split("T")[0]};Ye.push(Oe)}if(Ye.length===0){De.error("No valid data found in CSV");return}const at=new Set(t.map(we=>we.id)),Y=Ye.filter(we=>!at.has(we.id));if(Y.length===0)De.info("All records in CSV already exist");else{for(const we of Y)await s(we);De.success(`Successfully imported ${Y.length} new candidates`)}}catch(Xe){console.error("Import error:",Xe),De.error("Failed to parse CSV file")}finally{X(!1),ae.target&&(ae.target.value="")}},ue.readAsText(_e)},he=async(ae,_e)=>{if(!ne){X(!0);try{if(await o(ae,{status:_e}),_e==="Hired"){const ue=t.find(ke=>ke.id===ae);if(ue){const ke=`ENG-${Math.random().toString(36).substr(2,5).toUpperCase()}`;await u({id:ke,name:ue.name,role:ue.role,email:ue.email,phone:"N/A",department:"Pending Assignment",status:"Pending Approval",experience:ue.experience,type:"Internal"}),De.success(`Candidate ${ue.name} hired!`,{description:"Transferred to Employees directory for final approval.",action:{label:"View Employees",onClick:()=>f("/employees")}})}}else De.success(`Status updated to ${_e}`);B(null)}catch{De.error("Failed to update status")}finally{X(!1)}}},oe=e.filter(ae=>{const _e=v.toLowerCase(),ue=ae.title.toLowerCase().includes(_e)||ae.department.toLowerCase().includes(_e);return A==="All"?ue:ue&&ae.status===A}),z=t.filter(ae=>{const _e=v.toLowerCase(),ue=ae.name.toLowerCase().includes(_e)||ae.role.toLowerCase().includes(_e)||ae.status.toLowerCase().includes(_e);if(j==="All")return ue;const ke=e.find($e=>$e.title===ae.role);return ue&&(ke==null?void 0:ke.status)===j}),fe=N.useMemo(()=>{const ae=new Date;return ae.setDate(ae.getDate()-30),t.filter(_e=>new Date(_e.appliedDate).getTime()>=ae.getTime()).length},[t]),de=N.useMemo(()=>{const ae=new Date;return ae.setDate(ae.getDate()-30),e.filter(_e=>new Date(_e.postedDate).getTime()>=ae.getTime()).length},[e]),W=N.useMemo(()=>t.filter(ae=>["Screening","Interview","Offer"].includes(ae.status)).length,[t]);return i.jsxs("div",{className:"space-y-10 pb-20",children:[i.jsxs("div",{className:"relative overflow-hidden rounded-3xl bg-slate-950 p-8 md:p-12 text-white shadow-2xl",children:[i.jsxs("div",{className:"relative z-10 max-w-2xl",children:[i.jsxs("h1",{className:"font-serif text-5xl md:text-7xl font-bold leading-tight tracking-tighter mb-4",children:["Find the ",i.jsx("span",{className:"italic text-blue-400",children:"Perfect"})," Match."]}),i.jsx("p",{className:"text-lg md:text-xl text-slate-400 font-light max-w-lg mb-8",children:"Our recruitment engine helps you scale your engineering teams with precision and speed."}),i.jsxs("div",{className:"flex flex-wrap gap-3",children:[d("hr.create")&&i.jsxs("button",{onClick:Ae,className:"group flex items-center gap-2 rounded-full bg-blue-500 px-6 py-3 text-sm font-semibold text-white hover:bg-blue-400 transition-all shadow-lg shadow-blue-500/20",children:[i.jsx($n,{size:18,className:"group-hover:rotate-90 transition-transform"}),"Post New Job"]}),d("hr.create")&&i.jsxs("button",{onClick:H,className:"flex items-center gap-2 rounded-full bg-white/10 px-6 py-3 text-sm font-semibold text-white hover:bg-white/20 transition-all backdrop-blur-md",children:[i.jsx(Oh,{size:18}),"Add Candidate"]}),d("hr.create")&&i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"file",accept:".csv",className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",onChange:re}),i.jsxs("button",{className:"flex items-center gap-2 rounded-full bg-white/10 px-6 py-3 text-sm font-semibold text-white hover:bg-white/20 transition-all backdrop-blur-md",children:[i.jsx(co,{size:18}),"Import Candidates"]})]}),d("hr.export")&&i.jsxs("button",{onClick:E,className:"flex items-center gap-2 rounded-full bg-white/10 px-6 py-3 text-sm font-semibold text-white hover:bg-white/20 transition-all backdrop-blur-md",children:[i.jsx(Nr,{size:18}),"Export Candidates"]})]})]}),i.jsx("div",{className:"absolute top-0 right-0 -translate-y-1/2 translate-x-1/4 w-96 h-96 bg-blue-500/20 rounded-full blur-3xl"}),i.jsx("div",{className:"absolute bottom-0 right-0 translate-y-1/2 translate-x-1/4 w-64 h-64 bg-purple-500/10 rounded-full blur-3xl"})]}),i.jsxs("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(wb,{title:"Active Openings",value:e.filter(ae=>ae.status==="Open"||ae.status==="Interviewing").length.toString(),icon:Ni,trend:`${de} posted recently`,trendColor:"text-blue-500",onClick:()=>y("jobs")}),i.jsx(wb,{title:"Total Applicants",value:t.length.toString(),icon:Hn,trend:`${fe} in last 30 days`,trendColor:"text-blue-500",onClick:()=>{y("candidates"),w("")}}),i.jsx(wb,{title:"In Pipeline",value:W.toString(),icon:Lo,trend:`${t.filter(ae=>ae.status==="Interview").length} interviewing`,trendColor:"text-purple-500",onClick:()=>{y("candidates"),w("")}}),i.jsx(wb,{title:"Hired",value:e.filter(ae=>ae.status==="Closed").length.toString(),icon:Hl,trend:`${t.filter(ae=>ae.status==="Hired").length} hired`,trendColor:"text-green-500",onClick:()=>{y("jobs"),w("Closed")}})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-border",children:i.jsxs("div",{className:"flex",children:[i.jsxs("button",{onClick:()=>y("jobs"),className:tt("px-8 py-4 text-sm font-bold tracking-widest uppercase transition-all relative",x==="jobs"?"text-foreground":"text-muted-foreground hover:text-foreground"),children:["Job Openings",x==="jobs"&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-1 bg-blue-500"})]}),i.jsxs("button",{onClick:()=>y("candidates"),className:tt("px-8 py-4 text-sm font-bold tracking-widest uppercase transition-all relative",x==="candidates"?"text-foreground":"text-muted-foreground hover:text-foreground"),children:["Candidates",x==="candidates"&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-1 bg-blue-500"})]})]})}),i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center justify-between bg-card p-4 rounded-2xl shadow-sm border border-border",children:[i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(fs,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:x==="jobs"?"Search positions...":"Search candidates...",value:v,onChange:ae=>w(ae.target.value),className:"h-12 w-full rounded-xl border-none bg-muted pl-12 pr-4 text-sm focus:ring-2 focus:ring-blue-500/20 transition-all text-foreground"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[x==="candidates"&&i.jsxs("select",{value:j,onChange:ae=>k(ae.target.value),className:"h-12 rounded-xl border-border bg-card px-4 text-sm font-medium focus:ring-2 focus:ring-blue-500/20 text-foreground",children:[i.jsx("option",{value:"All",children:"All Jobs"}),i.jsx("option",{value:"Open",children:"Open"}),i.jsx("option",{value:"Interviewing",children:"Interviewing"}),i.jsx("option",{value:"Closed",children:"Closed"}),i.jsx("option",{value:"Rejected",children:"Cancelled"}),i.jsx("option",{value:"Draft",children:"Draft"})]}),x==="jobs"&&i.jsxs("select",{value:A,onChange:ae=>T(ae.target.value),className:"h-12 rounded-xl border-border bg-card px-4 text-sm font-medium focus:ring-2 focus:ring-blue-500/20 text-foreground",children:[i.jsx("option",{value:"All",children:"All Statuses"}),i.jsx("option",{value:"Open",children:"Open"}),i.jsx("option",{value:"Interviewing",children:"Interviewing"}),i.jsx("option",{value:"Draft",children:"Draft"}),i.jsx("option",{value:"Closed",children:"Closed"}),i.jsx("option",{value:"Rejected",children:"Cancelled"})]}),i.jsx("button",{onClick:()=>{w(""),T("All"),k("All")},className:"h-12 px-6 rounded-xl border border-border bg-card text-sm font-bold uppercase tracking-wider hover:bg-accent transition-all text-foreground",children:"Reset"})]})]}),x==="jobs"?i.jsxs("div",{className:"grid gap-8 md:grid-cols-2 xl:grid-cols-3",children:[oe.map(ae=>i.jsxs("div",{className:"group relative flex flex-col rounded-3xl border border-border bg-card p-8 shadow-sm hover:shadow-xl hover:-translate-y-1 transition-all duration-300",children:[i.jsxs("div",{className:"flex items-start justify-between mb-6",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-blue-500",children:ae.department}),i.jsx("h3",{className:"font-serif text-2xl font-bold leading-tight group-hover:text-blue-600 transition-colors text-foreground",children:ae.title})]}),d("hr.edit")&&i.jsxs("div",{className:"relative",children:[i.jsx("button",{onClick:()=>B(M===ae.id?null:ae.id),className:tt("p-2 hover:bg-muted rounded-full text-muted-foreground transition-colors",M===ae.id&&"bg-muted text-foreground"),children:i.jsx(Ym,{size:20})}),M===ae.id&&i.jsxs("div",{ref:le,className:"absolute right-0 top-10 z-50 w-48 rounded-2xl border border-border bg-popover p-2 shadow-2xl animate-in fade-in zoom-in duration-200",children:[d("hr.edit")&&i.jsx("button",{onClick:()=>ce(ae),className:"flex w-full items-center gap-3 rounded-xl px-4 py-2.5 text-left text-sm font-medium hover:bg-accent transition-colors text-popover-foreground",children:"Edit Details"}),d("hr.edit")&&i.jsx("button",{disabled:ne,onClick:async()=>{if(!ne){X(!0);try{await n(ae.id,{status:ae.status==="Open"?"Closed":"Open"}),De.info("Job status updated"),B(null)}catch{De.error("Failed to update status")}finally{X(!1)}}},className:"flex w-full items-center gap-3 rounded-xl px-4 py-2.5 text-left text-sm font-medium hover:bg-accent transition-colors disabled:opacity-50 text-popover-foreground",children:"Toggle Status"}),i.jsx("div",{className:"my-1 border-t border-border"}),d("hr.delete")&&i.jsx("button",{disabled:ne,onClick:async()=>{if(!ne){X(!0);try{await a(ae.id),De.error("Job opening deleted"),B(null)}catch{De.error("Failed to delete job")}finally{X(!1)}}},className:"flex w-full items-center gap-3 rounded-xl px-4 py-2.5 text-left text-sm font-medium text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-50",children:"Delete Job"})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-8",children:[i.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[i.jsx("div",{className:"p-2 rounded-lg bg-muted",children:i.jsx(P9,{size:16})}),i.jsx("span",{className:"text-sm font-medium",children:ae.location})]}),i.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[i.jsx("div",{className:"p-2 rounded-lg bg-muted",children:i.jsx(Ui,{size:16})}),i.jsx("span",{className:"text-sm font-medium",children:ae.type})]})]}),i.jsxs("div",{className:"mt-auto flex items-center justify-between",children:[i.jsxs("div",{onClick:()=>{w(ae.title),y("candidates"),window.scrollTo({top:0,behavior:"smooth"})},className:"flex -space-x-2 cursor-pointer hover:opacity-80 transition-opacity",children:[[1,2,3].map(_e=>i.jsx("div",{className:"h-8 w-8 rounded-full border-2 border-card bg-muted flex items-center justify-center text-[10px] font-bold",children:String.fromCharCode(64+_e)},_e)),i.jsxs("div",{className:"h-8 w-8 rounded-full border-2 border-card bg-muted flex items-center justify-center text-[10px] font-bold text-muted-foreground",children:["+",ae.applicants]})]}),i.jsx("span",{className:tt("rounded-full px-4 py-1 text-[10px] font-bold uppercase tracking-widest",ae.status==="Open"?"bg-green-100 text-green-700":ae.status==="Interviewing"?"bg-purple-100 text-purple-700":ae.status==="Draft"?"bg-yellow-100 text-yellow-700":ae.status==="Rejected"?"bg-red-100 text-red-700":"bg-slate-100 text-slate-600"),children:ae.status})]})]},ae.id)),oe.length===0&&i.jsx("div",{className:"col-span-full py-20 text-center bg-card rounded-3xl border border-dashed border-border",children:i.jsxs("div",{className:"flex flex-col items-center gap-4",children:[i.jsx("div",{className:"p-6 rounded-full bg-muted",children:i.jsx(Ni,{size:48,className:"text-muted-foreground/30"})}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("h3",{className:"text-xl font-bold text-foreground",children:"No positions found"}),i.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search or filters to find what you're looking for."})]}),i.jsx("button",{onClick:()=>{w(""),T("All")},className:"mt-4 px-8 py-3 rounded-full bg-primary text-primary-foreground text-sm font-bold uppercase tracking-wider hover:bg-primary/90 transition-all",children:"Clear all filters"})]})})]}):i.jsx("div",{className:"rounded-3xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border bg-muted/50",children:[i.jsx("th",{className:"px-8 py-5 font-bold uppercase tracking-widest text-[10px] text-muted-foreground",children:"Candidate"}),i.jsx("th",{className:"px-8 py-5 font-bold uppercase tracking-widest text-[10px] text-muted-foreground",children:"Position"}),i.jsx("th",{className:"px-8 py-5 font-bold uppercase tracking-widest text-[10px] text-muted-foreground",children:"Experience"}),i.jsx("th",{className:"px-8 py-5 font-bold uppercase tracking-widest text-[10px] text-muted-foreground",children:"Status"}),i.jsx("th",{className:"px-8 py-5 font-bold uppercase tracking-widest text-[10px] text-muted-foreground text-right",children:"Actions"})]})}),i.jsxs("tbody",{className:"divide-y divide-border",children:[z.map(ae=>i.jsxs("tr",{className:"hover:bg-accent/5 transition-colors group",children:[i.jsx("td",{className:"px-8 py-6",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"h-12 w-12 rounded-2xl bg-blue-500/10 flex items-center justify-center text-blue-500 font-bold text-sm",children:ae.name.split(" ").map(_e=>_e[0]).join("")}),i.jsxs("div",{children:[i.jsx("p",{className:"font-bold text-foreground group-hover:text-primary transition-colors",children:ae.name}),i.jsx("p",{className:"text-xs text-muted-foreground",children:ae.email})]})]})}),i.jsx("td",{className:"px-8 py-6",children:i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"font-medium text-foreground/80",children:ae.role}),(()=>{const _e=e.find(ue=>ue.title===ae.role);return _e?i.jsx("span",{className:tt("inline-flex w-fit items-center rounded-full px-2 py-0.5 text-[9px] font-bold uppercase tracking-tighter",_e.status==="Open"?"bg-green-500/10 text-green-500":_e.status==="Interviewing"?"bg-purple-500/10 text-purple-500":_e.status==="Draft"?"bg-yellow-500/10 text-yellow-500":_e.status==="Rejected"?"bg-red-500/10 text-red-500":"bg-muted text-muted-foreground"),children:_e.status==="Rejected"?"Cancelled":_e.status}):null})()]})}),i.jsx("td",{className:"px-8 py-6 text-muted-foreground font-medium",children:ae.experience}),i.jsx("td",{className:"px-8 py-6",children:i.jsx("span",{className:tt("inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-[10px] font-bold uppercase tracking-wider",ae.status==="Hired"?"bg-green-500 text-white":ae.status==="Offer"?"bg-blue-500 text-white":ae.status==="Interview"?"bg-purple-500 text-white":ae.status==="Rejected"?"bg-red-500 text-white":"bg-muted text-muted-foreground"),children:ae.status})}),i.jsx("td",{className:"px-8 py-6 text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[d("hr.export")&&i.jsx("button",{onClick:()=>De.info(`Viewing resume of ${ae.name}`),className:"h-10 w-10 flex items-center justify-center hover:bg-accent hover:shadow-md rounded-xl text-muted-foreground hover:text-primary transition-all",title:"View Resume",children:i.jsx(Tn,{size:18})}),(d("hr.edit")||d("hr.delete"))&&i.jsxs("div",{className:"relative",children:[i.jsx("button",{onClick:()=>B(M===ae.id?null:ae.id),className:tt("h-10 w-10 flex items-center justify-center hover:bg-muted hover:shadow-md rounded-xl text-muted-foreground transition-all",M===ae.id&&"bg-muted shadow-md text-foreground"),children:i.jsx(Ym,{size:18})}),M===ae.id&&i.jsxs("div",{ref:le,className:"absolute right-0 top-12 z-50 w-56 rounded-2xl border border-border bg-card p-2 shadow-2xl animate-in fade-in zoom-in duration-200",children:[i.jsx("div",{className:"px-4 py-2 text-[10px] font-bold uppercase tracking-widest text-muted-foreground",children:"Management"}),d("hr.edit")&&i.jsxs("button",{onClick:()=>{he(ae.id,"Interview"),De.info(`Interview scheduled for ${ae.name}`),B(null)},className:"flex w-full items-center gap-3 rounded-xl px-4 py-2.5 text-left text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Lo,{size:16,className:"text-muted-foreground"}),"Schedule Interview"]}),d("hr.edit")&&i.jsxs("button",{onClick:()=>{De.info(`Sending email to ${ae.name}`),B(null)},className:"flex w-full items-center gap-3 rounded-xl px-4 py-2.5 text-left text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Gl,{size:16,className:"text-muted-foreground"}),"Send Message"]}),d("hr.edit")&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-border"}),i.jsx("div",{className:"px-4 py-2 text-[10px] font-bold uppercase tracking-widest text-muted-foreground",children:"Status"}),i.jsx("div",{className:"grid grid-cols-2 gap-1 p-1",children:["Screening","Interview","Offer","Hired","Rejected"].map(_e=>i.jsx("button",{disabled:ne,onClick:()=>he(ae.id,_e),className:tt("px-2 py-1.5 rounded-lg text-[10px] font-bold text-center transition-all disabled:opacity-50",ae.status===_e?"bg-foreground text-background":"bg-muted text-muted-foreground hover:bg-accent"),children:_e==="Rejected"&&ne&&ae.status!==_e?"...":_e},_e))})]}),d("hr.delete")&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-border"}),i.jsxs("button",{disabled:ne,onClick:async()=>{if(!ne){X(!0);try{await l(ae.id),De.error("Candidate removed"),B(null)}catch{De.error("Failed to delete candidate")}finally{X(!1)}}},className:"flex w-full items-center gap-3 rounded-xl px-4 py-2.5 text-left text-sm font-medium text-red-500 hover:bg-red-50 transition-colors disabled:opacity-50",children:[i.jsx(aa,{size:16,className:"text-red-400"}),"Remove Candidate"]})]})]})]})]})})]},ae.id)),z.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-8 py-20 text-center",children:i.jsxs("div",{className:"flex flex-col items-center gap-4",children:[i.jsx("div",{className:"p-6 rounded-full bg-muted",children:i.jsx(Hn,{size:48,className:"text-muted-foreground/30"})}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("h3",{className:"text-xl font-bold text-foreground",children:"No candidates found"}),i.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search or filters to find what you're looking for."})]}),i.jsx("button",{onClick:()=>{w(""),k("All")},className:"mt-4 px-8 py-3 rounded-full bg-primary text-primary-foreground text-sm font-bold uppercase tracking-wider hover:bg-primary/90 transition-all",children:"Clear all filters"})]})})})]})]})})})]}),i.jsx(lAe,{isOpen:I,onClose:()=>{q(!1),F(null)},onSubmit:D,formData:K,setFormData:ee,isEditing:!!L}),i.jsx(cAe,{isOpen:P,onClose:()=>R(!1),onSubmit:G,formData:se,setFormData:Z,availableRoles:e.filter(ae=>ae.status==="Open").map(ae=>ae.title)})]})}function lAe({isOpen:e,onClose:t,onSubmit:r,formData:n,setFormData:a,isEditing:s}){return e?i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/40 backdrop-blur-md p-4 animate-in fade-in duration-300",children:i.jsxs("div",{className:"w-full max-w-lg rounded-[2rem] border border-border bg-card p-10 shadow-2xl animate-in zoom-in-95 duration-300",children:[i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsx("h2",{className:"font-serif text-3xl font-bold text-foreground",children:s?"Edit Position":"New Position"}),i.jsx("button",{onClick:t,className:"rounded-full p-2 hover:bg-muted text-muted-foreground transition-colors",children:i.jsx(xr,{size:24})})]}),i.jsxs("form",{onSubmit:r,className:"space-y-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Job Title"}),i.jsx("input",{required:!0,type:"text",value:n.title||"",onChange:o=>a({...n,title:o.target.value}),placeholder:"e.g. Senior Product Designer",className:"h-14 w-full rounded-2xl border-none bg-muted px-6 text-sm font-medium focus:ring-2 focus:ring-primary/20 transition-all text-foreground"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Department"}),i.jsx("input",{required:!0,type:"text",value:n.department||"",onChange:o=>a({...n,department:o.target.value}),placeholder:"e.g. Engineering",className:"h-14 w-full rounded-2xl border-none bg-muted px-6 text-sm font-medium focus:ring-2 focus:ring-primary/20 transition-all text-foreground"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Location"}),i.jsx("input",{required:!0,type:"text",value:n.location||"",onChange:o=>a({...n,location:o.target.value}),placeholder:"e.g. Remote or City, State",className:"h-14 w-full rounded-2xl border-none bg-muted px-6 text-sm font-medium focus:ring-2 focus:ring-primary/20 transition-all text-foreground"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Employment Type"}),i.jsxs("select",{value:n.type||"Full-time",onChange:o=>a({...n,type:o.target.value}),className:"h-14 w-full rounded-2xl border-none bg-muted px-6 text-sm font-medium focus:ring-2 focus:ring-primary/20 transition-all text-foreground",children:[i.jsx("option",{value:"Full-time",children:"Full-time"}),i.jsx("option",{value:"Contract",children:"Contract"}),i.jsx("option",{value:"Remote",children:"Remote"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Status"}),i.jsxs("select",{value:n.status||"Draft",onChange:o=>a({...n,status:o.target.value}),className:"h-14 w-full rounded-2xl border-none bg-muted px-6 text-sm font-medium focus:ring-2 focus:ring-primary/20 transition-all text-foreground",children:[i.jsx("option",{value:"Draft",children:"Draft"}),i.jsx("option",{value:"Open",children:"Open"}),i.jsx("option",{value:"Interviewing",children:"Interviewing"}),i.jsx("option",{value:"Closed",children:"Closed"}),i.jsx("option",{value:"Rejected",children:"Rejected"})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-4 pt-6",children:[i.jsx("button",{type:"button",onClick:t,className:"h-14 px-8 rounded-2xl text-sm font-bold uppercase tracking-widest text-muted-foreground hover:text-foreground transition-all",children:"Cancel"}),i.jsx("button",{type:"submit",className:"h-14 px-10 rounded-2xl bg-primary text-primary-foreground text-sm font-bold uppercase tracking-widest hover:bg-primary/90 transition-all shadow-xl shadow-primary/20",children:s?"Update Position":"Publish Position"})]})]})]})}):null}function cAe({isOpen:e,onClose:t,onSubmit:r,formData:n,setFormData:a,availableRoles:s}){return e?i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/40 backdrop-blur-md p-4 animate-in fade-in duration-300",children:i.jsxs("div",{className:"w-full max-w-lg rounded-[2rem] border border-border bg-card p-10 shadow-2xl animate-in zoom-in-95 duration-300",children:[i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsx("h2",{className:"font-serif text-3xl font-bold text-foreground",children:"Add Candidate"}),i.jsx("button",{onClick:t,className:"rounded-full p-2 hover:bg-muted text-muted-foreground transition-colors",children:i.jsx(xr,{size:24})})]}),i.jsxs("form",{onSubmit:r,className:"space-y-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Full Name"}),i.jsx("input",{required:!0,type:"text",value:n.name||"",onChange:o=>a({...n,name:o.target.value}),placeholder:"e.g. John Doe",className:"h-14 w-full rounded-2xl border-none bg-muted px-6 text-sm font-medium focus:ring-2 focus:ring-primary/20 transition-all text-foreground"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Email Address"}),i.jsx("input",{required:!0,type:"email",value:n.email||"",onChange:o=>a({...n,email:o.target.value}),placeholder:"e.g. john.doe@example.com",className:"h-14 w-full rounded-2xl border-none bg-muted px-6 text-sm font-medium focus:ring-2 focus:ring-primary/20 transition-all text-foreground"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Applied Role"}),i.jsxs("select",{required:!0,value:n.role||"",onChange:o=>a({...n,role:o.target.value}),className:"h-14 w-full rounded-2xl border-none bg-muted px-6 text-sm font-medium focus:ring-2 focus:ring-primary/20 transition-all text-foreground",children:[i.jsx("option",{value:"",disabled:!0,children:"Select a role"}),s.map(o=>i.jsx("option",{value:o,children:o},o)),i.jsx("option",{value:"Other",children:"Other"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Experience"}),i.jsx("input",{required:!0,type:"text",value:n.experience||"",onChange:o=>a({...n,experience:o.target.value}),placeholder:"e.g. 5 years",className:"h-14 w-full rounded-2xl border-none bg-muted px-6 text-sm font-medium focus:ring-2 focus:ring-primary/20 transition-all text-foreground"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Application Status"}),i.jsxs("select",{value:n.status||"Applied",onChange:o=>a({...n,status:o.target.value}),className:"h-14 w-full rounded-2xl border-none bg-muted px-6 text-sm font-medium focus:ring-2 focus:ring-primary/20 transition-all text-foreground",children:[i.jsx("option",{value:"Applied",children:"Applied"}),i.jsx("option",{value:"Screening",children:"Screening"}),i.jsx("option",{value:"Interview",children:"Interview"}),i.jsx("option",{value:"Offer",children:"Offer"}),i.jsx("option",{value:"Hired",children:"Hired"}),i.jsx("option",{value:"Rejected",children:"Rejected"})]})]}),i.jsxs("div",{className:"flex justify-end gap-4 pt-6",children:[i.jsx("button",{type:"button",onClick:t,className:"h-14 px-8 rounded-2xl text-sm font-bold uppercase tracking-widest text-muted-foreground hover:text-foreground transition-all",children:"Cancel"}),i.jsx("button",{type:"submit",className:"h-14 px-10 rounded-2xl bg-primary text-primary-foreground text-sm font-bold uppercase tracking-widest hover:bg-primary/90 transition-all shadow-xl shadow-primary/20",children:"Add Candidate"})]})]})]})}):null}function wb({title:e,value:t,icon:r,trend:n,trendColor:a="text-slate-500",onClick:s}){return i.jsxs("div",{onClick:s,className:tt("group rounded-3xl border border-border bg-card p-6 shadow-sm transition-all duration-300",s&&"cursor-pointer hover:shadow-xl hover:-translate-y-1 hover:border-primary/20"),children:[i.jsx("div",{className:"flex items-center justify-between mb-4",children:i.jsx("div",{className:"p-3 rounded-2xl bg-muted text-muted-foreground group-hover:bg-primary/10 group-hover:text-primary transition-colors",children:i.jsx(r,{size:24})})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground mb-1",children:e}),i.jsx("p",{className:"text-3xl font-serif font-bold text-foreground",children:t}),i.jsx("p",{className:tt("text-xs mt-2 font-medium",a),children:n})]})]})}function uAe(){var y;const{projects:e,expenses:t,companySettings:r}=ca(),[n,a]=N.useState("ledger"),[s,o]=N.useState("pnl"),[l,u]=N.useState(""),d=N.useMemo(()=>{const v=[{id:"1000",code:"1000",name:"Cash & Bank",type:"Asset",balance:0},{id:"1100",code:"1100",name:"Accounts Receivable",type:"Asset",balance:0},{id:"2000",code:"2000",name:"Accounts Payable",type:"Liability",balance:0},{id:"2100",code:"2100",name:"Tax Payable (VAT)",type:"Liability",balance:0},{id:"3000",code:"3000",name:"Owner's Equity",type:"Equity",balance:0},{id:"4000",code:"4000",name:"Project Revenue",type:"Revenue",balance:0},{id:"5000",code:"5000",name:"Engineer Payouts",type:"Expense",balance:0},{id:"5100",code:"5100",name:"Operating Expenses",type:"Expense",balance:0},{id:"5200",code:"5200",name:"Travel & Materials",type:"Expense",balance:0},{id:"5300",code:"5300",name:"Tax Payments",type:"Expense",balance:0},{id:"5400",code:"5400",name:"Vendor Commissions",type:"Expense",balance:0}],w=(T,M)=>!M||M==="USD"||M==="$"?T:T*({EUR:1.08,Euro:1.08,"€":1.08,GBP:1.25,"£":1.25,CAD:.74,AED:.27,SAR:.27}[M]||1);e.forEach(T=>{const M=w(T.clientTotalAmount||0,T.currency),B=w(T.taxAmount||0,T.currency),L=M-B,F=w(T.totalAmount||0,T.currency);v.find(R=>R.id==="4000").balance+=L,v.find(R=>R.id==="2100").balance+=B,T.clientInvoiceStatus!=="Paid"?v.find(R=>R.id==="1100").balance+=M:v.find(R=>R.id==="1000").balance+=M,v.find(R=>R.id==="5000").balance+=F;let I=0;if(T.commissions&&T.commissions.length>0)I=T.commissions.reduce((R,K)=>R+(K.amount||0),0);else if(T.thirdPartyName){const R=T.clientTotalAmount||T.totalAmount||0;I=T.thirdPartyCommissionAmount||R*((T.thirdPartyCommissionRate||0)/100)}const q=w(I,T.currency);q>0&&(v.find(R=>R.id==="5400").balance+=q,T.thirdPartyStatus==="Paid"||T.commissions&&T.commissions.every(R=>R.status==="Paid")?v.find(R=>R.id==="1000").balance-=q:v.find(R=>R.id==="2000").balance+=q);const P=w((T.travelCost||0)+(T.materialCost||0),T.currency);P>0&&(v.find(R=>R.id==="5200").balance+=P),T.engineerInvoiceStatus!=="Paid"?v.find(R=>R.id==="2000").balance+=F:v.find(R=>R.id==="1000").balance-=F}),t.forEach(T=>{T.status==="Approved"&&(T.category==="Tax Payment"?(v.find(M=>M.id==="5300").balance+=T.amount,v.find(M=>M.id==="2100").balance-=T.amount,v.find(M=>M.id==="1000").balance-=T.amount):T.category==="Travel"||T.category==="Materials"||T.category==="Travel & Materials"?(v.find(M=>M.id==="5200").balance+=T.amount,v.find(M=>M.id==="1000").balance-=T.amount):(v.find(M=>M.id==="5100").balance+=T.amount,v.find(M=>M.id==="1000").balance-=T.amount))});const j=v.filter(T=>T.type==="Asset").reduce((T,M)=>T+M.balance,0),k=v.filter(T=>T.type==="Liability").reduce((T,M)=>T+M.balance,0),A=v.find(T=>T.id==="3000");return A&&(A.balance=j-k),v},[e,t]),f=N.useMemo(()=>{var F,I,q;const v=(P,R)=>!R||R==="USD"||R==="$"?P:P*({EUR:1.08,Euro:1.08,"€":1.08,GBP:1.25,"£":1.25,CAD:.74,AED:.27,SAR:.27}[R]||1);let w=0,j=0,k=0,A=0;e.forEach(P=>{w+=v(P.clientTotalAmount||0,P.currency),j+=v(P.totalAmount||0,P.currency),k+=v(P.taxAmount||0,P.currency)}),t.forEach(P=>{P.status==="Approved"&&(P.category==="Tax Payment"?A+=P.amount:j+=P.amount)});const T=(r.corporateTaxRate||25)/100,M=w-j,B=Math.max(0,M*T),L=Math.max(0,k-A);return{corporateTax:B,totalEstimate:B+L,ownersEquity:((F=d.find(P=>P.id==="3000"))==null?void 0:F.balance)||0,taxPayments:((I=d.find(P=>P.id==="5300"))==null?void 0:I.balance)||0,travelMaterials:((q=d.find(P=>P.id==="5200"))==null?void 0:q.balance)||0}},[e,t,d]),g=N.useMemo(()=>{const v=(j,k)=>!k||k==="USD"||k==="$"?j:j*({EUR:1.08,Euro:1.08,"€":1.08,GBP:1.25,"£":1.25,CAD:.74,AED:.27,SAR:.27}[k]||1),w=[];return e.forEach(j=>{const k=v(j.clientTotalAmount||0,j.currency),A=v(j.taxAmount||0,j.currency),T=k-A,M=v(j.totalAmount||0,j.currency),B=j.issueDate||new Date().toISOString().split("T")[0];k>0&&(w.push({id:`JE-REV-NET-${j.id}`,date:B,description:`Project Revenue (Net) - ${j.client}`,reference:j.ticketId||j.id,debit:0,credit:T,account:"Project Revenue"}),A>0&&w.push({id:`JE-TAX-PAY-${j.id}`,date:B,description:`Tax Payable (VAT) - ${j.client}`,reference:j.ticketId||j.id,debit:0,credit:A,account:"Tax Payable (VAT)"}),j.clientInvoiceStatus==="Paid"?w.push({id:`JE-CASH-IN-${j.id}`,date:B,description:`Cash Receipt - ${j.client}`,reference:j.ticketId||j.id,debit:k,credit:0,account:"Cash & Bank"}):w.push({id:`JE-AR-${j.id}`,date:B,description:`Accounts Receivable - ${j.client}`,reference:j.ticketId||j.id,debit:k,credit:0,account:"Accounts Receivable"})),M>0&&(w.push({id:`JE-ENG-${j.id}`,date:B,description:`Engineer Cost - ${j.assignedTo}`,reference:j.ticketId||j.id,debit:M,credit:0,account:"Engineer Payouts"}),j.engineerInvoiceStatus==="Paid"?w.push({id:`JE-CASH-OUT-${j.id}`,date:B,description:`Cash Payment - ${j.assignedTo}`,reference:j.ticketId||j.id,debit:0,credit:M,account:"Cash & Bank"}):w.push({id:`JE-AP-${j.id}`,date:B,description:`Accounts Payable - ${j.assignedTo}`,reference:j.ticketId||j.id,debit:0,credit:M,account:"Accounts Payable"}));let L=[];if(j.commissions&&j.commissions.length>0)L=j.commissions;else if(j.thirdPartyName){const F=j.clientTotalAmount||j.totalAmount||0,I=j.thirdPartyCommissionAmount||F*((j.thirdPartyCommissionRate||0)/100);L=[{id:`LEGACY-${j.id}`,vendorName:j.thirdPartyName,amount:I,status:j.thirdPartyStatus||"Unpaid"}]}L.forEach(F=>{const I=v(F.amount||0,j.currency);I>0&&(w.push({id:`JE-COMM-${F.id}`,date:B,description:`Vendor Commission - ${F.vendorName} (${j.name})`,reference:j.ticketId||j.id,debit:I,credit:0,account:"Vendor Commissions"}),F.status==="Paid"?w.push({id:`JE-COMM-CASH-${F.id}`,date:B,description:`Commission Payment - ${F.vendorName}`,reference:j.ticketId||j.id,debit:0,credit:I,account:"Cash & Bank"}):w.push({id:`JE-COMM-AP-${F.id}`,date:B,description:`Commission Payable - ${F.vendorName}`,reference:j.ticketId||j.id,debit:0,credit:I,account:"Accounts Payable"}))})}),t.forEach(j=>{if(j.status==="Approved"){const k=j.category==="Tax Payment";w.push({id:`JE-EXP-${j.id}`,date:j.date,description:j.description,reference:j.reference||j.id,debit:j.amount,credit:0,account:k?"Tax Payments":"Operating Expenses"}),k&&w.push({id:`JE-TAX-RED-${j.id}`,date:j.date,description:`Tax Liability Reduction: ${j.description}`,reference:j.reference||j.id,debit:0,credit:j.amount,account:"Tax Payable (VAT)"}),w.push({id:`JE-EXP-CASH-${j.id}`,date:j.date,description:`Payment: ${j.description}`,reference:j.reference||j.id,debit:0,credit:j.amount,account:"Cash & Bank"})}}),w.sort((j,k)=>new Date(k.date).getTime()-new Date(j.date).getTime())},[e,t]).filter(v=>v.description.toLowerCase().includes(l.toLowerCase())||v.account.toLowerCase().includes(l.toLowerCase())||v.id.toLowerCase().includes(l.toLowerCase())),x=()=>{try{const v=new tr,w=s==="pnl"?"Profit & Loss Statement":"Balance Sheet",j=new Date().toLocaleDateString();v.setFontSize(20),v.setTextColor(63,81,181),v.text("MA IT Tech Services",14,22),v.setFontSize(16),v.setTextColor(0,0,0),v.text(w,14,32),v.setFontSize(10),v.setTextColor(100,100,100),v.text(`Report Date: ${j}`,14,40),v.text("Confidential Financial Report",14,45);const k=[];if(s==="pnl"){k.push([{content:"REVENUE",colSpan:2,styles:{fillColor:[240,240,240],fontStyle:"bold"}}]),d.filter(F=>F.type==="Revenue").forEach(F=>{k.push([F.name,`$${F.balance.toLocaleString()}`])});const A=d.filter(F=>F.type==="Revenue").reduce((F,I)=>F+I.balance,0);k.push([{content:"Total Revenue",styles:{fontStyle:"bold"}},{content:`$${A.toLocaleString()}`,styles:{fontStyle:"bold"}}]),k.push([{content:"COST OF GOODS SOLD",colSpan:2,styles:{fillColor:[240,240,240],fontStyle:"bold"}}]);const T=d.find(F=>F.id==="5000");k.push([T.name,`($${T.balance.toLocaleString()})`]);const M=d.find(F=>F.id==="5400");M.balance>0&&k.push([M.name,`($${M.balance.toLocaleString()})`]),k.push([{content:"Gross Profit",styles:{fontStyle:"bold"}},{content:`$${(A-T.balance-((M==null?void 0:M.balance)||0)).toLocaleString()}`,styles:{fontStyle:"bold"}}]),k.push([{content:"OPERATING EXPENSES",colSpan:2,styles:{fillColor:[240,240,240],fontStyle:"bold"}}]),d.filter(F=>F.type==="Expense"&&F.id!=="5000").forEach(F=>{k.push([F.name,`($${F.balance.toLocaleString()})`])});const B=d.filter(F=>F.type==="Expense").reduce((F,I)=>F+I.balance,0);k.push([{content:"Total Expenses",styles:{fontStyle:"bold"}},{content:`($${B.toLocaleString()})`,styles:{fontStyle:"bold"}}]);const L=A-B;k.push([{content:"NET INCOME",styles:{fontStyle:"bold",textColor:[63,81,181]}},{content:`$${L.toLocaleString()}`,styles:{fontStyle:"bold",textColor:[63,81,181]}}])}else{k.push([{content:"ASSETS",colSpan:2,styles:{fillColor:[240,240,240],fontStyle:"bold"}}]),d.filter(B=>B.type==="Asset").forEach(B=>{k.push([B.name,`$${B.balance.toLocaleString()}`])});const A=d.filter(B=>B.type==="Asset").reduce((B,L)=>B+L.balance,0);k.push([{content:"Total Assets",styles:{fontStyle:"bold"}},{content:`$${A.toLocaleString()}`,styles:{fontStyle:"bold"}}]),k.push([{content:"LIABILITIES",colSpan:2,styles:{fillColor:[240,240,240],fontStyle:"bold"}}]),d.filter(B=>B.type==="Liability").forEach(B=>{k.push([B.name,`$${B.balance.toLocaleString()}`])});const T=d.filter(B=>B.type==="Liability").reduce((B,L)=>B+L.balance,0);k.push([{content:"Total Liabilities",styles:{fontStyle:"bold"}},{content:`$${T.toLocaleString()}`,styles:{fontStyle:"bold"}}]),k.push([{content:"EQUITY",colSpan:2,styles:{fillColor:[240,240,240],fontStyle:"bold"}}]),d.filter(B=>B.type==="Equity").forEach(B=>{k.push([B.name,`$${B.balance.toLocaleString()}`])});const M=d.filter(B=>B.type==="Equity").reduce((B,L)=>B+L.balance,0);k.push([{content:"Total Equity",styles:{fontStyle:"bold"}},{content:`$${M.toLocaleString()}`,styles:{fontStyle:"bold"}}]),k.push([{content:"TOTAL LIABILITIES & EQUITY",styles:{fontStyle:"bold",textColor:[63,81,181]}},{content:`$${(T+M).toLocaleString()}`,styles:{fontStyle:"bold",textColor:[63,81,181]}}])}zd(v,{startY:55,head:[["Account","Amount"]],body:k,theme:"striped",headStyles:{fillColor:[63,81,181]},alternateRowStyles:{fillColor:[245,245,250]}}),v.save(`${w.replace(/\s+/g,"_").toLowerCase()}_${j.replace(/\//g,"-")}.pdf`),De.success("Financial report downloaded successfully")}catch(v){console.error("PDF Generation Error:",v),De.error("Failed to generate PDF report")}};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:i.jsx(DQ,{size:24})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Bookkeeping System"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Double-entry accounting and financial reporting."})]})]}),i.jsx("div",{className:"flex items-center gap-2",children:i.jsxs("button",{onClick:()=>De.info("Manual Journal Entry coming soon"),className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-bold text-primary-foreground hover:bg-primary/90 transition-all shadow-md active:scale-95",children:[i.jsx($n,{size:18}),"New Entry"]})})]}),i.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted/50 rounded-xl border border-border w-fit",children:[i.jsxs("button",{onClick:()=>a("ledger"),className:tt("flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg transition-all",n==="ledger"?"bg-card shadow-sm text-primary":"text-muted-foreground hover:bg-muted"),children:[i.jsx(Tn,{size:16}),"General Ledger"]}),i.jsxs("button",{onClick:()=>a("accounts"),className:tt("flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg transition-all",n==="accounts"?"bg-card shadow-sm text-primary":"text-muted-foreground hover:bg-muted"),children:[i.jsx(CN,{size:16}),"Chart of Accounts"]}),i.jsxs("button",{onClick:()=>a("reports"),className:tt("flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg transition-all",n==="reports"?"bg-card shadow-sm text-primary":"text-muted-foreground hover:bg-muted"),children:[i.jsx(UP,{size:16}),"Financial Reports"]})]}),i.jsxs(on,{mode:"wait",children:[n==="ledger"&&i.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search ledger entries...",value:l,onChange:v=>u(v.target.value),className:"h-10 w-full rounded-lg border border-border bg-background pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("button",{className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Oc,{size:18}),"Filter"]}),i.jsxs("button",{onClick:()=>De.success("Ledger exported to CSV"),className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:18}),"Export"]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground",children:"Date"}),i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground",children:"Description"}),i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground",children:"Account"}),i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground text-right",children:"Debit"}),i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground text-right",children:"Credit"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:g.map(v=>i.jsxs("tr",{className:"hover:bg-muted/30 transition-colors group",children:[i.jsx("td",{className:"px-4 py-3 text-muted-foreground font-mono text-xs",children:v.date}),i.jsx("td",{className:"px-4 py-3",children:i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"font-medium",children:v.description}),i.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:v.reference})]})}),i.jsx("td",{className:"px-4 py-3",children:i.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold uppercase bg-muted text-muted-foreground",children:v.account})}),i.jsx("td",{className:"px-4 py-3 text-right font-mono text-green-500",children:v.debit>0?`$${v.debit.toLocaleString(void 0,{minimumFractionDigits:2})}`:"-"}),i.jsx("td",{className:"px-4 py-3 text-right font-mono text-red-500",children:v.credit>0?`$${v.credit.toLocaleString(void 0,{minimumFractionDigits:2})}`:"-"})]},v.id))})]})})]},"ledger"),n==="accounts"&&i.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-5 gap-4",children:[i.jsxs("div",{className:"rounded-2xl border border-border bg-indigo-600 p-6 text-white shadow-lg shadow-indigo-200/50",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("div",{className:"p-2 rounded-lg bg-white/20",children:i.jsx(UP,{size:20})}),i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-indigo-100",children:"Tax Planning"})]}),i.jsx("h3",{className:"text-sm font-medium text-indigo-100 mb-1",children:"Total Tax Estimate"}),i.jsx("div",{className:"flex items-baseline gap-2",children:i.jsxs("span",{className:"text-3xl font-bold",children:["$",f.totalEstimate.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})})]}),i.jsxs("div",{className:"rounded-2xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:i.jsx(ds,{size:20})}),i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground",children:"Fiscal Year"})]}),i.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Estimated Corporate Tax"}),i.jsx("div",{className:"flex items-baseline gap-2",children:i.jsxs("span",{className:"text-3xl font-bold text-foreground",children:["$",f.corporateTax.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})})]}),i.jsxs("div",{className:"rounded-2xl border border-border bg-emerald-600 p-6 text-white shadow-lg shadow-emerald-200/50",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("div",{className:"p-2 rounded-lg bg-white/20",children:i.jsx(CN,{size:20})}),i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-emerald-100",children:"Net Worth"})]}),i.jsx("h3",{className:"text-sm font-medium text-emerald-100 mb-1",children:"Owner's Equity"}),i.jsx("div",{className:"flex items-baseline gap-2",children:i.jsxs("span",{className:"text-3xl font-bold",children:["$",f.ownersEquity.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})})]}),i.jsxs("div",{className:"rounded-2xl border border-border bg-orange-600 p-6 text-white shadow-lg shadow-orange-200/50",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("div",{className:"p-2 rounded-lg bg-white/20",children:i.jsx(nx,{size:20})}),i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-orange-100",children:"Compliance"})]}),i.jsx("h3",{className:"text-sm font-medium text-orange-100 mb-1",children:"Tax Payments"}),i.jsx("div",{className:"flex items-baseline gap-2",children:i.jsxs("span",{className:"text-3xl font-bold",children:["$",f.taxPayments.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})})]}),i.jsxs("div",{className:"rounded-2xl border border-border bg-blue-600 p-6 text-white shadow-lg shadow-blue-200/50",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("div",{className:"p-2 rounded-lg bg-white/20",children:i.jsx(Jee,{size:20})}),i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-blue-100",children:"Operations"})]}),i.jsx("h3",{className:"text-sm font-medium text-blue-100 mb-1",children:"Travel & Materials"}),i.jsx("div",{className:"flex items-baseline gap-2",children:i.jsxs("span",{className:"text-3xl font-bold",children:["$",f.travelMaterials.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})})]})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:d.map(v=>i.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm hover:shadow-md transition-all group",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("div",{className:tt("p-2 rounded-lg",v.type==="Asset"?"bg-blue-500/10 text-blue-500":v.type==="Liability"?"bg-red-500/10 text-red-500":v.type==="Equity"?"bg-purple-500/10 text-purple-500":v.type==="Revenue"?"bg-green-500/10 text-green-500":"bg-orange-500/10 text-orange-500"),children:i.jsx(CN,{size:20})}),i.jsxs("span",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground",children:["#",v.code]})]}),i.jsx("h3",{className:"text-lg font-bold mb-1",children:v.name}),i.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wider mb-4",children:v.type}),i.jsxs("div",{className:"flex items-end justify-between",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Current Balance"}),i.jsxs("span",{className:tt("text-xl font-bold",v.balance>=0?"text-foreground":"text-red-500"),children:["$",v.balance.toLocaleString(void 0,{minimumFractionDigits:2})]})]}),i.jsx("button",{className:"p-2 rounded-lg hover:bg-accent text-muted-foreground transition-colors opacity-0 group-hover:opacity-100",children:i.jsx(Io,{size:18})})]})]},v.id))})]},"accounts"),n==="reports"&&i.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center gap-2 p-1 bg-muted/50 rounded-xl border border-border w-fit",children:[i.jsx("button",{onClick:()=>o("pnl"),className:tt("px-4 py-2 text-sm font-medium rounded-lg transition-all",s==="pnl"?"bg-card shadow-sm text-primary":"text-muted-foreground hover:bg-muted"),children:"Profit & Loss"}),i.jsx("button",{onClick:()=>o("balance_sheet"),className:tt("px-4 py-2 text-sm font-medium rounded-lg transition-all",s==="balance_sheet"?"bg-card shadow-sm text-primary":"text-muted-foreground hover:bg-muted"),children:"Balance Sheet"})]}),i.jsxs("div",{className:"rounded-2xl border border-border bg-card p-8 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-2xl font-bold tracking-tight",children:s==="pnl"?"Profit & Loss Statement":"Balance Sheet"}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["For the period ending ",new Date().toLocaleDateString()]})]}),i.jsxs("button",{onClick:x,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:18}),"Download PDF"]})]}),s==="pnl"?i.jsxs("div",{className:"space-y-8",children:[i.jsx(Sp,{title:"Revenue",items:d.filter(v=>v.type==="Revenue").map(v=>({name:v.name,amount:v.balance})),totalLabel:"Total Revenue"}),i.jsx(Sp,{title:"Cost of Goods Sold",items:d.filter(v=>v.id==="5000").map(v=>({name:v.name,amount:v.balance})),totalLabel:"Total COGS",isNegative:!0}),i.jsxs("div",{className:"pt-4 border-t border-border flex justify-between items-center",children:[i.jsx("span",{className:"text-lg font-bold uppercase tracking-wider",children:"Gross Profit"}),i.jsxs("span",{className:"text-xl font-bold",children:["$",(d.find(v=>v.id==="4000").balance-d.find(v=>v.id==="5000").balance-(((y=d.find(v=>v.id==="5400"))==null?void 0:y.balance)||0)).toLocaleString()]})]}),i.jsx(Sp,{title:"Operating Expenses",items:d.filter(v=>v.type==="Expense"&&v.id!=="5000").map(v=>({name:v.name,amount:v.balance})),totalLabel:"Total Expenses",isNegative:!0}),i.jsxs("div",{className:"pt-6 border-t-2 border-primary flex justify-between items-center",children:[i.jsx("span",{className:"text-xl font-bold uppercase tracking-widest text-primary",children:"Net Income"}),i.jsxs("span",{className:"text-3xl font-bold text-primary",children:["$",(d.filter(v=>v.type==="Revenue").reduce((v,w)=>v+w.balance,0)-d.filter(v=>v.type==="Expense").reduce((v,w)=>v+w.balance,0)).toLocaleString()]})]})]}):i.jsxs("div",{className:"space-y-8",children:[i.jsx(Sp,{title:"Assets",items:d.filter(v=>v.type==="Asset").map(v=>({name:v.name,amount:v.balance})),totalLabel:"Total Assets"}),i.jsx(Sp,{title:"Liabilities",items:d.filter(v=>v.type==="Liability").map(v=>({name:v.name,amount:v.balance})),totalLabel:"Total Liabilities"}),i.jsx(Sp,{title:"Equity",items:d.filter(v=>v.type==="Equity").map(v=>({name:v.name,amount:v.balance})),totalLabel:"Total Equity"}),i.jsxs("div",{className:"pt-6 border-t-2 border-primary flex justify-between items-center",children:[i.jsx("span",{className:"text-xl font-bold uppercase tracking-widest text-primary",children:"Total Liabilities & Equity"}),i.jsxs("span",{className:"text-3xl font-bold text-primary",children:["$",d.filter(v=>v.type==="Liability"||v.type==="Equity").reduce((v,w)=>v+w.balance,0).toLocaleString()]})]})]})]})]},"reports")]})]})}function Sp({title:e,items:t,totalLabel:r,isNegative:n}){const a=t.reduce((s,o)=>s+o.amount,0);return i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground border-b border-border pb-2",children:e}),i.jsx("div",{className:"space-y-2",children:t.map((s,o)=>i.jsxs("div",{className:"flex justify-between items-center text-sm",children:[i.jsx("span",{children:s.name}),i.jsxs("span",{className:"font-mono",children:["$",s.amount.toLocaleString(void 0,{minimumFractionDigits:2})]})]},o))}),i.jsxs("div",{className:"flex justify-between items-center pt-2 font-bold",children:[i.jsx("span",{children:r}),i.jsx("span",{className:tt(n&&"text-red-500"),children:n?`($${a.toLocaleString()})`:`$${a.toLocaleString()}`})]})]})}function dAe(){const{projects:e,expenses:t,companySettings:r,updateCompanySettings:n}=ca(),[a,s]=N.useState("overview"),[o,l]=N.useState(!1),[u,d]=N.useState(""),[f,m]=N.useState(!1),[g,x]=N.useState("All"),[y,v]=N.useState("All"),w=Mt.useRef(null);Mt.useEffect(()=>{const he=oe=>{w.current&&!w.current.contains(oe.target)&&m(!1)};return document.addEventListener("mousedown",he),()=>document.removeEventListener("mousedown",he)},[]);const[j,k]=N.useState({type:"VAT",period:"",dueDate:"",amount:0,status:"Draft"}),[A,T]=N.useState([]),M=he=>{he.preventDefault();const z={id:`TAX-${new Date().getFullYear()}-${Math.floor(Math.random()*1e3).toString().padStart(3,"0")}`,type:j.type,period:j.period||"",dueDate:j.dueDate||"",amount:Number(j.amount)||0,status:j.status};T([z,...A]),l(!1),k({type:"VAT",period:"",dueDate:"",amount:0,status:"Draft"}),De.success("Tax filing record added successfully")},B=(he,oe)=>{T(A.map(z=>z.id===he?{...z,status:oe}:z)),De.success(`Filing status updated to ${oe}`)},L=he=>{if(he.includes("-CUR")){De.error("Cannot delete live data projections. These are calculated from active projects.");return}T(A.filter(oe=>oe.id!==he)),De.success("Tax filing record deleted")},F=N.useMemo(()=>{let he=0,oe=0,z=0,fe=0;e.forEach(ae=>{he+=ae.clientTotalAmount||0,oe+=ae.totalAmount||0,z+=ae.taxAmount||0}),t.forEach(ae=>{ae.status==="Approved"&&(ae.category==="Tax Payment"?fe+=ae.amount:oe+=ae.amount)});const de=he-oe-fe;(r.vatTaxRate||20)/100;const W=(r.corporateTaxRate||25)/100;return{estimatedVAT:z-fe,estimatedCorporateTax:Math.max(0,de*W),netProfit:de,totalRevenue:he,totalExpenses:oe,totalTaxPaid:fe,actualTaxPayable:z}},[e,t]),I=N.useMemo(()=>{const he=[...A],oe=[],z=new Map;return e.forEach(fe=>{if(!fe.issueDate)return;const de=new Date(fe.issueDate),W=de.getFullYear(),ae=Math.floor(de.getMonth()/3)+1,_e=`Q${ae} ${W}`,ue=z.get(_e)||{vat:0,corp:0,dueDate:`${W}-${(ae*3).toString().padStart(2,"0")}-30`};z.set(_e,{...ue,vat:ue.vat+(fe.taxAmount||0),corp:ue.corp+(fe.clientTotalAmount||0)*((r.corporateTaxRate||25)/100)})}),z.forEach((fe,de)=>{if(fe.vat>0){const W=t.some(ae=>ae.category==="Tax Payment"&&ae.status==="Approved"&&(ae.description.toLowerCase().includes(de.toLowerCase())||ae.description.toLowerCase().includes("vat")));oe.push({id:`LIVE-VAT-${de.replace(" ","-")}`,type:"VAT",period:de,dueDate:fe.dueDate,amount:fe.vat,status:W?"Paid":"Draft"})}if(fe.corp>0){const W=t.some(ae=>ae.category==="Tax Payment"&&ae.status==="Approved"&&(ae.description.toLowerCase().includes(de.toLowerCase())||ae.description.toLowerCase().includes("corporate")));oe.push({id:`LIVE-CORP-${de.replace(" ","-")}`,type:"Corporate",period:de,dueDate:fe.dueDate,amount:fe.corp,status:W?"Paid":"Draft"})}}),[...he,...oe].sort((fe,de)=>{const W=parseInt(fe.period.split(" ").pop()||"0"),ae=parseInt(de.period.split(" ").pop()||"0");return W!==ae?ae-W:de.period.localeCompare(fe.period)})},[A,e,t]),q=N.useMemo(()=>I.filter(he=>{const oe=he.id.toLowerCase().includes(u.toLowerCase())||he.period.toLowerCase().includes(u.toLowerCase())||he.type.toLowerCase().includes(u.toLowerCase()),z=g==="All"||he.type===g,fe=y==="All"||he.status===y;return oe&&z&&fe}),[I,u,g,y]),[P,R]=N.useState(0),[K,ee]=N.useState(0),[se,Z]=N.useState(r.corporateTaxRate||25),[ne,X]=N.useState(r.vatTaxRate||20),[le,Ae]=N.useState({corpTax:0,vatTax:0,total:0}),[ce,D]=N.useState(!1);Mt.useEffect(()=>{ce||(R(F.totalRevenue),ee(F.totalExpenses),Z(r.corporateTaxRate||25),X(r.vatTaxRate||20),D(!0));const he=P-K,oe=Math.max(0,he*(se/100)),z=P*(ne/100);Ae({corpTax:oe,vatTax:z,total:oe+z})},[F.totalRevenue,F.totalExpenses,r.corporateTaxRate,r.vatTaxRate,ce,P,K,se,ne]);const H=()=>{const he=P-K,oe=Math.max(0,he*(se/100)),z=P*(ne/100);Ae({corpTax:oe,vatTax:z,total:oe+z}),De.success("Tax estimates recalculated")},G=()=>{n({corporateTaxRate:se,vatTaxRate:ne}),De.success("Default system tax rates updated successfully")},E=()=>{if(q.length===0){De.error("No data to export");return}const z=[["Filing ID","Tax Type","Period","Due Date","Amount","Status"].join(","),...q.map(ae=>[`"${ae.id}"`,`"${ae.type}"`,`"${ae.period}"`,`"${ae.dueDate}"`,ae.amount.toFixed(2),`"${ae.status}"`].join(","))].join(`
`),fe=new Blob([z],{type:"text/csv;charset=utf-8;"}),de=URL.createObjectURL(fe),W=document.createElement("a");W.setAttribute("href",de),W.setAttribute("download",`tax_filings_export_${new Date().toISOString().split("T")[0]}.csv`),W.style.visibility="hidden",document.body.appendChild(W),W.click(),document.body.removeChild(W),De.success("Tax data exported successfully")},re=()=>{De.info('To record a tax payment, please add an expense with category "Tax Payment"')};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-indigo-500/10 text-indigo-500",children:i.jsx(GP,{size:24})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Government Tax Module"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage compliance, filings, and tax obligations."})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx($n,{size:18}),"New Tax Filing"]}),i.jsxs("button",{onClick:E,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:18}),"Export Tax Data"]}),i.jsxs("button",{onClick:re,className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-bold text-white hover:bg-indigo-700 transition-all shadow-md active:scale-95",children:[i.jsx(uee,{size:18}),"Record Tax Payment"]})]})]}),i.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted/50 rounded-xl border border-border w-fit",children:[i.jsxs("button",{onClick:()=>s("overview"),className:tt("flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg transition-all",a==="overview"?"bg-card shadow-sm text-indigo-600":"text-muted-foreground hover:bg-muted"),children:[i.jsx(GP,{size:16}),"Tax Overview"]}),i.jsxs("button",{onClick:()=>s("filings"),className:tt("flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg transition-all",a==="filings"?"bg-card shadow-sm text-indigo-600":"text-muted-foreground hover:bg-muted"),children:[i.jsx(Ck,{size:16}),"Filing History"]}),i.jsxs("button",{onClick:()=>s("calculator"),className:tt("flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg transition-all",a==="calculator"?"bg-card shadow-sm text-indigo-600":"text-muted-foreground hover:bg-muted"),children:[i.jsx(SN,{size:16}),"Tax Calculator"]})]}),i.jsxs(on,{mode:"wait",children:[a==="overview"&&i.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[i.jsx(XS,{title:"Current VAT Payable",amount:F.estimatedVAT,description:`Total Accrued: $${F.actualTaxPayable.toLocaleString()}`,icon:Kee,color:"blue"}),i.jsx(XS,{title:"Tax Paid to Date",amount:F.totalTaxPaid,description:"Current Fiscal Year",icon:bh,color:"green"}),i.jsx(XS,{title:"Corporate Tax Provision",amount:F.estimatedCorporateTax,description:"Estimated on Net Profit",icon:SN,color:"indigo"})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"rounded-2xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h3",{className:"text-lg font-bold",children:"Compliance Status"}),i.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-bold bg-green-500/10 text-green-500 uppercase tracking-wider",children:[i.jsx(bh,{size:14}),"Fully Compliant"]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(ZS,{label:"VAT Registration",status:"Verified",lastChecked:"2 days ago"}),i.jsx(ZS,{label:"Tax ID (EIN/VAT)",status:"Active",lastChecked:"1 month ago"}),i.jsx(ZS,{label:"Annual Return",status:"Up to Date",lastChecked:"FY 2025 Filed"})]})]}),i.jsxs("div",{className:"rounded-2xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"text-lg font-bold mb-6",children:"Tax Alerts & Reminders"}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4 p-4 rounded-xl bg-orange-500/5 border border-orange-500/20",children:[i.jsx("div",{className:"p-2 rounded-lg bg-orange-500/10 text-orange-500 h-fit",children:i.jsx(_te,{size:20})}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-bold text-orange-700",children:"Upcoming Deadline"}),i.jsx("p",{className:"text-sm text-orange-600/80",children:"Payroll tax filing for March 2026 is due in 4 days. Please review and submit."})]})]}),i.jsxs("div",{className:"flex gap-4 p-4 rounded-xl bg-blue-500/5 border border-blue-500/20",children:[i.jsx("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500 h-fit",children:i.jsx(WP,{size:20})}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-bold text-blue-700",children:"New Tax Regulation"}),i.jsx("p",{className:"text-sm text-blue-600/80",children:"Updated corporate tax rates for 2026 have been applied to your estimates."})]})]})]})]})]})]},"overview"),a==="filings"&&i.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"space-y-4",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center justify-between",children:[i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search filings, periods...",value:u,onChange:he=>d(he.target.value),className:"h-10 w-full rounded-lg border border-border bg-background pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"relative",ref:w,children:[i.jsxs("button",{onClick:()=>m(!f),className:tt("flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium transition-colors hover:bg-accent",(g!=="All"||y!=="All")&&"border-primary text-primary"),children:[i.jsx(Oc,{size:18}),"Filters",(g!=="All"||y!=="All")&&i.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:[g,y].filter(he=>he!=="All").length})]}),f&&i.jsxs("div",{className:"absolute right-0 mt-2 z-50 w-64 rounded-xl border border-border bg-card p-4 shadow-lg animate-in fade-in slide-in-from-top-2 duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h4",{className:"font-bold text-sm",children:"Filter Filings"}),i.jsx("button",{onClick:()=>{x("All"),v("All")},className:"text-[10px] font-bold uppercase tracking-wider text-primary hover:underline",children:"Reset"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Tax Type"}),i.jsxs("select",{value:g,onChange:he=>x(he.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Types"}),i.jsx("option",{value:"VAT",children:"VAT"}),i.jsx("option",{value:"Corporate",children:"Corporate"}),i.jsx("option",{value:"Payroll",children:"Payroll"}),i.jsx("option",{value:"Income",children:"Income"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Status"}),i.jsxs("select",{value:y,onChange:he=>v(he.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Statuses"}),i.jsx("option",{value:"Draft",children:"Draft"}),i.jsx("option",{value:"Filed",children:"Filed"}),i.jsx("option",{value:"Paid",children:"Paid"}),i.jsx("option",{value:"Overdue",children:"Overdue"})]})]})]})]})]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground",children:"Filing ID"}),i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground",children:"Tax Type"}),i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground",children:"Period"}),i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground",children:"Due Date"}),i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground text-right",children:"Amount"}),i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground",children:"Status"}),i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground text-right",children:"Action"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:q.map(he=>i.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[i.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:he.id}),i.jsx("td",{className:"px-4 py-3",children:i.jsxs("span",{className:"font-medium",children:[he.type," Tax"]})}),i.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:he.period}),i.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:he.dueDate}),i.jsxs("td",{className:"px-4 py-3 text-right font-mono font-bold",children:["$",he.amount.toLocaleString(void 0,{minimumFractionDigits:2})]}),i.jsx("td",{className:"px-4 py-3",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("span",{className:tt("inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold uppercase tracking-wider",he.status==="Paid"?"bg-green-500/10 text-green-500":he.status==="Filed"?"bg-indigo-500/10 text-indigo-500":he.status==="Draft"?"bg-blue-500/10 text-blue-500":"bg-red-500/10 text-red-500"),children:he.status})})}),i.jsx("td",{className:"px-4 py-3 text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[he.status==="Draft"&&i.jsx("button",{onClick:()=>B(he.id,"Filed"),className:"text-[10px] font-bold text-indigo-600 hover:underline",children:"MARK AS FILED"}),he.status==="Filed"&&i.jsx("button",{onClick:()=>B(he.id,"Paid"),className:"text-[10px] font-bold text-green-600 hover:underline",children:"MARK AS PAID"}),!he.id.includes("-CUR")&&i.jsx("button",{onClick:()=>L(he.id),className:"p-1.5 rounded-lg text-muted-foreground hover:bg-red-500/10 hover:text-red-500 transition-colors",title:"Delete Filing",children:i.jsx(aa,{size:14})}),i.jsx("button",{className:"text-muted-foreground hover:text-foreground",children:i.jsx(wv,{size:14})})]})})]},he.id))})]})})]},"filings"),a==="calculator"&&i.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[i.jsx("div",{className:"lg:col-span-2 space-y-6",children:i.jsxs("div",{className:"rounded-2xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"text-lg font-bold mb-6",children:"Interactive Tax Calculator"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Annual Revenue ($)"}),i.jsx("input",{type:"number",value:P,onChange:he=>R(Number(he.target.value)),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Annual Expenses ($)"}),i.jsx("input",{type:"number",value:K,onChange:he=>ee(Number(he.target.value)),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Corporate Tax Rate (%)"}),i.jsx("input",{type:"number",value:se,onChange:he=>Z(Number(he.target.value)),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"VAT/Sales Tax Rate (%)"}),i.jsx("input",{type:"number",value:ne,onChange:he=>X(Number(he.target.value)),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/20"})]})]}),i.jsxs("div",{className:"mt-8 pt-6 border-t border-border flex items-center justify-between",children:[i.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[i.jsx(WP,{size:14}),"Changes here are for calculation only unless saved as default."]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:G,className:"text-indigo-600 px-4 py-2 rounded-lg font-bold hover:bg-indigo-50 transition-all text-sm",children:"Save as Default System Rates"}),i.jsxs("button",{onClick:H,className:"bg-indigo-600 text-white px-6 py-2 rounded-lg font-bold hover:bg-indigo-700 transition-all active:scale-95 shadow-md flex items-center gap-2",children:[i.jsx(SN,{size:18}),"Recalculate Projections"]})]})]})]})}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"rounded-2xl border border-border bg-indigo-600 p-6 text-white shadow-lg shadow-indigo-200",children:[i.jsx("h3",{className:"text-lg font-bold mb-2",children:"Estimated Liability"}),i.jsx("p",{className:"text-indigo-100 text-sm mb-6",children:"Total projected tax obligation based on calculator inputs."}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-indigo-200 text-sm",children:"Corporate Tax"}),i.jsxs("span",{className:"text-xl font-bold",children:["$",le.corpTax.toLocaleString(void 0,{maximumFractionDigits:2})]})]}),i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-indigo-200 text-sm",children:"VAT (Projected)"}),i.jsxs("span",{className:"text-xl font-bold",children:["$",le.vatTax.toLocaleString(void 0,{maximumFractionDigits:2})]})]}),i.jsxs("div",{className:"pt-4 border-t border-indigo-500 flex justify-between items-center",children:[i.jsx("span",{className:"font-bold",children:"Total Estimate"}),i.jsxs("span",{className:"text-3xl font-bold",children:["$",le.total.toLocaleString(void 0,{maximumFractionDigits:2})]})]})]})]}),i.jsx("button",{onClick:()=>{R(F.totalRevenue),ee(F.totalExpenses),Z(r.corporateTaxRate||25),X(r.vatTaxRate||20),D(!0),H(),De.info("Reset to actual business data")},className:"w-full py-3 rounded-xl border border-dashed border-border text-muted-foreground text-sm font-medium hover:border-indigo-500 hover:text-indigo-600 transition-all",children:"Reset to Actual Business Data"})]})]},"calculator")]}),o&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card shadow-2xl animate-in fade-in zoom-in duration-200 overflow-hidden",children:[i.jsxs("div",{className:"bg-indigo-500/5 border-b border-border p-6 flex items-center justify-between",children:[i.jsx("h2",{className:"text-xl font-bold",children:"New Tax Filing"}),i.jsx("button",{onClick:()=>l(!1),className:"rounded-full p-2 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:M,className:"p-6 space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Tax Type"}),i.jsxs("select",{value:j.type,onChange:he=>k({...j,type:he.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:bg-background transition-all",required:!0,children:[i.jsx("option",{value:"VAT",children:"VAT Tax"}),i.jsx("option",{value:"Corporate",children:"Corporate Tax"}),i.jsx("option",{value:"Payroll",children:"Payroll Tax"}),i.jsx("option",{value:"Income",children:"Income Tax"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Period"}),i.jsx("input",{type:"text",placeholder:"e.g. Q2 2026",value:j.period,onChange:he=>k({...j,period:he.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:bg-background transition-all",required:!0})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Due Date"}),i.jsx("input",{type:"date",value:j.dueDate,onChange:he=>k({...j,dueDate:he.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:bg-background transition-all",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Amount ($)"}),i.jsx("input",{type:"number",step:"0.01",value:j.amount,onChange:he=>k({...j,amount:parseFloat(he.target.value)}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:bg-background transition-all",required:!0})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Status"}),i.jsxs("select",{value:j.status,onChange:he=>k({...j,status:he.target.value}),className:"h-11 w-full rounded-xl border border-border bg-muted/20 px-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:bg-background transition-all",required:!0,children:[i.jsx("option",{value:"Draft",children:"Draft"}),i.jsx("option",{value:"Filed",children:"Filed"}),i.jsx("option",{value:"Paid",children:"Paid"})]})]}),i.jsxs("div",{className:"pt-4 flex items-center gap-3",children:[i.jsx("button",{type:"button",onClick:()=>l(!1),className:"flex-1 h-11 text-sm font-bold border border-border rounded-xl hover:bg-accent transition-all",children:"Cancel"}),i.jsx("button",{type:"submit",className:"flex-1 h-11 bg-indigo-600 text-sm font-bold text-white rounded-xl hover:bg-indigo-700 transition-all shadow-md",children:"Add Filing"})]})]})]})})]})}function XS({title:e,amount:t,description:r,icon:n,color:a,isDate:s}){return i.jsxs("div",{className:"rounded-2xl border border-border bg-card p-6 shadow-sm hover:shadow-md transition-all",children:[i.jsx("div",{className:"flex items-center justify-between mb-4",children:i.jsx("div",{className:tt("p-2 rounded-lg",a==="blue"?"bg-blue-500/10 text-blue-500":a==="indigo"?"bg-indigo-500/10 text-indigo-500":a==="green"?"bg-green-500/10 text-green-500":"bg-orange-500/10 text-orange-500"),children:i.jsx(n,{size:20})})}),i.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:e}),i.jsx("div",{className:"text-2xl font-bold mb-1",children:typeof t=="number"?`$${t.toLocaleString(void 0,{minimumFractionDigits:2})}`:t}),i.jsx("p",{className:"text-xs text-muted-foreground",children:r})]})}function ZS({label:e,status:t,lastChecked:r}){return i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-muted/30 border border-border/50",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold",children:e}),i.jsxs("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:["Last Checked: ",r]})]}),i.jsx("span",{className:"text-xs font-bold text-green-500",children:t})]})}function fAe(){const e=mo(),[t,r]=sf(),{projects:n,tasks:a,addProject:s,updateProject:o,expenses:l,companySettings:u,currencies:d,addCurrency:f}=ca(),{hasPermission:m}=la(),g=Y=>{if(!Y)return"$";const we=d.find(J=>J.code===Y||J.code===(Y==="Euro"?"EUR":Y));return we?we.symbol:"$"},x=N.useMemo(()=>n.filter(Y=>Y.status==="Completed"),[n]),[y,v]=N.useState("overview"),w=Y=>{if(!Y)return 0;const we=Y.match(/(\d+)h/),J=Y.match(/(\d+)m/),ve=we?parseInt(we[1]):0,Oe=J?parseInt(J[1]):0;return ve+Oe/60},j=N.useMemo(()=>{const Y=[];return x.forEach(we=>{const J=w(we.totalTime),ve=(we.hourlyRate||0)*J,Oe=we.totalAmount&&we.totalAmount>0?we.totalAmount:ve+(we.travelCost||0)+(we.materialCost||0)+(we.halfDayRate||0)+(we.fullDayRate||0)+(we.monthlyRate||0),xe=(we.clientHourlyRate||0)*J,qe=we.clientTotalAmount&&we.clientTotalAmount>0?we.clientTotalAmount:xe+(we.clientTravelCost||0)+(we.clientMaterialCost||0)+(we.clientHalfDayRate||0)+(we.clientFullDayRate||0)+(we.clientMonthlyRate||0),me=g(we.currency);if((we.commissions||[]).forEach(Ge=>{Y.push({id:`TX-COMM-${Ge.id}`,invoiceId:we.ticketId||we.id,description:`Commission - ${Ge.vendorName} (${we.name})`,category:"Vendor Commission",amount:`${me}${Ge.amount.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,type:"Expense",date:we.issueDate||new Date().toISOString().split("T")[0],status:Ge.status==="Paid"?"Completed":"Pending"})}),we.thirdPartyName&&(!we.commissions||we.commissions.length===0)){const Ge=we.clientTotalAmount||we.totalAmount||0,Be=we.thirdPartyCommissionAmount||Ge*((we.thirdPartyCommissionRate||0)/100);Y.push({id:`TX-COMM-LEGACY-${we.id}`,invoiceId:we.ticketId||we.id,description:`Commission - ${we.thirdPartyName} (${we.name})`,category:"Vendor Commission",amount:`${me}${Be.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,type:"Expense",date:we.issueDate||new Date().toISOString().split("T")[0],status:we.thirdPartyStatus==="Paid"?"Completed":"Pending"})}Y.push({id:`TX-IN-${we.ticketId||we.id}`,invoiceId:we.ticketId||we.id,description:`Client Payment - ${we.client||we.name}`,category:"Project Revenue",amount:`${me}${qe.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,type:"Income",date:we.issueDate||new Date().toISOString().split("T")[0],status:we.clientInvoiceStatus==="Paid"||!we.clientInvoiceStatus&&we.clientStatus==="Completed"?"Completed":we.clientInvoiceStatus==="Overdue"||!we.clientInvoiceStatus&&we.clientStatus==="Cancelled"?"Cancelled":"Pending"}),Y.push({id:`TX-EX-${we.ticketId||we.id}`,invoiceId:we.ticketId||we.id,description:`Engineer Payout - ${we.assignedTo||"Unassigned"}`,category:"Engineer Payout",amount:`${me}${Oe.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,type:"Expense",date:we.issueDate||new Date().toISOString().split("T")[0],status:we.engineerInvoiceStatus==="Paid"||!we.engineerInvoiceStatus&&we.status==="Completed"?"Completed":we.engineerInvoiceStatus==="Overdue"||!we.engineerInvoiceStatus&&we.status==="Cancelled"?"Cancelled":"Pending"})}),l.forEach(we=>{Y.push({id:`TX-EXP-${we.id}`,invoiceId:we.reference||we.id,description:we.description,category:we.category,amount:`$${we.amount.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,type:"Expense",date:we.date,status:we.status==="Approved"?"Completed":we.status==="Rejected"?"Cancelled":"Pending"})}),Y.sort((we,J)=>new Date(J.date).getTime()-new Date(we.date).getTime())},[x,l]),k=N.useMemo(()=>x.map(Y=>{const we=xe=>{const qe=w(xe.totalTime),Ge=(xe.hourlyRate||0)*qe+(xe.travelCost||0)+(xe.materialCost||0)+(xe.halfDayRate||0)+(xe.fullDayRate||0)+(xe.monthlyRate||0),Be=xe.totalAmount&&xe.totalAmount>0?xe.totalAmount:Ge,st=(xe.clientHourlyRate||0)*qe+(xe.clientTravelCost||0)+(xe.clientMaterialCost||0)+(xe.clientHalfDayRate||0)+(xe.clientFullDayRate||0)+(xe.clientMonthlyRate||0),Ve=xe.clientTotalAmount&&xe.clientTotalAmount>0?xe.clientTotalAmount:st;return{internalAmount:Be,clientAmount:Ve}},{internalAmount:J,clientAmount:ve}=we(Y),Oe=g(Y.currency);return{id:Y.ticketId||Y.id,assignedOrder:Y.assignedTo||"Unassigned",requestedOrder:Y.client||Y.name,amount:`${Oe}${J.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,clientAmount:`${Oe}${ve.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,issueDate:Y.issueDate||new Date().toISOString().split("T")[0],dueDate:Y.deadline,completedDate:Y.completedDate,engineerStatus:Y.engineerInvoiceStatus||(Y.status==="Completed"?"Paid":Y.status==="Cancelled"?"Overdue":"Unpaid"),clientStatus:Y.clientInvoiceStatus||(Y.clientStatus==="Completed"?"Paid":Y.clientStatus==="Cancelled"?"Overdue":"Unpaid"),status:y==="client_invoices"?Y.clientInvoiceStatus||(Y.clientStatus==="Completed"?"Paid":Y.clientStatus==="Cancelled"?"Overdue":"Unpaid"):Y.engineerInvoiceStatus||(Y.status==="Completed"?"Paid":Y.status==="Cancelled"?"Overdue":"Unpaid"),project:Y,issuedMonth:Y.issuedMonth}}),[x,y]),A=N.useMemo(()=>{const Y=[];return x.forEach(we=>{if(we.thirdPartyName&&(!we.commissions||we.commissions.length===0)){const J=we.clientTotalAmount||we.totalAmount||0,ve=we.thirdPartyCommissionAmount||J*((we.thirdPartyCommissionRate||0)/100);Y.push({id:`LEGACY-${we.id}`,projectId:we.id,projectTicket:we.ticketId||we.id,projectName:we.name,client:we.client,vendorName:we.thirdPartyName,rate:we.thirdPartyCommissionRate||0,amount:ve,status:we.thirdPartyStatus||"Unpaid",project:we,isLegacy:!0})}(we.commissions||[]).forEach(J=>{Y.push({...J,projectId:we.id,projectTicket:we.ticketId||we.id,projectName:we.name,client:we.client,project:we})})}),Y},[x]),T=async(Y,we,J)=>{if(le)return;const ve=x.find(Oe=>Oe.id===Y);if(ve){Ae(!0);try{const Oe=J==="Paid"?"Unpaid":"Paid";if(ve.commissions&&!we.startsWith("LEGACY-")){const xe=ve.commissions.map(qe=>qe.id===we?{...qe,status:Oe}:qe);await o(Y,{commissions:xe})}else if(await o(Y,{thirdPartyStatus:Oe}),ve.commissions){const xe=ve.commissions.map(qe=>qe.id===we?{...qe,status:Oe}:qe);await o(Y,{commissions:xe})}De.success(`Commission marked as ${Oe}`)}catch{De.error("Failed to update commission status")}finally{Ae(!1)}}},[M,B]=N.useState(""),[L,F]=N.useState(!1),[I,q]=N.useState("All"),[P,R]=N.useState("All"),[K,ee]=N.useState("All"),se=Mt.useRef(null);N.useEffect(()=>{const Y=we=>{se.current&&!se.current.contains(we.target)&&F(!1)};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[]);const Z=N.useMemo(()=>{let Y=0,we=0,J=0,ve=0,Oe=0;const xe=new Date,qe=`${xe.getFullYear()}-${(xe.getMonth()+1).toString().padStart(2,"0")}`;let me=0,Ge=0;const Be=new Map;for(let te=5;te>=0;te--){const Ue=new Date(xe.getFullYear(),xe.getMonth()-te,1),ot=`${Ue.getFullYear()}-${(Ue.getMonth()+1).toString().padStart(2,"0")}`;Be.set(ot,{revenue:0,expenses:0})}x.forEach(te=>{var Ur;const Ue=w(te.totalTime),ot=(te.hourlyRate||0)*Ue,vt=te.totalAmount&&te.totalAmount>0?te.totalAmount:ot+(te.travelCost||0)+(te.materialCost||0)+(te.halfDayRate||0)+(te.fullDayRate||0)+(te.monthlyRate||0),_t=(te.clientHourlyRate||0)*Ue,qt=te.clientTotalAmount&&te.clientTotalAmount>0?te.clientTotalAmount:_t+(te.clientTravelCost||0)+(te.clientMaterialCost||0)+(te.clientHalfDayRate||0)+(te.clientFullDayRate||0)+(te.clientMonthlyRate||0),Ft=(te.commissions||[]).reduce((Ht,It)=>Ht+(It.amount||0),0);let Dt=0;if(te.thirdPartyName&&(!te.commissions||te.commissions.length===0)){const Ht=te.clientTotalAmount||te.totalAmount||0;Dt=te.thirdPartyCommissionAmount||Ht*((te.thirdPartyCommissionRate||0)/100)}const Rt=Ft+Dt;J+=Rt,Y+=qt,we+=vt+Rt;const wr=te.issuedMonth||(te.issueDate?te.issueDate.substring(0,7):"");if(wr===qe){const Ht=te.clientInvoiceStatus==="Paid"||!te.clientInvoiceStatus&&te.clientStatus==="Completed",It=te.engineerInvoiceStatus==="Paid"||!te.engineerInvoiceStatus&&te.status==="Completed",Rr=(((Ur=te.commissions)==null?void 0:Ur.every(kr=>kr.status==="Paid"))??!0)&&(te.thirdPartyStatus==="Paid"||!te.thirdPartyName);Ht&&(me+=qt),It&&(Ge+=vt),Rr&&(Ge+=Rt)}if(Be.has(wr)){const Ht=Be.get(wr);Ht.revenue+=qt,Ht.expenses+=vt+Rt}const gr=te.clientInvoiceStatus==="Paid"||!te.clientInvoiceStatus&&te.clientStatus==="Completed",Er=te.clientInvoiceStatus==="Overdue"||!te.clientInvoiceStatus&&te.clientStatus==="Cancelled";!gr&&!Er&&(ve+=qt,Oe++)}),l.forEach(te=>{te.status==="Approved"&&(we+=te.amount);const Ue=(te.date||"").substring(0,7);if(Ue===qe&&te.status==="Approved"&&(Ge+=te.amount),Be.has(Ue)){const ot=Be.get(Ue);te.status==="Approved"&&(ot.expenses+=te.amount)}});const it=Y-we,st=Y>0?it/Y*100:0,Ve=Array.from(Be.entries()).map(([te,Ue])=>{const ot=(te||"").split("-");if(ot.length<2)return{month:te,revenue:Ue.revenue,expenses:Ue.expenses};const[vt,_t]=ot;return{month:new Date(parseInt(vt),parseInt(_t)-1).toLocaleString("default",{month:"short"}),revenue:Ue.revenue,expenses:Ue.expenses}});return{totalRevenue:Y,totalExpenses:we,totalCommissions:J,netProfit:it,margin:st,pendingAmount:ve,pendingCount:Oe,chartData:Ve,currentMonthInflow:me,currentMonthOutflow:Ge}},[x,l]),[ne,X]=N.useState(!1),[le,Ae]=N.useState(!1),[ce,D]=N.useState(!1),[H,G]=N.useState(!1),[E,re]=N.useState({invoiceId:"",fromName:"",fromEmail:"",fromPhone:"",fromAddress:"",billToName:"",billToEmail:"",billToPhone:"",billToAddress:"",description:"",projectRef:"",amount:0,date:new Date().toISOString().split("T")[0],currency:"USD"}),[he,oe]=N.useState(!1),[z,fe]=N.useState(null),[de,W]=N.useState({assignedOrder:"",requestedOrder:"",amount:"",issueDate:new Date().toISOString().split("T")[0],dueDate:"",status:"Unpaid"});N.useEffect(()=>{if(t.get("create")==="true"){D(!0);const we=new URLSearchParams(t);we.delete("create"),r(we,{replace:!0})}},[t,r]);const ae=()=>{De.info("Create new projects in the Projects page to generate invoices")},_e=async Y=>{if(Y.preventDefault(),!le){Ae(!0);try{const J={id:`PRJ-${Math.floor(Math.random()*1e4).toString().padStart(4,"0")}`,name:de.requestedOrder||"Manual Invoice",client:de.requestedOrder||"N/A",assignedTo:de.assignedOrder||"Unassigned",status:de.status==="Paid"?"Completed":"In Progress",engineerInvoiceStatus:de.status||"Unpaid",clientInvoiceStatus:de.status||"Unpaid",team:1,deadline:de.dueDate||"",issueDate:de.issueDate||new Date().toISOString().split("T")[0],totalAmount:parseFloat(de.amount||"0"),clientTotalAmount:parseFloat(de.amount||"0"),currency:u.currency||"USD",ticketId:`INV-${new Date().getFullYear()}-${Math.floor(Math.random()*1e3).toString().padStart(3,"0")}`};await s(J),De.success("Invoice generated successfully"),D(!1),W({assignedOrder:"",requestedOrder:"",amount:"",issueDate:new Date().toISOString().split("T")[0],dueDate:"",status:"Unpaid"})}catch{De.error("Failed to generate invoice")}finally{Ae(!1)}}},ue=(Y,we)=>{var Ue;const J=we!==void 0?we:y==="client_invoices",ve=Y.project,Oe=new tr;Oe.setFillColor(249,250,251),Oe.rect(0,0,210,45,"F"),Oe.setFontSize(24),Oe.setTextColor(15,23,42),Oe.text(J?"CLIENT INVOICE":"ENGINEER INVOICE",20,28),Oe.setFontSize(10),Oe.setTextColor(100,116,139),Oe.text(`Invoice ID: #${Y.id}`,20,36);const xe=J?Y.clientStatus:Y.engineerStatus;Oe.setFontSize(9),Oe.setFont("helvetica","bold"),xe==="Paid"?(Oe.setFillColor(34,197,94),Oe.setTextColor(255,255,255)):xe==="Overdue"?(Oe.setFillColor(239,68,68),Oe.setTextColor(255,255,255)):(Oe.setFillColor(234,179,8),Oe.setTextColor(255,255,255)),Oe.rect(20,40,25,6,"F"),Oe.text(xe.toUpperCase(),32.5,44.5,{align:"center"}),Oe.setTextColor(15,23,42),Oe.setFontSize(10),Oe.setTextColor(15,23,42),Oe.setFont("helvetica","bold"),Oe.text("Date Issued:",140,20),Oe.setFont("helvetica","normal"),Oe.text(Y.issueDate||"N/A",170,20),Oe.setFont("helvetica","bold"),Oe.text("Issued Month:",140,27),Oe.setFont("helvetica","normal");const me=(ot=>{if(!ot)return"N/A";if(ot.includes("-")){const[vt,_t]=ot.split("-");return new Date(parseInt(vt),parseInt(_t)-1).toLocaleString("default",{month:"long",year:"numeric"})}return ot})(Y.issuedMonth||(Y.issueDate?Y.issueDate.substring(0,7):""));Oe.text(me,170,27),Oe.setFont("helvetica","bold"),Oe.text("Due Date:",140,34),Oe.setFont("helvetica","normal"),Oe.text(Y.dueDate||"N/A",170,34),Oe.setFontSize(11),Oe.setFont("helvetica","bold"),Oe.setTextColor(100,116,139),Oe.text(J?"FROM (COMPANY)":"FROM (ENGINEER)",20,60),Oe.text("BILL TO (CLIENT)",110,60),Oe.setFontSize(10),Oe.setTextColor(15,23,42);let Ge=68;if(Oe.setFont("helvetica","bold"),J){if(Oe.text((ve==null?void 0:ve.companyName)||"Your Company Name",20,Ge),Oe.setFont("helvetica","normal"),Ge+=5,Oe.text((ve==null?void 0:ve.companyEmail)||"billing@company.com",20,Ge),Ge+=5,Oe.text((ve==null?void 0:ve.companyPhone)||"+1 555 0123",20,Ge),Ge+=5,ve!=null&&ve.companyAddress){const ot=Oe.splitTextToSize(ve.companyAddress,80);Oe.text(ot,20,Ge),Ge+=ot.length*5}}else Oe.text(Y.assignedOrder||"N/A",20,Ge),Oe.setFont("helvetica","normal"),Ge+=5,ve!=null&&ve.assignedEmail?(Oe.text(ve.assignedEmail,20,Ge),Ge+=5):ve!=null&&ve.email&&(Oe.text(ve.email,20,Ge),Ge+=5),ve!=null&&ve.assignedContactNumber&&(Oe.text(ve.assignedContactNumber,20,Ge),Ge+=5);if(ve!=null&&ve.address){const ot=Oe.splitTextToSize(ve.address,80);Oe.text(ot,20,Ge)}let Be=68;if(Oe.setFont("helvetica","bold"),J){if(Oe.text(Y.requestedOrder||"N/A",110,Be),Oe.setFont("helvetica","normal"),Be+=5,ve!=null&&ve.personName&&(Oe.text(`Attn: ${ve.personName}`,110,Be),Be+=5),ve!=null&&ve.email&&(Oe.text(ve.email,110,Be),Be+=5),ve!=null&&ve.contactNumber&&(Oe.text(ve.contactNumber,110,Be),Be+=5),ve!=null&&ve.clientAddress){const ot=Oe.splitTextToSize(ve.clientAddress,80);Oe.text(ot,110,Be)}}else if(Oe.text((ve==null?void 0:ve.companyName)||"Your Company Name",110,Be),Oe.setFont("helvetica","normal"),Be+=5,Oe.text((ve==null?void 0:ve.companyEmail)||"billing@company.com",110,Be),Be+=5,Oe.text((ve==null?void 0:ve.companyPhone)||"+1 555 0123",110,Be),Be+=5,ve!=null&&ve.companyAddress){const ot=Oe.splitTextToSize(ve.companyAddress,80);Oe.text(ot,110,Be)}Oe.setFillColor(249,250,251),Oe.rect(20,110,170,12,"F"),Oe.setFont("helvetica","bold"),Oe.setTextColor(100,116,139),Oe.text("DESCRIPTION",25,118),Oe.text("QTY/TIME",110,118),Oe.text("RATE",140,118),Oe.text("AMOUNT",170,118),Oe.setFont("helvetica","normal"),Oe.setTextColor(15,23,42);let it=130;const st=(ve==null?void 0:ve.currency)==="Euro"?"€":(ve==null?void 0:ve.currency)==="GBP"?"£":"$",Ve=(ot,vt,_t,qt)=>{qt>0&&(Oe.text(ot,25,it),Oe.text(vt,110,it),Oe.text(`${st}${_t.toLocaleString(void 0,{minimumFractionDigits:2})}`,140,it),Oe.text(`${st}${qt.toLocaleString(void 0,{minimumFractionDigits:2})}`,170,it),it+=8)};if(ve){const ot=w(ve.totalTime),vt=J?ve.clientHourlyRate||0:ve.hourlyRate||0;Ve("Professional Services (Hourly)",ve.totalTime||"0h",vt,vt*ot);const _t=J?ve.clientHalfDayRate||0:ve.halfDayRate||0;Ve("Professional Services (Half Day)","1",_t,_t);const qt=J?ve.clientFullDayRate||0:ve.fullDayRate||0;Ve("Professional Services (Full Day)","1",qt,qt);const Ft=J?ve.clientMonthlyRate||0:ve.monthlyRate||0;Ve("Professional Services (Monthly)","1",Ft,Ft);const Dt=J?ve.clientTravelCost||0:ve.travelCost||0;Ve("Travel Expenses","1",Dt,Dt);const Rt=J?ve.clientMaterialCost||0:ve.materialCost||0;Ve("Material & Equipment","1",Rt,Rt)}else g(((Ue=Y.project)==null?void 0:Ue.currency)||"USD"),Oe.text(Y.requestedOrder,25,it),Oe.text(J?Y.clientAmount:Y.amount,170,it),it+=8;Oe.setDrawColor(226,232,240),Oe.line(20,it+5,190,it+5),Oe.setFontSize(10),Oe.setFont("helvetica","normal"),Oe.text("Subtotal",110,it+12);const te=J?((ve==null?void 0:ve.clientHourlyRate)||0)*w(ve==null?void 0:ve.totalTime)+((ve==null?void 0:ve.clientHalfDayRate)||0)+((ve==null?void 0:ve.clientFullDayRate)||0)+((ve==null?void 0:ve.clientMonthlyRate)||0)+((ve==null?void 0:ve.clientTravelCost)||0)+((ve==null?void 0:ve.clientMaterialCost)||0):((ve==null?void 0:ve.hourlyRate)||0)*w(ve==null?void 0:ve.totalTime)+((ve==null?void 0:ve.halfDayRate)||0)+((ve==null?void 0:ve.fullDayRate)||0)+((ve==null?void 0:ve.monthlyRate)||0)+((ve==null?void 0:ve.travelCost)||0)+((ve==null?void 0:ve.materialCost)||0);Oe.text(`${st}${te.toLocaleString(void 0,{minimumFractionDigits:2})}`,170,it+12),ve!=null&&ve.taxAmount&&ve.taxAmount>0&&(Oe.text(`Tax (${ve.taxRate||0}%)`,110,it+18),Oe.text(`${st}${ve.taxAmount.toLocaleString(void 0,{minimumFractionDigits:2})}`,170,it+18),it+=6),Oe.setFontSize(14),Oe.setFont("helvetica","bold"),Oe.text("Total Amount",110,it+25),Oe.text(J?Y.clientAmount:Y.amount,170,it+25),Oe.setFontSize(9),Oe.setTextColor(148,163,184),Oe.text("Thank you for your business!",105,275,{align:"center"}),Oe.text("If you have any questions, please contact us.",105,280,{align:"center"}),Oe.save(`Invoice_${Y.id}.pdf`),De.success(`Invoice ${Y.id} downloaded as PDF`)},ke=()=>{const Y=new tr;Y.setFontSize(18),Y.text("Transactions Report",14,20),Y.setFontSize(10),Y.text(`Generated on: ${new Date().toLocaleString()}`,14,28);const we=[["TX ID","Invoice ID","Description","Category","Amount","Type","Date","Status"]],J=at.map(ve=>[ve.id,ve.invoiceId,ve.description,ve.category,ve.amount,ve.type,ve.date,ve.status]);zd(Y,{head:we,body:J,startY:40,theme:"striped",headStyles:{fillColor:[15,23,42]}}),Y.save(`transactions_report_${new Date().toISOString().split("T")[0]}.pdf`),De.success("Transactions report exported as PDF")},$e=()=>{const Y=y==="invoices",we=y==="engineer_invoices",J=y==="client_invoices",ve=new tr("l","mm","a4");ve.setFontSize(18),ve.text("Invoices Report",14,20),ve.setFontSize(10),ve.text(`Generated on: ${new Date().toLocaleString()}`,14,28),ve.text(`View: ${Y?"All Invoices":we?"Engineer Invoices":"Client Invoices"}`,14,34);const Oe=["ID",...J?[]:["Assigned"],...we?[]:["Requested"],...Y?["Eng. Amt","Cli. Amt"]:[y==="client_invoices"?"Cli. Amt":"Eng. Amt"],"Issue Date","Month","Due Date",...Y?["Eng. Status","Cli. Status"]:["Status"]],xe=k.map(qe=>[qe.id,...J?[]:[qe.assignedOrder],...we?[]:[qe.requestedOrder],...Y?[qe.amount,qe.clientAmount||"0"]:[y==="client_invoices"?qe.clientAmount:qe.amount],qe.issueDate||"",qe.issuedMonth?qe.issuedMonth.includes("-")?new Date(parseInt(qe.issuedMonth.split("-")[0]),parseInt(qe.issuedMonth.split("-")[1])-1).toLocaleString("default",{month:"short",year:"numeric"}):qe.issuedMonth:"",qe.dueDate,...Y?[qe.engineerStatus,qe.clientStatus]:[qe.status]]);zd(ve,{head:[Oe],body:xe,startY:40,theme:"grid",styles:{fontSize:8},headStyles:{fillColor:[15,23,42]}}),ve.save(`invoices_report_${new Date().toISOString().split("T")[0]}.pdf`),De.success("Invoices report exported as PDF")},Je=Y=>{const we=new tr;we.setFontSize(18),we.text(`Invoice Report: ${Y.id}`,14,20),we.setFontSize(10),we.text(`Generated on: ${new Date().toLocaleString()}`,14,28);const J=[["Field","Value"]],ve=[["Invoice ID",Y.id],["Assigned Order",Y.assignedOrder],["Requested Order",Y.requestedOrder],["Engineer Amount",Y.amount],["Client Amount",Y.clientAmount||"0"],["Issue Date",Y.issueDate||"N/A"],["Issued Month",Y.issuedMonth?Y.issuedMonth.includes("-")?new Date(parseInt(Y.issuedMonth.split("-")[0]),parseInt(Y.issuedMonth.split("-")[1])-1).toLocaleString("default",{month:"long",year:"numeric"}):Y.issuedMonth:"N/A"],["Due Date",Y.dueDate||"N/A"],["Completed Date",Y.completedDate||"N/A"],["Status",Y.status]];zd(we,{head:J,body:ve,startY:40,theme:"striped",headStyles:{fillColor:[15,23,42]}}),we.save(`invoice_${Y.id}_report.pdf`),De.success(`Invoice ${Y.id} report exported as PDF`)},Xe=()=>{e("/expenses")},Ne=Y=>{if(Y.project){const we={...Y.project,issueDate:Y.project.issueDate||Y.issueDate||new Date().toISOString().split("T")[0],issuedMonth:Y.project.issuedMonth||(Y.project.issueDate||Y.issueDate?(Y.project.issueDate||Y.issueDate||"").substring(0,7):new Date().toISOString().substring(0,7)),companyName:Y.project.companyName||u.name||"Your Company Name",companyEmail:Y.project.companyEmail||u.email||"billing@company.com",companyPhone:Y.project.companyPhone||u.phone||"+1 555 0123",companyAddress:Y.project.companyAddress||u.location||`123 Business Ave, Suite 100
New York, NY 10001`};fe(we),oe(!0)}else De.error("Cannot edit this invoice: No associated project found")},Ye=async Y=>{if(Y.preventDefault(),!le&&z){Ae(!0);try{await o(z.id,z),De.success("Invoice updated successfully"),oe(!1),fe(null)}catch{De.error("Failed to update invoice")}finally{Ae(!1)}}},at=j.filter(Y=>{const we=Y.description.toLowerCase().includes(M.toLowerCase())||Y.category.toLowerCase().includes(M.toLowerCase())||Y.id.toLowerCase().includes(M.toLowerCase()),J=I==="All"||Y.type===I,ve=P==="All"||Y.category===P,Oe=K==="All"||Y.status===K;return we&&J&&ve&&Oe});return i.jsxs("div",{className:"space-y-6",children:[he&&z&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center p-4 bg-background/80 backdrop-blur-sm overflow-y-auto",children:i.jsx("div",{className:tt("w-full rounded-xl border border-border bg-card shadow-2xl animate-in fade-in zoom-in duration-200 my-8",y==="engineer_invoices"||y==="client_invoices"?"max-w-3xl":"max-w-md p-6"),children:y==="engineer_invoices"||y==="client_invoices"?i.jsxs("div",{className:"p-8 space-y-8",children:[i.jsxs("div",{className:"flex justify-between items-start",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-3xl font-bold text-primary mb-1",children:y==="client_invoices"?"CLIENT INVOICE":"ENGINEER INVOICE"}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["#",z.ticketId||z.id]})]}),i.jsxs("div",{className:"text-right",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4 justify-end",children:[i.jsxs("button",{onClick:()=>{if(z){const Y=z.currency==="Euro"?"€":z.currency==="GBP"?"£":"$",we=w(z.totalTime),ve=(z.hourlyRate||0)*we+(z.travelCost||0)+(z.materialCost||0)+(z.halfDayRate||0)+(z.fullDayRate||0)+(z.monthlyRate||0),Oe=z.totalAmount&&z.totalAmount>0?z.totalAmount:ve,qe=(z.clientHourlyRate||0)*we+(z.clientTravelCost||0)+(z.clientMaterialCost||0)+(z.clientHalfDayRate||0)+(z.clientFullDayRate||0)+(z.clientMonthlyRate||0),me=z.clientTotalAmount&&z.clientTotalAmount>0?z.clientTotalAmount:qe,Ge={id:z.ticketId||z.id,assignedOrder:z.assignedTo||"Unassigned",requestedOrder:z.client||z.name,amount:`${Y}${Oe.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,clientAmount:`${Y}${me.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,issueDate:z.issueDate||new Date().toISOString().split("T")[0],dueDate:z.deadline,completedDate:z.completedDate,status:z.status==="Completed"?"Paid":z.status==="Cancelled"?"Overdue":"Unpaid",engineerStatus:z.status==="Completed"?"Paid":z.status==="Cancelled"?"Overdue":"Unpaid",clientStatus:z.clientStatus==="Completed"?"Paid":z.clientStatus==="Cancelled"?"Overdue":"Unpaid",project:z,issuedMonth:z.issuedMonth};ue(Ge)}},className:"flex items-center gap-2 px-3 py-1.5 text-xs font-medium rounded-lg border border-border hover:bg-accent transition-colors text-primary",children:[i.jsx(Nr,{size:14}),"Download PDF"]}),i.jsx("button",{onClick:()=>oe(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-sm font-bold",children:"Date Issued"}),i.jsx("input",{type:"date",value:z.issueDate||"",onChange:Y=>fe({...z,issueDate:Y.target.value}),className:"text-sm text-muted-foreground bg-transparent border-none p-0 focus:ring-0 text-right w-full"})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-sm font-bold",children:"Issued Month"}),i.jsx("input",{type:"month",value:z.issuedMonth||"",onChange:Y=>fe({...z,issuedMonth:Y.target.value}),className:"text-sm text-muted-foreground bg-transparent border-none p-0 focus:ring-0 text-right w-full"})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-12 border-t border-b border-border py-8",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:y==="client_invoices"?"From (Company)":"From (Engineer)"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("input",{type:"text",value:y==="client_invoices"?z.companyName||"":z.assignedTo||"",onChange:Y=>{fe(y==="engineer_invoices"?{...z,assignedTo:Y.target.value}:{...z,companyName:Y.target.value})},className:"w-full font-bold bg-transparent border-none p-0 focus:ring-0 text-lg",placeholder:y==="client_invoices"?"Company Name":"Engineer Name"}),y==="engineer_invoices"?i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"email",value:z.assignedEmail||"",onChange:Y=>fe({...z,assignedEmail:Y.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground",placeholder:"engineer@example.com"}),i.jsx("input",{type:"text",value:z.assignedContactNumber||"",onChange:Y=>fe({...z,assignedContactNumber:Y.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground",placeholder:"Engineer Contact"})]}):i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"email",value:z.companyEmail||"",onChange:Y=>fe({...z,companyEmail:Y.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground",placeholder:"billing@company.com"}),i.jsx("input",{type:"text",value:z.companyPhone||"",onChange:Y=>fe({...z,companyPhone:Y.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground",placeholder:"Company Contact"})]}),i.jsx("textarea",{value:y==="client_invoices"?z.companyAddress||"":z.address||"",onChange:Y=>{fe(y==="client_invoices"?{...z,companyAddress:Y.target.value}:{...z,address:Y.target.value})},className:"w-full text-xs bg-transparent border-none p-0 focus:ring-0 text-muted-foreground resize-none",placeholder:y==="client_invoices"?"Company Address":"Sender Address",rows:2})]})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:y==="client_invoices"?"Bill To (Client)":"Bill To (Company)"}),i.jsx("div",{className:"space-y-2",children:y==="client_invoices"?i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",value:z.client||"",onChange:Y=>fe({...z,client:Y.target.value}),className:"w-full font-bold bg-transparent border-none p-0 focus:ring-0 text-lg",placeholder:"Client Name"}),i.jsx("input",{type:"text",value:z.personName||"",onChange:Y=>fe({...z,personName:Y.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground",placeholder:"Contact Person"}),i.jsx("input",{type:"email",value:z.email||"",onChange:Y=>fe({...z,email:Y.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground",placeholder:"Client Email"}),i.jsx("input",{type:"text",value:z.contactNumber||"",onChange:Y=>fe({...z,contactNumber:Y.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground",placeholder:"Client Contact"}),i.jsx("textarea",{value:z.clientAddress||"",onChange:Y=>fe({...z,clientAddress:Y.target.value}),className:"w-full text-xs bg-transparent border-none p-0 focus:ring-0 text-muted-foreground resize-none",placeholder:"Client Address",rows:2})]}):i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",value:z.companyName||"",onChange:Y=>fe({...z,companyName:Y.target.value}),className:"w-full font-bold bg-transparent border-none p-0 focus:ring-0 text-lg",placeholder:"Company Name"}),i.jsx("input",{type:"email",value:z.companyEmail||"",onChange:Y=>fe({...z,companyEmail:Y.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground",placeholder:"billing@company.com"}),i.jsx("input",{type:"text",value:z.companyPhone||"",onChange:Y=>fe({...z,companyPhone:Y.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground",placeholder:"Company Contact"}),i.jsx("textarea",{value:z.companyAddress||"",onChange:Y=>fe({...z,companyAddress:Y.target.value}),className:"w-full text-xs bg-transparent border-none p-0 focus:ring-0 text-muted-foreground resize-none",placeholder:"Company Address",rows:2})]})})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-12 gap-4 pb-2 border-b border-border text-xs font-bold uppercase tracking-wider text-muted-foreground",children:[i.jsx("div",{className:"col-span-6",children:"Description"}),i.jsx("div",{className:"col-span-2 text-center",children:"Quantity/Time"}),i.jsx("div",{className:"col-span-2 text-right",children:"Rate"}),i.jsx("div",{className:"col-span-2 text-right",children:"Amount"})]}),i.jsxs("div",{className:"grid grid-cols-12 gap-4 items-center py-2 border-b border-border/50",children:[i.jsx("div",{className:"col-span-6 text-sm font-medium",children:"Professional Services (Hourly)"}),i.jsx("div",{className:"col-span-2",children:i.jsx("input",{type:"text",value:z.totalTime||"0h",onChange:Y=>fe({...z,totalTime:Y.target.value}),className:"w-full text-center text-sm bg-transparent border-none p-0 focus:ring-0"})}),i.jsx("div",{className:"col-span-2",children:i.jsx("input",{type:"number",value:y==="client_invoices"?z.clientHourlyRate||0:z.hourlyRate||0,onChange:Y=>{const we=parseFloat(Y.target.value)||0;fe(y==="client_invoices"?{...z,clientHourlyRate:we}:{...z,hourlyRate:we})},className:"w-full text-right text-sm bg-transparent border-none p-0 focus:ring-0"})}),i.jsx("div",{className:"col-span-2 text-right text-sm font-medium",children:((y==="client_invoices"?z.clientHourlyRate||0:z.hourlyRate||0)*w(z.totalTime)).toFixed(2)})]}),i.jsxs("div",{className:"grid grid-cols-12 gap-4 items-center py-2 border-b border-border/50",children:[i.jsx("div",{className:"col-span-6 text-sm font-medium",children:"Professional Services (Half Day)"}),i.jsx("div",{className:"col-span-2 text-center text-sm text-muted-foreground",children:"1"}),i.jsx("div",{className:"col-span-2",children:i.jsx("input",{type:"number",value:y==="client_invoices"?z.clientHalfDayRate||0:z.halfDayRate||0,onChange:Y=>{const we=parseFloat(Y.target.value)||0;fe(y==="client_invoices"?{...z,clientHalfDayRate:we}:{...z,halfDayRate:we})},className:"w-full text-right text-sm bg-transparent border-none p-0 focus:ring-0"})}),i.jsx("div",{className:"col-span-2 text-right text-sm font-medium",children:(y==="client_invoices"?z.clientHalfDayRate||0:z.halfDayRate||0).toFixed(2)})]}),i.jsxs("div",{className:"grid grid-cols-12 gap-4 items-center py-2 border-b border-border/50",children:[i.jsx("div",{className:"col-span-6 text-sm font-medium",children:"Professional Services (Full Day)"}),i.jsx("div",{className:"col-span-2 text-center text-sm text-muted-foreground",children:"1"}),i.jsx("div",{className:"col-span-2",children:i.jsx("input",{type:"number",value:y==="client_invoices"?z.clientFullDayRate||0:z.fullDayRate||0,onChange:Y=>{const we=parseFloat(Y.target.value)||0;fe(y==="client_invoices"?{...z,clientFullDayRate:we}:{...z,fullDayRate:we})},className:"w-full text-right text-sm bg-transparent border-none p-0 focus:ring-0"})}),i.jsx("div",{className:"col-span-2 text-right text-sm font-medium",children:(y==="client_invoices"?z.clientFullDayRate||0:z.fullDayRate||0).toFixed(2)})]}),i.jsxs("div",{className:"grid grid-cols-12 gap-4 items-center py-2 border-b border-border/50",children:[i.jsx("div",{className:"col-span-6 text-sm font-medium",children:"Professional Services (Monthly)"}),i.jsx("div",{className:"col-span-2 text-center text-sm text-muted-foreground",children:"1"}),i.jsx("div",{className:"col-span-2",children:i.jsx("input",{type:"number",value:y==="client_invoices"?z.clientMonthlyRate||0:z.monthlyRate||0,onChange:Y=>{const we=parseFloat(Y.target.value)||0;fe(y==="client_invoices"?{...z,clientMonthlyRate:we}:{...z,monthlyRate:we})},className:"w-full text-right text-sm bg-transparent border-none p-0 focus:ring-0"})}),i.jsx("div",{className:"col-span-2 text-right text-sm font-medium",children:(y==="client_invoices"?z.clientMonthlyRate||0:z.monthlyRate||0).toFixed(2)})]}),i.jsxs("div",{className:"grid grid-cols-12 gap-4 items-center py-2 border-b border-border/50",children:[i.jsx("div",{className:"col-span-6 text-sm font-medium",children:"Travel Expenses"}),i.jsx("div",{className:"col-span-2 text-center text-sm text-muted-foreground",children:"1"}),i.jsx("div",{className:"col-span-2",children:i.jsx("input",{type:"number",value:y==="client_invoices"?z.clientTravelCost||0:z.travelCost||0,onChange:Y=>{const we=parseFloat(Y.target.value)||0;fe(y==="client_invoices"?{...z,clientTravelCost:we}:{...z,travelCost:we})},className:"w-full text-right text-sm bg-transparent border-none p-0 focus:ring-0"})}),i.jsx("div",{className:"col-span-2 text-right text-sm font-medium",children:(y==="client_invoices"?z.clientTravelCost||0:z.travelCost||0).toFixed(2)})]}),i.jsxs("div",{className:"grid grid-cols-12 gap-4 items-center py-2 border-b border-border/50",children:[i.jsx("div",{className:"col-span-6 text-sm font-medium",children:"Material & Equipment"}),i.jsx("div",{className:"col-span-2 text-center text-sm text-muted-foreground",children:"1"}),i.jsx("div",{className:"col-span-2",children:i.jsx("input",{type:"number",value:y==="client_invoices"?z.clientMaterialCost||0:z.materialCost||0,onChange:Y=>{const we=parseFloat(Y.target.value)||0;fe(y==="client_invoices"?{...z,clientMaterialCost:we}:{...z,materialCost:we})},className:"w-full text-right text-sm bg-transparent border-none p-0 focus:ring-0"})}),i.jsx("div",{className:"col-span-2 text-right text-sm font-medium",children:(y==="client_invoices"?z.clientMaterialCost||0:z.materialCost||0).toFixed(2)})]})]}),i.jsxs("div",{className:"flex justify-between items-start pt-4",children:[i.jsxs("div",{className:"w-1/2 space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Status"}),i.jsxs("select",{value:y==="client_invoices"?z.clientStatus==="Completed"?"Paid":z.clientStatus==="Cancelled"?"Overdue":"Unpaid":z.status==="Completed"?"Paid":z.status==="Cancelled"?"Overdue":"Unpaid",onChange:Y=>{const we=Y.target.value;let J="In Progress";we==="Paid"&&(J="Completed"),we==="Overdue"&&(J="Cancelled"),fe(y==="client_invoices"?{...z,clientStatus:J}:{...z,status:J})},className:"block w-full h-9 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"Unpaid",children:"Unpaid"}),i.jsx("option",{value:"Paid",children:"Paid"}),i.jsx("option",{value:"Overdue",children:"Overdue"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Due Date"}),i.jsx("input",{type:"date",value:z.deadline||"",onChange:Y=>fe({...z,deadline:Y.target.value}),className:"block w-full h-9 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Status"}),i.jsxs("select",{value:y==="client_invoices"?z.clientInvoiceStatus||"Unpaid":z.engineerInvoiceStatus||"Unpaid",onChange:Y=>{const we=Y.target.value;fe(y==="client_invoices"?{...z,clientInvoiceStatus:we}:{...z,engineerInvoiceStatus:we})},className:"block w-full h-9 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"Unpaid",children:"Unpaid"}),i.jsx("option",{value:"Paid",children:"Paid"}),i.jsx("option",{value:"Overdue",children:"Overdue"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Notes / Payment Terms"}),i.jsx("textarea",{rows:3,className:"w-full rounded-lg border border-border bg-background p-3 text-xs focus:outline-none focus:ring-2 focus:ring-primary/20 resize-none",placeholder:"e.g. Please pay within 30 days. Bank details: ...",defaultValue:y==="client_invoices"?"Payment is due within 30 days. Thank you for your business!":"Please process this invoice at your earliest convenience."})]})]}),i.jsxs("div",{className:"w-1/3 space-y-3",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Subtotal"}),i.jsx("span",{className:"font-medium",children:((y==="client_invoices"?z.clientHourlyRate||0:z.hourlyRate||0)*w(z.totalTime)+(y==="client_invoices"?z.clientHalfDayRate||0:z.halfDayRate||0)+(y==="client_invoices"?z.clientFullDayRate||0:z.fullDayRate||0)+(y==="client_invoices"?z.clientMonthlyRate||0:z.monthlyRate||0)+(y==="client_invoices"?z.clientTravelCost||0:z.travelCost||0)+(y==="client_invoices"?z.clientMaterialCost||0:z.materialCost||0)).toFixed(2)})]}),i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsxs("span",{className:"text-muted-foreground",children:["Tax (",z.taxRate||0,"%)"]}),i.jsx("span",{className:"font-medium",children:(z.taxAmount||0).toFixed(2)})]}),i.jsxs("div",{className:"flex justify-between items-center pt-3 border-t border-border",children:[i.jsx("span",{className:"text-lg font-bold",children:"Total"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-muted-foreground text-sm",children:g(z.currency)}),i.jsxs("div",{className:"flex flex-col items-end",children:[i.jsx("input",{type:"number",value:y==="client_invoices"?z.clientTotalAmount||0:z.totalAmount||0,onChange:Y=>{const we=parseFloat(Y.target.value)||0;fe(y==="client_invoices"?{...z,clientTotalAmount:we}:{...z,totalAmount:we})},className:"w-24 text-right text-2xl font-bold bg-transparent border-none p-0 focus:ring-0"}),i.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Tax Rate:"}),i.jsx("input",{type:"number",value:z.taxRate||0,onChange:Y=>{const we=parseFloat(Y.target.value)||0,J=(y==="client_invoices"?z.clientHourlyRate||0:z.hourlyRate||0)*w(z.totalTime)+(y==="client_invoices"?z.clientHalfDayRate||0:z.halfDayRate||0)+(y==="client_invoices"?z.clientFullDayRate||0:z.fullDayRate||0)+(y==="client_invoices"?z.clientMonthlyRate||0:z.monthlyRate||0)+(y==="client_invoices"?z.clientTravelCost||0:z.travelCost||0)+(y==="client_invoices"?z.clientMaterialCost||0:z.materialCost||0),ve=J*(we/100),Oe=J+ve;fe(y==="client_invoices"?{...z,taxRate:we,taxAmount:ve,clientTotalAmount:Oe}:{...z,taxRate:we,taxAmount:ve,totalAmount:Oe})},className:"w-12 text-right text-[10px] border border-border rounded px-1"}),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"%"})]}),i.jsxs("div",{className:"flex flex-col mt-4 pt-4 border-t border-border/50",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2 text-right",children:[i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Third-Party Commissions"}),i.jsxs("button",{type:"button",onClick:()=>{const Y={id:Math.random().toString(36).substr(2,9),vendorName:"",rate:0,amount:0,status:"Unpaid"};fe({...z,commissions:[...z.commissions||[],Y]})},className:"text-[10px] font-bold text-primary hover:underline flex items-center gap-1",children:[i.jsx($n,{size:10})," Add Vendor"]})]}),i.jsxs("div",{className:"space-y-2",children:[(z.commissions||[]).map((Y,we)=>i.jsxs("div",{className:"flex items-center gap-2 bg-muted/10 p-2 rounded-lg",children:[i.jsx("input",{type:"text",placeholder:"Vendor",value:Y.vendorName,onChange:J=>{const ve=JSON.parse(JSON.stringify(z.commissions||[]));ve[we].vendorName=J.target.value,fe({...z,commissions:ve})},className:"flex-1 text-[10px] h-7 bg-background border border-border rounded px-2 outline-none focus:ring-1 focus:ring-primary/20"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("input",{type:"number",value:Y.rate,onChange:J=>{const ve=parseFloat(J.target.value)||0,Oe=y==="client_invoices"?z.clientTotalAmount||0:z.totalAmount||0,xe=JSON.parse(JSON.stringify(z.commissions||[]));xe[we].rate=ve,xe[we].amount=Oe*(ve/100),fe({...z,commissions:xe})},className:"w-10 text-right text-[10px] h-7 bg-background border border-border rounded px-1 outline-none focus:ring-1 focus:ring-primary/20"}),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"%"})]}),i.jsxs("div",{className:"w-16 text-right text-[10px] font-bold text-primary truncate",children:[z.currency==="Euro"?"€":z.currency==="GBP"?"£":"$",Y.amount.toLocaleString(void 0,{minimumFractionDigits:2})]}),i.jsx("button",{type:"button",onClick:()=>{const J=(z.commissions||[]).filter((ve,Oe)=>Oe!==we);fe({...z,commissions:J})},className:"p-1 text-red-500 hover:bg-red-50 rounded transition-colors",children:i.jsx(xr,{size:12})})]},Y.id||we)),(z.commissions||[]).length===0&&i.jsx("p",{className:"text-[10px] text-muted-foreground italic text-center py-2",children:"No commissions assigned"})]})]})]})]})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-4 pt-8 border-t border-border",children:[i.jsxs("button",{type:"button",onClick:()=>{if(z){const Y=z.currency==="Euro"?"€":z.currency==="GBP"?"£":"$",we=w(z.totalTime),ve=(z.hourlyRate||0)*we+(z.travelCost||0)+(z.materialCost||0)+(z.halfDayRate||0)+(z.fullDayRate||0)+(z.monthlyRate||0),Oe=z.totalAmount&&z.totalAmount>0?z.totalAmount:ve,qe=(z.clientHourlyRate||0)*we+(z.clientTravelCost||0)+(z.clientMaterialCost||0)+(z.clientHalfDayRate||0)+(z.clientFullDayRate||0)+(z.clientMonthlyRate||0),me=z.clientTotalAmount&&z.clientTotalAmount>0?z.clientTotalAmount:qe,Ge={id:z.ticketId||z.id,assignedOrder:z.assignedTo||"Unassigned",requestedOrder:z.client||z.name,amount:`${Y}${Oe.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,clientAmount:`${Y}${me.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,issueDate:z.issueDate||new Date().toISOString().split("T")[0],dueDate:z.deadline,completedDate:z.completedDate,status:z.status==="Completed"?"Paid":z.status==="Cancelled"?"Overdue":"Unpaid",engineerStatus:z.status==="Completed"?"Paid":z.status==="Cancelled"?"Overdue":"Unpaid",clientStatus:z.clientStatus==="Completed"?"Paid":z.clientStatus==="Cancelled"?"Overdue":"Unpaid",project:z,issuedMonth:z.issuedMonth};ue(Ge)}},className:"px-6 py-2.5 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors flex items-center gap-2",children:[i.jsx(Nr,{size:16}),"Download PDF"]}),i.jsx("button",{type:"button",onClick:()=>oe(!1),className:"px-6 py-2.5 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Discard Changes"}),i.jsx("button",{onClick:Ye,disabled:le,className:"px-8 py-2.5 bg-primary text-primary-foreground text-sm font-medium rounded-lg hover:bg-primary/90 transition-colors shadow-lg shadow-primary/20 disabled:opacity-50",children:le?"Saving...":"Save & Update Invoice"})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Edit Invoice"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>{if(z){const Y=z.currency==="Euro"?"€":z.currency==="GBP"?"£":"$",we=w(z.totalTime),ve=(z.hourlyRate||0)*we+(z.travelCost||0)+(z.materialCost||0)+(z.halfDayRate||0)+(z.fullDayRate||0)+(z.monthlyRate||0),Oe=z.totalAmount&&z.totalAmount>0?z.totalAmount:ve,qe=(z.clientHourlyRate||0)*we+(z.clientTravelCost||0)+(z.clientMaterialCost||0)+(z.clientHalfDayRate||0)+(z.clientFullDayRate||0)+(z.clientMonthlyRate||0),me=z.clientTotalAmount&&z.clientTotalAmount>0?z.clientTotalAmount:qe,Ge={id:z.ticketId||z.id,assignedOrder:z.assignedTo||"Unassigned",requestedOrder:z.client||z.name,amount:`${Y}${Oe.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,clientAmount:`${Y}${me.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,issueDate:z.issueDate||new Date().toISOString().split("T")[0],dueDate:z.deadline,completedDate:z.completedDate,status:z.status==="Completed"?"Paid":z.status==="Cancelled"?"Overdue":"Unpaid",engineerStatus:z.status==="Completed"?"Paid":z.status==="Cancelled"?"Overdue":"Unpaid",clientStatus:z.clientStatus==="Completed"?"Paid":z.clientStatus==="Cancelled"?"Overdue":"Unpaid",project:z,issuedMonth:z.issuedMonth};ue(Ge)}},className:"flex items-center gap-2 px-3 py-1.5 text-xs font-medium rounded-lg border border-border hover:bg-accent transition-colors text-primary",children:[i.jsx(Nr,{size:14}),"Download PDF"]}),i.jsx("button",{type:"button",onClick:()=>oe(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsxs("form",{onSubmit:Ye,className:"space-y-4",children:[(y==="invoices"||y==="engineer_invoices")&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Assigned Order (Engineer)"}),i.jsx("input",{type:"text",value:z.assignedTo||"",onChange:Y=>fe({...z,assignedTo:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),(y==="invoices"||y==="client_invoices")&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Requested Order (Client)"}),i.jsx("input",{type:"text",value:z.client||"",onChange:Y=>fe({...z,client:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[(y==="invoices"||y==="engineer_invoices")&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Engineer Amount"}),i.jsx("input",{type:"number",value:z.totalAmount||0,onChange:Y=>fe({...z,totalAmount:parseFloat(Y.target.value)||0}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),(y==="invoices"||y==="client_invoices")&&i.jsxs("div",{className:tt("space-y-2",y==="client_invoices"?"col-span-2":""),children:[i.jsx("label",{className:"text-sm font-medium",children:"Client Amount"}),i.jsx("input",{type:"number",value:z.clientTotalAmount||0,onChange:Y=>fe({...z,clientTotalAmount:parseFloat(Y.target.value)||0}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Issue Date"}),i.jsx("input",{type:"date",value:z.issueDate||"",onChange:Y=>fe({...z,issueDate:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Issued Month"}),i.jsx("input",{type:"month",value:z.issuedMonth||"",onChange:Y=>fe({...z,issuedMonth:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Due Date"}),i.jsx("input",{type:"date",value:z.deadline||"",onChange:Y=>fe({...z,deadline:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[(y==="invoices"||y==="engineer_invoices")&&i.jsxs("div",{className:tt("space-y-2",y==="engineer_invoices"?"col-span-2":""),children:[i.jsx("label",{className:"text-sm font-medium",children:"Engineer Status"}),i.jsxs("select",{value:z.engineerInvoiceStatus||(z.status==="Completed"?"Paid":z.status==="Cancelled"?"Overdue":"Unpaid"),onChange:Y=>{const we=Y.target.value;fe({...z,engineerInvoiceStatus:we})},className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"Unpaid",children:"Unpaid"}),i.jsx("option",{value:"Paid",children:"Paid"}),i.jsx("option",{value:"Overdue",children:"Overdue"})]})]}),(y==="invoices"||y==="client_invoices")&&i.jsxs("div",{className:tt("space-y-2",y==="client_invoices"?"col-span-2":""),children:[i.jsx("label",{className:"text-sm font-medium",children:"Client Status"}),i.jsxs("select",{value:z.clientInvoiceStatus||(z.clientStatus==="Completed"?"Paid":z.clientStatus==="Cancelled"?"Overdue":"Unpaid"),onChange:Y=>{const we=Y.target.value;fe({...z,clientInvoiceStatus:we})},className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"Unpaid",children:"Unpaid"}),i.jsx("option",{value:"Paid",children:"Paid"}),i.jsx("option",{value:"Overdue",children:"Overdue"})]})]})]}),i.jsxs("div",{className:"pt-4 flex gap-3",children:[i.jsx("button",{type:"button",onClick:()=>oe(!1),className:"flex-1 px-4 py-2 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",className:"flex-1 bg-primary px-4 py-2 text-sm font-medium text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Save Changes"})]})]})]})})}),ce&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center p-4 bg-background/80 backdrop-blur-sm overflow-y-auto",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-2xl animate-in fade-in zoom-in duration-200 my-8",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Create New Invoice"}),i.jsx("button",{onClick:()=>D(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:_e,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Assigned Order"}),i.jsx("input",{type:"text",placeholder:"e.g. Alex Rivera",value:de.assignedOrder||"",onChange:Y=>W({...de,assignedOrder:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Requested Order (Company Name)"}),i.jsx("input",{type:"text",placeholder:"e.g. TechCorp",value:de.requestedOrder||"",onChange:Y=>W({...de,requestedOrder:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:y==="client_invoices"?"Amount":"Engineer Amount"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:g(u.currency||"USD")}),i.jsx("input",{type:"text",placeholder:"0.00",value:de.amount||"",onChange:Y=>W({...de,amount:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background pl-7 pr-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Issue Date"}),i.jsx("input",{type:"date",value:de.issueDate||"",onChange:Y=>W({...de,issueDate:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Issued Month"}),i.jsx("input",{type:"month",value:de.issuedMonth||"",onChange:Y=>W({...de,issuedMonth:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Due Date"}),i.jsx("input",{type:"date",value:de.dueDate||"",onChange:Y=>W({...de,dueDate:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Initial Status"}),i.jsxs("select",{value:de.status||"Unpaid",onChange:Y=>W({...de,status:Y.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"Unpaid",children:"Unpaid"}),i.jsx("option",{value:"Paid",children:"Paid"}),i.jsx("option",{value:"Overdue",children:"Overdue"})]})]}),i.jsxs("div",{className:"pt-4 flex gap-3",children:[i.jsx("button",{type:"button",onClick:()=>D(!1),className:"flex-1 px-4 py-2 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",className:"flex-1 bg-primary px-4 py-2 text-sm font-medium text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Create Invoice"})]})]})]})}),i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Finance Management"}),i.jsx("p",{className:"text-muted-foreground",children:"Monitor cash flow, manage invoices, and track business expenses."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:Xe,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(w3,{size:18,className:"text-red-500"}),"Record Expense"]}),i.jsxs("button",{onClick:ae,className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[i.jsx($n,{size:18}),"Create Invoice"]})]})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-5",children:[i.jsx(Vg,{title:"Total Revenue",value:`$${Z.totalRevenue.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,icon:Fo,trend:"Total billings",trendType:"neutral",description:"Total client billings"}),i.jsx(Vg,{title:"Total Expenses",value:`$${Z.totalExpenses.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,icon:w3,trend:"Payouts + Comms",trendType:"neutral",description:"Total payouts & commissions"}),i.jsx(Vg,{title:"3rd-party Comms",value:`$${Z.totalCommissions.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,icon:Hn,trend:`${(Z.totalCommissions/(Z.totalRevenue||1)*100).toFixed(1)}% of Rev`,trendType:"neutral",description:"Third-party commissions"}),i.jsx(Vg,{title:"Net Profit",value:`$${Z.netProfit.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,icon:ds,trend:`${Z.margin.toFixed(1)}%`,trendType:"up",description:"Profit margin"}),i.jsx(Vg,{title:"Pending Invoices",value:`$${Z.pendingAmount.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,icon:Ui,trend:`${Z.pendingCount} invoices`,trendType:"neutral",description:"Awaiting payment"})]}),i.jsxs("div",{className:"flex border-b border-border",children:[i.jsxs("button",{onClick:()=>v("overview"),className:tt("px-6 py-3 text-sm font-medium transition-all relative",y==="overview"?"text-primary":"text-muted-foreground hover:text-foreground"),children:["Overview",y==="overview"&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),i.jsxs("button",{onClick:()=>v("transactions"),className:tt("px-6 py-3 text-sm font-medium transition-all relative",y==="transactions"?"text-primary":"text-muted-foreground hover:text-foreground"),children:["Transactions",y==="transactions"&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),i.jsxs("button",{onClick:()=>v("invoices"),className:tt("px-6 py-3 text-sm font-medium transition-all relative",y==="invoices"?"text-primary":"text-muted-foreground hover:text-foreground"),children:["All Invoices",y==="invoices"&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),i.jsxs("button",{onClick:()=>v("engineer_invoices"),className:tt("px-6 py-3 text-sm font-medium transition-all relative",y==="engineer_invoices"?"text-primary":"text-muted-foreground hover:text-foreground"),children:["Engineer Invoices",y==="engineer_invoices"&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),i.jsxs("button",{onClick:()=>v("client_invoices"),className:tt("px-6 py-3 text-sm font-medium transition-all relative",y==="client_invoices"?"text-primary":"text-muted-foreground hover:text-foreground"),children:["Client Invoices",y==="client_invoices"&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),i.jsxs("button",{onClick:()=>v("bookkeeping"),className:tt("px-6 py-3 text-sm font-medium transition-all relative",y==="bookkeeping"?"text-primary":"text-muted-foreground hover:text-foreground"),children:["Bookkeeping",y==="bookkeeping"&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),i.jsxs("button",{onClick:()=>v("tax"),className:tt("px-6 py-3 text-sm font-medium transition-all relative",y==="tax"?"text-primary":"text-muted-foreground hover:text-foreground"),children:["Government Tax",y==="tax"&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),i.jsxs("button",{onClick:()=>v("commissions"),className:tt("px-6 py-3 text-sm font-medium transition-all relative",y==="commissions"?"text-primary":"text-muted-foreground hover:text-foreground"),children:["Third-party Commission",y==="commissions"&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]}),y==="commissions"&&i.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold",children:"Third-party Vendor Commissions"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage and track commission payouts to third-party agents or vendors."})]}),i.jsx("div",{className:"flex gap-2",children:i.jsxs("button",{onClick:()=>{const Y=new tr("l","mm","a4");Y.setFontSize(18),Y.text("Commission Report",14,20),Y.setFontSize(10),Y.text(`Generated on: ${new Date().toLocaleString()}`,14,28);const we=[["Project ID","Client","Project Name","Third Party","Rate (%)","Commission Amount","Status"]],J=A.map(ve=>{var xe,qe;const Oe=((xe=ve.project)==null?void 0:xe.currency)==="Euro"?"€":((qe=ve.project)==null?void 0:qe.currency)==="GBP"?"£":"$";return[ve.projectTicket,ve.client||"N/A",ve.projectName,ve.vendorName||"N/A",`${ve.rate||0}%`,`${Oe}${ve.amount.toLocaleString()}`,ve.status||"Unpaid"]});zd(Y,{head:we,body:J,startY:35,theme:"striped",headStyles:{fillColor:[15,23,42]}}),Y.save("commission_report.pdf"),De.success("Commission report exported")},className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:16}),"Export CSV"]})})]}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Total Commissions"}),i.jsxs("p",{className:"text-2xl font-bold",children:["$",A.reduce((Y,we)=>Y+we.amount,0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Paid Commissions"}),i.jsxs("p",{className:"text-2xl font-bold text-green-500",children:["$",A.filter(Y=>Y.status==="Paid").reduce((Y,we)=>Y+we.amount,0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Pending Commissions"}),i.jsxs("p",{className:"text-2xl font-bold text-orange-500",children:["$",A.filter(Y=>Y.status!=="Paid").reduce((Y,we)=>Y+we.amount,0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Project & Client"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Third Party Vendor"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Commission %"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Amount"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Status"}),i.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),i.jsxs("tbody",{className:"divide-y divide-border",children:[A.map(Y=>{var J,ve;const we=((J=Y.project)==null?void 0:J.currency)==="Euro"?"€":((ve=Y.project)==null?void 0:ve.currency)==="GBP"?"£":"$";return i.jsxs("tr",{className:"hover:bg-accent/30 transition-colors",children:[i.jsxs("td",{className:"px-6 py-4",children:[i.jsx("p",{className:"font-medium",children:Y.projectName}),i.jsx("p",{className:"text-xs text-muted-foreground",children:Y.client}),i.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:["ID: ",Y.projectTicket]})]}),i.jsx("td",{className:"px-6 py-4",children:Y.vendorName?i.jsx("span",{className:"font-medium",children:Y.vendorName}):i.jsx("span",{className:"text-muted-foreground italic text-xs",children:"Not assigned"})}),i.jsxs("td",{className:"px-6 py-4 font-mono",children:[Y.rate||0,"%"]}),i.jsxs("td",{className:"px-6 py-4 font-bold text-primary",children:[we,Y.amount.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),i.jsx("td",{className:"px-6 py-4",children:i.jsx("span",{className:tt("inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",Y.status==="Paid"?"bg-green-500/10 text-green-500":"bg-orange-500/10 text-orange-500"),children:Y.status||"Unpaid"})}),i.jsx("td",{className:"px-6 py-4 text-right",children:i.jsxs("div",{className:"flex justify-end gap-2",children:[m("finance.edit")&&i.jsx("button",{onClick:()=>{const Oe=k.find(xe=>xe.id===Y.projectTicket);Oe&&Ne(Oe)},className:"p-1.5 rounded-lg border border-border bg-card hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Edit project details",children:i.jsx(Ps,{size:14})}),m("finance.export")&&i.jsx("button",{onClick:()=>{var xe,qe,me,Ge,Be,it;const Oe=((xe=Y.project)==null?void 0:xe.currency)==="Euro"?"€":((qe=Y.project)==null?void 0:qe.currency)==="GBP"?"£":"$";re({invoiceId:`COMM-${Y.id.substring(0,8).toUpperCase()}`,fromName:((me=Y.project)==null?void 0:me.companyName)||u.name||"MA IT TECH",fromEmail:((Ge=Y.project)==null?void 0:Ge.companyEmail)||u.email||"billing@ma-it-tech.com",fromPhone:((Be=Y.project)==null?void 0:Be.companyPhone)||u.phone||"",fromAddress:((it=Y.project)==null?void 0:it.companyAddress)||u.location||"",billToName:Y.vendorName||"",billToEmail:"",billToPhone:"",billToAddress:"",description:`Commission for ${Y.projectName}`,projectRef:Y.projectTicket,amount:Y.amount,date:new Date().toISOString().split("T")[0],currency:Oe}),G(!0)},className:"p-1.5 rounded-lg border border-border bg-card hover:bg-accent transition-colors text-primary hover:text-primary-foreground hover:bg-primary",title:"Generate Commission Invoice",children:i.jsx(Tn,{size:14})}),m("finance.edit")&&i.jsx("button",{onClick:()=>T(Y.projectId,Y.id,Y.status),className:tt("p-1.5 rounded-lg border border-border bg-card transition-colors",Y.status==="Paid"?"text-green-500 bg-green-50":"text-muted-foreground hover:bg-accent"),title:Y.status==="Paid"?"Mark as Unpaid":"Mark as Paid",children:i.jsx(Hl,{size:14})})]})})]},`${Y.projectId}-${Y.id}`)}),A.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-muted-foreground italic",children:"No third-party commissions found."})})]})]})})]}),y==="tax"&&i.jsx(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},children:i.jsx(dAe,{})}),y==="bookkeeping"&&i.jsx(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},children:i.jsx(uAe,{})}),y==="overview"&&i.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h3",{className:"font-semibold",children:"Revenue vs Expenses"}),i.jsxs("select",{className:"text-xs border border-border rounded px-2 py-1 bg-background outline-none",children:[i.jsx("option",{children:"Last 6 Months"}),i.jsx("option",{children:"Last Year"})]})]}),i.jsx("div",{className:"h-[300px] w-full",children:i.jsx(_u,{width:"100%",height:"100%",children:i.jsxs(ov,{data:Z.chartData,children:[i.jsx(Mm,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))"}),i.jsx(uh,{dataKey:"month",axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"}}),i.jsx(dh,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"},tickFormatter:Y=>`$${Y/1e3}k`}),i.jsx(Eu,{contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",borderRadius:"8px"},itemStyle:{fontSize:"12px"},formatter:Y=>[`$${Y.toLocaleString()}`,""]}),i.jsx(Bd,{dataKey:"revenue",fill:"hsl(var(--primary))",radius:[4,4,0,0],barSize:30}),i.jsx(Bd,{dataKey:"expenses",fill:"hsl(var(--muted))",radius:[4,4,0,0],barSize:30})]})})})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"font-semibold mb-6",children:"Cash Flow Summary"}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-accent/30",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"h-10 w-10 rounded-full bg-green-500/10 flex items-center justify-center text-green-500",children:i.jsx(jv,{size:20})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:"Total Inflow"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Payments received this month"})]})]}),i.jsxs("p",{className:"text-lg font-bold text-green-500",children:["+$",Z.currentMonthInflow.toLocaleString()]})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-accent/30",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"h-10 w-10 rounded-full bg-red-500/10 flex items-center justify-center text-red-500",children:i.jsx(bv,{size:20})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:"Total Outflow"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Expenses paid this month"})]})]}),i.jsxs("p",{className:"text-lg font-bold text-red-500",children:["-$",Z.currentMonthOutflow.toLocaleString()]})]}),i.jsx("div",{className:"pt-4 border-t border-border",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("p",{className:"font-semibold",children:"Net Cash Flow"}),i.jsxs("p",{className:tt("text-xl font-bold",Z.currentMonthInflow-Z.currentMonthOutflow>=0?"text-green-500":"text-red-500"),children:[Z.currentMonthInflow-Z.currentMonthOutflow>=0?"+":"-","$",Math.abs(Z.currentMonthInflow-Z.currentMonthOutflow).toLocaleString()]})]})})]})]})]}),y==="transactions"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center justify-between",children:[i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search transactions, categories...",value:M,onChange:Y=>B(Y.target.value),className:"h-10 w-full rounded-lg border border-border bg-background pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[y==="transactions"&&m("finance.export")&&i.jsxs("button",{onClick:ke,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:18}),"Export PDF"]}),i.jsxs("div",{className:"relative",ref:se,children:[i.jsxs("button",{onClick:()=>F(!L),className:tt("flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium transition-colors hover:bg-accent",(I!=="All"||P!=="All"||K!=="All")&&"border-primary text-primary"),children:[i.jsx(Oc,{size:18}),"Filters",(I!=="All"||P!=="All"||K!=="All")&&i.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:[I,P,K].filter(Y=>Y!=="All").length})]}),L&&i.jsxs("div",{className:"absolute right-0 mt-2 z-50 w-72 rounded-xl border border-border bg-card p-4 shadow-lg animate-in fade-in slide-in-from-top-2 duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h4",{className:"font-bold text-sm",children:"Filter Transactions"}),i.jsx("button",{onClick:()=>{q("All"),R("All"),ee("All")},className:"text-[10px] font-bold uppercase tracking-wider text-primary hover:underline",children:"Reset"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Type"}),i.jsxs("select",{value:I,onChange:Y=>q(Y.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Types"}),i.jsx("option",{value:"Income",children:"Income"}),i.jsx("option",{value:"Expense",children:"Expense"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Category"}),i.jsxs("select",{value:P,onChange:Y=>R(Y.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Categories"}),Array.from(new Set(j.map(Y=>Y.category))).sort().map(Y=>i.jsx("option",{value:Y,children:Y},Y))]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Status"}),i.jsxs("select",{value:K,onChange:Y=>ee(Y.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Statuses"}),i.jsx("option",{value:"Completed",children:"Completed"}),i.jsx("option",{value:"Pending",children:"Pending"}),i.jsx("option",{value:"Cancelled",children:"Cancelled"})]})]})]})]})]})]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Transaction"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Invoice ID"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Category"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Amount"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Date"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),i.jsx("th",{className:"px-4 py-3 font-medium"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:at.map(Y=>i.jsxs("tr",{className:"hover:bg-accent/30 transition-colors group",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:tt("h-8 w-8 rounded-lg flex items-center justify-center",Y.type==="Income"?"bg-green-500/10 text-green-500":"bg-red-500/10 text-red-500"),children:Y.type==="Income"?i.jsx(jv,{size:16}):i.jsx(bv,{size:16})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium",children:Y.description}),i.jsx("p",{className:"text-xs text-muted-foreground",children:Y.id})]})]})}),i.jsxs("td",{className:"px-4 py-4 font-mono text-xs text-muted-foreground",children:["#",Y.invoiceId]}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:Y.category}),i.jsxs("td",{className:tt("px-4 py-4 font-semibold",Y.type==="Income"?"text-green-500":"text-red-500"),children:[Y.type==="Income"?"+":"-",Y.amount]}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:Y.date}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium",Y.status==="Completed"?"bg-green-500/10 text-green-500":Y.status==="Pending"?"bg-yellow-500/10 text-yellow-500":"bg-red-500/10 text-red-500"),children:Y.status})}),i.jsx("td",{className:"px-4 py-4 text-right",children:i.jsx("button",{className:"p-1 hover:bg-accent rounded-md text-muted-foreground transition-colors",children:i.jsx(Ym,{size:18})})})]},Y.id))})]})})})]}),(y==="invoices"||y==="client_invoices"||y==="engineer_invoices")&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center justify-between",children:[i.jsx("h3",{className:"text-lg font-semibold",children:y==="invoices"?"All Invoices":y==="engineer_invoices"?"Engineer Invoices (Engineer Rates)":"Client Invoices (Client Rates)"}),i.jsxs("div",{className:"flex items-center gap-2",children:[m("finance.export")&&i.jsxs("button",{onClick:$e,className:"px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors flex items-center gap-2",children:[i.jsx(Nr,{size:16}),"Export PDF"]}),i.jsx("button",{onClick:()=>{X(!ne),De.info(ne?"Showing limited invoices":"Displaying all invoices")},className:"px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",children:ne?"Show Less":"Show All Invoices"})]})]}),ne?i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Invoice"}),y!=="client_invoices"&&i.jsx("th",{className:"px-4 py-3 font-medium",children:"Assigned Order"}),y!=="engineer_invoices"&&i.jsx("th",{className:"px-4 py-3 font-medium",children:"Requested Order"}),y==="invoices"?i.jsxs(i.Fragment,{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Engineer Amount"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Client Amount"})]}):i.jsx("th",{className:"px-4 py-3 font-medium",children:y==="client_invoices"?"Client Amount":"Engineer Amount"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Issue Date"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Issued Month"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Due Date"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Completed Date"}),y==="invoices"?i.jsxs(i.Fragment,{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Eng. Status"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Client Status"})]}):i.jsx("th",{className:"px-4 py-3 font-medium",children:y==="client_invoices"?"Client Status":"Engineer Status"}),i.jsx("th",{className:"px-4 py-3 font-medium text-right",children:"Actions"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:k.map(Y=>i.jsxs("tr",{className:"hover:bg-accent/30 transition-colors group",children:[i.jsx("td",{className:"px-4 py-4 font-medium",children:Y.id}),y!=="client_invoices"&&i.jsx("td",{className:"px-4 py-4",children:Y.assignedOrder}),y!=="engineer_invoices"&&i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:Y.requestedOrder}),y==="invoices"?i.jsxs(i.Fragment,{children:[i.jsx("td",{className:"px-4 py-4 font-bold",children:Y.amount}),i.jsx("td",{className:"px-4 py-4 font-bold text-emerald-600",children:Y.clientAmount})]}):i.jsx("td",{className:"px-4 py-4 font-bold",children:y==="client_invoices"?Y.clientAmount:Y.amount}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:Y.issueDate}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:Y.issuedMonth?Y.issuedMonth.includes("-")?new Date(parseInt(Y.issuedMonth.split("-")[0]),parseInt(Y.issuedMonth.split("-")[1])-1).toLocaleString("default",{month:"long",year:"numeric"}):Y.issuedMonth:"-"}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:Y.dueDate}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:Y.completedDate||"-"}),y==="invoices"?i.jsxs(i.Fragment,{children:[i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("inline-flex items-center rounded-full px-2.5 py-0.5 text-[10px] font-medium",Y.engineerStatus==="Paid"?"bg-green-500/10 text-green-500":Y.engineerStatus==="Overdue"?"bg-red-500/10 text-red-500":"bg-yellow-500/10 text-yellow-500"),children:Y.engineerStatus})}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("inline-flex items-center rounded-full px-2.5 py-0.5 text-[10px] font-medium",Y.clientStatus==="Paid"?"bg-green-500/10 text-green-500":Y.clientStatus==="Overdue"?"bg-red-500/10 text-red-500":"bg-yellow-500/10 text-yellow-500"),children:Y.clientStatus})})]}):i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:tt("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",Y.status==="Paid"?"bg-green-500/10 text-green-500":Y.status==="Overdue"?"bg-red-500/10 text-red-500":"bg-yellow-500/10 text-yellow-500"),children:Y.status})}),i.jsx("td",{className:"px-4 py-4 text-right",children:i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx("button",{onClick:()=>Ne(Y),className:"p-2 rounded-lg border border-border hover:bg-accent transition-colors text-muted-foreground",title:"Edit",children:i.jsx(Ps,{size:14})}),y==="invoices"?i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Je(Y),className:"p-2 rounded-lg border border-border hover:bg-accent transition-colors text-orange-500",title:"Download Row Report (PDF)",children:i.jsx(Tn,{size:14})}),i.jsx("button",{onClick:()=>ue(Y,!1),className:"p-2 rounded-lg border border-border hover:bg-accent transition-colors text-blue-500",title:"Download Engineer Invoice (PDF)",children:i.jsx(Nr,{size:14})}),i.jsx("button",{onClick:()=>ue(Y,!0),className:"p-2 rounded-lg border border-border hover:bg-accent transition-colors text-emerald-600",title:"Download Client Invoice (PDF)",children:i.jsx(Nr,{size:14})})]}):i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Je(Y),className:"p-2 rounded-lg border border-border hover:bg-accent transition-colors text-orange-500",title:"Download Row Report (PDF)",children:i.jsx(Tn,{size:14})}),i.jsx("button",{onClick:()=>ue(Y),className:"p-2 rounded-lg border border-border hover:bg-accent transition-colors",title:"Download Invoice (PDF)",children:i.jsx(Nr,{size:14})})]})]})})]},Y.id))})]})})}):i.jsx("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-3",children:k.slice(0,3).map(Y=>i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm hover:shadow-md transition-all",children:[i.jsxs("div",{className:"flex items-start justify-between mb-4",children:[i.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(Tn,{size:20})}),y==="invoices"?i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("span",{className:tt("inline-flex items-center rounded-full px-2.5 py-0.5 text-[10px] font-medium",Y.engineerStatus==="Paid"?"bg-green-500/10 text-green-500":Y.engineerStatus==="Overdue"?"bg-red-500/10 text-red-500":"bg-yellow-500/10 text-yellow-500"),children:["Eng: ",Y.engineerStatus]}),i.jsxs("span",{className:tt("inline-flex items-center rounded-full px-2.5 py-0.5 text-[10px] font-medium",Y.clientStatus==="Paid"?"bg-green-500/10 text-green-500":Y.clientStatus==="Overdue"?"bg-red-500/10 text-red-500":"bg-yellow-500/10 text-yellow-500"),children:["Cli: ",Y.clientStatus]})]}):i.jsxs("span",{className:tt("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",Y.status==="Paid"?"bg-green-500/10 text-green-500":Y.status==="Overdue"?"bg-red-500/10 text-red-500":"bg-yellow-500/10 text-yellow-500"),children:[y==="client_invoices"?"Cli: ":"Eng: ",Y.status]})]}),y!=="client_invoices"&&i.jsx("h3",{className:"font-bold mb-1",children:Y.assignedOrder}),y!=="engineer_invoices"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1 uppercase font-bold",children:"Requested Order"}),i.jsx("p",{className:"text-sm text-primary font-medium mb-1",children:Y.requestedOrder})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:Y.id}),i.jsxs("p",{className:"text-xs font-medium text-primary mb-4",children:["Issued: ",Y.issuedMonth?Y.issuedMonth.includes("-")?new Date(parseInt(Y.issuedMonth.split("-")[0]),parseInt(Y.issuedMonth.split("-")[1])-1).toLocaleString("default",{month:"long",year:"numeric"}):Y.issuedMonth:"-"]}),i.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-border",children:[y==="invoices"?i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] text-muted-foreground uppercase font-bold",children:"Engineer"}),i.jsx("p",{className:"font-bold text-sm",children:Y.amount})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] text-emerald-600 uppercase font-bold",children:"Client"}),i.jsx("p",{className:"font-bold text-sm text-emerald-600",children:Y.clientAmount})]})]}):i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:y==="client_invoices"?"Client Amount":"Engineer Amount"}),i.jsx("p",{className:"font-bold text-lg",children:y==="client_invoices"?Y.clientAmount:Y.amount})]}),i.jsxs("div",{className:"text-right",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"Completed Date"}),i.jsx("p",{className:"text-sm font-medium",children:Y.completedDate||"-"})]})]}),i.jsxs("div",{className:"mt-4 flex gap-2",children:[i.jsxs("button",{onClick:()=>Ne(Y),className:"flex-1 py-2 text-xs font-medium rounded-lg border border-border hover:bg-accent transition-colors flex items-center justify-center gap-2",children:[i.jsx(Ps,{size:14}),"Edit"]}),y==="invoices"?i.jsxs("div",{className:"flex-[3] flex gap-2",children:[i.jsx("button",{onClick:()=>Je(Y),className:"flex-1 py-2 text-xs font-medium rounded-lg border border-border hover:bg-accent transition-colors flex items-center justify-center gap-1 text-orange-500",title:"PDF Report",children:i.jsx(Tn,{size:14})}),i.jsx("button",{onClick:()=>ue(Y,!1),className:"flex-1 py-2 text-xs font-medium rounded-lg border border-border hover:bg-accent transition-colors flex items-center justify-center gap-1 text-blue-500",title:"Engineer PDF",children:i.jsx(Nr,{size:14})}),i.jsx("button",{onClick:()=>ue(Y,!0),className:"flex-1 py-2 text-xs font-medium rounded-lg border border-border hover:bg-accent transition-colors flex items-center justify-center gap-1 text-emerald-600",title:"Client PDF",children:i.jsx(Nr,{size:14})})]}):i.jsxs("div",{className:"flex-[3] flex gap-2",children:[i.jsxs("button",{onClick:()=>Je(Y),className:"flex-1 py-2 text-xs font-medium rounded-lg border border-border hover:bg-accent transition-colors flex items-center justify-center gap-1 text-orange-500",children:[i.jsx(Tn,{size:14}),"PDF"]}),i.jsxs("button",{onClick:()=>ue(Y),className:"flex-[2] py-2 text-xs font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2 shadow-sm",children:[i.jsx(Nr,{size:14}),"PDF"]})]})]})]},Y.id))})]}),H&&i.jsx("div",{className:"fixed inset-0 z-[110] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-6 shadow-xl animate-in fade-in zoom-in duration-200 overflow-y-auto max-h-[90vh]",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold text-primary",children:"Commission Invoice Template"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Preview and edit invoice details"})]}),i.jsx("button",{onClick:()=>G(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",id:"close-commission-modal",children:i.jsx(xr,{size:20})})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4 border-b border-border pb-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:"Invoice ID"}),i.jsx("input",{type:"text",value:E.invoiceId,onChange:Y=>re({...E,invoiceId:Y.target.value}),className:"w-full bg-muted/30 border border-border rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-primary/20 outline-none"})]}),i.jsxs("div",{className:"space-y-2 text-right",children:[i.jsx("label",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:"Date"}),i.jsx("input",{type:"date",value:E.date,onChange:Y=>re({...E,date:Y.target.value}),className:"w-full bg-muted/30 border border-border rounded-lg px-3 py-2 text-sm text-right focus:ring-2 focus:ring-primary/20 outline-none"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"text-xs font-bold text-primary uppercase tracking-widest border-l-2 border-primary pl-2 font-mono",children:"From (Our Details)"}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("input",{type:"text",placeholder:"Company Name",value:E.fromName,onChange:Y=>re({...E,fromName:Y.target.value}),className:"w-full border border-border rounded-lg px-3 py-2 text-sm font-bold bg-background focus:ring-2 focus:ring-primary/20 outline-none"}),i.jsx("input",{type:"email",placeholder:"Email",value:E.fromEmail,onChange:Y=>re({...E,fromEmail:Y.target.value}),className:"w-full border border-border rounded-lg px-3 py-2 text-xs bg-background focus:ring-2 focus:ring-primary/20 outline-none"}),i.jsx("textarea",{placeholder:"Address",rows:2,value:E.fromAddress,onChange:Y=>re({...E,fromAddress:Y.target.value}),className:"w-full border border-border rounded-lg px-3 py-2 text-xs bg-background focus:ring-2 focus:ring-primary/20 outline-none"})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"text-xs font-bold text-orange-500 uppercase tracking-widest border-l-2 border-orange-500 pl-2 font-mono",children:"Bill To (Vendor Details)"}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("input",{type:"text",placeholder:"Vendor Name",value:E.billToName,onChange:Y=>re({...E,billToName:Y.target.value}),className:"w-full border border-border rounded-lg px-3 py-2 text-sm font-bold bg-background focus:ring-2 focus:ring-orange-500/20 outline-none"}),i.jsx("input",{type:"email",placeholder:"Email (Optional)",value:E.billToEmail,onChange:Y=>re({...E,billToEmail:Y.target.value}),className:"w-full border border-border rounded-lg px-3 py-2 text-xs bg-background focus:ring-2 focus:ring-orange-500/20 outline-none"}),i.jsx("textarea",{placeholder:"Vendor Address",rows:2,value:E.billToAddress,onChange:Y=>re({...E,billToAddress:Y.target.value}),className:"w-full border border-border rounded-lg px-3 py-2 text-xs bg-background focus:ring-2 focus:ring-orange-500/20 outline-none"})]})]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-muted/20 overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-xs",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-semibold w-1/2",children:"Description"}),i.jsx("th",{className:"px-4 py-3 font-semibold text-right",children:"Amount"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:i.jsxs("tr",{className:"bg-background",children:[i.jsxs("td",{className:"px-4 py-3",children:[i.jsx("input",{type:"text",value:E.description,onChange:Y=>re({...E,description:Y.target.value}),className:"w-full bg-transparent border-none focus:ring-0 p-0 font-medium"}),i.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1",children:["Ref: ",E.projectRef]})]}),i.jsxs("td",{className:"px-4 py-3 text-right font-bold text-sm",children:[E.currency,E.amount.toLocaleString(void 0,{minimumFractionDigits:2})]})]})})]})}),i.jsx("div",{className:"flex justify-end pt-4",children:i.jsx("div",{className:"w-64 space-y-4",children:i.jsxs("div",{className:"flex justify-between text-sm p-3 rounded-lg bg-primary/5 border border-primary/10",children:[i.jsx("span",{className:"text-muted-foreground font-medium",children:"Total Commission"}),i.jsxs("span",{className:"font-bold text-lg text-primary",children:[E.currency,E.amount.toLocaleString(void 0,{minimumFractionDigits:2})]})]})})}),i.jsxs("div",{className:"flex justify-end gap-3 pt-6 border-t border-border",children:[i.jsx("button",{type:"button",onClick:()=>G(!1),className:"rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsxs("button",{onClick:()=>{const Y=new tr;Y.setFillColor(15,23,42),Y.rect(0,0,210,45,"F"),Y.setTextColor(255,255,255),Y.setFontSize(24),Y.text("COMMISSION INVOICE",20,28),Y.setFontSize(10),Y.setTextColor(200,200,200),Y.text(`Invoice ID: ${E.invoiceId}`,20,36),Y.setTextColor(15,23,42),Y.setFontSize(11),Y.setFont("helvetica","bold"),Y.setTextColor(100,116,139),Y.text("FROM:",20,60),Y.text("BILL TO:",110,60),Y.setFontSize(10),Y.setTextColor(15,23,42);let we=68;if(Y.setFont("helvetica","bold"),Y.text(E.fromName,20,we),Y.setFont("helvetica","normal"),we+=5,Y.text(E.fromEmail,20,we),we+=5,E.fromPhone&&(Y.text(E.fromPhone,20,we),we+=5),E.fromAddress){const Oe=Y.splitTextToSize(E.fromAddress,80);Y.text(Oe,20,we)}let J=68;if(Y.setFont("helvetica","bold"),Y.text(E.billToName,110,J),Y.setFont("helvetica","normal"),J+=5,E.billToEmail&&(Y.text(E.billToEmail,110,J),J+=5),E.billToPhone&&(Y.text(E.billToPhone,110,J),J+=5),E.billToAddress){const Oe=Y.splitTextToSize(E.billToAddress,80);Y.text(Oe,110,J)}zd(Y,{head:[["Description","Ref","Amount"]],body:[[E.description,E.projectRef,`${E.currency}${E.amount.toLocaleString()}`]],startY:100,theme:"grid",headStyles:{fillColor:[15,23,42]}});const ve=Y.lastAutoTable.finalY+10;Y.setFontSize(14),Y.setFont("helvetica","bold"),Y.text("TOTAL COMMISSION:",110,ve),Y.text(`${E.currency}${E.amount.toLocaleString()}`,190,ve,{align:"right"}),Y.save(`${E.invoiceId}.pdf`),De.success("Commission Invoice generated"),G(!1)},className:"rounded-lg bg-primary px-6 py-2 text-sm font-bold text-primary-foreground hover:bg-primary/90 transition-colors shadow-lg shadow-primary/20 flex items-center gap-2",children:[i.jsx(Nr,{size:18}),"Download PDF"]})]})]})]})})]})}function Vg({title:e,value:t,icon:r,trend:n,trendType:a,description:s}){return i.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("div",{className:"p-2 rounded-lg bg-accent text-muted-foreground",children:i.jsx(r,{size:18})}),i.jsxs("div",{className:tt("flex items-center gap-1 text-xs font-medium",a==="up"?"text-green-500":a==="down"?"text-red-500":"text-muted-foreground"),children:[a==="up"&&i.jsx(jv,{size:14}),a==="down"&&i.jsx(bv,{size:14}),n]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:e}),i.jsx("p",{className:"text-2xl font-bold",children:t}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s})]})]})}const hAe=["Operations","Technology","Entertainment","Travel","Marketing","Legal","Rent","Utilities","Engineer bills"],MF=["Corporate Card","Direct Debit","Reimbursement","Bank Transfer","Cash"];function mAe(){var qe;const{expenses:e,addExpense:t,updateExpense:r,deleteExpense:n,companySettings:a,currencies:s,addCurrency:o}=ca(),{hasPermission:l}=la(),[u,d]=N.useState(hAe),[f,m]=sf(),[g,x]=N.useState(""),[y,v]=N.useState(!1),[w,j]=N.useState({invoiceId:"",date:"",fromName:"",fromEmail:"",fromPhone:"",fromAddress:"",billToName:"",billToEmail:"",billToPhone:"",billToAddress:"",description:"",amount:0,currency:"$"}),k=me=>{const Ge=`INV-${Math.floor(1e5+Math.random()*9e5)}`;j({invoiceId:Ge,date:new Date().toISOString().split("T")[0],fromName:a.name||"MA IT TECH",fromEmail:a.email||"support@ma-it-tech.com",fromPhone:a.phone||"+971 4 123 4567",fromAddress:a.location||"Dubai, UAE",billToName:"Recipient Name",billToEmail:"",billToPhone:"",billToAddress:"",description:me.description,amount:me.amount,currency:"$"}),v(!0)};N.useEffect(()=>{if(f.get("create")==="true"){T(!0);const Ge=new URLSearchParams(f);Ge.delete("create"),m(Ge,{replace:!0})}},[f,m]);const[A,T]=N.useState(!1),[M,B]=N.useState(null),[L,F]=N.useState(null),[I,q]=N.useState(!1),[P,R]=N.useState(null),[K,ee]=N.useState(!1),[se,Z]=N.useState(!1),[ne,X]=N.useState(!1),[le,Ae]=N.useState(null),[ce,D]=N.useState(0),[H,G]=N.useState([{id:"1",holder:"John Doe",number:"•••• 4242",type:"Visa",limit:5e3,spent:1240.5},{id:"2",holder:"Jane Smith",number:"•••• 8888",type:"Mastercard",limit:3e3,spent:450.2}]),[E,re]=N.useState({holder:"",type:"Visa",limit:1e3}),he=me=>{if(ce<=0){De.error("Limit must be greater than 0");return}G(H.map(Ge=>Ge.id===me?{...Ge,limit:ce}:Ge)),Ae(null),De.success("Card limit updated")},oe=me=>{if(me.preventDefault(),!E.holder){De.error("Card holder name is required");return}const Ge={id:Math.random().toString(36).substr(2,9),holder:E.holder,number:`•••• ${Math.floor(1e3+Math.random()*9e3)}`,type:E.type,limit:E.limit,spent:0};G([...H,Ge]),X(!1),re({holder:"",type:"Visa",limit:1e3}),De.success("New corporate card issued")},[z,fe]=N.useState(!1),[de,W]=N.useState("All"),[ae,_e]=N.useState("All"),[ue,ke]=N.useState("All"),$e=N.useRef(null);N.useEffect(()=>{const me=Ge=>{$e.current&&!$e.current.contains(Ge.target)&&fe(!1)};return document.addEventListener("mousedown",me),()=>document.removeEventListener("mousedown",me)},[]);const[Je,Xe]=N.useState({description:"",category:"Operations",amount:0,date:new Date().toISOString().split("T")[0],status:"Pending",paymentMethod:"Corporate Card"}),Ne=N.useMemo(()=>e.filter(me=>{const Ge=me.description.toLowerCase().includes(g.toLowerCase())||me.category.toLowerCase().includes(g.toLowerCase())||me.id.toLowerCase().includes(g.toLowerCase()),Be=de==="All"||me.category===de,it=ae==="All"||me.status===ae,st=ue==="All"||me.paymentMethod===ue;return Ge&&Be&&it&&st}),[e,g,de,ae,ue]),Ye=N.useMemo(()=>{const me=e.reduce((st,Ve)=>st+Ve.amount,0),Ge=e.filter(st=>st.status==="Pending").reduce((st,Ve)=>st+Ve.amount,0),Be=e.filter(st=>st.status==="Approved").reduce((st,Ve)=>st+Ve.amount,0),it=u.map(st=>({name:st,value:e.filter(Ve=>Ve.category===st).reduce((Ve,te)=>Ve+te.amount,0)})).filter(st=>st.value>0);return{total:me,pending:Ge,approved:Be,categoryData:it}},[e,u]),at=async me=>{if(me.preventDefault(),!K){ee(!0);try{if(M)await r(M.id,Je),De.success("Expense updated successfully");else{const Ge={id:`EXP-${Math.floor(Math.random()*1e4).toString().padStart(3,"0")}`,description:Je.description||"New Expense",category:Je.category||"Operations",amount:Number(Je.amount)||0,date:Je.date||new Date().toISOString().split("T")[0],status:Je.status||"Pending",paymentMethod:Je.paymentMethod||"Corporate Card",reference:Je.reference};await t(Ge),De.success("Expense recorded successfully")}T(!1),B(null),Xe({description:"",category:"Operations",amount:0,date:new Date().toISOString().split("T")[0],status:"Pending",paymentMethod:"Corporate Card"})}catch(Ge){console.error("Save expense error:",Ge)}finally{ee(!1)}}},Y=me=>{B(me),Xe(me),T(!0)},we=me=>{R(me),q(!0)},J=async()=>{if(P&&!K){ee(!0);try{await n(P),De.success("Expense deleted"),q(!1),R(null)}catch(me){console.error("Delete expense error:",me)}finally{ee(!1)}}},ve=()=>{if(Ne.length===0){De.error("No expenses to export");return}const Be=[["ID","Description","Category","Date","Amount","Status","Payment Method","Reference"].join(","),...Ne.map(te=>[`"${te.id}"`,`"${te.description}"`,`"${te.category}"`,`"${te.date}"`,te.amount.toFixed(2),`"${te.status}"`,`"${te.paymentMethod}"`,`"${te.reference||""}"`].join(","))].join(`
`),it=new Blob([Be],{type:"text/csv;charset=utf-8;"}),st=URL.createObjectURL(it),Ve=document.createElement("a");Ve.setAttribute("href",st),Ve.setAttribute("download",`company_expenses_${new Date().toISOString().split("T")[0]}.csv`),Ve.style.visibility="hidden",document.body.appendChild(Ve),Ve.click(),document.body.removeChild(Ve),De.success("Expenses exported successfully")},Oe=me=>{var it;const Ge=(it=me.target.files)==null?void 0:it[0];if(!Ge||K)return;ee(!0);const Be=new FileReader;Be.onload=async st=>{var Ve;try{const Ue=((Ve=st.target)==null?void 0:Ve.result).split(`
`).filter(qt=>qt.trim()!=="");if(Ue.length<2){De.error("Invalid CSV file format");return}const ot=[];for(let qt=1;qt<Ue.length;qt++){const Ft=Ue[qt].match(/(".*?"|[^",\s]+)(?=\s*,|\s*$)/g);if(!Ft||Ft.length<6)continue;const Dt=wr=>wr.replace(/^"|"$/g,"").trim(),Rt={id:Dt(Ft[0]),description:Dt(Ft[1]),category:Dt(Ft[2]),date:Dt(Ft[3]),amount:parseFloat(Dt(Ft[4]))||0,status:Dt(Ft[5]),paymentMethod:Dt(Ft[6])||"Corporate Card",reference:Ft[7]?Dt(Ft[7]):void 0};ot.push(Rt)}if(ot.length===0){De.error("No valid data found in CSV");return}const vt=new Set(e.map(qt=>qt.id)),_t=ot.filter(qt=>!vt.has(qt.id));if(_t.length===0)De.info("All records in CSV already exist in the system");else{for(const qt of _t)await t(qt);De.success(`Successfully imported ${_t.length} new expenses`)}}catch(te){console.error("Import error:",te),De.error("Failed to parse CSV file")}finally{ee(!1),me.target&&(me.target.value="")}},Be.readAsText(Ge)},xe=()=>{if(Ne.length===0){De.error("No expenses to report");return}const me=new tr;me.setFontSize(20),me.text("Company Expense Report",14,22),me.setFontSize(11),me.setTextColor(100),me.text(`Generated on: ${new Date().toLocaleString()}`,14,30),me.setFontSize(12),me.setTextColor(0),me.text(`Total Expenses: $${Ye.total.toLocaleString()}`,14,40),me.text(`Approved: $${Ye.approved.toLocaleString()}`,14,47),me.text(`Pending: $${Ye.pending.toLocaleString()}`,14,54),zd(me,{startY:65,head:[["Description","Category","Date","Amount","Status"]],body:Ne.map(Ge=>[Ge.description,Ge.category,Ge.date,`$${Ge.amount.toFixed(2)}`,Ge.status]),headStyles:{fillColor:[79,70,229]}}),me.save(`expense_report_${new Date().toISOString().split("T")[0]}.pdf`),De.success("PDF Report generated successfully")};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Company Expenses"}),i.jsx("p",{className:"text-muted-foreground",children:"Track and manage all operational expenditures."})]}),l("finance.create")&&i.jsxs("button",{onClick:()=>T(!0),className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors shadow-sm",children:[i.jsx($n,{size:18}),"Record Expense"]})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[i.jsx("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:i.jsx(ds,{size:20})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Expenses"}),i.jsxs("p",{className:"text-2xl font-bold",children:["$",Ye.total.toLocaleString(void 0,{minimumFractionDigits:2})]})]})]})}),i.jsx("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-yellow-500/10 text-yellow-500",children:i.jsx(Ui,{size:20})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Pending Approval"}),i.jsxs("p",{className:"text-2xl font-bold",children:["$",Ye.pending.toLocaleString(void 0,{minimumFractionDigits:2})]})]})]})}),i.jsx("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-green-500/10 text-green-500",children:i.jsx(Hl,{size:20})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Approved This Month"}),i.jsxs("p",{className:"text-2xl font-bold",children:["$",Ye.approved.toLocaleString(void 0,{minimumFractionDigits:2})]})]})]})})]}),i.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[i.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center justify-between",children:[i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search expenses...",value:g,onChange:me=>x(me.target.value),className:"h-10 w-full rounded-lg border border-border bg-background pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"relative",ref:$e,children:[i.jsxs("button",{onClick:()=>fe(!z),className:tt("flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-sm font-medium hover:bg-accent transition-colors",(de!=="All"||ae!=="All"||ue!=="All")&&"border-primary text-primary"),children:[i.jsx(Oc,{size:16}),"Filter",(de!=="All"||ae!=="All"||ue!=="All")&&i.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:[de,ae,ue].filter(me=>me!=="All").length})]}),z&&i.jsxs("div",{className:"absolute right-0 mt-2 z-50 w-64 rounded-xl border border-border bg-card p-4 shadow-lg animate-in fade-in slide-in-from-top-2 duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h4",{className:"font-bold text-sm",children:"Filter Expenses"}),i.jsx("button",{onClick:()=>{W("All"),_e("All"),ke("All")},className:"text-[10px] font-bold uppercase tracking-wider text-primary hover:underline",children:"Reset"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Category"}),i.jsxs("select",{value:de,onChange:me=>W(me.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Categories"}),u.map(me=>i.jsx("option",{value:me,children:me},me))]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Status"}),i.jsxs("select",{value:ae,onChange:me=>_e(me.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Statuses"}),i.jsx("option",{value:"Pending",children:"Pending"}),i.jsx("option",{value:"Approved",children:"Approved"}),i.jsx("option",{value:"Rejected",children:"Rejected"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Payment Method"}),i.jsxs("select",{value:ue,onChange:me=>ke(me.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Methods"}),MF.map(me=>i.jsx("option",{value:me,children:me},me))]})]})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[l("finance.create")&&i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"file",accept:".csv",className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",onChange:Oe}),i.jsxs("button",{className:"flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(co,{size:16}),"Import"]})]}),l("finance.export")&&i.jsxs("button",{onClick:ve,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:16}),"Export"]})]})]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Description"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Category"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Date"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Amount"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),i.jsx("th",{className:"px-4 py-3 font-medium text-right",children:"Action"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:Ne.map(me=>i.jsxs("tr",{className:"hover:bg-accent/30 transition-colors group",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"font-medium",children:me.description}),i.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[me.id," • ",me.paymentMethod]})]})}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:[i.jsx(gte,{size:10}),me.category]})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:me.date}),i.jsxs("td",{className:"px-4 py-4 font-bold",children:["$",me.amount.toLocaleString(void 0,{minimumFractionDigits:2})]}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("span",{className:tt("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium",me.status==="Approved"?"bg-green-500/10 text-green-500":me.status==="Pending"?"bg-yellow-500/10 text-yellow-500":"bg-red-500/10 text-red-500"),children:[me.status==="Approved"?i.jsx(Hl,{size:12}):me.status==="Pending"?i.jsx(Ui,{size:12}):i.jsx(pl,{size:12}),me.status]})}),i.jsx("td",{className:"px-4 py-4 text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsx("button",{onClick:()=>F(me),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground transition-colors",title:"View Details",children:i.jsx(Tn,{size:16})}),l("finance.edit")&&i.jsx("button",{onClick:()=>Y(me),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground transition-colors",title:"Edit",children:i.jsx(Ps,{size:16})}),l("finance.delete")&&i.jsx("button",{onClick:()=>we(me.id),className:"p-1.5 hover:bg-destructive/10 rounded-md text-destructive transition-colors",title:"Delete",children:i.jsx(aa,{size:16})})]})})]},me.id))})]})})})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"text-lg font-bold mb-4",children:"Expense by Category"}),i.jsx("div",{className:"h-[300px]",children:i.jsx(_u,{width:"100%",height:"100%",children:i.jsxs(qA,{children:[i.jsx(pw,{data:Ye.categoryData,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,paddingAngle:5,dataKey:"value",children:Ye.categoryData.map((me,Ge)=>i.jsx(Wd,{fill:`hsl(var(--primary) / ${100-Ge*15}%)`},`cell-${Ge}`))}),i.jsx(Eu,{contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",borderRadius:"8px"},itemStyle:{color:"hsl(var(--foreground))"}})]})})}),i.jsx("div",{className:"mt-4 space-y-2",children:Ye.categoryData.map((me,Ge)=>i.jsxs("div",{className:"flex items-center justify-between text-sm",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-3 w-3 rounded-full",style:{backgroundColor:`hsl(var(--primary) / ${100-Ge*15}%)`}}),i.jsx("span",{className:"text-muted-foreground",children:me.name})]}),i.jsxs("span",{className:"font-medium",children:["$",me.value.toLocaleString()]})]},me.name))})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"text-lg font-bold mb-4",children:"Quick Actions"}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l("finance.export")&&i.jsxs("button",{onClick:xe,className:"flex flex-col items-center justify-center gap-2 p-4 rounded-xl border border-border hover:bg-accent transition-colors",children:[i.jsx(Tn,{className:"text-primary",size:24}),i.jsx("span",{className:"text-xs font-medium",children:"Generate Report"})]}),l("finance.edit")&&i.jsxs("button",{onClick:()=>Z(!0),className:"flex flex-col items-center justify-center gap-2 p-4 rounded-xl border border-border hover:bg-accent transition-colors",children:[i.jsx(Up,{className:"text-primary",size:24}),i.jsx("span",{className:"text-xs font-medium",children:"Manage Cards"})]})]})]})]})]}),A&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-2xl animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:M?"Edit Expense":"Record New Expense"}),i.jsx("button",{onClick:()=>{T(!1),B(null),Xe({description:"",category:"Operations",amount:0,date:new Date().toISOString().split("T")[0],status:"Pending",paymentMethod:"Corporate Card"})},className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:at,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Description *"}),i.jsx("input",{type:"text",placeholder:"e.g. Office Supplies",value:Je.description||"",onChange:me=>Xe({...Je,description:me.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("label",{className:"text-sm font-medium",children:"Category"}),i.jsxs("button",{type:"button",onClick:()=>{const me=prompt("Enter new category name:");if(me&&me.trim()){const Ge=me.trim();u.includes(Ge)?De.error("Category already exists"):(d(Be=>[...Be,Ge]),Xe(Be=>({...Be,category:Ge})))}},className:"text-[10px] font-bold text-primary hover:underline flex items-center gap-1",children:[i.jsx($n,{size:10})," Add New"]})]}),i.jsx("select",{value:Je.category||"Operations",onChange:me=>Xe({...Je,category:me.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:u.map(me=>i.jsx("option",{value:me,children:me},me))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Amount ($) *"}),i.jsx("input",{type:"number",step:"0.01",placeholder:"0.00",value:Je.amount??0,onChange:me=>Xe({...Je,amount:parseFloat(me.target.value)}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Date"}),i.jsx("input",{type:"date",value:Je.date||"",onChange:me=>Xe({...Je,date:me.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Payment Method"}),i.jsx("select",{value:Je.paymentMethod||"Corporate Card",onChange:me=>Xe({...Je,paymentMethod:me.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:MF.map(me=>i.jsx("option",{value:me,children:me},me))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Status"}),i.jsxs("select",{value:Je.status||"Pending",onChange:me=>Xe({...Je,status:me.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"Pending",children:"Pending"}),i.jsx("option",{value:"Approved",children:"Approved"}),i.jsx("option",{value:"Rejected",children:"Rejected"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Reference (Optional)"}),i.jsx("input",{type:"text",placeholder:"e.g. Receipt #123",value:Je.reference||"",onChange:me=>Xe({...Je,reference:me.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"pt-4 flex items-center gap-3",children:[i.jsx("button",{type:"button",onClick:()=>{T(!1),B(null),Xe({description:"",category:"Operations",amount:0,date:new Date().toISOString().split("T")[0],status:"Pending",paymentMethod:"Corporate Card"})},className:"flex-1 px-4 py-2 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",disabled:K,className:"flex-1 bg-primary px-4 py-2 text-sm font-medium text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors shadow-sm disabled:opacity-50 flex items-center justify-center gap-2",children:K?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Saving..."]}):M?"Update Expense":"Save Expense"})]})]})]})}),se&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-lg rounded-xl border border-border bg-card p-6 shadow-2xl animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:i.jsx(Up,{size:20})}),i.jsx("h2",{className:"text-xl font-bold",children:"Manage Corporate Cards"})]}),i.jsx("button",{onClick:()=>Z(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("div",{className:"space-y-4",children:[H.map(me=>i.jsxs("div",{className:"p-4 rounded-xl border border-border bg-muted/30",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-full bg-card flex items-center justify-center border border-border",children:i.jsx(Up,{size:18,className:"text-muted-foreground"})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-bold",children:me.holder}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[me.type," • ",me.number]})]})]}),le===me.id?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"number",value:ce,onChange:Ge=>D(parseFloat(Ge.target.value)),className:"w-20 h-8 rounded border border-border bg-background px-2 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),i.jsx("button",{onClick:()=>he(me.id),className:"text-[10px] font-bold text-primary hover:underline",children:"SAVE"}),i.jsx("button",{onClick:()=>Ae(null),className:"text-[10px] font-bold text-muted-foreground hover:underline",children:"CANCEL"})]}):i.jsx("button",{onClick:()=>{Ae(me.id),D(me.limit)},className:"text-xs font-bold text-primary hover:underline",children:"Edit Limit"})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex justify-between text-xs",children:[i.jsx("span",{className:"text-muted-foreground",children:"Monthly Spend"}),i.jsxs("span",{className:"font-medium",children:["$",me.spent.toLocaleString()," / $",me.limit.toLocaleString()]})]}),i.jsx("div",{className:"h-2 w-full bg-muted rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${me.spent/me.limit*100}%`}})})]})]},me.id)),i.jsxs("button",{onClick:()=>X(!0),className:"w-full py-3 rounded-xl border border-dashed border-border text-muted-foreground text-sm font-medium hover:border-primary hover:text-primary transition-all flex items-center justify-center gap-2",children:[i.jsx($n,{size:16}),"Issue New Card"]})]}),i.jsx("div",{className:"mt-6 pt-6 border-t border-border",children:i.jsx("button",{onClick:()=>Z(!1),className:"w-full px-4 py-2 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Close"})})]})}),ne&&i.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-2xl animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Issue New Card"}),i.jsx("button",{onClick:()=>X(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:oe,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Card Holder Name *"}),i.jsx("input",{type:"text",placeholder:"e.g. Alex Johnson",value:E.holder,onChange:me=>re({...E,holder:me.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Card Type"}),i.jsxs("select",{value:E.type,onChange:me=>re({...E,type:me.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"Visa",children:"Visa"}),i.jsx("option",{value:"Mastercard",children:"Mastercard"}),i.jsx("option",{value:"Amex",children:"Amex"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Credit Limit ($) *"}),i.jsx("input",{type:"number",value:E.limit,onChange:me=>re({...E,limit:parseFloat(me.target.value)}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]})]}),i.jsxs("div",{className:"pt-4 flex items-center gap-3",children:[i.jsx("button",{type:"button",onClick:()=>X(!1),className:"flex-1 px-4 py-2 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",className:"flex-1 bg-primary px-4 py-2 text-sm font-medium text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors shadow-sm",children:"Issue Card"})]})]})]})}),I&&i.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-2xl animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4 text-destructive",children:[i.jsx("div",{className:"p-2 rounded-full bg-destructive/10",children:i.jsx(pl,{size:24})}),i.jsx("h2",{className:"text-xl font-bold",children:"Confirm Deletion"})]}),i.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Are you sure you want to delete this expense record? This action cannot be undone."}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:()=>{q(!1),R(null)},className:"flex-1 px-4 py-2 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{onClick:J,disabled:K,className:"flex-1 bg-destructive px-4 py-2 text-sm font-medium text-destructive-foreground rounded-lg hover:bg-destructive/90 transition-colors shadow-sm disabled:opacity-50 flex items-center justify-center gap-2",children:K?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-destructive-foreground border-t-transparent"}),"Deleting..."]}):"Delete"})]})]})}),L&&i.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card shadow-2xl animate-in fade-in zoom-in duration-200 overflow-hidden",children:[i.jsxs("div",{className:"bg-primary/5 border-b border-border p-6 flex items-center justify-between",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Expense Details"}),i.jsx("button",{onClick:()=>F(null),className:"rounded-full p-2 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("div",{className:"p-6 space-y-6",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"p-3 rounded-xl bg-primary/10 text-primary",children:i.jsx(nx,{size:24})}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-lg",children:L.description}),i.jsx("p",{className:"text-sm text-muted-foreground",children:L.id})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Amount"}),i.jsxs("p",{className:"text-xl font-bold text-primary",children:["$",L.amount.toLocaleString(void 0,{minimumFractionDigits:2})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Status"}),i.jsx("span",{className:tt("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-bold uppercase",L.status==="Approved"?"bg-green-500/10 text-green-500":L.status==="Pending"?"bg-yellow-500/10 text-yellow-500":"bg-red-500/10 text-red-500"),children:L.status})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Category"}),i.jsx("p",{className:"text-sm font-medium",children:L.category})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Date"}),i.jsx("p",{className:"text-sm font-medium",children:L.date})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Payment Method"}),i.jsx("p",{className:"text-sm font-medium",children:L.paymentMethod})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Reference"}),i.jsx("p",{className:"text-sm font-medium",children:L.reference||"N/A"})]})]}),i.jsxs("div",{className:"pt-4 flex flex-col gap-3",children:[i.jsxs("div",{className:"flex gap-3",children:[i.jsxs("button",{onClick:()=>{Y(L),F(null)},className:"flex-1 h-11 flex items-center justify-center gap-2 rounded-xl bg-accent text-sm font-bold hover:bg-accent/80 transition-all shadow-sm",children:[i.jsx(Ps,{size:18}),"Edit Expense"]}),i.jsxs("button",{onClick:()=>{k(L),F(null)},className:"flex-1 h-11 flex items-center justify-center gap-2 rounded-xl bg-primary text-sm font-bold text-primary-foreground hover:bg-primary/90 transition-all shadow-sm",children:[i.jsx(Tn,{size:18}),"Generate Invoice"]})]}),i.jsx("button",{onClick:()=>F(null),className:"w-full h-11 text-sm font-bold border border-border rounded-xl hover:bg-accent transition-all",children:"Close"})]})]})]})}),y&&i.jsx("div",{className:"fixed inset-0 z-[400] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm overflow-y-auto",children:i.jsx("div",{className:"w-full max-w-4xl rounded-xl border border-border bg-card shadow-2xl animate-in fade-in zoom-in duration-200 my-8",children:i.jsxs("div",{className:"p-8 space-y-8",children:[i.jsxs("div",{className:"flex justify-between items-start",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-3xl font-bold text-primary mb-1 tracking-tight",children:"EXPENSE INVOICE"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Invoice ID:"}),i.jsx("input",{type:"text",value:w.invoiceId,onChange:me=>j({...w,invoiceId:me.target.value}),className:"text-xs font-mono bg-muted/50 border border-border rounded px-2 py-0.5 focus:outline-none focus:ring-1 focus:ring-primary/20 w-32"})]})]}),i.jsxs("div",{className:"text-right",children:[i.jsx("div",{className:"flex items-center gap-2 mb-4 justify-end",children:i.jsx("button",{onClick:()=>v(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Date Issued"}),i.jsx("input",{type:"date",value:w.date,onChange:me=>j({...w,date:me.target.value}),className:"text-sm font-medium bg-transparent border-none p-0 focus:ring-0 text-right w-full"})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-12 border-t border-b border-border py-8",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"From"}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("input",{type:"text",value:w.fromName,onChange:me=>j({...w,fromName:me.target.value}),className:"w-full font-bold bg-transparent border-none p-0 focus:ring-0 text-lg",placeholder:"Company Name"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:i.jsx("input",{type:"email",value:w.fromEmail,onChange:me=>j({...w,fromEmail:me.target.value}),className:"w-full bg-transparent border-none p-0 focus:ring-0 text-sm",placeholder:"email@company.com"})}),i.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:i.jsx("input",{type:"text",value:w.fromPhone,onChange:me=>j({...w,fromPhone:me.target.value}),className:"w-full bg-transparent border-none p-0 focus:ring-0 text-sm",placeholder:"Phone Number"})}),i.jsx("textarea",{value:w.fromAddress,onChange:me=>j({...w,fromAddress:me.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground resize-none h-20",placeholder:"Company Address"})]})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Bill To"}),i.jsxs("button",{type:"button",onClick:()=>{const me=prompt("Enter currency code (e.g., JPY):");if(me&&me.trim()){const Ge=prompt("Enter currency symbol (e.g., ¥):")||me.trim();s.find(Be=>Be.code===me.trim().toUpperCase())?De.error("Currency already exists"):(o(me.trim().toUpperCase(),Ge),j(Be=>({...Be,currency:Ge})))}},className:"text-[10px] font-bold text-primary hover:underline flex items-center gap-1",children:[i.jsx($n,{size:10})," +Currency"]})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("input",{type:"text",value:w.billToName,onChange:me=>j({...w,billToName:me.target.value}),className:"w-full font-bold bg-transparent border-none p-0 focus:ring-0 text-lg",placeholder:"Recipient Name"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("input",{type:"email",value:w.billToEmail,onChange:me=>j({...w,billToEmail:me.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground",placeholder:"recipient@email.com"}),i.jsx("input",{type:"text",value:w.billToPhone,onChange:me=>j({...w,billToPhone:me.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground",placeholder:"Recipient Phone"}),i.jsx("textarea",{value:w.billToAddress,onChange:me=>j({...w,billToAddress:me.target.value}),className:"w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-muted-foreground resize-none h-20",placeholder:"Recipient Address"})]})]})]})]}),i.jsx("div",{className:"space-y-4",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"py-3 font-bold uppercase tracking-wider text-muted-foreground text-xs",children:"Description"}),i.jsx("th",{className:"py-3 font-bold uppercase tracking-wider text-muted-foreground text-xs text-right",children:"Amount"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:i.jsxs("tr",{children:[i.jsx("td",{className:"py-4",children:i.jsx("input",{type:"text",value:w.description,onChange:me=>j({...w,description:me.target.value}),className:"w-full bg-transparent border-none p-0 focus:ring-0 font-medium",placeholder:"Expense Description"})}),i.jsx("td",{className:"py-4 text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx("select",{value:((qe=s.find(me=>me.symbol===w.currency))==null?void 0:qe.code)||"",onChange:me=>{const Ge=s.find(Be=>Be.code===me.target.value);Ge&&j({...w,currency:Ge.symbol})},className:"bg-transparent border-none p-0 focus:ring-0 font-bold text-primary appearance-none cursor-pointer text-right min-w-[3rem]",children:s.map(me=>i.jsx("option",{value:me.code,children:me.symbol},me.code))}),i.jsx("input",{type:"number",value:w.amount,onChange:me=>j({...w,amount:parseFloat(me.target.value)}),className:"w-24 text-right bg-transparent border-none p-0 focus:ring-0 font-bold text-primary"})]})})]})})]})}),i.jsx("div",{className:"flex justify-end pt-4",children:i.jsx("div",{className:"w-64 space-y-4",children:i.jsxs("div",{className:"flex justify-between text-sm p-3 rounded-lg bg-primary/5 border border-primary/10",children:[i.jsx("span",{className:"text-muted-foreground font-medium",children:"Total Amount"}),i.jsxs("span",{className:"font-bold text-lg text-primary",children:[w.currency,w.amount.toLocaleString(void 0,{minimumFractionDigits:2})]})]})})}),i.jsxs("div",{className:"flex justify-end gap-3 pt-6 border-t border-border",children:[i.jsx("button",{type:"button",onClick:()=>v(!1),className:"rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsxs("button",{onClick:()=>{const me=new tr;me.setFillColor(15,23,42),me.rect(0,0,210,45,"F"),me.setTextColor(255,255,255),me.setFontSize(24),me.text("EXPENSE INVOICE",20,28),me.setFontSize(10),me.setTextColor(200,200,200),me.text(`Invoice ID: ${w.invoiceId}`,20,36),me.setTextColor(15,23,42),me.setFontSize(11),me.setFont("helvetica","bold"),me.setTextColor(100,116,139),me.text("FROM:",20,60),me.text("BILL TO:",110,60),me.setFontSize(10),me.setTextColor(15,23,42);let Ge=68;if(me.setFont("helvetica","bold"),me.text(w.fromName,20,Ge),me.setFont("helvetica","normal"),Ge+=5,me.text(w.fromEmail,20,Ge),Ge+=5,w.fromPhone&&(me.text(w.fromPhone,20,Ge),Ge+=5),w.fromAddress){const st=me.splitTextToSize(w.fromAddress,80);me.text(st,20,Ge)}let Be=68;if(me.setFont("helvetica","bold"),me.text(w.billToName,110,Be),me.setFont("helvetica","normal"),Be+=5,w.billToEmail&&(me.text(w.billToEmail,110,Be),Be+=5),w.billToPhone&&(me.text(w.billToPhone,110,Be),Be+=5),w.billToAddress){const st=me.splitTextToSize(w.billToAddress,80);me.text(st,110,Be)}zd(me,{head:[["Description","Amount"]],body:[[w.description,`${w.currency}${w.amount.toLocaleString()}`]],startY:100,theme:"grid",headStyles:{fillColor:[15,23,42]}});const it=me.lastAutoTable.finalY+10;me.setFontSize(14),me.setFont("helvetica","bold"),me.text("TOTAL AMOUNT:",110,it),me.text(`${w.currency}${w.amount.toLocaleString()}`,190,it,{align:"right"}),me.save(`${w.invoiceId}.pdf`),De.success("Expense Invoice generated"),v(!1)},className:"rounded-lg bg-primary px-6 py-2 text-sm font-bold text-primary-foreground hover:bg-primary/90 transition-colors shadow-lg shadow-primary/20 flex items-center gap-2",children:[i.jsx(Nr,{size:18}),"Download PDF"]})]})]})})})]})}function pAe(){const{documents:e,addDocument:t,updateDocument:r,deleteDocument:n,folders:a,addFolder:s,deleteFolder:o}=ca(),{profile:l}=la(),[u,d]=N.useState(""),[f,m]=N.useState("all"),[g,x]=N.useState(null),[y,v]=N.useState(!1),[w,j]=N.useState(!1),[k,A]=N.useState(!1),[T,M]=N.useState(!1),[B,L]=N.useState(null),[F,I]=N.useState(null),[q,P]=N.useState(!1),[R,K]=N.useState(""),[ee,se]=N.useState(null),[Z,ne]=N.useState({name:"",type:"PDF",size:"0 KB"}),X=N.useRef(null),le=async de=>{if(de.preventDefault(),!R.trim()){De.error("Please enter a folder name");return}if(!q){P(!0);try{const W=["text-blue-500","text-purple-500","text-green-500","text-red-500","text-orange-500","text-indigo-500"],ae=W[Math.floor(Math.random()*W.length)],ue={id:`FLD-${Math.floor(Math.random()*1e4).toString().padStart(4,"0")}`,name:R.trim(),color:ae};await s(ue),De.success(`Folder "${R}" created`),j(!1),K("")}catch(W){console.error("Create folder error:",W)}finally{P(!1)}}},Ae=e.filter(de=>{const W=de.name.toLowerCase().includes(u.toLowerCase());if(!(g?de.folder===g:!0))return!1;if(f==="starred")return W&&de.isStarred;if(f==="recent"){const _e=new Date().toISOString().split("T")[0];return W&&de.lastModified.startsWith(_e)}return W}),ce=de=>{var ae,_e;const W=(ae=de.target.files)==null?void 0:ae[0];if(W){se(W);const ue=(_e=W.name.split(".").pop())==null?void 0:_e.toUpperCase();let ke="PDF";["JPG","JPEG","PNG","GIF"].includes(ue||"")?ke="IMG":["DOC","DOCX"].includes(ue||"")?ke="DOCX":["XLS","XLSX"].includes(ue||"")?ke="XLSX":["PPT","PPTX"].includes(ue||"")?ke="PPTX":["ZIP","RAR","7Z"].includes(ue||"")?ke="ZIP":["JS","TS","PY","HTML","CSS","TSX"].includes(ue||"")&&(ke="CODE"),ne({...Z,name:W.name.split(".")[0],type:ke,size:`${(W.size/1024).toFixed(1)} KB`})}},D=async de=>{if(de.preventDefault(),!Z.name){De.error("Please enter a document name");return}if(!q){P(!0);try{const ae={id:`DOC-${Math.floor(Math.random()*1e4).toString().padStart(4,"0")}`,name:Z.name,type:Z.type,size:Z.size||"0 KB",lastModified:new Date().toISOString(),owner:(l==null?void 0:l.name)||"Unknown User",isStarred:!1,folder:g||void 0};await t(ae),De.success("Document uploaded successfully"),v(!1),ne({name:"",type:"PDF"}),se(null)}catch(W){console.error("Upload document error:",W)}finally{P(!1)}}},H=de=>{I(de),A(!0)},G=async()=>{if(F&&!q){P(!0);try{await n(F.id),De.success("Document deleted"),A(!1),I(null)}catch(de){console.error("Delete document error:",de)}finally{P(!1)}}},E=de=>{L(de),M(!0)},re=async de=>{if(B&&!q){P(!0);try{await r(B.id,{folder:de||void 0}),De.success(`Moved to ${de||"Root"}`),M(!1),L(null)}catch(W){console.error("Move document error:",W)}finally{P(!1)}}},he=de=>{const W=`
Document Details
---------------
ID: ${de.id}
Name: ${de.name}
Type: ${de.type}
Size: ${de.size}
Owner: ${de.owner}
Last Modified: ${new Date(de.lastModified).toLocaleString()}
Folder: ${de.folder||"Root"}

This is a simulated download of the document metadata.
    `.trim(),ae=new Blob([W],{type:"text/plain"}),_e=URL.createObjectURL(ae),ue=window.document.createElement("a");ue.href=_e,ue.download=`${de.name.replace(/\s+/g,"_")}_info.txt`,window.document.body.appendChild(ue),ue.click(),window.document.body.removeChild(ue),URL.revokeObjectURL(_e),De.success(`Downloading ${de.name}...`)},oe=()=>{const de=["ID","Name","Type","Size","Last Modified","Owner","Folder"],W=e.map($e=>[$e.id,$e.name,$e.type,$e.size,$e.lastModified,$e.owner,$e.folder||"Root"]),ae=[de.join(","),...W.map($e=>$e.map(Je=>`"${Je}"`).join(","))].join(`
`),_e=new Blob([ae],{type:"text/csv;charset=utf-8;"}),ue=URL.createObjectURL(_e),ke=window.document.createElement("a");ke.setAttribute("href",ue),ke.setAttribute("download",`documents_export_${new Date().toISOString().split("T")[0]}.csv`),window.document.body.appendChild(ke),ke.click(),window.document.body.removeChild(ke),URL.revokeObjectURL(ue),De.success("Documents list exported as CSV")},z=async de=>{try{await r(de.id,{isStarred:!de.isStarred}),De.success(de.isStarred?"Removed from starred":"Added to starred")}catch(W){console.error("Toggle star error:",W)}},fe=de=>{switch(de){case"PDF":return i.jsx(Tn,{className:"text-red-500",size:20});case"DOCX":return i.jsx(Tn,{className:"text-blue-500",size:20});case"XLSX":return i.jsx(Tn,{className:"text-green-500",size:20});case"IMG":return i.jsx(mee,{className:"text-purple-500",size:20});case"ZIP":return i.jsx(kk,{className:"text-orange-500",size:20});case"CODE":return i.jsx(fee,{className:"text-gray-500",size:20});default:return i.jsx(d2,{className:"text-muted-foreground",size:20})}};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Document Management"}),i.jsx("p",{className:"text-muted-foreground",children:"Securely store, organize, and share company documents."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:oe,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:18}),"Export List"]}),i.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx($n,{size:18}),"New Folder"]}),i.jsxs("button",{onClick:()=>v(!0),className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[i.jsx(co,{size:18}),"Upload File"]})]})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(jb,{title:"Total Storage",value:"1.2 TB",icon:VP,description:"65% of 2 TB used",progress:65}),i.jsx(jb,{title:"Total Files",value:e.length.toString(),icon:d2,description:"Across all departments"}),i.jsx(jb,{title:"Starred",value:e.filter(de=>de.isStarred).length.toString(),icon:kN,description:"Quick access items",color:"text-yellow-500"}),i.jsx(jb,{title:"Recent Uploads",value:e.filter(de=>de.lastModified.startsWith(new Date().toISOString().split("T")[0])).length.toString(),icon:Ui,description:"In the last 24 hours",color:"text-blue-500"})]}),i.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:a.map(de=>{const W=e.filter(_e=>_e.folder===de.name).length,ae=g===de.name;return i.jsxs("div",{className:tt("group relative flex items-center gap-4 p-4 rounded-xl border transition-all cursor-pointer",ae?"border-primary bg-primary/5 shadow-sm":"border-border bg-card hover:border-primary/50 hover:shadow-md"),onClick:()=>x(ae?null:de.name),children:[i.jsx("div",{className:tt("h-12 w-12 rounded-lg bg-accent flex items-center justify-center",de.color),children:i.jsx(HP,{size:24})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h3",{className:tt("font-semibold text-sm transition-colors",ae?"text-primary":"group-hover:text-primary"),children:de.name}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[W," Files"]})]}),i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx(Io,{size:16,className:tt("transition-colors",ae?"text-primary rotate-90":"text-muted-foreground group-hover:text-primary")}),ae&&i.jsx("button",{disabled:q,onClick:async _e=>{if(_e.stopPropagation(),confirm(`Delete folder "${de.name}"? Files will be moved to root.`)){P(!0);try{await o(de.id),x(null)}catch(ue){console.error("Delete folder error:",ue)}finally{P(!1)}}},className:"p-1 hover:bg-red-500/10 text-red-500 rounded-md transition-colors disabled:opacity-50",children:i.jsx(aa,{size:14})})]})]},de.id)})}),i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center justify-between",children:[i.jsx("div",{className:"flex items-center gap-2",children:["all","recent","starred"].map(de=>i.jsx("button",{onClick:()=>m(de),className:tt("px-4 py-1.5 rounded-full text-sm font-medium transition-all capitalize",f===de?"bg-primary text-primary-foreground shadow-sm":"bg-card border border-border text-muted-foreground hover:bg-accent"),children:de},de))}),i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search documents...",value:u,onChange:de=>d(de.target.value),className:"h-10 w-full rounded-lg border border-border bg-background pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Name"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Type"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Size"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Last Modified"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Owner"}),i.jsx("th",{className:"px-4 py-3 font-medium"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:Ae.length>0?Ae.map(de=>i.jsxs("tr",{className:"hover:bg-accent/30 transition-colors group",children:[i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[fe(de.type),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium group-hover:text-primary transition-colors",children:de.name}),i.jsx("p",{className:"text-xs text-muted-foreground",children:de.id})]}),de.isStarred&&i.jsx(kN,{size:14,className:"text-yellow-500 fill-yellow-500"})]})}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:"inline-flex items-center rounded-full bg-accent px-2 py-0.5 text-xs font-medium text-muted-foreground",children:de.type})}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:de.size}),i.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:new Date(de.lastModified).toLocaleDateString()}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center text-primary text-[10px] font-bold",children:de.owner.split(" ").map(W=>W[0]).join("")}),i.jsx("span",{className:"text-xs",children:de.owner})]})}),i.jsx("td",{className:"px-4 py-4 text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsx("button",{onClick:()=>z(de),className:tt("p-1 hover:bg-accent rounded-md transition-colors",de.isStarred?"text-yellow-500":"text-muted-foreground"),title:de.isStarred?"Unstar":"Star",children:i.jsx(kN,{size:16,fill:de.isStarred?"currentColor":"none"})}),i.jsx("button",{onClick:()=>he(de),className:"p-1 hover:bg-accent rounded-md text-muted-foreground transition-colors",title:"Download",children:i.jsx(Nr,{size:16})}),i.jsx("button",{onClick:()=>E(de),className:"p-1 hover:bg-accent rounded-md text-muted-foreground transition-colors",title:"Move to Folder",children:i.jsx(bee,{size:16})}),i.jsx("button",{onClick:()=>H(de),className:"p-1 hover:bg-accent rounded-md text-muted-foreground hover:text-destructive transition-colors",title:"Delete",children:i.jsx(aa,{size:16})}),i.jsx("button",{onClick:()=>De.info(`Options for ${de.name}`),className:"p-1 hover:bg-accent rounded-md text-muted-foreground transition-colors",children:i.jsx(Ym,{size:18})})]})})]},de.id)):i.jsx("tr",{children:i.jsx("td",{colSpan:6,className:"px-4 py-12 text-center text-muted-foreground",children:i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx(Tn,{size:48,className:"opacity-20"}),i.jsx("p",{children:"No documents found"}),i.jsx("button",{onClick:()=>v(!0),className:"text-sm text-primary hover:underline",children:"Upload your first document"})]})})})})]})})}),i.jsx(on,{children:y&&i.jsxs(i.Fragment,{children:[i.jsx(ar.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>v(!1),className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm"}),i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"fixed left-1/2 top-1/2 z-[51] w-[95vw] max-w-md -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-border bg-card p-6 shadow-2xl",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Upload Document"}),i.jsx("button",{onClick:()=>v(!1),className:"rounded-full p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:D,className:"space-y-4",children:[i.jsxs("div",{onClick:()=>{var de;return(de=X.current)==null?void 0:de.click()},className:"group relative flex flex-col items-center justify-center gap-3 p-8 rounded-xl border-2 border-dashed border-border hover:border-primary hover:bg-primary/5 transition-all cursor-pointer",children:[i.jsx("input",{type:"file",ref:X,onChange:ce,className:"hidden"}),i.jsx("div",{className:"p-3 rounded-full bg-primary/10 text-primary group-hover:scale-110 transition-transform",children:i.jsx(co,{size:24})}),i.jsxs("div",{className:"text-center",children:[i.jsx("p",{className:"text-sm font-medium",children:ee?ee.name:"Click to select or drag and drop"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Maximum file size 50MB"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Document Name"}),i.jsx("input",{type:"text",placeholder:"e.g. Project Proposal",value:Z.name,onChange:de=>ne({...Z,name:de.target.value}),className:"w-full h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"File Type"}),i.jsxs("select",{value:Z.type,onChange:de=>ne({...Z,type:de.target.value}),className:"w-full h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"PDF",children:"PDF Document"}),i.jsx("option",{value:"DOCX",children:"Word Document"}),i.jsx("option",{value:"XLSX",children:"Excel Spreadsheet"}),i.jsx("option",{value:"PPTX",children:"PowerPoint Presentation"}),i.jsx("option",{value:"ZIP",children:"Archive (ZIP)"}),i.jsx("option",{value:"IMG",children:"Image File"}),i.jsx("option",{value:"CODE",children:"Source Code"})]})]}),i.jsxs("div",{className:"pt-4 flex gap-3",children:[i.jsx("button",{type:"button",onClick:()=>v(!1),className:"flex-1 h-10 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",disabled:q,className:"flex-1 h-10 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:q?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Uploading..."]}):"Upload File"})]})]})]})]})}),i.jsx(on,{children:w&&i.jsxs(i.Fragment,{children:[i.jsx(ar.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>j(!1),className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm"}),i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"fixed left-1/2 top-1/2 z-[51] w-[95vw] max-w-md -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-border bg-card p-6 shadow-2xl",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Create New Folder"}),i.jsx("button",{onClick:()=>j(!1),className:"rounded-full p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:le,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Folder Name"}),i.jsx("input",{type:"text",placeholder:"e.g. Marketing Assets",value:R,onChange:de=>K(de.target.value),className:"w-full h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",autoFocus:!0,required:!0})]}),i.jsxs("div",{className:"pt-4 flex gap-3",children:[i.jsx("button",{type:"button",onClick:()=>j(!1),className:"flex-1 h-10 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",disabled:q,className:"flex-1 h-10 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:q?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Creating..."]}):"Create Folder"})]})]})]})]})}),i.jsx(on,{children:k&&i.jsxs(i.Fragment,{children:[i.jsx(ar.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>A(!1),className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm"}),i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"fixed left-1/2 top-1/2 z-[51] w-[95vw] max-w-md -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-border bg-card p-6 shadow-2xl",children:[i.jsxs("div",{className:"flex items-center gap-3 text-destructive mb-4",children:[i.jsx(pl,{size:24}),i.jsx("h2",{className:"text-xl font-bold",children:"Delete Document"})]}),i.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Are you sure you want to delete ",i.jsxs("span",{className:"font-semibold text-foreground",children:['"',F==null?void 0:F.name,'"']}),"? This action cannot be undone."]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx("button",{onClick:()=>A(!1),className:"flex-1 h-10 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{onClick:G,disabled:q,className:"flex-1 h-10 rounded-lg bg-destructive text-destructive-foreground text-sm font-medium hover:bg-destructive/90 transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:q?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-destructive-foreground border-t-transparent"}),"Deleting..."]}):"Delete"})]})]})]})}),i.jsx(on,{children:T&&i.jsxs(i.Fragment,{children:[i.jsx(ar.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>M(!1),className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm"}),i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"fixed left-1/2 top-1/2 z-[51] w-[95vw] max-w-md -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-border bg-card p-6 shadow-2xl",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Move to Folder"}),i.jsx("button",{onClick:()=>M(!1),className:"rounded-full p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("div",{className:"space-y-2 max-h-[400px] overflow-y-auto pr-2",children:[i.jsxs("button",{onClick:()=>re(null),className:"w-full flex items-center gap-3 p-3 rounded-xl border border-border hover:border-primary hover:bg-primary/5 transition-all text-left",children:[i.jsx("div",{className:"h-10 w-10 rounded-lg bg-accent flex items-center justify-center text-muted-foreground",children:i.jsx(VP,{size:20})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-sm",children:"Root Directory"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Main storage area"})]})]}),a.map(de=>i.jsxs("button",{onClick:()=>re(de.name),className:"w-full flex items-center gap-3 p-3 rounded-xl border border-border hover:border-primary hover:bg-primary/5 transition-all text-left",children:[i.jsx("div",{className:tt("h-10 w-10 rounded-lg bg-accent flex items-center justify-center",de.color),children:i.jsx(HP,{size:20})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-sm",children:de.name}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Move item here"})]})]},de.id))]}),i.jsx("div",{className:"mt-6 pt-6 border-t border-border",children:i.jsx("button",{onClick:()=>M(!1),className:"w-full h-10 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"})})]})]})})]})}function jb({title:e,value:t,icon:r,description:n,progress:a,color:s="text-muted-foreground"}){return i.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm",children:[i.jsx("div",{className:"flex items-center justify-between mb-2",children:i.jsx("div",{className:tt("p-2 rounded-lg bg-accent",s),children:i.jsx(r,{size:18})})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:e}),i.jsx("p",{className:"text-2xl font-bold",children:t}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n}),a!==void 0&&i.jsx("div",{className:"mt-3 h-1.5 w-full rounded-full bg-accent overflow-hidden",children:i.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${a}%`}})})]})]})}function xAe(){var ue;const{engineers:e,addEngineer:t,updateEngineer:r,deleteEngineer:n,projects:a,syncEngineersFromProjects:s}=ca(),{hasPermission:o}=la(),l=mo(),[u,d]=sf(),[f,m]=N.useState("");N.useEffect(()=>{if(u.get("create")==="true"){re();const $e=new URLSearchParams(u);$e.delete("create"),d($e,{replace:!0})}},[u,d]);const[g,x]=N.useState(null),[y,v]=N.useState({top:0,left:0}),[w,j]=N.useState(!1),[k,A]=N.useState(!1),[T,M]=N.useState(!1),[B,L]=N.useState(!1),[F,I]=N.useState(null),[q,P]=N.useState(null),[R,K]=N.useState(!1),[ee,se]=N.useState("All"),[Z,ne]=N.useState({name:"",role:"",department:"",email:"",phone:"",status:"Available",experience:"",type:"External",skills:[]}),X=N.useRef(null),le=N.useRef(null),Ae=e.filter(ke=>ke.type==="External"),ce=Ae.length,D=Ae.filter(ke=>ke.status==="Available").length,H=Ae.filter(ke=>ke.status==="Active").length,G=Ae.filter(ke=>ke.status==="Pending Approval").length;N.useEffect(()=>{const ke=$e=>{X.current&&!X.current.contains($e.target)&&x(null),le.current&&!le.current.contains($e.target)&&K(!1)};return document.addEventListener("mousedown",ke),()=>document.removeEventListener("mousedown",ke)},[]);const E=async()=>{if(!(B||k)){L(!0),A(!0);try{const ke=await s();ke>0?De.success(`Synced ${ke} new engineers from projects`):De.info("No new engineers found in projects")}catch{De.error("Failed to sync engineers")}finally{L(!1),A(!1)}}},re=()=>{I(null),ne({name:"",role:"",department:"",email:"",phone:"",status:"Available",experience:"",type:"External",skills:[]}),j(!0)},he=ke=>{I(ke),ne({...ke}),j(!0),x(null)},oe=ke=>{P(ke),M(!0),x(null)},z=ke=>{try{const $e={id:"Engineer ID",name:"Full Name",role:"Role",department:"Department",email:"Email Address",phone:"Phone Number",status:"Status",experience:"Experience",type:"Type",skills:"Skills"},Je=Object.keys($e),Xe=Je.map(J=>$e[J]).join(","),Ne=Je.map(J=>{const ve=ke[J];let Oe="";return Array.isArray(ve)?Oe=ve.join(" | "):ve!=null&&(Oe=String(ve)),Oe.includes(",")||Oe.includes(`
`)||Oe.includes('"')?`"${Oe.replace(/"/g,'""')}"`:Oe}).join(","),Ye=`${Xe}
${Ne}`,at=new Blob([Ye],{type:"text/csv;charset=utf-8;"}),Y=URL.createObjectURL(at),we=document.createElement("a");we.setAttribute("href",Y),we.setAttribute("download",`${ke.name.replace(/\s+/g,"_")}_details.csv`),document.body.appendChild(we),we.click(),document.body.removeChild(we),URL.revokeObjectURL(Y),De.success(`Downloading details for ${ke.name} as CSV`),x(null)}catch($e){console.error("Download Error:",$e),De.error("Failed to download engineer details")}},fe=async ke=>{if(ke.preventDefault(),!k){A(!0);try{if(F)await r(F.id,Z),De.success(Z.type==="Internal"?"Moved to Employees":"Engineer updated successfully"),Z.type==="Internal"&&l("/employees");else{const $e=`ENG-${Math.random().toString(36).substr(2,5).toUpperCase()}`;await t({...Z,id:$e}),De.success(Z.type==="Internal"?"Internal employee added to Employee Directory":"Engineer added successfully"),Z.type==="Internal"&&l("/employees")}j(!1)}catch($e){console.error("[Engineers] Submit error:",$e)}finally{A(!1)}}},de=async ke=>{if(!k){A(!0);try{await n(ke),De.success("Engineer deleted successfully")}catch{De.error("Failed to delete engineer")}finally{A(!1),x(null)}}},W=()=>{if(e.length===0){De.error("No engineers to export");return}const Je=[["ID","Name","Role","Department","Email","Phone","Status","Type","Experience"].join(","),...e.map(at=>[`"${at.id}"`,`"${at.name}"`,`"${at.role}"`,`"${at.department}"`,`"${at.email}"`,`"${at.phone}"`,`"${at.status}"`,`"${at.type}"`,`"${at.experience}"`].join(","))].join(`
`),Xe=new Blob([Je],{type:"text/csv;charset=utf-8;"}),Ne=URL.createObjectURL(Xe),Ye=document.createElement("a");Ye.setAttribute("href",Ne),Ye.setAttribute("download",`engineers_export_${new Date().toISOString().split("T")[0]}.csv`),Ye.style.visibility="hidden",document.body.appendChild(Ye),Ye.click(),document.body.removeChild(Ye),De.success("Engineers exported successfully")},ae=ke=>{var Xe;const $e=(Xe=ke.target.files)==null?void 0:Xe[0];if(!$e||k)return;A(!0);const Je=new FileReader;Je.onload=async Ne=>{var Ye;try{const Y=((Ye=Ne.target)==null?void 0:Ye.result).split(`
`).filter(Oe=>Oe.trim()!=="");if(Y.length<2){De.error("Invalid CSV file format");return}const we=[];for(let Oe=1;Oe<Y.length;Oe++){const xe=Y[Oe].match(/(".*?"|[^",\s]+)(?=\s*,|\s*$)/g);if(!xe||xe.length<7)continue;const qe=Ge=>Ge.replace(/^"|"$/g,"").trim(),me={id:qe(xe[0]),name:qe(xe[1]),role:qe(xe[2]),department:qe(xe[3]),email:qe(xe[4]),phone:qe(xe[5]),status:qe(xe[6]),type:qe(xe[7])||"External",experience:qe(xe[8])||"",skills:[]};we.push(me)}if(we.length===0){De.error("No valid data found in CSV");return}const J=new Set(e.map(Oe=>Oe.id)),ve=we.filter(Oe=>!J.has(Oe.id));if(ve.length===0)De.info("All records in CSV already exist");else{for(const Oe of ve)await t(Oe);De.success(`Successfully imported ${ve.length} new engineers`)}}catch(at){console.error("Import error:",at),De.error("Failed to parse CSV file")}finally{A(!1),ke.target&&(ke.target.value="")}},Je.readAsText($e)},_e=e.filter(ke=>{const $e=ke.name.toLowerCase().includes(f.toLowerCase())||ke.id.toLowerCase().includes(f.toLowerCase())||ke.role.toLowerCase().includes(f.toLowerCase())||ke.email.toLowerCase().includes(f.toLowerCase()),Je=ee==="All"||ke.status===ee,Xe=ke.type==="External";return $e&&Je&&Xe});return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Engineer Database"}),i.jsx("p",{className:"text-muted-foreground",children:"Manage internal and external technical staff resources."})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[o("hr.create")&&i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"file",accept:".csv",className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",onChange:ae}),i.jsxs("button",{className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(co,{size:18}),"Import CSV"]})]}),o("hr.export")&&i.jsxs("button",{onClick:W,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:18}),"Export CSV"]}),o("hr.edit")&&i.jsxs("button",{onClick:E,disabled:B,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors disabled:opacity-50",children:[i.jsx(Vw,{size:18,className:tt(B&&"animate-spin")}),B?"Syncing...":"Sync from Projects"]}),o("hr.create")&&i.jsxs("button",{onClick:re,className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors shadow-sm",children:[i.jsx(Oh,{size:18}),"Add Engineer"]})]})]}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Total External"}),i.jsx(Hn,{className:"text-primary",size:18})]}),i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("h3",{className:"text-2xl font-bold",children:ce}),i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Database total"})]})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Currently Active"}),i.jsx(Ni,{className:"text-blue-500",size:18})]}),i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("h3",{className:"text-2xl font-bold",children:H}),i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"On Projects"})]})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Available Now"}),i.jsx(Fo,{className:"text-green-500",size:18})]}),i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("h3",{className:"text-2xl font-bold",children:D}),i.jsx("span",{className:"text-xs font-medium text-green-500",children:"Ready for projects"})]})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Pending Approval"}),i.jsx(bh,{className:"text-orange-500",size:18})]}),i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("h3",{className:"text-2xl font-bold",children:G}),i.jsx("span",{className:"text-xs font-medium text-orange-500",children:"New hires"})]})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[i.jsxs("div",{className:"relative flex-1 min-w-[300px]",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search engineers by name, ID, role or email...",value:f,onChange:ke=>m(ke.target.value),className:"h-10 w-full rounded-lg border border-border bg-card pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"relative",ref:le,children:[i.jsxs("button",{onClick:()=>K(!R),className:tt("flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium transition-colors hover:bg-accent",ee!=="All"&&"border-primary text-primary"),children:[i.jsx(Oc,{size:18}),"Filters",ee!=="All"&&i.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:[ee].filter(ke=>ke!=="All").length})]}),R&&i.jsxs("div",{className:"absolute right-0 mt-2 z-50 w-64 rounded-xl border border-border bg-card p-4 shadow-lg animate-in fade-in slide-in-from-top-2 duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h4",{className:"font-bold text-sm",children:"Filter Options"}),i.jsx("button",{onClick:()=>{se("All")},className:"text-[10px] font-bold uppercase tracking-wider text-primary hover:underline",children:"Reset"})]}),i.jsx("div",{className:"space-y-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Status"}),i.jsxs("select",{value:ee,onChange:ke=>se(ke.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"All",children:"All Statuses"}),i.jsx("option",{value:"Available",children:"Available"}),i.jsx("option",{value:"Active",children:"Active"}),i.jsx("option",{value:"On Leave",children:"On Leave"}),i.jsx("option",{value:"Pending Approval",children:"Pending Approval"})]})]})})]})]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-card shadow-sm overflow-hidden",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Engineer"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Type"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Contact Info"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Role"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Experience"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Status"}),i.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),i.jsxs("tbody",{className:"divide-y divide-border",children:[_e.map(ke=>i.jsxs("tr",{className:"hover:bg-accent/30 transition-colors group",children:[i.jsx("td",{className:"px-6 py-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold group-hover:bg-primary group-hover:text-primary-foreground transition-colors",children:ke.name.charAt(0)}),i.jsxs("div",{children:[i.jsx("p",{className:"font-bold",children:ke.name}),i.jsx("p",{className:"text-[10px] font-mono text-muted-foreground",children:ke.id})]})]})}),i.jsx("td",{className:"px-6 py-4",children:i.jsxs("span",{className:tt("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-bold uppercase",ke.type==="Internal"?"bg-blue-500/10 text-blue-500":"bg-purple-500/10 text-purple-500"),children:[ke.type==="Internal"?i.jsx(BP,{size:10}):i.jsx(Km,{size:10}),ke.type]})}),i.jsx("td",{className:"px-6 py-4",children:i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(Gl,{size:12,className:"text-primary/70"}),ke.email]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(rx,{size:12,className:"text-primary/70"}),ke.phone]})]})}),i.jsx("td",{className:"px-6 py-4",children:i.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs font-medium",children:[i.jsx(qP,{size:12,className:"text-primary"}),ke.role]})}),i.jsx("td",{className:"px-6 py-4 font-medium",children:ke.experience}),i.jsx("td",{className:"px-6 py-4",children:i.jsx("span",{className:tt("inline-flex items-center rounded-full px-2.5 py-0.5 text-[10px] font-bold uppercase tracking-wider",ke.status==="Available"?"bg-green-500/10 text-green-500":ke.status==="Active"?"bg-blue-500/10 text-blue-500":ke.status==="Pending Approval"?"bg-orange-500/10 text-orange-500":"bg-yellow-500/10 text-yellow-500"),children:ke.status})}),i.jsxs("td",{className:"px-6 py-4 text-right relative",children:[i.jsx("button",{onClick:$e=>{const Je=$e.currentTarget.getBoundingClientRect();v({top:Je.bottom+window.scrollY,left:Je.right+window.scrollX-192}),x(g===ke.id?null:ke.id)},className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(k9,{size:18})}),g===ke.id&&jx.createPortal(i.jsxs("div",{ref:X,style:{position:"absolute",top:y.top,left:y.left,zIndex:9999},className:"w-48 rounded-lg border border-border bg-card p-1 shadow-lg animate-in fade-in zoom-in duration-150",children:[i.jsxs("button",{onClick:()=>oe(ke),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm hover:bg-accent transition-colors",children:[i.jsx(ls,{size:16,className:"text-muted-foreground"}),"View Profile"]}),o("hr.export")&&i.jsxs("button",{onClick:()=>z(ke),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:16,className:"text-muted-foreground"}),"Download Details"]}),ke.status==="Pending Approval"&&o("hr.edit")&&i.jsxs("button",{disabled:k,onClick:async()=>{if(!k){A(!0);try{await r(ke.id,{status:"Available"}),De.success(`${ke.name} approved and marked as Available`),x(null)}catch{De.error("Failed to approve engineer")}finally{A(!1)}}},className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-green-600 hover:bg-green-50 transition-colors disabled:opacity-50",children:[i.jsx(bh,{size:16}),"Approve Hire"]}),o("hr.edit")&&i.jsxs("button",{onClick:()=>he(ke),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm hover:bg-accent transition-colors",children:[i.jsx(Ps,{size:16,className:"text-muted-foreground"}),"Edit Details"]}),i.jsx("div",{className:"my-1 border-t border-border"}),o("hr.delete")&&i.jsxs("button",{onClick:()=>de(ke.id),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-destructive hover:bg-destructive/10 transition-colors",children:[i.jsx(aa,{size:16}),"Delete"]})]}),document.body)]})]},ke.id)),_e.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:7,className:"px-6 py-12 text-center text-muted-foreground italic",children:"No engineers found in the database."})})]})]})})}),w&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("h3",{className:"text-lg font-semibold",children:F?"Edit Engineer":"Add New Engineer"}),i.jsx("button",{onClick:()=>j(!1),className:"rounded-md p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:fe,className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Full Name"}),i.jsx("input",{type:"text",required:!0,placeholder:"e.g. Alex Rivera",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:Z.name||"",onChange:ke=>ne($e=>({...$e,name:ke.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Employment Type"}),i.jsxs("select",{className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50 [&>option]:bg-background [&>option]:text-foreground",value:Z.type||"External",onChange:ke=>ne($e=>({...$e,type:ke.target.value})),children:[i.jsx("option",{value:"External",children:"External (Contractor)"}),i.jsx("option",{value:"Internal",children:"Internal (Staff)"})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Department"}),i.jsx("input",{type:"text",placeholder:"e.g. Backend",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:Z.department||"",onChange:ke=>ne($e=>({...$e,department:ke.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Role"}),i.jsx("input",{type:"text",required:!0,placeholder:"e.g. Senior Engineer",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:Z.role||"",onChange:ke=>ne($e=>({...$e,role:ke.target.value}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Email"}),i.jsx("input",{type:"email",required:!0,placeholder:"alex@company.com",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:Z.email||"",onChange:ke=>ne($e=>({...$e,email:ke.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Phone"}),i.jsx("input",{type:"text",placeholder:"+1 (555) 000-0000",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:Z.phone||"",onChange:ke=>ne($e=>({...$e,phone:ke.target.value}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Experience"}),i.jsx("input",{type:"text",placeholder:"e.g. 5 years",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:Z.experience||"",onChange:ke=>ne($e=>({...$e,experience:ke.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Status"}),i.jsxs("select",{className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:Z.status||"Available",onChange:ke=>ne($e=>({...$e,status:ke.target.value})),children:[i.jsx("option",{value:"Available",children:"Available"}),i.jsx("option",{value:"Active",children:"Active"}),i.jsx("option",{value:"On Leave",children:"On Leave"}),i.jsx("option",{value:"Pending Approval",children:"Pending Approval"})]})]}),i.jsxs("div",{className:"space-y-2 col-span-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Skills (comma separated)"}),i.jsx("input",{type:"text",placeholder:"e.g. React, Node.js, AWS",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50",value:((ue=Z.skills)==null?void 0:ue.join(", "))||"",onChange:ke=>ne($e=>({...$e,skills:ke.target.value.split(",").map(Je=>Je.trim()).filter(Je=>Je!=="")}))})]})]}),i.jsxs("div",{className:"flex gap-3 pt-4",children:[i.jsx("button",{type:"button",onClick:()=>j(!1),className:"flex-1 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",disabled:k,className:tt("flex-1 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",k&&"opacity-50 cursor-not-allowed"),children:k?i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Saving..."]}):F?"Update":"Create"})]})]})]})}),T&&q&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"w-full max-w-2xl rounded-2xl border border-border bg-card shadow-2xl animate-in fade-in zoom-in duration-200 overflow-hidden",children:[i.jsx("div",{className:"relative h-32 bg-gradient-to-r from-primary/20 via-primary/10 to-transparent",children:i.jsx("button",{onClick:()=>M(!1),className:"absolute right-4 top-4 rounded-full bg-background/50 p-2 hover:bg-background transition-colors",children:i.jsx(xr,{size:20})})}),i.jsxs("div",{className:"px-8 pb-8",children:[i.jsxs("div",{className:"relative -mt-12 mb-6 flex items-end gap-6",children:[i.jsx("div",{className:"h-24 w-24 rounded-2xl bg-primary flex items-center justify-center text-primary-foreground text-4xl font-bold shadow-xl border-4 border-card",children:q.name.charAt(0)}),i.jsxs("div",{className:"pb-2",children:[i.jsx("h4",{className:"text-2xl font-bold",children:q.name}),i.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[i.jsx(qP,{size:16,className:"text-primary"}),i.jsx("span",{children:q.role})]})]}),i.jsx("div",{className:"ml-auto pb-2",children:i.jsx("span",{className:tt("inline-flex items-center rounded-full px-3 py-1 text-xs font-bold uppercase tracking-wider",q.status==="Available"?"bg-green-500/10 text-green-500":q.status==="Active"?"bg-blue-500/10 text-blue-500":"bg-yellow-500/10 text-yellow-500"),children:q.status})})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[i.jsxs("div",{className:"space-y-6",children:[i.jsxs("section",{className:"space-y-3",children:[i.jsx("h5",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:"Contact Information"}),i.jsxs("div",{className:"space-y-3 rounded-xl border border-border p-4 bg-muted/20",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-8 w-8 rounded-lg bg-card flex items-center justify-center border border-border",children:i.jsx(Gl,{size:14,className:"text-primary"})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] text-muted-foreground uppercase font-bold",children:"Email"}),i.jsx("p",{className:"text-sm font-medium",children:q.email})]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-8 w-8 rounded-lg bg-card flex items-center justify-center border border-border",children:i.jsx(rx,{size:14,className:"text-primary"})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] text-muted-foreground uppercase font-bold",children:"Phone"}),i.jsx("p",{className:"text-sm font-medium",children:q.phone})]})]})]})]}),i.jsxs("section",{className:"space-y-3",children:[i.jsx("h5",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:"System Info"}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"rounded-xl border border-border p-4 bg-muted/20",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground uppercase font-bold",children:"Engineer ID"}),i.jsx("p",{className:"font-mono text-xs",children:q.id})]}),i.jsxs("div",{className:"rounded-xl border border-border p-4 bg-muted/20",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground uppercase font-bold",children:"Type"}),i.jsx("p",{className:"text-xs font-medium",children:q.type})]})]})]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("section",{className:"space-y-3",children:[i.jsx("h5",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:"Technical Profile"}),i.jsxs("div",{className:"space-y-4 rounded-xl border border-border p-6 bg-primary/5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ni,{size:16,className:"text-primary"}),i.jsx("span",{className:"text-sm font-medium",children:"Experience"})]}),i.jsx("span",{className:"text-lg font-bold text-primary",children:q.experience})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(BP,{size:16,className:"text-primary"}),i.jsx("span",{className:"text-sm font-medium",children:"Department"})]}),i.jsx("span",{className:"text-lg font-bold text-primary",children:q.department||"N/A"})]})]})]}),i.jsx("div",{className:"flex gap-3",children:i.jsxs("button",{onClick:()=>l(`/projects?search=${encodeURIComponent(q.name)}`),className:"flex-1 flex items-center justify-center gap-2 rounded-xl bg-primary px-4 py-3 text-sm font-bold text-primary-foreground hover:bg-primary/90 transition-all shadow-lg shadow-primary/20",children:[i.jsx(C9,{size:16}),"View Projects"]})}),i.jsxs("section",{className:"space-y-3",children:[i.jsx("h5",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:"Skills & Expertise"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:q.skills&&q.skills.length>0?q.skills.map((ke,$e)=>i.jsx("span",{className:"px-2 py-1 rounded-md bg-primary/10 text-primary text-[10px] font-bold uppercase tracking-wider",children:ke},$e)):i.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No skills listed"})})]}),i.jsxs("section",{className:"space-y-3",children:[i.jsx("h5",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:"Assigned Projects"}),i.jsx("div",{className:"space-y-2",children:a.filter(ke=>ke.assignedTo===q.name).length>0?a.filter(ke=>ke.assignedTo===q.name).map(ke=>i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl border border-border bg-card hover:border-primary/50 transition-all group",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-bold group-hover:text-primary transition-colors",children:ke.name}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:ke.client})]}),i.jsx("span",{className:tt("px-1.5 py-0.5 rounded text-[10px] font-bold uppercase tracking-wider",ke.status==="In Progress"?"bg-blue-500/10 text-blue-500":ke.status==="Completed"?"bg-green-500/10 text-green-500":"bg-yellow-500/10 text-yellow-500"),children:ke.status})]},ke.id)):i.jsx("div",{className:"p-4 rounded-xl border border-dashed border-border text-center text-xs text-muted-foreground",children:"No active project assignments"})})]})]})]})]})]})})]})}function gAe(){const e=mo(),{projects:t,clients:r,engineers:n,tasks:a,expenses:s,addProject:o,updateProject:l,addClient:u,updateClient:d,addTask:f,updateTask:m,addExpense:g,deleteProject:x,deleteClient:y,deleteTask:v,deleteExpense:w,currencies:j}=ca(),[k,A]=N.useState("leads"),[T,M]=N.useState(""),[B,L]=N.useState(!1),[F,I]=N.useState(!1),[q,P]=N.useState(!1),[R,K]=N.useState(!1),[ee,se]=N.useState(!1),[Z,ne]=N.useState(!1),[X,le]=N.useState(!1),[Ae,ce]=N.useState(!1),[D,H]=N.useState(!1),[G,E]=N.useState(!1),[re,he]=N.useState(null),[oe,z]=N.useState(null),[fe,de]=N.useState({name:"",client:"",value:"",currency:"USD",deadline:new Date(Date.now()+720*60*60*1e3).toISOString().split("T")[0],status:"Planning",assignedTo:"Unassigned"}),[W,ae]=N.useState({name:"",industry:"",contactPerson:"",email:"",phone:"",website:""}),[_e,ue]=N.useState({name:"",client:"",budget:"",deadline:new Date(Date.now()+1440*60*60*1e3).toISOString().split("T")[0]}),[ke,$e]=N.useState({title:"",projectId:"",assignee:"",dueDate:new Date(Date.now()+10080*60*1e3).toISOString().split("T")[0]}),[Je,Xe]=N.useState({description:"",category:"Operations",amount:"",date:new Date().toISOString().split("T")[0],status:"Pending",paymentMethod:"Corporate Card"}),[Ne,Ye]=N.useState({projectId:""}),[at,Y]=N.useState(!1),we=N.useMemo(()=>{const xe=t.filter(it=>it.status==="Planning"||it.status==="Pending").length,qe=t.filter(it=>it.status==="Active"||it.status==="In Progress"||it.status==="Work In Progress").length,me=t.reduce((it,st)=>it+(st.clientTotalAmount||0),0),Ge=s.filter(it=>it.status==="Approved").reduce((it,st)=>it+st.amount,0),Be=me-Ge;return{totalLeads:xe,activeProjects:qe,totalRevenue:me,totalExpenses:Ge,profit:Be}},[t,s]),J=()=>{try{const xe=["Category","ID","Name/Title","Client/Project","Status","Amount/Value","Date/Deadline"],qe=[];qe.push(["SUMMARY","","Total Revenue","","",`$${we.totalRevenue}`,""]),qe.push(["SUMMARY","","Total Expenses","","",`$${we.totalExpenses}`,""]),qe.push(["SUMMARY","","Net Profit","","",`$${we.profit}`,""]),qe.push(["","","","","","",""]),t.forEach(st=>{qe.push(["PROJECT",st.id,st.name,st.client,st.status,`$${st.clientTotalAmount||0}`,st.deadline])}),qe.push(["","","","","","",""]),r.forEach(st=>{qe.push(["CLIENT",st.id,st.name,"",st.status,`$${st.revenue}`,""])}),qe.push(["","","","","","",""]),a.forEach(st=>{qe.push(["TASK",st.id,st.title,st.project,st.status,"",st.dueDate])}),qe.push(["","","","","","",""]),s.forEach(st=>{qe.push(["EXPENSE",st.id,st.description,st.category,st.status,`$${st.amount}`,st.date])});const me=[xe.join(","),...qe.map(st=>st.map(Ve=>`"${Ve}"`).join(","))].join(`
`),Ge=new Blob([me],{type:"text/csv;charset=utf-8;"}),Be=document.createElement("a"),it=URL.createObjectURL(Ge);Be.setAttribute("href",it),Be.setAttribute("download",`operations_full_report_${new Date().toISOString().split("T")[0]}.csv`),Be.style.visibility="hidden",document.body.appendChild(Be),Be.click(),document.body.removeChild(Be),De.success("Report downloaded successfully")}catch(xe){De.error("Failed to generate report"),console.error(xe)}},ve=N.useMemo(()=>[{id:"leads",label:"Lead",icon:xh,value:t.filter(xe=>xe.status==="Planning"||xe.status==="Pending").length,color:"text-blue-500",bg:"bg-blue-500/10"},{id:"clients",label:"Client",icon:Hn,value:r.length,color:"text-purple-500",bg:"bg-purple-500/10"},{id:"projects",label:"Project",icon:Ni,value:t.filter(xe=>xe.status==="Active"||xe.status==="In Progress"||xe.status==="Work In Progress").length,color:"text-orange-500",bg:"bg-orange-500/10"},{id:"tasks",label:"Tasks",icon:Ec,value:a.length,color:"text-green-500",bg:"bg-green-500/10"},{id:"timesheets",label:"Timesheets",icon:Ui,value:a.filter(xe=>xe.status==="Completed").length,color:"text-cyan-500",bg:"bg-cyan-500/10"},{id:"invoices",label:"Invoice (+Tax)",icon:Tn,value:t.filter(xe=>xe.clientInvoiceStatus).length,color:"text-yellow-500",bg:"bg-yellow-500/10"},{id:"payments",label:"Payment",icon:Up,value:t.filter(xe=>xe.clientInvoiceStatus==="Paid").length,color:"text-emerald-500",bg:"bg-emerald-500/10"},{id:"expenses",label:"Expenses",icon:nx,value:s.filter(xe=>xe.status==="Approved").length,color:"text-red-500",bg:"bg-red-500/10"},{id:"profit",label:"Profit",icon:Fo,value:`$${we.profit.toLocaleString()}`,color:"text-indigo-500",bg:"bg-indigo-500/10"}],[t,r,a,s,we.profit]),Oe=[{id:"leads",label:"Sales & Leads",icon:xh,color:"text-blue-500",bg:"bg-blue-500/10"},{id:"clients",label:"Clients",icon:Hn,color:"text-purple-500",bg:"bg-purple-500/10"},{id:"projects",label:"Projects",icon:Ni,color:"text-orange-500",bg:"bg-orange-500/10"},{id:"execution",label:"Execution",icon:Ec,color:"text-green-500",bg:"bg-green-500/10"},{id:"finance",label:"Finance",icon:ds,color:"text-emerald-500",bg:"bg-emerald-500/10"}];return i.jsxs("div",{className:"space-y-6 pb-12",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Operations Control Center"}),i.jsx("p",{className:"text-muted-foreground",children:"Manage the entire business lifecycle from lead to profit."})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"flex flex-col items-end",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Total Profit"}),i.jsxs("span",{className:tt("text-xl font-bold",we.profit>=0?"text-green-500":"text-red-500"),children:["$",we.profit.toLocaleString()]})]}),i.jsx("div",{className:"h-10 w-px bg-border mx-2"}),i.jsxs("button",{onClick:()=>le(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors shadow-sm",children:[i.jsx(u2,{size:18}),"Full Report"]})]})]}),i.jsxs("div",{className:"rounded-2xl border border-border bg-card p-6 shadow-sm overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("h2",{className:"text-lg font-bold flex items-center gap-2",children:[i.jsx(Fo,{className:"text-primary",size:20}),"Business Lifecycle Workflow"]}),i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground bg-muted px-2 py-0.5 rounded",children:"Real-time Pipeline"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"absolute top-1/2 left-0 right-0 h-0.5 bg-muted -translate-y-1/2 hidden lg:block"}),i.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-9 gap-4 relative z-10",children:ve.map((xe,qe)=>{const me=xe.icon;return i.jsxs(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:qe*.05},className:"flex flex-col items-center group",children:[i.jsx("div",{className:tt("w-12 h-12 rounded-full flex items-center justify-center mb-3 transition-all duration-300 group-hover:scale-110 shadow-sm",xe.bg,xe.color),children:i.jsx(me,{size:20})}),i.jsxs("div",{className:"text-center",children:[i.jsx("p",{className:"text-[10px] font-bold uppercase tracking-tighter text-muted-foreground mb-0.5",children:xe.label}),i.jsx("p",{className:"text-sm font-bold",children:xe.value})]}),qe<ve.length-1&&i.jsx("div",{className:"lg:hidden flex justify-center my-2 text-muted-foreground/30",children:i.jsx(Io,{size:16,className:"rotate-90"})})]},xe.id)})})]})]}),i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 p-1 bg-muted/30 rounded-xl border border-border",children:Oe.map(xe=>{const qe=xe.icon,me=k===xe.id;return i.jsxs("button",{onClick:()=>A(xe.id),className:tt("flex flex-col items-center gap-1 py-3 px-2 rounded-lg transition-all relative overflow-hidden",me?"bg-card shadow-sm text-primary":"text-muted-foreground hover:bg-muted/50"),children:[i.jsx("div",{className:tt("p-2 rounded-lg mb-1",me?xe.bg:"bg-transparent"),children:i.jsx(qe,{size:20,className:me?xe.color:"text-muted-foreground"})}),i.jsx("span",{className:"text-xs font-bold uppercase tracking-tighter",children:xe.label}),me&&i.jsx(ar.div,{layoutId:"activeStep",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]},xe.id)})}),i.jsx("div",{className:"min-h-[600px]",children:i.jsx(on,{mode:"wait",children:i.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[k==="leads"&&i.jsx(vAe,{onAddLead:()=>L(!0)}),k==="clients"&&i.jsx(yAe,{onAddClient:()=>I(!0),onViewDetails:xe=>{he(xe),ce(!0)},onEditClient:xe=>{he(xe),ae({name:xe.name,industry:xe.industry,contactPerson:xe.contactPerson,email:xe.email,phone:xe.phone,website:xe.website||""}),H(!0)},onDeleteClient:xe=>{z(xe),E(!0)}}),k==="projects"&&i.jsx(bAe,{onAddProject:()=>P(!0)}),k==="execution"&&i.jsx(wAe,{onAddTask:()=>K(!0)}),k==="finance"&&i.jsx(jAe,{onAddExpense:()=>se(!0),onGenerateInvoice:()=>ne(!0)})]},k)})}),B&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Add New Lead"}),i.jsx("button",{onClick:()=>L(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:async xe=>{if(xe.preventDefault(),!at){Y(!0);try{const qe={id:`LEAD-${Math.random().toString(36).substr(2,5).toUpperCase()}`,name:fe.name,client:fe.client,status:fe.status,team:0,deadline:fe.deadline,currency:fe.currency,clientTotalAmount:parseFloat(fe.value)||0,assignedTo:fe.assignedTo};await o(qe),De.success("Lead added to pipeline"),L(!1),de({name:"",client:"",value:"",currency:"USD",deadline:new Date(Date.now()+720*60*60*1e3).toISOString().split("T")[0],status:"Planning",assignedTo:"Unassigned"})}catch{De.error("Failed to add lead")}finally{Y(!1)}}},className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Deal Name"}),i.jsx("input",{required:!0,type:"text",value:fe.name||"",onChange:xe=>de({...fe,name:xe.target.value}),placeholder:"e.g. Website Redesign",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Company"}),i.jsx("input",{required:!0,type:"text",value:fe.client||"",onChange:xe=>de({...fe,client:xe.target.value}),placeholder:"e.g. Acme Corp",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Deal Value"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("select",{value:fe.currency||"USD",onChange:xe=>de({...fe,currency:xe.target.value}),className:"w-20 rounded-lg border border-border bg-background px-2 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:j.map(xe=>i.jsx("option",{value:xe.code,children:xe.code},xe.code))}),i.jsx("input",{required:!0,type:"number",value:fe.value||"",onChange:xe=>de({...fe,value:xe.target.value}),placeholder:"5000",className:"flex-1 rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Stage"}),i.jsxs("select",{value:fe.status,onChange:xe=>de({...fe,status:xe.target.value}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{value:"Planning",children:"Lead"}),i.jsx("option",{value:"Pending",children:"Qualified"}),i.jsx("option",{value:"In Progress",children:"Proposal"}),i.jsx("option",{value:"Active",children:"Negotiation"})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Expected Close"}),i.jsx("input",{required:!0,type:"date",value:fe.deadline||"",onChange:xe=>de({...fe,deadline:xe.target.value}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Owner"}),i.jsx("input",{type:"text",value:fe.assignedTo||"",onChange:xe=>de({...fe,assignedTo:xe.target.value}),placeholder:"Owner name",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[i.jsx("button",{type:"button",onClick:()=>L(!1),className:"rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsxs("button",{type:"submit",disabled:at,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50 flex items-center gap-2",children:[at&&i.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Save Lead"]})]})]})]})}),F&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Add New Client"}),i.jsx("button",{onClick:()=>I(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:async xe=>{if(xe.preventDefault(),!at){Y(!0);try{const qe={id:`CL-${Math.random().toString(36).substr(2,5).toUpperCase()}`,name:W.name,industry:W.industry||"Technology",contactPerson:W.contactPerson,email:W.email,phone:W.phone,status:"Active",projects:0,revenue:0,website:W.website};await u(qe),De.success("Client added successfully"),I(!1),ae({name:"",industry:"",contactPerson:"",email:"",phone:"",website:""})}catch{De.error("Failed to add client")}finally{Y(!1)}}},className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Company Name"}),i.jsx("input",{required:!0,type:"text",value:W.name||"",onChange:xe=>ae({...W,name:xe.target.value}),placeholder:"e.g. Acme Corp",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Industry"}),i.jsx("input",{type:"text",value:W.industry||"",onChange:xe=>ae({...W,industry:xe.target.value}),placeholder:"e.g. Software",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Contact Person"}),i.jsx("input",{required:!0,type:"text",value:W.contactPerson||"",onChange:xe=>ae({...W,contactPerson:xe.target.value}),placeholder:"e.g. Jane Smith",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Email"}),i.jsx("input",{required:!0,type:"email",value:W.email||"",onChange:xe=>ae({...W,email:xe.target.value}),placeholder:"jane@acme.com",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Phone"}),i.jsx("input",{type:"text",value:W.phone||"",onChange:xe=>ae({...W,phone:xe.target.value}),placeholder:"+1 (555) 000-0000",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Website"}),i.jsx("input",{type:"url",value:W.website||"",onChange:xe=>ae({...W,website:xe.target.value}),placeholder:"https://acme.com",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[i.jsx("button",{type:"button",onClick:()=>I(!1),className:"rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsxs("button",{type:"submit",disabled:at,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50 flex items-center gap-2",children:[at&&i.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Save Client"]})]})]})]})}),q&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Create New Project"}),i.jsx("button",{onClick:()=>P(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:async xe=>{if(xe.preventDefault(),!at){Y(!0);try{const qe={id:`PRJ-${Math.random().toString(36).substr(2,5).toUpperCase()}`,name:_e.name,client:_e.client,status:"Active",team:0,deadline:_e.deadline,clientTotalAmount:parseFloat(_e.budget)||0,issueDate:new Date().toISOString().split("T")[0],issuedMonth:new Date().toISOString().substring(0,7)};await o(qe),De.success("Project created successfully"),P(!1),ue({name:"",client:"",budget:"",deadline:new Date(Date.now()+1440*60*60*1e3).toISOString().split("T")[0]})}catch{De.error("Failed to create project")}finally{Y(!1)}}},className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Project Name"}),i.jsx("input",{required:!0,type:"text",value:_e.name||"",onChange:xe=>ue({..._e,name:xe.target.value}),placeholder:"e.g. Website Redesign",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Client"}),i.jsxs("select",{required:!0,value:_e.client||"",onChange:xe=>ue({..._e,client:xe.target.value}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"",children:"Select a client"}),r.map(xe=>i.jsx("option",{value:xe.name,children:xe.name},xe.id))]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Budget ($)"}),i.jsx("input",{required:!0,type:"number",value:_e.budget||"",onChange:xe=>ue({..._e,budget:xe.target.value}),placeholder:"5000",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Deadline"}),i.jsx("input",{required:!0,type:"date",value:_e.deadline||"",onChange:xe=>ue({..._e,deadline:xe.target.value}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[i.jsx("button",{type:"button",onClick:()=>P(!1),className:"rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsxs("button",{type:"submit",disabled:at,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50 flex items-center gap-2",children:[at&&i.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Create Project"]})]})]})]})}),R&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Add New Task"}),i.jsx("button",{onClick:()=>K(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:async xe=>{if(xe.preventDefault(),!at){Y(!0);try{const qe=t.find(Ge=>Ge.id===ke.projectId),me={id:`TSK-${Math.random().toString(36).substr(2,5).toUpperCase()}`,title:ke.title,project:(qe==null?void 0:qe.name)||"Unknown Project",projectId:ke.projectId,assignDate:new Date().toISOString().split("T")[0],status:"To Do",dueDate:ke.dueDate,assignee:ke.assignee};await f(me),De.success("Task added successfully"),K(!1),$e({title:"",projectId:"",assignee:"",dueDate:new Date(Date.now()+10080*60*1e3).toISOString().split("T")[0]})}catch{De.error("Failed to add task")}finally{Y(!1)}}},className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Task Title"}),i.jsx("input",{required:!0,type:"text",value:ke.title||"",onChange:xe=>$e({...ke,title:xe.target.value}),placeholder:"e.g. Design Homepage",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Project"}),i.jsxs("select",{required:!0,value:ke.projectId||"",onChange:xe=>$e({...ke,projectId:xe.target.value}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"",children:"Select a project"}),t.filter(xe=>xe.status==="Active"||xe.status==="In Progress").map(xe=>i.jsx("option",{value:xe.id,children:xe.name},xe.id))]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Assignee"}),i.jsxs("select",{required:!0,value:ke.assignee||"",onChange:xe=>$e({...ke,assignee:xe.target.value}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"",children:"Select engineer"}),n.map(xe=>i.jsx("option",{value:xe.name,children:xe.name},xe.id))]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Due Date"}),i.jsx("input",{required:!0,type:"date",value:ke.dueDate||"",onChange:xe=>$e({...ke,dueDate:xe.target.value}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[i.jsx("button",{type:"button",onClick:()=>K(!1),className:"rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsxs("button",{type:"submit",disabled:at,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50 flex items-center gap-2",children:[at&&i.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Save Task"]})]})]})]})}),ee&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Record New Expense"}),i.jsx("button",{onClick:()=>se(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:async xe=>{if(xe.preventDefault(),!at){Y(!0);try{const qe={id:`EXP-${Math.floor(Math.random()*1e4).toString().padStart(3,"0")}`,description:Je.description,category:Je.category,amount:parseFloat(Je.amount)||0,date:Je.date,status:Je.status,paymentMethod:Je.paymentMethod};await g(qe),De.success("Expense recorded successfully"),se(!1),Xe({description:"",category:"Operations",amount:"",date:new Date().toISOString().split("T")[0],status:"Pending",paymentMethod:"Corporate Card"})}catch{De.error("Failed to record expense")}finally{Y(!1)}}},className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Description"}),i.jsx("input",{required:!0,type:"text",value:Je.description,onChange:xe=>Xe({...Je,description:xe.target.value}),placeholder:"e.g. Office Supplies",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Category"}),i.jsxs("select",{value:Je.category,onChange:xe=>Xe({...Je,category:xe.target.value}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"Operations",children:"Operations"}),i.jsx("option",{value:"Technology",children:"Technology"}),i.jsx("option",{value:"Travel",children:"Travel"}),i.jsx("option",{value:"Marketing",children:"Marketing"}),i.jsx("option",{value:"Engineer bills",children:"Engineer bills"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Amount ($)"}),i.jsx("input",{required:!0,type:"number",step:"0.01",value:Je.amount,onChange:xe=>Xe({...Je,amount:xe.target.value}),placeholder:"0.00",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Date"}),i.jsx("input",{type:"date",value:Je.date,onChange:xe=>Xe({...Je,date:xe.target.value}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Payment Method"}),i.jsxs("select",{value:Je.paymentMethod,onChange:xe=>Xe({...Je,paymentMethod:xe.target.value}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"Corporate Card",children:"Corporate Card"}),i.jsx("option",{value:"Bank Transfer",children:"Bank Transfer"}),i.jsx("option",{value:"Cash",children:"Cash"})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[i.jsx("button",{type:"button",onClick:()=>se(!1),className:"rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsxs("button",{type:"submit",disabled:at,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50 flex items-center gap-2",children:[at&&i.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}),"Save Expense"]})]})]})]})}),Z&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Generate Invoice"}),i.jsx("button",{onClick:()=>ne(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:async xe=>{xe.preventDefault();try{const qe=t.find(me=>me.id===Ne.projectId);qe&&(await l(qe.id,{clientInvoiceStatus:"Unpaid",issueDate:new Date().toISOString().split("T")[0]}),De.success(`Invoice generated for ${qe.client}`),ne(!1),Ye({projectId:""}))}catch{De.error("Failed to generate invoice")}},className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Select Project to Invoice"}),i.jsxs("select",{required:!0,value:Ne.projectId,onChange:xe=>Ye({...Ne,projectId:xe.target.value}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{value:"",children:"Select a project"}),t.filter(xe=>!xe.clientInvoiceStatus&&(xe.status==="Active"||xe.status==="Completed")).map(xe=>i.jsxs("option",{value:xe.id,children:[xe.client," - ",xe.name]},xe.id))]})]}),i.jsx("div",{className:"p-4 rounded-lg bg-muted/30 border border-border",children:i.jsx("p",{className:"text-xs text-muted-foreground",children:`Generating an invoice will mark the project as "Unpaid" and set today's date as the issue date.`})}),i.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[i.jsx("button",{type:"button",onClick:()=>ne(!1),className:"rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:"Generate Invoice"})]})]})]})}),D&&re&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:"Edit Client"}),i.jsx("button",{onClick:()=>H(!1),className:"rounded-md p-1 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:async xe=>{xe.preventDefault();try{await d(re.id,W),De.success("Client updated successfully"),H(!1)}catch{De.error("Failed to update client")}},className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Company Name"}),i.jsx("input",{required:!0,type:"text",value:W.name||"",onChange:xe=>ae({...W,name:xe.target.value}),placeholder:"e.g. Acme Corp",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Industry"}),i.jsx("input",{type:"text",value:W.industry||"",onChange:xe=>ae({...W,industry:xe.target.value}),placeholder:"e.g. Software",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Contact Person"}),i.jsx("input",{required:!0,type:"text",value:W.contactPerson||"",onChange:xe=>ae({...W,contactPerson:xe.target.value}),placeholder:"e.g. Jane Smith",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Email"}),i.jsx("input",{required:!0,type:"email",value:W.email||"",onChange:xe=>ae({...W,email:xe.target.value}),placeholder:"jane@acme.com",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Phone"}),i.jsx("input",{type:"text",value:W.phone||"",onChange:xe=>ae({...W,phone:xe.target.value}),placeholder:"+1 (555) 000-0000",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Website"}),i.jsx("input",{type:"url",value:W.website||"",onChange:xe=>ae({...W,website:xe.target.value}),placeholder:"https://acme.com",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[i.jsx("button",{type:"button",onClick:()=>H(!1),className:"rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:"Update Client"})]})]})]})}),G&&oe&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-lg animate-in fade-in zoom-in duration-200",children:[i.jsxs("div",{className:"flex items-center gap-3 text-red-500 mb-4",children:[i.jsx(pl,{size:24}),i.jsx("h2",{className:"text-xl font-bold",children:"Delete Client"})]}),i.jsxs("p",{className:"text-muted-foreground mb-6",children:["Are you sure you want to delete ",i.jsx("span",{className:"font-bold text-foreground",children:oe.name}),"? This action cannot be undone and will remove all associated data."]}),i.jsxs("div",{className:"flex justify-end gap-3",children:[i.jsx("button",{onClick:()=>E(!1),className:"rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{onClick:async()=>{try{await y(oe.id),De.success("Client deleted successfully"),E(!1)}catch{De.error("Failed to delete client")}},className:"rounded-lg bg-red-500 px-4 py-2 text-sm font-medium text-white hover:bg-red-600 transition-colors",children:"Delete Client"})]})]})}),i.jsx(on,{children:Ae&&re&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"w-full max-w-2xl rounded-2xl border border-border bg-card shadow-2xl overflow-hidden flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500",children:i.jsx(Hn,{size:24})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:re.name}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:[re.industry," • ID: ",re.id]})]})]}),i.jsx("button",{onClick:()=>ce(!1),className:"rounded-full p-2 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("div",{className:"p-6 space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground",children:"Contact Information"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsx(Oh,{size:16,className:"text-muted-foreground"}),i.jsx("span",{className:"font-medium",children:re.contactPerson})]}),i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsx(xh,{size:16,className:"text-muted-foreground"}),i.jsx("a",{href:`mailto:${re.email}`,className:"text-primary hover:underline",children:re.email})]}),i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsx(Ui,{size:16,className:"text-muted-foreground"}),i.jsx("span",{children:re.phone})]}),re.website&&i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsx(Fo,{size:16,className:"text-muted-foreground"}),i.jsx("a",{href:re.website,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:re.website})]})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground",children:"Business Overview"}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 rounded-xl bg-muted/30 border border-border",children:[i.jsx("p",{className:"text-[10px] font-bold uppercase text-muted-foreground mb-1",children:"Total Revenue"}),i.jsxs("p",{className:"text-lg font-bold text-green-500",children:["$",re.revenue.toLocaleString()]})]}),i.jsxs("div",{className:"p-4 rounded-xl bg-muted/30 border border-border",children:[i.jsx("p",{className:"text-[10px] font-bold uppercase text-muted-foreground mb-1",children:"Active Projects"}),i.jsx("p",{className:"text-lg font-bold",children:re.projects})]})]}),i.jsxs("div",{className:"p-4 rounded-xl bg-muted/30 border border-border",children:[i.jsx("p",{className:"text-[10px] font-bold uppercase text-muted-foreground mb-1",children:"Account Status"}),i.jsx("span",{className:tt("inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold uppercase tracking-wider",re.status==="Active"?"bg-green-500/10 text-green-500":re.status==="Onboarding"?"bg-blue-500/10 text-blue-500":"bg-muted text-muted-foreground"),children:re.status})]})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground",children:"Associated Projects"}),i.jsxs("div",{className:"space-y-2",children:[t.filter(xe=>xe.client===re.name).map(xe=>i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/20 border border-border hover:bg-muted/30 transition-colors",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold",children:xe.name}),i.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[xe.status," • Deadline: ",xe.deadline]})]}),i.jsxs("p",{className:"text-sm font-bold",children:["$",(xe.clientTotalAmount||0).toLocaleString()]})]},xe.id)),t.filter(xe=>xe.client===re.name).length===0&&i.jsx("p",{className:"text-sm text-muted-foreground italic text-center py-4",children:"No projects found for this client."})]})]})]}),i.jsxs("div",{className:"p-4 border-t border-border bg-muted/10 flex justify-end gap-3",children:[i.jsx("button",{onClick:()=>ce(!1),className:"px-4 py-2 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Close"}),i.jsx("button",{onClick:()=>e(`/clients?search=${encodeURIComponent(re.name)}`),className:"px-4 py-2 text-sm font-bold bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Full Client Profile"})]})]})})}),i.jsx(on,{children:X&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"w-full max-w-4xl max-h-[90vh] overflow-hidden rounded-2xl border border-border bg-card shadow-2xl flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:i.jsx(u2,{size:24})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Operations Full Report"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Comprehensive overview of business health and activity."})]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("button",{onClick:J,className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-bold text-primary-foreground hover:bg-primary/90 transition-all shadow-md active:scale-95",children:[i.jsx(Nr,{size:18}),"Export CSV"]}),i.jsx("button",{onClick:()=>le(!1),className:"rounded-full p-2 hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(xr,{size:20})})]})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[i.jsx(Nb,{label:"Total Revenue",value:`$${we.totalRevenue.toLocaleString()}`,icon:Fo,color:"text-blue-500"}),i.jsx(Nb,{label:"Total Expenses",value:`$${we.totalExpenses.toLocaleString()}`,icon:nx,color:"text-red-500"}),i.jsx(Nb,{label:"Net Profit",value:`$${we.profit.toLocaleString()}`,icon:ds,color:"text-green-500"}),i.jsx(Nb,{label:"Active Projects",value:we.activeProjects.toString(),icon:Ni,color:"text-orange-500"})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsx(JS,{title:"Recent Projects",icon:Ni,headers:["Name","Client","Status","Value"],data:t.slice(0,5).map(xe=>[xe.name,xe.client,xe.status,`$${(xe.clientTotalAmount||0).toLocaleString()}`])}),i.jsx(JS,{title:"Key Clients",icon:Hn,headers:["Name","Industry","Status","Revenue"],data:r.slice(0,5).map(xe=>[xe.name,xe.industry,xe.status,`$${xe.revenue.toLocaleString()}`])}),i.jsx(JS,{title:"Critical Tasks",icon:Ec,headers:["Task","Project","Assignee","Due Date"],data:a.slice(0,5).map(xe=>[xe.title,xe.project,xe.assignee,xe.dueDate])})]})]}),i.jsx("div",{className:"p-4 border-t border-border bg-muted/10 text-center",children:i.jsxs("p",{className:"text-[10px] text-muted-foreground uppercase tracking-widest font-medium",children:["Report generated on ",new Date().toLocaleString()," • Confidential"]})})]})})})]})}function Nb({label:e,value:t,icon:r,color:n}){return i.jsxs("div",{className:"rounded-xl border border-border bg-background p-4 shadow-sm",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx("div",{className:tt("p-2 rounded-lg bg-muted",n.replace("text-","bg-").replace("500","500/10")),children:i.jsx(r,{size:18,className:n})}),i.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:e})]}),i.jsx("p",{className:"text-2xl font-bold",children:t})]})}function JS({title:e,icon:t,headers:r,data:n}){return i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center gap-2 px-1",children:[i.jsx(t,{size:18,className:"text-primary"}),i.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider",children:e})]}),i.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsx("tr",{children:r.map((a,s)=>i.jsx("th",{className:"px-4 py-3 font-semibold text-muted-foreground",children:a},s))})}),i.jsx("tbody",{className:"divide-y divide-border",children:n.map((a,s)=>i.jsx("tr",{className:"hover:bg-muted/30 transition-colors",children:a.map((o,l)=>i.jsx("td",{className:"px-4 py-3",children:o},l))},s))})]})})]})}function vAe({onAddLead:e}){const{projects:t,addClient:r,updateProject:n,clients:a}=ca(),s=t.filter(u=>u.status==="Planning"||u.status==="Pending"),o=async u=>{try{if(!a.find(f=>f.name.toLowerCase()===u.client.toLowerCase())){const f={id:`CL-${Math.random().toString(36).substr(2,5).toUpperCase()}`,name:u.client,industry:"Technology",contactPerson:"Pending",email:"pending@company.com",phone:"N/A",status:"Onboarding",projects:1,revenue:0};await r(f)}await n(u.id,{status:"Active"}),De.success(`Lead converted! ${u.client} is now a client and project is Active.`)}catch{De.error("Conversion failed")}},l=u=>{switch(u){case"EUR":return"€";case"GBP":return"£";case"AED":return"AED ";case"SAR":return"SAR ";default:return"$"}};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h2",{className:"text-xl font-bold flex items-center gap-2",children:[i.jsx(xh,{className:"text-blue-500"}),"Active Leads & Sales Pipeline"]}),i.jsxs("button",{onClick:e,className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[i.jsx($n,{size:18}),"New Lead"]})]}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[s.map(u=>i.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 shadow-sm hover:shadow-md transition-all",children:[i.jsxs("div",{className:"flex items-start justify-between mb-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold",children:u.name}),i.jsx("p",{className:"text-xs text-muted-foreground",children:u.client})]}),i.jsx("span",{className:"px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-500 text-[10px] font-bold uppercase",children:u.status})]}),i.jsxs("div",{className:"space-y-2 mb-4",children:[i.jsxs("div",{className:"flex items-center justify-between text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Expected Value"}),i.jsxs("span",{className:"font-bold",children:[l(u.currency),(u.clientTotalAmount||0).toLocaleString()]})]}),i.jsxs("div",{className:"flex items-center justify-between text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Close Date"}),i.jsx("span",{children:u.deadline})]})]}),i.jsxs("button",{onClick:()=>o(u),className:"w-full flex items-center justify-center gap-2 py-2 rounded-lg bg-primary/10 text-primary text-sm font-bold hover:bg-primary/20 transition-colors",children:["Convert to Project",i.jsx(wv,{size:16})]})]},u.id)),s.length===0&&i.jsxs("div",{className:"col-span-full py-12 text-center border-2 border-dashed border-border rounded-xl",children:[i.jsx(xh,{className:"mx-auto text-muted-foreground mb-2 opacity-20",size:48}),i.jsx("p",{className:"text-muted-foreground",children:"No active leads in the pipeline."})]})]})]})}function yAe({onAddClient:e,onViewDetails:t,onEditClient:r,onDeleteClient:n}){const{clients:a,updateClient:s}=ca(),o=async l=>{try{const u=l.status==="Active"?"Inactive":"Active";await s(l.id,{status:u}),De.success(`Client ${l.name} is now ${u}`)}catch{De.error("Failed to update client status")}};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h2",{className:"text-xl font-bold flex items-center gap-2",children:[i.jsx(Hn,{className:"text-purple-500"}),"Client Relationships"]}),i.jsxs("button",{onClick:e,className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[i.jsx($n,{size:18}),"Add Client"]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden shadow-sm",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Client"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Industry"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Status"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Revenue"}),i.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),i.jsx("tbody",{className:"divide-y divide-border",children:a.map(l=>i.jsxs("tr",{className:"hover:bg-accent/30 transition-colors",children:[i.jsx("td",{className:"px-6 py-4 font-medium",children:l.name}),i.jsx("td",{className:"px-6 py-4 text-muted-foreground",children:l.industry}),i.jsx("td",{className:"px-6 py-4",children:i.jsx("button",{onClick:()=>o(l),className:tt("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase transition-colors hover:opacity-80",l.status==="Active"?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"),children:l.status})}),i.jsxs("td",{className:"px-6 py-4 font-bold",children:["$",l.revenue.toLocaleString()]}),i.jsx("td",{className:"px-6 py-4 text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsx("button",{onClick:()=>t(l),className:"p-1.5 rounded-md hover:bg-accent text-primary transition-colors",title:"View Details",children:i.jsx(fs,{size:16})}),i.jsx("button",{onClick:()=>r(l),className:"p-1.5 rounded-md hover:bg-accent text-blue-500 transition-colors",title:"Edit Client",children:i.jsx(Ps,{size:16})}),i.jsx("button",{onClick:()=>n(l),className:"p-1.5 rounded-md hover:bg-accent text-red-500 transition-colors",title:"Delete Client",children:i.jsx(aa,{size:16})})]})})]},l.id))})]})})]})}function bAe({onAddProject:e}){const t=mo(),{projects:r,engineers:n,updateProject:a,deleteProject:s}=ca(),[o,l]=N.useState(null),u=r.filter(g=>!g.status||g.status==="Planning"||g.status==="Scheduled"||g.status==="In Progress"||g.status==="Work In Progress"||g.status==="Active"),d=async(g,x)=>{try{const y=n.find(v=>v.name===x);await a(g,{assignedTo:x,assignedRole:(y==null?void 0:y.role)||"Lead Engineer"}),De.success(`Assigned ${x} to project`)}catch{De.error("Assignment failed")}},f=async g=>{try{await a(g,{assignedTo:"",assignedRole:""}),De.success("Engineer unassigned successfully")}catch{De.error("Failed to unassign engineer")}},m=async g=>{if(window.confirm("Are you sure you want to delete this project? This action cannot be undone."))try{await s(g),De.success("Project deleted successfully")}catch{De.error("Failed to delete project")}};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h2",{className:"text-xl font-bold flex items-center gap-2",children:[i.jsx(Ni,{className:"text-orange-500"}),"Project Management & Assignments"]}),i.jsxs("button",{onClick:e,className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[i.jsx($n,{size:18}),"New Project"]})]}),i.jsxs("div",{className:"grid gap-6",children:[u.map(g=>i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 mb-6",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[i.jsx("h3",{className:"text-lg font-bold",children:g.name}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:()=>window.location.href="/projects",className:"text-[10px] text-primary hover:underline font-bold uppercase tracking-wider",children:"View"}),i.jsx("button",{onClick:()=>m(g.id),className:"text-[10px] text-red-500 hover:underline font-bold uppercase tracking-wider",children:"Delete"})]})]}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Client: ",g.client," • ID: ",g.id]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"text-right",children:[i.jsx("p",{className:"text-xs text-muted-foreground uppercase font-bold",children:"Deadline"}),i.jsx("p",{className:"font-medium",children:g.deadline})]}),i.jsx("div",{className:"h-8 w-px bg-border"}),i.jsxs("div",{className:"text-right",children:[i.jsx("p",{className:"text-xs text-muted-foreground uppercase font-bold",children:"Budget"}),i.jsxs("p",{className:"font-bold text-primary",children:["$",(g.clientTotalAmount||0).toLocaleString()]})]})]})]}),i.jsx("div",{className:"grid md:grid-cols-2 gap-8",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground",children:"Team Assignment"}),i.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg bg-muted/30 border border-border",children:[i.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(Vw,{size:24})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-sm font-bold",children:g.assignedTo||"No Engineer Assigned"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:g.assignedRole||"Assign a lead engineer to start"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[g.assignedTo&&i.jsx("button",{onClick:()=>f(g.id),className:"p-1.5 rounded-md hover:bg-red-50 text-red-500 transition-colors",title:"Remove Assignment",children:i.jsx(xr,{size:16})}),i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>l(o===g.id?null:g.id),className:tt("px-3 py-1.5 rounded-md border text-xs font-bold transition-all shadow-sm flex items-center gap-1.5",o===g.id?"bg-primary text-primary-foreground border-primary":"bg-card border-border hover:bg-accent"),children:["Assign",i.jsx(Io,{size:14,className:tt("transition-transform",o===g.id&&"rotate-90")})]}),o===g.id&&i.jsxs("div",{className:"absolute right-0 top-full mt-2 z-50 w-56 rounded-xl border border-border bg-card p-1 shadow-xl animate-in fade-in slide-in-from-top-2",children:[i.jsx("div",{className:"px-3 py-2 border-b border-border mb-1",children:i.jsx("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:"Available Engineers"})}),i.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[n.filter(x=>x.status==="Available").map(x=>i.jsxs("button",{onClick:()=>{d(g.id,x.name),l(null)},className:"flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-xs hover:bg-accent transition-colors group/eng",children:[i.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center text-[10px] font-bold text-primary group-hover/eng:bg-primary group-hover/eng:text-primary-foreground transition-colors",children:x.name.charAt(0)}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"font-bold",children:x.name}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:x.role})]})]},x.id)),n.filter(x=>x.status==="Available").length===0&&i.jsxs("div",{className:"p-4 text-center",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground italic mb-2",children:"No available engineers"}),i.jsx("button",{onClick:()=>t("/engineers?create=true"),className:"text-[10px] text-primary font-bold hover:underline",children:"Add New Engineer"})]})]})]})]})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground",children:"Project Health"}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs",children:[i.jsx("span",{children:"Progress"}),i.jsx("span",{className:"font-bold",children:"65%"})]}),i.jsx("div",{className:"h-2 w-full bg-muted rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-orange-500 w-[65%]"})}),i.jsxs("div",{className:"flex items-center justify-between mt-2",children:[i.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[i.jsx(Ui,{size:10}),"12 days remaining"]}),i.jsx("span",{className:"text-[10px] text-green-500 font-bold",children:"On Track"})]})]})]})]})})]},g.id)),u.length===0&&i.jsxs("div",{className:"py-12 text-center border-2 border-dashed border-border rounded-xl",children:[i.jsx(Ni,{className:"mx-auto text-muted-foreground mb-2 opacity-20",size:48}),i.jsx("p",{className:"text-muted-foreground",children:"No active projects currently being managed."})]})]})]})}function wAe({onAddTask:e}){const{tasks:t,updateTask:r}=ca(),n=async a=>{try{await r(a.id,{status:"Completed",completedDate:new Date().toISOString().split("T")[0]}),De.success(`Time logged for ${a.title}. Task marked as Completed.`)}catch{De.error("Failed to log time")}};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h2",{className:"text-xl font-bold flex items-center gap-2",children:[i.jsx(Ec,{className:"text-green-500"}),"Task Execution & Timesheets"]}),i.jsxs("button",{onClick:e,className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[i.jsx($n,{size:18}),"Add Task"]})]}),i.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:["To Do","In Progress","Completed"].map(a=>i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between px-2",children:[i.jsx("h3",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground",children:a}),i.jsx("span",{className:"text-xs font-bold bg-muted px-2 py-0.5 rounded-full",children:t.filter(s=>s.status===a).length})]}),i.jsx("div",{className:"space-y-3",children:t.filter(s=>s.status===a).map(s=>i.jsxs("div",{className:"p-4 rounded-xl border border-border bg-card shadow-sm hover:shadow-md transition-all group/task",children:[i.jsxs("div",{className:"flex items-start justify-between mb-1",children:[i.jsx("h4",{className:"font-bold text-sm",children:s.title}),a!=="Completed"&&i.jsx("button",{onClick:()=>n(s),className:"opacity-0 group-hover/task:opacity-100 p-1 rounded-md bg-primary/10 text-primary hover:bg-primary/20 transition-all",title:"Log Time & Complete",children:i.jsx(Ui,{size:14})})]}),i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground",children:s.project}),i.jsx("button",{onClick:()=>window.location.href="/tasks",className:"opacity-0 group-hover/task:opacity-100 text-[8px] text-primary hover:underline font-bold uppercase",children:"Details"})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[i.jsx(Lo,{size:10}),s.dueDate]}),i.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center text-[10px] font-bold text-primary",children:s.assignee.charAt(0)})]})]},s.id))})]},a))})]})}function jAe({onAddExpense:e,onGenerateInvoice:t}){const{projects:r,expenses:n,updateProject:a}=ca(),s=async l=>{try{await a(l.id,{clientInvoiceStatus:"Paid"}),De.success(`Payment received from ${l.client}`)}catch{De.error("Failed to record payment")}},o=N.useMemo(()=>{const l=r.reduce((m,g)=>m+(g.clientTotalAmount||0),0),u=n.filter(m=>m.status==="Approved").reduce((m,g)=>m+g.amount,0),d=l-u,f=l>0?d/l*100:0;return{revenue:l,cost:u,profit:d,margin:f}},[r,n]);return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h2",{className:"text-xl font-bold flex items-center gap-2",children:[i.jsx(ds,{className:"text-emerald-500"}),"Financial Control & Billing"]}),i.jsx("div",{className:"flex items-center gap-2",children:i.jsxs("button",{onClick:e,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(nx,{size:18}),"Add Expense"]})})]}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[i.jsx(Sb,{title:"Total Revenue",value:o.revenue,color:"text-emerald-500"}),i.jsx(Sb,{title:"Total Expenses",value:o.cost,color:"text-red-500"}),i.jsx(Sb,{title:"Net Profit",value:o.profit,color:"text-primary"}),i.jsx(Sb,{title:"Profit Margin",value:`${o.margin.toFixed(1)}%`,color:"text-blue-500",isCurrency:!1})]}),i.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"font-bold mb-4",children:"Recent Invoices"}),i.jsx("div",{className:"space-y-4",children:r.filter(l=>l.status==="Active"||l.status==="Completed").slice(0,5).map(l=>i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/20 border border-border",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold",children:l.client}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:l.name})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"text-right",children:[i.jsxs("p",{className:"text-sm font-bold",children:["$",(l.clientTotalAmount||0).toLocaleString()]}),i.jsx("span",{className:tt("text-[10px] font-bold uppercase",l.clientInvoiceStatus==="Paid"?"text-green-500":l.clientInvoiceStatus==="Unpaid"?"text-orange-500":"text-muted-foreground"),children:l.clientInvoiceStatus||"Not Invoiced"})]}),i.jsx("div",{className:"flex flex-col gap-1",children:l.clientInvoiceStatus==="Unpaid"&&i.jsx("button",{onClick:()=>s(l),className:"p-1 rounded bg-green-500/10 text-green-500 hover:bg-green-500/20 transition-colors",title:"Mark as Paid",children:i.jsx(Hl,{size:14})})})]})]},l.id))})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"font-bold mb-4",children:"Recent Expenses"}),i.jsx("div",{className:"space-y-4",children:n.slice(0,5).map(l=>i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/20 border border-border",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold",children:l.description}),i.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[l.category," • ",l.date]})]}),i.jsxs("div",{className:"text-right",children:[i.jsxs("p",{className:"text-sm font-bold text-red-500",children:["-$",l.amount.toLocaleString()]}),i.jsx("span",{className:"text-[10px] font-bold uppercase text-muted-foreground",children:l.status})]})]},l.id))})]})]})]})}function Sb({title:e,value:t,color:r,isCurrency:n=!0}){return i.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm",children:[i.jsx("p",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider mb-1",children:e}),i.jsx("p",{className:tt("text-xl font-bold",r),children:n?`$${t.toLocaleString()}`:t})]})}const NAe={Engineering:"hsl(var(--primary))",Sales:"#3b82f6",Marketing:"#ec4899",HR:"#f59e0b",Finance:"#10b981",Operations:"#8b5cf6",Support:"#06b6d4"},SAe={Travel:"#3b82f6",Materials:"#f59e0b",Equipment:"#ef4444",Software:"#8b5cf6",Office:"#10b981",Marketing:"#ec4899",Other:"#94a3b8"},AAe={Applied:"#94a3b8",Screening:"#3b82f6",Interview:"#8b5cf6",Offer:"#10b981",Hired:"hsl(var(--primary))",Rejected:"#ef4444"},kAe=[{id:"REP-001",name:"Monthly Financial Summary",type:"Financial",date:"2026-03-31",status:"Generated"},{id:"REP-002",name:"Employee Performance Review",type:"HR",date:"2026-03-30",status:"Generated"},{id:"REP-003",name:"Project Milestone Analysis",type:"Operations",date:"2026-03-28",status:"Draft"},{id:"REP-004",name:"Sales Pipeline Forecast",type:"Sales",date:"2026-03-25",status:"Generated"}];function CAe(){const{projects:e,tasks:t,engineers:r,expenses:n,candidates:a,jobs:s,clients:o}=ca(),[l,u]=N.useState("Last 6 Months"),[d,f]=N.useState(""),[m,g]=N.useState(kAe),x=N.useMemo(()=>{const P=new Date;let R=new Date;if(l==="Last 30 Days")R.setDate(P.getDate()-30);else if(l==="Last 3 Months")R.setMonth(P.getMonth()-3);else if(l==="Last 6 Months")R.setMonth(P.getMonth()-6);else if(l==="Last Year")R.setFullYear(P.getFullYear()-1);else return e;return e.filter(K=>(K.issueDate?new Date(K.issueDate):new Date)>=R)},[e,l]),y=N.useMemo(()=>{const P={Applied:0,Screening:0,Interview:0,Offer:0,Hired:0,Rejected:0};return a.forEach(R=>{P[R.status]!==void 0&&P[R.status]++}),Object.entries(P).map(([R,K])=>({name:R,value:K,color:AAe[R]}))},[a]),v=N.useMemo(()=>{const P=new Map;return e.forEach(R=>{const K=R.clientTotalAmount||0;P.set(R.client,(P.get(R.client)||0)+K)}),Array.from(P.entries()).map(([R,K])=>({name:R,value:K})).sort((R,K)=>K.value-R.value).slice(0,5)},[e]),w=N.useMemo(()=>{const P=r.length;if(P===0)return 0;const R=r.filter(K=>e.some(ee=>ee.assignedTo===K.name&&ee.status!=="Completed"&&ee.status!=="Cancelled")).length;return Math.round(R/P*100)},[r,e]),j=N.useMemo(()=>{const P=new Map;return r.forEach(R=>{P.has(R.department)||P.set(R.department,{count:0,completed:0,totalTasks:0,completedTasks:0});const K=P.get(R.department);K.count++;const se=e.filter(ne=>ne.assignedTo===R.name).filter(ne=>ne.status==="Completed").length;K.completed+=se;const Z=t.filter(ne=>ne.assignee===R.name);K.totalTasks+=Z.length,K.completedTasks+=Z.filter(ne=>ne.status==="Completed").length}),Array.from(P.entries()).map(([R,K])=>({name:R,efficiency:K.totalTasks>0?Math.round(K.completedTasks/K.totalTasks*100):0,quality:K.count>0?Math.min(100,80+Math.round(K.completed/K.count*20)):85,color:NAe[R]||"#94a3b8"})).sort((R,K)=>K.efficiency-R.efficiency)},[r,e,t]),k=N.useMemo(()=>{const P=new Map;return n.filter(R=>R.status==="Approved").forEach(R=>{P.set(R.category,(P.get(R.category)||0)+R.amount)}),Array.from(P.entries()).map(([R,K])=>({name:R,value:K,color:SAe[R]||"#94a3b8"})).sort((R,K)=>K.value-R.value)},[n]),A=N.useMemo(()=>{const P=new Date,R=[];for(let K=5;K>=0;K--){const ee=new Date(P.getFullYear(),P.getMonth()-K,1),se=ee.toLocaleString("default",{month:"short"}),Z=`${ee.getFullYear()}-${(ee.getMonth()+1).toString().padStart(2,"0")}`,ne=t.filter(Ae=>Ae.dueDate.startsWith(Z)||Ae.completedDate&&Ae.completedDate.startsWith(Z)),X=ne.filter(Ae=>Ae.status==="Completed").length,le=ne.length;R.push({month:se,completed:X,total:le,rate:le>0?Math.round(X/le*100):0})}return R},[t]),T=P=>{if(!P)return 0;const R=P.match(/(\d+)h/),K=P.match(/(\d+)m/),ee=R?parseInt(R[1]):0,se=K?parseInt(K[1]):0;return ee+se/60},M=N.useMemo(()=>{let P=0,R=0,K=0,ee=0;const se=new Date,Z=`${se.getFullYear()}-${(se.getMonth()+1).toString().padStart(2,"0")}`;let ne=0,X=0;const le=new Map;for(let E=5;E>=0;E--){const re=new Date(se.getFullYear(),se.getMonth()-E,1),he=`${re.getFullYear()}-${(re.getMonth()+1).toString().padStart(2,"0")}`;le.set(he,{revenue:0,expenses:0})}x.forEach(E=>{const re=T(E.totalTime),he=(E.hourlyRate||0)*re,oe=E.totalAmount&&E.totalAmount>0?E.totalAmount:he+(E.travelCost||0)+(E.materialCost||0)+(E.halfDayRate||0)+(E.fullDayRate||0)+(E.monthlyRate||0),z=(E.clientHourlyRate||0)*re,fe=E.clientTotalAmount&&E.clientTotalAmount>0?E.clientTotalAmount:z+(E.clientTravelCost||0)+(E.clientMaterialCost||0)+(E.clientHalfDayRate||0)+(E.clientFullDayRate||0)+(E.clientMonthlyRate||0);P+=fe,R+=oe;const de=E.issuedMonth||(E.issueDate?E.issueDate.substring(0,7):"");if(de===Z&&(E.clientStatus==="Completed"&&(ne+=fe),E.status==="Completed"&&(X+=oe)),le.has(de)){const W=le.get(de);W.revenue+=fe,W.expenses+=oe}E.clientStatus!=="Completed"&&E.clientStatus!=="Cancelled"&&(K+=fe,ee++)}),n.filter(E=>{if(E.status!=="Approved")return!1;const re=new Date;let he=new Date;if(l==="Last 30 Days")he.setDate(re.getDate()-30);else if(l==="Last 3 Months")he.setMonth(re.getMonth()-3);else if(l==="Last 6 Months")he.setMonth(re.getMonth()-6);else if(l==="Last Year")he.setFullYear(re.getFullYear()-1);else return!0;return new Date(E.date)>=he}).forEach(E=>{R+=E.amount;const re=(E.date||"").substring(0,7);if(re===Z&&(X+=E.amount),le.has(re)){const he=le.get(re);he.expenses+=E.amount}});const Ae=P-R,ce=P>0?Ae/P*100:0,D=Array.from(le.entries()).map(([E,re])=>{const he=(E||"").split("-");if(he.length<2)return{month:E,revenue:re.revenue,expenses:re.expenses};const[oe,z]=he;return{month:new Date(parseInt(oe),parseInt(z)-1).toLocaleString("default",{month:"short"}),revenue:re.revenue,expenses:re.expenses}}),H={"On Track":0,"At Risk":0,Delayed:0,Completed:0};x.forEach(E=>{E.status==="Completed"?H.Completed++:E.status==="In Progress"?H["On Track"]++:E.status==="Pending"?H["At Risk"]++:E.status==="Cancelled"?H.Delayed++:H["On Track"]++});const G=[{name:"On Track",value:H["On Track"],color:"hsl(var(--primary))"},{name:"At Risk",value:H["At Risk"],color:"#f59e0b"},{name:"Delayed",value:H.Delayed,color:"#ef4444"},{name:"Completed",value:H.Completed,color:"#10b981"}];return{totalRevenue:P,totalExpenses:R,netProfit:Ae,margin:ce,pendingAmount:K,pendingCount:ee,chartData:D,currentMonthInflow:ne,currentMonthOutflow:X,projectStatusData:G}},[x,n,l]),B=N.useMemo(()=>x.map(P=>{const R=T(P.totalTime),K=(P.hourlyRate||0)*R,ee=P.totalAmount&&P.totalAmount>0?P.totalAmount:K+(P.travelCost||0)+(P.materialCost||0)+(P.halfDayRate||0)+(P.fullDayRate||0)+(P.monthlyRate||0),se=(P.clientHourlyRate||0)*R,Z=P.clientTotalAmount&&P.clientTotalAmount>0?P.clientTotalAmount:se+(P.clientTravelCost||0)+(P.clientMaterialCost||0)+(P.clientHalfDayRate||0)+(P.clientFullDayRate||0)+(P.clientMonthlyRate||0),ne=Z-ee;return{name:P.name,profit:ne,revenue:Z,cost:ee}}).sort((P,R)=>R.profit-P.profit).slice(0,5),[x]),L=()=>{const P=["Metric","Value"],R=[["Total Revenue",M.totalRevenue.toFixed(2)],["Total Expenses",M.totalExpenses.toFixed(2)],["Net Profit",M.netProfit.toFixed(2)],["Profit Margin",`${M.margin.toFixed(2)}%`],["Engineer Utilization",`${w}%`],["Pending Amount",M.pendingAmount.toFixed(2)],["Pending Count",M.pendingCount.toString()]];R.push(["",""]),R.push(["Department","Efficiency (%)","Quality (%)"]),j.forEach(ne=>{R.push([ne.name,ne.efficiency.toString(),ne.quality.toString()])});const K=[P.join(","),...R.map(ne=>ne.map(X=>`"${X}"`).join(","))].join(`
`),ee=new Blob([K],{type:"text/csv;charset=utf-8;"}),se=URL.createObjectURL(ee),Z=window.document.createElement("a");Z.setAttribute("href",se),Z.setAttribute("download",`analytics_export_${new Date().toISOString().split("T")[0]}.csv`),window.document.body.appendChild(Z),Z.click(),window.document.body.removeChild(Z),URL.revokeObjectURL(se),De.success("Analytics data exported as CSV")},F=()=>{De.info("Refreshing analytics data...")},I=()=>{const P=`REP-${Math.floor(Math.random()*1e3).toString().padStart(3,"0")}`,R={id:P,name:`Performance Analysis - ${new Date().toLocaleDateString()}`,type:"Automated",date:new Date().toISOString().split("T")[0],status:"Generated"};g([R,...m]);const K=["Metric","Value"],ee=[["Report ID",P],["Report Name",R.name],["Generated On",new Date().toLocaleString()],["Range",l],["",""],["FINANCIAL SUMMARY",""],["Total Revenue",M.totalRevenue.toFixed(2)],["Total Expenses",M.totalExpenses.toFixed(2)],["Net Profit",M.netProfit.toFixed(2)],["Profit Margin",`${M.margin.toFixed(2)}%`],["",""],["OPERATIONAL METRICS",""],["Engineer Utilization",`${w}%`],["Pending Projects",M.pendingCount.toString()],["Pending Revenue",M.pendingAmount.toFixed(2)]],se=[K.join(","),...ee.map(le=>le.map(Ae=>`"${Ae}"`).join(","))].join(`
`),Z=new Blob([se],{type:"text/csv;charset=utf-8;"}),ne=URL.createObjectURL(Z),X=window.document.createElement("a");X.href=ne,X.download=`report_${P}.csv`,window.document.body.appendChild(X),X.click(),window.document.body.removeChild(X),URL.revokeObjectURL(ne),De.success("New report generated and downloaded as CSV")},q=P=>{const R=["Report ID","Name","Type","Date","Status"],K=[P.id,P.name,P.type,P.date,P.status],ee=[R.join(","),K.map(X=>`"${X}"`).join(",")].join(`
`),se=new Blob([ee],{type:"text/csv;charset=utf-8;"}),Z=URL.createObjectURL(se),ne=window.document.createElement("a");ne.href=Z,ne.download=`${P.id}_${P.name.replace(/\s+/g,"_")}.csv`,window.document.body.appendChild(ne),ne.click(),window.document.body.removeChild(ne),URL.revokeObjectURL(Z),De.success(`Downloading ${P.name} as CSV`)};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Reports & Analytics"}),i.jsx("p",{className:"text-muted-foreground",children:"Comprehensive insights into business performance and departmental metrics."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:F,className:"p-2 rounded-lg border border-border bg-card hover:bg-accent transition-colors",title:"Refresh Data",children:i.jsx(Nc,{size:18,className:"text-muted-foreground"})}),i.jsxs("div",{className:"relative",children:[i.jsx(Lo,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),i.jsxs("select",{value:l,onChange:P=>u(P.target.value),className:"h-10 rounded-lg border border-border bg-card pl-10 pr-4 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none cursor-pointer",children:[i.jsx("option",{children:"Last 30 Days"}),i.jsx("option",{children:"Last 3 Months"}),i.jsx("option",{children:"Last 6 Months"}),i.jsx("option",{children:"Last Year"})]})]}),i.jsxs("button",{onClick:L,className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:[i.jsx(Nr,{size:18}),"Export"]}),i.jsxs("button",{onClick:I,className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[i.jsx($n,{size:18}),"Generate Report"]})]})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(Ab,{title:"Total Revenue",value:`$${M.totalRevenue.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}`,icon:Fo,trend:`${M.margin.toFixed(1)}%`,trendType:"up",description:"Gross profit margin"}),i.jsx(Ab,{title:"Total Expenses",value:`$${M.totalExpenses.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}`,icon:w3,trend:"Stable",trendType:"neutral",description:"Engineer payouts & costs"}),i.jsx(Ab,{title:"Net Profit",value:`$${M.netProfit.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}`,icon:ds,trend:"+5.2%",trendType:"up",description:"Earnings after expenses"}),i.jsx(Ab,{title:"Engineer Utilization",value:`${w}%`,icon:Hn,trend:r.length.toString(),trendType:"neutral",description:"Active project assignments"})]}),i.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-lg",children:"Financial Performance"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Revenue vs. Expenses (Last 6 Months)"})]}),i.jsxs("div",{className:"flex items-center gap-4 text-[10px] font-bold uppercase tracking-wider",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"h-2 w-2 rounded-full bg-primary"}),i.jsx("span",{className:"text-muted-foreground",children:"Revenue"})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"h-2 w-2 rounded-full bg-muted"}),i.jsx("span",{className:"text-muted-foreground",children:"Expenses"})]})]})]}),i.jsx("div",{className:"h-[300px] w-full",children:i.jsx(_u,{width:"100%",height:"100%",children:i.jsxs(ov,{data:M.chartData,margin:{top:10,right:10,left:-20,bottom:0},children:[i.jsx(Mm,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))"}),i.jsx(uh,{dataKey:"month",axisLine:!1,tickLine:!1,tick:{fontSize:10,fontWeight:600,fill:"hsl(var(--muted-foreground))"}}),i.jsx(dh,{axisLine:!1,tickLine:!1,tick:{fontSize:10,fontWeight:600,fill:"hsl(var(--muted-foreground))"},tickFormatter:P=>`$${P/1e3}k`}),i.jsx(Eu,{cursor:{fill:"hsl(var(--muted)/0.1)"},contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",borderRadius:"12px",boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1)"},itemStyle:{fontSize:"11px",fontWeight:600},labelStyle:{fontSize:"12px",fontWeight:700,marginBottom:"4px"}}),i.jsx(Bd,{dataKey:"revenue",fill:"hsl(var(--primary))",radius:[4,4,0,0],barSize:24}),i.jsx(Bd,{dataKey:"expenses",fill:"hsl(var(--muted))",radius:[4,4,0,0],barSize:24})]})})})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-lg",children:"Recruitment Funnel"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Candidate status distribution"})]}),i.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:i.jsx(Hn,{size:18})})]}),i.jsx("div",{className:"h-[300px] w-full",children:i.jsx(_u,{width:"100%",height:"100%",children:i.jsxs(ov,{data:y,layout:"vertical",margin:{top:0,right:30,left:40,bottom:0},children:[i.jsx(Mm,{strokeDasharray:"3 3",horizontal:!1,stroke:"hsl(var(--border))"}),i.jsx(uh,{type:"number",hide:!0}),i.jsx(dh,{dataKey:"name",type:"category",axisLine:!1,tickLine:!1,tick:{fontSize:10,fontWeight:700,fill:"hsl(var(--foreground))"},width:100}),i.jsx(Eu,{cursor:{fill:"hsl(var(--muted)/0.1)"},contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",borderRadius:"12px"}}),i.jsx(Bd,{dataKey:"value",radius:[0,4,4,0],barSize:20,children:y.map((P,R)=>i.jsx(Wd,{fill:P.color},`cell-${R}`))})]})})})]})]}),i.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"font-bold text-lg mb-1",children:"Top Clients"}),i.jsx("p",{className:"text-xs text-muted-foreground mb-6",children:"Revenue contribution by client"}),i.jsxs("div",{className:"space-y-4",children:[v.map((P,R)=>i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs",children:[i.jsx("span",{className:"font-bold",children:P.name}),i.jsxs("span",{className:"font-mono text-primary font-bold",children:["$",P.value.toLocaleString()]})]}),i.jsx("div",{className:"h-2 w-full bg-muted rounded-full overflow-hidden",children:i.jsx(ar.div,{initial:{width:0},animate:{width:`${P.value/v[0].value*100}%`},className:"h-full bg-primary"})})]},P.name)),v.length===0&&i.jsx("p",{className:"text-center text-muted-foreground text-sm py-8",children:"No client data available"})]})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm lg:col-span-2",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-lg",children:"Departmental Efficiency"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Task completion vs. Quality score"})]}),i.jsxs("div",{className:"flex items-center gap-4 text-[10px] font-bold uppercase tracking-wider",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"h-2 w-2 rounded-full bg-primary"}),i.jsx("span",{className:"text-muted-foreground",children:"Efficiency"})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"h-2 w-2 rounded-full bg-muted"}),i.jsx("span",{className:"text-muted-foreground",children:"Quality"})]})]})]}),i.jsx("div",{className:"h-[300px] w-full",children:i.jsx(_u,{width:"100%",height:"100%",children:i.jsxs(ov,{data:j,layout:"vertical",margin:{top:0,right:30,left:40,bottom:0},children:[i.jsx(Mm,{strokeDasharray:"3 3",horizontal:!1,stroke:"hsl(var(--border))"}),i.jsx(uh,{type:"number",axisLine:!1,tickLine:!1,tick:{fontSize:10,fontWeight:600,fill:"hsl(var(--muted-foreground))"},domain:[0,100]}),i.jsx(dh,{dataKey:"name",type:"category",axisLine:!1,tickLine:!1,tick:{fontSize:10,fontWeight:700,fill:"hsl(var(--foreground))"},width:100}),i.jsx(Eu,{cursor:{fill:"hsl(var(--muted)/0.1)"},contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",borderRadius:"12px"}}),i.jsx(Bd,{dataKey:"efficiency",fill:"hsl(var(--primary))",radius:[0,4,4,0],barSize:12}),i.jsx(Bd,{dataKey:"quality",fill:"hsl(var(--muted))",radius:[0,4,4,0],barSize:12})]})})})]})]}),i.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"font-bold text-lg mb-1",children:"Expense Allocation"}),i.jsx("p",{className:"text-xs text-muted-foreground mb-6",children:"Distribution by category"}),i.jsx("div",{className:"h-[250px] w-full",children:i.jsx(_u,{width:"100%",height:"100%",children:i.jsxs(qA,{children:[i.jsx(pw,{data:k.length>0?k:[{name:"No Data",value:1,color:"#94a3b8"}],cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,paddingAngle:5,dataKey:"value",children:(k.length>0?k:[{name:"No Data",value:1,color:"#94a3b8"}]).map((P,R)=>i.jsx(Wd,{fill:P.color},`cell-${R}`))}),i.jsx(Eu,{formatter:P=>`$${P.toLocaleString()}`,contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",borderRadius:"12px"}})]})})}),i.jsx("div",{className:"mt-4 space-y-2",children:k.slice(0,4).map(P=>i.jsxs("div",{className:"flex items-center justify-between text-xs",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:P.color}}),i.jsx("span",{className:"font-medium",children:P.name})]}),i.jsxs("span",{className:"text-muted-foreground font-mono",children:["$",P.value.toLocaleString()]})]},P.name))})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-lg",children:"Task Execution Trends"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly completion rates and volume"})]}),i.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:i.jsx(Ec,{size:18})})]}),i.jsx("div",{className:"h-[250px] w-full",children:i.jsx(_u,{width:"100%",height:"100%",children:i.jsxs(Jje,{data:A,margin:{top:10,right:10,left:-20,bottom:0},children:[i.jsx(Mm,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))"}),i.jsx(uh,{dataKey:"month",axisLine:!1,tickLine:!1,tick:{fontSize:10,fontWeight:600,fill:"hsl(var(--muted-foreground))"}}),i.jsx(dh,{axisLine:!1,tickLine:!1,tick:{fontSize:10,fontWeight:600,fill:"hsl(var(--muted-foreground))"}}),i.jsx(Eu,{contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",borderRadius:"12px"},itemStyle:{fontSize:"11px",fontWeight:600}}),i.jsx(fq,{type:"monotone",dataKey:"rate",stroke:"hsl(var(--primary))",strokeWidth:3,dot:{r:4,fill:"hsl(var(--primary))",strokeWidth:2,stroke:"hsl(var(--card))"},activeDot:{r:6,strokeWidth:0},name:"Completion %"})]})})})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsx("h3",{className:"font-bold text-lg mb-1",children:"Portfolio Health"}),i.jsx("p",{className:"text-xs text-muted-foreground mb-6",children:"Project status distribution"}),i.jsx("div",{className:"h-[250px] w-full",children:i.jsx(_u,{width:"100%",height:"100%",children:i.jsxs(qA,{children:[i.jsx(pw,{data:M.projectStatusData,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,paddingAngle:5,dataKey:"value",children:M.projectStatusData.map((P,R)=>i.jsx(Wd,{fill:P.color},`cell-${R}`))}),i.jsx(Eu,{contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",borderRadius:"12px"}}),i.jsx(i$,{verticalAlign:"bottom",height:36,iconType:"circle",formatter:P=>i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:P})})]})})})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm lg:col-span-2",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h3",{className:"font-semibold",children:"Recently Generated Reports"}),i.jsxs("div",{className:"relative max-w-xs",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),i.jsx("input",{type:"text",placeholder:"Search reports...",value:d,onChange:P=>f(P.target.value),className:"h-9 w-full rounded-lg border border-border bg-background pl-9 pr-4 text-xs focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsx("div",{className:"space-y-4",children:m.filter(P=>P.name.toLowerCase().includes(d.toLowerCase())).map(P=>i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border hover:bg-accent/30 transition-all group cursor-pointer",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(Tn,{size:20})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium group-hover:text-primary transition-colors",children:P.name}),i.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[i.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider font-bold",children:P.id}),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"•"}),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:P.type})]})]})]}),i.jsxs("div",{className:"flex items-center gap-6",children:[i.jsxs("div",{className:"text-right hidden sm:block",children:[i.jsx("p",{className:"text-xs font-medium",children:P.date}),i.jsx("span",{className:tt("text-[10px] font-bold uppercase",P.status==="Generated"?"text-green-500":"text-yellow-500"),children:P.status})]}),i.jsx("button",{onClick:()=>q(P),className:"p-1 hover:bg-accent rounded-md text-muted-foreground transition-colors",children:i.jsx(Nr,{size:16})})]})]},P.id))}),i.jsxs("button",{className:"w-full mt-4 py-2 text-xs font-medium text-muted-foreground hover:text-primary transition-colors flex items-center justify-center gap-2",children:["View All Reports",i.jsx(Io,{size:14})]})]})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-lg",children:"Project Profitability"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Top 5 most profitable projects in selected period"})]}),i.jsx("div",{className:"p-2 rounded-lg bg-emerald-500/10 text-emerald-500",children:i.jsx(u2,{size:18})})]}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border text-left",children:[i.jsx("th",{className:"pb-3 font-bold uppercase tracking-wider text-[10px] text-muted-foreground",children:"Project Name"}),i.jsx("th",{className:"pb-3 font-bold uppercase tracking-wider text-[10px] text-muted-foreground text-right",children:"Revenue"}),i.jsx("th",{className:"pb-3 font-bold uppercase tracking-wider text-[10px] text-muted-foreground text-right",children:"Cost"}),i.jsx("th",{className:"pb-3 font-bold uppercase tracking-wider text-[10px] text-muted-foreground text-right",children:"Profit"}),i.jsx("th",{className:"pb-3 font-bold uppercase tracking-wider text-[10px] text-muted-foreground text-right",children:"Margin"})]})}),i.jsxs("tbody",{className:"divide-y divide-border",children:[B.map(P=>i.jsxs("tr",{className:"group hover:bg-muted/30 transition-colors",children:[i.jsx("td",{className:"py-3 font-medium",children:P.name}),i.jsxs("td",{className:"py-3 text-right font-mono",children:["$",P.revenue.toLocaleString()]}),i.jsxs("td",{className:"py-3 text-right font-mono text-muted-foreground",children:["$",P.cost.toLocaleString()]}),i.jsxs("td",{className:"py-3 text-right font-mono font-bold text-emerald-500",children:["$",P.profit.toLocaleString()]}),i.jsx("td",{className:"py-3 text-right",children:i.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold bg-emerald-500/10 text-emerald-500",children:[P.revenue>0?(P.profit/P.revenue*100).toFixed(1):0,"%"]})})]},P.name)),B.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"py-8 text-center text-muted-foreground",children:"No project data available for this period"})})]})]})})]})]})}function Ab({title:e,value:t,icon:r,trend:n,trendType:a,description:s}){return i.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("div",{className:"p-2 rounded-lg bg-accent text-muted-foreground",children:i.jsx(r,{size:18})}),i.jsxs("div",{className:tt("flex items-center gap-1 text-xs font-medium",a==="up"?"text-green-500":a==="down"?"text-red-500":"text-muted-foreground"),children:[a==="up"&&i.jsx(jv,{size:14}),a==="down"&&i.jsx(bv,{size:14}),n]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:e}),i.jsx("p",{className:"text-2xl font-bold",children:t}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s})]})]})}/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */var _w={};_w.version="0.18.5";var JW=1252,_Ae=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],uE={0:1252,1:65001,2:65001,77:1e4,128:932,129:949,130:1361,134:936,136:950,161:1253,162:1254,163:1258,177:1255,178:1256,186:1257,204:1251,222:874,238:1250,255:1252,69:6969},dE=function(e){_Ae.indexOf(e)!=-1&&(JW=uE[0]=e)};function EAe(){dE(1252)}var Cc=function(e){dE(e)};function fE(){Cc(1200),EAe()}function LF(e){for(var t=[],r=0,n=e.length;r<n;++r)t[r]=e.charCodeAt(r);return t}function TAe(e){for(var t=[],r=0;r<e.length>>1;++r)t[r]=String.fromCharCode(e.charCodeAt(2*r)+(e.charCodeAt(2*r+1)<<8));return t.join("")}function QW(e){for(var t=[],r=0;r<e.length>>1;++r)t[r]=String.fromCharCode(e.charCodeAt(2*r+1)+(e.charCodeAt(2*r)<<8));return t.join("")}var Zg=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1);return t==255&&r==254?TAe(e.slice(2)):t==254&&r==255?QW(e.slice(2)):t==65279?e.slice(1):e},kb=function(t){return String.fromCharCode(t)},IF=function(t){return String.fromCharCode(t)},Wv,hh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Gv(e){for(var t="",r=0,n=0,a=0,s=0,o=0,l=0,u=0,d=0;d<e.length;)r=e.charCodeAt(d++),s=r>>2,n=e.charCodeAt(d++),o=(r&3)<<4|n>>4,a=e.charCodeAt(d++),l=(n&15)<<2|a>>6,u=a&63,isNaN(n)?l=u=64:isNaN(a)&&(u=64),t+=hh.charAt(s)+hh.charAt(o)+hh.charAt(l)+hh.charAt(u);return t}function vl(e){var t="",r=0,n=0,a=0,s=0,o=0,l=0,u=0;e=e.replace(/[^\w\+\/\=]/g,"");for(var d=0;d<e.length;)s=hh.indexOf(e.charAt(d++)),o=hh.indexOf(e.charAt(d++)),r=s<<2|o>>4,t+=String.fromCharCode(r),l=hh.indexOf(e.charAt(d++)),n=(o&15)<<4|l>>2,l!==64&&(t+=String.fromCharCode(n)),u=hh.indexOf(e.charAt(d++)),a=(l&3)<<6|u,u!==64&&(t+=String.fromCharCode(a));return t}var Yr=(function(){return typeof Buffer<"u"&&typeof process<"u"&&typeof process.versions<"u"&&!!process.versions.node})(),hf=(function(){if(typeof Buffer<"u"){var e=!Buffer.from;if(!e)try{Buffer.from("foo","utf8")}catch{e=!0}return e?function(t,r){return r?new Buffer(t,r):new Buffer(t)}:Buffer.from.bind(Buffer)}return function(){}})();function _h(e){return Yr?Buffer.alloc?Buffer.alloc(e):new Buffer(e):typeof Uint8Array<"u"?new Uint8Array(e):new Array(e)}function FF(e){return Yr?Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e):typeof Uint8Array<"u"?new Uint8Array(e):new Array(e)}var cl=function(t){return Yr?hf(t,"binary"):t.split("").map(function(r){return r.charCodeAt(0)&255})};function Y5(e){if(typeof ArrayBuffer>"u")return cl(e);for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n!=e.length;++n)r[n]=e.charCodeAt(n)&255;return t}function Uh(e){if(Array.isArray(e))return e.map(function(n){return String.fromCharCode(n)}).join("");for(var t=[],r=0;r<e.length;++r)t[r]=String.fromCharCode(e[r]);return t.join("")}function PAe(e){if(typeof Uint8Array>"u")throw new Error("Unsupported");return new Uint8Array(e)}function hE(e){if(typeof ArrayBuffer>"u")throw new Error("Unsupported");if(e instanceof ArrayBuffer)return hE(new Uint8Array(e));for(var t=new Array(e.length),r=0;r<e.length;++r)t[r]=e[r];return t}var os=Yr?function(e){return Buffer.concat(e.map(function(t){return Buffer.isBuffer(t)?t:hf(t)}))}:function(e){if(typeof Uint8Array<"u"){var t=0,r=0;for(t=0;t<e.length;++t)r+=e[t].length;var n=new Uint8Array(r),a=0;for(t=0,r=0;t<e.length;r+=a,++t)if(a=e[t].length,e[t]instanceof Uint8Array)n.set(e[t],r);else{if(typeof e[t]=="string")throw"wtf";n.set(new Uint8Array(e[t]),r)}return n}return[].concat.apply([],e.map(function(s){return Array.isArray(s)?s:[].slice.call(s)}))};function DAe(e){for(var t=[],r=0,n=e.length+250,a=_h(e.length+255),s=0;s<e.length;++s){var o=e.charCodeAt(s);if(o<128)a[r++]=o;else if(o<2048)a[r++]=192|o>>6&31,a[r++]=128|o&63;else if(o>=55296&&o<57344){o=(o&1023)+64;var l=e.charCodeAt(++s)&1023;a[r++]=240|o>>8&7,a[r++]=128|o>>2&63,a[r++]=128|l>>6&15|(o&3)<<4,a[r++]=128|l&63}else a[r++]=224|o>>12&15,a[r++]=128|o>>6&63,a[r++]=128|o&63;r>n&&(t.push(a.slice(0,r)),r=0,a=_h(65535),n=65530)}return t.push(a.slice(0,r)),os(t)}var uo=/\u0000/g,Jg=/[\u0001-\u0006]/g;function Zp(e){for(var t="",r=e.length-1;r>=0;)t+=e.charAt(r--);return t}function _c(e,t){var r=""+e;return r.length>=t?r:ei("0",t-r.length)+r}function mE(e,t){var r=""+e;return r.length>=t?r:ei(" ",t-r.length)+r}function Ew(e,t){var r=""+e;return r.length>=t?r:r+ei(" ",t-r.length)}function OAe(e,t){var r=""+Math.round(e);return r.length>=t?r:ei("0",t-r.length)+r}function RAe(e,t){var r=""+e;return r.length>=t?r:ei("0",t-r.length)+r}var BF=Math.pow(2,32);function Ap(e,t){if(e>BF||e<-BF)return OAe(e,t);var r=Math.round(e);return RAe(r,t)}function Tw(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 zF=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],QS=[["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 MAe(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 Cr={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"秒 "'},UF={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},LAe={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 Pw(e,t,r){for(var n=e<0?-1:1,a=e*n,s=0,o=1,l=0,u=1,d=0,f=0,m=Math.floor(a);d<t&&(m=Math.floor(a),l=m*o+s,f=m*d+u,!(a-m<5e-8));)a=1/(a-m),s=o,o=l,u=d,d=f;if(f>t&&(d>t?(f=u,l=s):(f=d,l=o)),!r)return[0,n*l,f];var g=Math.floor(n*l/f);return[g,n*l-g*f,f]}function Lm(e,t,r){if(e>2958465||e<0)return null;var n=e|0,a=Math.floor(86400*(e-n)),s=0,o=[],l={D:n,T:a,u:86400*(e-n)-a,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(l.u)<1e-6&&(l.u=0),t&&t.date1904&&(n+=1462),l.u>.9999&&(l.u=0,++a==86400&&(l.T=a=0,++n,++l.D)),n===60)o=r?[1317,10,29]:[1900,2,29],s=3;else if(n===0)o=r?[1317,8,29]:[1900,1,0],s=6;else{n>60&&--n;var u=new Date(1900,0,1);u.setDate(u.getDate()+n-1),o=[u.getFullYear(),u.getMonth()+1,u.getDate()],s=u.getDay(),n<60&&(s=(s+6)%7),r&&(s=$Ae(u,o))}return l.y=o[0],l.m=o[1],l.d=o[2],l.S=a%60,a=Math.floor(a/60),l.M=a%60,a=Math.floor(a/60),l.H=a,l.q=s,l}var eG=new Date(1899,11,31,0,0,0),IAe=eG.getTime(),FAe=new Date(1900,2,1,0,0,0);function tG(e,t){var r=e.getTime();return t?r-=1461*24*60*60*1e3:e>=FAe&&(r+=1440*60*1e3),(r-(IAe+(e.getTimezoneOffset()-eG.getTimezoneOffset())*6e4))/(1440*60*1e3)}function pE(e){return e.indexOf(".")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function BAe(e){return e.indexOf("E")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}function zAe(e){var t=e<0?12:11,r=pE(e.toFixed(12));return r.length<=t||(r=e.toPrecision(10),r.length<=t)?r:e.toExponential(5)}function UAe(e){var t=pE(e.toFixed(11));return t.length>(e<0?12:11)||t==="0"||t==="-0"?e.toPrecision(6):t}function Yv(e){var t=Math.floor(Math.log(Math.abs(e))*Math.LOG10E),r;return t>=-4&&t<=-1?r=e.toPrecision(10+t):Math.abs(t)<=9?r=zAe(e):t===10?r=e.toFixed(10).substr(0,12):r=UAe(e),pE(BAe(r.toUpperCase()))}function c0(e,t){switch(typeof e){case"string":return e;case"boolean":return e?"TRUE":"FALSE";case"number":return(e|0)===e?e.toString(10):Yv(e);case"undefined":return"";case"object":if(e==null)return"";if(e instanceof Date)return Xl(14,tG(e,t&&t.date1904),t)}throw new Error("unsupported value in General format: "+e)}function $Ae(e,t){t[0]-=581;var r=e.getDay();return e<60&&(r=(r+6)%7),r}function HAe(e,t,r,n){var a="",s=0,o=0,l=r.y,u,d=0;switch(e){case 98:l=r.y+543;case 121:switch(t.length){case 1:case 2:u=l%100,d=2;break;default:u=l%1e4,d=4;break}break;case 109:switch(t.length){case 1:case 2:u=r.m,d=t.length;break;case 3:return QS[r.m-1][1];case 5:return QS[r.m-1][0];default:return QS[r.m-1][2]}break;case 100:switch(t.length){case 1:case 2:u=r.d,d=t.length;break;case 3:return zF[r.q][0];default:return zF[r.q][1]}break;case 104:switch(t.length){case 1:case 2:u=1+(r.H+11)%12,d=t.length;break;default:throw"bad hour format: "+t}break;case 72:switch(t.length){case 1:case 2:u=r.H,d=t.length;break;default:throw"bad hour format: "+t}break;case 77:switch(t.length){case 1:case 2:u=r.M,d=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 r.u===0&&(t=="s"||t=="ss")?_c(r.S,t.length):(n>=2?o=n===3?1e3:100:o=n===1?10:1,s=Math.round(o*(r.S+r.u)),s>=60*o&&(s=0),t==="s"?s===0?"0":""+s/o:(a=_c(s,2+n),t==="ss"?a.substr(0,2):"."+a.substr(2,t.length-1)));case 90:switch(t){case"[h]":case"[hh]":u=r.D*24+r.H;break;case"[m]":case"[mm]":u=(r.D*24+r.H)*60+r.M;break;case"[s]":case"[ss]":u=((r.D*24+r.H)*60+r.M)*60+Math.round(r.S+r.u);break;default:throw"bad abstime format: "+t}d=t.length===3?1:2;break;case 101:u=l,d=1;break}var f=d>0?_c(u,d):"";return f}function mh(e){var t=3;if(e.length<=t)return e;for(var r=e.length%t,n=e.substr(0,r);r!=e.length;r+=t)n+=(n.length>0?",":"")+e.substr(r,t);return n}var rG=/%/g;function VAe(e,t,r){var n=t.replace(rG,""),a=t.length-n.length;return Yd(e,n,r*Math.pow(10,2*a))+ei("%",a)}function qAe(e,t,r){for(var n=t.length-1;t.charCodeAt(n-1)===44;)--n;return Yd(e,t.substr(0,n),r/Math.pow(10,3*(t.length-n)))}function nG(e,t){var r,n=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(t==0)return"0.0E+0";if(t<0)return"-"+nG(e,-t);var a=e.indexOf(".");a===-1&&(a=e.indexOf("E"));var s=Math.floor(Math.log(t)*Math.LOG10E)%a;if(s<0&&(s+=a),r=(t/Math.pow(10,s)).toPrecision(n+1+(a+s)%a),r.indexOf("e")===-1){var o=Math.floor(Math.log(t)*Math.LOG10E);for(r.indexOf(".")===-1?r=r.charAt(0)+"."+r.substr(1)+"E+"+(o-r.length+s):r+="E+"+(o-s);r.substr(0,2)==="0.";)r=r.charAt(0)+r.substr(2,a)+"."+r.substr(2+a),r=r.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(l,u,d,f){return u+d+f.substr(0,(a+s)%a)+"."+f.substr(s)+"E"})}else r=t.toExponential(n);return e.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),e.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}var aG=/# (\?+)( ?)\/( ?)(\d+)/;function WAe(e,t,r){var n=parseInt(e[4],10),a=Math.round(t*n),s=Math.floor(a/n),o=a-s*n,l=n;return r+(s===0?"":""+s)+" "+(o===0?ei(" ",e[1].length+1+e[4].length):mE(o,e[1].length)+e[2]+"/"+e[3]+_c(l,e[4].length))}function GAe(e,t,r){return r+(t===0?"":""+t)+ei(" ",e[1].length+2+e[4].length)}var iG=/^#*0*\.([0#]+)/,sG=/\).*[0#]/,oG=/\(###\) ###\\?-####/;function no(e){for(var t="",r,n=0;n!=e.length;++n)switch(r=e.charCodeAt(n)){case 35:break;case 63:t+=" ";break;case 48:t+="0";break;default:t+=String.fromCharCode(r)}return t}function $F(e,t){var r=Math.pow(10,t);return""+Math.round(e*r)/r}function HF(e,t){var r=e-Math.floor(e),n=Math.pow(10,t);return t<(""+Math.round(r*n)).length?0:Math.round(r*n)}function YAe(e,t){return t<(""+Math.round((e-Math.floor(e))*Math.pow(10,t))).length?1:0}function KAe(e){return e<2147483647&&e>-2147483648?""+(e>=0?e|0:e-1|0):""+Math.floor(e)}function Rl(e,t,r){if(e.charCodeAt(0)===40&&!t.match(sG)){var n=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?Rl("n",n,r):"("+Rl("n",n,-r)+")"}if(t.charCodeAt(t.length-1)===44)return qAe(e,t,r);if(t.indexOf("%")!==-1)return VAe(e,t,r);if(t.indexOf("E")!==-1)return nG(t,r);if(t.charCodeAt(0)===36)return"$"+Rl(e,t.substr(t.charAt(1)==" "?2:1),r);var a,s,o,l,u=Math.abs(r),d=r<0?"-":"";if(t.match(/^00+$/))return d+Ap(u,t.length);if(t.match(/^[#?]+$/))return a=Ap(r,0),a==="0"&&(a=""),a.length>t.length?a:no(t.substr(0,t.length-a.length))+a;if(s=t.match(aG))return WAe(s,u,d);if(t.match(/^#+0+$/))return d+Ap(u,t.length-t.indexOf("0"));if(s=t.match(iG))return a=$F(r,s[1].length).replace(/^([^\.]+)$/,"$1."+no(s[1])).replace(/\.$/,"."+no(s[1])).replace(/\.(\d*)$/,function(y,v){return"."+v+ei("0",no(s[1]).length-v.length)}),t.indexOf("0.")!==-1?a:a.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),s=t.match(/^(0*)\.(#*)$/))return d+$F(u,s[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,s[1].length?"0.":".");if(s=t.match(/^#{1,3},##0(\.?)$/))return d+mh(Ap(u,0));if(s=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+Rl(e,t,-r):mh(""+(Math.floor(r)+YAe(r,s[1].length)))+"."+_c(HF(r,s[1].length),s[1].length);if(s=t.match(/^#,#*,#0/))return Rl(e,t.replace(/^#,#*,/,""),r);if(s=t.match(/^([0#]+)(\\?-([0#]+))+$/))return a=Zp(Rl(e,t.replace(/[\\-]/g,""),r)),o=0,Zp(Zp(t.replace(/\\/g,"")).replace(/[0#]/g,function(y){return o<a.length?a.charAt(o++):y==="0"?"0":""}));if(t.match(oG))return a=Rl(e,"##########",r),"("+a.substr(0,3)+") "+a.substr(3,3)+"-"+a.substr(6);var f="";if(s=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return o=Math.min(s[4].length,7),l=Pw(u,Math.pow(10,o)-1,!1),a=""+d,f=Yd("n",s[1],l[1]),f.charAt(f.length-1)==" "&&(f=f.substr(0,f.length-1)+"0"),a+=f+s[2]+"/"+s[3],f=Ew(l[2],o),f.length<s[4].length&&(f=no(s[4].substr(s[4].length-f.length))+f),a+=f,a;if(s=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return o=Math.min(Math.max(s[1].length,s[4].length),7),l=Pw(u,Math.pow(10,o)-1,!0),d+(l[0]||(l[1]?"":"0"))+" "+(l[1]?mE(l[1],o)+s[2]+"/"+s[3]+Ew(l[2],o):ei(" ",2*o+1+s[2].length+s[3].length));if(s=t.match(/^[#0?]+$/))return a=Ap(r,0),t.length<=a.length?a:no(t.substr(0,t.length-a.length))+a;if(s=t.match(/^([#0?]+)\.([#0]+)$/)){a=""+r.toFixed(Math.min(s[2].length,10)).replace(/([^0])0+$/,"$1"),o=a.indexOf(".");var m=t.indexOf(".")-o,g=t.length-a.length-m;return no(t.substr(0,m)+a+t.substr(t.length-g))}if(s=t.match(/^00,000\.([#0]*0)$/))return o=HF(r,s[1].length),r<0?"-"+Rl(e,t,-r):mh(KAe(r)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(y){return"00,"+(y.length<3?_c(0,3-y.length):"")+y})+"."+_c(o,s[1].length);switch(t){case"###,##0.00":return Rl(e,"#,##0.00",r);case"###,###":case"##,###":case"#,###":var x=mh(Ap(u,0));return x!=="0"?d+x:"";case"###,###.00":return Rl(e,"###,##0.00",r).replace(/^0\./,".");case"#,###.00":return Rl(e,"#,##0.00",r).replace(/^0\./,".")}throw new Error("unsupported format |"+t+"|")}function XAe(e,t,r){for(var n=t.length-1;t.charCodeAt(n-1)===44;)--n;return Yd(e,t.substr(0,n),r/Math.pow(10,3*(t.length-n)))}function ZAe(e,t,r){var n=t.replace(rG,""),a=t.length-n.length;return Yd(e,n,r*Math.pow(10,2*a))+ei("%",a)}function lG(e,t){var r,n=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(t==0)return"0.0E+0";if(t<0)return"-"+lG(e,-t);var a=e.indexOf(".");a===-1&&(a=e.indexOf("E"));var s=Math.floor(Math.log(t)*Math.LOG10E)%a;if(s<0&&(s+=a),r=(t/Math.pow(10,s)).toPrecision(n+1+(a+s)%a),!r.match(/[Ee]/)){var o=Math.floor(Math.log(t)*Math.LOG10E);r.indexOf(".")===-1?r=r.charAt(0)+"."+r.substr(1)+"E+"+(o-r.length+s):r+="E+"+(o-s),r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(l,u,d,f){return u+d+f.substr(0,(a+s)%a)+"."+f.substr(s)+"E"})}else r=t.toExponential(n);return e.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),e.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}function Su(e,t,r){if(e.charCodeAt(0)===40&&!t.match(sG)){var n=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?Su("n",n,r):"("+Su("n",n,-r)+")"}if(t.charCodeAt(t.length-1)===44)return XAe(e,t,r);if(t.indexOf("%")!==-1)return ZAe(e,t,r);if(t.indexOf("E")!==-1)return lG(t,r);if(t.charCodeAt(0)===36)return"$"+Su(e,t.substr(t.charAt(1)==" "?2:1),r);var a,s,o,l,u=Math.abs(r),d=r<0?"-":"";if(t.match(/^00+$/))return d+_c(u,t.length);if(t.match(/^[#?]+$/))return a=""+r,r===0&&(a=""),a.length>t.length?a:no(t.substr(0,t.length-a.length))+a;if(s=t.match(aG))return GAe(s,u,d);if(t.match(/^#+0+$/))return d+_c(u,t.length-t.indexOf("0"));if(s=t.match(iG))return a=(""+r).replace(/^([^\.]+)$/,"$1."+no(s[1])).replace(/\.$/,"."+no(s[1])),a=a.replace(/\.(\d*)$/,function(y,v){return"."+v+ei("0",no(s[1]).length-v.length)}),t.indexOf("0.")!==-1?a:a.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),s=t.match(/^(0*)\.(#*)$/))return d+(""+u).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,s[1].length?"0.":".");if(s=t.match(/^#{1,3},##0(\.?)$/))return d+mh(""+u);if(s=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+Su(e,t,-r):mh(""+r)+"."+ei("0",s[1].length);if(s=t.match(/^#,#*,#0/))return Su(e,t.replace(/^#,#*,/,""),r);if(s=t.match(/^([0#]+)(\\?-([0#]+))+$/))return a=Zp(Su(e,t.replace(/[\\-]/g,""),r)),o=0,Zp(Zp(t.replace(/\\/g,"")).replace(/[0#]/g,function(y){return o<a.length?a.charAt(o++):y==="0"?"0":""}));if(t.match(oG))return a=Su(e,"##########",r),"("+a.substr(0,3)+") "+a.substr(3,3)+"-"+a.substr(6);var f="";if(s=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return o=Math.min(s[4].length,7),l=Pw(u,Math.pow(10,o)-1,!1),a=""+d,f=Yd("n",s[1],l[1]),f.charAt(f.length-1)==" "&&(f=f.substr(0,f.length-1)+"0"),a+=f+s[2]+"/"+s[3],f=Ew(l[2],o),f.length<s[4].length&&(f=no(s[4].substr(s[4].length-f.length))+f),a+=f,a;if(s=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return o=Math.min(Math.max(s[1].length,s[4].length),7),l=Pw(u,Math.pow(10,o)-1,!0),d+(l[0]||(l[1]?"":"0"))+" "+(l[1]?mE(l[1],o)+s[2]+"/"+s[3]+Ew(l[2],o):ei(" ",2*o+1+s[2].length+s[3].length));if(s=t.match(/^[#0?]+$/))return a=""+r,t.length<=a.length?a:no(t.substr(0,t.length-a.length))+a;if(s=t.match(/^([#0]+)\.([#0]+)$/)){a=""+r.toFixed(Math.min(s[2].length,10)).replace(/([^0])0+$/,"$1"),o=a.indexOf(".");var m=t.indexOf(".")-o,g=t.length-a.length-m;return no(t.substr(0,m)+a+t.substr(t.length-g))}if(s=t.match(/^00,000\.([#0]*0)$/))return r<0?"-"+Su(e,t,-r):mh(""+r).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(y){return"00,"+(y.length<3?_c(0,3-y.length):"")+y})+"."+_c(0,s[1].length);switch(t){case"###,###":case"##,###":case"#,###":var x=mh(""+u);return x!=="0"?d+x:"";default:if(t.match(/\.[0#?]*$/))return Su(e,t.slice(0,t.lastIndexOf(".")),r)+no(t.slice(t.lastIndexOf(".")))}throw new Error("unsupported format |"+t+"|")}function Yd(e,t,r){return(r|0)===r?Su(e,t,r):Rl(e,t,r)}function JAe(e){for(var t=[],r=!1,n=0,a=0;n<e.length;++n)switch(e.charCodeAt(n)){case 34:r=!r;break;case 95:case 42:case 92:++n;break;case 59:t[t.length]=e.substr(a,n-a),a=n+1}if(t[t.length]=e.substr(a),r===!0)throw new Error("Format |"+e+"| unterminated string ");return t}var cG=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function Ix(e){for(var t=0,r="",n="";t<e.length;)switch(r=e.charAt(t)){case"G":Tw(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(n=r;e.charAt(t++)!=="]"&&t<e.length;)n+=e.charAt(t);if(n.match(cG))return!0;break;case".":case"0":case"#":for(;t<e.length&&("0#?.,E+-%".indexOf(r=e.charAt(++t))>-1||r=="\\"&&e.charAt(t+1)=="-"&&"0#".indexOf(e.charAt(t+2))>-1););break;case"?":for(;e.charAt(++t)===r;);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 QAe(e,t,r,n){for(var a=[],s="",o=0,l="",u="t",d,f,m,g="H";o<e.length;)switch(l=e.charAt(o)){case"G":if(!Tw(e,o))throw new Error("unrecognized character "+l+" in "+e);a[a.length]={t:"G",v:"General"},o+=7;break;case'"':for(s="";(m=e.charCodeAt(++o))!==34&&o<e.length;)s+=String.fromCharCode(m);a[a.length]={t:"t",v:s},++o;break;case"\\":var x=e.charAt(++o),y=x==="("||x===")"?x:"t";a[a.length]={t:y,v:x},++o;break;case"_":a[a.length]={t:"t",v:" "},o+=2;break;case"@":a[a.length]={t:"T",v:t},++o;break;case"B":case"b":if(e.charAt(o+1)==="1"||e.charAt(o+1)==="2"){if(d==null&&(d=Lm(t,r,e.charAt(o+1)==="2"),d==null))return"";a[a.length]={t:"X",v:e.substr(o,2)},u=l,o+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":l=l.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if(t<0||d==null&&(d=Lm(t,r),d==null))return"";for(s=l;++o<e.length&&e.charAt(o).toLowerCase()===l;)s+=l;l==="m"&&u.toLowerCase()==="h"&&(l="M"),l==="h"&&(l=g),a[a.length]={t:l,v:s},u=l;break;case"A":case"a":case"上":var v={t:l,v:l};if(d==null&&(d=Lm(t,r)),e.substr(o,3).toUpperCase()==="A/P"?(d!=null&&(v.v=d.H>=12?"P":"A"),v.t="T",g="h",o+=3):e.substr(o,5).toUpperCase()==="AM/PM"?(d!=null&&(v.v=d.H>=12?"PM":"AM"),v.t="T",o+=5,g="h"):e.substr(o,5).toUpperCase()==="上午/下午"?(d!=null&&(v.v=d.H>=12?"下午":"上午"),v.t="T",o+=5,g="h"):(v.t="t",++o),d==null&&v.t==="T")return"";a[a.length]=v,u=l;break;case"[":for(s=l;e.charAt(o++)!=="]"&&o<e.length;)s+=e.charAt(o);if(s.slice(-1)!=="]")throw'unterminated "[" block: |'+s+"|";if(s.match(cG)){if(d==null&&(d=Lm(t,r),d==null))return"";a[a.length]={t:"Z",v:s.toLowerCase()},u=s.charAt(1)}else s.indexOf("$")>-1&&(s=(s.match(/\$([^-\[\]]*)/)||[])[1]||"$",Ix(e)||(a[a.length]={t:"t",v:s}));break;case".":if(d!=null){for(s=l;++o<e.length&&(l=e.charAt(o))==="0";)s+=l;a[a.length]={t:"s",v:s};break}case"0":case"#":for(s=l;++o<e.length&&"0#?.,E+-%".indexOf(l=e.charAt(o))>-1;)s+=l;a[a.length]={t:"n",v:s};break;case"?":for(s=l;e.charAt(++o)===l;)s+=l;a[a.length]={t:l,v:s},u=l;break;case"*":++o,(e.charAt(o)==" "||e.charAt(o)=="*")&&++o;break;case"(":case")":a[a.length]={t:n===1?"t":l,v:l},++o;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(s=l;o<e.length&&"0123456789".indexOf(e.charAt(++o))>-1;)s+=e.charAt(o);a[a.length]={t:"D",v:s};break;case" ":a[a.length]={t:l,v:l},++o;break;case"$":a[a.length]={t:"t",v:"$"},++o;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(l)===-1)throw new Error("unrecognized character "+l+" in "+e);a[a.length]={t:"t",v:l},++o;break}var w=0,j=0,k;for(o=a.length-1,u="t";o>=0;--o)switch(a[o].t){case"h":case"H":a[o].t=g,u="h",w<1&&(w=1);break;case"s":(k=a[o].v.match(/\.0+$/))&&(j=Math.max(j,k[0].length-1)),w<3&&(w=3);case"d":case"y":case"M":case"e":u=a[o].t;break;case"m":u==="s"&&(a[o].t="M",w<2&&(w=2));break;case"X":break;case"Z":w<1&&a[o].v.match(/[Hh]/)&&(w=1),w<2&&a[o].v.match(/[Mm]/)&&(w=2),w<3&&a[o].v.match(/[Ss]/)&&(w=3)}switch(w){case 0:break;case 1:d.u>=.5&&(d.u=0,++d.S),d.S>=60&&(d.S=0,++d.M),d.M>=60&&(d.M=0,++d.H);break;case 2:d.u>=.5&&(d.u=0,++d.S),d.S>=60&&(d.S=0,++d.M);break}var A="",T;for(o=0;o<a.length;++o)switch(a[o].t){case"t":case"T":case" ":case"D":break;case"X":a[o].v="",a[o].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":a[o].v=HAe(a[o].t.charCodeAt(0),a[o].v,d,j),a[o].t="t";break;case"n":case"?":for(T=o+1;a[T]!=null&&((l=a[T].t)==="?"||l==="D"||(l===" "||l==="t")&&a[T+1]!=null&&(a[T+1].t==="?"||a[T+1].t==="t"&&a[T+1].v==="/")||a[o].t==="("&&(l===" "||l==="n"||l===")")||l==="t"&&(a[T].v==="/"||a[T].v===" "&&a[T+1]!=null&&a[T+1].t=="?"));)a[o].v+=a[T].v,a[T]={v:"",t:";"},++T;A+=a[o].v,o=T-1;break;case"G":a[o].t="t",a[o].v=c0(t,r);break}var M="",B,L;if(A.length>0){A.charCodeAt(0)==40?(B=t<0&&A.charCodeAt(0)===45?-t:t,L=Yd("n",A,B)):(B=t<0&&n>1?-t:t,L=Yd("n",A,B),B<0&&a[0]&&a[0].t=="t"&&(L=L.substr(1),a[0].v="-"+a[0].v)),T=L.length-1;var F=a.length;for(o=0;o<a.length;++o)if(a[o]!=null&&a[o].t!="t"&&a[o].v.indexOf(".")>-1){F=o;break}var I=a.length;if(F===a.length&&L.indexOf("E")===-1){for(o=a.length-1;o>=0;--o)a[o]==null||"n?".indexOf(a[o].t)===-1||(T>=a[o].v.length-1?(T-=a[o].v.length,a[o].v=L.substr(T+1,a[o].v.length)):T<0?a[o].v="":(a[o].v=L.substr(0,T+1),T=-1),a[o].t="t",I=o);T>=0&&I<a.length&&(a[I].v=L.substr(0,T+1)+a[I].v)}else if(F!==a.length&&L.indexOf("E")===-1){for(T=L.indexOf(".")-1,o=F;o>=0;--o)if(!(a[o]==null||"n?".indexOf(a[o].t)===-1)){for(f=a[o].v.indexOf(".")>-1&&o===F?a[o].v.indexOf(".")-1:a[o].v.length-1,M=a[o].v.substr(f+1);f>=0;--f)T>=0&&(a[o].v.charAt(f)==="0"||a[o].v.charAt(f)==="#")&&(M=L.charAt(T--)+M);a[o].v=M,a[o].t="t",I=o}for(T>=0&&I<a.length&&(a[I].v=L.substr(0,T+1)+a[I].v),T=L.indexOf(".")+1,o=F;o<a.length;++o)if(!(a[o]==null||"n?(".indexOf(a[o].t)===-1&&o!==F)){for(f=a[o].v.indexOf(".")>-1&&o===F?a[o].v.indexOf(".")+1:0,M=a[o].v.substr(0,f);f<a[o].v.length;++f)T<L.length&&(M+=L.charAt(T++));a[o].v=M,a[o].t="t",I=o}}}for(o=0;o<a.length;++o)a[o]!=null&&"n?".indexOf(a[o].t)>-1&&(B=n>1&&t<0&&o>0&&a[o-1].v==="-"?-t:t,a[o].v=Yd(a[o].t,a[o].v,B),a[o].t="t");var q="";for(o=0;o!==a.length;++o)a[o]!=null&&(q+=a[o].v);return q}var VF=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function qF(e,t){if(t==null)return!1;var r=parseFloat(t[2]);switch(t[1]){case"=":if(e==r)return!0;break;case">":if(e>r)return!0;break;case"<":if(e<r)return!0;break;case"<>":if(e!=r)return!0;break;case">=":if(e>=r)return!0;break;case"<=":if(e<=r)return!0;break}return!1}function eke(e,t){var r=JAe(e),n=r.length,a=r[n-1].indexOf("@");if(n<4&&a>-1&&--n,r.length>4)throw new Error("cannot find right format for |"+r.join("|")+"|");if(typeof t!="number")return[4,r.length===4||a>-1?r[r.length-1]:"@"];switch(r.length){case 1:r=a>-1?["General","General","General",r[0]]:[r[0],r[0],r[0],"@"];break;case 2:r=a>-1?[r[0],r[0],r[0],r[1]]:[r[0],r[1],r[0],"@"];break;case 3:r=a>-1?[r[0],r[1],r[0],r[2]]:[r[0],r[1],r[2],"@"];break}var s=t>0?r[0]:t<0?r[1]:r[2];if(r[0].indexOf("[")===-1&&r[1].indexOf("[")===-1)return[n,s];if(r[0].match(/\[[=<>]/)!=null||r[1].match(/\[[=<>]/)!=null){var o=r[0].match(VF),l=r[1].match(VF);return qF(t,o)?[n,r[0]]:qF(t,l)?[n,r[1]]:[n,r[o!=null&&l!=null?2:1]]}return[n,s]}function Xl(e,t,r){r==null&&(r={});var n="";switch(typeof e){case"string":e=="m/d/yy"&&r.dateNF?n=r.dateNF:n=e;break;case"number":e==14&&r.dateNF?n=r.dateNF:n=(r.table!=null?r.table:Cr)[e],n==null&&(n=r.table&&r.table[UF[e]]||Cr[UF[e]]),n==null&&(n=LAe[e]||"General");break}if(Tw(n,0))return c0(t,r);t instanceof Date&&(t=tG(t,r.date1904));var a=eke(n,t);if(Tw(a[1]))return c0(t,r);if(t===!0)t="TRUE";else if(t===!1)t="FALSE";else if(t===""||t==null)return"";return QAe(a[1],t,r,a[0])}function Kd(e,t){if(typeof t!="number"){t=+t||-1;for(var r=0;r<392;++r){if(Cr[r]==null){t<0&&(t=r);continue}if(Cr[r]==e){t=r;break}}t<0&&(t=391)}return Cr[t]=e,t}function K5(e){for(var t=0;t!=392;++t)e[t]!==void 0&&Kd(e[t],t)}function Fx(){Cr=MAe()}var tke={5:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',23:"General",24:"General",25:"General",26:"General",27:"m/d/yy",28:"m/d/yy",29:"m/d/yy",30:"m/d/yy",31:"m/d/yy",32:"h:mm:ss",33:"h:mm:ss",34:"h:mm:ss",35:"h:mm:ss",36:"m/d/yy",41:'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',50:"m/d/yy",51:"m/d/yy",52:"m/d/yy",53:"m/d/yy",54:"m/d/yy",55:"m/d/yy",56:"m/d/yy",57:"m/d/yy",58:"m/d/yy",59:"0",60:"0.00",61:"#,##0",62:"#,##0.00",63:'"$"#,##0_);\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',67:"0%",68:"0.00%",69:"# ?/?",70:"# ??/??",71:"m/d/yy",72:"m/d/yy",73:"d-mmm-yy",74:"d-mmm",75:"mmm-yy",76:"h:mm",77:"h:mm:ss",78:"m/d/yy h:mm",79:"mm:ss",80:"[h]:mm:ss",81:"mmss.0"},uG=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function rke(e){var t=typeof e=="number"?Cr[e]:e;return t=t.replace(uG,"(\\d+)"),new RegExp("^"+t+"$")}function nke(e,t,r){var n=-1,a=-1,s=-1,o=-1,l=-1,u=-1;(t.match(uG)||[]).forEach(function(m,g){var x=parseInt(r[g+1],10);switch(m.toLowerCase().charAt(0)){case"y":n=x;break;case"d":s=x;break;case"h":o=x;break;case"s":u=x;break;case"m":o>=0?l=x:a=x;break}}),u>=0&&l==-1&&a>=0&&(l=a,a=-1);var d=(""+(n>=0?n:new Date().getFullYear())).slice(-4)+"-"+("00"+(a>=1?a:1)).slice(-2)+"-"+("00"+(s>=1?s:1)).slice(-2);d.length==7&&(d="0"+d),d.length==8&&(d="20"+d);var f=("00"+(o>=0?o:0)).slice(-2)+":"+("00"+(l>=0?l:0)).slice(-2)+":"+("00"+(u>=0?u:0)).slice(-2);return o==-1&&l==-1&&u==-1?d:n==-1&&a==-1&&s==-1?f:d+"T"+f}var ake=(function(){var e={};e.version="1.2.0";function t(){for(var L=0,F=new Array(256),I=0;I!=256;++I)L=I,L=L&1?-306674912^L>>>1:L>>>1,L=L&1?-306674912^L>>>1:L>>>1,L=L&1?-306674912^L>>>1:L>>>1,L=L&1?-306674912^L>>>1:L>>>1,L=L&1?-306674912^L>>>1:L>>>1,L=L&1?-306674912^L>>>1:L>>>1,L=L&1?-306674912^L>>>1:L>>>1,L=L&1?-306674912^L>>>1:L>>>1,F[I]=L;return typeof Int32Array<"u"?new Int32Array(F):F}var r=t();function n(L){var F=0,I=0,q=0,P=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(q=0;q!=256;++q)P[q]=L[q];for(q=0;q!=256;++q)for(I=L[q],F=256+q;F<4096;F+=256)I=P[F]=I>>>8^L[I&255];var R=[];for(q=1;q!=16;++q)R[q-1]=typeof Int32Array<"u"?P.subarray(q*256,q*256+256):P.slice(q*256,q*256+256);return R}var a=n(r),s=a[0],o=a[1],l=a[2],u=a[3],d=a[4],f=a[5],m=a[6],g=a[7],x=a[8],y=a[9],v=a[10],w=a[11],j=a[12],k=a[13],A=a[14];function T(L,F){for(var I=F^-1,q=0,P=L.length;q<P;)I=I>>>8^r[(I^L.charCodeAt(q++))&255];return~I}function M(L,F){for(var I=F^-1,q=L.length-15,P=0;P<q;)I=A[L[P++]^I&255]^k[L[P++]^I>>8&255]^j[L[P++]^I>>16&255]^w[L[P++]^I>>>24]^v[L[P++]]^y[L[P++]]^x[L[P++]]^g[L[P++]]^m[L[P++]]^f[L[P++]]^d[L[P++]]^u[L[P++]]^l[L[P++]]^o[L[P++]]^s[L[P++]]^r[L[P++]];for(q+=15;P<q;)I=I>>>8^r[(I^L[P++])&255];return~I}function B(L,F){for(var I=F^-1,q=0,P=L.length,R=0,K=0;q<P;)R=L.charCodeAt(q++),R<128?I=I>>>8^r[(I^R)&255]:R<2048?(I=I>>>8^r[(I^(192|R>>6&31))&255],I=I>>>8^r[(I^(128|R&63))&255]):R>=55296&&R<57344?(R=(R&1023)+64,K=L.charCodeAt(q++)&1023,I=I>>>8^r[(I^(240|R>>8&7))&255],I=I>>>8^r[(I^(128|R>>2&63))&255],I=I>>>8^r[(I^(128|K>>6&15|(R&3)<<4))&255],I=I>>>8^r[(I^(128|K&63))&255]):(I=I>>>8^r[(I^(224|R>>12&15))&255],I=I>>>8^r[(I^(128|R>>6&63))&255],I=I>>>8^r[(I^(128|R&63))&255]);return~I}return e.table=r,e.bstr=T,e.buf=M,e.str=B,e})(),br=(function(){var t={};t.version="1.2.1";function r(ye,Ie){for(var Ee=ye.split("/"),Te=Ie.split("/"),Re=0,ze=0,ct=Math.min(Ee.length,Te.length);Re<ct;++Re){if(ze=Ee[Re].length-Te[Re].length)return ze;if(Ee[Re]!=Te[Re])return Ee[Re]<Te[Re]?-1:1}return Ee.length-Te.length}function n(ye){if(ye.charAt(ye.length-1)=="/")return ye.slice(0,-1).indexOf("/")===-1?ye:n(ye.slice(0,-1));var Ie=ye.lastIndexOf("/");return Ie===-1?ye:ye.slice(0,Ie+1)}function a(ye){if(ye.charAt(ye.length-1)=="/")return a(ye.slice(0,-1));var Ie=ye.lastIndexOf("/");return Ie===-1?ye:ye.slice(Ie+1)}function s(ye,Ie){typeof Ie=="string"&&(Ie=new Date(Ie));var Ee=Ie.getHours();Ee=Ee<<6|Ie.getMinutes(),Ee=Ee<<5|Ie.getSeconds()>>>1,ye.write_shift(2,Ee);var Te=Ie.getFullYear()-1980;Te=Te<<4|Ie.getMonth()+1,Te=Te<<5|Ie.getDate(),ye.write_shift(2,Te)}function o(ye){var Ie=ye.read_shift(2)&65535,Ee=ye.read_shift(2)&65535,Te=new Date,Re=Ee&31;Ee>>>=5;var ze=Ee&15;Ee>>>=4,Te.setMilliseconds(0),Te.setFullYear(Ee+1980),Te.setMonth(ze-1),Te.setDate(Re);var ct=Ie&31;Ie>>>=5;var bt=Ie&63;return Ie>>>=6,Te.setHours(Ie),Te.setMinutes(bt),Te.setSeconds(ct<<1),Te}function l(ye){_s(ye,0);for(var Ie={},Ee=0;ye.l<=ye.length-4;){var Te=ye.read_shift(2),Re=ye.read_shift(2),ze=ye.l+Re,ct={};switch(Te){case 21589:Ee=ye.read_shift(1),Ee&1&&(ct.mtime=ye.read_shift(4)),Re>5&&(Ee&2&&(ct.atime=ye.read_shift(4)),Ee&4&&(ct.ctime=ye.read_shift(4))),ct.mtime&&(ct.mt=new Date(ct.mtime*1e3));break}ye.l=ze,Ie[Te]=ct}return Ie}var u;function d(){return u||(u={})}function f(ye,Ie){if(ye[0]==80&&ye[1]==75)return _t(ye,Ie);if((ye[0]|32)==109&&(ye[1]|32)==105)return Ht(ye,Ie);if(ye.length<512)throw new Error("CFB file size "+ye.length+" < 512");var Ee=3,Te=512,Re=0,ze=0,ct=0,bt=0,dt=0,ft=[],mt=ye.slice(0,512);_s(mt,0);var Lt=m(mt);switch(Ee=Lt[0],Ee){case 3:Te=512;break;case 4:Te=4096;break;case 0:if(Lt[1]==0)return _t(ye,Ie);default:throw new Error("Major Version: Expected 3 or 4 saw "+Ee)}Te!==512&&(mt=ye.slice(0,Te),_s(mt,28));var Vt=ye.slice(0,Te);g(mt,Ee);var Xt=mt.read_shift(4,"i");if(Ee===3&&Xt!==0)throw new Error("# Directory Sectors: Expected 0 saw "+Xt);mt.l+=4,ct=mt.read_shift(4,"i"),mt.l+=4,mt.chk("00100000","Mini Stream Cutoff Size: "),bt=mt.read_shift(4,"i"),Re=mt.read_shift(4,"i"),dt=mt.read_shift(4,"i"),ze=mt.read_shift(4,"i");for(var $t=-1,Gt=0;Gt<109&&($t=mt.read_shift(4,"i"),!($t<0));++Gt)ft[Gt]=$t;var er=x(ye,Te);w(dt,ze,er,Te,ft);var An=k(er,ct,ft,Te);An[ct].name="!Directory",Re>0&&bt!==K&&(An[bt].name="!MiniFAT"),An[ft[0]].name="!FAT",An.fat_addrs=ft,An.ssz=Te;var Wr={},Pn=[],xs=[],Vo=[];A(ct,An,er,Pn,Re,Wr,xs,bt),y(xs,Vo,Pn),Pn.shift();var qo={FileIndex:xs,FullPaths:Vo};return Ie&&Ie.raw&&(qo.raw={header:Vt,sectors:er}),qo}function m(ye){if(ye[ye.l]==80&&ye[ye.l+1]==75)return[0,0];ye.chk(ee,"Header Signature: "),ye.l+=16;var Ie=ye.read_shift(2,"u");return[ye.read_shift(2,"u"),Ie]}function g(ye,Ie){var Ee=9;switch(ye.l+=2,Ee=ye.read_shift(2)){case 9:if(Ie!=3)throw new Error("Sector Shift: Expected 9 saw "+Ee);break;case 12:if(Ie!=4)throw new Error("Sector Shift: Expected 12 saw "+Ee);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+Ee)}ye.chk("0600","Mini Sector Shift: "),ye.chk("000000000000","Reserved: ")}function x(ye,Ie){for(var Ee=Math.ceil(ye.length/Ie)-1,Te=[],Re=1;Re<Ee;++Re)Te[Re-1]=ye.slice(Re*Ie,(Re+1)*Ie);return Te[Ee-1]=ye.slice(Ee*Ie),Te}function y(ye,Ie,Ee){for(var Te=0,Re=0,ze=0,ct=0,bt=0,dt=Ee.length,ft=[],mt=[];Te<dt;++Te)ft[Te]=mt[Te]=Te,Ie[Te]=Ee[Te];for(;bt<mt.length;++bt)Te=mt[bt],Re=ye[Te].L,ze=ye[Te].R,ct=ye[Te].C,ft[Te]===Te&&(Re!==-1&&ft[Re]!==Re&&(ft[Te]=ft[Re]),ze!==-1&&ft[ze]!==ze&&(ft[Te]=ft[ze])),ct!==-1&&(ft[ct]=Te),Re!==-1&&Te!=ft[Te]&&(ft[Re]=ft[Te],mt.lastIndexOf(Re)<bt&&mt.push(Re)),ze!==-1&&Te!=ft[Te]&&(ft[ze]=ft[Te],mt.lastIndexOf(ze)<bt&&mt.push(ze));for(Te=1;Te<dt;++Te)ft[Te]===Te&&(ze!==-1&&ft[ze]!==ze?ft[Te]=ft[ze]:Re!==-1&&ft[Re]!==Re&&(ft[Te]=ft[Re]));for(Te=1;Te<dt;++Te)if(ye[Te].type!==0){if(bt=Te,bt!=ft[bt])do bt=ft[bt],Ie[Te]=Ie[bt]+"/"+Ie[Te];while(bt!==0&&ft[bt]!==-1&&bt!=ft[bt]);ft[Te]=-1}for(Ie[0]+="/",Te=1;Te<dt;++Te)ye[Te].type!==2&&(Ie[Te]+="/")}function v(ye,Ie,Ee){for(var Te=ye.start,Re=ye.size,ze=[],ct=Te;Ee&&Re>0&&ct>=0;)ze.push(Ie.slice(ct*R,ct*R+R)),Re-=R,ct=_m(Ee,ct*4);return ze.length===0?St(0):os(ze).slice(0,ye.size)}function w(ye,Ie,Ee,Te,Re){var ze=K;if(ye===K){if(Ie!==0)throw new Error("DIFAT chain shorter than expected")}else if(ye!==-1){var ct=Ee[ye],bt=(Te>>>2)-1;if(!ct)return;for(var dt=0;dt<bt&&(ze=_m(ct,dt*4))!==K;++dt)Re.push(ze);w(_m(ct,Te-4),Ie-1,Ee,Te,Re)}}function j(ye,Ie,Ee,Te,Re){var ze=[],ct=[];Re||(Re=[]);var bt=Te-1,dt=0,ft=0;for(dt=Ie;dt>=0;){Re[dt]=!0,ze[ze.length]=dt,ct.push(ye[dt]);var mt=Ee[Math.floor(dt*4/Te)];if(ft=dt*4&bt,Te<4+ft)throw new Error("FAT boundary crossed: "+dt+" 4 "+Te);if(!ye[mt])break;dt=_m(ye[mt],ft)}return{nodes:ze,data:n7([ct])}}function k(ye,Ie,Ee,Te){var Re=ye.length,ze=[],ct=[],bt=[],dt=[],ft=Te-1,mt=0,Lt=0,Vt=0,Xt=0;for(mt=0;mt<Re;++mt)if(bt=[],Vt=mt+Ie,Vt>=Re&&(Vt-=Re),!ct[Vt]){dt=[];var $t=[];for(Lt=Vt;Lt>=0;){$t[Lt]=!0,ct[Lt]=!0,bt[bt.length]=Lt,dt.push(ye[Lt]);var Gt=Ee[Math.floor(Lt*4/Te)];if(Xt=Lt*4&ft,Te<4+Xt)throw new Error("FAT boundary crossed: "+Lt+" 4 "+Te);if(!ye[Gt]||(Lt=_m(ye[Gt],Xt),$t[Lt]))break}ze[Vt]={nodes:bt,data:n7([dt])}}return ze}function A(ye,Ie,Ee,Te,Re,ze,ct,bt){for(var dt=0,ft=Te.length?2:0,mt=Ie[ye].data,Lt=0,Vt=0,Xt;Lt<mt.length;Lt+=128){var $t=mt.slice(Lt,Lt+128);_s($t,64),Vt=$t.read_shift(2),Xt=jE($t,0,Vt-ft),Te.push(Xt);var Gt={name:Xt,type:$t.read_shift(1),color:$t.read_shift(1),L:$t.read_shift(4,"i"),R:$t.read_shift(4,"i"),C:$t.read_shift(4,"i"),clsid:$t.read_shift(16),state:$t.read_shift(4,"i"),start:0,size:0},er=$t.read_shift(2)+$t.read_shift(2)+$t.read_shift(2)+$t.read_shift(2);er!==0&&(Gt.ct=T($t,$t.l-8));var An=$t.read_shift(2)+$t.read_shift(2)+$t.read_shift(2)+$t.read_shift(2);An!==0&&(Gt.mt=T($t,$t.l-8)),Gt.start=$t.read_shift(4,"i"),Gt.size=$t.read_shift(4,"i"),Gt.size<0&&Gt.start<0&&(Gt.size=Gt.type=0,Gt.start=K,Gt.name=""),Gt.type===5?(dt=Gt.start,Re>0&&dt!==K&&(Ie[dt].name="!StreamData")):Gt.size>=4096?(Gt.storage="fat",Ie[Gt.start]===void 0&&(Ie[Gt.start]=j(Ee,Gt.start,Ie.fat_addrs,Ie.ssz)),Ie[Gt.start].name=Gt.name,Gt.content=Ie[Gt.start].data.slice(0,Gt.size)):(Gt.storage="minifat",Gt.size<0?Gt.size=0:dt!==K&&Gt.start!==K&&Ie[dt]&&(Gt.content=v(Gt,Ie[dt].data,(Ie[bt]||{}).data))),Gt.content&&_s(Gt.content,0),ze[Xt]=Gt,ct.push(Gt)}}function T(ye,Ie){return new Date((ol(ye,Ie+4)/1e7*Math.pow(2,32)+ol(ye,Ie)/1e7-11644473600)*1e3)}function M(ye,Ie){return d(),f(u.readFileSync(ye),Ie)}function B(ye,Ie){var Ee=Ie&&Ie.type;switch(Ee||Yr&&Buffer.isBuffer(ye)&&(Ee="buffer"),Ee||"base64"){case"file":return M(ye,Ie);case"base64":return f(cl(vl(ye)),Ie);case"binary":return f(cl(ye),Ie)}return f(ye,Ie)}function L(ye,Ie){var Ee=Ie||{},Te=Ee.root||"Root Entry";if(ye.FullPaths||(ye.FullPaths=[]),ye.FileIndex||(ye.FileIndex=[]),ye.FullPaths.length!==ye.FileIndex.length)throw new Error("inconsistent CFB structure");ye.FullPaths.length===0&&(ye.FullPaths[0]=Te+"/",ye.FileIndex[0]={name:Te,type:5}),Ee.CLSID&&(ye.FileIndex[0].clsid=Ee.CLSID),F(ye)}function F(ye){var Ie="Sh33tJ5";if(!br.find(ye,"/"+Ie)){var Ee=St(4);Ee[0]=55,Ee[1]=Ee[3]=50,Ee[2]=54,ye.FileIndex.push({name:Ie,type:2,content:Ee,size:4,L:69,R:69,C:69}),ye.FullPaths.push(ye.FullPaths[0]+Ie),I(ye)}}function I(ye,Ie){L(ye);for(var Ee=!1,Te=!1,Re=ye.FullPaths.length-1;Re>=0;--Re){var ze=ye.FileIndex[Re];switch(ze.type){case 0:Te?Ee=!0:(ye.FileIndex.pop(),ye.FullPaths.pop());break;case 1:case 2:case 5:Te=!0,isNaN(ze.R*ze.L*ze.C)&&(Ee=!0),ze.R>-1&&ze.L>-1&&ze.R==ze.L&&(Ee=!0);break;default:Ee=!0;break}}if(!(!Ee&&!Ie)){var ct=new Date(1987,1,19),bt=0,dt=Object.create?Object.create(null):{},ft=[];for(Re=0;Re<ye.FullPaths.length;++Re)dt[ye.FullPaths[Re]]=!0,ye.FileIndex[Re].type!==0&&ft.push([ye.FullPaths[Re],ye.FileIndex[Re]]);for(Re=0;Re<ft.length;++Re){var mt=n(ft[Re][0]);Te=dt[mt],Te||(ft.push([mt,{name:a(mt).replace("/",""),type:1,clsid:Z,ct,mt:ct,content:null}]),dt[mt]=!0)}for(ft.sort(function(Xt,$t){return r(Xt[0],$t[0])}),ye.FullPaths=[],ye.FileIndex=[],Re=0;Re<ft.length;++Re)ye.FullPaths[Re]=ft[Re][0],ye.FileIndex[Re]=ft[Re][1];for(Re=0;Re<ft.length;++Re){var Lt=ye.FileIndex[Re],Vt=ye.FullPaths[Re];if(Lt.name=a(Vt).replace("/",""),Lt.L=Lt.R=Lt.C=-(Lt.color=1),Lt.size=Lt.content?Lt.content.length:0,Lt.start=0,Lt.clsid=Lt.clsid||Z,Re===0)Lt.C=ft.length>1?1:-1,Lt.size=0,Lt.type=5;else if(Vt.slice(-1)=="/"){for(bt=Re+1;bt<ft.length&&n(ye.FullPaths[bt])!=Vt;++bt);for(Lt.C=bt>=ft.length?-1:bt,bt=Re+1;bt<ft.length&&n(ye.FullPaths[bt])!=n(Vt);++bt);Lt.R=bt>=ft.length?-1:bt,Lt.type=1}else n(ye.FullPaths[Re+1]||"")==n(Vt)&&(Lt.R=Re+1),Lt.type=2}}}function q(ye,Ie){var Ee=Ie||{};if(Ee.fileType=="mad")return It(ye,Ee);switch(I(ye),Ee.fileType){case"zip":return Ft(ye,Ee)}var Te=(function(Xt){for(var $t=0,Gt=0,er=0;er<Xt.FileIndex.length;++er){var An=Xt.FileIndex[er];if(An.content){var Wr=An.content.length;Wr>0&&(Wr<4096?$t+=Wr+63>>6:Gt+=Wr+511>>9)}}for(var Pn=Xt.FullPaths.length+3>>2,xs=$t+7>>3,Vo=$t+127>>7,qo=xs+Gt+Pn+Vo,Zs=qo+127>>7,Hc=Zs<=109?0:Math.ceil((Zs-109)/127);qo+Zs+Hc+127>>7>Zs;)Hc=++Zs<=109?0:Math.ceil((Zs-109)/127);var ua=[1,Hc,Zs,Vo,Pn,Gt,$t,0];return Xt.FileIndex[0].size=$t<<6,ua[7]=(Xt.FileIndex[0].start=ua[0]+ua[1]+ua[2]+ua[3]+ua[4]+ua[5])+(ua[6]+7>>3),ua})(ye),Re=St(Te[7]<<9),ze=0,ct=0;{for(ze=0;ze<8;++ze)Re.write_shift(1,se[ze]);for(ze=0;ze<8;++ze)Re.write_shift(2,0);for(Re.write_shift(2,62),Re.write_shift(2,3),Re.write_shift(2,65534),Re.write_shift(2,9),Re.write_shift(2,6),ze=0;ze<3;++ze)Re.write_shift(2,0);for(Re.write_shift(4,0),Re.write_shift(4,Te[2]),Re.write_shift(4,Te[0]+Te[1]+Te[2]+Te[3]-1),Re.write_shift(4,0),Re.write_shift(4,4096),Re.write_shift(4,Te[3]?Te[0]+Te[1]+Te[2]-1:K),Re.write_shift(4,Te[3]),Re.write_shift(-4,Te[1]?Te[0]-1:K),Re.write_shift(4,Te[1]),ze=0;ze<109;++ze)Re.write_shift(-4,ze<Te[2]?Te[1]+ze:-1)}if(Te[1])for(ct=0;ct<Te[1];++ct){for(;ze<236+ct*127;++ze)Re.write_shift(-4,ze<Te[2]?Te[1]+ze:-1);Re.write_shift(-4,ct===Te[1]-1?K:ct+1)}var bt=function(Xt){for(ct+=Xt;ze<ct-1;++ze)Re.write_shift(-4,ze+1);Xt&&(++ze,Re.write_shift(-4,K))};for(ct=ze=0,ct+=Te[1];ze<ct;++ze)Re.write_shift(-4,ne.DIFSECT);for(ct+=Te[2];ze<ct;++ze)Re.write_shift(-4,ne.FATSECT);bt(Te[3]),bt(Te[4]);for(var dt=0,ft=0,mt=ye.FileIndex[0];dt<ye.FileIndex.length;++dt)mt=ye.FileIndex[dt],mt.content&&(ft=mt.content.length,!(ft<4096)&&(mt.start=ct,bt(ft+511>>9)));for(bt(Te[6]+7>>3);Re.l&511;)Re.write_shift(-4,ne.ENDOFCHAIN);for(ct=ze=0,dt=0;dt<ye.FileIndex.length;++dt)mt=ye.FileIndex[dt],mt.content&&(ft=mt.content.length,!(!ft||ft>=4096)&&(mt.start=ct,bt(ft+63>>6)));for(;Re.l&511;)Re.write_shift(-4,ne.ENDOFCHAIN);for(ze=0;ze<Te[4]<<2;++ze){var Lt=ye.FullPaths[ze];if(!Lt||Lt.length===0){for(dt=0;dt<17;++dt)Re.write_shift(4,0);for(dt=0;dt<3;++dt)Re.write_shift(4,-1);for(dt=0;dt<12;++dt)Re.write_shift(4,0);continue}mt=ye.FileIndex[ze],ze===0&&(mt.start=mt.size?mt.start-1:K);var Vt=ze===0&&Ee.root||mt.name;if(ft=2*(Vt.length+1),Re.write_shift(64,Vt,"utf16le"),Re.write_shift(2,ft),Re.write_shift(1,mt.type),Re.write_shift(1,mt.color),Re.write_shift(-4,mt.L),Re.write_shift(-4,mt.R),Re.write_shift(-4,mt.C),mt.clsid)Re.write_shift(16,mt.clsid,"hex");else for(dt=0;dt<4;++dt)Re.write_shift(4,0);Re.write_shift(4,mt.state||0),Re.write_shift(4,0),Re.write_shift(4,0),Re.write_shift(4,0),Re.write_shift(4,0),Re.write_shift(4,mt.start),Re.write_shift(4,mt.size),Re.write_shift(4,0)}for(ze=1;ze<ye.FileIndex.length;++ze)if(mt=ye.FileIndex[ze],mt.size>=4096)if(Re.l=mt.start+1<<9,Yr&&Buffer.isBuffer(mt.content))mt.content.copy(Re,Re.l,0,mt.size),Re.l+=mt.size+511&-512;else{for(dt=0;dt<mt.size;++dt)Re.write_shift(1,mt.content[dt]);for(;dt&511;++dt)Re.write_shift(1,0)}for(ze=1;ze<ye.FileIndex.length;++ze)if(mt=ye.FileIndex[ze],mt.size>0&&mt.size<4096)if(Yr&&Buffer.isBuffer(mt.content))mt.content.copy(Re,Re.l,0,mt.size),Re.l+=mt.size+63&-64;else{for(dt=0;dt<mt.size;++dt)Re.write_shift(1,mt.content[dt]);for(;dt&63;++dt)Re.write_shift(1,0)}if(Yr)Re.l=Re.length;else for(;Re.l<Re.length;)Re.write_shift(1,0);return Re}function P(ye,Ie){var Ee=ye.FullPaths.map(function(dt){return dt.toUpperCase()}),Te=Ee.map(function(dt){var ft=dt.split("/");return ft[ft.length-(dt.slice(-1)=="/"?2:1)]}),Re=!1;Ie.charCodeAt(0)===47?(Re=!0,Ie=Ee[0].slice(0,-1)+Ie):Re=Ie.indexOf("/")!==-1;var ze=Ie.toUpperCase(),ct=Re===!0?Ee.indexOf(ze):Te.indexOf(ze);if(ct!==-1)return ye.FileIndex[ct];var bt=!ze.match(Jg);for(ze=ze.replace(uo,""),bt&&(ze=ze.replace(Jg,"!")),ct=0;ct<Ee.length;++ct)if((bt?Ee[ct].replace(Jg,"!"):Ee[ct]).replace(uo,"")==ze||(bt?Te[ct].replace(Jg,"!"):Te[ct]).replace(uo,"")==ze)return ye.FileIndex[ct];return null}var R=64,K=-2,ee="d0cf11e0a1b11ae1",se=[208,207,17,224,161,177,26,225],Z="00000000000000000000000000000000",ne={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:K,FREESECT:-1,HEADER_SIGNATURE:ee,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:Z,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function X(ye,Ie,Ee){d();var Te=q(ye,Ee);u.writeFileSync(Ie,Te)}function le(ye){for(var Ie=new Array(ye.length),Ee=0;Ee<ye.length;++Ee)Ie[Ee]=String.fromCharCode(ye[Ee]);return Ie.join("")}function Ae(ye,Ie){var Ee=q(ye,Ie);switch(Ie&&Ie.type||"buffer"){case"file":return d(),u.writeFileSync(Ie.filename,Ee),Ee;case"binary":return typeof Ee=="string"?Ee:le(Ee);case"base64":return Gv(typeof Ee=="string"?Ee:le(Ee));case"buffer":if(Yr)return Buffer.isBuffer(Ee)?Ee:hf(Ee);case"array":return typeof Ee=="string"?cl(Ee):Ee}return Ee}var ce;function D(ye){try{var Ie=ye.InflateRaw,Ee=new Ie;if(Ee._processChunk(new Uint8Array([3,0]),Ee._finishFlushFlag),Ee.bytesRead)ce=ye;else throw new Error("zlib does not expose bytesRead")}catch(Te){console.error("cannot use native zlib: "+(Te.message||Te))}}function H(ye,Ie){if(!ce)return ot(ye,Ie);var Ee=ce.InflateRaw,Te=new Ee,Re=Te._processChunk(ye.slice(ye.l),Te._finishFlushFlag);return ye.l+=Te.bytesRead,Re}function G(ye){return ce?ce.deflateRawSync(ye):me(ye)}var E=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],re=[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],he=[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 oe(ye){var Ie=(ye<<1|ye<<11)&139536|(ye<<5|ye<<15)&558144;return(Ie>>16|Ie>>8|Ie)&255}for(var z=typeof Uint8Array<"u",fe=z?new Uint8Array(256):[],de=0;de<256;++de)fe[de]=oe(de);function W(ye,Ie){var Ee=fe[ye&255];return Ie<=8?Ee>>>8-Ie:(Ee=Ee<<8|fe[ye>>8&255],Ie<=16?Ee>>>16-Ie:(Ee=Ee<<8|fe[ye>>16&255],Ee>>>24-Ie))}function ae(ye,Ie){var Ee=Ie&7,Te=Ie>>>3;return(ye[Te]|(Ee<=6?0:ye[Te+1]<<8))>>>Ee&3}function _e(ye,Ie){var Ee=Ie&7,Te=Ie>>>3;return(ye[Te]|(Ee<=5?0:ye[Te+1]<<8))>>>Ee&7}function ue(ye,Ie){var Ee=Ie&7,Te=Ie>>>3;return(ye[Te]|(Ee<=4?0:ye[Te+1]<<8))>>>Ee&15}function ke(ye,Ie){var Ee=Ie&7,Te=Ie>>>3;return(ye[Te]|(Ee<=3?0:ye[Te+1]<<8))>>>Ee&31}function $e(ye,Ie){var Ee=Ie&7,Te=Ie>>>3;return(ye[Te]|(Ee<=1?0:ye[Te+1]<<8))>>>Ee&127}function Je(ye,Ie,Ee){var Te=Ie&7,Re=Ie>>>3,ze=(1<<Ee)-1,ct=ye[Re]>>>Te;return Ee<8-Te||(ct|=ye[Re+1]<<8-Te,Ee<16-Te)||(ct|=ye[Re+2]<<16-Te,Ee<24-Te)||(ct|=ye[Re+3]<<24-Te),ct&ze}function Xe(ye,Ie,Ee){var Te=Ie&7,Re=Ie>>>3;return Te<=5?ye[Re]|=(Ee&7)<<Te:(ye[Re]|=Ee<<Te&255,ye[Re+1]=(Ee&7)>>8-Te),Ie+3}function Ne(ye,Ie,Ee){var Te=Ie&7,Re=Ie>>>3;return Ee=(Ee&1)<<Te,ye[Re]|=Ee,Ie+1}function Ye(ye,Ie,Ee){var Te=Ie&7,Re=Ie>>>3;return Ee<<=Te,ye[Re]|=Ee&255,Ee>>>=8,ye[Re+1]=Ee,Ie+8}function at(ye,Ie,Ee){var Te=Ie&7,Re=Ie>>>3;return Ee<<=Te,ye[Re]|=Ee&255,Ee>>>=8,ye[Re+1]=Ee&255,ye[Re+2]=Ee>>>8,Ie+16}function Y(ye,Ie){var Ee=ye.length,Te=2*Ee>Ie?2*Ee:Ie+5,Re=0;if(Ee>=Ie)return ye;if(Yr){var ze=FF(Te);if(ye.copy)ye.copy(ze);else for(;Re<ye.length;++Re)ze[Re]=ye[Re];return ze}else if(z){var ct=new Uint8Array(Te);if(ct.set)ct.set(ye);else for(;Re<Ee;++Re)ct[Re]=ye[Re];return ct}return ye.length=Te,ye}function we(ye){for(var Ie=new Array(ye),Ee=0;Ee<ye;++Ee)Ie[Ee]=0;return Ie}function J(ye,Ie,Ee){var Te=1,Re=0,ze=0,ct=0,bt=0,dt=ye.length,ft=z?new Uint16Array(32):we(32);for(ze=0;ze<32;++ze)ft[ze]=0;for(ze=dt;ze<Ee;++ze)ye[ze]=0;dt=ye.length;var mt=z?new Uint16Array(dt):we(dt);for(ze=0;ze<dt;++ze)ft[Re=ye[ze]]++,Te<Re&&(Te=Re),mt[ze]=0;for(ft[0]=0,ze=1;ze<=Te;++ze)ft[ze+16]=bt=bt+ft[ze-1]<<1;for(ze=0;ze<dt;++ze)bt=ye[ze],bt!=0&&(mt[ze]=ft[bt+16]++);var Lt=0;for(ze=0;ze<dt;++ze)if(Lt=ye[ze],Lt!=0)for(bt=W(mt[ze],Te)>>Te-Lt,ct=(1<<Te+4-Lt)-1;ct>=0;--ct)Ie[bt|ct<<Lt]=Lt&15|ze<<4;return Te}var ve=z?new Uint16Array(512):we(512),Oe=z?new Uint16Array(32):we(32);if(!z){for(var xe=0;xe<512;++xe)ve[xe]=0;for(xe=0;xe<32;++xe)Oe[xe]=0}(function(){for(var ye=[],Ie=0;Ie<32;Ie++)ye.push(5);J(ye,Oe,32);var Ee=[];for(Ie=0;Ie<=143;Ie++)Ee.push(8);for(;Ie<=255;Ie++)Ee.push(9);for(;Ie<=279;Ie++)Ee.push(7);for(;Ie<=287;Ie++)Ee.push(8);J(Ee,ve,288)})();var qe=(function(){for(var Ie=z?new Uint8Array(32768):[],Ee=0,Te=0;Ee<he.length-1;++Ee)for(;Te<he[Ee+1];++Te)Ie[Te]=Ee;for(;Te<32768;++Te)Ie[Te]=29;var Re=z?new Uint8Array(259):[];for(Ee=0,Te=0;Ee<re.length-1;++Ee)for(;Te<re[Ee+1];++Te)Re[Te]=Ee;function ze(bt,dt){for(var ft=0;ft<bt.length;){var mt=Math.min(65535,bt.length-ft),Lt=ft+mt==bt.length;for(dt.write_shift(1,+Lt),dt.write_shift(2,mt),dt.write_shift(2,~mt&65535);mt-- >0;)dt[dt.l++]=bt[ft++]}return dt.l}function ct(bt,dt){for(var ft=0,mt=0,Lt=z?new Uint16Array(32768):[];mt<bt.length;){var Vt=Math.min(65535,bt.length-mt);if(Vt<10){for(ft=Xe(dt,ft,+(mt+Vt==bt.length)),ft&7&&(ft+=8-(ft&7)),dt.l=ft/8|0,dt.write_shift(2,Vt),dt.write_shift(2,~Vt&65535);Vt-- >0;)dt[dt.l++]=bt[mt++];ft=dt.l*8;continue}ft=Xe(dt,ft,+(mt+Vt==bt.length)+2);for(var Xt=0;Vt-- >0;){var $t=bt[mt];Xt=(Xt<<5^$t)&32767;var Gt=-1,er=0;if((Gt=Lt[Xt])&&(Gt|=mt&-32768,Gt>mt&&(Gt-=32768),Gt<mt))for(;bt[Gt+er]==bt[mt+er]&&er<250;)++er;if(er>2){$t=Re[er],$t<=22?ft=Ye(dt,ft,fe[$t+1]>>1)-1:(Ye(dt,ft,3),ft+=5,Ye(dt,ft,fe[$t-23]>>5),ft+=3);var An=$t<8?0:$t-4>>2;An>0&&(at(dt,ft,er-re[$t]),ft+=An),$t=Ie[mt-Gt],ft=Ye(dt,ft,fe[$t]>>3),ft-=3;var Wr=$t<4?0:$t-2>>1;Wr>0&&(at(dt,ft,mt-Gt-he[$t]),ft+=Wr);for(var Pn=0;Pn<er;++Pn)Lt[Xt]=mt&32767,Xt=(Xt<<5^bt[mt])&32767,++mt;Vt-=er-1}else $t<=143?$t=$t+48:ft=Ne(dt,ft,1),ft=Ye(dt,ft,fe[$t]),Lt[Xt]=mt&32767,++mt}ft=Ye(dt,ft,0)-1}return dt.l=(ft+7)/8|0,dt.l}return function(dt,ft){return dt.length<8?ze(dt,ft):ct(dt,ft)}})();function me(ye){var Ie=St(50+Math.floor(ye.length*1.1)),Ee=qe(ye,Ie);return Ie.slice(0,Ee)}var Ge=z?new Uint16Array(32768):we(32768),Be=z?new Uint16Array(32768):we(32768),it=z?new Uint16Array(128):we(128),st=1,Ve=1;function te(ye,Ie){var Ee=ke(ye,Ie)+257;Ie+=5;var Te=ke(ye,Ie)+1;Ie+=5;var Re=ue(ye,Ie)+4;Ie+=4;for(var ze=0,ct=z?new Uint8Array(19):we(19),bt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],dt=1,ft=z?new Uint8Array(8):we(8),mt=z?new Uint8Array(8):we(8),Lt=ct.length,Vt=0;Vt<Re;++Vt)ct[E[Vt]]=ze=_e(ye,Ie),dt<ze&&(dt=ze),ft[ze]++,Ie+=3;var Xt=0;for(ft[0]=0,Vt=1;Vt<=dt;++Vt)mt[Vt]=Xt=Xt+ft[Vt-1]<<1;for(Vt=0;Vt<Lt;++Vt)(Xt=ct[Vt])!=0&&(bt[Vt]=mt[Xt]++);var $t=0;for(Vt=0;Vt<Lt;++Vt)if($t=ct[Vt],$t!=0){Xt=fe[bt[Vt]]>>8-$t;for(var Gt=(1<<7-$t)-1;Gt>=0;--Gt)it[Xt|Gt<<$t]=$t&7|Vt<<3}var er=[];for(dt=1;er.length<Ee+Te;)switch(Xt=it[$e(ye,Ie)],Ie+=Xt&7,Xt>>>=3){case 16:for(ze=3+ae(ye,Ie),Ie+=2,Xt=er[er.length-1];ze-- >0;)er.push(Xt);break;case 17:for(ze=3+_e(ye,Ie),Ie+=3;ze-- >0;)er.push(0);break;case 18:for(ze=11+$e(ye,Ie),Ie+=7;ze-- >0;)er.push(0);break;default:er.push(Xt),dt<Xt&&(dt=Xt);break}var An=er.slice(0,Ee),Wr=er.slice(Ee);for(Vt=Ee;Vt<286;++Vt)An[Vt]=0;for(Vt=Te;Vt<30;++Vt)Wr[Vt]=0;return st=J(An,Ge,286),Ve=J(Wr,Be,30),Ie}function Ue(ye,Ie){if(ye[0]==3&&!(ye[1]&3))return[_h(Ie),2];for(var Ee=0,Te=0,Re=FF(Ie||1<<18),ze=0,ct=Re.length>>>0,bt=0,dt=0;(Te&1)==0;){if(Te=_e(ye,Ee),Ee+=3,Te>>>1)Te>>1==1?(bt=9,dt=5):(Ee=te(ye,Ee),bt=st,dt=Ve);else{Ee&7&&(Ee+=8-(Ee&7));var ft=ye[Ee>>>3]|ye[(Ee>>>3)+1]<<8;if(Ee+=32,ft>0)for(!Ie&&ct<ze+ft&&(Re=Y(Re,ze+ft),ct=Re.length);ft-- >0;)Re[ze++]=ye[Ee>>>3],Ee+=8;continue}for(;;){!Ie&&ct<ze+32767&&(Re=Y(Re,ze+32767),ct=Re.length);var mt=Je(ye,Ee,bt),Lt=Te>>>1==1?ve[mt]:Ge[mt];if(Ee+=Lt&15,Lt>>>=4,(Lt>>>8&255)===0)Re[ze++]=Lt;else{if(Lt==256)break;Lt-=257;var Vt=Lt<8?0:Lt-4>>2;Vt>5&&(Vt=0);var Xt=ze+re[Lt];Vt>0&&(Xt+=Je(ye,Ee,Vt),Ee+=Vt),mt=Je(ye,Ee,dt),Lt=Te>>>1==1?Oe[mt]:Be[mt],Ee+=Lt&15,Lt>>>=4;var $t=Lt<4?0:Lt-2>>1,Gt=he[Lt];for($t>0&&(Gt+=Je(ye,Ee,$t),Ee+=$t),!Ie&&ct<Xt&&(Re=Y(Re,Xt+100),ct=Re.length);ze<Xt;)Re[ze]=Re[ze-Gt],++ze}}}return Ie?[Re,Ee+7>>>3]:[Re.slice(0,ze),Ee+7>>>3]}function ot(ye,Ie){var Ee=ye.slice(ye.l||0),Te=Ue(Ee,Ie);return ye.l+=Te[1],Te[0]}function vt(ye,Ie){if(ye)typeof console<"u"&&console.error(Ie);else throw new Error(Ie)}function _t(ye,Ie){var Ee=ye;_s(Ee,0);var Te=[],Re=[],ze={FileIndex:Te,FullPaths:Re};L(ze,{root:Ie.root});for(var ct=Ee.length-4;(Ee[ct]!=80||Ee[ct+1]!=75||Ee[ct+2]!=5||Ee[ct+3]!=6)&&ct>=0;)--ct;Ee.l=ct+4,Ee.l+=4;var bt=Ee.read_shift(2);Ee.l+=6;var dt=Ee.read_shift(4);for(Ee.l=dt,ct=0;ct<bt;++ct){Ee.l+=20;var ft=Ee.read_shift(4),mt=Ee.read_shift(4),Lt=Ee.read_shift(2),Vt=Ee.read_shift(2),Xt=Ee.read_shift(2);Ee.l+=8;var $t=Ee.read_shift(4),Gt=l(Ee.slice(Ee.l+Lt,Ee.l+Lt+Vt));Ee.l+=Lt+Vt+Xt;var er=Ee.l;Ee.l=$t+4,qt(Ee,ft,mt,ze,Gt),Ee.l=er}return ze}function qt(ye,Ie,Ee,Te,Re){ye.l+=2;var ze=ye.read_shift(2),ct=ye.read_shift(2),bt=o(ye);if(ze&8257)throw new Error("Unsupported ZIP encryption");for(var dt=ye.read_shift(4),ft=ye.read_shift(4),mt=ye.read_shift(4),Lt=ye.read_shift(2),Vt=ye.read_shift(2),Xt="",$t=0;$t<Lt;++$t)Xt+=String.fromCharCode(ye[ye.l++]);if(Vt){var Gt=l(ye.slice(ye.l,ye.l+Vt));(Gt[21589]||{}).mt&&(bt=Gt[21589].mt),((Re||{})[21589]||{}).mt&&(bt=Re[21589].mt)}ye.l+=Vt;var er=ye.slice(ye.l,ye.l+ft);switch(ct){case 8:er=H(ye,mt);break;case 0:break;default:throw new Error("Unsupported ZIP Compression method "+ct)}var An=!1;ze&8&&(dt=ye.read_shift(4),dt==134695760&&(dt=ye.read_shift(4),An=!0),ft=ye.read_shift(4),mt=ye.read_shift(4)),ft!=Ie&&vt(An,"Bad compressed size: "+Ie+" != "+ft),mt!=Ee&&vt(An,"Bad uncompressed size: "+Ee+" != "+mt),kr(Te,Xt,er,{unsafe:!0,mt:bt})}function Ft(ye,Ie){var Ee=Ie||{},Te=[],Re=[],ze=St(1),ct=Ee.compression?8:0,bt=0,dt=0,ft=0,mt=0,Lt=0,Vt=ye.FullPaths[0],Xt=Vt,$t=ye.FileIndex[0],Gt=[],er=0;for(dt=1;dt<ye.FullPaths.length;++dt)if(Xt=ye.FullPaths[dt].slice(Vt.length),$t=ye.FileIndex[dt],!(!$t.size||!$t.content||Xt=="Sh33tJ5")){var An=mt,Wr=St(Xt.length);for(ft=0;ft<Xt.length;++ft)Wr.write_shift(1,Xt.charCodeAt(ft)&127);Wr=Wr.slice(0,Wr.l),Gt[Lt]=ake.buf($t.content,0);var Pn=$t.content;ct==8&&(Pn=G(Pn)),ze=St(30),ze.write_shift(4,67324752),ze.write_shift(2,20),ze.write_shift(2,bt),ze.write_shift(2,ct),$t.mt?s(ze,$t.mt):ze.write_shift(4,0),ze.write_shift(-4,Gt[Lt]),ze.write_shift(4,Pn.length),ze.write_shift(4,$t.content.length),ze.write_shift(2,Wr.length),ze.write_shift(2,0),mt+=ze.length,Te.push(ze),mt+=Wr.length,Te.push(Wr),mt+=Pn.length,Te.push(Pn),ze=St(46),ze.write_shift(4,33639248),ze.write_shift(2,0),ze.write_shift(2,20),ze.write_shift(2,bt),ze.write_shift(2,ct),ze.write_shift(4,0),ze.write_shift(-4,Gt[Lt]),ze.write_shift(4,Pn.length),ze.write_shift(4,$t.content.length),ze.write_shift(2,Wr.length),ze.write_shift(2,0),ze.write_shift(2,0),ze.write_shift(2,0),ze.write_shift(2,0),ze.write_shift(4,0),ze.write_shift(4,An),er+=ze.l,Re.push(ze),er+=Wr.length,Re.push(Wr),++Lt}return ze=St(22),ze.write_shift(4,101010256),ze.write_shift(2,0),ze.write_shift(2,0),ze.write_shift(2,Lt),ze.write_shift(2,Lt),ze.write_shift(4,er),ze.write_shift(4,mt),ze.write_shift(2,0),os([os(Te),os(Re),ze])}var Dt={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 Rt(ye,Ie){if(ye.ctype)return ye.ctype;var Ee=ye.name||"",Te=Ee.match(/\.([^\.]+)$/);return Te&&Dt[Te[1]]||Ie&&(Te=(Ee=Ie).match(/[\.\\]([^\.\\])+$/),Te&&Dt[Te[1]])?Dt[Te[1]]:"application/octet-stream"}function wr(ye){for(var Ie=Gv(ye),Ee=[],Te=0;Te<Ie.length;Te+=76)Ee.push(Ie.slice(Te,Te+76));return Ee.join(`\r
`)+`\r
`}function gr(ye){var Ie=ye.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g,function(ft){var mt=ft.charCodeAt(0).toString(16).toUpperCase();return"="+(mt.length==1?"0"+mt:mt)});Ie=Ie.replace(/ $/mg,"=20").replace(/\t$/mg,"=09"),Ie.charAt(0)==`
`&&(Ie="=0D"+Ie.slice(1)),Ie=Ie.replace(/\r(?!\n)/mg,"=0D").replace(/\n\n/mg,`
=0A`).replace(/([^\r\n])\n/mg,"$1=0A");for(var Ee=[],Te=Ie.split(`\r
`),Re=0;Re<Te.length;++Re){var ze=Te[Re];if(ze.length==0){Ee.push("");continue}for(var ct=0;ct<ze.length;){var bt=76,dt=ze.slice(ct,ct+bt);dt.charAt(bt-1)=="="?bt--:dt.charAt(bt-2)=="="?bt-=2:dt.charAt(bt-3)=="="&&(bt-=3),dt=ze.slice(ct,ct+bt),ct+=bt,ct<ze.length&&(dt+="="),Ee.push(dt)}}return Ee.join(`\r
`)}function Er(ye){for(var Ie=[],Ee=0;Ee<ye.length;++Ee){for(var Te=ye[Ee];Ee<=ye.length&&Te.charAt(Te.length-1)=="=";)Te=Te.slice(0,Te.length-1)+ye[++Ee];Ie.push(Te)}for(var Re=0;Re<Ie.length;++Re)Ie[Re]=Ie[Re].replace(/[=][0-9A-Fa-f]{2}/g,function(ze){return String.fromCharCode(parseInt(ze.slice(1),16))});return cl(Ie.join(`\r
`))}function Ur(ye,Ie,Ee){for(var Te="",Re="",ze="",ct,bt=0;bt<10;++bt){var dt=Ie[bt];if(!dt||dt.match(/^\s*$/))break;var ft=dt.match(/^(.*?):\s*([^\s].*)$/);if(ft)switch(ft[1].toLowerCase()){case"content-location":Te=ft[2].trim();break;case"content-type":ze=ft[2].trim();break;case"content-transfer-encoding":Re=ft[2].trim();break}}switch(++bt,Re.toLowerCase()){case"base64":ct=cl(vl(Ie.slice(bt).join("")));break;case"quoted-printable":ct=Er(Ie.slice(bt));break;default:throw new Error("Unsupported Content-Transfer-Encoding "+Re)}var mt=kr(ye,Te.slice(Ee.length),ct,{unsafe:!0});ze&&(mt.ctype=ze)}function Ht(ye,Ie){if(le(ye.slice(0,13)).toLowerCase()!="mime-version:")throw new Error("Unsupported MAD header");var Ee=Ie&&Ie.root||"",Te=(Yr&&Buffer.isBuffer(ye)?ye.toString("binary"):le(ye)).split(`\r
`),Re=0,ze="";for(Re=0;Re<Te.length;++Re)if(ze=Te[Re],!!/^Content-Location:/i.test(ze)&&(ze=ze.slice(ze.indexOf("file")),Ee||(Ee=ze.slice(0,ze.lastIndexOf("/")+1)),ze.slice(0,Ee.length)!=Ee))for(;Ee.length>0&&(Ee=Ee.slice(0,Ee.length-1),Ee=Ee.slice(0,Ee.lastIndexOf("/")+1),ze.slice(0,Ee.length)!=Ee););var ct=(Te[1]||"").match(/boundary="(.*?)"/);if(!ct)throw new Error("MAD cannot find boundary");var bt="--"+(ct[1]||""),dt=[],ft=[],mt={FileIndex:dt,FullPaths:ft};L(mt);var Lt,Vt=0;for(Re=0;Re<Te.length;++Re){var Xt=Te[Re];Xt!==bt&&Xt!==bt+"--"||(Vt++&&Ur(mt,Te.slice(Lt,Re),Ee),Lt=Re)}return mt}function It(ye,Ie){var Ee=Ie||{},Te=Ee.boundary||"SheetJS";Te="------="+Te;for(var Re=["MIME-Version: 1.0",'Content-Type: multipart/related; boundary="'+Te.slice(2)+'"',"","",""],ze=ye.FullPaths[0],ct=ze,bt=ye.FileIndex[0],dt=1;dt<ye.FullPaths.length;++dt)if(ct=ye.FullPaths[dt].slice(ze.length),bt=ye.FileIndex[dt],!(!bt.size||!bt.content||ct=="Sh33tJ5")){ct=ct.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g,function(er){return"_x"+er.charCodeAt(0).toString(16)+"_"}).replace(/[\u0080-\uFFFF]/g,function(er){return"_u"+er.charCodeAt(0).toString(16)+"_"});for(var ft=bt.content,mt=Yr&&Buffer.isBuffer(ft)?ft.toString("binary"):le(ft),Lt=0,Vt=Math.min(1024,mt.length),Xt=0,$t=0;$t<=Vt;++$t)(Xt=mt.charCodeAt($t))>=32&&Xt<128&&++Lt;var Gt=Lt>=Vt*4/5;Re.push(Te),Re.push("Content-Location: "+(Ee.root||"file:///C:/SheetJS/")+ct),Re.push("Content-Transfer-Encoding: "+(Gt?"quoted-printable":"base64")),Re.push("Content-Type: "+Rt(bt,ct)),Re.push(""),Re.push(Gt?gr(mt):wr(mt))}return Re.push(Te+`--\r
`),Re.join(`\r
`)}function Rr(ye){var Ie={};return L(Ie,ye),Ie}function kr(ye,Ie,Ee,Te){var Re=Te&&Te.unsafe;Re||L(ye);var ze=!Re&&br.find(ye,Ie);if(!ze){var ct=ye.FullPaths[0];Ie.slice(0,ct.length)==ct?ct=Ie:(ct.slice(-1)!="/"&&(ct+="/"),ct=(ct+Ie).replace("//","/")),ze={name:a(Ie),type:2},ye.FileIndex.push(ze),ye.FullPaths.push(ct),Re||br.utils.cfb_gc(ye)}return ze.content=Ee,ze.size=Ee?Ee.length:0,Te&&(Te.CLSID&&(ze.clsid=Te.CLSID),Te.mt&&(ze.mt=Te.mt),Te.ct&&(ze.ct=Te.ct)),ze}function qr(ye,Ie){L(ye);var Ee=br.find(ye,Ie);if(Ee){for(var Te=0;Te<ye.FileIndex.length;++Te)if(ye.FileIndex[Te]==Ee)return ye.FileIndex.splice(Te,1),ye.FullPaths.splice(Te,1),!0}return!1}function Xr(ye,Ie,Ee){L(ye);var Te=br.find(ye,Ie);if(Te){for(var Re=0;Re<ye.FileIndex.length;++Re)if(ye.FileIndex[Re]==Te)return ye.FileIndex[Re].name=a(Ee),ye.FullPaths[Re]=Ee,!0}return!1}function Zr(ye){I(ye,!0)}return t.find=P,t.read=B,t.parse=f,t.write=Ae,t.writeFile=X,t.utils={cfb_new:Rr,cfb_add:kr,cfb_del:qr,cfb_mov:Xr,cfb_gc:Zr,ReadShift:dv,CheckField:DG,prep_blob:_s,bconcat:os,use_zlib:D,_deflateRaw:me,_inflateRaw:ot,consts:ne},t})();function ike(e){return typeof e=="string"?Y5(e):Array.isArray(e)?PAe(e):e}function M1(e,t,r){if(typeof Deno<"u"){if(r&&typeof t=="string")switch(r){case"utf8":t=new TextEncoder(r).encode(t);break;case"binary":t=Y5(t);break;default:throw new Error("Unsupported encoding "+r)}return Deno.writeFileSync(e,t)}var n=r=="utf8"?Mu(t):t;if(typeof IE_SaveFile<"u")return IE_SaveFile(n,e);if(typeof Blob<"u"){var a=new Blob([ike(n)],{type:"application/octet-stream"});if(typeof navigator<"u"&&navigator.msSaveBlob)return navigator.msSaveBlob(a,e);if(typeof saveAs<"u")return saveAs(a,e);if(typeof URL<"u"&&typeof document<"u"&&document.createElement&&URL.createObjectURL){var s=URL.createObjectURL(a);if(typeof chrome=="object"&&typeof(chrome.downloads||{}).download=="function")return URL.revokeObjectURL&&typeof setTimeout<"u"&&setTimeout(function(){URL.revokeObjectURL(s)},6e4),chrome.downloads.download({url:s,filename:e,saveAs:!0});var o=document.createElement("a");if(o.download!=null)return o.download=e,o.href=s,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL&&typeof setTimeout<"u"&&setTimeout(function(){URL.revokeObjectURL(s)},6e4),s}}if(typeof $<"u"&&typeof File<"u"&&typeof Folder<"u")try{var l=File(e);return l.open("w"),l.encoding="binary",Array.isArray(t)&&(t=Uh(t)),l.write(t),l.close(),t}catch(u){if(!u.message||!u.message.match(/onstruct/))throw u}throw new Error("cannot save file "+e)}function ske(e){if(typeof Deno<"u")return Deno.readFileSync(e);if(typeof $<"u"&&typeof File<"u"&&typeof Folder<"u")try{var t=File(e);t.open("r"),t.encoding="binary";var r=t.read();return t.close(),r}catch(n){if(!n.message||!n.message.match(/onstruct/))throw n}throw new Error("Cannot access file "+e)}function ri(e){for(var t=Object.keys(e),r=[],n=0;n<t.length;++n)Object.prototype.hasOwnProperty.call(e,t[n])&&r.push(t[n]);return r}function WF(e,t){for(var r=[],n=ri(e),a=0;a!==n.length;++a)r[e[n[a]][t]]==null&&(r[e[n[a]][t]]=n[a]);return r}function X5(e){for(var t=[],r=ri(e),n=0;n!==r.length;++n)t[e[r[n]]]=r[n];return t}function Z5(e){for(var t=[],r=ri(e),n=0;n!==r.length;++n)t[e[r[n]]]=parseInt(r[n],10);return t}function oke(e){for(var t=[],r=ri(e),n=0;n!==r.length;++n)t[e[r[n]]]==null&&(t[e[r[n]]]=[]),t[e[r[n]]].push(r[n]);return t}var Dw=new Date(1899,11,30,0,0,0);function Hi(e,t){var r=e.getTime(),n=Dw.getTime()+(e.getTimezoneOffset()-Dw.getTimezoneOffset())*6e4;return(r-n)/(1440*60*1e3)}var dG=new Date,lke=Dw.getTime()+(dG.getTimezoneOffset()-Dw.getTimezoneOffset())*6e4,GF=dG.getTimezoneOffset();function J5(e){var t=new Date;return t.setTime(e*24*60*60*1e3+lke),t.getTimezoneOffset()!==GF&&t.setTime(t.getTime()+(t.getTimezoneOffset()-GF)*6e4),t}function cke(e){var t=0,r=0,n=!1,a=e.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/);if(!a)throw new Error("|"+e+"| is not an ISO8601 Duration");for(var s=1;s!=a.length;++s)if(a[s]){switch(r=1,s>3&&(n=!0),a[s].slice(a[s].length-1)){case"Y":throw new Error("Unsupported ISO Duration Field: "+a[s].slice(a[s].length-1));case"D":r*=24;case"H":r*=60;case"M":if(n)r*=60;else throw new Error("Unsupported ISO Duration Field: M")}t+=r*parseInt(a[s],10)}return t}var YF=new Date("2017-02-19T19:06:09.000Z"),fG=isNaN(YF.getFullYear())?new Date("2/19/17"):YF,uke=fG.getFullYear()==2017;function ja(e,t){var r=new Date(e);if(uke)return t>0?r.setTime(r.getTime()+r.getTimezoneOffset()*60*1e3):t<0&&r.setTime(r.getTime()-r.getTimezoneOffset()*60*1e3),r;if(e instanceof Date)return e;if(fG.getFullYear()==1917&&!isNaN(r.getFullYear())){var n=r.getFullYear();return e.indexOf(""+n)>-1||r.setFullYear(r.getFullYear()+100),r}var a=e.match(/\d+/g)||["2017","2","19","0","0","0"],s=new Date(+a[0],+a[1]-1,+a[2],+a[3]||0,+a[4]||0,+a[5]||0);return e.indexOf("Z")>-1&&(s=new Date(s.getTime()-s.getTimezoneOffset()*60*1e3)),s}function u0(e,t){if(Yr&&Buffer.isBuffer(e)){if(t){if(e[0]==255&&e[1]==254)return Mu(e.slice(2).toString("utf16le"));if(e[1]==254&&e[2]==255)return Mu(QW(e.slice(2).toString("binary")))}return e.toString("binary")}if(typeof TextDecoder<"u")try{if(t){if(e[0]==255&&e[1]==254)return Mu(new TextDecoder("utf-16le").decode(e.slice(2)));if(e[0]==254&&e[1]==255)return Mu(new TextDecoder("utf-16be").decode(e.slice(2)))}var r={"€":"","‚":"",ƒ:"","„":"","…":"","†":"","‡":"","ˆ":"","‰":"",Š:"","‹":"",Œ:"",Ž:"","‘":"","’":"","“":"","”":"","•":"","–":"","—":"","˜":"","™":"",š:"","›":"",œ:"",ž:"",Ÿ:""};return Array.isArray(e)&&(e=new Uint8Array(e)),new TextDecoder("latin1").decode(e).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g,function(s){return r[s]||s})}catch{}for(var n=[],a=0;a!=e.length;++a)n.push(String.fromCharCode(e[a]));return n.join("")}function Na(e){if(typeof JSON<"u"&&!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 r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=Na(e[r]));return t}function ei(e,t){for(var r="";r.length<t;)r+=e;return r}function Pc(e){var t=Number(e);if(!isNaN(t))return isFinite(t)?t:NaN;if(!/\d/.test(e))return t;var r=1,n=e.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){return r*=100,""});return!isNaN(t=Number(n))||(n=n.replace(/[(](.*)[)]/,function(a,s){return r=-r,s}),!isNaN(t=Number(n)))?t/r:t}var dke=["january","february","march","april","may","june","july","august","september","october","november","december"];function px(e){var t=new Date(e),r=new Date(NaN),n=t.getYear(),a=t.getMonth(),s=t.getDate();if(isNaN(s))return r;var o=e.toLowerCase();if(o.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)){if(o=o.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,""),o.length>3&&dke.indexOf(o)==-1)return r}else if(o.match(/[a-z]/))return r;return n<0||n>8099?r:(a>0||s>1)&&n!=101?t:e.match(/[^-0-9:,\/\\]/)?r:t}var fke=(function(){var e="abacaba".split(/(:?b)/i).length==5;return function(r,n,a){if(e||typeof n=="string")return r.split(n);for(var s=r.split(n),o=[s[0]],l=1;l<s.length;++l)o.push(a),o.push(s[l]);return o}})();function hG(e){return e?e.content&&e.type?u0(e.content,!0):e.data?Zg(e.data):e.asNodeBuffer&&Yr?Zg(e.asNodeBuffer().toString("binary")):e.asBinary?Zg(e.asBinary()):e._data&&e._data.getContent?Zg(u0(Array.prototype.slice.call(e._data.getContent(),0))):null:null}function mG(e){if(!e)return null;if(e.data)return LF(e.data);if(e.asNodeBuffer&&Yr)return e.asNodeBuffer();if(e._data&&e._data.getContent){var t=e._data.getContent();return typeof t=="string"?LF(t):Array.prototype.slice.call(t)}return e.content&&e.type?e.content:null}function hke(e){return e&&e.name.slice(-4)===".bin"?mG(e):hG(e)}function Fl(e,t){for(var r=e.FullPaths||ri(e.files),n=t.toLowerCase().replace(/[\/]/g,"\\"),a=n.replace(/\\/g,"/"),s=0;s<r.length;++s){var o=r[s].replace(/^Root Entry[\/]/,"").toLowerCase();if(n==o||a==o)return e.files?e.files[r[s]]:e.FileIndex[s]}return null}function xE(e,t){var r=Fl(e,t);if(r==null)throw new Error("Cannot find file "+t+" in zip");return r}function bi(e,t,r){if(!r)return hke(xE(e,t));if(!t)return null;try{return bi(e,t)}catch{return null}}function ul(e,t,r){if(!r)return hG(xE(e,t));if(!t)return null;try{return ul(e,t)}catch{return null}}function mke(e,t,r){return mG(xE(e,t))}function KF(e){for(var t=e.FullPaths||ri(e.files),r=[],n=0;n<t.length;++n)t[n].slice(-1)!="/"&&r.push(t[n].replace(/^Root Entry[\/]/,""));return r.sort()}function Hr(e,t,r){if(e.FullPaths){if(typeof r=="string"){var n;return Yr?n=hf(r):n=DAe(r),br.utils.cfb_add(e,t,n)}br.utils.cfb_add(e,t,r)}else e.file(t,r)}function gE(){return br.utils.cfb_new()}function pG(e,t){switch(t.type){case"base64":return br.read(e,{type:"base64"});case"binary":return br.read(e,{type:"binary"});case"buffer":case"array":return br.read(e,{type:"buffer"})}throw new Error("Unrecognized type "+t.type)}function Qg(e,t){if(e.charAt(0)=="/")return e.slice(1);var r=t.split("/");t.slice(-1)!="/"&&r.pop();for(var n=e.split("/");n.length!==0;){var a=n.shift();a===".."?r.pop():a!=="."&&r.push(a)}return r.join("/")}var pi=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
`,pke=/([^"\s?>\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g,XF=/<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s*[\/\?]?>/mg,xke=/<[^>]*>/g,Xs=pi.match(XF)?XF:xke,gke=/<\w*:/,vke=/<(\/?)\w+:/;function Tr(e,t,r){for(var n={},a=0,s=0;a!==e.length&&!((s=e.charCodeAt(a))===32||s===10||s===13);++a);if(t||(n[0]=e.slice(0,a)),a===e.length)return n;var o=e.match(pke),l=0,u="",d=0,f="",m="",g=1;if(o)for(d=0;d!=o.length;++d){for(m=o[d],s=0;s!=m.length&&m.charCodeAt(s)!==61;++s);for(f=m.slice(0,s).trim();m.charCodeAt(s+1)==32;)++s;for(g=(a=m.charCodeAt(s+1))==34||a==39?1:0,u=m.slice(s+1+g,m.length-g),l=0;l!=f.length&&f.charCodeAt(l)!==58;++l);if(l===f.length)f.indexOf("_")>0&&(f=f.slice(0,f.indexOf("_"))),n[f]=u,n[f.toLowerCase()]=u;else{var x=(l===5&&f.slice(0,5)==="xmlns"?"xmlns":"")+f.slice(l+1);if(n[x]&&f.slice(l-3,l)=="ext")continue;n[x]=u,n[x.toLowerCase()]=u}}return n}function Zu(e){return e.replace(vke,"<$1")}var xG={"&quot;":'"',"&apos;":"'","&gt;":">","&lt;":"<","&amp;":"&"},vE=X5(xG),vn=(function(){var e=/&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig,t=/_x([\da-fA-F]{4})_/ig;return function r(n){var a=n+"",s=a.indexOf("<![CDATA[");if(s==-1)return a.replace(e,function(l,u){return xG[l]||String.fromCharCode(parseInt(u,l.indexOf("x")>-1?16:10))||l}).replace(t,function(l,u){return String.fromCharCode(parseInt(u,16))});var o=a.indexOf("]]>");return r(a.slice(0,s))+a.slice(s+9,o)+r(a.slice(o+3))}})(),yE=/[&<>'"]/g,yke=/[\u0000-\u0008\u000b-\u001f]/g;function Vn(e){var t=e+"";return t.replace(yE,function(r){return vE[r]}).replace(yke,function(r){return"_x"+("000"+r.charCodeAt(0).toString(16)).slice(-4)+"_"})}function ZF(e){return Vn(e).replace(/ /g,"_x0020_")}var gG=/[\u0000-\u001f]/g;function bE(e){var t=e+"";return t.replace(yE,function(r){return vE[r]}).replace(/\n/g,"<br/>").replace(gG,function(r){return"&#x"+("000"+r.charCodeAt(0).toString(16)).slice(-4)+";"})}function bke(e){var t=e+"";return t.replace(yE,function(r){return vE[r]}).replace(gG,function(r){return"&#x"+r.charCodeAt(0).toString(16).toUpperCase()+";"})}var JF=(function(){var e=/&#(\d+);/g;function t(r,n){return String.fromCharCode(parseInt(n,10))}return function(n){return n.replace(e,t)}})();function wke(e){return e.replace(/(\r\n|[\r\n])/g,"&#10;")}function ya(e){switch(e){case 1:case!0:case"1":case"true":case"TRUE":return!0;default:return!1}}function e3(e){for(var t="",r=0,n=0,a=0,s=0,o=0,l=0;r<e.length;){if(n=e.charCodeAt(r++),n<128){t+=String.fromCharCode(n);continue}if(a=e.charCodeAt(r++),n>191&&n<224){o=(n&31)<<6,o|=a&63,t+=String.fromCharCode(o);continue}if(s=e.charCodeAt(r++),n<240){t+=String.fromCharCode((n&15)<<12|(a&63)<<6|s&63);continue}o=e.charCodeAt(r++),l=((n&7)<<18|(a&63)<<12|(s&63)<<6|o&63)-65536,t+=String.fromCharCode(55296+(l>>>10&1023)),t+=String.fromCharCode(56320+(l&1023))}return t}function QF(e){var t=_h(2*e.length),r,n,a=1,s=0,o=0,l;for(n=0;n<e.length;n+=a)a=1,(l=e.charCodeAt(n))<128?r=l:l<224?(r=(l&31)*64+(e.charCodeAt(n+1)&63),a=2):l<240?(r=(l&15)*4096+(e.charCodeAt(n+1)&63)*64+(e.charCodeAt(n+2)&63),a=3):(a=4,r=(l&7)*262144+(e.charCodeAt(n+1)&63)*4096+(e.charCodeAt(n+2)&63)*64+(e.charCodeAt(n+3)&63),r-=65536,o=55296+(r>>>10&1023),r=56320+(r&1023)),o!==0&&(t[s++]=o&255,t[s++]=o>>>8,o=0),t[s++]=r%256,t[s++]=r>>>8;return t.slice(0,s).toString("ucs2")}function e7(e){return hf(e,"binary").toString("utf8")}var Cb="foo bar bazâð£",Xn=Yr&&(e7(Cb)==e3(Cb)&&e7||QF(Cb)==e3(Cb)&&QF)||e3,Mu=Yr?function(e){return hf(e,"utf8").toString("binary")}:function(e){for(var t=[],r=0,n=0,a=0;r<e.length;)switch(n=e.charCodeAt(r++),!0){case n<128:t.push(String.fromCharCode(n));break;case n<2048:t.push(String.fromCharCode(192+(n>>6))),t.push(String.fromCharCode(128+(n&63)));break;case(n>=55296&&n<57344):n-=55296,a=e.charCodeAt(r++)-56320+(n<<10),t.push(String.fromCharCode(240+(a>>18&7))),t.push(String.fromCharCode(144+(a>>12&63))),t.push(String.fromCharCode(128+(a>>6&63))),t.push(String.fromCharCode(128+(a&63)));break;default:t.push(String.fromCharCode(224+(n>>12))),t.push(String.fromCharCode(128+(n>>6&63))),t.push(String.fromCharCode(128+(n&63)))}return t.join("")},Kv=(function(){var e={};return function(r,n){var a=r+"|"+(n||"");return e[a]?e[a]:e[a]=new RegExp("<(?:\\w+:)?"+r+'(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)</(?:\\w+:)?'+r+">",n||"")}})(),vG=(function(){var e=[["nbsp"," "],["middot","·"],["quot",'"'],["apos","'"],["gt",">"],["lt","<"],["amp","&"]].map(function(t){return[new RegExp("&"+t[0]+";","ig"),t[1]]});return function(r){for(var n=r.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,""),a=0;a<e.length;++a)n=n.replace(e[a][0],e[a][1]);return n}})(),jke=(function(){var e={};return function(r){return e[r]!==void 0?e[r]:e[r]=new RegExp("<(?:vt:)?"+r+">([\\s\\S]*?)</(?:vt:)?"+r+">","g")}})(),Nke=/<\/?(?:vt:)?variant>/g,Ske=/<(?:vt:)([^>]*)>([\s\S]*)</;function t7(e,t){var r=Tr(e),n=e.match(jke(r.baseType))||[],a=[];if(n.length!=r.size){if(t.WTF)throw new Error("unexpected vector length "+n.length+" != "+r.size);return a}return n.forEach(function(s){var o=s.replace(Nke,"").match(Ske);o&&a.push({v:Xn(o[2]),t:o[1]})}),a}var yG=/(^\s|\s$|\n)/;function Es(e,t){return"<"+e+(t.match(yG)?' xml:space="preserve"':"")+">"+t+"</"+e+">"}function Xv(e){return ri(e).map(function(t){return" "+t+'="'+e[t]+'"'}).join("")}function Wt(e,t,r){return"<"+e+(r!=null?Xv(r):"")+(t!=null?(t.match(yG)?' xml:space="preserve"':"")+">"+t+"</"+e:"/")+">"}function sk(e,t){try{return e.toISOString().replace(/\.\d*/,"")}catch(r){if(t)throw r}return""}function Ake(e,t){switch(typeof e){case"string":var r=Wt("vt:lpwstr",Vn(e));return r=r.replace(/&quot;/g,"_x0022_"),r;case"number":return Wt((e|0)==e?"vt:i4":"vt:r8",Vn(String(e)));case"boolean":return Wt("vt:bool",e?"true":"false")}if(e instanceof Date)return Wt("vt:filetime",sk(e));throw new Error("Unable to serialize "+e)}function wE(e){if(Yr&&Buffer.isBuffer(e))return e.toString("utf8");if(typeof e=="string")return e;if(typeof Uint8Array<"u"&&e instanceof Uint8Array)return Xn(Uh(hE(e)));throw new Error("Bad input format: expected Buffer or string")}var Zv=/<(\/?)([^\s?><!\/:]*:|)([^\s?<>:\/]+)(?:[\s?:\/][^>]*)?>/mg,$i={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"},j0=["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"],sl={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 kke(e,t){for(var r=1-2*(e[t+7]>>>7),n=((e[t+7]&127)<<4)+(e[t+6]>>>4&15),a=e[t+6]&15,s=5;s>=0;--s)a=a*256+e[t+s];return n==2047?a==0?r*(1/0):NaN:(n==0?n=-1022:(n-=1023,a+=Math.pow(2,52)),r*Math.pow(2,n-52)*a)}function Cke(e,t,r){var n=(t<0||1/t==-1/0?1:0)<<7,a=0,s=0,o=n?-t:t;isFinite(o)?o==0?a=s=0:(a=Math.floor(Math.log(o)/Math.LN2),s=o*Math.pow(2,52-a),a<=-1023&&(!isFinite(s)||s<Math.pow(2,52))?a=-1022:(s-=Math.pow(2,52),a+=1023)):(a=2047,s=isNaN(t)?26985:0);for(var l=0;l<=5;++l,s/=256)e[r+l]=s&255;e[r+6]=(a&15)<<4|s&15,e[r+7]=a>>4|n}var r7=function(e){for(var t=[],r=10240,n=0;n<e[0].length;++n)if(e[0][n])for(var a=0,s=e[0][n].length;a<s;a+=r)t.push.apply(t,e[0][n].slice(a,a+r));return t},n7=Yr?function(e){return e[0].length>0&&Buffer.isBuffer(e[0][0])?Buffer.concat(e[0].map(function(t){return Buffer.isBuffer(t)?t:hf(t)})):r7(e)}:r7,a7=function(e,t,r){for(var n=[],a=t;a<r;a+=2)n.push(String.fromCharCode(Vd(e,a)));return n.join("").replace(uo,"")},jE=Yr?function(e,t,r){return Buffer.isBuffer(e)?e.toString("utf16le",t,r).replace(uo,""):a7(e,t,r)}:a7,i7=function(e,t,r){for(var n=[],a=t;a<t+r;++a)n.push(("0"+e[a].toString(16)).slice(-2));return n.join("")},bG=Yr?function(e,t,r){return Buffer.isBuffer(e)?e.toString("hex",t,t+r):i7(e,t,r)}:i7,s7=function(e,t,r){for(var n=[],a=t;a<r;a++)n.push(String.fromCharCode(Dp(e,a)));return n.join("")},L1=Yr?function(t,r,n){return Buffer.isBuffer(t)?t.toString("utf8",r,n):s7(t,r,n)}:s7,wG=function(e,t){var r=ol(e,t);return r>0?L1(e,t+4,t+4+r-1):""},jG=wG,NG=function(e,t){var r=ol(e,t);return r>0?L1(e,t+4,t+4+r-1):""},SG=NG,AG=function(e,t){var r=2*ol(e,t);return r>0?L1(e,t+4,t+4+r-1):""},kG=AG,CG=function(t,r){var n=ol(t,r);return n>0?jE(t,r+4,r+4+n):""},_G=CG,EG=function(e,t){var r=ol(e,t);return r>0?L1(e,t+4,t+4+r):""},TG=EG,PG=function(e,t){return kke(e,t)},Ow=PG,NE=function(t){return Array.isArray(t)||typeof Uint8Array<"u"&&t instanceof Uint8Array};Yr&&(jG=function(t,r){if(!Buffer.isBuffer(t))return wG(t,r);var n=t.readUInt32LE(r);return n>0?t.toString("utf8",r+4,r+4+n-1):""},SG=function(t,r){if(!Buffer.isBuffer(t))return NG(t,r);var n=t.readUInt32LE(r);return n>0?t.toString("utf8",r+4,r+4+n-1):""},kG=function(t,r){if(!Buffer.isBuffer(t))return AG(t,r);var n=2*t.readUInt32LE(r);return t.toString("utf16le",r+4,r+4+n-1)},_G=function(t,r){if(!Buffer.isBuffer(t))return CG(t,r);var n=t.readUInt32LE(r);return t.toString("utf16le",r+4,r+4+n)},TG=function(t,r){if(!Buffer.isBuffer(t))return EG(t,r);var n=t.readUInt32LE(r);return t.toString("utf8",r+4,r+4+n)},Ow=function(t,r){return Buffer.isBuffer(t)?t.readDoubleLE(r):PG(t,r)},NE=function(t){return Buffer.isBuffer(t)||Array.isArray(t)||typeof Uint8Array<"u"&&t instanceof Uint8Array});var Dp=function(e,t){return e[t]},Vd=function(e,t){return e[t+1]*256+e[t]},_ke=function(e,t){var r=e[t+1]*256+e[t];return r<32768?r:(65535-r+1)*-1},ol=function(e,t){return e[t+3]*(1<<24)+(e[t+2]<<16)+(e[t+1]<<8)+e[t]},_m=function(e,t){return e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]},Eke=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};function dv(e,t){var r="",n,a,s=[],o,l,u,d;switch(t){case"dbcs":if(d=this.l,Yr&&Buffer.isBuffer(this))r=this.slice(this.l,this.l+2*e).toString("utf16le");else for(u=0;u<e;++u)r+=String.fromCharCode(Vd(this,d)),d+=2;e*=2;break;case"utf8":r=L1(this,this.l,this.l+e);break;case"utf16le":e*=2,r=jE(this,this.l,this.l+e);break;case"wstr":return dv.call(this,e,"dbcs");case"lpstr-ansi":r=jG(this,this.l),e=4+ol(this,this.l);break;case"lpstr-cp":r=SG(this,this.l),e=4+ol(this,this.l);break;case"lpwstr":r=kG(this,this.l),e=4+2*ol(this,this.l);break;case"lpp4":e=4+ol(this,this.l),r=_G(this,this.l),e&2&&(e+=2);break;case"8lpp4":e=4+ol(this,this.l),r=TG(this,this.l),e&3&&(e+=4-(e&3));break;case"cstr":for(e=0,r="";(o=Dp(this,this.l+e++))!==0;)s.push(kb(o));r=s.join("");break;case"_wstr":for(e=0,r="";(o=Vd(this,this.l+e))!==0;)s.push(kb(o)),e+=2;e+=2,r=s.join("");break;case"dbcs-cont":for(r="",d=this.l,u=0;u<e;++u){if(this.lens&&this.lens.indexOf(d)!==-1)return o=Dp(this,d),this.l=d+1,l=dv.call(this,e-u,o?"dbcs-cont":"sbcs-cont"),s.join("")+l;s.push(kb(Vd(this,d))),d+=2}r=s.join(""),e*=2;break;case"cpstr":case"sbcs-cont":for(r="",d=this.l,u=0;u!=e;++u){if(this.lens&&this.lens.indexOf(d)!==-1)return o=Dp(this,d),this.l=d+1,l=dv.call(this,e-u,o?"dbcs-cont":"sbcs-cont"),s.join("")+l;s.push(kb(Dp(this,d))),d+=1}r=s.join("");break;default:switch(e){case 1:return n=Dp(this,this.l),this.l++,n;case 2:return n=(t==="i"?_ke:Vd)(this,this.l),this.l+=2,n;case 4:case-4:return t==="i"||(this[this.l+3]&128)===0?(n=(e>0?_m:Eke)(this,this.l),this.l+=4,n):(a=ol(this,this.l),this.l+=4,a);case 8:case-8:if(t==="f")return e==8?a=Ow(this,this.l):a=Ow([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,a;e=8;case 16:r=bG(this,this.l,e);break}}return this.l+=e,r}var Tke=function(e,t,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24&255},Pke=function(e,t,r){e[r]=t&255,e[r+1]=t>>8&255,e[r+2]=t>>16&255,e[r+3]=t>>24&255},Dke=function(e,t,r){e[r]=t&255,e[r+1]=t>>>8&255};function Oke(e,t,r){var n=0,a=0;if(r==="dbcs"){for(a=0;a!=t.length;++a)Dke(this,t.charCodeAt(a),this.l+2*a);n=2*t.length}else if(r==="sbcs"){for(t=t.replace(/[^\x00-\x7F]/g,"_"),a=0;a!=t.length;++a)this[this.l+a]=t.charCodeAt(a)&255;n=t.length}else if(r==="hex"){for(;a<e;++a)this[this.l++]=parseInt(t.slice(2*a,2*a+2),16)||0;return this}else if(r==="utf16le"){var s=Math.min(this.l+e,this.length);for(a=0;a<Math.min(t.length,e);++a){var o=t.charCodeAt(a);this[this.l++]=o&255,this[this.l++]=o>>8}for(;this.l<s;)this[this.l++]=0;return this}else switch(e){case 1:n=1,this[this.l]=t&255;break;case 2:n=2,this[this.l]=t&255,t>>>=8,this[this.l+1]=t&255;break;case 3:n=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:n=4,Tke(this,t,this.l);break;case 8:if(n=8,r==="f"){Cke(this,t,this.l);break}case 16:break;case-4:n=4,Pke(this,t,this.l);break}return this.l+=n,this}function DG(e,t){var r=bG(this,this.l,e.length>>1);if(r!==e)throw new Error(t+"Expected "+e+" saw "+r);this.l+=e.length>>1}function _s(e,t){e.l=t,e.read_shift=dv,e.chk=DG,e.write_shift=Oke}function Ys(e,t){e.l+=t}function St(e){var t=_h(e);return _s(t,0),t}function mf(e,t,r){if(e){var n,a,s;_s(e,e.l||0);for(var o=e.length,l=0,u=0;e.l<o;){l=e.read_shift(1),l&128&&(l=(l&127)+((e.read_shift(1)&127)<<7));var d=n1[l]||n1[65535];for(n=e.read_shift(1),s=n&127,a=1;a<4&&n&128;++a)s+=((n=e.read_shift(1))&127)<<7*a;u=e.l+s;var f=d.f&&d.f(e,s,r);if(e.l=u,t(f,d,l))return}}}function Uo(){var e=[],t=Yr?256:2048,r=function(d){var f=St(d);return _s(f,0),f},n=r(t),a=function(){n&&(n.length>n.l&&(n=n.slice(0,n.l),n.l=n.length),n.length>0&&e.push(n),n=null)},s=function(d){return n&&d<n.length-n.l?n:(a(),n=r(Math.max(d+1,t)))},o=function(){return a(),os(e)},l=function(d){a(),n=d,n.l==null&&(n.l=n.length),s(t)};return{next:s,push:l,end:o,_bufs:e}}function Ot(e,t,r,n){var a=+t,s;if(!isNaN(a)){n||(n=n1[a].p||(r||[]).length||0),s=1+(a>=128?1:0)+1,n>=128&&++s,n>=16384&&++s,n>=2097152&&++s;var o=e.next(s);a<=127?o.write_shift(1,a):(o.write_shift(1,(a&127)+128),o.write_shift(1,a>>7));for(var l=0;l!=4;++l)if(n>=128)o.write_shift(1,(n&127)+128),n>>=7;else{o.write_shift(1,n);break}n>0&&NE(r)&&e.push(r)}}function fv(e,t,r){var n=Na(e);if(t.s?(n.cRel&&(n.c+=t.s.c),n.rRel&&(n.r+=t.s.r)):(n.cRel&&(n.c+=t.c),n.rRel&&(n.r+=t.r)),!r||r.biff<12){for(;n.c>=256;)n.c-=256;for(;n.r>=65536;)n.r-=65536}return n}function o7(e,t,r){var n=Na(e);return n.s=fv(n.s,t.s,r),n.e=fv(n.e,t.s,r),n}function hv(e,t){if(e.cRel&&e.c<0)for(e=Na(e);e.c<0;)e.c+=t>8?16384:256;if(e.rRel&&e.r<0)for(e=Na(e);e.r<0;)e.r+=t>8?1048576:t>5?65536:16384;var r=_r(e);return!e.cRel&&e.cRel!=null&&(r=Lke(r)),!e.rRel&&e.rRel!=null&&(r=Rke(r)),r}function t3(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?"":"$")+Ia(e.s.c)+":"+(e.e.cRel?"":"$")+Ia(e.e.c):e.s.c==0&&!e.s.cRel&&e.e.c==(t.biff>=12?16383:255)&&!e.e.cRel?(e.s.rRel?"":"$")+hi(e.s.r)+":"+(e.e.rRel?"":"$")+hi(e.e.r):hv(e.s,t.biff)+":"+hv(e.e,t.biff)}function SE(e){return parseInt(Mke(e),10)-1}function hi(e){return""+(e+1)}function Rke(e){return e.replace(/([A-Z]|^)(\d+)$/,"$1$$$2")}function Mke(e){return e.replace(/\$(\d+)$/,"$1")}function AE(e){for(var t=Ike(e),r=0,n=0;n!==t.length;++n)r=26*r+t.charCodeAt(n)-64;return r-1}function Ia(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 Lke(e){return e.replace(/^([A-Z])/,"$$$1")}function Ike(e){return e.replace(/^\$([A-Z])/,"$1")}function Fke(e){return e.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")}function Fa(e){for(var t=0,r=0,n=0;n<e.length;++n){var a=e.charCodeAt(n);a>=48&&a<=57?t=10*t+(a-48):a>=65&&a<=90&&(r=26*r+(a-64))}return{c:r-1,r:t-1}}function _r(e){for(var t=e.c+1,r="";t;t=(t-1)/26|0)r=String.fromCharCode((t-1)%26+65)+r;return r+(e.r+1)}function $o(e){var t=e.indexOf(":");return t==-1?{s:Fa(e),e:Fa(e)}:{s:Fa(e.slice(0,t)),e:Fa(e.slice(t+1))}}function zr(e,t){return typeof t>"u"||typeof t=="number"?zr(e.s,e.e):(typeof e!="string"&&(e=_r(e)),typeof t!="string"&&(t=_r(t)),e==t?e:e+":"+t)}function yn(e){var t={s:{c:0,r:0},e:{c:0,r:0}},r=0,n=0,a=0,s=e.length;for(r=0;n<s&&!((a=e.charCodeAt(n)-64)<1||a>26);++n)r=26*r+a;for(t.s.c=--r,r=0;n<s&&!((a=e.charCodeAt(n)-48)<0||a>9);++n)r=10*r+a;if(t.s.r=--r,n===s||a!=10)return t.e.c=t.s.c,t.e.r=t.s.r,t;for(++n,r=0;n!=s&&!((a=e.charCodeAt(n)-64)<1||a>26);++n)r=26*r+a;for(t.e.c=--r,r=0;n!=s&&!((a=e.charCodeAt(n)-48)<0||a>9);++n)r=10*r+a;return t.e.r=--r,t}function l7(e,t){var r=e.t=="d"&&t instanceof Date;if(e.z!=null)try{return e.w=Xl(e.z,r?Hi(t):t)}catch{}try{return e.w=Xl((e.XF||{}).numFmtId||(r?14:0),r?Hi(t):t)}catch{return""+t}}function nf(e,t,r){return e==null||e.t==null||e.t=="z"?"":e.w!==void 0?e.w:(e.t=="d"&&!e.z&&r&&r.dateNF&&(e.z=r.dateNF),e.t=="e"?pf[e.v]||e.v:t==null?l7(e,e.v):l7(e,t))}function $h(e,t){var r=t&&t.sheet?t.sheet:"Sheet1",n={};return n[r]=e,{SheetNames:[r],Sheets:n}}function OG(e,t,r){var n=r||{},a=e?Array.isArray(e):n.dense,s=e||(a?[]:{}),o=0,l=0;if(s&&n.origin!=null){if(typeof n.origin=="number")o=n.origin;else{var u=typeof n.origin=="string"?Fa(n.origin):n.origin;o=u.r,l=u.c}s["!ref"]||(s["!ref"]="A1:A1")}var d={s:{c:1e7,r:1e7},e:{c:0,r:0}};if(s["!ref"]){var f=yn(s["!ref"]);d.s.c=f.s.c,d.s.r=f.s.r,d.e.c=Math.max(d.e.c,f.e.c),d.e.r=Math.max(d.e.r,f.e.r),o==-1&&(d.e.r=o=f.e.r+1)}for(var m=0;m!=t.length;++m)if(t[m]){if(!Array.isArray(t[m]))throw new Error("aoa_to_sheet expects an array of arrays");for(var g=0;g!=t[m].length;++g)if(!(typeof t[m][g]>"u")){var x={v:t[m][g]},y=o+m,v=l+g;if(d.s.r>y&&(d.s.r=y),d.s.c>v&&(d.s.c=v),d.e.r<y&&(d.e.r=y),d.e.c<v&&(d.e.c=v),t[m][g]&&typeof t[m][g]=="object"&&!Array.isArray(t[m][g])&&!(t[m][g]instanceof Date))x=t[m][g];else if(Array.isArray(x.v)&&(x.f=t[m][g][1],x.v=x.v[0]),x.v===null)if(x.f)x.t="n";else if(n.nullError)x.t="e",x.v=0;else if(n.sheetStubs)x.t="z";else continue;else typeof x.v=="number"?x.t="n":typeof x.v=="boolean"?x.t="b":x.v instanceof Date?(x.z=n.dateNF||Cr[14],n.cellDates?(x.t="d",x.w=Xl(x.z,Hi(x.v))):(x.t="n",x.v=Hi(x.v),x.w=Xl(x.z,x.v))):x.t="s";if(a)s[y]||(s[y]=[]),s[y][v]&&s[y][v].z&&(x.z=s[y][v].z),s[y][v]=x;else{var w=_r({c:v,r:y});s[w]&&s[w].z&&(x.z=s[w].z),s[w]=x}}}return d.s.c<1e7&&(s["!ref"]=zr(d)),s}function Bx(e,t){return OG(null,e,t)}function Bke(e){return e.read_shift(4,"i")}function Dc(e,t){return t||(t=St(4)),t.write_shift(4,e),t}function Ws(e){var t=e.read_shift(4);return t===0?"":e.read_shift(t,"dbcs")}function us(e,t){var r=!1;return t==null&&(r=!0,t=St(4+2*e.length)),t.write_shift(4,e.length),e.length>0&&t.write_shift(0,e,"dbcs"),r?t.slice(0,t.l):t}function zke(e){return{ich:e.read_shift(2),ifnt:e.read_shift(2)}}function Uke(e,t){return t||(t=St(4)),t.write_shift(2,0),t.write_shift(2,0),t}function kE(e,t){var r=e.l,n=e.read_shift(1),a=Ws(e),s=[],o={t:a,h:a};if((n&1)!==0){for(var l=e.read_shift(4),u=0;u!=l;++u)s.push(zke(e));o.r=s}else o.r=[{ich:0,ifnt:0}];return e.l=r+t,o}function $ke(e,t){var r=!1;return t==null&&(r=!0,t=St(15+4*e.t.length)),t.write_shift(1,0),us(e.t,t),r?t.slice(0,t.l):t}var Hke=kE;function Vke(e,t){var r=!1;return t==null&&(r=!0,t=St(23+4*e.t.length)),t.write_shift(1,1),us(e.t,t),t.write_shift(4,1),Uke({},t),r?t.slice(0,t.l):t}function Jl(e){var t=e.read_shift(4),r=e.read_shift(2);return r+=e.read_shift(1)<<16,e.l++,{c:t,iStyleRef:r}}function N0(e,t){return t==null&&(t=St(8)),t.write_shift(-4,e.c),t.write_shift(3,e.iStyleRef||e.s),t.write_shift(1,0),t}function S0(e){var t=e.read_shift(2);return t+=e.read_shift(1)<<16,e.l++,{c:-1,iStyleRef:t}}function A0(e,t){return t==null&&(t=St(4)),t.write_shift(3,e.iStyleRef||e.s),t.write_shift(1,0),t}var qke=Ws,RG=us;function CE(e){var t=e.read_shift(4);return t===0||t===4294967295?"":e.read_shift(t,"dbcs")}function Rw(e,t){var r=!1;return t==null&&(r=!0,t=St(127)),t.write_shift(4,e.length>0?e.length:4294967295),e.length>0&&t.write_shift(0,e,"dbcs"),r?t.slice(0,t.l):t}var Wke=Ws,ok=CE,_E=Rw;function EE(e){var t=e.slice(e.l,e.l+4),r=t[0]&1,n=t[0]&2;e.l+=4;var a=n===0?Ow([0,0,0,0,t[0]&252,t[1],t[2],t[3]],0):_m(t,0)>>2;return r?a/100:a}function MG(e,t){t==null&&(t=St(4));var r=0,n=0,a=e*100;if(e==(e|0)&&e>=-536870912&&e<1<<29?n=1:a==(a|0)&&a>=-536870912&&a<1<<29&&(n=1,r=1),n)t.write_shift(-4,((r?a:e)<<2)+(r+2));else throw new Error("unsupported RkNumber "+e)}function LG(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 Gke(e,t){return t||(t=St(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 k0=LG,zx=Gke;function Vs(e){if(e.length-e.l<8)throw"XLS Xnum Buffer underflow";return e.read_shift(8,"f")}function d0(e,t){return(t||St(8)).write_shift(8,e,"f")}function Yke(e){var t={},r=e.read_shift(1),n=r>>>1,a=e.read_shift(1),s=e.read_shift(2,"i"),o=e.read_shift(1),l=e.read_shift(1),u=e.read_shift(1);switch(e.l++,n){case 0:t.auto=1;break;case 1:t.index=a;var d=Vm[a];d&&(t.rgb=Qv(d));break;case 2:t.rgb=Qv([o,l,u]);break;case 3:t.theme=a;break}return s!=0&&(t.tint=s>0?s/32767:s/32768),t}function Mw(e,t){if(t||(t=St(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 r=e.tint||0;if(r>0?r*=32767:r<0&&(r*=32768),t.write_shift(2,r),!e.rgb||e.theme!=null)t.write_shift(2,0),t.write_shift(1,0),t.write_shift(1,0);else{var n=e.rgb||"FFFFFF";typeof n=="number"&&(n=("000000"+n.toString(16)).slice(-6)),t.write_shift(1,parseInt(n.slice(0,2),16)),t.write_shift(1,parseInt(n.slice(2,4),16)),t.write_shift(1,parseInt(n.slice(4,6),16)),t.write_shift(1,255)}return t}function Kke(e){var t=e.read_shift(1);e.l++;var r={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 r}function Xke(e,t){t||(t=St(2));var r=(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,r),t.write_shift(1,0),t}function IG(e,t){var r={2:"BITMAP",3:"METAFILEPICT",8:"DIB",14:"ENHMETAFILE"},n=e.read_shift(4);switch(n){case 0:return"";case 4294967295:case 4294967294:return r[e.read_shift(4)]||""}if(n>400)throw new Error("Unsupported Clipboard: "+n.toString(16));return e.l-=4,e.read_shift(0,t==1?"lpstr":"lpwstr")}function Zke(e){return IG(e,1)}function Jke(e){return IG(e,2)}var TE=2,Mo=3,_b=11,c7=12,Lw=19,Eb=64,Qke=65,eCe=71,tCe=4108,rCe=4126,is=80,FG=81,nCe=[is,FG],lk={1:{n:"CodePage",t:TE},2:{n:"Category",t:is},3:{n:"PresentationFormat",t:is},4:{n:"ByteCount",t:Mo},5:{n:"LineCount",t:Mo},6:{n:"ParagraphCount",t:Mo},7:{n:"SlideCount",t:Mo},8:{n:"NoteCount",t:Mo},9:{n:"HiddenCount",t:Mo},10:{n:"MultimediaClipCount",t:Mo},11:{n:"ScaleCrop",t:_b},12:{n:"HeadingPairs",t:tCe},13:{n:"TitlesOfParts",t:rCe},14:{n:"Manager",t:is},15:{n:"Company",t:is},16:{n:"LinksUpToDate",t:_b},17:{n:"CharacterCount",t:Mo},19:{n:"SharedDoc",t:_b},22:{n:"HyperlinksChanged",t:_b},23:{n:"AppVersion",t:Mo,p:"version"},24:{n:"DigSig",t:Qke},26:{n:"ContentType",t:is},27:{n:"ContentStatus",t:is},28:{n:"Language",t:is},29:{n:"Version",t:is},255:{},2147483648:{n:"Locale",t:Lw},2147483651:{n:"Behavior",t:Lw},1919054434:{}},ck={1:{n:"CodePage",t:TE},2:{n:"Title",t:is},3:{n:"Subject",t:is},4:{n:"Author",t:is},5:{n:"Keywords",t:is},6:{n:"Comments",t:is},7:{n:"Template",t:is},8:{n:"LastAuthor",t:is},9:{n:"RevNumber",t:is},10:{n:"EditTime",t:Eb},11:{n:"LastPrinted",t:Eb},12:{n:"CreatedDate",t:Eb},13:{n:"ModifiedDate",t:Eb},14:{n:"PageCount",t:Mo},15:{n:"WordCount",t:Mo},16:{n:"CharCount",t:Mo},17:{n:"Thumbnail",t:eCe},18:{n:"Application",t:is},19:{n:"DocSecurity",t:Mo},255:{},2147483648:{n:"Locale",t:Lw},2147483651:{n:"Behavior",t:Lw},1919054434:{}},u7={1:"US",2:"CA",3:"",7:"RU",20:"EG",30:"GR",31:"NL",32:"BE",33:"FR",34:"ES",36:"HU",39:"IT",41:"CH",43:"AT",44:"GB",45:"DK",46:"SE",47:"NO",48:"PL",49:"DE",52:"MX",55:"BR",61:"AU",64:"NZ",66:"TH",81:"JP",82:"KR",84:"VN",86:"CN",90:"TR",105:"JS",213:"DZ",216:"MA",218:"LY",351:"PT",354:"IS",358:"FI",420:"CZ",886:"TW",961:"LB",962:"JO",963:"SY",964:"IQ",965:"KW",966:"SA",971:"AE",972:"IL",974:"QA",981:"IR",65535:"US"},aCe=[null,"solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"];function iCe(e){return e.map(function(t){return[t>>16&255,t>>8&255,t&255]})}var sCe=iCe([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]),Vm=Na(sCe),pf={0:"#NULL!",7:"#DIV/0!",15:"#VALUE!",23:"#REF!",29:"#NAME?",36:"#NUM!",42:"#N/A",43:"#GETTING_DATA",255:"#WTF?"},BG={"#NULL!":0,"#DIV/0!":7,"#VALUE!":15,"#REF!":23,"#NAME?":29,"#NUM!":36,"#N/A":42,"#GETTING_DATA":43,"#WTF?":255},uk={"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"},Tb={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 PE(){return{workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],rels:[],strs:[],comments:[],threadedcomments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],metadata:[],people:[],TODO:[],xmlns:""}}function oCe(e){var t=PE();if(!e||!e.match)return t;var r={};if((e.match(Xs)||[]).forEach(function(n){var a=Tr(n);switch(a[0].replace(gke,"<")){case"<?xml":break;case"<Types":t.xmlns=a["xmlns"+(a[0].match(/<(\w+):/)||["",""])[1]];break;case"<Default":r[a.Extension]=a.ContentType;break;case"<Override":t[uk[a.ContentType]]!==void 0&&t[uk[a.ContentType]].push(a.PartName);break}}),t.xmlns!==$i.CT)throw new Error("Unknown Namespace: "+t.xmlns);return t.calcchain=t.calcchains.length>0?t.calcchains[0]:"",t.sst=t.strs.length>0?t.strs[0]:"",t.style=t.styles.length>0?t.styles[0]:"",t.defaults=r,delete t.calcchains,t}function zG(e,t){var r=oke(uk),n=[],a;n[n.length]=pi,n[n.length]=Wt("Types",null,{xmlns:$i.CT,"xmlns:xsd":$i.xsd,"xmlns:xsi":$i.xsi}),n=n.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(u){return Wt("Default",null,{Extension:u[0],ContentType:u[1]})}));var s=function(u){e[u]&&e[u].length>0&&(a=e[u][0],n[n.length]=Wt("Override",null,{PartName:(a[0]=="/"?"":"/")+a,ContentType:Tb[u][t.bookType]||Tb[u].xlsx}))},o=function(u){(e[u]||[]).forEach(function(d){n[n.length]=Wt("Override",null,{PartName:(d[0]=="/"?"":"/")+d,ContentType:Tb[u][t.bookType]||Tb[u].xlsx})})},l=function(u){(e[u]||[]).forEach(function(d){n[n.length]=Wt("Override",null,{PartName:(d[0]=="/"?"":"/")+d,ContentType:r[u][0]})})};return s("workbooks"),o("sheets"),o("charts"),l("themes"),["strs","styles"].forEach(s),["coreprops","extprops","custprops"].forEach(l),l("vba"),l("comments"),l("threadedcomments"),l("drawings"),o("metadata"),l("people"),n.length>2&&(n[n.length]="</Types>",n[1]=n[1].replace("/>",">")),n.join("")}var Qr={WB:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",SHEET:"http://sheetjs.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",XLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",CXML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",CXMLP:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",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",CHART:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",CHARTEX:"http://schemas.microsoft.com/office/2014/relationships/chartEx",CS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet",WS:["http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet","http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet"],DS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet",MS:"http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet",IMG:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",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 Jv(e){var t=e.lastIndexOf("/");return e.slice(0,t+1)+"_rels/"+e.slice(t+1)+".rels"}function mv(e,t){var r={"!id":{}};if(!e)return r;t.charAt(0)!=="/"&&(t="/"+t);var n={};return(e.match(Xs)||[]).forEach(function(a){var s=Tr(a);if(s[0]==="<Relationship"){var o={};o.Type=s.Type,o.Target=s.Target,o.Id=s.Id,s.TargetMode&&(o.TargetMode=s.TargetMode);var l=s.TargetMode==="External"?s.Target:Qg(s.Target,t);r[l]=o,n[s.Id]=o}}),r["!id"]=n,r}function Jp(e){var t=[pi,Wt("Relationships",null,{xmlns:$i.RELS})];return ri(e["!id"]).forEach(function(r){t[t.length]=Wt("Relationship",null,e["!id"][r])}),t.length>2&&(t[t.length]="</Relationships>",t[1]=t[1].replace("/>",">")),t.join("")}function zn(e,t,r,n,a,s){if(a||(a={}),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,a.Id="rId"+t,a.Type=n,a.Target=r,[Qr.HLINK,Qr.XPATH,Qr.XMISS].indexOf(a.Type)>-1&&(a.TargetMode="External"),e["!id"][a.Id])throw new Error("Cannot rewrite rId "+t);return e["!id"][a.Id]=a,e[("/"+a.Target).replace("//","/")]=a,t}var lCe="application/vnd.oasis.opendocument.spreadsheet";function cCe(e,t){for(var r=wE(e),n,a;n=Zv.exec(r);)switch(n[3]){case"manifest":break;case"file-entry":if(a=Tr(n[0],!1),a.path=="/"&&a.type!==lCe)throw new Error("This OpenDocument is not a spreadsheet");break;case"encryption-data":case"algorithm":case"start-key-generation":case"key-derivation":throw new Error("Unsupported ODS Encryption");default:if(t&&t.WTF)throw n}}function uCe(e){var t=[pi];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 r=0;r<e.length;++r)t.push('  <manifest:file-entry manifest:full-path="'+e[r][0]+'" manifest:media-type="'+e[r][1]+`"/>
`);return t.push("</manifest:manifest>"),t.join("")}function d7(e,t,r){return['  <rdf:Description rdf:about="'+e+`">
`,'    <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/'+(r||"odf")+"#"+t+`"/>
`,`  </rdf:Description>
`].join("")}function dCe(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 fCe(e){var t=[pi];t.push(`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
`);for(var r=0;r!=e.length;++r)t.push(d7(e[r][0],e[r][1])),t.push(dCe("",e[r][0]));return t.push(d7("","Document","pkg")),t.push("</rdf:RDF>"),t.join("")}function UG(){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 '+_w.version+"</meta:generator></office:meta></office:document-meta>"}var ql=[["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"]],hCe=(function(){for(var e=new Array(ql.length),t=0;t<ql.length;++t){var r=ql[t],n="(?:"+r[0].slice(0,r[0].indexOf(":"))+":)"+r[0].slice(r[0].indexOf(":")+1);e[t]=new RegExp("<"+n+"[^>]*>([\\s\\S]*?)</"+n+">")}return e})();function $G(e){var t={};e=Xn(e);for(var r=0;r<ql.length;++r){var n=ql[r],a=e.match(hCe[r]);a!=null&&a.length>0&&(t[n[1]]=vn(a[1])),n[2]==="date"&&t[n[1]]&&(t[n[1]]=ja(t[n[1]]))}return t}function r3(e,t,r,n,a){a[e]!=null||t==null||t===""||(a[e]=t,t=Vn(t),n[n.length]=r?Wt(e,t,r):Es(e,t))}function HG(e,t){var r=t||{},n=[pi,Wt("cp:coreProperties",null,{"xmlns:cp":$i.CORE_PROPS,"xmlns:dc":$i.dc,"xmlns:dcterms":$i.dcterms,"xmlns:dcmitype":$i.dcmitype,"xmlns:xsi":$i.xsi})],a={};if(!e&&!r.Props)return n.join("");e&&(e.CreatedDate!=null&&r3("dcterms:created",typeof e.CreatedDate=="string"?e.CreatedDate:sk(e.CreatedDate,r.WTF),{"xsi:type":"dcterms:W3CDTF"},n,a),e.ModifiedDate!=null&&r3("dcterms:modified",typeof e.ModifiedDate=="string"?e.ModifiedDate:sk(e.ModifiedDate,r.WTF),{"xsi:type":"dcterms:W3CDTF"},n,a));for(var s=0;s!=ql.length;++s){var o=ql[s],l=r.Props&&r.Props[o[1]]!=null?r.Props[o[1]]:e?e[o[1]]:null;l===!0?l="1":l===!1?l="0":typeof l=="number"&&(l=String(l)),l!=null&&r3(o[0],l,null,n,a)}return n.length>2&&(n[n.length]="</cp:coreProperties>",n[1]=n[1].replace("/>",">")),n.join("")}var qm=[["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"]],VG=["Worksheets","SheetNames","NamedRanges","DefinedNames","Chartsheets","ChartNames"];function qG(e,t,r,n){var a=[];if(typeof e=="string")a=t7(e,n);else for(var s=0;s<e.length;++s)a=a.concat(e[s].map(function(f){return{v:f}}));var o=typeof t=="string"?t7(t,n).map(function(f){return f.v}):t,l=0,u=0;if(o.length>0)for(var d=0;d!==a.length;d+=2){switch(u=+a[d+1].v,a[d].v){case"Worksheets":case"工作表":case"Листы":case"أوراق العمل":case"ワークシート":case"גליונות עבודה":case"Arbeitsblätter":case"Çalışma Sayfaları":case"Feuilles de calcul":case"Fogli di lavoro":case"Folhas de cálculo":case"Planilhas":case"Regneark":case"Hojas de cálculo":case"Werkbladen":r.Worksheets=u,r.SheetNames=o.slice(l,l+u);break;case"Named Ranges":case"Rangos con nombre":case"名前付き一覧":case"Benannte Bereiche":case"Navngivne områder":r.NamedRanges=u,r.DefinedNames=o.slice(l,l+u);break;case"Charts":case"Diagramme":r.Chartsheets=u,r.ChartNames=o.slice(l,l+u);break}l+=u}}function mCe(e,t,r){var n={};return t||(t={}),e=Xn(e),qm.forEach(function(a){var s=(e.match(Kv(a[0]))||[])[1];switch(a[2]){case"string":s&&(t[a[1]]=vn(s));break;case"bool":t[a[1]]=s==="true";break;case"raw":var o=e.match(new RegExp("<"+a[0]+"[^>]*>([\\s\\S]*?)</"+a[0]+">"));o&&o.length>0&&(n[a[1]]=o[1]);break}}),n.HeadingPairs&&n.TitlesOfParts&&qG(n.HeadingPairs,n.TitlesOfParts,t,r),t}function WG(e){var t=[],r=Wt;return e||(e={}),e.Application="SheetJS",t[t.length]=pi,t[t.length]=Wt("Properties",null,{xmlns:$i.EXT_PROPS,"xmlns:vt":$i.vt}),qm.forEach(function(n){if(e[n[1]]!==void 0){var a;switch(n[2]){case"string":a=Vn(String(e[n[1]]));break;case"bool":a=e[n[1]]?"true":"false";break}a!==void 0&&(t[t.length]=r(n[0],a))}}),t[t.length]=r("HeadingPairs",r("vt:vector",r("vt:variant","<vt:lpstr>Worksheets</vt:lpstr>")+r("vt:variant",r("vt:i4",String(e.Worksheets))),{size:2,baseType:"variant"})),t[t.length]=r("TitlesOfParts",r("vt:vector",e.SheetNames.map(function(n){return"<vt:lpstr>"+Vn(n)+"</vt:lpstr>"}).join(""),{size:e.Worksheets,baseType:"lpstr"})),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}var pCe=/<[^>]+>[^<]*/g;function xCe(e,t){var r={},n="",a=e.match(pCe);if(a)for(var s=0;s!=a.length;++s){var o=a[s],l=Tr(o);switch(l[0]){case"<?xml":break;case"<Properties":break;case"<property":n=vn(l.name);break;case"</property>":n=null;break;default:if(o.indexOf("<vt:")===0){var u=o.split(">"),d=u[0].slice(4),f=u[1];switch(d){case"lpstr":case"bstr":case"lpwstr":r[n]=vn(f);break;case"bool":r[n]=ya(f);break;case"i1":case"i2":case"i4":case"i8":case"int":case"uint":r[n]=parseInt(f,10);break;case"r4":case"r8":case"decimal":r[n]=parseFloat(f);break;case"filetime":case"date":r[n]=ja(f);break;case"cy":case"error":r[n]=vn(f);break;default:if(d.slice(-1)=="/")break;t.WTF&&typeof console<"u"&&console.warn("Unexpected",o,d,u)}}else if(o.slice(0,2)!=="</"){if(t.WTF)throw new Error(o)}}}return r}function GG(e){var t=[pi,Wt("Properties",null,{xmlns:$i.CUST_PROPS,"xmlns:vt":$i.vt})];if(!e)return t.join("");var r=1;return ri(e).forEach(function(a){++r,t[t.length]=Wt("property",Ake(e[a]),{fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:r,name:Vn(a)})}),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}var dk={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"},n3;function gCe(e,t,r){n3||(n3=X5(dk)),t=n3[t]||t,e[t]=r}function vCe(e,t){var r=[];return ri(dk).map(function(n){for(var a=0;a<ql.length;++a)if(ql[a][1]==n)return ql[a];for(a=0;a<qm.length;++a)if(qm[a][1]==n)return qm[a];throw n}).forEach(function(n){if(e[n[1]]!=null){var a=t&&t.Props&&t.Props[n[1]]!=null?t.Props[n[1]]:e[n[1]];switch(n[2]){case"date":a=new Date(a).toISOString().replace(/\.\d*Z/,"Z");break}typeof a=="number"?a=String(a):a===!0||a===!1?a=a?"1":"0":a instanceof Date&&(a=new Date(a).toISOString().replace(/\.\d*Z/,"")),r.push(Es(dk[n[1]]||n[1],a))}}),Wt("DocumentProperties",r.join(""),{xmlns:sl.o})}function yCe(e,t){var r=["Worksheets","SheetNames"],n="CustomDocumentProperties",a=[];return e&&ri(e).forEach(function(s){if(Object.prototype.hasOwnProperty.call(e,s)){for(var o=0;o<ql.length;++o)if(s==ql[o][1])return;for(o=0;o<qm.length;++o)if(s==qm[o][1])return;for(o=0;o<r.length;++o)if(s==r[o])return;var l=e[s],u="string";typeof l=="number"?(u="float",l=String(l)):l===!0||l===!1?(u="boolean",l=l?"1":"0"):l=String(l),a.push(Wt(ZF(s),l,{"dt:dt":u}))}}),t&&ri(t).forEach(function(s){if(Object.prototype.hasOwnProperty.call(t,s)&&!(e&&Object.prototype.hasOwnProperty.call(e,s))){var o=t[s],l="string";typeof o=="number"?(l="float",o=String(o)):o===!0||o===!1?(l="boolean",o=o?"1":"0"):o instanceof Date?(l="dateTime.tz",o=o.toISOString()):o=String(o),a.push(Wt(ZF(s),o,{"dt:dt":l}))}}),"<"+n+' xmlns="'+sl.o+'">'+a.join("")+"</"+n+">"}function DE(e){var t=e.read_shift(4),r=e.read_shift(4);return new Date((r/1e7*Math.pow(2,32)+t/1e7-11644473600)*1e3).toISOString().replace(/\.000/,"")}function bCe(e){var t=typeof e=="string"?new Date(Date.parse(e)):e,r=t.getTime()/1e3+11644473600,n=r%Math.pow(2,32),a=(r-n)/Math.pow(2,32);n*=1e7,a*=1e7;var s=n/Math.pow(2,32)|0;s>0&&(n=n%Math.pow(2,32),a+=s);var o=St(8);return o.write_shift(4,n),o.write_shift(4,a),o}function YG(e,t,r){var n=e.l,a=e.read_shift(0,"lpstr-cp");if(r)for(;e.l-n&3;)++e.l;return a}function KG(e,t,r){var n=e.read_shift(0,"lpwstr");return n}function XG(e,t,r){return t===31?KG(e):YG(e,t,r)}function fk(e,t,r){return XG(e,t,r===!1?0:4)}function wCe(e,t){if(!t)throw new Error("VtUnalignedString must have positive length");return XG(e,t,0)}function jCe(e){for(var t=e.read_shift(4),r=[],n=0;n!=t;++n){var a=e.l;r[n]=e.read_shift(0,"lpwstr").replace(uo,""),e.l-a&2&&(e.l+=2)}return r}function NCe(e){for(var t=e.read_shift(4),r=[],n=0;n!=t;++n)r[n]=e.read_shift(0,"lpstr-cp").replace(uo,"");return r}function SCe(e){var t=e.l,r=Iw(e,FG);e[e.l]==0&&e[e.l+1]==0&&e.l-t&2&&(e.l+=2);var n=Iw(e,Mo);return[r,n]}function ACe(e){for(var t=e.read_shift(4),r=[],n=0;n<t/2;++n)r.push(SCe(e));return r}function f7(e,t){for(var r=e.read_shift(4),n={},a=0;a!=r;++a){var s=e.read_shift(4),o=e.read_shift(4);n[s]=e.read_shift(o,t===1200?"utf16le":"utf8").replace(uo,"").replace(Jg,"!"),t===1200&&o%2&&(e.l+=2)}return e.l&3&&(e.l=e.l>>3<<2),n}function ZG(e){var t=e.read_shift(4),r=e.slice(e.l,e.l+t);return e.l+=t,(t&3)>0&&(e.l+=4-(t&3)&3),r}function kCe(e){var t={};return t.Size=e.read_shift(4),e.l+=t.Size+3-(t.Size-1)%4,t}function Iw(e,t,r){var n=e.read_shift(2),a,s=r||{};if(e.l+=2,t!==c7&&n!==t&&nCe.indexOf(t)===-1&&!((t&65534)==4126&&(n&65534)==4126))throw new Error("Expected type "+t+" saw "+n);switch(t===c7?n:t){case 2:return a=e.read_shift(2,"i"),s.raw||(e.l+=2),a;case 3:return a=e.read_shift(4,"i"),a;case 11:return e.read_shift(4)!==0;case 19:return a=e.read_shift(4),a;case 30:return YG(e,n,4).replace(uo,"");case 31:return KG(e);case 64:return DE(e);case 65:return ZG(e);case 71:return kCe(e);case 80:return fk(e,n,!s.raw).replace(uo,"");case 81:return wCe(e,n).replace(uo,"");case 4108:return ACe(e);case 4126:case 4127:return n==4127?jCe(e):NCe(e);default:throw new Error("TypedPropertyValue unrecognized type "+t+" "+n)}}function h7(e,t){var r=St(4),n=St(4);switch(r.write_shift(4,e==80?31:e),e){case 3:n.write_shift(-4,t);break;case 5:n=St(8),n.write_shift(8,t,"f");break;case 11:n.write_shift(4,t?1:0);break;case 64:n=bCe(t);break;case 31:case 80:for(n=St(4+2*(t.length+1)+(t.length%2?0:2)),n.write_shift(4,t.length+1),n.write_shift(0,t,"dbcs");n.l!=n.length;)n.write_shift(1,0);break;default:throw new Error("TypedPropertyValue unrecognized type "+e+" "+t)}return os([r,n])}function m7(e,t){var r=e.l,n=e.read_shift(4),a=e.read_shift(4),s=[],o=0,l=0,u=-1,d={};for(o=0;o!=a;++o){var f=e.read_shift(4),m=e.read_shift(4);s[o]=[f,m+r]}s.sort(function(k,A){return k[1]-A[1]});var g={};for(o=0;o!=a;++o){if(e.l!==s[o][1]){var x=!0;if(o>0&&t)switch(t[s[o-1][0]].t){case 2:e.l+2===s[o][1]&&(e.l+=2,x=!1);break;case 80:e.l<=s[o][1]&&(e.l=s[o][1],x=!1);break;case 4108:e.l<=s[o][1]&&(e.l=s[o][1],x=!1);break}if((!t||o==0)&&e.l<=s[o][1]&&(x=!1,e.l=s[o][1]),x)throw new Error("Read Error: Expected address "+s[o][1]+" at "+e.l+" :"+o)}if(t){var y=t[s[o][0]];if(g[y.n]=Iw(e,y.t,{raw:!0}),y.p==="version"&&(g[y.n]=String(g[y.n]>>16)+"."+("0000"+String(g[y.n]&65535)).slice(-4)),y.n=="CodePage")switch(g[y.n]){case 0:g[y.n]=1252;case 874:case 932:case 936:case 949:case 950:case 1250:case 1251:case 1253:case 1254:case 1255:case 1256:case 1257:case 1258:case 1e4:case 1200:case 1201:case 1252:case 65e3:case-536:case 65001:case-535:Cc(l=g[y.n]>>>0&65535);break;default:throw new Error("Unsupported CodePage: "+g[y.n])}}else if(s[o][0]===1){if(l=g.CodePage=Iw(e,TE),Cc(l),u!==-1){var v=e.l;e.l=s[u][1],d=f7(e,l),e.l=v}}else if(s[o][0]===0){if(l===0){u=o,e.l=s[o+1][1];continue}d=f7(e,l)}else{var w=d[s[o][0]],j;switch(e[e.l]){case 65:e.l+=4,j=ZG(e);break;case 30:e.l+=4,j=fk(e,e[e.l-4]).replace(/\u0000+$/,"");break;case 31:e.l+=4,j=fk(e,e[e.l-4]).replace(/\u0000+$/,"");break;case 3:e.l+=4,j=e.read_shift(4,"i");break;case 19:e.l+=4,j=e.read_shift(4);break;case 5:e.l+=4,j=e.read_shift(8,"f");break;case 11:e.l+=4,j=li(e,4);break;case 64:e.l+=4,j=ja(DE(e));break;default:throw new Error("unparsed value: "+e[e.l])}g[w]=j}}return e.l=r+n,g}var JG=["CodePage","Thumbnail","_PID_LINKBASE","_PID_HLINKS","SystemIdentifier","FMTID"];function CCe(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 p7(e,t,r){var n=St(8),a=[],s=[],o=8,l=0,u=St(8),d=St(8);if(u.write_shift(4,2),u.write_shift(4,1200),d.write_shift(4,1),s.push(u),a.push(d),o+=8+u.length,!t){d=St(8),d.write_shift(4,0),a.unshift(d);var f=[St(4)];for(f[0].write_shift(4,e.length),l=0;l<e.length;++l){var m=e[l][0];for(u=St(8+2*(m.length+1)+(m.length%2?0:2)),u.write_shift(4,l+2),u.write_shift(4,m.length+1),u.write_shift(0,m,"dbcs");u.l!=u.length;)u.write_shift(1,0);f.push(u)}u=os(f),s.unshift(u),o+=8+u.length}for(l=0;l<e.length;++l)if(!(t&&!t[e[l][0]])&&!(JG.indexOf(e[l][0])>-1||VG.indexOf(e[l][0])>-1)&&e[l][1]!=null){var g=e[l][1],x=0;if(t){x=+t[e[l][0]];var y=r[x];if(y.p=="version"&&typeof g=="string"){var v=g.split(".");g=(+v[0]<<16)+(+v[1]||0)}u=h7(y.t,g)}else{var w=CCe(g);w==-1&&(w=31,g=String(g)),u=h7(w,g)}s.push(u),d=St(8),d.write_shift(4,t?x:2+l),a.push(d),o+=8+u.length}var j=8*(s.length+1);for(l=0;l<s.length;++l)a[l].write_shift(4,j),j+=s[l].length;return n.write_shift(4,o),n.write_shift(4,s.length),os([n].concat(a).concat(s))}function x7(e,t,r){var n=e.content;if(!n)return{};_s(n,0);var a,s,o,l,u=0;n.chk("feff","Byte Order: "),n.read_shift(2);var d=n.read_shift(4),f=n.read_shift(16);if(f!==br.utils.consts.HEADER_CLSID&&f!==r)throw new Error("Bad PropertySet CLSID "+f);if(a=n.read_shift(4),a!==1&&a!==2)throw new Error("Unrecognized #Sets: "+a);if(s=n.read_shift(16),l=n.read_shift(4),a===1&&l!==n.l)throw new Error("Length mismatch: "+l+" !== "+n.l);a===2&&(o=n.read_shift(16),u=n.read_shift(4));var m=m7(n,t),g={SystemIdentifier:d};for(var x in m)g[x]=m[x];if(g.FMTID=s,a===1)return g;if(u-n.l==2&&(n.l+=2),n.l!==u)throw new Error("Length mismatch 2: "+n.l+" !== "+u);var y;try{y=m7(n,null)}catch{}for(x in y)g[x]=y[x];return g.FMTID=[s,o],g}function g7(e,t,r,n,a,s){var o=St(a?68:48),l=[o];o.write_shift(2,65534),o.write_shift(2,0),o.write_shift(4,842412599),o.write_shift(16,br.utils.consts.HEADER_CLSID,"hex"),o.write_shift(4,a?2:1),o.write_shift(16,t,"hex"),o.write_shift(4,a?68:48);var u=p7(e,r,n);if(l.push(u),a){var d=p7(a,null,null);o.write_shift(16,s,"hex"),o.write_shift(4,68+u.length),l.push(d)}return os(l)}function rh(e,t){return e.read_shift(t),null}function _Ce(e,t){t||(t=St(e));for(var r=0;r<e;++r)t.write_shift(1,0);return t}function ECe(e,t,r){for(var n=[],a=e.l+t;e.l<a;)n.push(r(e,a-e.l));if(a!==e.l)throw new Error("Slurp error");return n}function li(e,t){return e.read_shift(t)===1}function ao(e,t){return t||(t=St(2)),t.write_shift(2,+!!e),t}function wi(e){return e.read_shift(2,"u")}function Bl(e,t){return t||(t=St(2)),t.write_shift(2,e),t}function QG(e,t){return ECe(e,t,wi)}function TCe(e){var t=e.read_shift(1),r=e.read_shift(1);return r===1?t:t===1}function eY(e,t,r){return r||(r=St(2)),r.write_shift(1,t=="e"?+e:+!!e),r.write_shift(1,t=="e"?1:0),r}function I1(e,t,r){var n=e.read_shift(r&&r.biff>=12?2:1),a="sbcs-cont";if(r&&r.biff>=8,!r||r.biff==8){var s=e.read_shift(1);s&&(a="dbcs-cont")}else r.biff==12&&(a="wstr");r.biff>=2&&r.biff<=5&&(a="cpstr");var o=n?e.read_shift(n,a):"";return o}function PCe(e){var t=e.read_shift(2),r=e.read_shift(1),n=r&4,a=r&8,s=1+(r&1),o=0,l,u={};a&&(o=e.read_shift(2)),n&&(l=e.read_shift(4));var d=s==2?"dbcs-cont":"sbcs-cont",f=t===0?"":e.read_shift(t,d);return a&&(e.l+=4*o),n&&(e.l+=l),u.t=f,a||(u.raw="<t>"+u.t+"</t>",u.r=u.t),u}function DCe(e){var t=e.t||"",r=St(3);r.write_shift(2,t.length),r.write_shift(1,1);var n=St(2*t.length);n.write_shift(2*t.length,t,"utf16le");var a=[r,n];return os(a)}function f0(e,t,r){var n;if(r){if(r.biff>=2&&r.biff<=5)return e.read_shift(t,"cpstr");if(r.biff>=12)return e.read_shift(t,"dbcs-cont")}var a=e.read_shift(1);return a===0?n=e.read_shift(t,"sbcs-cont"):n=e.read_shift(t,"dbcs-cont"),n}function F1(e,t,r){var n=e.read_shift(r&&r.biff==2?1:2);return n===0?(e.l++,""):f0(e,n,r)}function C0(e,t,r){if(r.biff>5)return F1(e,t,r);var n=e.read_shift(1);return n===0?(e.l++,""):e.read_shift(n,r.biff<=4||!e.lens?"cpstr":"sbcs-cont")}function tY(e,t,r){return r||(r=St(3+2*e.length)),r.write_shift(2,e.length),r.write_shift(1,1),r.write_shift(31,e,"utf16le"),r}function OCe(e){var t=e.read_shift(1);e.l++;var r=e.read_shift(2);return e.l+=2,[t,r]}function RCe(e){var t=e.read_shift(4),r=e.l,n=!1;t>24&&(e.l+=t-24,e.read_shift(16)==="795881f43b1d7f48af2c825dc4852763"&&(n=!0),e.l=r);var a=e.read_shift((n?t-24:t)>>1,"utf16le").replace(uo,"");return n&&(e.l+=24),a}function MCe(e){for(var t=e.read_shift(2),r="";t-- >0;)r+="../";var n=e.read_shift(0,"lpstr-ansi");if(e.l+=2,e.read_shift(2)!=57005)throw new Error("Bad FileMoniker");var a=e.read_shift(4);if(a===0)return r+n.replace(/\\/g,"/");var s=e.read_shift(4);if(e.read_shift(2)!=3)throw new Error("Bad FileMoniker");var o=e.read_shift(s>>1,"utf16le").replace(uo,"");return r+o}function LCe(e,t){var r=e.read_shift(16);switch(r){case"e0c9ea79f9bace118c8200aa004ba90b":return RCe(e);case"0303000000000000c000000000000046":return MCe(e);default:throw new Error("Unsupported Moniker "+r)}}function Pb(e){var t=e.read_shift(4),r=t>0?e.read_shift(t,"utf16le").replace(uo,""):"";return r}function v7(e,t){t||(t=St(6+e.length*2)),t.write_shift(4,1+e.length);for(var r=0;r<e.length;++r)t.write_shift(2,e.charCodeAt(r));return t.write_shift(2,0),t}function ICe(e,t){var r=e.l+t,n=e.read_shift(4);if(n!==2)throw new Error("Unrecognized streamVersion: "+n);var a=e.read_shift(2);e.l+=2;var s,o,l,u,d="",f,m;a&16&&(s=Pb(e,r-e.l)),a&128&&(o=Pb(e,r-e.l)),(a&257)===257&&(l=Pb(e,r-e.l)),(a&257)===1&&(u=LCe(e,r-e.l)),a&8&&(d=Pb(e,r-e.l)),a&32&&(f=e.read_shift(16)),a&64&&(m=DE(e)),e.l=r;var g=o||l||u||"";g&&d&&(g+="#"+d),g||(g="#"+d),a&2&&g.charAt(0)=="/"&&g.charAt(1)!="/"&&(g="file://"+g);var x={Target:g};return f&&(x.guid=f),m&&(x.time=m),s&&(x.Tooltip=s),x}function FCe(e){var t=St(512),r=0,n=e.Target;n.slice(0,7)=="file://"&&(n=n.slice(7));var a=n.indexOf("#"),s=a>-1?31:23;switch(n.charAt(0)){case"#":s=28;break;case".":s&=-3;break}t.write_shift(4,2),t.write_shift(4,s);var o=[8,6815827,6619237,4849780,83];for(r=0;r<o.length;++r)t.write_shift(4,o[r]);if(s==28)n=n.slice(1),v7(n,t);else if(s&2){for(o="e0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),r=0;r<o.length;++r)t.write_shift(1,parseInt(o[r],16));var l=a>-1?n.slice(0,a):n;for(t.write_shift(4,2*(l.length+1)),r=0;r<l.length;++r)t.write_shift(2,l.charCodeAt(r));t.write_shift(2,0),s&8&&v7(a>-1?n.slice(a+1):"",t)}else{for(o="03 03 00 00 00 00 00 00 c0 00 00 00 00 00 00 46".split(" "),r=0;r<o.length;++r)t.write_shift(1,parseInt(o[r],16));for(var u=0;n.slice(u*3,u*3+3)=="../"||n.slice(u*3,u*3+3)=="..\\";)++u;for(t.write_shift(2,u),t.write_shift(4,n.length-3*u+1),r=0;r<n.length-3*u;++r)t.write_shift(1,n.charCodeAt(r+3*u)&255);for(t.write_shift(1,0),t.write_shift(2,65535),t.write_shift(2,57005),r=0;r<6;++r)t.write_shift(4,0)}return t.slice(0,t.l)}function rY(e){var t=e.read_shift(1),r=e.read_shift(1),n=e.read_shift(1),a=e.read_shift(1);return[t,r,n,a]}function nY(e,t){var r=rY(e);return r[3]=0,r}function Ju(e){var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(2);return{r:t,c:r,ixfe:n}}function h0(e,t,r,n){return n||(n=St(6)),n.write_shift(2,e),n.write_shift(2,t),n.write_shift(2,r||0),n}function BCe(e){var t=e.read_shift(2),r=e.read_shift(2);return e.l+=8,{type:t,flags:r}}function zCe(e,t,r){return t===0?"":C0(e,t,r)}function UCe(e,t,r){var n=r.biff>8?4:2,a=e.read_shift(n),s=e.read_shift(n,"i"),o=e.read_shift(n,"i");return[a,s,o]}function aY(e){var t=e.read_shift(2),r=EE(e);return[t,r]}function $Ce(e,t,r){e.l+=4,t-=4;var n=e.l+t,a=I1(e,t,r),s=e.read_shift(2);if(n-=e.l,s!==n)throw new Error("Malformed AddinUdf: padding = "+n+" != "+s);return e.l+=s,a}function Q5(e){var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(2),a=e.read_shift(2);return{s:{c:n,r:t},e:{c:a,r}}}function iY(e,t){return t||(t=St(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 sY(e){var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(1),a=e.read_shift(1);return{s:{c:n,r:t},e:{c:a,r}}}var HCe=sY;function oY(e){e.l+=4;var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(2);return e.l+=12,[r,t,n]}function VCe(e){var t={};return e.l+=4,e.l+=16,t.fSharedNote=e.read_shift(2),e.l+=4,t}function qCe(e){var t={};return e.l+=4,e.cf=e.read_shift(2),t}function Fs(e){e.l+=2,e.l+=e.read_shift(2)}var WCe={0:Fs,4:Fs,5:Fs,6:Fs,7:qCe,8:Fs,9:Fs,10:Fs,11:Fs,12:Fs,13:VCe,14:Fs,15:Fs,16:Fs,17:Fs,18:Fs,19:Fs,20:Fs,21:oY};function GCe(e,t){for(var r=e.l+t,n=[];e.l<r;){var a=e.read_shift(2);e.l-=2;try{n.push(WCe[a](e,r-e.l))}catch{return e.l=r,n}}return e.l!=r&&(e.l=r),n}function Db(e,t){var r={BIFFVer:0,dt:0};switch(r.BIFFVer=e.read_shift(2),t-=2,t>=2&&(r.dt=e.read_shift(2),e.l-=2),r.BIFFVer){case 1536:case 1280:case 1024:case 768:case 512:case 2:case 7:break;default:if(t>6)throw new Error("Unexpected BIFF Ver "+r.BIFFVer)}return e.read_shift(t),r}function OE(e,t,r){var n=1536,a=16;switch(r.bookType){case"biff8":break;case"biff5":n=1280,a=8;break;case"biff4":n=4,a=6;break;case"biff3":n=3,a=6;break;case"biff2":n=2,a=4;break;case"xla":break;default:throw new Error("unsupported BIFF version")}var s=St(a);return s.write_shift(2,n),s.write_shift(2,t),a>4&&s.write_shift(2,29282),a>6&&s.write_shift(2,1997),a>8&&(s.write_shift(2,49161),s.write_shift(2,1),s.write_shift(2,1798),s.write_shift(2,0)),s}function YCe(e,t){return t===0||e.read_shift(2),1200}function KCe(e,t,r){if(r.enc)return e.l+=t,"";var n=e.l,a=C0(e,0,r);return e.read_shift(t+n-e.l),a}function XCe(e,t){var r=!t||t.biff==8,n=St(r?112:54);for(n.write_shift(t.biff==8?2:1,7),r&&n.write_shift(1,0),n.write_shift(4,859007059),n.write_shift(4,5458548|(r?0:536870912));n.l<n.length;)n.write_shift(1,r?0:32);return n}function ZCe(e,t,r){var n=r&&r.biff==8||t==2?e.read_shift(2):(e.l+=t,0);return{fDialog:n&16,fBelow:n&64,fRight:n&128}}function JCe(e,t,r){var n=e.read_shift(4),a=e.read_shift(1)&3,s=e.read_shift(1);switch(s){case 0:s="Worksheet";break;case 1:s="Macrosheet";break;case 2:s="Chartsheet";break;case 6:s="VBAModule";break}var o=I1(e,0,r);return o.length===0&&(o="Sheet1"),{pos:n,hs:a,dt:s,name:o}}function QCe(e,t){var r=!t||t.biff>=8?2:1,n=St(8+r*e.name.length);n.write_shift(4,e.pos),n.write_shift(1,e.hs||0),n.write_shift(1,e.dt),n.write_shift(1,e.name.length),t.biff>=8&&n.write_shift(1,1),n.write_shift(r*e.name.length,e.name,t.biff<8?"sbcs":"utf16le");var a=n.slice(0,n.l);return a.l=n.l,a}function e_e(e,t){for(var r=e.l+t,n=e.read_shift(4),a=e.read_shift(4),s=[],o=0;o!=a&&e.l<r;++o)s.push(PCe(e));return s.Count=n,s.Unique=a,s}function t_e(e,t){var r=St(8);r.write_shift(4,e.Count),r.write_shift(4,e.Unique);for(var n=[],a=0;a<e.length;++a)n[a]=DCe(e[a]);var s=os([r].concat(n));return s.parts=[r.length].concat(n.map(function(o){return o.length})),s}function r_e(e,t){var r={};return r.dsst=e.read_shift(2),e.l+=t-2,r}function n_e(e){var t={};t.r=e.read_shift(2),t.c=e.read_shift(2),t.cnt=e.read_shift(2)-t.c;var r=e.read_shift(2);e.l+=4;var n=e.read_shift(1);return e.l+=3,n&7&&(t.level=n&7),n&32&&(t.hidden=!0),n&64&&(t.hpt=r/20),t}function a_e(e){var t=BCe(e);if(t.type!=2211)throw new Error("Invalid Future Record "+t.type);var r=e.read_shift(4);return r!==0}function i_e(e){return e.read_shift(2),e.read_shift(4)}function y7(e,t,r){var n=0;r&&r.biff==2||(n=e.read_shift(2));var a=e.read_shift(2);r&&r.biff==2&&(n=1-(a>>15),a&=32767);var s={Unsynced:n&1,DyZero:(n&2)>>1,ExAsc:(n&4)>>2,ExDsc:(n&8)>>3};return[s,a]}function s_e(e){var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(2),a=e.read_shift(2),s=e.read_shift(2),o=e.read_shift(2),l=e.read_shift(2),u=e.read_shift(2),d=e.read_shift(2);return{Pos:[t,r],Dim:[n,a],Flags:s,CurTab:o,FirstTab:l,Selected:u,TabRatio:d}}function o_e(){var e=St(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 l_e(e,t,r){if(r&&r.biff>=2&&r.biff<5)return{};var n=e.read_shift(2);return{RTL:n&64}}function c_e(e){var t=St(18),r=1718;return e&&e.RTL&&(r|=64),t.write_shift(2,r),t.write_shift(4,0),t.write_shift(4,64),t.write_shift(4,0),t.write_shift(4,0),t}function u_e(){}function d_e(e,t,r){var n={dyHeight:e.read_shift(2),fl:e.read_shift(2)};switch(r&&r.biff||8){case 2:break;case 3:case 4:e.l+=2;break;default:e.l+=10;break}return n.name=I1(e,0,r),n}function f_e(e,t){var r=e.name||"Arial",n=t&&t.biff==5,a=n?15+r.length:16+2*r.length,s=St(a);return s.write_shift(2,e.sz*20),s.write_shift(4,0),s.write_shift(2,400),s.write_shift(4,0),s.write_shift(2,0),s.write_shift(1,r.length),n||s.write_shift(1,1),s.write_shift((n?1:2)*r.length,r,n?"sbcs":"utf16le"),s}function h_e(e){var t=Ju(e);return t.isst=e.read_shift(4),t}function m_e(e,t,r,n){var a=St(10);return h0(e,t,n,a),a.write_shift(4,r),a}function p_e(e,t,r){r.biffguess&&r.biff==2&&(r.biff=5);var n=e.l+t,a=Ju(e);r.biff==2&&e.l++;var s=F1(e,n-e.l,r);return a.val=s,a}function x_e(e,t,r,n,a){var s=!a||a.biff==8,o=St(8+ +s+(1+s)*r.length);return h0(e,t,n,o),o.write_shift(2,r.length),s&&o.write_shift(1,1),o.write_shift((1+s)*r.length,r,s?"utf16le":"sbcs"),o}function g_e(e,t,r){var n=e.read_shift(2),a=C0(e,0,r);return[n,a]}function v_e(e,t,r,n){var a=r&&r.biff==5;n||(n=St(a?3+t.length:5+2*t.length)),n.write_shift(2,e),n.write_shift(a?1:2,t.length),a||n.write_shift(1,1),n.write_shift((a?1:2)*t.length,t,a?"sbcs":"utf16le");var s=n.length>n.l?n.slice(0,n.l):n;return s.l==null&&(s.l=s.length),s}var y_e=C0;function b7(e,t,r){var n=e.l+t,a=r.biff==8||!r.biff?4:2,s=e.read_shift(a),o=e.read_shift(a),l=e.read_shift(2),u=e.read_shift(2);return e.l=n,{s:{r:s,c:l},e:{r:o,c:u}}}function b_e(e,t){var r=t.biff==8||!t.biff?4:2,n=St(2*r+6);return n.write_shift(r,e.s.r),n.write_shift(r,e.e.r+1),n.write_shift(2,e.s.c),n.write_shift(2,e.e.c+1),n.write_shift(2,0),n}function w_e(e){var t=e.read_shift(2),r=e.read_shift(2),n=aY(e);return{r:t,c:r,ixfe:n[0],rknum:n[1]}}function j_e(e,t){for(var r=e.l+t-2,n=e.read_shift(2),a=e.read_shift(2),s=[];e.l<r;)s.push(aY(e));if(e.l!==r)throw new Error("MulRK read error");var o=e.read_shift(2);if(s.length!=o-a+1)throw new Error("MulRK length mismatch");return{r:n,c:a,C:o,rkrec:s}}function N_e(e,t){for(var r=e.l+t-2,n=e.read_shift(2),a=e.read_shift(2),s=[];e.l<r;)s.push(e.read_shift(2));if(e.l!==r)throw new Error("MulBlank read error");var o=e.read_shift(2);if(s.length!=o-a+1)throw new Error("MulBlank length mismatch");return{r:n,c:a,C:o,ixfe:s}}function S_e(e,t,r,n){var a={},s=e.read_shift(4),o=e.read_shift(4),l=e.read_shift(4),u=e.read_shift(2);return a.patternType=aCe[l>>26],n.cellStyles&&(a.alc=s&7,a.fWrap=s>>3&1,a.alcV=s>>4&7,a.fJustLast=s>>7&1,a.trot=s>>8&255,a.cIndent=s>>16&15,a.fShrinkToFit=s>>20&1,a.iReadOrder=s>>22&2,a.fAtrNum=s>>26&1,a.fAtrFnt=s>>27&1,a.fAtrAlc=s>>28&1,a.fAtrBdr=s>>29&1,a.fAtrPat=s>>30&1,a.fAtrProt=s>>31&1,a.dgLeft=o&15,a.dgRight=o>>4&15,a.dgTop=o>>8&15,a.dgBottom=o>>12&15,a.icvLeft=o>>16&127,a.icvRight=o>>23&127,a.grbitDiag=o>>30&3,a.icvTop=l&127,a.icvBottom=l>>7&127,a.icvDiag=l>>14&127,a.dgDiag=l>>21&15,a.icvFore=u&127,a.icvBack=u>>7&127,a.fsxButton=u>>14&1),a}function A_e(e,t,r){var n={};return n.ifnt=e.read_shift(2),n.numFmtId=e.read_shift(2),n.flags=e.read_shift(2),n.fStyle=n.flags>>2&1,t-=6,n.data=S_e(e,t,n.fStyle,r),n}function w7(e,t,r,n){var a=r&&r.biff==5;n||(n=St(a?16:20)),n.write_shift(2,0),e.style?(n.write_shift(2,e.numFmtId||0),n.write_shift(2,65524)):(n.write_shift(2,e.numFmtId||0),n.write_shift(2,t<<4));var s=0;return e.numFmtId>0&&a&&(s|=1024),n.write_shift(4,s),n.write_shift(4,0),a||n.write_shift(4,0),n.write_shift(2,0),n}function k_e(e){e.l+=4;var t=[e.read_shift(2),e.read_shift(2)];if(t[0]!==0&&t[0]--,t[1]!==0&&t[1]--,t[0]>7||t[1]>7)throw new Error("Bad Gutters: "+t.join("|"));return t}function C_e(e){var t=St(8);return t.write_shift(4,0),t.write_shift(2,0),t.write_shift(2,0),t}function j7(e,t,r){var n=Ju(e);(r.biff==2||t==9)&&++e.l;var a=TCe(e);return n.val=a,n.t=a===!0||a===!1?"b":"e",n}function __e(e,t,r,n,a,s){var o=St(8);return h0(e,t,n,o),eY(r,s,o),o}function E_e(e,t,r){r.biffguess&&r.biff==2&&(r.biff=5);var n=Ju(e),a=Vs(e);return n.val=a,n}function T_e(e,t,r,n){var a=St(14);return h0(e,t,n,a),d0(r,a),a}var N7=zCe;function P_e(e,t,r){var n=e.l+t,a=e.read_shift(2),s=e.read_shift(2);if(r.sbcch=s,s==1025||s==14849)return[s,a];if(s<1||s>255)throw new Error("Unexpected SupBook type: "+s);for(var o=f0(e,s),l=[];n>e.l;)l.push(F1(e));return[s,a,o,l]}function S7(e,t,r){var n=e.read_shift(2),a,s={fBuiltIn:n&1,fWantAdvise:n>>>1&1,fWantPict:n>>>2&1,fOle:n>>>3&1,fOleLink:n>>>4&1,cf:n>>>5&1023,fIcon:n>>>15&1};return r.sbcch===14849&&(a=$Ce(e,t-2,r)),s.body=a||e.read_shift(t-2),typeof a=="string"&&(s.Name=a),s}var D_e=["_xlnm.Consolidate_Area","_xlnm.Auto_Open","_xlnm.Auto_Close","_xlnm.Extract","_xlnm.Database","_xlnm.Criteria","_xlnm.Print_Area","_xlnm.Print_Titles","_xlnm.Recorder","_xlnm.Data_Form","_xlnm.Auto_Activate","_xlnm.Auto_Deactivate","_xlnm.Sheet_Title","_xlnm._FilterDatabase"];function A7(e,t,r){var n=e.l+t,a=e.read_shift(2),s=e.read_shift(1),o=e.read_shift(1),l=e.read_shift(r&&r.biff==2?1:2),u=0;(!r||r.biff>=5)&&(r.biff!=5&&(e.l+=2),u=e.read_shift(2),r.biff==5&&(e.l+=2),e.l+=4);var d=f0(e,o,r);a&32&&(d=D_e[d.charCodeAt(0)]);var f=n-e.l;r&&r.biff==2&&--f;var m=n==e.l||l===0||!(f>0)?[]:GPe(e,f,r,l);return{chKey:s,Name:d,itab:u,rgce:m}}function lY(e,t,r){if(r.biff<8)return O_e(e,t,r);for(var n=[],a=e.l+t,s=e.read_shift(r.biff>8?4:2);s--!==0;)n.push(UCe(e,r.biff>8?12:6,r));if(e.l!=a)throw new Error("Bad ExternSheet: "+e.l+" != "+a);return n}function O_e(e,t,r){e[e.l+1]==3&&e[e.l]++;var n=I1(e,t,r);return n.charCodeAt(0)==3?n.slice(1):n}function R_e(e,t,r){if(r.biff<8){e.l+=t;return}var n=e.read_shift(2),a=e.read_shift(2),s=f0(e,n,r),o=f0(e,a,r);return[s,o]}function M_e(e,t,r){var n=sY(e);e.l++;var a=e.read_shift(1);return t-=8,[YPe(e,t,r),a,n]}function k7(e,t,r){var n=HCe(e);switch(r.biff){case 2:e.l++,t-=7;break;case 3:case 4:e.l+=2,t-=8;break;default:e.l+=6,t-=12}return[n,qPe(e,t,r)]}function L_e(e){var t=e.read_shift(4)!==0,r=e.read_shift(4)!==0,n=e.read_shift(4);return[t,r,n]}function I_e(e,t,r){if(!(r.biff<8)){var n=e.read_shift(2),a=e.read_shift(2),s=e.read_shift(2),o=e.read_shift(2),l=C0(e,0,r);return r.biff<8&&e.read_shift(1),[{r:n,c:a},l,o,s]}}function F_e(e,t,r){return I_e(e,t,r)}function B_e(e,t){for(var r=[],n=e.read_shift(2);n--;)r.push(Q5(e));return r}function z_e(e){var t=St(2+e.length*8);t.write_shift(2,e.length);for(var r=0;r<e.length;++r)iY(e[r],t);return t}function U_e(e,t,r){if(r&&r.biff<8)return H_e(e,t,r);var n=oY(e),a=GCe(e,t-22,n[1]);return{cmo:n,ft:a}}var $_e={8:function(e,t){var r=e.l+t;e.l+=10;var n=e.read_shift(2);e.l+=4,e.l+=2,e.l+=2,e.l+=2,e.l+=4;var a=e.read_shift(1);return e.l+=a,e.l=r,{fmt:n}}};function H_e(e,t,r){e.l+=4;var n=e.read_shift(2),a=e.read_shift(2),s=e.read_shift(2);e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=6,t-=36;var o=[];return o.push(($_e[n]||Ys)(e,t,r)),{cmo:[a,n,s],ft:o}}function V_e(e,t,r){var n=e.l,a="";try{e.l+=4;var s=(r.lastobj||{cmo:[0,0]}).cmo[1],o;[0,5,7,11,12,14].indexOf(s)==-1?e.l+=6:o=OCe(e,6,r);var l=e.read_shift(2);e.read_shift(2),wi(e,2);var u=e.read_shift(2);e.l+=u;for(var d=1;d<e.lens.length-1;++d){if(e.l-n!=e.lens[d])throw new Error("TxO: bad continue record");var f=e[e.l],m=f0(e,e.lens[d+1]-e.lens[d]-1);if(a+=m,a.length>=(f?l:2*l))break}if(a.length!==l&&a.length!==l*2)throw new Error("cchText: "+l+" != "+a.length);return e.l=n+t,{t:a}}catch{return e.l=n+t,{t:a}}}function q_e(e,t){var r=Q5(e);e.l+=16;var n=ICe(e,t-24);return[r,n]}function W_e(e){var t=St(24),r=Fa(e[0]);t.write_shift(2,r.r),t.write_shift(2,r.r),t.write_shift(2,r.c),t.write_shift(2,r.c);for(var n="d0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),a=0;a<16;++a)t.write_shift(1,parseInt(n[a],16));return os([t,FCe(e[1])])}function G_e(e,t){e.read_shift(2);var r=Q5(e),n=e.read_shift((t-10)/2,"dbcs-cont");return n=n.replace(uo,""),[r,n]}function Y_e(e){var t=e[1].Tooltip,r=St(10+2*(t.length+1));r.write_shift(2,2048);var n=Fa(e[0]);r.write_shift(2,n.r),r.write_shift(2,n.r),r.write_shift(2,n.c),r.write_shift(2,n.c);for(var a=0;a<t.length;++a)r.write_shift(2,t.charCodeAt(a));return r.write_shift(2,0),r}function K_e(e){var t=[0,0],r;return r=e.read_shift(2),t[0]=u7[r]||r,r=e.read_shift(2),t[1]=u7[r]||r,t}function X_e(e){return e||(e=St(4)),e.write_shift(2,1),e.write_shift(2,1),e}function Z_e(e){for(var t=e.read_shift(2),r=[];t-- >0;)r.push(nY(e));return r}function J_e(e){for(var t=e.read_shift(2),r=[];t-- >0;)r.push(nY(e));return r}function Q_e(e){e.l+=2;var t={cxfs:0,crc:0};return t.cxfs=e.read_shift(2),t.crc=e.read_shift(4),t}function cY(e,t,r){if(!r.cellStyles)return Ys(e,t);var n=r&&r.biff>=12?4:2,a=e.read_shift(n),s=e.read_shift(n),o=e.read_shift(n),l=e.read_shift(n),u=e.read_shift(2);n==2&&(e.l+=2);var d={s:a,e:s,w:o,ixfe:l,flags:u};return(r.biff>=5||!r.biff)&&(d.level=u>>8&7),d}function eEe(e,t){var r=St(12);r.write_shift(2,t),r.write_shift(2,t),r.write_shift(2,e.width*256),r.write_shift(2,0);var n=0;return e.hidden&&(n|=1),r.write_shift(1,n),n=e.level||0,r.write_shift(1,n),r.write_shift(2,0),r}function tEe(e,t){var r={};return t<32||(e.l+=16,r.header=Vs(e),r.footer=Vs(e),e.l+=2),r}function rEe(e,t,r){var n={area:!1};if(r.biff!=5)return e.l+=t,n;var a=e.read_shift(1);return e.l+=3,a&16&&(n.area=!0),n}function nEe(e){for(var t=St(2*e),r=0;r<e;++r)t.write_shift(2,r+1);return t}var aEe=Ju,iEe=QG,sEe=F1;function oEe(e){var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(4),a={fmt:t,env:r,len:n,data:e.slice(e.l,e.l+n)};return e.l+=n,a}function lEe(e,t,r){r.biffguess&&r.biff==5&&(r.biff=2);var n=Ju(e);++e.l;var a=C0(e,t-7,r);return n.t="str",n.val=a,n}function cEe(e){var t=Ju(e);++e.l;var r=Vs(e);return t.t="n",t.val=r,t}function uEe(e,t,r){var n=St(15);return $1(n,e,t),n.write_shift(8,r,"f"),n}function dEe(e){var t=Ju(e);++e.l;var r=e.read_shift(2);return t.t="n",t.val=r,t}function fEe(e,t,r){var n=St(9);return $1(n,e,t),n.write_shift(2,r),n}function hEe(e){var t=e.read_shift(1);return t===0?(e.l++,""):e.read_shift(t,"sbcs-cont")}function mEe(e,t){e.l+=6,e.l+=2,e.l+=1,e.l+=3,e.l+=1,e.l+=t-13}function pEe(e,t,r){var n=e.l+t,a=Ju(e),s=e.read_shift(2),o=f0(e,s,r);return e.l=n,a.t="str",a.val=o,a}var xEe=[2,3,48,49,131,139,140,245],hk=(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=X5({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 r(l,u){var d=[],f=_h(1);switch(u.type){case"base64":f=cl(vl(l));break;case"binary":f=cl(l);break;case"buffer":case"array":f=l;break}_s(f,0);var m=f.read_shift(1),g=!!(m&136),x=!1,y=!1;switch(m){case 2:break;case 3:break;case 48:x=!0,g=!0;break;case 49:x=!0,g=!0;break;case 131:break;case 139:break;case 140:y=!0;break;case 245:break;default:throw new Error("DBF Unsupported Version: "+m.toString(16))}var v=0,w=521;m==2&&(v=f.read_shift(2)),f.l+=3,m!=2&&(v=f.read_shift(4)),v>1048576&&(v=1e6),m!=2&&(w=f.read_shift(2));var j=f.read_shift(2),k=u.codepage||1252;m!=2&&(f.l+=16,f.read_shift(1),f[f.l]!==0&&(k=e[f[f.l]]),f.l+=1,f.l+=2),y&&(f.l+=36);for(var A=[],T={},M=Math.min(f.length,m==2?521:w-10-(x?264:0)),B=y?32:11;f.l<M&&f[f.l]!=13;)switch(T={},T.name=Wv.utils.decode(k,f.slice(f.l,f.l+B)).replace(/[\u0000\r\n].*$/g,""),f.l+=B,T.type=String.fromCharCode(f.read_shift(1)),m!=2&&!y&&(T.offset=f.read_shift(4)),T.len=f.read_shift(1),m==2&&(T.offset=f.read_shift(2)),T.dec=f.read_shift(1),T.name.length&&A.push(T),m!=2&&(f.l+=y?13:14),T.type){case"B":(!x||T.len!=8)&&u.WTF&&console.log("Skipping "+T.name+":"+T.type);break;case"G":case"P":u.WTF&&console.log("Skipping "+T.name+":"+T.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: "+T.type)}if(f[f.l]!==13&&(f.l=w-1),f.read_shift(1)!==13)throw new Error("DBF Terminator not found "+f.l+" "+f[f.l]);f.l=w;var L=0,F=0;for(d[0]=[],F=0;F!=A.length;++F)d[0][F]=A[F].name;for(;v-- >0;){if(f[f.l]===42){f.l+=j;continue}for(++f.l,d[++L]=[],F=0,F=0;F!=A.length;++F){var I=f.slice(f.l,f.l+A[F].len);f.l+=A[F].len,_s(I,0);var q=Wv.utils.decode(k,I);switch(A[F].type){case"C":q.trim().length&&(d[L][F]=q.replace(/\s+$/,""));break;case"D":q.length===8?d[L][F]=new Date(+q.slice(0,4),+q.slice(4,6)-1,+q.slice(6,8)):d[L][F]=q;break;case"F":d[L][F]=parseFloat(q.trim());break;case"+":case"I":d[L][F]=y?I.read_shift(-4,"i")^2147483648:I.read_shift(4,"i");break;case"L":switch(q.trim().toUpperCase()){case"Y":case"T":d[L][F]=!0;break;case"N":case"F":d[L][F]=!1;break;case"":case"?":break;default:throw new Error("DBF Unrecognized L:|"+q+"|")}break;case"M":if(!g)throw new Error("DBF Unexpected MEMO for type "+m.toString(16));d[L][F]="##MEMO##"+(y?parseInt(q.trim(),10):I.read_shift(4));break;case"N":q=q.replace(/\u0000/g,"").trim(),q&&q!="."&&(d[L][F]=+q||0);break;case"@":d[L][F]=new Date(I.read_shift(-8,"f")-621356832e5);break;case"T":d[L][F]=new Date((I.read_shift(4)-2440588)*864e5+I.read_shift(4));break;case"Y":d[L][F]=I.read_shift(4,"i")/1e4+I.read_shift(4,"i")/1e4*Math.pow(2,32);break;case"O":d[L][F]=-I.read_shift(-8,"f");break;case"B":if(x&&A[F].len==8){d[L][F]=I.read_shift(8,"f");break}case"G":case"P":I.l+=A[F].len;break;case"0":if(A[F].name==="_NullFlags")break;default:throw new Error("DBF Unsupported data type "+A[F].type)}}}if(m!=2&&f.l<f.length&&f[f.l++]!=26)throw new Error("DBF EOF Marker missing "+(f.l-1)+" of "+f.length+" "+f[f.l-1].toString(16));return u&&u.sheetRows&&(d=d.slice(0,u.sheetRows)),u.DBF=A,d}function n(l,u){var d=u||{};d.dateNF||(d.dateNF="yyyymmdd");var f=Bx(r(l,d),d);return f["!cols"]=d.DBF.map(function(m){return{wch:m.len,DBF:m}}),delete d.DBF,f}function a(l,u){try{return $h(n(l,u),u)}catch(d){if(u&&u.WTF)throw d}return{SheetNames:[],Sheets:{}}}var s={B:8,C:250,L:1,D:8,"?":0,"":0};function o(l,u){var d=u||{};if(+d.codepage>=0&&Cc(+d.codepage),d.type=="string")throw new Error("Cannot write DBF to JS string");var f=Uo(),m=zw(l,{header:1,raw:!0,cellDates:!0}),g=m[0],x=m.slice(1),y=l["!cols"]||[],v=0,w=0,j=0,k=1;for(v=0;v<g.length;++v){if(((y[v]||{}).DBF||{}).name){g[v]=y[v].DBF.name,++j;continue}if(g[v]!=null){if(++j,typeof g[v]=="number"&&(g[v]=g[v].toString(10)),typeof g[v]!="string")throw new Error("DBF Invalid column name "+g[v]+" |"+typeof g[v]+"|");if(g.indexOf(g[v])!==v){for(w=0;w<1024;++w)if(g.indexOf(g[v]+"_"+w)==-1){g[v]+="_"+w;break}}}}var A=yn(l["!ref"]),T=[],M=[],B=[];for(v=0;v<=A.e.c-A.s.c;++v){var L="",F="",I=0,q=[];for(w=0;w<x.length;++w)x[w][v]!=null&&q.push(x[w][v]);if(q.length==0||g[v]==null){T[v]="?";continue}for(w=0;w<q.length;++w){switch(typeof q[w]){case"number":F="B";break;case"string":F="C";break;case"boolean":F="L";break;case"object":F=q[w]instanceof Date?"D":"C";break;default:F="C"}I=Math.max(I,String(q[w]).length),L=L&&L!=F?"C":F}I>250&&(I=250),F=((y[v]||{}).DBF||{}).type,F=="C"&&y[v].DBF.len>I&&(I=y[v].DBF.len),L=="B"&&F=="N"&&(L="N",B[v]=y[v].DBF.dec,I=y[v].DBF.len),M[v]=L=="C"||F=="N"?I:s[L]||0,k+=M[v],T[v]=L}var P=f.next(32);for(P.write_shift(4,318902576),P.write_shift(4,x.length),P.write_shift(2,296+32*j),P.write_shift(2,k),v=0;v<4;++v)P.write_shift(4,0);for(P.write_shift(4,0|(+t[JW]||3)<<8),v=0,w=0;v<g.length;++v)if(g[v]!=null){var R=f.next(32),K=(g[v].slice(-10)+"\0\0\0\0\0\0\0\0\0\0\0").slice(0,11);R.write_shift(1,K,"sbcs"),R.write_shift(1,T[v]=="?"?"C":T[v],"sbcs"),R.write_shift(4,w),R.write_shift(1,M[v]||s[T[v]]||0),R.write_shift(1,B[v]||0),R.write_shift(1,2),R.write_shift(4,0),R.write_shift(1,0),R.write_shift(4,0),R.write_shift(4,0),w+=M[v]||s[T[v]]||0}var ee=f.next(264);for(ee.write_shift(4,13),v=0;v<65;++v)ee.write_shift(4,0);for(v=0;v<x.length;++v){var se=f.next(k);for(se.write_shift(1,0),w=0;w<g.length;++w)if(g[w]!=null)switch(T[w]){case"L":se.write_shift(1,x[v][w]==null?63:x[v][w]?84:70);break;case"B":se.write_shift(8,x[v][w]||0,"f");break;case"N":var Z="0";for(typeof x[v][w]=="number"&&(Z=x[v][w].toFixed(B[w]||0)),j=0;j<M[w]-Z.length;++j)se.write_shift(1,32);se.write_shift(1,Z,"sbcs");break;case"D":x[v][w]?(se.write_shift(4,("0000"+x[v][w].getFullYear()).slice(-4),"sbcs"),se.write_shift(2,("00"+(x[v][w].getMonth()+1)).slice(-2),"sbcs"),se.write_shift(2,("00"+x[v][w].getDate()).slice(-2),"sbcs")):se.write_shift(8,"00000000","sbcs");break;case"C":var ne=String(x[v][w]!=null?x[v][w]:"").slice(0,M[w]);for(se.write_shift(1,ne,"sbcs"),j=0;j<M[w]-ne.length;++j)se.write_shift(1,32);break}}return f.next(1).write_shift(1,26),f.end()}return{to_workbook:a,to_sheet:n,from_sheet:o}})(),uY=(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("+ri(e).join("|").replace(/\|\|\|/,"|\\||").replace(/([?()+])/g,"\\$1")+"|\\|)","gm"),r=function(g,x){var y=e[x];return typeof y=="number"?IF(y):y},n=function(g,x,y){var v=x.charCodeAt(0)-32<<4|y.charCodeAt(0)-48;return v==59?g:IF(v)};e["|"]=254;function a(g,x){switch(x.type){case"base64":return s(vl(g),x);case"binary":return s(g,x);case"buffer":return s(Yr&&Buffer.isBuffer(g)?g.toString("binary"):Uh(g),x);case"array":return s(u0(g),x)}throw new Error("Unrecognized type "+x.type)}function s(g,x){var y=g.split(/[\n\r]+/),v=-1,w=-1,j=0,k=0,A=[],T=[],M=null,B={},L=[],F=[],I=[],q=0,P;for(+x.codepage>=0&&Cc(+x.codepage);j!==y.length;++j){q=0;var R=y[j].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g,n).replace(t,r),K=R.replace(/;;/g,"\0").split(";").map(function(E){return E.replace(/\u0000/g,";")}),ee=K[0],se;if(R.length>0)switch(ee){case"ID":break;case"E":break;case"B":break;case"O":break;case"W":break;case"P":K[1].charAt(0)=="P"&&T.push(R.slice(3).replace(/;;/g,";"));break;case"C":var Z=!1,ne=!1,X=!1,le=!1,Ae=-1,ce=-1;for(k=1;k<K.length;++k)switch(K[k].charAt(0)){case"A":break;case"X":w=parseInt(K[k].slice(1))-1,ne=!0;break;case"Y":for(v=parseInt(K[k].slice(1))-1,ne||(w=0),P=A.length;P<=v;++P)A[P]=[];break;case"K":se=K[k].slice(1),se.charAt(0)==='"'?se=se.slice(1,se.length-1):se==="TRUE"?se=!0:se==="FALSE"?se=!1:isNaN(Pc(se))?isNaN(px(se).getDate())||(se=ja(se)):(se=Pc(se),M!==null&&Ix(M)&&(se=J5(se))),Z=!0;break;case"E":le=!0;var D=Qp(K[k].slice(1),{r:v,c:w});A[v][w]=[A[v][w],D];break;case"S":X=!0,A[v][w]=[A[v][w],"S5S"];break;case"G":break;case"R":Ae=parseInt(K[k].slice(1))-1;break;case"C":ce=parseInt(K[k].slice(1))-1;break;default:if(x&&x.WTF)throw new Error("SYLK bad record "+R)}if(Z&&(A[v][w]&&A[v][w].length==2?A[v][w][0]=se:A[v][w]=se,M=null),X){if(le)throw new Error("SYLK shared formula cannot have own formula");var H=Ae>-1&&A[Ae][ce];if(!H||!H[1])throw new Error("SYLK shared formula cannot find base");A[v][w][1]=_Y(H[1],{r:v-Ae,c:w-ce})}break;case"F":var G=0;for(k=1;k<K.length;++k)switch(K[k].charAt(0)){case"X":w=parseInt(K[k].slice(1))-1,++G;break;case"Y":for(v=parseInt(K[k].slice(1))-1,P=A.length;P<=v;++P)A[P]=[];break;case"M":q=parseInt(K[k].slice(1))/20;break;case"F":break;case"G":break;case"P":M=T[parseInt(K[k].slice(1))];break;case"S":break;case"D":break;case"N":break;case"W":for(I=K[k].slice(1).split(" "),P=parseInt(I[0],10);P<=parseInt(I[1],10);++P)q=parseInt(I[2],10),F[P-1]=q===0?{hidden:!0}:{wch:q},Eh(F[P-1]);break;case"C":w=parseInt(K[k].slice(1))-1,F[w]||(F[w]={});break;case"R":v=parseInt(K[k].slice(1))-1,L[v]||(L[v]={}),q>0?(L[v].hpt=q,L[v].hpx=gx(q)):q===0&&(L[v].hidden=!0);break;default:if(x&&x.WTF)throw new Error("SYLK bad record "+R)}G<1&&(M=null);break;default:if(x&&x.WTF)throw new Error("SYLK bad record "+R)}}return L.length>0&&(B["!rows"]=L),F.length>0&&(B["!cols"]=F),x&&x.sheetRows&&(A=A.slice(0,x.sheetRows)),[A,B]}function o(g,x){var y=a(g,x),v=y[0],w=y[1],j=Bx(v,x);return ri(w).forEach(function(k){j[k]=w[k]}),j}function l(g,x){return $h(o(g,x),x)}function u(g,x,y,v){var w="C;Y"+(y+1)+";X"+(v+1)+";K";switch(g.t){case"n":w+=g.v||0,g.f&&!g.F&&(w+=";E"+BE(g.f,{r:y,c:v}));break;case"b":w+=g.v?"TRUE":"FALSE";break;case"e":w+=g.w||g.v;break;case"d":w+='"'+(g.w||g.v)+'"';break;case"s":w+='"'+g.v.replace(/"/g,"").replace(/;/g,";;")+'"';break}return w}function d(g,x){x.forEach(function(y,v){var w="F;W"+(v+1)+" "+(v+1)+" ";y.hidden?w+="0":(typeof y.width=="number"&&!y.wpx&&(y.wpx=e1(y.width)),typeof y.wpx=="number"&&!y.wch&&(y.wch=t1(y.wpx)),typeof y.wch=="number"&&(w+=Math.round(y.wch))),w.charAt(w.length-1)!=" "&&g.push(w)})}function f(g,x){x.forEach(function(y,v){var w="F;";y.hidden?w+="M0;":y.hpt?w+="M"+20*y.hpt+";":y.hpx&&(w+="M"+20*r1(y.hpx)+";"),w.length>2&&g.push(w+"R"+(v+1))})}function m(g,x){var y=["ID;PWXL;N;E"],v=[],w=yn(g["!ref"]),j,k=Array.isArray(g),A=`\r
`;y.push("P;PGeneral"),y.push("F;P0;DG0G8;M255"),g["!cols"]&&d(y,g["!cols"]),g["!rows"]&&f(y,g["!rows"]),y.push("B;Y"+(w.e.r-w.s.r+1)+";X"+(w.e.c-w.s.c+1)+";D"+[w.s.c,w.s.r,w.e.c,w.e.r].join(" "));for(var T=w.s.r;T<=w.e.r;++T)for(var M=w.s.c;M<=w.e.c;++M){var B=_r({r:T,c:M});j=k?(g[T]||[])[M]:g[B],!(!j||j.v==null&&(!j.f||j.F))&&v.push(u(j,g,T,M))}return y.join(A)+A+v.join(A)+A+"E"+A}return{to_workbook:l,to_sheet:o,from_sheet:m}})(),dY=(function(){function e(s,o){switch(o.type){case"base64":return t(vl(s),o);case"binary":return t(s,o);case"buffer":return t(Yr&&Buffer.isBuffer(s)?s.toString("binary"):Uh(s),o);case"array":return t(u0(s),o)}throw new Error("Unrecognized type "+o.type)}function t(s,o){for(var l=s.split(`
`),u=-1,d=-1,f=0,m=[];f!==l.length;++f){if(l[f].trim()==="BOT"){m[++u]=[],d=0;continue}if(!(u<0)){var g=l[f].trim().split(","),x=g[0],y=g[1];++f;for(var v=l[f]||"";(v.match(/["]/g)||[]).length&1&&f<l.length-1;)v+=`
`+l[++f];switch(v=v.trim(),+x){case-1:if(v==="BOT"){m[++u]=[],d=0;continue}else if(v!=="EOD")throw new Error("Unrecognized DIF special command "+v);break;case 0:v==="TRUE"?m[u][d]=!0:v==="FALSE"?m[u][d]=!1:isNaN(Pc(y))?isNaN(px(y).getDate())?m[u][d]=y:m[u][d]=ja(y):m[u][d]=Pc(y),++d;break;case 1:v=v.slice(1,v.length-1),v=v.replace(/""/g,'"'),v&&v.match(/^=".*"$/)&&(v=v.slice(2,-1)),m[u][d++]=v!==""?v:null;break}if(v==="EOD")break}}return o&&o.sheetRows&&(m=m.slice(0,o.sheetRows)),m}function r(s,o){return Bx(e(s,o),o)}function n(s,o){return $h(r(s,o),o)}var a=(function(){var s=function(u,d,f,m,g){u.push(d),u.push(f+","+m),u.push('"'+g.replace(/"/g,'""')+'"')},o=function(u,d,f,m){u.push(d+","+f),u.push(d==1?'"'+m.replace(/"/g,'""')+'"':m)};return function(u){var d=[],f=yn(u["!ref"]),m,g=Array.isArray(u);s(d,"TABLE",0,1,"sheetjs"),s(d,"VECTORS",0,f.e.r-f.s.r+1,""),s(d,"TUPLES",0,f.e.c-f.s.c+1,""),s(d,"DATA",0,0,"");for(var x=f.s.r;x<=f.e.r;++x){o(d,-1,0,"BOT");for(var y=f.s.c;y<=f.e.c;++y){var v=_r({r:x,c:y});if(m=g?(u[x]||[])[y]:u[v],!m){o(d,1,0,"");continue}switch(m.t){case"n":var w=m.w;!w&&m.v!=null&&(w=m.v),w==null?m.f&&!m.F?o(d,1,0,"="+m.f):o(d,1,0,""):o(d,0,w,"V");break;case"b":o(d,0,m.v?1:0,m.v?"TRUE":"FALSE");break;case"s":o(d,1,0,isNaN(m.v)?m.v:'="'+m.v+'"');break;case"d":m.w||(m.w=Xl(m.z||Cr[14],Hi(ja(m.v)))),o(d,0,m.w,"V");break;default:o(d,1,0,"")}}}o(d,-1,0,"EOD");var j=`\r
`,k=d.join(j);return k}})();return{to_workbook:n,to_sheet:r,from_sheet:a}})(),fY=(function(){function e(m){return m.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n/g,`
`)}function t(m){return m.replace(/\\/g,"\\b").replace(/:/g,"\\c").replace(/\n/g,"\\n")}function r(m,g){for(var x=m.split(`
`),y=-1,v=-1,w=0,j=[];w!==x.length;++w){var k=x[w].trim().split(":");if(k[0]==="cell"){var A=Fa(k[1]);if(j.length<=A.r)for(y=j.length;y<=A.r;++y)j[y]||(j[y]=[]);switch(y=A.r,v=A.c,k[2]){case"t":j[y][v]=e(k[3]);break;case"v":j[y][v]=+k[3];break;case"vtf":var T=k[k.length-1];case"vtc":switch(k[3]){case"nl":j[y][v]=!!+k[4];break;default:j[y][v]=+k[4];break}k[2]=="vtf"&&(j[y][v]=[j[y][v],T])}}}return g&&g.sheetRows&&(j=j.slice(0,g.sheetRows)),j}function n(m,g){return Bx(r(m,g),g)}function a(m,g){return $h(n(m,g),g)}var s=["socialcalc:version:1.5","MIME-Version: 1.0","Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave"].join(`
`),o=["--SocialCalcSpreadsheetControlSave","Content-type: text/plain; charset=UTF-8"].join(`
`)+`
`,l=["# SocialCalc Spreadsheet Control Save","part:sheet"].join(`
`),u="--SocialCalcSpreadsheetControlSave--";function d(m){if(!m||!m["!ref"])return"";for(var g=[],x=[],y,v="",w=$o(m["!ref"]),j=Array.isArray(m),k=w.s.r;k<=w.e.r;++k)for(var A=w.s.c;A<=w.e.c;++A)if(v=_r({r:k,c:A}),y=j?(m[k]||[])[A]:m[v],!(!y||y.v==null||y.t==="z")){switch(x=["cell",v,"t"],y.t){case"s":case"str":x.push(t(y.v));break;case"n":y.f?(x[2]="vtf",x[3]="n",x[4]=y.v,x[5]=t(y.f)):(x[2]="v",x[3]=y.v);break;case"b":x[2]="vt"+(y.f?"f":"c"),x[3]="nl",x[4]=y.v?"1":"0",x[5]=t(y.f||(y.v?"TRUE":"FALSE"));break;case"d":var T=Hi(ja(y.v));x[2]="vtc",x[3]="nd",x[4]=""+T,x[5]=y.w||Xl(y.z||Cr[14],T);break;case"e":continue}g.push(x.join(":"))}return g.push("sheet:c:"+(w.e.c-w.s.c+1)+":r:"+(w.e.r-w.s.r+1)+":tvf:1"),g.push("valueformat:1:text-wiki"),g.join(`
`)}function f(m){return[s,o,l,o,d(m),u].join(`
`)}return{to_workbook:a,to_sheet:n,from_sheet:f}})(),xx=(function(){function e(f,m,g,x,y){y.raw?m[g][x]=f:f===""||(f==="TRUE"?m[g][x]=!0:f==="FALSE"?m[g][x]=!1:isNaN(Pc(f))?isNaN(px(f).getDate())?m[g][x]=f:m[g][x]=ja(f):m[g][x]=Pc(f))}function t(f,m){var g=m||{},x=[];if(!f||f.length===0)return x;for(var y=f.split(/[\r\n]/),v=y.length-1;v>=0&&y[v].length===0;)--v;for(var w=10,j=0,k=0;k<=v;++k)j=y[k].indexOf(" "),j==-1?j=y[k].length:j++,w=Math.max(w,j);for(k=0;k<=v;++k){x[k]=[];var A=0;for(e(y[k].slice(0,w).trim(),x,k,A,g),A=1;A<=(y[k].length-w)/10+1;++A)e(y[k].slice(w+(A-1)*10,w+A*10).trim(),x,k,A,g)}return g.sheetRows&&(x=x.slice(0,g.sheetRows)),x}var r={44:",",9:"	",59:";",124:"|"},n={44:3,9:2,59:1,124:0};function a(f){for(var m={},g=!1,x=0,y=0;x<f.length;++x)(y=f.charCodeAt(x))==34?g=!g:!g&&y in r&&(m[y]=(m[y]||0)+1);y=[];for(x in m)Object.prototype.hasOwnProperty.call(m,x)&&y.push([m[x],x]);if(!y.length){m=n;for(x in m)Object.prototype.hasOwnProperty.call(m,x)&&y.push([m[x],x])}return y.sort(function(v,w){return v[0]-w[0]||n[v[1]]-n[w[1]]}),r[y.pop()[1]]||44}function s(f,m){var g=m||{},x="",y=g.dense?[]:{},v={s:{c:0,r:0},e:{c:0,r:0}};f.slice(0,4)=="sep="?f.charCodeAt(5)==13&&f.charCodeAt(6)==10?(x=f.charAt(4),f=f.slice(7)):f.charCodeAt(5)==13||f.charCodeAt(5)==10?(x=f.charAt(4),f=f.slice(6)):x=a(f.slice(0,1024)):g&&g.FS?x=g.FS:x=a(f.slice(0,1024));var w=0,j=0,k=0,A=0,T=0,M=x.charCodeAt(0),B=!1,L=0,F=f.charCodeAt(0);f=f.replace(/\r\n/mg,`
`);var I=g.dateNF!=null?rke(g.dateNF):null;function q(){var P=f.slice(A,T),R={};if(P.charAt(0)=='"'&&P.charAt(P.length-1)=='"'&&(P=P.slice(1,-1).replace(/""/g,'"')),P.length===0)R.t="z";else if(g.raw)R.t="s",R.v=P;else if(P.trim().length===0)R.t="s",R.v=P;else if(P.charCodeAt(0)==61)P.charCodeAt(1)==34&&P.charCodeAt(P.length-1)==34?(R.t="s",R.v=P.slice(2,-1).replace(/""/g,'"')):P6e(P)?(R.t="n",R.f=P.slice(1)):(R.t="s",R.v=P);else if(P=="TRUE")R.t="b",R.v=!0;else if(P=="FALSE")R.t="b",R.v=!1;else if(!isNaN(k=Pc(P)))R.t="n",g.cellText!==!1&&(R.w=P),R.v=k;else if(!isNaN(px(P).getDate())||I&&P.match(I)){R.z=g.dateNF||Cr[14];var K=0;I&&P.match(I)&&(P=nke(P,g.dateNF,P.match(I)||[]),K=1),g.cellDates?(R.t="d",R.v=ja(P,K)):(R.t="n",R.v=Hi(ja(P,K))),g.cellText!==!1&&(R.w=Xl(R.z,R.v instanceof Date?Hi(R.v):R.v)),g.cellNF||delete R.z}else R.t="s",R.v=P;if(R.t=="z"||(g.dense?(y[w]||(y[w]=[]),y[w][j]=R):y[_r({c:j,r:w})]=R),A=T+1,F=f.charCodeAt(A),v.e.c<j&&(v.e.c=j),v.e.r<w&&(v.e.r=w),L==M)++j;else if(j=0,++w,g.sheetRows&&g.sheetRows<=w)return!0}e:for(;T<f.length;++T)switch(L=f.charCodeAt(T)){case 34:F===34&&(B=!B);break;case M:case 10:case 13:if(!B&&q())break e;break}return T-A>0&&q(),y["!ref"]=zr(v),y}function o(f,m){return!(m&&m.PRN)||m.FS||f.slice(0,4)=="sep="||f.indexOf("	")>=0||f.indexOf(",")>=0||f.indexOf(";")>=0?s(f,m):Bx(t(f,m),m)}function l(f,m){var g="",x=m.type=="string"?[0,0,0,0]:GE(f,m);switch(m.type){case"base64":g=vl(f);break;case"binary":g=f;break;case"buffer":m.codepage==65001?g=f.toString("utf8"):m.codepage&&typeof Wv<"u"||(g=Yr&&Buffer.isBuffer(f)?f.toString("binary"):Uh(f));break;case"array":g=u0(f);break;case"string":g=f;break;default:throw new Error("Unrecognized type "+m.type)}return x[0]==239&&x[1]==187&&x[2]==191?g=Xn(g.slice(3)):m.type!="string"&&m.type!="buffer"&&m.codepage==65001?g=Xn(g):m.type=="binary"&&typeof Wv<"u",g.slice(0,19)=="socialcalc:version:"?fY.to_sheet(m.type=="string"?g:Xn(g),m):o(g,m)}function u(f,m){return $h(l(f,m),m)}function d(f){for(var m=[],g=yn(f["!ref"]),x,y=Array.isArray(f),v=g.s.r;v<=g.e.r;++v){for(var w=[],j=g.s.c;j<=g.e.c;++j){var k=_r({r:v,c:j});if(x=y?(f[v]||[])[j]:f[k],!x||x.v==null){w.push("          ");continue}for(var A=(x.w||(nf(x),x.w)||"").slice(0,10);A.length<10;)A+=" ";w.push(A+(j===0?" ":""))}m.push(w.join(""))}return m.join(`
`)}return{to_workbook:u,to_sheet:l,from_sheet:d}})();function gEe(e,t){var r=t||{},n=!!r.WTF;r.WTF=!0;try{var a=uY.to_workbook(e,r);return r.WTF=n,a}catch(s){if(r.WTF=n,!s.message.match(/SYLK bad record ID/)&&n)throw s;return xx.to_workbook(e,t)}}var Wm=(function(){function e(D,H,G){if(D){_s(D,D.l||0);for(var E=G.Enum||Ae;D.l<D.length;){var re=D.read_shift(2),he=E[re]||E[65535],oe=D.read_shift(2),z=D.l+oe,fe=he.f&&he.f(D,oe,G);if(D.l=z,H(fe,he,re))return}}}function t(D,H){switch(H.type){case"base64":return r(cl(vl(D)),H);case"binary":return r(cl(D),H);case"buffer":case"array":return r(D,H)}throw"Unsupported type "+H.type}function r(D,H){if(!D)return D;var G=H||{},E=G.dense?[]:{},re="Sheet1",he="",oe=0,z={},fe=[],de=[],W={s:{r:0,c:0},e:{r:0,c:0}},ae=G.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)G.Enum=Ae,e(D,function($e,Je,Xe){switch(Xe){case 0:G.vers=$e,$e>=4096&&(G.qpro=!0);break;case 6:W=$e;break;case 204:$e&&(he=$e);break;case 222:he=$e;break;case 15:case 51:G.qpro||($e[1].v=$e[1].v.slice(1));case 13:case 14:case 16:Xe==14&&($e[2]&112)==112&&($e[2]&15)>1&&($e[2]&15)<15&&($e[1].z=G.dateNF||Cr[14],G.cellDates&&($e[1].t="d",$e[1].v=J5($e[1].v))),G.qpro&&$e[3]>oe&&(E["!ref"]=zr(W),z[re]=E,fe.push(re),E=G.dense?[]:{},W={s:{r:0,c:0},e:{r:0,c:0}},oe=$e[3],re=he||"Sheet"+(oe+1),he="");var Ne=G.dense?(E[$e[0].r]||[])[$e[0].c]:E[_r($e[0])];if(Ne){Ne.t=$e[1].t,Ne.v=$e[1].v,$e[1].z!=null&&(Ne.z=$e[1].z),$e[1].f!=null&&(Ne.f=$e[1].f);break}G.dense?(E[$e[0].r]||(E[$e[0].r]=[]),E[$e[0].r][$e[0].c]=$e[1]):E[_r($e[0])]=$e[1];break}},G);else if(D[2]==26||D[2]==14)G.Enum=ce,D[2]==14&&(G.qpro=!0,D.l=0),e(D,function($e,Je,Xe){switch(Xe){case 204:re=$e;break;case 22:$e[1].v=$e[1].v.slice(1);case 23:case 24:case 25:case 37:case 39:case 40:if($e[3]>oe&&(E["!ref"]=zr(W),z[re]=E,fe.push(re),E=G.dense?[]:{},W={s:{r:0,c:0},e:{r:0,c:0}},oe=$e[3],re="Sheet"+(oe+1)),ae>0&&$e[0].r>=ae)break;G.dense?(E[$e[0].r]||(E[$e[0].r]=[]),E[$e[0].r][$e[0].c]=$e[1]):E[_r($e[0])]=$e[1],W.e.c<$e[0].c&&(W.e.c=$e[0].c),W.e.r<$e[0].r&&(W.e.r=$e[0].r);break;case 27:$e[14e3]&&(de[$e[14e3][0]]=$e[14e3][1]);break;case 1537:de[$e[0]]=$e[1],$e[0]==oe&&(re=$e[1]);break}},G);else throw new Error("Unrecognized LOTUS BOF "+D[2]);if(E["!ref"]=zr(W),z[he||re]=E,fe.push(he||re),!de.length)return{SheetNames:fe,Sheets:z};for(var _e={},ue=[],ke=0;ke<de.length;++ke)z[fe[ke]]?(ue.push(de[ke]||fe[ke]),_e[de[ke]]=z[de[ke]]||z[fe[ke]]):(ue.push(de[ke]),_e[de[ke]]={"!ref":"A1"});return{SheetNames:ue,Sheets:_e}}function n(D,H){var G=H||{};if(+G.codepage>=0&&Cc(+G.codepage),G.type=="string")throw new Error("Cannot write WK1 to JS string");var E=Uo(),re=yn(D["!ref"]),he=Array.isArray(D),oe=[];Yt(E,0,s(1030)),Yt(E,6,u(re));for(var z=Math.min(re.e.r,8191),fe=re.s.r;fe<=z;++fe)for(var de=hi(fe),W=re.s.c;W<=re.e.c;++W){fe===re.s.r&&(oe[W]=Ia(W));var ae=oe[W]+de,_e=he?(D[fe]||[])[W]:D[ae];if(!(!_e||_e.t=="z"))if(_e.t=="n")(_e.v|0)==_e.v&&_e.v>=-32768&&_e.v<=32767?Yt(E,13,x(fe,W,_e.v)):Yt(E,14,v(fe,W,_e.v));else{var ue=nf(_e);Yt(E,15,m(fe,W,ue.slice(0,239)))}}return Yt(E,1),E.end()}function a(D,H){var G=H||{};if(+G.codepage>=0&&Cc(+G.codepage),G.type=="string")throw new Error("Cannot write WK3 to JS string");var E=Uo();Yt(E,0,o(D));for(var re=0,he=0;re<D.SheetNames.length;++re)(D.Sheets[D.SheetNames[re]]||{})["!ref"]&&Yt(E,27,le(D.SheetNames[re],he++));var oe=0;for(re=0;re<D.SheetNames.length;++re){var z=D.Sheets[D.SheetNames[re]];if(!(!z||!z["!ref"])){for(var fe=yn(z["!ref"]),de=Array.isArray(z),W=[],ae=Math.min(fe.e.r,8191),_e=fe.s.r;_e<=ae;++_e)for(var ue=hi(_e),ke=fe.s.c;ke<=fe.e.c;++ke){_e===fe.s.r&&(W[ke]=Ia(ke));var $e=W[ke]+ue,Je=de?(z[_e]||[])[ke]:z[$e];if(!(!Je||Je.t=="z"))if(Je.t=="n")Yt(E,23,q(_e,ke,oe,Je.v));else{var Xe=nf(Je);Yt(E,22,L(_e,ke,oe,Xe.slice(0,239)))}}++oe}}return Yt(E,1),E.end()}function s(D){var H=St(2);return H.write_shift(2,D),H}function o(D){var H=St(26);H.write_shift(2,4096),H.write_shift(2,4),H.write_shift(4,0);for(var G=0,E=0,re=0,he=0;he<D.SheetNames.length;++he){var oe=D.SheetNames[he],z=D.Sheets[oe];if(!(!z||!z["!ref"])){++re;var fe=$o(z["!ref"]);G<fe.e.r&&(G=fe.e.r),E<fe.e.c&&(E=fe.e.c)}}return G>8191&&(G=8191),H.write_shift(2,G),H.write_shift(1,re),H.write_shift(1,E),H.write_shift(2,0),H.write_shift(2,0),H.write_shift(1,1),H.write_shift(1,2),H.write_shift(4,0),H.write_shift(4,0),H}function l(D,H,G){var E={s:{c:0,r:0},e:{c:0,r:0}};return H==8&&G.qpro?(E.s.c=D.read_shift(1),D.l++,E.s.r=D.read_shift(2),E.e.c=D.read_shift(1),D.l++,E.e.r=D.read_shift(2),E):(E.s.c=D.read_shift(2),E.s.r=D.read_shift(2),H==12&&G.qpro&&(D.l+=2),E.e.c=D.read_shift(2),E.e.r=D.read_shift(2),H==12&&G.qpro&&(D.l+=2),E.s.c==65535&&(E.s.c=E.e.c=E.s.r=E.e.r=0),E)}function u(D){var H=St(8);return H.write_shift(2,D.s.c),H.write_shift(2,D.s.r),H.write_shift(2,D.e.c),H.write_shift(2,D.e.r),H}function d(D,H,G){var E=[{c:0,r:0},{t:"n",v:0},0,0];return G.qpro&&G.vers!=20768?(E[0].c=D.read_shift(1),E[3]=D.read_shift(1),E[0].r=D.read_shift(2),D.l+=2):(E[2]=D.read_shift(1),E[0].c=D.read_shift(2),E[0].r=D.read_shift(2)),E}function f(D,H,G){var E=D.l+H,re=d(D,H,G);if(re[1].t="s",G.vers==20768){D.l++;var he=D.read_shift(1);return re[1].v=D.read_shift(he,"utf8"),re}return G.qpro&&D.l++,re[1].v=D.read_shift(E-D.l,"cstr"),re}function m(D,H,G){var E=St(7+G.length);E.write_shift(1,255),E.write_shift(2,H),E.write_shift(2,D),E.write_shift(1,39);for(var re=0;re<E.length;++re){var he=G.charCodeAt(re);E.write_shift(1,he>=128?95:he)}return E.write_shift(1,0),E}function g(D,H,G){var E=d(D,H,G);return E[1].v=D.read_shift(2,"i"),E}function x(D,H,G){var E=St(7);return E.write_shift(1,255),E.write_shift(2,H),E.write_shift(2,D),E.write_shift(2,G,"i"),E}function y(D,H,G){var E=d(D,H,G);return E[1].v=D.read_shift(8,"f"),E}function v(D,H,G){var E=St(13);return E.write_shift(1,255),E.write_shift(2,H),E.write_shift(2,D),E.write_shift(8,G,"f"),E}function w(D,H,G){var E=D.l+H,re=d(D,H,G);if(re[1].v=D.read_shift(8,"f"),G.qpro)D.l=E;else{var he=D.read_shift(2);T(D.slice(D.l,D.l+he),re),D.l+=he}return re}function j(D,H,G){var E=H&32768;return H&=-32769,H=(E?D:0)+(H>=8192?H-16384:H),(E?"":"$")+(G?Ia(H):hi(H))}var k={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]},A=["","","","","","","","","","+","-","*","/","^","=","<>","<=",">=","<",">","","","","","&","","","","","","",""];function T(D,H){_s(D,0);for(var G=[],E=0,re="",he="",oe="",z="";D.l<D.length;){var fe=D[D.l++];switch(fe){case 0:G.push(D.read_shift(8,"f"));break;case 1:he=j(H[0].c,D.read_shift(2),!0),re=j(H[0].r,D.read_shift(2),!1),G.push(he+re);break;case 2:{var de=j(H[0].c,D.read_shift(2),!0),W=j(H[0].r,D.read_shift(2),!1);he=j(H[0].c,D.read_shift(2),!0),re=j(H[0].r,D.read_shift(2),!1),G.push(de+W+":"+he+re)}break;case 3:if(D.l<D.length){console.error("WK1 premature formula end");return}break;case 4:G.push("("+G.pop()+")");break;case 5:G.push(D.read_shift(2));break;case 6:{for(var ae="";fe=D[D.l++];)ae+=String.fromCharCode(fe);G.push('"'+ae.replace(/"/g,'""')+'"')}break;case 8:G.push("-"+G.pop());break;case 23:G.push("+"+G.pop());break;case 22:G.push("NOT("+G.pop()+")");break;case 20:case 21:z=G.pop(),oe=G.pop(),G.push(["AND","OR"][fe-20]+"("+oe+","+z+")");break;default:if(fe<32&&A[fe])z=G.pop(),oe=G.pop(),G.push(oe+A[fe]+z);else if(k[fe]){if(E=k[fe][1],E==69&&(E=D[D.l++]),E>G.length){console.error("WK1 bad formula parse 0x"+fe.toString(16)+":|"+G.join("|")+"|");return}var _e=G.slice(-E);G.length-=E,G.push(k[fe][0]+"("+_e.join(",")+")")}else return fe<=7?console.error("WK1 invalid opcode "+fe.toString(16)):fe<=24?console.error("WK1 unsupported op "+fe.toString(16)):fe<=30?console.error("WK1 invalid opcode "+fe.toString(16)):fe<=115?console.error("WK1 unsupported function opcode "+fe.toString(16)):console.error("WK1 unrecognized opcode "+fe.toString(16))}}G.length==1?H[1].f=""+G[0]:console.error("WK1 bad formula parse |"+G.join("|")+"|")}function M(D){var H=[{c:0,r:0},{t:"n",v:0},0];return H[0].r=D.read_shift(2),H[3]=D[D.l++],H[0].c=D[D.l++],H}function B(D,H){var G=M(D);return G[1].t="s",G[1].v=D.read_shift(H-4,"cstr"),G}function L(D,H,G,E){var re=St(6+E.length);re.write_shift(2,D),re.write_shift(1,G),re.write_shift(1,H),re.write_shift(1,39);for(var he=0;he<E.length;++he){var oe=E.charCodeAt(he);re.write_shift(1,oe>=128?95:oe)}return re.write_shift(1,0),re}function F(D,H){var G=M(D);G[1].v=D.read_shift(2);var E=G[1].v>>1;if(G[1].v&1)switch(E&7){case 0:E=(E>>3)*5e3;break;case 1:E=(E>>3)*500;break;case 2:E=(E>>3)/20;break;case 3:E=(E>>3)/200;break;case 4:E=(E>>3)/2e3;break;case 5:E=(E>>3)/2e4;break;case 6:E=(E>>3)/16;break;case 7:E=(E>>3)/64;break}return G[1].v=E,G}function I(D,H){var G=M(D),E=D.read_shift(4),re=D.read_shift(4),he=D.read_shift(2);if(he==65535)return E===0&&re===3221225472?(G[1].t="e",G[1].v=15):E===0&&re===3489660928?(G[1].t="e",G[1].v=42):G[1].v=0,G;var oe=he&32768;return he=(he&32767)-16446,G[1].v=(1-oe*2)*(re*Math.pow(2,he+32)+E*Math.pow(2,he)),G}function q(D,H,G,E){var re=St(14);if(re.write_shift(2,D),re.write_shift(1,G),re.write_shift(1,H),E==0)return re.write_shift(4,0),re.write_shift(4,0),re.write_shift(2,65535),re;var he=0,oe=0,z=0,fe=0;return E<0&&(he=1,E=-E),oe=Math.log2(E)|0,E/=Math.pow(2,oe-31),fe=E>>>0,(fe&2147483648)==0&&(E/=2,++oe,fe=E>>>0),E-=fe,fe|=2147483648,fe>>>=0,E*=Math.pow(2,32),z=E>>>0,re.write_shift(4,z),re.write_shift(4,fe),oe+=16383+(he?32768:0),re.write_shift(2,oe),re}function P(D,H){var G=I(D);return D.l+=H-14,G}function R(D,H){var G=M(D),E=D.read_shift(4);return G[1].v=E>>6,G}function K(D,H){var G=M(D),E=D.read_shift(8,"f");return G[1].v=E,G}function ee(D,H){var G=K(D);return D.l+=H-10,G}function se(D,H){return D[D.l+H-1]==0?D.read_shift(H,"cstr"):""}function Z(D,H){var G=D[D.l++];G>H-1&&(G=H-1);for(var E="";E.length<G;)E+=String.fromCharCode(D[D.l++]);return E}function ne(D,H,G){if(!(!G.qpro||H<21)){var E=D.read_shift(1);D.l+=17,D.l+=1,D.l+=2;var re=D.read_shift(H-21,"cstr");return[E,re]}}function X(D,H){for(var G={},E=D.l+H;D.l<E;){var re=D.read_shift(2);if(re==14e3){for(G[re]=[0,""],G[re][0]=D.read_shift(2);D[D.l];)G[re][1]+=String.fromCharCode(D[D.l]),D.l++;D.l++}}return G}function le(D,H){var G=St(5+D.length);G.write_shift(2,14e3),G.write_shift(2,H);for(var E=0;E<D.length;++E){var re=D.charCodeAt(E);G[G.l++]=re>127?95:re}return G[G.l++]=0,G}var Ae={0:{n:"BOF",f:wi},1:{n:"EOF"},2:{n:"CALCMODE"},3:{n:"CALCORDER"},4:{n:"SPLIT"},5:{n:"SYNC"},6:{n:"RANGE",f:l},7:{n:"WINDOW1"},8:{n:"COLW1"},9:{n:"WINTWO"},10:{n:"COLW2"},11:{n:"NAME"},12:{n:"BLANK"},13:{n:"INTEGER",f:g},14:{n:"NUMBER",f:y},15:{n:"LABEL",f},16:{n:"FORMULA",f:w},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},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:se},222:{n:"SHEETNAMELP",f:Z},65535:{n:""}},ce={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:B},23:{n:"NUMBER17",f:I},24:{n:"NUMBER18",f:F},25:{n:"FORMULA19",f:P},26:{n:"FORMULA1A"},27:{n:"XFORMAT",f:X},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:R},38:{n:"??"},39:{n:"NUMBER27",f:K},40:{n:"FORMULA28",f:ee},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:se},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:ne},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:n,book_to_wk3:a,to_workbook:t}})();function vEe(e){var t={},r=e.match(Xs),n=0,a=!1;if(r)for(;n!=r.length;++n){var s=Tr(r[n]);switch(s[0].replace(/\w*:/g,"")){case"<condense":break;case"<extend":break;case"<shadow":if(!s.val)break;case"<shadow>":case"<shadow/>":t.shadow=1;break;case"</shadow>":break;case"<charset":if(s.val=="1")break;t.cp=uE[parseInt(s.val,10)];break;case"<outline":if(!s.val)break;case"<outline>":case"<outline/>":t.outline=1;break;case"</outline>":break;case"<rFont":t.name=s.val;break;case"<sz":t.sz=s.val;break;case"<strike":if(!s.val)break;case"<strike>":case"<strike/>":t.strike=1;break;case"</strike>":break;case"<u":if(!s.val)break;switch(s.val){case"double":t.uval="double";break;case"singleAccounting":t.uval="single-accounting";break;case"doubleAccounting":t.uval="double-accounting";break}case"<u>":case"<u/>":t.u=1;break;case"</u>":break;case"<b":if(s.val=="0")break;case"<b>":case"<b/>":t.b=1;break;case"</b>":break;case"<i":if(s.val=="0")break;case"<i>":case"<i/>":t.i=1;break;case"</i>":break;case"<color":s.rgb&&(t.color=s.rgb.slice(2,8));break;case"<color>":case"<color/>":case"</color>":break;case"<family":t.family=s.val;break;case"<family>":case"<family/>":case"</family>":break;case"<vertAlign":t.valign=s.val;break;case"<vertAlign>":case"<vertAlign/>":case"</vertAlign>":break;case"<scheme":break;case"<scheme>":case"<scheme/>":case"</scheme>":break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":a=!0;break;case"</ext>":a=!1;break;default:if(s[0].charCodeAt(1)!==47&&!a)throw new Error("Unrecognized rich format "+s[0])}}return t}var yEe=(function(){var e=Kv("t"),t=Kv("rPr");function r(s){var o=s.match(e);if(!o)return{t:"s",v:""};var l={t:"s",v:vn(o[1])},u=s.match(t);return u&&(l.s=vEe(u[1])),l}var n=/<(?:\w+:)?r>/g,a=/<\/(?:\w+:)?r>/;return function(o){return o.replace(n,"").split(a).map(r).filter(function(l){return l.v})}})(),bEe=(function(){var t=/(\r\n|\n)/g;function r(a,s,o){var l=[];a.u&&l.push("text-decoration: underline;"),a.uval&&l.push("text-underline-style:"+a.uval+";"),a.sz&&l.push("font-size:"+a.sz+"pt;"),a.outline&&l.push("text-effect: outline;"),a.shadow&&l.push("text-shadow: auto;"),s.push('<span style="'+l.join("")+'">'),a.b&&(s.push("<b>"),o.push("</b>")),a.i&&(s.push("<i>"),o.push("</i>")),a.strike&&(s.push("<s>"),o.push("</s>"));var u=a.valign||"";return u=="superscript"||u=="super"?u="sup":u=="subscript"&&(u="sub"),u!=""&&(s.push("<"+u+">"),o.push("</"+u+">")),o.push("</span>"),a}function n(a){var s=[[],a.v,[]];return a.v?(a.s&&r(a.s,s[0],s[2]),s[0].join("")+s[1].replace(t,"<br/>")+s[2].join("")):""}return function(s){return s.map(n).join("")}})(),wEe=/<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g,jEe=/<(?:\w+:)?r>/,NEe=/<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g;function RE(e,t){var r=t?t.cellHTML:!0,n={};return e?(e.match(/^\s*<(?:\w+:)?t[^>]*>/)?(n.t=vn(Xn(e.slice(e.indexOf(">")+1).split(/<\/(?:\w+:)?t>/)[0]||"")),n.r=Xn(e),r&&(n.h=bE(n.t))):e.match(jEe)&&(n.r=Xn(e),n.t=vn(Xn((e.replace(NEe,"").match(wEe)||[]).join("").replace(Xs,""))),r&&(n.h=bEe(yEe(n.r)))),n):{t:""}}var SEe=/<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/,AEe=/<(?:\w+:)?(?:si|sstItem)>/g,kEe=/<\/(?:\w+:)?(?:si|sstItem)>/;function CEe(e,t){var r=[],n="";if(!e)return r;var a=e.match(SEe);if(a){n=a[2].replace(AEe,"").split(kEe);for(var s=0;s!=n.length;++s){var o=RE(n[s].trim(),t);o!=null&&(r[r.length]=o)}a=Tr(a[1]),r.Count=a.count,r.Unique=a.uniqueCount}return r}var _Ee=/^\s|\s$|[\t\n\r]/;function hY(e,t){if(!t.bookSST)return"";var r=[pi];r[r.length]=Wt("sst",null,{xmlns:j0[0],count:e.Count,uniqueCount:e.Unique});for(var n=0;n!=e.length;++n)if(e[n]!=null){var a=e[n],s="<si>";a.r?s+=a.r:(s+="<t",a.t||(a.t=""),a.t.match(_Ee)&&(s+=' xml:space="preserve"'),s+=">"+Vn(a.t)+"</t>"),s+="</si>",r[r.length]=s}return r.length>2&&(r[r.length]="</sst>",r[1]=r[1].replace("/>",">")),r.join("")}function EEe(e){return[e.read_shift(4),e.read_shift(4)]}function TEe(e,t){var r=[],n=!1;return mf(e,function(s,o,l){switch(l){case 159:r.Count=s[0],r.Unique=s[1];break;case 19:r.push(s);break;case 160:return!0;case 35:n=!0;break;case 36:n=!1;break;default:if(o.T,!n||t.WTF)throw new Error("Unexpected record 0x"+l.toString(16))}}),r}function PEe(e,t){return t||(t=St(8)),t.write_shift(4,e.Count),t.write_shift(4,e.Unique),t}var DEe=$ke;function OEe(e){var t=Uo();Ot(t,159,PEe(e));for(var r=0;r<e.length;++r)Ot(t,19,DEe(e[r]));return Ot(t,160),t.end()}function mY(e){for(var t=[],r=e.split(""),n=0;n<r.length;++n)t[n]=r[n].charCodeAt(0);return t}function Xd(e,t){var r={};return r.Major=e.read_shift(2),r.Minor=e.read_shift(2),t>=4&&(e.l+=t-4),r}function REe(e){var t={};return t.id=e.read_shift(0,"lpp4"),t.R=Xd(e,4),t.U=Xd(e,4),t.W=Xd(e,4),t}function MEe(e){for(var t=e.read_shift(4),r=e.l+t-4,n={},a=e.read_shift(4),s=[];a-- >0;)s.push({t:e.read_shift(4),v:e.read_shift(0,"lpp4")});if(n.name=e.read_shift(0,"lpp4"),n.comps=s,e.l!=r)throw new Error("Bad DataSpaceMapEntry: "+e.l+" != "+r);return n}function LEe(e){var t=[];e.l+=4;for(var r=e.read_shift(4);r-- >0;)t.push(MEe(e));return t}function IEe(e){var t=[];e.l+=4;for(var r=e.read_shift(4);r-- >0;)t.push(e.read_shift(0,"lpp4"));return t}function FEe(e){var t={};return e.read_shift(4),e.l+=4,t.id=e.read_shift(0,"lpp4"),t.name=e.read_shift(0,"lpp4"),t.R=Xd(e,4),t.U=Xd(e,4),t.W=Xd(e,4),t}function BEe(e){var t=FEe(e);if(t.ename=e.read_shift(0,"8lpp4"),t.blksz=e.read_shift(4),t.cmode=e.read_shift(4),e.read_shift(4)!=4)throw new Error("Bad !Primary record");return t}function pY(e,t){var r=e.l+t,n={};n.Flags=e.read_shift(4)&63,e.l+=4,n.AlgID=e.read_shift(4);var a=!1;switch(n.AlgID){case 26126:case 26127:case 26128:a=n.Flags==36;break;case 26625:a=n.Flags==4;break;case 0:a=n.Flags==16||n.Flags==4||n.Flags==36;break;default:throw"Unrecognized encryption algorithm: "+n.AlgID}if(!a)throw new Error("Encryption Flags/AlgID mismatch");return n.AlgIDHash=e.read_shift(4),n.KeySize=e.read_shift(4),n.ProviderType=e.read_shift(4),e.l+=8,n.CSPName=e.read_shift(r-e.l>>1,"utf16le"),e.l=r,n}function xY(e,t){var r={},n=e.l+t;return e.l+=4,r.Salt=e.slice(e.l,e.l+16),e.l+=16,r.Verifier=e.slice(e.l,e.l+16),e.l+=16,e.read_shift(4),r.VerifierHash=e.slice(e.l,n),e.l=n,r}function zEe(e){var t=Xd(e);switch(t.Minor){case 2:return[t.Minor,UEe(e)];case 3:return[t.Minor,$Ee()];case 4:return[t.Minor,HEe(e)]}throw new Error("ECMA-376 Encrypted file unrecognized Version: "+t.Minor)}function UEe(e){var t=e.read_shift(4);if((t&63)!=36)throw new Error("EncryptionInfo mismatch");var r=e.read_shift(4),n=pY(e,r),a=xY(e,e.length-e.l);return{t:"Std",h:n,v:a}}function $Ee(){throw new Error("File is password-protected: ECMA-376 Extensible")}function HEe(e){var t=["saltSize","blockSize","keyBits","hashSize","cipherAlgorithm","cipherChaining","hashAlgorithm","saltValue"];e.l+=4;var r=e.read_shift(e.length-e.l,"utf8"),n={};return r.replace(Xs,function(s){var o=Tr(s);switch(Zu(o[0])){case"<?xml":break;case"<encryption":case"</encryption>":break;case"<keyData":t.forEach(function(l){n[l]=o[l]});break;case"<dataIntegrity":n.encryptedHmacKey=o.encryptedHmacKey,n.encryptedHmacValue=o.encryptedHmacValue;break;case"<keyEncryptors>":case"<keyEncryptors":n.encs=[];break;case"</keyEncryptors>":break;case"<keyEncryptor":n.uri=o.uri;break;case"</keyEncryptor>":break;case"<encryptedKey":n.encs.push(o);break;default:throw o[0]}}),n}function VEe(e,t){var r={},n=r.EncryptionVersionInfo=Xd(e,4);if(t-=4,n.Minor!=2)throw new Error("unrecognized minor version code: "+n.Minor);if(n.Major>4||n.Major<2)throw new Error("unrecognized major version code: "+n.Major);r.Flags=e.read_shift(4),t-=4;var a=e.read_shift(4);return t-=4,r.EncryptionHeader=pY(e,a),t-=a,r.EncryptionVerifier=xY(e,t),r}function qEe(e){var t={},r=t.EncryptionVersionInfo=Xd(e,4);if(r.Major!=1||r.Minor!=1)throw"unrecognized version code "+r.Major+" : "+r.Minor;return t.Salt=e.read_shift(16),t.EncryptedVerifier=e.read_shift(16),t.EncryptedVerifierHash=e.read_shift(16),t}function ME(e){var t=0,r,n=mY(e),a=n.length+1,s,o,l,u,d;for(r=_h(a),r[0]=n.length,s=1;s!=a;++s)r[s]=n[s-1];for(s=a-1;s>=0;--s)o=r[s],l=(t&16384)===0?0:1,u=t<<1&32767,d=l|u,t=d^o;return t^52811}var gY=(function(){var e=[187,255,255,186,255,255,185,128,0,190,15,0,191,15,0],t=[57840,7439,52380,33984,4364,3600,61902,12606,6258,57657,54287,34041,10252,43370,20163],r=[44796,19929,39858,10053,20106,40212,10761,31585,63170,64933,60267,50935,40399,11199,17763,35526,1453,2906,5812,11624,23248,885,1770,3540,7080,14160,28320,56640,55369,41139,20807,41614,21821,43642,17621,28485,56970,44341,19019,38038,14605,29210,60195,50791,40175,10751,21502,43004,24537,18387,36774,3949,7898,15796,31592,63184,47201,24803,49606,37805,14203,28406,56812,17824,35648,1697,3394,6788,13576,27152,43601,17539,35078,557,1114,2228,4456,30388,60776,51953,34243,7079,14158,28316,14128,28256,56512,43425,17251,34502,7597,13105,26210,52420,35241,883,1766,3532,4129,8258,16516,33032,4657,9314,18628],n=function(o){return(o/2|o*128)&255},a=function(o,l){return n(o^l)},s=function(o){for(var l=t[o.length-1],u=104,d=o.length-1;d>=0;--d)for(var f=o[d],m=0;m!=7;++m)f&64&&(l^=r[u]),f*=2,--u;return l};return function(o){for(var l=mY(o),u=s(l),d=l.length,f=_h(16),m=0;m!=16;++m)f[m]=0;var g,x,y;for((d&1)===1&&(g=u>>8,f[d]=a(e[0],g),--d,g=u&255,x=l[l.length-1],f[d]=a(x,g));d>0;)--d,g=u>>8,f[d]=a(l[d],g),--d,g=u&255,f[d]=a(l[d],g);for(d=15,y=15-l.length;y>0;)g=u>>8,f[d]=a(e[y],g),--d,--y,g=u&255,f[d]=a(l[d],g),--d,--y;return f}})(),WEe=function(e,t,r,n,a){a||(a=t),n||(n=gY(e));var s,o;for(s=0;s!=t.length;++s)o=t[s],o^=n[r],o=(o>>5|o<<3)&255,a[s]=o,++r;return[a,r,n]},GEe=function(e){var t=0,r=gY(e);return function(n){var a=WEe("",n,t,r);return t=a[1],a[0]}};function YEe(e,t,r,n){var a={key:wi(e),verificationBytes:wi(e)};return r.password&&(a.verifier=ME(r.password)),n.valid=a.verificationBytes===a.verifier,n.valid&&(n.insitu=GEe(r.password)),a}function KEe(e,t,r){var n=r||{};return n.Info=e.read_shift(2),e.l-=2,n.Info===1?n.Data=qEe(e):n.Data=VEe(e,t),n}function XEe(e,t,r){var n={Type:r.biff>=8?e.read_shift(2):0};return n.Type?KEe(e,t-2,n):YEe(e,r.biff>=8?t:t-2,r,n),n}var vY=(function(){function e(a,s){switch(s.type){case"base64":return t(vl(a),s);case"binary":return t(a,s);case"buffer":return t(Yr&&Buffer.isBuffer(a)?a.toString("binary"):Uh(a),s);case"array":return t(u0(a),s)}throw new Error("Unrecognized type "+s.type)}function t(a,s){var o=s||{},l=o.dense?[]:{},u=a.match(/\\trowd.*?\\row\b/g);if(!u.length)throw new Error("RTF missing table");var d={s:{c:0,r:0},e:{c:0,r:u.length-1}};return u.forEach(function(f,m){Array.isArray(l)&&(l[m]=[]);for(var g=/\\\w+\b/g,x=0,y,v=-1;y=g.exec(f);){switch(y[0]){case"\\cell":var w=f.slice(x,g.lastIndex-y[0].length);if(w[0]==" "&&(w=w.slice(1)),++v,w.length){var j={v:w,t:"s"};Array.isArray(l)?l[m][v]=j:l[_r({r:m,c:v})]=j}break}x=g.lastIndex}v>d.e.c&&(d.e.c=v)}),l["!ref"]=zr(d),l}function r(a,s){return $h(e(a,s),s)}function n(a){for(var s=["{\\rtf1\\ansi"],o=yn(a["!ref"]),l,u=Array.isArray(a),d=o.s.r;d<=o.e.r;++d){s.push("\\trowd\\trautofit1");for(var f=o.s.c;f<=o.e.c;++f)s.push("\\cellx"+(f+1));for(s.push("\\pard\\intbl"),f=o.s.c;f<=o.e.c;++f){var m=_r({r:d,c:f});l=u?(a[d]||[])[f]:a[m],!(!l||l.v==null&&(!l.f||l.F))&&(s.push(" "+(l.w||(nf(l),l.w))),s.push("\\cell"))}s.push("\\pard\\intbl\\row")}return s.join("")+"}"}return{to_workbook:r,to_sheet:e,from_sheet:n}})();function ZEe(e){var t=e.slice(e[0]==="#"?1:0).slice(0,6);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}function Qv(e){for(var t=0,r=1;t!=3;++t)r=r*256+(e[t]>255?255:e[t]<0?0:e[t]);return r.toString(16).toUpperCase().slice(1)}function JEe(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255,a=Math.max(t,r,n),s=Math.min(t,r,n),o=a-s;if(o===0)return[0,0,t];var l=0,u=0,d=a+s;switch(u=o/(d>1?2-d:d),a){case t:l=((r-n)/o+6)%6;break;case r:l=(n-t)/o+2;break;case n:l=(t-r)/o+4;break}return[l/6,u,d/2]}function QEe(e){var t=e[0],r=e[1],n=e[2],a=r*2*(n<.5?n:1-n),s=n-a/2,o=[s,s,s],l=6*t,u;if(r!==0)switch(l|0){case 0:case 6:u=a*l,o[0]+=a,o[1]+=u;break;case 1:u=a*(2-l),o[0]+=u,o[1]+=a;break;case 2:u=a*(l-2),o[1]+=a,o[2]+=u;break;case 3:u=a*(4-l),o[1]+=u,o[2]+=a;break;case 4:u=a*(l-4),o[2]+=a,o[0]+=u;break;case 5:u=a*(6-l),o[2]+=u,o[0]+=a;break}for(var d=0;d!=3;++d)o[d]=Math.round(o[d]*255);return o}function Fw(e,t){if(t===0)return e;var r=JEe(ZEe(e));return t<0?r[2]=r[2]*(1+t):r[2]=1-(1-r[2])*(1-t),Qv(QEe(r))}var yY=6,eTe=15,tTe=1,Hs=yY;function e1(e){return Math.floor((e+Math.round(128/Hs)/256)*Hs)}function t1(e){return Math.floor((e-5)/Hs*100+.5)/100}function Bw(e){return Math.round((e*Hs+5)/Hs*256)/256}function a3(e){return Bw(t1(e1(e)))}function LE(e){var t=Math.abs(e-a3(e)),r=Hs;if(t>.005)for(Hs=tTe;Hs<eTe;++Hs)Math.abs(e-a3(e))<=t&&(t=Math.abs(e-a3(e)),r=Hs);Hs=r}function Eh(e){e.width?(e.wpx=e1(e.width),e.wch=t1(e.wpx),e.MDW=Hs):e.wpx?(e.wch=t1(e.wpx),e.width=Bw(e.wch),e.MDW=Hs):typeof e.wch=="number"&&(e.width=Bw(e.wch),e.wpx=e1(e.width),e.MDW=Hs),e.customWidth&&delete e.customWidth}var rTe=96,bY=rTe;function r1(e){return e*96/bY}function gx(e){return e*bY/96}var nTe={None:"none",Solid:"solid",Gray50:"mediumGray",Gray75:"darkGray",Gray25:"lightGray",HorzStripe:"darkHorizontal",VertStripe:"darkVertical",ReverseDiagStripe:"darkDown",DiagStripe:"darkUp",DiagCross:"darkGrid",ThickDiagCross:"darkTrellis",ThinHorzStripe:"lightHorizontal",ThinVertStripe:"lightVertical",ThinReverseDiagStripe:"lightDown",ThinHorzCross:"lightGrid"};function aTe(e,t,r,n){t.Borders=[];var a={},s=!1;(e[0].match(Xs)||[]).forEach(function(o){var l=Tr(o);switch(Zu(l[0])){case"<borders":case"<borders>":case"</borders>":break;case"<border":case"<border>":case"<border/>":a={},l.diagonalUp&&(a.diagonalUp=ya(l.diagonalUp)),l.diagonalDown&&(a.diagonalDown=ya(l.diagonalDown)),t.Borders.push(a);break;case"</border>":break;case"<left/>":break;case"<left":case"<left>":break;case"</left>":break;case"<right/>":break;case"<right":case"<right>":break;case"</right>":break;case"<top/>":break;case"<top":case"<top>":break;case"</top>":break;case"<bottom/>":break;case"<bottom":case"<bottom>":break;case"</bottom>":break;case"<diagonal":case"<diagonal>":case"<diagonal/>":break;case"</diagonal>":break;case"<horizontal":case"<horizontal>":case"<horizontal/>":break;case"</horizontal>":break;case"<vertical":case"<vertical>":case"<vertical/>":break;case"</vertical>":break;case"<start":case"<start>":case"<start/>":break;case"</start>":break;case"<end":case"<end>":case"<end/>":break;case"</end>":break;case"<color":case"<color>":break;case"<color/>":case"</color>":break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":s=!0;break;case"</ext>":s=!1;break;default:if(n&&n.WTF&&!s)throw new Error("unrecognized "+l[0]+" in borders")}})}function iTe(e,t,r,n){t.Fills=[];var a={},s=!1;(e[0].match(Xs)||[]).forEach(function(o){var l=Tr(o);switch(Zu(l[0])){case"<fills":case"<fills>":case"</fills>":break;case"<fill>":case"<fill":case"<fill/>":a={},t.Fills.push(a);break;case"</fill>":break;case"<gradientFill>":break;case"<gradientFill":case"</gradientFill>":t.Fills.push(a),a={};break;case"<patternFill":case"<patternFill>":l.patternType&&(a.patternType=l.patternType);break;case"<patternFill/>":case"</patternFill>":break;case"<bgColor":a.bgColor||(a.bgColor={}),l.indexed&&(a.bgColor.indexed=parseInt(l.indexed,10)),l.theme&&(a.bgColor.theme=parseInt(l.theme,10)),l.tint&&(a.bgColor.tint=parseFloat(l.tint)),l.rgb&&(a.bgColor.rgb=l.rgb.slice(-6));break;case"<bgColor/>":case"</bgColor>":break;case"<fgColor":a.fgColor||(a.fgColor={}),l.theme&&(a.fgColor.theme=parseInt(l.theme,10)),l.tint&&(a.fgColor.tint=parseFloat(l.tint)),l.rgb!=null&&(a.fgColor.rgb=l.rgb.slice(-6));break;case"<fgColor/>":case"</fgColor>":break;case"<stop":case"<stop/>":break;case"</stop>":break;case"<color":case"<color/>":break;case"</color>":break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":s=!0;break;case"</ext>":s=!1;break;default:if(n&&n.WTF&&!s)throw new Error("unrecognized "+l[0]+" in fills")}})}function sTe(e,t,r,n){t.Fonts=[];var a={},s=!1;(e[0].match(Xs)||[]).forEach(function(o){var l=Tr(o);switch(Zu(l[0])){case"<fonts":case"<fonts>":case"</fonts>":break;case"<font":case"<font>":break;case"</font>":case"<font/>":t.Fonts.push(a),a={};break;case"<name":l.val&&(a.name=Xn(l.val));break;case"<name/>":case"</name>":break;case"<b":a.bold=l.val?ya(l.val):1;break;case"<b/>":a.bold=1;break;case"<i":a.italic=l.val?ya(l.val):1;break;case"<i/>":a.italic=1;break;case"<u":switch(l.val){case"none":a.underline=0;break;case"single":a.underline=1;break;case"double":a.underline=2;break;case"singleAccounting":a.underline=33;break;case"doubleAccounting":a.underline=34;break}break;case"<u/>":a.underline=1;break;case"<strike":a.strike=l.val?ya(l.val):1;break;case"<strike/>":a.strike=1;break;case"<outline":a.outline=l.val?ya(l.val):1;break;case"<outline/>":a.outline=1;break;case"<shadow":a.shadow=l.val?ya(l.val):1;break;case"<shadow/>":a.shadow=1;break;case"<condense":a.condense=l.val?ya(l.val):1;break;case"<condense/>":a.condense=1;break;case"<extend":a.extend=l.val?ya(l.val):1;break;case"<extend/>":a.extend=1;break;case"<sz":l.val&&(a.sz=+l.val);break;case"<sz/>":case"</sz>":break;case"<vertAlign":l.val&&(a.vertAlign=l.val);break;case"<vertAlign/>":case"</vertAlign>":break;case"<family":l.val&&(a.family=parseInt(l.val,10));break;case"<family/>":case"</family>":break;case"<scheme":l.val&&(a.scheme=l.val);break;case"<scheme/>":case"</scheme>":break;case"<charset":if(l.val=="1")break;l.codepage=uE[parseInt(l.val,10)];break;case"<color":if(a.color||(a.color={}),l.auto&&(a.color.auto=ya(l.auto)),l.rgb)a.color.rgb=l.rgb.slice(-6);else if(l.indexed){a.color.index=parseInt(l.indexed,10);var u=Vm[a.color.index];a.color.index==81&&(u=Vm[1]),u||(u=Vm[1]),a.color.rgb=u[0].toString(16)+u[1].toString(16)+u[2].toString(16)}else l.theme&&(a.color.theme=parseInt(l.theme,10),l.tint&&(a.color.tint=parseFloat(l.tint)),l.theme&&r.themeElements&&r.themeElements.clrScheme&&(a.color.rgb=Fw(r.themeElements.clrScheme[a.color.theme].rgb,a.color.tint||0)));break;case"<color/>":case"</color>":break;case"<AlternateContent":s=!0;break;case"</AlternateContent>":s=!1;break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":s=!0;break;case"</ext>":s=!1;break;default:if(n&&n.WTF&&!s)throw new Error("unrecognized "+l[0]+" in fonts")}})}function oTe(e,t,r){t.NumberFmt=[];for(var n=ri(Cr),a=0;a<n.length;++a)t.NumberFmt[n[a]]=Cr[n[a]];var s=e[0].match(Xs);if(s)for(a=0;a<s.length;++a){var o=Tr(s[a]);switch(Zu(o[0])){case"<numFmts":case"</numFmts>":case"<numFmts/>":case"<numFmts>":break;case"<numFmt":{var l=vn(Xn(o.formatCode)),u=parseInt(o.numFmtId,10);if(t.NumberFmt[u]=l,u>0){if(u>392){for(u=392;u>60&&t.NumberFmt[u]!=null;--u);t.NumberFmt[u]=l}Kd(l,u)}}break;case"</numFmt>":break;default:if(r.WTF)throw new Error("unrecognized "+o[0]+" in numFmts")}}}function lTe(e){var t=["<numFmts>"];return[[5,8],[23,26],[41,44],[50,392]].forEach(function(r){for(var n=r[0];n<=r[1];++n)e[n]!=null&&(t[t.length]=Wt("numFmt",null,{numFmtId:n,formatCode:Vn(e[n])}))}),t.length===1?"":(t[t.length]="</numFmts>",t[0]=Wt("numFmts",null,{count:t.length-2}).replace("/>",">"),t.join(""))}var Ob=["numFmtId","fillId","fontId","borderId","xfId"],Rb=["applyAlignment","applyBorder","applyFill","applyFont","applyNumberFormat","applyProtection","pivotButton","quotePrefix"];function cTe(e,t,r){t.CellXf=[];var n,a=!1;(e[0].match(Xs)||[]).forEach(function(s){var o=Tr(s),l=0;switch(Zu(o[0])){case"<cellXfs":case"<cellXfs>":case"<cellXfs/>":case"</cellXfs>":break;case"<xf":case"<xf/>":for(n=o,delete n[0],l=0;l<Ob.length;++l)n[Ob[l]]&&(n[Ob[l]]=parseInt(n[Ob[l]],10));for(l=0;l<Rb.length;++l)n[Rb[l]]&&(n[Rb[l]]=ya(n[Rb[l]]));if(t.NumberFmt&&n.numFmtId>392){for(l=392;l>60;--l)if(t.NumberFmt[n.numFmtId]==t.NumberFmt[l]){n.numFmtId=l;break}}t.CellXf.push(n);break;case"</xf>":break;case"<alignment":case"<alignment/>":var u={};o.vertical&&(u.vertical=o.vertical),o.horizontal&&(u.horizontal=o.horizontal),o.textRotation!=null&&(u.textRotation=o.textRotation),o.indent&&(u.indent=o.indent),o.wrapText&&(u.wrapText=ya(o.wrapText)),n.alignment=u;break;case"</alignment>":break;case"<protection":break;case"</protection>":case"<protection/>":break;case"<AlternateContent":a=!0;break;case"</AlternateContent>":a=!1;break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":a=!0;break;case"</ext>":a=!1;break;default:if(r&&r.WTF&&!a)throw new Error("unrecognized "+o[0]+" in cellXfs")}})}function uTe(e){var t=[];return t[t.length]=Wt("cellXfs",null),e.forEach(function(r){t[t.length]=Wt("xf",null,r)}),t[t.length]="</cellXfs>",t.length===2?"":(t[0]=Wt("cellXfs",null,{count:t.length-2}).replace("/>",">"),t.join(""))}var dTe=(function(){var t=/<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/,r=/<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/,n=/<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/,a=/<(?:\w+:)?fonts([^>]*)>[\S\s]*?<\/(?:\w+:)?fonts>/,s=/<(?:\w+:)?borders([^>]*)>[\S\s]*?<\/(?:\w+:)?borders>/;return function(l,u,d){var f={};if(!l)return f;l=l.replace(/<!--([\s\S]*?)-->/mg,"").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm,"");var m;return(m=l.match(t))&&oTe(m,f,d),(m=l.match(a))&&sTe(m,f,u,d),(m=l.match(n))&&iTe(m,f,u,d),(m=l.match(s))&&aTe(m,f,u,d),(m=l.match(r))&&cTe(m,f,d),f}})();function wY(e,t){var r=[pi,Wt("styleSheet",null,{xmlns:j0[0],"xmlns:vt":$i.vt})],n;return e.SSF&&(n=lTe(e.SSF))!=null&&(r[r.length]=n),r[r.length]='<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>',r[r.length]='<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>',r[r.length]='<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>',r[r.length]='<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>',(n=uTe(t.cellXfs))&&(r[r.length]=n),r[r.length]='<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>',r[r.length]='<dxfs count="0"/>',r[r.length]='<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4"/>',r.length>2&&(r[r.length]="</styleSheet>",r[1]=r[1].replace("/>",">")),r.join("")}function fTe(e,t){var r=e.read_shift(2),n=Ws(e);return[r,n]}function hTe(e,t,r){r||(r=St(6+4*t.length)),r.write_shift(2,e),us(t,r);var n=r.length>r.l?r.slice(0,r.l):r;return r.l==null&&(r.l=r.length),n}function mTe(e,t,r){var n={};n.sz=e.read_shift(2)/20;var a=Kke(e);a.fItalic&&(n.italic=1),a.fCondense&&(n.condense=1),a.fExtend&&(n.extend=1),a.fShadow&&(n.shadow=1),a.fOutline&&(n.outline=1),a.fStrikeout&&(n.strike=1);var s=e.read_shift(2);switch(s===700&&(n.bold=1),e.read_shift(2)){case 1:n.vertAlign="superscript";break;case 2:n.vertAlign="subscript";break}var o=e.read_shift(1);o!=0&&(n.underline=o);var l=e.read_shift(1);l>0&&(n.family=l);var u=e.read_shift(1);switch(u>0&&(n.charset=u),e.l++,n.color=Yke(e),e.read_shift(1)){case 1:n.scheme="major";break;case 2:n.scheme="minor";break}return n.name=Ws(e),n}function pTe(e,t){t||(t=St(153)),t.write_shift(2,e.sz*20),Xke(e,t),t.write_shift(2,e.bold?700:400);var r=0;e.vertAlign=="superscript"?r=1:e.vertAlign=="subscript"&&(r=2),t.write_shift(2,r),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),Mw(e.color,t);var n=0;return n=2,t.write_shift(1,n),us(e.name,t),t.length>t.l?t.slice(0,t.l):t}var xTe=["none","solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"],i3,gTe=Ys;function C7(e,t){t||(t=St(84)),i3||(i3=X5(xTe));var r=i3[e.patternType];r==null&&(r=40),t.write_shift(4,r);var n=0;if(r!=40)for(Mw({auto:1},t),Mw({auto:1},t);n<12;++n)t.write_shift(4,0);else{for(;n<4;++n)t.write_shift(4,0);for(;n<12;++n)t.write_shift(4,0)}return t.length>t.l?t.slice(0,t.l):t}function vTe(e,t){var r=e.l+t,n=e.read_shift(2),a=e.read_shift(2);return e.l=r,{ixfe:n,numFmtId:a}}function jY(e,t,r){r||(r=St(16)),r.write_shift(2,t||0),r.write_shift(2,e.numFmtId||0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(1,0),r.write_shift(1,0);var n=0;return r.write_shift(1,n),r.write_shift(1,0),r.write_shift(1,0),r.write_shift(1,0),r}function qg(e,t){return t||(t=St(10)),t.write_shift(1,0),t.write_shift(1,0),t.write_shift(4,0),t.write_shift(4,0),t}var yTe=Ys;function bTe(e,t){return t||(t=St(51)),t.write_shift(1,0),qg(null,t),qg(null,t),qg(null,t),qg(null,t),qg(null,t),t.length>t.l?t.slice(0,t.l):t}function wTe(e,t){return t||(t=St(52)),t.write_shift(4,e.xfId),t.write_shift(2,1),t.write_shift(1,0),t.write_shift(1,0),Rw(e.name||"",t),t.length>t.l?t.slice(0,t.l):t}function jTe(e,t,r){var n=St(2052);return n.write_shift(4,e),Rw(t,n),Rw(r,n),n.length>n.l?n.slice(0,n.l):n}function NTe(e,t,r){var n={};n.NumberFmt=[];for(var a in Cr)n.NumberFmt[a]=Cr[a];n.CellXf=[],n.Fonts=[];var s=[],o=!1;return mf(e,function(u,d,f){switch(f){case 44:n.NumberFmt[u[0]]=u[1],Kd(u[1],u[0]);break;case 43:n.Fonts.push(u),u.color.theme!=null&&t&&t.themeElements&&t.themeElements.clrScheme&&(u.color.rgb=Fw(t.themeElements.clrScheme[u.color.theme].rgb,u.color.tint||0));break;case 1025:break;case 45:break;case 46:break;case 47:s[s.length-1]==617&&n.CellXf.push(u);break;case 48:case 507:case 572:case 475:break;case 1171:case 2102:case 1130:case 512:case 2095:case 3072:break;case 35:o=!0;break;case 36:o=!1;break;case 37:s.push(f),o=!0;break;case 38:s.pop(),o=!1;break;default:if(d.T>0)s.push(f);else if(d.T<0)s.pop();else if(!o||r.WTF&&s[s.length-1]!=37)throw new Error("Unexpected record 0x"+f.toString(16))}}),n}function STe(e,t){if(t){var r=0;[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var a=n[0];a<=n[1];++a)t[a]!=null&&++r}),r!=0&&(Ot(e,615,Dc(r)),[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var a=n[0];a<=n[1];++a)t[a]!=null&&Ot(e,44,hTe(a,t[a]))}),Ot(e,616))}}function ATe(e){var t=1;Ot(e,611,Dc(t)),Ot(e,43,pTe({sz:12,color:{theme:1},name:"Calibri",family:2})),Ot(e,612)}function kTe(e){var t=2;Ot(e,603,Dc(t)),Ot(e,45,C7({patternType:"none"})),Ot(e,45,C7({patternType:"gray125"})),Ot(e,604)}function CTe(e){var t=1;Ot(e,613,Dc(t)),Ot(e,46,bTe()),Ot(e,614)}function _Te(e){var t=1;Ot(e,626,Dc(t)),Ot(e,47,jY({numFmtId:0},65535)),Ot(e,627)}function ETe(e,t){Ot(e,617,Dc(t.length)),t.forEach(function(r){Ot(e,47,jY(r,0))}),Ot(e,618)}function TTe(e){var t=1;Ot(e,619,Dc(t)),Ot(e,48,wTe({xfId:0,name:"Normal"})),Ot(e,620)}function PTe(e){var t=0;Ot(e,505,Dc(t)),Ot(e,506)}function DTe(e){var t=0;Ot(e,508,jTe(t,"TableStyleMedium9","PivotStyleMedium4")),Ot(e,509)}function OTe(e,t){var r=Uo();return Ot(r,278),STe(r,e.SSF),ATe(r),kTe(r),CTe(r),_Te(r),ETe(r,t.cellXfs),TTe(r),PTe(r),DTe(r),Ot(r,279),r.end()}var RTe=["</a:lt1>","</a:dk1>","</a:lt2>","</a:dk2>","</a:accent1>","</a:accent2>","</a:accent3>","</a:accent4>","</a:accent5>","</a:accent6>","</a:hlink>","</a:folHlink>"];function MTe(e,t,r){t.themeElements.clrScheme=[];var n={};(e[0].match(Xs)||[]).forEach(function(a){var s=Tr(a);switch(s[0]){case"<a:clrScheme":case"</a:clrScheme>":break;case"<a:srgbClr":n.rgb=s.val;break;case"<a:sysClr":n.rgb=s.lastClr;break;case"<a:dk1>":case"</a:dk1>":case"<a:lt1>":case"</a:lt1>":case"<a:dk2>":case"</a:dk2>":case"<a:lt2>":case"</a:lt2>":case"<a:accent1>":case"</a:accent1>":case"<a:accent2>":case"</a:accent2>":case"<a:accent3>":case"</a:accent3>":case"<a:accent4>":case"</a:accent4>":case"<a:accent5>":case"</a:accent5>":case"<a:accent6>":case"</a:accent6>":case"<a:hlink>":case"</a:hlink>":case"<a:folHlink>":case"</a:folHlink>":s[0].charAt(1)==="/"?(t.themeElements.clrScheme[RTe.indexOf(s[0])]=n,n={}):n.name=s[0].slice(3,s[0].length-1);break;default:if(r&&r.WTF)throw new Error("Unrecognized "+s[0]+" in clrScheme")}})}function LTe(){}function ITe(){}var FTe=/<a:clrScheme([^>]*)>[\s\S]*<\/a:clrScheme>/,BTe=/<a:fontScheme([^>]*)>[\s\S]*<\/a:fontScheme>/,zTe=/<a:fmtScheme([^>]*)>[\s\S]*<\/a:fmtScheme>/;function UTe(e,t,r){t.themeElements={};var n;[["clrScheme",FTe,MTe],["fontScheme",BTe,LTe],["fmtScheme",zTe,ITe]].forEach(function(a){if(!(n=e.match(a[1])))throw new Error(a[0]+" not found in themeElements");a[2](n,t,r)})}var $Te=/<a:themeElements([^>]*)>[\s\S]*<\/a:themeElements>/;function NY(e,t){(!e||e.length===0)&&(e=IE());var r,n={};if(!(r=e.match($Te)))throw new Error("themeElements not found in theme");return UTe(r[0],n,t),n.raw=e,n}function IE(e,t){if(t&&t.themeXLSX)return t.themeXLSX;if(e&&typeof e.raw=="string")return e.raw;var r=[pi];return r[r.length]='<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">',r[r.length]="<a:themeElements>",r[r.length]='<a:clrScheme name="Office">',r[r.length]='<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1>',r[r.length]='<a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>',r[r.length]='<a:dk2><a:srgbClr val="1F497D"/></a:dk2>',r[r.length]='<a:lt2><a:srgbClr val="EEECE1"/></a:lt2>',r[r.length]='<a:accent1><a:srgbClr val="4F81BD"/></a:accent1>',r[r.length]='<a:accent2><a:srgbClr val="C0504D"/></a:accent2>',r[r.length]='<a:accent3><a:srgbClr val="9BBB59"/></a:accent3>',r[r.length]='<a:accent4><a:srgbClr val="8064A2"/></a:accent4>',r[r.length]='<a:accent5><a:srgbClr val="4BACC6"/></a:accent5>',r[r.length]='<a:accent6><a:srgbClr val="F79646"/></a:accent6>',r[r.length]='<a:hlink><a:srgbClr val="0000FF"/></a:hlink>',r[r.length]='<a:folHlink><a:srgbClr val="800080"/></a:folHlink>',r[r.length]="</a:clrScheme>",r[r.length]='<a:fontScheme name="Office">',r[r.length]="<a:majorFont>",r[r.length]='<a:latin typeface="Cambria"/>',r[r.length]='<a:ea typeface=""/>',r[r.length]='<a:cs typeface=""/>',r[r.length]='<a:font script="Jpan" typeface="ＭＳ Ｐゴシック"/>',r[r.length]='<a:font script="Hang" typeface="맑은 고딕"/>',r[r.length]='<a:font script="Hans" typeface="宋体"/>',r[r.length]='<a:font script="Hant" typeface="新細明體"/>',r[r.length]='<a:font script="Arab" typeface="Times New Roman"/>',r[r.length]='<a:font script="Hebr" typeface="Times New Roman"/>',r[r.length]='<a:font script="Thai" typeface="Tahoma"/>',r[r.length]='<a:font script="Ethi" typeface="Nyala"/>',r[r.length]='<a:font script="Beng" typeface="Vrinda"/>',r[r.length]='<a:font script="Gujr" typeface="Shruti"/>',r[r.length]='<a:font script="Khmr" typeface="MoolBoran"/>',r[r.length]='<a:font script="Knda" typeface="Tunga"/>',r[r.length]='<a:font script="Guru" typeface="Raavi"/>',r[r.length]='<a:font script="Cans" typeface="Euphemia"/>',r[r.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',r[r.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',r[r.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',r[r.length]='<a:font script="Thaa" typeface="MV Boli"/>',r[r.length]='<a:font script="Deva" typeface="Mangal"/>',r[r.length]='<a:font script="Telu" typeface="Gautami"/>',r[r.length]='<a:font script="Taml" typeface="Latha"/>',r[r.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',r[r.length]='<a:font script="Orya" typeface="Kalinga"/>',r[r.length]='<a:font script="Mlym" typeface="Kartika"/>',r[r.length]='<a:font script="Laoo" typeface="DokChampa"/>',r[r.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',r[r.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',r[r.length]='<a:font script="Viet" typeface="Times New Roman"/>',r[r.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',r[r.length]='<a:font script="Geor" typeface="Sylfaen"/>',r[r.length]="</a:majorFont>",r[r.length]="<a:minorFont>",r[r.length]='<a:latin typeface="Calibri"/>',r[r.length]='<a:ea typeface=""/>',r[r.length]='<a:cs typeface=""/>',r[r.length]='<a:font script="Jpan" typeface="ＭＳ Ｐゴシック"/>',r[r.length]='<a:font script="Hang" typeface="맑은 고딕"/>',r[r.length]='<a:font script="Hans" typeface="宋体"/>',r[r.length]='<a:font script="Hant" typeface="新細明體"/>',r[r.length]='<a:font script="Arab" typeface="Arial"/>',r[r.length]='<a:font script="Hebr" typeface="Arial"/>',r[r.length]='<a:font script="Thai" typeface="Tahoma"/>',r[r.length]='<a:font script="Ethi" typeface="Nyala"/>',r[r.length]='<a:font script="Beng" typeface="Vrinda"/>',r[r.length]='<a:font script="Gujr" typeface="Shruti"/>',r[r.length]='<a:font script="Khmr" typeface="DaunPenh"/>',r[r.length]='<a:font script="Knda" typeface="Tunga"/>',r[r.length]='<a:font script="Guru" typeface="Raavi"/>',r[r.length]='<a:font script="Cans" typeface="Euphemia"/>',r[r.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',r[r.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',r[r.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',r[r.length]='<a:font script="Thaa" typeface="MV Boli"/>',r[r.length]='<a:font script="Deva" typeface="Mangal"/>',r[r.length]='<a:font script="Telu" typeface="Gautami"/>',r[r.length]='<a:font script="Taml" typeface="Latha"/>',r[r.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',r[r.length]='<a:font script="Orya" typeface="Kalinga"/>',r[r.length]='<a:font script="Mlym" typeface="Kartika"/>',r[r.length]='<a:font script="Laoo" typeface="DokChampa"/>',r[r.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',r[r.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',r[r.length]='<a:font script="Viet" typeface="Arial"/>',r[r.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',r[r.length]='<a:font script="Geor" typeface="Sylfaen"/>',r[r.length]="</a:minorFont>",r[r.length]="</a:fontScheme>",r[r.length]='<a:fmtScheme name="Office">',r[r.length]="<a:fillStyleLst>",r[r.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',r[r.length]="</a:gsLst>",r[r.length]='<a:lin ang="16200000" scaled="1"/>',r[r.length]="</a:gradFill>",r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.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>',r[r.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>',r[r.length]="</a:gsLst>",r[r.length]='<a:lin ang="16200000" scaled="0"/>',r[r.length]="</a:gradFill>",r[r.length]="</a:fillStyleLst>",r[r.length]="<a:lnStyleLst>",r[r.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>',r[r.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>',r[r.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>',r[r.length]="</a:lnStyleLst>",r[r.length]="<a:effectStyleLst>",r[r.length]="<a:effectStyle>",r[r.length]="<a:effectLst>",r[r.length]='<a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw>',r[r.length]="</a:effectLst>",r[r.length]="</a:effectStyle>",r[r.length]="<a:effectStyle>",r[r.length]="<a:effectLst>",r[r.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',r[r.length]="</a:effectLst>",r[r.length]="</a:effectStyle>",r[r.length]="<a:effectStyle>",r[r.length]="<a:effectLst>",r[r.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',r[r.length]="</a:effectLst>",r[r.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>',r[r.length]='<a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d>',r[r.length]="</a:effectStyle>",r[r.length]="</a:effectStyleLst>",r[r.length]="<a:bgFillStyleLst>",r[r.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',r[r.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>',r[r.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs>',r[r.length]="</a:gsLst>",r[r.length]='<a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path>',r[r.length]="</a:gradFill>",r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>',r[r.length]="</a:gsLst>",r[r.length]='<a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>',r[r.length]="</a:gradFill>",r[r.length]="</a:bgFillStyleLst>",r[r.length]="</a:fmtScheme>",r[r.length]="</a:themeElements>",r[r.length]="<a:objectDefaults>",r[r.length]="<a:spDef>",r[r.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>',r[r.length]="</a:spDef>",r[r.length]="<a:lnDef>",r[r.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>',r[r.length]="</a:lnDef>",r[r.length]="</a:objectDefaults>",r[r.length]="<a:extraClrSchemeLst/>",r[r.length]="</a:theme>",r.join("")}function HTe(e,t,r){var n=e.l+t,a=e.read_shift(4);if(a!==124226){if(!r.cellStyles){e.l=n;return}var s=e.slice(e.l);e.l=n;var o;try{o=pG(s,{type:"array"})}catch{return}var l=ul(o,"theme/theme/theme1.xml",!0);if(l)return NY(l,r)}}function VTe(e){return e.read_shift(4)}function qTe(e){var t={};switch(t.xclrType=e.read_shift(2),t.nTintShade=e.read_shift(2),t.xclrType){case 0:e.l+=4;break;case 1:t.xclrValue=WTe(e,4);break;case 2:t.xclrValue=rY(e);break;case 3:t.xclrValue=VTe(e);break;case 4:e.l+=4;break}return e.l+=8,t}function WTe(e,t){return Ys(e,t)}function GTe(e,t){return Ys(e,t)}function YTe(e){var t=e.read_shift(2),r=e.read_shift(2)-4,n=[t];switch(t){case 4:case 5:case 7:case 8:case 9:case 10:case 11:case 13:n[1]=qTe(e);break;case 6:n[1]=GTe(e,r);break;case 14:case 15:n[1]=e.read_shift(r===1?1:2);break;default:throw new Error("Unrecognized ExtProp type: "+t+" "+r)}return n}function KTe(e,t){var r=e.l+t;e.l+=2;var n=e.read_shift(2);e.l+=2;for(var a=e.read_shift(2),s=[];a-- >0;)s.push(YTe(e,r-e.l));return{ixfe:n,ext:s}}function XTe(e,t){t.forEach(function(r){r[0]})}function ZTe(e,t){return{flags:e.read_shift(4),version:e.read_shift(4),name:Ws(e)}}function JTe(e){var t=St(12+2*e.name.length);return t.write_shift(4,e.flags),t.write_shift(4,e.version),us(e.name,t),t.slice(0,t.l)}function QTe(e){for(var t=[],r=e.read_shift(4);r-- >0;)t.push([e.read_shift(4),e.read_shift(4)]);return t}function e6e(e){var t=St(4+8*e.length);t.write_shift(4,e.length);for(var r=0;r<e.length;++r)t.write_shift(4,e[r][0]),t.write_shift(4,e[r][1]);return t}function t6e(e,t){var r=St(8+2*t.length);return r.write_shift(4,e),us(t,r),r.slice(0,r.l)}function r6e(e){return e.l+=4,e.read_shift(4)!=0}function n6e(e,t){var r=St(8);return r.write_shift(4,e),r.write_shift(4,1),r}function a6e(e,t,r){var n={Types:[],Cell:[],Value:[]},a=r||{},s=[],o=!1,l=2;return mf(e,function(u,d,f){switch(f){case 335:n.Types.push({name:u.name});break;case 51:u.forEach(function(m){l==1?n.Cell.push({type:n.Types[m[0]-1].name,index:m[1]}):l==0&&n.Value.push({type:n.Types[m[0]-1].name,index:m[1]})});break;case 337:l=u?1:0;break;case 338:l=2;break;case 35:s.push(f),o=!0;break;case 36:s.pop(),o=!1;break;default:if(!d.T){if(!o||a.WTF&&s[s.length-1]!=35)throw new Error("Unexpected record 0x"+f.toString(16))}}}),n}function i6e(){var e=Uo();return Ot(e,332),Ot(e,334,Dc(1)),Ot(e,335,JTe({name:"XLDAPR",version:12e4,flags:3496657072})),Ot(e,336),Ot(e,339,t6e(1,"XLDAPR")),Ot(e,52),Ot(e,35,Dc(514)),Ot(e,4096,Dc(0)),Ot(e,4097,Bl(1)),Ot(e,36),Ot(e,53),Ot(e,340),Ot(e,337,n6e(1)),Ot(e,51,e6e([[1,0]])),Ot(e,338),Ot(e,333),e.end()}function s6e(e,t,r){var n={Types:[],Cell:[],Value:[]};if(!e)return n;var a=!1,s=2,o;return e.replace(Xs,function(l){var u=Tr(l);switch(Zu(u[0])){case"<?xml":break;case"<metadata":case"</metadata>":break;case"<metadataTypes":case"</metadataTypes>":break;case"<metadataType":n.Types.push({name:u.name});break;case"</metadataType>":break;case"<futureMetadata":for(var d=0;d<n.Types.length;++d)n.Types[d].name==u.name&&(o=n.Types[d]);break;case"</futureMetadata>":break;case"<bk>":break;case"</bk>":break;case"<rc":s==1?n.Cell.push({type:n.Types[u.t-1].name,index:+u.v}):s==0&&n.Value.push({type:n.Types[u.t-1].name,index:+u.v});break;case"</rc>":break;case"<cellMetadata":s=1;break;case"</cellMetadata>":s=2;break;case"<valueMetadata":s=0;break;case"</valueMetadata>":s=2;break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":a=!0;break;case"</ext>":a=!1;break;case"<rvb":if(!o)break;o.offsets||(o.offsets=[]),o.offsets.push(+u.i);break;default:if(!a&&r.WTF)throw new Error("unrecognized "+u[0]+" in metadata")}return l}),n}function SY(){var e=[pi];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 o6e(e){var t=[];if(!e)return t;var r=1;return(e.match(Xs)||[]).forEach(function(n){var a=Tr(n);switch(a[0]){case"<?xml":break;case"<calcChain":case"<calcChain>":case"</calcChain>":break;case"<c":delete a[0],a.i?r=a.i:a.i=r,t.push(a);break}}),t}function l6e(e){var t={};t.i=e.read_shift(4);var r={};r.r=e.read_shift(4),r.c=e.read_shift(4),t.r=_r(r);var n=e.read_shift(1);return n&2&&(t.l="1"),n&8&&(t.a="1"),t}function c6e(e,t,r){var n=[];return mf(e,function(s,o,l){switch(l){case 63:n.push(s);break;default:if(!o.T)throw new Error("Unexpected record 0x"+l.toString(16))}}),n}function u6e(e,t,r,n){if(!e)return e;var a=n||{},s=!1;mf(e,function(l,u,d){switch(d){case 359:case 363:case 364:case 366:case 367:case 368:case 369:case 370:case 371:case 472:case 577:case 578:case 579:case 580:case 581:case 582:case 583:case 584:case 585:case 586:case 587:break;case 35:s=!0;break;case 36:s=!1;break;default:if(!u.T){if(!s||a.WTF)throw new Error("Unexpected record 0x"+d.toString(16))}}},a)}function d6e(e,t){if(!e)return"??";var r=(e.match(/<c:chart [^>]*r:id="([^"]*)"/)||["",""])[1];return t["!id"][r].Target}var zp=1024;function AY(e,t){for(var r=[21600,21600],n=["m0,0l0",r[1],r[0],r[1],r[0],"0xe"].join(","),a=[Wt("xml",null,{"xmlns:v":sl.v,"xmlns:o":sl.o,"xmlns:x":sl.x,"xmlns:mv":sl.mv}).replace(/\/>/,">"),Wt("o:shapelayout",Wt("o:idmap",null,{"v:ext":"edit",data:e}),{"v:ext":"edit"}),Wt("v:shapetype",[Wt("v:stroke",null,{joinstyle:"miter"}),Wt("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:r.join(","),path:n})];zp<e*1e3;)zp+=1e3;return t.forEach(function(s){var o=Fa(s[0]),l={color2:"#BEFF82",type:"gradient"};l.type=="gradient"&&(l.angle="-180");var u=l.type=="gradient"?Wt("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}):null,d=Wt("v:fill",u,l),f={on:"t",obscured:"t"};++zp,a=a.concat(["<v:shape"+Xv({id:"_x0000_s"+zp,type:"#_x0000_t202",style:"position:absolute; margin-left:80pt;margin-top:5pt;width:104pt;height:64pt;z-index:10"+(s[1].hidden?";visibility:hidden":""),fillcolor:"#ECFAD4",strokecolor:"#edeaa1"})+">",d,Wt("v:shadow",null,f),Wt("v:path",null,{"o:connecttype":"none"}),'<v:textbox><div style="text-align:left"></div></v:textbox>','<x:ClientData ObjectType="Note">',"<x:MoveWithCells/>","<x:SizeWithCells/>",Es("x:Anchor",[o.c+1,0,o.r+1,0,o.c+3,20,o.r+5,20].join(",")),Es("x:AutoFill","False"),Es("x:Row",String(o.r)),Es("x:Column",String(o.c)),s[1].hidden?"":"<x:Visible/>","</x:ClientData>","</v:shape>"])}),a.push("</xml>"),a.join("")}function _7(e,t,r,n){var a=Array.isArray(e),s;t.forEach(function(o){var l=Fa(o.ref);if(a?(e[l.r]||(e[l.r]=[]),s=e[l.r][l.c]):s=e[o.ref],!s){s={t:"z"},a?e[l.r][l.c]=s:e[o.ref]=s;var u=yn(e["!ref"]||"BDWGO1000001:A1");u.s.r>l.r&&(u.s.r=l.r),u.e.r<l.r&&(u.e.r=l.r),u.s.c>l.c&&(u.s.c=l.c),u.e.c<l.c&&(u.e.c=l.c);var d=zr(u);d!==e["!ref"]&&(e["!ref"]=d)}s.c||(s.c=[]);var f={a:o.author,t:o.t,r:o.r,T:r};o.h&&(f.h=o.h);for(var m=s.c.length-1;m>=0;--m){if(!r&&s.c[m].T)return;r&&!s.c[m].T&&s.c.splice(m,1)}if(r&&n){for(m=0;m<n.length;++m)if(f.a==n[m].id){f.a=n[m].name||f.a;break}}s.c.push(f)})}function f6e(e,t){if(e.match(/<(?:\w+:)?comments *\/>/))return[];var r=[],n=[],a=e.match(/<(?:\w+:)?authors>([\s\S]*)<\/(?:\w+:)?authors>/);a&&a[1]&&a[1].split(/<\/\w*:?author>/).forEach(function(o){if(!(o===""||o.trim()==="")){var l=o.match(/<(?:\w+:)?author[^>]*>(.*)/);l&&r.push(l[1])}});var s=e.match(/<(?:\w+:)?commentList>([\s\S]*)<\/(?:\w+:)?commentList>/);return s&&s[1]&&s[1].split(/<\/\w*:?comment>/).forEach(function(o){if(!(o===""||o.trim()==="")){var l=o.match(/<(?:\w+:)?comment[^>]*>/);if(l){var u=Tr(l[0]),d={author:u.authorId&&r[u.authorId]||"sheetjsghost",ref:u.ref,guid:u.guid},f=Fa(u.ref);if(!(t.sheetRows&&t.sheetRows<=f.r)){var m=o.match(/<(?:\w+:)?text>([\s\S]*)<\/(?:\w+:)?text>/),g=!!m&&!!m[1]&&RE(m[1])||{r:"",t:"",h:""};d.r=g.r,g.r=="<t></t>"&&(g.t=g.h=""),d.t=(g.t||"").replace(/\r\n/g,`
`).replace(/\r/g,`
`),t.cellHTML&&(d.h=g.h),n.push(d)}}}}),n}function kY(e){var t=[pi,Wt("comments",null,{xmlns:j0[0]})],r=[];return t.push("<authors>"),e.forEach(function(n){n[1].forEach(function(a){var s=Vn(a.a);r.indexOf(s)==-1&&(r.push(s),t.push("<author>"+s+"</author>")),a.T&&a.ID&&r.indexOf("tc="+a.ID)==-1&&(r.push("tc="+a.ID),t.push("<author>tc="+a.ID+"</author>"))})}),r.length==0&&(r.push("SheetJ5"),t.push("<author>SheetJ5</author>")),t.push("</authors>"),t.push("<commentList>"),e.forEach(function(n){var a=0,s=[];if(n[1][0]&&n[1][0].T&&n[1][0].ID?a=r.indexOf("tc="+n[1][0].ID):n[1].forEach(function(u){u.a&&(a=r.indexOf(Vn(u.a))),s.push(u.t||"")}),t.push('<comment ref="'+n[0]+'" authorId="'+a+'"><text>'),s.length<=1)t.push(Es("t",Vn(s[0]||"")));else{for(var o=`Comment:
    `+s[0]+`
`,l=1;l<s.length;++l)o+=`Reply:
    `+s[l]+`
`;t.push(Es("t",Vn(o)))}t.push("</text></comment>")}),t.push("</commentList>"),t.length>2&&(t[t.length]="</comments>",t[1]=t[1].replace("/>",">")),t.join("")}function h6e(e,t){var r=[],n=!1,a={},s=0;return e.replace(Xs,function(l,u){var d=Tr(l);switch(Zu(d[0])){case"<?xml":break;case"<ThreadedComments":break;case"</ThreadedComments>":break;case"<threadedComment":a={author:d.personId,guid:d.id,ref:d.ref,T:1};break;case"</threadedComment>":a.t!=null&&r.push(a);break;case"<text>":case"<text":s=u+l.length;break;case"</text>":a.t=e.slice(s,u).replace(/\r\n/g,`
`).replace(/\r/g,`
`);break;case"<mentions":case"<mentions>":n=!0;break;case"</mentions>":n=!1;break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":n=!0;break;case"</ext>":n=!1;break;default:if(!n&&t.WTF)throw new Error("unrecognized "+d[0]+" in threaded comments")}return l}),r}function m6e(e,t,r){var n=[pi,Wt("ThreadedComments",null,{xmlns:$i.TCMNT}).replace(/[\/]>/,">")];return e.forEach(function(a){var s="";(a[1]||[]).forEach(function(o,l){if(!o.T){delete o.ID;return}o.a&&t.indexOf(o.a)==-1&&t.push(o.a);var u={ref:a[0],id:"{54EE7951-7262-4200-6969-"+("000000000000"+r.tcid++).slice(-12)+"}"};l==0?s=u.id:u.parentId=s,o.ID=u.id,o.a&&(u.personId="{54EE7950-7262-4200-6969-"+("000000000000"+t.indexOf(o.a)).slice(-12)+"}"),n.push(Wt("threadedComment",Es("text",o.t||""),u))})}),n.push("</ThreadedComments>"),n.join("")}function p6e(e,t){var r=[],n=!1;return e.replace(Xs,function(s){var o=Tr(s);switch(Zu(o[0])){case"<?xml":break;case"<personList":break;case"</personList>":break;case"<person":r.push({name:o.displayname,id:o.id});break;case"</person>":break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":n=!0;break;case"</ext>":n=!1;break;default:if(!n&&t.WTF)throw new Error("unrecognized "+o[0]+" in threaded comments")}return s}),r}function x6e(e){var t=[pi,Wt("personList",null,{xmlns:$i.TCMNT,"xmlns:x":j0[0]}).replace(/[\/]>/,">")];return e.forEach(function(r,n){t.push(Wt("person",null,{displayName:r,id:"{54EE7950-7262-4200-6969-"+("000000000000"+n).slice(-12)+"}",userId:r,providerId:"None"}))}),t.push("</personList>"),t.join("")}function g6e(e){var t={};t.iauthor=e.read_shift(4);var r=k0(e);return t.rfx=r.s,t.ref=_r(r.s),e.l+=16,t}function v6e(e,t){return t==null&&(t=St(36)),t.write_shift(4,e[1].iauthor),zx(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 y6e=Ws;function b6e(e){return us(e.slice(0,54))}function w6e(e,t){var r=[],n=[],a={},s=!1;return mf(e,function(l,u,d){switch(d){case 632:n.push(l);break;case 635:a=l;break;case 637:a.t=l.t,a.h=l.h,a.r=l.r;break;case 636:if(a.author=n[a.iauthor],delete a.iauthor,t.sheetRows&&a.rfx&&t.sheetRows<=a.rfx.r)break;a.t||(a.t=""),delete a.rfx,r.push(a);break;case 3072:break;case 35:s=!0;break;case 36:s=!1;break;case 37:break;case 38:break;default:if(!u.T){if(!s||t.WTF)throw new Error("Unexpected record 0x"+d.toString(16))}}}),r}function j6e(e){var t=Uo(),r=[];return Ot(t,628),Ot(t,630),e.forEach(function(n){n[1].forEach(function(a){r.indexOf(a.a)>-1||(r.push(a.a.slice(0,54)),Ot(t,632,b6e(a.a)))})}),Ot(t,631),Ot(t,633),e.forEach(function(n){n[1].forEach(function(a){a.iauthor=r.indexOf(a.a);var s={s:Fa(n[0]),e:Fa(n[0])};Ot(t,635,v6e([s,a])),a.t&&a.t.length>0&&Ot(t,637,Vke(a)),Ot(t,636),delete a.iauthor})}),Ot(t,634),Ot(t,629),t.end()}var N6e="application/vnd.ms-office.vbaProject";function S6e(e){var t=br.utils.cfb_new({root:"R"});return e.FullPaths.forEach(function(r,n){if(!(r.slice(-1)==="/"||!r.match(/_VBA_PROJECT_CUR/))){var a=r.replace(/^[^\/]*/,"R").replace(/\/_VBA_PROJECT_CUR\u0000*/,"");br.utils.cfb_add(t,a,e.FileIndex[n].content)}}),br.write(t)}function A6e(e,t){t.FullPaths.forEach(function(r,n){if(n!=0){var a=r.replace(/[^\/]*[\/]/,"/_VBA_PROJECT_CUR/");a.slice(-1)!=="/"&&br.utils.cfb_add(e,a,t.FileIndex[n].content)}})}var CY=["xlsb","xlsm","xlam","biff8","xla"];function k6e(){return{"!type":"dialog"}}function C6e(){return{"!type":"dialog"}}function _6e(){return{"!type":"macro"}}function E6e(){return{"!type":"macro"}}var Qp=(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 r(n,a,s,o){var l=!1,u=!1;s.length==0?u=!0:s.charAt(0)=="["&&(u=!0,s=s.slice(1,-1)),o.length==0?l=!0:o.charAt(0)=="["&&(l=!0,o=o.slice(1,-1));var d=s.length>0?parseInt(s,10)|0:0,f=o.length>0?parseInt(o,10)|0:0;return l?f+=t.c:--f,u?d+=t.r:--d,a+(l?"":"$")+Ia(f)+(u?"":"$")+hi(d)}return function(a,s){return t=s,a.replace(e,r)}})(),FE=/(^|[^._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,BE=(function(){return function(t,r){return t.replace(FE,function(n,a,s,o,l,u){var d=AE(o)-(s?0:r.c),f=SE(u)-(l?0:r.r),m=f==0?"":l?f+1:"["+f+"]",g=d==0?"":s?d+1:"["+d+"]";return a+"R"+m+"C"+g})}})();function _Y(e,t){return e.replace(FE,function(r,n,a,s,o,l){return n+(a=="$"?a+s:Ia(AE(s)+t.c))+(o=="$"?o+l:hi(SE(l)+t.r))})}function T6e(e,t,r){var n=$o(t),a=n.s,s=Fa(r),o={r:s.r-a.r,c:s.c-a.c};return _Y(e,o)}function P6e(e){return e.length!=1}function E7(e){return e.replace(/_xlfn\./g,"")}function yi(e){e.l+=1}function Th(e,t){var r=e.read_shift(2);return[r&16383,r>>14&1,r>>15&1]}function EY(e,t,r){var n=2;if(r){if(r.biff>=2&&r.biff<=5)return TY(e);r.biff==12&&(n=4)}var a=e.read_shift(n),s=e.read_shift(n),o=Th(e),l=Th(e);return{s:{r:a,c:o[0],cRel:o[1],rRel:o[2]},e:{r:s,c:l[0],cRel:l[1],rRel:l[2]}}}function TY(e){var t=Th(e),r=Th(e),n=e.read_shift(1),a=e.read_shift(1);return{s:{r:t[0],c:n,cRel:t[1],rRel:t[2]},e:{r:r[0],c:a,cRel:r[1],rRel:r[2]}}}function D6e(e,t,r){if(r.biff<8)return TY(e);var n=e.read_shift(r.biff==12?4:2),a=e.read_shift(r.biff==12?4:2),s=Th(e),o=Th(e);return{s:{r:n,c:s[0],cRel:s[1],rRel:s[2]},e:{r:a,c:o[0],cRel:o[1],rRel:o[2]}}}function PY(e,t,r){if(r&&r.biff>=2&&r.biff<=5)return O6e(e);var n=e.read_shift(r&&r.biff==12?4:2),a=Th(e);return{r:n,c:a[0],cRel:a[1],rRel:a[2]}}function O6e(e){var t=Th(e),r=e.read_shift(1);return{r:t[0],c:r,cRel:t[1],rRel:t[2]}}function R6e(e){var t=e.read_shift(2),r=e.read_shift(2);return{r:t,c:r&255,fQuoted:!!(r&16384),cRel:r>>15,rRel:r>>15}}function M6e(e,t,r){var n=r&&r.biff?r.biff:8;if(n>=2&&n<=5)return L6e(e);var a=e.read_shift(n>=12?4:2),s=e.read_shift(2),o=(s&16384)>>14,l=(s&32768)>>15;if(s&=16383,l==1)for(;a>524287;)a-=1048576;if(o==1)for(;s>8191;)s=s-16384;return{r:a,c:s,cRel:o,rRel:l}}function L6e(e){var t=e.read_shift(2),r=e.read_shift(1),n=(t&32768)>>15,a=(t&16384)>>14;return t&=16383,n==1&&t>=8192&&(t=t-16384),a==1&&r>=128&&(r=r-256),{r:t,c:r,cRel:a,rRel:n}}function I6e(e,t,r){var n=(e[e.l++]&96)>>5,a=EY(e,r.biff>=2&&r.biff<=5?6:8,r);return[n,a]}function F6e(e,t,r){var n=(e[e.l++]&96)>>5,a=e.read_shift(2,"i"),s=8;if(r)switch(r.biff){case 5:e.l+=12,s=6;break;case 12:s=12;break}var o=EY(e,s,r);return[n,a,o]}function B6e(e,t,r){var n=(e[e.l++]&96)>>5;return e.l+=r&&r.biff>8?12:r.biff<8?6:8,[n]}function z6e(e,t,r){var n=(e[e.l++]&96)>>5,a=e.read_shift(2),s=8;if(r)switch(r.biff){case 5:e.l+=12,s=6;break;case 12:s=12;break}return e.l+=s,[n,a]}function U6e(e,t,r){var n=(e[e.l++]&96)>>5,a=D6e(e,t-1,r);return[n,a]}function $6e(e,t,r){var n=(e[e.l++]&96)>>5;return e.l+=r.biff==2?6:r.biff==12?14:7,[n]}function T7(e){var t=e[e.l+1]&1,r=1;return e.l+=4,[t,r]}function H6e(e,t,r){e.l+=2;for(var n=e.read_shift(r&&r.biff==2?1:2),a=[],s=0;s<=n;++s)a.push(e.read_shift(r&&r.biff==2?1:2));return a}function V6e(e,t,r){var n=e[e.l+1]&255?1:0;return e.l+=2,[n,e.read_shift(r&&r.biff==2?1:2)]}function q6e(e,t,r){var n=e[e.l+1]&255?1:0;return e.l+=2,[n,e.read_shift(r&&r.biff==2?1:2)]}function W6e(e){var t=e[e.l+1]&255?1:0;return e.l+=2,[t,e.read_shift(2)]}function G6e(e,t,r){var n=e[e.l+1]&255?1:0;return e.l+=r&&r.biff==2?3:4,[n]}function DY(e){var t=e.read_shift(1),r=e.read_shift(1);return[t,r]}function Y6e(e){return e.read_shift(2),DY(e)}function K6e(e){return e.read_shift(2),DY(e)}function X6e(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var a=PY(e,0,r);return[n,a]}function Z6e(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var a=M6e(e,0,r);return[n,a]}function J6e(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var a=e.read_shift(2);r&&r.biff==5&&(e.l+=12);var s=PY(e,0,r);return[n,a,s]}function Q6e(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var a=e.read_shift(r&&r.biff<=3?1:2);return[rDe[a],MY[a],n]}function ePe(e,t,r){var n=e[e.l++],a=e.read_shift(1),s=r&&r.biff<=3?[n==88?-1:0,e.read_shift(1)]:tPe(e);return[a,(s[0]===0?MY:tDe)[s[1]]]}function tPe(e){return[e[e.l+1]>>7,e.read_shift(2)&32767]}function rPe(e,t,r){e.l+=r&&r.biff==2?3:4}function nPe(e,t,r){if(e.l++,r&&r.biff==12)return[e.read_shift(4,"i"),0];var n=e.read_shift(2),a=e.read_shift(r&&r.biff==2?1:2);return[n,a]}function aPe(e){return e.l++,pf[e.read_shift(1)]}function iPe(e){return e.l++,e.read_shift(2)}function sPe(e){return e.l++,e.read_shift(1)!==0}function oPe(e){return e.l++,Vs(e)}function lPe(e,t,r){return e.l++,I1(e,t-1,r)}function cPe(e,t){var r=[e.read_shift(1)];if(t==12)switch(r[0]){case 2:r[0]=4;break;case 4:r[0]=16;break;case 0:r[0]=1;break;case 1:r[0]=2;break}switch(r[0]){case 4:r[1]=li(e,1)?"TRUE":"FALSE",t!=12&&(e.l+=7);break;case 37:case 16:r[1]=pf[e[e.l]],e.l+=t==12?4:8;break;case 0:e.l+=8;break;case 1:r[1]=Vs(e);break;case 2:r[1]=C0(e,0,{biff:t>0&&t<8?2:t});break;default:throw new Error("Bad SerAr: "+r[0])}return r}function uPe(e,t,r){for(var n=e.read_shift(r.biff==12?4:2),a=[],s=0;s!=n;++s)a.push((r.biff==12?k0:Q5)(e));return a}function dPe(e,t,r){var n=0,a=0;r.biff==12?(n=e.read_shift(4),a=e.read_shift(4)):(a=1+e.read_shift(1),n=1+e.read_shift(2)),r.biff>=2&&r.biff<8&&(--n,--a==0&&(a=256));for(var s=0,o=[];s!=n&&(o[s]=[]);++s)for(var l=0;l!=a;++l)o[s][l]=cPe(e,r.biff);return o}function fPe(e,t,r){var n=e.read_shift(1)>>>5&3,a=!r||r.biff>=8?4:2,s=e.read_shift(a);switch(r.biff){case 2:e.l+=5;break;case 3:case 4:e.l+=8;break;case 5:e.l+=12;break}return[n,0,s]}function hPe(e,t,r){if(r.biff==5)return mPe(e);var n=e.read_shift(1)>>>5&3,a=e.read_shift(2),s=e.read_shift(4);return[n,a,s]}function mPe(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2,"i");e.l+=8;var n=e.read_shift(2);return e.l+=12,[t,r,n]}function pPe(e,t,r){var n=e.read_shift(1)>>>5&3;e.l+=r&&r.biff==2?3:4;var a=e.read_shift(r&&r.biff==2?1:2);return[n,a]}function xPe(e,t,r){var n=e.read_shift(1)>>>5&3,a=e.read_shift(r&&r.biff==2?1:2);return[n,a]}function gPe(e,t,r){var n=e.read_shift(1)>>>5&3;return e.l+=4,r.biff<8&&e.l--,r.biff==12&&(e.l+=2),[n]}function vPe(e,t,r){var n=(e[e.l++]&96)>>5,a=e.read_shift(2),s=4;if(r)switch(r.biff){case 5:s=15;break;case 12:s=6;break}return e.l+=s,[n,a]}var yPe=Ys,bPe=Ys,wPe=Ys;function B1(e,t,r){return e.l+=2,[R6e(e)]}function zE(e){return e.l+=6,[]}var jPe=B1,NPe=zE,SPe=zE,APe=B1;function OY(e){return e.l+=2,[wi(e),e.read_shift(2)&1]}var kPe=B1,CPe=OY,_Pe=zE,EPe=B1,TPe=B1,PPe=["Data","All","Headers","??","?Data2","??","?DataHeaders","??","Totals","??","??","??","?DataTotals","??","??","??","?Current"];function DPe(e){e.l+=2;var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(4),a=e.read_shift(2),s=e.read_shift(2),o=PPe[r>>2&31];return{ixti:t,coltype:r&3,rt:o,idx:n,c:a,C:s}}function OPe(e){return e.l+=2,[e.read_shift(4)]}function RPe(e,t,r){return e.l+=5,e.l+=2,e.l+=r.biff==2?1:4,["PTGSHEET"]}function MPe(e,t,r){return e.l+=r.biff==2?4:5,["PTGENDSHEET"]}function LPe(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2);return[t,r]}function IPe(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2);return[t,r]}function FPe(e){return e.l+=4,[0,0]}var P7={1:{n:"PtgExp",f:nPe},2:{n:"PtgTbl",f:wPe},3:{n:"PtgAdd",f:yi},4:{n:"PtgSub",f:yi},5:{n:"PtgMul",f:yi},6:{n:"PtgDiv",f:yi},7:{n:"PtgPower",f:yi},8:{n:"PtgConcat",f:yi},9:{n:"PtgLt",f:yi},10:{n:"PtgLe",f:yi},11:{n:"PtgEq",f:yi},12:{n:"PtgGe",f:yi},13:{n:"PtgGt",f:yi},14:{n:"PtgNe",f:yi},15:{n:"PtgIsect",f:yi},16:{n:"PtgUnion",f:yi},17:{n:"PtgRange",f:yi},18:{n:"PtgUplus",f:yi},19:{n:"PtgUminus",f:yi},20:{n:"PtgPercent",f:yi},21:{n:"PtgParen",f:yi},22:{n:"PtgMissArg",f:yi},23:{n:"PtgStr",f:lPe},26:{n:"PtgSheet",f:RPe},27:{n:"PtgEndSheet",f:MPe},28:{n:"PtgErr",f:aPe},29:{n:"PtgBool",f:sPe},30:{n:"PtgInt",f:iPe},31:{n:"PtgNum",f:oPe},32:{n:"PtgArray",f:$6e},33:{n:"PtgFunc",f:Q6e},34:{n:"PtgFuncVar",f:ePe},35:{n:"PtgName",f:fPe},36:{n:"PtgRef",f:X6e},37:{n:"PtgArea",f:I6e},38:{n:"PtgMemArea",f:pPe},39:{n:"PtgMemErr",f:yPe},40:{n:"PtgMemNoMem",f:bPe},41:{n:"PtgMemFunc",f:xPe},42:{n:"PtgRefErr",f:gPe},43:{n:"PtgAreaErr",f:B6e},44:{n:"PtgRefN",f:Z6e},45:{n:"PtgAreaN",f:U6e},46:{n:"PtgMemAreaN",f:LPe},47:{n:"PtgMemNoMemN",f:IPe},57:{n:"PtgNameX",f:hPe},58:{n:"PtgRef3d",f:J6e},59:{n:"PtgArea3d",f:F6e},60:{n:"PtgRefErr3d",f:vPe},61:{n:"PtgAreaErr3d",f:z6e},255:{}},BPe={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},zPe={1:{n:"PtgElfLel",f:OY},2:{n:"PtgElfRw",f:EPe},3:{n:"PtgElfCol",f:jPe},6:{n:"PtgElfRwV",f:TPe},7:{n:"PtgElfColV",f:APe},10:{n:"PtgElfRadical",f:kPe},11:{n:"PtgElfRadicalS",f:_Pe},13:{n:"PtgElfColS",f:NPe},15:{n:"PtgElfColSV",f:SPe},16:{n:"PtgElfRadicalLel",f:CPe},25:{n:"PtgList",f:DPe},29:{n:"PtgSxName",f:OPe},255:{}},UPe={0:{n:"PtgAttrNoop",f:FPe},1:{n:"PtgAttrSemi",f:G6e},2:{n:"PtgAttrIf",f:q6e},4:{n:"PtgAttrChoose",f:H6e},8:{n:"PtgAttrGoto",f:V6e},16:{n:"PtgAttrSum",f:rPe},32:{n:"PtgAttrBaxcel",f:T7},33:{n:"PtgAttrBaxcel",f:T7},64:{n:"PtgAttrSpace",f:Y6e},65:{n:"PtgAttrSpaceSemi",f:K6e},128:{n:"PtgAttrIfError",f:W6e},255:{}};function z1(e,t,r,n){if(n.biff<8)return Ys(e,t);for(var a=e.l+t,s=[],o=0;o!==r.length;++o)switch(r[o][0]){case"PtgArray":r[o][1]=dPe(e,0,n),s.push(r[o][1]);break;case"PtgMemArea":r[o][2]=uPe(e,r[o][1],n),s.push(r[o][2]);break;case"PtgExp":n&&n.biff==12&&(r[o][1][1]=e.read_shift(4),s.push(r[o][1]));break;case"PtgList":case"PtgElfRadicalS":case"PtgElfColS":case"PtgElfColSV":throw"Unsupported "+r[o][0]}return t=a-e.l,t!==0&&s.push(Ys(e,t)),s}function U1(e,t,r){for(var n=e.l+t,a,s,o=[];n!=e.l;)t=n-e.l,s=e[e.l],a=P7[s]||P7[BPe[s]],(s===24||s===25)&&(a=(s===24?zPe:UPe)[e[e.l+1]]),!a||!a.f?Ys(e,t):o.push([a.n,a.f(e,t,r)]);return o}function $Pe(e){for(var t=[],r=0;r<e.length;++r){for(var n=e[r],a=[],s=0;s<n.length;++s){var o=n[s];if(o)switch(o[0]){case 2:a.push('"'+o[1].replace(/"/g,'""')+'"');break;default:a.push(o[1])}else a.push("")}t.push(a.join(","))}return t.join(";")}var HPe={PtgAdd:"+",PtgConcat:"&",PtgDiv:"/",PtgEq:"=",PtgGe:">=",PtgGt:">",PtgLe:"<=",PtgLt:"<",PtgMul:"*",PtgNe:"<>",PtgPower:"^",PtgSub:"-"};function VPe(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 RY(e,t,r){if(!e)return"SH33TJSERR0";if(r.biff>8&&(!e.XTI||!e.XTI[t]))return e.SheetNames[t];if(!e.XTI)return"SH33TJSERR6";var n=e.XTI[t];if(r.biff<8)return t>1e4&&(t-=65536),t<0&&(t=-t),t==0?"":e.XTI[t-1];if(!n)return"SH33TJSERR1";var a="";if(r.biff>8)switch(e[n[0]][0]){case 357:return a=n[1]==-1?"#REF":e.SheetNames[n[1]],n[1]==n[2]?a:a+":"+e.SheetNames[n[2]];case 358:return r.SID!=null?e.SheetNames[r.SID]:"SH33TJSSAME"+e[n[0]][0];case 355:default:return"SH33TJSSRC"+e[n[0]][0]}switch(e[n[0]][0][0]){case 1025:return a=n[1]==-1?"#REF":e.SheetNames[n[1]]||"SH33TJSERR3",n[1]==n[2]?a:a+":"+e.SheetNames[n[2]];case 14849:return e[n[0]].slice(1).map(function(s){return s.Name}).join(";;");default:return e[n[0]][0][3]?(a=n[1]==-1?"#REF":e[n[0]][0][3][n[1]]||"SH33TJSERR4",n[1]==n[2]?a:a+":"+e[n[0]][0][3][n[2]]):"SH33TJSERR2"}}function D7(e,t,r){var n=RY(e,t,r);return n=="#REF"?n:VPe(n,r)}function Us(e,t,r,n,a){var s=a&&a.biff||8,o={s:{c:0,r:0}},l=[],u,d,f,m=0,g=0,x,y="";if(!e[0]||!e[0][0])return"";for(var v=-1,w="",j=0,k=e[0].length;j<k;++j){var A=e[0][j];switch(A[0]){case"PtgUminus":l.push("-"+l.pop());break;case"PtgUplus":l.push("+"+l.pop());break;case"PtgPercent":l.push(l.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(u=l.pop(),d=l.pop(),v>=0){switch(e[0][v][1][0]){case 0:w=ei(" ",e[0][v][1][1]);break;case 1:w=ei("\r",e[0][v][1][1]);break;default:if(w="",a.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][v][1][0])}d=d+w,v=-1}l.push(d+HPe[A[0]]+u);break;case"PtgIsect":u=l.pop(),d=l.pop(),l.push(d+" "+u);break;case"PtgUnion":u=l.pop(),d=l.pop(),l.push(d+","+u);break;case"PtgRange":u=l.pop(),d=l.pop(),l.push(d+":"+u);break;case"PtgAttrChoose":break;case"PtgAttrGoto":break;case"PtgAttrIf":break;case"PtgAttrIfError":break;case"PtgRef":f=fv(A[1][1],o,a),l.push(hv(f,s));break;case"PtgRefN":f=r?fv(A[1][1],r,a):A[1][1],l.push(hv(f,s));break;case"PtgRef3d":m=A[1][1],f=fv(A[1][2],o,a),y=D7(n,m,a),l.push(y+"!"+hv(f,s));break;case"PtgFunc":case"PtgFuncVar":var T=A[1][0],M=A[1][1];T||(T=0),T&=127;var B=T==0?[]:l.slice(-T);l.length-=T,M==="User"&&(M=B.shift()),l.push(M+"("+B.join(",")+")");break;case"PtgBool":l.push(A[1]?"TRUE":"FALSE");break;case"PtgInt":l.push(A[1]);break;case"PtgNum":l.push(String(A[1]));break;case"PtgStr":l.push('"'+A[1].replace(/"/g,'""')+'"');break;case"PtgErr":l.push(A[1]);break;case"PtgAreaN":x=o7(A[1][1],r?{s:r}:o,a),l.push(t3(x,a));break;case"PtgArea":x=o7(A[1][1],o,a),l.push(t3(x,a));break;case"PtgArea3d":m=A[1][1],x=A[1][2],y=D7(n,m,a),l.push(y+"!"+t3(x,a));break;case"PtgAttrSum":l.push("SUM("+l.pop()+")");break;case"PtgAttrBaxcel":case"PtgAttrSemi":break;case"PtgName":g=A[1][2];var L=(n.names||[])[g-1]||(n[0]||[])[g],F=L?L.Name:"SH33TJSNAME"+String(g);F&&F.slice(0,6)=="_xlfn."&&!a.xlfn&&(F=F.slice(6)),l.push(F);break;case"PtgNameX":var I=A[1][1];g=A[1][2];var q;if(a.biff<=5)I<0&&(I=-I),n[I]&&(q=n[I][g]);else{var P="";if(((n[I]||[])[0]||[])[0]==14849||(((n[I]||[])[0]||[])[0]==1025?n[I][g]&&n[I][g].itab>0&&(P=n.SheetNames[n[I][g].itab-1]+"!"):P=n.SheetNames[g-1]+"!"),n[I]&&n[I][g])P+=n[I][g].Name;else if(n[0]&&n[0][g])P+=n[0][g].Name;else{var R=(RY(n,I,a)||"").split(";;");R[g-1]?P=R[g-1]:P+="SH33TJSERRX"}l.push(P);break}q||(q={Name:"SH33TJSERRY"}),l.push(q.Name);break;case"PtgParen":var K="(",ee=")";if(v>=0){switch(w="",e[0][v][1][0]){case 2:K=ei(" ",e[0][v][1][1])+K;break;case 3:K=ei("\r",e[0][v][1][1])+K;break;case 4:ee=ei(" ",e[0][v][1][1])+ee;break;case 5:ee=ei("\r",e[0][v][1][1])+ee;break;default:if(a.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][v][1][0])}v=-1}l.push(K+l.pop()+ee);break;case"PtgRefErr":l.push("#REF!");break;case"PtgRefErr3d":l.push("#REF!");break;case"PtgExp":f={c:A[1][1],r:A[1][0]};var se={c:r.c,r:r.r};if(n.sharedf[_r(f)]){var Z=n.sharedf[_r(f)];l.push(Us(Z,o,se,n,a))}else{var ne=!1;for(u=0;u!=n.arrayf.length;++u)if(d=n.arrayf[u],!(f.c<d[0].s.c||f.c>d[0].e.c)&&!(f.r<d[0].s.r||f.r>d[0].e.r)){l.push(Us(d[1],o,se,n,a)),ne=!0;break}ne||l.push(A[1])}break;case"PtgArray":l.push("{"+$Pe(A[1])+"}");break;case"PtgMemArea":break;case"PtgAttrSpace":case"PtgAttrSpaceSemi":v=j;break;case"PtgTbl":break;case"PtgMemErr":break;case"PtgMissArg":l.push("");break;case"PtgAreaErr":l.push("#REF!");break;case"PtgAreaErr3d":l.push("#REF!");break;case"PtgList":l.push("Table"+A[1].idx+"[#"+A[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(A));default:throw new Error("Unrecognized Formula Token: "+String(A))}var X=["PtgAttrSpace","PtgAttrSpaceSemi","PtgAttrGoto"];if(a.biff!=3&&v>=0&&X.indexOf(e[0][j][0])==-1){A=e[0][v];var le=!0;switch(A[1][0]){case 4:le=!1;case 0:w=ei(" ",A[1][1]);break;case 5:le=!1;case 1:w=ei("\r",A[1][1]);break;default:if(w="",a.WTF)throw new Error("Unexpected PtgAttrSpaceType "+A[1][0])}l.push((le?w:"")+l.pop()+(le?"":w)),v=-1}}if(l.length>1&&a.WTF)throw new Error("bad formula stack");return l[0]}function qPe(e,t,r){var n=e.l+t,a=r.biff==2?1:2,s,o=e.read_shift(a);if(o==65535)return[[],Ys(e,t-2)];var l=U1(e,o,r);return t!==o+a&&(s=z1(e,t-o-a,l,r)),e.l=n,[l,s]}function WPe(e,t,r){var n=e.l+t,a=r.biff==2?1:2,s,o=e.read_shift(a);if(o==65535)return[[],Ys(e,t-2)];var l=U1(e,o,r);return t!==o+a&&(s=z1(e,t-o-a,l,r)),e.l=n,[l,s]}function GPe(e,t,r,n){var a=e.l+t,s=U1(e,n,r),o;return a!==e.l&&(o=z1(e,a-e.l,s,r)),[s,o]}function YPe(e,t,r){var n=e.l+t,a,s=e.read_shift(2),o=U1(e,s,r);return s==65535?[[],Ys(e,t-2)]:(t!==s+2&&(a=z1(e,n-s-2,o,r)),[o,a])}function KPe(e){var t;if(Vd(e,e.l+6)!==65535)return[Vs(e),"n"];switch(e[e.l]){case 0:return e.l+=8,["String","s"];case 1:return t=e[e.l+2]===1,e.l+=8,[t,"b"];case 2:return t=e[e.l+2],e.l+=8,[t,"e"];case 3:return e.l+=8,["","s"]}return[]}function XPe(e){if(e==null){var t=St(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 d0(e);return d0(0)}function s3(e,t,r){var n=e.l+t,a=Ju(e);r.biff==2&&++e.l;var s=KPe(e),o=e.read_shift(1);r.biff!=2&&(e.read_shift(1),r.biff>=5&&e.read_shift(4));var l=WPe(e,n-e.l,r);return{cell:a,val:s[0],formula:l,shared:o>>3&1,tt:s[1]}}function ZPe(e,t,r,n,a){var s=h0(t,r,a),o=XPe(e.v),l=St(6),u=33;l.write_shift(2,u),l.write_shift(4,0);for(var d=St(e.bf.length),f=0;f<e.bf.length;++f)d[f]=e.bf[f];var m=os([s,o,l,d]);return m}function ej(e,t,r){var n=e.read_shift(4),a=U1(e,n,r),s=e.read_shift(4),o=s>0?z1(e,s,a,r):null;return[a,o]}var JPe=ej,tj=ej,QPe=ej,eDe=ej,tDe={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"},MY={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"},rDe={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 O7(e){return e.slice(0,3)=="of:"&&(e=e.slice(3)),e.charCodeAt(0)==61&&(e=e.slice(1),e.charCodeAt(0)==61&&(e=e.slice(1))),e=e.replace(/COM\.MICROSOFT\./g,""),e=e.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g,function(t,r){return r.replace(/\./g,"")}),e=e.replace(/\[.(#[A-Z]*[?!])\]/g,"$1"),e.replace(/[;~]/g,",").replace(/\|/g,";")}function nDe(e){var t="of:="+e.replace(FE,"$1[.$2$3$4$5]").replace(/\]:\[/g,":");return t.replace(/;/g,"|").replace(/,/g,";")}function o3(e){var t=e.split(":"),r=t[0].split(".")[0];return[r,t[0].split(".")[1]+(t.length>1?":"+(t[1].split(".")[1]||t[1].split(".")[0]):"")]}function aDe(e){return e.replace(/\./,"!")}var pv={},ex={},xv=typeof Map<"u";function UE(e,t,r){var n=0,a=e.length;if(r){if(xv?r.has(t):Object.prototype.hasOwnProperty.call(r,t)){for(var s=xv?r.get(t):r[t];n<s.length;++n)if(e[s[n]].t===t)return e.Count++,s[n]}}else for(;n<a;++n)if(e[n].t===t)return e.Count++,n;return e[a]={t},e.Count++,e.Unique++,r&&(xv?(r.has(t)||r.set(t,[]),r.get(t).push(a)):(Object.prototype.hasOwnProperty.call(r,t)||(r[t]=[]),r[t].push(a))),a}function rj(e,t){var r={min:e+1,max:e+1},n=-1;return t.MDW&&(Hs=t.MDW),t.width!=null?r.customWidth=1:t.wpx!=null?n=t1(t.wpx):t.wch!=null&&(n=t.wch),n>-1?(r.width=Bw(n),r.customWidth=1):t.width!=null&&(r.width=t.width),t.hidden&&(r.hidden=!0),t.level!=null&&(r.outlineLevel=r.level=t.level),r}function Gm(e,t){if(e){var r=[.7,.7,.75,.75,.3,.3];t=="xlml"&&(r=[1,1,1,1,.5,.5]),e.left==null&&(e.left=r[0]),e.right==null&&(e.right=r[1]),e.top==null&&(e.top=r[2]),e.bottom==null&&(e.bottom=r[3]),e.header==null&&(e.header=r[4]),e.footer==null&&(e.footer=r[5])}}function Hh(e,t,r){var n=r.revssf[t.z!=null?t.z:"General"],a=60,s=e.length;if(n==null&&r.ssf){for(;a<392;++a)if(r.ssf[a]==null){Kd(t.z,a),r.ssf[a]=t.z,r.revssf[t.z]=n=a;break}}for(a=0;a!=s;++a)if(e[a].numFmtId===n)return a;return e[s]={numFmtId:n,fontId:0,fillId:0,borderId:0,xfId:0,applyNumberFormat:1},s}function LY(e,t,r,n,a,s){try{n.cellNF&&(e.z=Cr[t])}catch(l){if(n.WTF)throw l}if(!(e.t==="z"&&!n.cellStyles)){if(e.t==="d"&&typeof e.v=="string"&&(e.v=ja(e.v)),(!n||n.cellText!==!1)&&e.t!=="z")try{if(Cr[t]==null&&Kd(tke[t]||"General",t),e.t==="e")e.w=e.w||pf[e.v];else if(t===0)if(e.t==="n")(e.v|0)===e.v?e.w=e.v.toString(10):e.w=Yv(e.v);else if(e.t==="d"){var o=Hi(e.v);(o|0)===o?e.w=o.toString(10):e.w=Yv(o)}else{if(e.v===void 0)return"";e.w=c0(e.v,ex)}else e.t==="d"?e.w=Xl(t,Hi(e.v),ex):e.w=Xl(t,e.v,ex)}catch(l){if(n.WTF)throw l}if(n.cellStyles&&r!=null)try{e.s=s.Fills[r],e.s.fgColor&&e.s.fgColor.theme&&!e.s.fgColor.rgb&&(e.s.fgColor.rgb=Fw(a.themeElements.clrScheme[e.s.fgColor.theme].rgb,e.s.fgColor.tint||0),n.WTF&&(e.s.fgColor.raw_rgb=a.themeElements.clrScheme[e.s.fgColor.theme].rgb)),e.s.bgColor&&e.s.bgColor.theme&&(e.s.bgColor.rgb=Fw(a.themeElements.clrScheme[e.s.bgColor.theme].rgb,e.s.bgColor.tint||0),n.WTF&&(e.s.bgColor.raw_rgb=a.themeElements.clrScheme[e.s.bgColor.theme].rgb))}catch(l){if(n.WTF&&s.Fills)throw l}}}function iDe(e,t,r){if(e&&e["!ref"]){var n=yn(e["!ref"]);if(n.e.c<n.s.c||n.e.r<n.s.r)throw new Error("Bad range ("+r+"): "+e["!ref"])}}function sDe(e,t){var r=yn(t);r.s.r<=r.e.r&&r.s.c<=r.e.c&&r.s.r>=0&&r.s.c>=0&&(e["!ref"]=zr(r))}var oDe=/<(?:\w:)?mergeCell ref="[A-Z0-9:]+"\s*[\/]?>/g,lDe=/<(?:\w+:)?sheetData[^>]*>([\s\S]*)<\/(?:\w+:)?sheetData>/,cDe=/<(?:\w:)?hyperlink [^>]*>/mg,uDe=/"(\w*:\w*)"/,dDe=/<(?:\w:)?col\b[^>]*[\/]?>/g,fDe=/<(?:\w:)?autoFilter[^>]*([\/]|>([\s\S]*)<\/(?:\w:)?autoFilter)>/g,hDe=/<(?:\w:)?pageMargins[^>]*\/>/g,IY=/<(?:\w:)?sheetPr\b(?:[^>a-z][^>]*)?\/>/,mDe=/<(?:\w:)?sheetPr[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetPr)>/,pDe=/<(?:\w:)?sheetViews[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetViews)>/;function xDe(e,t,r,n,a,s,o){if(!e)return e;n||(n={"!id":{}});var l=t.dense?[]:{},u={s:{r:2e6,c:2e6},e:{r:0,c:0}},d="",f="",m=e.match(lDe);m?(d=e.slice(0,m.index),f=e.slice(m.index+m[0].length)):d=f=e;var g=d.match(IY);g?$E(g[0],l,a,r):(g=d.match(mDe))&&vDe(g[0],g[1]||"",l,a,r);var x=(d.match(/<(?:\w*:)?dimension/)||{index:-1}).index;if(x>0){var y=d.slice(x,x+50).match(uDe);y&&sDe(l,y[1])}var v=d.match(pDe);v&&v[1]&&PDe(v[1],a);var w=[];if(t.cellStyles){var j=d.match(dDe);j&&kDe(w,j)}m&&RDe(m[1],l,t,u,s,o);var k=f.match(fDe);k&&(l["!autofilter"]=_De(k[0]));var A=[],T=f.match(oDe);if(T)for(x=0;x!=T.length;++x)A[x]=yn(T[x].slice(T[x].indexOf('"')+1));var M=f.match(cDe);M&&NDe(l,M,n);var B=f.match(hDe);if(B&&(l["!margins"]=SDe(Tr(B[0]))),!l["!ref"]&&u.e.c>=u.s.c&&u.e.r>=u.s.r&&(l["!ref"]=zr(u)),t.sheetRows>0&&l["!ref"]){var L=yn(l["!ref"]);t.sheetRows<=+L.e.r&&(L.e.r=t.sheetRows-1,L.e.r>u.e.r&&(L.e.r=u.e.r),L.e.r<L.s.r&&(L.s.r=L.e.r),L.e.c>u.e.c&&(L.e.c=u.e.c),L.e.c<L.s.c&&(L.s.c=L.e.c),l["!fullref"]=l["!ref"],l["!ref"]=zr(L))}return w.length>0&&(l["!cols"]=w),A.length>0&&(l["!merges"]=A),l}function gDe(e){if(e.length===0)return"";for(var t='<mergeCells count="'+e.length+'">',r=0;r!=e.length;++r)t+='<mergeCell ref="'+zr(e[r])+'"/>';return t+"</mergeCells>"}function $E(e,t,r,n){var a=Tr(e);r.Sheets[n]||(r.Sheets[n]={}),a.codeName&&(r.Sheets[n].CodeName=vn(Xn(a.codeName)))}function vDe(e,t,r,n,a){$E(e.slice(0,e.indexOf(">")),r,n,a)}function yDe(e,t,r,n,a){var s=!1,o={},l=null;if(n.bookType!=="xlsx"&&t.vbaraw){var u=t.SheetNames[r];try{t.Workbook&&(u=t.Workbook.Sheets[r].CodeName||u)}catch{}s=!0,o.codeName=Mu(Vn(u))}if(e&&e["!outline"]){var d={summaryBelow:1,summaryRight:1};e["!outline"].above&&(d.summaryBelow=0),e["!outline"].left&&(d.summaryRight=0),l=(l||"")+Wt("outlinePr",null,d)}!s&&!l||(a[a.length]=Wt("sheetPr",l,o))}var bDe=["objects","scenarios","selectLockedCells","selectUnlockedCells"],wDe=["formatColumns","formatRows","formatCells","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"];function jDe(e){var t={sheet:1};return bDe.forEach(function(r){e[r]!=null&&e[r]&&(t[r]="1")}),wDe.forEach(function(r){e[r]!=null&&!e[r]&&(t[r]="0")}),e.password&&(t.password=ME(e.password).toString(16).toUpperCase()),Wt("sheetProtection",null,t)}function NDe(e,t,r){for(var n=Array.isArray(e),a=0;a!=t.length;++a){var s=Tr(Xn(t[a]),!0);if(!s.ref)return;var o=((r||{})["!id"]||[])[s.id];o?(s.Target=o.Target,s.location&&(s.Target+="#"+vn(s.location))):(s.Target="#"+vn(s.location),o={Target:s.Target,TargetMode:"Internal"}),s.Rel=o,s.tooltip&&(s.Tooltip=s.tooltip,delete s.tooltip);for(var l=yn(s.ref),u=l.s.r;u<=l.e.r;++u)for(var d=l.s.c;d<=l.e.c;++d){var f=_r({c:d,r:u});n?(e[u]||(e[u]=[]),e[u][d]||(e[u][d]={t:"z",v:void 0}),e[u][d].l=s):(e[f]||(e[f]={t:"z",v:void 0}),e[f].l=s)}}}function SDe(e){var t={};return["left","right","top","bottom","header","footer"].forEach(function(r){e[r]&&(t[r]=parseFloat(e[r]))}),t}function ADe(e){return Gm(e),Wt("pageMargins",null,e)}function kDe(e,t){for(var r=!1,n=0;n!=t.length;++n){var a=Tr(t[n],!0);a.hidden&&(a.hidden=ya(a.hidden));var s=parseInt(a.min,10)-1,o=parseInt(a.max,10)-1;for(a.outlineLevel&&(a.level=+a.outlineLevel||0),delete a.min,delete a.max,a.width=+a.width,!r&&a.width&&(r=!0,LE(a.width)),Eh(a);s<=o;)e[s++]=Na(a)}}function CDe(e,t){for(var r=["<cols>"],n,a=0;a!=t.length;++a)(n=t[a])&&(r[r.length]=Wt("col",null,rj(a,n)));return r[r.length]="</cols>",r.join("")}function _De(e){var t={ref:(e.match(/ref="([^"]*)"/)||[])[1]};return t}function EDe(e,t,r,n){var a=typeof e.ref=="string"?e.ref:zr(e.ref);r.Workbook||(r.Workbook={Sheets:[]}),r.Workbook.Names||(r.Workbook.Names=[]);var s=r.Workbook.Names,o=$o(a);o.s.r==o.e.r&&(o.e.r=$o(t["!ref"]).e.r,a=zr(o));for(var l=0;l<s.length;++l){var u=s[l];if(u.Name=="_xlnm._FilterDatabase"&&u.Sheet==n){u.Ref="'"+r.SheetNames[n]+"'!"+a;break}}return l==s.length&&s.push({Name:"_xlnm._FilterDatabase",Sheet:n,Ref:"'"+r.SheetNames[n]+"'!"+a}),Wt("autoFilter",null,{ref:a})}var TDe=/<(?:\w:)?sheetView(?:[^>a-z][^>]*)?\/?>/;function PDe(e,t){t.Views||(t.Views=[{}]),(e.match(TDe)||[]).forEach(function(r,n){var a=Tr(r);t.Views[n]||(t.Views[n]={}),+a.zoomScale&&(t.Views[n].zoom=+a.zoomScale),ya(a.rightToLeft)&&(t.Views[n].RTL=!0)})}function DDe(e,t,r,n){var a={workbookViewId:"0"};return(((n||{}).Workbook||{}).Views||[])[0]&&(a.rightToLeft=n.Workbook.Views[0].RTL?"1":"0"),Wt("sheetViews",Wt("sheetView",null,a),{})}function ODe(e,t,r,n){if(e.c&&r["!comments"].push([t,e.c]),e.v===void 0&&typeof e.f!="string"||e.t==="z"&&!e.f)return"";var a="",s=e.t,o=e.v;if(e.t!=="z")switch(e.t){case"b":a=e.v?"1":"0";break;case"n":a=""+e.v;break;case"e":a=pf[e.v];break;case"d":n&&n.cellDates?a=ja(e.v,-1).toISOString():(e=Na(e),e.t="n",a=""+(e.v=Hi(ja(e.v)))),typeof e.z>"u"&&(e.z=Cr[14]);break;default:a=e.v;break}var l=Es("v",Vn(a)),u={r:t},d=Hh(n.cellXfs,e,n);switch(d!==0&&(u.s=d),e.t){case"n":break;case"d":u.t="d";break;case"b":u.t="b";break;case"e":u.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(n&&n.bookSST){l=Es("v",""+UE(n.Strings,e.v,n.revStrings)),u.t="s";break}u.t="str";break}if(e.t!=s&&(e.t=s,e.v=o),typeof e.f=="string"&&e.f){var f=e.F&&e.F.slice(0,t.length)==t?{t:"array",ref:e.F}:null;l=Wt("f",Vn(e.f),f)+(e.v!=null?l:"")}return e.l&&r["!links"].push([t,e.l]),e.D&&(u.cm=1),Wt("c",l,u)}var RDe=(function(){var e=/<(?:\w+:)?c[ \/>]/,t=/<\/(?:\w+:)?row>/,r=/r=["']([^"']*)["']/,n=/<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/,a=/ref=["']([^"']*)["']/,s=Kv("v"),o=Kv("f");return function(u,d,f,m,g,x){for(var y=0,v="",w=[],j=[],k=0,A=0,T=0,M="",B,L,F=0,I=0,q,P,R=0,K=0,ee=Array.isArray(x.CellXf),se,Z=[],ne=[],X=Array.isArray(d),le=[],Ae={},ce=!1,D=!!f.sheetStubs,H=u.split(t),G=0,E=H.length;G!=E;++G){v=H[G].trim();var re=v.length;if(re!==0){var he=0;e:for(y=0;y<re;++y)switch(v[y]){case">":if(v[y-1]!="/"){++y;break e}if(f&&f.cellStyles){if(L=Tr(v.slice(he,y),!0),F=L.r!=null?parseInt(L.r,10):F+1,I=-1,f.sheetRows&&f.sheetRows<F)continue;Ae={},ce=!1,L.ht&&(ce=!0,Ae.hpt=parseFloat(L.ht),Ae.hpx=gx(Ae.hpt)),L.hidden=="1"&&(ce=!0,Ae.hidden=!0),L.outlineLevel!=null&&(ce=!0,Ae.level=+L.outlineLevel),ce&&(le[F-1]=Ae)}break;case"<":he=y;break}if(he>=y)break;if(L=Tr(v.slice(he,y),!0),F=L.r!=null?parseInt(L.r,10):F+1,I=-1,!(f.sheetRows&&f.sheetRows<F)){m.s.r>F-1&&(m.s.r=F-1),m.e.r<F-1&&(m.e.r=F-1),f&&f.cellStyles&&(Ae={},ce=!1,L.ht&&(ce=!0,Ae.hpt=parseFloat(L.ht),Ae.hpx=gx(Ae.hpt)),L.hidden=="1"&&(ce=!0,Ae.hidden=!0),L.outlineLevel!=null&&(ce=!0,Ae.level=+L.outlineLevel),ce&&(le[F-1]=Ae)),w=v.slice(y).split(e);for(var oe=0;oe!=w.length&&w[oe].trim().charAt(0)=="<";++oe);for(w=w.slice(oe),y=0;y!=w.length;++y)if(v=w[y].trim(),v.length!==0){if(j=v.match(r),k=y,A=0,T=0,v="<c "+(v.slice(0,1)=="<"?">":"")+v,j!=null&&j.length===2){for(k=0,M=j[1],A=0;A!=M.length&&!((T=M.charCodeAt(A)-64)<1||T>26);++A)k=26*k+T;--k,I=k}else++I;for(A=0;A!=v.length&&v.charCodeAt(A)!==62;++A);if(++A,L=Tr(v.slice(0,A),!0),L.r||(L.r=_r({r:F-1,c:I})),M=v.slice(A),B={t:""},(j=M.match(s))!=null&&j[1]!==""&&(B.v=vn(j[1])),f.cellFormula){if((j=M.match(o))!=null&&j[1]!==""){if(B.f=vn(Xn(j[1])).replace(/\r\n/g,`
`),f.xlfn||(B.f=E7(B.f)),j[0].indexOf('t="array"')>-1)B.F=(M.match(a)||[])[1],B.F.indexOf(":")>-1&&Z.push([yn(B.F),B.F]);else if(j[0].indexOf('t="shared"')>-1){P=Tr(j[0]);var z=vn(Xn(j[1]));f.xlfn||(z=E7(z)),ne[parseInt(P.si,10)]=[P,z,L.r]}}else(j=M.match(/<f[^>]*\/>/))&&(P=Tr(j[0]),ne[P.si]&&(B.f=T6e(ne[P.si][1],ne[P.si][2],L.r)));var fe=Fa(L.r);for(A=0;A<Z.length;++A)fe.r>=Z[A][0].s.r&&fe.r<=Z[A][0].e.r&&fe.c>=Z[A][0].s.c&&fe.c<=Z[A][0].e.c&&(B.F=Z[A][1])}if(L.t==null&&B.v===void 0)if(B.f||B.F)B.v=0,B.t="n";else if(D)B.t="z";else continue;else B.t=L.t||"n";switch(m.s.c>I&&(m.s.c=I),m.e.c<I&&(m.e.c=I),B.t){case"n":if(B.v==""||B.v==null){if(!D)continue;B.t="z"}else B.v=parseFloat(B.v);break;case"s":if(typeof B.v>"u"){if(!D)continue;B.t="z"}else q=pv[parseInt(B.v,10)],B.v=q.t,B.r=q.r,f.cellHTML&&(B.h=q.h);break;case"str":B.t="s",B.v=B.v!=null?Xn(B.v):"",f.cellHTML&&(B.h=bE(B.v));break;case"inlineStr":j=M.match(n),B.t="s",j!=null&&(q=RE(j[1]))?(B.v=q.t,f.cellHTML&&(B.h=q.h)):B.v="";break;case"b":B.v=ya(B.v);break;case"d":f.cellDates?B.v=ja(B.v,1):(B.v=Hi(ja(B.v,1)),B.t="n");break;case"e":(!f||f.cellText!==!1)&&(B.w=B.v),B.v=BG[B.v];break}if(R=K=0,se=null,ee&&L.s!==void 0&&(se=x.CellXf[L.s],se!=null&&(se.numFmtId!=null&&(R=se.numFmtId),f.cellStyles&&se.fillId!=null&&(K=se.fillId))),LY(B,R,K,f,g,x),f.cellDates&&ee&&B.t=="n"&&Ix(Cr[R])&&(B.t="d",B.v=J5(B.v)),L.cm&&f.xlmeta){var de=(f.xlmeta.Cell||[])[+L.cm-1];de&&de.type=="XLDAPR"&&(B.D=!0)}if(X){var W=Fa(L.r);d[W.r]||(d[W.r]=[]),d[W.r][W.c]=B}else d[L.r]=B}}}}le.length>0&&(d["!rows"]=le)}})();function MDe(e,t,r,n){var a=[],s=[],o=yn(e["!ref"]),l="",u,d="",f=[],m=0,g=0,x=e["!rows"],y=Array.isArray(e),v={r:d},w,j=-1;for(g=o.s.c;g<=o.e.c;++g)f[g]=Ia(g);for(m=o.s.r;m<=o.e.r;++m){for(s=[],d=hi(m),g=o.s.c;g<=o.e.c;++g){u=f[g]+d;var k=y?(e[m]||[])[g]:e[u];k!==void 0&&(l=ODe(k,u,e,t))!=null&&s.push(l)}(s.length>0||x&&x[m])&&(v={r:d},x&&x[m]&&(w=x[m],w.hidden&&(v.hidden=1),j=-1,w.hpx?j=r1(w.hpx):w.hpt&&(j=w.hpt),j>-1&&(v.ht=j,v.customHeight=1),w.level&&(v.outlineLevel=w.level)),a[a.length]=Wt("row",s.join(""),v))}if(x)for(;m<x.length;++m)x&&x[m]&&(v={r:m+1},w=x[m],w.hidden&&(v.hidden=1),j=-1,w.hpx?j=r1(w.hpx):w.hpt&&(j=w.hpt),j>-1&&(v.ht=j,v.customHeight=1),w.level&&(v.outlineLevel=w.level),a[a.length]=Wt("row","",v));return a.join("")}function FY(e,t,r,n){var a=[pi,Wt("worksheet",null,{xmlns:j0[0],"xmlns:r":$i.r})],s=r.SheetNames[e],o=0,l="",u=r.Sheets[s];u==null&&(u={});var d=u["!ref"]||"A1",f=yn(d);if(f.e.c>16383||f.e.r>1048575){if(t.WTF)throw new Error("Range "+d+" exceeds format limit A1:XFD1048576");f.e.c=Math.min(f.e.c,16383),f.e.r=Math.min(f.e.c,1048575),d=zr(f)}n||(n={}),u["!comments"]=[];var m=[];yDe(u,r,e,t,a),a[a.length]=Wt("dimension",null,{ref:d}),a[a.length]=DDe(u,t,e,r),t.sheetFormat&&(a[a.length]=Wt("sheetFormatPr",null,{defaultRowHeight:t.sheetFormat.defaultRowHeight||"16",baseColWidth:t.sheetFormat.baseColWidth||"10",outlineLevelRow:t.sheetFormat.outlineLevelRow||"7"})),u["!cols"]!=null&&u["!cols"].length>0&&(a[a.length]=CDe(u,u["!cols"])),a[o=a.length]="<sheetData/>",u["!links"]=[],u["!ref"]!=null&&(l=MDe(u,t),l.length>0&&(a[a.length]=l)),a.length>o+1&&(a[a.length]="</sheetData>",a[o]=a[o].replace("/>",">")),u["!protect"]&&(a[a.length]=jDe(u["!protect"])),u["!autofilter"]!=null&&(a[a.length]=EDe(u["!autofilter"],u,r,e)),u["!merges"]!=null&&u["!merges"].length>0&&(a[a.length]=gDe(u["!merges"]));var g=-1,x,y=-1;return u["!links"].length>0&&(a[a.length]="<hyperlinks>",u["!links"].forEach(function(v){v[1].Target&&(x={ref:v[0]},v[1].Target.charAt(0)!="#"&&(y=zn(n,-1,Vn(v[1].Target).replace(/#.*$/,""),Qr.HLINK),x["r:id"]="rId"+y),(g=v[1].Target.indexOf("#"))>-1&&(x.location=Vn(v[1].Target.slice(g+1))),v[1].Tooltip&&(x.tooltip=Vn(v[1].Tooltip)),a[a.length]=Wt("hyperlink",null,x))}),a[a.length]="</hyperlinks>"),delete u["!links"],u["!margins"]!=null&&(a[a.length]=ADe(u["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&(a[a.length]=Es("ignoredErrors",Wt("ignoredError",null,{numberStoredAsText:1,sqref:d}))),m.length>0&&(y=zn(n,-1,"../drawings/drawing"+(e+1)+".xml",Qr.DRAW),a[a.length]=Wt("drawing",null,{"r:id":"rId"+y}),u["!drawing"]=m),u["!comments"].length>0&&(y=zn(n,-1,"../drawings/vmlDrawing"+(e+1)+".vml",Qr.VML),a[a.length]=Wt("legacyDrawing",null,{"r:id":"rId"+y}),u["!legacy"]=y),a.length>1&&(a[a.length]="</worksheet>",a[1]=a[1].replace("/>",">")),a.join("")}function LDe(e,t){var r={},n=e.l+t;r.r=e.read_shift(4),e.l+=4;var a=e.read_shift(2);e.l+=1;var s=e.read_shift(1);return e.l=n,s&7&&(r.level=s&7),s&16&&(r.hidden=!0),s&32&&(r.hpt=a/20),r}function IDe(e,t,r){var n=St(145),a=(r["!rows"]||[])[e]||{};n.write_shift(4,e),n.write_shift(4,0);var s=320;a.hpx?s=r1(a.hpx)*20:a.hpt&&(s=a.hpt*20),n.write_shift(2,s),n.write_shift(1,0);var o=0;a.level&&(o|=a.level),a.hidden&&(o|=16),(a.hpx||a.hpt)&&(o|=32),n.write_shift(1,o),n.write_shift(1,0);var l=0,u=n.l;n.l+=4;for(var d={r:e,c:0},f=0;f<16;++f)if(!(t.s.c>f+1<<10||t.e.c<f<<10)){for(var m=-1,g=-1,x=f<<10;x<f+1<<10;++x){d.c=x;var y=Array.isArray(r)?(r[d.r]||[])[d.c]:r[_r(d)];y&&(m<0&&(m=x),g=x)}m<0||(++l,n.write_shift(4,m),n.write_shift(4,g))}var v=n.l;return n.l=u,n.write_shift(4,l),n.l=v,n.length>n.l?n.slice(0,n.l):n}function FDe(e,t,r,n){var a=IDe(n,r,t);(a.length>17||(t["!rows"]||[])[n])&&Ot(e,0,a)}var BDe=k0,zDe=zx;function UDe(){}function $De(e,t){var r={},n=e[e.l];return++e.l,r.above=!(n&64),r.left=!(n&128),e.l+=18,r.name=qke(e),r}function HDe(e,t,r){r==null&&(r=St(84+4*e.length));var n=192;t&&(t.above&&(n&=-65),t.left&&(n&=-129)),r.write_shift(1,n);for(var a=1;a<3;++a)r.write_shift(1,0);return Mw({auto:1},r),r.write_shift(-4,-1),r.write_shift(-4,-1),RG(e,r),r.slice(0,r.l)}function VDe(e){var t=Jl(e);return[t]}function qDe(e,t,r){return r==null&&(r=St(8)),N0(t,r)}function WDe(e){var t=S0(e);return[t]}function GDe(e,t,r){return r==null&&(r=St(4)),A0(t,r)}function YDe(e){var t=Jl(e),r=e.read_shift(1);return[t,r,"b"]}function KDe(e,t,r){return r==null&&(r=St(9)),N0(t,r),r.write_shift(1,e.v?1:0),r}function XDe(e){var t=S0(e),r=e.read_shift(1);return[t,r,"b"]}function ZDe(e,t,r){return r==null&&(r=St(5)),A0(t,r),r.write_shift(1,e.v?1:0),r}function JDe(e){var t=Jl(e),r=e.read_shift(1);return[t,r,"e"]}function QDe(e,t,r){return r==null&&(r=St(9)),N0(t,r),r.write_shift(1,e.v),r}function e8e(e){var t=S0(e),r=e.read_shift(1);return[t,r,"e"]}function t8e(e,t,r){return r==null&&(r=St(8)),A0(t,r),r.write_shift(1,e.v),r.write_shift(2,0),r.write_shift(1,0),r}function r8e(e){var t=Jl(e),r=e.read_shift(4);return[t,r,"s"]}function n8e(e,t,r){return r==null&&(r=St(12)),N0(t,r),r.write_shift(4,t.v),r}function a8e(e){var t=S0(e),r=e.read_shift(4);return[t,r,"s"]}function i8e(e,t,r){return r==null&&(r=St(8)),A0(t,r),r.write_shift(4,t.v),r}function s8e(e){var t=Jl(e),r=Vs(e);return[t,r,"n"]}function o8e(e,t,r){return r==null&&(r=St(16)),N0(t,r),d0(e.v,r),r}function BY(e){var t=S0(e),r=Vs(e);return[t,r,"n"]}function l8e(e,t,r){return r==null&&(r=St(12)),A0(t,r),d0(e.v,r),r}function c8e(e){var t=Jl(e),r=EE(e);return[t,r,"n"]}function u8e(e,t,r){return r==null&&(r=St(12)),N0(t,r),MG(e.v,r),r}function d8e(e){var t=S0(e),r=EE(e);return[t,r,"n"]}function f8e(e,t,r){return r==null&&(r=St(8)),A0(t,r),MG(e.v,r),r}function h8e(e){var t=Jl(e),r=kE(e);return[t,r,"is"]}function m8e(e){var t=Jl(e),r=Ws(e);return[t,r,"str"]}function p8e(e,t,r){return r==null&&(r=St(12+4*e.v.length)),N0(t,r),us(e.v,r),r.length>r.l?r.slice(0,r.l):r}function x8e(e){var t=S0(e),r=Ws(e);return[t,r,"str"]}function g8e(e,t,r){return r==null&&(r=St(8+4*e.v.length)),A0(t,r),us(e.v,r),r.length>r.l?r.slice(0,r.l):r}function v8e(e,t,r){var n=e.l+t,a=Jl(e);a.r=r["!row"];var s=e.read_shift(1),o=[a,s,"b"];if(r.cellFormula){e.l+=2;var l=tj(e,n-e.l,r);o[3]=Us(l,null,a,r.supbooks,r)}else e.l=n;return o}function y8e(e,t,r){var n=e.l+t,a=Jl(e);a.r=r["!row"];var s=e.read_shift(1),o=[a,s,"e"];if(r.cellFormula){e.l+=2;var l=tj(e,n-e.l,r);o[3]=Us(l,null,a,r.supbooks,r)}else e.l=n;return o}function b8e(e,t,r){var n=e.l+t,a=Jl(e);a.r=r["!row"];var s=Vs(e),o=[a,s,"n"];if(r.cellFormula){e.l+=2;var l=tj(e,n-e.l,r);o[3]=Us(l,null,a,r.supbooks,r)}else e.l=n;return o}function w8e(e,t,r){var n=e.l+t,a=Jl(e);a.r=r["!row"];var s=Ws(e),o=[a,s,"str"];if(r.cellFormula){e.l+=2;var l=tj(e,n-e.l,r);o[3]=Us(l,null,a,r.supbooks,r)}else e.l=n;return o}var j8e=k0,N8e=zx;function S8e(e,t){return t==null&&(t=St(4)),t.write_shift(4,e),t}function A8e(e,t){var r=e.l+t,n=k0(e),a=CE(e),s=Ws(e),o=Ws(e),l=Ws(e);e.l=r;var u={rfx:n,relId:a,loc:s,display:l};return o&&(u.Tooltip=o),u}function k8e(e,t){var r=St(50+4*(e[1].Target.length+(e[1].Tooltip||"").length));zx({s:Fa(e[0]),e:Fa(e[0])},r),_E("rId"+t,r);var n=e[1].Target.indexOf("#"),a=n==-1?"":e[1].Target.slice(n+1);return us(a||"",r),us(e[1].Tooltip||"",r),us("",r),r.slice(0,r.l)}function C8e(){}function _8e(e,t,r){var n=e.l+t,a=LG(e),s=e.read_shift(1),o=[a];if(o[2]=s,r.cellFormula){var l=JPe(e,n-e.l,r);o[1]=l}else e.l=n;return o}function E8e(e,t,r){var n=e.l+t,a=k0(e),s=[a];if(r.cellFormula){var o=eDe(e,n-e.l,r);s[1]=o,e.l=n}else e.l=n;return s}function T8e(e,t,r){r==null&&(r=St(18));var n=rj(e,t);r.write_shift(-4,e),r.write_shift(-4,e),r.write_shift(4,(n.width||10)*256),r.write_shift(4,0);var a=0;return t.hidden&&(a|=1),typeof n.width=="number"&&(a|=2),t.level&&(a|=t.level<<8),r.write_shift(2,a),r}var zY=["left","right","top","bottom","header","footer"];function P8e(e){var t={};return zY.forEach(function(r){t[r]=Vs(e)}),t}function D8e(e,t){return t==null&&(t=St(48)),Gm(e),zY.forEach(function(r){d0(e[r],t)}),t}function O8e(e){var t=e.read_shift(2);return e.l+=28,{RTL:t&32}}function R8e(e,t,r){r==null&&(r=St(30));var n=924;return(((t||{}).Views||[])[0]||{}).RTL&&(n|=32),r.write_shift(2,n),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(1,0),r.write_shift(1,0),r.write_shift(2,0),r.write_shift(2,100),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(4,0),r}function M8e(e){var t=St(24);return t.write_shift(4,4),t.write_shift(4,1),zx(e,t),t}function L8e(e,t){return t==null&&(t=St(66)),t.write_shift(2,e.password?ME(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(r){r[1]?t.write_shift(4,e[r[0]]!=null&&!e[r[0]]?1:0):t.write_shift(4,e[r[0]]!=null&&e[r[0]]?0:1)}),t}function I8e(){}function F8e(){}function B8e(e,t,r,n,a,s,o){if(!e)return e;var l=t||{};n||(n={"!id":{}});var u=l.dense?[]:{},d,f={s:{r:2e6,c:2e6},e:{r:0,c:0}},m=!1,g=!1,x,y,v,w,j,k,A,T,M,B=[];l.biff=12,l["!row"]=0;var L=0,F=!1,I=[],q={},P=l.supbooks||a.supbooks||[[]];if(P.sharedf=q,P.arrayf=I,P.SheetNames=a.SheetNames||a.Sheets.map(function(X){return X.name}),!l.supbooks&&(l.supbooks=P,a.Names))for(var R=0;R<a.Names.length;++R)P[0][R+1]=a.Names[R];var K=[],ee=[],se=!1;n1[16]={n:"BrtShortReal",f:BY};var Z;if(mf(e,function(le,Ae,ce){if(!g)switch(ce){case 148:d=le;break;case 0:x=le,l.sheetRows&&l.sheetRows<=x.r&&(g=!0),T=hi(w=x.r),l["!row"]=x.r,(le.hidden||le.hpt||le.level!=null)&&(le.hpt&&(le.hpx=gx(le.hpt)),ee[le.r]=le);break;case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 13:case 14:case 15:case 16:case 17:case 18:case 62:switch(y={t:le[2]},le[2]){case"n":y.v=le[1];break;case"s":A=pv[le[1]],y.v=A.t,y.r=A.r;break;case"b":y.v=!!le[1];break;case"e":y.v=le[1],l.cellText!==!1&&(y.w=pf[y.v]);break;case"str":y.t="s",y.v=le[1];break;case"is":y.t="s",y.v=le[1].t;break}if((v=o.CellXf[le[0].iStyleRef])&&LY(y,v.numFmtId,null,l,s,o),j=le[0].c==-1?j+1:le[0].c,l.dense?(u[w]||(u[w]=[]),u[w][j]=y):u[Ia(j)+T]=y,l.cellFormula){for(F=!1,L=0;L<I.length;++L){var D=I[L];x.r>=D[0].s.r&&x.r<=D[0].e.r&&j>=D[0].s.c&&j<=D[0].e.c&&(y.F=zr(D[0]),F=!0)}!F&&le.length>3&&(y.f=le[3])}if(f.s.r>x.r&&(f.s.r=x.r),f.s.c>j&&(f.s.c=j),f.e.r<x.r&&(f.e.r=x.r),f.e.c<j&&(f.e.c=j),l.cellDates&&v&&y.t=="n"&&Ix(Cr[v.numFmtId])){var H=Lm(y.v);H&&(y.t="d",y.v=new Date(H.y,H.m-1,H.d,H.H,H.M,H.S,H.u))}Z&&(Z.type=="XLDAPR"&&(y.D=!0),Z=void 0);break;case 1:case 12:if(!l.sheetStubs||m)break;y={t:"z",v:void 0},j=le[0].c==-1?j+1:le[0].c,l.dense?(u[w]||(u[w]=[]),u[w][j]=y):u[Ia(j)+T]=y,f.s.r>x.r&&(f.s.r=x.r),f.s.c>j&&(f.s.c=j),f.e.r<x.r&&(f.e.r=x.r),f.e.c<j&&(f.e.c=j),Z&&(Z.type=="XLDAPR"&&(y.D=!0),Z=void 0);break;case 176:B.push(le);break;case 49:Z=((l.xlmeta||{}).Cell||[])[le-1];break;case 494:var G=n["!id"][le.relId];for(G?(le.Target=G.Target,le.loc&&(le.Target+="#"+le.loc),le.Rel=G):le.relId==""&&(le.Target="#"+le.loc),w=le.rfx.s.r;w<=le.rfx.e.r;++w)for(j=le.rfx.s.c;j<=le.rfx.e.c;++j)l.dense?(u[w]||(u[w]=[]),u[w][j]||(u[w][j]={t:"z",v:void 0}),u[w][j].l=le):(k=_r({c:j,r:w}),u[k]||(u[k]={t:"z",v:void 0}),u[k].l=le);break;case 426:if(!l.cellFormula)break;I.push(le),M=l.dense?u[w][j]:u[Ia(j)+T],M.f=Us(le[1],f,{r:x.r,c:j},P,l),M.F=zr(le[0]);break;case 427:if(!l.cellFormula)break;q[_r(le[0].s)]=le[1],M=l.dense?u[w][j]:u[Ia(j)+T],M.f=Us(le[1],f,{r:x.r,c:j},P,l);break;case 60:if(!l.cellStyles)break;for(;le.e>=le.s;)K[le.e--]={width:le.w/256,hidden:!!(le.flags&1),level:le.level},se||(se=!0,LE(le.w/256)),Eh(K[le.e+1]);break;case 161:u["!autofilter"]={ref:zr(le)};break;case 476:u["!margins"]=le;break;case 147:a.Sheets[r]||(a.Sheets[r]={}),le.name&&(a.Sheets[r].CodeName=le.name),(le.above||le.left)&&(u["!outline"]={above:le.above,left:le.left});break;case 137:a.Views||(a.Views=[{}]),a.Views[0]||(a.Views[0]={}),le.RTL&&(a.Views[0].RTL=!0);break;case 485:break;case 64:case 1053:break;case 151:break;case 152:case 175:case 644:case 625:case 562:case 396:case 1112:case 1146:case 471:case 1050:case 649:case 1105:case 589:case 607:case 564:case 1055:case 168:case 174:case 1180:case 499:case 507:case 550:case 171:case 167:case 1177:case 169:case 1181:case 551:case 552:case 661:case 639:case 478:case 537:case 477:case 536:case 1103:case 680:case 1104:case 1024:case 663:case 535:case 678:case 504:case 1043:case 428:case 170:case 3072:case 50:case 2070:case 1045:break;case 35:m=!0;break;case 36:m=!1;break;case 37:m=!0;break;case 38:m=!1;break;default:if(!Ae.T){if(!m||l.WTF)throw new Error("Unexpected record 0x"+ce.toString(16))}}},l),delete l.supbooks,delete l["!row"],!u["!ref"]&&(f.s.r<2e6||d&&(d.e.r>0||d.e.c>0||d.s.r>0||d.s.c>0))&&(u["!ref"]=zr(d||f)),l.sheetRows&&u["!ref"]){var ne=yn(u["!ref"]);l.sheetRows<=+ne.e.r&&(ne.e.r=l.sheetRows-1,ne.e.r>f.e.r&&(ne.e.r=f.e.r),ne.e.r<ne.s.r&&(ne.s.r=ne.e.r),ne.e.c>f.e.c&&(ne.e.c=f.e.c),ne.e.c<ne.s.c&&(ne.s.c=ne.e.c),u["!fullref"]=u["!ref"],u["!ref"]=zr(ne))}return B.length>0&&(u["!merges"]=B),K.length>0&&(u["!cols"]=K),ee.length>0&&(u["!rows"]=ee),u}function z8e(e,t,r,n,a,s,o){if(t.v===void 0)return!1;var l="";switch(t.t){case"b":l=t.v?"1":"0";break;case"d":t=Na(t),t.z=t.z||Cr[14],t.v=Hi(ja(t.v)),t.t="n";break;case"n":case"e":l=""+t.v;break;default:l=t.v;break}var u={r,c:n};switch(u.s=Hh(a.cellXfs,t,a),t.l&&s["!links"].push([_r(u),t.l]),t.c&&s["!comments"].push([_r(u),t.c]),t.t){case"s":case"str":return a.bookSST?(l=UE(a.Strings,t.v,a.revStrings),u.t="s",u.v=l,o?Ot(e,18,i8e(t,u)):Ot(e,7,n8e(t,u))):(u.t="str",o?Ot(e,17,g8e(t,u)):Ot(e,6,p8e(t,u))),!0;case"n":return t.v==(t.v|0)&&t.v>-1e3&&t.v<1e3?o?Ot(e,13,f8e(t,u)):Ot(e,2,u8e(t,u)):o?Ot(e,16,l8e(t,u)):Ot(e,5,o8e(t,u)),!0;case"b":return u.t="b",o?Ot(e,15,ZDe(t,u)):Ot(e,4,KDe(t,u)),!0;case"e":return u.t="e",o?Ot(e,14,t8e(t,u)):Ot(e,3,QDe(t,u)),!0}return o?Ot(e,12,GDe(t,u)):Ot(e,1,qDe(t,u)),!0}function U8e(e,t,r,n){var a=yn(t["!ref"]||"A1"),s,o="",l=[];Ot(e,145);var u=Array.isArray(t),d=a.e.r;t["!rows"]&&(d=Math.max(a.e.r,t["!rows"].length-1));for(var f=a.s.r;f<=d;++f){o=hi(f),FDe(e,t,a,f);var m=!1;if(f<=a.e.r)for(var g=a.s.c;g<=a.e.c;++g){f===a.s.r&&(l[g]=Ia(g)),s=l[g]+o;var x=u?(t[f]||[])[g]:t[s];if(!x){m=!1;continue}m=z8e(e,x,f,g,n,t,m)}}Ot(e,146)}function $8e(e,t){!t||!t["!merges"]||(Ot(e,177,S8e(t["!merges"].length)),t["!merges"].forEach(function(r){Ot(e,176,N8e(r))}),Ot(e,178))}function H8e(e,t){!t||!t["!cols"]||(Ot(e,390),t["!cols"].forEach(function(r,n){r&&Ot(e,60,T8e(n,r))}),Ot(e,391))}function V8e(e,t){!t||!t["!ref"]||(Ot(e,648),Ot(e,649,M8e(yn(t["!ref"]))),Ot(e,650))}function q8e(e,t,r){t["!links"].forEach(function(n){if(n[1].Target){var a=zn(r,-1,n[1].Target.replace(/#.*$/,""),Qr.HLINK);Ot(e,494,k8e(n,a))}}),delete t["!links"]}function W8e(e,t,r,n){if(t["!comments"].length>0){var a=zn(n,-1,"../drawings/vmlDrawing"+(r+1)+".vml",Qr.VML);Ot(e,551,_E("rId"+a)),t["!legacy"]=a}}function G8e(e,t,r,n){if(t["!autofilter"]){var a=t["!autofilter"],s=typeof a.ref=="string"?a.ref:zr(a.ref);r.Workbook||(r.Workbook={Sheets:[]}),r.Workbook.Names||(r.Workbook.Names=[]);var o=r.Workbook.Names,l=$o(s);l.s.r==l.e.r&&(l.e.r=$o(t["!ref"]).e.r,s=zr(l));for(var u=0;u<o.length;++u){var d=o[u];if(d.Name=="_xlnm._FilterDatabase"&&d.Sheet==n){d.Ref="'"+r.SheetNames[n]+"'!"+s;break}}u==o.length&&o.push({Name:"_xlnm._FilterDatabase",Sheet:n,Ref:"'"+r.SheetNames[n]+"'!"+s}),Ot(e,161,zx(yn(s))),Ot(e,162)}}function Y8e(e,t,r){Ot(e,133),Ot(e,137,R8e(t,r)),Ot(e,138),Ot(e,134)}function K8e(e,t){t["!protect"]&&Ot(e,535,L8e(t["!protect"]))}function X8e(e,t,r,n){var a=Uo(),s=r.SheetNames[e],o=r.Sheets[s]||{},l=s;try{r&&r.Workbook&&(l=r.Workbook.Sheets[e].CodeName||l)}catch{}var u=yn(o["!ref"]||"A1");if(u.e.c>16383||u.e.r>1048575){if(t.WTF)throw new Error("Range "+(o["!ref"]||"A1")+" exceeds format limit A1:XFD1048576");u.e.c=Math.min(u.e.c,16383),u.e.r=Math.min(u.e.c,1048575)}return o["!links"]=[],o["!comments"]=[],Ot(a,129),(r.vbaraw||o["!outline"])&&Ot(a,147,HDe(l,o["!outline"])),Ot(a,148,zDe(u)),Y8e(a,o,r.Workbook),H8e(a,o),U8e(a,o,e,t),K8e(a,o),G8e(a,o,r,e),$8e(a,o),q8e(a,o,n),o["!margins"]&&Ot(a,476,D8e(o["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&V8e(a,o),W8e(a,o,e,n),Ot(a,130),a.end()}function Z8e(e){var t=[],r=e.match(/^<c:numCache>/),n;(e.match(/<c:pt idx="(\d*)">(.*?)<\/c:pt>/mg)||[]).forEach(function(s){var o=s.match(/<c:pt idx="(\d*?)"><c:v>(.*)<\/c:v><\/c:pt>/);o&&(t[+o[1]]=r?+o[2]:o[2])});var a=vn((e.match(/<c:formatCode>([\s\S]*?)<\/c:formatCode>/)||["","General"])[1]);return(e.match(/<c:f>(.*?)<\/c:f>/mg)||[]).forEach(function(s){n=s.replace(/<.*?>/g,"")}),[t,a,n]}function J8e(e,t,r,n,a,s){var o=s||{"!type":"chart"};if(!e)return s;var l=0,u=0,d="A",f={s:{r:2e6,c:2e6},e:{r:0,c:0}};return(e.match(/<c:numCache>[\s\S]*?<\/c:numCache>/gm)||[]).forEach(function(m){var g=Z8e(m);f.s.r=f.s.c=0,f.e.c=l,d=Ia(l),g[0].forEach(function(x,y){o[d+hi(y)]={t:"n",v:x,z:g[1]},u=y}),f.e.r<u&&(f.e.r=u),++l}),l>0&&(o["!ref"]=zr(f)),o}function Q8e(e,t,r,n,a){if(!e)return e;n||(n={"!id":{}});var s={"!type":"chart","!drawel":null,"!rel":""},o,l=e.match(IY);return l&&$E(l[0],s,a,r),(o=e.match(/drawing r:id="(.*?)"/))&&(s["!rel"]=o[1]),n["!id"][s["!rel"]]&&(s["!drawel"]=n["!id"][s["!rel"]]),s}function eOe(e,t){e.l+=10;var r=Ws(e);return{name:r}}function tOe(e,t,r,n,a){if(!e)return e;n||(n={"!id":{}});var s={"!type":"chart","!drawel":null,"!rel":""},o=!1;return mf(e,function(u,d,f){switch(f){case 550:s["!rel"]=u;break;case 651:a.Sheets[r]||(a.Sheets[r]={}),u.name&&(a.Sheets[r].CodeName=u.name);break;case 562:case 652:case 669:case 679:case 551:case 552:case 476:case 3072:break;case 35:o=!0;break;case 36:o=!1;break;case 37:break;case 38:break;default:if(!(d.T>0)){if(!(d.T<0)){if(!o||t.WTF)throw new Error("Unexpected record 0x"+f.toString(16))}}}},t),n["!id"][s["!rel"]]&&(s["!drawel"]=n["!id"][s["!rel"]]),s}var HE=[["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"]],rOe=[["activeTab",0,"int"],["autoFilterDateGrouping",!0,"bool"],["firstSheet",0,"int"],["minimized",!1,"bool"],["showHorizontalScroll",!0,"bool"],["showSheetTabs",!0,"bool"],["showVerticalScroll",!0,"bool"],["tabRatio",600,"int"],["visibility","visible"]],nOe=[],aOe=[["calcCompleted","true"],["calcMode","auto"],["calcOnSave","true"],["concurrentCalc","true"],["fullCalcOnLoad","false"],["fullPrecision","true"],["iterate","false"],["iterateCount","100"],["iterateDelta","0.001"],["refMode","A1"]];function R7(e,t){for(var r=0;r!=e.length;++r)for(var n=e[r],a=0;a!=t.length;++a){var s=t[a];if(n[s[0]]==null)n[s[0]]=s[1];else switch(s[2]){case"bool":typeof n[s[0]]=="string"&&(n[s[0]]=ya(n[s[0]]));break;case"int":typeof n[s[0]]=="string"&&(n[s[0]]=parseInt(n[s[0]],10));break}}}function M7(e,t){for(var r=0;r!=t.length;++r){var n=t[r];if(e[n[0]]==null)e[n[0]]=n[1];else switch(n[2]){case"bool":typeof e[n[0]]=="string"&&(e[n[0]]=ya(e[n[0]]));break;case"int":typeof e[n[0]]=="string"&&(e[n[0]]=parseInt(e[n[0]],10));break}}}function UY(e){M7(e.WBProps,HE),M7(e.CalcPr,aOe),R7(e.WBView,rOe),R7(e.Sheets,nOe),ex.date1904=ya(e.WBProps.date1904)}function iOe(e){return!e.Workbook||!e.Workbook.WBProps?"false":ya(e.Workbook.WBProps.date1904)?"true":"false"}var sOe="][*?/\\".split("");function $Y(e,t){if(e.length>31)throw new Error("Sheet names cannot exceed 31 chars");var r=!0;return sOe.forEach(function(n){if(e.indexOf(n)!=-1)throw new Error("Sheet name cannot contain : \\ / ? * [ ]")}),r}function oOe(e,t,r){e.forEach(function(n,a){$Y(n);for(var s=0;s<a;++s)if(n==e[s])throw new Error("Duplicate Sheet Name: "+n);if(r){var o=t&&t[a]&&t[a].CodeName||n;if(o.charCodeAt(0)==95&&o.length>22)throw new Error("Bad Code Name: Worksheet"+o)}})}function lOe(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||[];oOe(e.SheetNames,t,!!e.vbaraw);for(var r=0;r<e.SheetNames.length;++r)iDe(e.Sheets[e.SheetNames[r]],e.SheetNames[r],r)}var cOe=/<\w+:workbook/;function uOe(e,t){if(!e)throw new Error("Could not find file");var r={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},Names:[],xmlns:""},n=!1,a="xmlns",s={},o=0;if(e.replace(Xs,function(u,d){var f=Tr(u);switch(Zu(f[0])){case"<?xml":break;case"<workbook":u.match(cOe)&&(a="xmlns"+u.match(/<(\w+):/)[1]),r.xmlns=f[a];break;case"</workbook>":break;case"<fileVersion":delete f[0],r.AppVersion=f;break;case"<fileVersion/>":case"</fileVersion>":break;case"<fileSharing":break;case"<fileSharing/>":break;case"<workbookPr":case"<workbookPr/>":HE.forEach(function(m){if(f[m[0]]!=null)switch(m[2]){case"bool":r.WBProps[m[0]]=ya(f[m[0]]);break;case"int":r.WBProps[m[0]]=parseInt(f[m[0]],10);break;default:r.WBProps[m[0]]=f[m[0]]}}),f.codeName&&(r.WBProps.CodeName=Xn(f.codeName));break;case"</workbookPr>":break;case"<workbookProtection":break;case"<workbookProtection/>":break;case"<bookViews":case"<bookViews>":case"</bookViews>":break;case"<workbookView":case"<workbookView/>":delete f[0],r.WBView.push(f);break;case"</workbookView>":break;case"<sheets":case"<sheets>":case"</sheets>":break;case"<sheet":switch(f.state){case"hidden":f.Hidden=1;break;case"veryHidden":f.Hidden=2;break;default:f.Hidden=0}delete f.state,f.name=vn(Xn(f.name)),delete f[0],r.Sheets.push(f);break;case"</sheet>":break;case"<functionGroups":case"<functionGroups/>":break;case"<functionGroup":break;case"<externalReferences":case"</externalReferences>":case"<externalReferences>":break;case"<externalReference":break;case"<definedNames/>":break;case"<definedNames>":case"<definedNames":n=!0;break;case"</definedNames>":n=!1;break;case"<definedName":s={},s.Name=Xn(f.name),f.comment&&(s.Comment=f.comment),f.localSheetId&&(s.Sheet=+f.localSheetId),ya(f.hidden||"0")&&(s.Hidden=!0),o=d+u.length;break;case"</definedName>":s.Ref=vn(Xn(e.slice(o,d))),r.Names.push(s);break;case"<definedName/>":break;case"<calcPr":delete f[0],r.CalcPr=f;break;case"<calcPr/>":delete f[0],r.CalcPr=f;break;case"</calcPr>":break;case"<oleSize":break;case"<customWorkbookViews>":case"</customWorkbookViews>":case"<customWorkbookViews":break;case"<customWorkbookView":case"</customWorkbookView>":break;case"<pivotCaches>":case"</pivotCaches>":case"<pivotCaches":break;case"<pivotCache":break;case"<smartTagPr":case"<smartTagPr/>":break;case"<smartTagTypes":case"<smartTagTypes>":case"</smartTagTypes>":break;case"<smartTagType":break;case"<webPublishing":case"<webPublishing/>":break;case"<fileRecoveryPr":case"<fileRecoveryPr/>":break;case"<webPublishObjects>":case"<webPublishObjects":case"</webPublishObjects>":break;case"<webPublishObject":break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":n=!0;break;case"</ext>":n=!1;break;case"<ArchID":break;case"<AlternateContent":case"<AlternateContent>":n=!0;break;case"</AlternateContent>":n=!1;break;case"<revisionPtr":break;default:if(!n&&t.WTF)throw new Error("unrecognized "+f[0]+" in workbook")}return u}),j0.indexOf(r.xmlns)===-1)throw new Error("Unknown Namespace: "+r.xmlns);return UY(r),r}function HY(e){var t=[pi];t[t.length]=Wt("workbook",null,{xmlns:j0[0],"xmlns:r":$i.r});var r=e.Workbook&&(e.Workbook.Names||[]).length>0,n={codeName:"ThisWorkbook"};e.Workbook&&e.Workbook.WBProps&&(HE.forEach(function(l){e.Workbook.WBProps[l[0]]!=null&&e.Workbook.WBProps[l[0]]!=l[1]&&(n[l[0]]=e.Workbook.WBProps[l[0]])}),e.Workbook.WBProps.CodeName&&(n.codeName=e.Workbook.WBProps.CodeName,delete n.CodeName)),t[t.length]=Wt("workbookPr",null,n);var a=e.Workbook&&e.Workbook.Sheets||[],s=0;if(a&&a[0]&&a[0].Hidden){for(t[t.length]="<bookViews>",s=0;s!=e.SheetNames.length&&!(!a[s]||!a[s].Hidden);++s);s==e.SheetNames.length&&(s=0),t[t.length]='<workbookView firstSheet="'+s+'" activeTab="'+s+'"/>',t[t.length]="</bookViews>"}for(t[t.length]="<sheets>",s=0;s!=e.SheetNames.length;++s){var o={name:Vn(e.SheetNames[s].slice(0,31))};if(o.sheetId=""+(s+1),o["r:id"]="rId"+(s+1),a[s])switch(a[s].Hidden){case 1:o.state="hidden";break;case 2:o.state="veryHidden";break}t[t.length]=Wt("sheet",null,o)}return t[t.length]="</sheets>",r&&(t[t.length]="<definedNames>",e.Workbook&&e.Workbook.Names&&e.Workbook.Names.forEach(function(l){var u={name:l.Name};l.Comment&&(u.comment=l.Comment),l.Sheet!=null&&(u.localSheetId=""+l.Sheet),l.Hidden&&(u.hidden="1"),l.Ref&&(t[t.length]=Wt("definedName",Vn(l.Ref),u))}),t[t.length]="</definedNames>"),t.length>2&&(t[t.length]="</workbook>",t[1]=t[1].replace("/>",">")),t.join("")}function dOe(e,t){var r={};return r.Hidden=e.read_shift(4),r.iTabID=e.read_shift(4),r.strRelID=ok(e),r.name=Ws(e),r}function fOe(e,t){return t||(t=St(127)),t.write_shift(4,e.Hidden),t.write_shift(4,e.iTabID),_E(e.strRelID,t),us(e.name.slice(0,31),t),t.length>t.l?t.slice(0,t.l):t}function hOe(e,t){var r={},n=e.read_shift(4);r.defaultThemeVersion=e.read_shift(4);var a=t>8?Ws(e):"";return a.length>0&&(r.CodeName=a),r.autoCompressPictures=!!(n&65536),r.backupFile=!!(n&64),r.checkCompatibility=!!(n&4096),r.date1904=!!(n&1),r.filterPrivacy=!!(n&8),r.hidePivotFieldList=!!(n&1024),r.promptedSolutions=!!(n&16),r.publishItems=!!(n&2048),r.refreshAllConnections=!!(n&262144),r.saveExternalLinkValues=!!(n&128),r.showBorderUnselectedTables=!!(n&4),r.showInkAnnotation=!!(n&32),r.showObjects=["all","placeholders","none"][n>>13&3],r.showPivotChartFilter=!!(n&32768),r.updateLinks=["userSet","never","always"][n>>8&3],r}function mOe(e,t){t||(t=St(72));var r=0;return e&&e.filterPrivacy&&(r|=8),t.write_shift(4,r),t.write_shift(4,0),RG(e&&e.CodeName||"ThisWorkbook",t),t.slice(0,t.l)}function pOe(e,t){var r={};return e.read_shift(4),r.ArchID=e.read_shift(4),e.l+=t-8,r}function xOe(e,t,r){var n=e.l+t;e.l+=4,e.l+=1;var a=e.read_shift(4),s=Wke(e),o=QPe(e,0,r),l=CE(e);e.l=n;var u={Name:s,Ptg:o};return a<268435455&&(u.Sheet=a),l&&(u.Comment=l),u}function gOe(e,t){var r={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},xmlns:""},n=[],a=!1;t||(t={}),t.biff=12;var s=[],o=[[]];return o.SheetNames=[],o.XTI=[],n1[16]={n:"BrtFRTArchID$",f:pOe},mf(e,function(u,d,f){switch(f){case 156:o.SheetNames.push(u.name),r.Sheets.push(u);break;case 153:r.WBProps=u;break;case 39:u.Sheet!=null&&(t.SID=u.Sheet),u.Ref=Us(u.Ptg,null,null,o,t),delete t.SID,delete u.Ptg,s.push(u);break;case 1036:break;case 357:case 358:case 355:case 667:o[0].length?o.push([f,u]):o[0]=[f,u],o[o.length-1].XTI=[];break;case 362:o.length===0&&(o[0]=[],o[0].XTI=[]),o[o.length-1].XTI=o[o.length-1].XTI.concat(u),o.XTI=o.XTI.concat(u);break;case 361:break;case 2071:case 158:case 143:case 664:case 353:break;case 3072:case 3073:case 534:case 677:case 157:case 610:case 2050:case 155:case 548:case 676:case 128:case 665:case 2128:case 2125:case 549:case 2053:case 596:case 2076:case 2075:case 2082:case 397:case 154:case 1117:case 553:case 2091:break;case 35:n.push(f),a=!0;break;case 36:n.pop(),a=!1;break;case 37:n.push(f),a=!0;break;case 38:n.pop(),a=!1;break;case 16:break;default:if(!d.T){if(!a||t.WTF&&n[n.length-1]!=37&&n[n.length-1]!=35)throw new Error("Unexpected record 0x"+f.toString(16))}}},t),UY(r),r.Names=s,r.supbooks=o,r}function vOe(e,t){Ot(e,143);for(var r=0;r!=t.SheetNames.length;++r){var n=t.Workbook&&t.Workbook.Sheets&&t.Workbook.Sheets[r]&&t.Workbook.Sheets[r].Hidden||0,a={Hidden:n,iTabID:r+1,strRelID:"rId"+(r+1),name:t.SheetNames[r]};Ot(e,156,fOe(a))}Ot(e,144)}function yOe(e,t){t||(t=St(127));for(var r=0;r!=4;++r)t.write_shift(4,0);return us("SheetJS",t),us(_w.version,t),us(_w.version,t),us("7262",t),t.length>t.l?t.slice(0,t.l):t}function bOe(e,t){t||(t=St(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 r=120;return t.write_shift(1,r),t.length>t.l?t.slice(0,t.l):t}function wOe(e,t){if(!(!t.Workbook||!t.Workbook.Sheets)){for(var r=t.Workbook.Sheets,n=0,a=-1,s=-1;n<r.length;++n)!r[n]||!r[n].Hidden&&a==-1?a=n:r[n].Hidden==1&&s==-1&&(s=n);s>a||(Ot(e,135),Ot(e,158,bOe(a)),Ot(e,136))}}function jOe(e,t){var r=Uo();return Ot(r,131),Ot(r,128,yOe()),Ot(r,153,mOe(e.Workbook&&e.Workbook.WBProps||null)),wOe(r,e),vOe(r,e),Ot(r,132),r.end()}function NOe(e,t,r){return t.slice(-4)===".bin"?gOe(e,r):uOe(e,r)}function SOe(e,t,r,n,a,s,o,l){return t.slice(-4)===".bin"?B8e(e,n,r,a,s,o,l):xDe(e,n,r,a,s,o,l)}function AOe(e,t,r,n,a,s,o,l){return t.slice(-4)===".bin"?tOe(e,n,r,a,s):Q8e(e,n,r,a,s)}function kOe(e,t,r,n,a,s,o,l){return t.slice(-4)===".bin"?_6e():E6e()}function COe(e,t,r,n,a,s,o,l){return t.slice(-4)===".bin"?k6e():C6e()}function _Oe(e,t,r,n){return t.slice(-4)===".bin"?NTe(e,r,n):dTe(e,r,n)}function EOe(e,t,r){return NY(e,r)}function TOe(e,t,r){return t.slice(-4)===".bin"?TEe(e,r):CEe(e,r)}function POe(e,t,r){return t.slice(-4)===".bin"?w6e(e,r):f6e(e,r)}function DOe(e,t,r){return t.slice(-4)===".bin"?c6e(e):o6e(e)}function OOe(e,t,r,n){return r.slice(-4)===".bin"?u6e(e,t,r,n):void 0}function ROe(e,t,r){return t.slice(-4)===".bin"?a6e(e,t,r):s6e(e,t,r)}function MOe(e,t,r){return(t.slice(-4)===".bin"?jOe:HY)(e)}function LOe(e,t,r,n,a){return(t.slice(-4)===".bin"?X8e:FY)(e,r,n,a)}function IOe(e,t,r){return(t.slice(-4)===".bin"?OTe:wY)(e,r)}function FOe(e,t,r){return(t.slice(-4)===".bin"?OEe:hY)(e,r)}function BOe(e,t,r){return(t.slice(-4)===".bin"?j6e:kY)(e)}function zOe(e){return(e.slice(-4)===".bin"?i6e:SY)()}var VY=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g,qY=/([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/;function wc(e,t){var r=e.split(/\s+/),n=[];if(n[0]=r[0],r.length===1)return n;var a=e.match(VY),s,o,l,u;if(a)for(u=0;u!=a.length;++u)s=a[u].match(qY),(o=s[1].indexOf(":"))===-1?n[s[1]]=s[2].slice(1,s[2].length-1):(s[1].slice(0,6)==="xmlns:"?l="xmlns"+s[1].slice(6):l=s[1].slice(o+1),n[l]=s[2].slice(1,s[2].length-1));return n}function UOe(e){var t=e.split(/\s+/),r={};if(t.length===1)return r;var n=e.match(VY),a,s,o,l;if(n)for(l=0;l!=n.length;++l)a=n[l].match(qY),(s=a[1].indexOf(":"))===-1?r[a[1]]=a[2].slice(1,a[2].length-1):(a[1].slice(0,6)==="xmlns:"?o="xmlns"+a[1].slice(6):o=a[1].slice(s+1),r[o]=a[2].slice(1,a[2].length-1));return r}var gv;function $Oe(e,t){var r=gv[e]||vn(e);return r==="General"?c0(t):Xl(r,t)}function HOe(e,t,r,n){var a=n;switch((r[0].match(/dt:dt="([\w.]+)"/)||["",""])[1]){case"boolean":a=ya(n);break;case"i2":case"int":a=parseInt(n,10);break;case"r4":case"float":a=parseFloat(n);break;case"date":case"dateTime.tz":a=ja(n);break;case"i8":case"string":case"fixed":case"uuid":case"bin.base64":break;default:throw new Error("bad custprop:"+r[0])}e[vn(t)]=a}function VOe(e,t,r){if(e.t!=="z"){if(!r||r.cellText!==!1)try{e.t==="e"?e.w=e.w||pf[e.v]:t==="General"?e.t==="n"?(e.v|0)===e.v?e.w=e.v.toString(10):e.w=Yv(e.v):e.w=c0(e.v):e.w=$Oe(t||"General",e.v)}catch(s){if(r.WTF)throw s}try{var n=gv[t]||t||"General";if(r.cellNF&&(e.z=n),r.cellDates&&e.t=="n"&&Ix(n)){var a=Lm(e.v);a&&(e.t="d",e.v=new Date(a.y,a.m-1,a.d,a.H,a.M,a.S,a.u))}}catch(s){if(r.WTF)throw s}}}function qOe(e,t,r){if(r.cellStyles&&t.Interior){var n=t.Interior;n.Pattern&&(n.patternType=nTe[n.Pattern]||n.Pattern)}e[t.ID]=t}function WOe(e,t,r,n,a,s,o,l,u,d){var f="General",m=n.StyleID,g={};d=d||{};var x=[],y=0;for(m===void 0&&l&&(m=l.StyleID),m===void 0&&o&&(m=o.StyleID);s[m]!==void 0&&(s[m].nf&&(f=s[m].nf),s[m].Interior&&x.push(s[m].Interior),!!s[m].Parent);)m=s[m].Parent;switch(r.Type){case"Boolean":n.t="b",n.v=ya(e);break;case"String":n.t="s",n.r=JF(vn(e)),n.v=e.indexOf("<")>-1?vn(t||e).replace(/<.*?>/g,""):n.r;break;case"DateTime":e.slice(-1)!="Z"&&(e+="Z"),n.v=(ja(e)-new Date(Date.UTC(1899,11,30)))/(1440*60*1e3),n.v!==n.v?n.v=vn(e):n.v<60&&(n.v=n.v-1),(!f||f=="General")&&(f="yyyy-mm-dd");case"Number":n.v===void 0&&(n.v=+e),n.t||(n.t="n");break;case"Error":n.t="e",n.v=BG[e],d.cellText!==!1&&(n.w=e);break;default:e==""&&t==""?n.t="z":(n.t="s",n.v=JF(t||e));break}if(VOe(n,f,d),d.cellFormula!==!1)if(n.Formula){var v=vn(n.Formula);v.charCodeAt(0)==61&&(v=v.slice(1)),n.f=Qp(v,a),delete n.Formula,n.ArrayRange=="RC"?n.F=Qp("RC:RC",a):n.ArrayRange&&(n.F=Qp(n.ArrayRange,a),u.push([yn(n.F),n.F]))}else for(y=0;y<u.length;++y)a.r>=u[y][0].s.r&&a.r<=u[y][0].e.r&&a.c>=u[y][0].s.c&&a.c<=u[y][0].e.c&&(n.F=u[y][1]);d.cellStyles&&(x.forEach(function(w){!g.patternType&&w.patternType&&(g.patternType=w.patternType)}),n.s=g),n.StyleID!==void 0&&(n.ixfe=n.StyleID)}function GOe(e){e.t=e.v||"",e.t=e.t.replace(/\r\n/g,`
`).replace(/\r/g,`
`),e.v=e.w=e.ixfe=void 0}function l3(e,t){var r=t||{};Fx();var n=Zg(wE(e));(r.type=="binary"||r.type=="array"||r.type=="base64")&&(n=Xn(n));var a=n.slice(0,1024).toLowerCase(),s=!1;if(a=a.replace(/".*?"/g,""),(a.indexOf(">")&1023)>Math.min(a.indexOf(",")&1023,a.indexOf(";")&1023)){var o=Na(r);return o.type="string",xx.to_workbook(n,o)}if(a.indexOf("<?xml")==-1&&["html","table","head","meta","script","style","div"].forEach(function(Je){a.indexOf("<"+Je)>=0&&(s=!0)}),s)return DRe(n,r);gv={"General Number":"General","General Date":Cr[22],"Long Date":"dddd, mmmm dd, yyyy","Medium Date":Cr[15],"Short Date":Cr[14],"Long Time":Cr[19],"Medium Time":Cr[18],"Short Time":Cr[20],Currency:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',Fixed:Cr[2],Standard:Cr[4],Percent:Cr[10],Scientific:Cr[11],"Yes/No":'"Yes";"Yes";"No";@',"True/False":'"True";"True";"False";@',"On/Off":'"Yes";"Yes";"No";@'};var l,u=[],d,f={},m=[],g=r.dense?[]:{},x="",y={},v={},w=wc('<Data ss:Type="String">'),j=0,k=0,A=0,T={s:{r:2e6,c:2e6},e:{r:0,c:0}},M={},B={},L="",F=0,I=[],q={},P={},R=0,K=[],ee=[],se={},Z=[],ne,X=!1,le=[],Ae=[],ce={},D=0,H=0,G={Sheets:[],WBProps:{date1904:!1}},E={};Zv.lastIndex=0,n=n.replace(/<!--([\s\S]*?)-->/mg,"");for(var re="";l=Zv.exec(n);)switch(l[3]=(re=l[3]).toLowerCase()){case"data":if(re=="data"){if(l[1]==="/"){if((d=u.pop())[0]!==l[3])throw new Error("Bad state: "+d.join("|"))}else l[0].charAt(l[0].length-2)!=="/"&&u.push([l[3],!0]);break}if(u[u.length-1][1])break;l[1]==="/"?WOe(n.slice(j,l.index),L,w,u[u.length-1][0]=="comment"?se:y,{c:k,r:A},M,Z[k],v,le,r):(L="",w=wc(l[0]),j=l.index+l[0].length);break;case"cell":if(l[1]==="/")if(ee.length>0&&(y.c=ee),(!r.sheetRows||r.sheetRows>A)&&y.v!==void 0&&(r.dense?(g[A]||(g[A]=[]),g[A][k]=y):g[Ia(k)+hi(A)]=y),y.HRef&&(y.l={Target:vn(y.HRef)},y.HRefScreenTip&&(y.l.Tooltip=y.HRefScreenTip),delete y.HRef,delete y.HRefScreenTip),(y.MergeAcross||y.MergeDown)&&(D=k+(parseInt(y.MergeAcross,10)|0),H=A+(parseInt(y.MergeDown,10)|0),I.push({s:{c:k,r:A},e:{c:D,r:H}})),!r.sheetStubs)y.MergeAcross?k=D+1:++k;else if(y.MergeAcross||y.MergeDown){for(var he=k;he<=D;++he)for(var oe=A;oe<=H;++oe)(he>k||oe>A)&&(r.dense?(g[oe]||(g[oe]=[]),g[oe][he]={t:"z"}):g[Ia(he)+hi(oe)]={t:"z"});k=D+1}else++k;else y=UOe(l[0]),y.Index&&(k=+y.Index-1),k<T.s.c&&(T.s.c=k),k>T.e.c&&(T.e.c=k),l[0].slice(-2)==="/>"&&++k,ee=[];break;case"row":l[1]==="/"||l[0].slice(-2)==="/>"?(A<T.s.r&&(T.s.r=A),A>T.e.r&&(T.e.r=A),l[0].slice(-2)==="/>"&&(v=wc(l[0]),v.Index&&(A=+v.Index-1)),k=0,++A):(v=wc(l[0]),v.Index&&(A=+v.Index-1),ce={},(v.AutoFitHeight=="0"||v.Height)&&(ce.hpx=parseInt(v.Height,10),ce.hpt=r1(ce.hpx),Ae[A]=ce),v.Hidden=="1"&&(ce.hidden=!0,Ae[A]=ce));break;case"worksheet":if(l[1]==="/"){if((d=u.pop())[0]!==l[3])throw new Error("Bad state: "+d.join("|"));m.push(x),T.s.r<=T.e.r&&T.s.c<=T.e.c&&(g["!ref"]=zr(T),r.sheetRows&&r.sheetRows<=T.e.r&&(g["!fullref"]=g["!ref"],T.e.r=r.sheetRows-1,g["!ref"]=zr(T))),I.length&&(g["!merges"]=I),Z.length>0&&(g["!cols"]=Z),Ae.length>0&&(g["!rows"]=Ae),f[x]=g}else T={s:{r:2e6,c:2e6},e:{r:0,c:0}},A=k=0,u.push([l[3],!1]),d=wc(l[0]),x=vn(d.Name),g=r.dense?[]:{},I=[],le=[],Ae=[],E={name:x,Hidden:0},G.Sheets.push(E);break;case"table":if(l[1]==="/"){if((d=u.pop())[0]!==l[3])throw new Error("Bad state: "+d.join("|"))}else{if(l[0].slice(-2)=="/>")break;u.push([l[3],!1]),Z=[],X=!1}break;case"style":l[1]==="/"?qOe(M,B,r):B=wc(l[0]);break;case"numberformat":B.nf=vn(wc(l[0]).Format||"General"),gv[B.nf]&&(B.nf=gv[B.nf]);for(var z=0;z!=392&&Cr[z]!=B.nf;++z);if(z==392){for(z=57;z!=392;++z)if(Cr[z]==null){Kd(B.nf,z);break}}break;case"column":if(u[u.length-1][0]!=="table")break;if(ne=wc(l[0]),ne.Hidden&&(ne.hidden=!0,delete ne.Hidden),ne.Width&&(ne.wpx=parseInt(ne.Width,10)),!X&&ne.wpx>10){X=!0,Hs=yY;for(var fe=0;fe<Z.length;++fe)Z[fe]&&Eh(Z[fe])}X&&Eh(ne),Z[ne.Index-1||Z.length]=ne;for(var de=0;de<+ne.Span;++de)Z[Z.length]=Na(ne);break;case"namedrange":if(l[1]==="/")break;G.Names||(G.Names=[]);var W=Tr(l[0]),ae={Name:W.Name,Ref:Qp(W.RefersTo.slice(1),{r:0,c:0})};G.Sheets.length>0&&(ae.Sheet=G.Sheets.length-1),G.Names.push(ae);break;case"namedcell":break;case"b":break;case"i":break;case"u":break;case"s":break;case"em":break;case"h2":break;case"h3":break;case"sub":break;case"sup":break;case"span":break;case"alignment":break;case"borders":break;case"border":break;case"font":if(l[0].slice(-2)==="/>")break;l[1]==="/"?L+=n.slice(F,l.index):F=l.index+l[0].length;break;case"interior":if(!r.cellStyles)break;B.Interior=wc(l[0]);break;case"protection":break;case"author":case"title":case"description":case"created":case"keywords":case"subject":case"category":case"company":case"lastauthor":case"lastsaved":case"lastprinted":case"version":case"revision":case"totaltime":case"hyperlinkbase":case"manager":case"contentstatus":case"identifier":case"language":case"appname":if(l[0].slice(-2)==="/>")break;l[1]==="/"?gCe(q,re,n.slice(R,l.index)):R=l.index+l[0].length;break;case"paragraphs":break;case"styles":case"workbook":if(l[1]==="/"){if((d=u.pop())[0]!==l[3])throw new Error("Bad state: "+d.join("|"))}else u.push([l[3],!1]);break;case"comment":if(l[1]==="/"){if((d=u.pop())[0]!==l[3])throw new Error("Bad state: "+d.join("|"));GOe(se),ee.push(se)}else u.push([l[3],!1]),d=wc(l[0]),se={a:d.Author};break;case"autofilter":if(l[1]==="/"){if((d=u.pop())[0]!==l[3])throw new Error("Bad state: "+d.join("|"))}else if(l[0].charAt(l[0].length-2)!=="/"){var _e=wc(l[0]);g["!autofilter"]={ref:Qp(_e.Range).replace(/\$/g,"")},u.push([l[3],!0])}break;case"name":break;case"datavalidation":if(l[1]==="/"){if((d=u.pop())[0]!==l[3])throw new Error("Bad state: "+d.join("|"))}else l[0].charAt(l[0].length-2)!=="/"&&u.push([l[3],!0]);break;case"pixelsperinch":break;case"componentoptions":case"documentproperties":case"customdocumentproperties":case"officedocumentsettings":case"pivottable":case"pivotcache":case"names":case"mapinfo":case"pagebreaks":case"querytable":case"sorting":case"schema":case"conditionalformatting":case"smarttagtype":case"smarttags":case"excelworkbook":case"workbookoptions":case"worksheetoptions":if(l[1]==="/"){if((d=u.pop())[0]!==l[3])throw new Error("Bad state: "+d.join("|"))}else l[0].charAt(l[0].length-2)!=="/"&&u.push([l[3],!0]);break;case"null":break;default:if(u.length==0&&l[3]=="document"||u.length==0&&l[3]=="uof")return z7(n,r);var ue=!0;switch(u[u.length-1][0]){case"officedocumentsettings":switch(l[3]){case"allowpng":break;case"removepersonalinformation":break;case"downloadcomponents":break;case"locationofcomponents":break;case"colors":break;case"color":break;case"index":break;case"rgb":break;case"targetscreensize":break;case"readonlyrecommended":break;default:ue=!1}break;case"componentoptions":switch(l[3]){case"toolbar":break;case"hideofficelogo":break;case"spreadsheetautofit":break;case"label":break;case"caption":break;case"maxheight":break;case"maxwidth":break;case"nextsheetnumber":break;default:ue=!1}break;case"excelworkbook":switch(l[3]){case"date1904":G.WBProps.date1904=!0;break;case"windowheight":break;case"windowwidth":break;case"windowtopx":break;case"windowtopy":break;case"tabratio":break;case"protectstructure":break;case"protectwindow":break;case"protectwindows":break;case"activesheet":break;case"displayinknotes":break;case"firstvisiblesheet":break;case"supbook":break;case"sheetname":break;case"sheetindex":break;case"sheetindexfirst":break;case"sheetindexlast":break;case"dll":break;case"acceptlabelsinformulas":break;case"donotsavelinkvalues":break;case"iteration":break;case"maxiterations":break;case"maxchange":break;case"path":break;case"xct":break;case"count":break;case"selectedsheets":break;case"calculation":break;case"uncalced":break;case"startupprompt":break;case"crn":break;case"externname":break;case"formula":break;case"colfirst":break;case"collast":break;case"wantadvise":break;case"boolean":break;case"error":break;case"text":break;case"ole":break;case"noautorecover":break;case"publishobjects":break;case"donotcalculatebeforesave":break;case"number":break;case"refmoder1c1":break;case"embedsavesmarttags":break;default:ue=!1}break;case"workbookoptions":switch(l[3]){case"owcversion":break;case"height":break;case"width":break;default:ue=!1}break;case"worksheetoptions":switch(l[3]){case"visible":if(l[0].slice(-2)!=="/>")if(l[1]==="/")switch(n.slice(R,l.index)){case"SheetHidden":E.Hidden=1;break;case"SheetVeryHidden":E.Hidden=2;break}else R=l.index+l[0].length;break;case"header":g["!margins"]||Gm(g["!margins"]={},"xlml"),isNaN(+Tr(l[0]).Margin)||(g["!margins"].header=+Tr(l[0]).Margin);break;case"footer":g["!margins"]||Gm(g["!margins"]={},"xlml"),isNaN(+Tr(l[0]).Margin)||(g["!margins"].footer=+Tr(l[0]).Margin);break;case"pagemargins":var ke=Tr(l[0]);g["!margins"]||Gm(g["!margins"]={},"xlml"),isNaN(+ke.Top)||(g["!margins"].top=+ke.Top),isNaN(+ke.Left)||(g["!margins"].left=+ke.Left),isNaN(+ke.Right)||(g["!margins"].right=+ke.Right),isNaN(+ke.Bottom)||(g["!margins"].bottom=+ke.Bottom);break;case"displayrighttoleft":G.Views||(G.Views=[]),G.Views[0]||(G.Views[0]={}),G.Views[0].RTL=!0;break;case"freezepanes":break;case"frozennosplit":break;case"splithorizontal":case"splitvertical":break;case"donotdisplaygridlines":break;case"activerow":break;case"activecol":break;case"toprowbottompane":break;case"leftcolumnrightpane":break;case"unsynced":break;case"print":break;case"printerrors":break;case"panes":break;case"scale":break;case"pane":break;case"number":break;case"layout":break;case"pagesetup":break;case"selected":break;case"protectobjects":break;case"enableselection":break;case"protectscenarios":break;case"validprinterinfo":break;case"horizontalresolution":break;case"verticalresolution":break;case"numberofcopies":break;case"activepane":break;case"toprowvisible":break;case"leftcolumnvisible":break;case"fittopage":break;case"rangeselection":break;case"papersizeindex":break;case"pagelayoutzoom":break;case"pagebreakzoom":break;case"filteron":break;case"fitwidth":break;case"fitheight":break;case"commentslayout":break;case"zoom":break;case"lefttoright":break;case"gridlines":break;case"allowsort":break;case"allowfilter":break;case"allowinsertrows":break;case"allowdeleterows":break;case"allowinsertcols":break;case"allowdeletecols":break;case"allowinserthyperlinks":break;case"allowformatcells":break;case"allowsizecols":break;case"allowsizerows":break;case"nosummaryrowsbelowdetail":g["!outline"]||(g["!outline"]={}),g["!outline"].above=!0;break;case"tabcolorindex":break;case"donotdisplayheadings":break;case"showpagelayoutzoom":break;case"nosummarycolumnsrightdetail":g["!outline"]||(g["!outline"]={}),g["!outline"].left=!0;break;case"blackandwhite":break;case"donotdisplayzeros":break;case"displaypagebreak":break;case"rowcolheadings":break;case"donotdisplayoutline":break;case"noorientation":break;case"allowusepivottables":break;case"zeroheight":break;case"viewablerange":break;case"selection":break;case"protectcontents":break;default:ue=!1}break;case"pivottable":case"pivotcache":switch(l[3]){case"immediateitemsondrop":break;case"showpagemultipleitemlabel":break;case"compactrowindent":break;case"location":break;case"pivotfield":break;case"orientation":break;case"layoutform":break;case"layoutsubtotallocation":break;case"layoutcompactrow":break;case"position":break;case"pivotitem":break;case"datatype":break;case"datafield":break;case"sourcename":break;case"parentfield":break;case"ptlineitems":break;case"ptlineitem":break;case"countofsameitems":break;case"item":break;case"itemtype":break;case"ptsource":break;case"cacheindex":break;case"consolidationreference":break;case"filename":break;case"reference":break;case"nocolumngrand":break;case"norowgrand":break;case"blanklineafteritems":break;case"hidden":break;case"subtotal":break;case"basefield":break;case"mapchilditems":break;case"function":break;case"refreshonfileopen":break;case"printsettitles":break;case"mergelabels":break;case"defaultversion":break;case"refreshname":break;case"refreshdate":break;case"refreshdatecopy":break;case"versionlastrefresh":break;case"versionlastupdate":break;case"versionupdateablemin":break;case"versionrefreshablemin":break;case"calculation":break;default:ue=!1}break;case"pagebreaks":switch(l[3]){case"colbreaks":break;case"colbreak":break;case"rowbreaks":break;case"rowbreak":break;case"colstart":break;case"colend":break;case"rowend":break;default:ue=!1}break;case"autofilter":switch(l[3]){case"autofiltercolumn":break;case"autofiltercondition":break;case"autofilterand":break;case"autofilteror":break;default:ue=!1}break;case"querytable":switch(l[3]){case"id":break;case"autoformatfont":break;case"autoformatpattern":break;case"querysource":break;case"querytype":break;case"enableredirections":break;case"refreshedinxl9":break;case"urlstring":break;case"htmltables":break;case"connection":break;case"commandtext":break;case"refreshinfo":break;case"notitles":break;case"nextid":break;case"columninfo":break;case"overwritecells":break;case"donotpromptforfile":break;case"textwizardsettings":break;case"source":break;case"number":break;case"decimal":break;case"thousandseparator":break;case"trailingminusnumbers":break;case"formatsettings":break;case"fieldtype":break;case"delimiters":break;case"tab":break;case"comma":break;case"autoformatname":break;case"versionlastedit":break;case"versionlastrefresh":break;default:ue=!1}break;case"datavalidation":switch(l[3]){case"range":break;case"type":break;case"min":break;case"max":break;case"sort":break;case"descending":break;case"order":break;case"casesensitive":break;case"value":break;case"errorstyle":break;case"errormessage":break;case"errortitle":break;case"inputmessage":break;case"inputtitle":break;case"combohide":break;case"inputhide":break;case"condition":break;case"qualifier":break;case"useblank":break;case"value1":break;case"value2":break;case"format":break;case"cellrangelist":break;default:ue=!1}break;case"sorting":case"conditionalformatting":switch(l[3]){case"range":break;case"type":break;case"min":break;case"max":break;case"sort":break;case"descending":break;case"order":break;case"casesensitive":break;case"value":break;case"errorstyle":break;case"errormessage":break;case"errortitle":break;case"cellrangelist":break;case"inputmessage":break;case"inputtitle":break;case"combohide":break;case"inputhide":break;case"condition":break;case"qualifier":break;case"useblank":break;case"value1":break;case"value2":break;case"format":break;default:ue=!1}break;case"mapinfo":case"schema":case"data":switch(l[3]){case"map":break;case"entry":break;case"range":break;case"xpath":break;case"field":break;case"xsdtype":break;case"filteron":break;case"aggregate":break;case"elementtype":break;case"attributetype":break;case"schema":case"element":case"complextype":case"datatype":case"all":case"attribute":case"extends":break;case"row":break;default:ue=!1}break;case"smarttags":break;default:ue=!1;break}if(ue||l[3].match(/!\[CDATA/))break;if(!u[u.length-1][1])throw"Unrecognized tag: "+l[3]+"|"+u.join("|");if(u[u.length-1][0]==="customdocumentproperties"){if(l[0].slice(-2)==="/>")break;l[1]==="/"?HOe(P,re,K,n.slice(R,l.index)):(K=l,R=l.index+l[0].length);break}if(r.WTF)throw"Unrecognized tag: "+l[3]+"|"+u.join("|")}var $e={};return!r.bookSheets&&!r.bookProps&&($e.Sheets=f),$e.SheetNames=m,$e.Workbook=G,$e.SSF=Na(Cr),$e.Props=q,$e.Custprops=P,$e}function mk(e,t){switch(qE(t=t||{}),t.type||"base64"){case"base64":return l3(vl(e),t);case"binary":case"buffer":case"file":return l3(e,t);case"array":return l3(Uh(e),t)}}function YOe(e,t){var r=[];return e.Props&&r.push(vCe(e.Props,t)),e.Custprops&&r.push(yCe(e.Props,e.Custprops)),r.join("")}function KOe(){return""}function XOe(e,t){var r=['<Style ss:ID="Default" ss:Name="Normal"><NumberFormat/></Style>'];return t.cellXfs.forEach(function(n,a){var s=[];s.push(Wt("NumberFormat",null,{"ss:Format":Vn(Cr[n.numFmtId])}));var o={"ss:ID":"s"+(21+a)};r.push(Wt("Style",s.join(""),o))}),Wt("Styles",r.join(""))}function WY(e){return Wt("NamedRange",null,{"ss:Name":e.Name,"ss:RefersTo":"="+BE(e.Ref,{r:0,c:0})})}function ZOe(e){if(!((e||{}).Workbook||{}).Names)return"";for(var t=e.Workbook.Names,r=[],n=0;n<t.length;++n){var a=t[n];a.Sheet==null&&(a.Name.match(/^_xlfn\./)||r.push(WY(a)))}return Wt("Names",r.join(""))}function JOe(e,t,r,n){if(!e||!((n||{}).Workbook||{}).Names)return"";for(var a=n.Workbook.Names,s=[],o=0;o<a.length;++o){var l=a[o];l.Sheet==r&&(l.Name.match(/^_xlfn\./)||s.push(WY(l)))}return s.join("")}function QOe(e,t,r,n){if(!e)return"";var a=[];if(e["!margins"]&&(a.push("<PageSetup>"),e["!margins"].header&&a.push(Wt("Header",null,{"x:Margin":e["!margins"].header})),e["!margins"].footer&&a.push(Wt("Footer",null,{"x:Margin":e["!margins"].footer})),a.push(Wt("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"})),a.push("</PageSetup>")),n&&n.Workbook&&n.Workbook.Sheets&&n.Workbook.Sheets[r])if(n.Workbook.Sheets[r].Hidden)a.push(Wt("Visible",n.Workbook.Sheets[r].Hidden==1?"SheetHidden":"SheetVeryHidden",{}));else{for(var s=0;s<r&&!(n.Workbook.Sheets[s]&&!n.Workbook.Sheets[s].Hidden);++s);s==r&&a.push("<Selected/>")}return((((n||{}).Workbook||{}).Views||[])[0]||{}).RTL&&a.push("<DisplayRightToLeft/>"),e["!protect"]&&(a.push(Es("ProtectContents","True")),e["!protect"].objects&&a.push(Es("ProtectObjects","True")),e["!protect"].scenarios&&a.push(Es("ProtectScenarios","True")),e["!protect"].selectLockedCells!=null&&!e["!protect"].selectLockedCells?a.push(Es("EnableSelection","NoSelection")):e["!protect"].selectUnlockedCells!=null&&!e["!protect"].selectUnlockedCells&&a.push(Es("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(o){e["!protect"][o[0]]&&a.push("<"+o[1]+"/>")})),a.length==0?"":Wt("WorksheetOptions",a.join(""),{xmlns:sl.x})}function eRe(e){return e.map(function(t){var r=wke(t.t||""),n=Wt("ss:Data",r,{xmlns:"http://www.w3.org/TR/REC-html40"});return Wt("Comment",n,{"ss:Author":t.a})}).join("")}function tRe(e,t,r,n,a,s,o){if(!e||e.v==null&&e.f==null)return"";var l={};if(e.f&&(l["ss:Formula"]="="+Vn(BE(e.f,o))),e.F&&e.F.slice(0,t.length)==t){var u=Fa(e.F.slice(t.length+1));l["ss:ArrayRange"]="RC:R"+(u.r==o.r?"":"["+(u.r-o.r)+"]")+"C"+(u.c==o.c?"":"["+(u.c-o.c)+"]")}if(e.l&&e.l.Target&&(l["ss:HRef"]=Vn(e.l.Target),e.l.Tooltip&&(l["x:HRefScreenTip"]=Vn(e.l.Tooltip))),r["!merges"])for(var d=r["!merges"],f=0;f!=d.length;++f)d[f].s.c!=o.c||d[f].s.r!=o.r||(d[f].e.c>d[f].s.c&&(l["ss:MergeAcross"]=d[f].e.c-d[f].s.c),d[f].e.r>d[f].s.r&&(l["ss:MergeDown"]=d[f].e.r-d[f].s.r));var m="",g="";switch(e.t){case"z":if(!n.sheetStubs)return"";break;case"n":m="Number",g=String(e.v);break;case"b":m="Boolean",g=e.v?"1":"0";break;case"e":m="Error",g=pf[e.v];break;case"d":m="DateTime",g=new Date(e.v).toISOString(),e.z==null&&(e.z=e.z||Cr[14]);break;case"s":m="String",g=bke(e.v||"");break}var x=Hh(n.cellXfs,e,n);l["ss:StyleID"]="s"+(21+x),l["ss:Index"]=o.c+1;var y=e.v!=null?g:"",v=e.t=="z"?"":'<Data ss:Type="'+m+'">'+y+"</Data>";return(e.c||[]).length>0&&(v+=eRe(e.c)),Wt("Cell",v,l)}function rRe(e,t){var r='<Row ss:Index="'+(e+1)+'"';return t&&(t.hpt&&!t.hpx&&(t.hpx=gx(t.hpt)),t.hpx&&(r+=' ss:AutoFitHeight="0" ss:Height="'+t.hpx+'"'),t.hidden&&(r+=' ss:Hidden="1"')),r+">"}function nRe(e,t,r,n){if(!e["!ref"])return"";var a=yn(e["!ref"]),s=e["!merges"]||[],o=0,l=[];e["!cols"]&&e["!cols"].forEach(function(w,j){Eh(w);var k=!!w.width,A=rj(j,w),T={"ss:Index":j+1};k&&(T["ss:Width"]=e1(A.width)),w.hidden&&(T["ss:Hidden"]="1"),l.push(Wt("Column",null,T))});for(var u=Array.isArray(e),d=a.s.r;d<=a.e.r;++d){for(var f=[rRe(d,(e["!rows"]||[])[d])],m=a.s.c;m<=a.e.c;++m){var g=!1;for(o=0;o!=s.length;++o)if(!(s[o].s.c>m)&&!(s[o].s.r>d)&&!(s[o].e.c<m)&&!(s[o].e.r<d)){(s[o].s.c!=m||s[o].s.r!=d)&&(g=!0);break}if(!g){var x={r:d,c:m},y=_r(x),v=u?(e[d]||[])[m]:e[y];f.push(tRe(v,y,e,t,r,n,x))}}f.push("</Row>"),f.length>2&&l.push(f.join(""))}return l.join("")}function aRe(e,t,r){var n=[],a=r.SheetNames[e],s=r.Sheets[a],o=s?JOe(s,t,e,r):"";return o.length>0&&n.push("<Names>"+o+"</Names>"),o=s?nRe(s,t,e,r):"",o.length>0&&n.push("<Table>"+o+"</Table>"),n.push(QOe(s,t,e,r)),n.join("")}function iRe(e,t){t||(t={}),e.SSF||(e.SSF=Na(Cr)),e.SSF&&(Fx(),K5(e.SSF),t.revssf=Z5(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF,t.cellXfs=[],Hh(t.cellXfs,{},{revssf:{General:0}}));var r=[];r.push(YOe(e,t)),r.push(KOe()),r.push(""),r.push("");for(var n=0;n<e.SheetNames.length;++n)r.push(Wt("Worksheet",aRe(n,t,e),{"ss:Name":Vn(e.SheetNames[n])}));return r[2]=XOe(e,t),r[3]=ZOe(e),pi+Wt("Workbook",r.join(""),{xmlns:sl.ss,"xmlns:o":sl.o,"xmlns:x":sl.x,"xmlns:ss":sl.ss,"xmlns:dt":sl.dt,"xmlns:html":sl.html})}function sRe(e){var t={},r=e.content;if(r.l=28,t.AnsiUserType=r.read_shift(0,"lpstr-ansi"),t.AnsiClipboardFormat=Zke(r),r.length-r.l<=4)return t;var n=r.read_shift(4);if(n==0||n>40||(r.l-=4,t.Reserved1=r.read_shift(0,"lpstr-ansi"),r.length-r.l<=4)||(n=r.read_shift(4),n!==1907505652)||(t.UnicodeClipboardFormat=Jke(r),n=r.read_shift(4),n==0||n>40))return t;r.l-=4,t.Reserved2=r.read_shift(0,"lpwstr")}var oRe=[60,1084,2066,2165,2175];function lRe(e,t,r,n,a){var s=n,o=[],l=r.slice(r.l,r.l+s);if(a&&a.enc&&a.enc.insitu&&l.length>0)switch(e){case 9:case 521:case 1033:case 2057:case 47:case 405:case 225:case 406:case 312:case 404:case 10:break;case 133:break;default:a.enc.insitu(l)}o.push(l),r.l+=s;for(var u=Vd(r,r.l),d=pk[u],f=0;d!=null&&oRe.indexOf(u)>-1;)s=Vd(r,r.l+2),f=r.l+4,u==2066?f+=4:(u==2165||u==2175)&&(f+=12),l=r.slice(f,r.l+4+s),o.push(l),r.l+=4+s,d=pk[u=Vd(r,r.l)];var m=os(o);_s(m,0);var g=0;m.lens=[];for(var x=0;x<o.length;++x)m.lens.push(g),g+=o[x].length;if(m.length<n)throw"XLS Record 0x"+e.toString(16)+" Truncated: "+m.length+" < "+n;return t.f(m,m.length,a)}function ju(e,t,r){if(e.t!=="z"&&e.XF){var n=0;try{n=e.z||e.XF.numFmtId||0,t.cellNF&&(e.z=Cr[n])}catch(s){if(t.WTF)throw s}if(!t||t.cellText!==!1)try{e.t==="e"?e.w=e.w||pf[e.v]:n===0||n=="General"?e.t==="n"?(e.v|0)===e.v?e.w=e.v.toString(10):e.w=Yv(e.v):e.w=c0(e.v):e.w=Xl(n,e.v,{date1904:!!r,dateNF:t&&t.dateNF})}catch(s){if(t.WTF)throw s}if(t.cellDates&&n&&e.t=="n"&&Ix(Cr[n]||String(n))){var a=Lm(e.v);a&&(e.t="d",e.v=new Date(a.y,a.m-1,a.d,a.H,a.M,a.S,a.u))}}}function Mb(e,t,r){return{v:e,ixfe:t,t:r}}function cRe(e,t){var r={opts:{}},n={},a=t.dense?[]:{},s={},o={},l=null,u=[],d="",f={},m,g="",x,y,v,w,j={},k=[],A,T,M=[],B=[],L={Sheets:[],WBProps:{date1904:!1},Views:[{}]},F={},I=function(me){return me<8?Vm[me]:me<64&&B[me-8]||Vm[me]},q=function(me,Ge,Be){var it=Ge.XF.data;if(!(!it||!it.patternType||!Be||!Be.cellStyles)){Ge.s={},Ge.s.patternType=it.patternType;var st;(st=Qv(I(it.icvFore)))&&(Ge.s.fgColor={rgb:st}),(st=Qv(I(it.icvBack)))&&(Ge.s.bgColor={rgb:st})}},P=function(me,Ge,Be){if(!(ce>1)&&!(Be.sheetRows&&me.r>=Be.sheetRows)){if(Be.cellStyles&&Ge.XF&&Ge.XF.data&&q(me,Ge,Be),delete Ge.ixfe,delete Ge.XF,m=me,g=_r(me),(!o||!o.s||!o.e)&&(o={s:{r:0,c:0},e:{r:0,c:0}}),me.r<o.s.r&&(o.s.r=me.r),me.c<o.s.c&&(o.s.c=me.c),me.r+1>o.e.r&&(o.e.r=me.r+1),me.c+1>o.e.c&&(o.e.c=me.c+1),Be.cellFormula&&Ge.f){for(var it=0;it<k.length;++it)if(!(k[it][0].s.c>me.c||k[it][0].s.r>me.r)&&!(k[it][0].e.c<me.c||k[it][0].e.r<me.r)){Ge.F=zr(k[it][0]),(k[it][0].s.c!=me.c||k[it][0].s.r!=me.r)&&delete Ge.f,Ge.f&&(Ge.f=""+Us(k[it][1],o,me,le,R));break}}Be.dense?(a[me.r]||(a[me.r]=[]),a[me.r][me.c]=Ge):a[g]=Ge}},R={enc:!1,sbcch:0,snames:[],sharedf:j,arrayf:k,rrtabid:[],lastuser:"",biff:8,codepage:0,winlocked:0,cellStyles:!!t&&!!t.cellStyles,WTF:!!t&&!!t.wtf};t.password&&(R.password=t.password);var K,ee=[],se=[],Z=[],ne=[],X=!1,le=[];le.SheetNames=R.snames,le.sharedf=R.sharedf,le.arrayf=R.arrayf,le.names=[],le.XTI=[];var Ae=0,ce=0,D=0,H=[],G=[],E;R.codepage=1200,Cc(1200);for(var re=!1;e.l<e.length-1;){var he=e.l,oe=e.read_shift(2);if(oe===0&&Ae===10)break;var z=e.l===e.length?0:e.read_shift(2),fe=pk[oe];if(fe&&fe.f){if(t.bookSheets&&Ae===133&&oe!==133)break;if(Ae=oe,fe.r===2||fe.r==12){var de=e.read_shift(2);if(z-=2,!R.enc&&de!==oe&&((de&255)<<8|de>>8)!==oe)throw new Error("rt mismatch: "+de+"!="+oe);fe.r==12&&(e.l+=10,z-=10)}var W={};if(oe===10?W=fe.f(e,z,R):W=lRe(oe,fe,e,z,R),ce==0&&[9,521,1033,2057].indexOf(Ae)===-1)continue;switch(oe){case 34:r.opts.Date1904=L.WBProps.date1904=W;break;case 134:r.opts.WriteProtect=!0;break;case 47:if(R.enc||(e.l=0),R.enc=W,!t.password)throw new Error("File is password-protected");if(W.valid==null)throw new Error("Encryption scheme unsupported");if(!W.valid)throw new Error("Password is incorrect");break;case 92:R.lastuser=W;break;case 66:var ae=Number(W);switch(ae){case 21010:ae=1200;break;case 32768:ae=1e4;break;case 32769:ae=1252;break}Cc(R.codepage=ae),re=!0;break;case 317:R.rrtabid=W;break;case 25:R.winlocked=W;break;case 439:r.opts.RefreshAll=W;break;case 12:r.opts.CalcCount=W;break;case 16:r.opts.CalcDelta=W;break;case 17:r.opts.CalcIter=W;break;case 13:r.opts.CalcMode=W;break;case 14:r.opts.CalcPrecision=W;break;case 95:r.opts.CalcSaveRecalc=W;break;case 15:R.CalcRefMode=W;break;case 2211:r.opts.FullCalc=W;break;case 129:W.fDialog&&(a["!type"]="dialog"),W.fBelow||((a["!outline"]||(a["!outline"]={})).above=!0),W.fRight||((a["!outline"]||(a["!outline"]={})).left=!0);break;case 224:M.push(W);break;case 430:le.push([W]),le[le.length-1].XTI=[];break;case 35:case 547:le[le.length-1].push(W);break;case 24:case 536:E={Name:W.Name,Ref:Us(W.rgce,o,null,le,R)},W.itab>0&&(E.Sheet=W.itab-1),le.names.push(E),le[0]||(le[0]=[],le[0].XTI=[]),le[le.length-1].push(W),W.Name=="_xlnm._FilterDatabase"&&W.itab>0&&W.rgce&&W.rgce[0]&&W.rgce[0][0]&&W.rgce[0][0][0]=="PtgArea3d"&&(G[W.itab-1]={ref:zr(W.rgce[0][0][1][2])});break;case 22:R.ExternCount=W;break;case 23:le.length==0&&(le[0]=[],le[0].XTI=[]),le[le.length-1].XTI=le[le.length-1].XTI.concat(W),le.XTI=le.XTI.concat(W);break;case 2196:if(R.biff<8)break;E!=null&&(E.Comment=W[1]);break;case 18:a["!protect"]=W;break;case 19:W!==0&&R.WTF&&console.error("Password verifier: "+W);break;case 133:s[W.pos]=W,R.snames.push(W.name);break;case 10:{if(--ce)break;if(o.e){if(o.e.r>0&&o.e.c>0){if(o.e.r--,o.e.c--,a["!ref"]=zr(o),t.sheetRows&&t.sheetRows<=o.e.r){var _e=o.e.r;o.e.r=t.sheetRows-1,a["!fullref"]=a["!ref"],a["!ref"]=zr(o),o.e.r=_e}o.e.r++,o.e.c++}ee.length>0&&(a["!merges"]=ee),se.length>0&&(a["!objects"]=se),Z.length>0&&(a["!cols"]=Z),ne.length>0&&(a["!rows"]=ne),L.Sheets.push(F)}d===""?f=a:n[d]=a,a=t.dense?[]:{}}break;case 9:case 521:case 1033:case 2057:{if(R.biff===8&&(R.biff={9:2,521:3,1033:4}[oe]||{512:2,768:3,1024:4,1280:5,1536:8,2:2,7:2}[W.BIFFVer]||8),R.biffguess=W.BIFFVer==0,W.BIFFVer==0&&W.dt==4096&&(R.biff=5,re=!0,Cc(R.codepage=28591)),R.biff==8&&W.BIFFVer==0&&W.dt==16&&(R.biff=2),ce++)break;if(a=t.dense?[]:{},R.biff<8&&!re&&(re=!0,Cc(R.codepage=t.codepage||1252)),R.biff<5||W.BIFFVer==0&&W.dt==4096){d===""&&(d="Sheet1"),o={s:{r:0,c:0},e:{r:0,c:0}};var ue={pos:e.l-z,name:d};s[ue.pos]=ue,R.snames.push(d)}else d=(s[he]||{name:""}).name;W.dt==32&&(a["!type"]="chart"),W.dt==64&&(a["!type"]="macro"),ee=[],se=[],R.arrayf=k=[],Z=[],ne=[],X=!1,F={Hidden:(s[he]||{hs:0}).hs,name:d}}break;case 515:case 3:case 2:a["!type"]=="chart"&&(t.dense?(a[W.r]||[])[W.c]:a[_r({c:W.c,r:W.r})])&&++W.c,A={ixfe:W.ixfe,XF:M[W.ixfe]||{},v:W.val,t:"n"},D>0&&(A.z=H[A.ixfe>>8&63]),ju(A,t,r.opts.Date1904),P({c:W.c,r:W.r},A,t);break;case 5:case 517:A={ixfe:W.ixfe,XF:M[W.ixfe],v:W.val,t:W.t},D>0&&(A.z=H[A.ixfe>>8&63]),ju(A,t,r.opts.Date1904),P({c:W.c,r:W.r},A,t);break;case 638:A={ixfe:W.ixfe,XF:M[W.ixfe],v:W.rknum,t:"n"},D>0&&(A.z=H[A.ixfe>>8&63]),ju(A,t,r.opts.Date1904),P({c:W.c,r:W.r},A,t);break;case 189:for(var ke=W.c;ke<=W.C;++ke){var $e=W.rkrec[ke-W.c][0];A={ixfe:$e,XF:M[$e],v:W.rkrec[ke-W.c][1],t:"n"},D>0&&(A.z=H[A.ixfe>>8&63]),ju(A,t,r.opts.Date1904),P({c:ke,r:W.r},A,t)}break;case 6:case 518:case 1030:{if(W.val=="String"){l=W;break}if(A=Mb(W.val,W.cell.ixfe,W.tt),A.XF=M[A.ixfe],t.cellFormula){var Je=W.formula;if(Je&&Je[0]&&Je[0][0]&&Je[0][0][0]=="PtgExp"){var Xe=Je[0][0][1][0],Ne=Je[0][0][1][1],Ye=_r({r:Xe,c:Ne});j[Ye]?A.f=""+Us(W.formula,o,W.cell,le,R):A.F=((t.dense?(a[Xe]||[])[Ne]:a[Ye])||{}).F}else A.f=""+Us(W.formula,o,W.cell,le,R)}D>0&&(A.z=H[A.ixfe>>8&63]),ju(A,t,r.opts.Date1904),P(W.cell,A,t),l=W}break;case 7:case 519:if(l)l.val=W,A=Mb(W,l.cell.ixfe,"s"),A.XF=M[A.ixfe],t.cellFormula&&(A.f=""+Us(l.formula,o,l.cell,le,R)),D>0&&(A.z=H[A.ixfe>>8&63]),ju(A,t,r.opts.Date1904),P(l.cell,A,t),l=null;else throw new Error("String record expects Formula");break;case 33:case 545:{k.push(W);var at=_r(W[0].s);if(x=t.dense?(a[W[0].s.r]||[])[W[0].s.c]:a[at],t.cellFormula&&x){if(!l||!at||!x)break;x.f=""+Us(W[1],o,W[0],le,R),x.F=zr(W[0])}}break;case 1212:{if(!t.cellFormula)break;if(g){if(!l)break;j[_r(l.cell)]=W[0],x=t.dense?(a[l.cell.r]||[])[l.cell.c]:a[_r(l.cell)],(x||{}).f=""+Us(W[0],o,m,le,R)}}break;case 253:A=Mb(u[W.isst].t,W.ixfe,"s"),u[W.isst].h&&(A.h=u[W.isst].h),A.XF=M[A.ixfe],D>0&&(A.z=H[A.ixfe>>8&63]),ju(A,t,r.opts.Date1904),P({c:W.c,r:W.r},A,t);break;case 513:t.sheetStubs&&(A={ixfe:W.ixfe,XF:M[W.ixfe],t:"z"},D>0&&(A.z=H[A.ixfe>>8&63]),ju(A,t,r.opts.Date1904),P({c:W.c,r:W.r},A,t));break;case 190:if(t.sheetStubs)for(var Y=W.c;Y<=W.C;++Y){var we=W.ixfe[Y-W.c];A={ixfe:we,XF:M[we],t:"z"},D>0&&(A.z=H[A.ixfe>>8&63]),ju(A,t,r.opts.Date1904),P({c:Y,r:W.r},A,t)}break;case 214:case 516:case 4:A=Mb(W.val,W.ixfe,"s"),A.XF=M[A.ixfe],D>0&&(A.z=H[A.ixfe>>8&63]),ju(A,t,r.opts.Date1904),P({c:W.c,r:W.r},A,t);break;case 0:case 512:ce===1&&(o=W);break;case 252:u=W;break;case 1054:if(R.biff==4){H[D++]=W[1];for(var J=0;J<D+163&&Cr[J]!=W[1];++J);J>=163&&Kd(W[1],D+163)}else Kd(W[1],W[0]);break;case 30:{H[D++]=W;for(var ve=0;ve<D+163&&Cr[ve]!=W;++ve);ve>=163&&Kd(W,D+163)}break;case 229:ee=ee.concat(W);break;case 93:se[W.cmo[0]]=R.lastobj=W;break;case 438:R.lastobj.TxO=W;break;case 127:R.lastobj.ImData=W;break;case 440:for(w=W[0].s.r;w<=W[0].e.r;++w)for(v=W[0].s.c;v<=W[0].e.c;++v)x=t.dense?(a[w]||[])[v]:a[_r({c:v,r:w})],x&&(x.l=W[1]);break;case 2048:for(w=W[0].s.r;w<=W[0].e.r;++w)for(v=W[0].s.c;v<=W[0].e.c;++v)x=t.dense?(a[w]||[])[v]:a[_r({c:v,r:w})],x&&x.l&&(x.l.Tooltip=W[1]);break;case 28:{if(R.biff<=5&&R.biff>=2)break;x=t.dense?(a[W[0].r]||[])[W[0].c]:a[_r(W[0])];var Oe=se[W[2]];x||(t.dense?(a[W[0].r]||(a[W[0].r]=[]),x=a[W[0].r][W[0].c]={t:"z"}):x=a[_r(W[0])]={t:"z"},o.e.r=Math.max(o.e.r,W[0].r),o.s.r=Math.min(o.s.r,W[0].r),o.e.c=Math.max(o.e.c,W[0].c),o.s.c=Math.min(o.s.c,W[0].c)),x.c||(x.c=[]),y={a:W[1],t:Oe.TxO.t},x.c.push(y)}break;case 2173:XTe(M[W.ixfe],W.ext);break;case 125:{if(!R.cellStyles)break;for(;W.e>=W.s;)Z[W.e--]={width:W.w/256,level:W.level||0,hidden:!!(W.flags&1)},X||(X=!0,LE(W.w/256)),Eh(Z[W.e+1])}break;case 520:{var xe={};W.level!=null&&(ne[W.r]=xe,xe.level=W.level),W.hidden&&(ne[W.r]=xe,xe.hidden=!0),W.hpt&&(ne[W.r]=xe,xe.hpt=W.hpt,xe.hpx=gx(W.hpt))}break;case 38:case 39:case 40:case 41:a["!margins"]||Gm(a["!margins"]={}),a["!margins"][{38:"left",39:"right",40:"top",41:"bottom"}[oe]]=W;break;case 161:a["!margins"]||Gm(a["!margins"]={}),a["!margins"].header=W.header,a["!margins"].footer=W.footer;break;case 574:W.RTL&&(L.Views[0].RTL=!0);break;case 146:B=W;break;case 2198:K=W;break;case 140:T=W;break;case 442:d?F.CodeName=W||F.name:L.WBProps.CodeName=W||"ThisWorkbook";break}}else fe||console.error("Missing Info for XLS Record 0x"+oe.toString(16)),e.l+=z}return r.SheetNames=ri(s).sort(function(qe,me){return Number(qe)-Number(me)}).map(function(qe){return s[qe].name}),t.bookSheets||(r.Sheets=n),!r.SheetNames.length&&f["!ref"]?(r.SheetNames.push("Sheet1"),r.Sheets&&(r.Sheets.Sheet1=f)):r.Preamble=f,r.Sheets&&G.forEach(function(qe,me){r.Sheets[r.SheetNames[me]]["!autofilter"]=qe}),r.Strings=u,r.SSF=Na(Cr),R.enc&&(r.Encryption=R.enc),K&&(r.Themes=K),r.Metadata={},T!==void 0&&(r.Metadata.Country=T),le.names.length>0&&(L.Names=le.names),r.Workbook=L,r}var vv={SI:"e0859ff2f94f6810ab9108002b27b3d9",DSI:"02d5cdd59c2e1b10939708002b2cf9ae",UDI:"05d5cdd59c2e1b10939708002b2cf9ae"};function uRe(e,t,r){var n=br.find(e,"/!DocumentSummaryInformation");if(n&&n.size>0)try{var a=x7(n,lk,vv.DSI);for(var s in a)t[s]=a[s]}catch(d){if(r.WTF)throw d}var o=br.find(e,"/!SummaryInformation");if(o&&o.size>0)try{var l=x7(o,ck,vv.SI);for(var u in l)t[u]==null&&(t[u]=l[u])}catch(d){if(r.WTF)throw d}t.HeadingPairs&&t.TitlesOfParts&&(qG(t.HeadingPairs,t.TitlesOfParts,t,r),delete t.HeadingPairs,delete t.TitlesOfParts)}function dRe(e,t){var r=[],n=[],a=[],s=0,o,l=WF(lk,"n"),u=WF(ck,"n");if(e.Props)for(o=ri(e.Props),s=0;s<o.length;++s)(Object.prototype.hasOwnProperty.call(l,o[s])?r:Object.prototype.hasOwnProperty.call(u,o[s])?n:a).push([o[s],e.Props[o[s]]]);if(e.Custprops)for(o=ri(e.Custprops),s=0;s<o.length;++s)Object.prototype.hasOwnProperty.call(e.Props||{},o[s])||(Object.prototype.hasOwnProperty.call(l,o[s])?r:Object.prototype.hasOwnProperty.call(u,o[s])?n:a).push([o[s],e.Custprops[o[s]]]);var d=[];for(s=0;s<a.length;++s)JG.indexOf(a[s][0])>-1||VG.indexOf(a[s][0])>-1||a[s][1]!=null&&d.push(a[s]);n.length&&br.utils.cfb_add(t,"/SummaryInformation",g7(n,vv.SI,u,ck)),(r.length||d.length)&&br.utils.cfb_add(t,"/DocumentSummaryInformation",g7(r,vv.DSI,l,lk,d.length?d:null,vv.UDI))}function GY(e,t){t||(t={}),qE(t),fE(),t.codepage&&dE(t.codepage);var r,n;if(e.FullPaths){if(br.find(e,"/encryption"))throw new Error("File is password-protected");r=br.find(e,"!CompObj"),n=br.find(e,"/Workbook")||br.find(e,"/Book")}else{switch(t.type){case"base64":e=cl(vl(e));break;case"binary":e=cl(e);break;case"buffer":break;case"array":Array.isArray(e)||(e=Array.prototype.slice.call(e));break}_s(e,0),n={content:e}}var a,s;if(r&&sRe(r),t.bookProps&&!t.bookSheets)a={};else{var o=Yr?"buffer":"array";if(n&&n.content)a=cRe(n.content,t);else if((s=br.find(e,"PerfectOffice_MAIN"))&&s.content)a=Wm.to_workbook(s.content,(t.type=o,t));else if((s=br.find(e,"NativeContent_MAIN"))&&s.content)a=Wm.to_workbook(s.content,(t.type=o,t));else throw(s=br.find(e,"MN0"))&&s.content?new Error("Unsupported Works 4 for Mac file"):new Error("Cannot find Workbook stream");t.bookVBA&&e.FullPaths&&br.find(e,"/_VBA_PROJECT_CUR/VBA/dir")&&(a.vbaraw=S6e(e))}var l={};return e.FullPaths&&uRe(e,l,t),a.Props=a.Custprops=l,t.bookFiles&&(a.cfb=e),a}function fRe(e,t){var r=t||{},n=br.utils.cfb_new({root:"R"}),a="/Workbook";switch(r.bookType||"xls"){case"xls":r.bookType="biff8";case"xla":r.bookType||(r.bookType="xla");case"biff8":a="/Workbook",r.biff=8;break;case"biff5":a="/Book",r.biff=5;break;default:throw new Error("invalid type "+r.bookType+" for XLS CFB")}return br.utils.cfb_add(n,a,YY(e,r)),r.biff==8&&(e.Props||e.Custprops)&&dRe(e,n),r.biff==8&&e.vbaraw&&A6e(n,br.read(e.vbaraw,{type:typeof e.vbaraw=="string"?"binary":"buffer"})),n}var n1={0:{f:LDe},1:{f:VDe},2:{f:c8e},3:{f:JDe},4:{f:YDe},5:{f:s8e},6:{f:m8e},7:{f:r8e},8:{f:w8e},9:{f:b8e},10:{f:v8e},11:{f:y8e},12:{f:WDe},13:{f:d8e},14:{f:e8e},15:{f:XDe},16:{f:BY},17:{f:x8e},18:{f:a8e},19:{f:kE},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:xOe},40:{},42:{},43:{f:mTe},44:{f:fTe},45:{f:gTe},46:{f:yTe},47:{f:vTe},48:{},49:{f:Bke},50:{},51:{f:QTe},52:{T:1},53:{T:-1},54:{T:1},55:{T:-1},56:{T:1},57:{T:-1},58:{},59:{},60:{f:cY},62:{f:h8e},63:{f:l6e},64:{f:I8e},65:{},66:{},67:{},68:{},69:{},70:{},128:{},129:{T:1},130:{T:-1},131:{T:1,f:Ys,p:0},132:{T:-1},133:{T:1},134:{T:-1},135:{T:1},136:{T:-1},137:{T:1,f:O8e},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:$De},148:{f:BDe,p:16},151:{f:C8e},152:{},153:{f:hOe},154:{},155:{},156:{f:dOe},157:{},158:{},159:{T:1,f:EEe},160:{T:-1},161:{T:1,f:k0},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:j8e},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:ZTe},336:{T:-1},337:{f:r6e,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:ok},357:{},358:{},359:{},360:{T:1},361:{},362:{f:lY},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:_8e},427:{f:E8e},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:P8e},477:{},478:{},479:{T:1},480:{T:-1},481:{T:1},482:{T:-1},483:{T:1},484:{T:-1},485:{f:UDe},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:A8e},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:ok},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:y6e},633:{T:1},634:{T:-1},635:{T:1,f:g6e},636:{T:-1},637:{f:Hke},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:eOe},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:F8e},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:""}},pk={6:{f:s3},10:{f:rh},12:{f:wi},13:{f:wi},14:{f:li},15:{f:li},16:{f:Vs},17:{f:li},18:{f:li},19:{f:wi},20:{f:N7},21:{f:N7},23:{f:lY},24:{f:A7},25:{f:li},26:{},27:{},28:{f:F_e},29:{},34:{f:li},35:{f:S7},38:{f:Vs},39:{f:Vs},40:{f:Vs},41:{f:Vs},42:{f:li},43:{f:li},47:{f:XEe},49:{f:d_e},51:{f:wi},60:{},61:{f:s_e},64:{f:li},65:{f:u_e},66:{f:wi},77:{},80:{},81:{},82:{},85:{f:wi},89:{},90:{},91:{},92:{f:KCe},93:{f:U_e},94:{},95:{f:li},96:{},97:{},99:{f:li},125:{f:cY},128:{f:k_e},129:{f:ZCe},130:{f:wi},131:{f:li},132:{f:li},133:{f:JCe},134:{},140:{f:K_e},141:{f:wi},144:{},146:{f:J_e},151:{},152:{},153:{},154:{},155:{},156:{f:wi},157:{},158:{},160:{f:iEe},161:{f:tEe},174:{},175:{},176:{},177:{},178:{},180:{},181:{},182:{},184:{},185:{},189:{f:j_e},190:{f:N_e},193:{f:rh},197:{},198:{},199:{},200:{},201:{},202:{f:li},203:{},204:{},205:{},206:{},207:{},208:{},209:{},210:{},211:{},213:{},215:{},216:{},217:{},218:{f:wi},220:{},221:{f:li},222:{},224:{f:A_e},225:{f:YCe},226:{f:rh},227:{},229:{f:B_e},233:{},235:{},236:{},237:{},239:{},240:{},241:{},242:{},244:{},245:{},246:{},247:{},248:{},249:{},251:{},252:{f:e_e},253:{f:h_e},255:{f:r_e},256:{},259:{},290:{},311:{},312:{},315:{},317:{f:QG},318:{},319:{},320:{},330:{},331:{},333:{},334:{},335:{},336:{},337:{},338:{},339:{},340:{},351:{},352:{f:li},353:{f:rh},401:{},402:{},403:{},404:{},405:{},406:{},407:{},408:{},425:{},426:{},427:{},428:{},429:{},430:{f:P_e},431:{f:li},432:{},433:{},434:{},437:{},438:{f:V_e},439:{f:li},440:{f:q_e},441:{},442:{f:F1},443:{},444:{f:wi},445:{},446:{},448:{f:rh},449:{f:i_e,r:2},450:{f:rh},512:{f:b7},513:{f:aEe},515:{f:E_e},516:{f:p_e},517:{f:j7},519:{f:sEe},520:{f:n_e},523:{},545:{f:k7},549:{f:y7},566:{},574:{f:l_e},638:{f:w_e},659:{},1048:{},1054:{f:g_e},1084:{},1212:{f:M_e},2048:{f:G_e},2049:{},2050:{},2051:{},2052:{},2053:{},2054:{},2055:{},2056:{},2057:{f:Db},2058:{},2059:{},2060:{},2061:{},2062:{},2063:{},2064:{},2066:{},2067:{},2128:{},2129:{},2130:{},2131:{},2132:{},2133:{},2134:{},2135:{},2136:{},2137:{},2138:{},2146:{},2147:{r:12},2148:{},2149:{},2150:{},2151:{f:rh},2152:{},2154:{},2155:{},2156:{},2161:{},2162:{},2164:{},2165:{},2166:{},2167:{},2168:{},2169:{},2170:{},2171:{},2172:{f:Q_e,r:12},2173:{f:KTe,r:12},2174:{},2175:{},2180:{},2181:{},2182:{},2183:{},2184:{},2185:{},2186:{},2187:{},2188:{f:li,r:12},2189:{},2190:{r:12},2191:{},2192:{},2194:{},2195:{},2196:{f:R_e,r:12},2197:{},2198:{f:HTe,r:12},2199:{},2200:{},2201:{},2202:{f:L_e,r:12},2203:{f:rh},2204:{},2205:{},2206:{},2207:{},2211:{f:a_e},2212:{},2213:{},2214:{},2215:{},4097:{},4098:{},4099:{},4102:{},4103:{},4105:{},4106:{},4107:{},4108:{},4109:{},4116:{},4117:{},4118:{},4119:{},4120:{},4121:{},4122:{},4123:{},4124:{},4125:{},4126:{},4127:{},4128:{},4129:{},4130:{},4132:{},4133:{},4134:{f:wi},4135:{},4146:{},4147:{},4148:{},4149:{},4154:{},4156:{},4157:{},4158:{},4159:{},4160:{},4161:{},4163:{},4164:{f:rEe},4165:{},4166:{},4168:{},4170:{},4171:{},4174:{},4175:{},4176:{},4177:{},4187:{},4188:{f:Z_e},4189:{},4191:{},4192:{},4193:{},4194:{},4195:{},4196:{},4197:{},4198:{},4199:{},4200:{},0:{f:b7},1:{},2:{f:dEe},3:{f:cEe},4:{f:lEe},5:{f:j7},7:{f:hEe},8:{},9:{f:Db},11:{},22:{f:wi},30:{f:y_e},31:{},32:{},33:{f:k7},36:{},37:{f:y7},50:{f:mEe},62:{},52:{},67:{},68:{f:wi},69:{},86:{},126:{},127:{f:oEe},135:{},136:{},137:{},145:{},148:{},149:{},150:{},169:{},171:{},188:{},191:{},192:{},194:{},195:{},214:{f:pEe},223:{},234:{},354:{},421:{},518:{f:s3},521:{f:Db},536:{f:A7},547:{f:S7},561:{},579:{},1030:{f:s3},1033:{f:Db},1091:{},2157:{},2163:{},2177:{},2240:{},2241:{},2242:{},2243:{},2244:{},2245:{},2246:{},2247:{},2248:{},2249:{},2250:{},2251:{},2262:{r:12},29282:{}};function Yt(e,t,r,n){var a=t;if(!isNaN(a)){var s=n||(r||[]).length||0,o=e.next(4);o.write_shift(2,a),o.write_shift(2,s),s>0&&NE(r)&&e.push(r)}}function hRe(e,t,r,n){var a=(r||[]).length||0;if(a<=8224)return Yt(e,t,r,a);var s=t;if(!isNaN(s)){for(var o=r.parts||[],l=0,u=0,d=0;d+(o[l]||8224)<=8224;)d+=o[l]||8224,l++;var f=e.next(4);for(f.write_shift(2,s),f.write_shift(2,d),e.push(r.slice(u,u+d)),u+=d;u<a;){for(f=e.next(4),f.write_shift(2,60),d=0;d+(o[l]||8224)<=8224;)d+=o[l]||8224,l++;f.write_shift(2,d),e.push(r.slice(u,u+d)),u+=d}}}function $1(e,t,r){return e||(e=St(7)),e.write_shift(2,t),e.write_shift(2,r),e.write_shift(2,0),e.write_shift(1,0),e}function mRe(e,t,r,n){var a=St(9);return $1(a,e,t),eY(r,n||"b",a),a}function pRe(e,t,r){var n=St(8+2*r.length);return $1(n,e,t),n.write_shift(1,r.length),n.write_shift(r.length,r,"sbcs"),n.l<n.length?n.slice(0,n.l):n}function xRe(e,t,r,n){if(t.v!=null)switch(t.t){case"d":case"n":var a=t.t=="d"?Hi(ja(t.v)):t.v;a==(a|0)&&a>=0&&a<65536?Yt(e,2,fEe(r,n,a)):Yt(e,3,uEe(r,n,a));return;case"b":case"e":Yt(e,5,mRe(r,n,t.v,t.t));return;case"s":case"str":Yt(e,4,pRe(r,n,(t.v||"").slice(0,255)));return}Yt(e,1,$1(null,r,n))}function gRe(e,t,r,n){var a=Array.isArray(t),s=yn(t["!ref"]||"A1"),o,l="",u=[];if(s.e.c>255||s.e.r>16383){if(n.WTF)throw new Error("Range "+(t["!ref"]||"A1")+" exceeds format limit A1:IV16384");s.e.c=Math.min(s.e.c,255),s.e.r=Math.min(s.e.c,16383),o=zr(s)}for(var d=s.s.r;d<=s.e.r;++d){l=hi(d);for(var f=s.s.c;f<=s.e.c;++f){d===s.s.r&&(u[f]=Ia(f)),o=u[f]+l;var m=a?(t[d]||[])[f]:t[o];m&&xRe(e,m,d,f)}}}function vRe(e,t){for(var r=t||{},n=Uo(),a=0,s=0;s<e.SheetNames.length;++s)e.SheetNames[s]==r.sheet&&(a=s);if(a==0&&r.sheet&&e.SheetNames[0]!=r.sheet)throw new Error("Sheet not found: "+r.sheet);return Yt(n,r.biff==4?1033:r.biff==3?521:9,OE(e,16,r)),gRe(n,e.Sheets[e.SheetNames[a]],a,r),Yt(n,10),n.end()}function yRe(e,t,r){Yt(e,49,f_e({sz:12,name:"Arial"},r))}function bRe(e,t,r){t&&[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var a=n[0];a<=n[1];++a)t[a]!=null&&Yt(e,1054,v_e(a,t[a],r))})}function wRe(e,t){var r=St(19);r.write_shift(4,2151),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(2,3),r.write_shift(1,1),r.write_shift(4,0),Yt(e,2151,r),r=St(39),r.write_shift(4,2152),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(2,3),r.write_shift(1,0),r.write_shift(4,0),r.write_shift(2,1),r.write_shift(4,4),r.write_shift(2,0),iY(yn(t["!ref"]||"A1"),r),r.write_shift(4,4),Yt(e,2152,r)}function jRe(e,t){for(var r=0;r<16;++r)Yt(e,224,w7({numFmtId:0,style:!0},0,t));t.cellXfs.forEach(function(n){Yt(e,224,w7(n,0,t))})}function NRe(e,t){for(var r=0;r<t["!links"].length;++r){var n=t["!links"][r];Yt(e,440,W_e(n)),n[1].Tooltip&&Yt(e,2048,Y_e(n))}delete t["!links"]}function SRe(e,t){if(t){var r=0;t.forEach(function(n,a){++r<=256&&n&&Yt(e,125,eEe(rj(a,n),a))})}}function ARe(e,t,r,n,a){var s=16+Hh(a.cellXfs,t,a);if(t.v==null&&!t.bf){Yt(e,513,h0(r,n,s));return}if(t.bf)Yt(e,6,ZPe(t,r,n,a,s));else switch(t.t){case"d":case"n":var o=t.t=="d"?Hi(ja(t.v)):t.v;Yt(e,515,T_e(r,n,o,s));break;case"b":case"e":Yt(e,517,__e(r,n,t.v,s,a,t.t));break;case"s":case"str":if(a.bookSST){var l=UE(a.Strings,t.v,a.revStrings);Yt(e,253,m_e(r,n,l,s))}else Yt(e,516,x_e(r,n,(t.v||"").slice(0,255),s,a));break;default:Yt(e,513,h0(r,n,s))}}function kRe(e,t,r){var n=Uo(),a=r.SheetNames[e],s=r.Sheets[a]||{},o=(r||{}).Workbook||{},l=(o.Sheets||[])[e]||{},u=Array.isArray(s),d=t.biff==8,f,m="",g=[],x=yn(s["!ref"]||"A1"),y=d?65536:16384;if(x.e.c>255||x.e.r>=y){if(t.WTF)throw new Error("Range "+(s["!ref"]||"A1")+" exceeds format limit A1:IV16384");x.e.c=Math.min(x.e.c,255),x.e.r=Math.min(x.e.c,y-1)}Yt(n,2057,OE(r,16,t)),Yt(n,13,Bl(1)),Yt(n,12,Bl(100)),Yt(n,15,ao(!0)),Yt(n,17,ao(!1)),Yt(n,16,d0(.001)),Yt(n,95,ao(!0)),Yt(n,42,ao(!1)),Yt(n,43,ao(!1)),Yt(n,130,Bl(1)),Yt(n,128,C_e()),Yt(n,131,ao(!1)),Yt(n,132,ao(!1)),d&&SRe(n,s["!cols"]),Yt(n,512,b_e(x,t)),d&&(s["!links"]=[]);for(var v=x.s.r;v<=x.e.r;++v){m=hi(v);for(var w=x.s.c;w<=x.e.c;++w){v===x.s.r&&(g[w]=Ia(w)),f=g[w]+m;var j=u?(s[v]||[])[w]:s[f];j&&(ARe(n,j,v,w,t),d&&j.l&&s["!links"].push([f,j.l]))}}var k=l.CodeName||l.name||a;return d&&Yt(n,574,c_e((o.Views||[])[0])),d&&(s["!merges"]||[]).length&&Yt(n,229,z_e(s["!merges"])),d&&NRe(n,s),Yt(n,442,tY(k)),d&&wRe(n,s),Yt(n,10),n.end()}function CRe(e,t,r){var n=Uo(),a=(e||{}).Workbook||{},s=a.Sheets||[],o=a.WBProps||{},l=r.biff==8,u=r.biff==5;if(Yt(n,2057,OE(e,5,r)),r.bookType=="xla"&&Yt(n,135),Yt(n,225,l?Bl(1200):null),Yt(n,193,_Ce(2)),u&&Yt(n,191),u&&Yt(n,192),Yt(n,226),Yt(n,92,XCe("SheetJS",r)),Yt(n,66,Bl(l?1200:1252)),l&&Yt(n,353,Bl(0)),l&&Yt(n,448),Yt(n,317,nEe(e.SheetNames.length)),l&&e.vbaraw&&Yt(n,211),l&&e.vbaraw){var d=o.CodeName||"ThisWorkbook";Yt(n,442,tY(d))}Yt(n,156,Bl(17)),Yt(n,25,ao(!1)),Yt(n,18,ao(!1)),Yt(n,19,Bl(0)),l&&Yt(n,431,ao(!1)),l&&Yt(n,444,Bl(0)),Yt(n,61,o_e()),Yt(n,64,ao(!1)),Yt(n,141,Bl(0)),Yt(n,34,ao(iOe(e)=="true")),Yt(n,14,ao(!0)),l&&Yt(n,439,ao(!1)),Yt(n,218,Bl(0)),yRe(n,e,r),bRe(n,e.SSF,r),jRe(n,r),l&&Yt(n,352,ao(!1));var f=n.end(),m=Uo();l&&Yt(m,140,X_e()),l&&r.Strings&&hRe(m,252,t_e(r.Strings)),Yt(m,10);var g=m.end(),x=Uo(),y=0,v=0;for(v=0;v<e.SheetNames.length;++v)y+=(l?12:11)+(l?2:1)*e.SheetNames[v].length;var w=f.length+y+g.length;for(v=0;v<e.SheetNames.length;++v){var j=s[v]||{};Yt(x,133,QCe({pos:w,hs:j.Hidden||0,dt:0,name:e.SheetNames[v]},r)),w+=t[v].length}var k=x.end();if(y!=k.length)throw new Error("BS8 "+y+" != "+k.length);var A=[];return f.length&&A.push(f),k.length&&A.push(k),g.length&&A.push(g),os(A)}function _Re(e,t){var r=t||{},n=[];e&&!e.SSF&&(e.SSF=Na(Cr)),e&&e.SSF&&(Fx(),K5(e.SSF),r.revssf=Z5(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF),r.Strings=[],r.Strings.Count=0,r.Strings.Unique=0,WE(r),r.cellXfs=[],Hh(r.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={});for(var a=0;a<e.SheetNames.length;++a)n[n.length]=kRe(a,r,e);return n.unshift(CRe(e,n,r)),os(n)}function YY(e,t){for(var r=0;r<=e.SheetNames.length;++r){var n=e.Sheets[e.SheetNames[r]];if(!(!n||!n["!ref"])){var a=$o(n["!ref"]);a.e.c>255&&typeof console<"u"&&console.error&&console.error("Worksheet '"+e.SheetNames[r]+"' extends beyond column IV (255).  Data may be lost.")}}var s=t||{};switch(s.biff||2){case 8:case 5:return _Re(e,t);case 4:case 3:case 2:return vRe(e,t)}throw new Error("invalid type "+s.bookType+" for BIFF")}function L7(e,t){var r=t||{},n=r.dense?[]:{};e=e.replace(/<!--.*?-->/g,"");var a=e.match(/<table/i);if(!a)throw new Error("Invalid HTML: could not find <table>");var s=e.match(/<\/table/i),o=a.index,l=s&&s.index||e.length,u=fke(e.slice(o,l),/(:?<tr[^>]*>)/i,"<tr>"),d=-1,f=0,m=0,g=0,x={s:{r:1e7,c:1e7},e:{r:0,c:0}},y=[];for(o=0;o<u.length;++o){var v=u[o].trim(),w=v.slice(0,3).toLowerCase();if(w=="<tr"){if(++d,r.sheetRows&&r.sheetRows<=d){--d;break}f=0;continue}if(!(w!="<td"&&w!="<th")){var j=v.split(/<\/t[dh]>/i);for(l=0;l<j.length;++l){var k=j[l].trim();if(k.match(/<t[dh]/i)){for(var A=k,T=0;A.charAt(0)=="<"&&(T=A.indexOf(">"))>-1;)A=A.slice(T+1);for(var M=0;M<y.length;++M){var B=y[M];B.s.c==f&&B.s.r<d&&d<=B.e.r&&(f=B.e.c+1,M=-1)}var L=Tr(k.slice(0,k.indexOf(">")));g=L.colspan?+L.colspan:1,((m=+L.rowspan)>1||g>1)&&y.push({s:{r:d,c:f},e:{r:d+(m||1)-1,c:f+g-1}});var F=L.t||L["data-t"]||"";if(!A.length){f+=g;continue}if(A=vG(A),x.s.r>d&&(x.s.r=d),x.e.r<d&&(x.e.r=d),x.s.c>f&&(x.s.c=f),x.e.c<f&&(x.e.c=f),!A.length){f+=g;continue}var I={t:"s",v:A};r.raw||!A.trim().length||F=="s"||(A==="TRUE"?I={t:"b",v:!0}:A==="FALSE"?I={t:"b",v:!1}:isNaN(Pc(A))?isNaN(px(A).getDate())||(I={t:"d",v:ja(A)},r.cellDates||(I={t:"n",v:Hi(I.v)}),I.z=r.dateNF||Cr[14]):I={t:"n",v:Pc(A)}),r.dense?(n[d]||(n[d]=[]),n[d][f]=I):n[_r({r:d,c:f})]=I,f+=g}}}}return n["!ref"]=zr(x),y.length&&(n["!merges"]=y),n}function ERe(e,t,r,n){for(var a=e["!merges"]||[],s=[],o=t.s.c;o<=t.e.c;++o){for(var l=0,u=0,d=0;d<a.length;++d)if(!(a[d].s.r>r||a[d].s.c>o)&&!(a[d].e.r<r||a[d].e.c<o)){if(a[d].s.r<r||a[d].s.c<o){l=-1;break}l=a[d].e.r-a[d].s.r+1,u=a[d].e.c-a[d].s.c+1;break}if(!(l<0)){var f=_r({r,c:o}),m=n.dense?(e[r]||[])[o]:e[f],g=m&&m.v!=null&&(m.h||bE(m.w||(nf(m),m.w)||""))||"",x={};l>1&&(x.rowspan=l),u>1&&(x.colspan=u),n.editable?g='<span contenteditable="true">'+g+"</span>":m&&(x["data-t"]=m&&m.t||"z",m.v!=null&&(x["data-v"]=m.v),m.z!=null&&(x["data-z"]=m.z),m.l&&(m.l.Target||"#").charAt(0)!="#"&&(g='<a href="'+m.l.Target+'">'+g+"</a>")),x.id=(n.id||"sjs")+"-"+f,s.push(Wt("td",g,x))}}var y="<tr>";return y+s.join("")+"</tr>"}var TRe='<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body>',PRe="</body></html>";function DRe(e,t){var r=e.match(/<table[\s\S]*?>[\s\S]*?<\/table>/gi);if(!r||r.length==0)throw new Error("Invalid HTML: could not find <table>");if(r.length==1)return $h(L7(r[0],t),t);var n=KE();return r.forEach(function(a,s){XE(n,L7(a,t),"Sheet"+(s+1))}),n}function ORe(e,t,r){var n=[];return n.join("")+"<table"+(r&&r.id?' id="'+r.id+'"':"")+">"}function KY(e,t){var r=t||{},n=r.header!=null?r.header:TRe,a=r.footer!=null?r.footer:PRe,s=[n],o=$o(e["!ref"]);r.dense=Array.isArray(e),s.push(ORe(e,o,r));for(var l=o.s.r;l<=o.e.r;++l)s.push(ERe(e,o,l,r));return s.push("</table>"+a),s.join("")}function XY(e,t,r){var n=r||{},a=0,s=0;if(n.origin!=null)if(typeof n.origin=="number")a=n.origin;else{var o=typeof n.origin=="string"?Fa(n.origin):n.origin;a=o.r,s=o.c}var l=t.getElementsByTagName("tr"),u=Math.min(n.sheetRows||1e7,l.length),d={s:{r:0,c:0},e:{r:a,c:s}};if(e["!ref"]){var f=$o(e["!ref"]);d.s.r=Math.min(d.s.r,f.s.r),d.s.c=Math.min(d.s.c,f.s.c),d.e.r=Math.max(d.e.r,f.e.r),d.e.c=Math.max(d.e.c,f.e.c),a==-1&&(d.e.r=a=f.e.r+1)}var m=[],g=0,x=e["!rows"]||(e["!rows"]=[]),y=0,v=0,w=0,j=0,k=0,A=0;for(e["!cols"]||(e["!cols"]=[]);y<l.length&&v<u;++y){var T=l[y];if(I7(T)){if(n.display)continue;x[v]={hidden:!0}}var M=T.children;for(w=j=0;w<M.length;++w){var B=M[w];if(!(n.display&&I7(B))){var L=B.hasAttribute("data-v")?B.getAttribute("data-v"):B.hasAttribute("v")?B.getAttribute("v"):vG(B.innerHTML),F=B.getAttribute("data-z")||B.getAttribute("z");for(g=0;g<m.length;++g){var I=m[g];I.s.c==j+s&&I.s.r<v+a&&v+a<=I.e.r&&(j=I.e.c+1-s,g=-1)}A=+B.getAttribute("colspan")||1,((k=+B.getAttribute("rowspan")||1)>1||A>1)&&m.push({s:{r:v+a,c:j+s},e:{r:v+a+(k||1)-1,c:j+s+(A||1)-1}});var q={t:"s",v:L},P=B.getAttribute("data-t")||B.getAttribute("t")||"";L!=null&&(L.length==0?q.t=P||"z":n.raw||L.trim().length==0||P=="s"||(L==="TRUE"?q={t:"b",v:!0}:L==="FALSE"?q={t:"b",v:!1}:isNaN(Pc(L))?isNaN(px(L).getDate())||(q={t:"d",v:ja(L)},n.cellDates||(q={t:"n",v:Hi(q.v)}),q.z=n.dateNF||Cr[14]):q={t:"n",v:Pc(L)})),q.z===void 0&&F!=null&&(q.z=F);var R="",K=B.getElementsByTagName("A");if(K&&K.length)for(var ee=0;ee<K.length&&!(K[ee].hasAttribute("href")&&(R=K[ee].getAttribute("href"),R.charAt(0)!="#"));++ee);R&&R.charAt(0)!="#"&&(q.l={Target:R}),n.dense?(e[v+a]||(e[v+a]=[]),e[v+a][j+s]=q):e[_r({c:j+s,r:v+a})]=q,d.e.c<j+s&&(d.e.c=j+s),j+=A}}++v}return m.length&&(e["!merges"]=(e["!merges"]||[]).concat(m)),d.e.r=Math.max(d.e.r,v-1+a),e["!ref"]=zr(d),v>=u&&(e["!fullref"]=zr((d.e.r=l.length-y+v-1+a,d))),e}function ZY(e,t){var r=t||{},n=r.dense?[]:{};return XY(n,e,t)}function RRe(e,t){return $h(ZY(e,t),t)}function I7(e){var t="",r=MRe(e);return r&&(t=r(e).getPropertyValue("display")),t||(t=e.style&&e.style.display),t==="none"}function MRe(e){return e.ownerDocument.defaultView&&typeof e.ownerDocument.defaultView.getComputedStyle=="function"?e.ownerDocument.defaultView.getComputedStyle:typeof getComputedStyle=="function"?getComputedStyle:null}function LRe(e){var t=e.replace(/[\t\r\n]/g," ").trim().replace(/ +/g," ").replace(/<text:s\/>/g," ").replace(/<text:s text:c="(\d+)"\/>/g,function(n,a){return Array(parseInt(a,10)+1).join(" ")}).replace(/<text:tab[^>]*\/>/g,"	").replace(/<text:line-break\/>/g,`
`),r=vn(t.replace(/<[^>]*>/g,""));return[r]}var F7={day:["d","dd"],month:["m","mm"],year:["y","yy"],hours:["h","hh"],minutes:["m","mm"],seconds:["s","ss"],"am-pm":["A/P","AM/PM"],"day-of-week":["ddd","dddd"],era:["e","ee"],quarter:["\\Qm",'m\\"th quarter"']};function JY(e,t){var r=t||{},n=wE(e),a=[],s,o,l={name:""},u="",d=0,f,m,g={},x=[],y=r.dense?[]:{},v,w,j={value:""},k="",A=0,T=[],M=-1,B=-1,L={s:{r:1e6,c:1e7},e:{r:0,c:0}},F=0,I={},q=[],P={},R=0,K=0,ee=[],se=1,Z=1,ne=[],X={Names:[]},le={},Ae=["",""],ce=[],D={},H="",G=0,E=!1,re=!1,he=0;for(Zv.lastIndex=0,n=n.replace(/<!--([\s\S]*?)-->/mg,"").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm,"");v=Zv.exec(n);)switch(v[3]=v[3].replace(/_.*$/,"")){case"table":case"工作表":v[1]==="/"?(L.e.c>=L.s.c&&L.e.r>=L.s.r?y["!ref"]=zr(L):y["!ref"]="A1:A1",r.sheetRows>0&&r.sheetRows<=L.e.r&&(y["!fullref"]=y["!ref"],L.e.r=r.sheetRows-1,y["!ref"]=zr(L)),q.length&&(y["!merges"]=q),ee.length&&(y["!rows"]=ee),f.name=f.名称||f.name,typeof JSON<"u"&&JSON.stringify(f),x.push(f.name),g[f.name]=y,re=!1):v[0].charAt(v[0].length-2)!=="/"&&(f=Tr(v[0],!1),M=B=-1,L.s.r=L.s.c=1e7,L.e.r=L.e.c=0,y=r.dense?[]:{},q=[],ee=[],re=!0);break;case"table-row-group":v[1]==="/"?--F:++F;break;case"table-row":case"行":if(v[1]==="/"){M+=se,se=1;break}if(m=Tr(v[0],!1),m.行号?M=m.行号-1:M==-1&&(M=0),se=+m["number-rows-repeated"]||1,se<10)for(he=0;he<se;++he)F>0&&(ee[M+he]={level:F});B=-1;break;case"covered-table-cell":v[1]!=="/"&&++B,r.sheetStubs&&(r.dense?(y[M]||(y[M]=[]),y[M][B]={t:"z"}):y[_r({r:M,c:B})]={t:"z"}),k="",T=[];break;case"table-cell":case"数据":if(v[0].charAt(v[0].length-2)==="/")++B,j=Tr(v[0],!1),Z=parseInt(j["number-columns-repeated"]||"1",10),w={t:"z",v:null},j.formula&&r.cellFormula!=!1&&(w.f=O7(vn(j.formula))),(j.数据类型||j["value-type"])=="string"&&(w.t="s",w.v=vn(j["string-value"]||""),r.dense?(y[M]||(y[M]=[]),y[M][B]=w):y[_r({r:M,c:B})]=w),B+=Z-1;else if(v[1]!=="/"){++B,k="",A=0,T=[],Z=1;var oe=se?M+se-1:M;if(B>L.e.c&&(L.e.c=B),B<L.s.c&&(L.s.c=B),M<L.s.r&&(L.s.r=M),oe>L.e.r&&(L.e.r=oe),j=Tr(v[0],!1),ce=[],D={},w={t:j.数据类型||j["value-type"],v:null},r.cellFormula)if(j.formula&&(j.formula=vn(j.formula)),j["number-matrix-columns-spanned"]&&j["number-matrix-rows-spanned"]&&(R=parseInt(j["number-matrix-rows-spanned"],10)||0,K=parseInt(j["number-matrix-columns-spanned"],10)||0,P={s:{r:M,c:B},e:{r:M+R-1,c:B+K-1}},w.F=zr(P),ne.push([P,w.F])),j.formula)w.f=O7(j.formula);else for(he=0;he<ne.length;++he)M>=ne[he][0].s.r&&M<=ne[he][0].e.r&&B>=ne[he][0].s.c&&B<=ne[he][0].e.c&&(w.F=ne[he][1]);switch((j["number-columns-spanned"]||j["number-rows-spanned"])&&(R=parseInt(j["number-rows-spanned"],10)||0,K=parseInt(j["number-columns-spanned"],10)||0,P={s:{r:M,c:B},e:{r:M+R-1,c:B+K-1}},q.push(P)),j["number-columns-repeated"]&&(Z=parseInt(j["number-columns-repeated"],10)),w.t){case"boolean":w.t="b",w.v=ya(j["boolean-value"]);break;case"float":w.t="n",w.v=parseFloat(j.value);break;case"percentage":w.t="n",w.v=parseFloat(j.value);break;case"currency":w.t="n",w.v=parseFloat(j.value);break;case"date":w.t="d",w.v=ja(j["date-value"]),r.cellDates||(w.t="n",w.v=Hi(w.v)),w.z="m/d/yy";break;case"time":w.t="n",w.v=cke(j["time-value"])/86400,r.cellDates&&(w.t="d",w.v=J5(w.v)),w.z="HH:MM:SS";break;case"number":w.t="n",w.v=parseFloat(j.数据数值);break;default:if(w.t==="string"||w.t==="text"||!w.t)w.t="s",j["string-value"]!=null&&(k=vn(j["string-value"]),T=[]);else throw new Error("Unsupported value type "+w.t)}}else{if(E=!1,w.t==="s"&&(w.v=k||"",T.length&&(w.R=T),E=A==0),le.Target&&(w.l=le),ce.length>0&&(w.c=ce,ce=[]),k&&r.cellText!==!1&&(w.w=k),E&&(w.t="z",delete w.v),(!E||r.sheetStubs)&&!(r.sheetRows&&r.sheetRows<=M))for(var z=0;z<se;++z){if(Z=parseInt(j["number-columns-repeated"]||"1",10),r.dense)for(y[M+z]||(y[M+z]=[]),y[M+z][B]=z==0?w:Na(w);--Z>0;)y[M+z][B+Z]=Na(w);else for(y[_r({r:M+z,c:B})]=w;--Z>0;)y[_r({r:M+z,c:B+Z})]=Na(w);L.e.c<=B&&(L.e.c=B)}Z=parseInt(j["number-columns-repeated"]||"1",10),B+=Z-1,Z=0,w={},k="",T=[]}le={};break;case"document":case"document-content":case"电子表格文档":case"spreadsheet":case"主体":case"scripts":case"styles":case"font-face-decls":case"master-styles":if(v[1]==="/"){if((s=a.pop())[0]!==v[3])throw"Bad state: "+s}else v[0].charAt(v[0].length-2)!=="/"&&a.push([v[3],!0]);break;case"annotation":if(v[1]==="/"){if((s=a.pop())[0]!==v[3])throw"Bad state: "+s;D.t=k,T.length&&(D.R=T),D.a=H,ce.push(D)}else v[0].charAt(v[0].length-2)!=="/"&&a.push([v[3],!1]);H="",G=0,k="",A=0,T=[];break;case"creator":v[1]==="/"?H=n.slice(G,v.index):G=v.index+v[0].length;break;case"meta":case"元数据":case"settings":case"config-item-set":case"config-item-map-indexed":case"config-item-map-entry":case"config-item-map-named":case"shapes":case"frame":case"text-box":case"image":case"data-pilot-tables":case"list-style":case"form":case"dde-links":case"event-listeners":case"chart":if(v[1]==="/"){if((s=a.pop())[0]!==v[3])throw"Bad state: "+s}else v[0].charAt(v[0].length-2)!=="/"&&a.push([v[3],!1]);k="",A=0,T=[];break;case"scientific-number":break;case"currency-symbol":break;case"currency-style":break;case"number-style":case"percentage-style":case"date-style":case"time-style":if(v[1]==="/"){if(I[l.name]=u,(s=a.pop())[0]!==v[3])throw"Bad state: "+s}else v[0].charAt(v[0].length-2)!=="/"&&(u="",l=Tr(v[0],!1),a.push([v[3],!0]));break;case"script":break;case"libraries":break;case"automatic-styles":break;case"default-style":case"page-layout":break;case"style":break;case"map":break;case"font-face":break;case"paragraph-properties":break;case"table-properties":break;case"table-column-properties":break;case"table-row-properties":break;case"table-cell-properties":break;case"number":switch(a[a.length-1][0]){case"time-style":case"date-style":o=Tr(v[0],!1),u+=F7[v[3]][o.style==="long"?1:0];break}break;case"fraction":break;case"day":case"month":case"year":case"era":case"day-of-week":case"week-of-year":case"quarter":case"hours":case"minutes":case"seconds":case"am-pm":switch(a[a.length-1][0]){case"time-style":case"date-style":o=Tr(v[0],!1),u+=F7[v[3]][o.style==="long"?1:0];break}break;case"boolean-style":break;case"boolean":break;case"text-style":break;case"text":if(v[0].slice(-2)==="/>")break;if(v[1]==="/")switch(a[a.length-1][0]){case"number-style":case"date-style":case"time-style":u+=n.slice(d,v.index);break}else d=v.index+v[0].length;break;case"named-range":o=Tr(v[0],!1),Ae=o3(o["cell-range-address"]);var fe={Name:o.name,Ref:Ae[0]+"!"+Ae[1]};re&&(fe.Sheet=x.length),X.Names.push(fe);break;case"text-content":break;case"text-properties":break;case"embedded-text":break;case"body":case"电子表格":break;case"forms":break;case"table-column":break;case"table-header-rows":break;case"table-rows":break;case"table-column-group":break;case"table-header-columns":break;case"table-columns":break;case"null-date":break;case"graphic-properties":break;case"calculation-settings":break;case"named-expressions":break;case"label-range":break;case"label-ranges":break;case"named-expression":break;case"sort":break;case"sort-by":break;case"sort-groups":break;case"tab":break;case"line-break":break;case"span":break;case"p":case"文本串":if(["master-styles"].indexOf(a[a.length-1][0])>-1)break;if(v[1]==="/"&&(!j||!j["string-value"])){var de=LRe(n.slice(A,v.index));k=(k.length>0?k+`
`:"")+de[0]}else Tr(v[0],!1),A=v.index+v[0].length;break;case"s":break;case"database-range":if(v[1]==="/")break;try{Ae=o3(Tr(v[0])["target-range-address"]),g[Ae[0]]["!autofilter"]={ref:Ae[1]}}catch{}break;case"date":break;case"object":break;case"title":case"标题":break;case"desc":break;case"binary-data":break;case"table-source":break;case"scenario":break;case"iteration":break;case"content-validations":break;case"content-validation":break;case"help-message":break;case"error-message":break;case"database-ranges":break;case"filter":break;case"filter-and":break;case"filter-or":break;case"filter-condition":break;case"list-level-style-bullet":break;case"list-level-style-number":break;case"list-level-properties":break;case"sender-firstname":case"sender-lastname":case"sender-initials":case"sender-title":case"sender-position":case"sender-email":case"sender-phone-private":case"sender-fax":case"sender-company":case"sender-phone-work":case"sender-street":case"sender-city":case"sender-postal-code":case"sender-country":case"sender-state-or-province":case"author-name":case"author-initials":case"chapter":case"file-name":case"template-name":case"sheet-name":break;case"event-listener":break;case"initial-creator":case"creation-date":case"print-date":case"generator":case"document-statistic":case"user-defined":case"editing-duration":case"editing-cycles":break;case"config-item":break;case"page-number":break;case"page-count":break;case"time":break;case"cell-range-source":break;case"detective":break;case"operation":break;case"highlighted-range":break;case"data-pilot-table":case"source-cell-range":case"source-service":case"data-pilot-field":case"data-pilot-level":case"data-pilot-subtotals":case"data-pilot-subtotal":case"data-pilot-members":case"data-pilot-member":case"data-pilot-display-info":case"data-pilot-sort-info":case"data-pilot-layout-info":case"data-pilot-field-reference":case"data-pilot-groups":case"data-pilot-group":case"data-pilot-group-member":break;case"rect":break;case"dde-connection-decls":case"dde-connection-decl":case"dde-link":case"dde-source":break;case"properties":break;case"property":break;case"a":if(v[1]!=="/"){if(le=Tr(v[0],!1),!le.href)break;le.Target=vn(le.href),delete le.href,le.Target.charAt(0)=="#"&&le.Target.indexOf(".")>-1?(Ae=o3(le.Target.slice(1)),le.Target="#"+Ae[0]+"!"+Ae[1]):le.Target.match(/^\.\.[\\\/]/)&&(le.Target=le.Target.slice(3))}break;case"table-protection":break;case"data-pilot-grand-total":break;case"office-document-common-attrs":break;default:switch(v[2]){case"dc:":case"calcext:":case"loext:":case"ooo:":case"chartooo:":case"draw:":case"style:":case"chart:":case"form:":case"uof:":case"表:":case"字:":break;default:if(r.WTF)throw new Error(v)}}var W={Sheets:g,SheetNames:x,Workbook:X};return r.bookSheets&&delete W.Sheets,W}function B7(e,t){t=t||{},Fl(e,"META-INF/manifest.xml")&&cCe(bi(e,"META-INF/manifest.xml"),t);var r=ul(e,"content.xml");if(!r)throw new Error("Missing content.xml in ODS / UOF file");var n=JY(Xn(r),t);return Fl(e,"meta.xml")&&(n.Props=$G(bi(e,"meta.xml"))),n}function z7(e,t){return JY(e,t)}var IRe=(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 "+Xv({"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 pi+t}})(),U7=(function(){var e=function(s){return Vn(s).replace(/  +/g,function(o){return'<text:s text:c="'+o.length+'"/>'}).replace(/\t/g,"<text:tab/>").replace(/\n/g,"</text:p><text:p>").replace(/^ /,"<text:s/>").replace(/ $/,"<text:s/>")},t=`          <table:table-cell />
`,r=`          <table:covered-table-cell/>
`,n=function(s,o,l){var u=[];u.push('      <table:table table:name="'+Vn(o.SheetNames[l])+`" table:style-name="ta1">
`);var d=0,f=0,m=$o(s["!ref"]||"A1"),g=s["!merges"]||[],x=0,y=Array.isArray(s);if(s["!cols"])for(f=0;f<=m.e.c;++f)u.push("        <table:table-column"+(s["!cols"][f]?' table:style-name="co'+s["!cols"][f].ods+'"':"")+`></table:table-column>
`);var v="",w=s["!rows"]||[];for(d=0;d<m.s.r;++d)v=w[d]?' table:style-name="ro'+w[d].ods+'"':"",u.push("        <table:table-row"+v+`></table:table-row>
`);for(;d<=m.e.r;++d){for(v=w[d]?' table:style-name="ro'+w[d].ods+'"':"",u.push("        <table:table-row"+v+`>
`),f=0;f<m.s.c;++f)u.push(t);for(;f<=m.e.c;++f){var j=!1,k={},A="";for(x=0;x!=g.length;++x)if(!(g[x].s.c>f)&&!(g[x].s.r>d)&&!(g[x].e.c<f)&&!(g[x].e.r<d)){(g[x].s.c!=f||g[x].s.r!=d)&&(j=!0),k["table:number-columns-spanned"]=g[x].e.c-g[x].s.c+1,k["table:number-rows-spanned"]=g[x].e.r-g[x].s.r+1;break}if(j){u.push(r);continue}var T=_r({r:d,c:f}),M=y?(s[d]||[])[f]:s[T];if(M&&M.f&&(k["table:formula"]=Vn(nDe(M.f)),M.F&&M.F.slice(0,T.length)==T)){var B=$o(M.F);k["table:number-matrix-columns-spanned"]=B.e.c-B.s.c+1,k["table:number-matrix-rows-spanned"]=B.e.r-B.s.r+1}if(!M){u.push(t);continue}switch(M.t){case"b":A=M.v?"TRUE":"FALSE",k["office:value-type"]="boolean",k["office:boolean-value"]=M.v?"true":"false";break;case"n":A=M.w||String(M.v||0),k["office:value-type"]="float",k["office:value"]=M.v||0;break;case"s":case"str":A=M.v==null?"":M.v,k["office:value-type"]="string";break;case"d":A=M.w||ja(M.v).toISOString(),k["office:value-type"]="date",k["office:date-value"]=ja(M.v).toISOString(),k["table:style-name"]="ce1";break;default:u.push(t);continue}var L=e(A);if(M.l&&M.l.Target){var F=M.l.Target;F=F.charAt(0)=="#"?"#"+aDe(F.slice(1)):F,F.charAt(0)!="#"&&!F.match(/^\w+:/)&&(F="../"+F),L=Wt("text:a",L,{"xlink:href":F.replace(/&/g,"&amp;")})}u.push("          "+Wt("table:table-cell",Wt("text:p",L,{}),k)+`
`)}u.push(`        </table:table-row>
`)}return u.push(`      </table:table>
`),u.join("")},a=function(s,o){s.push(` <office:automatic-styles>
`),s.push(`  <number:date-style style:name="N37" number:automatic-order="true">
`),s.push(`   <number:month number:style="long"/>
`),s.push(`   <number:text>/</number:text>
`),s.push(`   <number:day number:style="long"/>
`),s.push(`   <number:text>/</number:text>
`),s.push(`   <number:year/>
`),s.push(`  </number:date-style>
`);var l=0;o.SheetNames.map(function(d){return o.Sheets[d]}).forEach(function(d){if(d&&d["!cols"]){for(var f=0;f<d["!cols"].length;++f)if(d["!cols"][f]){var m=d["!cols"][f];if(m.width==null&&m.wpx==null&&m.wch==null)continue;Eh(m),m.ods=l;var g=d["!cols"][f].wpx+"px";s.push('  <style:style style:name="co'+l+`" style:family="table-column">
`),s.push('   <style:table-column-properties fo:break-before="auto" style:column-width="'+g+`"/>
`),s.push(`  </style:style>
`),++l}}});var u=0;o.SheetNames.map(function(d){return o.Sheets[d]}).forEach(function(d){if(d&&d["!rows"]){for(var f=0;f<d["!rows"].length;++f)if(d["!rows"][f]){d["!rows"][f].ods=u;var m=d["!rows"][f].hpx+"px";s.push('  <style:style style:name="ro'+u+`" style:family="table-row">
`),s.push('   <style:table-row-properties fo:break-before="auto" style:row-height="'+m+`"/>
`),s.push(`  </style:style>
`),++u}}}),s.push(`  <style:style style:name="ta1" style:family="table" style:master-page-name="mp1">
`),s.push(`   <style:table-properties table:display="true" style:writing-mode="lr-tb"/>
`),s.push(`  </style:style>
`),s.push(`  <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>
`),s.push(` </office:automatic-styles>
`)};return function(o,l){var u=[pi],d=Xv({"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"}),f=Xv({"xmlns:config":"urn:oasis:names:tc:opendocument:xmlns:config:1.0","office:mimetype":"application/vnd.oasis.opendocument.spreadsheet"});l.bookType=="fods"?(u.push("<office:document"+d+f+`>
`),u.push(UG().replace(/office:document-meta/g,"office:meta"))):u.push("<office:document-content"+d+`>
`),a(u,o),u.push(`  <office:body>
`),u.push(`    <office:spreadsheet>
`);for(var m=0;m!=o.SheetNames.length;++m)u.push(n(o.Sheets[o.SheetNames[m]],o,m));return u.push(`    </office:spreadsheet>
`),u.push(`  </office:body>
`),l.bookType=="fods"?u.push("</office:document>"):u.push("</office:document-content>"),u.join("")}})();function QY(e,t){if(t.bookType=="fods")return U7(e,t);var r=gE(),n="",a=[],s=[];return n="mimetype",Hr(r,n,"application/vnd.oasis.opendocument.spreadsheet"),n="content.xml",Hr(r,n,U7(e,t)),a.push([n,"text/xml"]),s.push([n,"ContentFile"]),n="styles.xml",Hr(r,n,IRe(e,t)),a.push([n,"text/xml"]),s.push([n,"StylesFile"]),n="meta.xml",Hr(r,n,pi+UG()),a.push([n,"text/xml"]),s.push([n,"MetadataFile"]),n="manifest.rdf",Hr(r,n,fCe(s)),a.push([n,"application/rdf+xml"]),n="META-INF/manifest.xml",Hr(r,n,uCe(a)),r}/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */function m0(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function xk(e){return typeof TextDecoder<"u"?new TextDecoder().decode(e):Xn(Uh(e))}function FRe(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):cl(Mu(e))}function BRe(e,t){e:for(var r=0;r<=e.length-t.length;++r){for(var n=0;n<t.length;++n)if(e[r+n]!=t[n])continue e;return!0}return!1}function Ph(e){var t=e.reduce(function(a,s){return a+s.length},0),r=new Uint8Array(t),n=0;return e.forEach(function(a){r.set(a,n),n+=a.length}),r}function $7(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>>24}function zRe(e,t){for(var r=(e[t+15]&127)<<7|e[t+14]>>1,n=e[t+14]&1,a=t+13;a>=t;--a)n=n*256+e[a];return(e[t+15]&128?-n:n)*Math.pow(10,r-6176)}function URe(e,t,r){var n=Math.floor(r==0?0:Math.LOG10E*Math.log(Math.abs(r)))+6176-20,a=r/Math.pow(10,n-6176);e[t+15]|=n>>7,e[t+14]|=(n&127)<<1;for(var s=0;a>=1;++s,a/=256)e[t+s]=a&255;e[t+15]|=r>=0?0:128}function a1(e,t){var r=t?t[0]:0,n=e[r]&127;e:if(e[r++]>=128&&(n|=(e[r]&127)<<7,e[r++]<128||(n|=(e[r]&127)<<14,e[r++]<128)||(n|=(e[r]&127)<<21,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,28),++r,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,35),++r,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,42),++r,e[r++]<128)))break e;return t&&(t[0]=r),n}function Bn(e){var t=new Uint8Array(7);t[0]=e&127;var r=1;e:if(e>127){if(t[r-1]|=128,t[r]=e>>7&127,++r,e<=16383||(t[r-1]|=128,t[r]=e>>14&127,++r,e<=2097151)||(t[r-1]|=128,t[r]=e>>21&127,++r,e<=268435455)||(t[r-1]|=128,t[r]=e/256>>>21&127,++r,e<=34359738367)||(t[r-1]|=128,t[r]=e/65536>>>21&127,++r,e<=4398046511103))break e;t[r-1]|=128,t[r]=e/16777216>>>21&127,++r}return t.slice(0,r)}function ti(e){var t=0,r=e[t]&127;e:if(e[t++]>=128){if(r|=(e[t]&127)<<7,e[t++]<128||(r|=(e[t]&127)<<14,e[t++]<128)||(r|=(e[t]&127)<<21,e[t++]<128))break e;r|=(e[t]&127)<<28}return r}function jn(e){for(var t=[],r=[0];r[0]<e.length;){var n=r[0],a=a1(e,r),s=a&7;a=Math.floor(a/8);var o=0,l;if(a==0)break;switch(s){case 0:{for(var u=r[0];e[r[0]++]>=128;);l=e.slice(u,r[0])}break;case 5:o=4,l=e.slice(r[0],r[0]+o),r[0]+=o;break;case 1:o=8,l=e.slice(r[0],r[0]+o),r[0]+=o;break;case 2:o=a1(e,r),l=e.slice(r[0],r[0]+o),r[0]+=o;break;case 3:case 4:default:throw new Error("PB Type ".concat(s," for Field ").concat(a," at offset ").concat(n))}var d={data:l,type:s};t[a]==null?t[a]=[d]:t[a].push(d)}return t}function Ss(e){var t=[];return e.forEach(function(r,n){r.forEach(function(a){a.data&&(t.push(Bn(n*8+a.type)),a.type==2&&t.push(Bn(a.data.length)),t.push(a.data))})}),Ph(t)}function VE(e,t){return(e==null?void 0:e.map(function(r){return t(r.data)}))||[]}function Ml(e){for(var t,r=[],n=[0];n[0]<e.length;){var a=a1(e,n),s=jn(e.slice(n[0],n[0]+a));n[0]+=a;var o={id:ti(s[1][0].data),messages:[]};s[2].forEach(function(l){var u=jn(l.data),d=ti(u[3][0].data);o.messages.push({meta:u,data:e.slice(n[0],n[0]+d)}),n[0]+=d}),(t=s[3])!=null&&t[0]&&(o.merge=ti(s[3][0].data)>>>0>0),r.push(o)}return r}function kp(e){var t=[];return e.forEach(function(r){var n=[];n[1]=[{data:Bn(r.id),type:0}],n[2]=[],r.merge!=null&&(n[3]=[{data:Bn(+!!r.merge),type:0}]);var a=[];r.messages.forEach(function(o){a.push(o.data),o.meta[3]=[{type:0,data:Bn(o.data.length)}],n[2].push({data:Ss(o.meta),type:2})});var s=Ss(n);t.push(Bn(s.length)),t.push(s),a.forEach(function(o){return t.push(o)})}),Ph(t)}function $Re(e,t){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var r=[0],n=a1(t,r),a=[];r[0]<t.length;){var s=t[r[0]]&3;if(s==0){var o=t[r[0]++]>>2;if(o<60)++o;else{var l=o-59;o=t[r[0]],l>1&&(o|=t[r[0]+1]<<8),l>2&&(o|=t[r[0]+2]<<16),l>3&&(o|=t[r[0]+3]<<24),o>>>=0,o++,r[0]+=l}a.push(t.slice(r[0],r[0]+o)),r[0]+=o;continue}else{var u=0,d=0;if(s==1?(d=(t[r[0]]>>2&7)+4,u=(t[r[0]++]&224)<<3,u|=t[r[0]++]):(d=(t[r[0]++]>>2)+1,s==2?(u=t[r[0]]|t[r[0]+1]<<8,r[0]+=2):(u=(t[r[0]]|t[r[0]+1]<<8|t[r[0]+2]<<16|t[r[0]+3]<<24)>>>0,r[0]+=4)),a=[Ph(a)],u==0)throw new Error("Invalid offset 0");if(u>a[0].length)throw new Error("Invalid offset beyond length");if(d>=u)for(a.push(a[0].slice(-u)),d-=u;d>=a[a.length-1].length;)a.push(a[a.length-1]),d-=a[a.length-1].length;a.push(a[0].slice(-u,-u+d))}}var f=Ph(a);if(f.length!=n)throw new Error("Unexpected length: ".concat(f.length," != ").concat(n));return f}function Ll(e){for(var t=[],r=0;r<e.length;){var n=e[r++],a=e[r]|e[r+1]<<8|e[r+2]<<16;r+=3,t.push($Re(n,e.slice(r,r+a))),r+=a}if(r!==e.length)throw new Error("data is not a valid framed stream!");return Ph(t)}function Cp(e){for(var t=[],r=0;r<e.length;){var n=Math.min(e.length-r,268435455),a=new Uint8Array(4);t.push(a);var s=Bn(n),o=s.length;t.push(s),n<=60?(o++,t.push(new Uint8Array([n-1<<2]))):n<=256?(o+=2,t.push(new Uint8Array([240,n-1&255]))):n<=65536?(o+=3,t.push(new Uint8Array([244,n-1&255,n-1>>8&255]))):n<=16777216?(o+=4,t.push(new Uint8Array([248,n-1&255,n-1>>8&255,n-1>>16&255]))):n<=4294967296&&(o+=5,t.push(new Uint8Array([252,n-1&255,n-1>>8&255,n-1>>16&255,n-1>>>24&255]))),t.push(e.slice(r,r+n)),o+=n,a[0]=0,a[1]=o&255,a[2]=o>>8&255,a[3]=o>>16&255,r+=n}return Ph(t)}function HRe(e,t,r,n){var a=m0(e),s=a.getUint32(4,!0),o=(n>1?12:8)+$7(s&(n>1?3470:398))*4,l=-1,u=-1,d=NaN,f=new Date(2001,0,1);s&512&&(l=a.getUint32(o,!0),o+=4),o+=$7(s&(n>1?12288:4096))*4,s&16&&(u=a.getUint32(o,!0),o+=4),s&32&&(d=a.getFloat64(o,!0),o+=8),s&64&&(f.setTime(f.getTime()+a.getFloat64(o,!0)*1e3),o+=8);var m;switch(e[2]){case 0:break;case 2:m={t:"n",v:d};break;case 3:m={t:"s",v:t[u]};break;case 5:m={t:"d",v:f};break;case 6:m={t:"b",v:d>0};break;case 7:m={t:"n",v:d/86400};break;case 8:m={t:"e",v:0};break;case 9:if(l>-1)m={t:"s",v:r[l]};else if(u>-1)m={t:"s",v:t[u]};else if(!isNaN(d))m={t:"n",v:d};else throw new Error("Unsupported cell type ".concat(e.slice(0,4)));break;default:throw new Error("Unsupported cell type ".concat(e.slice(0,4)))}return m}function VRe(e,t,r){var n=m0(e),a=n.getUint32(8,!0),s=12,o=-1,l=-1,u=NaN,d=NaN,f=new Date(2001,0,1);a&1&&(u=zRe(e,s),s+=16),a&2&&(d=n.getFloat64(s,!0),s+=8),a&4&&(f.setTime(f.getTime()+n.getFloat64(s,!0)*1e3),s+=8),a&8&&(l=n.getUint32(s,!0),s+=4),a&16&&(o=n.getUint32(s,!0),s+=4);var m;switch(e[1]){case 0:break;case 2:m={t:"n",v:u};break;case 3:m={t:"s",v:t[l]};break;case 5:m={t:"d",v:f};break;case 6:m={t:"b",v:d>0};break;case 7:m={t:"n",v:d/86400};break;case 8:m={t:"e",v:0};break;case 9:if(o>-1)m={t:"s",v:r[o]};else throw new Error("Unsupported cell type ".concat(e[1]," : ").concat(a&31," : ").concat(e.slice(0,4)));break;case 10:m={t:"n",v:u};break;default:throw new Error("Unsupported cell type ".concat(e[1]," : ").concat(a&31," : ").concat(e.slice(0,4)))}return m}function c3(e,t){var r=new Uint8Array(32),n=m0(r),a=12,s=0;switch(r[0]=5,e.t){case"n":r[1]=2,URe(r,a,e.v),s|=1,a+=16;break;case"b":r[1]=6,n.setFloat64(a,e.v?1:0,!0),s|=2,a+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));r[1]=3,n.setUint32(a,t.indexOf(e.v),!0),s|=8,a+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(8,s,!0),r.slice(0,a)}function u3(e,t){var r=new Uint8Array(32),n=m0(r),a=12,s=0;switch(r[0]=3,e.t){case"n":r[2]=2,n.setFloat64(a,e.v,!0),s|=32,a+=8;break;case"b":r[2]=6,n.setFloat64(a,e.v?1:0,!0),s|=32,a+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));r[2]=3,n.setUint32(a,t.indexOf(e.v),!0),s|=16,a+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(4,s,!0),r.slice(0,a)}function qRe(e,t,r){switch(e[0]){case 0:case 1:case 2:case 3:return HRe(e,t,r,e[0]);case 5:return VRe(e,t,r);default:throw new Error("Unsupported payload version ".concat(e[0]))}}function zs(e){var t=jn(e);return a1(t[1][0].data)}function H7(e,t){var r=jn(t.data),n=ti(r[1][0].data),a=r[3],s=[];return(a||[]).forEach(function(o){var l=jn(o.data),u=ti(l[1][0].data)>>>0;switch(n){case 1:s[u]=xk(l[3][0].data);break;case 8:{var d=e[zs(l[9][0].data)][0],f=jn(d.data),m=e[zs(f[1][0].data)][0],g=ti(m.meta[1][0].data);if(g!=2001)throw new Error("2000 unexpected reference to ".concat(g));var x=jn(m.data);s[u]=x[3].map(function(y){return xk(y.data)}).join("")}break}}),s}function WRe(e,t){var r,n,a,s,o,l,u,d,f,m,g,x,y,v,w=jn(e),j=ti(w[1][0].data)>>>0,k=ti(w[2][0].data)>>>0,A=((n=(r=w[8])==null?void 0:r[0])==null?void 0:n.data)&&ti(w[8][0].data)>0||!1,T,M;if((s=(a=w[7])==null?void 0:a[0])!=null&&s.data&&t!=0)T=(l=(o=w[7])==null?void 0:o[0])==null?void 0:l.data,M=(d=(u=w[6])==null?void 0:u[0])==null?void 0:d.data;else if((m=(f=w[4])==null?void 0:f[0])!=null&&m.data&&t!=1)T=(x=(g=w[4])==null?void 0:g[0])==null?void 0:x.data,M=(v=(y=w[3])==null?void 0:y[0])==null?void 0:v.data;else throw"NUMBERS Tile missing ".concat(t," cell storage");for(var B=A?4:1,L=m0(T),F=[],I=0;I<T.length/2;++I){var q=L.getUint16(I*2,!0);q<65535&&F.push([I,q])}if(F.length!=k)throw"Expected ".concat(k," cells, found ").concat(F.length);var P=[];for(I=0;I<F.length-1;++I)P[F[I][0]]=M.subarray(F[I][1]*B,F[I+1][1]*B);return F.length>=1&&(P[F[F.length-1][0]]=M.subarray(F[F.length-1][1]*B)),{R:j,cells:P}}function GRe(e,t){var r,n=jn(t.data),a=(r=n==null?void 0:n[7])!=null&&r[0]?ti(n[7][0].data)>>>0>0?1:0:-1,s=VE(n[5],function(o){return WRe(o,a)});return{nrows:ti(n[4][0].data)>>>0,data:s.reduce(function(o,l){return o[l.R]||(o[l.R]=[]),l.cells.forEach(function(u,d){if(o[l.R][d])throw new Error("Duplicate cell r=".concat(l.R," c=").concat(d));o[l.R][d]=u}),o},[])}}function YRe(e,t,r){var n,a=jn(t.data),s={s:{r:0,c:0},e:{r:0,c:0}};if(s.e.r=(ti(a[6][0].data)>>>0)-1,s.e.r<0)throw new Error("Invalid row varint ".concat(a[6][0].data));if(s.e.c=(ti(a[7][0].data)>>>0)-1,s.e.c<0)throw new Error("Invalid col varint ".concat(a[7][0].data));r["!ref"]=zr(s);var o=jn(a[4][0].data),l=H7(e,e[zs(o[4][0].data)][0]),u=(n=o[17])!=null&&n[0]?H7(e,e[zs(o[17][0].data)][0]):[],d=jn(o[3][0].data),f=0;d[1].forEach(function(m){var g=jn(m.data),x=e[zs(g[2][0].data)][0],y=ti(x.meta[1][0].data);if(y!=6002)throw new Error("6001 unexpected reference to ".concat(y));var v=GRe(e,x);v.data.forEach(function(w,j){w.forEach(function(k,A){var T=_r({r:f+j,c:A}),M=qRe(k,l,u);M&&(r[T]=M)})}),f+=v.nrows})}function KRe(e,t){var r=jn(t.data),n={"!ref":"A1"},a=e[zs(r[2][0].data)],s=ti(a[0].meta[1][0].data);if(s!=6001)throw new Error("6000 unexpected reference to ".concat(s));return YRe(e,a[0],n),n}function XRe(e,t){var r,n=jn(t.data),a={name:(r=n[1])!=null&&r[0]?xk(n[1][0].data):"",sheets:[]},s=VE(n[2],zs);return s.forEach(function(o){e[o].forEach(function(l){var u=ti(l.meta[1][0].data);u==6e3&&a.sheets.push(KRe(e,l))})}),a}function ZRe(e,t){var r=KE(),n=jn(t.data),a=VE(n[1],zs);if(a.forEach(function(s){e[s].forEach(function(o){var l=ti(o.meta[1][0].data);if(l==2){var u=XRe(e,o);u.sheets.forEach(function(d,f){XE(r,d,f==0?u.name:u.name+"_"+f,!0)})}})}),r.SheetNames.length==0)throw new Error("Empty NUMBERS file");return r}function d3(e){var t,r,n,a,s={},o=[];if(e.FullPaths.forEach(function(u){if(u.match(/\.iwpv2/))throw new Error("Unsupported password protection")}),e.FileIndex.forEach(function(u){if(u.name.match(/\.iwa$/)){var d;try{d=Ll(u.content)}catch(m){return console.log("?? "+u.content.length+" "+(m.message||m))}var f;try{f=Ml(d)}catch(m){return console.log("## "+(m.message||m))}f.forEach(function(m){s[m.id]=m.messages,o.push(m.id)})}}),!o.length)throw new Error("File has no messages");var l=((a=(n=(r=(t=s==null?void 0:s[1])==null?void 0:t[0])==null?void 0:r.meta)==null?void 0:n[1])==null?void 0:a[0].data)&&ti(s[1][0].meta[1][0].data)==1&&s[1][0];if(l||o.forEach(function(u){s[u].forEach(function(d){var f=ti(d.meta[1][0].data)>>>0;if(f==1)if(!l)l=d;else throw new Error("Document has multiple roots")})}),!l)throw new Error("Cannot find Document root");return ZRe(s,l)}function JRe(e,t,r){var n,a,s,o;if(!((n=e[6])!=null&&n[0])||!((a=e[7])!=null&&a[0]))throw"Mutation only works on post-BNC storages!";var l=((o=(s=e[8])==null?void 0:s[0])==null?void 0:o.data)&&ti(e[8][0].data)>0||!1;if(l)throw"Math only works with normal offsets";for(var u=0,d=m0(e[7][0].data),f=0,m=[],g=m0(e[4][0].data),x=0,y=[],v=0;v<t.length;++v){if(t[v]==null){d.setUint16(v*2,65535,!0),g.setUint16(v*2,65535);continue}d.setUint16(v*2,f,!0),g.setUint16(v*2,x,!0);var w,j;switch(typeof t[v]){case"string":w=c3({t:"s",v:t[v]},r),j=u3({t:"s",v:t[v]},r);break;case"number":w=c3({t:"n",v:t[v]},r),j=u3({t:"n",v:t[v]},r);break;case"boolean":w=c3({t:"b",v:t[v]},r),j=u3({t:"b",v:t[v]},r);break;default:throw new Error("Unsupported value "+t[v])}m.push(w),f+=w.length,y.push(j),x+=j.length,++u}for(e[2][0].data=Bn(u);v<e[7][0].data.length/2;++v)d.setUint16(v*2,65535,!0),g.setUint16(v*2,65535,!0);return e[6][0].data=Ph(m),e[3][0].data=Ph(y),u}function QRe(e,t){if(!t||!t.numbers)throw new Error("Must pass a `numbers` option -- check the README");var r=e.Sheets[e.SheetNames[0]];e.SheetNames.length>1&&console.error("The Numbers writer currently writes only the first table");var n=$o(r["!ref"]);n.s.r=n.s.c=0;var a=!1;n.e.c>9&&(a=!0,n.e.c=9),n.e.r>49&&(a=!0,n.e.r=49),a&&console.error("The Numbers writer is currently limited to ".concat(zr(n)));var s=zw(r,{range:n,header:1}),o=["~Sh33tJ5~"];s.forEach(function(H){return H.forEach(function(G){typeof G=="string"&&o.push(G)})});var l={},u=[],d=br.read(t.numbers,{type:"base64"});d.FileIndex.map(function(H,G){return[H,d.FullPaths[G]]}).forEach(function(H){var G=H[0],E=H[1];if(G.type==2&&G.name.match(/\.iwa/)){var re=G.content,he=Ll(re),oe=Ml(he);oe.forEach(function(z){u.push(z.id),l[z.id]={deps:[],location:E,type:ti(z.messages[0].meta[1][0].data)}})}}),u.sort(function(H,G){return H-G});var f=u.filter(function(H){return H>1}).map(function(H){return[H,Bn(H)]});d.FileIndex.map(function(H,G){return[H,d.FullPaths[G]]}).forEach(function(H){var G=H[0];if(H[1],!!G.name.match(/\.iwa/)){var E=Ml(Ll(G.content));E.forEach(function(re){re.messages.forEach(function(he){f.forEach(function(oe){re.messages.some(function(z){return ti(z.meta[1][0].data)!=11006&&BRe(z.data,oe[1])})&&l[oe[0]].deps.push(re.id)})})})}});for(var m=br.find(d,l[1].location),g=Ml(Ll(m.content)),x,y=0;y<g.length;++y){var v=g[y];v.id==1&&(x=v)}var w=zs(jn(x.messages[0].data)[1][0].data);for(m=br.find(d,l[w].location),g=Ml(Ll(m.content)),y=0;y<g.length;++y)v=g[y],v.id==w&&(x=v);for(w=zs(jn(x.messages[0].data)[2][0].data),m=br.find(d,l[w].location),g=Ml(Ll(m.content)),y=0;y<g.length;++y)v=g[y],v.id==w&&(x=v);for(w=zs(jn(x.messages[0].data)[2][0].data),m=br.find(d,l[w].location),g=Ml(Ll(m.content)),y=0;y<g.length;++y)v=g[y],v.id==w&&(x=v);var j=jn(x.messages[0].data);{j[6][0].data=Bn(n.e.r+1),j[7][0].data=Bn(n.e.c+1);var k=zs(j[46][0].data),A=br.find(d,l[k].location),T=Ml(Ll(A.content));{for(var M=0;M<T.length&&T[M].id!=k;++M);if(T[M].id!=k)throw"Bad ColumnRowUIDMapArchive";var B=jn(T[M].messages[0].data);B[1]=[],B[2]=[],B[3]=[];for(var L=0;L<=n.e.c;++L){var F=[];F[1]=F[2]=[{type:0,data:Bn(L+420690)}],B[1].push({type:2,data:Ss(F)}),B[2].push({type:0,data:Bn(L)}),B[3].push({type:0,data:Bn(L)})}B[4]=[],B[5]=[],B[6]=[];for(var I=0;I<=n.e.r;++I)F=[],F[1]=F[2]=[{type:0,data:Bn(I+726270)}],B[4].push({type:2,data:Ss(F)}),B[5].push({type:0,data:Bn(I)}),B[6].push({type:0,data:Bn(I)});T[M].messages[0].data=Ss(B)}A.content=Cp(kp(T)),A.size=A.content.length,delete j[46];var q=jn(j[4][0].data);{q[7][0].data=Bn(n.e.r+1);var P=jn(q[1][0].data),R=zs(P[2][0].data);A=br.find(d,l[R].location),T=Ml(Ll(A.content));{if(T[0].id!=R)throw"Bad HeaderStorageBucket";var K=jn(T[0].messages[0].data);for(I=0;I<s.length;++I){var ee=jn(K[2][0].data);ee[1][0].data=Bn(I),ee[4][0].data=Bn(s[I].length),K[2][I]={type:K[2][0].type,data:Ss(ee)}}T[0].messages[0].data=Ss(K)}A.content=Cp(kp(T)),A.size=A.content.length;var se=zs(q[2][0].data);A=br.find(d,l[se].location),T=Ml(Ll(A.content));{if(T[0].id!=se)throw"Bad HeaderStorageBucket";for(K=jn(T[0].messages[0].data),L=0;L<=n.e.c;++L)ee=jn(K[2][0].data),ee[1][0].data=Bn(L),ee[4][0].data=Bn(n.e.r+1),K[2][L]={type:K[2][0].type,data:Ss(ee)};T[0].messages[0].data=Ss(K)}A.content=Cp(kp(T)),A.size=A.content.length;var Z=zs(q[4][0].data);(function(){for(var H=br.find(d,l[Z].location),G=Ml(Ll(H.content)),E,re=0;re<G.length;++re){var he=G[re];he.id==Z&&(E=he)}var oe=jn(E.messages[0].data);{oe[3]=[];var z=[];o.forEach(function(W,ae){z[1]=[{type:0,data:Bn(ae)}],z[2]=[{type:0,data:Bn(1)}],z[3]=[{type:2,data:FRe(W)}],oe[3].push({type:2,data:Ss(z)})})}E.messages[0].data=Ss(oe);var fe=kp(G),de=Cp(fe);H.content=de,H.size=H.content.length})();var ne=jn(q[3][0].data);{var X=ne[1][0];delete ne[2];var le=jn(X.data);{var Ae=zs(le[2][0].data);(function(){for(var H=br.find(d,l[Ae].location),G=Ml(Ll(H.content)),E,re=0;re<G.length;++re){var he=G[re];he.id==Ae&&(E=he)}var oe=jn(E.messages[0].data);{delete oe[6],delete ne[7];var z=new Uint8Array(oe[5][0].data);oe[5]=[];for(var fe=0,de=0;de<=n.e.r;++de){var W=jn(z);fe+=JRe(W,s[de],o),W[1][0].data=Bn(de),oe[5].push({data:Ss(W),type:2})}oe[1]=[{type:0,data:Bn(n.e.c+1)}],oe[2]=[{type:0,data:Bn(n.e.r+1)}],oe[3]=[{type:0,data:Bn(fe)}],oe[4]=[{type:0,data:Bn(n.e.r+1)}]}E.messages[0].data=Ss(oe);var ae=kp(G),_e=Cp(ae);H.content=_e,H.size=H.content.length})()}X.data=Ss(le)}q[3][0].data=Ss(ne)}j[4][0].data=Ss(q)}x.messages[0].data=Ss(j);var ce=kp(g),D=Cp(ce);return m.content=D,m.size=m.content.length,d}function eK(e){return function(r){for(var n=0;n!=e.length;++n){var a=e[n];r[a[0]]===void 0&&(r[a[0]]=a[1]),a[2]==="n"&&(r[a[0]]=Number(r[a[0]]))}}}function qE(e){eK([["cellNF",!1],["cellHTML",!0],["cellFormula",!0],["cellStyles",!1],["cellText",!0],["cellDates",!1],["sheetStubs",!1],["sheetRows",0,"n"],["bookDeps",!1],["bookSheets",!1],["bookProps",!1],["bookFiles",!1],["bookVBA",!1],["password",""],["WTF",!1]])(e)}function WE(e){eK([["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]])(e)}function eMe(e){return Qr.WS.indexOf(e)>-1?"sheet":e==Qr.CS?"chart":e==Qr.DS?"dialog":e==Qr.MS?"macro":e&&e.length?e:"sheet"}function tMe(e,t){if(!e)return 0;try{e=t.map(function(n){return n.id||(n.id=n.strRelID),[n.name,e["!id"][n.id].Target,eMe(e["!id"][n.id].Type)]})}catch{return null}return!e||e.length===0?null:e}function rMe(e,t,r,n,a,s,o,l,u,d,f,m){try{s[n]=mv(ul(e,r,!0),t);var g=bi(e,t),x;switch(l){case"sheet":x=SOe(g,t,a,u,s[n],d,f,m);break;case"chart":if(x=AOe(g,t,a,u,s[n],d,f,m),!x||!x["!drawel"])break;var y=Qg(x["!drawel"].Target,t),v=Jv(y),w=d6e(ul(e,y,!0),mv(ul(e,v,!0),y)),j=Qg(w,y),k=Jv(j);x=J8e(ul(e,j,!0),j,u,mv(ul(e,k,!0),j),d,x);break;case"macro":x=kOe(g,t,a,u,s[n],d,f,m);break;case"dialog":x=COe(g,t,a,u,s[n],d,f,m);break;default:throw new Error("Unrecognized sheet type "+l)}o[n]=x;var A=[];s&&s[n]&&ri(s[n]).forEach(function(T){var M="";if(s[n][T].Type==Qr.CMNT){M=Qg(s[n][T].Target,t);var B=POe(bi(e,M,!0),M,u);if(!B||!B.length)return;_7(x,B,!1)}s[n][T].Type==Qr.TCMNT&&(M=Qg(s[n][T].Target,t),A=A.concat(h6e(bi(e,M,!0),u)))}),A&&A.length&&_7(x,A,!0,u.people||[])}catch(T){if(u.WTF)throw T}}function Dl(e){return e.charAt(0)=="/"?e.slice(1):e}function nMe(e,t){if(Fx(),t=t||{},qE(t),Fl(e,"META-INF/manifest.xml")||Fl(e,"objectdata.xml"))return B7(e,t);if(Fl(e,"Index/Document.iwa")){if(typeof Uint8Array>"u")throw new Error("NUMBERS file parsing requires Uint8Array support");if(typeof d3<"u"){if(e.FileIndex)return d3(e);var r=br.utils.cfb_new();return KF(e).forEach(function(ee){Hr(r,ee,mke(e,ee))}),d3(r)}throw new Error("Unsupported NUMBERS file")}if(!Fl(e,"[Content_Types].xml"))throw Fl(e,"index.xml.gz")?new Error("Unsupported NUMBERS 08 file"):Fl(e,"index.xml")?new Error("Unsupported NUMBERS 09 file"):new Error("Unsupported ZIP file");var n=KF(e),a=oCe(ul(e,"[Content_Types].xml")),s=!1,o,l;if(a.workbooks.length===0&&(l="xl/workbook.xml",bi(e,l,!0)&&a.workbooks.push(l)),a.workbooks.length===0){if(l="xl/workbook.bin",!bi(e,l,!0))throw new Error("Could not find workbook");a.workbooks.push(l),s=!0}a.workbooks[0].slice(-3)=="bin"&&(s=!0);var u={},d={};if(!t.bookSheets&&!t.bookProps){if(pv=[],a.sst)try{pv=TOe(bi(e,Dl(a.sst)),a.sst,t)}catch(ee){if(t.WTF)throw ee}t.cellStyles&&a.themes.length&&(u=EOe(ul(e,a.themes[0].replace(/^\//,""),!0)||"",a.themes[0],t)),a.style&&(d=_Oe(bi(e,Dl(a.style)),a.style,u,t))}a.links.map(function(ee){try{var se=mv(ul(e,Jv(Dl(ee))),ee);return OOe(bi(e,Dl(ee)),se,ee,t)}catch{}});var f=NOe(bi(e,Dl(a.workbooks[0])),a.workbooks[0],t),m={},g="";a.coreprops.length&&(g=bi(e,Dl(a.coreprops[0]),!0),g&&(m=$G(g)),a.extprops.length!==0&&(g=bi(e,Dl(a.extprops[0]),!0),g&&mCe(g,m,t)));var x={};(!t.bookSheets||t.bookProps)&&a.custprops.length!==0&&(g=ul(e,Dl(a.custprops[0]),!0),g&&(x=xCe(g,t)));var y={};if((t.bookSheets||t.bookProps)&&(f.Sheets?o=f.Sheets.map(function(se){return se.name}):m.Worksheets&&m.SheetNames.length>0&&(o=m.SheetNames),t.bookProps&&(y.Props=m,y.Custprops=x),t.bookSheets&&typeof o<"u"&&(y.SheetNames=o),t.bookSheets?y.SheetNames:t.bookProps))return y;o={};var v={};t.bookDeps&&a.calcchain&&(v=DOe(bi(e,Dl(a.calcchain)),a.calcchain));var w=0,j={},k,A;{var T=f.Sheets;m.Worksheets=T.length,m.SheetNames=[];for(var M=0;M!=T.length;++M)m.SheetNames[M]=T[M].name}var B=s?"bin":"xml",L=a.workbooks[0].lastIndexOf("/"),F=(a.workbooks[0].slice(0,L+1)+"_rels/"+a.workbooks[0].slice(L+1)+".rels").replace(/^\//,"");Fl(e,F)||(F="xl/_rels/workbook."+B+".rels");var I=mv(ul(e,F,!0),F.replace(/_rels.*/,"s5s"));(a.metadata||[]).length>=1&&(t.xlmeta=ROe(bi(e,Dl(a.metadata[0])),a.metadata[0],t)),(a.people||[]).length>=1&&(t.people=p6e(bi(e,Dl(a.people[0])),t)),I&&(I=tMe(I,f.Sheets));var q=bi(e,"xl/worksheets/sheet.xml",!0)?1:0;e:for(w=0;w!=m.Worksheets;++w){var P="sheet";if(I&&I[w]?(k="xl/"+I[w][1].replace(/[\/]?xl\//,""),Fl(e,k)||(k=I[w][1]),Fl(e,k)||(k=F.replace(/_rels\/.*$/,"")+I[w][1]),P=I[w][2]):(k="xl/worksheets/sheet"+(w+1-q)+"."+B,k=k.replace(/sheet0\./,"sheet.")),A=k.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels"),t&&t.sheets!=null)switch(typeof t.sheets){case"number":if(w!=t.sheets)continue e;break;case"string":if(m.SheetNames[w].toLowerCase()!=t.sheets.toLowerCase())continue e;break;default:if(Array.isArray&&Array.isArray(t.sheets)){for(var R=!1,K=0;K!=t.sheets.length;++K)typeof t.sheets[K]=="number"&&t.sheets[K]==w&&(R=1),typeof t.sheets[K]=="string"&&t.sheets[K].toLowerCase()==m.SheetNames[w].toLowerCase()&&(R=1);if(!R)continue e}}rMe(e,k,A,m.SheetNames[w],w,j,o,P,t,f,u,d)}return y={Directory:a,Workbook:f,Props:m,Custprops:x,Deps:v,Sheets:o,SheetNames:m.SheetNames,Strings:pv,Styles:d,Themes:u,SSF:Na(Cr)},t&&t.bookFiles&&(e.files?(y.keys=n,y.files=e.files):(y.keys=[],y.files={},e.FullPaths.forEach(function(ee,se){ee=ee.replace(/^Root Entry[\/]/,""),y.keys.push(ee),y.files[ee]=e.FileIndex[se]}))),t&&t.bookVBA&&(a.vba.length>0?y.vbaraw=bi(e,Dl(a.vba[0]),!0):a.defaults&&a.defaults.bin===N6e&&(y.vbaraw=bi(e,"xl/vbaProject.bin",!0))),y}function aMe(e,t){var r=t||{},n="Workbook",a=br.find(e,n);try{if(n="/!DataSpaces/Version",a=br.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);if(REe(a.content),n="/!DataSpaces/DataSpaceMap",a=br.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);var s=LEe(a.content);if(s.length!==1||s[0].comps.length!==1||s[0].comps[0].t!==0||s[0].name!=="StrongEncryptionDataSpace"||s[0].comps[0].v!=="EncryptedPackage")throw new Error("ECMA-376 Encrypted file bad "+n);if(n="/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace",a=br.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);var o=IEe(a.content);if(o.length!=1||o[0]!="StrongEncryptionTransform")throw new Error("ECMA-376 Encrypted file bad "+n);if(n="/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary",a=br.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);BEe(a.content)}catch{}if(n="/EncryptionInfo",a=br.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);var l=zEe(a.content);if(n="/EncryptedPackage",a=br.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);if(l[0]==4&&typeof decrypt_agile<"u")return decrypt_agile(l[1],a.content,r.password||"",r);if(l[0]==2&&typeof decrypt_std76<"u")return decrypt_std76(l[1],a.content,r.password||"",r);throw new Error("File is password-protected")}function iMe(e,t){return t.bookType=="ods"?QY(e,t):t.bookType=="numbers"?QRe(e,t):t.bookType=="xlsb"?sMe(e,t):oMe(e,t)}function sMe(e,t){zp=1024,e&&!e.SSF&&(e.SSF=Na(Cr)),e&&e.SSF&&(Fx(),K5(e.SSF),t.revssf=Z5(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,xv?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var r=t.bookType=="xlsb"?"bin":"xml",n=CY.indexOf(t.bookType)>-1,a=PE();WE(t=t||{});var s=gE(),o="",l=0;if(t.cellXfs=[],Hh(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),o="docProps/core.xml",Hr(s,o,HG(e.Props,t)),a.coreprops.push(o),zn(t.rels,2,o,Qr.CORE_PROPS),o="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var u=[],d=0;d<e.SheetNames.length;++d)(e.Workbook.Sheets[d]||{}).Hidden!=2&&u.push(e.SheetNames[d]);e.Props.SheetNames=u}for(e.Props.Worksheets=e.Props.SheetNames.length,Hr(s,o,WG(e.Props)),a.extprops.push(o),zn(t.rels,3,o,Qr.EXT_PROPS),e.Custprops!==e.Props&&ri(e.Custprops||{}).length>0&&(o="docProps/custom.xml",Hr(s,o,GG(e.Custprops)),a.custprops.push(o),zn(t.rels,4,o,Qr.CUST_PROPS)),l=1;l<=e.SheetNames.length;++l){var f={"!id":{}},m=e.Sheets[e.SheetNames[l-1]],g=(m||{})["!type"]||"sheet";switch(g){case"chart":default:o="xl/worksheets/sheet"+l+"."+r,Hr(s,o,LOe(l-1,o,t,e,f)),a.sheets.push(o),zn(t.wbrels,-1,"worksheets/sheet"+l+"."+r,Qr.WS[0])}if(m){var x=m["!comments"],y=!1,v="";x&&x.length>0&&(v="xl/comments"+l+"."+r,Hr(s,v,BOe(x,v)),a.comments.push(v),zn(f,-1,"../comments"+l+"."+r,Qr.CMNT),y=!0),m["!legacy"]&&y&&Hr(s,"xl/drawings/vmlDrawing"+l+".vml",AY(l,m["!comments"])),delete m["!comments"],delete m["!legacy"]}f["!id"].rId1&&Hr(s,Jv(o),Jp(f))}return t.Strings!=null&&t.Strings.length>0&&(o="xl/sharedStrings."+r,Hr(s,o,FOe(t.Strings,o,t)),a.strs.push(o),zn(t.wbrels,-1,"sharedStrings."+r,Qr.SST)),o="xl/workbook."+r,Hr(s,o,MOe(e,o)),a.workbooks.push(o),zn(t.rels,1,o,Qr.WB),o="xl/theme/theme1.xml",Hr(s,o,IE(e.Themes,t)),a.themes.push(o),zn(t.wbrels,-1,"theme/theme1.xml",Qr.THEME),o="xl/styles."+r,Hr(s,o,IOe(e,o,t)),a.styles.push(o),zn(t.wbrels,-1,"styles."+r,Qr.STY),e.vbaraw&&n&&(o="xl/vbaProject.bin",Hr(s,o,e.vbaraw),a.vba.push(o),zn(t.wbrels,-1,"vbaProject.bin",Qr.VBA)),o="xl/metadata."+r,Hr(s,o,zOe(o)),a.metadata.push(o),zn(t.wbrels,-1,"metadata."+r,Qr.XLMETA),Hr(s,"[Content_Types].xml",zG(a,t)),Hr(s,"_rels/.rels",Jp(t.rels)),Hr(s,"xl/_rels/workbook."+r+".rels",Jp(t.wbrels)),delete t.revssf,delete t.ssf,s}function oMe(e,t){zp=1024,e&&!e.SSF&&(e.SSF=Na(Cr)),e&&e.SSF&&(Fx(),K5(e.SSF),t.revssf=Z5(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,xv?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var r="xml",n=CY.indexOf(t.bookType)>-1,a=PE();WE(t=t||{});var s=gE(),o="",l=0;if(t.cellXfs=[],Hh(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),o="docProps/core.xml",Hr(s,o,HG(e.Props,t)),a.coreprops.push(o),zn(t.rels,2,o,Qr.CORE_PROPS),o="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var u=[],d=0;d<e.SheetNames.length;++d)(e.Workbook.Sheets[d]||{}).Hidden!=2&&u.push(e.SheetNames[d]);e.Props.SheetNames=u}e.Props.Worksheets=e.Props.SheetNames.length,Hr(s,o,WG(e.Props)),a.extprops.push(o),zn(t.rels,3,o,Qr.EXT_PROPS),e.Custprops!==e.Props&&ri(e.Custprops||{}).length>0&&(o="docProps/custom.xml",Hr(s,o,GG(e.Custprops)),a.custprops.push(o),zn(t.rels,4,o,Qr.CUST_PROPS));var f=["SheetJ5"];for(t.tcid=0,l=1;l<=e.SheetNames.length;++l){var m={"!id":{}},g=e.Sheets[e.SheetNames[l-1]],x=(g||{})["!type"]||"sheet";switch(x){case"chart":default:o="xl/worksheets/sheet"+l+"."+r,Hr(s,o,FY(l-1,t,e,m)),a.sheets.push(o),zn(t.wbrels,-1,"worksheets/sheet"+l+"."+r,Qr.WS[0])}if(g){var y=g["!comments"],v=!1,w="";if(y&&y.length>0){var j=!1;y.forEach(function(k){k[1].forEach(function(A){A.T==!0&&(j=!0)})}),j&&(w="xl/threadedComments/threadedComment"+l+"."+r,Hr(s,w,m6e(y,f,t)),a.threadedcomments.push(w),zn(m,-1,"../threadedComments/threadedComment"+l+"."+r,Qr.TCMNT)),w="xl/comments"+l+"."+r,Hr(s,w,kY(y)),a.comments.push(w),zn(m,-1,"../comments"+l+"."+r,Qr.CMNT),v=!0}g["!legacy"]&&v&&Hr(s,"xl/drawings/vmlDrawing"+l+".vml",AY(l,g["!comments"])),delete g["!comments"],delete g["!legacy"]}m["!id"].rId1&&Hr(s,Jv(o),Jp(m))}return t.Strings!=null&&t.Strings.length>0&&(o="xl/sharedStrings."+r,Hr(s,o,hY(t.Strings,t)),a.strs.push(o),zn(t.wbrels,-1,"sharedStrings."+r,Qr.SST)),o="xl/workbook."+r,Hr(s,o,HY(e)),a.workbooks.push(o),zn(t.rels,1,o,Qr.WB),o="xl/theme/theme1.xml",Hr(s,o,IE(e.Themes,t)),a.themes.push(o),zn(t.wbrels,-1,"theme/theme1.xml",Qr.THEME),o="xl/styles."+r,Hr(s,o,wY(e,t)),a.styles.push(o),zn(t.wbrels,-1,"styles."+r,Qr.STY),e.vbaraw&&n&&(o="xl/vbaProject.bin",Hr(s,o,e.vbaraw),a.vba.push(o),zn(t.wbrels,-1,"vbaProject.bin",Qr.VBA)),o="xl/metadata."+r,Hr(s,o,SY()),a.metadata.push(o),zn(t.wbrels,-1,"metadata."+r,Qr.XLMETA),f.length>1&&(o="xl/persons/person.xml",Hr(s,o,x6e(f)),a.people.push(o),zn(t.wbrels,-1,"persons/person.xml",Qr.PEOPLE)),Hr(s,"[Content_Types].xml",zG(a,t)),Hr(s,"_rels/.rels",Jp(t.rels)),Hr(s,"xl/_rels/workbook."+r+".rels",Jp(t.wbrels)),delete t.revssf,delete t.ssf,s}function GE(e,t){var r="";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":r=vl(e.slice(0,12));break;case"binary":r=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[r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2),r.charCodeAt(3),r.charCodeAt(4),r.charCodeAt(5),r.charCodeAt(6),r.charCodeAt(7)]}function lMe(e,t){return br.find(e,"EncryptedPackage")?aMe(e,t):GY(e,t)}function cMe(e,t){var r,n=e,a=t||{};return a.type||(a.type=Yr&&Buffer.isBuffer(e)?"buffer":"base64"),r=pG(n,a),nMe(r,a)}function tK(e,t){var r=0;e:for(;r<e.length;)switch(e.charCodeAt(r)){case 10:case 13:case 32:++r;break;case 60:return mk(e.slice(r),t);default:break e}return xx.to_workbook(e,t)}function uMe(e,t){var r="",n=GE(e,t);switch(t.type){case"base64":r=vl(e);break;case"binary":r=e;break;case"buffer":r=e.toString("binary");break;case"array":r=u0(e);break;default:throw new Error("Unrecognized type "+t.type)}return n[0]==239&&n[1]==187&&n[2]==191&&(r=Xn(r)),t.type="binary",tK(r,t)}function dMe(e,t){var r=e;return t.type=="base64"&&(r=vl(r)),r=Wv.utils.decode(1200,r.slice(2),"str"),t.type="binary",tK(r,t)}function fMe(e){return e.match(/[^\x00-\x7F]/)?Mu(e):e}function f3(e,t,r,n){return n?(r.type="string",xx.to_workbook(e,r)):xx.to_workbook(t,r)}function gk(e,t){fE();var r=t||{};if(typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer)return gk(new Uint8Array(e),(r=Na(r),r.type="array",r));typeof Uint8Array<"u"&&e instanceof Uint8Array&&!r.type&&(r.type=typeof Deno<"u"?"buffer":"array");var n=e,a=[0,0,0,0],s=!1;if(r.cellStyles&&(r.cellNF=!0,r.sheetStubs=!0),ex={},r.dateNF&&(ex.dateNF=r.dateNF),r.type||(r.type=Yr&&Buffer.isBuffer(e)?"buffer":"base64"),r.type=="file"&&(r.type=Yr?"buffer":"binary",n=ske(e),typeof Uint8Array<"u"&&!Yr&&(r.type="array")),r.type=="string"&&(s=!0,r.type="binary",r.codepage=65001,n=fMe(e)),r.type=="array"&&typeof Uint8Array<"u"&&e instanceof Uint8Array&&typeof ArrayBuffer<"u"){var o=new ArrayBuffer(3),l=new Uint8Array(o);if(l.foo="bar",!l.foo)return r=Na(r),r.type="array",gk(hE(n),r)}switch((a=GE(n,r))[0]){case 208:if(a[1]===207&&a[2]===17&&a[3]===224&&a[4]===161&&a[5]===177&&a[6]===26&&a[7]===225)return lMe(br.read(n,r),r);break;case 9:if(a[1]<=8)return GY(n,r);break;case 60:return mk(n,r);case 73:if(a[1]===73&&a[2]===42&&a[3]===0)throw new Error("TIFF Image File is not a spreadsheet");if(a[1]===68)return gEe(n,r);break;case 84:if(a[1]===65&&a[2]===66&&a[3]===76)return dY.to_workbook(n,r);break;case 80:return a[1]===75&&a[2]<9&&a[3]<9?cMe(n,r):f3(e,n,r,s);case 239:return a[3]===60?mk(n,r):f3(e,n,r,s);case 255:if(a[1]===254)return dMe(n,r);if(a[1]===0&&a[2]===2&&a[3]===0)return Wm.to_workbook(n,r);break;case 0:if(a[1]===0&&(a[2]>=2&&a[3]===0||a[2]===0&&(a[3]===8||a[3]===9)))return Wm.to_workbook(n,r);break;case 3:case 131:case 139:case 140:return hk.to_workbook(n,r);case 123:if(a[1]===92&&a[2]===114&&a[3]===116)return vY.to_workbook(n,r);break;case 10:case 13:case 32:return uMe(n,r);case 137:if(a[1]===80&&a[2]===78&&a[3]===71)throw new Error("PNG Image File is not a spreadsheet");break}return xEe.indexOf(a[0])>-1&&a[2]<=12&&a[3]<=31?hk.to_workbook(n,r):f3(e,n,r,s)}function rK(e,t){switch(t.type){case"base64":case"binary":break;case"buffer":case"array":t.type="";break;case"file":return M1(t.file,br.write(e,{type:Yr?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");default:throw new Error("Unrecognized type "+t.type)}return br.write(e,t)}function hMe(e,t){var r=Na(t||{}),n=iMe(e,r);return mMe(n,r)}function mMe(e,t){var r={},n=Yr?"nodebuffer":typeof Uint8Array<"u"?"array":"string";if(t.compression&&(r.compression="DEFLATE"),t.password)r.type=n;else switch(t.type){case"base64":r.type="base64";break;case"binary":r.type="string";break;case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");case"buffer":case"file":r.type=n;break;default:throw new Error("Unrecognized type "+t.type)}var a=e.FullPaths?br.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[r.type]||r.type,compression:!!t.compression}):e.generate(r);if(typeof Deno<"u"&&typeof a=="string"){if(t.type=="binary"||t.type=="base64")return a;a=new Uint8Array(Y5(a))}return t.password&&typeof encrypt_agile<"u"?rK(encrypt_agile(a,t.password),t):t.type==="file"?M1(t.file,a):t.type=="string"?Xn(a):a}function pMe(e,t){var r=t||{},n=fRe(e,r);return rK(n,r)}function Au(e,t,r){r||(r="");var n=r+e;switch(t.type){case"base64":return Gv(Mu(n));case"binary":return Mu(n);case"string":return e;case"file":return M1(t.file,n,"utf8");case"buffer":return Yr?hf(n,"utf8"):typeof TextEncoder<"u"?new TextEncoder().encode(n):Au(n,{type:"binary"}).split("").map(function(a){return a.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function xMe(e,t){switch(t.type){case"base64":return Gv(e);case"binary":return e;case"string":return e;case"file":return M1(t.file,e,"binary");case"buffer":return Yr?hf(e,"binary"):e.split("").map(function(r){return r.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function Lb(e,t){switch(t.type){case"string":case"base64":case"binary":for(var r="",n=0;n<e.length;++n)r+=String.fromCharCode(e[n]);return t.type=="base64"?Gv(r):t.type=="string"?Xn(r):r;case"file":return M1(t.file,e);case"buffer":return e;default:throw new Error("Unrecognized type "+t.type)}}function nK(e,t){fE(),lOe(e);var r=Na(t||{});if(r.cellStyles&&(r.cellNF=!0,r.sheetStubs=!0),r.type=="array"){r.type="binary";var n=nK(e,r);return r.type="array",Y5(n)}var a=0;if(r.sheet&&(typeof r.sheet=="number"?a=r.sheet:a=e.SheetNames.indexOf(r.sheet),!e.SheetNames[a]))throw new Error("Sheet not found: "+r.sheet+" : "+typeof r.sheet);switch(r.bookType||"xlsb"){case"xml":case"xlml":return Au(iRe(e,r),r);case"slk":case"sylk":return Au(uY.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"htm":case"html":return Au(KY(e.Sheets[e.SheetNames[a]],r),r);case"txt":return xMe(aK(e.Sheets[e.SheetNames[a]],r),r);case"csv":return Au(YE(e.Sheets[e.SheetNames[a]],r),r,"\uFEFF");case"dif":return Au(dY.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"dbf":return Lb(hk.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"prn":return Au(xx.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"rtf":return Au(vY.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"eth":return Au(fY.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"fods":return Au(QY(e,r),r);case"wk1":return Lb(Wm.sheet_to_wk1(e.Sheets[e.SheetNames[a]],r),r);case"wk3":return Lb(Wm.book_to_wk3(e,r),r);case"biff2":r.biff||(r.biff=2);case"biff3":r.biff||(r.biff=3);case"biff4":return r.biff||(r.biff=4),Lb(YY(e,r),r);case"biff5":r.biff||(r.biff=5);case"biff8":case"xla":case"xls":return r.biff||(r.biff=8),pMe(e,r);case"xlsx":case"xlsm":case"xlam":case"xlsb":case"numbers":case"ods":return hMe(e,r);default:throw new Error("Unrecognized bookType |"+r.bookType+"|")}}function gMe(e){if(!e.bookType){var t={xls:"biff8",htm:"html",slk:"sylk",socialcalc:"eth",Sh33tJS:"WTF"},r=e.file.slice(e.file.lastIndexOf(".")).toLowerCase();r.match(/^\.[a-z]+$/)&&(e.bookType=r.slice(1)),e.bookType=t[e.bookType]||e.bookType}}function vMe(e,t,r){var n={};return n.type="file",n.file=t,gMe(n),nK(e,n)}function yMe(e,t,r,n,a,s,o,l){var u=hi(r),d=l.defval,f=l.raw||!Object.prototype.hasOwnProperty.call(l,"raw"),m=!0,g=a===1?[]:{};if(a!==1)if(Object.defineProperty)try{Object.defineProperty(g,"__rowNum__",{value:r,enumerable:!1})}catch{g.__rowNum__=r}else g.__rowNum__=r;if(!o||e[r])for(var x=t.s.c;x<=t.e.c;++x){var y=o?e[r][x]:e[n[x]+u];if(y===void 0||y.t===void 0){if(d===void 0)continue;s[x]!=null&&(g[s[x]]=d);continue}var v=y.v;switch(y.t){case"z":if(v==null)break;continue;case"e":v=v==0?null:void 0;break;case"s":case"d":case"b":case"n":break;default:throw new Error("unrecognized type "+y.t)}if(s[x]!=null){if(v==null)if(y.t=="e"&&v===null)g[s[x]]=null;else if(d!==void 0)g[s[x]]=d;else if(f&&v===null)g[s[x]]=null;else continue;else g[s[x]]=f&&(y.t!=="n"||y.t==="n"&&l.rawNumbers!==!1)?v:nf(y,v,l);v!=null&&(m=!1)}}return{row:g,isempty:m}}function zw(e,t){if(e==null||e["!ref"]==null)return[];var r={t:"n",v:0},n=0,a=1,s=[],o=0,l="",u={s:{r:0,c:0},e:{r:0,c:0}},d=t||{},f=d.range!=null?d.range:e["!ref"];switch(d.header===1?n=1:d.header==="A"?n=2:Array.isArray(d.header)?n=3:d.header==null&&(n=0),typeof f){case"string":u=yn(f);break;case"number":u=yn(e["!ref"]),u.s.r=f;break;default:u=f}n>0&&(a=0);var m=hi(u.s.r),g=[],x=[],y=0,v=0,w=Array.isArray(e),j=u.s.r,k=0,A={};w&&!e[j]&&(e[j]=[]);var T=d.skipHidden&&e["!cols"]||[],M=d.skipHidden&&e["!rows"]||[];for(k=u.s.c;k<=u.e.c;++k)if(!(T[k]||{}).hidden)switch(g[k]=Ia(k),r=w?e[j][k]:e[g[k]+m],n){case 1:s[k]=k-u.s.c;break;case 2:s[k]=g[k];break;case 3:s[k]=d.header[k-u.s.c];break;default:if(r==null&&(r={w:"__EMPTY",t:"s"}),l=o=nf(r,null,d),v=A[o]||0,!v)A[o]=1;else{do l=o+"_"+v++;while(A[l]);A[o]=v,A[l]=1}s[k]=l}for(j=u.s.r+a;j<=u.e.r;++j)if(!(M[j]||{}).hidden){var B=yMe(e,u,j,g,n,s,w,d);(B.isempty===!1||(n===1?d.blankrows!==!1:d.blankrows))&&(x[y++]=B.row)}return x.length=y,x}var V7=/"/g;function bMe(e,t,r,n,a,s,o,l){for(var u=!0,d=[],f="",m=hi(r),g=t.s.c;g<=t.e.c;++g)if(n[g]){var x=l.dense?(e[r]||[])[g]:e[n[g]+m];if(x==null)f="";else if(x.v!=null){u=!1,f=""+(l.rawNumbers&&x.t=="n"?x.v:nf(x,null,l));for(var y=0,v=0;y!==f.length;++y)if((v=f.charCodeAt(y))===a||v===s||v===34||l.forceQuotes){f='"'+f.replace(V7,'""')+'"';break}f=="ID"&&(f='"ID"')}else x.f!=null&&!x.F?(u=!1,f="="+x.f,f.indexOf(",")>=0&&(f='"'+f.replace(V7,'""')+'"')):f="";d.push(f)}return l.blankrows===!1&&u?null:d.join(o)}function YE(e,t){var r=[],n=t??{};if(e==null||e["!ref"]==null)return"";var a=yn(e["!ref"]),s=n.FS!==void 0?n.FS:",",o=s.charCodeAt(0),l=n.RS!==void 0?n.RS:`
`,u=l.charCodeAt(0),d=new RegExp((s=="|"?"\\|":s)+"+$"),f="",m=[];n.dense=Array.isArray(e);for(var g=n.skipHidden&&e["!cols"]||[],x=n.skipHidden&&e["!rows"]||[],y=a.s.c;y<=a.e.c;++y)(g[y]||{}).hidden||(m[y]=Ia(y));for(var v=0,w=a.s.r;w<=a.e.r;++w)(x[w]||{}).hidden||(f=bMe(e,a,w,m,o,u,s,n),f!=null&&(n.strip&&(f=f.replace(d,"")),(f||n.blankrows!==!1)&&r.push((v++?l:"")+f)));return delete n.dense,r.join("")}function aK(e,t){t||(t={}),t.FS="	",t.RS=`
`;var r=YE(e,t);return r}function wMe(e){var t="",r,n="";if(e==null||e["!ref"]==null)return[];var a=yn(e["!ref"]),s="",o=[],l,u=[],d=Array.isArray(e);for(l=a.s.c;l<=a.e.c;++l)o[l]=Ia(l);for(var f=a.s.r;f<=a.e.r;++f)for(s=hi(f),l=a.s.c;l<=a.e.c;++l)if(t=o[l]+s,r=d?(e[f]||[])[l]:e[t],n="",r!==void 0){if(r.F!=null){if(t=r.F,!r.f)continue;n=r.f,t.indexOf(":")==-1&&(t=t+":"+t)}if(r.f!=null)n=r.f;else{if(r.t=="z")continue;if(r.t=="n"&&r.v!=null)n=""+r.v;else if(r.t=="b")n=r.v?"TRUE":"FALSE";else if(r.w!==void 0)n="'"+r.w;else{if(r.v===void 0)continue;r.t=="s"?n="'"+r.v:n=""+r.v}}u[u.length]=t+"="+n}return u}function iK(e,t,r){var n=r||{},a=+!n.skipHeader,s=e||{},o=0,l=0;if(s&&n.origin!=null)if(typeof n.origin=="number")o=n.origin;else{var u=typeof n.origin=="string"?Fa(n.origin):n.origin;o=u.r,l=u.c}var d,f={s:{c:0,r:0},e:{c:l,r:o+t.length-1+a}};if(s["!ref"]){var m=yn(s["!ref"]);f.e.c=Math.max(f.e.c,m.e.c),f.e.r=Math.max(f.e.r,m.e.r),o==-1&&(o=m.e.r+1,f.e.r=o+t.length-1+a)}else o==-1&&(o=0,f.e.r=t.length-1+a);var g=n.header||[],x=0;t.forEach(function(v,w){ri(v).forEach(function(j){(x=g.indexOf(j))==-1&&(g[x=g.length]=j);var k=v[j],A="z",T="",M=_r({c:l+x,r:o+w+a});d=i1(s,M),k&&typeof k=="object"&&!(k instanceof Date)?s[M]=k:(typeof k=="number"?A="n":typeof k=="boolean"?A="b":typeof k=="string"?A="s":k instanceof Date?(A="d",n.cellDates||(A="n",k=Hi(k)),T=n.dateNF||Cr[14]):k===null&&n.nullError&&(A="e",k=0),d?(d.t=A,d.v=k,delete d.w,delete d.R,T&&(d.z=T)):s[M]=d={t:A,v:k},T&&(d.z=T))})}),f.e.c=Math.max(f.e.c,l+g.length-1);var y=hi(o);if(a)for(x=0;x<g.length;++x)s[Ia(x+l)+y]={t:"s",v:g[x]};return s["!ref"]=zr(f),s}function jMe(e,t){return iK(null,e,t)}function i1(e,t,r){if(typeof t=="string"){if(Array.isArray(e)){var n=Fa(t);return e[n.r]||(e[n.r]=[]),e[n.r][n.c]||(e[n.r][n.c]={t:"z"})}return e[t]||(e[t]={t:"z"})}return typeof t!="number"?i1(e,_r(t)):i1(e,_r({r:t,c:r||0}))}function NMe(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 r=e.SheetNames.indexOf(t);if(r>-1)return r;throw new Error("Cannot find sheet name |"+t+"|")}else throw new Error("Cannot find sheet |"+t+"|")}function KE(){return{SheetNames:[],Sheets:{}}}function XE(e,t,r,n){var a=1;if(!r)for(;a<=65535&&e.SheetNames.indexOf(r="Sheet"+a)!=-1;++a,r=void 0);if(!r||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(n&&e.SheetNames.indexOf(r)>=0){var s=r.match(/(^.*?)(\d+)$/);a=s&&+s[2]||0;var o=s&&s[1]||r;for(++a;a<=65535&&e.SheetNames.indexOf(r=o+a)!=-1;++a);}if($Y(r),e.SheetNames.indexOf(r)>=0)throw new Error("Worksheet with name |"+r+"| already exists!");return e.SheetNames.push(r),e.Sheets[r]=t,r}function SMe(e,t,r){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var n=NMe(e,t);switch(e.Workbook.Sheets[n]||(e.Workbook.Sheets[n]={}),r){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+r)}e.Workbook.Sheets[n].Hidden=r}function AMe(e,t){return e.z=t,e}function sK(e,t,r){return t?(e.l={Target:t},r&&(e.l.Tooltip=r)):delete e.l,e}function kMe(e,t,r){return sK(e,"#"+t,r)}function CMe(e,t,r){e.c||(e.c=[]),e.c.push({t,a:r||"SheetJS"})}function _Me(e,t,r,n){for(var a=typeof t!="string"?t:yn(t),s=typeof t=="string"?t:zr(t),o=a.s.r;o<=a.e.r;++o)for(var l=a.s.c;l<=a.e.c;++l){var u=i1(e,o,l);u.t="n",u.F=s,delete u.v,o==a.s.r&&l==a.s.c&&(u.f=r,n&&(u.D=!0))}return e}var Ib={encode_col:Ia,encode_row:hi,encode_cell:_r,encode_range:zr,decode_col:AE,decode_row:SE,split_cell:Fke,decode_cell:Fa,decode_range:$o,format_cell:nf,sheet_add_aoa:OG,sheet_add_json:iK,sheet_add_dom:XY,aoa_to_sheet:Bx,json_to_sheet:jMe,table_to_sheet:ZY,table_to_book:RRe,sheet_to_csv:YE,sheet_to_txt:aK,sheet_to_json:zw,sheet_to_html:KY,sheet_to_formulae:wMe,sheet_to_row_object_array:zw,sheet_get_cell:i1,book_new:KE,book_append_sheet:XE,book_set_sheet_visibility:SMe,cell_set_number_format:AMe,cell_set_hyperlink:sK,cell_set_internal_link:kMe,cell_add_comment:CMe,sheet_set_array_formula:_Me,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};const Fb=[{key:"users",label:"Users"},{key:"roles",label:"Roles"},{key:"rolePermissions",label:"Role Permissions"},{key:"departments",label:"Organization / Departments"},{key:"engineers",label:"Engineers / Employees"},{key:"clients",label:"Clients"},{key:"projects",label:"Projects"},{key:"tasks",label:"Tasks"},{key:"expenses",label:"Company Expenses"},{key:"jobs",label:"Job Openings"},{key:"candidates",label:"Candidates"},{key:"documents",label:"Documents"},{key:"leads",label:"Leads / Recruitment"}];function EMe(){const[e,t]=N.useState(!1),[r,n]=N.useState(!1),[a,s]=N.useState(!1),o=async()=>{t(!0);try{const g=Ib.book_new();(await Promise.all(Fb.map(async({key:v,label:w})=>{const j=await Bt.get(v,[]);return{key:v,label:w,data:Array.isArray(j)?j:[j]}}))).forEach(({label:v,data:w})=>{const j=v.replace(/[:\\/?*[\]]/g,"_").substring(0,31),k=Ib.json_to_sheet(w);Ib.book_append_sheet(g,k,j)});const y=`ERP_Data_Export_${new Date().toISOString().split("T")[0]}.xlsx`;vMe(g,y),De.success("Data exported successfully to Excel")}catch(g){console.error("Export error:",g),De.error("Failed to export data")}finally{t(!1)}},l=async g=>{var v;const x=(v=g.target.files)==null?void 0:v[0];if(!x)return;n(!0);const y=new FileReader;y.onload=async w=>{var j;try{const k=new Uint8Array((j=w.target)==null?void 0:j.result),A=gk(k,{type:"array"}),T=A.SheetNames.map(async M=>{const B=Fb.find(F=>F.label.replace(/[:\\/?*[\]]/g,"_").substring(0,31)===M);if(!B)return;const L=Ib.sheet_to_json(A.Sheets[M]);B.key==="rolePermissions"?await Bt.set(B.key,L[0]||{}):await Bt.set(B.key,L)});await Promise.all(T),De.success("Data imported successfully. Refreshing application..."),setTimeout(()=>window.location.reload(),1500)}catch(k){console.error("Import error:",k),De.error("Failed to import data. Please check file format.")}finally{n(!1),g.target&&(g.target.value="")}},y.readAsArrayBuffer(x)},u=async()=>{if(confirm("CRITICAL: This will delete ALL data and reset the system to its initial state. This cannot be undone. Are you absolutely sure?")){s(!0);try{await Promise.all(Fb.map(({key:g})=>Bt.set(g,[]))),De.success("System database reset successfully"),setTimeout(()=>window.location.reload(),1500)}catch{De.error("Failed to reset database")}finally{s(!1)}}},[d,f]=N.useState(!1),m=async()=>{f(!0);try{const g=await fetch("/api/admin/migrate",{credentials:"include"});if(!g.ok)throw new Error(`Server returned ${g.status}: ${g.statusText}`);const x=await g.json();x.success?(De.success("Server data consolidated successfully! Please refresh your browser."),setTimeout(()=>{window.location.reload()},1500)):De.error("Sync failed: "+x.error)}catch(g){console.error("Sync error:",g),De.error("Could not connect to sync service")}finally{f(!1)}};return i.jsxs("div",{className:"space-y-8",children:[i.jsx("div",{className:"rounded-xl border border-blue-500/20 bg-blue-500/5 p-6",children:i.jsxs("div",{className:"flex items-start gap-4",children:[i.jsx("div",{className:"rounded-lg bg-blue-500/10 p-3 text-blue-500",children:i.jsx(Nc,{size:24})}),i.jsxs("div",{className:"flex-1 space-y-1",children:[i.jsx("h3",{className:"font-semibold text-foreground",children:"Database Sync & Repair"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Run this tool if data created by one user is not visible to others. It will search all private folders and merge everything into the main shared database."}),i.jsx("div",{className:"pt-4",children:i.jsx("button",{onClick:m,disabled:d,className:"flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 transition-all disabled:opacity-50",children:d?i.jsxs(i.Fragment,{children:[i.jsx(Nc,{className:"animate-spin",size:16}),"Syncing..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Nc,{size:16}),"Run Global Repair Sync"]})})})]})]})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"p-6 rounded-2xl border border-border bg-card shadow-sm space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"p-3 rounded-xl bg-primary/10 text-primary",children:i.jsx(Nr,{size:24})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold",children:"Export Data"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Download all system data as an Excel file."})]})]}),i.jsxs("div",{className:"p-4 rounded-xl bg-muted/30 border border-border",children:[i.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground mb-3",children:"Included Modules:"}),i.jsx("div",{className:"grid grid-cols-2 gap-2",children:Fb.map(g=>i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(Hl,{size:12,className:"text-primary"}),g.label]},g.key))})]}),i.jsxs("button",{onClick:o,disabled:e,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-primary px-4 py-3 text-sm font-bold text-primary-foreground hover:bg-primary/90 transition-all disabled:opacity-50",children:[e?i.jsx(Nc,{size:18,className:"animate-spin"}):i.jsx(Nr,{size:18}),e?"Exporting...":"Export to Excel (.xlsx)"]})]}),i.jsxs(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"p-6 rounded-2xl border border-border bg-card shadow-sm space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"p-3 rounded-xl bg-blue-500/10 text-blue-500",children:i.jsx(co,{size:24})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold",children:"Import Data"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Restore or update data from a previously exported file."})]})]}),i.jsx("div",{className:"p-4 rounded-xl bg-blue-500/5 border border-blue-500/10",children:i.jsxs("div",{className:"flex gap-3",children:[i.jsx(pl,{size:18,className:"text-blue-500 shrink-0"}),i.jsx("p",{className:"text-xs text-blue-700 leading-relaxed",children:"Importing data will overwrite existing records with the same IDs. Ensure your file follows the correct format (exported from this system)."})]})}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"file",accept:".xlsx,.xls,.csv",onChange:l,disabled:r,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer disabled:cursor-not-allowed"}),i.jsx("div",{className:"flex items-center justify-center gap-2 rounded-xl border-2 border-dashed border-border px-4 py-8 text-sm font-medium text-muted-foreground hover:border-primary/50 hover:bg-muted/30 transition-all",children:r?i.jsx(Nc,{size:24,className:"animate-spin text-primary"}):i.jsxs("div",{className:"text-center",children:[i.jsx(Tn,{size:32,className:"mx-auto mb-2 opacity-20"}),i.jsx("p",{children:"Click or drag file to import"}),i.jsx("p",{className:"text-[10px] mt-1",children:"Supports .xlsx, .xls, .csv"})]})})]})]})]}),i.jsxs(ar.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"p-6 rounded-2xl border border-destructive/20 bg-destructive/5 space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"p-3 rounded-xl bg-destructive/10 text-destructive",children:i.jsx(ev,{size:24})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold text-destructive",children:"Database Maintenance"}),i.jsx("p",{className:"text-sm text-destructive/70",children:"Advanced tools for system administrators."})]})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[i.jsxs("button",{onClick:u,disabled:a,className:"flex-1 flex items-center justify-center gap-2 rounded-xl border border-destructive/50 bg-card px-4 py-3 text-sm font-bold text-destructive hover:bg-destructive hover:text-destructive-foreground transition-all disabled:opacity-50",children:[a?i.jsx(Nc,{size:18,className:"animate-spin"}):i.jsx(aa,{size:18}),"Reset System Database"]}),i.jsx("div",{className:"flex-1 p-4 rounded-xl bg-card border border-destructive/10",children:i.jsx("p",{className:"text-xs text-muted-foreground italic",children:"* Resetting the database will clear all records across all modules. User accounts and role permissions will also be reset to defaults."})})]})]})]})}function TMe(){const[e,t]=N.useState(null),[r,n]=N.useState(!1),[a,s]=N.useState(0),[o,l]=N.useState("idle"),u=f=>{var g;const m=(g=f.target.files)==null?void 0:g[0];if(m){if(m.type!=="application/zip"&&!m.name.endsWith(".zip")){De.error("Please select a ZIP file");return}t(m),l("idle")}},d=async()=>{if(!e){De.error("Please select a file first");return}n(!0),l("uploading"),s(0);const f=setInterval(()=>{s(m=>m>=95?(clearInterval(f),95):m+5)},100);try{await new Promise(m=>setTimeout(m,2e3)),s(100),l("verifying"),await new Promise(m=>setTimeout(m,1500)),l("success"),De.success("System update package uploaded and verified successfully")}catch{l("error"),De.error("Failed to upload update package")}finally{n(!1),clearInterval(f)}};return i.jsxs("div",{className:"space-y-6",children:[i.jsx("div",{className:"bg-primary/5 rounded-2xl p-6 border border-primary/10 mb-6",children:i.jsxs("div",{className:"flex items-start gap-4",children:[i.jsx("div",{className:"p-3 rounded-xl bg-primary/10 text-primary",children:i.jsx(bh,{size:24})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold",children:"System Update & Import"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Upload a ZIP package to update system modules, components, or static assets. Always ensure you have a full database backup before proceeding with system-wide imports."})]})]})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:`
              relative border-2 border-dashed rounded-2xl p-10 flex flex-col items-center justify-center transition-all
              ${o==="success"?"border-green-500 bg-green-50":"border-border bg-muted/30 hover:border-primary/50"}
            `,children:[i.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",accept:".zip",onChange:u,disabled:r}),i.jsx("div",{className:`p-4 rounded-full mb-4 ${o==="success"?"bg-green-100 text-green-600":"bg-primary/10 text-primary"}`,children:o==="success"?i.jsx(Hl,{size:40}):i.jsx(kk,{size:40})}),i.jsxs("div",{className:"text-center",children:[i.jsx("p",{className:"font-semibold text-lg",children:e?e.name:"Click or drag ZIP file here"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e?`${(e.size/(1024*1024)).toFixed(2)} MB`:"System package format (.zip) only"})]}),o==="uploading"&&i.jsxs("div",{className:"absolute inset-x-6 bottom-6",children:[i.jsx("div",{className:"h-1.5 w-full bg-border rounded-full overflow-hidden",children:i.jsx(ar.div,{initial:{width:0},animate:{width:`${a}%`},className:"h-full bg-primary"})}),i.jsxs("p",{className:"text-[10px] text-center mt-2 font-medium text-primary",children:["Uploading... ",a,"%"]})]})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs("button",{onClick:d,disabled:!e||r||o==="success",className:"flex-1 flex items-center justify-center gap-2 bg-primary text-primary-foreground px-6 py-3 rounded-xl font-bold hover:bg-primary/90 transition-all disabled:opacity-50 shadow-lg shadow-primary/20",children:[r?i.jsx(Nc,{className:"animate-spin",size:18}):i.jsx(co,{size:18}),"Push Update Package"]}),o==="success"&&i.jsx("button",{onClick:()=>{t(null),l("idle")},className:"px-6 py-3 rounded-xl font-bold border border-border hover:bg-muted transition-all",children:"Reset"})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("h4",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-2",children:["Import History",i.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"p-4 rounded-xl border border-border bg-card flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-green-500/10 text-green-500",children:i.jsx(Hl,{size:16})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold",children:"V-2.4.0-Patch.zip"}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Applied on April 22, 2024"})]})]}),i.jsxs("div",{className:"text-right",children:[i.jsx("p",{className:"text-[10px] font-bold text-muted-foreground",children:"Admin-01"}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"42.5 MB"})]})]}),i.jsxs("div",{className:"p-4 rounded-xl border border-border bg-card flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-green-500/10 text-green-500",children:i.jsx(Hl,{size:16})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold",children:"Base_Assets_V1.zip"}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Applied on April 15, 2024"})]})]}),i.jsxs("div",{className:"text-right",children:[i.jsx("p",{className:"text-[10px] font-bold text-muted-foreground",children:"System"}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"128.0 MB"})]})]}),i.jsxs("div",{className:"p-4 rounded-xl border border-border bg-card flex items-center justify-between opacity-60",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-red-500/10 text-red-500",children:i.jsx(pl,{size:16})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold",children:"Corrupted_Patch.zip"}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Failed on April 10, 2024"})]})]}),i.jsx("div",{className:"text-right text-red-500 text-[10px] font-bold",children:"INVALID HASH"})]})]}),i.jsxs("button",{className:"w-full py-2 text-xs font-bold text-primary hover:underline flex items-center justify-center gap-1 mt-2",children:["View Detailed System Logs",i.jsx(wv,{size:12})]})]})]})]})}function PMe(){var Ge;const{profile:e,rolePermissions:t,updateRolePermissions:r,modules:n,roles:a,systemUsers:s,updateSystemUsers:o,updateRoles:l,hasPermission:u}=la(),{companySettings:d,updateCompanySettings:f}=ca(),[m,g]=N.useState("general"),[x,y]=N.useState("permissions"),[v,w]=N.useState("Administrator"),[j,k]=N.useState(!1),[A,T]=N.useState(!1),[M,B]=N.useState(null),[L,F]=N.useState({name:"",description:""}),[I,q]=N.useState(null),[P,R]=N.useState(null),[K,ee]=N.useState(!1),[se,Z]=N.useState(!1),[ne,X]=N.useState(null),[le,Ae]=N.useState(d.name||""),[ce,D]=N.useState(d.email||""),[H,G]=N.useState(d.logo||""),[E,re]=N.useState(d.location||""),[he,oe]=N.useState(d.phone||""),[z,fe]=N.useState({fullName:"",email:"",password:"",phone:"",role:"Employee"}),de=N.useMemo(()=>{const Be={};return s.forEach(it=>{Be[it.role]=(Be[it.role]||0)+1}),Be},[s]),[W,ae]=N.useState([]);N.useEffect(()=>{ae(a.map(Be=>({...Be,users:de[Be.name]||0})))},[a,de]);const _e=N.useMemo(()=>s.map(Be=>({id:Be.uid||Be.id,name:Be.name,email:Be.email,role:Be.role,avatar:Be.photoURL})),[s]);N.useEffect(()=>{Ae(d.name||""),D(d.email||""),G(d.logo||""),re(d.location||""),oe(d.phone||"")},[d]);const ue=async()=>{ee(!0);try{await f({name:le,email:ce,logo:H,location:E,phone:he}),De.success("General settings saved successfully")}catch{De.error("Failed to save settings")}finally{ee(!1)}},ke=Be=>{var st;const it=(st=Be.target.files)==null?void 0:st[0];if(it){const Ve=new FileReader;Ve.onloadend=()=>{G(Ve.result)},Ve.readAsDataURL(it)}},$e=Be=>{fe(it=>({...it,role:Be})),Z(!0)},Je=async()=>{if(!z.fullName||!z.email||!ne&&!z.password){De.error("Please fill in all required fields");return}ee(!0);try{if(ne){const Be=s.map(it=>it.uid===ne||it.id===ne?{...it,name:z.fullName,email:z.email,role:z.role}:it);await o(Be),De.success(`User ${z.fullName} updated successfully`)}else{const Be=crypto.randomUUID().split("-")[0],it={uid:Be,id:Be,tenantId:(e==null?void 0:e.tenantId)||(e==null?void 0:e.uid),name:z.fullName,email:z.email,username:z.email.split("@")[0],password:z.password,role:z.role,createdAt:new Date().toISOString()};await o([...s,it]),De.success(`User ${z.fullName} created and assigned to ${z.role}`)}Z(!1),X(null),fe({fullName:"",email:"",password:"",phone:"",role:"Employee"})}catch{De.error("Failed to save user")}finally{ee(!1)}},Xe=Be=>{X(Be.id),fe({fullName:Be.name,email:Be.email,password:"",phone:"",role:Be.role}),Z(!0)},Ne=async()=>{if(M){ee(!0);try{const Be=s.filter(it=>it.uid!==M.id&&it.id!==M.id);await o(Be),De.success("User removed successfully"),T(!1),B(null)}catch{De.error("Failed to delete user")}finally{ee(!1)}}},Ye=Be=>{B(Be),T(!0)},at=async(Be,it)=>{if(!K){ee(!0);try{const st=t[Be]||[],Ve=st.includes(it)?st.filter(Ue=>Ue!==it):[...st,it],te={...t,[Be]:Ve};await r(te),De.success("Permission updated")}catch(st){console.error("Toggle permission error:",st),De.error("Failed to update permission")}finally{ee(!1)}}},Y=async(Be,it,st)=>{if(!K){ee(!0);try{const Ve=n.find(_t=>_t.id===it);if(!Ve)return;const te=Ve.actions.map(_t=>`${it}.${_t}`),Ue=t[Be]||[];let ot;st?ot=[...new Set([...Ue,...te])]:ot=Ue.filter(_t=>!te.includes(_t));const vt={...t,[Be]:ot};await r(vt),De.success(`${st?"Granted":"Revoked"} all ${Ve.name} permissions`)}catch(Ve){console.error("Toggle module error:",Ve),De.error("Failed to update module permissions")}finally{ee(!1)}}},we=async()=>{if(K)return;if(!L.name||!L.name.trim()){De.error("Role name is required");return}const Be=L.name.trim(),it=L.description||"";ee(!0);try{if(I){if(W.some(te=>te.name.toLowerCase()===Be.toLowerCase()&&te.name!==I)){De.error("Another role already has this name"),ee(!1);return}const Ve=W.map(te=>te.name===I?{...te,name:Be,description:it}:te);if(await l(Ve.map(({name:te,description:Ue})=>({name:te,description:Ue}))),I!==Be){const te={...t};te[Be]=te[I]||[],delete te[I],await r(te),v===I&&w(Be)}ae(Ve),De.success("Role updated successfully")}else{if(W.some(Ue=>Ue.name.toLowerCase()===Be.toLowerCase())){De.error("Role already exists"),ee(!1);return}const Ve=[...W,{name:Be,description:it,users:0}];await l(Ve.map(({name:Ue,description:ot})=>({name:Ue,description:ot})));const te={...t};te[Be]||(te[Be]=[],await r(te)),ae(Ve),De.success("New role created successfully")}k(!1),F({name:"",description:""}),q(null)}catch(st){console.error("Add role error:",st),De.error(`Failed to save role: ${st.message||"Unknown error"}`)}finally{ee(!1)}},J=Be=>{const it=W.find(st=>st.name===Be);it&&(F({name:it.name,description:it.description}),q(Be),k(!0))},ve=async Be=>{if(Be==="Administrator"){De.error("Cannot delete Administrator role");return}if(!K){ee(!0);try{const it=W.filter(Ve=>Ve.name!==Be);ae(it),await l(it.map(({name:Ve,description:te})=>({name:Ve,description:te})));const st={...t};delete st[Be],await r(st),v===Be&&w("Administrator"),De.success(`${Be} role deleted`)}catch(it){console.error("Delete role error:",it),De.error("Failed to delete role")}finally{ee(!1)}}},Oe=async Be=>{const it=W.find(st=>st.name===Be);if(it){if(K)return;ee(!0);try{const st=`${Be} (Copy)`,Ve=[...W,{...it,name:st,users:0}];ae(Ve),await l(Ve.map(({name:te,description:Ue})=>({name:te,description:Ue}))),await r({...t,[st]:[...t[Be]||[]]}),De.success(`Duplicated ${Be}`)}catch(st){console.error("Duplicate role error:",st),De.error("Failed to duplicate role")}finally{ee(!1)}}},xe=()=>{ee(!0),setTimeout(()=>{ee(!1),De.success("Settings saved successfully")},1200)},qe=async()=>{if(!K){ee(!0);try{await l([{name:"Administrator",description:"Full system access and configuration",users:0},{name:"Manager",description:"Access to departmental reports and tasks",users:0},{name:"Employee",description:"Standard access to personal tasks and documents",users:0},{name:"Guest",description:"Limited read-only access to specific projects",users:0}]),await r({Administrator:["dashboard.view","crm.view","crm.create","crm.edit","crm.delete","crm.export","projects.view","projects.view_all","projects.create","projects.edit","projects.delete","projects.export","tasks.view","tasks.view_all","tasks.create","tasks.edit","tasks.delete","tasks.export","finance.view","finance.create","finance.edit","finance.delete","finance.export","hr.view","hr.create","hr.edit","hr.delete","hr.export","operations.view","operations.create","operations.edit","operations.delete","operations.export","documents.view","documents.create","documents.edit","documents.delete","documents.export","settings.view","settings.edit"],Manager:["dashboard.view","crm.view","crm.create","crm.edit","projects.view","projects.view_all","projects.create","projects.edit","tasks.view","tasks.view_all","tasks.create","tasks.edit","hr.view","operations.view","documents.view","documents.create"],Employee:["dashboard.view","projects.view","tasks.view","documents.view"],Guest:[]}),De.info("Settings reset to default")}catch(Be){console.error("Reset roles error:",Be),De.error("Failed to reset roles")}finally{ee(!1)}}},me=async()=>{if(confirm("CRITICAL ACTION: This will delete ALL projects, tasks, expenses, clients, engineers, jobs, candidates, and documents from the server. This cannot be undone. Are you absolutely sure?")){ee(!0);try{const Be=["projects","tasks","expenses","clients","engineers","departments","jobs","candidates","documents","leads"];await Promise.all(Be.map(it=>Bt.set(it,[]))),De.success("All application data has been cleared from the server"),window.location.reload()}catch(Be){console.error("Error clearing data:",Be),De.error("Failed to clear data.")}finally{ee(!1)}}};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"System Settings"}),i.jsx("p",{className:"text-muted-foreground",children:"Configure global application preferences, user roles, and security protocols."})]}),i.jsxs("div",{className:"flex flex-col lg:flex-row gap-8",children:[i.jsxs("div",{className:"w-full lg:w-64 space-y-1",children:[i.jsx(wm,{icon:Km,label:"General",active:m==="general",onClick:()=>g("general")}),i.jsx(wm,{icon:ls,label:"User Management",active:m==="users",onClick:()=>g("users")}),i.jsx(wm,{icon:Pu,label:"Security & Privacy",active:m==="security",onClick:()=>g("security")}),i.jsx(wm,{icon:c2,label:"Notifications",active:m==="notifications",onClick:()=>g("notifications")}),i.jsx(wm,{icon:Tee,label:"Integrations & API",active:m==="integrations",onClick:()=>g("integrations")}),i.jsx(wm,{icon:ev,label:"Data Management",active:m==="data",onClick:()=>g("data")}),i.jsx(wm,{icon:kk,label:"Code Import",active:m==="import",onClick:()=>g("import")})]}),i.jsx("div",{className:"flex-1 space-y-6",children:i.jsxs("div",{className:"rounded-xl border border-border bg-card shadow-sm overflow-hidden",children:[i.jsxs("div",{className:"p-6 border-b border-border bg-muted/30",children:[i.jsxs("h3",{className:"font-semibold capitalize",children:[m.replace("-"," ")," Settings"]}),i.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Manage your ",m," preferences and configurations."]})]}),i.jsxs("div",{className:"p-6 space-y-6",children:[m==="general"&&i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex flex-col md:flex-row gap-8 items-start",children:[i.jsxs("div",{className:"flex flex-col items-center gap-4",children:[i.jsxs("div",{className:"h-32 w-32 rounded-2xl border-2 border-dashed border-border bg-muted/30 flex items-center justify-center overflow-hidden relative group",children:[H?i.jsx("img",{src:H,alt:"Company Logo",className:"h-full w-full object-contain",referrerPolicy:"no-referrer"}):i.jsx(zi,{size:40,className:"text-muted-foreground"}),i.jsxs("label",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center cursor-pointer",children:[i.jsx($n,{className:"text-white",size:24}),i.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:ke})]})]}),i.jsxs("div",{className:"text-center",children:[i.jsx("p",{className:"text-xs font-medium",children:"Company Logo"}),i.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"PNG, JPG up to 2MB"})]})]}),i.jsxs("div",{className:"flex-1 space-y-4 w-full",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Company Name"}),i.jsx("input",{type:"text",value:le,onChange:Be=>Ae(Be.target.value),className:"h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Support Email"}),i.jsx("input",{type:"email",value:ce,onChange:Be=>D(Be.target.value),className:"h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Location"}),i.jsx("input",{type:"text",value:E,onChange:Be=>re(Be.target.value),placeholder:"e.g. Dubai, UAE",className:"h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Phone Number"}),i.jsx("input",{type:"text",value:he,onChange:Be=>oe(Be.target.value),placeholder:"e.g. +971 4 123 4567",className:"h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Timezone"}),i.jsxs("select",{className:"h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{children:"(GMT-08:00) Pacific Time"}),i.jsx("option",{children:"(GMT-05:00) Eastern Time"}),i.jsx("option",{children:"(GMT+00:00) UTC"}),i.jsx("option",{children:"(GMT+01:00) Central European Time"})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Language"}),i.jsxs("select",{className:"h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:[i.jsx("option",{children:"English (US)"}),i.jsx("option",{children:"Spanish"}),i.jsx("option",{children:"French"}),i.jsx("option",{children:"German"})]})]})]}),i.jsx("div",{className:"flex justify-end pt-4",children:u("settings.edit")&&i.jsxs("button",{onClick:ue,disabled:K,className:"flex items-center gap-2 rounded-lg bg-primary px-6 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-all disabled:opacity-50",children:[K?i.jsx(Nc,{className:"animate-spin",size:16}):i.jsx(b3,{size:16}),"Save Changes"]})}),i.jsxs("div",{className:"pt-6 border-t border-border",children:[i.jsx("h4",{className:"text-sm font-bold text-destructive mb-2",children:"Danger Zone"}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"These actions are destructive and cannot be undone."}),u("settings.edit")&&i.jsxs("button",{onClick:me,disabled:K,className:"flex items-center gap-2 rounded-lg border border-destructive/50 bg-destructive/5 px-4 py-2 text-sm font-medium text-destructive hover:bg-destructive hover:text-destructive-foreground transition-all disabled:opacity-50",children:[i.jsx(aa,{size:16}),"Clear All Application Data"]})]})]}),m==="users"&&i.jsxs("div",{className:"space-y-8",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"p-4 rounded-2xl border border-border bg-card shadow-sm",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(ls,{size:18})}),i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Total Users"})]}),i.jsx("p",{className:"text-2xl font-bold",children:_e.length})]}),i.jsxs("div",{className:"p-4 rounded-2xl border border-border bg-card shadow-sm",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx("div",{className:"h-8 w-8 rounded-lg bg-blue-500/10 flex items-center justify-center text-blue-500",children:i.jsx(Pu,{size:18})}),i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Admins"})]}),i.jsx("p",{className:"text-2xl font-bold",children:_e.filter(Be=>Be.role==="Administrator").length})]}),i.jsxs("div",{className:"p-4 rounded-2xl border border-border bg-card shadow-sm",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx("div",{className:"h-8 w-8 rounded-lg bg-green-500/10 flex items-center justify-center text-green-500",children:i.jsx(ph,{size:18})}),i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Active Roles"})]}),i.jsx("p",{className:"text-2xl font-bold",children:W.length})]})]}),i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-8",children:[i.jsxs("div",{className:"xl:col-span-4 space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between px-1",children:[i.jsx("h4",{className:"text-sm font-bold uppercase tracking-widest text-muted-foreground",children:"System Roles"}),u("settings.edit")&&i.jsx("button",{onClick:()=>k(!0),className:"p-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary/20 transition-colors",title:"Add New Role",children:i.jsx($n,{size:16})})]}),i.jsx("div",{className:"grid grid-cols-1 gap-3",children:W.map(Be=>i.jsx(DMe,{name:Be.name,description:Be.description,users:Be.users,active:v===Be.name,onClick:()=>w(Be.name),isMenuOpen:P===Be.name,onToggleMenu:()=>R(P===Be.name?null:Be.name),onDelete:()=>ve(Be.name),onDuplicate:()=>Oe(Be.name),onEdit:()=>J(Be.name),canEdit:u("settings.edit")},Be.name))})]}),i.jsx("div",{className:"xl:col-span-8 space-y-6",children:v?i.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"space-y-6",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 bg-muted/30 p-4 rounded-2xl border border-border",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:"text-lg font-bold",children:v}),i.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-primary/10 text-primary text-[10px] font-bold uppercase tracking-wider",children:[_e.filter(Be=>Be.role===v).length," Users"]})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:(Ge=W.find(Be=>Be.name===v))==null?void 0:Ge.description})]}),i.jsx("div",{className:"flex items-center gap-2",children:u("settings.edit")&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>J(v),className:"p-2 rounded-lg border border-border bg-card hover:bg-accent transition-colors text-muted-foreground",title:"Edit Role",children:i.jsx(f2,{size:16})}),i.jsxs("button",{onClick:()=>$e(v),className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground hover:bg-primary/90 transition-all shadow-sm",children:[i.jsx($n,{size:16}),"Add User"]})]})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-1 border-b border-border",children:[i.jsxs("button",{onClick:()=>y("permissions"),className:tt("px-4 py-2 text-xs font-bold uppercase tracking-widest transition-all relative",x==="permissions"?"text-primary":"text-muted-foreground hover:text-foreground"),children:["Permissions",x==="permissions"&&i.jsx(ar.div,{layoutId:"tab-underline",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),i.jsxs("button",{onClick:()=>y("assigned-users"),className:tt("px-4 py-2 text-xs font-bold uppercase tracking-widest transition-all relative",x==="assigned-users"?"text-primary":"text-muted-foreground hover:text-foreground"),children:["Assigned Users",x==="assigned-users"&&i.jsx(ar.div,{layoutId:"tab-underline",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]}),x==="permissions"?i.jsx("div",{className:"space-y-6",children:n.map(Be=>{Be.actions.map(Ve=>`${Be.id}.${Ve}`);const it=(t[v]||[]).filter(Ve=>Ve.startsWith(`${Be.id}.`)),st=it.length===Be.actions.length;return it.length>0,i.jsxs("div",{className:"rounded-2xl border border-border bg-card overflow-hidden shadow-sm",children:[i.jsxs("div",{className:"px-6 py-4 border-b border-border bg-muted/30 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary/10 flex items-center justify-center text-primary",children:Be.id==="crm"?i.jsx(Fo,{size:18}):Be.id==="projects"?i.jsx(Ni,{size:18}):Be.id==="finance"?i.jsx(ds,{size:18}):Be.id==="hr"?i.jsx(Hn,{size:18}):Be.id==="operations"?i.jsx(xh,{size:18}):i.jsx(Pu,{size:18})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-sm font-bold",children:Be.name}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:Be.description})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:[it.length," / ",Be.actions.length," Actions"]}),i.jsx("button",{onClick:()=>Y(v,Be.id,!st),className:tt("px-3 py-1 rounded-lg text-[10px] font-bold uppercase tracking-wider transition-all",st?"bg-primary/10 text-primary hover:bg-primary/20":"bg-muted text-muted-foreground hover:bg-accent hover:text-foreground"),children:st?"Revoke All":"Grant All"})]})]}),i.jsx("div",{className:"p-6 grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-4",children:Be.actions.map(Ve=>{const te=`${Be.id}.${Ve}`,Ue=(t[v]||[]).includes(te);return i.jsxs("button",{onClick:()=>at(v,te),disabled:!u("settings.edit"),className:tt("flex flex-col items-center justify-center gap-2 p-3 rounded-xl border transition-all group",Ue?"border-primary/20 bg-primary/5 text-primary shadow-sm":"border-border bg-card hover:border-primary/30 text-muted-foreground hover:text-foreground",!u("settings.edit")&&"opacity-60 cursor-not-allowed"),children:[i.jsx("div",{className:tt("h-5 w-5 rounded border transition-colors flex items-center justify-center",Ue?"bg-primary border-primary text-white":"border-muted-foreground/30"),children:Ue&&i.jsx(ph,{size:14,strokeWidth:3})}),i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest",children:Ve})]},Ve)})})]},Be.id)})}):i.jsx("div",{className:"rounded-2xl border border-border bg-card overflow-hidden shadow-sm",children:_e.filter(Be=>Be.role===v).length>0?i.jsx("div",{className:"divide-y divide-border",children:_e.filter(Be=>Be.role===v).map(Be=>i.jsxs("div",{className:"flex items-center justify-between p-4 hover:bg-muted/30 transition-colors group",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"h-12 w-12 rounded-full bg-gradient-to-br from-primary/20 to-primary/5 flex items-center justify-center text-primary font-bold text-sm border border-primary/10",children:Be.name.split(" ").map(it=>it[0]).join("")}),i.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 h-4 w-4 rounded-full bg-green-500 border-2 border-card"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold",children:Be.name}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-0.5",children:[i.jsx(Gl,{size:12}),Be.email]})]})]}),i.jsx("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:u("settings.edit")&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Xe(Be),className:"p-2 rounded-lg text-muted-foreground hover:text-primary hover:bg-primary/10 transition-all",title:"Edit User",children:i.jsx(f2,{size:16})}),i.jsx("button",{onClick:()=>Ye({id:Be.id,name:Be.name}),className:"p-2 rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-all",title:"Delete User",children:i.jsx(aa,{size:16})})]})})]},Be.id))}):i.jsxs("div",{className:"p-12 text-center",children:[i.jsx("div",{className:"mx-auto h-16 w-16 rounded-full bg-muted/30 flex items-center justify-center text-muted-foreground/30 mb-4",children:i.jsx(ls,{size:32})}),i.jsx("p",{className:"text-sm font-bold text-foreground",children:"No users assigned"}),i.jsxs("p",{className:"text-xs text-muted-foreground mt-1 max-w-[200px] mx-auto",children:["There are currently no users assigned to the ",v," role."]}),i.jsxs("button",{onClick:()=>$e(v),className:"mt-6 text-xs font-bold text-primary hover:underline flex items-center gap-2 mx-auto",children:[i.jsx($n,{size:14}),"Assign the first user"]})]})})]})]},v):i.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-12 text-center bg-muted/10 rounded-3xl border border-dashed border-border",children:[i.jsx(Pu,{size:48,className:"text-muted-foreground/20 mb-4"}),i.jsx("h3",{className:"text-lg font-bold text-muted-foreground",children:"Select a Role"}),i.jsx("p",{className:"text-sm text-muted-foreground/60 mt-2 max-w-xs",children:"Choose a role from the left to manage its permissions and assigned users."})]})})]})]}),m==="security"&&i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border border-border bg-accent/30",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(yh,{size:20})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:"Two-Factor Authentication"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Add an extra layer of security to your account."})]})]}),i.jsx("div",{className:"h-6 w-11 rounded-full bg-primary relative cursor-pointer transition-colors",children:i.jsx("div",{className:"absolute right-1 top-1 h-4 w-4 rounded-full bg-white shadow-sm"})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"text-sm font-semibold",children:"Password Policy"}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),"Minimum 12 characters"]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),"Include special characters"]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-yellow-500"}),"Require password change every 90 days"]})]})]})]}),m==="notifications"&&i.jsxs("div",{className:"space-y-4",children:[i.jsx(Bb,{label:"Email Notifications",description:"Receive updates via email",active:!0}),i.jsx(Bb,{label:"Push Notifications",description:"Receive updates on your desktop",active:!1}),i.jsx(Bb,{label:"Project Updates",description:"Get notified when project status changes",active:!0}),i.jsx(Bb,{label:"Task Assignments",description:"Get notified when a new task is assigned",active:!0})]}),m==="integrations"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"API Key"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"password",defaultValue:"sk_test_51Mz9jL2eZ...",readOnly:!0,className:"h-10 flex-1 rounded-lg border border-border bg-muted px-3 text-sm focus:outline-none"}),i.jsx("button",{onClick:()=>De.success("API Key copied to clipboard"),className:"px-4 rounded-lg border border-border bg-card text-xs font-medium hover:bg-accent transition-colors",children:"Copy"})]})]}),i.jsxs("div",{className:"pt-4 border-t border-border",children:[i.jsx("h4",{className:"text-sm font-semibold mb-4",children:"Connected Apps"}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(h3,{name:"Slack",status:"Connected"}),i.jsx(h3,{name:"GitHub",status:"Connected"}),i.jsx(h3,{name:"Jira",status:"Disconnected"})]})]})]}),m==="data"&&i.jsx(EMe,{}),m==="import"&&i.jsx(TMe,{})]}),i.jsxs("div",{className:"p-6 border-t border-border bg-muted/30 flex items-center justify-between",children:[u("settings.edit")?i.jsxs("button",{onClick:qe,className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:[i.jsx(Nc,{size:16}),"Reset to Default"]}):i.jsx("div",{}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:()=>De.info("Changes discarded"),className:"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"}),i.jsx("button",{onClick:xe,disabled:K,className:tt("flex items-center gap-2 rounded-lg bg-primary px-6 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors shadow-sm disabled:opacity-70 disabled:cursor-not-allowed min-w-[140px] justify-center"),children:K?i.jsxs(i.Fragment,{children:[i.jsx(Nc,{size:18,className:"animate-spin"}),"Saving..."]}):i.jsxs(i.Fragment,{children:[i.jsx(b3,{size:18}),"Save Changes"]})})]})]})]})})]}),i.jsx(on,{children:A&&M&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"w-full max-w-sm rounded-2xl border border-border bg-card p-6 shadow-xl",children:[i.jsxs("div",{className:"flex flex-col items-center text-center",children:[i.jsx("div",{className:"mb-4 rounded-full bg-destructive/10 p-3 text-destructive",children:i.jsx(pl,{size:32})}),i.jsx("h3",{className:"text-lg font-bold",children:"Remove User"}),i.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Are you sure you want to remove ",i.jsx("span",{className:"font-bold text-foreground",children:M.name}),"? This will revoke their access to the system."]})]}),i.jsxs("div",{className:"mt-6 flex gap-3",children:[i.jsx("button",{onClick:()=>T(!1),className:"flex-1 rounded-xl border border-border px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{onClick:Ne,disabled:K,className:"flex-1 rounded-xl bg-destructive px-4 py-2 text-sm font-medium text-destructive-foreground hover:bg-destructive/90 transition-colors disabled:opacity-50",children:K?"Removing...":"Remove User"})]})]})})}),i.jsx(on,{children:j&&i.jsxs(i.Fragment,{children:[i.jsx(ar.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>k(!1),className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm"}),i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"fixed left-1/2 top-1/2 z-[51] w-[95vw] max-w-md -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-border bg-card p-6 shadow-2xl",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:I?"Edit Role":"Create New Role"}),i.jsx("button",{onClick:()=>{k(!1),q(null),F({name:"",description:""})},className:"rounded-full p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Role Name"}),i.jsx("input",{type:"text",placeholder:"e.g. Project Lead",value:L.name,onChange:Be=>F({...L,name:Be.target.value}),className:"w-full h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Description"}),i.jsx("textarea",{placeholder:"What can this role do?",value:L.description,onChange:Be=>F({...L,description:Be.target.value}),className:"w-full min-h-[100px] rounded-lg border border-border bg-background p-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"flex gap-3 pt-4",children:[i.jsx("button",{onClick:()=>{k(!1),q(null),F({name:"",description:""})},className:"flex-1 h-10 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{onClick:we,className:"flex-1 h-10 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 transition-colors",children:I?"Save Changes":"Create Role"})]})]})]})]})}),i.jsx(on,{children:se&&i.jsxs(i.Fragment,{children:[i.jsx(ar.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Z(!1),className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm"}),i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"fixed left-1/2 top-1/2 z-[51] w-[95vw] max-w-md -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-border bg-card p-6 shadow-2xl",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-xl font-bold",children:ne?"Edit User":"Add New User"}),i.jsx("button",{onClick:()=>{Z(!1),X(null),fe({fullName:"",email:"",password:"",phone:"",role:"Administrator"})},className:"rounded-full p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Full Name"}),i.jsxs("div",{className:"relative",children:[i.jsx(ls,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),i.jsx("input",{type:"text",value:z.fullName,onChange:Be=>fe({...z,fullName:Be.target.value}),placeholder:"John Doe",className:"w-full h-10 pl-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Email Address"}),i.jsxs("div",{className:"relative",children:[i.jsx(Gl,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),i.jsx("input",{type:"email",value:z.email,onChange:Be=>fe({...z,email:Be.target.value}),placeholder:"john@example.com",className:"w-full h-10 pl-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Phone Number"}),i.jsxs("div",{className:"relative",children:[i.jsx(rx,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),i.jsx("input",{type:"tel",value:z.phone,onChange:Be=>fe({...z,phone:Be.target.value}),placeholder:"+1 (555) 000-0000",className:"w-full h-10 pl-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-sm font-medium",children:["Password ",ne&&i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"(Leave blank to keep current)"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(yh,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),i.jsx("input",{type:"password",value:z.password,onChange:Be=>fe({...z,password:Be.target.value}),placeholder:ne?"••••••••":"Create a password",className:"w-full h-10 pl-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Assign Role"}),i.jsx("select",{value:z.role,onChange:Be=>fe({...z,role:Be.target.value}),className:"w-full h-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",children:W.map(Be=>i.jsx("option",{value:Be.name,children:Be.name},Be.name))})]}),i.jsx("button",{onClick:Je,className:"w-full h-10 mt-2 rounded-lg bg-primary text-sm font-semibold text-primary-foreground hover:bg-primary/90 transition-colors",children:ne?"Update User Details":"Create User Account"})]})]})]})})]})}function wm({icon:e,label:t,active:r,onClick:n}){return i.jsxs("button",{onClick:n,className:tt("w-full flex items-center justify-between px-4 py-3 rounded-lg text-sm font-medium transition-all group",r?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(e,{size:18}),t]}),i.jsx(Io,{size:14,className:tt("transition-transform",r?"translate-x-0":"-translate-x-2 opacity-0 group-hover:translate-x-0 group-hover:opacity-100")})]})}const DMe=({name:e,description:t,users:r,active:n,onClick:a,isMenuOpen:s,onToggleMenu:o,onDelete:l,onDuplicate:u,onEdit:d})=>i.jsxs("div",{onClick:a,className:tt("group relative flex flex-col p-4 rounded-2xl border transition-all cursor-pointer overflow-hidden",n?"border-primary bg-primary/5 shadow-md ring-1 ring-primary/20":"border-border bg-card hover:border-primary/30 hover:shadow-sm"),children:[n&&i.jsx("div",{className:"absolute top-0 right-0 p-2",children:i.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"})}),i.jsxs("div",{className:"flex items-start justify-between mb-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-xl bg-muted group-hover:bg-primary/10 flex items-center justify-center text-muted-foreground group-hover:text-primary transition-colors",children:e==="Administrator"?i.jsx(Pu,{size:20}):e==="Manager"?i.jsx(ls,{size:20}):i.jsx(Km,{size:20})}),i.jsxs("div",{className:"relative",children:[i.jsx("button",{onClick:f=>{f.stopPropagation(),o==null||o()},className:tt("p-1.5 rounded-lg transition-colors",s?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:i.jsx(Ym,{size:16})}),i.jsx(on,{children:s&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:f=>{f.stopPropagation(),o==null||o()}}),i.jsxs(ar.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:"absolute right-0 mt-2 w-40 origin-top-right rounded-xl border border-border bg-card p-1 shadow-2xl z-20",children:[i.jsxs("button",{onClick:f=>{f.stopPropagation(),d==null||d(),o==null||o()},className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-xs font-bold text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:[i.jsx(f2,{size:14}),"Edit Role"]}),i.jsxs("button",{onClick:f=>{f.stopPropagation(),u==null||u(),o==null||o()},className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-xs font-bold text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:[i.jsx(Wg,{size:14}),"Duplicate"]}),i.jsx("div",{className:"my-1 border-t border-border"}),i.jsxs("button",{onClick:f=>{f.stopPropagation(),l==null||l(),o==null||o()},className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-xs font-bold text-destructive hover:bg-destructive/10 transition-colors",children:[i.jsx(Ste,{size:14}),"Delete Role"]})]})]})})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("h4",{className:"text-sm font-bold leading-none",children:e}),i.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:t})]}),i.jsxs("div",{className:"mt-4 pt-4 border-t border-border/50 flex items-center justify-between",children:[i.jsxs("span",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground",children:[r," Users"]}),i.jsx(Io,{size:14,className:tt("transition-transform",n?"text-primary translate-x-0":"text-muted-foreground -translate-x-2 opacity-0 group-hover:translate-x-0 group-hover:opacity-100")})]})]});function Bb({label:e,description:t,active:r}){const[n,a]=N.useState(r);return i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border border-border bg-accent/30",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:e}),i.jsx("p",{className:"text-xs text-muted-foreground",children:t})]}),i.jsx("div",{onClick:()=>a(!n),className:tt("h-6 w-11 rounded-full relative cursor-pointer transition-colors",n?"bg-primary":"bg-muted"),children:i.jsx("div",{className:tt("absolute top-1 h-4 w-4 rounded-full bg-white shadow-sm transition-all",n?"right-1":"left-1")})})]})}function h3({name:e,status:t}){return i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center font-bold text-xs",children:e[0]}),i.jsx("span",{className:"text-sm font-medium",children:e})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:tt("text-[10px] font-bold uppercase tracking-wider",t==="Connected"?"text-green-500":"text-muted-foreground"),children:t}),i.jsx("button",{onClick:()=>De.info(`${t==="Connected"?"Disconnecting":"Connecting"} ${e}...`),className:"text-xs font-medium text-primary hover:underline",children:t==="Connected"?"Manage":"Connect"})]})]})}function OMe(){const{profile:e,roles:t,systemUsers:r,updateSystemUsers:n,hasPermission:a}=la(),[s,o]=N.useState(""),[l,u]=N.useState(!1),[d,f]=N.useState(!1),[m,g]=N.useState(null),[x,y]=N.useState(null),[v,w]=N.useState(!1),[j,k]=N.useState(!1),[A,T]=N.useState("All"),[M,B]=N.useState({fullName:"",email:"",password:"",role:"Employee"}),L=t.map(se=>se.name),F=N.useMemo(()=>r.map(se=>({id:se.uid||se.id,name:se.name,email:se.email,role:se.role,avatar:se.photoURL,status:se.status||"Active"})),[r]),I=async se=>{if(se.preventDefault(),!M.fullName||!M.email||!x&&!M.password){De.error("Please fill in all required fields");return}w(!0);try{const Z=await Bt.get("users",[]);if(x){const ne=Z.map(X=>X.uid===x||X.id===x?{...X,name:M.fullName,email:M.email,role:M.role}:X);await n(ne),De.success(`User ${M.fullName} updated successfully`)}else{const ne=crypto.randomUUID().split("-")[0],X={uid:ne,id:ne,tenantId:"default-tenant",name:M.fullName,email:M.email,username:M.email.split("@")[0],password:M.password,role:M.role,status:"Active",createdAt:new Date().toISOString()};await n([...r,X]),De.success(`User ${M.fullName} created successfully`)}u(!1),y(null),B({fullName:"",email:"",password:"",role:"Employee"})}catch{De.error("Failed to save user")}finally{w(!1)}},q=se=>{y(se.id),B({fullName:se.name,email:se.email,password:"",role:se.role}),u(!0)},P=se=>{g(se),f(!0)},R=async()=>{if(m){w(!0);try{const se=r.filter(Z=>Z.uid!==m.id&&Z.id!==m.id);await n(se),De.success("User removed successfully"),f(!1),g(null)}catch{De.error("Failed to delete user")}finally{w(!1)}}},K=async se=>{w(!0);try{const Z=se.status==="Active"?"Inactive":"Active",ne=r.map(X=>X.uid===se.id||X.id===se.id?{...X,status:Z}:X);await n(ne),De.success(`User ${se.name} is now ${Z}`)}catch{De.error("Failed to update status")}finally{w(!1)}},ee=F.filter(se=>{const Z=se.name.toLowerCase().includes(s.toLowerCase())||se.email.toLowerCase().includes(s.toLowerCase())||se.role.toLowerCase().includes(s.toLowerCase()),ne=A==="All"||se.role===A;return Z&&ne});return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Assigned Users"}),i.jsx("p",{className:"text-muted-foreground",children:"Manage system access, roles, and user accounts."})]}),a("settings.edit")&&i.jsxs("button",{onClick:()=>{y(null),B({fullName:"",email:"",password:"",role:"Employee"}),u(!0)},className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors shadow-sm",children:[i.jsx(Oh,{size:18}),"Add New User"]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[i.jsxs("div",{className:"relative flex-1 min-w-[300px]",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search users by name, email or role...",value:s,onChange:se=>o(se.target.value),className:"h-10 w-full rounded-lg border border-border bg-card pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>k(!j),className:tt("flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",A!=="All"&&"border-primary text-primary bg-primary/5"),children:[i.jsx(Oc,{size:18}),A==="All"?"Filters":`Role: ${A}`]}),i.jsx(on,{children:j&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>k(!1)}),i.jsxs(ar.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:"absolute right-0 mt-2 w-48 rounded-xl border border-border bg-card p-2 shadow-xl z-20",children:[i.jsx("div",{className:"px-3 py-2 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Filter by Role"}),i.jsx("div",{className:"space-y-1",children:["All",...L].map(se=>i.jsxs("button",{onClick:()=>{T(se),k(!1)},className:tt("w-full flex items-center justify-between rounded-lg px-3 py-2 text-sm transition-colors",A===se?"bg-primary/10 text-primary font-medium":"hover:bg-accent text-muted-foreground hover:text-foreground"),children:[se,A===se&&i.jsx(ph,{size:14})]},se))})]})]})})]})]}),i.jsx("div",{className:"rounded-xl border border-border bg-card shadow-sm overflow-hidden",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{className:"bg-muted/50 border-b border-border",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-6 py-4 font-semibold",children:"User"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Role"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Status"}),i.jsx("th",{className:"px-6 py-4 font-semibold",children:"Email"}),i.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),i.jsxs("tbody",{className:"divide-y divide-border",children:[ee.map(se=>i.jsxs("tr",{className:"hover:bg-accent/50 transition-colors group",children:[i.jsx("td",{className:"px-6 py-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold",children:se.name.charAt(0)}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium",children:se.name}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["ID: ",se.id]})]})]})}),i.jsx("td",{className:"px-6 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Pu,{size:14,className:tt(se.role==="Administrator"?"text-blue-500":se.role==="Manager"?"text-purple-500":"text-muted-foreground")}),i.jsx("span",{className:"font-medium",children:se.role})]})}),i.jsx("td",{className:"px-6 py-4",children:i.jsx("span",{className:tt("inline-flex items-center rounded-full px-2 py-1 text-[10px] font-bold uppercase tracking-wider",se.status==="Active"?"bg-green-500/10 text-green-500":"bg-yellow-500/10 text-yellow-500"),children:se.status||"Active"})}),i.jsx("td",{className:"px-6 py-4 text-muted-foreground",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Gl,{size:14}),se.email]})}),i.jsx("td",{className:"px-6 py-4 text-right",children:i.jsx("div",{className:"flex items-center justify-end gap-2",children:a("settings.edit")&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>K(se),className:tt("p-2 rounded-lg transition-all",se.status==="Active"?"text-yellow-500 hover:bg-yellow-500/10":"text-green-500 hover:bg-green-500/10"),title:se.status==="Active"?"Deactivate User":"Activate User",children:se.status==="Active"?i.jsx(pl,{size:16}):i.jsx(ph,{size:16})}),i.jsx("button",{onClick:()=>q(se),className:"p-2 rounded-lg text-muted-foreground hover:text-primary hover:bg-primary/10 transition-all",title:"Edit User",children:i.jsx(f2,{size:16})}),i.jsx("button",{onClick:()=>P(se),className:"p-2 rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-all",title:"Delete User",children:i.jsx(aa,{size:16})})]})})})]},se.id)),ee.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-6 py-12 text-center text-muted-foreground",children:"No users found matching your search."})})]})]})})}),i.jsx(on,{children:l&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"w-full max-w-md rounded-2xl border border-border bg-card p-6 shadow-xl",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h3",{className:"text-xl font-bold",children:x?"Edit User":"Add New User"}),i.jsx("button",{onClick:()=>u(!1),className:"rounded-full p-1 hover:bg-accent transition-colors",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:I,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Full Name"}),i.jsx("input",{type:"text",required:!0,className:"w-full rounded-xl border border-border bg-background px-4 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",value:M.fullName,onChange:se=>B(Z=>({...Z,fullName:se.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Email Address"}),i.jsx("input",{type:"email",required:!0,className:"w-full rounded-xl border border-border bg-background px-4 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",value:M.email,onChange:se=>B(Z=>({...Z,email:se.target.value}))})]}),!x&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Password"}),i.jsx("input",{type:"password",required:!0,className:"w-full rounded-xl border border-border bg-background px-4 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",value:M.password,onChange:se=>B(Z=>({...Z,password:se.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"System Role"}),i.jsx("select",{className:"w-full rounded-xl border border-border bg-background px-4 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",value:M.role,onChange:se=>B(Z=>({...Z,role:se.target.value})),children:L.map(se=>i.jsx("option",{value:se,children:se},se))})]}),i.jsxs("div",{className:"flex gap-3 pt-4",children:[i.jsx("button",{type:"button",onClick:()=>u(!1),className:"flex-1 rounded-xl border border-border px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{type:"submit",disabled:v,className:"flex-1 rounded-xl bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50",children:v?"Saving...":x?"Update User":"Create User"})]})]})]})})}),i.jsx(on,{children:d&&m&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs(ar.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"w-full max-w-sm rounded-2xl border border-border bg-card p-6 shadow-xl",children:[i.jsxs("div",{className:"flex flex-col items-center text-center",children:[i.jsx("div",{className:"mb-4 rounded-full bg-destructive/10 p-3 text-destructive",children:i.jsx(pl,{size:32})}),i.jsx("h3",{className:"text-lg font-bold",children:"Remove User"}),i.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Are you sure you want to remove ",i.jsx("span",{className:"font-bold text-foreground",children:m.name}),"? This will revoke their access to the system."]})]}),i.jsxs("div",{className:"mt-6 flex gap-3",children:[i.jsx("button",{onClick:()=>f(!1),className:"flex-1 rounded-xl border border-border px-4 py-2 text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{onClick:R,disabled:v,className:"flex-1 rounded-xl bg-destructive px-4 py-2 text-sm font-medium text-destructive-foreground hover:bg-destructive/90 transition-colors disabled:opacity-50",children:v?"Removing...":"Remove User"})]})]})})})]})}function RMe(){const{bankDetails:e,clients:t,engineers:r,projects:n,addBankDetail:a,updateBankDetail:s,deleteBankDetail:o,currencies:l,addCurrency:u}=ca(),{hasPermission:d}=la(),[f,m]=N.useState(""),[g,x]=N.useState("All"),[y,v]=N.useState("table"),[w,j]=N.useState(!1),[k,A]=N.useState(null),[T,M]=N.useState(!1),[B,L]=N.useState(null),[F,I]=N.useState(null),[q,P]=N.useState(!1),[R,K]=N.useState(!1),[ee,se]=N.useState({code:"",symbol:""}),[Z,ne]=N.useState(!1),[X,le]=N.useState({entityType:"Client",entityId:"",bankName:"",accountName:"",accountNumber:"",iban:"",swiftCode:"",routingNumber:"",sortCode:"",institutionNumber:"",transitNumber:"",bankAddress:"",currency:"USD"}),Ae=N.useMemo(()=>{const E=new Set;return n.forEach(re=>{re.thirdPartyName&&E.add(re.thirdPartyName),re.commissions&&re.commissions.forEach(he=>E.add(he.vendorName))}),Array.from(E).map(re=>({id:re,name:re}))},[n]),ce=N.useMemo(()=>e.filter(E=>{const re=E.entityName.toLowerCase().includes(f.toLowerCase())||E.bankName.toLowerCase().includes(f.toLowerCase())||E.accountNumber.includes(f),he=g==="All"||E.entityType===g;return re&&he}),[e,f,g]),D=(E,re)=>{navigator.clipboard.writeText(E),I(re),De.success("Copied to clipboard"),setTimeout(()=>I(null),2e3)},H=E=>{var oe,z;if(E.preventDefault(),!X.entityId||!X.bankName||!X.accountNumber){De.error("Please fill in all required fields");return}let re="Unknown";X.entityType==="Client"?re=((oe=t.find(fe=>fe.id===X.entityId))==null?void 0:oe.name)||X.entityId||"Unknown":X.entityType==="Engineer"?re=((z=r.find(fe=>fe.id===X.entityId))==null?void 0:z.name)||X.entityId||"Unknown":X.entityType==="Third-party"&&(re=X.entityId||"Unknown");const he={id:(k==null?void 0:k.id)||`BNK-${Math.random().toString(36).substr(2,5).toUpperCase()}`,entityId:X.entityId,entityType:X.entityType,entityName:re,bankName:X.bankName,accountName:X.accountName||"",accountNumber:X.accountNumber,iban:X.iban||"",swiftCode:X.swiftCode||"",routingNumber:X.routingNumber||"",sortCode:X.sortCode||"",institutionNumber:X.institutionNumber||"",transitNumber:X.transitNumber||"",bankAddress:X.bankAddress,currency:X.currency||"USD",createdAt:(k==null?void 0:k.createdAt)||new Date().toISOString()};k?(s(k.id,he),De.success("Bank details updated")):(a(he),De.success("Bank details recorded")),j(!1),A(null),P(!1),ne(!1),K(!1),se({code:"",symbol:""}),le({entityType:"Client",entityId:"",bankName:"",accountName:"",accountNumber:"",iban:"",swiftCode:"",routingNumber:"",sortCode:"",bankAddress:"",currency:"USD"})},G=()=>{B&&(o(B),De.success("Bank details deleted"),M(!1),L(null))};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Bank Details"}),i.jsx("p",{className:"text-muted-foreground",children:"Manage banking information for clients and engineers."})]}),d("finance.create")&&i.jsxs("button",{onClick:()=>j(!0),className:"flex items-center justify-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-bold text-primary-foreground hover:bg-primary/90 transition-all shadow-sm",children:[i.jsx($n,{size:18}),"Add Bank Details"]})]}),i.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center justify-between bg-card p-4 rounded-xl border border-border shadow-sm",children:[i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(fs,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:18}),i.jsx("input",{type:"text",placeholder:"Search by name, bank or account...",value:f,onChange:E=>m(E.target.value),className:"w-full pl-10 pr-4 py-2 rounded-lg border border-border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex rounded-lg border border-border p-1 bg-muted/50 mr-2",children:[i.jsx("button",{onClick:()=>v("grid"),className:tt("p-1.5 rounded-md transition-all",y==="grid"?"bg-background text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),title:"Grid View",children:i.jsx(E9,{size:16})}),i.jsx("button",{onClick:()=>v("table"),className:tt("p-1.5 rounded-md transition-all",y==="table"?"bg-background text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),title:"Table View",children:i.jsx(y3,{size:16})})]}),i.jsx("div",{className:"flex rounded-lg border border-border p-1 bg-muted/50",children:["All","Client","Engineer","Third-party"].map(E=>i.jsx("button",{onClick:()=>{x(E)},className:tt("px-3 py-1.5 text-xs font-bold rounded-md transition-all",g===E?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:E},E))})]})]}),y==="grid"?i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[ce.map(E=>i.jsxs("div",{className:"group relative bg-card rounded-2xl border border-border p-6 shadow-sm hover:shadow-md transition-all",children:[i.jsxs("div",{className:"flex items-start justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:tt("w-10 h-10 rounded-xl flex items-center justify-center",E.entityType==="Client"?"bg-blue-500/10 text-blue-500":E.entityType==="Engineer"?"bg-purple-500/10 text-purple-500":"bg-orange-500/10 text-orange-500"),children:E.entityType==="Client"?i.jsx(ls,{size:20}):E.entityType==="Engineer"?i.jsx(Hn,{size:20}):i.jsx(zi,{size:20})}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-lg leading-none",children:E.entityName}),i.jsx("p",{className:"text-xs font-medium text-muted-foreground mt-1 uppercase tracking-wider",children:E.entityType})]})]}),i.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[d("finance.edit")&&i.jsx("button",{onClick:()=>{A(E),le(E),j(!0)},className:"p-2 rounded-lg hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(Ps,{size:16})}),d("finance.delete")&&i.jsx("button",{onClick:()=>{L(E.id),M(!0)},className:"p-2 rounded-lg hover:bg-red-500/10 text-red-500 transition-colors",children:i.jsx(aa,{size:16})})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"p-3 rounded-xl bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"flex items-center justify-between mb-1",children:i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Bank Name"})}),i.jsxs("p",{className:"text-sm font-bold flex items-center gap-2",children:[i.jsx(zi,{size:14,className:"text-muted-foreground"}),E.bankName]}),E.bankAddress&&i.jsx("p",{className:"text-[10px] text-muted-foreground mt-1 line-clamp-2 italic",children:E.bankAddress})]}),i.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[E.iban&&i.jsxs("div",{className:"relative group/copy overflow-hidden",children:[i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground block mb-1",children:"IBAN"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("code",{className:"text-xs font-mono bg-muted/50 p-2 rounded-lg border border-border flex-1 truncate",children:E.iban}),i.jsx("button",{onClick:()=>D(E.iban,E.id+"-iban"),className:"p-2 rounded-lg hover:bg-accent text-muted-foreground shrink-0 transition-colors",title:"Copy IBAN",children:F===E.id+"-iban"?i.jsx(ph,{size:14,className:"text-green-500"}):i.jsx(Wg,{size:14})})]})]}),E.accountNumber&&i.jsxs("div",{className:"relative group/copy overflow-hidden",children:[i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground block mb-1",children:"Account Number"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("code",{className:"text-xs font-mono bg-muted/50 p-2 rounded-lg border border-border flex-1 truncate",children:E.accountNumber}),i.jsx("button",{onClick:()=>D(E.accountNumber,E.id+"-acc"),className:"p-2 rounded-lg hover:bg-accent text-muted-foreground shrink-0 transition-colors",title:"Copy Account Number",children:F===E.id+"-acc"?i.jsx(ph,{size:14,className:"text-green-500"}):i.jsx(Wg,{size:14})})]})]}),(E.swiftCode||E.routingNumber||E.sortCode)&&i.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-1",children:[E.swiftCode&&i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground block",children:"SWIFT/BIC"}),i.jsx("code",{className:"text-[10px] font-mono bg-muted/30 p-1.5 rounded border border-border block truncate",children:E.swiftCode})]}),E.routingNumber&&i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground block",children:"Routing #"}),i.jsx("code",{className:"text-[10px] font-mono bg-muted/30 p-1.5 rounded border border-border block truncate",children:E.routingNumber})]}),E.institutionNumber&&i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground block",children:"Inst. #"}),i.jsx("code",{className:"text-[10px] font-mono bg-muted/30 p-1.5 rounded border border-border block truncate",children:E.institutionNumber})]}),E.transitNumber&&i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground block",children:"Transit #"}),i.jsx("code",{className:"text-[10px] font-mono bg-muted/30 p-1.5 rounded border border-border block truncate",children:E.transitNumber})]}),E.sortCode&&i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground block",children:"Sort Code"}),i.jsx("code",{className:"text-[10px] font-mono bg-muted/30 p-1.5 rounded border border-border block truncate",children:E.sortCode})]})]})]}),i.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border/50",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(Up,{size:12}),i.jsxs("span",{children:[E.currency," Account"]})]}),i.jsx("div",{className:"text-xs text-muted-foreground font-mono",children:new Date(E.createdAt).toLocaleDateString()})]})]})]},E.id)),ce.length===0&&i.jsxs("div",{className:"col-span-full py-12 flex flex-col items-center justify-center bg-card rounded-2xl border-2 border-dashed border-border text-center",children:[i.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4",children:i.jsx(zi,{size:32,className:"text-muted-foreground opacity-20"})}),i.jsx("h3",{className:"text-lg font-bold",children:"No bank details found"}),i.jsx("p",{className:"text-muted-foreground max-w-xs mx-auto",children:"Start by adding bank information for your clients or engineers."}),i.jsxs("button",{onClick:()=>j(!0),className:"mt-6 flex items-center gap-2 text-primary font-bold hover:underline",children:[i.jsx($n,{size:16})," Record Bank Details"]})]})]}):i.jsx("div",{className:"bg-card rounded-2xl border border-border shadow-sm overflow-hidden animate-in fade-in slide-in-from-bottom-2 duration-300",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border bg-muted/30",children:[i.jsx("th",{className:"px-6 py-4 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Entity"}),i.jsx("th",{className:"px-6 py-4 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Bank Name"}),i.jsx("th",{className:"px-6 py-4 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Account Info"}),i.jsx("th",{className:"px-6 py-4 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Identifiers"}),i.jsx("th",{className:"px-6 py-4 text-xs font-bold uppercase tracking-wider text-muted-foreground text-center",children:"Currency"}),i.jsx("th",{className:"px-6 py-4 text-xs font-bold uppercase tracking-wider text-muted-foreground text-right",children:"Actions"})]})}),i.jsxs("tbody",{className:"divide-y divide-border text-sm",children:[ce.map(E=>i.jsxs("tr",{className:"hover:bg-muted/10 transition-colors group",children:[i.jsx("td",{className:"px-6 py-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:tt("w-8 h-8 rounded-lg flex items-center justify-center shrink-0",E.entityType==="Client"?"bg-blue-500/10 text-blue-500":E.entityType==="Engineer"?"bg-purple-500/10 text-purple-500":"bg-orange-500/10 text-orange-500"),children:E.entityType==="Client"?i.jsx(ls,{size:14}):E.entityType==="Engineer"?i.jsx(Hn,{size:14}):i.jsx(zi,{size:14})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-bold",children:E.entityName}),i.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:E.entityType})]})]})}),i.jsxs("td",{className:"px-6 py-4",children:[i.jsx("p",{className:"font-medium text-muted-foreground",children:E.bankName}),E.bankAddress&&i.jsx("p",{className:"text-[10px] text-muted-foreground italic mt-0.5 max-w-[150px] truncate",title:E.bankAddress,children:E.bankAddress})]}),i.jsx("td",{className:"px-6 py-4",children:i.jsxs("div",{className:"space-y-1",children:[E.accountNumber&&i.jsxs("div",{className:"flex items-center gap-2 group/copy",children:[i.jsx("span",{className:"font-mono text-xs",children:E.accountNumber}),i.jsx("button",{onClick:()=>D(E.accountNumber,E.id+"-acc"),className:"opacity-0 group-hover/copy:opacity-100 transition-opacity p-1 hover:bg-muted rounded text-muted-foreground hover:text-primary",children:i.jsx(Wg,{size:12})})]}),E.iban&&i.jsxs("div",{className:"flex items-center gap-2 group/copy",children:[i.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:E.iban}),i.jsx("button",{onClick:()=>D(E.iban,E.id+"-iban"),className:"opacity-0 group-hover/copy:opacity-100 transition-opacity p-1 hover:bg-muted rounded text-muted-foreground hover:text-primary",children:i.jsx(Wg,{size:12})})]})]})}),i.jsx("td",{className:"px-6 py-4",children:i.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[E.swiftCode&&i.jsxs("span",{className:"text-[9px] bg-muted/50 px-1.5 py-0.5 rounded border border-border",title:"SWIFT",children:["SWIFT: ",E.swiftCode]}),E.routingNumber&&i.jsxs("span",{className:"text-[9px] bg-muted/50 px-1.5 py-0.5 rounded border border-border",title:"Routing",children:["R: ",E.routingNumber]}),E.institutionNumber&&i.jsxs("span",{className:"text-[9px] bg-muted/50 px-1.5 py-0.5 rounded border border-border",title:"Institution",children:["I: ",E.institutionNumber]}),E.transitNumber&&i.jsxs("span",{className:"text-[9px] bg-muted/50 px-1.5 py-0.5 rounded border border-border",title:"Transit",children:["T: ",E.transitNumber]}),E.sortCode&&i.jsxs("span",{className:"text-[9px] bg-muted/50 px-1.5 py-0.5 rounded border border-border",title:"Sort Code",children:["S: ",E.sortCode]})]})}),i.jsx("td",{className:"px-6 py-4 text-center",children:i.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 bg-primary/10 text-primary rounded-full uppercase",children:E.currency})}),i.jsx("td",{className:"px-6 py-4 text-right",children:i.jsxs("div",{className:"flex justify-end gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[d("finance.edit")&&i.jsx("button",{onClick:()=>{A(E),le(E),j(!0)},className:"p-1.5 rounded-lg hover:bg-accent text-muted-foreground transition-colors",children:i.jsx(Ps,{size:14})}),d("finance.delete")&&i.jsx("button",{onClick:()=>{L(E.id),M(!0)},className:"p-1.5 rounded-lg hover:bg-red-500/10 text-red-500 transition-colors",children:i.jsx(aa,{size:14})})]})})]},E.id)),ce.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-muted-foreground",children:"No bank details found matching your filters."})})]})]})})}),w&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm overflow-y-auto",children:i.jsxs("div",{className:"w-full max-w-2xl my-auto rounded-2xl border border-border bg-card p-0 shadow-2xl animate-in fade-in zoom-in duration-200 overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border bg-muted/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 text-primary flex items-center justify-center",children:i.jsx(zi,{size:22})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:k?"Edit Bank Details":"Add Bank Details"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter specific banking information for settlements."})]})]}),i.jsx("button",{onClick:()=>{j(!1),A(null),P(!1),K(!1),se({code:"",symbol:""})},className:"rounded-full p-2 hover:bg-accent text-muted-foreground transition-colors",type:"button",children:i.jsx(xr,{size:20})})]}),i.jsxs("form",{onSubmit:H,className:"p-6",children:[i.jsxs("div",{className:"space-y-8",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground mb-4 flex items-center gap-2",children:[i.jsx(ls,{size:14}),"Beneficiary Information"]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Entity Type"}),i.jsx("div",{className:"flex p-1 rounded-lg border border-border bg-muted/30",children:["Client","Engineer","Third-party"].map(E=>i.jsx("button",{type:"button",onClick:()=>le({...X,entityType:E,entityId:""}),className:tt("flex-1 py-1.5 text-xs font-bold rounded-md transition-all",X.entityType===E?"bg-background text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),children:E},E))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("label",{className:"text-sm font-semibold",children:["Select ",X.entityType," *"]}),i.jsxs("button",{type:"button",onClick:()=>K(!R),className:tt("text-[10px] font-bold flex items-center gap-1 hover:underline",R?"text-red-500":"text-primary"),children:[R?i.jsx(y3,{size:10}):i.jsx($n,{size:10}),R?"Switch to List":"Add Manual Name"]})]}),R?i.jsx("input",{type:"text",value:X.entityId,onChange:E=>le({...X,entityId:E.target.value}),placeholder:`Enter ${X.entityType} Name`,className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0}):i.jsxs("select",{value:X.entityId,onChange:E=>le({...X,entityId:E.target.value}),className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 appearance-none bg-[url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E')] bg-[length:16px] bg-[right:12px_center] bg-no-repeat pr-10",required:!0,children:[i.jsx("option",{value:"",children:"Choose from list..."}),X.entityType==="Client"?t.map(E=>i.jsx("option",{value:E.id,children:E.name},E.id)):X.entityType==="Engineer"?r.map(E=>i.jsx("option",{value:E.id,children:E.name},E.id)):Ae.map(E=>i.jsx("option",{value:E.id,children:E.name},E.id))]})]}),i.jsxs("div",{className:"md:col-span-2 space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Account Beneficiary Name *"}),i.jsxs("div",{className:"relative",children:[i.jsx(ls,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),i.jsx("input",{type:"text",value:X.accountName||"",onChange:E=>le({...X,accountName:E.target.value}),placeholder:"Full name or company name as it appears on bank records",className:"h-10 w-full pl-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]})]})]})]}),i.jsxs("div",{children:[i.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground mb-4 flex items-center gap-2",children:[i.jsx(zi,{size:14}),"Institution & Currency"]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Account Currency *"}),i.jsxs("button",{type:"button",onClick:()=>P(!q),className:tt("text-[10px] font-bold flex items-center gap-1 hover:underline",q?"text-red-500":"text-primary"),children:[q?i.jsx(xr,{size:10}):i.jsx($n,{size:10}),q?"Cancel":"Add Other"]})]}),q?i.jsxs("div",{className:"flex gap-2 animate-in slide-in-from-top-1 duration-200",children:[i.jsx("input",{type:"text",placeholder:"e.g. JPY",maxLength:3,value:ee.code,onChange:E=>se({...ee,code:E.target.value.toUpperCase()}),className:"h-10 flex-1 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20"}),i.jsx("button",{type:"button",onClick:()=>{ee.code&&(l.find(E=>E.code===ee.code)?De.error("Exists"):(u(ee.code,ee.code),le(E=>({...E,currency:ee.code})),P(!1),se({code:"",symbol:""}),De.success(`Added ${ee.code}`)))},className:"bg-primary text-primary-foreground px-3 py-2 rounded-lg text-xs font-bold",children:"Add"})]}):i.jsxs("div",{className:"grid grid-cols-5 gap-1.5 p-1 rounded-lg border border-border bg-muted/30",children:[["USD","EUR","GBP","CAD"].map(E=>i.jsx("button",{type:"button",onClick:()=>le({...X,currency:E}),className:tt("py-1.5 text-xs font-bold rounded-md transition-all",X.currency===E?"bg-background text-primary shadow-sm border border-primary/20":"text-muted-foreground hover:text-foreground"),children:E},E)),i.jsxs("div",{className:"relative group",children:[i.jsxs("button",{type:"button",onClick:()=>ne(!Z),className:tt("w-full py-1.5 text-xs font-bold rounded-md transition-all flex items-center justify-center gap-1",["USD","EUR","GBP","CAD"].includes(X.currency||"")?"text-muted-foreground hover:text-foreground":"bg-background text-primary shadow-sm border border-primary/20"),children:[["USD","EUR","GBP","CAD"].includes(X.currency||"")?"More":X.currency,i.jsx(Nv,{size:12,className:tt("transition-transform",Z&&"rotate-180")})]}),Z&&i.jsx("div",{className:"absolute top-full left-0 right-0 z-50 mt-1 max-h-40 overflow-auto rounded-lg border border-border bg-popover p-1 shadow-lg backdrop-blur-sm animate-in fade-in zoom-in-95 duration-200",children:l.filter(E=>!["USD","EUR","GBP","CAD"].includes(E.code)).map(E=>i.jsxs("button",{type:"button",onClick:()=>{le({...X,currency:E.code}),ne(!1)},className:tt("flex w-full items-center justify-between rounded-md px-2 py-1.5 text-xs transition-colors hover:bg-accent",X.currency===E.code?"bg-accent text-primary font-bold":"text-popover-foreground"),children:[E.code,X.currency===E.code&&i.jsx(ph,{size:12})]},E.code))})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Bank Name *"}),i.jsxs("div",{className:"relative",children:[i.jsx(zi,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),i.jsx("input",{type:"text",value:X.bankName||"",onChange:E=>le({...X,bankName:E.target.value}),placeholder:"e.g. HSBC, Emirates NBD, Chase",className:"h-10 w-full pl-10 rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20",required:!0})]})]}),i.jsxs("div",{className:"md:col-span-2 space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold text-muted-foreground",children:"Bank Branch Address (Optional)"}),i.jsx("textarea",{value:X.bankAddress||"",onChange:E=>le({...X,bankAddress:E.target.value}),placeholder:"Full physical address of the bank branch for international wire transfers",className:"w-full rounded-lg border border-border bg-background p-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 min-h-[70px] resize-none"})]})]})]}),i.jsxs("div",{className:"pt-4 border-t border-border",children:[i.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground mb-4 flex items-center gap-2",children:[i.jsx(Up,{size:14}),"Account Specifications (",X.currency,")"]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 bg-muted/20 p-6 rounded-2xl border border-border/50",children:[X.currency==="USD"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Account Number *"}),i.jsx("input",{type:"text",value:X.accountNumber||"",onChange:E=>le({...X,accountNumber:E.target.value}),placeholder:"USA Checking/Savings Account #",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"ABA Routing Number"}),i.jsx("input",{type:"text",value:X.routingNumber||"",onChange:E=>le({...X,routingNumber:E.target.value}),placeholder:"9-digit ACH/Wire Routing #",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"SWIFT/BIC Code"}),i.jsx("input",{type:"text",value:X.swiftCode||"",onChange:E=>le({...X,swiftCode:E.target.value}),placeholder:"SWIFT Code for international wire",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary"})]})]}),X.currency==="EUR"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2 md:col-span-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"IBAN *"}),i.jsx("input",{type:"text",value:X.iban||"",onChange:E=>le({...X,iban:E.target.value}),placeholder:"International Bank Account Number",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary",required:!0})]}),i.jsxs("div",{className:"space-y-2 md:col-span-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"BIC / SWIFT *"}),i.jsx("input",{type:"text",value:X.swiftCode||"",onChange:E=>le({...X,swiftCode:E.target.value}),placeholder:"Bank Identifier Code",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary",required:X.currency==="EUR"})]})]}),X.currency==="GBP"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Account Number *"}),i.jsx("input",{type:"text",value:X.accountNumber||"",onChange:E=>le({...X,accountNumber:E.target.value}),placeholder:"8-digit UK Account Number",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Sort Code *"}),i.jsx("input",{type:"text",value:X.sortCode||"",onChange:E=>le({...X,sortCode:E.target.value}),placeholder:"XX-XX-XX",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary",required:X.currency==="GBP"})]}),i.jsx("div",{className:"space-y-2 md:col-span-2",children:i.jsx("label",{className:"text-sm font-semibold italic text-muted-foreground",children:"Note: For GBP, Account Number and Sort Code are mandatory identifiers."})})]}),X.currency==="CAD"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2 md:col-span-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Account Number *"}),i.jsx("input",{type:"text",value:X.accountNumber||"",onChange:E=>le({...X,accountNumber:E.target.value}),placeholder:"Canadian Bank Account Number",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Transit Number *"}),i.jsx("input",{type:"text",value:X.transitNumber||"",onChange:E=>le({...X,transitNumber:E.target.value}),placeholder:"5-digit Transit #",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary",required:X.currency==="CAD"}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Identifies the specific branch."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Institution Number *"}),i.jsx("input",{type:"text",value:X.institutionNumber||"",onChange:E=>le({...X,institutionNumber:E.target.value}),placeholder:"3-digit Bank Code",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary",required:X.currency==="CAD"}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Identifies the financial institution."})]}),i.jsxs("div",{className:"space-y-2 md:col-span-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"SWIFT Code"}),i.jsx("input",{type:"text",value:X.swiftCode||"",onChange:E=>le({...X,swiftCode:E.target.value}),placeholder:"For international wires to Canada",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary"})]})]}),!["USD","EUR","GBP","CAD"].includes(X.currency||"")&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2 md:col-span-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"Account Number *"}),i.jsx("input",{type:"text",value:X.accountNumber||"",onChange:E=>le({...X,accountNumber:E.target.value}),placeholder:"International Account Number",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary",required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"IBAN (if applicable)"}),i.jsx("input",{type:"text",value:X.iban||"",onChange:E=>le({...X,iban:E.target.value}),placeholder:"International Format",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-semibold",children:"SWIFT / BIC *"}),i.jsx("input",{type:"text",value:X.swiftCode||"",onChange:E=>le({...X,swiftCode:E.target.value}),placeholder:"Global Bank Identifier",className:"h-10 w-full rounded-lg border border-border bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary",required:!0})]})]})]})]})]}),i.jsxs("div",{className:"mt-8 flex items-center gap-3",children:[i.jsx("button",{type:"button",onClick:()=>{j(!1),A(null),P(!1),ne(!1),se({code:"",symbol:""})},className:"flex-1 h-11 text-sm font-bold border border-border rounded-xl hover:bg-accent transition-all",children:"Cancel"}),i.jsx("button",{type:"submit",className:"flex-[2] bg-primary h-11 text-sm font-bold text-primary-foreground rounded-xl hover:bg-primary/90 transition-all shadow-lg active:scale-[0.98]",children:k?"Update Bank Record":"Create Bank Record"})]})]})]})}),T&&i.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-border bg-card p-6 shadow-2xl",children:[i.jsxs("div",{className:"flex items-center gap-3 text-red-500 mb-4",children:[i.jsx(pl,{size:24}),i.jsx("h2",{className:"text-lg font-bold",children:"Delete Bank Details?"})]}),i.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"This action cannot be undone. This will permanently delete the bank information from the system."}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx("button",{onClick:()=>M(!1),className:"flex-1 px-4 py-2 text-sm font-medium border border-border rounded-lg hover:bg-accent transition-colors",children:"Cancel"}),i.jsx("button",{onClick:G,className:"flex-1 bg-red-500 px-4 py-2 text-sm font-bold text-white rounded-lg hover:bg-red-600 transition-colors shadow-sm",children:"Delete"})]})]})})]})}function MMe(){const e=N.useRef(null),t=N.useRef(!0);return N.useEffect(()=>{const n=setInterval(async()=>{try{const a=await fetch("/api/health",{headers:{"Cache-Control":"no-cache"},credentials:"include"});if(a.ok){const o=(await a.json()).bootTime;if(t.current){e.current=o,t.current=!1;return}e.current!==null&&o!==e.current&&(console.log("[AutoReload] Server restart detected, reloading..."),window.location.reload())}}catch{}},3e3);return()=>clearInterval(n)},[]),null}const ns=({children:e,permission:t})=>{const{user:r,loading:n,hasPermission:a}=la();return n?i.jsx("div",{className:"flex h-screen items-center justify-center bg-slate-50",children:i.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary/30 border-t-primary"})}):r?t&&!a(t)?i.jsx(_P,{to:"/",replace:!0}):i.jsx(Hse,{children:e}):i.jsx(_P,{to:"/login",replace:!0})};function LMe(){return i.jsx(Bse,{children:i.jsxs(zse,{children:[i.jsx(MMe,{}),i.jsxs(YZ,{children:[i.jsx(PJ,{position:"top-right",richColors:!0}),i.jsxs(NZ,{children:[i.jsx(oi,{path:"/login",element:i.jsx(vNe,{})}),i.jsx(oi,{path:"/signup",element:i.jsx(yNe,{})}),i.jsx(oi,{path:"/",element:i.jsx(ns,{children:i.jsx(gNe,{})})}),i.jsx(oi,{path:"/organization",element:i.jsx(ns,{permission:"hr.view",children:i.jsx(X3e,{})})}),i.jsx(oi,{path:"/employees",element:i.jsx(ns,{permission:"hr.view",children:i.jsx(K3e,{})})}),i.jsx(oi,{path:"/engineers",element:i.jsx(ns,{permission:"hr.view",children:i.jsx(xAe,{})})}),i.jsx(oi,{path:"/projects",element:i.jsx(ns,{permission:"projects.view",children:i.jsx(J3e,{})})}),i.jsx(oi,{path:"/profile",element:i.jsx(ns,{children:i.jsx(Q3e,{})})}),i.jsx(oi,{path:"/tasks",element:i.jsx(ns,{permission:"tasks.view",children:i.jsx(aAe,{})})}),i.jsx(oi,{path:"/clients",element:i.jsx(ns,{permission:"crm.view",children:i.jsx(iAe,{})})}),i.jsx(oi,{path:"/crm",element:i.jsx(ns,{permission:"crm.view",children:i.jsx(sAe,{})})}),i.jsx(oi,{path:"/operations",element:i.jsx(ns,{permission:"operations.view",children:i.jsx(gAe,{})})}),i.jsx(oi,{path:"/recruitment",element:i.jsx(ns,{permission:"hr.view",children:i.jsx(oAe,{})})}),i.jsx(oi,{path:"/finance",element:i.jsx(ns,{permission:"finance.view",children:i.jsx(fAe,{})})}),i.jsx(oi,{path:"/expenses",element:i.jsx(ns,{permission:"finance.view",children:i.jsx(mAe,{})})}),i.jsx(oi,{path:"/bank-details",element:i.jsx(ns,{permission:"finance.view",children:i.jsx(RMe,{})})}),i.jsx(oi,{path:"/documents",element:i.jsx(ns,{permission:"documents.view",children:i.jsx(pAe,{})})}),i.jsx(oi,{path:"/reports",element:i.jsx(ns,{permission:"finance.view",children:i.jsx(CAe,{})})}),i.jsx(oi,{path:"/users",element:i.jsx(ns,{permission:"settings.view",children:i.jsx(OMe,{})})}),i.jsx(oi,{path:"/settings",element:i.jsx(ns,{permission:"settings.view",children:i.jsx(PMe,{})})})]})]})]})})}kX.createRoot(document.getElementById("root")).render(i.jsx(N.StrictMode,{children:i.jsx(LMe,{})}));export{Un as _,FMe as c,af as g};
