var Cme=Object.defineProperty;var $B=t=>{throw TypeError(t)};var kme=(t,e,r)=>e in t?Cme(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Le=(t,e,r)=>kme(t,typeof e!="symbol"?e+"":e,r),cP=(t,e,r)=>e.has(t)||$B("Cannot "+r);var _=(t,e,r)=>(cP(t,e,"read from private field"),r?r.call(t):e.get(t)),se=(t,e,r)=>e.has(t)?$B("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Q=(t,e,r,n)=>(cP(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ce=(t,e,r)=>(cP(t,e,"access private method"),r);var ns=(t,e,r,n)=>({set _(s){Q(t,e,s,r)},get _(){return _(t,e,n)}});function Tme(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var Wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Pme(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return t[n]}})}),r}var GX={exports:{}},Bk={},KX={exports:{}},Wt={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Nj=Symbol.for("react.element"),Ome=Symbol.for("react.portal"),Ime=Symbol.for("react.fragment"),Rme=Symbol.for("react.strict_mode"),Mme=Symbol.for("react.profiler"),Dme=Symbol.for("react.provider"),Lme=Symbol.for("react.context"),Fme=Symbol.for("react.forward_ref"),$me=Symbol.for("react.suspense"),Bme=Symbol.for("react.memo"),Ume=Symbol.for("react.lazy"),BB=Symbol.iterator;function zme(t){return t===null||typeof t!="object"?null:(t=BB&&t[BB]||t["@@iterator"],typeof t=="function"?t:null)}var YX={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},XX=Object.assign,QX={};function eb(t,e,r){this.props=t,this.context=e,this.refs=QX,this.updater=r||YX}eb.prototype.isReactComponent={};eb.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};eb.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function ZX(){}ZX.prototype=eb.prototype;function $3(t,e,r){this.props=t,this.context=e,this.refs=QX,this.updater=r||YX}var B3=$3.prototype=new ZX;B3.constructor=$3;XX(B3,eb.prototype);B3.isPureReactComponent=!0;var UB=Array.isArray,JX=Object.prototype.hasOwnProperty,U3={current:null},eQ={key:!0,ref:!0,__self:!0,__source:!0};function tQ(t,e,r){var n,s={},i=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)JX.call(e,n)&&!eQ.hasOwnProperty(n)&&(s[n]=e[n]);var l=arguments.length-2;if(l===1)s.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(t&&t.defaultProps)for(n in l=t.defaultProps,l)s[n]===void 0&&(s[n]=l[n]);return{$$typeof:Nj,type:t,key:i,ref:o,props:s,_owner:U3.current}}function Hme(t,e){return{$$typeof:Nj,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function z3(t){return typeof t=="object"&&t!==null&&t.$$typeof===Nj}function Wme(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var zB=/\/+/g;function uP(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Wme(""+t.key):e.toString(36)}function nA(t,e,r,n,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Nj:case Ome:o=!0}}if(o)return o=t,s=s(o),t=n===""?"."+uP(o,0):n,UB(s)?(r="",t!=null&&(r=t.replace(zB,"$&/")+"/"),nA(s,e,r,"",function(u){return u})):s!=null&&(z3(s)&&(s=Hme(s,r+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(zB,"$&/")+"/")+t)),e.push(s)),1;if(o=0,n=n===""?".":n+":",UB(t))for(var l=0;l<t.length;l++){i=t[l];var c=n+uP(i,l);o+=nA(i,e,r,c,s)}else if(c=zme(t),typeof c=="function")for(t=c.call(t),l=0;!(i=t.next()).done;)i=i.value,c=n+uP(i,l++),o+=nA(i,e,r,c,s);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function DS(t,e,r){if(t==null)return t;var n=[],s=0;return nA(t,n,"","",function(i){return e.call(r,i,s++)}),n}function Vme(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Si={current:null},sA={transition:null},qme={ReactCurrentDispatcher:Si,ReactCurrentBatchConfig:sA,ReactCurrentOwner:U3};function rQ(){throw Error("act(...) is not supported in production builds of React.")}Wt.Children={map:DS,forEach:function(t,e,r){DS(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return DS(t,function(){e++}),e},toArray:function(t){return DS(t,function(e){return e})||[]},only:function(t){if(!z3(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Wt.Component=eb;Wt.Fragment=Ime;Wt.Profiler=Mme;Wt.PureComponent=$3;Wt.StrictMode=Rme;Wt.Suspense=$me;Wt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qme;Wt.act=rQ;Wt.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=XX({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=U3.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(c in e)JX.call(e,c)&&!eQ.hasOwnProperty(c)&&(n[c]=e[c]===void 0&&l!==void 0?l[c]:e[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];n.children=l}return{$$typeof:Nj,type:t.type,key:s,ref:i,props:n,_owner:o}};Wt.createContext=function(t){return t={$$typeof:Lme,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Dme,_context:t},t.Consumer=t};Wt.createElement=tQ;Wt.createFactory=function(t){var e=tQ.bind(null,t);return e.type=t,e};Wt.createRef=function(){return{current:null}};Wt.forwardRef=function(t){return{$$typeof:Fme,render:t}};Wt.isValidElement=z3;Wt.lazy=function(t){return{$$typeof:Ume,_payload:{_status:-1,_result:t},_init:Vme}};Wt.memo=function(t,e){return{$$typeof:Bme,type:t,compare:e===void 0?null:e}};Wt.startTransition=function(t){var e=sA.transition;sA.transition={};try{t()}finally{sA.transition=e}};Wt.unstable_act=rQ;Wt.useCallback=function(t,e){return Si.current.useCallback(t,e)};Wt.useContext=function(t){return Si.current.useContext(t)};Wt.useDebugValue=function(){};Wt.useDeferredValue=function(t){return Si.current.useDeferredValue(t)};Wt.useEffect=function(t,e){return Si.current.useEffect(t,e)};Wt.useId=function(){return Si.current.useId()};Wt.useImperativeHandle=function(t,e,r){return Si.current.useImperativeHandle(t,e,r)};Wt.useInsertionEffect=function(t,e){return Si.current.useInsertionEffect(t,e)};Wt.useLayoutEffect=function(t,e){return Si.current.useLayoutEffect(t,e)};Wt.useMemo=function(t,e){return Si.current.useMemo(t,e)};Wt.useReducer=function(t,e,r){return Si.current.useReducer(t,e,r)};Wt.useRef=function(t){return Si.current.useRef(t)};Wt.useState=function(t){return Si.current.useState(t)};Wt.useSyncExternalStore=function(t,e,r){return Si.current.useSyncExternalStore(t,e,r)};Wt.useTransition=function(){return Si.current.useTransition()};Wt.version="18.3.1";KX.exports=Wt;var S=KX.exports;const me=qt(S),H3=Tme({__proto__:null,default:me},[S]);/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Gme=S,Kme=Symbol.for("react.element"),Yme=Symbol.for("react.fragment"),Xme=Object.prototype.hasOwnProperty,Qme=Gme.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Zme={key:!0,ref:!0,__self:!0,__source:!0};function nQ(t,e,r){var n,s={},i=null,o=null;r!==void 0&&(i=""+r),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(n in e)Xme.call(e,n)&&!Zme.hasOwnProperty(n)&&(s[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)s[n]===void 0&&(s[n]=e[n]);return{$$typeof:Kme,type:t,key:i,ref:o,props:s,_owner:Qme.current}}Bk.Fragment=Yme;Bk.jsx=nQ;Bk.jsxs=nQ;GX.exports=Bk;var a=GX.exports,sQ={exports:{}},La={},iQ={exports:{}},aQ={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(t){function e(Y,H){var B=Y.length;Y.push(H);e:for(;0<B;){var L=B-1>>>1,F=Y[L];if(0<s(F,H))Y[L]=H,Y[B]=F,B=L;else break e}}function r(Y){return Y.length===0?null:Y[0]}function n(Y){if(Y.length===0)return null;var H=Y[0],B=Y.pop();if(B!==H){Y[0]=B;e:for(var L=0,F=Y.length,W=F>>>1;L<W;){var X=2*(L+1)-1,oe=Y[X],le=X+1,U=Y[le];if(0>s(oe,B))le<F&&0>s(U,oe)?(Y[L]=U,Y[le]=B,L=le):(Y[L]=oe,Y[X]=B,L=X);else if(le<F&&0>s(U,B))Y[L]=U,Y[le]=B,L=le;else break e}}return H}function s(Y,H){var B=Y.sortIndex-H.sortIndex;return B!==0?B:Y.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,h=null,f=3,p=!1,g=!1,m=!1,x=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(Y){for(var H=r(u);H!==null;){if(H.callback===null)n(u);else if(H.startTime<=Y)n(u),H.sortIndex=H.expirationTime,e(c,H);else break;H=r(u)}}function w(Y){if(m=!1,b(Y),!g)if(r(c)!==null)g=!0,K(j);else{var H=r(u);H!==null&&G(w,H.startTime-Y)}}function j(Y,H){g=!1,m&&(m=!1,y(k),k=-1),p=!0;var B=f;try{for(b(H),h=r(c);h!==null&&(!(h.expirationTime>H)||Y&&!z());){var L=h.callback;if(typeof L=="function"){h.callback=null,f=h.priorityLevel;var F=L(h.expirationTime<=H);H=t.unstable_now(),typeof F=="function"?h.callback=F:h===r(c)&&n(c),b(H)}else n(c);h=r(c)}if(h!==null)var W=!0;else{var X=r(u);X!==null&&G(w,X.startTime-H),W=!1}return W}finally{h=null,f=B,p=!1}}var N=!1,C=null,k=-1,E=5,M=-1;function z(){return!(t.unstable_now()-M<E)}function P(){if(C!==null){var Y=t.unstable_now();M=Y;var H=!0;try{H=C(!0,Y)}finally{H?V():(N=!1,C=null)}}else N=!1}var V;if(typeof v=="function")V=function(){v(P)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,$=A.port2;A.port1.onmessage=P,V=function(){$.postMessage(null)}}else V=function(){x(P,0)};function K(Y){C=Y,N||(N=!0,V())}function G(Y,H){k=x(function(){Y(t.unstable_now())},H)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(Y){Y.callback=null},t.unstable_continueExecution=function(){g||p||(g=!0,K(j))},t.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<Y?Math.floor(1e3/Y):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return r(c)},t.unstable_next=function(Y){switch(f){case 1:case 2:case 3:var H=3;break;default:H=f}var B=f;f=H;try{return Y()}finally{f=B}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(Y,H){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var B=f;f=Y;try{return H()}finally{f=B}},t.unstable_scheduleCallback=function(Y,H,B){var L=t.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?L+B:L):B=L,Y){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=B+F,Y={id:d++,callback:H,priorityLevel:Y,startTime:B,expirationTime:F,sortIndex:-1},B>L?(Y.sortIndex=B,e(u,Y),r(c)===null&&Y===r(u)&&(m?(y(k),k=-1):m=!0,G(w,B-L))):(Y.sortIndex=F,e(c,Y),g||p||(g=!0,K(j))),Y},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(Y){var H=f;return function(){var B=f;f=H;try{return Y.apply(this,arguments)}finally{f=B}}}})(aQ);iQ.exports=aQ;var Jme=iQ.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ege=S,Da=Jme;function He(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)e+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var oQ=new Set,Ew={};function ig(t,e){hv(t,e),hv(t+"Capture",e)}function hv(t,e){for(Ew[t]=e,t=0;t<e.length;t++)oQ.add(e[t])}var Wu=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gM=Object.prototype.hasOwnProperty,tge=/^[: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]*$/,HB={},WB={};function rge(t){return gM.call(WB,t)?!0:gM.call(HB,t)?!1:tge.test(t)?WB[t]=!0:(HB[t]=!0,!1)}function nge(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function sge(t,e,r,n){if(e===null||typeof e>"u"||nge(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ni(t,e,r,n,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var Rs={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Rs[t]=new Ni(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Rs[e]=new Ni(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Rs[t]=new Ni(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Rs[t]=new Ni(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Rs[t]=new Ni(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Rs[t]=new Ni(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Rs[t]=new Ni(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Rs[t]=new Ni(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Rs[t]=new Ni(t,5,!1,t.toLowerCase(),null,!1,!1)});var W3=/[\-:]([a-z])/g;function V3(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(W3,V3);Rs[e]=new Ni(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(W3,V3);Rs[e]=new Ni(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(W3,V3);Rs[e]=new Ni(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Rs[t]=new Ni(t,1,!1,t.toLowerCase(),null,!1,!1)});Rs.xlinkHref=new Ni("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Rs[t]=new Ni(t,1,!1,t.toLowerCase(),null,!0,!0)});function q3(t,e,r,n){var s=Rs.hasOwnProperty(e)?Rs[e]:null;(s!==null?s.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(sge(e,r,s,n)&&(r=null),n||s===null?rge(e)&&(r===null?t.removeAttribute(e):t.setAttribute(e,""+r)):s.mustUseProperty?t[s.propertyName]=r===null?s.type===3?!1:"":r:(e=s.attributeName,n=s.attributeNamespace,r===null?t.removeAttribute(e):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,n?t.setAttributeNS(n,e,r):t.setAttribute(e,r))))}var ad=ege.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,LS=Symbol.for("react.element"),Qg=Symbol.for("react.portal"),Zg=Symbol.for("react.fragment"),G3=Symbol.for("react.strict_mode"),yM=Symbol.for("react.profiler"),lQ=Symbol.for("react.provider"),cQ=Symbol.for("react.context"),K3=Symbol.for("react.forward_ref"),xM=Symbol.for("react.suspense"),vM=Symbol.for("react.suspense_list"),Y3=Symbol.for("react.memo"),Ed=Symbol.for("react.lazy"),uQ=Symbol.for("react.offscreen"),VB=Symbol.iterator;function Db(t){return t===null||typeof t!="object"?null:(t=VB&&t[VB]||t["@@iterator"],typeof t=="function"?t:null)}var an=Object.assign,dP;function v0(t){if(dP===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);dP=e&&e[1]||""}return`
`+dP+t}var hP=!1;function fP(t,e){if(!t||hP)return"";hP=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var n=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){n=u}t.call(e.prototype)}else{try{throw Error()}catch(u){n=u}t()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(`
`),i=n.stack.split(`
`),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
`+s[o].replace(" at new "," at ");return t.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",t.displayName)),c}while(1<=o&&0<=l);break}}}finally{hP=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?v0(t):""}function ige(t){switch(t.tag){case 5:return v0(t.type);case 16:return v0("Lazy");case 13:return v0("Suspense");case 19:return v0("SuspenseList");case 0:case 2:case 15:return t=fP(t.type,!1),t;case 11:return t=fP(t.type.render,!1),t;case 1:return t=fP(t.type,!0),t;default:return""}}function bM(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Zg:return"Fragment";case Qg:return"Portal";case yM:return"Profiler";case G3:return"StrictMode";case xM:return"Suspense";case vM:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case cQ:return(t.displayName||"Context")+".Consumer";case lQ:return(t._context.displayName||"Context")+".Provider";case K3:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Y3:return e=t.displayName||null,e!==null?e:bM(t.type)||"Memo";case Ed:e=t._payload,t=t._init;try{return bM(t(e))}catch{}}return null}function age(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return bM(e);case 8:return e===G3?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Yh(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function dQ(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function oge(t){var e=dQ(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function FS(t){t._valueTracker||(t._valueTracker=oge(t))}function hQ(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=dQ(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function dE(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function wM(t,e){var r=e.checked;return an({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function qB(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=Yh(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function fQ(t,e){e=e.checked,e!=null&&q3(t,"checked",e,!1)}function _M(t,e){fQ(t,e);var r=Yh(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?jM(t,e.type,r):e.hasOwnProperty("defaultValue")&&jM(t,e.type,Yh(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function GB(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function jM(t,e,r){(e!=="number"||dE(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var b0=Array.isArray;function _y(t,e,r,n){if(t=t.options,e){e={};for(var s=0;s<r.length;s++)e["$"+r[s]]=!0;for(r=0;r<t.length;r++)s=e.hasOwnProperty("$"+t[r].value),t[r].selected!==s&&(t[r].selected=s),s&&n&&(t[r].defaultSelected=!0)}else{for(r=""+Yh(r),e=null,s=0;s<t.length;s++){if(t[s].value===r){t[s].selected=!0,n&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function SM(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(He(91));return an({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function KB(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(He(92));if(b0(r)){if(1<r.length)throw Error(He(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:Yh(r)}}function pQ(t,e){var r=Yh(e.value),n=Yh(e.defaultValue);r!=null&&(r=""+r,r!==t.value&&(t.value=r),e.defaultValue==null&&t.defaultValue!==r&&(t.defaultValue=r)),n!=null&&(t.defaultValue=""+n)}function YB(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function mQ(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function NM(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?mQ(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var $S,gQ=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,r,n,s){MSApp.execUnsafeLocalFunction(function(){return t(e,r,n,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for($S=$S||document.createElement("div"),$S.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=$S.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Cw(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var tw={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},lge=["Webkit","ms","Moz","O"];Object.keys(tw).forEach(function(t){lge.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),tw[e]=tw[t]})});function yQ(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||tw.hasOwnProperty(t)&&tw[t]?(""+e).trim():e+"px"}function xQ(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=yQ(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,s):t[r]=s}}var cge=an({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function AM(t,e){if(e){if(cge[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(He(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(He(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(He(61))}if(e.style!=null&&typeof e.style!="object")throw Error(He(62))}}function EM(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 CM=null;function X3(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var kM=null,jy=null,Sy=null;function XB(t){if(t=Cj(t)){if(typeof kM!="function")throw Error(He(280));var e=t.stateNode;e&&(e=Vk(e),kM(t.stateNode,t.type,e))}}function vQ(t){jy?Sy?Sy.push(t):Sy=[t]:jy=t}function bQ(){if(jy){var t=jy,e=Sy;if(Sy=jy=null,XB(t),e)for(t=0;t<e.length;t++)XB(e[t])}}function wQ(t,e){return t(e)}function _Q(){}var pP=!1;function jQ(t,e,r){if(pP)return t(e,r);pP=!0;try{return wQ(t,e,r)}finally{pP=!1,(jy!==null||Sy!==null)&&(_Q(),bQ())}}function kw(t,e){var r=t.stateNode;if(r===null)return null;var n=Vk(r);if(n===null)return null;r=n[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(He(231,e,typeof r));return r}var TM=!1;if(Wu)try{var Lb={};Object.defineProperty(Lb,"passive",{get:function(){TM=!0}}),window.addEventListener("test",Lb,Lb),window.removeEventListener("test",Lb,Lb)}catch{TM=!1}function uge(t,e,r,n,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{e.apply(r,u)}catch(d){this.onError(d)}}var rw=!1,hE=null,fE=!1,PM=null,dge={onError:function(t){rw=!0,hE=t}};function hge(t,e,r,n,s,i,o,l,c){rw=!1,hE=null,uge.apply(dge,arguments)}function fge(t,e,r,n,s,i,o,l,c){if(hge.apply(this,arguments),rw){if(rw){var u=hE;rw=!1,hE=null}else throw Error(He(198));fE||(fE=!0,PM=u)}}function ag(t){var e=t,r=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(r=e.return),t=e.return;while(t)}return e.tag===3?r:null}function SQ(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function QB(t){if(ag(t)!==t)throw Error(He(188))}function pge(t){var e=t.alternate;if(!e){if(e=ag(t),e===null)throw Error(He(188));return e!==t?null:t}for(var r=t,n=e;;){var s=r.return;if(s===null)break;var i=s.alternate;if(i===null){if(n=s.return,n!==null){r=n;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===r)return QB(s),t;if(i===n)return QB(s),e;i=i.sibling}throw Error(He(188))}if(r.return!==n.return)r=s,n=i;else{for(var o=!1,l=s.child;l;){if(l===r){o=!0,r=s,n=i;break}if(l===n){o=!0,n=s,r=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===r){o=!0,r=i,n=s;break}if(l===n){o=!0,n=i,r=s;break}l=l.sibling}if(!o)throw Error(He(189))}}if(r.alternate!==n)throw Error(He(190))}if(r.tag!==3)throw Error(He(188));return r.stateNode.current===r?t:e}function NQ(t){return t=pge(t),t!==null?AQ(t):null}function AQ(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=AQ(t);if(e!==null)return e;t=t.sibling}return null}var EQ=Da.unstable_scheduleCallback,ZB=Da.unstable_cancelCallback,mge=Da.unstable_shouldYield,gge=Da.unstable_requestPaint,Nn=Da.unstable_now,yge=Da.unstable_getCurrentPriorityLevel,Q3=Da.unstable_ImmediatePriority,CQ=Da.unstable_UserBlockingPriority,pE=Da.unstable_NormalPriority,xge=Da.unstable_LowPriority,kQ=Da.unstable_IdlePriority,Uk=null,cc=null;function vge(t){if(cc&&typeof cc.onCommitFiberRoot=="function")try{cc.onCommitFiberRoot(Uk,t,void 0,(t.current.flags&128)===128)}catch{}}var al=Math.clz32?Math.clz32:_ge,bge=Math.log,wge=Math.LN2;function _ge(t){return t>>>=0,t===0?32:31-(bge(t)/wge|0)|0}var BS=64,US=4194304;function w0(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function mE(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,s=t.suspendedLanes,i=t.pingedLanes,o=r&268435455;if(o!==0){var l=o&~s;l!==0?n=w0(l):(i&=o,i!==0&&(n=w0(i)))}else o=r&~s,o!==0?n=w0(o):i!==0&&(n=w0(i));if(n===0)return 0;if(e!==0&&e!==n&&!(e&s)&&(s=n&-n,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0<e;)r=31-al(e),s=1<<r,n|=t[r],e&=~s;return n}function jge(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Sge(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-al(i),l=1<<o,c=s[o];c===-1?(!(l&r)||l&n)&&(s[o]=jge(l,e)):c<=e&&(t.expiredLanes|=l),i&=~l}}function OM(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function TQ(){var t=BS;return BS<<=1,!(BS&4194240)&&(BS=64),t}function mP(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function Aj(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-al(e),t[e]=r}function Nge(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0<r;){var s=31-al(r),i=1<<s;e[s]=0,n[s]=-1,t[s]=-1,r&=~i}}function Z3(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-al(r),s=1<<n;s&e|t[n]&e&&(t[n]|=e),r&=~s}}var mr=0;function PQ(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var OQ,J3,IQ,RQ,MQ,IM=!1,zS=[],Lh=null,Fh=null,$h=null,Tw=new Map,Pw=new Map,Td=[],Age="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 submit".split(" ");function JB(t,e){switch(t){case"focusin":case"focusout":Lh=null;break;case"dragenter":case"dragleave":Fh=null;break;case"mouseover":case"mouseout":$h=null;break;case"pointerover":case"pointerout":Tw.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pw.delete(e.pointerId)}}function Fb(t,e,r,n,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[s]},e!==null&&(e=Cj(e),e!==null&&J3(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function Ege(t,e,r,n,s){switch(e){case"focusin":return Lh=Fb(Lh,t,e,r,n,s),!0;case"dragenter":return Fh=Fb(Fh,t,e,r,n,s),!0;case"mouseover":return $h=Fb($h,t,e,r,n,s),!0;case"pointerover":var i=s.pointerId;return Tw.set(i,Fb(Tw.get(i)||null,t,e,r,n,s)),!0;case"gotpointercapture":return i=s.pointerId,Pw.set(i,Fb(Pw.get(i)||null,t,e,r,n,s)),!0}return!1}function DQ(t){var e=np(t.target);if(e!==null){var r=ag(e);if(r!==null){if(e=r.tag,e===13){if(e=SQ(r),e!==null){t.blockedOn=e,MQ(t.priority,function(){IQ(r)});return}}else if(e===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function iA(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=RM(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);CM=n,r.target.dispatchEvent(n),CM=null}else return e=Cj(r),e!==null&&J3(e),t.blockedOn=r,!1;e.shift()}return!0}function eU(t,e,r){iA(t)&&r.delete(e)}function Cge(){IM=!1,Lh!==null&&iA(Lh)&&(Lh=null),Fh!==null&&iA(Fh)&&(Fh=null),$h!==null&&iA($h)&&($h=null),Tw.forEach(eU),Pw.forEach(eU)}function $b(t,e){t.blockedOn===e&&(t.blockedOn=null,IM||(IM=!0,Da.unstable_scheduleCallback(Da.unstable_NormalPriority,Cge)))}function Ow(t){function e(s){return $b(s,t)}if(0<zS.length){$b(zS[0],t);for(var r=1;r<zS.length;r++){var n=zS[r];n.blockedOn===t&&(n.blockedOn=null)}}for(Lh!==null&&$b(Lh,t),Fh!==null&&$b(Fh,t),$h!==null&&$b($h,t),Tw.forEach(e),Pw.forEach(e),r=0;r<Td.length;r++)n=Td[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<Td.length&&(r=Td[0],r.blockedOn===null);)DQ(r),r.blockedOn===null&&Td.shift()}var Ny=ad.ReactCurrentBatchConfig,gE=!0;function kge(t,e,r,n){var s=mr,i=Ny.transition;Ny.transition=null;try{mr=1,eF(t,e,r,n)}finally{mr=s,Ny.transition=i}}function Tge(t,e,r,n){var s=mr,i=Ny.transition;Ny.transition=null;try{mr=4,eF(t,e,r,n)}finally{mr=s,Ny.transition=i}}function eF(t,e,r,n){if(gE){var s=RM(t,e,r,n);if(s===null)NP(t,e,n,yE,r),JB(t,n);else if(Ege(s,t,e,r,n))n.stopPropagation();else if(JB(t,n),e&4&&-1<Age.indexOf(t)){for(;s!==null;){var i=Cj(s);if(i!==null&&OQ(i),i=RM(t,e,r,n),i===null&&NP(t,e,n,yE,r),i===s)break;s=i}s!==null&&n.stopPropagation()}else NP(t,e,n,null,r)}}var yE=null;function RM(t,e,r,n){if(yE=null,t=X3(n),t=np(t),t!==null)if(e=ag(t),e===null)t=null;else if(r=e.tag,r===13){if(t=SQ(e),t!==null)return t;t=null}else if(r===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return yE=t,null}function LQ(t){switch(t){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(yge()){case Q3:return 1;case CQ:return 4;case pE:case xge:return 16;case kQ:return 536870912;default:return 16}default:return 16}}var Rh=null,tF=null,aA=null;function FQ(){if(aA)return aA;var t,e=tF,r=e.length,n,s="value"in Rh?Rh.value:Rh.textContent,i=s.length;for(t=0;t<r&&e[t]===s[t];t++);var o=r-t;for(n=1;n<=o&&e[r-n]===s[i-n];n++);return aA=s.slice(t,1<n?1-n:void 0)}function oA(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function HS(){return!0}function tU(){return!1}function Fa(t){function e(r,n,s,i,o){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(r=t[l],this[l]=r?r(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?HS:tU,this.isPropagationStopped=tU,this}return an(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=HS)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=HS)},persist:function(){},isPersistent:HS}),e}var tb={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rF=Fa(tb),Ej=an({},tb,{view:0,detail:0}),Pge=Fa(Ej),gP,yP,Bb,zk=an({},Ej,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nF,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Bb&&(Bb&&t.type==="mousemove"?(gP=t.screenX-Bb.screenX,yP=t.screenY-Bb.screenY):yP=gP=0,Bb=t),gP)},movementY:function(t){return"movementY"in t?t.movementY:yP}}),rU=Fa(zk),Oge=an({},zk,{dataTransfer:0}),Ige=Fa(Oge),Rge=an({},Ej,{relatedTarget:0}),xP=Fa(Rge),Mge=an({},tb,{animationName:0,elapsedTime:0,pseudoElement:0}),Dge=Fa(Mge),Lge=an({},tb,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Fge=Fa(Lge),$ge=an({},tb,{data:0}),nU=Fa($ge),Bge={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Uge={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"},zge={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hge(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=zge[t])?!!e[t]:!1}function nF(){return Hge}var Wge=an({},Ej,{key:function(t){if(t.key){var e=Bge[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=oA(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Uge[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nF,charCode:function(t){return t.type==="keypress"?oA(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?oA(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Vge=Fa(Wge),qge=an({},zk,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sU=Fa(qge),Gge=an({},Ej,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nF}),Kge=Fa(Gge),Yge=an({},tb,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xge=Fa(Yge),Qge=an({},zk,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Zge=Fa(Qge),Jge=[9,13,27,32],sF=Wu&&"CompositionEvent"in window,nw=null;Wu&&"documentMode"in document&&(nw=document.documentMode);var eye=Wu&&"TextEvent"in window&&!nw,$Q=Wu&&(!sF||nw&&8<nw&&11>=nw),iU=" ",aU=!1;function BQ(t,e){switch(t){case"keyup":return Jge.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function UQ(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Jg=!1;function tye(t,e){switch(t){case"compositionend":return UQ(e);case"keypress":return e.which!==32?null:(aU=!0,iU);case"textInput":return t=e.data,t===iU&&aU?null:t;default:return null}}function rye(t,e){if(Jg)return t==="compositionend"||!sF&&BQ(t,e)?(t=FQ(),aA=tF=Rh=null,Jg=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return $Q&&e.locale!=="ko"?null:e.data;default:return null}}var nye={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 oU(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!nye[t.type]:e==="textarea"}function zQ(t,e,r,n){vQ(n),e=xE(e,"onChange"),0<e.length&&(r=new rF("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var sw=null,Iw=null;function sye(t){JQ(t,0)}function Hk(t){var e=ry(t);if(hQ(e))return t}function iye(t,e){if(t==="change")return e}var HQ=!1;if(Wu){var vP;if(Wu){var bP="oninput"in document;if(!bP){var lU=document.createElement("div");lU.setAttribute("oninput","return;"),bP=typeof lU.oninput=="function"}vP=bP}else vP=!1;HQ=vP&&(!document.documentMode||9<document.documentMode)}function cU(){sw&&(sw.detachEvent("onpropertychange",WQ),Iw=sw=null)}function WQ(t){if(t.propertyName==="value"&&Hk(Iw)){var e=[];zQ(e,Iw,t,X3(t)),jQ(sye,e)}}function aye(t,e,r){t==="focusin"?(cU(),sw=e,Iw=r,sw.attachEvent("onpropertychange",WQ)):t==="focusout"&&cU()}function oye(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Hk(Iw)}function lye(t,e){if(t==="click")return Hk(e)}function cye(t,e){if(t==="input"||t==="change")return Hk(e)}function uye(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ul=typeof Object.is=="function"?Object.is:uye;function Rw(t,e){if(ul(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var s=r[n];if(!gM.call(e,s)||!ul(t[s],e[s]))return!1}return!0}function uU(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function dU(t,e){var r=uU(t);t=0;for(var n;r;){if(r.nodeType===3){if(n=t+r.textContent.length,t<=e&&n>=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=uU(r)}}function VQ(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?VQ(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function qQ(){for(var t=window,e=dE();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=dE(t.document)}return e}function iF(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function dye(t){var e=qQ(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&VQ(r.ownerDocument.documentElement,r)){if(n!==null&&iF(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=r.textContent.length,i=Math.min(n.start,s);n=n.end===void 0?i:Math.min(n.end,s),!t.extend&&i>n&&(s=n,n=i,i=s),s=dU(r,i);var o=dU(r,n);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>n?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<e.length;r++)t=e[r],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var hye=Wu&&"documentMode"in document&&11>=document.documentMode,ey=null,MM=null,iw=null,DM=!1;function hU(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;DM||ey==null||ey!==dE(n)||(n=ey,"selectionStart"in n&&iF(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),iw&&Rw(iw,n)||(iw=n,n=xE(MM,"onSelect"),0<n.length&&(e=new rF("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=ey)))}function WS(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var ty={animationend:WS("Animation","AnimationEnd"),animationiteration:WS("Animation","AnimationIteration"),animationstart:WS("Animation","AnimationStart"),transitionend:WS("Transition","TransitionEnd")},wP={},GQ={};Wu&&(GQ=document.createElement("div").style,"AnimationEvent"in window||(delete ty.animationend.animation,delete ty.animationiteration.animation,delete ty.animationstart.animation),"TransitionEvent"in window||delete ty.transitionend.transition);function Wk(t){if(wP[t])return wP[t];if(!ty[t])return t;var e=ty[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in GQ)return wP[t]=e[r];return t}var KQ=Wk("animationend"),YQ=Wk("animationiteration"),XQ=Wk("animationstart"),QQ=Wk("transitionend"),ZQ=new Map,fU="abort auxClick 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(" ");function cf(t,e){ZQ.set(t,e),ig(e,[t])}for(var _P=0;_P<fU.length;_P++){var jP=fU[_P],fye=jP.toLowerCase(),pye=jP[0].toUpperCase()+jP.slice(1);cf(fye,"on"+pye)}cf(KQ,"onAnimationEnd");cf(YQ,"onAnimationIteration");cf(XQ,"onAnimationStart");cf("dblclick","onDoubleClick");cf("focusin","onFocus");cf("focusout","onBlur");cf(QQ,"onTransitionEnd");hv("onMouseEnter",["mouseout","mouseover"]);hv("onMouseLeave",["mouseout","mouseover"]);hv("onPointerEnter",["pointerout","pointerover"]);hv("onPointerLeave",["pointerout","pointerover"]);ig("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ig("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ig("onBeforeInput",["compositionend","keypress","textInput","paste"]);ig("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ig("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ig("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _0="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(" "),mye=new Set("cancel close invalid load scroll toggle".split(" ").concat(_0));function pU(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,fge(n,e,void 0,t),t.currentTarget=null}function JQ(t,e){e=(e&4)!==0;for(var r=0;r<t.length;r++){var n=t[r],s=n.event;n=n.listeners;e:{var i=void 0;if(e)for(var o=n.length-1;0<=o;o--){var l=n[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;pU(s,l,u),i=c}else for(o=0;o<n.length;o++){if(l=n[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;pU(s,l,u),i=c}}}if(fE)throw t=PM,fE=!1,PM=null,t}function Br(t,e){var r=e[UM];r===void 0&&(r=e[UM]=new Set);var n=t+"__bubble";r.has(n)||(eZ(e,t,2,!1),r.add(n))}function SP(t,e,r){var n=0;e&&(n|=4),eZ(r,t,n,e)}var VS="_reactListening"+Math.random().toString(36).slice(2);function Mw(t){if(!t[VS]){t[VS]=!0,oQ.forEach(function(r){r!=="selectionchange"&&(mye.has(r)||SP(r,!1,t),SP(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[VS]||(e[VS]=!0,SP("selectionchange",!1,e))}}function eZ(t,e,r,n){switch(LQ(e)){case 1:var s=kge;break;case 4:s=Tge;break;default:s=eF}r=s.bind(null,e,r,t),s=void 0,!TM||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),n?s!==void 0?t.addEventListener(e,r,{capture:!0,passive:s}):t.addEventListener(e,r,!0):s!==void 0?t.addEventListener(e,r,{passive:s}):t.addEventListener(e,r,!1)}function NP(t,e,r,n,s){var i=n;if(!(e&1)&&!(e&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=n.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=np(l),o===null)return;if(c=o.tag,c===5||c===6){n=i=o;continue e}l=l.parentNode}}n=n.return}jQ(function(){var u=i,d=X3(r),h=[];e:{var f=ZQ.get(t);if(f!==void 0){var p=rF,g=t;switch(t){case"keypress":if(oA(r)===0)break e;case"keydown":case"keyup":p=Vge;break;case"focusin":g="focus",p=xP;break;case"focusout":g="blur",p=xP;break;case"beforeblur":case"afterblur":p=xP;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=rU;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Ige;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Kge;break;case KQ:case YQ:case XQ:p=Dge;break;case QQ:p=Xge;break;case"scroll":p=Pge;break;case"wheel":p=Zge;break;case"copy":case"cut":case"paste":p=Fge;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=sU}var m=(e&4)!==0,x=!m&&t==="scroll",y=m?f!==null?f+"Capture":null:f;m=[];for(var v=u,b;v!==null;){b=v;var w=b.stateNode;if(b.tag===5&&w!==null&&(b=w,y!==null&&(w=kw(v,y),w!=null&&m.push(Dw(v,w,b)))),x)break;v=v.return}0<m.length&&(f=new p(f,g,null,r,d),h.push({event:f,listeners:m}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&r!==CM&&(g=r.relatedTarget||r.fromElement)&&(np(g)||g[Vu]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(g=r.relatedTarget||r.toElement,p=u,g=g?np(g):null,g!==null&&(x=ag(g),g!==x||g.tag!==5&&g.tag!==6)&&(g=null)):(p=null,g=u),p!==g)){if(m=rU,w="onMouseLeave",y="onMouseEnter",v="mouse",(t==="pointerout"||t==="pointerover")&&(m=sU,w="onPointerLeave",y="onPointerEnter",v="pointer"),x=p==null?f:ry(p),b=g==null?f:ry(g),f=new m(w,v+"leave",p,r,d),f.target=x,f.relatedTarget=b,w=null,np(d)===u&&(m=new m(y,v+"enter",g,r,d),m.target=b,m.relatedTarget=x,w=m),x=w,p&&g)t:{for(m=p,y=g,v=0,b=m;b;b=wg(b))v++;for(b=0,w=y;w;w=wg(w))b++;for(;0<v-b;)m=wg(m),v--;for(;0<b-v;)y=wg(y),b--;for(;v--;){if(m===y||y!==null&&m===y.alternate)break t;m=wg(m),y=wg(y)}m=null}else m=null;p!==null&&mU(h,f,p,m,!1),g!==null&&x!==null&&mU(h,x,g,m,!0)}}e:{if(f=u?ry(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var j=iye;else if(oU(f))if(HQ)j=cye;else{j=oye;var N=aye}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(j=lye);if(j&&(j=j(t,u))){zQ(h,j,r,d);break e}N&&N(t,f,u),t==="focusout"&&(N=f._wrapperState)&&N.controlled&&f.type==="number"&&jM(f,"number",f.value)}switch(N=u?ry(u):window,t){case"focusin":(oU(N)||N.contentEditable==="true")&&(ey=N,MM=u,iw=null);break;case"focusout":iw=MM=ey=null;break;case"mousedown":DM=!0;break;case"contextmenu":case"mouseup":case"dragend":DM=!1,hU(h,r,d);break;case"selectionchange":if(hye)break;case"keydown":case"keyup":hU(h,r,d)}var C;if(sF)e:{switch(t){case"compositionstart":var k="onCompositionStart";break e;case"compositionend":k="onCompositionEnd";break e;case"compositionupdate":k="onCompositionUpdate";break e}k=void 0}else Jg?BQ(t,r)&&(k="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(k="onCompositionStart");k&&($Q&&r.locale!=="ko"&&(Jg||k!=="onCompositionStart"?k==="onCompositionEnd"&&Jg&&(C=FQ()):(Rh=d,tF="value"in Rh?Rh.value:Rh.textContent,Jg=!0)),N=xE(u,k),0<N.length&&(k=new nU(k,t,null,r,d),h.push({event:k,listeners:N}),C?k.data=C:(C=UQ(r),C!==null&&(k.data=C)))),(C=eye?tye(t,r):rye(t,r))&&(u=xE(u,"onBeforeInput"),0<u.length&&(d=new nU("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:u}),d.data=C))}JQ(h,e)})}function Dw(t,e,r){return{instance:t,listener:e,currentTarget:r}}function xE(t,e){for(var r=e+"Capture",n=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=kw(t,r),i!=null&&n.unshift(Dw(t,i,s)),i=kw(t,e),i!=null&&n.push(Dw(t,i,s))),t=t.return}return n}function wg(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function mU(t,e,r,n,s){for(var i=e._reactName,o=[];r!==null&&r!==n;){var l=r,c=l.alternate,u=l.stateNode;if(c!==null&&c===n)break;l.tag===5&&u!==null&&(l=u,s?(c=kw(r,i),c!=null&&o.unshift(Dw(r,c,l))):s||(c=kw(r,i),c!=null&&o.push(Dw(r,c,l)))),r=r.return}o.length!==0&&t.push({event:e,listeners:o})}var gye=/\r\n?/g,yye=/\u0000|\uFFFD/g;function gU(t){return(typeof t=="string"?t:""+t).replace(gye,`
`).replace(yye,"")}function qS(t,e,r){if(e=gU(e),gU(t)!==e&&r)throw Error(He(425))}function vE(){}var LM=null,FM=null;function $M(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var BM=typeof setTimeout=="function"?setTimeout:void 0,xye=typeof clearTimeout=="function"?clearTimeout:void 0,yU=typeof Promise=="function"?Promise:void 0,vye=typeof queueMicrotask=="function"?queueMicrotask:typeof yU<"u"?function(t){return yU.resolve(null).then(t).catch(bye)}:BM;function bye(t){setTimeout(function(){throw t})}function AP(t,e){var r=e,n=0;do{var s=r.nextSibling;if(t.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(n===0){t.removeChild(s),Ow(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);Ow(e)}function Bh(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function xU(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"){if(e===0)return t;e--}else r==="/$"&&e++}t=t.previousSibling}return null}var rb=Math.random().toString(36).slice(2),rc="__reactFiber$"+rb,Lw="__reactProps$"+rb,Vu="__reactContainer$"+rb,UM="__reactEvents$"+rb,wye="__reactListeners$"+rb,_ye="__reactHandles$"+rb;function np(t){var e=t[rc];if(e)return e;for(var r=t.parentNode;r;){if(e=r[Vu]||r[rc]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=xU(t);t!==null;){if(r=t[rc])return r;t=xU(t)}return e}t=r,r=t.parentNode}return null}function Cj(t){return t=t[rc]||t[Vu],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function ry(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(He(33))}function Vk(t){return t[Lw]||null}var zM=[],ny=-1;function uf(t){return{current:t}}function Vr(t){0>ny||(t.current=zM[ny],zM[ny]=null,ny--)}function Or(t,e){ny++,zM[ny]=t.current,t.current=e}var Xh={},Zs=uf(Xh),qi=uf(!1),Fm=Xh;function fv(t,e){var r=t.type.contextTypes;if(!r)return Xh;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in r)s[i]=e[i];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Gi(t){return t=t.childContextTypes,t!=null}function bE(){Vr(qi),Vr(Zs)}function vU(t,e,r){if(Zs.current!==Xh)throw Error(He(168));Or(Zs,e),Or(qi,r)}function tZ(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in e))throw Error(He(108,age(t)||"Unknown",s));return an({},r,n)}function wE(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Xh,Fm=Zs.current,Or(Zs,t),Or(qi,qi.current),!0}function bU(t,e,r){var n=t.stateNode;if(!n)throw Error(He(169));r?(t=tZ(t,e,Fm),n.__reactInternalMemoizedMergedChildContext=t,Vr(qi),Vr(Zs),Or(Zs,t)):Vr(qi),Or(qi,r)}var Xc=null,qk=!1,EP=!1;function rZ(t){Xc===null?Xc=[t]:Xc.push(t)}function jye(t){qk=!0,rZ(t)}function df(){if(!EP&&Xc!==null){EP=!0;var t=0,e=mr;try{var r=Xc;for(mr=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}Xc=null,qk=!1}catch(s){throw Xc!==null&&(Xc=Xc.slice(t+1)),EQ(Q3,df),s}finally{mr=e,EP=!1}}return null}var sy=[],iy=0,_E=null,jE=0,so=[],io=0,$m=null,Ou=1,Iu="";function Bf(t,e){sy[iy++]=jE,sy[iy++]=_E,_E=t,jE=e}function nZ(t,e,r){so[io++]=Ou,so[io++]=Iu,so[io++]=$m,$m=t;var n=Ou;t=Iu;var s=32-al(n)-1;n&=~(1<<s),r+=1;var i=32-al(e)+s;if(30<i){var o=s-s%5;i=(n&(1<<o)-1).toString(32),n>>=o,s-=o,Ou=1<<32-al(e)+s|r<<s|n,Iu=i+t}else Ou=1<<i|r<<s|n,Iu=t}function aF(t){t.return!==null&&(Bf(t,1),nZ(t,1,0))}function oF(t){for(;t===_E;)_E=sy[--iy],sy[iy]=null,jE=sy[--iy],sy[iy]=null;for(;t===$m;)$m=so[--io],so[io]=null,Iu=so[--io],so[io]=null,Ou=so[--io],so[io]=null}var Pa=null,ka=null,Qr=!1,Jo=null;function sZ(t,e){var r=co(5,null,null,0);r.elementType="DELETED",r.stateNode=e,r.return=t,e=t.deletions,e===null?(t.deletions=[r],t.flags|=16):e.push(r)}function wU(t,e){switch(t.tag){case 5:var r=t.type;return e=e.nodeType!==1||r.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Pa=t,ka=Bh(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Pa=t,ka=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=$m!==null?{id:Ou,overflow:Iu}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=co(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Pa=t,ka=null,!0):!1;default:return!1}}function HM(t){return(t.mode&1)!==0&&(t.flags&128)===0}function WM(t){if(Qr){var e=ka;if(e){var r=e;if(!wU(t,e)){if(HM(t))throw Error(He(418));e=Bh(r.nextSibling);var n=Pa;e&&wU(t,e)?sZ(n,r):(t.flags=t.flags&-4097|2,Qr=!1,Pa=t)}}else{if(HM(t))throw Error(He(418));t.flags=t.flags&-4097|2,Qr=!1,Pa=t}}}function _U(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Pa=t}function GS(t){if(t!==Pa)return!1;if(!Qr)return _U(t),Qr=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!$M(t.type,t.memoizedProps)),e&&(e=ka)){if(HM(t))throw iZ(),Error(He(418));for(;e;)sZ(t,e),e=Bh(e.nextSibling)}if(_U(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(He(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){ka=Bh(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}ka=null}}else ka=Pa?Bh(t.stateNode.nextSibling):null;return!0}function iZ(){for(var t=ka;t;)t=Bh(t.nextSibling)}function pv(){ka=Pa=null,Qr=!1}function lF(t){Jo===null?Jo=[t]:Jo.push(t)}var Sye=ad.ReactCurrentBatchConfig;function Ub(t,e,r){if(t=r.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(He(309));var n=r.stateNode}if(!n)throw Error(He(147,t));var s=n,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(He(284));if(!r._owner)throw Error(He(290,t))}return t}function KS(t,e){throw t=Object.prototype.toString.call(e),Error(He(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function jU(t){var e=t._init;return e(t._payload)}function aZ(t){function e(y,v){if(t){var b=y.deletions;b===null?(y.deletions=[v],y.flags|=16):b.push(v)}}function r(y,v){if(!t)return null;for(;v!==null;)e(y,v),v=v.sibling;return null}function n(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function s(y,v){return y=Wh(y,v),y.index=0,y.sibling=null,y}function i(y,v,b){return y.index=b,t?(b=y.alternate,b!==null?(b=b.index,b<v?(y.flags|=2,v):b):(y.flags|=2,v)):(y.flags|=1048576,v)}function o(y){return t&&y.alternate===null&&(y.flags|=2),y}function l(y,v,b,w){return v===null||v.tag!==6?(v=RP(b,y.mode,w),v.return=y,v):(v=s(v,b),v.return=y,v)}function c(y,v,b,w){var j=b.type;return j===Zg?d(y,v,b.props.children,w,b.key):v!==null&&(v.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Ed&&jU(j)===v.type)?(w=s(v,b.props),w.ref=Ub(y,v,b),w.return=y,w):(w=pA(b.type,b.key,b.props,null,y.mode,w),w.ref=Ub(y,v,b),w.return=y,w)}function u(y,v,b,w){return v===null||v.tag!==4||v.stateNode.containerInfo!==b.containerInfo||v.stateNode.implementation!==b.implementation?(v=MP(b,y.mode,w),v.return=y,v):(v=s(v,b.children||[]),v.return=y,v)}function d(y,v,b,w,j){return v===null||v.tag!==7?(v=Tm(b,y.mode,w,j),v.return=y,v):(v=s(v,b),v.return=y,v)}function h(y,v,b){if(typeof v=="string"&&v!==""||typeof v=="number")return v=RP(""+v,y.mode,b),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case LS:return b=pA(v.type,v.key,v.props,null,y.mode,b),b.ref=Ub(y,null,v),b.return=y,b;case Qg:return v=MP(v,y.mode,b),v.return=y,v;case Ed:var w=v._init;return h(y,w(v._payload),b)}if(b0(v)||Db(v))return v=Tm(v,y.mode,b,null),v.return=y,v;KS(y,v)}return null}function f(y,v,b,w){var j=v!==null?v.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return j!==null?null:l(y,v,""+b,w);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case LS:return b.key===j?c(y,v,b,w):null;case Qg:return b.key===j?u(y,v,b,w):null;case Ed:return j=b._init,f(y,v,j(b._payload),w)}if(b0(b)||Db(b))return j!==null?null:d(y,v,b,w,null);KS(y,b)}return null}function p(y,v,b,w,j){if(typeof w=="string"&&w!==""||typeof w=="number")return y=y.get(b)||null,l(v,y,""+w,j);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case LS:return y=y.get(w.key===null?b:w.key)||null,c(v,y,w,j);case Qg:return y=y.get(w.key===null?b:w.key)||null,u(v,y,w,j);case Ed:var N=w._init;return p(y,v,b,N(w._payload),j)}if(b0(w)||Db(w))return y=y.get(b)||null,d(v,y,w,j,null);KS(v,w)}return null}function g(y,v,b,w){for(var j=null,N=null,C=v,k=v=0,E=null;C!==null&&k<b.length;k++){C.index>k?(E=C,C=null):E=C.sibling;var M=f(y,C,b[k],w);if(M===null){C===null&&(C=E);break}t&&C&&M.alternate===null&&e(y,C),v=i(M,v,k),N===null?j=M:N.sibling=M,N=M,C=E}if(k===b.length)return r(y,C),Qr&&Bf(y,k),j;if(C===null){for(;k<b.length;k++)C=h(y,b[k],w),C!==null&&(v=i(C,v,k),N===null?j=C:N.sibling=C,N=C);return Qr&&Bf(y,k),j}for(C=n(y,C);k<b.length;k++)E=p(C,y,k,b[k],w),E!==null&&(t&&E.alternate!==null&&C.delete(E.key===null?k:E.key),v=i(E,v,k),N===null?j=E:N.sibling=E,N=E);return t&&C.forEach(function(z){return e(y,z)}),Qr&&Bf(y,k),j}function m(y,v,b,w){var j=Db(b);if(typeof j!="function")throw Error(He(150));if(b=j.call(b),b==null)throw Error(He(151));for(var N=j=null,C=v,k=v=0,E=null,M=b.next();C!==null&&!M.done;k++,M=b.next()){C.index>k?(E=C,C=null):E=C.sibling;var z=f(y,C,M.value,w);if(z===null){C===null&&(C=E);break}t&&C&&z.alternate===null&&e(y,C),v=i(z,v,k),N===null?j=z:N.sibling=z,N=z,C=E}if(M.done)return r(y,C),Qr&&Bf(y,k),j;if(C===null){for(;!M.done;k++,M=b.next())M=h(y,M.value,w),M!==null&&(v=i(M,v,k),N===null?j=M:N.sibling=M,N=M);return Qr&&Bf(y,k),j}for(C=n(y,C);!M.done;k++,M=b.next())M=p(C,y,k,M.value,w),M!==null&&(t&&M.alternate!==null&&C.delete(M.key===null?k:M.key),v=i(M,v,k),N===null?j=M:N.sibling=M,N=M);return t&&C.forEach(function(P){return e(y,P)}),Qr&&Bf(y,k),j}function x(y,v,b,w){if(typeof b=="object"&&b!==null&&b.type===Zg&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case LS:e:{for(var j=b.key,N=v;N!==null;){if(N.key===j){if(j=b.type,j===Zg){if(N.tag===7){r(y,N.sibling),v=s(N,b.props.children),v.return=y,y=v;break e}}else if(N.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Ed&&jU(j)===N.type){r(y,N.sibling),v=s(N,b.props),v.ref=Ub(y,N,b),v.return=y,y=v;break e}r(y,N);break}else e(y,N);N=N.sibling}b.type===Zg?(v=Tm(b.props.children,y.mode,w,b.key),v.return=y,y=v):(w=pA(b.type,b.key,b.props,null,y.mode,w),w.ref=Ub(y,v,b),w.return=y,y=w)}return o(y);case Qg:e:{for(N=b.key;v!==null;){if(v.key===N)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){r(y,v.sibling),v=s(v,b.children||[]),v.return=y,y=v;break e}else{r(y,v);break}else e(y,v);v=v.sibling}v=MP(b,y.mode,w),v.return=y,y=v}return o(y);case Ed:return N=b._init,x(y,v,N(b._payload),w)}if(b0(b))return g(y,v,b,w);if(Db(b))return m(y,v,b,w);KS(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,v!==null&&v.tag===6?(r(y,v.sibling),v=s(v,b),v.return=y,y=v):(r(y,v),v=RP(b,y.mode,w),v.return=y,y=v),o(y)):r(y,v)}return x}var mv=aZ(!0),oZ=aZ(!1),SE=uf(null),NE=null,ay=null,cF=null;function uF(){cF=ay=NE=null}function dF(t){var e=SE.current;Vr(SE),t._currentValue=e}function VM(t,e,r){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===r)break;t=t.return}}function Ay(t,e){NE=t,cF=ay=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ui=!0),t.firstContext=null)}function bo(t){var e=t._currentValue;if(cF!==t)if(t={context:t,memoizedValue:e,next:null},ay===null){if(NE===null)throw Error(He(308));ay=t,NE.dependencies={lanes:0,firstContext:t}}else ay=ay.next=t;return e}var sp=null;function hF(t){sp===null?sp=[t]:sp.push(t)}function lZ(t,e,r,n){var s=e.interleaved;return s===null?(r.next=r,hF(e)):(r.next=s.next,s.next=r),e.interleaved=r,qu(t,n)}function qu(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var Cd=!1;function fF(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function cZ(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Lu(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Uh(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,tr&2){var s=n.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),n.pending=e,qu(t,r)}return s=n.interleaved,s===null?(e.next=e,hF(n)):(e.next=s.next,s.next=e),n.interleaved=e,qu(t,r)}function lA(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Z3(t,r)}}function SU(t,e){var r=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?s=i=o:i=i.next=o,r=r.next}while(r!==null);i===null?s=i=e:i=i.next=e}else s=i=e;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,effects:n.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function AE(t,e,r,n){var s=t.updateQueue;Cd=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=t.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var h=s.baseState;o=0,d=u=c=null,l=i;do{var f=l.lane,p=l.eventTime;if((n&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=t,m=l;switch(f=e,p=r,m.tag){case 1:if(g=m.payload,typeof g=="function"){h=g.call(p,h,f);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,f=typeof g=="function"?g.call(p,h,f):g,f==null)break e;h=an({},h,f);break e;case 2:Cd=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=h):d=d.next=p,o|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(c=h),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);Um|=o,t.lanes=o,t.memoizedState=h}}function NU(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],s=n.callback;if(s!==null){if(n.callback=null,n=r,typeof s!="function")throw Error(He(191,s));s.call(n)}}}var kj={},uc=uf(kj),Fw=uf(kj),$w=uf(kj);function ip(t){if(t===kj)throw Error(He(174));return t}function pF(t,e){switch(Or($w,e),Or(Fw,t),Or(uc,kj),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:NM(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=NM(e,t)}Vr(uc),Or(uc,e)}function gv(){Vr(uc),Vr(Fw),Vr($w)}function uZ(t){ip($w.current);var e=ip(uc.current),r=NM(e,t.type);e!==r&&(Or(Fw,t),Or(uc,r))}function mF(t){Fw.current===t&&(Vr(uc),Vr(Fw))}var rn=uf(0);function EE(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var CP=[];function gF(){for(var t=0;t<CP.length;t++)CP[t]._workInProgressVersionPrimary=null;CP.length=0}var cA=ad.ReactCurrentDispatcher,kP=ad.ReactCurrentBatchConfig,Bm=0,sn=null,Kn=null,fs=null,CE=!1,aw=!1,Bw=0,Nye=0;function Bs(){throw Error(He(321))}function yF(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!ul(t[r],e[r]))return!1;return!0}function xF(t,e,r,n,s,i){if(Bm=i,sn=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,cA.current=t===null||t.memoizedState===null?kye:Tye,t=r(n,s),aw){i=0;do{if(aw=!1,Bw=0,25<=i)throw Error(He(301));i+=1,fs=Kn=null,e.updateQueue=null,cA.current=Pye,t=r(n,s)}while(aw)}if(cA.current=kE,e=Kn!==null&&Kn.next!==null,Bm=0,fs=Kn=sn=null,CE=!1,e)throw Error(He(300));return t}function vF(){var t=Bw!==0;return Bw=0,t}function kl(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fs===null?sn.memoizedState=fs=t:fs=fs.next=t,fs}function wo(){if(Kn===null){var t=sn.alternate;t=t!==null?t.memoizedState:null}else t=Kn.next;var e=fs===null?sn.memoizedState:fs.next;if(e!==null)fs=e,Kn=t;else{if(t===null)throw Error(He(310));Kn=t,t={memoizedState:Kn.memoizedState,baseState:Kn.baseState,baseQueue:Kn.baseQueue,queue:Kn.queue,next:null},fs===null?sn.memoizedState=fs=t:fs=fs.next=t}return fs}function Uw(t,e){return typeof e=="function"?e(t):e}function TP(t){var e=wo(),r=e.queue;if(r===null)throw Error(He(311));r.lastRenderedReducer=t;var n=Kn,s=n.baseQueue,i=r.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}n.baseQueue=s=i,r.pending=null}if(s!==null){i=s.next,n=n.baseState;var l=o=null,c=null,u=i;do{var d=u.lane;if((Bm&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:t(n,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=h,o=n):c=c.next=h,sn.lanes|=d,Um|=d}u=u.next}while(u!==null&&u!==i);c===null?o=n:c.next=l,ul(n,e.memoizedState)||(Ui=!0),e.memoizedState=n,e.baseState=o,e.baseQueue=c,r.lastRenderedState=n}if(t=r.interleaved,t!==null){s=t;do i=s.lane,sn.lanes|=i,Um|=i,s=s.next;while(s!==t)}else s===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function PP(t){var e=wo(),r=e.queue;if(r===null)throw Error(He(311));r.lastRenderedReducer=t;var n=r.dispatch,s=r.pending,i=e.memoizedState;if(s!==null){r.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);ul(i,e.memoizedState)||(Ui=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function dZ(){}function hZ(t,e){var r=sn,n=wo(),s=e(),i=!ul(n.memoizedState,s);if(i&&(n.memoizedState=s,Ui=!0),n=n.queue,bF(mZ.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||fs!==null&&fs.memoizedState.tag&1){if(r.flags|=2048,zw(9,pZ.bind(null,r,n,s,e),void 0,null),ps===null)throw Error(He(349));Bm&30||fZ(r,e,s)}return s}function fZ(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=sn.updateQueue,e===null?(e={lastEffect:null,stores:null},sn.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function pZ(t,e,r,n){e.value=r,e.getSnapshot=n,gZ(e)&&yZ(t)}function mZ(t,e,r){return r(function(){gZ(e)&&yZ(t)})}function gZ(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!ul(t,r)}catch{return!0}}function yZ(t){var e=qu(t,1);e!==null&&ol(e,t,1,-1)}function AU(t){var e=kl();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Uw,lastRenderedState:t},e.queue=t,t=t.dispatch=Cye.bind(null,sn,t),[e.memoizedState,t]}function zw(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=sn.updateQueue,e===null?(e={lastEffect:null,stores:null},sn.updateQueue=e,e.lastEffect=t.next=t):(r=e.lastEffect,r===null?e.lastEffect=t.next=t:(n=r.next,r.next=t,t.next=n,e.lastEffect=t)),t}function xZ(){return wo().memoizedState}function uA(t,e,r,n){var s=kl();sn.flags|=t,s.memoizedState=zw(1|e,r,void 0,n===void 0?null:n)}function Gk(t,e,r,n){var s=wo();n=n===void 0?null:n;var i=void 0;if(Kn!==null){var o=Kn.memoizedState;if(i=o.destroy,n!==null&&yF(n,o.deps)){s.memoizedState=zw(e,r,i,n);return}}sn.flags|=t,s.memoizedState=zw(1|e,r,i,n)}function EU(t,e){return uA(8390656,8,t,e)}function bF(t,e){return Gk(2048,8,t,e)}function vZ(t,e){return Gk(4,2,t,e)}function bZ(t,e){return Gk(4,4,t,e)}function wZ(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function _Z(t,e,r){return r=r!=null?r.concat([t]):null,Gk(4,4,wZ.bind(null,e,t),r)}function wF(){}function jZ(t,e){var r=wo();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&yF(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function SZ(t,e){var r=wo();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&yF(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function NZ(t,e,r){return Bm&21?(ul(r,e)||(r=TQ(),sn.lanes|=r,Um|=r,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Ui=!0),t.memoizedState=r)}function Aye(t,e){var r=mr;mr=r!==0&&4>r?r:4,t(!0);var n=kP.transition;kP.transition={};try{t(!1),e()}finally{mr=r,kP.transition=n}}function AZ(){return wo().memoizedState}function Eye(t,e,r){var n=Hh(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},EZ(t))CZ(e,r);else if(r=lZ(t,e,r,n),r!==null){var s=wi();ol(r,t,n,s),kZ(r,e,n)}}function Cye(t,e,r){var n=Hh(t),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(EZ(t))CZ(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,l=i(o,r);if(s.hasEagerState=!0,s.eagerState=l,ul(l,o)){var c=e.interleaved;c===null?(s.next=s,hF(e)):(s.next=c.next,c.next=s),e.interleaved=s;return}}catch{}finally{}r=lZ(t,e,s,n),r!==null&&(s=wi(),ol(r,t,n,s),kZ(r,e,n))}}function EZ(t){var e=t.alternate;return t===sn||e!==null&&e===sn}function CZ(t,e){aw=CE=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function kZ(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Z3(t,r)}}var kE={readContext:bo,useCallback:Bs,useContext:Bs,useEffect:Bs,useImperativeHandle:Bs,useInsertionEffect:Bs,useLayoutEffect:Bs,useMemo:Bs,useReducer:Bs,useRef:Bs,useState:Bs,useDebugValue:Bs,useDeferredValue:Bs,useTransition:Bs,useMutableSource:Bs,useSyncExternalStore:Bs,useId:Bs,unstable_isNewReconciler:!1},kye={readContext:bo,useCallback:function(t,e){return kl().memoizedState=[t,e===void 0?null:e],t},useContext:bo,useEffect:EU,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,uA(4194308,4,wZ.bind(null,e,t),r)},useLayoutEffect:function(t,e){return uA(4194308,4,t,e)},useInsertionEffect:function(t,e){return uA(4,2,t,e)},useMemo:function(t,e){var r=kl();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=kl();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=Eye.bind(null,sn,t),[n.memoizedState,t]},useRef:function(t){var e=kl();return t={current:t},e.memoizedState=t},useState:AU,useDebugValue:wF,useDeferredValue:function(t){return kl().memoizedState=t},useTransition:function(){var t=AU(!1),e=t[0];return t=Aye.bind(null,t[1]),kl().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=sn,s=kl();if(Qr){if(r===void 0)throw Error(He(407));r=r()}else{if(r=e(),ps===null)throw Error(He(349));Bm&30||fZ(n,e,r)}s.memoizedState=r;var i={value:r,getSnapshot:e};return s.queue=i,EU(mZ.bind(null,n,i,t),[t]),n.flags|=2048,zw(9,pZ.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=kl(),e=ps.identifierPrefix;if(Qr){var r=Iu,n=Ou;r=(n&~(1<<32-al(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Bw++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=Nye++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Tye={readContext:bo,useCallback:jZ,useContext:bo,useEffect:bF,useImperativeHandle:_Z,useInsertionEffect:vZ,useLayoutEffect:bZ,useMemo:SZ,useReducer:TP,useRef:xZ,useState:function(){return TP(Uw)},useDebugValue:wF,useDeferredValue:function(t){var e=wo();return NZ(e,Kn.memoizedState,t)},useTransition:function(){var t=TP(Uw)[0],e=wo().memoizedState;return[t,e]},useMutableSource:dZ,useSyncExternalStore:hZ,useId:AZ,unstable_isNewReconciler:!1},Pye={readContext:bo,useCallback:jZ,useContext:bo,useEffect:bF,useImperativeHandle:_Z,useInsertionEffect:vZ,useLayoutEffect:bZ,useMemo:SZ,useReducer:PP,useRef:xZ,useState:function(){return PP(Uw)},useDebugValue:wF,useDeferredValue:function(t){var e=wo();return Kn===null?e.memoizedState=t:NZ(e,Kn.memoizedState,t)},useTransition:function(){var t=PP(Uw)[0],e=wo().memoizedState;return[t,e]},useMutableSource:dZ,useSyncExternalStore:hZ,useId:AZ,unstable_isNewReconciler:!1};function Lo(t,e){if(t&&t.defaultProps){e=an({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}function qM(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:an({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var Kk={isMounted:function(t){return(t=t._reactInternals)?ag(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=wi(),s=Hh(t),i=Lu(n,s);i.payload=e,r!=null&&(i.callback=r),e=Uh(t,i,s),e!==null&&(ol(e,t,s,n),lA(e,t,s))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=wi(),s=Hh(t),i=Lu(n,s);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=Uh(t,i,s),e!==null&&(ol(e,t,s,n),lA(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=wi(),n=Hh(t),s=Lu(r,n);s.tag=2,e!=null&&(s.callback=e),e=Uh(t,s,n),e!==null&&(ol(e,t,n,r),lA(e,t,n))}};function CU(t,e,r,n,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,i,o):e.prototype&&e.prototype.isPureReactComponent?!Rw(r,n)||!Rw(s,i):!0}function TZ(t,e,r){var n=!1,s=Xh,i=e.contextType;return typeof i=="object"&&i!==null?i=bo(i):(s=Gi(e)?Fm:Zs.current,n=e.contextTypes,i=(n=n!=null)?fv(t,s):Xh),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Kk,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function kU(t,e,r,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(r,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(r,n),e.state!==t&&Kk.enqueueReplaceState(e,e.state,null)}function GM(t,e,r,n){var s=t.stateNode;s.props=r,s.state=t.memoizedState,s.refs={},fF(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=bo(i):(i=Gi(e)?Fm:Zs.current,s.context=fv(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(qM(t,e,i,r),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&Kk.enqueueReplaceState(s,s.state,null),AE(t,r,s,n),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function yv(t,e){try{var r="",n=e;do r+=ige(n),n=n.return;while(n);var s=r}catch(i){s=`
Error generating stack: `+i.message+`
`+i.stack}return{value:t,source:e,stack:s,digest:null}}function OP(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function KM(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var Oye=typeof WeakMap=="function"?WeakMap:Map;function PZ(t,e,r){r=Lu(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){PE||(PE=!0,sD=n),KM(t,e)},r}function OZ(t,e,r){r=Lu(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var s=e.value;r.payload=function(){return n(s)},r.callback=function(){KM(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){KM(t,e),typeof n!="function"&&(zh===null?zh=new Set([this]):zh.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),r}function TU(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new Oye;var s=new Set;n.set(e,s)}else s=n.get(e),s===void 0&&(s=new Set,n.set(e,s));s.has(r)||(s.add(r),t=qye.bind(null,t,e,r),e.then(t,t))}function PU(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function OU(t,e,r,n,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=Lu(-1,1),e.tag=2,Uh(r,e,1))),r.lanes|=1),t)}var Iye=ad.ReactCurrentOwner,Ui=!1;function gi(t,e,r,n){e.child=t===null?oZ(e,null,r,n):mv(e,t.child,r,n)}function IU(t,e,r,n,s){r=r.render;var i=e.ref;return Ay(e,s),n=xF(t,e,r,n,i,s),r=vF(),t!==null&&!Ui?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Gu(t,e,s)):(Qr&&r&&aF(e),e.flags|=1,gi(t,e,n,s),e.child)}function RU(t,e,r,n,s){if(t===null){var i=r.type;return typeof i=="function"&&!kF(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,IZ(t,e,i,n,s)):(t=pA(r.type,null,n,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(r=r.compare,r=r!==null?r:Rw,r(o,n)&&t.ref===e.ref)return Gu(t,e,s)}return e.flags|=1,t=Wh(i,n),t.ref=e.ref,t.return=e,e.child=t}function IZ(t,e,r,n,s){if(t!==null){var i=t.memoizedProps;if(Rw(i,n)&&t.ref===e.ref)if(Ui=!1,e.pendingProps=n=i,(t.lanes&s)!==0)t.flags&131072&&(Ui=!0);else return e.lanes=t.lanes,Gu(t,e,s)}return YM(t,e,r,n,s)}function RZ(t,e,r){var n=e.pendingProps,s=n.children,i=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Or(ly,ja),ja|=r;else{if(!(r&1073741824))return t=i!==null?i.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Or(ly,ja),ja|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,Or(ly,ja),ja|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,Or(ly,ja),ja|=n;return gi(t,e,s,r),e.child}function MZ(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function YM(t,e,r,n,s){var i=Gi(r)?Fm:Zs.current;return i=fv(e,i),Ay(e,s),r=xF(t,e,r,n,i,s),n=vF(),t!==null&&!Ui?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Gu(t,e,s)):(Qr&&n&&aF(e),e.flags|=1,gi(t,e,r,s),e.child)}function MU(t,e,r,n,s){if(Gi(r)){var i=!0;wE(e)}else i=!1;if(Ay(e,s),e.stateNode===null)dA(t,e),TZ(e,r,n),GM(e,r,n,s),n=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var c=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=bo(u):(u=Gi(r)?Fm:Zs.current,u=fv(e,u));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||c!==u)&&kU(e,o,n,u),Cd=!1;var f=e.memoizedState;o.state=f,AE(e,n,o,s),c=e.memoizedState,l!==n||f!==c||qi.current||Cd?(typeof d=="function"&&(qM(e,r,d,n),c=e.memoizedState),(l=Cd||CU(e,r,l,n,f,c,u))?(h||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"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=c),o.props=n,o.state=c,o.context=u,n=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{o=e.stateNode,cZ(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:Lo(e.type,l),o.props=u,h=e.pendingProps,f=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=bo(c):(c=Gi(r)?Fm:Zs.current,c=fv(e,c));var p=r.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||f!==c)&&kU(e,o,n,c),Cd=!1,f=e.memoizedState,o.state=f,AE(e,n,o,s);var g=e.memoizedState;l!==h||f!==g||qi.current||Cd?(typeof p=="function"&&(qM(e,r,p,n),g=e.memoizedState),(u=Cd||CU(e,r,u,n,f,g,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,g,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,g,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=g),o.props=n,o.state=g,o.context=c,n=u):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),n=!1)}return XM(t,e,r,n,i,s)}function XM(t,e,r,n,s,i){MZ(t,e);var o=(e.flags&128)!==0;if(!n&&!o)return s&&bU(e,r,!1),Gu(t,e,i);n=e.stateNode,Iye.current=e;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&o?(e.child=mv(e,t.child,null,i),e.child=mv(e,null,l,i)):gi(t,e,l,i),e.memoizedState=n.state,s&&bU(e,r,!0),e.child}function DZ(t){var e=t.stateNode;e.pendingContext?vU(t,e.pendingContext,e.pendingContext!==e.context):e.context&&vU(t,e.context,!1),pF(t,e.containerInfo)}function DU(t,e,r,n,s){return pv(),lF(s),e.flags|=256,gi(t,e,r,n),e.child}var QM={dehydrated:null,treeContext:null,retryLane:0};function ZM(t){return{baseLanes:t,cachePool:null,transitions:null}}function LZ(t,e,r){var n=e.pendingProps,s=rn.current,i=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(s&2)!==0),l?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),Or(rn,s&1),t===null)return WM(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=n.children,t=n.fallback,i?(n=e.mode,i=e.child,o={mode:"hidden",children:o},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Qk(o,n,0,null),t=Tm(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=ZM(r),e.memoizedState=QM,t):_F(e,o));if(s=t.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return Rye(t,e,o,n,l,s,r);if(i){i=n.fallback,o=e.mode,s=t.child,l=s.sibling;var c={mode:"hidden",children:n.children};return!(o&1)&&e.child!==s?(n=e.child,n.childLanes=0,n.pendingProps=c,e.deletions=null):(n=Wh(s,c),n.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Wh(l,i):(i=Tm(i,o,r,null),i.flags|=2),i.return=e,n.return=e,n.sibling=i,e.child=n,n=i,i=e.child,o=t.child.memoizedState,o=o===null?ZM(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~r,e.memoizedState=QM,n}return i=t.child,t=i.sibling,n=Wh(i,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function _F(t,e){return e=Qk({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function YS(t,e,r,n){return n!==null&&lF(n),mv(e,t.child,null,r),t=_F(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Rye(t,e,r,n,s,i,o){if(r)return e.flags&256?(e.flags&=-257,n=OP(Error(He(422))),YS(t,e,o,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,s=e.mode,n=Qk({mode:"visible",children:n.children},s,0,null),i=Tm(i,s,o,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,e.mode&1&&mv(e,t.child,null,o),e.child.memoizedState=ZM(o),e.memoizedState=QM,i);if(!(e.mode&1))return YS(t,e,o,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var l=n.dgst;return n=l,i=Error(He(419)),n=OP(i,n,void 0),YS(t,e,o,n)}if(l=(o&t.childLanes)!==0,Ui||l){if(n=ps,n!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(n.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,qu(t,s),ol(n,t,s,-1))}return CF(),n=OP(Error(He(421))),YS(t,e,o,n)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=Gye.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,ka=Bh(s.nextSibling),Pa=e,Qr=!0,Jo=null,t!==null&&(so[io++]=Ou,so[io++]=Iu,so[io++]=$m,Ou=t.id,Iu=t.overflow,$m=e),e=_F(e,n.children),e.flags|=4096,e)}function LU(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),VM(t.return,e,r)}function IP(t,e,r,n,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=s)}function FZ(t,e,r){var n=e.pendingProps,s=n.revealOrder,i=n.tail;if(gi(t,e,n.children,r),n=rn.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&LU(t,r,e);else if(t.tag===19)LU(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(Or(rn,n),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(r=e.child,s=null;r!==null;)t=r.alternate,t!==null&&EE(t)===null&&(s=r),r=r.sibling;r=s,r===null?(s=e.child,e.child=null):(s=r.sibling,r.sibling=null),IP(e,!1,s,r,i);break;case"backwards":for(r=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&EE(t)===null){e.child=s;break}t=s.sibling,s.sibling=r,r=s,s=t}IP(e,!0,r,null,i);break;case"together":IP(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function dA(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Gu(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),Um|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(He(153));if(e.child!==null){for(t=e.child,r=Wh(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=Wh(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function Mye(t,e,r){switch(e.tag){case 3:DZ(e),pv();break;case 5:uZ(e);break;case 1:Gi(e.type)&&wE(e);break;case 4:pF(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,s=e.memoizedProps.value;Or(SE,n._currentValue),n._currentValue=s;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(Or(rn,rn.current&1),e.flags|=128,null):r&e.child.childLanes?LZ(t,e,r):(Or(rn,rn.current&1),t=Gu(t,e,r),t!==null?t.sibling:null);Or(rn,rn.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return FZ(t,e,r);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Or(rn,rn.current),n)break;return null;case 22:case 23:return e.lanes=0,RZ(t,e,r)}return Gu(t,e,r)}var $Z,JM,BZ,UZ;$Z=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};JM=function(){};BZ=function(t,e,r,n){var s=t.memoizedProps;if(s!==n){t=e.stateNode,ip(uc.current);var i=null;switch(r){case"input":s=wM(t,s),n=wM(t,n),i=[];break;case"select":s=an({},s,{value:void 0}),n=an({},n,{value:void 0}),i=[];break;case"textarea":s=SM(t,s),n=SM(t,n),i=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=vE)}AM(r,n);var o;r=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ew.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var c=n[u];if(l=s!=null?s[u]:void 0,n.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(r||(r={}),r[o]=c[o])}else r||(i||(i=[]),i.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ew.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Br("scroll",t),i||l===c||(i=[])):(i=i||[]).push(u,c))}r&&(i=i||[]).push("style",r);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};UZ=function(t,e,r,n){r!==n&&(e.flags|=4)};function zb(t,e){if(!Qr)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function Us(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var s=t.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function Dye(t,e,r){var n=e.pendingProps;switch(oF(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Us(e),null;case 1:return Gi(e.type)&&bE(),Us(e),null;case 3:return n=e.stateNode,gv(),Vr(qi),Vr(Zs),gF(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(GS(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Jo!==null&&(oD(Jo),Jo=null))),JM(t,e),Us(e),null;case 5:mF(e);var s=ip($w.current);if(r=e.type,t!==null&&e.stateNode!=null)BZ(t,e,r,n,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(He(166));return Us(e),null}if(t=ip(uc.current),GS(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[rc]=e,n[Lw]=i,t=(e.mode&1)!==0,r){case"dialog":Br("cancel",n),Br("close",n);break;case"iframe":case"object":case"embed":Br("load",n);break;case"video":case"audio":for(s=0;s<_0.length;s++)Br(_0[s],n);break;case"source":Br("error",n);break;case"img":case"image":case"link":Br("error",n),Br("load",n);break;case"details":Br("toggle",n);break;case"input":qB(n,i),Br("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},Br("invalid",n);break;case"textarea":KB(n,i),Br("invalid",n)}AM(r,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?n.textContent!==l&&(i.suppressHydrationWarning!==!0&&qS(n.textContent,l,t),s=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&qS(n.textContent,l,t),s=["children",""+l]):Ew.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Br("scroll",n)}switch(r){case"input":FS(n),GB(n,i,!0);break;case"textarea":FS(n),YB(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=vE)}n=s,e.updateQueue=n,n!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=mQ(r)),t==="http://www.w3.org/1999/xhtml"?r==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=o.createElement(r,{is:n.is}):(t=o.createElement(r),r==="select"&&(o=t,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):t=o.createElementNS(t,r),t[rc]=e,t[Lw]=n,$Z(t,e,!1,!1),e.stateNode=t;e:{switch(o=EM(r,n),r){case"dialog":Br("cancel",t),Br("close",t),s=n;break;case"iframe":case"object":case"embed":Br("load",t),s=n;break;case"video":case"audio":for(s=0;s<_0.length;s++)Br(_0[s],t);s=n;break;case"source":Br("error",t),s=n;break;case"img":case"image":case"link":Br("error",t),Br("load",t),s=n;break;case"details":Br("toggle",t),s=n;break;case"input":qB(t,n),s=wM(t,n),Br("invalid",t);break;case"option":s=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},s=an({},n,{value:void 0}),Br("invalid",t);break;case"textarea":KB(t,n),s=SM(t,n),Br("invalid",t);break;default:s=n}AM(r,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?xQ(t,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&gQ(t,c)):i==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&Cw(t,c):typeof c=="number"&&Cw(t,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ew.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Br("scroll",t):c!=null&&q3(t,i,c,o))}switch(r){case"input":FS(t),GB(t,n,!1);break;case"textarea":FS(t),YB(t);break;case"option":n.value!=null&&t.setAttribute("value",""+Yh(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?_y(t,!!n.multiple,i,!1):n.defaultValue!=null&&_y(t,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=vE)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Us(e),null;case 6:if(t&&e.stateNode!=null)UZ(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(He(166));if(r=ip($w.current),ip(uc.current),GS(e)){if(n=e.stateNode,r=e.memoizedProps,n[rc]=e,(i=n.nodeValue!==r)&&(t=Pa,t!==null))switch(t.tag){case 3:qS(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&qS(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[rc]=e,e.stateNode=n}return Us(e),null;case 13:if(Vr(rn),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Qr&&ka!==null&&e.mode&1&&!(e.flags&128))iZ(),pv(),e.flags|=98560,i=!1;else if(i=GS(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(He(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(He(317));i[rc]=e}else pv(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Us(e),i=!1}else Jo!==null&&(oD(Jo),Jo=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=r,e):(n=n!==null,n!==(t!==null&&t.memoizedState!==null)&&n&&(e.child.flags|=8192,e.mode&1&&(t===null||rn.current&1?Xn===0&&(Xn=3):CF())),e.updateQueue!==null&&(e.flags|=4),Us(e),null);case 4:return gv(),JM(t,e),t===null&&Mw(e.stateNode.containerInfo),Us(e),null;case 10:return dF(e.type._context),Us(e),null;case 17:return Gi(e.type)&&bE(),Us(e),null;case 19:if(Vr(rn),i=e.memoizedState,i===null)return Us(e),null;if(n=(e.flags&128)!==0,o=i.rendering,o===null)if(n)zb(i,!1);else{if(Xn!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=EE(t),o!==null){for(e.flags|=128,zb(i,!1),n=o.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),e.subtreeFlags=0,n=r,r=e.child;r!==null;)i=r,t=n,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),r=r.sibling;return Or(rn,rn.current&1|2),e.child}t=t.sibling}i.tail!==null&&Nn()>xv&&(e.flags|=128,n=!0,zb(i,!1),e.lanes=4194304)}else{if(!n)if(t=EE(o),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),zb(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Qr)return Us(e),null}else 2*Nn()-i.renderingStartTime>xv&&r!==1073741824&&(e.flags|=128,n=!0,zb(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(r=i.last,r!==null?r.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Nn(),e.sibling=null,r=rn.current,Or(rn,n?r&1|2:r&1),e):(Us(e),null);case 22:case 23:return EF(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?ja&1073741824&&(Us(e),e.subtreeFlags&6&&(e.flags|=8192)):Us(e),null;case 24:return null;case 25:return null}throw Error(He(156,e.tag))}function Lye(t,e){switch(oF(e),e.tag){case 1:return Gi(e.type)&&bE(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return gv(),Vr(qi),Vr(Zs),gF(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return mF(e),null;case 13:if(Vr(rn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(He(340));pv()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Vr(rn),null;case 4:return gv(),null;case 10:return dF(e.type._context),null;case 22:case 23:return EF(),null;case 24:return null;default:return null}}var XS=!1,Ys=!1,Fye=typeof WeakSet=="function"?WeakSet:Set,ct=null;function oy(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){fn(t,e,n)}else r.current=null}function eD(t,e,r){try{r()}catch(n){fn(t,e,n)}}var FU=!1;function $ye(t,e){if(LM=gE,t=qQ(),iF(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var o=0,l=-1,c=-1,u=0,d=0,h=t,f=null;t:for(;;){for(var p;h!==r||s!==0&&h.nodeType!==3||(l=o+s),h!==i||n!==0&&h.nodeType!==3||(c=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===t)break t;if(f===r&&++u===s&&(l=o),f===i&&++d===n&&(c=o),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(FM={focusedElem:t,selectionRange:r},gE=!1,ct=e;ct!==null;)if(e=ct,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ct=t;else for(;ct!==null;){e=ct;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,x=g.memoizedState,y=e.stateNode,v=y.getSnapshotBeforeUpdate(e.elementType===e.type?m:Lo(e.type,m),x);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=e.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(He(163))}}catch(w){fn(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,ct=t;break}ct=e.return}return g=FU,FU=!1,g}function ow(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&eD(e,r,i)}s=s.next}while(s!==n)}}function Yk(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function tD(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function zZ(t){var e=t.alternate;e!==null&&(t.alternate=null,zZ(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[rc],delete e[Lw],delete e[UM],delete e[wye],delete e[_ye])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function HZ(t){return t.tag===5||t.tag===3||t.tag===4}function $U(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||HZ(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function rD(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=vE));else if(n!==4&&(t=t.child,t!==null))for(rD(t,e,r),t=t.sibling;t!==null;)rD(t,e,r),t=t.sibling}function nD(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(nD(t,e,r),t=t.sibling;t!==null;)nD(t,e,r),t=t.sibling}var js=null,Qo=!1;function pd(t,e,r){for(r=r.child;r!==null;)WZ(t,e,r),r=r.sibling}function WZ(t,e,r){if(cc&&typeof cc.onCommitFiberUnmount=="function")try{cc.onCommitFiberUnmount(Uk,r)}catch{}switch(r.tag){case 5:Ys||oy(r,e);case 6:var n=js,s=Qo;js=null,pd(t,e,r),js=n,Qo=s,js!==null&&(Qo?(t=js,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):js.removeChild(r.stateNode));break;case 18:js!==null&&(Qo?(t=js,r=r.stateNode,t.nodeType===8?AP(t.parentNode,r):t.nodeType===1&&AP(t,r),Ow(t)):AP(js,r.stateNode));break;case 4:n=js,s=Qo,js=r.stateNode.containerInfo,Qo=!0,pd(t,e,r),js=n,Qo=s;break;case 0:case 11:case 14:case 15:if(!Ys&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&eD(r,e,o),s=s.next}while(s!==n)}pd(t,e,r);break;case 1:if(!Ys&&(oy(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){fn(r,e,l)}pd(t,e,r);break;case 21:pd(t,e,r);break;case 22:r.mode&1?(Ys=(n=Ys)||r.memoizedState!==null,pd(t,e,r),Ys=n):pd(t,e,r);break;default:pd(t,e,r)}}function BU(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new Fye),e.forEach(function(n){var s=Kye.bind(null,t,n);r.has(n)||(r.add(n),n.then(s,s))})}}function Co(t,e){var r=e.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var i=t,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:js=l.stateNode,Qo=!1;break e;case 3:js=l.stateNode.containerInfo,Qo=!0;break e;case 4:js=l.stateNode.containerInfo,Qo=!0;break e}l=l.return}if(js===null)throw Error(He(160));WZ(i,o,s),js=null,Qo=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){fn(s,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)VZ(e,t),e=e.sibling}function VZ(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Co(e,t),Sl(t),n&4){try{ow(3,t,t.return),Yk(3,t)}catch(m){fn(t,t.return,m)}try{ow(5,t,t.return)}catch(m){fn(t,t.return,m)}}break;case 1:Co(e,t),Sl(t),n&512&&r!==null&&oy(r,r.return);break;case 5:if(Co(e,t),Sl(t),n&512&&r!==null&&oy(r,r.return),t.flags&32){var s=t.stateNode;try{Cw(s,"")}catch(m){fn(t,t.return,m)}}if(n&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=r!==null?r.memoizedProps:i,l=t.type,c=t.updateQueue;if(t.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&fQ(s,i),EM(l,o);var u=EM(l,i);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?xQ(s,h):d==="dangerouslySetInnerHTML"?gQ(s,h):d==="children"?Cw(s,h):q3(s,d,h,u)}switch(l){case"input":_M(s,i);break;case"textarea":pQ(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?_y(s,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?_y(s,!!i.multiple,i.defaultValue,!0):_y(s,!!i.multiple,i.multiple?[]:"",!1))}s[Lw]=i}catch(m){fn(t,t.return,m)}}break;case 6:if(Co(e,t),Sl(t),n&4){if(t.stateNode===null)throw Error(He(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(m){fn(t,t.return,m)}}break;case 3:if(Co(e,t),Sl(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Ow(e.containerInfo)}catch(m){fn(t,t.return,m)}break;case 4:Co(e,t),Sl(t);break;case 13:Co(e,t),Sl(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(NF=Nn())),n&4&&BU(t);break;case 22:if(d=r!==null&&r.memoizedState!==null,t.mode&1?(Ys=(u=Ys)||d,Co(e,t),Ys=u):Co(e,t),Sl(t),n&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!d&&t.mode&1)for(ct=t,d=t.child;d!==null;){for(h=ct=d;ct!==null;){switch(f=ct,p=f.child,f.tag){case 0:case 11:case 14:case 15:ow(4,f,f.return);break;case 1:oy(f,f.return);var g=f.stateNode;if(typeof g.componentWillUnmount=="function"){n=f,r=f.return;try{e=n,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(m){fn(n,r,m)}}break;case 5:oy(f,f.return);break;case 22:if(f.memoizedState!==null){zU(h);continue}}p!==null?(p.return=f,ct=p):zU(h)}d=d.sibling}e:for(d=null,h=t;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=yQ("display",o))}catch(m){fn(t,t.return,m)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(m){fn(t,t.return,m)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Co(e,t),Sl(t),n&4&&BU(t);break;case 21:break;default:Co(e,t),Sl(t)}}function Sl(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(HZ(r)){var n=r;break e}r=r.return}throw Error(He(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(Cw(s,""),n.flags&=-33);var i=$U(t);nD(t,i,s);break;case 3:case 4:var o=n.stateNode.containerInfo,l=$U(t);rD(t,l,o);break;default:throw Error(He(161))}}catch(c){fn(t,t.return,c)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Bye(t,e,r){ct=t,qZ(t)}function qZ(t,e,r){for(var n=(t.mode&1)!==0;ct!==null;){var s=ct,i=s.child;if(s.tag===22&&n){var o=s.memoizedState!==null||XS;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Ys;l=XS;var u=Ys;if(XS=o,(Ys=c)&&!u)for(ct=s;ct!==null;)o=ct,c=o.child,o.tag===22&&o.memoizedState!==null?HU(s):c!==null?(c.return=o,ct=c):HU(s);for(;i!==null;)ct=i,qZ(i),i=i.sibling;ct=s,XS=l,Ys=u}UU(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,ct=i):UU(t)}}function UU(t){for(;ct!==null;){var e=ct;if(e.flags&8772){var r=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Ys||Yk(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!Ys)if(r===null)n.componentDidMount();else{var s=e.elementType===e.type?r.memoizedProps:Lo(e.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&NU(e,i,n);break;case 3:var o=e.updateQueue;if(o!==null){if(r=null,e.child!==null)switch(e.child.tag){case 5:r=e.child.stateNode;break;case 1:r=e.child.stateNode}NU(e,o,r)}break;case 5:var l=e.stateNode;if(r===null&&e.flags&4){r=l;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&Ow(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(He(163))}Ys||e.flags&512&&tD(e)}catch(f){fn(e,e.return,f)}}if(e===t){ct=null;break}if(r=e.sibling,r!==null){r.return=e.return,ct=r;break}ct=e.return}}function zU(t){for(;ct!==null;){var e=ct;if(e===t){ct=null;break}var r=e.sibling;if(r!==null){r.return=e.return,ct=r;break}ct=e.return}}function HU(t){for(;ct!==null;){var e=ct;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{Yk(4,e)}catch(c){fn(e,r,c)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var s=e.return;try{n.componentDidMount()}catch(c){fn(e,s,c)}}var i=e.return;try{tD(e)}catch(c){fn(e,i,c)}break;case 5:var o=e.return;try{tD(e)}catch(c){fn(e,o,c)}}}catch(c){fn(e,e.return,c)}if(e===t){ct=null;break}var l=e.sibling;if(l!==null){l.return=e.return,ct=l;break}ct=e.return}}var Uye=Math.ceil,TE=ad.ReactCurrentDispatcher,jF=ad.ReactCurrentOwner,po=ad.ReactCurrentBatchConfig,tr=0,ps=null,Dn=null,ks=0,ja=0,ly=uf(0),Xn=0,Hw=null,Um=0,Xk=0,SF=0,lw=null,$i=null,NF=0,xv=1/0,Hc=null,PE=!1,sD=null,zh=null,QS=!1,Mh=null,OE=0,cw=0,iD=null,hA=-1,fA=0;function wi(){return tr&6?Nn():hA!==-1?hA:hA=Nn()}function Hh(t){return t.mode&1?tr&2&&ks!==0?ks&-ks:Sye.transition!==null?(fA===0&&(fA=TQ()),fA):(t=mr,t!==0||(t=window.event,t=t===void 0?16:LQ(t.type)),t):1}function ol(t,e,r,n){if(50<cw)throw cw=0,iD=null,Error(He(185));Aj(t,r,n),(!(tr&2)||t!==ps)&&(t===ps&&(!(tr&2)&&(Xk|=r),Xn===4&&Pd(t,ks)),Ki(t,n),r===1&&tr===0&&!(e.mode&1)&&(xv=Nn()+500,qk&&df()))}function Ki(t,e){var r=t.callbackNode;Sge(t,e);var n=mE(t,t===ps?ks:0);if(n===0)r!==null&&ZB(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&ZB(r),e===1)t.tag===0?jye(WU.bind(null,t)):rZ(WU.bind(null,t)),vye(function(){!(tr&6)&&df()}),r=null;else{switch(PQ(n)){case 1:r=Q3;break;case 4:r=CQ;break;case 16:r=pE;break;case 536870912:r=kQ;break;default:r=pE}r=eJ(r,GZ.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function GZ(t,e){if(hA=-1,fA=0,tr&6)throw Error(He(327));var r=t.callbackNode;if(Ey()&&t.callbackNode!==r)return null;var n=mE(t,t===ps?ks:0);if(n===0)return null;if(n&30||n&t.expiredLanes||e)e=IE(t,n);else{e=n;var s=tr;tr|=2;var i=YZ();(ps!==t||ks!==e)&&(Hc=null,xv=Nn()+500,km(t,e));do try{Wye();break}catch(l){KZ(t,l)}while(!0);uF(),TE.current=i,tr=s,Dn!==null?e=0:(ps=null,ks=0,e=Xn)}if(e!==0){if(e===2&&(s=OM(t),s!==0&&(n=s,e=aD(t,s))),e===1)throw r=Hw,km(t,0),Pd(t,n),Ki(t,Nn()),r;if(e===6)Pd(t,n);else{if(s=t.current.alternate,!(n&30)&&!zye(s)&&(e=IE(t,n),e===2&&(i=OM(t),i!==0&&(n=i,e=aD(t,i))),e===1))throw r=Hw,km(t,0),Pd(t,n),Ki(t,Nn()),r;switch(t.finishedWork=s,t.finishedLanes=n,e){case 0:case 1:throw Error(He(345));case 2:Uf(t,$i,Hc);break;case 3:if(Pd(t,n),(n&130023424)===n&&(e=NF+500-Nn(),10<e)){if(mE(t,0)!==0)break;if(s=t.suspendedLanes,(s&n)!==n){wi(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=BM(Uf.bind(null,t,$i,Hc),e);break}Uf(t,$i,Hc);break;case 4:if(Pd(t,n),(n&4194240)===n)break;for(e=t.eventTimes,s=-1;0<n;){var o=31-al(n);i=1<<o,o=e[o],o>s&&(s=o),n&=~i}if(n=s,n=Nn()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Uye(n/1960))-n,10<n){t.timeoutHandle=BM(Uf.bind(null,t,$i,Hc),n);break}Uf(t,$i,Hc);break;case 5:Uf(t,$i,Hc);break;default:throw Error(He(329))}}}return Ki(t,Nn()),t.callbackNode===r?GZ.bind(null,t):null}function aD(t,e){var r=lw;return t.current.memoizedState.isDehydrated&&(km(t,e).flags|=256),t=IE(t,e),t!==2&&(e=$i,$i=r,e!==null&&oD(e)),t}function oD(t){$i===null?$i=t:$i.push.apply($i,t)}function zye(t){for(var e=t;;){if(e.flags&16384){var r=e.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var s=r[n],i=s.getSnapshot;s=s.value;try{if(!ul(i(),s))return!1}catch{return!1}}}if(r=e.child,e.subtreeFlags&16384&&r!==null)r.return=e,e=r;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Pd(t,e){for(e&=~SF,e&=~Xk,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-al(e),n=1<<r;t[r]=-1,e&=~n}}function WU(t){if(tr&6)throw Error(He(327));Ey();var e=mE(t,0);if(!(e&1))return Ki(t,Nn()),null;var r=IE(t,e);if(t.tag!==0&&r===2){var n=OM(t);n!==0&&(e=n,r=aD(t,n))}if(r===1)throw r=Hw,km(t,0),Pd(t,e),Ki(t,Nn()),r;if(r===6)throw Error(He(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Uf(t,$i,Hc),Ki(t,Nn()),null}function AF(t,e){var r=tr;tr|=1;try{return t(e)}finally{tr=r,tr===0&&(xv=Nn()+500,qk&&df())}}function zm(t){Mh!==null&&Mh.tag===0&&!(tr&6)&&Ey();var e=tr;tr|=1;var r=po.transition,n=mr;try{if(po.transition=null,mr=1,t)return t()}finally{mr=n,po.transition=r,tr=e,!(tr&6)&&df()}}function EF(){ja=ly.current,Vr(ly)}function km(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,xye(r)),Dn!==null)for(r=Dn.return;r!==null;){var n=r;switch(oF(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&bE();break;case 3:gv(),Vr(qi),Vr(Zs),gF();break;case 5:mF(n);break;case 4:gv();break;case 13:Vr(rn);break;case 19:Vr(rn);break;case 10:dF(n.type._context);break;case 22:case 23:EF()}r=r.return}if(ps=t,Dn=t=Wh(t.current,null),ks=ja=e,Xn=0,Hw=null,SF=Xk=Um=0,$i=lw=null,sp!==null){for(e=0;e<sp.length;e++)if(r=sp[e],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,i=r.pending;if(i!==null){var o=i.next;i.next=s,n.next=o}r.pending=n}sp=null}return t}function KZ(t,e){do{var r=Dn;try{if(uF(),cA.current=kE,CE){for(var n=sn.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}CE=!1}if(Bm=0,fs=Kn=sn=null,aw=!1,Bw=0,jF.current=null,r===null||r.return===null){Xn=1,Hw=e,Dn=null;break}e:{var i=t,o=r.return,l=r,c=e;if(e=ks,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=PU(o);if(p!==null){p.flags&=-257,OU(p,o,l,i,e),p.mode&1&&TU(i,u,e),e=p,c=u;var g=e.updateQueue;if(g===null){var m=new Set;m.add(c),e.updateQueue=m}else g.add(c);break e}else{if(!(e&1)){TU(i,u,e),CF();break e}c=Error(He(426))}}else if(Qr&&l.mode&1){var x=PU(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),OU(x,o,l,i,e),lF(yv(c,l));break e}}i=c=yv(c,l),Xn!==4&&(Xn=2),lw===null?lw=[i]:lw.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=PZ(i,c,e);SU(i,y);break e;case 1:l=c;var v=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(zh===null||!zh.has(b)))){i.flags|=65536,e&=-e,i.lanes|=e;var w=OZ(i,l,e);SU(i,w);break e}}i=i.return}while(i!==null)}QZ(r)}catch(j){e=j,Dn===r&&r!==null&&(Dn=r=r.return);continue}break}while(!0)}function YZ(){var t=TE.current;return TE.current=kE,t===null?kE:t}function CF(){(Xn===0||Xn===3||Xn===2)&&(Xn=4),ps===null||!(Um&268435455)&&!(Xk&268435455)||Pd(ps,ks)}function IE(t,e){var r=tr;tr|=2;var n=YZ();(ps!==t||ks!==e)&&(Hc=null,km(t,e));do try{Hye();break}catch(s){KZ(t,s)}while(!0);if(uF(),tr=r,TE.current=n,Dn!==null)throw Error(He(261));return ps=null,ks=0,Xn}function Hye(){for(;Dn!==null;)XZ(Dn)}function Wye(){for(;Dn!==null&&!mge();)XZ(Dn)}function XZ(t){var e=JZ(t.alternate,t,ja);t.memoizedProps=t.pendingProps,e===null?QZ(t):Dn=e,jF.current=null}function QZ(t){var e=t;do{var r=e.alternate;if(t=e.return,e.flags&32768){if(r=Lye(r,e),r!==null){r.flags&=32767,Dn=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Xn=6,Dn=null;return}}else if(r=Dye(r,e,ja),r!==null){Dn=r;return}if(e=e.sibling,e!==null){Dn=e;return}Dn=e=t}while(e!==null);Xn===0&&(Xn=5)}function Uf(t,e,r){var n=mr,s=po.transition;try{po.transition=null,mr=1,Vye(t,e,r,n)}finally{po.transition=s,mr=n}return null}function Vye(t,e,r,n){do Ey();while(Mh!==null);if(tr&6)throw Error(He(327));r=t.finishedWork;var s=t.finishedLanes;if(r===null)return null;if(t.finishedWork=null,t.finishedLanes=0,r===t.current)throw Error(He(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(Nge(t,i),t===ps&&(Dn=ps=null,ks=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||QS||(QS=!0,eJ(pE,function(){return Ey(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=po.transition,po.transition=null;var o=mr;mr=1;var l=tr;tr|=4,jF.current=null,$ye(t,r),VZ(r,t),dye(FM),gE=!!LM,FM=LM=null,t.current=r,Bye(r),gge(),tr=l,mr=o,po.transition=i}else t.current=r;if(QS&&(QS=!1,Mh=t,OE=s),i=t.pendingLanes,i===0&&(zh=null),vge(r.stateNode),Ki(t,Nn()),e!==null)for(n=t.onRecoverableError,r=0;r<e.length;r++)s=e[r],n(s.value,{componentStack:s.stack,digest:s.digest});if(PE)throw PE=!1,t=sD,sD=null,t;return OE&1&&t.tag!==0&&Ey(),i=t.pendingLanes,i&1?t===iD?cw++:(cw=0,iD=t):cw=0,df(),null}function Ey(){if(Mh!==null){var t=PQ(OE),e=po.transition,r=mr;try{if(po.transition=null,mr=16>t?16:t,Mh===null)var n=!1;else{if(t=Mh,Mh=null,OE=0,tr&6)throw Error(He(331));var s=tr;for(tr|=4,ct=t.current;ct!==null;){var i=ct,o=i.child;if(ct.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(ct=u;ct!==null;){var d=ct;switch(d.tag){case 0:case 11:case 15:ow(8,d,i)}var h=d.child;if(h!==null)h.return=d,ct=h;else for(;ct!==null;){d=ct;var f=d.sibling,p=d.return;if(zZ(d),d===u){ct=null;break}if(f!==null){f.return=p,ct=f;break}ct=p}}}var g=i.alternate;if(g!==null){var m=g.child;if(m!==null){g.child=null;do{var x=m.sibling;m.sibling=null,m=x}while(m!==null)}}ct=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,ct=o;else e:for(;ct!==null;){if(i=ct,i.flags&2048)switch(i.tag){case 0:case 11:case 15:ow(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,ct=y;break e}ct=i.return}}var v=t.current;for(ct=v;ct!==null;){o=ct;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,ct=b;else e:for(o=v;ct!==null;){if(l=ct,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Yk(9,l)}}catch(j){fn(l,l.return,j)}if(l===o){ct=null;break e}var w=l.sibling;if(w!==null){w.return=l.return,ct=w;break e}ct=l.return}}if(tr=s,df(),cc&&typeof cc.onPostCommitFiberRoot=="function")try{cc.onPostCommitFiberRoot(Uk,t)}catch{}n=!0}return n}finally{mr=r,po.transition=e}}return!1}function VU(t,e,r){e=yv(r,e),e=PZ(t,e,1),t=Uh(t,e,1),e=wi(),t!==null&&(Aj(t,1,e),Ki(t,e))}function fn(t,e,r){if(t.tag===3)VU(t,t,r);else for(;e!==null;){if(e.tag===3){VU(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(zh===null||!zh.has(n))){t=yv(r,t),t=OZ(e,t,1),e=Uh(e,t,1),t=wi(),e!==null&&(Aj(e,1,t),Ki(e,t));break}}e=e.return}}function qye(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=wi(),t.pingedLanes|=t.suspendedLanes&r,ps===t&&(ks&r)===r&&(Xn===4||Xn===3&&(ks&130023424)===ks&&500>Nn()-NF?km(t,0):SF|=r),Ki(t,e)}function ZZ(t,e){e===0&&(t.mode&1?(e=US,US<<=1,!(US&130023424)&&(US=4194304)):e=1);var r=wi();t=qu(t,e),t!==null&&(Aj(t,e,r),Ki(t,r))}function Gye(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),ZZ(t,r)}function Kye(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,s=t.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(He(314))}n!==null&&n.delete(e),ZZ(t,r)}var JZ;JZ=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||qi.current)Ui=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Ui=!1,Mye(t,e,r);Ui=!!(t.flags&131072)}else Ui=!1,Qr&&e.flags&1048576&&nZ(e,jE,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;dA(t,e),t=e.pendingProps;var s=fv(e,Zs.current);Ay(e,r),s=xF(null,e,n,t,s,r);var i=vF();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Gi(n)?(i=!0,wE(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,fF(e),s.updater=Kk,e.stateNode=s,s._reactInternals=e,GM(e,n,t,r),e=XM(null,e,n,!0,i,r)):(e.tag=0,Qr&&i&&aF(e),gi(null,e,s,r),e=e.child),e;case 16:n=e.elementType;e:{switch(dA(t,e),t=e.pendingProps,s=n._init,n=s(n._payload),e.type=n,s=e.tag=Xye(n),t=Lo(n,t),s){case 0:e=YM(null,e,n,t,r);break e;case 1:e=MU(null,e,n,t,r);break e;case 11:e=IU(null,e,n,t,r);break e;case 14:e=RU(null,e,n,Lo(n.type,t),r);break e}throw Error(He(306,n,""))}return e;case 0:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:Lo(n,s),YM(t,e,n,s,r);case 1:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:Lo(n,s),MU(t,e,n,s,r);case 3:e:{if(DZ(e),t===null)throw Error(He(387));n=e.pendingProps,i=e.memoizedState,s=i.element,cZ(t,e),AE(e,n,null,r);var o=e.memoizedState;if(n=o.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=yv(Error(He(423)),e),e=DU(t,e,n,r,s);break e}else if(n!==s){s=yv(Error(He(424)),e),e=DU(t,e,n,r,s);break e}else for(ka=Bh(e.stateNode.containerInfo.firstChild),Pa=e,Qr=!0,Jo=null,r=oZ(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(pv(),n===s){e=Gu(t,e,r);break e}gi(t,e,n,r)}e=e.child}return e;case 5:return uZ(e),t===null&&WM(e),n=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,$M(n,s)?o=null:i!==null&&$M(n,i)&&(e.flags|=32),MZ(t,e),gi(t,e,o,r),e.child;case 6:return t===null&&WM(e),null;case 13:return LZ(t,e,r);case 4:return pF(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=mv(e,null,n,r):gi(t,e,n,r),e.child;case 11:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:Lo(n,s),IU(t,e,n,s,r);case 7:return gi(t,e,e.pendingProps,r),e.child;case 8:return gi(t,e,e.pendingProps.children,r),e.child;case 12:return gi(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,Or(SE,n._currentValue),n._currentValue=o,i!==null)if(ul(i.value,o)){if(i.children===s.children&&!qi.current){e=Gu(t,e,r);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(i.tag===1){c=Lu(-1,r&-r),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=r,c=i.alternate,c!==null&&(c.lanes|=r),VM(i.return,r,e),l.lanes|=r;break}c=c.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(He(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),VM(o,r,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}gi(t,e,s.children,r),e=e.child}return e;case 9:return s=e.type,n=e.pendingProps.children,Ay(e,r),s=bo(s),n=n(s),e.flags|=1,gi(t,e,n,r),e.child;case 14:return n=e.type,s=Lo(n,e.pendingProps),s=Lo(n.type,s),RU(t,e,n,s,r);case 15:return IZ(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:Lo(n,s),dA(t,e),e.tag=1,Gi(n)?(t=!0,wE(e)):t=!1,Ay(e,r),TZ(e,n,s),GM(e,n,s,r),XM(null,e,n,!0,t,r);case 19:return FZ(t,e,r);case 22:return RZ(t,e,r)}throw Error(He(156,e.tag))};function eJ(t,e){return EQ(t,e)}function Yye(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function co(t,e,r,n){return new Yye(t,e,r,n)}function kF(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Xye(t){if(typeof t=="function")return kF(t)?1:0;if(t!=null){if(t=t.$$typeof,t===K3)return 11;if(t===Y3)return 14}return 2}function Wh(t,e){var r=t.alternate;return r===null?(r=co(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function pA(t,e,r,n,s,i){var o=2;if(n=t,typeof t=="function")kF(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Zg:return Tm(r.children,s,i,e);case G3:o=8,s|=8;break;case yM:return t=co(12,r,e,s|2),t.elementType=yM,t.lanes=i,t;case xM:return t=co(13,r,e,s),t.elementType=xM,t.lanes=i,t;case vM:return t=co(19,r,e,s),t.elementType=vM,t.lanes=i,t;case uQ:return Qk(r,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case lQ:o=10;break e;case cQ:o=9;break e;case K3:o=11;break e;case Y3:o=14;break e;case Ed:o=16,n=null;break e}throw Error(He(130,t==null?t:typeof t,""))}return e=co(o,r,e,s),e.elementType=t,e.type=n,e.lanes=i,e}function Tm(t,e,r,n){return t=co(7,t,n,e),t.lanes=r,t}function Qk(t,e,r,n){return t=co(22,t,n,e),t.elementType=uQ,t.lanes=r,t.stateNode={isHidden:!1},t}function RP(t,e,r){return t=co(6,t,null,e),t.lanes=r,t}function MP(t,e,r){return e=co(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Qye(t,e,r,n,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mP(0),this.expirationTimes=mP(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mP(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function TF(t,e,r,n,s,i,o,l,c){return t=new Qye(t,e,r,l,c),e===1?(e=1,i===!0&&(e|=8)):e=0,i=co(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},fF(i),t}function Zye(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Qg,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function tJ(t){if(!t)return Xh;t=t._reactInternals;e:{if(ag(t)!==t||t.tag!==1)throw Error(He(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Gi(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(He(171))}if(t.tag===1){var r=t.type;if(Gi(r))return tZ(t,r,e)}return e}function rJ(t,e,r,n,s,i,o,l,c){return t=TF(r,n,!0,t,s,i,o,l,c),t.context=tJ(null),r=t.current,n=wi(),s=Hh(r),i=Lu(n,s),i.callback=e??null,Uh(r,i,s),t.current.lanes=s,Aj(t,s,n),Ki(t,n),t}function Zk(t,e,r,n){var s=e.current,i=wi(),o=Hh(s);return r=tJ(r),e.context===null?e.context=r:e.pendingContext=r,e=Lu(i,o),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=Uh(s,e,o),t!==null&&(ol(t,s,o,i),lA(t,s,o)),o}function RE(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function qU(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function PF(t,e){qU(t,e),(t=t.alternate)&&qU(t,e)}function Jye(){return null}var nJ=typeof reportError=="function"?reportError:function(t){console.error(t)};function OF(t){this._internalRoot=t}Jk.prototype.render=OF.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(He(409));Zk(t,e,null,null)};Jk.prototype.unmount=OF.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;zm(function(){Zk(null,t,null,null)}),e[Vu]=null}};function Jk(t){this._internalRoot=t}Jk.prototype.unstable_scheduleHydration=function(t){if(t){var e=RQ();t={blockedOn:null,target:t,priority:e};for(var r=0;r<Td.length&&e!==0&&e<Td[r].priority;r++);Td.splice(r,0,t),r===0&&DQ(t)}};function IF(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function eT(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function GU(){}function exe(t,e,r,n,s){if(s){if(typeof n=="function"){var i=n;n=function(){var u=RE(o);i.call(u)}}var o=rJ(e,n,t,0,null,!1,!1,"",GU);return t._reactRootContainer=o,t[Vu]=o.current,Mw(t.nodeType===8?t.parentNode:t),zm(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof n=="function"){var l=n;n=function(){var u=RE(c);l.call(u)}}var c=TF(t,0,!1,null,null,!1,!1,"",GU);return t._reactRootContainer=c,t[Vu]=c.current,Mw(t.nodeType===8?t.parentNode:t),zm(function(){Zk(e,c,r,n)}),c}function tT(t,e,r,n,s){var i=r._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=RE(o);l.call(c)}}Zk(e,o,t,s)}else o=exe(r,e,t,s,n);return RE(o)}OQ=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=w0(e.pendingLanes);r!==0&&(Z3(e,r|1),Ki(e,Nn()),!(tr&6)&&(xv=Nn()+500,df()))}break;case 13:zm(function(){var n=qu(t,1);if(n!==null){var s=wi();ol(n,t,1,s)}}),PF(t,1)}};J3=function(t){if(t.tag===13){var e=qu(t,134217728);if(e!==null){var r=wi();ol(e,t,134217728,r)}PF(t,134217728)}};IQ=function(t){if(t.tag===13){var e=Hh(t),r=qu(t,e);if(r!==null){var n=wi();ol(r,t,e,n)}PF(t,e)}};RQ=function(){return mr};MQ=function(t,e){var r=mr;try{return mr=t,e()}finally{mr=r}};kM=function(t,e,r){switch(e){case"input":if(_M(t,r),e=r.name,r.type==="radio"&&e!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<r.length;e++){var n=r[e];if(n!==t&&n.form===t.form){var s=Vk(n);if(!s)throw Error(He(90));hQ(n),_M(n,s)}}}break;case"textarea":pQ(t,r);break;case"select":e=r.value,e!=null&&_y(t,!!r.multiple,e,!1)}};wQ=AF;_Q=zm;var txe={usingClientEntryPoint:!1,Events:[Cj,ry,Vk,vQ,bQ,AF]},Hb={findFiberByHostInstance:np,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},rxe={bundleType:Hb.bundleType,version:Hb.version,rendererPackageName:Hb.rendererPackageName,rendererConfig:Hb.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ad.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=NQ(t),t===null?null:t.stateNode},findFiberByHostInstance:Hb.findFiberByHostInstance||Jye,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ZS=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ZS.isDisabled&&ZS.supportsFiber)try{Uk=ZS.inject(rxe),cc=ZS}catch{}}La.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=txe;La.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!IF(e))throw Error(He(200));return Zye(t,e,null,r)};La.createRoot=function(t,e){if(!IF(t))throw Error(He(299));var r=!1,n="",s=nJ;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=TF(t,1,!1,null,null,r,!1,n,s),t[Vu]=e.current,Mw(t.nodeType===8?t.parentNode:t),new OF(e)};La.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(He(188)):(t=Object.keys(t).join(","),Error(He(268,t)));return t=NQ(e),t=t===null?null:t.stateNode,t};La.flushSync=function(t){return zm(t)};La.hydrate=function(t,e,r){if(!eT(e))throw Error(He(200));return tT(null,t,e,!0,r)};La.hydrateRoot=function(t,e,r){if(!IF(t))throw Error(He(405));var n=r!=null&&r.hydratedSources||null,s=!1,i="",o=nJ;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),e=rJ(e,null,t,1,r??null,s,!1,i,o),t[Vu]=e.current,Mw(t),n)for(t=0;t<n.length;t++)r=n[t],s=r._getVersion,s=s(r._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[r,s]:e.mutableSourceEagerHydrationData.push(r,s);return new Jk(e)};La.render=function(t,e,r){if(!eT(e))throw Error(He(200));return tT(null,t,e,!1,r)};La.unmountComponentAtNode=function(t){if(!eT(t))throw Error(He(40));return t._reactRootContainer?(zm(function(){tT(null,null,t,!1,function(){t._reactRootContainer=null,t[Vu]=null})}),!0):!1};La.unstable_batchedUpdates=AF;La.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!eT(r))throw Error(He(200));if(t==null||t._reactInternals===void 0)throw Error(He(38));return tT(t,e,r,!1,n)};La.version="18.3.1-next-f1338f8080-20240426";function sJ(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sJ)}catch(t){console.error(t)}}sJ(),sQ.exports=La;var Ac=sQ.exports;const iJ=qt(Ac);var aJ,KU=Ac;aJ=KU.createRoot,KU.hydrateRoot;var nxe=typeof Element<"u",sxe=typeof Map=="function",ixe=typeof Set=="function",axe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function mA(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var r,n,s;if(Array.isArray(t)){if(r=t.length,r!=e.length)return!1;for(n=r;n--!==0;)if(!mA(t[n],e[n]))return!1;return!0}var i;if(sxe&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(i=t.entries();!(n=i.next()).done;)if(!e.has(n.value[0]))return!1;for(i=t.entries();!(n=i.next()).done;)if(!mA(n.value[1],e.get(n.value[0])))return!1;return!0}if(ixe&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(i=t.entries();!(n=i.next()).done;)if(!e.has(n.value[0]))return!1;return!0}if(axe&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(r=t.length,r!=e.length)return!1;for(n=r;n--!==0;)if(t[n]!==e[n])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf&&typeof t.valueOf=="function"&&typeof e.valueOf=="function")return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString&&typeof t.toString=="function"&&typeof e.toString=="function")return t.toString()===e.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[n]))return!1;if(nxe&&t instanceof Element)return!1;for(n=r;n--!==0;)if(!((s[n]==="_owner"||s[n]==="__v"||s[n]==="__o")&&t.$$typeof)&&!mA(t[s[n]],e[s[n]]))return!1;return!0}return t!==t&&e!==e}var oxe=function(e,r){try{return mA(e,r)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}};const lxe=qt(oxe);var cxe=function(t,e,r,n,s,i,o,l){if(!t){var c;if(e===void 0)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[r,n,s,i,o,l],d=0;c=new Error(e.replace(/%s/g,function(){return u[d++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}},uxe=cxe;const YU=qt(uxe);var dxe=function(e,r,n,s){var i=n?n.call(s,e,r):void 0;if(i!==void 0)return!!i;if(e===r)return!0;if(typeof e!="object"||!e||typeof r!="object"||!r)return!1;var o=Object.keys(e),l=Object.keys(r);if(o.length!==l.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(r),u=0;u<o.length;u++){var d=o[u];if(!c(d))return!1;var h=e[d],f=r[d];if(i=n?n.call(s,h,f,d):void 0,i===!1||i===void 0&&h!==f)return!1}return!0};const hxe=qt(dxe);var oJ=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(oJ||{}),DP={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},XU=Object.values(oJ),RF={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},fxe=Object.entries(RF).reduce((t,[e,r])=>(t[r]=e,t),{}),nl="data-rh",Cy={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},ky=(t,e)=>{for(let r=t.length-1;r>=0;r-=1){const n=t[r];if(Object.prototype.hasOwnProperty.call(n,e))return n[e]}return null},pxe=t=>{let e=ky(t,"title");const r=ky(t,Cy.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),r&&e)return r.replace(/%s/g,()=>e);const n=ky(t,Cy.DEFAULT_TITLE);return e||n||void 0},mxe=t=>ky(t,Cy.ON_CHANGE_CLIENT_STATE)||(()=>{}),LP=(t,e)=>e.filter(r=>typeof r[t]<"u").map(r=>r[t]).reduce((r,n)=>({...r,...n}),{}),gxe=(t,e)=>e.filter(r=>typeof r.base<"u").map(r=>r.base).reverse().reduce((r,n)=>{if(!r.length){const s=Object.keys(n);for(let i=0;i<s.length;i+=1){const l=s[i].toLowerCase();if(t.indexOf(l)!==-1&&n[l])return r.concat(n)}}return r},[]),yxe=t=>console&&typeof console.warn=="function"&&console.warn(t),Wb=(t,e,r)=>{const n={};return r.filter(s=>Array.isArray(s[t])?!0:(typeof s[t]<"u"&&yxe(`Helmet: ${t} should be of type "Array". Instead found type "${typeof s[t]}"`),!1)).map(s=>s[t]).reverse().reduce((s,i)=>{const o={};i.filter(c=>{let u;const d=Object.keys(c);for(let f=0;f<d.length;f+=1){const p=d[f],g=p.toLowerCase();e.indexOf(g)!==-1&&!(u==="rel"&&c[u].toLowerCase()==="canonical")&&!(g==="rel"&&c[g].toLowerCase()==="stylesheet")&&(u=g),e.indexOf(p)!==-1&&(p==="innerHTML"||p==="cssText"||p==="itemprop")&&(u=p)}if(!u||!c[u])return!1;const h=c[u].toLowerCase();return n[u]||(n[u]={}),o[u]||(o[u]={}),n[u][h]?!1:(o[u][h]=!0,!0)}).reverse().forEach(c=>s.push(c));const l=Object.keys(o);for(let c=0;c<l.length;c+=1){const u=l[c],d={...n[u],...o[u]};n[u]=d}return s},[]).reverse()},xxe=(t,e)=>{if(Array.isArray(t)&&t.length){for(let r=0;r<t.length;r+=1)if(t[r][e])return!0}return!1},vxe=t=>({baseTag:gxe(["href"],t),bodyAttributes:LP("bodyAttributes",t),defer:ky(t,Cy.DEFER),encode:ky(t,Cy.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:LP("htmlAttributes",t),linkTags:Wb("link",["rel","href"],t),metaTags:Wb("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:Wb("noscript",["innerHTML"],t),onChangeClientState:mxe(t),scriptTags:Wb("script",["src","innerHTML"],t),styleTags:Wb("style",["cssText"],t),title:pxe(t),titleAttributes:LP("titleAttributes",t),prioritizeSeoTags:xxe(t,Cy.PRIORITIZE_SEO_TAGS)}),lJ=t=>Array.isArray(t)?t.join(""):t,bxe=(t,e)=>{const r=Object.keys(t);for(let n=0;n<r.length;n+=1)if(e[r[n]]&&e[r[n]].includes(t[r[n]]))return!0;return!1},FP=(t,e)=>Array.isArray(t)?t.reduce((r,n)=>(bxe(n,e)?r.priority.push(n):r.default.push(n),r),{priority:[],default:[]}):{default:t,priority:[]},QU=(t,e)=>({...t,[e]:void 0}),wxe=["noscript","script","style"],lD=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),cJ=t=>Object.keys(t).reduce((e,r)=>{const n=typeof t[r]<"u"?`${r}="${t[r]}"`:`${r}`;return e?`${e} ${n}`:n},""),_xe=(t,e,r,n)=>{const s=cJ(r),i=lJ(e);return s?`<${t} ${nl}="true" ${s}>${lD(i,n)}</${t}>`:`<${t} ${nl}="true">${lD(i,n)}</${t}>`},jxe=(t,e,r=!0)=>e.reduce((n,s)=>{const i=s,o=Object.keys(i).filter(u=>!(u==="innerHTML"||u==="cssText")).reduce((u,d)=>{const h=typeof i[d]>"u"?d:`${d}="${lD(i[d],r)}"`;return u?`${u} ${h}`:h},""),l=i.innerHTML||i.cssText||"",c=wxe.indexOf(t)===-1;return`${n}<${t} ${nl}="true" ${o}${c?"/>":`>${l}</${t}>`}`},""),uJ=(t,e={})=>Object.keys(t).reduce((r,n)=>{const s=RF[n];return r[s||n]=t[n],r},e),Sxe=(t,e,r)=>{const n={key:e,[nl]:!0},s=uJ(r,n);return[me.createElement("title",s,e)]},gA=(t,e)=>e.map((r,n)=>{const s={key:n,[nl]:!0};return Object.keys(r).forEach(i=>{const l=RF[i]||i;if(l==="innerHTML"||l==="cssText"){const c=r.innerHTML||r.cssText;s.dangerouslySetInnerHTML={__html:c}}else s[l]=r[i]}),me.createElement(t,s)}),qa=(t,e,r=!0)=>{switch(t){case"title":return{toComponent:()=>Sxe(t,e.title,e.titleAttributes),toString:()=>_xe(t,e.title,e.titleAttributes,r)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>uJ(e),toString:()=>cJ(e)};default:return{toComponent:()=>gA(t,e),toString:()=>jxe(t,e,r)}}},Nxe=({metaTags:t,linkTags:e,scriptTags:r,encode:n})=>{const s=FP(t,DP.meta),i=FP(e,DP.link),o=FP(r,DP.script);return{priorityMethods:{toComponent:()=>[...gA("meta",s.priority),...gA("link",i.priority),...gA("script",o.priority)],toString:()=>`${qa("meta",s.priority,n)} ${qa("link",i.priority,n)} ${qa("script",o.priority,n)}`},metaTags:s.default,linkTags:i.default,scriptTags:o.default}},Axe=t=>{const{baseTag:e,bodyAttributes:r,encode:n=!0,htmlAttributes:s,noscriptTags:i,styleTags:o,title:l="",titleAttributes:c,prioritizeSeoTags:u}=t;let{linkTags:d,metaTags:h,scriptTags:f}=t,p={toComponent:()=>{},toString:()=>""};return u&&({priorityMethods:p,linkTags:d,metaTags:h,scriptTags:f}=Nxe(t)),{priority:p,base:qa("base",e,n),bodyAttributes:qa("bodyAttributes",r,n),htmlAttributes:qa("htmlAttributes",s,n),link:qa("link",d,n),meta:qa("meta",h,n),noscript:qa("noscript",i,n),script:qa("script",f,n),style:qa("style",o,n),title:qa("title",{title:l,titleAttributes:c},n)}},cD=Axe,JS=[],dJ=!!(typeof window<"u"&&window.document&&window.document.createElement),uD=class{constructor(t,e){Le(this,"instances",[]);Le(this,"canUseDOM",dJ);Le(this,"context");Le(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?JS:this.instances,add:t=>{(this.canUseDOM?JS:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?JS:this.instances).indexOf(t);(this.canUseDOM?JS:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=cD({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},Exe={},hJ=me.createContext(Exe),pp,fJ=(pp=class extends S.Component{constructor(r){super(r);Le(this,"helmetData");this.helmetData=new uD(this.props.context||{},pp.canUseDOM)}render(){return me.createElement(hJ.Provider,{value:this.helmetData.value},this.props.children)}},Le(pp,"canUseDOM",dJ),pp),_g=(t,e)=>{const r=document.head||document.querySelector("head"),n=r.querySelectorAll(`${t}[${nl}]`),s=[].slice.call(n),i=[];let o;return e&&e.length&&e.forEach(l=>{const c=document.createElement(t);for(const u in l)if(Object.prototype.hasOwnProperty.call(l,u))if(u==="innerHTML")c.innerHTML=l.innerHTML;else if(u==="cssText")c.styleSheet?c.styleSheet.cssText=l.cssText:c.appendChild(document.createTextNode(l.cssText));else{const d=u,h=typeof l[d]>"u"?"":l[d];c.setAttribute(u,h)}c.setAttribute(nl,"true"),s.some((u,d)=>(o=d,c.isEqualNode(u)))?s.splice(o,1):i.push(c)}),s.forEach(l=>{var c;return(c=l.parentNode)==null?void 0:c.removeChild(l)}),i.forEach(l=>r.appendChild(l)),{oldTags:s,newTags:i}},dD=(t,e)=>{const r=document.getElementsByTagName(t)[0];if(!r)return;const n=r.getAttribute(nl),s=n?n.split(","):[],i=[...s],o=Object.keys(e);for(const l of o){const c=e[l]||"";r.getAttribute(l)!==c&&r.setAttribute(l,c),s.indexOf(l)===-1&&s.push(l);const u=i.indexOf(l);u!==-1&&i.splice(u,1)}for(let l=i.length-1;l>=0;l-=1)r.removeAttribute(i[l]);s.length===i.length?r.removeAttribute(nl):r.getAttribute(nl)!==o.join(",")&&r.setAttribute(nl,o.join(","))},Cxe=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=lJ(t)),dD("title",e)},ZU=(t,e)=>{const{baseTag:r,bodyAttributes:n,htmlAttributes:s,linkTags:i,metaTags:o,noscriptTags:l,onChangeClientState:c,scriptTags:u,styleTags:d,title:h,titleAttributes:f}=t;dD("body",n),dD("html",s),Cxe(h,f);const p={baseTag:_g("base",r),linkTags:_g("link",i),metaTags:_g("meta",o),noscriptTags:_g("noscript",l),scriptTags:_g("script",u),styleTags:_g("style",d)},g={},m={};Object.keys(p).forEach(x=>{const{newTags:y,oldTags:v}=p[x];y.length&&(g[x]=y),v.length&&(m[x]=p[x].oldTags)}),e&&e(),c(t,g,m)},Vb=null,kxe=t=>{Vb&&cancelAnimationFrame(Vb),t.defer?Vb=requestAnimationFrame(()=>{ZU(t,()=>{Vb=null})}):(ZU(t),Vb=null)},Txe=kxe,JU=class extends S.Component{constructor(){super(...arguments);Le(this,"rendered",!1)}shouldComponentUpdate(e){return!hxe(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:r}=this.props.context;let n=null;const s=vxe(e.get().map(i=>{const o={...i.props};return delete o.context,o}));fJ.canUseDOM?Txe(s):cD&&(n=cD(s)),r(n)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},mM,Pxe=(mM=class extends S.Component{shouldComponentUpdate(t){return!lxe(QU(this.props,"helmetData"),QU(t,"helmetData"))}mapNestedChildrenToProps(t,e){if(!e)return null;switch(t.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,e,r,n){return{...e,[t.type]:[...e[t.type]||[],{...r,...this.mapNestedChildrenToProps(t,n)}]}}mapObjectTypeChildren(t,e,r,n){switch(t.type){case"title":return{...e,[t.type]:n,titleAttributes:{...r}};case"body":return{...e,bodyAttributes:{...r}};case"html":return{...e,htmlAttributes:{...r}};default:return{...e,[t.type]:{...r}}}}mapArrayTypeChildrenToProps(t,e){let r={...e};return Object.keys(t).forEach(n=>{r={...r,[n]:t[n]}}),r}warnOnInvalidChildren(t,e){return YU(XU.some(r=>t.type===r),typeof t.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${XU.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),YU(!e||typeof e=="string"||Array.isArray(e)&&!e.some(r=>typeof r!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`}</${t.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(t,e){let r={};return me.Children.forEach(t,n=>{if(!n||!n.props)return;const{children:s,...i}=n.props,o=Object.keys(i).reduce((c,u)=>(c[fxe[u]||u]=i[u],c),{});let{type:l}=n;switch(typeof l=="symbol"?l=l.toString():this.warnOnInvalidChildren(n,s),l){case"Symbol(react.fragment)":e=this.mapChildrenToProps(s,e);break;case"link":case"meta":case"noscript":case"script":case"style":r=this.flattenArrayTypeChildren(n,r,o,s);break;default:e=this.mapObjectTypeChildren(n,e,o,s);break}}),this.mapArrayTypeChildrenToProps(r,e)}render(){const{children:t,...e}=this.props;let r={...e},{helmetData:n}=e;if(t&&(r=this.mapChildrenToProps(t,r)),n&&!(n instanceof uD)){const s=n;n=new uD(s.context,!0),delete r.helmetData}return n?me.createElement(JU,{...r,context:n.value}):me.createElement(hJ.Consumer,null,s=>me.createElement(JU,{...r,context:s}))}},Le(mM,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),mM);const Oxe=1,Ixe=1e6;let $P=0;function Rxe(){return $P=($P+1)%Number.MAX_SAFE_INTEGER,$P.toString()}const BP=new Map,ez=t=>{if(BP.has(t))return;const e=setTimeout(()=>{BP.delete(t),uw({type:"REMOVE_TOAST",toastId:t})},Ixe);BP.set(t,e)},Mxe=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,Oxe)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(r=>r.id===e.toast.id?{...r,...e.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=e;return r?ez(r):t.toasts.forEach(n=>{ez(n.id)}),{...t,toasts:t.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(r=>r.id!==e.toastId)}}},yA=[];let xA={toasts:[]};function uw(t){xA=Mxe(xA,t),yA.forEach(e=>{e(xA)})}function j0({...t}){const e=Rxe(),r=s=>uw({type:"UPDATE_TOAST",toast:{...s,id:e}}),n=()=>uw({type:"DISMISS_TOAST",toastId:e});return uw({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||n()}}}),{id:e,dismiss:n,update:r}}function on(){const[t,e]=S.useState(xA);return S.useEffect(()=>(yA.push(e),()=>{const r=yA.indexOf(e);r>-1&&yA.splice(r,1)}),[t]),{...t,toast:j0,dismiss:r=>uw({type:"DISMISS_TOAST",toastId:r})}}function ze(t,e,{checkForDefaultPrevented:r=!0}={}){return function(s){if(t==null||t(s),r===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function tz(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function rT(...t){return e=>{let r=!1;const n=t.map(s=>{const i=tz(s,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let s=0;s<n.length;s++){const i=n[s];typeof i=="function"?i():tz(t[s],null)}}}}function Nt(...t){return S.useCallback(rT(...t),t)}function Dxe(t,e){const r=S.createContext(e),n=i=>{const{children:o,...l}=i,c=S.useMemo(()=>l,Object.values(l));return a.jsx(r.Provider,{value:c,children:o})};n.displayName=t+"Provider";function s(i){const o=S.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[n,s]}function Bn(t,e=[]){let r=[];function n(i,o){const l=S.createContext(o),c=r.length;r=[...r,o];const u=h=>{var y;const{scope:f,children:p,...g}=h,m=((y=f==null?void 0:f[t])==null?void 0:y[c])||l,x=S.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})};u.displayName=i+"Provider";function d(h,f){var m;const p=((m=f==null?void 0:f[t])==null?void 0:m[c])||l,g=S.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const s=()=>{const i=r.map(o=>S.createContext(o));return function(l){const c=(l==null?void 0:l[t])||i;return S.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[n,Lxe(s,...e)]}function Lxe(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const h=c(i)[`__scope${u}`];return{...l,...h}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function Qh(t){const e=$xe(t),r=S.forwardRef((n,s)=>{const{children:i,...o}=n,l=S.Children.toArray(i),c=l.find(Bxe);if(c){const u=c.props.children,d=l.map(h=>h===c?S.Children.count(u)>1?S.Children.only(null):S.isValidElement(u)?u.props.children:null:h);return a.jsx(e,{...o,ref:s,children:S.isValidElement(u)?S.cloneElement(u,void 0,d):null})}return a.jsx(e,{...o,ref:s,children:i})});return r.displayName=`${t}.Slot`,r}var Fxe=Qh("Slot");function $xe(t){const e=S.forwardRef((r,n)=>{const{children:s,...i}=r;if(S.isValidElement(s)){const o=zxe(s),l=Uxe(i,s.props);return s.type!==S.Fragment&&(l.ref=n?rT(n,o):o),S.cloneElement(s,l)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var pJ=Symbol("radix.slottable");function mJ(t){const e=({children:r})=>a.jsx(a.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=pJ,e}function Bxe(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===pJ}function Uxe(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function zxe(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function Tj(t){const e=t+"CollectionProvider",[r,n]=Bn(e),[s,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=m=>{const{scope:x,children:y}=m,v=me.useRef(null),b=me.useRef(new Map).current;return a.jsx(s,{scope:x,itemMap:b,collectionRef:v,children:y})};o.displayName=e;const l=t+"CollectionSlot",c=Qh(l),u=me.forwardRef((m,x)=>{const{scope:y,children:v}=m,b=i(l,y),w=Nt(x,b.collectionRef);return a.jsx(c,{ref:w,children:v})});u.displayName=l;const d=t+"CollectionItemSlot",h="data-radix-collection-item",f=Qh(d),p=me.forwardRef((m,x)=>{const{scope:y,children:v,...b}=m,w=me.useRef(null),j=Nt(x,w),N=i(d,y);return me.useEffect(()=>(N.itemMap.set(w,{ref:w,...b}),()=>void N.itemMap.delete(w))),a.jsx(f,{[h]:"",ref:j,children:v})});p.displayName=d;function g(m){const x=i(t+"CollectionConsumer",m);return me.useCallback(()=>{const v=x.collectionRef.current;if(!v)return[];const b=Array.from(v.querySelectorAll(`[${h}]`));return Array.from(x.itemMap.values()).sort((N,C)=>b.indexOf(N.ref.current)-b.indexOf(C.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},g,n]}var Hxe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],et=Hxe.reduce((t,e)=>{const r=Qh(`Primitive.${e}`),n=S.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function MF(t,e){t&&Ac.flushSync(()=>t.dispatchEvent(e))}function gn(t){const e=S.useRef(t);return S.useEffect(()=>{e.current=t}),S.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function Wxe(t,e=globalThis==null?void 0:globalThis.document){const r=gn(t);S.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var Vxe="DismissableLayer",hD="dismissableLayer.update",qxe="dismissableLayer.pointerDownOutside",Gxe="dismissableLayer.focusOutside",rz,gJ=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),og=S.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=t,u=S.useContext(gJ),[d,h]=S.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=S.useState({}),g=Nt(e,C=>h(C)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(x),v=d?m.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,w=v>=y,j=Yxe(C=>{const k=C.target,E=[...u.branches].some(M=>M.contains(k));!w||E||(s==null||s(C),o==null||o(C),C.defaultPrevented||l==null||l())},f),N=Xxe(C=>{const k=C.target;[...u.branches].some(M=>M.contains(k))||(i==null||i(C),o==null||o(C),C.defaultPrevented||l==null||l())},f);return Wxe(C=>{v===u.layers.size-1&&(n==null||n(C),!C.defaultPrevented&&l&&(C.preventDefault(),l()))},f),S.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(rz=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),nz(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=rz)}},[d,f,r,u]),S.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),nz())},[d,u]),S.useEffect(()=>{const C=()=>p({});return document.addEventListener(hD,C),()=>document.removeEventListener(hD,C)},[]),a.jsx(et.div,{...c,ref:g,style:{pointerEvents:b?w?"auto":"none":void 0,...t.style},onFocusCapture:ze(t.onFocusCapture,N.onFocusCapture),onBlurCapture:ze(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:ze(t.onPointerDownCapture,j.onPointerDownCapture)})});og.displayName=Vxe;var Kxe="DismissableLayerBranch",yJ=S.forwardRef((t,e)=>{const r=S.useContext(gJ),n=S.useRef(null),s=Nt(e,n);return S.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),a.jsx(et.div,{...t,ref:s})});yJ.displayName=Kxe;function Yxe(t,e=globalThis==null?void 0:globalThis.document){const r=gn(t),n=S.useRef(!1),s=S.useRef(()=>{});return S.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){xJ(qxe,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=c,e.addEventListener("click",s.current,{once:!0})):c()}else e.removeEventListener("click",s.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",s.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function Xxe(t,e=globalThis==null?void 0:globalThis.document){const r=gn(t),n=S.useRef(!1);return S.useEffect(()=>{const s=i=>{i.target&&!n.current&&xJ(Gxe,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function nz(){const t=new CustomEvent(hD);document.dispatchEvent(t)}function xJ(t,e,r,{discrete:n}){const s=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?MF(s,i):s.dispatchEvent(i)}var Qxe=og,Zxe=yJ,vn=globalThis!=null&&globalThis.document?S.useLayoutEffect:()=>{},Jxe="Portal",nb=S.forwardRef((t,e)=>{var l;const{container:r,...n}=t,[s,i]=S.useState(!1);vn(()=>i(!0),[]);const o=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?iJ.createPortal(a.jsx(et.div,{...n,ref:e}),o):null});nb.displayName=Jxe;function eve(t,e){return S.useReducer((r,n)=>e[r][n]??r,t)}var es=t=>{const{present:e,children:r}=t,n=tve(e),s=typeof r=="function"?r({present:n.isPresent}):S.Children.only(r),i=Nt(n.ref,rve(s));return typeof r=="function"||n.isPresent?S.cloneElement(s,{ref:i}):null};es.displayName="Presence";function tve(t){const[e,r]=S.useState(),n=S.useRef(null),s=S.useRef(t),i=S.useRef("none"),o=t?"mounted":"unmounted",[l,c]=eve(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{const u=eN(n.current);i.current=l==="mounted"?u:"none"},[l]),vn(()=>{const u=n.current,d=s.current;if(d!==t){const f=i.current,p=eN(u);t?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&f!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),vn(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,h=p=>{const m=eN(n.current).includes(p.animationName);if(p.target===e&&m&&(c("ANIMATION_END"),!s.current)){const x=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=x)})}},f=p=>{p.target===e&&(i.current=eN(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:S.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function eN(t){return(t==null?void 0:t.animationName)||"none"}function rve(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var nve=H3[" useInsertionEffect ".trim().toString()]||vn;function Ms({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){const[s,i,o]=sve({defaultProp:e,onChange:r}),l=t!==void 0,c=l?t:s;{const d=S.useRef(t!==void 0);S.useEffect(()=>{const h=d.current;h!==l&&console.warn(`${n} is changing from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,n])}const u=S.useCallback(d=>{var h;if(l){const f=ive(d)?d(t):d;f!==t&&((h=o.current)==null||h.call(o,f))}else i(d)},[l,t,i,o]);return[c,u]}function sve({defaultProp:t,onChange:e}){const[r,n]=S.useState(t),s=S.useRef(r),i=S.useRef(e);return nve(()=>{i.current=e},[e]),S.useEffect(()=>{var o;s.current!==r&&((o=i.current)==null||o.call(i,r),s.current=r)},[r,s]),[r,n,i]}function ive(t){return typeof t=="function"}var vJ=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ave="VisuallyHidden",nT=S.forwardRef((t,e)=>a.jsx(et.span,{...t,ref:e,style:{...vJ,...t.style}}));nT.displayName=ave;var ove=nT,DF="ToastProvider",[LF,lve,cve]=Tj("Toast"),[bJ,Eyt]=Bn("Toast",[cve]),[uve,sT]=bJ(DF),wJ=t=>{const{__scopeToast:e,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:o}=t,[l,c]=S.useState(null),[u,d]=S.useState(0),h=S.useRef(!1),f=S.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${DF}\`. Expected non-empty \`string\`.`),a.jsx(LF.Provider,{scope:e,children:a.jsx(uve,{scope:e,label:r,duration:n,swipeDirection:s,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:S.useCallback(()=>d(p=>p+1),[]),onToastRemove:S.useCallback(()=>d(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:f,children:o})})};wJ.displayName=DF;var _J="ToastViewport",dve=["F8"],fD="toast.viewportPause",pD="toast.viewportResume",jJ=S.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:n=dve,label:s="Notifications ({hotkey})",...i}=t,o=sT(_J,r),l=lve(r),c=S.useRef(null),u=S.useRef(null),d=S.useRef(null),h=S.useRef(null),f=Nt(e,h,o.onViewportChange),p=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=o.toastCount>0;S.useEffect(()=>{const x=y=>{var b;n.length!==0&&n.every(w=>y[w]||y.code===w)&&((b=h.current)==null||b.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]),S.useEffect(()=>{const x=c.current,y=h.current;if(g&&x&&y){const v=()=>{if(!o.isClosePausedRef.current){const N=new CustomEvent(fD);y.dispatchEvent(N),o.isClosePausedRef.current=!0}},b=()=>{if(o.isClosePausedRef.current){const N=new CustomEvent(pD);y.dispatchEvent(N),o.isClosePausedRef.current=!1}},w=N=>{!x.contains(N.relatedTarget)&&b()},j=()=>{x.contains(document.activeElement)||b()};return x.addEventListener("focusin",v),x.addEventListener("focusout",w),x.addEventListener("pointermove",v),x.addEventListener("pointerleave",j),window.addEventListener("blur",v),window.addEventListener("focus",b),()=>{x.removeEventListener("focusin",v),x.removeEventListener("focusout",w),x.removeEventListener("pointermove",v),x.removeEventListener("pointerleave",j),window.removeEventListener("blur",v),window.removeEventListener("focus",b)}}},[g,o.isClosePausedRef]);const m=S.useCallback(({tabbingDirection:x})=>{const v=l().map(b=>{const w=b.ref.current,j=[w,...Sve(w)];return x==="forwards"?j:j.reverse()});return(x==="forwards"?v.reverse():v).flat()},[l]);return S.useEffect(()=>{const x=h.current;if(x){const y=v=>{var j,N,C;const b=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!b){const k=document.activeElement,E=v.shiftKey;if(v.target===x&&E){(j=u.current)==null||j.focus();return}const P=m({tabbingDirection:E?"backwards":"forwards"}),V=P.findIndex(A=>A===k);UP(P.slice(V+1))?v.preventDefault():E?(N=u.current)==null||N.focus():(C=d.current)==null||C.focus()}};return x.addEventListener("keydown",y),()=>x.removeEventListener("keydown",y)}},[l,m]),a.jsxs(Zxe,{ref:c,role:"region","aria-label":s.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&a.jsx(mD,{ref:u,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"forwards"});UP(x)}}),a.jsx(LF.Slot,{scope:r,children:a.jsx(et.ol,{tabIndex:-1,...i,ref:f})}),g&&a.jsx(mD,{ref:d,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"backwards"});UP(x)}})]})});jJ.displayName=_J;var SJ="ToastFocusProxy",mD=S.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=t,i=sT(SJ,r);return a.jsx(nT,{"aria-hidden":!0,tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:o=>{var u;const l=o.relatedTarget;!((u=i.viewport)!=null&&u.contains(l))&&n()}})});mD.displayName=SJ;var Pj="Toast",hve="toast.swipeStart",fve="toast.swipeMove",pve="toast.swipeCancel",mve="toast.swipeEnd",NJ=S.forwardRef((t,e)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:i,...o}=t,[l,c]=Ms({prop:n,defaultProp:s??!0,onChange:i,caller:Pj});return a.jsx(es,{present:r||l,children:a.jsx(xve,{open:l,...o,ref:e,onClose:()=>c(!1),onPause:gn(t.onPause),onResume:gn(t.onResume),onSwipeStart:ze(t.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ze(t.onSwipeMove,u=>{const{x:d,y:h}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:ze(t.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ze(t.onSwipeEnd,u=>{const{x:d,y:h}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),c(!1)})})})});NJ.displayName=Pj;var[gve,yve]=bJ(Pj,{onClose(){}}),xve=S.forwardRef((t,e)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:h,onSwipeCancel:f,onSwipeEnd:p,...g}=t,m=sT(Pj,r),[x,y]=S.useState(null),v=Nt(e,A=>y(A)),b=S.useRef(null),w=S.useRef(null),j=s||m.duration,N=S.useRef(0),C=S.useRef(j),k=S.useRef(0),{onToastAdd:E,onToastRemove:M}=m,z=gn(()=>{var $;(x==null?void 0:x.contains(document.activeElement))&&(($=m.viewport)==null||$.focus()),o()}),P=S.useCallback(A=>{!A||A===1/0||(window.clearTimeout(k.current),N.current=new Date().getTime(),k.current=window.setTimeout(z,A))},[z]);S.useEffect(()=>{const A=m.viewport;if(A){const $=()=>{P(C.current),u==null||u()},K=()=>{const G=new Date().getTime()-N.current;C.current=C.current-G,window.clearTimeout(k.current),c==null||c()};return A.addEventListener(fD,K),A.addEventListener(pD,$),()=>{A.removeEventListener(fD,K),A.removeEventListener(pD,$)}}},[m.viewport,j,c,u,P]),S.useEffect(()=>{i&&!m.isClosePausedRef.current&&P(j)},[i,j,m.isClosePausedRef,P]),S.useEffect(()=>(E(),()=>M()),[E,M]);const V=S.useMemo(()=>x?OJ(x):null,[x]);return m.viewport?a.jsxs(a.Fragment,{children:[V&&a.jsx(vve,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:V}),a.jsx(gve,{scope:r,onClose:z,children:Ac.createPortal(a.jsx(LF.ItemSlot,{scope:r,children:a.jsx(Qxe,{asChild:!0,onEscapeKeyDown:ze(l,()=>{m.isFocusedToastEscapeKeyDownRef.current||z(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(et.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":m.swipeDirection,...g,ref:v,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:ze(t.onKeyDown,A=>{A.key==="Escape"&&(l==null||l(A.nativeEvent),A.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,z()))}),onPointerDown:ze(t.onPointerDown,A=>{A.button===0&&(b.current={x:A.clientX,y:A.clientY})}),onPointerMove:ze(t.onPointerMove,A=>{if(!b.current)return;const $=A.clientX-b.current.x,K=A.clientY-b.current.y,G=!!w.current,Y=["left","right"].includes(m.swipeDirection),H=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,B=Y?H(0,$):0,L=Y?0:H(0,K),F=A.pointerType==="touch"?10:2,W={x:B,y:L},X={originalEvent:A,delta:W};G?(w.current=W,tN(fve,h,X,{discrete:!1})):sz(W,m.swipeDirection,F)?(w.current=W,tN(hve,d,X,{discrete:!1}),A.target.setPointerCapture(A.pointerId)):(Math.abs($)>F||Math.abs(K)>F)&&(b.current=null)}),onPointerUp:ze(t.onPointerUp,A=>{const $=w.current,K=A.target;if(K.hasPointerCapture(A.pointerId)&&K.releasePointerCapture(A.pointerId),w.current=null,b.current=null,$){const G=A.currentTarget,Y={originalEvent:A,delta:$};sz($,m.swipeDirection,m.swipeThreshold)?tN(mve,p,Y,{discrete:!0}):tN(pve,f,Y,{discrete:!0}),G.addEventListener("click",H=>H.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),vve=t=>{const{__scopeToast:e,children:r,...n}=t,s=sT(Pj,e),[i,o]=S.useState(!1),[l,c]=S.useState(!1);return _ve(()=>o(!0)),S.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:a.jsx(nb,{asChild:!0,children:a.jsx(nT,{...n,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",r]})})})},bve="ToastTitle",AJ=S.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return a.jsx(et.div,{...n,ref:e})});AJ.displayName=bve;var wve="ToastDescription",EJ=S.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return a.jsx(et.div,{...n,ref:e})});EJ.displayName=wve;var CJ="ToastAction",kJ=S.forwardRef((t,e)=>{const{altText:r,...n}=t;return r.trim()?a.jsx(PJ,{altText:r,asChild:!0,children:a.jsx(FF,{...n,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${CJ}\`. Expected non-empty \`string\`.`),null)});kJ.displayName=CJ;var TJ="ToastClose",FF=S.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t,s=yve(TJ,r);return a.jsx(PJ,{asChild:!0,children:a.jsx(et.button,{type:"button",...n,ref:e,onClick:ze(t.onClick,s.onClose)})})});FF.displayName=TJ;var PJ=S.forwardRef((t,e)=>{const{__scopeToast:r,altText:n,...s}=t;return a.jsx(et.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:e})});function OJ(t){const e=[];return Array.from(t.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&e.push(n.textContent),jve(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",i=n.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=n.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(...OJ(n))}}),e}function tN(t,e,r,{discrete:n}){const s=r.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?MF(s,i):s.dispatchEvent(i)}var sz=(t,e,r=0)=>{const n=Math.abs(t.x),s=Math.abs(t.y),i=n>s;return e==="left"||e==="right"?i&&n>r:!i&&s>r};function _ve(t=()=>{}){const e=gn(t);vn(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[e])}function jve(t){return t.nodeType===t.ELEMENT_NODE}function Sve(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function UP(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var Nve=wJ,IJ=jJ,RJ=NJ,MJ=AJ,DJ=EJ,LJ=kJ,FJ=FF;function $J(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(r=$J(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Jt(){for(var t,e,r=0,n="",s=arguments.length;r<s;r++)(t=arguments[r])&&(e=$J(t))&&(n&&(n+=" "),n+=e);return n}const iz=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,az=Jt,od=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return az(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:i}=e,o=Object.keys(s).map(u=>{const d=r==null?void 0:r[u],h=i==null?void 0:i[u];if(d===null)return null;const f=iz(d)||iz(h);return s[u][f]}),l=r&&Object.entries(r).reduce((u,d)=>{let[h,f]=d;return f===void 0||(u[h]=f),u},{}),c=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:h,className:f,...p}=d;return Object.entries(p).every(g=>{let[m,x]=g;return Array.isArray(x)?x.includes({...i,...l}[m]):{...i,...l}[m]===x})?[...u,h,f]:u},[]);return az(t,o,c,r==null?void 0:r.class,r==null?void 0:r.className)};/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ave=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),BJ=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var Eve={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.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Cve=S.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...l},c)=>S.createElement("svg",{ref:c,...Eve,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:BJ("lucide",s),...l},[...o.map(([u,d])=>S.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Oe=(t,e)=>{const r=S.forwardRef(({className:n,...s},i)=>S.createElement(Cve,{ref:i,iconNode:e,className:BJ(`lucide-${Ave(t)}`,n),...s}));return r.displayName=`${t}`,r};/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const oz=Oe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kve=Oe("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Tve=Oe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Oa=Oe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pve=Oe("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ove=Oe("BookCheck",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 9.5 2 2 4-4",key:"1dth82"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Js=Oe("BookOpen",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lz=Oe("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cz=Oe("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const UJ=Oe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zJ=Oe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const uz=Oe("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dz=Oe("Calendar",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hm=Oe("ChartColumn",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yn=Oe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vc=Oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ive=Oe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const HJ=Oe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const WJ=Oe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ww=Oe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gl=Oe("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dc=Oe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Rve=Oe("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Mve=Oe("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Dve=Oe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gD=Oe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Lve=Oe("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zP=Oe("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sb=Oe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fve=Oe("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const VJ=Oe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bn=Oe("Copy",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $ve=Oe("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bve=Oe("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mo=Oe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Uve=Oe("Ellipsis",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ib=Oe("ExternalLink",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ME=Oe("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qi=Oe("Eye",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hz=Oe("FileDown",[["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:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zve=Oe("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qJ=Oe("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nr=Oe("FileText",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hve=Oe("FileType",[["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 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wve=Oe("FileX",[["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:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vve=Oe("File",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qve=Oe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const DE=Oe("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gve=Oe("Globe",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const GJ=Oe("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kve=Oe("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yve=Oe("HardDrive",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xve=Oe("History",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Oj=Oe("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wm=Oe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const KJ=Oe("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qve=Oe("LayoutDashboard",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hf=Oe("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const St=Oe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xs=Oe("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $F=Oe("Lock",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zve=Oe("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const YJ=Oe("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jve=Oe("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ebe=Oe("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const BF=Oe("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tbe=Oe("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rbe=Oe("MessageSquareQuote",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 12a2 2 0 0 0 2-2V8H8",key:"1jfesj"}],["path",{d:"M14 12a2 2 0 0 0 2-2V8h-2",key:"1dq9mh"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nbe=Oe("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vm=Oe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sbe=Oe("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const XJ=Oe("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ibe=Oe("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const abe=Oe("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const obe=Oe("MousePointer",[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lbe=Oe("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cbe=Oe("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ube=Oe("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const QJ=Oe("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const LE=Oe("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ZJ=Oe("Pen",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const JJ=Oe("Pencil",[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sl=Oe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dbe=Oe("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ab=Oe("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hbe=Oe("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/**
* @license lucide-react v0.462.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=Oe("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fbe=Oe("RotateCcw",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yD=Oe("Save",[["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"}]]);/**
* @license lucide-react v0.462.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=Oe("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ll=Oe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const UF=Oe("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pbe=Oe("ShieldCheck",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zF=Oe("Shield",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ji=Oe("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mbe=Oe("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xD=Oe("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gbe=Oe("Sun",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ybe=Oe("Target",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ts=Oe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xbe=Oe("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vbe=Oe("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ia=Oe("TriangleAlert",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ku=Oe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ij=Oe("User",[["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"}]]);/**
* @license lucide-react v0.462.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=Oe("Users",[["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"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bbe=Oe("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wbe=Oe("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const En=Oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _be=Oe("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jbe=Oe("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),HF="-",Sbe=t=>{const e=Abe(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const l=o.split(HF);return l[0]===""&&l.length!==1&&l.shift(),nee(l,e)||Nbe(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},nee=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),s=n?nee(t.slice(1),n):void 0;if(s)return s;if(e.validators.length===0)return;const i=t.join(HF);return(o=e.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},fz=/^\[(.+)\]$/,Nbe=t=>{if(fz.test(t)){const e=fz.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},Abe=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return Cbe(Object.entries(t.classGroups),r).forEach(([i,o])=>{vD(o,n,i,e)}),n},vD=(t,e,r,n)=>{t.forEach(s=>{if(typeof s=="string"){const i=s===""?e:pz(e,s);i.classGroupId=r;return}if(typeof s=="function"){if(Ebe(s)){vD(s(n),e,r,n);return}e.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([i,o])=>{vD(o,pz(e,i),r,n)})})},pz=(t,e)=>{let r=t;return e.split(HF).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Ebe=t=>t.isThemeGetter,Cbe=(t,e)=>e?t.map(([r,n])=>{const s=n.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[e+o,l])):i);return[r,s]}):t,kbe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const s=(i,o)=>{r.set(i,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return s(i,o),o},set(i,o){r.has(i)?r.set(i,o):s(i,o)}}},see="!",Tbe=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,s=e[0],i=e.length,o=l=>{const c=[];let u=0,d=0,h;for(let x=0;x<l.length;x++){let y=l[x];if(u===0){if(y===s&&(n||l.slice(x,x+i)===e)){c.push(l.slice(d,x)),d=x+i;continue}if(y==="/"){h=x;continue}}y==="["?u++:y==="]"&&u--}const f=c.length===0?l:l.substring(d),p=f.startsWith(see),g=p?f.substring(1):f,m=h&&h>d?h-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return r?l=>r({className:l,parseClassName:o}):o},Pbe=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},Obe=t=>({cache:kbe(t.cacheSize),parseClassName:Tbe(t),...Sbe(t)}),Ibe=/\s+/,Rbe=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=e,i=[],o=t.trim().split(Ibe);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}=r(u);let g=!!p,m=n(g?f.substring(0,p):f);if(!m){if(!g){l=u+(l.length>0?" "+l:l);continue}if(m=n(f),!m){l=u+(l.length>0?" "+l:l);continue}g=!1}const x=Pbe(d).join(":"),y=h?x+see:x,v=y+m;if(i.includes(v))continue;i.push(v);const b=s(m,g);for(let w=0;w<b.length;++w){const j=b[w];i.push(y+j)}l=u+(l.length>0?" "+l:l)}return l};function Mbe(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=iee(e))&&(n&&(n+=" "),n+=r);return n}const iee=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=iee(t[n]))&&(r&&(r+=" "),r+=e);return r};function Dbe(t,...e){let r,n,s,i=o;function o(c){const u=e.reduce((d,h)=>h(d),t());return r=Obe(u),n=r.cache.get,s=r.cache.set,i=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=Rbe(c,r);return s(c,d),d}return function(){return i(Mbe.apply(null,arguments))}}const $r=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},aee=/^\[(?:([a-z-]+):)?(.+)\]$/i,Lbe=/^\d+\/\d+$/,Fbe=new Set(["px","full","screen"]),$be=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bbe=/\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$/,Ube=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,zbe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Hbe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ic=t=>Ty(t)||Fbe.has(t)||Lbe.test(t),md=t=>ob(t,"length",Qbe),Ty=t=>!!t&&!Number.isNaN(Number(t)),HP=t=>ob(t,"number",Ty),qb=t=>!!t&&Number.isInteger(Number(t)),Wbe=t=>t.endsWith("%")&&Ty(t.slice(0,-1)),Rt=t=>aee.test(t),gd=t=>$be.test(t),Vbe=new Set(["length","size","percentage"]),qbe=t=>ob(t,Vbe,oee),Gbe=t=>ob(t,"position",oee),Kbe=new Set(["image","url"]),Ybe=t=>ob(t,Kbe,Jbe),Xbe=t=>ob(t,"",Zbe),Gb=()=>!0,ob=(t,e,r)=>{const n=aee.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},Qbe=t=>Bbe.test(t)&&!Ube.test(t),oee=()=>!1,Zbe=t=>zbe.test(t),Jbe=t=>Hbe.test(t),e0e=()=>{const t=$r("colors"),e=$r("spacing"),r=$r("blur"),n=$r("brightness"),s=$r("borderColor"),i=$r("borderRadius"),o=$r("borderSpacing"),l=$r("borderWidth"),c=$r("contrast"),u=$r("grayscale"),d=$r("hueRotate"),h=$r("invert"),f=$r("gap"),p=$r("gradientColorStops"),g=$r("gradientColorStopPositions"),m=$r("inset"),x=$r("margin"),y=$r("opacity"),v=$r("padding"),b=$r("saturate"),w=$r("scale"),j=$r("sepia"),N=$r("skew"),C=$r("space"),k=$r("translate"),E=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto",Rt,e],P=()=>[Rt,e],V=()=>["",Ic,md],A=()=>["auto",Ty,Rt],$=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>["start","end","center","between","around","evenly","stretch"],H=()=>["","0",Rt],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>[Ty,Rt];return{cacheSize:500,separator:":",theme:{colors:[Gb],spacing:[Ic,md],blur:["none","",gd,Rt],brightness:L(),borderColor:[t],borderRadius:["none","","full",gd,Rt],borderSpacing:P(),borderWidth:V(),contrast:L(),grayscale:H(),hueRotate:L(),invert:H(),gap:P(),gradientColorStops:[t],gradientColorStopPositions:[Wbe,md],inset:z(),margin:z(),opacity:L(),padding:P(),saturate:L(),scale:L(),sepia:H(),skew:L(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",Rt]}],container:["container"],columns:[{columns:[gd]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"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"],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:[...$(),Rt]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",qb,Rt]}],basis:[{basis:z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Rt]}],grow:[{grow:H()}],shrink:[{shrink:H()}],order:[{order:["first","last","none",qb,Rt]}],"grid-cols":[{"grid-cols":[Gb]}],"col-start-end":[{col:["auto",{span:["full",qb,Rt]},Rt]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[Gb]}],"row-start-end":[{row:["auto",{span:[qb,Rt]},Rt]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Rt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Rt]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Rt,e]}],"min-w":[{"min-w":[Rt,e,"min","max","fit"]}],"max-w":[{"max-w":[Rt,e,"none","full","min","max","fit","prose",{screen:[gd]},gd]}],h:[{h:[Rt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Rt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Rt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Rt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",gd,md]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",HP]}],"font-family":[{font:[Gb]}],"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:["tighter","tight","normal","wide","wider","widest",Rt]}],"line-clamp":[{"line-clamp":["none",Ty,HP]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ic,Rt]}],"list-image":[{"list-image":["none",Rt]}],"list-style-type":[{list:["none","disc","decimal",Rt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ic,md]}],"underline-offset":[{"underline-offset":["auto",Ic,Rt]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Rt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Rt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...$(),Gbe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",qbe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Ybe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...K(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:K()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[Ic,Rt]}],"outline-w":[{outline:[Ic,md]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Ic,md]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",gd,Xbe]}],"shadow-color":[{shadow:[Gb]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",gd,Rt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[b]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Rt]}],duration:[{duration:L()}],ease:[{ease:["linear","in","out","in-out",Rt]}],delay:[{delay:L()}],animate:[{animate:["none","spin","ping","pulse","bounce",Rt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[qb,Rt]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Rt]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],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",Rt]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",Rt]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Ic,md,HP]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-s","border-w-e","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-s","border-color-e","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"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","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-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"]}}},t0e=Dbe(e0e);function Ie(...t){return t0e(Jt(t))}const r0e=Nve,lee=S.forwardRef(({className:t,...e},r)=>a.jsx(IJ,{ref:r,className:Ie("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));lee.displayName=IJ.displayName;const n0e=od("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),cee=S.forwardRef(({className:t,variant:e,...r},n)=>a.jsx(RJ,{ref:n,className:Ie(n0e({variant:e}),t),...r}));cee.displayName=RJ.displayName;const s0e=S.forwardRef(({className:t,...e},r)=>a.jsx(LJ,{ref:r,className:Ie("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));s0e.displayName=LJ.displayName;const uee=S.forwardRef(({className:t,...e},r)=>a.jsx(FJ,{ref:r,className:Ie("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:a.jsx(En,{className:"h-4 w-4"})}));uee.displayName=FJ.displayName;const dee=S.forwardRef(({className:t,...e},r)=>a.jsx(MJ,{ref:r,className:Ie("text-sm font-semibold",t),...e}));dee.displayName=MJ.displayName;const hee=S.forwardRef(({className:t,...e},r)=>a.jsx(DJ,{ref:r,className:Ie("text-sm opacity-90",t),...e}));hee.displayName=DJ.displayName;function i0e(){const{toasts:t}=on();return a.jsxs(r0e,{children:[t.map(function({id:e,title:r,description:n,action:s,...i}){return a.jsxs(cee,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[r&&a.jsx(dee,{children:r}),n&&a.jsx(hee,{children:n})]}),s,a.jsx(uee,{})]},e)}),a.jsx(lee,{})]})}var mz=["light","dark"],a0e="(prefers-color-scheme: dark)",o0e=S.createContext(void 0),l0e={setTheme:t=>{},themes:[]},c0e=()=>{var t;return(t=S.useContext(o0e))!=null?t:l0e};S.memo(({forcedTheme:t,storageKey:e,attribute:r,enableSystem:n,enableColorScheme:s,defaultTheme:i,value:o,attrs:l,nonce:c})=>{let u=i==="system",d=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,h=s?mz.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(g,m=!1,x=!0)=>{let y=o?o[g]:g,v=m?g+"|| ''":`'${y}'`,b="";return s&&x&&!m&&mz.includes(g)&&(b+=`d.style.colorScheme = '${g}';`),r==="class"?m||y?b+=`c.add(${v})`:b+="null":y&&(b+=`d[s](n,${v})`),b},p=t?`!function(){${d}${f(t)}}()`:n?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${a0e}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}${u?"":"else{"+f(i,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}else{${f(i,!1,!1)};}${h}}catch(t){}}();`;return S.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var u0e=t=>{switch(t){case"success":return f0e;case"info":return m0e;case"warning":return p0e;case"error":return g0e;default:return null}},d0e=Array(12).fill(0),h0e=({visible:t,className:e})=>me.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},me.createElement("div",{className:"sonner-spinner"},d0e.map((r,n)=>me.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),f0e=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.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"})),p0e=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},me.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"})),m0e=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.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"})),g0e=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.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"})),y0e=me.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"},me.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),me.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),x0e=()=>{let[t,e]=me.useState(document.hidden);return me.useEffect(()=>{let r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t},bD=1,v0e=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:r,...n}=t,s=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:bD++,i=this.toasts.find(l=>l.id===s),o=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...t,id:s,title:r}),{...l,...t,id:s,dismissible:o,title:r}):l):this.addToast({title:r,...n,dismissible:o,id:s}),s},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(r=>r({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let r;e.loading!==void 0&&(r=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let n=t instanceof Promise?t:t(),s=r!==void 0,i,o=n.then(async c=>{if(i=["resolve",c],me.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(w0e(c)&&!c.ok){s=!1;let u=typeof e.error=="function"?await e.error(`HTTP error! status: ${c.status}`):e.error,d=typeof e.description=="function"?await e.description(`HTTP error! status: ${c.status}`):e.description;this.create({id:r,type:"error",message:u,description:d})}else if(e.success!==void 0){s=!1;let u=typeof e.success=="function"?await e.success(c):e.success,d=typeof e.description=="function"?await e.description(c):e.description;this.create({id:r,type:"success",message:u,description:d})}}).catch(async c=>{if(i=["reject",c],e.error!==void 0){s=!1;let u=typeof e.error=="function"?await e.error(c):e.error,d=typeof e.description=="function"?await e.description(c):e.description;this.create({id:r,type:"error",message:u,description:d})}}).finally(()=>{var c;s&&(this.dismiss(r),r=void 0),(c=e.finally)==null||c.call(e)}),l=()=>new Promise((c,u)=>o.then(()=>i[0]==="reject"?u(i[1]):c(i[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(t,e)=>{let r=(e==null?void 0:e.id)||bD++;return this.create({jsx:t(r),id:r,...e}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Li=new v0e,b0e=(t,e)=>{let r=(e==null?void 0:e.id)||bD++;return Li.addToast({title:t,...e,id:r}),r},w0e=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",_0e=b0e,j0e=()=>Li.toasts,S0e=()=>Li.getActiveToasts(),$e=Object.assign(_0e,{success:Li.success,info:Li.info,warning:Li.warning,error:Li.error,custom:Li.custom,message:Li.message,promise:Li.promise,dismiss:Li.dismiss,loading:Li.loading},{getHistory:j0e,getToasts:S0e});function N0e(t,{insertAt:e}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}N0e(`:where(html[dir="ltr"]),:where([data-sonner-toaster][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%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][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%)}:where([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:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([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);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([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 #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([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)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([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;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([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);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-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([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}:where([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}:where([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, 0px)) translate(var(--swipe-amount-x, 0px));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{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{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{0%{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-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--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-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-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-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, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--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-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-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],[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],[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],[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],[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:nth-child(1){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)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{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 rN(t){return t.label!==void 0}var A0e=3,E0e="32px",C0e="16px",gz=4e3,k0e=356,T0e=14,P0e=20,O0e=200;function ko(...t){return t.filter(Boolean).join(" ")}function I0e(t){let[e,r]=t.split("-"),n=[];return e&&n.push(e),r&&n.push(r),n}var R0e=t=>{var e,r,n,s,i,o,l,c,u,d,h;let{invert:f,toast:p,unstyled:g,interacting:m,setHeights:x,visibleToasts:y,heights:v,index:b,toasts:w,expanded:j,removeToast:N,defaultRichColors:C,closeButton:k,style:E,cancelButtonStyle:M,actionButtonStyle:z,className:P="",descriptionClassName:V="",duration:A,position:$,gap:K,loadingIcon:G,expandByDefault:Y,classNames:H,icons:B,closeButtonAriaLabel:L="Close toast",pauseWhenPageIsHidden:F}=t,[W,X]=me.useState(null),[oe,le]=me.useState(null),[U,R]=me.useState(!1),[ee,te]=me.useState(!1),[Z,J]=me.useState(!1),[he,O]=me.useState(!1),[ie,q]=me.useState(!1),[I,T]=me.useState(0),[D,ne]=me.useState(0),ue=me.useRef(p.duration||A||gz),re=me.useRef(null),pe=me.useRef(null),ve=b===0,xe=b+1<=y,ae=p.type,de=p.dismissible!==!1,ge=p.className||"",we=p.descriptionClassName||"",je=me.useMemo(()=>v.findIndex(Ve=>Ve.toastId===p.id)||0,[v,p.id]),Se=me.useMemo(()=>{var Ve;return(Ve=p.closeButton)!=null?Ve:k},[p.closeButton,k]),Ue=me.useMemo(()=>p.duration||A||gz,[p.duration,A]),Ae=me.useRef(0),fe=me.useRef(0),Ee=me.useRef(0),Ce=me.useRef(null),[Ge,ht]=$.split("-"),Ne=me.useMemo(()=>v.reduce((Ve,mt,Et)=>Et>=je?Ve:Ve+mt.height,0),[v,je]),Ze=x0e(),Ke=p.invert||f,Xe=ae==="loading";fe.current=me.useMemo(()=>je*K+Ne,[je,Ne]),me.useEffect(()=>{ue.current=Ue},[Ue]),me.useEffect(()=>{R(!0)},[]),me.useEffect(()=>{let Ve=pe.current;if(Ve){let mt=Ve.getBoundingClientRect().height;return ne(mt),x(Et=>[{toastId:p.id,height:mt,position:p.position},...Et]),()=>x(Et=>Et.filter(Fs=>Fs.toastId!==p.id))}},[x,p.id]),me.useLayoutEffect(()=>{if(!U)return;let Ve=pe.current,mt=Ve.style.height;Ve.style.height="auto";let Et=Ve.getBoundingClientRect().height;Ve.style.height=mt,ne(Et),x(Fs=>Fs.find(rs=>rs.toastId===p.id)?Fs.map(rs=>rs.toastId===p.id?{...rs,height:Et}:rs):[{toastId:p.id,height:Et,position:p.position},...Fs])},[U,p.title,p.description,x,p.id]);let Ye=me.useCallback(()=>{te(!0),T(fe.current),x(Ve=>Ve.filter(mt=>mt.toastId!==p.id)),setTimeout(()=>{N(p)},O0e)},[p,N,x,fe]);me.useEffect(()=>{if(p.promise&&ae==="loading"||p.duration===1/0||p.type==="loading")return;let Ve;return j||m||F&&Ze?(()=>{if(Ee.current<Ae.current){let mt=new Date().getTime()-Ae.current;ue.current=ue.current-mt}Ee.current=new Date().getTime()})():ue.current!==1/0&&(Ae.current=new Date().getTime(),Ve=setTimeout(()=>{var mt;(mt=p.onAutoClose)==null||mt.call(p,p),Ye()},ue.current)),()=>clearTimeout(Ve)},[j,m,p,ae,F,Ze,Ye]),me.useEffect(()=>{p.delete&&Ye()},[Ye,p.delete]);function Ct(){var Ve,mt,Et;return B!=null&&B.loading?me.createElement("div",{className:ko(H==null?void 0:H.loader,(Ve=p==null?void 0:p.classNames)==null?void 0:Ve.loader,"sonner-loader"),"data-visible":ae==="loading"},B.loading):G?me.createElement("div",{className:ko(H==null?void 0:H.loader,(mt=p==null?void 0:p.classNames)==null?void 0:mt.loader,"sonner-loader"),"data-visible":ae==="loading"},G):me.createElement(h0e,{className:ko(H==null?void 0:H.loader,(Et=p==null?void 0:p.classNames)==null?void 0:Et.loader),visible:ae==="loading"})}return me.createElement("li",{tabIndex:0,ref:pe,className:ko(P,ge,H==null?void 0:H.toast,(e=p==null?void 0:p.classNames)==null?void 0:e.toast,H==null?void 0:H.default,H==null?void 0:H[ae],(r=p==null?void 0:p.classNames)==null?void 0:r[ae]),"data-sonner-toast":"","data-rich-colors":(n=p.richColors)!=null?n:C,"data-styled":!(p.jsx||p.unstyled||g),"data-mounted":U,"data-promise":!!p.promise,"data-swiped":ie,"data-removed":ee,"data-visible":xe,"data-y-position":Ge,"data-x-position":ht,"data-index":b,"data-front":ve,"data-swiping":Z,"data-dismissible":de,"data-type":ae,"data-invert":Ke,"data-swipe-out":he,"data-swipe-direction":oe,"data-expanded":!!(j||Y&&U),style:{"--index":b,"--toasts-before":b,"--z-index":w.length-b,"--offset":`${ee?I:fe.current}px`,"--initial-height":Y?"auto":`${D}px`,...E,...p.style},onDragEnd:()=>{J(!1),X(null),Ce.current=null},onPointerDown:Ve=>{Xe||!de||(re.current=new Date,T(fe.current),Ve.target.setPointerCapture(Ve.pointerId),Ve.target.tagName!=="BUTTON"&&(J(!0),Ce.current={x:Ve.clientX,y:Ve.clientY}))},onPointerUp:()=>{var Ve,mt,Et,Fs;if(he||!de)return;Ce.current=null;let rs=Number(((Ve=pe.current)==null?void 0:Ve.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ra=Number(((mt=pe.current)==null?void 0:mt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),$a=new Date().getTime()-((Et=re.current)==null?void 0:Et.getTime()),$s=W==="x"?rs:ra,na=Math.abs($s)/$a;if(Math.abs($s)>=P0e||na>.11){T(fe.current),(Fs=p.onDismiss)==null||Fs.call(p,p),le(W==="x"?rs>0?"right":"left":ra>0?"down":"up"),Ye(),O(!0),q(!1);return}J(!1),X(null)},onPointerMove:Ve=>{var mt,Et,Fs,rs;if(!Ce.current||!de||((mt=window.getSelection())==null?void 0:mt.toString().length)>0)return;let ra=Ve.clientY-Ce.current.y,$a=Ve.clientX-Ce.current.x,$s=(Et=t.swipeDirections)!=null?Et:I0e($);!W&&(Math.abs($a)>1||Math.abs(ra)>1)&&X(Math.abs($a)>Math.abs(ra)?"x":"y");let na={x:0,y:0};W==="y"?($s.includes("top")||$s.includes("bottom"))&&($s.includes("top")&&ra<0||$s.includes("bottom")&&ra>0)&&(na.y=ra):W==="x"&&($s.includes("left")||$s.includes("right"))&&($s.includes("left")&&$a<0||$s.includes("right")&&$a>0)&&(na.x=$a),(Math.abs(na.x)>0||Math.abs(na.y)>0)&&q(!0),(Fs=pe.current)==null||Fs.style.setProperty("--swipe-amount-x",`${na.x}px`),(rs=pe.current)==null||rs.style.setProperty("--swipe-amount-y",`${na.y}px`)}},Se&&!p.jsx?me.createElement("button",{"aria-label":L,"data-disabled":Xe,"data-close-button":!0,onClick:Xe||!de?()=>{}:()=>{var Ve;Ye(),(Ve=p.onDismiss)==null||Ve.call(p,p)},className:ko(H==null?void 0:H.closeButton,(s=p==null?void 0:p.classNames)==null?void 0:s.closeButton)},(i=B==null?void 0:B.close)!=null?i:y0e):null,p.jsx||S.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:me.createElement(me.Fragment,null,ae||p.icon||p.promise?me.createElement("div",{"data-icon":"",className:ko(H==null?void 0:H.icon,(o=p==null?void 0:p.classNames)==null?void 0:o.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||Ct():null,p.type!=="loading"?p.icon||(B==null?void 0:B[ae])||u0e(ae):null):null,me.createElement("div",{"data-content":"",className:ko(H==null?void 0:H.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},me.createElement("div",{"data-title":"",className:ko(H==null?void 0:H.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?me.createElement("div",{"data-description":"",className:ko(V,we,H==null?void 0:H.description,(u=p==null?void 0:p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),S.isValidElement(p.cancel)?p.cancel:p.cancel&&rN(p.cancel)?me.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||M,onClick:Ve=>{var mt,Et;rN(p.cancel)&&de&&((Et=(mt=p.cancel).onClick)==null||Et.call(mt,Ve),Ye())},className:ko(H==null?void 0:H.cancelButton,(d=p==null?void 0:p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,S.isValidElement(p.action)?p.action:p.action&&rN(p.action)?me.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||z,onClick:Ve=>{var mt,Et;rN(p.action)&&((Et=(mt=p.action).onClick)==null||Et.call(mt,Ve),!Ve.defaultPrevented&&Ye())},className:ko(H==null?void 0:H.actionButton,(h=p==null?void 0:p.classNames)==null?void 0:h.actionButton)},p.action.label):null))};function yz(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function M0e(t,e){let r={};return[t,e].forEach((n,s)=>{let i=s===1,o=i?"--mobile-offset":"--offset",l=i?C0e:E0e;function c(u){["top","right","bottom","left"].forEach(d=>{r[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${o}-${u}`]=l:r[`${o}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):c(l)}),r}var D0e=S.forwardRef(function(t,e){let{invert:r,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:h,duration:f,style:p,visibleToasts:g=A0e,toastOptions:m,dir:x=yz(),gap:y=T0e,loadingIcon:v,icons:b,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:j}=t,[N,C]=me.useState([]),k=me.useMemo(()=>Array.from(new Set([n].concat(N.filter(F=>F.position).map(F=>F.position)))),[N,n]),[E,M]=me.useState([]),[z,P]=me.useState(!1),[V,A]=me.useState(!1),[$,K]=me.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=me.useRef(null),Y=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=me.useRef(null),B=me.useRef(!1),L=me.useCallback(F=>{C(W=>{var X;return(X=W.find(oe=>oe.id===F.id))!=null&&X.delete||Li.dismiss(F.id),W.filter(({id:oe})=>oe!==F.id)})},[]);return me.useEffect(()=>Li.subscribe(F=>{if(F.dismiss){C(W=>W.map(X=>X.id===F.id?{...X,delete:!0}:X));return}setTimeout(()=>{iJ.flushSync(()=>{C(W=>{let X=W.findIndex(oe=>oe.id===F.id);return X!==-1?[...W.slice(0,X),{...W[X],...F},...W.slice(X+1)]:[F,...W]})})})}),[]),me.useEffect(()=>{if(d!=="system"){K(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;let F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:W})=>{K(W?"dark":"light")})}catch{F.addListener(({matches:X})=>{try{K(X?"dark":"light")}catch(oe){console.error(oe)}})}},[d]),me.useEffect(()=>{N.length<=1&&P(!1)},[N]),me.useEffect(()=>{let F=W=>{var X,oe;s.every(le=>W[le]||W.code===le)&&(P(!0),(X=G.current)==null||X.focus()),W.code==="Escape"&&(document.activeElement===G.current||(oe=G.current)!=null&&oe.contains(document.activeElement))&&P(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[s]),me.useEffect(()=>{if(G.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,B.current=!1)}},[G.current]),me.createElement("section",{ref:e,"aria-label":`${w} ${Y}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},k.map((F,W)=>{var X;let[oe,le]=F.split("-");return N.length?me.createElement("ol",{key:F,dir:x==="auto"?yz():x,tabIndex:-1,ref:G,className:l,"data-sonner-toaster":!0,"data-theme":$,"data-y-position":oe,"data-lifted":z&&N.length>1&&!i,"data-x-position":le,style:{"--front-toast-height":`${((X=E[0])==null?void 0:X.height)||0}px`,"--width":`${k0e}px`,"--gap":`${y}px`,...p,...M0e(c,u)},onBlur:U=>{B.current&&!U.currentTarget.contains(U.relatedTarget)&&(B.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:U=>{U.target instanceof HTMLElement&&U.target.dataset.dismissible==="false"||B.current||(B.current=!0,H.current=U.relatedTarget)},onMouseEnter:()=>P(!0),onMouseMove:()=>P(!0),onMouseLeave:()=>{V||P(!1)},onDragEnd:()=>P(!1),onPointerDown:U=>{U.target instanceof HTMLElement&&U.target.dataset.dismissible==="false"||A(!0)},onPointerUp:()=>A(!1)},N.filter(U=>!U.position&&W===0||U.position===F).map((U,R)=>{var ee,te;return me.createElement(R0e,{key:U.id,icons:b,index:R,toast:U,defaultRichColors:h,duration:(ee=m==null?void 0:m.duration)!=null?ee:f,className:m==null?void 0:m.className,descriptionClassName:m==null?void 0:m.descriptionClassName,invert:r,visibleToasts:g,closeButton:(te=m==null?void 0:m.closeButton)!=null?te:o,interacting:V,position:F,style:m==null?void 0:m.style,unstyled:m==null?void 0:m.unstyled,classNames:m==null?void 0:m.classNames,cancelButtonStyle:m==null?void 0:m.cancelButtonStyle,actionButtonStyle:m==null?void 0:m.actionButtonStyle,removeToast:L,toasts:N.filter(Z=>Z.position==U.position),heights:E.filter(Z=>Z.position==U.position),setHeights:M,expandByDefault:i,gap:y,loadingIcon:v,expanded:z,pauseWhenPageIsHidden:j,swipeDirections:t.swipeDirections})})):null}))});const L0e=({...t})=>{const{theme:e="system"}=c0e();return a.jsx(D0e,{theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})};var F0e=H3[" useId ".trim().toString()]||(()=>{}),$0e=0;function Yi(t){const[e,r]=S.useState(F0e());return vn(()=>{r(n=>n??String($0e++))},[t]),e?`radix-${e}`:""}const B0e=["top","right","bottom","left"],Zh=Math.min,Na=Math.max,FE=Math.round,nN=Math.floor,hc=t=>({x:t,y:t}),U0e={left:"right",right:"left",bottom:"top",top:"bottom"},z0e={start:"end",end:"start"};function wD(t,e,r){return Na(t,Zh(e,r))}function Yu(t,e){return typeof t=="function"?t(e):t}function Xu(t){return t.split("-")[0]}function lb(t){return t.split("-")[1]}function WF(t){return t==="x"?"y":"x"}function VF(t){return t==="y"?"height":"width"}const H0e=new Set(["top","bottom"]);function ac(t){return H0e.has(Xu(t))?"y":"x"}function qF(t){return WF(ac(t))}function W0e(t,e,r){r===void 0&&(r=!1);const n=lb(t),s=qF(t),i=VF(s);let o=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=$E(o)),[o,$E(o)]}function V0e(t){const e=$E(t);return[_D(t),e,_D(e)]}function _D(t){return t.replace(/start|end/g,e=>z0e[e])}const xz=["left","right"],vz=["right","left"],q0e=["top","bottom"],G0e=["bottom","top"];function K0e(t,e,r){switch(t){case"top":case"bottom":return r?e?vz:xz:e?xz:vz;case"left":case"right":return e?q0e:G0e;default:return[]}}function Y0e(t,e,r,n){const s=lb(t);let i=K0e(Xu(t),r==="start",n);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(_D)))),i}function $E(t){return t.replace(/left|right|bottom|top/g,e=>U0e[e])}function X0e(t){return{top:0,right:0,bottom:0,left:0,...t}}function fee(t){return typeof t!="number"?X0e(t):{top:t,right:t,bottom:t,left:t}}function BE(t){const{x:e,y:r,width:n,height:s}=t;return{width:n,height:s,top:r,left:e,right:e+n,bottom:r+s,x:e,y:r}}function bz(t,e,r){let{reference:n,floating:s}=t;const i=ac(e),o=qF(e),l=VF(o),c=Xu(e),u=i==="y",d=n.x+n.width/2-s.width/2,h=n.y+n.height/2-s.height/2,f=n[l]/2-s[l]/2;let p;switch(c){case"top":p={x:d,y:n.y-s.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:h};break;case"left":p={x:n.x-s.width,y:h};break;default:p={x:n.x,y:n.y}}switch(lb(e)){case"start":p[o]-=f*(r&&u?-1:1);break;case"end":p[o]+=f*(r&&u?-1:1);break}return p}const Q0e=async(t,e,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:i=[],platform:o}=r,l=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:h}=bz(u,n,c),f=n,p={},g=0;for(let m=0;m<l.length;m++){const{name:x,fn:y}=l[m],{x:v,y:b,data:w,reset:j}=await y({x:d,y:h,initialPlacement:n,placement:f,strategy:s,middlewareData:p,rects:u,platform:o,elements:{reference:t,floating:e}});d=v??d,h=b??h,p={...p,[x]:{...p[x],...w}},j&&g<=50&&(g++,typeof j=="object"&&(j.placement&&(f=j.placement),j.rects&&(u=j.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):j.rects),{x:d,y:h}=bz(u,f,c)),m=-1)}return{x:d,y:h,placement:f,strategy:s,middlewareData:p}};async function Vw(t,e){var r;e===void 0&&(e={});const{x:n,y:s,platform:i,rects:o,elements:l,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:p=0}=Yu(e,t),g=fee(p),x=l[f?h==="floating"?"reference":"floating":h],y=BE(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(x)))==null||r?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),v=h==="floating"?{x:n,y:s,width:o.floating.width,height:o.floating.height}:o.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},j=BE(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:b,strategy:c}):v);return{top:(y.top-j.top+g.top)/w.y,bottom:(j.bottom-y.bottom+g.bottom)/w.y,left:(y.left-j.left+g.left)/w.x,right:(j.right-y.right+g.right)/w.x}}const Z0e=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=e,{element:u,padding:d=0}=Yu(t,e)||{};if(u==null)return{};const h=fee(d),f={x:r,y:n},p=qF(s),g=VF(p),m=await o.getDimensions(u),x=p==="y",y=x?"top":"left",v=x?"bottom":"right",b=x?"clientHeight":"clientWidth",w=i.reference[g]+i.reference[p]-f[p]-i.floating[g],j=f[p]-i.reference[p],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let C=N?N[b]:0;(!C||!await(o.isElement==null?void 0:o.isElement(N)))&&(C=l.floating[b]||i.floating[g]);const k=w/2-j/2,E=C/2-m[g]/2-1,M=Zh(h[y],E),z=Zh(h[v],E),P=M,V=C-m[g]-z,A=C/2-m[g]/2+k,$=wD(P,A,V),K=!c.arrow&&lb(s)!=null&&A!==$&&i.reference[g]/2-(A<P?M:z)-m[g]/2<0,G=K?A<P?A-P:A-V:0;return{[p]:f[p]+G,data:{[p]:$,centerOffset:A-$-G,...K&&{alignmentOffset:G}},reset:K}}}),J0e=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...x}=Yu(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const y=Xu(s),v=ac(l),b=Xu(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=f||(b||!m?[$E(l)]:V0e(l)),N=g!=="none";!f&&N&&j.push(...Y0e(l,m,g,w));const C=[l,...j],k=await Vw(e,x),E=[];let M=((n=i.flip)==null?void 0:n.overflows)||[];if(d&&E.push(k[y]),h){const A=W0e(s,o,w);E.push(k[A[0]],k[A[1]])}if(M=[...M,{placement:s,overflows:E}],!E.every(A=>A<=0)){var z,P;const A=(((z=i.flip)==null?void 0:z.index)||0)+1,$=C[A];if($&&(!(h==="alignment"?v!==ac($):!1)||M.every(Y=>ac(Y.placement)===v?Y.overflows[0]>0:!0)))return{data:{index:A,overflows:M},reset:{placement:$}};let K=(P=M.filter(G=>G.overflows[0]<=0).sort((G,Y)=>G.overflows[1]-Y.overflows[1])[0])==null?void 0:P.placement;if(!K)switch(p){case"bestFit":{var V;const G=(V=M.filter(Y=>{if(N){const H=ac(Y.placement);return H===v||H==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(H=>H>0).reduce((H,B)=>H+B,0)]).sort((Y,H)=>Y[1]-H[1])[0])==null?void 0:V[0];G&&(K=G);break}case"initialPlacement":K=l;break}if(s!==K)return{reset:{placement:K}}}return{}}}};function wz(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function _z(t){return B0e.some(e=>t[e]>=0)}const ewe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...s}=Yu(t,e);switch(n){case"referenceHidden":{const i=await Vw(e,{...s,elementContext:"reference"}),o=wz(i,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:_z(o)}}}case"escaped":{const i=await Vw(e,{...s,altBoundary:!0}),o=wz(i,r.floating);return{data:{escapedOffsets:o,escaped:_z(o)}}}default:return{}}}}},pee=new Set(["left","top"]);async function twe(t,e){const{placement:r,platform:n,elements:s}=t,i=await(n.isRTL==null?void 0:n.isRTL(s.floating)),o=Xu(r),l=lb(r),c=ac(r)==="y",u=pee.has(o)?-1:1,d=i&&c?-1:1,h=Yu(e,t);let{mainAxis:f,crossAxis:p,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),c?{x:p*d,y:f*u}:{x:f*u,y:p*d}}const rwe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:s,y:i,placement:o,middlewareData:l}=e,c=await twe(e,t);return o===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},nwe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:s}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:x=>{let{x:y,y:v}=x;return{x:y,y:v}}},...c}=Yu(t,e),u={x:r,y:n},d=await Vw(e,c),h=ac(Xu(s)),f=WF(h);let p=u[f],g=u[h];if(i){const x=f==="y"?"top":"left",y=f==="y"?"bottom":"right",v=p+d[x],b=p-d[y];p=wD(v,p,b)}if(o){const x=h==="y"?"top":"left",y=h==="y"?"bottom":"right",v=g+d[x],b=g-d[y];g=wD(v,g,b)}const m=l.fn({...e,[f]:p,[h]:g});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[f]:i,[h]:o}}}}}},swe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:s,rects:i,middlewareData:o}=e,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Yu(t,e),d={x:r,y:n},h=ac(s),f=WF(h);let p=d[f],g=d[h];const m=Yu(l,e),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const b=f==="y"?"height":"width",w=i.reference[f]-i.floating[b]+x.mainAxis,j=i.reference[f]+i.reference[b]-x.mainAxis;p<w?p=w:p>j&&(p=j)}if(u){var y,v;const b=f==="y"?"width":"height",w=pee.has(Xu(s)),j=i.reference[h]-i.floating[b]+(w&&((y=o.offset)==null?void 0:y[h])||0)+(w?0:x.crossAxis),N=i.reference[h]+i.reference[b]+(w?0:((v=o.offset)==null?void 0:v[h])||0)-(w?x.crossAxis:0);g<j?g=j:g>N&&(g=N)}return{[f]:p,[h]:g}}}},iwe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,n;const{placement:s,rects:i,platform:o,elements:l}=e,{apply:c=()=>{},...u}=Yu(t,e),d=await Vw(e,u),h=Xu(s),f=lb(s),p=ac(s)==="y",{width:g,height:m}=i.floating;let x,y;h==="top"||h==="bottom"?(x=h,y=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(y=h,x=f==="end"?"top":"bottom");const v=m-d.top-d.bottom,b=g-d.left-d.right,w=Zh(m-d[x],v),j=Zh(g-d[y],b),N=!e.middlewareData.shift;let C=w,k=j;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(k=b),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(C=v),N&&!f){const M=Na(d.left,0),z=Na(d.right,0),P=Na(d.top,0),V=Na(d.bottom,0);p?k=g-2*(M!==0||z!==0?M+z:Na(d.left,d.right)):C=m-2*(P!==0||V!==0?P+V:Na(d.top,d.bottom))}await c({...e,availableWidth:k,availableHeight:C});const E=await o.getDimensions(l.floating);return g!==E.width||m!==E.height?{reset:{rects:!0}}:{}}}};function iT(){return typeof window<"u"}function cb(t){return mee(t)?(t.nodeName||"").toLowerCase():"#document"}function Ra(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ec(t){var e;return(e=(mee(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function mee(t){return iT()?t instanceof Node||t instanceof Ra(t).Node:!1}function dl(t){return iT()?t instanceof Element||t instanceof Ra(t).Element:!1}function bc(t){return iT()?t instanceof HTMLElement||t instanceof Ra(t).HTMLElement:!1}function jz(t){return!iT()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ra(t).ShadowRoot}const awe=new Set(["inline","contents"]);function Rj(t){const{overflow:e,overflowX:r,overflowY:n,display:s}=hl(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!awe.has(s)}const owe=new Set(["table","td","th"]);function lwe(t){return owe.has(cb(t))}const cwe=[":popover-open",":modal"];function aT(t){return cwe.some(e=>{try{return t.matches(e)}catch{return!1}})}const uwe=["transform","translate","scale","rotate","perspective"],dwe=["transform","translate","scale","rotate","perspective","filter"],hwe=["paint","layout","strict","content"];function GF(t){const e=KF(),r=dl(t)?hl(t):t;return uwe.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||dwe.some(n=>(r.willChange||"").includes(n))||hwe.some(n=>(r.contain||"").includes(n))}function fwe(t){let e=Jh(t);for(;bc(e)&&!vv(e);){if(GF(e))return e;if(aT(e))return null;e=Jh(e)}return null}function KF(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const pwe=new Set(["html","body","#document"]);function vv(t){return pwe.has(cb(t))}function hl(t){return Ra(t).getComputedStyle(t)}function oT(t){return dl(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Jh(t){if(cb(t)==="html")return t;const e=t.assignedSlot||t.parentNode||jz(t)&&t.host||Ec(t);return jz(e)?e.host:e}function gee(t){const e=Jh(t);return vv(e)?t.ownerDocument?t.ownerDocument.body:t.body:bc(e)&&Rj(e)?e:gee(e)}function qw(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const s=gee(t),i=s===((n=t.ownerDocument)==null?void 0:n.body),o=Ra(s);if(i){const l=jD(o);return e.concat(o,o.visualViewport||[],Rj(s)?s:[],l&&r?qw(l):[])}return e.concat(s,qw(s,[],r))}function jD(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function yee(t){const e=hl(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=bc(t),i=s?t.offsetWidth:r,o=s?t.offsetHeight:n,l=FE(r)!==i||FE(n)!==o;return l&&(r=i,n=o),{width:r,height:n,$:l}}function YF(t){return dl(t)?t:t.contextElement}function Py(t){const e=YF(t);if(!bc(e))return hc(1);const r=e.getBoundingClientRect(),{width:n,height:s,$:i}=yee(e);let o=(i?FE(r.width):r.width)/n,l=(i?FE(r.height):r.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const mwe=hc(0);function xee(t){const e=Ra(t);return!KF()||!e.visualViewport?mwe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function gwe(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Ra(t)?!1:e}function qm(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const s=t.getBoundingClientRect(),i=YF(t);let o=hc(1);e&&(n?dl(n)&&(o=Py(n)):o=Py(t));const l=gwe(i,r,n)?xee(i):hc(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,h=s.height/o.y;if(i){const f=Ra(i),p=n&&dl(n)?Ra(n):n;let g=f,m=jD(g);for(;m&&n&&p!==g;){const x=Py(m),y=m.getBoundingClientRect(),v=hl(m),b=y.left+(m.clientLeft+parseFloat(v.paddingLeft))*x.x,w=y.top+(m.clientTop+parseFloat(v.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,h*=x.y,c+=b,u+=w,g=Ra(m),m=jD(g)}}return BE({width:d,height:h,x:c,y:u})}function lT(t,e){const r=oT(t).scrollLeft;return e?e.left+r:qm(Ec(t)).left+r}function vee(t,e){const r=t.getBoundingClientRect(),n=r.left+e.scrollLeft-lT(t,r),s=r.top+e.scrollTop;return{x:n,y:s}}function ywe(t){let{elements:e,rect:r,offsetParent:n,strategy:s}=t;const i=s==="fixed",o=Ec(n),l=e?aT(e.floating):!1;if(n===o||l&&i)return r;let c={scrollLeft:0,scrollTop:0},u=hc(1);const d=hc(0),h=bc(n);if((h||!h&&!i)&&((cb(n)!=="body"||Rj(o))&&(c=oT(n)),bc(n))){const p=qm(n);u=Py(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}const f=o&&!h&&!i?vee(o,c):hc(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+f.x,y:r.y*u.y-c.scrollTop*u.y+d.y+f.y}}function xwe(t){return Array.from(t.getClientRects())}function vwe(t){const e=Ec(t),r=oT(t),n=t.ownerDocument.body,s=Na(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Na(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+lT(t);const l=-r.scrollTop;return hl(n).direction==="rtl"&&(o+=Na(e.clientWidth,n.clientWidth)-s),{width:s,height:i,x:o,y:l}}const Sz=25;function bwe(t,e){const r=Ra(t),n=Ec(t),s=r.visualViewport;let i=n.clientWidth,o=n.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const d=KF();(!d||d&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=lT(n);if(u<=0){const d=n.ownerDocument,h=d.body,f=getComputedStyle(h),p=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,g=Math.abs(n.clientWidth-h.clientWidth-p);g<=Sz&&(i-=g)}else u<=Sz&&(i+=u);return{width:i,height:o,x:l,y:c}}const wwe=new Set(["absolute","fixed"]);function _we(t,e){const r=qm(t,!0,e==="fixed"),n=r.top+t.clientTop,s=r.left+t.clientLeft,i=bc(t)?Py(t):hc(1),o=t.clientWidth*i.x,l=t.clientHeight*i.y,c=s*i.x,u=n*i.y;return{width:o,height:l,x:c,y:u}}function Nz(t,e,r){let n;if(e==="viewport")n=bwe(t,r);else if(e==="document")n=vwe(Ec(t));else if(dl(e))n=_we(e,r);else{const s=xee(t);n={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return BE(n)}function bee(t,e){const r=Jh(t);return r===e||!dl(r)||vv(r)?!1:hl(r).position==="fixed"||bee(r,e)}function jwe(t,e){const r=e.get(t);if(r)return r;let n=qw(t,[],!1).filter(l=>dl(l)&&cb(l)!=="body"),s=null;const i=hl(t).position==="fixed";let o=i?Jh(t):t;for(;dl(o)&&!vv(o);){const l=hl(o),c=GF(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&wwe.has(s.position)||Rj(o)&&!c&&bee(t,o))?n=n.filter(d=>d!==o):s=l,o=Jh(o)}return e.set(t,n),n}function Swe(t){let{element:e,boundary:r,rootBoundary:n,strategy:s}=t;const o=[...r==="clippingAncestors"?aT(e)?[]:jwe(e,this._c):[].concat(r),n],l=o[0],c=o.reduce((u,d)=>{const h=Nz(e,d,s);return u.top=Na(h.top,u.top),u.right=Zh(h.right,u.right),u.bottom=Zh(h.bottom,u.bottom),u.left=Na(h.left,u.left),u},Nz(e,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Nwe(t){const{width:e,height:r}=yee(t);return{width:e,height:r}}function Awe(t,e,r){const n=bc(e),s=Ec(e),i=r==="fixed",o=qm(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const c=hc(0);function u(){c.x=lT(s)}if(n||!n&&!i)if((cb(e)!=="body"||Rj(s))&&(l=oT(e)),n){const p=qm(e,!0,i,e);c.x=p.x+e.clientLeft,c.y=p.y+e.clientTop}else s&&u();i&&!n&&s&&u();const d=s&&!n&&!i?vee(s,l):hc(0),h=o.left+l.scrollLeft-c.x-d.x,f=o.top+l.scrollTop-c.y-d.y;return{x:h,y:f,width:o.width,height:o.height}}function WP(t){return hl(t).position==="static"}function Az(t,e){if(!bc(t)||hl(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return Ec(t)===r&&(r=r.ownerDocument.body),r}function wee(t,e){const r=Ra(t);if(aT(t))return r;if(!bc(t)){let s=Jh(t);for(;s&&!vv(s);){if(dl(s)&&!WP(s))return s;s=Jh(s)}return r}let n=Az(t,e);for(;n&&lwe(n)&&WP(n);)n=Az(n,e);return n&&vv(n)&&WP(n)&&!GF(n)?r:n||fwe(t)||r}const Ewe=async function(t){const e=this.getOffsetParent||wee,r=this.getDimensions,n=await r(t.floating);return{reference:Awe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Cwe(t){return hl(t).direction==="rtl"}const kwe={convertOffsetParentRelativeRectToViewportRelativeRect:ywe,getDocumentElement:Ec,getClippingRect:Swe,getOffsetParent:wee,getElementRects:Ewe,getClientRects:xwe,getDimensions:Nwe,getScale:Py,isElement:dl,isRTL:Cwe};function _ee(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Twe(t,e){let r=null,n;const s=Ec(t);function i(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=t.getBoundingClientRect(),{left:d,top:h,width:f,height:p}=u;if(l||e(),!f||!p)return;const g=nN(h),m=nN(s.clientWidth-(d+f)),x=nN(s.clientHeight-(h+p)),y=nN(d),b={rootMargin:-g+"px "+-m+"px "+-x+"px "+-y+"px",threshold:Na(0,Zh(1,c))||1};let w=!0;function j(N){const C=N[0].intersectionRatio;if(C!==c){if(!w)return o();C?o(!1,C):n=setTimeout(()=>{o(!1,1e-7)},1e3)}C===1&&!_ee(u,t.getBoundingClientRect())&&o(),w=!1}try{r=new IntersectionObserver(j,{...b,root:s.ownerDocument})}catch{r=new IntersectionObserver(j,b)}r.observe(t)}return o(!0),i}function Pwe(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=YF(t),d=s||i?[...u?qw(u):[],...qw(e)]:[];d.forEach(y=>{s&&y.addEventListener("scroll",r,{passive:!0}),i&&y.addEventListener("resize",r)});const h=u&&l?Twe(u,r):null;let f=-1,p=null;o&&(p=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=p)==null||b.observe(e)})),r()}),u&&!c&&p.observe(u),p.observe(e));let g,m=c?qm(t):null;c&&x();function x(){const y=qm(t);m&&!_ee(m,y)&&r(),m=y,g=requestAnimationFrame(x)}return r(),()=>{var y;d.forEach(v=>{s&&v.removeEventListener("scroll",r),i&&v.removeEventListener("resize",r)}),h==null||h(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const Owe=rwe,Iwe=nwe,Rwe=J0e,Mwe=iwe,Dwe=ewe,Ez=Z0e,Lwe=swe,Fwe=(t,e,r)=>{const n=new Map,s={platform:kwe,...r},i={...s.platform,_c:n};return Q0e(t,e,{...s,platform:i})};var $we=typeof document<"u",Bwe=function(){},vA=$we?S.useLayoutEffect:Bwe;function UE(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!UE(t[n],e[n]))return!1;return!0}if(s=Object.keys(t),r=s.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,s[n]))return!1;for(n=r;n--!==0;){const i=s[n];if(!(i==="_owner"&&t.$$typeof)&&!UE(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function jee(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Cz(t,e){const r=jee(t);return Math.round(e*r)/r}function VP(t){const e=S.useRef(t);return vA(()=>{e.current=t}),e}function Uwe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[d,h]=S.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=S.useState(n);UE(f,n)||p(n);const[g,m]=S.useState(null),[x,y]=S.useState(null),v=S.useCallback(Y=>{Y!==N.current&&(N.current=Y,m(Y))},[]),b=S.useCallback(Y=>{Y!==C.current&&(C.current=Y,y(Y))},[]),w=i||g,j=o||x,N=S.useRef(null),C=S.useRef(null),k=S.useRef(d),E=c!=null,M=VP(c),z=VP(s),P=VP(u),V=S.useCallback(()=>{if(!N.current||!C.current)return;const Y={placement:e,strategy:r,middleware:f};z.current&&(Y.platform=z.current),Fwe(N.current,C.current,Y).then(H=>{const B={...H,isPositioned:P.current!==!1};A.current&&!UE(k.current,B)&&(k.current=B,Ac.flushSync(()=>{h(B)}))})},[f,e,r,z,P]);vA(()=>{u===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,h(Y=>({...Y,isPositioned:!1})))},[u]);const A=S.useRef(!1);vA(()=>(A.current=!0,()=>{A.current=!1}),[]),vA(()=>{if(w&&(N.current=w),j&&(C.current=j),w&&j){if(M.current)return M.current(w,j,V);V()}},[w,j,V,M,E]);const $=S.useMemo(()=>({reference:N,floating:C,setReference:v,setFloating:b}),[v,b]),K=S.useMemo(()=>({reference:w,floating:j}),[w,j]),G=S.useMemo(()=>{const Y={position:r,left:0,top:0};if(!K.floating)return Y;const H=Cz(K.floating,d.x),B=Cz(K.floating,d.y);return l?{...Y,transform:"translate("+H+"px, "+B+"px)",...jee(K.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:H,top:B}},[r,l,K.floating,d.x,d.y]);return S.useMemo(()=>({...d,update:V,refs:$,elements:K,floatingStyles:G}),[d,V,$,K,G])}const zwe=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:s}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?Ez({element:n.current,padding:s}).fn(r):{}:n?Ez({element:n,padding:s}).fn(r):{}}}},Hwe=(t,e)=>({...Owe(t),options:[t,e]}),Wwe=(t,e)=>({...Iwe(t),options:[t,e]}),Vwe=(t,e)=>({...Lwe(t),options:[t,e]}),qwe=(t,e)=>({...Rwe(t),options:[t,e]}),Gwe=(t,e)=>({...Mwe(t),options:[t,e]}),Kwe=(t,e)=>({...Dwe(t),options:[t,e]}),Ywe=(t,e)=>({...zwe(t),options:[t,e]});var Xwe="Arrow",See=S.forwardRef((t,e)=>{const{children:r,width:n=10,height:s=5,...i}=t;return a.jsx(et.svg,{...i,ref:e,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});See.displayName=Xwe;var Qwe=See;function XF(t){const[e,r]=S.useState(void 0);return vn(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=t.offsetWidth,l=t.offsetHeight;r({width:o,height:l})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var QF="Popper",[Nee,ff]=Bn(QF),[Zwe,Aee]=Nee(QF),Eee=t=>{const{__scopePopper:e,children:r}=t,[n,s]=S.useState(null);return a.jsx(Zwe,{scope:e,anchor:n,onAnchorChange:s,children:r})};Eee.displayName=QF;var Cee="PopperAnchor",kee=S.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...s}=t,i=Aee(Cee,r),o=S.useRef(null),l=Nt(e,o);return S.useEffect(()=>{i.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:a.jsx(et.div,{...s,ref:l})});kee.displayName=Cee;var ZF="PopperContent",[Jwe,e1e]=Nee(ZF),Tee=S.forwardRef((t,e)=>{var U,R,ee,te,Z,J;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=t,x=Aee(ZF,r),[y,v]=S.useState(null),b=Nt(e,he=>v(he)),[w,j]=S.useState(null),N=XF(w),C=(N==null?void 0:N.width)??0,k=(N==null?void 0:N.height)??0,E=n+(i!=="center"?"-"+i:""),M=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},z=Array.isArray(u)?u:[u],P=z.length>0,V={padding:M,boundary:z.filter(r1e),altBoundary:P},{refs:A,floatingStyles:$,placement:K,isPositioned:G,middlewareData:Y}=Uwe({strategy:"fixed",placement:E,whileElementsMounted:(...he)=>Pwe(...he,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[Hwe({mainAxis:s+k,alignmentAxis:o}),c&&Wwe({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Vwe():void 0,...V}),c&&qwe({...V}),Gwe({...V,apply:({elements:he,rects:O,availableWidth:ie,availableHeight:q})=>{const{width:I,height:T}=O.reference,D=he.floating.style;D.setProperty("--radix-popper-available-width",`${ie}px`),D.setProperty("--radix-popper-available-height",`${q}px`),D.setProperty("--radix-popper-anchor-width",`${I}px`),D.setProperty("--radix-popper-anchor-height",`${T}px`)}}),w&&Ywe({element:w,padding:l}),n1e({arrowWidth:C,arrowHeight:k}),f&&Kwe({strategy:"referenceHidden",...V})]}),[H,B]=Iee(K),L=gn(g);vn(()=>{G&&(L==null||L())},[G,L]);const F=(U=Y.arrow)==null?void 0:U.x,W=(R=Y.arrow)==null?void 0:R.y,X=((ee=Y.arrow)==null?void 0:ee.centerOffset)!==0,[oe,le]=S.useState();return vn(()=>{y&&le(window.getComputedStyle(y).zIndex)},[y]),a.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:G?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(te=Y.transformOrigin)==null?void 0:te.x,(Z=Y.transformOrigin)==null?void 0:Z.y].join(" "),...((J=Y.hide)==null?void 0:J.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(Jwe,{scope:r,placedSide:H,onArrowChange:j,arrowX:F,arrowY:W,shouldHideArrow:X,children:a.jsx(et.div,{"data-side":H,"data-align":B,...m,ref:b,style:{...m.style,animation:G?void 0:"none"}})})})});Tee.displayName=ZF;var Pee="PopperArrow",t1e={top:"bottom",right:"left",bottom:"top",left:"right"},Oee=S.forwardRef(function(e,r){const{__scopePopper:n,...s}=e,i=e1e(Pee,n),o=t1e[i.placedSide];return a.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:a.jsx(Qwe,{...s,ref:r,style:{...s.style,display:"block"}})})});Oee.displayName=Pee;function r1e(t){return t!==null}var n1e=t=>({name:"transformOrigin",options:t,fn(e){var x,y,v;const{placement:r,rects:n,middlewareData:s}=e,o=((x=s.arrow)==null?void 0:x.centerOffset)!==0,l=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[u,d]=Iee(r),h={start:"0%",center:"50%",end:"100%"}[d],f=(((y=s.arrow)==null?void 0:y.x)??0)+l/2,p=(((v=s.arrow)==null?void 0:v.y)??0)+c/2;let g="",m="";return u==="bottom"?(g=o?h:`${f}px`,m=`${-c}px`):u==="top"?(g=o?h:`${f}px`,m=`${n.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=o?h:`${p}px`):u==="left"&&(g=`${n.floating.width+c}px`,m=o?h:`${p}px`),{data:{x:g,y:m}}}});function Iee(t){const[e,r="center"]=t.split("-");return[e,r]}var cT=Eee,Mj=kee,uT=Tee,dT=Oee,[hT,Cyt]=Bn("Tooltip",[ff]),fT=ff(),Ree="TooltipProvider",s1e=700,SD="tooltip.open",[i1e,JF]=hT(Ree),Mee=t=>{const{__scopeTooltip:e,delayDuration:r=s1e,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:i}=t,o=S.useRef(!0),l=S.useRef(!1),c=S.useRef(0);return S.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(i1e,{scope:e,isOpenDelayedRef:o,delayDuration:r,onOpen:S.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:S.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:i})};Mee.displayName=Ree;var Gw="Tooltip",[a1e,pT]=hT(Gw),Dee=t=>{const{__scopeTooltip:e,children:r,open:n,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=t,c=JF(Gw,t.__scopeTooltip),u=fT(e),[d,h]=S.useState(null),f=Yi(),p=S.useRef(0),g=o??c.disableHoverableContent,m=l??c.delayDuration,x=S.useRef(!1),[y,v]=Ms({prop:n,defaultProp:s??!1,onChange:C=>{C?(c.onOpen(),document.dispatchEvent(new CustomEvent(SD))):c.onClose(),i==null||i(C)},caller:Gw}),b=S.useMemo(()=>y?x.current?"delayed-open":"instant-open":"closed",[y]),w=S.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,v(!0)},[v]),j=S.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),N=S.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,v(!0),p.current=0},m)},[m,v]);return S.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(cT,{...u,children:a.jsx(a1e,{scope:e,contentId:f,open:y,stateAttribute:b,trigger:d,onTriggerChange:h,onTriggerEnter:S.useCallback(()=>{c.isOpenDelayedRef.current?N():w()},[c.isOpenDelayedRef,N,w]),onTriggerLeave:S.useCallback(()=>{g?j():(window.clearTimeout(p.current),p.current=0)},[j,g]),onOpen:w,onClose:j,disableHoverableContent:g,children:r})})};Dee.displayName=Gw;var ND="TooltipTrigger",Lee=S.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=pT(ND,r),i=JF(ND,r),o=fT(r),l=S.useRef(null),c=Nt(e,l,s.onTriggerChange),u=S.useRef(!1),d=S.useRef(!1),h=S.useCallback(()=>u.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),a.jsx(Mj,{asChild:!0,...o,children:a.jsx(et.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ze(t.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ze(t.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ze(t.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ze(t.onFocus,()=>{u.current||s.onOpen()}),onBlur:ze(t.onBlur,s.onClose),onClick:ze(t.onClick,s.onClose)})})});Lee.displayName=ND;var o1e="TooltipPortal",[kyt,l1e]=hT(o1e,{forceMount:void 0}),bv="TooltipContent",Fee=S.forwardRef((t,e)=>{const r=l1e(bv,t.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...i}=t,o=pT(bv,t.__scopeTooltip);return a.jsx(es,{present:n||o.open,children:o.disableHoverableContent?a.jsx($ee,{side:s,...i,ref:e}):a.jsx(c1e,{side:s,...i,ref:e})})}),c1e=S.forwardRef((t,e)=>{const r=pT(bv,t.__scopeTooltip),n=JF(bv,t.__scopeTooltip),s=S.useRef(null),i=Nt(e,s),[o,l]=S.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:h}=n,f=S.useCallback(()=>{l(null),h(!1)},[h]),p=S.useCallback((g,m)=>{const x=g.currentTarget,y={x:g.clientX,y:g.clientY},v=p1e(y,x.getBoundingClientRect()),b=m1e(y,v),w=g1e(m.getBoundingClientRect()),j=x1e([...b,...w]);l(j),h(!0)},[h]);return S.useEffect(()=>()=>f(),[f]),S.useEffect(()=>{if(c&&d){const g=x=>p(x,d),m=x=>p(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[c,d,p,f]),S.useEffect(()=>{if(o){const g=m=>{const x=m.target,y={x:m.clientX,y:m.clientY},v=(c==null?void 0:c.contains(x))||(d==null?void 0:d.contains(x)),b=!y1e(y,o);v?f():b&&(f(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,f]),a.jsx($ee,{...t,ref:i})}),[u1e,d1e]=hT(Gw,{isInside:!1}),h1e=mJ("TooltipContent"),$ee=S.forwardRef((t,e)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=t,c=pT(bv,r),u=fT(r),{onClose:d}=c;return S.useEffect(()=>(document.addEventListener(SD,d),()=>document.removeEventListener(SD,d)),[d]),S.useEffect(()=>{if(c.trigger){const h=f=>{const p=f.target;p!=null&&p.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),a.jsx(og,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:a.jsxs(uT,{"data-state":c.stateAttribute,...u,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(h1e,{children:n}),a.jsx(u1e,{scope:r,isInside:!0,children:a.jsx(ove,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Fee.displayName=bv;var Bee="TooltipArrow",f1e=S.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=fT(r);return d1e(Bee,r).isInside?null:a.jsx(dT,{...s,...n,ref:e})});f1e.displayName=Bee;function p1e(t,e){const r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(r,n,s,i)){case i:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function m1e(t,e,r=5){const n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function g1e(t){const{top:e,right:r,bottom:n,left:s}=t;return[{x:s,y:e},{x:r,y:e},{x:r,y:n},{x:s,y:n}]}function y1e(t,e){const{x:r,y:n}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const l=e[i],c=e[o],u=l.x,d=l.y,h=c.x,f=c.y;d>n!=f>n&&r<(h-u)*(n-d)/(f-d)+u&&(s=!s)}return s}function x1e(t){const e=t.slice();return e.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),v1e(e)}function v1e(t){if(t.length<=1)return t.slice();const e=[];for(let n=0;n<t.length;n++){const s=t[n];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const r=[];for(let n=t.length-1;n>=0;n--){const s=t[n];for(;r.length>=2;){const i=r[r.length-1],o=r[r.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))r.pop();else break}r.push(s)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var b1e=Mee,w1e=Dee,_1e=Lee,Uee=Fee;const Ai=b1e,Yt=w1e,Xt=_1e,Vt=S.forwardRef(({className:t,sideOffset:e=4,...r},n)=>a.jsx(Uee,{ref:n,sideOffset:e,className:Ie("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));Vt.displayName=Uee.displayName;var ub=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Gm=typeof window>"u"||"Deno"in globalThis;function yi(){}function j1e(t,e){return typeof t=="function"?t(e):t}function AD(t){return typeof t=="number"&&t>=0&&t!==1/0}function zee(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Vh(t,e){return typeof t=="function"?t(e):t}function no(t,e){return typeof t=="function"?t(e):t}function kz(t,e){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:l}=t;if(o){if(n){if(e.queryHash!==e6(o,e.options))return!1}else if(!Kw(e.queryKey,o))return!1}if(r!=="all"){const c=e.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||i&&!i(e))}function Tz(t,e){const{exact:r,status:n,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(r){if(Km(e.options.mutationKey)!==Km(i))return!1}else if(!Kw(e.options.mutationKey,i))return!1}return!(n&&e.state.status!==n||s&&!s(e))}function e6(t,e){return((e==null?void 0:e.queryKeyHashFn)||Km)(t)}function Km(t){return JSON.stringify(t,(e,r)=>ED(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Kw(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>Kw(t[r],e[r])):!1}function Hee(t,e){if(t===e)return t;const r=Pz(t)&&Pz(e);if(r||ED(t)&&ED(e)){const n=r?t:Object.keys(t),s=n.length,i=r?e:Object.keys(e),o=i.length,l=r?[]:{},c=new Set(n);let u=0;for(let d=0;d<o;d++){const h=r?d:i[d];(!r&&c.has(h)||r)&&t[h]===void 0&&e[h]===void 0?(l[h]=void 0,u++):(l[h]=Hee(t[h],e[h]),l[h]===t[h]&&t[h]!==void 0&&u++)}return s===o&&u===s?t:l}return e}function zE(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function Pz(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function ED(t){if(!Oz(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!Oz(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Oz(t){return Object.prototype.toString.call(t)==="[object Object]"}function S1e(t){return new Promise(e=>{setTimeout(e,t)})}function CD(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?Hee(t,e):e}function N1e(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function A1e(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var t6=Symbol();function Wee(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===t6?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Vee(t,e){return typeof t=="function"?t(...e):!!t}var mp,Dd,Vy,MX,E1e=(MX=class extends ub{constructor(){super();se(this,mp);se(this,Dd);se(this,Vy);Q(this,Vy,e=>{if(!Gm&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){_(this,Dd)||this.setEventListener(_(this,Vy))}onUnsubscribe(){var e;this.hasListeners()||((e=_(this,Dd))==null||e.call(this),Q(this,Dd,void 0))}setEventListener(e){var r;Q(this,Vy,e),(r=_(this,Dd))==null||r.call(this),Q(this,Dd,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){_(this,mp)!==e&&(Q(this,mp,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof _(this,mp)=="boolean"?_(this,mp):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},mp=new WeakMap,Dd=new WeakMap,Vy=new WeakMap,MX),r6=new E1e,qy,Ld,Gy,DX,C1e=(DX=class extends ub{constructor(){super();se(this,qy,!0);se(this,Ld);se(this,Gy);Q(this,Gy,e=>{if(!Gm&&window.addEventListener){const r=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){_(this,Ld)||this.setEventListener(_(this,Gy))}onUnsubscribe(){var e;this.hasListeners()||((e=_(this,Ld))==null||e.call(this),Q(this,Ld,void 0))}setEventListener(e){var r;Q(this,Gy,e),(r=_(this,Ld))==null||r.call(this),Q(this,Ld,e(this.setOnline.bind(this)))}setOnline(e){_(this,qy)!==e&&(Q(this,qy,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return _(this,qy)}},qy=new WeakMap,Ld=new WeakMap,Gy=new WeakMap,DX),HE=new C1e;function kD(){let t,e;const r=new Promise((s,i)=>{t=s,e=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),t(s)},r.reject=s=>{n({status:"rejected",reason:s}),e(s)},r}function k1e(t){return Math.min(1e3*2**t,3e4)}function qee(t){return(t??"online")==="online"?HE.isOnline():!0}var Gee=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function qP(t){return t instanceof Gee}function Kee(t){let e=!1,r=0,n=!1,s;const i=kD(),o=m=>{var x;n||(f(new Gee(m)),(x=t.abort)==null||x.call(t))},l=()=>{e=!0},c=()=>{e=!1},u=()=>r6.isFocused()&&(t.networkMode==="always"||HE.isOnline())&&t.canRun(),d=()=>qee(t.networkMode)&&t.canRun(),h=m=>{var x;n||(n=!0,(x=t.onSuccess)==null||x.call(t,m),s==null||s(),i.resolve(m))},f=m=>{var x;n||(n=!0,(x=t.onError)==null||x.call(t,m),s==null||s(),i.reject(m))},p=()=>new Promise(m=>{var x;s=y=>{(n||u())&&m(y)},(x=t.onPause)==null||x.call(t)}).then(()=>{var m;s=void 0,n||(m=t.onContinue)==null||m.call(t)}),g=()=>{if(n)return;let m;const x=r===0?t.initialPromise:void 0;try{m=x??t.fn()}catch(y){m=Promise.reject(y)}Promise.resolve(m).then(h).catch(y=>{var N;if(n)return;const v=t.retry??(Gm?0:3),b=t.retryDelay??k1e,w=typeof b=="function"?b(r,y):b,j=v===!0||typeof v=="number"&&r<v||typeof v=="function"&&v(r,y);if(e||!j){f(y);return}r++,(N=t.onFail)==null||N.call(t,r,y),S1e(w).then(()=>u()?void 0:p()).then(()=>{e?f(y):g()})})};return{promise:i,cancel:o,continue:()=>(s==null||s(),i),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?g():p().then(g),i)}}var T1e=t=>setTimeout(t,0);function P1e(){let t=[],e=0,r=l=>{l()},n=l=>{l()},s=T1e;const i=l=>{e?t.push(l):s(()=>{r(l)})},o=()=>{const l=t;t=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var Yn=P1e(),gp,LX,Yee=(LX=class{constructor(){se(this,gp)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),AD(this.gcTime)&&Q(this,gp,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Gm?1/0:5*60*1e3))}clearGcTimeout(){_(this,gp)&&(clearTimeout(_(this,gp)),Q(this,gp,void 0))}},gp=new WeakMap,LX),Ky,yp,Ga,xp,Vs,q1,vp,Fo,Fc,FX,O1e=(FX=class extends Yee{constructor(e){super();se(this,Fo);se(this,Ky);se(this,yp);se(this,Ga);se(this,xp);se(this,Vs);se(this,q1);se(this,vp);Q(this,vp,!1),Q(this,q1,e.defaultOptions),this.setOptions(e.options),this.observers=[],Q(this,xp,e.client),Q(this,Ga,_(this,xp).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Q(this,Ky,I1e(this.options)),this.state=e.state??_(this,Ky),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=_(this,Vs))==null?void 0:e.promise}setOptions(e){this.options={..._(this,q1),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,Ga).remove(this)}setData(e,r){const n=CD(this.state.data,e,this.options);return ce(this,Fo,Fc).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e,r){ce(this,Fo,Fc).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var n,s;const r=(n=_(this,Vs))==null?void 0:n.promise;return(s=_(this,Vs))==null||s.cancel(e),r?r.then(yi).catch(yi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,Ky))}isActive(){return this.observers.some(e=>no(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===t6||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Vh(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!zee(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=_(this,Vs))==null||r.continue()}onOnline(){var r;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=_(this,Vs))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),_(this,Ga).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(_(this,Vs)&&(_(this,vp)?_(this,Vs).cancel({revert:!0}):_(this,Vs).cancelRetry()),this.scheduleGc()),_(this,Ga).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ce(this,Fo,Fc).call(this,{type:"invalidate"})}fetch(e,r){var u,d,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(_(this,Vs))return _(this,Vs).continueRetry(),_(this,Vs).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}const n=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Q(this,vp,!0),n.signal)})},i=()=>{const f=Wee(this.options,r),g=(()=>{const m={client:_(this,xp),queryKey:this.queryKey,meta:this.meta};return s(m),m})();return Q(this,vp,!1),this.options.persister?this.options.persister(f,g,this):f(g)},l=(()=>{const f={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:_(this,xp),state:this.state,fetchFn:i};return s(f),f})();(u=this.options.behavior)==null||u.onFetch(l,this),Q(this,yp,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&ce(this,Fo,Fc).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta});const c=f=>{var p,g,m,x;qP(f)&&f.silent||ce(this,Fo,Fc).call(this,{type:"error",error:f}),qP(f)||((g=(p=_(this,Ga).config).onError)==null||g.call(p,f,this),(x=(m=_(this,Ga).config).onSettled)==null||x.call(m,this.state.data,f,this)),this.scheduleGc()};return Q(this,Vs,Kee({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,abort:n.abort.bind(n),onSuccess:f=>{var p,g,m,x;if(f===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(y){c(y);return}(g=(p=_(this,Ga).config).onSuccess)==null||g.call(p,f,this),(x=(m=_(this,Ga).config).onSettled)==null||x.call(m,f,this.state.error,this),this.scheduleGc()},onError:c,onFail:(f,p)=>{ce(this,Fo,Fc).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{ce(this,Fo,Fc).call(this,{type:"pause"})},onContinue:()=>{ce(this,Fo,Fc).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),_(this,Vs).start()}},Ky=new WeakMap,yp=new WeakMap,Ga=new WeakMap,xp=new WeakMap,Vs=new WeakMap,q1=new WeakMap,vp=new WeakMap,Fo=new WeakSet,Fc=function(e){const r=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Xee(n.data,this.options),fetchMeta:e.meta??null};case"success":return Q(this,yp,void 0),{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=e.error;return qP(s)&&s.revert&&_(this,yp)?{..._(this,yp),fetchStatus:"idle"}:{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),Yn.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),_(this,Ga).notify({query:this,type:"updated",action:e})})},FX);function Xee(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qee(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function I1e(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Il,$X,R1e=($X=class extends ub{constructor(e={}){super();se(this,Il);this.config=e,Q(this,Il,new Map)}build(e,r,n){const s=r.queryKey,i=r.queryHash??e6(s,r);let o=this.get(i);return o||(o=new O1e({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){_(this,Il).has(e.queryHash)||(_(this,Il).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=_(this,Il).get(e.queryHash);r&&(e.destroy(),r===e&&_(this,Il).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Yn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return _(this,Il).get(e)}getAll(){return[..._(this,Il).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(n=>kz(r,n))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(n=>kz(e,n)):r}notify(e){Yn.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){Yn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Yn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Il=new WeakMap,$X),Rl,ci,bp,Ml,_d,BX,M1e=(BX=class extends Yee{constructor(e){super();se(this,Ml);se(this,Rl);se(this,ci);se(this,bp);this.mutationId=e.mutationId,Q(this,ci,e.mutationCache),Q(this,Rl,[]),this.state=e.state||Qee(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){_(this,Rl).includes(e)||(_(this,Rl).push(e),this.clearGcTimeout(),_(this,ci).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Q(this,Rl,_(this,Rl).filter(r=>r!==e)),this.scheduleGc(),_(this,ci).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){_(this,Rl).length||(this.state.status==="pending"?this.scheduleGc():_(this,ci).remove(this))}continue(){var e;return((e=_(this,bp))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,o,l,c,u,d,h,f,p,g,m,x,y,v,b,w,j,N,C,k;const r=()=>{ce(this,Ml,_d).call(this,{type:"continue"})};Q(this,bp,Kee({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(E,M)=>{ce(this,Ml,_d).call(this,{type:"failed",failureCount:E,error:M})},onPause:()=>{ce(this,Ml,_d).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,ci).canRun(this)}));const n=this.state.status==="pending",s=!_(this,bp).canStart();try{if(n)r();else{ce(this,Ml,_d).call(this,{type:"pending",variables:e,isPaused:s}),await((o=(i=_(this,ci).config).onMutate)==null?void 0:o.call(i,e,this));const M=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,e));M!==this.state.context&&ce(this,Ml,_d).call(this,{type:"pending",context:M,variables:e,isPaused:s})}const E=await _(this,bp).start();return await((d=(u=_(this,ci).config).onSuccess)==null?void 0:d.call(u,E,e,this.state.context,this)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,E,e,this.state.context)),await((g=(p=_(this,ci).config).onSettled)==null?void 0:g.call(p,E,null,this.state.variables,this.state.context,this)),await((x=(m=this.options).onSettled)==null?void 0:x.call(m,E,null,e,this.state.context)),ce(this,Ml,_d).call(this,{type:"success",data:E}),E}catch(E){try{throw await((v=(y=_(this,ci).config).onError)==null?void 0:v.call(y,E,e,this.state.context,this)),await((w=(b=this.options).onError)==null?void 0:w.call(b,E,e,this.state.context)),await((N=(j=_(this,ci).config).onSettled)==null?void 0:N.call(j,void 0,E,this.state.variables,this.state.context,this)),await((k=(C=this.options).onSettled)==null?void 0:k.call(C,void 0,E,e,this.state.context)),E}finally{ce(this,Ml,_d).call(this,{type:"error",error:E})}}finally{_(this,ci).runNext(this)}}},Rl=new WeakMap,ci=new WeakMap,bp=new WeakMap,Ml=new WeakSet,_d=function(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Yn.batch(()=>{_(this,Rl).forEach(n=>{n.onMutationUpdate(e)}),_(this,ci).notify({mutation:this,type:"updated",action:e})})},BX);function Qee(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Qc,$o,G1,UX,D1e=(UX=class extends ub{constructor(e={}){super();se(this,Qc);se(this,$o);se(this,G1);this.config=e,Q(this,Qc,new Set),Q(this,$o,new Map),Q(this,G1,0)}build(e,r,n){const s=new M1e({mutationCache:this,mutationId:++ns(this,G1)._,options:e.defaultMutationOptions(r),state:n});return this.add(s),s}add(e){_(this,Qc).add(e);const r=sN(e);if(typeof r=="string"){const n=_(this,$o).get(r);n?n.push(e):_(this,$o).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(_(this,Qc).delete(e)){const r=sN(e);if(typeof r=="string"){const n=_(this,$o).get(r);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&_(this,$o).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=sN(e);if(typeof r=="string"){const n=_(this,$o).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var n;const r=sN(e);if(typeof r=="string"){const s=(n=_(this,$o).get(r))==null?void 0:n.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Yn.batch(()=>{_(this,Qc).forEach(e=>{this.notify({type:"removed",mutation:e})}),_(this,Qc).clear(),_(this,$o).clear()})}getAll(){return Array.from(_(this,Qc))}find(e){const r={exact:!0,...e};return this.getAll().find(n=>Tz(r,n))}findAll(e={}){return this.getAll().filter(r=>Tz(e,r))}notify(e){Yn.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return Yn.batch(()=>Promise.all(e.map(r=>r.continue().catch(yi))))}},Qc=new WeakMap,$o=new WeakMap,G1=new WeakMap,UX);function sN(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Iz(t){return{onFetch:(e,r)=>{var d,h,f,p,g;const n=e.options,s=(f=(h=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,i=((p=e.state.data)==null?void 0:p.pages)||[],o=((g=e.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let m=!1;const x=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(e.signal.aborted?m=!0:e.signal.addEventListener("abort",()=>{m=!0}),e.signal)})},y=Wee(e.options,e.fetchOptions),v=async(b,w,j)=>{if(m)return Promise.reject();if(w==null&&b.pages.length)return Promise.resolve(b);const C=(()=>{const z={client:e.client,queryKey:e.queryKey,pageParam:w,direction:j?"backward":"forward",meta:e.options.meta};return x(z),z})(),k=await y(C),{maxPages:E}=e.options,M=j?A1e:N1e;return{pages:M(b.pages,k,E),pageParams:M(b.pageParams,w,E)}};if(s&&i.length){const b=s==="backward",w=b?L1e:Rz,j={pages:i,pageParams:o},N=w(n,j);l=await v(j,N,b)}else{const b=t??i.length;do{const w=c===0?o[0]??n.initialPageParam:Rz(n,l);if(c>0&&w==null)break;l=await v(l,w),c++}while(c<b)}return l};e.options.persister?e.fetchFn=()=>{var m,x;return(x=(m=e.options).persister)==null?void 0:x.call(m,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=u}}}function Rz(t,{pages:e,pageParams:r}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,r[n],r):void 0}function L1e(t,{pages:e,pageParams:r}){var n;return e.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,r[0],r):void 0}var cn,Fd,$d,Yy,Xy,Bd,Qy,Zy,zX,F1e=(zX=class{constructor(t={}){se(this,cn);se(this,Fd);se(this,$d);se(this,Yy);se(this,Xy);se(this,Bd);se(this,Qy);se(this,Zy);Q(this,cn,t.queryCache||new R1e),Q(this,Fd,t.mutationCache||new D1e),Q(this,$d,t.defaultOptions||{}),Q(this,Yy,new Map),Q(this,Xy,new Map),Q(this,Bd,0)}mount(){ns(this,Bd)._++,_(this,Bd)===1&&(Q(this,Qy,r6.subscribe(async t=>{t&&(await this.resumePausedMutations(),_(this,cn).onFocus())})),Q(this,Zy,HE.subscribe(async t=>{t&&(await this.resumePausedMutations(),_(this,cn).onOnline())})))}unmount(){var t,e;ns(this,Bd)._--,_(this,Bd)===0&&((t=_(this,Qy))==null||t.call(this),Q(this,Qy,void 0),(e=_(this,Zy))==null||e.call(this),Q(this,Zy,void 0))}isFetching(t){return _(this,cn).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return _(this,Fd).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=_(this,cn).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=_(this,cn).build(this,e),n=r.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Vh(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return _(this,cn).findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=this.defaultQueryOptions({queryKey:t}),s=_(this,cn).get(n.queryHash),i=s==null?void 0:s.state.data,o=j1e(e,i);if(o!==void 0)return _(this,cn).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return Yn.batch(()=>_(this,cn).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=_(this,cn).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=_(this,cn);Yn.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=_(this,cn);return Yn.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=Yn.batch(()=>_(this,cn).findAll(t).map(s=>s.cancel(r)));return Promise.all(n).then(yi).catch(yi)}invalidateQueries(t,e={}){return Yn.batch(()=>(_(this,cn).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},n=Yn.batch(()=>_(this,cn).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(yi)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(yi)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=_(this,cn).build(this,e);return r.isStaleByTime(Vh(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(yi).catch(yi)}fetchInfiniteQuery(t){return t.behavior=Iz(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(yi).catch(yi)}ensureInfiniteQueryData(t){return t.behavior=Iz(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return HE.isOnline()?_(this,Fd).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,cn)}getMutationCache(){return _(this,Fd)}getDefaultOptions(){return _(this,$d)}setDefaultOptions(t){Q(this,$d,t)}setQueryDefaults(t,e){_(this,Yy).set(Km(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[..._(this,Yy).values()],r={};return e.forEach(n=>{Kw(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){_(this,Xy).set(Km(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[..._(this,Xy).values()],r={};return e.forEach(n=>{Kw(t,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={..._(this,$d).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=e6(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===t6&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{..._(this,$d).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){_(this,cn).clear(),_(this,Fd).clear()}},cn=new WeakMap,Fd=new WeakMap,$d=new WeakMap,Yy=new WeakMap,Xy=new WeakMap,Bd=new WeakMap,Qy=new WeakMap,Zy=new WeakMap,zX),Oi,Gt,K1,ui,wp,Jy,Ud,zd,Y1,ex,tx,_p,jp,Hd,rx,dr,S0,TD,PD,OD,ID,RD,MD,DD,Zee,HX,$1e=(HX=class extends ub{constructor(e,r){super();se(this,dr);se(this,Oi);se(this,Gt);se(this,K1);se(this,ui);se(this,wp);se(this,Jy);se(this,Ud);se(this,zd);se(this,Y1);se(this,ex);se(this,tx);se(this,_p);se(this,jp);se(this,Hd);se(this,rx,new Set);this.options=r,Q(this,Oi,e),Q(this,zd,null),Q(this,Ud,kD()),this.options.experimental_prefetchInRender||_(this,Ud).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,Gt).addObserver(this),Mz(_(this,Gt),this.options)?ce(this,dr,S0).call(this):this.updateResult(),ce(this,dr,ID).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return LD(_(this,Gt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return LD(_(this,Gt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ce(this,dr,RD).call(this),ce(this,dr,MD).call(this),_(this,Gt).removeObserver(this)}setOptions(e){const r=this.options,n=_(this,Gt);if(this.options=_(this,Oi).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof no(this.options.enabled,_(this,Gt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ce(this,dr,DD).call(this),_(this,Gt).setOptions(this.options),r._defaulted&&!zE(this.options,r)&&_(this,Oi).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,Gt),observer:this});const s=this.hasListeners();s&&Dz(_(this,Gt),n,this.options,r)&&ce(this,dr,S0).call(this),this.updateResult(),s&&(_(this,Gt)!==n||no(this.options.enabled,_(this,Gt))!==no(r.enabled,_(this,Gt))||Vh(this.options.staleTime,_(this,Gt))!==Vh(r.staleTime,_(this,Gt)))&&ce(this,dr,TD).call(this);const i=ce(this,dr,PD).call(this);s&&(_(this,Gt)!==n||no(this.options.enabled,_(this,Gt))!==no(r.enabled,_(this,Gt))||i!==_(this,Hd))&&ce(this,dr,OD).call(this,i)}getOptimisticResult(e){const r=_(this,Oi).getQueryCache().build(_(this,Oi),e),n=this.createResult(r,e);return U1e(this,n)&&(Q(this,ui,n),Q(this,Jy,this.options),Q(this,wp,_(this,Gt).state)),n}getCurrentResult(){return _(this,ui)}trackResult(e,r){return new Proxy(e,{get:(n,s)=>(this.trackProp(s),r==null||r(s),Reflect.get(n,s))})}trackProp(e){_(this,rx).add(e)}getCurrentQuery(){return _(this,Gt)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=_(this,Oi).defaultQueryOptions(e),n=_(this,Oi).getQueryCache().build(_(this,Oi),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(e){return ce(this,dr,S0).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,ui)))}createResult(e,r){var E;const n=_(this,Gt),s=this.options,i=_(this,ui),o=_(this,wp),l=_(this,Jy),u=e!==n?e.state:_(this,K1),{state:d}=e;let h={...d},f=!1,p;if(r._optimisticResults){const M=this.hasListeners(),z=!M&&Mz(e,r),P=M&&Dz(e,n,r,s);(z||P)&&(h={...h,...Xee(d.data,e.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:g,errorUpdatedAt:m,status:x}=h;p=h.data;let y=!1;if(r.placeholderData!==void 0&&p===void 0&&x==="pending"){let M;i!=null&&i.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(M=i.data,y=!0):M=typeof r.placeholderData=="function"?r.placeholderData((E=_(this,tx))==null?void 0:E.state.data,_(this,tx)):r.placeholderData,M!==void 0&&(x="success",p=CD(i==null?void 0:i.data,M,r),f=!0)}if(r.select&&p!==void 0&&!y)if(i&&p===(o==null?void 0:o.data)&&r.select===_(this,Y1))p=_(this,ex);else try{Q(this,Y1,r.select),p=r.select(p),p=CD(i==null?void 0:i.data,p,r),Q(this,ex,p),Q(this,zd,null)}catch(M){Q(this,zd,M)}_(this,zd)&&(g=_(this,zd),p=_(this,ex),m=Date.now(),x="error");const v=h.fetchStatus==="fetching",b=x==="pending",w=x==="error",j=b&&v,N=p!==void 0,k={status:x,fetchStatus:h.fetchStatus,isPending:b,isSuccess:x==="success",isError:w,isInitialLoading:j,isLoading:j,data:p,dataUpdatedAt:h.dataUpdatedAt,error:g,errorUpdatedAt:m,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:v,isRefetching:v&&!b,isLoadingError:w&&!N,isPaused:h.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:w&&N,isStale:n6(e,r),refetch:this.refetch,promise:_(this,Ud),isEnabled:no(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const M=V=>{k.status==="error"?V.reject(k.error):k.data!==void 0&&V.resolve(k.data)},z=()=>{const V=Q(this,Ud,k.promise=kD());M(V)},P=_(this,Ud);switch(P.status){case"pending":e.queryHash===n.queryHash&&M(P);break;case"fulfilled":(k.status==="error"||k.data!==P.value)&&z();break;case"rejected":(k.status!=="error"||k.error!==P.reason)&&z();break}}return k}updateResult(){const e=_(this,ui),r=this.createResult(_(this,Gt),this.options);if(Q(this,wp,_(this,Gt).state),Q(this,Jy,this.options),_(this,wp).data!==void 0&&Q(this,tx,_(this,Gt)),zE(r,e))return;Q(this,ui,r);const n=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!_(this,rx).size)return!0;const o=new Set(i??_(this,rx));return this.options.throwOnError&&o.add("error"),Object.keys(_(this,ui)).some(l=>{const c=l;return _(this,ui)[c]!==e[c]&&o.has(c)})};ce(this,dr,Zee).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ce(this,dr,ID).call(this)}},Oi=new WeakMap,Gt=new WeakMap,K1=new WeakMap,ui=new WeakMap,wp=new WeakMap,Jy=new WeakMap,Ud=new WeakMap,zd=new WeakMap,Y1=new WeakMap,ex=new WeakMap,tx=new WeakMap,_p=new WeakMap,jp=new WeakMap,Hd=new WeakMap,rx=new WeakMap,dr=new WeakSet,S0=function(e){ce(this,dr,DD).call(this);let r=_(this,Gt).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(yi)),r},TD=function(){ce(this,dr,RD).call(this);const e=Vh(this.options.staleTime,_(this,Gt));if(Gm||_(this,ui).isStale||!AD(e))return;const n=zee(_(this,ui).dataUpdatedAt,e)+1;Q(this,_p,setTimeout(()=>{_(this,ui).isStale||this.updateResult()},n))},PD=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,Gt)):this.options.refetchInterval)??!1},OD=function(e){ce(this,dr,MD).call(this),Q(this,Hd,e),!(Gm||no(this.options.enabled,_(this,Gt))===!1||!AD(_(this,Hd))||_(this,Hd)===0)&&Q(this,jp,setInterval(()=>{(this.options.refetchIntervalInBackground||r6.isFocused())&&ce(this,dr,S0).call(this)},_(this,Hd)))},ID=function(){ce(this,dr,TD).call(this),ce(this,dr,OD).call(this,ce(this,dr,PD).call(this))},RD=function(){_(this,_p)&&(clearTimeout(_(this,_p)),Q(this,_p,void 0))},MD=function(){_(this,jp)&&(clearInterval(_(this,jp)),Q(this,jp,void 0))},DD=function(){const e=_(this,Oi).getQueryCache().build(_(this,Oi),this.options);if(e===_(this,Gt))return;const r=_(this,Gt);Q(this,Gt,e),Q(this,K1,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},Zee=function(e){Yn.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(_(this,ui))}),_(this,Oi).getQueryCache().notify({query:_(this,Gt),type:"observerResultsUpdated"})})},HX);function B1e(t,e){return no(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Mz(t,e){return B1e(t,e)||t.state.data!==void 0&&LD(t,e,e.refetchOnMount)}function LD(t,e,r){if(no(e.enabled,t)!==!1&&Vh(e.staleTime,t)!=="static"){const n=typeof r=="function"?r(t):r;return n==="always"||n!==!1&&n6(t,e)}return!1}function Dz(t,e,r,n){return(t!==e||no(n.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&n6(t,r)}function n6(t,e){return no(e.enabled,t)!==!1&&t.isStaleByTime(Vh(e.staleTime,t))}function U1e(t,e){return!zE(t.getCurrentResult(),e)}var Wd,Vd,Ii,Zc,Uu,bA,FD,WX,z1e=(WX=class extends ub{constructor(r,n){super();se(this,Uu);se(this,Wd);se(this,Vd);se(this,Ii);se(this,Zc);Q(this,Wd,r),this.setOptions(n),this.bindMethods(),ce(this,Uu,bA).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var s;const n=this.options;this.options=_(this,Wd).defaultMutationOptions(r),zE(this.options,n)||_(this,Wd).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,Ii),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Km(n.mutationKey)!==Km(this.options.mutationKey)?this.reset():((s=_(this,Ii))==null?void 0:s.state.status)==="pending"&&_(this,Ii).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=_(this,Ii))==null||r.removeObserver(this)}onMutationUpdate(r){ce(this,Uu,bA).call(this),ce(this,Uu,FD).call(this,r)}getCurrentResult(){return _(this,Vd)}reset(){var r;(r=_(this,Ii))==null||r.removeObserver(this),Q(this,Ii,void 0),ce(this,Uu,bA).call(this),ce(this,Uu,FD).call(this)}mutate(r,n){var s;return Q(this,Zc,n),(s=_(this,Ii))==null||s.removeObserver(this),Q(this,Ii,_(this,Wd).getMutationCache().build(_(this,Wd),this.options)),_(this,Ii).addObserver(this),_(this,Ii).execute(r)}},Wd=new WeakMap,Vd=new WeakMap,Ii=new WeakMap,Zc=new WeakMap,Uu=new WeakSet,bA=function(){var n;const r=((n=_(this,Ii))==null?void 0:n.state)??Qee();Q(this,Vd,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},FD=function(r){Yn.batch(()=>{var n,s,i,o,l,c,u,d;if(_(this,Zc)&&this.hasListeners()){const h=_(this,Vd).variables,f=_(this,Vd).context;(r==null?void 0:r.type)==="success"?((s=(n=_(this,Zc)).onSuccess)==null||s.call(n,r.data,h,f),(o=(i=_(this,Zc)).onSettled)==null||o.call(i,r.data,null,h,f)):(r==null?void 0:r.type)==="error"&&((c=(l=_(this,Zc)).onError)==null||c.call(l,r.error,h,f),(d=(u=_(this,Zc)).onSettled)==null||d.call(u,void 0,r.error,h,f))}this.listeners.forEach(h=>{h(_(this,Vd))})})},WX),Jee=S.createContext(void 0),s6=t=>{const e=S.useContext(Jee);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},H1e=({client:t,children:e})=>(S.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),a.jsx(Jee.Provider,{value:t,children:e})),ete=S.createContext(!1),W1e=()=>S.useContext(ete);ete.Provider;function V1e(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var q1e=S.createContext(V1e()),G1e=()=>S.useContext(q1e),K1e=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},Y1e=t=>{S.useEffect(()=>{t.clearReset()},[t])},X1e=({result:t,errorResetBoundary:e,throwOnError:r,query:n,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(s&&t.data===void 0||Vee(r,[t.error,n])),Q1e=t=>{if(t.suspense){const e=n=>n==="static"?n:Math.max(n??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...n)=>e(r(...n)):e(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},Z1e=(t,e)=>t.isLoading&&t.isFetching&&!e,J1e=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Lz=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function e_e(t,e,r){var h,f,p,g,m;const n=W1e(),s=G1e(),i=s6(),o=i.defaultQueryOptions(t);(f=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||f.call(h,o),o._optimisticResults=n?"isRestoring":"optimistic",Q1e(o),K1e(o,s),Y1e(s);const l=!i.getQueryCache().get(o.queryHash),[c]=S.useState(()=>new e(i,o)),u=c.getOptimisticResult(o),d=!n&&t.subscribed!==!1;if(S.useSyncExternalStore(S.useCallback(x=>{const y=d?c.subscribe(Yn.batchCalls(x)):yi;return c.updateResult(),y},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),S.useEffect(()=>{c.setOptions(o)},[o,c]),J1e(o,u))throw Lz(o,c,s);if(X1e({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if((g=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||g.call(p,o,u),o.experimental_prefetchInRender&&!Gm&&Z1e(u,n)){const x=l?Lz(o,c,s):(m=i.getQueryCache().get(o.queryHash))==null?void 0:m.promise;x==null||x.catch(yi).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function t_e(t,e){return e_e(t,$1e)}function GP(t,e){const r=s6(),[n]=S.useState(()=>new z1e(r,t));S.useEffect(()=>{n.setOptions(t)},[n,t]);const s=S.useSyncExternalStore(S.useCallback(o=>n.subscribe(Yn.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=S.useCallback((o,l)=>{n.mutate(o,l).catch(yi)},[n]);if(s.error&&Vee(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}/**
* @remix-run/router v1.23.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Yw(){return Yw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Yw.apply(this,arguments)}var Dh;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Dh||(Dh={}));const Fz="popstate";function r_e(t){t===void 0&&(t={});function e(n,s){let{pathname:i,search:o,hash:l}=n.location;return $D("",{pathname:i,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function r(n,s){return typeof s=="string"?s:WE(s)}return s_e(e,r,null,t)}function An(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function tte(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function n_e(){return Math.random().toString(36).substr(2,8)}function $z(t,e){return{usr:t.state,key:t.key,idx:e}}function $D(t,e,r,n){return r===void 0&&(r=null),Yw({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?db(e):e,{state:r,key:e&&e.key||n||n_e()})}function WE(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function db(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function s_e(t,e,r,n){n===void 0&&(n={});let{window:s=document.defaultView,v5Compat:i=!1}=n,o=s.history,l=Dh.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Yw({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function h(){l=Dh.Pop;let x=d(),y=x==null?null:x-u;u=x,c&&c({action:l,location:m.location,delta:y})}function f(x,y){l=Dh.Push;let v=$D(m.location,x,y);u=d()+1;let b=$z(v,u),w=m.createHref(v);try{o.pushState(b,"",w)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(w)}i&&c&&c({action:l,location:m.location,delta:1})}function p(x,y){l=Dh.Replace;let v=$D(m.location,x,y);u=d();let b=$z(v,u),w=m.createHref(v);o.replaceState(b,"",w),i&&c&&c({action:l,location:m.location,delta:0})}function g(x){let y=s.location.origin!=="null"?s.location.origin:s.location.href,v=typeof x=="string"?x:WE(x);return v=v.replace(/ $/,"%20"),An(y,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,y)}let m={get action(){return l},get location(){return t(s,o)},listen(x){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Fz,h),c=x,()=>{s.removeEventListener(Fz,h),c=null}},createHref(x){return e(s,x)},createURL:g,encodeLocation(x){let y=g(x);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:p,go(x){return o.go(x)}};return m}var Bz;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Bz||(Bz={}));function i_e(t,e,r){return r===void 0&&(r="/"),a_e(t,e,r,!1)}function a_e(t,e,r,n){let s=typeof e=="string"?db(e):e,i=i6(s.pathname||"/",r);if(i==null)return null;let o=rte(t);o_e(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=x_e(i);l=g_e(o[c],u,n)}return l}function rte(t,e,r,n){e===void 0&&(e=[]),r===void 0&&(r=[]),n===void 0&&(n="");let s=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(An(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=qh([n,c.relativePath]),d=r.concat(c);i.children&&i.children.length>0&&(An(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),rte(i.children,e,d,u)),!(i.path==null&&!i.index)&&e.push({path:u,score:p_e(u,i.index),routesMeta:d})};return t.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let c of nte(i.path))s(i,o,c)}),e}function nte(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,s=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return s?[i,""]:[i];let o=nte(n.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function o_e(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:m_e(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const l_e=/^:[\w-]+$/,c_e=3,u_e=2,d_e=1,h_e=10,f_e=-2,Uz=t=>t==="*";function p_e(t,e){let r=t.split("/"),n=r.length;return r.some(Uz)&&(n+=f_e),e&&(n+=u_e),r.filter(s=>!Uz(s)).reduce((s,i)=>s+(l_e.test(i)?c_e:i===""?d_e:h_e),n)}function m_e(t,e){return t.length===e.length&&t.slice(0,-1).every((n,s)=>n===e[s])?t[t.length-1]-e[e.length-1]:0}function g_e(t,e,r){let{routesMeta:n}=t,s={},i="/",o=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,d=i==="/"?e:e.slice(i.length)||"/",h=zz({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),f=c.route;if(!h&&u&&r&&!n[n.length-1].route.index&&(h=zz({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;Object.assign(s,h.params),o.push({params:s,pathname:qh([i,h.pathname]),pathnameBase:__e(qh([i,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(i=qh([i,h.pathnameBase]))}return o}function zz(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=y_e(t.path,t.caseSensitive,t.end),s=e.match(r);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:n.reduce((u,d,h)=>{let{paramName:f,isOptional:p}=d;if(f==="*"){let m=l[h]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[h];return p&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:t}}function y_e(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),tte(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),n]}function x_e(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return tte(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function i6(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function v_e(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:s=""}=typeof t=="string"?db(t):t;return{pathname:r?r.startsWith("/")?r:b_e(r,e):e,search:j_e(n),hash:S_e(s)}}function b_e(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function KP(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` 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 w_e(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function a6(t,e){let r=w_e(t);return e?r.map((n,s)=>s===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function o6(t,e,r,n){n===void 0&&(n=!1);let s;typeof t=="string"?s=db(t):(s=Yw({},t),An(!s.pathname||!s.pathname.includes("?"),KP("?","pathname","search",s)),An(!s.pathname||!s.pathname.includes("#"),KP("#","pathname","hash",s)),An(!s.search||!s.search.includes("#"),KP("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=r;else{let h=e.length-1;if(!n&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}l=h>=0?e[h]:"/"}let c=v_e(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const qh=t=>t.join("/").replace(/\/\/+/g,"/"),__e=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),j_e=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,S_e=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function N_e(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const ste=["post","put","patch","delete"];new Set(ste);const A_e=["get",...ste];new Set(A_e);/**
* React Router v6.30.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Xw(){return Xw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Xw.apply(this,arguments)}const l6=S.createContext(null),E_e=S.createContext(null),pf=S.createContext(null),mT=S.createContext(null),ld=S.createContext({outlet:null,matches:[],isDataRoute:!1}),ite=S.createContext(null);function C_e(t,e){let{relative:r}=e===void 0?{}:e;hb()||An(!1);let{basename:n,navigator:s}=S.useContext(pf),{hash:i,pathname:o,search:l}=ote(t,{relative:r}),c=o;return n!=="/"&&(c=o==="/"?n:qh([n,o])),s.createHref({pathname:c,search:l,hash:i})}function hb(){return S.useContext(mT)!=null}function mf(){return hb()||An(!1),S.useContext(mT).location}function ate(t){S.useContext(pf).static||S.useLayoutEffect(t)}function gr(){let{isDataRoute:t}=S.useContext(ld);return t?H_e():k_e()}function k_e(){hb()||An(!1);let t=S.useContext(l6),{basename:e,future:r,navigator:n}=S.useContext(pf),{matches:s}=S.useContext(ld),{pathname:i}=mf(),o=JSON.stringify(a6(s,r.v7_relativeSplatPath)),l=S.useRef(!1);return ate(()=>{l.current=!0}),S.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let h=o6(u,JSON.parse(o),i,d.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:qh([e,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[e,n,o,i,t])}const T_e=S.createContext(null);function P_e(t){let e=S.useContext(ld).outlet;return e&&S.createElement(T_e.Provider,{value:t},e)}function ote(t,e){let{relative:r}=e===void 0?{}:e,{future:n}=S.useContext(pf),{matches:s}=S.useContext(ld),{pathname:i}=mf(),o=JSON.stringify(a6(s,n.v7_relativeSplatPath));return S.useMemo(()=>o6(t,JSON.parse(o),i,r==="path"),[t,o,i,r])}function O_e(t,e){return I_e(t,e)}function I_e(t,e,r,n){hb()||An(!1);let{navigator:s}=S.useContext(pf),{matches:i}=S.useContext(ld),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=mf(),d;if(e){var h;let x=typeof e=="string"?db(e):e;c==="/"||(h=x.pathname)!=null&&h.startsWith(c)||An(!1),d=x}else d=u;let f=d.pathname||"/",p=f;if(c!=="/"){let x=c.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(x.length).join("/")}let g=i_e(t,{pathname:p}),m=F_e(g&&g.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:qh([c,s.encodeLocation?s.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?c:qh([c,s.encodeLocation?s.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),i,r,n);return e&&m?S.createElement(mT.Provider,{value:{location:Xw({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Dh.Pop}},m):m}function R_e(){let t=z_e(),e=N_e(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},e),r?S.createElement("pre",{style:s},r):null,null)}const M_e=S.createElement(R_e,null);class D_e extends S.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,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?S.createElement(ld.Provider,{value:this.props.routeContext},S.createElement(ite.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function L_e(t){let{routeContext:e,match:r,children:n}=t,s=S.useContext(l6);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),S.createElement(ld.Provider,{value:e},n)}function F_e(t,e,r,n){var s;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var i;if(!r)return null;if(r.errors)t=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let o=t,l=(s=r)==null?void 0:s.errors;if(l!=null){let d=o.findIndex(h=>h.route.id&&(l==null?void 0:l[h.route.id])!==void 0);d>=0||An(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d<o.length;d++){let h=o[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=d),h.route.id){let{loaderData:f,errors:p}=r,g=h.route.loader&&f[h.route.id]===void 0&&(!p||p[h.route.id]===void 0);if(h.route.lazy||g){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,h,f)=>{let p,g=!1,m=null,x=null;r&&(p=l&&h.route.id?l[h.route.id]:void 0,m=h.route.errorElement||M_e,c&&(u<0&&f===0?(g=!0,x=null):u===f&&(g=!0,x=h.route.hydrateFallbackElement||null)));let y=e.concat(o.slice(0,f+1)),v=()=>{let b;return p?b=m:g?b=x:h.route.Component?b=S.createElement(h.route.Component,null):h.route.element?b=h.route.element:b=d,S.createElement(L_e,{match:h,routeContext:{outlet:d,matches:y,isDataRoute:r!=null},children:b})};return r&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?S.createElement(D_e,{location:r.location,revalidation:r.revalidation,component:m,error:p,children:v(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):v()},null)}var lte=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(lte||{}),VE=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(VE||{});function $_e(t){let e=S.useContext(l6);return e||An(!1),e}function B_e(t){let e=S.useContext(E_e);return e||An(!1),e}function U_e(t){let e=S.useContext(ld);return e||An(!1),e}function cte(t){let e=U_e(),r=e.matches[e.matches.length-1];return r.route.id||An(!1),r.route.id}function z_e(){var t;let e=S.useContext(ite),r=B_e(VE.UseRouteError),n=cte(VE.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function H_e(){let{router:t}=$_e(lte.UseNavigateStable),e=cte(VE.UseNavigateStable),r=S.useRef(!1);return ate(()=>{r.current=!0}),S.useCallback(function(s,i){i===void 0&&(i={}),r.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,Xw({fromRouteId:e},i)))},[t,e])}function W_e(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function BD(t){let{to:e,replace:r,state:n,relative:s}=t;hb()||An(!1);let{future:i,static:o}=S.useContext(pf),{matches:l}=S.useContext(ld),{pathname:c}=mf(),u=gr(),d=o6(e,a6(l,i.v7_relativeSplatPath),c,s==="path"),h=JSON.stringify(d);return S.useEffect(()=>u(JSON.parse(h),{replace:r,state:n,relative:s}),[u,h,s,r,n]),null}function V_e(t){return P_e(t.context)}function wt(t){An(!1)}function q_e(t){let{basename:e="/",children:r=null,location:n,navigationType:s=Dh.Pop,navigator:i,static:o=!1,future:l}=t;hb()&&An(!1);let c=e.replace(/^\/*/,"/"),u=S.useMemo(()=>({basename:c,navigator:i,static:o,future:Xw({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof n=="string"&&(n=db(n));let{pathname:d="/",search:h="",hash:f="",state:p=null,key:g="default"}=n,m=S.useMemo(()=>{let x=i6(d,c);return x==null?null:{location:{pathname:x,search:h,hash:f,state:p,key:g},navigationType:s}},[c,d,h,f,p,g,s]);return m==null?null:S.createElement(pf.Provider,{value:u},S.createElement(mT.Provider,{children:r,value:m}))}function G_e(t){let{children:e,location:r}=t;return O_e(UD(e),r)}new Promise(()=>{});function UD(t,e){e===void 0&&(e=[]);let r=[];return S.Children.forEach(t,(n,s)=>{if(!S.isValidElement(n))return;let i=[...e,s];if(n.type===S.Fragment){r.push.apply(r,UD(n.props.children,i));return}n.type!==wt&&An(!1),!n.props.index||!n.props.children||An(!1);let o={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary: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=UD(n.props.children,i)),r.push(o)}),r}/**
* React Router DOM v6.30.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function zD(){return zD=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},zD.apply(this,arguments)}function K_e(t,e){if(t==null)return{};var r={},n=Object.keys(t),s,i;for(i=0;i<n.length;i++)s=n[i],!(e.indexOf(s)>=0)&&(r[s]=t[s]);return r}function Y_e(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function X_e(t,e){return t.button===0&&(!e||e==="_self")&&!Y_e(t)}function HD(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,r)=>{let n=t[r];return e.concat(Array.isArray(n)?n.map(s=>[r,s]):[[r,n]])},[]))}function Q_e(t,e){let r=HD(t);return e&&e.forEach((n,s)=>{r.has(s)||e.getAll(s).forEach(i=>{r.append(s,i)})}),r}const Z_e=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],J_e="6";try{window.__reactRouterVersion=J_e}catch{}const eje="startTransition",Hz=H3[eje];function tje(t){let{basename:e,children:r,future:n,window:s}=t,i=S.useRef();i.current==null&&(i.current=r_e({window:s,v5Compat:!0}));let o=i.current,[l,c]=S.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},d=S.useCallback(h=>{u&&Hz?Hz(()=>c(h)):c(h)},[c,u]);return S.useLayoutEffect(()=>o.listen(d),[o,d]),S.useEffect(()=>W_e(n),[n]),S.createElement(q_e,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}const rje=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",nje=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tt=S.forwardRef(function(e,r){let{onClick:n,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:h}=e,f=K_e(e,Z_e),{basename:p}=S.useContext(pf),g,m=!1;if(typeof u=="string"&&nje.test(u)&&(g=u,rje))try{let b=new URL(window.location.href),w=u.startsWith("//")?new URL(b.protocol+u):new URL(u),j=i6(w.pathname,p);w.origin===b.origin&&j!=null?u=j+w.search+w.hash:m=!0}catch{}let x=C_e(u,{relative:s}),y=sje(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,viewTransition:h});function v(b){n&&n(b),b.defaultPrevented||y(b)}return S.createElement("a",zD({},f,{href:g||x,onClick:m||i?n:v,ref:r,target:c}))});var Wz;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Wz||(Wz={}));var Vz;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Vz||(Vz={}));function sje(t,e){let{target:r,replace:n,state:s,preventScrollReset:i,relative:o,viewTransition:l}=e===void 0?{}:e,c=gr(),u=mf(),d=ote(t,{relative:o});return S.useCallback(h=>{if(X_e(h,r)){h.preventDefault();let f=n!==void 0?n:WE(u)===WE(d);c(t,{replace:f,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,d,n,s,r,t,i,o,l])}function Dj(t){let e=S.useRef(HD(t)),r=S.useRef(!1),n=mf(),s=S.useMemo(()=>Q_e(n.search,r.current?null:e.current),[n.search]),i=gr(),o=S.useCallback((l,c)=>{const u=HD(typeof l=="function"?l(s):l);r.current=!0,i("?"+u,c)},[i,s]);return[s,o]}const ije="modulepreload",aje=function(t){return"/"+t},qz={},Lj=function(e,r,n){let s=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(r.map(c=>{if(c=aje(c),c in qz)return;qz[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":ije,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return e().catch(i)})},oje=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...r)=>Lj(async()=>{const{default:n}=await Promise.resolve().then(()=>fb);return{default:n}},[]).then(({default:n})=>n(...r)):e=fetch,(...r)=>e(...r)};class c6 extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}}class lje extends c6{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Gz extends c6{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Kz extends c6{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var WD;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(WD||(WD={}));var cje=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};class uje{constructor(e,{headers:r={},customFetch:n,region:s=WD.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=oje(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,r={}){var n;return cje(this,void 0,void 0,function*(){try{const{headers:s,method:i,body:o}=r;let l={},{region:c}=r;c||(c=this.region);const u=new URL(`${this.url}/${e}`);c&&c!=="any"&&(l["x-region"]=c,u.searchParams.set("forceFunctionRegion",c));let d;o&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",d=o):typeof o=="string"?(l["Content-Type"]="text/plain",d=o):typeof FormData<"u"&&o instanceof FormData?d=o:(l["Content-Type"]="application/json",d=JSON.stringify(o)));const h=yield this.fetch(u.toString(),{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),s),body:d}).catch(m=>{throw new lje(m)}),f=h.headers.get("x-relay-error");if(f&&f==="true")throw new Gz(h);if(!h.ok)throw new Kz(h);let p=((n=h.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),g;return p==="application/json"?g=yield h.json():p==="application/octet-stream"?g=yield h.blob():p==="text/event-stream"?g=h:p==="multipart/form-data"?g=yield h.formData():g=yield h.text(),{data:g,error:null,response:h}}catch(s){return{data:null,error:s,response:s instanceof Kz||s instanceof Gz?s.context:void 0}}})}}var Bi={},u6={},gT={},Fj={},yT={},xT={},dje=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},wv=dje();const hje=wv.fetch,ute=wv.fetch.bind(wv),dte=wv.Headers,fje=wv.Request,pje=wv.Response,fb=Object.freeze(Object.defineProperty({__proto__:null,Headers:dte,Request:fje,Response:pje,default:ute,fetch:hje},Symbol.toStringTag,{value:"Module"})),mje=Pme(fb);var vT={};Object.defineProperty(vT,"__esModule",{value:!0});let gje=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};vT.default=gje;var hte=Wr&&Wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xT,"__esModule",{value:!0});const yje=hte(mje),xje=hte(vT);let vje=class{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=yje.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,r){return this.headers=Object.assign({},this.headers),this.headers[e]=r,this}then(e,r){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");const n=this.fetch;let s=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var o,l,c;let u=null,d=null,h=null,f=i.status,p=i.statusText;if(i.ok){if(this.method!=="HEAD"){const y=await i.text();y===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?d=y:d=JSON.parse(y))}const m=(o=this.headers.Prefer)===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),x=(l=i.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");m&&x&&x.length>1&&(h=parseInt(x[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,h=null,f=406,p="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{const m=await i.text();try{u=JSON.parse(m),Array.isArray(u)&&i.status===404&&(d=[],u=null,f=200,p="OK")}catch{i.status===404&&m===""?(f=204,p="No Content"):u={message:m}}if(u&&this.isMaybeSingle&&(!((c=u==null?void 0:u.details)===null||c===void 0)&&c.includes("0 rows"))&&(u=null,f=200,p="OK"),u&&this.shouldThrowOnError)throw new xje.default(u)}return{error:u,data:d,count:h,status:f,statusText:p}});return this.shouldThrowOnError||(s=s.catch(i=>{var o,l,c;return{error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:`${(l=i==null?void 0:i.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(c=i==null?void 0:i.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),s.then(e,r)}returns(){return this}overrideTypes(){return this}};xT.default=vje;var bje=Wr&&Wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yT,"__esModule",{value:!0});const wje=bje(xT);let _je=class extends wje.default{select(e){let r=!1;const n=(e??"*").split("").map(s=>/\s/.test(s)&&!r?"":(s==='"'&&(r=!r),s)).join("");return this.url.searchParams.set("select",n),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:r=!0,nullsFirst:n,foreignTable:s,referencedTable:i=s}={}){const o=i?`${i}.order`:"order",l=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${l?`${l},`:""}${e}.${r?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,r,{foreignTable:n,referencedTable:s=n}={}){const i=typeof s>"u"?"offset":`${s}.offset`,o=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(o,`${r-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:r=!1,settings:n=!1,buffers:s=!1,wal:i=!1,format:o="text"}={}){var l;const c=[e?"analyze":null,r?"verbose":null,n?"settings":null,s?"buffers":null,i?"wal":null].filter(Boolean).join("|"),u=(l=this.headers.Accept)!==null&&l!==void 0?l:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${o}; for="${u}"; options=${c};`,o==="json"?this:this}rollback(){var e;return((e=this.headers.Prefer)!==null&&e!==void 0?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}};yT.default=_je;var jje=Wr&&Wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fj,"__esModule",{value:!0});const Sje=jje(yT);let Nje=class extends Sje.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){const n=Array.from(new Set(r)).map(s=>typeof s=="string"&&new RegExp("[,()]").test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cs.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cs.{${r.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(r)}`),this}containedBy(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cd.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cd.{${r.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(r)}`),this}rangeGt(e,r){return this.url.searchParams.append(e,`sr.${r}`),this}rangeGte(e,r){return this.url.searchParams.append(e,`nxl.${r}`),this}rangeLt(e,r){return this.url.searchParams.append(e,`sl.${r}`),this}rangeLte(e,r){return this.url.searchParams.append(e,`nxr.${r}`),this}rangeAdjacent(e,r){return this.url.searchParams.append(e,`adj.${r}`),this}overlaps(e,r){return typeof r=="string"?this.url.searchParams.append(e,`ov.${r}`):this.url.searchParams.append(e,`ov.{${r.join(",")}}`),this}textSearch(e,r,{config:n,type:s}={}){let i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");const o=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${o}.${r}`),this}match(e){return Object.entries(e).forEach(([r,n])=>{this.url.searchParams.append(r,`eq.${n}`)}),this}not(e,r,n){return this.url.searchParams.append(e,`not.${r}.${n}`),this}or(e,{foreignTable:r,referencedTable:n=r}={}){const s=n?`${n}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,r,n){return this.url.searchParams.append(e,`${r}.${n}`),this}};Fj.default=Nje;var Aje=Wr&&Wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gT,"__esModule",{value:!0});const Kb=Aje(Fj);let Eje=class{constructor(e,{headers:r={},schema:n,fetch:s}){this.url=e,this.headers=r,this.schema=n,this.fetch=s}select(e,{head:r=!1,count:n}={}){const s=r?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(l=>/\s/.test(l)&&!i?"":(l==='"'&&(i=!i),l)).join("");return this.url.searchParams.set("select",o),n&&(this.headers.Prefer=`count=${n}`),new Kb.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:r,defaultToNull:n=!0}={}){const s="POST",i=[];if(this.headers.Prefer&&i.push(this.headers.Prefer),r&&i.push(`count=${r}`),n||i.push("missing=default"),this.headers.Prefer=i.join(","),Array.isArray(e)){const o=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new Kb.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:r,ignoreDuplicates:n=!1,count:s,defaultToNull:i=!0}={}){const o="POST",l=[`resolution=${n?"ignore":"merge"}-duplicates`];if(r!==void 0&&this.url.searchParams.set("on_conflict",r),this.headers.Prefer&&l.push(this.headers.Prefer),s&&l.push(`count=${s}`),i||l.push("missing=default"),this.headers.Prefer=l.join(","),Array.isArray(e)){const c=e.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);this.url.searchParams.set("columns",u.join(","))}}return new Kb.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:r}={}){const n="PATCH",s=[];return this.headers.Prefer&&s.push(this.headers.Prefer),r&&s.push(`count=${r}`),this.headers.Prefer=s.join(","),new Kb.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){const r="DELETE",n=[];return e&&n.push(`count=${e}`),this.headers.Prefer&&n.unshift(this.headers.Prefer),this.headers.Prefer=n.join(","),new Kb.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}};gT.default=Eje;var bT={},wT={};Object.defineProperty(wT,"__esModule",{value:!0});wT.version=void 0;wT.version="0.0.0-automated";Object.defineProperty(bT,"__esModule",{value:!0});bT.DEFAULT_HEADERS=void 0;const Cje=wT;bT.DEFAULT_HEADERS={"X-Client-Info":`postgrest-js/${Cje.version}`};var fte=Wr&&Wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(u6,"__esModule",{value:!0});const kje=fte(gT),Tje=fte(Fj),Pje=bT;let Oje=class pte{constructor(e,{headers:r={},schema:n,fetch:s}={}){this.url=e,this.headers=Object.assign(Object.assign({},Pje.DEFAULT_HEADERS),r),this.schemaName=n,this.fetch=s}from(e){const r=new URL(`${this.url}/${e}`);return new kje.default(r,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new pte(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:s=!1,count:i}={}){let o;const l=new URL(`${this.url}/rpc/${e}`);let c;n||s?(o=n?"HEAD":"GET",Object.entries(r).filter(([d,h])=>h!==void 0).map(([d,h])=>[d,Array.isArray(h)?`{${h.join(",")}}`:`${h}`]).forEach(([d,h])=>{l.searchParams.append(d,h)})):(o="POST",c=r);const u=Object.assign({},this.headers);return i&&(u.Prefer=`count=${i}`),new Tje.default({method:o,url:l,headers:u,schema:this.schemaName,body:c,fetch:this.fetch,allowEmpty:!1})}};u6.default=Oje;var pb=Wr&&Wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bi,"__esModule",{value:!0});Bi.PostgrestError=Bi.PostgrestBuilder=Bi.PostgrestTransformBuilder=Bi.PostgrestFilterBuilder=Bi.PostgrestQueryBuilder=Bi.PostgrestClient=void 0;const mte=pb(u6);Bi.PostgrestClient=mte.default;const gte=pb(gT);Bi.PostgrestQueryBuilder=gte.default;const yte=pb(Fj);Bi.PostgrestFilterBuilder=yte.default;const xte=pb(yT);Bi.PostgrestTransformBuilder=xte.default;const vte=pb(xT);Bi.PostgrestBuilder=vte.default;const bte=pb(vT);Bi.PostgrestError=bte.default;var Ije=Bi.default={PostgrestClient:mte.default,PostgrestQueryBuilder:gte.default,PostgrestFilterBuilder:yte.default,PostgrestTransformBuilder:xte.default,PostgrestBuilder:vte.default,PostgrestError:bte.default};const{PostgrestClient:Rje,PostgrestQueryBuilder:Dyt,PostgrestFilterBuilder:Lyt,PostgrestTransformBuilder:Fyt,PostgrestBuilder:$yt,PostgrestError:Byt}=Ije;class Mje{static dynamicRequire(e){try{return typeof process<"u"&&process.versions&&process.versions.node&&typeof require<"u"?require(e):null}catch{return null}}static detectEnvironment(){var e,r;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"&&process.versions&&process.versions.node){const n=parseInt(process.versions.node.split(".")[0]);if(n>=22)try{if(typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};const s=this.dynamicRequire("undici");if(s&&s.WebSocket)return{type:"native",constructor:s.WebSocket};throw new Error("undici not available")}catch{return{type:"unsupported",error:`Node.js ${n} detected but native WebSocket not found.`,workaround:'Install the "ws" package or check your Node.js installation.'}}try{const s=this.dynamicRequire("ws");if(s)return{type:"ws",constructor:(r=s.WebSocket)!==null&&r!==void 0?r:s};throw new Error("ws package not available")}catch{return{type:"unsupported",error:`Node.js ${n} detected without WebSocket support.`,workaround:'Install the "ws" package: npm install ws'}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
Suggested solution: ${e.workaround}`),new Error(r)}static createWebSocket(e,r){const n=this.getWebSocketConstructor();return new n(e,r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const Dje="2.15.0",Lje=`realtime-js/${Dje}`,Fje="1.0.0",VD=1e4,$je=1e3,Bje=100;var dw;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(dw||(dw={}));var zn;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(zn||(zn={}));var Zo;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(Zo||(Zo={}));var qD;(function(t){t.websocket="websocket"})(qD||(qD={}));var Qf;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Qf||(Qf={}));class Uje{constructor(){this.HEADER_LENGTH=1}decode(e,r){return e.constructor===ArrayBuffer?r(this._binaryDecode(e)):r(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const r=new DataView(e),n=new TextDecoder;return this._decodeBroadcast(e,r,n)}_decodeBroadcast(e,r,n){const s=r.getUint8(1),i=r.getUint8(2);let o=this.HEADER_LENGTH+2;const l=n.decode(e.slice(o,o+s));o=o+s;const c=n.decode(e.slice(o,o+i));o=o+i;const u=JSON.parse(n.decode(e.slice(o,e.byteLength)));return{ref:null,topic:l,event:c,payload:u}}}let wte=class{constructor(e,r){this.callback=e,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};var Ar;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Ar||(Ar={}));const Yz=(t,e,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return Object.keys(e).reduce((i,o)=>(i[o]=zje(o,t,e,s),i),{})},zje=(t,e,r,n)=>{const s=e.find(l=>l.name===t),i=s==null?void 0:s.type,o=r[t];return i&&!n.includes(i)?_te(i,o):GD(o)},_te=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return qje(e,r)}switch(t){case Ar.bool:return Hje(e);case Ar.float4:case Ar.float8:case Ar.int2:case Ar.int4:case Ar.int8:case Ar.numeric:case Ar.oid:return Wje(e);case Ar.json:case Ar.jsonb:return Vje(e);case Ar.timestamp:return Gje(e);case Ar.abstime:case Ar.date:case Ar.daterange:case Ar.int4range:case Ar.int8range:case Ar.money:case Ar.reltime:case Ar.text:case Ar.time:case Ar.timestamptz:case Ar.timetz:case Ar.tsrange:case Ar.tstzrange:return GD(e);default:return GD(e)}},GD=t=>t,Hje=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Wje=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Vje=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},qje=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let i;const o=t.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>_te(e,l))}return t},Gje=t=>typeof t=="string"?t.replace(" ","T"):t,jte=t=>{let e=t;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"};class YP{constructor(e,r,n={},s=VD){this.channel=e,this.event=r,this.payload=n,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,r){var n;return this._hasReceived(e)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Xz;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Xz||(Xz={}));class hw{constructor(e,r){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(r==null?void 0:r.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},s=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=hw.syncState(this.state,s,i,o),this.pendingDiffs.forEach(c=>{this.state=hw.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],l()}),this.channel._on(n.diff,{},s=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=hw.syncDiff(this.state,s,i,o),l())}),this.onJoin((s,i,o)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:i,newPresences:o})}),this.onLeave((s,i,o)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,r,n,s){const i=this.cloneDeep(e),o=this.transformState(r),l={},c={};return this.map(i,(u,d)=>{o[u]||(c[u]=d)}),this.map(o,(u,d)=>{const h=i[u];if(h){const f=d.map(x=>x.presence_ref),p=h.map(x=>x.presence_ref),g=d.filter(x=>p.indexOf(x.presence_ref)<0),m=h.filter(x=>f.indexOf(x.presence_ref)<0);g.length>0&&(l[u]=g),m.length>0&&(c[u]=m)}else l[u]=d}),this.syncDiff(i,{joins:l,leaves:c},n,s)}static syncDiff(e,r,n,s){const{joins:i,leaves:o}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),s||(s=()=>{}),this.map(i,(l,c)=>{var u;const d=(u=e[l])!==null&&u!==void 0?u:[];if(e[l]=this.cloneDeep(c),d.length>0){const h=e[l].map(p=>p.presence_ref),f=d.filter(p=>h.indexOf(p.presence_ref)<0);e[l].unshift(...f)}n(l,d,c)}),this.map(o,(l,c)=>{let u=e[l];if(!u)return;const d=c.map(h=>h.presence_ref);u=u.filter(h=>d.indexOf(h.presence_ref)<0),e[l]=u,s(l,u,c),u.length===0&&delete e[l]}),e}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return"metas"in s?r[n]=s.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):r[n]=s,r},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Qz;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Qz||(Qz={}));var fw;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(fw||(fw={}));var Wc;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Wc||(Wc={}));class d6{constructor(e,r={config:{}},n){this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=zn.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new YP(this,Zo.join,this.params,this.timeout),this.rejoinTimer=new wte(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=zn.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=zn.closed,this.socket._remove(this)}),this._onError(s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=zn.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=zn.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=zn.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Zo.reply,{},(s,i)=>{this._trigger(this._replyEventName(i),s)}),this.presence=new hw(this),this.broadcastEndpointURL=jte(this.socket.endPoint),this.private=this.params.config.private||!1}subscribe(e,r=this.timeout){var n,s;if(this.socket.isConnected()||this.socket.connect(),this.state==zn.closed){const{config:{broadcast:i,presence:o,private:l}}=this.params,c=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[fw.PRESENCE]&&this.bindings[fw.PRESENCE].length>0,d={},h={broadcast:i,presence:Object.assign(Object.assign({},o),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(f=>e==null?void 0:e(Wc.CHANNEL_ERROR,f)),this._onClose(()=>e==null?void 0:e(Wc.CLOSED)),this.updateJoinPayload(Object.assign({config:h},d)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var p;if(this.socket.setAuth(),f===void 0){e==null||e(Wc.SUBSCRIBED);return}else{const g=this.bindings.postgres_changes,m=(p=g==null?void 0:g.length)!==null&&p!==void 0?p:0,x=[];for(let y=0;y<m;y++){const v=g[y],{filter:{event:b,schema:w,table:j,filter:N}}=v,C=f&&f[y];if(C&&C.event===b&&C.schema===w&&C.table===j&&C.filter===N)x.push(Object.assign(Object.assign({},v),{id:C.id}));else{this.unsubscribe(),this.state=zn.errored,e==null||e(Wc.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=x,e&&e(Wc.SUBSCRIBED);return}}).receive("error",f=>{this.state=zn.errored,e==null||e(Wc.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Wc.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){return this.state===zn.joined&&e===fw.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,r,n)}async send(e,r={}){var n,s;if(!this._canPush()&&e.type==="broadcast"){const{event:i,payload:o}=e,c={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=u.body)===null||s===void 0?void 0:s.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,c;const u=this._push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),u.receive("ok",()=>i("ok")),u.receive("error",()=>i("error")),u.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=zn.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Zo.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(s=>{n=new YP(this,Zo.leave,{},e),n.receive("ok",()=>{r(),s("ok")}).receive("timeout",()=>{r(),s("timed out")}).receive("error",()=>{s("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=zn.closed,this.bindings={}}async _fetchWithTimeout(e,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),o}_push(e,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new YP(this,e,r,n);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Bje){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(e,r,n){return r}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,r,n){var s,i;const o=e.toLocaleLowerCase(),{close:l,error:c,leave:u,join:d}=Zo;if(n&&[l,c,u,d].indexOf(o)>=0&&n!==this._joinRef())return;let f=this._onMessage(o,r,n);if(r&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(p=>{var g,m,x;return((g=p.filter)===null||g===void 0?void 0:g.event)==="*"||((x=(m=p.filter)===null||m===void 0?void 0:m.event)===null||x===void 0?void 0:x.toLocaleLowerCase())===o}).map(p=>p.callback(f,n)):(i=this.bindings[o])===null||i===void 0||i.filter(p=>{var g,m,x,y,v,b;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in p){const w=p.id,j=(g=p.filter)===null||g===void 0?void 0:g.event;return w&&((m=r.ids)===null||m===void 0?void 0:m.includes(w))&&(j==="*"||(j==null?void 0:j.toLocaleLowerCase())===((x=r.data)===null||x===void 0?void 0:x.type.toLocaleLowerCase()))}else{const w=(v=(y=p==null?void 0:p.filter)===null||y===void 0?void 0:y.event)===null||v===void 0?void 0:v.toLocaleLowerCase();return w==="*"||w===((b=r==null?void 0:r.event)===null||b===void 0?void 0:b.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===o}).map(p=>{if(typeof f=="object"&&"ids"in f){const g=f.data,{schema:m,table:x,commit_timestamp:y,type:v,errors:b}=g;f=Object.assign(Object.assign({},{schema:m,table:x,commit_timestamp:y,eventType:v,new:{},old:{},errors:b}),this._getPayloadRecords(g))}p.callback(f,n)})}_isClosed(){return this.state===zn.closed}_isJoined(){return this.state===zn.joined}_isJoining(){return this.state===zn.joining}_isLeaving(){return this.state===zn.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,r,n){const s=e.toLocaleLowerCase(),i={type:s,filter:r,callback:n};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,r){const n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(s=>{var i;return!(((i=s.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===n&&d6.isEqual(s.filter,r))})),this}static isEqual(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(const n in e)if(e[n]!==r[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Zo.close,{},e)}_onError(e){this._on(Zo.error,{},r=>e(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=zn.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=Yz(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=Yz(e.columns,e.old_record)),r}}const Zz=()=>{},iN={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Kje=[1e3,2e3,5e3,1e4],Yje=1e4,Xje=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class Qje{constructor(e,r){var n;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=VD,this.transport=null,this.heartbeatIntervalMs=iN.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Zz,this.ref=0,this.reconnectTimer=null,this.logger=Zz,this.conn=null,this.sendBuffer=[],this.serializer=new Uje,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=s=>{let i;return s?i=s:typeof fetch>"u"?i=(...o)=>Lj(async()=>{const{default:l}=await Promise.resolve().then(()=>fb);return{default:l}},void 0).then(({default:l})=>l(...o)).catch(l=>{throw new Error(`Failed to load @supabase/node-fetch: ${l.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):i=fetch,(...o)=>i(...o)},!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${e}/${qD.websocket}`,this.httpEndpoint=jte(e),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Mje.createWebSocket(this.endpointURL())}catch(e){throw this._setConnectionState("disconnected"),new Error(`WebSocket not available: ${e.message}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:Fje}))}disconnect(e,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},e?this.conn.close(e,r??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const e=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,r,n){this.logger(e,r,n)}connectionState(){switch(this.conn&&this.conn.readyState){case dw.connecting:return Qf.Connecting;case dw.open:return Qf.Open;case dw.closing:return Qf.Closing;default:return Qf.Closed}}isConnected(){return this.connectionState()===Qf.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,r={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new d6(`realtime:${e}`,r,this);return this.channels.push(i),i}}push(e){const{topic:r,event:n,payload:s,ref:i}=e,o=()=>{this.encode(e,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${r} ${n} (${i})`,s),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){this.heartbeatCallback("disconnected");return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.heartbeatCallback("timeout"),this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close($je,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},iN.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatCallback("sent"),this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let r=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${e}"`),r.unsubscribe())}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,r=>{r.topic==="phoenix"&&r.event==="phx_reply"&&this.heartbeatCallback(r.payload.status==="ok"?"ok":"error"),r.ref&&r.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:n,event:s,payload:i,ref:o}=r,l=o?`(${o})`:"",c=i.status||"";this.log("receive",`${c} ${n} ${s} ${l}`.trim(),i),this.channels.filter(u=>u._isMember(n)).forEach(u=>u._trigger(s,i,o)),this._triggerStateCallbacks("message",r)})}_clearTimer(e){var r;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this.workerRef.terminate()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var r;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(Zo.error))}_appendParams(e,r){if(Object.keys(r).length===0)return e;const n=e.match(/\?/)?"&":"?",s=new URLSearchParams(r);return`${e}${n}${s}`}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([Xje],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_setConnectionState(e,r=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(e=null){let r;e?r=e:this.accessToken?r=await this.accessToken():r=this.accessTokenValue,this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(n=>{const s={access_token:r,version:Lje};r&&n.updateJoinPayload(s),n.joinedOnce&&n._isJoined()&&n._push(Zo.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(r=>{this.log("error",`error setting auth in ${e}`,r)})}_triggerStateCallbacks(e,r){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(r)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new wte(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},iN.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var r,n,s,i,o,l,c,u;if(this.transport=(r=e==null?void 0:e.transport)!==null&&r!==void 0?r:null,this.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:VD,this.heartbeatIntervalMs=(s=e==null?void 0:e.heartbeatIntervalMs)!==null&&s!==void 0?s:iN.HEARTBEAT_INTERVAL,this.worker=(i=e==null?void 0:e.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=e==null?void 0:e.accessToken)!==null&&o!==void 0?o:null,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(l=e==null?void 0:e.reconnectAfterMs)!==null&&l!==void 0?l:d=>Kje[d-1]||Yje,this.encode=(c=e==null?void 0:e.encode)!==null&&c!==void 0?c:(d,h)=>h(JSON.stringify(d)),this.decode=(u=e==null?void 0:e.decode)!==null&&u!==void 0?u:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}class h6 extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function ds(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class Zje extends h6{constructor(e,r,n){super(e),this.name="StorageApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class KD extends h6{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}}var Jje=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};const Ste=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...r)=>Lj(async()=>{const{default:n}=await Promise.resolve().then(()=>fb);return{default:n}},void 0).then(({default:n})=>n(...r)):e=fetch,(...r)=>e(...r)},eSe=()=>Jje(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Lj(()=>Promise.resolve().then(()=>fb),void 0)).Response:Response}),YD=t=>{if(Array.isArray(t))return t.map(r=>YD(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=YD(n)}),e},tSe=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};var lg=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};const XP=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),rSe=(t,e,r)=>lg(void 0,void 0,void 0,function*(){const n=yield eSe();t instanceof n&&!(r!=null&&r.noResolveJson)?t.json().then(s=>{const i=t.status||500,o=(s==null?void 0:s.statusCode)||i+"";e(new Zje(XP(s),i,o))}).catch(s=>{e(new KD(XP(s),s))}):e(new KD(XP(t),t))}),nSe=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!n?s:(tSe(n)?(s.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),s.body=JSON.stringify(n)):s.body=n,Object.assign(Object.assign({},s),r))};function $j(t,e,r,n,s,i){return lg(this,void 0,void 0,function*(){return new Promise((o,l)=>{t(r,nSe(e,n,s,i)).then(c=>{if(!c.ok)throw c;return n!=null&&n.noResolveJson?c:c.json()}).then(c=>o(c)).catch(c=>rSe(c,l,n))})})}function qE(t,e,r,n){return lg(this,void 0,void 0,function*(){return $j(t,"GET",e,r,n)})}function Vc(t,e,r,n,s){return lg(this,void 0,void 0,function*(){return $j(t,"POST",e,n,s,r)})}function XD(t,e,r,n,s){return lg(this,void 0,void 0,function*(){return $j(t,"PUT",e,n,s,r)})}function sSe(t,e,r,n){return lg(this,void 0,void 0,function*(){return $j(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function Nte(t,e,r,n,s){return lg(this,void 0,void 0,function*(){return $j(t,"DELETE",e,n,s,r)})}var Ci=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};const iSe={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Jz={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class aSe{constructor(e,r={},n,s){this.url=e,this.headers=r,this.bucketId=n,this.fetch=Ste(s)}uploadOrUpdate(e,r,n,s){return Ci(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},Jz),s);let l=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c))):(i=n,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=this.toBase64(this.encodeMetadata(c)))),s!=null&&s.headers&&(l=Object.assign(Object.assign({},l),s.headers));const u=this._removeEmptyFolders(r),d=this._getFinalPath(u),h=yield(e=="PUT"?XD:Vc)(this.fetch,`${this.url}/object/${d}`,i,Object.assign({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{data:{path:u,id:h.Id,fullPath:h.Key},error:null}}catch(i){if(ds(i))return{data:null,error:i};throw i}})}upload(e,r,n){return Ci(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,s){return Ci(this,void 0,void 0,function*(){const i=this._removeEmptyFolders(e),o=this._getFinalPath(i),l=new URL(this.url+`/object/upload/sign/${o}`);l.searchParams.set("token",r);try{let c;const u=Object.assign({upsert:Jz.upsert},s),d=Object.assign(Object.assign({},this.headers),{"x-upsert":String(u.upsert)});typeof Blob<"u"&&n instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),c.append("",n)):typeof FormData<"u"&&n instanceof FormData?(c=n,c.append("cacheControl",u.cacheControl)):(c=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType);const h=yield XD(this.fetch,l.toString(),c,{headers:d});return{data:{path:i,fullPath:h.Key},error:null}}catch(c){if(ds(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(e,r){return Ci(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e);const s=Object.assign({},this.headers);r!=null&&r.upsert&&(s["x-upsert"]="true");const i=yield Vc(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(this.url+i.url),l=o.searchParams.get("token");if(!l)throw new h6("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:l},error:null}}catch(n){if(ds(n))return{data:null,error:n};throw n}})}update(e,r,n){return Ci(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return Ci(this,void 0,void 0,function*(){try{return{data:yield Vc(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers}),error:null}}catch(s){if(ds(s))return{data:null,error:s};throw s}})}copy(e,r,n){return Ci(this,void 0,void 0,function*(){try{return{data:{path:(yield Vc(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers})).Key},error:null}}catch(s){if(ds(s))return{data:null,error:s};throw s}})}createSignedUrl(e,r,n){return Ci(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e),i=yield Vc(this.fetch,`${this.url}/object/sign/${s}`,Object.assign({expiresIn:r},n!=null&&n.transform?{transform:n.transform}:{}),{headers:this.headers});const o=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${o}`)},{data:i,error:null}}catch(s){if(ds(s))return{data:null,error:s};throw s}})}createSignedUrls(e,r,n){return Ci(this,void 0,void 0,function*(){try{const s=yield Vc(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),i=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{data:s.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${i}`):null})),error:null}}catch(s){if(ds(s))return{data:null,error:s};throw s}})}download(e,r){return Ci(this,void 0,void 0,function*(){const s=typeof(r==null?void 0:r.transform)<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((r==null?void 0:r.transform)||{}),o=i?`?${i}`:"";try{const l=this._getFinalPath(e);return{data:yield(yield qE(this.fetch,`${this.url}/${s}/${l}${o}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(l){if(ds(l))return{data:null,error:l};throw l}})}info(e){return Ci(this,void 0,void 0,function*(){const r=this._getFinalPath(e);try{const n=yield qE(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:YD(n),error:null}}catch(n){if(ds(n))return{data:null,error:n};throw n}})}exists(e){return Ci(this,void 0,void 0,function*(){const r=this._getFinalPath(e);try{return yield sSe(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(ds(n)&&n instanceof KD){const s=n.originalError;if([400,404].includes(s==null?void 0:s.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,r){const n=this._getFinalPath(e),s=[],i=r!=null&&r.download?`download=${r.download===!0?"":r.download}`:"";i!==""&&s.push(i);const l=typeof(r==null?void 0:r.transform)<"u"?"render/image":"object",c=this.transformOptsToQueryString((r==null?void 0:r.transform)||{});c!==""&&s.push(c);let u=s.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}${u}`)}}}remove(e){return Ci(this,void 0,void 0,function*(){try{return{data:yield Nte(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(ds(r))return{data:null,error:r};throw r}})}list(e,r,n){return Ci(this,void 0,void 0,function*(){try{const s=Object.assign(Object.assign(Object.assign({},iSe),r),{prefix:e||""});return{data:yield Vc(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(ds(s))return{data:null,error:s};throw s}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const r=[];return e.width&&r.push(`width=${e.width}`),e.height&&r.push(`height=${e.height}`),e.resize&&r.push(`resize=${e.resize}`),e.format&&r.push(`format=${e.format}`),e.quality&&r.push(`quality=${e.quality}`),r.join("&")}}const oSe="2.10.4",lSe={"X-Client-Info":`storage-js/${oSe}`};var jg=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};class cSe{constructor(e,r={},n,s){const i=new URL(e);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href,this.headers=Object.assign(Object.assign({},lSe),r),this.fetch=Ste(n)}listBuckets(){return jg(this,void 0,void 0,function*(){try{return{data:yield qE(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(ds(e))return{data:null,error:e};throw e}})}getBucket(e){return jg(this,void 0,void 0,function*(){try{return{data:yield qE(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(ds(r))return{data:null,error:r};throw r}})}createBucket(e,r={public:!1}){return jg(this,void 0,void 0,function*(){try{return{data:yield Vc(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:r.type,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(ds(n))return{data:null,error:n};throw n}})}updateBucket(e,r){return jg(this,void 0,void 0,function*(){try{return{data:yield XD(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(ds(n))return{data:null,error:n};throw n}})}emptyBucket(e){return jg(this,void 0,void 0,function*(){try{return{data:yield Vc(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(ds(r))return{data:null,error:r};throw r}})}deleteBucket(e){return jg(this,void 0,void 0,function*(){try{return{data:yield Nte(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(ds(r))return{data:null,error:r};throw r}})}}class uSe extends cSe{constructor(e,r={},n,s){super(e,r,n,s)}from(e){return new aSe(this.url,this.headers,e,this.fetch)}}const dSe="2.54.0";let N0="";typeof Deno<"u"?N0="deno":typeof document<"u"?N0="web":typeof navigator<"u"&&navigator.product==="ReactNative"?N0="react-native":N0="node";const hSe={"X-Client-Info":`supabase-js-${N0}/${dSe}`},fSe={headers:hSe},pSe={schema:"public"},mSe={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},gSe={};var ySe=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};const xSe=t=>{let e;return t?e=t:typeof fetch>"u"?e=ute:e=fetch,(...r)=>e(...r)},vSe=()=>typeof Headers>"u"?dte:Headers,bSe=(t,e,r)=>{const n=xSe(r),s=vSe();return(i,o)=>ySe(void 0,void 0,void 0,function*(){var l;const c=(l=yield e())!==null&&l!==void 0?l:t;let u=new s(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",t),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),n(i,Object.assign(Object.assign({},o),{headers:u}))})};var wSe=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};function _Se(t){return t.endsWith("/")?t:t+"/"}function jSe(t,e){var r,n;const{db:s,auth:i,realtime:o,global:l}=t,{db:c,auth:u,realtime:d,global:h}=e,f={db:Object.assign(Object.assign({},c),s),auth:Object.assign(Object.assign({},u),i),realtime:Object.assign(Object.assign({},d),o),storage:{},global:Object.assign(Object.assign(Object.assign({},h),l),{headers:Object.assign(Object.assign({},(r=h==null?void 0:h.headers)!==null&&r!==void 0?r:{}),(n=l==null?void 0:l.headers)!==null&&n!==void 0?n:{})}),accessToken:()=>wSe(this,void 0,void 0,function*(){return""})};return t.accessToken?f.accessToken=t.accessToken:delete f.accessToken,f}const Ate="2.71.1",Fg=30*1e3,QD=3,QP=QD*Fg,SSe="http://localhost:9999",NSe="supabase.auth.token",ASe={"X-Client-Info":`gotrue-js/${Ate}`},ZD="X-Supabase-Api-Version",Ete={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},ESe=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,CSe=10*60*1e3;class f6 extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}}function Ot(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class kSe extends f6{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function TSe(t){return Ot(t)&&t.name==="AuthApiError"}class Cte extends f6{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class gf extends f6{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class jd extends gf{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function PSe(t){return Ot(t)&&t.name==="AuthSessionMissingError"}class aN extends gf{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class oN extends gf{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class lN extends gf{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function OSe(t){return Ot(t)&&t.name==="AuthImplicitGrantRedirectError"}class eH extends gf{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class JD extends gf{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function ZP(t){return Ot(t)&&t.name==="AuthRetryableFetchError"}class tH extends gf{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}}class e4 extends gf{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const GE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),rH=`
\r=`.split(""),ISe=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<rH.length;e+=1)t[rH[e].charCodeAt(0)]=-2;for(let e=0;e<GE.length;e+=1)t[GE[e].charCodeAt(0)]=e;return t})();function nH(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(GE[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(GE[n]),e.queuedBits-=6}}function kte(t,e,r){const n=ISe[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function sH(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{DSe(o,n,r)};for(let o=0;o<t.length;o+=1)kte(t.charCodeAt(o),s,i);return e.join("")}function RSe(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function MSe(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}RSe(n,e)}}function DSe(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function LSe(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)kte(t.charCodeAt(s),r,n);return new Uint8Array(e)}function FSe(t){const e=[];return MSe(t,r=>e.push(r)),new Uint8Array(e)}function $Se(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>nH(s,r,n)),nH(null,r,n),e.join("")}function BSe(t){return Math.round(Date.now()/1e3)+t}function USe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const Io=()=>typeof window<"u"&&typeof document<"u",Pf={tested:!1,writable:!1},Tte=()=>{if(!Io())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Pf.tested)return Pf.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Pf.tested=!0,Pf.writable=!0}catch{Pf.tested=!0,Pf.writable=!1}return Pf.writable};function zSe(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return r.searchParams.forEach((n,s)=>{e[s]=n}),e}const Pte=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...r)=>Lj(async()=>{const{default:n}=await Promise.resolve().then(()=>fb);return{default:n}},void 0).then(({default:n})=>n(...r)):e=fetch,(...r)=>e(...r)},HSe=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",$g=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},Of=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return r}},yd=async(t,e)=>{await t.removeItem(e)};class _T{constructor(){this.promise=new _T.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}_T.promiseConstructor=Promise;function JP(t){const e=t.split(".");if(e.length!==3)throw new e4("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!ESe.test(e[n]))throw new e4("JWT not in base64url format");return{header:JSON.parse(sH(e[0])),payload:JSON.parse(sH(e[1])),signature:LSe(e[2]),raw:{header:e[0],payload:e[1]}}}async function WSe(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function VSe(t,e){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){n(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function qSe(t){return("0"+t.toString(16)).substr(-2)}function GSe(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let i=0;i<56;i++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(e),Array.from(e,qSe).join("")}async function KSe(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function YSe(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await KSe(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Sg(t,e,r=!1){const n=GSe();let s=n;r&&(s+="/PASSWORD_RECOVERY"),await $g(t,`${e}-code-verifier`,s);const i=await YSe(n);return[i,n===i?"plain":"s256"]}const XSe=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function QSe(t){const e=t.headers.get(ZD);if(!e||!e.match(XSe))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function ZSe(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function JSe(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const eNe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Ng(t){if(!eNe.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function eO(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function iH(t){return JSON.parse(JSON.stringify(t))}var tNe=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r};const zf=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),rNe=[502,503,504];async function aH(t){var e;if(!HSe(t))throw new JD(zf(t),0);if(rNe.includes(t.status))throw new JD(zf(t),t.status);let r;try{r=await t.json()}catch(i){throw new Cte(zf(i),i)}let n;const s=QSe(t);if(s&&s.getTime()>=Ete["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new tH(zf(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new jd}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new tH(zf(r),t.status,r.weak_password.reasons);throw new kSe(zf(r),t.status||500,n)}const nNe=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function zt(t,e,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[ZD]||(i[ZD]=Ete["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const o=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await sNe(t,e,r+l,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(c):{data:Object.assign({},c),error:null}}async function sNe(t,e,r,n,s,i){const o=nNe(e,n,s,i);let l;try{l=await t(r,Object.assign({},o))}catch(c){throw console.error(c),new JD(zf(c),0)}if(l.ok||await aH(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(c){await aH(c)}}function $c(t){var e;let r=null;lNe(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=BSe(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:n},error:null}}function oH(t){const e=$c(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Od(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function iNe(t){return{data:t,error:null}}function aNe(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=t,o=tNe(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function oNe(t){return t}function lNe(t){return t.access_token&&t.refresh_token&&t.expires_in}const tO=["global","local","others"];var cNe=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r};class uNe{constructor({url:e="",headers:r={},fetch:n}){this.url=e,this.headers=r,this.fetch=Pte(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,r=tO[0]){if(tO.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${tO.join(", ")}`);try{return await zt(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Ot(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await zt(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Od})}catch(n){if(Ot(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=cNe(e,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await zt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:aNe,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(Ot(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await zt(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Od})}catch(r){if(Ot(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,s,i,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await zt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:oNe});if(d.error)throw d.error;const h=await d.json(),f=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(g=>{const m=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(g.split(";")[1].split("=")[1]);u[`${x}Page`]=m}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(Ot(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){Ng(e);try{return await zt(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Od})}catch(r){if(Ot(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Ng(e);try{return await zt(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:Od})}catch(n){if(Ot(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Ng(e);try{return await zt(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:Od})}catch(n){if(Ot(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Ng(e.userId);try{const{data:r,error:n}=await zt(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(Ot(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Ng(e.userId),Ng(e.id);try{return{data:await zt(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(Ot(r))return{data:null,error:r};throw r}}}function lH(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}function dNe(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}const Ag={debug:!!(globalThis&&Tte()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Ote extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class hNe extends Ote{}async function fNe(t,e,r){Ag.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),Ag.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async s=>{if(s){Ag.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,s.name);try{return await r()}finally{Ag.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,s.name)}}else{if(e===0)throw Ag.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new hNe(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Ag.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null," "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}}))}dNe();const pNe={url:SSe,storageKey:NSe,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ASe,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function cH(t,e,r){return await r()}const Eg={};class Qw{constructor(e){var r,n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=Qw.nextInstanceID,Qw.nextInstanceID+=1,this.instanceID>0&&Io()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const s=Object.assign(Object.assign({},pNe),e);if(this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.persistSession=s.persistSession,this.storageKey=s.storageKey,this.autoRefreshToken=s.autoRefreshToken,this.admin=new uNe({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=Pte(s.fetch),this.lock=s.lock||cH,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,s.lock?this.lock=s.lock:Io()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=fNe:this.lock=cH,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:Tte()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=lH(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=lH(this.memoryStorage)),Io()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}get jwks(){var e,r;return(r=(e=Eg[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Eg[this.storageKey]=Object.assign(Object.assign({},Eg[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Eg[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Eg[this.storageKey]=Object.assign(Object.assign({},Eg[this.storageKey]),{cachedAt:e})}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${Ate}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const r=zSe(window.location.href);let n="none";if(this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce"),Io()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:i}=await this._getSessionFromURL(r,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),OSe(i)){const c=(e=i.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:o,redirectType:l}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return Ot(r)?{error:r}:{error:new Cte("Unexpected error during initialization",r)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const i=await zt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:$c}),{data:o,error:l}=i;if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(i){if(Ot(i))return{data:{user:null,session:null},error:i};throw i}}async signUp(e){var r,n,s;try{let i;if("email"in e){const{email:d,password:h,options:f}=e;let p=null,g=null;this.flowType==="pkce"&&([p,g]=await Sg(this.storage,this.storageKey)),i=await zt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:d,password:h,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:g},xform:$c})}else if("phone"in e){const{phone:d,password:h,options:f}=e;i=await zt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:h,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},channel:(s=f==null?void 0:f.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:$c})}else throw new oN("You must provide either an email or phone number and a password");const{data:o,error:l}=i;if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(i){if(Ot(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{let r;if("email"in e){const{email:i,password:o,options:l}=e;r=await zt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:oH})}else if("phone"in e){const{phone:i,password:o,options:l}=e;r=await zt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:oH})}else throw new oN("You must provide either an email or phone number and a password");const{data:n,error:s}=r;return s?{data:{user:null,session:null},error:s}:!n||!n.session||!n.user?{data:{user:null,session:null},error:new aN}:(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),{data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if(Ot(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOAuth(e){var r,n,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:r}=e;if(r==="solana")return await this.signInWithSolana(e);throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}async signInWithSolana(e){var r,n,s,i,o,l,c,u,d,h,f,p;let g,m;if("message"in e)g=e.message,m=e.signature;else{const{chain:x,wallet:y,statement:v,options:b}=e;let w;if(Io())if(typeof y=="object")w=y;else{const N=window;if("solana"in N&&typeof N.solana=="object"&&("signIn"in N.solana&&typeof N.solana.signIn=="function"||"signMessage"in N.solana&&typeof N.solana.signMessage=="function"))w=N.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof y!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=y}const j=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in w&&w.signIn){const N=await w.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:j.host,uri:j.href}),v?{statement:v}:null));let C;if(Array.isArray(N)&&N[0]&&typeof N[0]=="object")C=N[0];else if(N&&typeof N=="object"&&"signedMessage"in N&&"signature"in N)C=N;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in C&&"signature"in C&&(typeof C.signedMessage=="string"||C.signedMessage instanceof Uint8Array)&&C.signature instanceof Uint8Array)g=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),m=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in w)||typeof w.signMessage!="function"||!("publicKey"in w)||typeof w!="object"||!w.publicKey||!("toBase58"in w.publicKey)||typeof w.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${j.host} wants you to sign in with your Solana account:`,w.publicKey.toBase58(),...v?["",v,""]:[""],"Version: 1",`URI: ${j.href}`,`Issued At: ${(s=(n=b==null?void 0:b.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=b==null?void 0:b.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((u=b==null?void 0:b.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((h=(d=b==null?void 0:b.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",...b.signInWithSolana.resources.map(C=>`- ${C}`)]:[]].join(`
`);const N=await w.signMessage(new TextEncoder().encode(g),"utf8");if(!N||!(N instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");m=N}}try{const{data:x,error:y}=await zt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:$Se(m)},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:$c});if(y)throw y;return!x||!x.session||!x.user?{data:{user:null,session:null},error:new aN}:(x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),{data:Object.assign({},x),error:y})}catch(x){if(Ot(x))return{data:{user:null,session:null},error:x};throw x}}async _exchangeCodeForSession(e){const r=await Of(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{const{data:i,error:o}=await zt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:$c});if(await yd(this.storage,`${this.storageKey}-code-verifier`),o)throw o;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new aN}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(Ot(i))return{data:{user:null,session:null,redirectType:null},error:i};throw i}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:i,nonce:o}=e,l=await zt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:$c}),{data:c,error:u}=l;return u?{data:{user:null,session:null},error:u}:!c||!c.session||!c.user?{data:{user:null,session:null},error:new aN}:(c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),{data:c,error:u})}catch(r){if(Ot(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOtp(e){var r,n,s,i,o;try{if("email"in e){const{email:l,options:c}=e;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await Sg(this.storage,this.storageKey));const{error:h}=await zt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(r=c==null?void 0:c.data)!==null&&r!==void 0?r:{},create_user:(n=c==null?void 0:c.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c==null?void 0:c.emailRedirectTo});return{data:{user:null,session:null},error:h}}if("phone"in e){const{phone:l,options:c}=e,{data:u,error:d}=await zt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d}}throw new oN("You must provide either an email or phone number.")}catch(l){if(Ot(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(e){var r,n;try{let s,i;"options"in e&&(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo,i=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:l}=await zt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:$c});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,u=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(s){if(Ot(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithSSO(e){var r,n,s;try{let i=null,o=null;return this.flowType==="pkce"&&([i,o]=await Sg(this.storage,this.storageKey)),await zt(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:o}),headers:this.headers,xform:iNe})}catch(i){if(Ot(i))return{data:null,error:i};throw i}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new jd;const{error:s}=await zt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return{data:{user:null,session:null},error:s}})}catch(e){if(Ot(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:s,options:i}=e,{error:o}=await zt(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:n,type:s,options:i}=e,{data:o,error:l}=await zt(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l}}throw new oN("You must provide either an email or phone number and a type")}catch(r){if(Ot(r))return{data:{user:null,session:null},error:r};throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await Of(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<QP:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await Of(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=eO()}if(this.storage.isServer&&e.user){let o=this.suppressGetSessionWarning;e=new Proxy(e,{get:(c,u,d)=>(!o&&u==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),o=!0,this.suppressGetSessionWarning=!0),Reflect.get(c,u,d))})}return{data:{session:e},error:null}}const{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:s},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await zt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Od}):await this._useSession(async r=>{var n,s,i;const{data:o,error:l}=r;if(l)throw l;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new jd}:await zt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:Od})})}catch(r){if(Ot(r))return PSe(r)&&(await this._removeSession(),await yd(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:r};throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new jd;const o=s.session;let l=null,c=null;this.flowType==="pkce"&&e.email!=null&&([l,c]=await Sg(this.storage,this.storageKey));const{data:u,error:d}=await zt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:Od});if(d)throw d;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(n){if(Ot(n))return{data:{user:null},error:n};throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new jd;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:o}=JP(e.access_token);if(o.exp&&(n=o.exp,s=n<=r),s){const{session:l,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return{data:{user:null,session:null},error:c};if(!l)return{data:{user:null,session:null},error:null};i=l}else{const{data:l,error:c}=await this._getUser(e.access_token);if(c)throw c;i={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(r){if(Ot(r))return{data:{session:null,user:null},error:r};throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:o,error:l}=r;if(l)throw l;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new jd;const{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(r){if(Ot(r))return{data:{user:null,session:null},error:r};throw r}}async _getSessionFromURL(e,r){try{if(!Io())throw new lN("No browser detected.");if(e.error||e.error_description||e.error_code)throw new lN(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new eH("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new lN("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new eH("No code detected.");const{data:v,error:b}=await this._exchangeCodeForSession(e.code);if(b)throw b;const w=new URL(window.location.href);return w.searchParams.delete("code"),window.history.replaceState(window.history.state,"",w.toString()),{data:{session:v.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:s,access_token:i,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=e;if(!i||!l||!o||!u)throw new lN("No session defined in URL");const d=Math.round(Date.now()/1e3),h=parseInt(l);let f=d+h;c&&(f=parseInt(c));const p=f-d;p*1e3<=Fg&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${h}s`);const g=f-h;d-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,f,d):d-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",g,f,d);const{data:m,error:x}=await this._getUser(i);if(x)throw x;const y={provider_token:n,provider_refresh_token:s,access_token:i,expires_in:h,expires_at:f,refresh_token:o,token_type:u,user:m.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:e.type},error:null}}catch(n){if(Ot(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await Of(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return{error:i};const o=(n=s.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:l}=await this.admin.signOut(o,e);if(l&&!(TSe(l)&&(l.status===404||l.status===401||l.status===403)))return{error:l}}return e!=="others"&&(await this._removeSession(),await yd(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const r=USe(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,s;try{const{data:{session:i},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),console.error(i)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Sg(this.storage,this.storageKey,!0));try{return await zt(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(Ot(i))return{data:null,error:i};throw i}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return{data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(r){if(Ot(r))return{data:null,error:r};throw r}}async linkIdentity(e){var r;try{const{data:n,error:s}=await this._useSession(async i=>{var o,l,c,u,d;const{data:h,error:f}=i;if(f)throw f;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await zt(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return Io()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),{data:{provider:e.provider,url:n==null?void 0:n.url},error:null}}catch(n){if(Ot(n))return{data:{provider:e.provider,url:null},error:n};throw n}}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)throw o;return await zt(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(Ot(r))return{data:null,error:r};throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await VSe(async s=>(s>0&&await WSe(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await zt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:$c})),(s,i)=>{const o=200*Math.pow(2,s);return i&&ZP(i)&&Date.now()+o-n<Fg})}catch(n){if(this._debug(r,"error",n),Ot(n))return{data:{session:null,user:null},error:n};throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),Io()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await Of(this.storage,this.storageKey);if(s&&this.userStorage){let o=await Of(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await $g(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:eO()}else if(s&&!s.user&&!s.user){const o=await Of(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await yd(this.storage,this.storageKey+"-user"),await $g(this.storage,this.storageKey,s)):s.user=eO()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const i=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<QP;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${QP}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),ZP(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(s.access_token);!l&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new jd;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new _T;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new jd;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const l={session:i.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(i){if(this._debug(s,"error",i),Ot(i)){const o={session:null,error:i};return ZP(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,r,n=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,r)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await $g(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=iH(s);await $g(this.storage,this.storageKey,i)}else{const s=iH(r);await $g(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),await yd(this.storage,this.storageKey),await yd(this.storage,this.storageKey+"-code-verifier"),await yd(this.storage,this.storageKey+"-user"),this.userStorage&&await yd(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Io()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Fg);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-e)/Fg);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Fg}ms, refresh threshold is ${QD} ticks`),s<=QD&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof Ote)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Io()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,o]=await Sg(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(l.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);s.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?{data:null,error:i}:await zt(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(Ot(r))return{data:null,error:r};throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)return{data:null,error:o};const l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:{issuer:e.issuer}),{data:c,error:u}=await zt(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return u?{data:null,error:u}:(e.factorType==="totp"&&(!((s=c==null?void 0:c.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),{data:c,error:null})})}catch(r){if(Ot(r))return{data:null,error:r};throw r}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return{data:null,error:i};const{data:o,error:l}=await zt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),{data:o,error:l})})}catch(r){if(Ot(r))return{data:null,error:r};throw r}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?{data:null,error:i}:await zt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(Ot(r))return{data:null,error:r};throw r}})}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?{data:null,error:n}:await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){const{data:{user:e},error:r}=await this.getUser();if(r)return{data:null,error:r};const n=(e==null?void 0:e.factors)||[],s=n.filter(o=>o.factor_type==="totp"&&o.status==="verified"),i=n.filter(o=>o.factor_type==="phone"&&o.status==="verified");return{data:{all:n,totp:s,phone:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var r,n;const{data:{session:s},error:i}=e;if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=JP(s.access_token);let l=null;o.aal&&(l=o.aal);let c=l;((n=(r=s.user.factors)===null||r===void 0?void 0:r.filter(h=>h.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(c="aal2");const d=o.amr||[];return{data:{currentLevel:l,nextLevel:c,currentAuthenticationMethods:d},error:null}}))}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(l=>l.kid===e);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(l=>l.kid===e),n&&this.jwks_cached_at+CSe>s)return n;const{data:i,error:o}=await zt(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,n=i.keys.find(l=>l.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:p,error:g}=await this.getSession();if(g||!p.session)return{data:null,error:g};n=p.session.access_token}const{header:s,payload:i,signature:o,raw:{header:l,payload:c}}=JP(n);r!=null&&r.allowExpired||ZSe(i.exp);const u=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!u){const{error:p}=await this.getUser(n);if(p)throw p;return{data:{claims:i,header:s,signature:o},error:null}}const d=JSe(s.alg),h=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,o,FSe(`${l}.${c}`)))throw new e4("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if(Ot(n))return{data:null,error:n};throw n}}}Qw.nextInstanceID=0;const mNe=Qw;class gNe extends mNe{constructor(e){super(e)}}var yNe=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};class xNe{constructor(e,r,n){var s,i,o;if(this.supabaseUrl=e,this.supabaseKey=r,!e)throw new Error("supabaseUrl is required.");if(!r)throw new Error("supabaseKey is required.");const l=_Se(e),c=new URL(l);this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,d={db:pSe,realtime:gSe,auth:Object.assign(Object.assign({},mSe),{storageKey:u}),global:fSe},h=jSe(n??{},d);this.storageKey=(s=h.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(i=h.global.headers)!==null&&i!==void 0?i:{},h.accessToken?(this.accessToken=h.accessToken,this.auth=new Proxy({},{get:(f,p)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(p)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=h.auth)!==null&&o!==void 0?o:{},this.headers,h.global.fetch),this.fetch=bSe(r,this._getAccessToken.bind(this),h.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},h.realtime)),this.rest=new Rje(new URL("rest/v1",c).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch}),this.storage=new uSe(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new uje(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,r={},n={}){return this.rest.rpc(e,r,n)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,r;return yNe(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();const{data:n}=yield this.auth.getSession();return(r=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:s,storageKey:i,flowType:o,lock:l,debug:c},u,d){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new gNe({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),u),storageKey:i,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:s,flowType:o,lock:l,debug:c,fetch:d,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new Qje(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,n)=>{this._handleTokenChanged(r,"CLIENT",n==null?void 0:n.access_token)})}_handleTokenChanged(e,r,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?this.changedAccessToken=n:e==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const Ite=(t,e,r)=>new xNe(t,e,r);function vNe(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}vNe()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const bNe="https://nqibmbtqcjucktqcreob.supabase.co",wNe="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5xaWJtYnRxY2p1Y2t0cWNyZW9iIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ1NTk5MTAsImV4cCI6MjA3MDEzNTkxMH0.UnFk-GqYCZtlkXNlxyHUTaFAnS6Q4hIgDgWKANrxEHg",kr=Ite(bNe,wNe,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),Rte=S.createContext(void 0);function _Ne({children:t}){const[e,r]=S.useState(null),[n,s]=S.useState(null),[i,o]=S.useState(null),[l,c]=S.useState(null),[u,d]=S.useState(!0),h=async A=>{try{await Promise.all([f(A),p(A),g(A)])}catch($){console.error("Error loading user data:",$)}finally{d(!1)}};S.useEffect(()=>{let A=!0;kr.auth.getSession().then(async({data:{session:K}})=>{A&&(r((K==null?void 0:K.user)??null),K!=null&&K.user?await h(K.user.id):d(!1))});const{data:{subscription:$}}=kr.auth.onAuthStateChange((K,G)=>{A&&(K==="SIGNED_IN"&&d(!0),r((G==null?void 0:G.user)??null),G!=null&&G.user?setTimeout(async()=>{A&&await h(G.user.id)},0):(s(null),o(null),c(null),d(!1)))});return()=>{A=!1,$.unsubscribe()}},[]);const f=async A=>{try{const{data:$,error:K}=await kr.from("users").select("*").eq("id",A).maybeSingle();if(K){if(console.error("Error fetching user profile:",K),K.code==="PGRST116"){await v(A);return}}else $?s($):await v(A)}catch($){console.error("Error in fetchUserProfile:",$)}},p=async A=>{try{const{data:$,error:K}=await kr.from("user_profiles").select("*").eq("user_id",A).maybeSingle();if(K&&K.code!=="PGRST116"){console.error("Error fetching research profile:",K);return}o($)}catch($){console.error("Error in fetchResearchProfile:",$)}},g=async A=>{try{const{data:$,error:K}=await kr.from("user_student_points").select("total_purchased, used_points, remaining_points").eq("user_id",A).maybeSingle();if(K)throw K;c({total:($==null?void 0:$.total_purchased)||60,used:($==null?void 0:$.used_points)||0,remaining:($==null?void 0:$.remaining_points)||60})}catch($){console.error("Error fetching student points:",$),c({total:60,used:0,remaining:60})}},m=async A=>{await g(A)},x=async()=>{e&&(await f(e.id),await g(e.id))},y=async A=>{await p(A)},v=async(A,$)=>{var K;try{const{data:G}=await kr.auth.getUser();if(!((K=G.user)!=null&&K.email))return;const Y={id:A,email:G.user.email,plan:"starter",current_token_balance:30};if($)Y.terms_accepted_at=$.terms_accepted_at,Y.privacy_accepted_at=$.privacy_accepted_at,Y.terms_version=$.terms_version,Y.privacy_version=$.privacy_version,Y.marketing_consent=!0,Y.marketing_consent_at=$.terms_accepted_at;else if(G.user.user_metadata){const L=G.user.user_metadata;L.terms_accepted_at&&(Y.terms_accepted_at=L.terms_accepted_at,Y.privacy_accepted_at=L.privacy_accepted_at,Y.terms_version=L.terms_version,Y.privacy_version=L.privacy_version,Y.marketing_consent=!0,Y.marketing_consent_at=L.terms_accepted_at)}const{data:H,error:B}=await kr.from("users").insert(Y).select().single();if(B)if(B.code==="23505"){console.log("User profile already exists, fetching...");const{data:L}=await kr.from("users").select("*").eq("id",A).single();L&&s(L)}else console.error("Error creating user profile:",B);else s(H)}catch(G){console.error("Error in createUserProfile:",G)}},b=async(A,$)=>{if(!A||!A.includes("@"))return{error:{message:"Please enter a valid email address"}};if(!$||$.length<6)return{error:{message:"Password must be at least 6 characters"}};const{error:K}=await kr.auth.signInWithPassword({email:A.trim().toLowerCase(),password:$});return K||typeof window<"u"&&window.umami&&window.umami.track("user-login"),{error:K}},w=async(A,$,K)=>{if(!A||!A.includes("@"))return{error:{message:"Please enter a valid email address"}};if(!$||$.length<6)return{error:{message:"Password must be at least 6 characters"}};const{data:G,error:Y}=await kr.auth.signUp({email:A.trim().toLowerCase(),password:$,options:{emailRedirectTo:`${window.location.origin}/dashboard`,data:K?{terms_accepted_at:K.terms_accepted_at,privacy_accepted_at:K.privacy_accepted_at,terms_version:K.terms_version,privacy_version:K.privacy_version}:void 0}});return!Y&&G.user&&K&&await v(G.user.id,K),{error:Y}},j=async()=>{const{error:A}=await kr.auth.signOut();return A||(r(null),s(null),o(null),c(null)),{error:A}},N=A=>{switch(A){case"starter":return 30;case"pro":return 100;case"author":return 200;default:return 30}},C=async A=>{try{const{data:$,error:K}=await kr.rpc("consume_tokens",{pages_to_consume:A});return K?(console.error("Token consumption error:",K),{success:!1,error:K.message}):(e&&await f(e.id),$)}catch($){return console.error("Token consumption error:",$),{success:!1,error:$.message||"Failed to consume tokens"}}},k=-20,E=()=>l?l.remaining>k:!1,M=async A=>{if(e)try{const{error:$}=await kr.from("user_profiles").upsert({user_id:e.id,...A,updated_at:new Date().toISOString()},{onConflict:"user_id"});if($)throw $;await y(e.id)}catch($){throw console.error("Error updating research profile:",$),$}},V={user:e,userProfile:n,researchProfile:i,studentPoints:l,loading:u,signIn:b,signUp:w,signOut:j,getPlanLimit:N,consumeTokens:C,fetchStudentPoints:m,refreshProfile:x,checkStudentPoints:E,updateResearchProfile:M,uploadAvatar:async A=>{if(!e)throw new Error("No user logged in");try{const $=A.name.split(".").pop(),K=`${e.id}/avatar.${$}`,{error:G}=await kr.storage.from("avatars").upload(K,A,{upsert:!0});if(G)throw G;return await M({avatar_url:K}),K}catch($){throw console.error("Error uploading avatar:",$),$}},selectPublicAvatar:async A=>{if(!e)throw new Error("No user logged in");await M({avatar_url:A})}};return a.jsx(Rte.Provider,{value:V,children:t})}function Pt(){const t=S.useContext(Rte);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}const p6=od("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 active:scale-[0.98]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 rounded-xl shadow-md shadow-primary/20 hover:shadow-lg hover:shadow-primary/30",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 rounded-xl shadow-md",outline:"border border-border/50 bg-card/50 backdrop-blur-sm hover:bg-muted/50 hover:text-foreground rounded-xl dark:border-border/30",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 rounded-xl",ghost:"hover:bg-muted/50 hover:text-foreground rounded-xl",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-5 py-2",sm:"h-9 rounded-xl px-4",lg:"h-12 rounded-xl px-8",icon:"h-10 w-10 rounded-xl"}},defaultVariants:{variant:"default",size:"default"}}),ye=S.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...s},i)=>{const o=n?Fxe:"button";return a.jsx(o,{className:Ie(p6({variant:e,size:r,className:t})),ref:i,...s})});ye.displayName="Button";var jNe=S.createContext(void 0);function cg(t){const e=S.useContext(jNe);return t||e||"ltr"}var rO=0;function jT(){S.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??uH()),document.body.insertAdjacentElement("beforeend",t[1]??uH()),rO++,()=>{rO===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),rO--}},[])}function uH(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var nO="focusScope.autoFocusOnMount",sO="focusScope.autoFocusOnUnmount",dH={bubbles:!1,cancelable:!0},SNe="FocusScope",Bj=S.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=t,[l,c]=S.useState(null),u=gn(s),d=gn(i),h=S.useRef(null),f=Nt(e,m=>c(m)),p=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(n){let m=function(b){if(p.paused||!l)return;const w=b.target;l.contains(w)?h.current=w:Sd(h.current,{select:!0})},x=function(b){if(p.paused||!l)return;const w=b.relatedTarget;w!==null&&(l.contains(w)||Sd(h.current,{select:!0}))},y=function(b){if(document.activeElement===document.body)for(const j of b)j.removedNodes.length>0&&Sd(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const v=new MutationObserver(y);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),v.disconnect()}}},[n,l,p.paused]),S.useEffect(()=>{if(l){fH.add(p);const m=document.activeElement;if(!l.contains(m)){const y=new CustomEvent(nO,dH);l.addEventListener(nO,u),l.dispatchEvent(y),y.defaultPrevented||(NNe(TNe(Mte(l)),{select:!0}),document.activeElement===m&&Sd(l))}return()=>{l.removeEventListener(nO,u),setTimeout(()=>{const y=new CustomEvent(sO,dH);l.addEventListener(sO,d),l.dispatchEvent(y),y.defaultPrevented||Sd(m??document.body,{select:!0}),l.removeEventListener(sO,d),fH.remove(p)},0)}}},[l,u,d,p]);const g=S.useCallback(m=>{if(!r&&!n||p.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(x&&y){const v=m.currentTarget,[b,w]=ANe(v);b&&w?!m.shiftKey&&y===w?(m.preventDefault(),r&&Sd(b,{select:!0})):m.shiftKey&&y===b&&(m.preventDefault(),r&&Sd(w,{select:!0})):y===v&&m.preventDefault()}},[r,n,p.paused]);return a.jsx(et.div,{tabIndex:-1,...o,ref:f,onKeyDown:g})});Bj.displayName=SNe;function NNe(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(Sd(n,{select:e}),document.activeElement!==r)return}function ANe(t){const e=Mte(t),r=hH(e,t),n=hH(e.reverse(),t);return[r,n]}function Mte(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function hH(t,e){for(const r of t)if(!ENe(r,{upTo:e}))return r}function ENe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function CNe(t){return t instanceof HTMLInputElement&&"select"in t}function Sd(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&CNe(t)&&e&&t.select()}}var fH=kNe();function kNe(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=pH(t,e),t.unshift(e)},remove(e){var r;t=pH(t,e),(r=t[0])==null||r.resume()}}}function pH(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function TNe(t){return t.filter(e=>e.tagName!=="A")}var iO="rovingFocusGroup.onEntryFocus",PNe={bubbles:!1,cancelable:!0},Uj="RovingFocusGroup",[t4,Dte,ONe]=Tj(Uj),[INe,mb]=Bn(Uj,[ONe]),[RNe,MNe]=INe(Uj),Lte=S.forwardRef((t,e)=>a.jsx(t4.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(t4.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(DNe,{...t,ref:e})})}));Lte.displayName=Uj;var DNe=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=t,f=S.useRef(null),p=Nt(e,f),g=cg(i),[m,x]=Ms({prop:o,defaultProp:l??null,onChange:c,caller:Uj}),[y,v]=S.useState(!1),b=gn(u),w=Dte(r),j=S.useRef(!1),[N,C]=S.useState(0);return S.useEffect(()=>{const k=f.current;if(k)return k.addEventListener(iO,b),()=>k.removeEventListener(iO,b)},[b]),a.jsx(RNe,{scope:r,orientation:n,dir:g,loop:s,currentTabStopId:m,onItemFocus:S.useCallback(k=>x(k),[x]),onItemShiftTab:S.useCallback(()=>v(!0),[]),onFocusableItemAdd:S.useCallback(()=>C(k=>k+1),[]),onFocusableItemRemove:S.useCallback(()=>C(k=>k-1),[]),children:a.jsx(et.div,{tabIndex:y||N===0?-1:0,"data-orientation":n,...h,ref:p,style:{outline:"none",...t.style},onMouseDown:ze(t.onMouseDown,()=>{j.current=!0}),onFocus:ze(t.onFocus,k=>{const E=!j.current;if(k.target===k.currentTarget&&E&&!y){const M=new CustomEvent(iO,PNe);if(k.currentTarget.dispatchEvent(M),!M.defaultPrevented){const z=w().filter(K=>K.focusable),P=z.find(K=>K.active),V=z.find(K=>K.id===m),$=[P,V,...z].filter(Boolean).map(K=>K.ref.current);Bte($,d)}}j.current=!1}),onBlur:ze(t.onBlur,()=>v(!1))})})}),Fte="RovingFocusGroupItem",$te=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:i,children:o,...l}=t,c=Yi(),u=i||c,d=MNe(Fte,r),h=d.currentTabStopId===u,f=Dte(r),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:m}=d;return S.useEffect(()=>{if(n)return p(),()=>g()},[n,p,g]),a.jsx(t4.ItemSlot,{scope:r,id:u,focusable:n,active:s,children:a.jsx(et.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...l,ref:e,onMouseDown:ze(t.onMouseDown,x=>{n?d.onItemFocus(u):x.preventDefault()}),onFocus:ze(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:ze(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const y=$Ne(x,d.orientation,d.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let b=f().filter(w=>w.focusable).map(w=>w.ref.current);if(y==="last")b.reverse();else if(y==="prev"||y==="next"){y==="prev"&&b.reverse();const w=b.indexOf(x.currentTarget);b=d.loop?BNe(b,w+1):b.slice(w+1)}setTimeout(()=>Bte(b))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:m!=null}):o})})});$te.displayName=Fte;var LNe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function FNe(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function $Ne(t,e,r){const n=FNe(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return LNe[n]}function Bte(t,e=!1){const r=document.activeElement;for(const n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function BNe(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var m6=Lte,g6=$te,UNe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Cg=new WeakMap,cN=new WeakMap,uN={},aO=0,Ute=function(t){return t&&(t.host||Ute(t.parentNode))},zNe=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=Ute(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},HNe=function(t,e,r,n){var s=zNe(e,Array.isArray(t)?t:[t]);uN[r]||(uN[r]=new WeakMap);var i=uN[r],o=[],l=new Set,c=new Set(s),u=function(h){!h||l.has(h)||(l.add(h),u(h.parentNode))};s.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(f){if(l.has(f))d(f);else try{var p=f.getAttribute(n),g=p!==null&&p!=="false",m=(Cg.get(f)||0)+1,x=(i.get(f)||0)+1;Cg.set(f,m),i.set(f,x),o.push(f),m===1&&g&&cN.set(f,!0),x===1&&f.setAttribute(r,"true"),g||f.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",f,y)}})};return d(e),l.clear(),aO++,function(){o.forEach(function(h){var f=Cg.get(h)-1,p=i.get(h)-1;Cg.set(h,f),i.set(h,p),f||(cN.has(h)||h.removeAttribute(n),cN.delete(h)),p||h.removeAttribute(r)}),aO--,aO||(Cg=new WeakMap,Cg=new WeakMap,cN=new WeakMap,uN={})}},ST=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),s=UNe(t);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),HNe(n,s,r,"aria-hidden")):function(){return null}},nc=function(){return nc=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},nc.apply(this,arguments)};function zte(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function WNe(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}var wA="right-scroll-bar-position",_A="width-before-scroll-bar",VNe="with-scroll-bars-hidden",qNe="--removed-body-scroll-bar-size";function oO(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function GNe(t,e){var r=S.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=e,r.facade}var KNe=typeof window<"u"?S.useLayoutEffect:S.useEffect,mH=new WeakMap;function YNe(t,e){var r=GNe(null,function(n){return t.forEach(function(s){return oO(s,n)})});return KNe(function(){var n=mH.get(r);if(n){var s=new Set(n),i=new Set(t),o=r.current;s.forEach(function(l){i.has(l)||oO(l,null)}),i.forEach(function(l){s.has(l)||oO(l,o)})}mH.set(r,t)},[t]),r}function XNe(t){return t}function QNe(t,e){e===void 0&&(e=XNe);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(i){var o=e(i,n);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(n=!0;r.length;){var o=r;r=[],o.forEach(i)}r={push:function(l){return i(l)},filter:function(){return r}}},assignMedium:function(i){n=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(i),o=r}var c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),r}}}};return s}function ZNe(t){t===void 0&&(t={});var e=QNe(null);return e.options=nc({async:!0,ssr:!1},t),e}var Hte=function(t){var e=t.sideCar,r=zte(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return S.createElement(n,nc({},r))};Hte.isSideCarExport=!0;function JNe(t,e){return t.useMedium(e),Hte}var Wte=ZNe(),lO=function(){},NT=S.forwardRef(function(t,e){var r=S.useRef(null),n=S.useState({onScrollCapture:lO,onWheelCapture:lO,onTouchMoveCapture:lO}),s=n[0],i=n[1],o=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,h=t.shards,f=t.sideCar,p=t.noRelative,g=t.noIsolation,m=t.inert,x=t.allowPinchZoom,y=t.as,v=y===void 0?"div":y,b=t.gapMode,w=zte(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=f,N=YNe([r,e]),C=nc(nc({},w),s);return S.createElement(S.Fragment,null,d&&S.createElement(j,{sideCar:Wte,removeScrollBar:u,shards:h,noRelative:p,noIsolation:g,inert:m,setCallbacks:i,allowPinchZoom:!!x,lockRef:r,gapMode:b}),o?S.cloneElement(S.Children.only(l),nc(nc({},C),{ref:N})):S.createElement(v,nc({},C,{className:c,ref:N}),l))});NT.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};NT.classNames={fullWidth:_A,zeroRight:wA};var eAe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function tAe(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=eAe();return e&&t.setAttribute("nonce",e),t}function rAe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function nAe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var sAe=function(){var t=0,e=null;return{add:function(r){t==0&&(e=tAe())&&(rAe(e,r),nAe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},iAe=function(){var t=sAe();return function(e,r){S.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},Vte=function(){var t=iAe(),e=function(r){var n=r.styles,s=r.dynamic;return t(n,s),null};return e},aAe={left:0,top:0,right:0,gap:0},cO=function(t){return parseInt(t||"",10)||0},oAe=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[cO(r),cO(n),cO(s)]},lAe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return aAe;var e=oAe(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},cAe=Vte(),Oy="data-scroll-locked",uAe=function(t,e,r,n){var s=t.left,i=t.top,o=t.right,l=t.gap;return r===void 0&&(r="margin"),`
.`.concat(VNe,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(l,"px ").concat(n,`;
}
body[`).concat(Oy,`] {
overflow: hidden `).concat(n,`;
overscroll-behavior: contain;
`).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
padding-left: `.concat(s,`px;
padding-top: `).concat(i,`px;
padding-right: `).concat(o,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(l,"px ").concat(n,`;
`),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
}
.`).concat(wA,` {
right: `).concat(l,"px ").concat(n,`;
}
.`).concat(_A,` {
margin-right: `).concat(l,"px ").concat(n,`;
}
.`).concat(wA," .").concat(wA,` {
right: 0 `).concat(n,`;
}
.`).concat(_A," .").concat(_A,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(Oy,`] {
`).concat(qNe,": ").concat(l,`px;
}
`)},gH=function(){var t=parseInt(document.body.getAttribute(Oy)||"0",10);return isFinite(t)?t:0},dAe=function(){S.useEffect(function(){return document.body.setAttribute(Oy,(gH()+1).toString()),function(){var t=gH()-1;t<=0?document.body.removeAttribute(Oy):document.body.setAttribute(Oy,t.toString())}},[])},hAe=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,s=n===void 0?"margin":n;dAe();var i=S.useMemo(function(){return lAe(s)},[s]);return S.createElement(cAe,{styles:uAe(i,!e,s,r?"":"!important")})},r4=!1;if(typeof window<"u")try{var dN=Object.defineProperty({},"passive",{get:function(){return r4=!0,!0}});window.addEventListener("test",dN,dN),window.removeEventListener("test",dN,dN)}catch{r4=!1}var kg=r4?{passive:!1}:!1,fAe=function(t){return t.tagName==="TEXTAREA"},qte=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!fAe(t)&&r[e]==="visible")},pAe=function(t){return qte(t,"overflowY")},mAe=function(t){return qte(t,"overflowX")},yH=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=Gte(t,n);if(s){var i=Kte(t,n),o=i[1],l=i[2];if(o>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},gAe=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},yAe=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},Gte=function(t,e){return t==="v"?pAe(e):mAe(e)},Kte=function(t,e){return t==="v"?gAe(e):yAe(e)},xAe=function(t,e){return t==="h"&&e==="rtl"?-1:1},vAe=function(t,e,r,n,s){var i=xAe(t,window.getComputedStyle(e).direction),o=i*n,l=r.target,c=e.contains(l),u=!1,d=o>0,h=0,f=0;do{if(!l)break;var p=Kte(t,l),g=p[0],m=p[1],x=p[2],y=m-x-i*g;(g||y)&&Gte(t,l)&&(h+=y,f+=g);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(d&&(Math.abs(h)<1||!s)||!d&&(Math.abs(f)<1||!s))&&(u=!0),u},hN=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},xH=function(t){return[t.deltaX,t.deltaY]},vH=function(t){return t&&"current"in t?t.current:t},bAe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},wAe=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},_Ae=0,Tg=[];function jAe(t){var e=S.useRef([]),r=S.useRef([0,0]),n=S.useRef(),s=S.useState(_Ae++)[0],i=S.useState(Vte)[0],o=S.useRef(t);S.useEffect(function(){o.current=t},[t]),S.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var m=WNe([t.lockRef.current],(t.shards||[]).map(vH),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=S.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var y=hN(m),v=r.current,b="deltaX"in m?m.deltaX:v[0]-y[0],w="deltaY"in m?m.deltaY:v[1]-y[1],j,N=m.target,C=Math.abs(b)>Math.abs(w)?"h":"v";if("touches"in m&&C==="h"&&N.type==="range")return!1;var k=yH(C,N);if(!k)return!0;if(k?j=C:(j=C==="v"?"h":"v",k=yH(C,N)),!k)return!1;if(!n.current&&"changedTouches"in m&&(b||w)&&(n.current=j),!j)return!0;var E=n.current||j;return vAe(E,x,m,E==="h"?b:w,!0)},[]),c=S.useCallback(function(m){var x=m;if(!(!Tg.length||Tg[Tg.length-1]!==i)){var y="deltaY"in x?xH(x):hN(x),v=e.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&bAe(j.delta,y)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var b=(o.current.shards||[]).map(vH).filter(Boolean).filter(function(j){return j.contains(x.target)}),w=b.length>0?l(x,b[0]):!o.current.noIsolation;w&&x.cancelable&&x.preventDefault()}}},[]),u=S.useCallback(function(m,x,y,v){var b={name:m,delta:x,target:y,should:v,shadowParent:SAe(y)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(w){return w!==b})},1)},[]),d=S.useCallback(function(m){r.current=hN(m),n.current=void 0},[]),h=S.useCallback(function(m){u(m.type,xH(m),m.target,l(m,t.lockRef.current))},[]),f=S.useCallback(function(m){u(m.type,hN(m),m.target,l(m,t.lockRef.current))},[]);S.useEffect(function(){return Tg.push(i),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",c,kg),document.addEventListener("touchmove",c,kg),document.addEventListener("touchstart",d,kg),function(){Tg=Tg.filter(function(m){return m!==i}),document.removeEventListener("wheel",c,kg),document.removeEventListener("touchmove",c,kg),document.removeEventListener("touchstart",d,kg)}},[]);var p=t.removeScrollBar,g=t.inert;return S.createElement(S.Fragment,null,g?S.createElement(i,{styles:wAe(s)}):null,p?S.createElement(hAe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function SAe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const NAe=JNe(Wte,jAe);var zj=S.forwardRef(function(t,e){return S.createElement(NT,nc({},t,{ref:e,sideCar:NAe}))});zj.classNames=NT.classNames;var n4=["Enter"," "],AAe=["ArrowDown","PageUp","Home"],Yte=["ArrowUp","PageDown","End"],EAe=[...AAe,...Yte],CAe={ltr:[...n4,"ArrowRight"],rtl:[...n4,"ArrowLeft"]},kAe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Hj="Menu",[Zw,TAe,PAe]=Tj(Hj),[ug,Xte]=Bn(Hj,[PAe,ff,mb]),AT=ff(),Qte=mb(),[OAe,dg]=ug(Hj),[IAe,Wj]=ug(Hj),Zte=t=>{const{__scopeMenu:e,open:r=!1,children:n,dir:s,onOpenChange:i,modal:o=!0}=t,l=AT(e),[c,u]=S.useState(null),d=S.useRef(!1),h=gn(i),f=cg(s);return S.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),a.jsx(cT,{...l,children:a.jsx(OAe,{scope:e,open:r,onOpenChange:h,content:c,onContentChange:u,children:a.jsx(IAe,{scope:e,onClose:S.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:f,modal:o,children:n})})})};Zte.displayName=Hj;var RAe="MenuAnchor",y6=S.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=AT(r);return a.jsx(Mj,{...s,...n,ref:e})});y6.displayName=RAe;var x6="MenuPortal",[MAe,Jte]=ug(x6,{forceMount:void 0}),ere=t=>{const{__scopeMenu:e,forceMount:r,children:n,container:s}=t,i=dg(x6,e);return a.jsx(MAe,{scope:e,forceMount:r,children:a.jsx(es,{present:r||i.open,children:a.jsx(nb,{asChild:!0,container:s,children:n})})})};ere.displayName=x6;var go="MenuContent",[DAe,v6]=ug(go),tre=S.forwardRef((t,e)=>{const r=Jte(go,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,i=dg(go,t.__scopeMenu),o=Wj(go,t.__scopeMenu);return a.jsx(Zw.Provider,{scope:t.__scopeMenu,children:a.jsx(es,{present:n||i.open,children:a.jsx(Zw.Slot,{scope:t.__scopeMenu,children:o.modal?a.jsx(LAe,{...s,ref:e}):a.jsx(FAe,{...s,ref:e})})})})}),LAe=S.forwardRef((t,e)=>{const r=dg(go,t.__scopeMenu),n=S.useRef(null),s=Nt(e,n);return S.useEffect(()=>{const i=n.current;if(i)return ST(i)},[]),a.jsx(b6,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ze(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),FAe=S.forwardRef((t,e)=>{const r=dg(go,t.__scopeMenu);return a.jsx(b6,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),$Ae=Qh("MenuContent.ScrollLock"),b6=S.forwardRef((t,e)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,disableOutsideScroll:g,...m}=t,x=dg(go,r),y=Wj(go,r),v=AT(r),b=Qte(r),w=TAe(r),[j,N]=S.useState(null),C=S.useRef(null),k=Nt(e,C,x.onContentChange),E=S.useRef(0),M=S.useRef(""),z=S.useRef(0),P=S.useRef(null),V=S.useRef("right"),A=S.useRef(0),$=g?zj:S.Fragment,K=g?{as:$Ae,allowPinchZoom:!0}:void 0,G=H=>{var U,R;const B=M.current+H,L=w().filter(ee=>!ee.disabled),F=document.activeElement,W=(U=L.find(ee=>ee.ref.current===F))==null?void 0:U.textValue,X=L.map(ee=>ee.textValue),oe=QAe(X,B,W),le=(R=L.find(ee=>ee.textValue===oe))==null?void 0:R.ref.current;(function ee(te){M.current=te,window.clearTimeout(E.current),te!==""&&(E.current=window.setTimeout(()=>ee(""),1e3))})(B),le&&setTimeout(()=>le.focus())};S.useEffect(()=>()=>window.clearTimeout(E.current),[]),jT();const Y=S.useCallback(H=>{var L,F;return V.current===((L=P.current)==null?void 0:L.side)&&JAe(H,(F=P.current)==null?void 0:F.area)},[]);return a.jsx(DAe,{scope:r,searchRef:M,onItemEnter:S.useCallback(H=>{Y(H)&&H.preventDefault()},[Y]),onItemLeave:S.useCallback(H=>{var B;Y(H)||((B=C.current)==null||B.focus(),N(null))},[Y]),onTriggerLeave:S.useCallback(H=>{Y(H)&&H.preventDefault()},[Y]),pointerGraceTimerRef:z,onPointerGraceIntentChange:S.useCallback(H=>{P.current=H},[]),children:a.jsx($,{...K,children:a.jsx(Bj,{asChild:!0,trapped:s,onMountAutoFocus:ze(i,H=>{var B;H.preventDefault(),(B=C.current)==null||B.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(og,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,children:a.jsx(m6,{asChild:!0,...b,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:N,onEntryFocus:ze(c,H=>{y.isUsingKeyboardRef.current||H.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(uT,{role:"menu","aria-orientation":"vertical","data-state":yre(x.open),"data-radix-menu-content":"",dir:y.dir,...v,...m,ref:k,style:{outline:"none",...m.style},onKeyDown:ze(m.onKeyDown,H=>{const L=H.target.closest("[data-radix-menu-content]")===H.currentTarget,F=H.ctrlKey||H.altKey||H.metaKey,W=H.key.length===1;L&&(H.key==="Tab"&&H.preventDefault(),!F&&W&&G(H.key));const X=C.current;if(H.target!==X||!EAe.includes(H.key))return;H.preventDefault();const le=w().filter(U=>!U.disabled).map(U=>U.ref.current);Yte.includes(H.key)&&le.reverse(),YAe(le)}),onBlur:ze(t.onBlur,H=>{H.currentTarget.contains(H.target)||(window.clearTimeout(E.current),M.current="")}),onPointerMove:ze(t.onPointerMove,Jw(H=>{const B=H.target,L=A.current!==H.clientX;if(H.currentTarget.contains(B)&&L){const F=H.clientX>A.current?"right":"left";V.current=F,A.current=H.clientX}}))})})})})})})});tre.displayName=go;var BAe="MenuGroup",w6=S.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return a.jsx(et.div,{role:"group",...n,ref:e})});w6.displayName=BAe;var UAe="MenuLabel",rre=S.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return a.jsx(et.div,{...n,ref:e})});rre.displayName=UAe;var KE="MenuItem",bH="menu.itemSelect",ET=S.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...s}=t,i=S.useRef(null),o=Wj(KE,t.__scopeMenu),l=v6(KE,t.__scopeMenu),c=Nt(e,i),u=S.useRef(!1),d=()=>{const h=i.current;if(!r&&h){const f=new CustomEvent(bH,{bubbles:!0,cancelable:!0});h.addEventListener(bH,p=>n==null?void 0:n(p),{once:!0}),MF(h,f),f.defaultPrevented?u.current=!1:o.onClose()}};return a.jsx(nre,{...s,ref:c,disabled:r,onClick:ze(t.onClick,d),onPointerDown:h=>{var f;(f=t.onPointerDown)==null||f.call(t,h),u.current=!0},onPointerUp:ze(t.onPointerUp,h=>{var f;u.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:ze(t.onKeyDown,h=>{const f=l.searchRef.current!=="";r||f&&h.key===" "||n4.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});ET.displayName=KE;var nre=S.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...i}=t,o=v6(KE,r),l=Qte(r),c=S.useRef(null),u=Nt(e,c),[d,h]=S.useState(!1),[f,p]=S.useState("");return S.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[i.children]),a.jsx(Zw.ItemSlot,{scope:r,disabled:n,textValue:s??f,children:a.jsx(g6,{asChild:!0,...l,focusable:!n,children:a.jsx(et.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:u,onPointerMove:ze(t.onPointerMove,Jw(g=>{n?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ze(t.onPointerLeave,Jw(g=>o.onItemLeave(g))),onFocus:ze(t.onFocus,()=>h(!0)),onBlur:ze(t.onBlur,()=>h(!1))})})})}),zAe="MenuCheckboxItem",sre=S.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...s}=t;return a.jsx(cre,{scope:t.__scopeMenu,checked:r,children:a.jsx(ET,{role:"menuitemcheckbox","aria-checked":YE(r)?"mixed":r,...s,ref:e,"data-state":j6(r),onSelect:ze(s.onSelect,()=>n==null?void 0:n(YE(r)?!0:!r),{checkForDefaultPrevented:!1})})})});sre.displayName=zAe;var ire="MenuRadioGroup",[HAe,WAe]=ug(ire,{value:void 0,onValueChange:()=>{}}),are=S.forwardRef((t,e)=>{const{value:r,onValueChange:n,...s}=t,i=gn(n);return a.jsx(HAe,{scope:t.__scopeMenu,value:r,onValueChange:i,children:a.jsx(w6,{...s,ref:e})})});are.displayName=ire;var ore="MenuRadioItem",lre=S.forwardRef((t,e)=>{const{value:r,...n}=t,s=WAe(ore,t.__scopeMenu),i=r===s.value;return a.jsx(cre,{scope:t.__scopeMenu,checked:i,children:a.jsx(ET,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":j6(i),onSelect:ze(n.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,r)},{checkForDefaultPrevented:!1})})})});lre.displayName=ore;var _6="MenuItemIndicator",[cre,VAe]=ug(_6,{checked:!1}),ure=S.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...s}=t,i=VAe(_6,r);return a.jsx(es,{present:n||YE(i.checked)||i.checked===!0,children:a.jsx(et.span,{...s,ref:e,"data-state":j6(i.checked)})})});ure.displayName=_6;var qAe="MenuSeparator",dre=S.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return a.jsx(et.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});dre.displayName=qAe;var GAe="MenuArrow",hre=S.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=AT(r);return a.jsx(dT,{...s,...n,ref:e})});hre.displayName=GAe;var KAe="MenuSub",[zyt,fre]=ug(KAe),A0="MenuSubTrigger",pre=S.forwardRef((t,e)=>{const r=dg(A0,t.__scopeMenu),n=Wj(A0,t.__scopeMenu),s=fre(A0,t.__scopeMenu),i=v6(A0,t.__scopeMenu),o=S.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,u={__scopeMenu:t.__scopeMenu},d=S.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return S.useEffect(()=>d,[d]),S.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),a.jsx(y6,{asChild:!0,...u,children:a.jsx(nre,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":yre(r.open),...t,ref:rT(e,s.onTriggerChange),onClick:h=>{var f;(f=t.onClick)==null||f.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ze(t.onPointerMove,Jw(h=>{i.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!r.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:ze(t.onPointerLeave,Jw(h=>{var p,g;d();const f=(p=r.content)==null?void 0:p.getBoundingClientRect();if(f){const m=(g=r.content)==null?void 0:g.dataset.side,x=m==="right",y=x?-5:5,v=f[x?"left":"right"],b=f[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+y,y:h.clientY},{x:v,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:v,y:f.bottom}],side:m}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ze(t.onKeyDown,h=>{var p;const f=i.searchRef.current!=="";t.disabled||f&&h.key===" "||CAe[n.dir].includes(h.key)&&(r.onOpenChange(!0),(p=r.content)==null||p.focus(),h.preventDefault())})})})});pre.displayName=A0;var mre="MenuSubContent",gre=S.forwardRef((t,e)=>{const r=Jte(go,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,i=dg(go,t.__scopeMenu),o=Wj(go,t.__scopeMenu),l=fre(mre,t.__scopeMenu),c=S.useRef(null),u=Nt(e,c);return a.jsx(Zw.Provider,{scope:t.__scopeMenu,children:a.jsx(es,{present:n||i.open,children:a.jsx(Zw.Slot,{scope:t.__scopeMenu,children:a.jsx(b6,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ze(t.onFocusOutside,d=>{d.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ze(t.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:ze(t.onKeyDown,d=>{var p;const h=d.currentTarget.contains(d.target),f=kAe[o.dir].includes(d.key);h&&f&&(i.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});gre.displayName=mre;function yre(t){return t?"open":"closed"}function YE(t){return t==="indeterminate"}function j6(t){return YE(t)?"indeterminate":t?"checked":"unchecked"}function YAe(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function XAe(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function QAe(t,e,r){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let o=XAe(t,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function ZAe(t,e){const{x:r,y:n}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const l=e[i],c=e[o],u=l.x,d=l.y,h=c.x,f=c.y;d>n!=f>n&&r<(h-u)*(n-d)/(f-d)+u&&(s=!s)}return s}function JAe(t,e){if(!e)return!1;const r={x:t.clientX,y:t.clientY};return ZAe(r,e)}function Jw(t){return e=>e.pointerType==="mouse"?t(e):void 0}var eEe=Zte,tEe=y6,rEe=ere,nEe=tre,sEe=w6,iEe=rre,aEe=ET,oEe=sre,lEe=are,cEe=lre,uEe=ure,dEe=dre,hEe=hre,fEe=pre,pEe=gre,CT="DropdownMenu",[mEe,Hyt]=Bn(CT,[Xte]),Ei=Xte(),[gEe,xre]=mEe(CT),vre=t=>{const{__scopeDropdownMenu:e,children:r,dir:n,open:s,defaultOpen:i,onOpenChange:o,modal:l=!0}=t,c=Ei(e),u=S.useRef(null),[d,h]=Ms({prop:s,defaultProp:i??!1,onChange:o,caller:CT});return a.jsx(gEe,{scope:e,triggerId:Yi(),triggerRef:u,contentId:Yi(),open:d,onOpenChange:h,onOpenToggle:S.useCallback(()=>h(f=>!f),[h]),modal:l,children:a.jsx(eEe,{...c,open:d,onOpenChange:h,dir:n,modal:l,children:r})})};vre.displayName=CT;var bre="DropdownMenuTrigger",wre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=t,i=xre(bre,r),o=Ei(r);return a.jsx(tEe,{asChild:!0,...o,children:a.jsx(et.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:rT(e,i.triggerRef),onPointerDown:ze(t.onPointerDown,l=>{!n&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:ze(t.onKeyDown,l=>{n||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});wre.displayName=bre;var yEe="DropdownMenuPortal",_re=t=>{const{__scopeDropdownMenu:e,...r}=t,n=Ei(e);return a.jsx(rEe,{...n,...r})};_re.displayName=yEe;var jre="DropdownMenuContent",Sre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=xre(jre,r),i=Ei(r),o=S.useRef(!1);return a.jsx(nEe,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...n,ref:e,onCloseAutoFocus:ze(t.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:ze(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Sre.displayName=jre;var xEe="DropdownMenuGroup",vEe=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ei(r);return a.jsx(sEe,{...s,...n,ref:e})});vEe.displayName=xEe;var bEe="DropdownMenuLabel",Nre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ei(r);return a.jsx(iEe,{...s,...n,ref:e})});Nre.displayName=bEe;var wEe="DropdownMenuItem",Are=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ei(r);return a.jsx(aEe,{...s,...n,ref:e})});Are.displayName=wEe;var _Ee="DropdownMenuCheckboxItem",Ere=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ei(r);return a.jsx(oEe,{...s,...n,ref:e})});Ere.displayName=_Ee;var jEe="DropdownMenuRadioGroup",SEe=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ei(r);return a.jsx(lEe,{...s,...n,ref:e})});SEe.displayName=jEe;var NEe="DropdownMenuRadioItem",Cre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ei(r);return a.jsx(cEe,{...s,...n,ref:e})});Cre.displayName=NEe;var AEe="DropdownMenuItemIndicator",kre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ei(r);return a.jsx(uEe,{...s,...n,ref:e})});kre.displayName=AEe;var EEe="DropdownMenuSeparator",Tre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ei(r);return a.jsx(dEe,{...s,...n,ref:e})});Tre.displayName=EEe;var CEe="DropdownMenuArrow",kEe=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ei(r);return a.jsx(hEe,{...s,...n,ref:e})});kEe.displayName=CEe;var TEe="DropdownMenuSubTrigger",Pre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ei(r);return a.jsx(fEe,{...s,...n,ref:e})});Pre.displayName=TEe;var PEe="DropdownMenuSubContent",Ore=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ei(r);return a.jsx(pEe,{...s,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ore.displayName=PEe;var OEe=vre,IEe=wre,REe=_re,Ire=Sre,Rre=Nre,Mre=Are,Dre=Ere,Lre=Cre,Fre=kre,$re=Tre,Bre=Pre,Ure=Ore;const zre=OEe,Hre=IEe,MEe=S.forwardRef(({className:t,inset:e,children:r,...n},s)=>a.jsxs(Bre,{ref:s,className:Ie("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...n,children:[r,a.jsx(HJ,{className:"ml-auto h-4 w-4"})]}));MEe.displayName=Bre.displayName;const DEe=S.forwardRef(({className:t,...e},r)=>a.jsx(Ure,{ref:r,className:Ie("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));DEe.displayName=Ure.displayName;const S6=S.forwardRef(({className:t,sideOffset:e=4,...r},n)=>a.jsx(REe,{children:a.jsx(Ire,{ref:n,sideOffset:e,className:Ie("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));S6.displayName=Ire.displayName;const Iy=S.forwardRef(({className:t,inset:e,...r},n)=>a.jsx(Mre,{ref:n,className:Ie("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...r}));Iy.displayName=Mre.displayName;const LEe=S.forwardRef(({className:t,children:e,checked:r,...n},s)=>a.jsxs(Dre,{ref:s,className:Ie("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:r,...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Fre,{children:a.jsx(yn,{className:"h-4 w-4"})})}),e]}));LEe.displayName=Dre.displayName;const FEe=S.forwardRef(({className:t,children:e,...r},n)=>a.jsxs(Lre,{ref:n,className:Ie("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Fre,{children:a.jsx(gD,{className:"h-2 w-2 fill-current"})})}),e]}));FEe.displayName=Lre.displayName;const $Ee=S.forwardRef(({className:t,inset:e,...r},n)=>a.jsx(Rre,{ref:n,className:Ie("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...r}));$Ee.displayName=Rre.displayName;const N6=S.forwardRef(({className:t,...e},r)=>a.jsx($re,{ref:r,className:Ie("-mx-1 my-1 h-px bg-muted",t),...e}));N6.displayName=$re.displayName;var Wre={exports:{}},Vre={};/**
* @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 _v=S;function BEe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var UEe=typeof Object.is=="function"?Object.is:BEe,zEe=_v.useState,HEe=_v.useEffect,WEe=_v.useLayoutEffect,VEe=_v.useDebugValue;function qEe(t,e){var r=e(),n=zEe({inst:{value:r,getSnapshot:e}}),s=n[0].inst,i=n[1];return WEe(function(){s.value=r,s.getSnapshot=e,uO(s)&&i({inst:s})},[t,r,e]),HEe(function(){return uO(s)&&i({inst:s}),t(function(){uO(s)&&i({inst:s})})},[t]),VEe(r),r}function uO(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!UEe(t,r)}catch{return!0}}function GEe(t,e){return e()}var KEe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?GEe:qEe;Vre.useSyncExternalStore=_v.useSyncExternalStore!==void 0?_v.useSyncExternalStore:KEe;Wre.exports=Vre;var YEe=Wre.exports;function XEe(){return YEe.useSyncExternalStore(QEe,()=>!0,()=>!1)}function QEe(){return()=>{}}var A6="Avatar",[ZEe,Wyt]=Bn(A6),[JEe,qre]=ZEe(A6),Gre=S.forwardRef((t,e)=>{const{__scopeAvatar:r,...n}=t,[s,i]=S.useState("idle");return a.jsx(JEe,{scope:r,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:a.jsx(et.span,{...n,ref:e})})});Gre.displayName=A6;var Kre="AvatarImage",Yre=S.forwardRef((t,e)=>{const{__scopeAvatar:r,src:n,onLoadingStatusChange:s=()=>{},...i}=t,o=qre(Kre,r),l=eCe(n,i),c=gn(u=>{s(u),o.onImageLoadingStatusChange(u)});return vn(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?a.jsx(et.img,{...i,ref:e,src:n}):null});Yre.displayName=Kre;var Xre="AvatarFallback",Qre=S.forwardRef((t,e)=>{const{__scopeAvatar:r,delayMs:n,...s}=t,i=qre(Xre,r),[o,l]=S.useState(n===void 0);return S.useEffect(()=>{if(n!==void 0){const c=window.setTimeout(()=>l(!0),n);return()=>window.clearTimeout(c)}},[n]),o&&i.imageLoadingStatus!=="loaded"?a.jsx(et.span,{...s,ref:e}):null});Qre.displayName=Xre;function wH(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function eCe(t,{referrerPolicy:e,crossOrigin:r}){const n=XEe(),s=S.useRef(null),i=n?(s.current||(s.current=new window.Image),s.current):null,[o,l]=S.useState(()=>wH(i,t));return vn(()=>{l(wH(i,t))},[i,t]),vn(()=>{const c=h=>()=>{l(h)};if(!i)return;const u=c("loaded"),d=c("error");return i.addEventListener("load",u),i.addEventListener("error",d),e&&(i.referrerPolicy=e),typeof r=="string"&&(i.crossOrigin=r),()=>{i.removeEventListener("load",u),i.removeEventListener("error",d)}},[i,r,e]),o}var Zre=Gre,Jre=Yre,ene=Qre;const kT=S.forwardRef(({className:t,...e},r)=>a.jsx(Zre,{ref:r,className:Ie("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));kT.displayName=Zre.displayName;const TT=S.forwardRef(({className:t,...e},r)=>a.jsx(Jre,{ref:r,className:Ie("aspect-square h-full w-full",t),...e}));TT.displayName=Jre.displayName;const PT=S.forwardRef(({className:t,...e},r)=>a.jsx(ene,{ref:r,className:Ie("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));PT.displayName=ene.displayName;const tne=S.createContext(void 0),tCe=({children:t})=>{const[e,r]=S.useState(()=>localStorage.getItem("theme")||"light");S.useEffect(()=>{e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),localStorage.setItem("theme",e)},[e]);const n=()=>{r(s=>s==="light"?"dark":"light")};return a.jsx(tne.Provider,{value:{theme:e,toggleTheme:n},children:t})},E6=()=>{const t=S.useContext(tne);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t};function rCe(){const{toggleTheme:t}=E6();return a.jsxs("button",{onClick:t,className:"relative flex items-center justify-center text-gray-500 transition-colors bg-white border border-gray-200 rounded-full hover:text-gray-900 h-11 w-11 hover:bg-gray-100 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white","aria-label":"Toggle theme",children:[a.jsx(gbe,{className:"hidden h-5 w-5 dark:block"}),a.jsx(abe,{className:"h-5 w-5 dark:hidden"})]})}var OT="Dialog",[rne,nne]=Bn(OT),[nCe,yl]=rne(OT),sne=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:o=!0}=t,l=S.useRef(null),c=S.useRef(null),[u,d]=Ms({prop:n,defaultProp:s??!1,onChange:i,caller:OT});return a.jsx(nCe,{scope:e,triggerRef:l,contentRef:c,contentId:Yi(),titleId:Yi(),descriptionId:Yi(),open:u,onOpenChange:d,onOpenToggle:S.useCallback(()=>d(h=>!h),[d]),modal:o,children:r})};sne.displayName=OT;var ine="DialogTrigger",ane=S.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=yl(ine,r),i=Nt(e,s.triggerRef);return a.jsx(et.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":T6(s.open),...n,ref:i,onClick:ze(t.onClick,s.onOpenToggle)})});ane.displayName=ine;var C6="DialogPortal",[sCe,one]=rne(C6,{forceMount:void 0}),lne=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:s}=t,i=yl(C6,e);return a.jsx(sCe,{scope:e,forceMount:r,children:S.Children.map(n,o=>a.jsx(es,{present:r||i.open,children:a.jsx(nb,{asChild:!0,container:s,children:o})}))})};lne.displayName=C6;var XE="DialogOverlay",cne=S.forwardRef((t,e)=>{const r=one(XE,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,i=yl(XE,t.__scopeDialog);return i.modal?a.jsx(es,{present:n||i.open,children:a.jsx(aCe,{...s,ref:e})}):null});cne.displayName=XE;var iCe=Qh("DialogOverlay.RemoveScroll"),aCe=S.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=yl(XE,r);return a.jsx(zj,{as:iCe,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(et.div,{"data-state":T6(s.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),Ym="DialogContent",une=S.forwardRef((t,e)=>{const r=one(Ym,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,i=yl(Ym,t.__scopeDialog);return a.jsx(es,{present:n||i.open,children:i.modal?a.jsx(oCe,{...s,ref:e}):a.jsx(lCe,{...s,ref:e})})});une.displayName=Ym;var oCe=S.forwardRef((t,e)=>{const r=yl(Ym,t.__scopeDialog),n=S.useRef(null),s=Nt(e,r.contentRef,n);return S.useEffect(()=>{const i=n.current;if(i)return ST(i)},[]),a.jsx(dne,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ze(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ze(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:ze(t.onFocusOutside,i=>i.preventDefault())})}),lCe=S.forwardRef((t,e)=>{const r=yl(Ym,t.__scopeDialog),n=S.useRef(!1),s=S.useRef(!1);return a.jsx(dne,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),dne=S.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=t,l=yl(Ym,r),c=S.useRef(null),u=Nt(e,c);return jT(),a.jsxs(a.Fragment,{children:[a.jsx(Bj,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(og,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":T6(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(uCe,{titleId:l.titleId}),a.jsx(hCe,{contentRef:c,descriptionId:l.descriptionId})]})]})}),k6="DialogTitle",hne=S.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=yl(k6,r);return a.jsx(et.h2,{id:s.titleId,...n,ref:e})});hne.displayName=k6;var fne="DialogDescription",pne=S.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=yl(fne,r);return a.jsx(et.p,{id:s.descriptionId,...n,ref:e})});pne.displayName=fne;var mne="DialogClose",gne=S.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=yl(mne,r);return a.jsx(et.button,{type:"button",...n,ref:e,onClick:ze(t.onClick,()=>s.onOpenChange(!1))})});gne.displayName=mne;function T6(t){return t?"open":"closed"}var yne="DialogTitleWarning",[cCe,xne]=Dxe(yne,{contentName:Ym,titleName:k6,docsSlug:"dialog"}),uCe=({titleId:t})=>{const e=xne(yne),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return S.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},dCe="DialogDescriptionWarning",hCe=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${xne(dCe).contentName}}.`;return S.useEffect(()=>{var i;const s=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},P6=sne,O6=ane,I6=lne,Vj=cne,qj=une,Gj=hne,Kj=pne,IT=gne;const qr=P6,fl=O6,fCe=I6,vne=S.forwardRef(({className:t,...e},r)=>a.jsx(Vj,{ref:r,className:Ie("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));vne.displayName=Vj.displayName;const Dr=S.forwardRef(({className:t,children:e,...r},n)=>a.jsxs(fCe,{children:[a.jsx(vne,{}),a.jsxs(qj,{ref:n,className:Ie("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...r,children:[e,a.jsxs(IT,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(En,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Dr.displayName=qj.displayName;const Lr=({className:t,...e})=>a.jsx("div",{className:Ie("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Lr.displayName="DialogHeader";const yf=({className:t,...e})=>a.jsx("div",{className:Ie("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});yf.displayName="DialogFooter";const Fr=S.forwardRef(({className:t,...e},r)=>a.jsx(Gj,{ref:r,className:Ie("text-lg font-semibold leading-none tracking-tight",t),...e}));Fr.displayName=Gj.displayName;const gb=S.forwardRef(({className:t,...e},r)=>a.jsx(Kj,{ref:r,className:Ie("text-sm text-muted-foreground",t),...e}));gb.displayName=Kj.displayName;const Ht=S.forwardRef(({className:t,...e},r)=>a.jsx("textarea",{className:Ie("flex min-h-[120px] w-full rounded-lg border border-input bg-background","px-4 py-3 text-sm text-foreground","shadow-theme-xs","placeholder:text-muted-foreground","focus:border-brand-300 focus:outline-none focus:ring-3 focus:ring-brand-500/10","disabled:cursor-not-allowed disabled:opacity-50","dark:border-gray-800 dark:bg-gray-900 dark:text-white",t),ref:r,...e}));Ht.displayName="Textarea";function s4(t,[e,r]){return Math.min(r,Math.max(e,t))}function pCe(t,e){return S.useReducer((r,n)=>e[r][n]??r,t)}var R6="ScrollArea",[bne,Vyt]=Bn(R6),[mCe,No]=bne(R6),wne=S.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:i=600,...o}=t,[l,c]=S.useState(null),[u,d]=S.useState(null),[h,f]=S.useState(null),[p,g]=S.useState(null),[m,x]=S.useState(null),[y,v]=S.useState(0),[b,w]=S.useState(0),[j,N]=S.useState(!1),[C,k]=S.useState(!1),E=Nt(e,z=>c(z)),M=cg(s);return a.jsx(mCe,{scope:r,type:n,dir:M,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:h,onContentChange:f,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:j,onScrollbarXEnabledChange:N,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:C,onScrollbarYEnabledChange:k,onCornerWidthChange:v,onCornerHeightChange:w,children:a.jsx(et.div,{dir:M,...o,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":b+"px",...t.style}})})});wne.displayName=R6;var _ne="ScrollAreaViewport",jne=S.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:s,...i}=t,o=No(_ne,r),l=S.useRef(null),c=Nt(e,l,o.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),a.jsx(et.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});jne.displayName=_ne;var Cc="ScrollAreaScrollbar",M6=S.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=No(Cc,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=s,l=t.orientation==="horizontal";return S.useEffect(()=>(l?i(!0):o(!0),()=>{l?i(!1):o(!1)}),[l,i,o]),s.type==="hover"?a.jsx(gCe,{...n,ref:e,forceMount:r}):s.type==="scroll"?a.jsx(yCe,{...n,ref:e,forceMount:r}):s.type==="auto"?a.jsx(Sne,{...n,ref:e,forceMount:r}):s.type==="always"?a.jsx(D6,{...n,ref:e}):null});M6.displayName=Cc;var gCe=S.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=No(Cc,t.__scopeScrollArea),[i,o]=S.useState(!1);return S.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),o(!0)},d=()=>{c=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(es,{present:r||i,children:a.jsx(Sne,{"data-state":i?"visible":"hidden",...n,ref:e})})}),yCe=S.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=No(Cc,t.__scopeScrollArea),i=t.orientation==="horizontal",o=MT(()=>c("SCROLL_END"),100),[l,c]=pCe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return S.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,s.scrollHideDelay,c]),S.useEffect(()=>{const u=s.viewport,d=i?"scrollLeft":"scrollTop";if(u){let h=u[d];const f=()=>{const p=u[d];h!==p&&(c("SCROLL"),o()),h=p};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,i,c,o]),a.jsx(es,{present:r||l!=="hidden",children:a.jsx(D6,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:ze(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ze(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Sne=S.forwardRef((t,e)=>{const r=No(Cc,t.__scopeScrollArea),{forceMount:n,...s}=t,[i,o]=S.useState(!1),l=t.orientation==="horizontal",c=MT(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;o(l?u:d)}},10);return jv(r.viewport,c),jv(r.content,c),a.jsx(es,{present:n||i,children:a.jsx(D6,{"data-state":i?"visible":"hidden",...s,ref:e})})}),D6=S.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,s=No(Cc,t.__scopeScrollArea),i=S.useRef(null),o=S.useRef(0),[l,c]=S.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=kne(l.viewport,l.content),d={...n,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:f=>o.current=f};function h(f,p){return jCe(f,o.current,l,p)}return r==="horizontal"?a.jsx(xCe,{...d,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const f=s.viewport.scrollLeft,p=_H(f,l,s.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=h(f,s.dir))}}):r==="vertical"?a.jsx(vCe,{...d,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const f=s.viewport.scrollTop,p=_H(f,l);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=h(f))}}):null}),xCe=S.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...s}=t,i=No(Cc,t.__scopeScrollArea),[o,l]=S.useState(),c=S.useRef(null),u=Nt(e,c,i.onScrollbarXChange);return S.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(Ane,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":RT(r)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(i.viewport){const f=i.viewport.scrollLeft+d.deltaX;t.onWheelScroll(f),Pne(f,h)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:ZE(o.paddingLeft),paddingEnd:ZE(o.paddingRight)}})}})}),vCe=S.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...s}=t,i=No(Cc,t.__scopeScrollArea),[o,l]=S.useState(),c=S.useRef(null),u=Nt(e,c,i.onScrollbarYChange);return S.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(Ane,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":RT(r)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(i.viewport){const f=i.viewport.scrollTop+d.deltaY;t.onWheelScroll(f),Pne(f,h)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:ZE(o.paddingTop),paddingEnd:ZE(o.paddingBottom)}})}})}),[bCe,Nne]=bne(Cc),Ane=S.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:h,...f}=t,p=No(Cc,r),[g,m]=S.useState(null),x=Nt(e,E=>m(E)),y=S.useRef(null),v=S.useRef(""),b=p.viewport,w=n.content-n.viewport,j=gn(d),N=gn(c),C=MT(h,10);function k(E){if(y.current){const M=E.clientX-y.current.left,z=E.clientY-y.current.top;u({x:M,y:z})}}return S.useEffect(()=>{const E=M=>{const z=M.target;(g==null?void 0:g.contains(z))&&j(M,w)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[b,g,w,j]),S.useEffect(N,[n,N]),jv(g,C),jv(p.content,C),a.jsx(bCe,{scope:r,scrollbar:g,hasThumb:s,onThumbChange:gn(i),onThumbPointerUp:gn(o),onThumbPositionChange:N,onThumbPointerDown:gn(l),children:a.jsx(et.div,{...f,ref:x,style:{position:"absolute",...f.style},onPointerDown:ze(t.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),y.current=g.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),k(E))}),onPointerMove:ze(t.onPointerMove,k),onPointerUp:ze(t.onPointerUp,E=>{const M=E.target;M.hasPointerCapture(E.pointerId)&&M.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),QE="ScrollAreaThumb",Ene=S.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=Nne(QE,t.__scopeScrollArea);return a.jsx(es,{present:r||s.hasThumb,children:a.jsx(wCe,{ref:e,...n})})}),wCe=S.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...s}=t,i=No(QE,r),o=Nne(QE,r),{onThumbPositionChange:l}=o,c=Nt(e,h=>o.onThumbChange(h)),u=S.useRef(void 0),d=MT(()=>{u.current&&(u.current(),u.current=void 0)},100);return S.useEffect(()=>{const h=i.viewport;if(h){const f=()=>{if(d(),!u.current){const p=SCe(h,l);u.current=p,l()}};return l(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[i.viewport,d,l]),a.jsx(et.div,{"data-state":o.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ze(t.onPointerDownCapture,h=>{const p=h.target.getBoundingClientRect(),g=h.clientX-p.left,m=h.clientY-p.top;o.onThumbPointerDown({x:g,y:m})}),onPointerUp:ze(t.onPointerUp,o.onThumbPointerUp)})});Ene.displayName=QE;var L6="ScrollAreaCorner",Cne=S.forwardRef((t,e)=>{const r=No(L6,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?a.jsx(_Ce,{...t,ref:e}):null});Cne.displayName=L6;var _Ce=S.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,s=No(L6,r),[i,o]=S.useState(0),[l,c]=S.useState(0),u=!!(i&&l);return jv(s.scrollbarX,()=>{var h;const d=((h=s.scrollbarX)==null?void 0:h.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),jv(s.scrollbarY,()=>{var h;const d=((h=s.scrollbarY)==null?void 0:h.offsetWidth)||0;s.onCornerWidthChange(d),o(d)}),u?a.jsx(et.div,{...n,ref:e,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function ZE(t){return t?parseInt(t,10):0}function kne(t,e){const r=t/e;return isNaN(r)?0:r}function RT(t){const e=kne(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function jCe(t,e,r,n="ltr"){const s=RT(r),i=s/2,o=e||i,l=s-o,c=r.scrollbar.paddingStart+o,u=r.scrollbar.size-r.scrollbar.paddingEnd-l,d=r.content-r.viewport,h=n==="ltr"?[0,d]:[d*-1,0];return Tne([c,u],h)(t)}function _H(t,e,r="ltr"){const n=RT(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,o=e.content-e.viewport,l=i-n,c=r==="ltr"?[0,o]:[o*-1,0],u=s4(t,c);return Tne([0,o],[0,l])(u)}function Tne(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function Pne(t,e){return t>0&&t<e}var SCe=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return function s(){const i={left:t.scrollLeft,top:t.scrollTop},o=r.left!==i.left,l=r.top!==i.top;(o||l)&&e(),r=i,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function MT(t,e){const r=gn(t),n=S.useRef(0);return S.useEffect(()=>()=>window.clearTimeout(n.current),[]),S.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function jv(t,e){const r=gn(e);vn(()=>{let n=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(t),()=>{window.cancelAnimationFrame(n),s.unobserve(t)}}},[t,r])}var One=wne,NCe=jne,ACe=Cne;const Yj=S.forwardRef(({className:t,children:e,...r},n)=>a.jsxs(One,{ref:n,className:Ie("relative overflow-hidden",t),...r,children:[a.jsx(NCe,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(Ine,{}),a.jsx(ACe,{})]}));Yj.displayName=One.displayName;const Ine=S.forwardRef(({className:t,orientation:e="vertical",...r},n)=>a.jsx(M6,{ref:n,orientation:e,className:Ie("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:a.jsx(Ene,{className:"relative flex-1 rounded-full bg-border"})}));Ine.displayName=M6.displayName;var ECe="Separator",jH="horizontal",CCe=["horizontal","vertical"],Rne=S.forwardRef((t,e)=>{const{decorative:r,orientation:n=jH,...s}=t,i=kCe(n)?n:jH,l=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(et.div,{"data-orientation":i,...l,...s,ref:e})});Rne.displayName=ECe;function kCe(t){return CCe.includes(t)}var Mne=Rne;const Ps=S.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},s)=>a.jsx(Mne,{ref:s,decorative:r,orientation:e,className:Ie("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));Ps.displayName=Mne.displayName;function ar({className:t,...e}){return a.jsx("div",{className:Ie("animate-pulse rounded-md bg-muted",t),...e})}const TCe="https://nqibmbtqcjucktqcreob.supabase.co",PCe="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5xaWJtYnRxY2p1Y2t0cWNyZW9iIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ1NTk5MTAsImV4cCI6MjA3MDEzNTkxMH0.UnFk-GqYCZtlkXNlxyHUTaFAnS6Q4hIgDgWKANrxEHg",be=Ite(TCe,PCe,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}});function ur(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function Qu(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function OCe(t,e){const r=ur(t);return isNaN(e)?Qu(t,NaN):(r.setDate(r.getDate()+e),r)}const Dne=6048e5,ICe=864e5,fN=43200,SH=1440;let RCe={};function Xj(){return RCe}function e1(t,e){var l,c,u,d;const r=Xj(),n=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,s=ur(t),i=s.getDay(),o=(i<n?7:0)+i-n;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function JE(t){return e1(t,{weekStartsOn:1})}function Lne(t){const e=ur(t),r=e.getFullYear(),n=Qu(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const s=JE(n),i=Qu(t,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const o=JE(i);return e.getTime()>=s.getTime()?r+1:e.getTime()>=o.getTime()?r:r-1}function eC(t){const e=ur(t);return e.setHours(0,0,0,0),e}function tC(t){const e=ur(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function Fne(t,e){const r=eC(t),n=eC(e),s=+r-tC(r),i=+n-tC(n);return Math.round((s-i)/ICe)}function MCe(t){const e=Lne(t),r=Qu(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),JE(r)}function jA(t,e){const r=ur(t),n=ur(e),s=r.getTime()-n.getTime();return s<0?-1:s>0?1:s}function F6(t){return Qu(t,Date.now())}function $ne(t,e){const r=eC(t),n=eC(e);return+r==+n}function DCe(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function LCe(t){if(!DCe(t)&&typeof t!="number")return!1;const e=ur(t);return!isNaN(Number(e))}function FCe(t,e){const r=ur(t),n=ur(e),s=r.getFullYear()-n.getFullYear(),i=r.getMonth()-n.getMonth();return s*12+i}function dO(t,e){const r=ur(t),n=ur(e),s=NH(r,n),i=Math.abs(Fne(r,n));r.setDate(r.getDate()-s*i);const o=+(NH(r,n)===-s),l=s*(i-o);return l===0?0:l}function NH(t,e){const r=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return r<0?-1:r>0?1:r}function $Ce(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function BCe(t,e){return+ur(t)-+ur(e)}function UCe(t){const e=ur(t);return e.setHours(23,59,59,999),e}function zCe(t){const e=ur(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function HCe(t){const e=ur(t);return+UCe(e)==+zCe(e)}function WCe(t,e){const r=ur(t),n=ur(e),s=jA(r,n),i=Math.abs(FCe(r,n));let o;if(i<1)o=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-s*i);let l=jA(r,n)===-s;HCe(ur(t))&&i===1&&jA(t,n)===1&&(l=!1),o=s*(i-Number(l))}return o===0?0:o}function VCe(t,e,r){const n=BCe(t,e)/1e3;return $Ce(r==null?void 0:r.roundingMethod)(n)}function qCe(t){const e=ur(t),r=Qu(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const GCe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},KCe=(t,e,r)=>{let n;const s=GCe[t];return typeof s=="string"?n=s:e===1?n=s.one:n=s.other.replace("{{count}}",e.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function hO(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const YCe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},XCe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},QCe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ZCe={date:hO({formats:YCe,defaultWidth:"full"}),time:hO({formats:XCe,defaultWidth:"full"}),dateTime:hO({formats:QCe,defaultWidth:"full"})},JCe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},eke=(t,e,r,n)=>JCe[t];function Yb(t){return(e,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let s;if(n==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,l=r!=null&&r.width?String(r.width):o;s=t.formattingValues[l]||t.formattingValues[o]}else{const o=t.defaultWidth,l=r!=null&&r.width?String(r.width):t.defaultWidth;s=t.values[l]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const tke={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},rke={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},nke={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ske={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ike={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},ake={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},oke=(t,e)=>{const r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},lke={ordinalNumber:oke,era:Yb({values:tke,defaultWidth:"wide"}),quarter:Yb({values:rke,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Yb({values:nke,defaultWidth:"wide"}),day:Yb({values:ske,defaultWidth:"wide"}),dayPeriod:Yb({values:ike,defaultWidth:"wide",formattingValues:ake,defaultFormattingWidth:"wide"})};function Xb(t){return(e,r={})=>{const n=r.width,s=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const o=i[0],l=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?uke(l,h=>h.test(o)):cke(l,h=>h.test(o));let u;u=t.valueCallback?t.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const d=e.slice(o.length);return{value:u,rest:d}}}function cke(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function uke(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function dke(t){return(e,r={})=>{const n=e.match(t.matchPattern);if(!n)return null;const s=n[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=r.valueCallback?r.valueCallback(o):o;const l=e.slice(s.length);return{value:o,rest:l}}}const hke=/^(\d+)(th|st|nd|rd)?/i,fke=/\d+/i,pke={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},mke={any:[/^b/i,/^(a|c)/i]},gke={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},yke={any:[/1/i,/2/i,/3/i,/4/i]},xke={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},vke={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},bke={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},wke={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},_ke={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},jke={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Ske={ordinalNumber:dke({matchPattern:hke,parsePattern:fke,valueCallback:t=>parseInt(t,10)}),era:Xb({matchPatterns:pke,defaultMatchWidth:"wide",parsePatterns:mke,defaultParseWidth:"any"}),quarter:Xb({matchPatterns:gke,defaultMatchWidth:"wide",parsePatterns:yke,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Xb({matchPatterns:xke,defaultMatchWidth:"wide",parsePatterns:vke,defaultParseWidth:"any"}),day:Xb({matchPatterns:bke,defaultMatchWidth:"wide",parsePatterns:wke,defaultParseWidth:"any"}),dayPeriod:Xb({matchPatterns:_ke,defaultMatchWidth:"any",parsePatterns:jke,defaultParseWidth:"any"})},$6={code:"en-US",formatDistance:KCe,formatLong:ZCe,formatRelative:eke,localize:lke,match:Ske,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Nke(t){const e=ur(t);return Fne(e,qCe(e))+1}function Ake(t){const e=ur(t),r=+JE(e)-+MCe(e);return Math.round(r/Dne)+1}function Bne(t,e){var d,h,f,p;const r=ur(t),n=r.getFullYear(),s=Xj(),i=(e==null?void 0:e.firstWeekContainsDate)??((h=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((p=(f=s.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,o=Qu(t,0);o.setFullYear(n+1,0,i),o.setHours(0,0,0,0);const l=e1(o,e),c=Qu(t,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const u=e1(c,e);return r.getTime()>=l.getTime()?n+1:r.getTime()>=u.getTime()?n:n-1}function Eke(t,e){var l,c,u,d;const r=Xj(),n=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,s=Bne(t,e),i=Qu(t,0);return i.setFullYear(s,0,n),i.setHours(0,0,0,0),e1(i,e)}function Cke(t,e){const r=ur(t),n=+e1(r,e)-+Eke(r,e);return Math.round(n/Dne)+1}function pr(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const xd={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return pr(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):pr(r+1,2)},d(t,e){return pr(t.getDate(),e.length)},a(t,e){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,e){return pr(t.getHours()%12||12,e.length)},H(t,e){return pr(t.getHours(),e.length)},m(t,e){return pr(t.getMinutes(),e.length)},s(t,e){return pr(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),s=Math.trunc(n*Math.pow(10,r-3));return pr(s,e.length)}},Pg={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},AH={G:function(t,e,r){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(t,e,r){if(e==="yo"){const n=t.getFullYear(),s=n>0?n:1-n;return r.ordinalNumber(s,{unit:"year"})}return xd.y(t,e)},Y:function(t,e,r,n){const s=Bne(t,n),i=s>0?s:1-s;if(e==="YY"){const o=i%100;return pr(o,2)}return e==="Yo"?r.ordinalNumber(i,{unit:"year"}):pr(i,e.length)},R:function(t,e){const r=Lne(t);return pr(r,e.length)},u:function(t,e){const r=t.getFullYear();return pr(r,e.length)},Q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return pr(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return pr(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,r){const n=t.getMonth();switch(e){case"M":case"MM":return xd.M(t,e);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,r){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return pr(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,r,n){const s=Cke(t,n);return e==="wo"?r.ordinalNumber(s,{unit:"week"}):pr(s,e.length)},I:function(t,e,r){const n=Ake(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):pr(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):xd.d(t,e)},D:function(t,e,r){const n=Nke(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):pr(n,e.length)},E:function(t,e,r){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,r,n){const s=t.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return pr(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,r,n){const s=t.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return pr(i,e.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,r){const n=t.getDay(),s=n===0?7:n;switch(e){case"i":return String(s);case"ii":return pr(s,e.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,r){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,r){const n=t.getHours();let s;switch(n===12?s=Pg.noon:n===0?s=Pg.midnight:s=n/12>=1?"pm":"am",e){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,r){const n=t.getHours();let s;switch(n>=17?s=Pg.evening:n>=12?s=Pg.afternoon:n>=4?s=Pg.morning:s=Pg.night,e){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,r){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return xd.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):xd.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):pr(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):pr(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):xd.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):xd.s(t,e)},S:function(t,e){return xd.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return CH(n);case"XXXX":case"XX":return Hf(n);case"XXXXX":case"XXX":default:return Hf(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return CH(n);case"xxxx":case"xx":return Hf(n);case"xxxxx":case"xxx":default:return Hf(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+EH(n,":");case"OOOO":default:return"GMT"+Hf(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+EH(n,":");case"zzzz":default:return"GMT"+Hf(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return pr(n,e.length)},T:function(t,e,r){const n=t.getTime();return pr(n,e.length)}};function EH(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),s=Math.trunc(n/60),i=n%60;return i===0?r+String(s):r+String(s)+e+pr(i,2)}function CH(t,e){return t%60===0?(t>0?"-":"+")+pr(Math.abs(t)/60,2):Hf(t,e)}function Hf(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),s=pr(Math.trunc(n/60),2),i=pr(n%60,2);return r+s+e+i}const kH=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Une=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},kke=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],s=r[2];if(!s)return kH(t,e);let i;switch(n){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",kH(n,e)).replace("{{time}}",Une(s,e))},Tke={p:Une,P:kke},Pke=/^D+$/,Oke=/^Y+$/,Ike=["D","DD","YY","YYYY"];function Rke(t){return Pke.test(t)}function Mke(t){return Oke.test(t)}function Dke(t,e,r){const n=Lke(t,e,r);if(console.warn(n),Ike.includes(t))throw new RangeError(n)}function Lke(t,e,r){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Fke=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$ke=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bke=/^'([^]*?)'?$/,Uke=/''/g,zke=/[a-zA-Z]/;function t1(t,e,r){var d,h,f,p,g,m,x,y;const n=Xj(),s=(r==null?void 0:r.locale)??n.locale??$6,i=(r==null?void 0:r.firstWeekContainsDate)??((h=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??n.firstWeekContainsDate??((p=(f=n.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,o=(r==null?void 0:r.weekStartsOn)??((m=(g=r==null?void 0:r.locale)==null?void 0:g.options)==null?void 0:m.weekStartsOn)??n.weekStartsOn??((y=(x=n.locale)==null?void 0:x.options)==null?void 0:y.weekStartsOn)??0,l=ur(t);if(!LCe(l))throw new RangeError("Invalid time value");let c=e.match($ke).map(v=>{const b=v[0];if(b==="p"||b==="P"){const w=Tke[b];return w(v,s.formatLong)}return v}).join("").match(Fke).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const b=v[0];if(b==="'")return{isToken:!1,value:Hke(v)};if(AH[b])return{isToken:!0,value:v};if(b.match(zke))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:v}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(v=>{if(!v.isToken)return v.value;const b=v.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&Mke(b)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&Rke(b))&&Dke(b,e,String(t));const w=AH[b[0]];return w(l,b,s.localize,u)}).join("")}function Hke(t){const e=t.match(Bke);return e?e[1].replace(Uke,"'"):t}function Wke(t,e,r){const n=Xj(),s=(r==null?void 0:r.locale)??n.locale??$6,i=2520,o=jA(t,e);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:o});let c,u;o>0?(c=ur(e),u=ur(t)):(c=ur(t),u=ur(e));const d=VCe(u,c),h=(tC(u)-tC(c))/1e3,f=Math.round((d-h)/60);let p;if(f<2)return r!=null&&r.includeSeconds?d<5?s.formatDistance("lessThanXSeconds",5,l):d<10?s.formatDistance("lessThanXSeconds",10,l):d<20?s.formatDistance("lessThanXSeconds",20,l):d<40?s.formatDistance("halfAMinute",0,l):d<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):f===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",f,l);if(f<45)return s.formatDistance("xMinutes",f,l);if(f<90)return s.formatDistance("aboutXHours",1,l);if(f<SH){const g=Math.round(f/60);return s.formatDistance("aboutXHours",g,l)}else{if(f<i)return s.formatDistance("xDays",1,l);if(f<fN){const g=Math.round(f/SH);return s.formatDistance("xDays",g,l)}else if(f<fN*2)return p=Math.round(f/fN),s.formatDistance("aboutXMonths",p,l)}if(p=WCe(u,c),p<12){const g=Math.round(f/fN);return s.formatDistance("xMonths",g,l)}else{const g=p%12,m=Math.trunc(p/12);return g<3?s.formatDistance("aboutXYears",m,l):g<9?s.formatDistance("overXYears",m,l):s.formatDistance("almostXYears",m+1,l)}}function Vke(t,e){return Wke(t,F6(t),e)}function qke(t){return $ne(t,F6(t))}function Gke(t,e){return OCe(t,-e)}function Kke(t){return $ne(t,Gke(F6(t),1))}function Yke(t){if(!t||t.length===0)return[];const e=new Map;return t.forEach(r=>{const n=new Date(r.created_at),s=t1(n,"yyyy-MM-dd");let i;qke(n)?i="Today":Kke(n)?i="Yesterday":i=t1(n,"MMMM d, yyyy"),e.has(s)?e.get(s).notes.push(r):e.set(s,{date:i,dateKey:s,notes:[r]})}),Array.from(e.values()).sort((r,n)=>n.dateKey.localeCompare(r.dateKey)).map(r=>({...r,notes:r.notes.sort((n,s)=>new Date(s.created_at).getTime()-new Date(n.created_at).getTime())}))}function Xke(t){return t1(new Date(t),"HH:mm")}function Qke(){const{user:t}=Pt(),{toast:e}=on(),r=s6(),n=["user-notes",t==null?void 0:t.id],{data:s,isLoading:i,error:o}=t_e({queryKey:n,queryFn:async()=>{const{data:h,error:f}=await be.from("user_notes").select("*").order("created_at",{ascending:!1});if(f)throw f;return h},enabled:!!t}),l=GP({mutationFn:async h=>{if(!t)throw new Error("Not authenticated");const{data:f,error:p}=await be.from("user_notes").insert({user_id:t.id,content:h}).select().single();if(p)throw p;return f},onSuccess:()=>{r.invalidateQueries({queryKey:n})},onError:h=>{e({title:"Error",description:"Could not save note.",variant:"destructive"}),console.error("Create note error:",h)}}),c=GP({mutationFn:async({id:h,content:f})=>{const{data:p,error:g}=await be.from("user_notes").update({content:f,updated_at:new Date().toISOString()}).eq("id",h).select().single();if(g)throw g;return p},onSuccess:()=>{r.invalidateQueries({queryKey:n})},onError:h=>{e({title:"Error",description:"Could not update note.",variant:"destructive"}),console.error("Update note error:",h)}}),u=GP({mutationFn:async h=>{const{error:f}=await be.from("user_notes").delete().eq("id",h);if(f)throw f},onSuccess:()=>{r.invalidateQueries({queryKey:n}),e({title:"Deleted",description:"Note has been removed."})},onError:h=>{e({title:"Error",description:"Could not delete note.",variant:"destructive"}),console.error("Delete note error:",h)}}),d=S.useMemo(()=>Yke(s),[s]);return{notes:s,groupedNotes:d,isLoading:i,error:o,createNote:async h=>{await l.mutateAsync(h)},updateNote:async h=>{await c.mutateAsync(h)},deleteNote:async h=>{await u.mutateAsync(h)},isCreating:l.isPending,isUpdating:c.isPending,isDeleting:u.isPending}}function Zke({note:t,onUpdate:e,onDelete:r,isUpdating:n,isDeleting:s}){const[i,o]=S.useState(!1),[l,c]=S.useState(t.content),u=async()=>{l.trim()&&l!==t.content&&await e(t.id,l.trim()),o(!1)},d=()=>{c(t.content),o(!1)},h=async()=>{await r(t.id)};return i?a.jsxs("div",{className:"group relative p-3 rounded-lg bg-muted/50 border border-border mb-2",children:[a.jsx(Ht,{value:l,onChange:f=>c(f.target.value),className:"min-h-[80px] resize-none text-sm",autoFocus:!0}),a.jsxs("div",{className:"flex justify-end gap-2 mt-2",children:[a.jsxs(ye,{size:"sm",variant:"ghost",onClick:d,disabled:n,children:[a.jsx(En,{className:"h-4 w-4 mr-1"}),"Cancel"]}),a.jsxs(ye,{size:"sm",onClick:u,disabled:n||!l.trim(),children:[a.jsx(yn,{className:"h-4 w-4 mr-1"}),"Save"]})]})]}):a.jsxs("div",{className:"group relative p-3 rounded-lg hover:bg-muted/50 transition-colors mb-2",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:Xke(t.created_at)}),a.jsx("p",{className:"text-sm text-foreground mt-1 whitespace-pre-wrap break-words",children:t.content}),a.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity flex gap-1",children:[a.jsx(ye,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>o(!0),disabled:s,children:a.jsx(JJ,{className:"h-3.5 w-3.5"})}),a.jsx(ye,{size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:h,disabled:s,children:a.jsx(Ts,{className:"h-3.5 w-3.5"})})]})]})}function Jke({open:t,onOpenChange:e}){const[r,n]=S.useState(""),{groupedNotes:s,isLoading:i,createNote:o,updateNote:l,deleteNote:c,isCreating:u,isUpdating:d,isDeleting:h}=Qke(),f=async()=>{!r.trim()||u||(await o(r.trim()),n(""))},p=g=>{(g.ctrlKey||g.metaKey)&&g.key==="Enter"&&(g.preventDefault(),f())};return a.jsx(qr,{open:t,onOpenChange:e,children:a.jsxs(Dr,{className:"sm:max-w-[800px] h-[80vh] flex flex-col p-0",children:[a.jsx(Lr,{className:"px-6 py-4 border-b border-border",children:a.jsxs(Fr,{className:"flex items-center gap-2",children:[a.jsx(xD,{className:"h-5 w-5 text-primary"}),"My Notebook"]})}),a.jsx(Yj,{className:"flex-1 px-6 overflow-y-auto",children:i?a.jsx("div",{className:"py-4 space-y-4",children:[1,2,3].map(g=>a.jsxs("div",{className:"space-y-2",children:[a.jsx(ar,{className:"h-4 w-24"}),a.jsx(ar,{className:"h-16 w-full"})]},g))}):s.length===0?a.jsxs("div",{className:"py-12 text-center",children:[a.jsx(xD,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground text-sm",children:"No notes yet."}),a.jsx("p",{className:"text-muted-foreground text-xs mt-1",children:"Write your first note below."})]}):a.jsx("div",{className:"py-4",children:s.map(g=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3 my-4 first:mt-0",children:[a.jsx(Ps,{className:"flex-1"}),a.jsx("span",{className:"text-xs font-medium text-muted-foreground whitespace-nowrap",children:g.date}),a.jsx(Ps,{className:"flex-1"})]}),g.notes.map(m=>a.jsx(Zke,{note:m,onUpdate:(x,y)=>l({id:x,content:y}),onDelete:c,isUpdating:d,isDeleting:h},m.id))]},g.dateKey))})}),a.jsxs("div",{className:"border-t border-border p-4 bg-background",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Ht,{placeholder:"Write a new note... (Ctrl+Enter to save)",value:r,onChange:g=>n(g.target.value),onKeyDown:p,className:"min-h-[80px] pr-12 resize-none",disabled:u}),a.jsx(ye,{size:"icon",className:"absolute bottom-2 right-2 h-8 w-8",onClick:f,disabled:!r.trim()||u,children:a.jsx(UF,{className:"h-4 w-4"})})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center",children:"Your notes are saved automatically"})]})]})})}async function eTe(t,e,r=3600){if(!e)return null;const{data:n,error:s}=await be.storage.from(t).createSignedUrl(e,r);return s?(console.error("Signed URL error:",s),null):n.signedUrl}async function tTe(t,e=3600){if(!t)return null;const{data:r,error:n}=await be.storage.from("avatars").createSignedUrl(t,e);return n?(console.error("Avatar signed URL error:",n),null):r.signedUrl}async function Ry(t){return t?t.startsWith("https://")?t:tTe(t):null}async function DT(t,e){const r={};return await Promise.all(t.map(async n=>{if(n.storage_path){const s=await eTe(e,n.storage_path);s&&(r[n.id]=s)}})),r}const TH=({pageTitle:t="Dashboard",onToggleSidebar:e,onToggleMobile:r,isMobileOpen:n,showSidebarControls:s=!0})=>{const{user:i,studentPoints:o,researchProfile:l,signOut:c}=Pt(),u=gr(),{theme:d}=E6(),[h,f]=S.useState(!1),[p,g]=S.useState(null);S.useEffect(()=>{(async()=>{const b=await Ry(l==null?void 0:l.avatar_url);g(b)})()},[l==null?void 0:l.avatar_url]);const m=d==="dark"?"https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/logo_new_light.png":"https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/logo_new.png",x=async()=>{await c(),u("/login")},y=()=>l!=null&&l.nickname?l.nickname.slice(0,2).toUpperCase():i!=null&&i.email?i.email.slice(0,2).toUpperCase():"U";return!i||!s?a.jsxs("header",{className:"sticky top-0 z-40 flex items-center justify-between w-full bg-card border-b border-border px-4 py-4 lg:px-6",children:[a.jsx(tt,{to:"/",className:"flex items-center",children:a.jsx("img",{src:m,alt:"Academly.ai",className:"h-8 w-auto"})}),a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(tt,{to:"/pricing",className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:"Pricing"}),a.jsx(tt,{to:"/how-it-works",className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:"How it works"}),i?a.jsx(ye,{asChild:!0,size:"sm",children:a.jsx(tt,{to:"/dashboard",children:"Dashboard"})}):a.jsx(ye,{asChild:!0,size:"sm",children:a.jsx(tt,{to:"/login",children:"Login"})})]})]}):a.jsx("header",{className:"ta-header astro-header",children:a.jsxs("div",{className:"ta-header-content",children:[a.jsxs("div",{className:"ta-header-left",children:[a.jsx("button",{onClick:r,className:"lg:hidden flex items-center justify-center w-10 h-10 text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors","aria-label":"Toggle mobile menu",children:n?a.jsx(En,{className:"w-5 h-5"}):a.jsx(BF,{className:"w-5 h-5"})}),a.jsx("button",{onClick:e,className:"hidden lg:flex items-center justify-center w-11 h-11 text-muted-foreground hover:text-foreground border border-border rounded-lg transition-colors","aria-label":"Toggle sidebar",children:a.jsx("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.583252 1C0.583252 0.585788 0.919038 0.25 1.33325 0.25H14.6666C15.0808 0.25 15.4166 0.585786 15.4166 1C15.4166 1.41421 15.0808 1.75 14.6666 1.75L1.33325 1.75C0.919038 1.75 0.583252 1.41422 0.583252 1ZM0.583252 11C0.583252 10.5858 0.919038 10.25 1.33325 10.25L14.6666 10.25C15.0808 10.25 15.4166 10.5858 15.4166 11C15.4166 11.4142 15.0808 11.75 14.6666 11.75L1.33325 11.75C0.919038 11.75 0.583252 11.4142 0.583252 11ZM1.33325 5.25C0.919038 5.25 0.583252 5.58579 0.583252 6C0.583252 6.41421 0.919038 6.75 1.33325 6.75L7.99992 6.75C8.41413 6.75 8.74992 6.41421 8.74992 6C8.74992 5.58579 8.41413 5.25 7.99992 5.25L1.33325 5.25Z",fill:"currentColor"})})}),a.jsx(tt,{to:"/dashboard",className:"lg:hidden",children:a.jsx("img",{src:m,alt:"Academly.ai",className:"h-8 w-auto"})}),a.jsx("h1",{className:"ta-header-title",children:t})]}),a.jsxs("div",{className:"ta-header-right",children:[a.jsx("button",{onClick:()=>f(!0),className:"flex items-center justify-center w-10 h-10 text-muted-foreground hover:text-foreground hover:bg-muted rounded-full border border-border transition-colors","aria-label":"Open notes",children:a.jsx(xD,{className:"w-5 h-5"})}),a.jsx(rCe,{}),a.jsx(Jke,{open:h,onOpenChange:f}),o&&a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 rounded-full bg-gradient-to-r from-primary/10 to-primary/5 border border-primary/20 shadow-sm shadow-primary/10",children:[a.jsx(Ji,{className:"h-4 w-4 text-primary"}),a.jsxs("span",{className:"text-sm font-semibold text-primary",children:[Math.floor(o.remaining).toLocaleString("de-DE")," SP"]})]}),a.jsxs(zre,{children:[a.jsx(Hre,{asChild:!0,children:a.jsx("button",{className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:a.jsxs(kT,{className:"h-10 w-10 border-2 border-border",children:[p?a.jsx(TT,{src:p,alt:"Avatar"}):null,a.jsx(PT,{className:"bg-brand-50 text-brand-500 font-semibold",children:y()})]})})}),a.jsxs(S6,{className:"w-60",align:"end",forceMount:!0,children:[a.jsxs("div",{className:"px-4 py-3 border-b border-border",children:[a.jsx("p",{className:"font-medium text-foreground",children:(l==null?void 0:l.nickname)||"User"}),a.jsx("p",{className:"text-sm text-muted-foreground truncate",children:i==null?void 0:i.email})]}),a.jsxs(Iy,{onClick:()=>u("/account"),className:"cursor-pointer",children:[a.jsx(Ij,{className:"mr-2 h-4 w-4"}),a.jsx("span",{children:"Manage Account"})]}),a.jsxs(Iy,{onClick:()=>u("/history"),className:"cursor-pointer",children:[a.jsx(Xve,{className:"mr-2 h-4 w-4"}),a.jsx("span",{children:"History"})]}),a.jsx(N6,{}),a.jsxs(Iy,{onClick:x,className:"cursor-pointer text-destructive focus:text-destructive",children:[a.jsx(Zve,{className:"mr-2 h-4 w-4"}),a.jsx("span",{children:"Sign Out"})]})]})]})]})]})})},jr=({children:t,className:e=""})=>a.jsx("div",{className:`max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 ${e}`,children:t}),Ds=()=>a.jsx("footer",{className:"border-t border-border bg-card",children:a.jsx(jr,{children:a.jsxs("div",{className:"py-12 lg:py-16",children:[a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-8 lg:gap-12",children:[a.jsxs("div",{className:"col-span-2 md:col-span-1",children:[a.jsxs(tt,{to:"/",className:"flex items-center space-x-2 mb-4",children:[a.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary flex items-center justify-center",children:a.jsx("span",{className:"text-primary-foreground font-bold text-sm",children:"A"})}),a.jsx("span",{className:"font-bold text-lg text-foreground",children:"Academly.ai"})]}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Thesis platform built around source-backed academic writing."})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground mb-4",children:"Product"}),a.jsxs("ul",{className:"space-y-3",children:[a.jsx("li",{children:a.jsx(tt,{to:"/#features",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Features"})}),a.jsx("li",{children:a.jsx(tt,{to:"/#how-it-works",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"How It Works"})}),a.jsx("li",{children:a.jsx(tt,{to:"/pricing",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Pricing"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground mb-4",children:"Free Tools"}),a.jsxs("ul",{className:"space-y-3",children:[a.jsx("li",{children:a.jsx(tt,{to:"/topic-ideas",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Topic Generator"})}),a.jsx("li",{children:a.jsx(tt,{to:"/literature-search",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Literature Search"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground mb-4",children:"Compare"}),a.jsxs("ul",{className:"space-y-3",children:[a.jsx("li",{children:a.jsx(tt,{to:"/vs/chatgpt",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Academly vs ChatGPT"})}),a.jsx("li",{children:a.jsx(tt,{to:"/vs/jenni-ai",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Academly vs Jenni AI"})}),a.jsx("li",{children:a.jsx(tt,{to:"/vs/perplexity",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Academly vs Perplexity"})}),a.jsx("li",{children:a.jsx(tt,{to:"/vs/claude",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Academly vs Claude"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground mb-4",children:"Company"}),a.jsxs("ul",{className:"space-y-3",children:[a.jsx("li",{children:a.jsx(tt,{to:"/blog",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Blog"})}),a.jsx("li",{children:a.jsx(tt,{to:"/team",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Team"})}),a.jsx("li",{children:a.jsx("a",{href:"https://docs.academly.ai/",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Docs"})}),a.jsx("li",{children:a.jsx("a",{href:"mailto:support@academly.ai",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Support"})}),a.jsx("li",{children:a.jsx(tt,{to:"/legal#privacy",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Privacy"})}),a.jsx("li",{children:a.jsx(tt,{to:"/legal#terms",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Terms"})}),a.jsx("li",{children:a.jsx(tt,{to:"/legal",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Imprint"})})]})]})]}),a.jsxs("div",{className:"border-t border-border mt-12 pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["© ",new Date().getFullYear()," Academly.ai. All rights reserved."]}),a.jsxs("div",{className:"flex items-center gap-6",children:[a.jsx("a",{href:"https://youtube.com/@academly-ai?si=hAadi72xwmt5fJ3u",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-primary transition-colors","aria-label":"YouTube",children:a.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M23.498 6.186a3.016 3.016 0 00-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 00.502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 002.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 002.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"})})}),a.jsx("a",{href:"https://discord.gg/YFHAZY8d9",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-primary transition-colors","aria-label":"Discord",children:a.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 00-5.487 0 12.64 12.64 0 00-.617-1.25.077.077 0 00-.079-.037A19.736 19.736 0 003.677 4.37a.07.07 0 00-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 00.031.057 19.9 19.9 0 005.993 3.03.078.078 0 00.084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 00-.041-.106 13.107 13.107 0 01-1.872-.892.077.077 0 01-.008-.128 10.2 10.2 0 00.372-.292.074.074 0 01.077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 01.078.01c.12.098.246.198.373.292a.077.077 0 01-.006.127 12.299 12.299 0 01-1.873.892.077.077 0 00-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 00.084.028 19.839 19.839 0 006.002-3.03.077.077 0 00.032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 00-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}),a.jsx("a",{href:"https://www.linkedin.com/company/academly-ai",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-primary transition-colors","aria-label":"LinkedIn",children:a.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{fillRule:"evenodd",d:"M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z",clipRule:"evenodd"})})})]})]})]})})}),rTe=[{name:"Dashboard",path:"/dashboard",icon:a.jsx(Qve,{className:"w-5 h-5"})},{name:"My Library",path:"/documents",icon:a.jsx(Nr,{className:"w-5 h-5"})},{name:"My Citations",path:"/reference-checker",icon:a.jsx(ab,{className:"w-5 h-5"})},{name:"My Thesis",icon:a.jsx(QJ,{className:"w-5 h-5"}),subItems:[{name:"Manager",path:"/thesis-manager"},{name:"My Thesis 2",path:"/my-thesis-2"}]}],nTe=[{name:"Topic Explorer",icon:a.jsx(Js,{className:"w-5 h-5"}),subItems:[{name:"Topic Ideas",path:"/topic-explorer/ideas"},{name:"Outline",path:"/topic-explorer/outline"},{name:"Literature Keywords",path:"/topic-explorer/keywords"}]},{name:"Theory & Background",path:"/thesis-builder",icon:a.jsx(Js,{className:"w-5 h-5"})},{name:"Methods & Approach",path:"/methods-approach",icon:a.jsx(XJ,{className:"w-5 h-5"})},{name:"Discussion",path:"/discussion",icon:a.jsx(Vm,{className:"w-5 h-5"})},{name:"Conclusion",path:"/conclusion",icon:a.jsx(mbe,{className:"w-5 h-5"})}],sTe=[{name:"Qualitative",icon:a.jsx(rbe,{className:"w-5 h-5"}),subItems:[{name:"Research Setup",path:"/qualitative/research-setup"},{name:"Codebook",path:"/qualitative/kodierbogen"},{name:"Codebook (Grid)",path:"/qualitative/kodierbogen-grid"},{name:"Interviews",path:"/qualitative/interviews"},{name:"Coding",path:"/qualitative/kodieren"},{name:"Analysis",path:"/qualitative/auswertung"}]}],iTe=[{name:"Summaries",path:"/summary",icon:a.jsx(sl,{className:"w-5 h-5"})},{name:"Text Extractor",path:"/pdf-extract",icon:a.jsx(qJ,{className:"w-5 h-5"})},{name:"Page Selector",path:"/pdf-slicer",icon:a.jsx(tee,{className:"w-5 h-5"})},{name:"Supervisor",path:"/supervisor",icon:a.jsx(GJ,{className:"w-5 h-5"})}],PH=[{label:"Workspace",items:rTe,type:"workspace"},{label:"Writing",items:nTe,type:"writing"},{label:"Qualitative",items:sTe,type:"qualitative"},{label:"Utilities",items:iTe,type:"utilities"}];function aTe({isExpanded:t,isHovered:e,isMobileOpen:r,onHoverChange:n,onMobileClose:s}){const i=mf(),o=i.pathname,{theme:l}=E6(),[c,u]=S.useState(null),[d,h]=S.useState({}),f=S.useRef({}),p=S.useCallback(y=>o===y,[o]),g=t||e||r;S.useEffect(()=>{let y=!1;PH.forEach(v=>{v.items.forEach((b,w)=>{b.subItems&&b.subItems.forEach(j=>{p(j.path)&&(u({type:v.type,index:w}),y=!0)})})}),y||u(null)},[i,p]),S.useEffect(()=>{if(c!==null){const y=`${c.type}-${c.index}`;f.current[y]&&h(v=>{var b;return{...v,[y]:((b=f.current[y])==null?void 0:b.scrollHeight)||0}})}},[c]);const m=(y,v)=>{u(b=>b&&b.type===v&&b.index===y?null:{type:v,index:y})},x=(y,v)=>a.jsx("ul",{className:"flex flex-col gap-1.5",children:y.map((b,w)=>a.jsx("li",{children:b.subItems?a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>m(w,v),className:`astro-menu-item group w-full ${(c==null?void 0:c.type)===v&&(c==null?void 0:c.index)===w?"astro-menu-item-active":"astro-menu-item-inactive"} ${g?"":"justify-center"}`,children:[a.jsx("span",{className:`w-5 h-5 flex-shrink-0 transition-colors ${(c==null?void 0:c.type)===v&&(c==null?void 0:c.index)===w?"text-primary":"text-muted-foreground group-hover:text-foreground"}`,children:b.icon}),g&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"flex-1 text-left",children:b.name}),a.jsx(vc,{className:`w-4 h-4 transition-transform duration-300 ${(c==null?void 0:c.type)===v&&(c==null?void 0:c.index)===w?"rotate-180":""}`})]})]}),g&&a.jsx("div",{ref:j=>{f.current[`${v}-${w}`]=j},className:"overflow-hidden transition-all duration-300 ease-out",style:{height:(c==null?void 0:c.type)===v&&(c==null?void 0:c.index)===w?`${d[`${v}-${w}`]}px`:"0px"},children:a.jsx("ul",{className:"mt-2 ml-9 space-y-1",children:b.subItems.map(j=>a.jsx("li",{children:a.jsx(tt,{to:j.path,onClick:s,className:`astro-dropdown-item ${p(j.path)?"astro-dropdown-item-active":"astro-dropdown-item-inactive"}`,children:j.name})},j.name))})})]}):b.path?a.jsxs(tt,{to:b.path,onClick:s,className:`astro-menu-item group ${p(b.path)?"astro-menu-item-active":"astro-menu-item-inactive"} ${g?"":"justify-center"}`,children:[a.jsx("span",{className:`w-5 h-5 flex-shrink-0 transition-colors ${p(b.path)?"text-primary":"text-muted-foreground group-hover:text-foreground"}`,children:b.icon}),g&&a.jsx("span",{children:b.name})]}):null},b.name))});return a.jsxs(a.Fragment,{children:[r&&a.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 lg:hidden",onClick:s}),a.jsxs("aside",{className:`ta-sidebar astro-sidebar ${g?"ta-sidebar-expanded":"ta-sidebar-collapsed"} ${r?"ta-sidebar-mobile-open":"ta-sidebar-mobile-closed"}`,onMouseEnter:()=>!t&&n(!0),onMouseLeave:()=>n(!1),children:[a.jsx("div",{className:`ta-sidebar-logo ${g?"":"justify-center"}`,children:a.jsx(tt,{to:"/dashboard",className:"flex items-center",children:g?a.jsx("img",{src:l==="dark"?"https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/logo_new_light.png":"https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/logo_new.png",alt:"Academly.ai",className:"h-10 w-auto"}):a.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center",children:a.jsx("span",{className:"text-primary-foreground font-bold text-sm",children:"ST"})})})}),a.jsx("nav",{className:"ta-sidebar-nav no-scrollbar",children:PH.map(y=>a.jsxs("div",{className:"ta-sidebar-section",children:[a.jsx("h2",{className:`ta-sidebar-section-label ${g?"":"text-center"}`,children:g?y.label:"•••"}),x(y.items,y.type)]},y.type))})]})]})}function oTe(){return a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-foreground",children:[a.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor",children:a.jsx("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),a.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:a.jsx("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),a.jsx("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:a.jsx("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}function OH({variant:t="received",layout:e="default",className:r,children:n}){return a.jsx("div",{className:Ie("flex gap-2 max-w-[80%]",t==="sent"?"ml-auto flex-row-reverse":"",e==="ai"?"items-start":"items-end",r),children:n})}function IH({variant:t="received",isLoading:e,className:r,children:n}){return a.jsx("div",{className:Ie("rounded-xl px-3 py-2 text-sm",t==="sent"?"bg-primary text-primary-foreground":"bg-muted text-foreground",r),children:e?a.jsx("div",{className:"flex items-center space-x-2",children:a.jsx(oTe,{})}):n})}function RH({src:t,fallback:e="AI",className:r}){return a.jsxs(kT,{className:Ie("h-8 w-8 shrink-0",r),children:[t&&a.jsx(TT,{src:t}),a.jsx(PT,{className:"text-xs",children:e})]})}const zne=S.forwardRef(({className:t,...e},r)=>a.jsx(Ht,{autoComplete:"off",ref:r,name:"message",className:Ie("max-h-12 px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",t),...e}));zne.displayName="ChatInput";const pN={dimensions:{sm:"sm:max-w-sm sm:h-[500px]",md:"sm:max-w-md sm:h-[min(600px,calc(100vh-120px))]",lg:"sm:max-w-lg sm:h-[min(700px,calc(100vh-120px))]",xl:"sm:max-w-xl sm:h-[min(800px,calc(100vh-120px))]",full:"sm:w-full sm:h-full"},positions:{"bottom-right":"bottom-5 right-5","bottom-left":"bottom-5 left-5"},states:{open:"pointer-events-auto opacity-100 visible scale-100 translate-y-0",closed:"pointer-events-none opacity-0 invisible scale-100 sm:translate-y-5"}},Hne=({className:t,position:e="bottom-right",size:r="md",icon:n,children:s,...i})=>{const[o,l]=S.useState(!1),c=S.useRef(null),u=()=>l(!o);return a.jsxs("div",{className:Ie(`fixed ${pN.positions[e]} z-50 flex flex-col items-end gap-3 pointer-events-none`,t),...i,children:[a.jsxs("div",{ref:c,className:Ie("flex flex-col bg-background border border-border sm:rounded-2xl shadow-xl","transition-all duration-250 ease-out origin-bottom-right","w-full sm:w-auto",pN.dimensions[r],o?pN.states.open:pN.states.closed),children:[s,a.jsx(ye,{variant:"ghost",size:"icon",className:"absolute top-2 right-2 text-muted-foreground hover:text-foreground sm:hidden",onClick:u,children:a.jsx(En,{className:"h-4 w-4"})})]}),a.jsx(Gne,{icon:n,isOpen:o,toggleChat:u})]})};Hne.displayName="ExpandableChat";const Wne=({className:t,...e})=>a.jsx("div",{className:Ie("flex items-center justify-between p-4 border-b border-border",t),...e});Wne.displayName="ExpandableChatHeader";const Vne=({className:t,...e})=>a.jsx("div",{className:Ie("flex-1 overflow-y-auto",t),...e});Vne.displayName="ExpandableChatBody";const qne=({className:t,...e})=>a.jsx("div",{className:Ie("border-t border-border p-4",t),...e});qne.displayName="ExpandableChatFooter";const Gne=({className:t,icon:e,isOpen:r,toggleChat:n,...s})=>a.jsx(ye,{variant:"default",onClick:n,className:Ie("w-14 h-14 rounded-full shadow-lg hover:shadow-xl transition-shadow pointer-events-auto",t),...s,children:r?a.jsx(En,{className:"h-6 w-6"}):e||a.jsx(tbe,{className:"h-6 w-6"})});Gne.displayName="ExpandableChatToggle";function lTe(t={}){const{offset:e=20,smooth:r=!1,content:n}=t,s=S.useRef(null),i=S.useRef(0),o=S.useRef(!1),[l,c]=S.useState({isAtBottom:!0,autoScrollEnabled:!0}),u=S.useCallback(p=>{const{scrollTop:g,scrollHeight:m,clientHeight:x}=p;return Math.abs(m-g-x)<=e},[e]),d=S.useCallback(p=>{if(!s.current)return;const g=s.current.scrollHeight-s.current.clientHeight;p?s.current.scrollTop=g:s.current.scrollTo({top:g,behavior:r?"smooth":"auto"}),c({isAtBottom:!0,autoScrollEnabled:!0}),o.current=!1},[r]),h=S.useCallback(()=>{if(!s.current)return;const p=u(s.current);c(g=>({isAtBottom:p,autoScrollEnabled:p?!0:g.autoScrollEnabled}))},[u]);S.useEffect(()=>{const p=s.current;if(p)return p.addEventListener("scroll",h,{passive:!0}),()=>p.removeEventListener("scroll",h)},[h]),S.useEffect(()=>{const p=s.current;if(!p)return;const g=p.scrollHeight;g!==i.current&&(l.autoScrollEnabled&&requestAnimationFrame(()=>{d(i.current===0)}),i.current=g)},[n,l.autoScrollEnabled,d]),S.useEffect(()=>{const p=s.current;if(!p)return;const g=new ResizeObserver(()=>{l.autoScrollEnabled&&d(!0)});return g.observe(p),()=>g.disconnect()},[l.autoScrollEnabled,d]);const f=S.useCallback(()=>{(s.current?u(s.current):!1)||(o.current=!0,c(g=>({...g,autoScrollEnabled:!1})))},[u]);return{scrollRef:s,isAtBottom:l.isAtBottom,autoScrollEnabled:l.autoScrollEnabled,scrollToBottom:()=>d(!1),disableAutoScroll:f}}const Kne=S.forwardRef(({className:t,children:e,smooth:r=!1,...n},s)=>{const{scrollRef:i,isAtBottom:o,autoScrollEnabled:l,scrollToBottom:c,disableAutoScroll:u}=lTe({smooth:r,content:e});return a.jsxs("div",{className:Ie("relative w-full h-full",t),...n,children:[a.jsx("div",{className:"h-full overflow-y-auto p-4",ref:i,onWheel:u,onTouchMove:u,children:a.jsx("div",{className:"flex flex-col gap-4",children:e})}),!o&&a.jsx(ye,{onClick:()=>{c()},size:"icon",variant:"outline",className:"absolute bottom-2 left-1/2 transform -translate-x-1/2 inline-flex rounded-full shadow-md","aria-label":"Scroll to bottom",children:a.jsx(kve,{className:"h-4 w-4"})})]})});Kne.displayName="ChatMessageList";function cTe(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const uTe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dTe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hTe={};function MH(t,e){return(hTe.jsx?dTe:uTe).test(t)}const fTe=/[ \t\n\f\r]/g;function pTe(t){return typeof t=="object"?t.type==="text"?DH(t.value):!1:DH(t)}function DH(t){return t.replace(fTe,"")===""}class Qj{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}Qj.prototype.normal={};Qj.prototype.property={};Qj.prototype.space=void 0;function Yne(t,e){const r={},n={};for(const s of t)Object.assign(r,s.property),Object.assign(n,s.normal);return new Qj(r,n,e)}function i4(t){return t.toLowerCase()}class ea{constructor(e,r){this.attribute=r,this.property=e}}ea.prototype.attribute="";ea.prototype.booleanish=!1;ea.prototype.boolean=!1;ea.prototype.commaOrSpaceSeparated=!1;ea.prototype.commaSeparated=!1;ea.prototype.defined=!1;ea.prototype.mustUseProperty=!1;ea.prototype.number=!1;ea.prototype.overloadedBoolean=!1;ea.prototype.property="";ea.prototype.spaceSeparated=!1;ea.prototype.space=void 0;let mTe=0;const Mt=hg(),In=hg(),a4=hg(),We=hg(),Cr=hg(),My=hg(),sa=hg();function hg(){return 2**++mTe}const o4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Mt,booleanish:In,commaOrSpaceSeparated:sa,commaSeparated:My,number:We,overloadedBoolean:a4,spaceSeparated:Cr},Symbol.toStringTag,{value:"Module"})),fO=Object.keys(o4);class B6 extends ea{constructor(e,r,n,s){let i=-1;if(super(e,r),LH(this,"space",s),typeof n=="number")for(;++i<fO.length;){const o=fO[i];LH(this,fO[i],(n&o4[o])===o4[o])}}}B6.prototype.defined=!0;function LH(t,e,r){r&&(t[e]=r)}function yb(t){const e={},r={};for(const[n,s]of Object.entries(t.properties)){const i=new B6(n,t.transform(t.attributes||{},n),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(i.mustUseProperty=!0),e[n]=i,r[i4(n)]=n,r[i4(i.attribute)]=n}return new Qj(e,r,t.space)}const Xne=yb({properties:{ariaActiveDescendant:null,ariaAtomic:In,ariaAutoComplete:null,ariaBusy:In,ariaChecked:In,ariaColCount:We,ariaColIndex:We,ariaColSpan:We,ariaControls:Cr,ariaCurrent:null,ariaDescribedBy:Cr,ariaDetails:null,ariaDisabled:In,ariaDropEffect:Cr,ariaErrorMessage:null,ariaExpanded:In,ariaFlowTo:Cr,ariaGrabbed:In,ariaHasPopup:null,ariaHidden:In,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Cr,ariaLevel:We,ariaLive:null,ariaModal:In,ariaMultiLine:In,ariaMultiSelectable:In,ariaOrientation:null,ariaOwns:Cr,ariaPlaceholder:null,ariaPosInSet:We,ariaPressed:In,ariaReadOnly:In,ariaRelevant:null,ariaRequired:In,ariaRoleDescription:Cr,ariaRowCount:We,ariaRowIndex:We,ariaRowSpan:We,ariaSelected:In,ariaSetSize:We,ariaSort:null,ariaValueMax:We,ariaValueMin:We,ariaValueNow:We,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Qne(t,e){return e in t?t[e]:e}function Zne(t,e){return Qne(t,e.toLowerCase())}const gTe=yb({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:My,acceptCharset:Cr,accessKey:Cr,action:null,allow:null,allowFullScreen:Mt,allowPaymentRequest:Mt,allowUserMedia:Mt,alt:null,as:null,async:Mt,autoCapitalize:null,autoComplete:Cr,autoFocus:Mt,autoPlay:Mt,blocking:Cr,capture:null,charSet:null,checked:Mt,cite:null,className:Cr,cols:We,colSpan:null,content:null,contentEditable:In,controls:Mt,controlsList:Cr,coords:We|My,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Mt,defer:Mt,dir:null,dirName:null,disabled:Mt,download:a4,draggable:In,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Mt,formTarget:null,headers:Cr,height:We,hidden:a4,high:We,href:null,hrefLang:null,htmlFor:Cr,httpEquiv:Cr,id:null,imageSizes:null,imageSrcSet:null,inert:Mt,inputMode:null,integrity:null,is:null,isMap:Mt,itemId:null,itemProp:Cr,itemRef:Cr,itemScope:Mt,itemType:Cr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Mt,low:We,manifest:null,max:null,maxLength:We,media:null,method:null,min:null,minLength:We,multiple:Mt,muted:Mt,name:null,nonce:null,noModule:Mt,noValidate:Mt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Mt,optimum:We,pattern:null,ping:Cr,placeholder:null,playsInline:Mt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Mt,referrerPolicy:null,rel:Cr,required:Mt,reversed:Mt,rows:We,rowSpan:We,sandbox:Cr,scope:null,scoped:Mt,seamless:Mt,selected:Mt,shadowRootClonable:Mt,shadowRootDelegatesFocus:Mt,shadowRootMode:null,shape:null,size:We,sizes:null,slot:null,span:We,spellCheck:In,src:null,srcDoc:null,srcLang:null,srcSet:null,start:We,step:null,style:null,tabIndex:We,target:null,title:null,translate:null,type:null,typeMustMatch:Mt,useMap:null,value:In,width:We,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Cr,axis:null,background:null,bgColor:null,border:We,borderColor:null,bottomMargin:We,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Mt,declare:Mt,event:null,face:null,frame:null,frameBorder:null,hSpace:We,leftMargin:We,link:null,longDesc:null,lowSrc:null,marginHeight:We,marginWidth:We,noResize:Mt,noHref:Mt,noShade:Mt,noWrap:Mt,object:null,profile:null,prompt:null,rev:null,rightMargin:We,rules:null,scheme:null,scrolling:In,standby:null,summary:null,text:null,topMargin:We,valueType:null,version:null,vAlign:null,vLink:null,vSpace:We,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Mt,disableRemotePlayback:Mt,prefix:null,property:null,results:We,security:null,unselectable:null},space:"html",transform:Zne}),yTe=yb({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:sa,accentHeight:We,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:We,amplitude:We,arabicForm:null,ascent:We,attributeName:null,attributeType:null,azimuth:We,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:We,by:null,calcMode:null,capHeight:We,className:Cr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:We,diffuseConstant:We,direction:null,display:null,dur:null,divisor:We,dominantBaseline:null,download:Mt,dx:null,dy:null,edgeMode:null,editable:null,elevation:We,enableBackground:null,end:null,event:null,exponent:We,externalResourcesRequired:null,fill:null,fillOpacity:We,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:My,g2:My,glyphName:My,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:We,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:We,horizOriginX:We,horizOriginY:We,id:null,ideographic:We,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:We,k:We,k1:We,k2:We,k3:We,k4:We,kernelMatrix:sa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:We,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:We,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:We,overlineThickness:We,paintOrder:null,panose1:null,path:null,pathLength:We,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Cr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:We,pointsAtY:We,pointsAtZ:We,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sa,rev:sa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sa,requiredFeatures:sa,requiredFonts:sa,requiredFormats:sa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:We,specularExponent:We,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:We,strikethroughThickness:We,string:null,stroke:null,strokeDashArray:sa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:We,strokeOpacity:We,strokeWidth:null,style:null,surfaceScale:We,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sa,tabIndex:We,tableValues:null,target:null,targetX:We,targetY:We,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:We,underlineThickness:We,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:We,values:null,vAlphabetic:We,vMathematical:We,vectorEffect:null,vHanging:We,vIdeographic:We,version:null,vertAdvY:We,vertOriginX:We,vertOriginY:We,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:We,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Qne}),Jne=yb({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),ese=yb({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Zne}),tse=yb({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),xTe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},vTe=/[A-Z]/g,FH=/-[a-z]/g,bTe=/^data[-\w.:]+$/i;function wTe(t,e){const r=i4(e);let n=e,s=ea;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&bTe.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(FH,jTe);n="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!FH.test(i)){let o=i.replace(vTe,_Te);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}s=B6}return new s(n,e)}function _Te(t){return"-"+t.toLowerCase()}function jTe(t){return t.charAt(1).toUpperCase()}const STe=Yne([Xne,gTe,Jne,ese,tse],"html"),U6=Yne([Xne,yTe,Jne,ese,tse],"svg");function NTe(t){return t.join(" ").trim()}var z6={},$H=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,ATe=/\n/g,ETe=/^\s*/,CTe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,kTe=/^:\s*/,TTe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,PTe=/^[;\s]*/,OTe=/^\s+|\s+$/g,ITe=`
`,BH="/",UH="*",Zf="",RTe="comment",MTe="declaration",DTe=function(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var r=1,n=1;function s(g){var m=g.match(ATe);m&&(r+=m.length);var x=g.lastIndexOf(ITe);n=~x?g.length-x:n+g.length}function i(){var g={line:r,column:n};return function(m){return m.position=new o(g),u(),m}}function o(g){this.start=g,this.end={line:r,column:n},this.source=e.source}o.prototype.content=t;function l(g){var m=new Error(e.source+":"+r+":"+n+": "+g);if(m.reason=g,m.filename=e.source,m.line=r,m.column=n,m.source=t,!e.silent)throw m}function c(g){var m=g.exec(t);if(m){var x=m[0];return s(x),t=t.slice(x.length),m}}function u(){c(ETe)}function d(g){var m;for(g=g||[];m=h();)m!==!1&&g.push(m);return g}function h(){var g=i();if(!(BH!=t.charAt(0)||UH!=t.charAt(1))){for(var m=2;Zf!=t.charAt(m)&&(UH!=t.charAt(m)||BH!=t.charAt(m+1));)++m;if(m+=2,Zf===t.charAt(m-1))return l("End of comment missing");var x=t.slice(2,m-2);return n+=2,s(x),t=t.slice(m),n+=2,g({type:RTe,comment:x})}}function f(){var g=i(),m=c(CTe);if(m){if(h(),!c(kTe))return l("property missing ':'");var x=c(TTe),y=g({type:MTe,property:zH(m[0].replace($H,Zf)),value:x?zH(x[0].replace($H,Zf)):Zf});return c(PTe),y}}function p(){var g=[];d(g);for(var m;m=f();)m!==!1&&(g.push(m),d(g));return g}return u(),p()};function zH(t){return t?t.replace(OTe,Zf):Zf}var LTe=Wr&&Wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(z6,"__esModule",{value:!0});z6.default=$Te;var FTe=LTe(DTe);function $Te(t,e){var r=null;if(!t||typeof t!="string")return r;var n=(0,FTe.default)(t),s=typeof e=="function";return n.forEach(function(i){if(i.type==="declaration"){var o=i.property,l=i.value;s?e(o,l,i):l&&(r=r||{},r[o]=l)}}),r}var LT={};Object.defineProperty(LT,"__esModule",{value:!0});LT.camelCase=void 0;var BTe=/^--[a-zA-Z0-9_-]+$/,UTe=/-([a-z])/g,zTe=/^[^-]+$/,HTe=/^-(webkit|moz|ms|o|khtml)-/,WTe=/^-(ms)-/,VTe=function(t){return!t||zTe.test(t)||BTe.test(t)},qTe=function(t,e){return e.toUpperCase()},HH=function(t,e){return"".concat(e,"-")},GTe=function(t,e){return e===void 0&&(e={}),VTe(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(WTe,HH):t=t.replace(HTe,HH),t.replace(UTe,qTe))};LT.camelCase=GTe;var KTe=Wr&&Wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},YTe=KTe(z6),XTe=LT;function l4(t,e){var r={};return!t||typeof t!="string"||(0,YTe.default)(t,function(n,s){n&&s&&(r[(0,XTe.camelCase)(n,e)]=s)}),r}l4.default=l4;var QTe=l4;const ZTe=qt(QTe),rse=nse("end"),H6=nse("start");function nse(t){return e;function e(r){const n=r&&r.position&&r.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function JTe(t){const e=H6(t),r=rse(t);if(e&&r)return{start:e,end:r}}function pw(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?WH(t.position):"start"in t||"end"in t?WH(t):"line"in t||"column"in t?c4(t):""}function c4(t){return VH(t&&t.line)+":"+VH(t&&t.column)}function WH(t){return c4(t&&t.start)+"-"+c4(t&&t.end)}function VH(t){return t&&typeof t=="number"?t:1}class ii extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let s="",i={},o=!1;if(r&&("line"in r&&"column"in r?i={place:r}:"start"in r&&"end"in r?i={place:r}:"type"in r?i={ancestors:[r],place:r.position}:i={...r}),typeof e=="string"?s=e:!i.cause&&e&&(o=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n=="string"){const c=n.indexOf(":");c===-1?i.ruleId=n:(i.source=n.slice(0,c),i.ruleId=n.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=pw(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ii.prototype.file="";ii.prototype.name="";ii.prototype.reason="";ii.prototype.message="";ii.prototype.stack="";ii.prototype.column=void 0;ii.prototype.line=void 0;ii.prototype.ancestors=void 0;ii.prototype.cause=void 0;ii.prototype.fatal=void 0;ii.prototype.place=void 0;ii.prototype.ruleId=void 0;ii.prototype.source=void 0;const W6={}.hasOwnProperty,e2e=new Map,t2e=/[A-Z]/g,r2e=new Set(["table","tbody","thead","tfoot","tr"]),n2e=new Set(["td","th"]),sse="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function s2e(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=e.filePath||void 0;let n;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=h2e(r,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=d2e(r,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:n,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?U6:STe,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=ise(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function ise(t,e,r){if(e.type==="element")return i2e(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return a2e(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return l2e(t,e,r);if(e.type==="mdxjsEsm")return o2e(t,e);if(e.type==="root")return c2e(t,e,r);if(e.type==="text")return u2e(t,e)}function i2e(t,e,r){const n=t.schema;let s=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(s=U6,t.schema=s),t.ancestors.push(e);const i=ose(t,e.tagName,!1),o=f2e(t,e);let l=q6(t,e);return r2e.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!pTe(c):!0})),ase(t,o,i,e),V6(o,l),t.ancestors.pop(),t.schema=n,t.create(e,i,o,r)}function a2e(t,e){if(e.data&&e.data.estree&&t.evaluater){const n=e.data.estree.body[0];return n.type,t.evaluater.evaluateExpression(n.expression)}r1(t,e.position)}function o2e(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);r1(t,e.position)}function l2e(t,e,r){const n=t.schema;let s=n;e.name==="svg"&&n.space==="html"&&(s=U6,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:ose(t,e.name,!0),o=p2e(t,e),l=q6(t,e);return ase(t,o,i,e),V6(o,l),t.ancestors.pop(),t.schema=n,t.create(e,i,o,r)}function c2e(t,e,r){const n={};return V6(n,q6(t,e)),t.create(e,t.Fragment,n,r)}function u2e(t,e){return e.value}function ase(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function V6(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function d2e(t,e,r){return n;function n(s,i,o,l){const u=Array.isArray(o.children)?r:e;return l?u(i,o,l):u(i,o)}}function h2e(t,e){return r;function r(n,s,i,o){const l=Array.isArray(i.children),c=H6(n);return e(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function f2e(t,e){const r={};let n,s;for(s in e.properties)if(s!=="children"&&W6.call(e.properties,s)){const i=m2e(t,s,e.properties[s]);if(i){const[o,l]=i;t.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&n2e.has(e.tagName)?n=l:r[o]=l}}if(n){const i=r.style||(r.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function p2e(t,e){const r={};for(const n of e.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&t.evaluater){const i=n.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,t.evaluater.evaluateExpression(l.argument))}else r1(t,e.position);else{const s=n.name;let i;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&t.evaluater){const l=n.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else r1(t,e.position);else i=n.value===null?!0:n.value;r[s]=i}return r}function q6(t,e){const r=[];let n=-1;const s=t.passKeys?new Map:e2e;for(;++n<e.children.length;){const i=e.children[n];let o;if(t.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=s.get(c)||0;o=c+"-"+u,s.set(c,u+1)}}const l=ise(t,i,o);l!==void 0&&r.push(l)}return r}function m2e(t,e,r){const n=wTe(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?cTe(r):NTe(r)),n.property==="style"){let s=typeof r=="object"?r:g2e(t,String(r));return t.stylePropertyNameCase==="css"&&(s=y2e(s)),["style",s]}return[t.elementAttributeNameCase==="react"&&n.space?xTe[n.property]||n.property:n.attribute,r]}}function g2e(t,e){try{return ZTe(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,s=new ii("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=t.filePath||void 0,s.url=sse+"#cannot-parse-style-attribute",s}}function ose(t,e,r){let n;if(!r)n={type:"Literal",value:e};else if(e.includes(".")){const s=e.split(".");let i=-1,o;for(;++i<s.length;){const l=MH(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}n=o}else n=MH(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const s=n.value;return W6.call(t.components,s)?t.components[s]:s}if(t.evaluater)return t.evaluater.evaluateExpression(n);r1(t)}function r1(t,e){const r=new ii("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=sse+"#cannot-handle-mdx-estrees-without-createevaluater",r}function y2e(t){const e={};let r;for(r in t)W6.call(t,r)&&(e[x2e(r)]=t[r]);return e}function x2e(t){let e=t.replace(t2e,v2e);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function v2e(t){return"-"+t.toLowerCase()}const pO={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},b2e={};function w2e(t,e){const r=b2e,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return lse(t,n,s)}function lse(t,e,r){if(_2e(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return qH(t.children,e,r)}return Array.isArray(t)?qH(t,e,r):""}function qH(t,e,r){const n=[];let s=-1;for(;++s<t.length;)n[s]=lse(t[s],e,r);return n.join("")}function _2e(t){return!!(t&&typeof t=="object")}const GH=document.createElement("i");function G6(t){const e="&"+t+";";GH.innerHTML=e;const r=GH.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function wc(t,e,r,n){const s=t.length;let i=0,o;if(e<0?e=-e>s?0:s+e:e=e>s?s:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);i<n.length;)o=n.slice(i,i+1e4),o.unshift(e,0),t.splice(...o),i+=1e4,e+=1e4}function ao(t,e){return t.length>0?(wc(t,t.length,0,e),t):e}const KH={}.hasOwnProperty;function j2e(t){const e={};let r=-1;for(;++r<t.length;)S2e(e,t[r]);return e}function S2e(t,e){let r;for(r in e){const s=(KH.call(t,r)?t[r]:void 0)||(t[r]={}),i=e[r];let o;if(i)for(o in i){KH.call(s,o)||(s[o]=[]);const l=i[o];N2e(s[o],Array.isArray(l)?l:l?[l]:[])}}}function N2e(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);wc(t,0,0,n)}function cse(t,e){const r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Dy(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sc=xf(/[A-Za-z]/),Ta=xf(/[\dA-Za-z]/),A2e=xf(/[#-'*+\--9=?A-Z^-~]/);function u4(t){return t!==null&&(t<32||t===127)}const d4=xf(/\d/),E2e=xf(/[\dA-Fa-f]/),C2e=xf(/[!-/:-@[-`{-~]/);function jt(t){return t!==null&&t<-2}function Xi(t){return t!==null&&(t<0||t===32)}function lr(t){return t===-2||t===-1||t===32}const k2e=xf(new RegExp("\\p{P}|\\p{S}","u")),T2e=xf(/\s/);function xf(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function xb(t){const e=[];let r=-1,n=0,s=0;for(;++r<t.length;){const i=t.charCodeAt(r);let o="";if(i===37&&Ta(t.charCodeAt(r+1))&&Ta(t.charCodeAt(r+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=t.charCodeAt(r+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(e.push(t.slice(n,r),encodeURIComponent(o)),n=r+s+1,o=""),s&&(r+=s,s=0)}return e.join("")+t.slice(n)}function Ir(t,e,r,n){const s=n?n-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return lr(c)?(t.enter(r),l(c)):e(c)}function l(c){return lr(c)&&i++<s?(t.consume(c),l):(t.exit(r),e(c))}}const P2e={tokenize:O2e};function O2e(t){const e=t.attempt(this.parser.constructs.contentInitial,n,s);let r;return e;function n(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Ir(t,e,"linePrefix")}function s(l){return t.enter("paragraph"),i(l)}function i(l){const c=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=c),r=c,o(l)}function o(l){if(l===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(l);return}return jt(l)?(t.consume(l),t.exit("chunkText"),i):(t.consume(l),o)}}const I2e={tokenize:R2e},YH={tokenize:M2e};function R2e(t){const e=this,r=[];let n=0,s,i,o;return l;function l(b){if(n<r.length){const w=r[n];return e.containerState=w[1],t.attempt(w[0].continuation,c,u)(b)}return u(b)}function c(b){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,s&&v();const w=e.events.length;let j=w,N;for(;j--;)if(e.events[j][0]==="exit"&&e.events[j][1].type==="chunkFlow"){N=e.events[j][1].end;break}y(n);let C=w;for(;C<e.events.length;)e.events[C][1].end={...N},C++;return wc(e.events,j+1,0,e.events.slice(w)),e.events.length=C,u(b)}return l(b)}function u(b){if(n===r.length){if(!s)return f(b);if(s.currentConstruct&&s.currentConstruct.concrete)return g(b);e.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(YH,d,h)(b)}function d(b){return s&&v(),y(n),f(b)}function h(b){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,g(b)}function f(b){return e.containerState={},t.attempt(YH,p,g)(b)}function p(b){return n++,r.push([e.currentConstruct,e.containerState]),f(b)}function g(b){if(b===null){s&&v(),y(0),t.consume(b);return}return s=s||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),m(b)}function m(b){if(b===null){x(t.exit("chunkFlow"),!0),y(0),t.consume(b);return}return jt(b)?(t.consume(b),x(t.exit("chunkFlow")),n=0,e.interrupt=void 0,l):(t.consume(b),m)}function x(b,w){const j=e.sliceStream(b);if(w&&j.push(null),b.previous=i,i&&(i.next=b),i=b,s.defineSkip(b.start),s.write(j),e.parser.lazy[b.start.line]){let N=s.events.length;for(;N--;)if(s.events[N][1].start.offset<o&&(!s.events[N][1].end||s.events[N][1].end.offset>o))return;const C=e.events.length;let k=C,E,M;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){if(E){M=e.events[k][1].end;break}E=!0}for(y(n),N=C;N<e.events.length;)e.events[N][1].end={...M},N++;wc(e.events,k+1,0,e.events.slice(C)),e.events.length=N}}function y(b){let w=r.length;for(;w-- >b;){const j=r[w];e.containerState=j[1],j[0].exit.call(e,t)}r.length=b}function v(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function M2e(t,e,r){return Ir(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function XH(t){if(t===null||Xi(t)||T2e(t))return 1;if(k2e(t))return 2}function K6(t,e,r){const n=[];let s=-1;for(;++s<t.length;){const i=t[s].resolveAll;i&&!n.includes(i)&&(e=i(e,r),n.push(i))}return e}const h4={name:"attention",resolveAll:D2e,tokenize:L2e};function D2e(t,e){let r=-1,n,s,i,o,l,c,u,d;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;c=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const h={...t[n][1].end},f={...t[r][1].start};QH(h,-c),QH(f,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...t[n][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:f},i={type:c>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[r][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},t[n][1].end={...o.start},t[r][1].start={...l.end},u=[],t[n][1].end.offset-t[n][1].start.offset&&(u=ao(u,[["enter",t[n][1],e],["exit",t[n][1],e]])),u=ao(u,[["enter",s,e],["enter",o,e],["exit",o,e],["enter",i,e]]),u=ao(u,K6(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),u=ao(u,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[r][1].end.offset-t[r][1].start.offset?(d=2,u=ao(u,[["enter",t[r][1],e],["exit",t[r][1],e]])):d=0,wc(t,n-1,r-n+3,u),r=n+u.length-d-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function L2e(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,s=XH(n);let i;return o;function o(c){return i=c,t.enter("attentionSequence"),l(c)}function l(c){if(c===i)return t.consume(c),l;const u=t.exit("attentionSequence"),d=XH(c),h=!d||d===2&&s||r.includes(c),f=!s||s===2&&d||r.includes(n);return u._open=!!(i===42?h:h&&(s||!f)),u._close=!!(i===42?f:f&&(d||!h)),e(c)}}function QH(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const F2e={name:"autolink",tokenize:$2e};function $2e(t,e,r){let n=0;return s;function s(p){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(p){return sc(p)?(t.consume(p),o):p===64?r(p):u(p)}function o(p){return p===43||p===45||p===46||Ta(p)?(n=1,l(p)):u(p)}function l(p){return p===58?(t.consume(p),n=0,c):(p===43||p===45||p===46||Ta(p))&&n++<32?(t.consume(p),l):(n=0,u(p))}function c(p){return p===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):p===null||p===32||p===60||u4(p)?r(p):(t.consume(p),c)}function u(p){return p===64?(t.consume(p),d):A2e(p)?(t.consume(p),u):r(p)}function d(p){return Ta(p)?h(p):r(p)}function h(p){return p===46?(t.consume(p),n=0,d):p===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):f(p)}function f(p){if((p===45||Ta(p))&&n++<63){const g=p===45?f:h;return t.consume(p),g}return r(p)}}const FT={partial:!0,tokenize:B2e};function B2e(t,e,r){return n;function n(i){return lr(i)?Ir(t,s,"linePrefix")(i):s(i)}function s(i){return i===null||jt(i)?e(i):r(i)}}const use={continuation:{tokenize:z2e},exit:H2e,name:"blockQuote",tokenize:U2e};function U2e(t,e,r){const n=this;return s;function s(o){if(o===62){const l=n.containerState;return l.open||(t.enter("blockQuote",{_container:!0}),l.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),i}return r(o)}function i(o){return lr(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function z2e(t,e,r){const n=this;return s;function s(o){return lr(o)?Ir(t,i,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return t.attempt(use,e,r)(o)}}function H2e(t){t.exit("blockQuote")}const dse={name:"characterEscape",tokenize:W2e};function W2e(t,e,r){return n;function n(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),s}function s(i){return C2e(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(i)}}const hse={name:"characterReference",tokenize:V2e};function V2e(t,e,r){const n=this;let s=0,i,o;return l;function l(h){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),c}function c(h){return h===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(h),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),i=31,o=Ta,d(h))}function u(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,o=E2e,d):(t.enter("characterReferenceValue"),i=7,o=d4,d(h))}function d(h){if(h===59&&s){const f=t.exit("characterReferenceValue");return o===Ta&&!G6(n.sliceSerialize(f))?r(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(h)&&s++<i?(t.consume(h),d):r(h)}}const ZH={partial:!0,tokenize:G2e},JH={concrete:!0,name:"codeFenced",tokenize:q2e};function q2e(t,e,r){const n=this,s={partial:!0,tokenize:j};let i=0,o=0,l;return c;function c(N){return u(N)}function u(N){const C=n.events[n.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,l=N,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(N)}function d(N){return N===l?(o++,t.consume(N),d):o<3?r(N):(t.exit("codeFencedFenceSequence"),lr(N)?Ir(t,h,"whitespace")(N):h(N))}function h(N){return N===null||jt(N)?(t.exit("codeFencedFence"),n.interrupt?e(N):t.check(ZH,m,w)(N)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(N))}function f(N){return N===null||jt(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(N)):lr(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ir(t,p,"whitespace")(N)):N===96&&N===l?r(N):(t.consume(N),f)}function p(N){return N===null||jt(N)?h(N):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),g(N))}function g(N){return N===null||jt(N)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(N)):N===96&&N===l?r(N):(t.consume(N),g)}function m(N){return t.attempt(s,w,x)(N)}function x(N){return t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),y}function y(N){return i>0&&lr(N)?Ir(t,v,"linePrefix",i+1)(N):v(N)}function v(N){return N===null||jt(N)?t.check(ZH,m,w)(N):(t.enter("codeFlowValue"),b(N))}function b(N){return N===null||jt(N)?(t.exit("codeFlowValue"),v(N)):(t.consume(N),b)}function w(N){return t.exit("codeFenced"),e(N)}function j(N,C,k){let E=0;return M;function M($){return N.enter("lineEnding"),N.consume($),N.exit("lineEnding"),z}function z($){return N.enter("codeFencedFence"),lr($)?Ir(N,P,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):P($)}function P($){return $===l?(N.enter("codeFencedFenceSequence"),V($)):k($)}function V($){return $===l?(E++,N.consume($),V):E>=o?(N.exit("codeFencedFenceSequence"),lr($)?Ir(N,A,"whitespace")($):A($)):k($)}function A($){return $===null||jt($)?(N.exit("codeFencedFence"),C($)):k($)}}}function G2e(t,e,r){const n=this;return s;function s(o){return o===null?r(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i)}function i(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}const mO={name:"codeIndented",tokenize:Y2e},K2e={partial:!0,tokenize:X2e};function Y2e(t,e,r){const n=this;return s;function s(u){return t.enter("codeIndented"),Ir(t,i,"linePrefix",5)(u)}function i(u){const d=n.events[n.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):r(u)}function o(u){return u===null?c(u):jt(u)?t.attempt(K2e,o,c)(u):(t.enter("codeFlowValue"),l(u))}function l(u){return u===null||jt(u)?(t.exit("codeFlowValue"),o(u)):(t.consume(u),l)}function c(u){return t.exit("codeIndented"),e(u)}}function X2e(t,e,r){const n=this;return s;function s(o){return n.parser.lazy[n.now().line]?r(o):jt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):Ir(t,i,"linePrefix",5)(o)}function i(o){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(o):jt(o)?s(o):r(o)}}const Q2e={name:"codeText",previous:J2e,resolve:Z2e,tokenize:ePe};function Z2e(t){let e=t.length-4,r=3,n,s;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)s===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(s=n):(n===e||t[n][1].type==="lineEnding")&&(t[s][1].type="codeTextData",n!==s+2&&(t[s][1].end=t[n-1][1].end,t.splice(s+2,n-s-2),e-=n-s-2,n=s+2),s=void 0);return t}function J2e(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ePe(t,e,r){let n=0,s,i;return o;function o(h){return t.enter("codeText"),t.enter("codeTextSequence"),l(h)}function l(h){return h===96?(t.consume(h),n++,l):(t.exit("codeTextSequence"),c(h))}function c(h){return h===null?r(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),c):h===96?(i=t.enter("codeTextSequence"),s=0,d(h)):jt(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||jt(h)?(t.exit("codeTextData"),c(h)):(t.consume(h),u)}function d(h){return h===96?(t.consume(h),s++,d):s===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(i.type="codeTextData",u(h))}}class tPe{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){const s=r||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return n&&Qb(this.left,n),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Qb(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Qb(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const r=this.left.splice(e,Number.POSITIVE_INFINITY);Qb(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Qb(this.left,r.reverse())}}}function Qb(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function fse(t){const e={};let r=-1,n,s,i,o,l,c,u;const d=new tPe(t);for(;++r<d.length;){for(;r in e;)r=e[r];if(n=d.get(r),r&&n[1].type==="chunkFlow"&&d.get(r-1)[1].type==="listItemPrefix"&&(c=n[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,rPe(d,r)),r=e[r],u=!0);else if(n[1]._container){for(i=r,s=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(d.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(n[1].end={...d.get(s)[1].start},l=d.slice(s,r),l.unshift(n),d.splice(s,r-s+1,l))}}return wc(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function rPe(t,e){const r=t.get(e)[1],n=t.get(e)[2];let s=e-1;const i=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let d,h,f=-1,p=r,g=0,m=0;const x=[m];for(;p;){for(;t.get(++s)[1]!==p;);i.push(s),p._tokenizer||(d=n.sliceStream(p),p.next||d.push(null),h&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=r;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(m=f+1,x.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):x.pop(),f=x.length;f--;){const y=l.slice(x[f],x[f+1]),v=i.pop();c.push([v,v+y.length-1]),t.splice(v,2,y)}for(c.reverse(),f=-1;++f<c.length;)u[g+c[f][0]]=g+c[f][1],g+=c[f][1]-c[f][0]-1;return u}const nPe={resolve:iPe,tokenize:aPe},sPe={partial:!0,tokenize:oPe};function iPe(t){return fse(t),t}function aPe(t,e){let r;return n;function n(l){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):jt(l)?t.check(sPe,o,i)(l):(t.consume(l),s)}function i(l){return t.exit("chunkContent"),t.exit("content"),e(l)}function o(l){return t.consume(l),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function oPe(t,e,r){const n=this;return s;function s(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Ir(t,i,"linePrefix")}function i(o){if(o===null||jt(o))return r(o);const l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(o):t.interrupt(n.parser.constructs.flow,r,e)(o)}}function pse(t,e,r,n,s,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(y){return y===60?(t.enter(n),t.enter(s),t.enter(i),t.consume(y),t.exit(i),f):y===null||y===32||y===41||u4(y)?r(y):(t.enter(n),t.enter(o),t.enter(l),t.enter("chunkString",{contentType:"string"}),m(y))}function f(y){return y===62?(t.enter(i),t.consume(y),t.exit(i),t.exit(s),t.exit(n),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(t.exit("chunkString"),t.exit(l),f(y)):y===null||y===60||jt(y)?r(y):(t.consume(y),y===92?g:p)}function g(y){return y===60||y===62||y===92?(t.consume(y),p):p(y)}function m(y){return!d&&(y===null||y===41||Xi(y))?(t.exit("chunkString"),t.exit(l),t.exit(o),t.exit(n),e(y)):d<u&&y===40?(t.consume(y),d++,m):y===41?(t.consume(y),d--,m):y===null||y===32||y===40||u4(y)?r(y):(t.consume(y),y===92?x:m)}function x(y){return y===40||y===41||y===92?(t.consume(y),m):m(y)}}function mse(t,e,r,n,s,i){const o=this;let l=0,c;return u;function u(p){return t.enter(n),t.enter(s),t.consume(p),t.exit(s),t.enter(i),d}function d(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(t.exit(i),t.enter(s),t.consume(p),t.exit(s),t.exit(n),e):jt(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||jt(p)||l++>999?(t.exit("chunkString"),d(p)):(t.consume(p),c||(c=!lr(p)),p===92?f:h)}function f(p){return p===91||p===92||p===93?(t.consume(p),l++,h):h(p)}}function gse(t,e,r,n,s,i){let o;return l;function l(f){return f===34||f===39||f===40?(t.enter(n),t.enter(s),t.consume(f),t.exit(s),o=f===40?41:f,c):r(f)}function c(f){return f===o?(t.enter(s),t.consume(f),t.exit(s),t.exit(n),e):(t.enter(i),u(f))}function u(f){return f===o?(t.exit(i),c(o)):f===null?r(f):jt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),Ir(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||jt(f)?(t.exit("chunkString"),u(f)):(t.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(t.consume(f),d):d(f)}}function mw(t,e){let r;return n;function n(s){return jt(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r=!0,n):lr(s)?Ir(t,n,r?"linePrefix":"lineSuffix")(s):e(s)}}const lPe={name:"definition",tokenize:uPe},cPe={partial:!0,tokenize:dPe};function uPe(t,e,r){const n=this;let s;return i;function i(p){return t.enter("definition"),o(p)}function o(p){return mse.call(n,t,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=Dy(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),c):r(p)}function c(p){return Xi(p)?mw(t,u)(p):u(p)}function u(p){return pse(t,d,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return t.attempt(cPe,h,h)(p)}function h(p){return lr(p)?Ir(t,f,"whitespace")(p):f(p)}function f(p){return p===null||jt(p)?(t.exit("definition"),n.parser.defined.push(s),e(p)):r(p)}}function dPe(t,e,r){return n;function n(l){return Xi(l)?mw(t,s)(l):r(l)}function s(l){return gse(t,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return lr(l)?Ir(t,o,"whitespace")(l):o(l)}function o(l){return l===null||jt(l)?e(l):r(l)}}const hPe={name:"hardBreakEscape",tokenize:fPe};function fPe(t,e,r){return n;function n(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return jt(i)?(t.exit("hardBreakEscape"),e(i)):r(i)}}const pPe={name:"headingAtx",resolve:mPe,tokenize:gPe};function mPe(t,e){let r=t.length-2,n=3,s,i;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(s={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},i={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},wc(t,n,r-n+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function gPe(t,e,r){let n=0;return s;function s(d){return t.enter("atxHeading"),i(d)}function i(d){return t.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&n++<6?(t.consume(d),o):d===null||Xi(d)?(t.exit("atxHeadingSequence"),l(d)):r(d)}function l(d){return d===35?(t.enter("atxHeadingSequence"),c(d)):d===null||jt(d)?(t.exit("atxHeading"),e(d)):lr(d)?Ir(t,l,"whitespace")(d):(t.enter("atxHeadingText"),u(d))}function c(d){return d===35?(t.consume(d),c):(t.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Xi(d)?(t.exit("atxHeadingText"),l(d)):(t.consume(d),u)}}const yPe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],e9=["pre","script","style","textarea"],xPe={concrete:!0,name:"htmlFlow",resolveTo:wPe,tokenize:_Pe},vPe={partial:!0,tokenize:SPe},bPe={partial:!0,tokenize:jPe};function wPe(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function _Pe(t,e,r){const n=this;let s,i,o,l,c;return u;function u(W){return d(W)}function d(W){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(W),h}function h(W){return W===33?(t.consume(W),f):W===47?(t.consume(W),i=!0,m):W===63?(t.consume(W),s=3,n.interrupt?e:B):sc(W)?(t.consume(W),o=String.fromCharCode(W),x):r(W)}function f(W){return W===45?(t.consume(W),s=2,p):W===91?(t.consume(W),s=5,l=0,g):sc(W)?(t.consume(W),s=4,n.interrupt?e:B):r(W)}function p(W){return W===45?(t.consume(W),n.interrupt?e:B):r(W)}function g(W){const X="CDATA[";return W===X.charCodeAt(l++)?(t.consume(W),l===X.length?n.interrupt?e:P:g):r(W)}function m(W){return sc(W)?(t.consume(W),o=String.fromCharCode(W),x):r(W)}function x(W){if(W===null||W===47||W===62||Xi(W)){const X=W===47,oe=o.toLowerCase();return!X&&!i&&e9.includes(oe)?(s=1,n.interrupt?e(W):P(W)):yPe.includes(o.toLowerCase())?(s=6,X?(t.consume(W),y):n.interrupt?e(W):P(W)):(s=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(W):i?v(W):b(W))}return W===45||Ta(W)?(t.consume(W),o+=String.fromCharCode(W),x):r(W)}function y(W){return W===62?(t.consume(W),n.interrupt?e:P):r(W)}function v(W){return lr(W)?(t.consume(W),v):M(W)}function b(W){return W===47?(t.consume(W),M):W===58||W===95||sc(W)?(t.consume(W),w):lr(W)?(t.consume(W),b):M(W)}function w(W){return W===45||W===46||W===58||W===95||Ta(W)?(t.consume(W),w):j(W)}function j(W){return W===61?(t.consume(W),N):lr(W)?(t.consume(W),j):b(W)}function N(W){return W===null||W===60||W===61||W===62||W===96?r(W):W===34||W===39?(t.consume(W),c=W,C):lr(W)?(t.consume(W),N):k(W)}function C(W){return W===c?(t.consume(W),c=null,E):W===null||jt(W)?r(W):(t.consume(W),C)}function k(W){return W===null||W===34||W===39||W===47||W===60||W===61||W===62||W===96||Xi(W)?j(W):(t.consume(W),k)}function E(W){return W===47||W===62||lr(W)?b(W):r(W)}function M(W){return W===62?(t.consume(W),z):r(W)}function z(W){return W===null||jt(W)?P(W):lr(W)?(t.consume(W),z):r(W)}function P(W){return W===45&&s===2?(t.consume(W),K):W===60&&s===1?(t.consume(W),G):W===62&&s===4?(t.consume(W),L):W===63&&s===3?(t.consume(W),B):W===93&&s===5?(t.consume(W),H):jt(W)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(vPe,F,V)(W)):W===null||jt(W)?(t.exit("htmlFlowData"),V(W)):(t.consume(W),P)}function V(W){return t.check(bPe,A,F)(W)}function A(W){return t.enter("lineEnding"),t.consume(W),t.exit("lineEnding"),$}function $(W){return W===null||jt(W)?V(W):(t.enter("htmlFlowData"),P(W))}function K(W){return W===45?(t.consume(W),B):P(W)}function G(W){return W===47?(t.consume(W),o="",Y):P(W)}function Y(W){if(W===62){const X=o.toLowerCase();return e9.includes(X)?(t.consume(W),L):P(W)}return sc(W)&&o.length<8?(t.consume(W),o+=String.fromCharCode(W),Y):P(W)}function H(W){return W===93?(t.consume(W),B):P(W)}function B(W){return W===62?(t.consume(W),L):W===45&&s===2?(t.consume(W),B):P(W)}function L(W){return W===null||jt(W)?(t.exit("htmlFlowData"),F(W)):(t.consume(W),L)}function F(W){return t.exit("htmlFlow"),e(W)}}function jPe(t,e,r){const n=this;return s;function s(o){return jt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):r(o)}function i(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}function SPe(t,e,r){return n;function n(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(FT,e,r)}}const NPe={name:"htmlText",tokenize:APe};function APe(t,e,r){const n=this;let s,i,o;return l;function l(B){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(B),c}function c(B){return B===33?(t.consume(B),u):B===47?(t.consume(B),j):B===63?(t.consume(B),b):sc(B)?(t.consume(B),k):r(B)}function u(B){return B===45?(t.consume(B),d):B===91?(t.consume(B),i=0,g):sc(B)?(t.consume(B),v):r(B)}function d(B){return B===45?(t.consume(B),p):r(B)}function h(B){return B===null?r(B):B===45?(t.consume(B),f):jt(B)?(o=h,G(B)):(t.consume(B),h)}function f(B){return B===45?(t.consume(B),p):h(B)}function p(B){return B===62?K(B):B===45?f(B):h(B)}function g(B){const L="CDATA[";return B===L.charCodeAt(i++)?(t.consume(B),i===L.length?m:g):r(B)}function m(B){return B===null?r(B):B===93?(t.consume(B),x):jt(B)?(o=m,G(B)):(t.consume(B),m)}function x(B){return B===93?(t.consume(B),y):m(B)}function y(B){return B===62?K(B):B===93?(t.consume(B),y):m(B)}function v(B){return B===null||B===62?K(B):jt(B)?(o=v,G(B)):(t.consume(B),v)}function b(B){return B===null?r(B):B===63?(t.consume(B),w):jt(B)?(o=b,G(B)):(t.consume(B),b)}function w(B){return B===62?K(B):b(B)}function j(B){return sc(B)?(t.consume(B),N):r(B)}function N(B){return B===45||Ta(B)?(t.consume(B),N):C(B)}function C(B){return jt(B)?(o=C,G(B)):lr(B)?(t.consume(B),C):K(B)}function k(B){return B===45||Ta(B)?(t.consume(B),k):B===47||B===62||Xi(B)?E(B):r(B)}function E(B){return B===47?(t.consume(B),K):B===58||B===95||sc(B)?(t.consume(B),M):jt(B)?(o=E,G(B)):lr(B)?(t.consume(B),E):K(B)}function M(B){return B===45||B===46||B===58||B===95||Ta(B)?(t.consume(B),M):z(B)}function z(B){return B===61?(t.consume(B),P):jt(B)?(o=z,G(B)):lr(B)?(t.consume(B),z):E(B)}function P(B){return B===null||B===60||B===61||B===62||B===96?r(B):B===34||B===39?(t.consume(B),s=B,V):jt(B)?(o=P,G(B)):lr(B)?(t.consume(B),P):(t.consume(B),A)}function V(B){return B===s?(t.consume(B),s=void 0,$):B===null?r(B):jt(B)?(o=V,G(B)):(t.consume(B),V)}function A(B){return B===null||B===34||B===39||B===60||B===61||B===96?r(B):B===47||B===62||Xi(B)?E(B):(t.consume(B),A)}function $(B){return B===47||B===62||Xi(B)?E(B):r(B)}function K(B){return B===62?(t.consume(B),t.exit("htmlTextData"),t.exit("htmlText"),e):r(B)}function G(B){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(B),t.exit("lineEnding"),Y}function Y(B){return lr(B)?Ir(t,H,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):H(B)}function H(B){return t.enter("htmlTextData"),o(B)}}const Y6={name:"labelEnd",resolveAll:TPe,resolveTo:PPe,tokenize:OPe},EPe={tokenize:IPe},CPe={tokenize:RPe},kPe={tokenize:MPe};function TPe(t){let e=-1;const r=[];for(;++e<t.length;){const n=t[e][1];if(r.push(t[e]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const s=n.type==="labelImage"?4:2;n.type="data",e+=s}}return t.length!==r.length&&wc(t,0,t.length,r),t}function PPe(t,e){let r=t.length,n=0,s,i,o,l;for(;r--;)if(s=t[r][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;t[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(t[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=r,s.type!=="labelLink")){n=2;break}}else s.type==="labelEnd"&&(o=r);const c={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},u={type:"label",start:{...t[i][1].start},end:{...t[o][1].end}},d={type:"labelText",start:{...t[i+n+2][1].end},end:{...t[o-2][1].start}};return l=[["enter",c,e],["enter",u,e]],l=ao(l,t.slice(i+1,i+n+3)),l=ao(l,[["enter",d,e]]),l=ao(l,K6(e.parser.constructs.insideSpan.null,t.slice(i+n+4,o-3),e)),l=ao(l,[["exit",d,e],t[o-2],t[o-1],["exit",u,e]]),l=ao(l,t.slice(o+1)),l=ao(l,[["exit",c,e]]),wc(t,i,t.length,l),t}function OPe(t,e,r){const n=this;let s=n.events.length,i,o;for(;s--;)if((n.events[s][1].type==="labelImage"||n.events[s][1].type==="labelLink")&&!n.events[s][1]._balanced){i=n.events[s][1];break}return l;function l(f){return i?i._inactive?h(f):(o=n.parser.defined.includes(Dy(n.sliceSerialize({start:i.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelEnd"),c):r(f)}function c(f){return f===40?t.attempt(EPe,d,o?d:h)(f):f===91?t.attempt(CPe,d,o?u:h)(f):o?d(f):h(f)}function u(f){return t.attempt(kPe,d,h)(f)}function d(f){return e(f)}function h(f){return i._balanced=!0,r(f)}}function IPe(t,e,r){return n;function n(h){return t.enter("resource"),t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),s}function s(h){return Xi(h)?mw(t,i)(h):i(h)}function i(h){return h===41?d(h):pse(t,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Xi(h)?mw(t,c)(h):d(h)}function l(h){return r(h)}function c(h){return h===34||h===39||h===40?gse(t,u,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Xi(h)?mw(t,d)(h):d(h)}function d(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),e):r(h)}}function RPe(t,e,r){const n=this;return s;function s(l){return mse.call(n,t,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return n.parser.defined.includes(Dy(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(l):r(l)}function o(l){return r(l)}}function MPe(t,e,r){return n;function n(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),s}function s(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):r(i)}}const DPe={name:"labelStartImage",resolveAll:Y6.resolveAll,tokenize:LPe};function LPe(t,e,r){const n=this;return s;function s(l){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(l),t.exit("labelImageMarker"),i}function i(l){return l===91?(t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(l):e(l)}}const FPe={name:"labelStartLink",resolveAll:Y6.resolveAll,tokenize:$Pe};function $Pe(t,e,r){const n=this;return s;function s(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):e(o)}}const gO={name:"lineEnding",tokenize:BPe};function BPe(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Ir(t,e,"linePrefix")}}const SA={name:"thematicBreak",tokenize:UPe};function UPe(t,e,r){let n=0,s;return i;function i(u){return t.enter("thematicBreak"),o(u)}function o(u){return s=u,l(u)}function l(u){return u===s?(t.enter("thematicBreakSequence"),c(u)):n>=3&&(u===null||jt(u))?(t.exit("thematicBreak"),e(u)):r(u)}function c(u){return u===s?(t.consume(u),n++,c):(t.exit("thematicBreakSequence"),lr(u)?Ir(t,l,"whitespace")(u):l(u))}}const ki={continuation:{tokenize:VPe},exit:GPe,name:"list",tokenize:WPe},zPe={partial:!0,tokenize:KPe},HPe={partial:!0,tokenize:qPe};function WPe(t,e,r){const n=this,s=n.events[n.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const g=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:d4(p)){if(n.containerState.type||(n.containerState.type=g,t.enter(g,{_container:!0})),g==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(SA,r,u)(p):u(p);if(!n.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(p)}return r(p)}function c(p){return d4(p)&&++o<10?(t.consume(p),c):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),u(p)):r(p)}function u(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,t.check(FT,n.interrupt?r:d,t.attempt(zPe,f,h))}function d(p){return n.containerState.initialBlankLine=!0,i++,f(p)}function h(p){return lr(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),f):r(p)}function f(p){return n.containerState.size=i+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function VPe(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(FT,s,i);function s(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Ir(t,e,"listItemIndent",n.containerState.size+1)(l)}function i(l){return n.containerState.furtherBlankLines||!lr(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(HPe,e,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Ir(t,t.attempt(ki,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function qPe(t,e,r){const n=this;return Ir(t,s,"listItemIndent",n.containerState.size+1);function s(i){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?e(i):r(i)}}function GPe(t){t.exit(this.containerState.type)}function KPe(t,e,r){const n=this;return Ir(t,s,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=n.events[n.events.length-1];return!lr(i)&&o&&o[1].type==="listItemPrefixWhitespace"?e(i):r(i)}}const t9={name:"setextUnderline",resolveTo:YPe,tokenize:XPe};function YPe(t,e){let r=t.length,n,s,i;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(s=r)}else t[r][1].type==="content"&&t.splice(r,1),!i&&t[r][1].type==="definition"&&(i=r);const o={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",o,e]),t.splice(i+1,0,["exit",t[n][1],e]),t[n][1].end={...t[i][1].end}):t[n][1]=o,t.push(["exit",o,e]),t}function XPe(t,e,r){const n=this;let s;return i;function i(u){let d=n.events.length,h;for(;d--;)if(n.events[d][1].type!=="lineEnding"&&n.events[d][1].type!=="linePrefix"&&n.events[d][1].type!=="content"){h=n.events[d][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||h)?(t.enter("setextHeadingLine"),s=u,o(u)):r(u)}function o(u){return t.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(t.consume(u),l):(t.exit("setextHeadingLineSequence"),lr(u)?Ir(t,c,"lineSuffix")(u):c(u))}function c(u){return u===null||jt(u)?(t.exit("setextHeadingLine"),e(u)):r(u)}}const QPe={tokenize:ZPe};function ZPe(t){const e=this,r=t.attempt(FT,n,t.attempt(this.parser.constructs.flowInitial,s,Ir(t,t.attempt(this.parser.constructs.flow,s,t.attempt(nPe,s)),"linePrefix")));return r;function n(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,r}}const JPe={resolveAll:xse()},eOe=yse("string"),tOe=yse("text");function yse(t){return{resolveAll:xse(t==="text"?rOe:void 0),tokenize:e};function e(r){const n=this,s=this.parser.constructs[t],i=r.attempt(s,o,l);return o;function o(d){return u(d)?i(d):l(d)}function l(d){if(d===null){r.consume(d);return}return r.enter("data"),r.consume(d),c}function c(d){return u(d)?(r.exit("data"),i(d)):(r.consume(d),c)}function u(d){if(d===null)return!0;const h=s[d];let f=-1;if(h)for(;++f<h.length;){const p=h[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function xse(t){return e;function e(r,n){let s=-1,i;for(;++s<=r.length;)i===void 0?r[s]&&r[s][1].type==="data"&&(i=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==i+2&&(r[i][1].end=r[s-1][1].end,r.splice(i+2,s-i-2),s=i+2),i=void 0);return t?t(r,n):r}}function rOe(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const n=t[r-1][1],s=e.sliceStream(n);let i=s.length,o=-1,l=0,c;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(l=0),l){const u={type:r===t.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:n.start._bufferIndex+o,_index:n.start._index+i,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...u.start},n.start.offset===n.end.offset?Object.assign(n,u):(t.splice(r,0,["enter",u,e],["exit",u,e]),r+=2)}r++}return t}const nOe={42:ki,43:ki,45:ki,48:ki,49:ki,50:ki,51:ki,52:ki,53:ki,54:ki,55:ki,56:ki,57:ki,62:use},sOe={91:lPe},iOe={[-2]:mO,[-1]:mO,32:mO},aOe={35:pPe,42:SA,45:[t9,SA],60:xPe,61:t9,95:SA,96:JH,126:JH},oOe={38:hse,92:dse},lOe={[-5]:gO,[-4]:gO,[-3]:gO,33:DPe,38:hse,42:h4,60:[F2e,NPe],91:FPe,92:[hPe,dse],93:Y6,95:h4,96:Q2e},cOe={null:[h4,JPe]},uOe={null:[42,95]},dOe={null:[]},hOe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:uOe,contentInitial:sOe,disable:dOe,document:nOe,flow:aOe,flowInitial:iOe,insideSpan:cOe,string:oOe,text:lOe},Symbol.toStringTag,{value:"Module"}));function fOe(t,e,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},i=[];let o=[],l=[];const c={attempt:C(j),check:C(N),consume:v,enter:b,exit:w,interrupt:C(N,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:t,previous:null,sliceSerialize:f,sliceStream:p,write:h};let d=e.tokenize.call(u,c);return e.resolveAll&&i.push(e),u;function h(z){return o=ao(o,z),x(),o[o.length-1]!==null?[]:(k(e,0),u.events=K6(i,u.events,u),u.events)}function f(z,P){return mOe(p(z),P)}function p(z){return pOe(o,z)}function g(){const{_bufferIndex:z,_index:P,line:V,column:A,offset:$}=n;return{_bufferIndex:z,_index:P,line:V,column:A,offset:$}}function m(z){s[z.line]=z.column,M()}function x(){let z;for(;n._index<o.length;){const P=o[n._index];if(typeof P=="string")for(z=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===z&&n._bufferIndex<P.length;)y(P.charCodeAt(n._bufferIndex));else y(P)}}function y(z){d=d(z)}function v(z){jt(z)?(n.line++,n.column=1,n.offset+=z===-3?2:1,M()):z!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=z}function b(z,P){const V=P||{};return V.type=z,V.start=g(),u.events.push(["enter",V,u]),l.push(V),V}function w(z){const P=l.pop();return P.end=g(),u.events.push(["exit",P,u]),P}function j(z,P){k(z,P.from)}function N(z,P){P.restore()}function C(z,P){return V;function V(A,$,K){let G,Y,H,B;return Array.isArray(A)?F(A):"tokenize"in A?F([A]):L(A);function L(le){return U;function U(R){const ee=R!==null&&le[R],te=R!==null&&le.null,Z=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(te)?te:te?[te]:[]];return F(Z)(R)}}function F(le){return G=le,Y=0,le.length===0?K:W(le[Y])}function W(le){return U;function U(R){return B=E(),H=le,le.partial||(u.currentConstruct=le),le.name&&u.parser.constructs.disable.null.includes(le.name)?oe():le.tokenize.call(P?Object.assign(Object.create(u),P):u,c,X,oe)(R)}}function X(le){return z(H,B),$}function oe(le){return B.restore(),++Y<G.length?W(G[Y]):K}}}function k(z,P){z.resolveAll&&!i.includes(z)&&i.push(z),z.resolve&&wc(u.events,P,u.events.length-P,z.resolve(u.events.slice(P),u)),z.resolveTo&&(u.events=z.resolveTo(u.events,u))}function E(){const z=g(),P=u.previous,V=u.currentConstruct,A=u.events.length,$=Array.from(l);return{from:A,restore:K};function K(){n=z,u.previous=P,u.currentConstruct=V,u.events.length=A,l=$,M()}}function M(){n.line in s&&n.column<2&&(n.column=s[n.line],n.offset+=s[n.line]-1)}}function pOe(t,e){const r=e.start._index,n=e.start._bufferIndex,s=e.end._index,i=e.end._bufferIndex;let o;if(r===s)o=[t[r].slice(n,i)];else{if(o=t.slice(r,s),n>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(n):o.shift()}i>0&&o.push(t[s].slice(0,i))}return o}function mOe(t,e){let r=-1;const n=[];let s;for(;++r<t.length;){const i=t[r];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,n.push(o)}return n.join("")}function gOe(t){const n={constructs:j2e([hOe,...(t||{}).extensions||[]]),content:s(P2e),defined:[],document:s(I2e),flow:s(QPe),lazy:{},string:s(eOe),text:s(tOe)};return n;function s(i){return o;function o(l){return fOe(n,i,l)}}}function yOe(t){for(;!fse(t););return t}const r9=/[\0\t\n\r]/g;function xOe(){let t=1,e="",r=!0,n;return s;function s(i,o,l){const c=[];let u,d,h,f,p;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,e="",r&&(i.charCodeAt(0)===65279&&h++,r=void 0);h<i.length;){if(r9.lastIndex=h,u=r9.exec(i),f=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(f),!u){e=i.slice(h);break}if(p===10&&h===f&&n)c.push(-3),n=void 0;else switch(n&&(c.push(-5),n=void 0),h<f&&(c.push(i.slice(h,f)),t+=f-h),p){case 0:{c.push(65533),t++;break}case 9:{for(d=Math.ceil(t/4)*4,c.push(-2);t++<d;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:n=!0,t=1}h=f+1}return l&&(n&&c.push(-5),e&&c.push(e),c.push(null)),c}}const vOe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function bOe(t){return t.replace(vOe,wOe)}function wOe(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),i=s===120||s===88;return cse(r.slice(i?2:1),i?16:10)}return G6(r)||t}const vse={}.hasOwnProperty;function _Oe(t,e,r){return typeof e!="string"&&(r=e,e=void 0),jOe(r)(yOe(gOe(r).document().write(xOe()(t,e,!0))))}function jOe(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(D),autolinkProtocol:E,autolinkEmail:E,atxHeading:i(ie),blockQuote:i(te),characterEscape:E,characterReference:E,codeFenced:i(Z),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Z,o),codeText:i(J,o),codeTextData:E,data:E,codeFlowValue:E,definition:i(he),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(O),hardBreakEscape:i(q),hardBreakTrailing:i(q),htmlFlow:i(I,o),htmlFlowData:E,htmlText:i(I,o),htmlTextData:E,image:i(T),label:o,link:i(D),listItem:i(ue),listItemValue:f,listOrdered:i(ne,h),listUnordered:i(ne),paragraph:i(re),reference:W,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ie),strong:i(pe),thematicBreak:i(xe)},exit:{atxHeading:c(),atxHeadingSequence:j,autolink:c(),autolinkEmail:ee,autolinkProtocol:R,blockQuote:c(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:le,characterReference:U,codeFenced:c(x),codeFencedFence:m,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:M,codeIndented:c(y),codeText:c($),codeTextData:M,data:M,definition:c(),definitionDestinationString:w,definitionLabelString:v,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(P),hardBreakTrailing:c(P),htmlFlow:c(V),htmlFlowData:M,htmlText:c(A),htmlTextData:M,image:c(G),label:H,labelText:Y,lineEnding:z,link:c(K),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:X,resourceDestinationString:B,resourceTitleString:L,resource:F,setextHeading:c(k),setextHeadingLineSequence:C,setextHeadingText:N,strong:c(),thematicBreak:c()}};bse(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(ae){let de={type:"root",children:[]};const ge={stack:[de],tokenStack:[],config:e,enter:l,exit:u,buffer:o,resume:d,data:r},we=[];let je=-1;for(;++je<ae.length;)if(ae[je][1].type==="listOrdered"||ae[je][1].type==="listUnordered")if(ae[je][0]==="enter")we.push(je);else{const Se=we.pop();je=s(ae,Se,je)}for(je=-1;++je<ae.length;){const Se=e[ae[je][0]];vse.call(Se,ae[je][1].type)&&Se[ae[je][1].type].call(Object.assign({sliceSerialize:ae[je][2].sliceSerialize},ge),ae[je][1])}if(ge.tokenStack.length>0){const Se=ge.tokenStack[ge.tokenStack.length-1];(Se[1]||n9).call(ge,void 0,Se[0])}for(de.position={start:vd(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:vd(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je<e.transforms.length;)de=e.transforms[je](de)||de;return de}function s(ae,de,ge){let we=de-1,je=-1,Se=!1,Ue,Ae,fe,Ee;for(;++we<=ge;){const Ce=ae[we];switch(Ce[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ce[0]==="enter"?je++:je--,Ee=void 0;break}case"lineEndingBlank":{Ce[0]==="enter"&&(Ue&&!Ee&&!je&&!fe&&(fe=we),Ee=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ee=void 0}if(!je&&Ce[0]==="enter"&&Ce[1].type==="listItemPrefix"||je===-1&&Ce[0]==="exit"&&(Ce[1].type==="listUnordered"||Ce[1].type==="listOrdered")){if(Ue){let Ge=we;for(Ae=void 0;Ge--;){const ht=ae[Ge];if(ht[1].type==="lineEnding"||ht[1].type==="lineEndingBlank"){if(ht[0]==="exit")continue;Ae&&(ae[Ae][1].type="lineEndingBlank",Se=!0),ht[1].type="lineEnding",Ae=Ge}else if(!(ht[1].type==="linePrefix"||ht[1].type==="blockQuotePrefix"||ht[1].type==="blockQuotePrefixWhitespace"||ht[1].type==="blockQuoteMarker"||ht[1].type==="listItemIndent"))break}fe&&(!Ae||fe<Ae)&&(Ue._spread=!0),Ue.end=Object.assign({},Ae?ae[Ae][1].start:Ce[1].end),ae.splice(Ae||we,0,["exit",Ue,Ce[2]]),we++,ge++}if(Ce[1].type==="listItemPrefix"){const Ge={type:"listItem",_spread:!1,start:Object.assign({},Ce[1].start),end:void 0};Ue=Ge,ae.splice(we,0,["enter",Ge,Ce[2]]),we++,ge++,fe=void 0,Ee=!0}}}return ae[de][1]._spread=Se,ge}function i(ae,de){return ge;function ge(we){l.call(this,ae(we),we),de&&de.call(this,we)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(ae,de,ge){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([de,ge||void 0]),ae.position={start:vd(de.start),end:void 0}}function c(ae){return de;function de(ge){ae&&ae.call(this,ge),u.call(this,ge)}}function u(ae,de){const ge=this.stack.pop(),we=this.tokenStack.pop();if(we)we[0].type!==ae.type&&(de?de.call(this,ae,we[0]):(we[1]||n9).call(this,ae,we[0]));else throw new Error("Cannot close `"+ae.type+"` ("+pw({start:ae.start,end:ae.end})+"): it’s not open");ge.position.end=vd(ae.end)}function d(){return w2e(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(ae){if(this.data.expectingFirstListItemValue){const de=this.stack[this.stack.length-2];de.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function p(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.lang=ae}function g(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.meta=ae}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae.replace(/(\r?\n|\r)$/g,"")}function v(ae){const de=this.resume(),ge=this.stack[this.stack.length-1];ge.label=de,ge.identifier=Dy(this.sliceSerialize(ae)).toLowerCase()}function b(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.title=ae}function w(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.url=ae}function j(ae){const de=this.stack[this.stack.length-1];if(!de.depth){const ge=this.sliceSerialize(ae).length;de.depth=ge}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function C(ae){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function E(ae){const ge=this.stack[this.stack.length-1].children;let we=ge[ge.length-1];(!we||we.type!=="text")&&(we=ve(),we.position={start:vd(ae.start),end:void 0},ge.push(we)),this.stack.push(we)}function M(ae){const de=this.stack.pop();de.value+=this.sliceSerialize(ae),de.position.end=vd(ae.end)}function z(ae){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ge=de.children[de.children.length-1];ge.position.end=vd(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(de.type)&&(E.call(this,ae),M.call(this,ae))}function P(){this.data.atHardBreak=!0}function V(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function A(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function $(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function K(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=de,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function G(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=de,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function Y(ae){const de=this.sliceSerialize(ae),ge=this.stack[this.stack.length-2];ge.label=bOe(de),ge.identifier=Dy(de).toLowerCase()}function H(){const ae=this.stack[this.stack.length-1],de=this.resume(),ge=this.stack[this.stack.length-1];if(this.data.inReference=!0,ge.type==="link"){const we=ae.children;ge.children=we}else ge.alt=de}function B(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.url=ae}function L(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.title=ae}function F(){this.data.inReference=void 0}function W(){this.data.referenceType="collapsed"}function X(ae){const de=this.resume(),ge=this.stack[this.stack.length-1];ge.label=de,ge.identifier=Dy(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function oe(ae){this.data.characterReferenceType=ae.type}function le(ae){const de=this.sliceSerialize(ae),ge=this.data.characterReferenceType;let we;ge?(we=cse(de,ge==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):we=G6(de);const je=this.stack[this.stack.length-1];je.value+=we}function U(ae){const de=this.stack.pop();de.position.end=vd(ae.end)}function R(ae){M.call(this,ae);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(ae)}function ee(ae){M.call(this,ae);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(ae)}function te(){return{type:"blockquote",children:[]}}function Z(){return{type:"code",lang:null,meta:null,value:""}}function J(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function O(){return{type:"emphasis",children:[]}}function ie(){return{type:"heading",depth:0,children:[]}}function q(){return{type:"break"}}function I(){return{type:"html",value:""}}function T(){return{type:"image",title:null,url:"",alt:null}}function D(){return{type:"link",title:null,url:"",children:[]}}function ne(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function ue(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function re(){return{type:"paragraph",children:[]}}function pe(){return{type:"strong",children:[]}}function ve(){return{type:"text",value:""}}function xe(){return{type:"thematicBreak"}}}function vd(t){return{line:t.line,column:t.column,offset:t.offset}}function bse(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?bse(t,n):SOe(t,n)}}function SOe(t,e){let r;for(r in e)if(vse.call(e,r))switch(r){case"canContainEols":{const n=e[r];n&&t[r].push(...n);break}case"transforms":{const n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{const n=e[r];n&&Object.assign(t[r],n);break}}}function n9(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+pw({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+pw({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+pw({start:e.start,end:e.end})+") is still open")}function NOe(t){const e=this;e.parser=r;function r(n){return _Oe(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function AOe(t,e){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function EOe(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
`}]}function COe(t,e){const r=e.value?e.value+`
`:"",n={};e.lang&&(n.className=["language-"+e.lang]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function kOe(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function TOe(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function POe(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),s=xb(n.toLowerCase()),i=t.footnoteOrder.indexOf(n);let o,l=t.footnoteCounts.get(n);l===void 0?(l=0,t.footnoteOrder.push(n),o=t.footnoteOrder.length):o=i+1,l+=1,t.footnoteCounts.set(n,l);const c={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,u),t.applyData(e,u)}function OOe(t,e){const r={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function IOe(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function wse(t,e){const r=e.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=n:s.push({type:"text",value:n}),s}function ROe(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return wse(t,e);const s={src:xb(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(s.title=n.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function MOe(t,e){const r={src:xb(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function DOe(t,e){const r={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(e,n),t.applyData(e,n)}function LOe(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return wse(t,e);const s={href:xb(n.url||"")};n.title!==null&&n.title!==void 0&&(s.title=n.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function FOe(t,e){const r={href:xb(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function $Oe(t,e,r){const n=t.all(e),s=r?BOe(r):_se(e),i={},o=[];if(typeof e.checked=="boolean"){const d=n[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},n.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const d=n[l];(s||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!s?o.push(...d.children):o.push(d)}const c=n[n.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
`});const u={type:"element",tagName:"li",properties:i,children:o};return t.patch(e,u),t.applyData(e,u)}function BOe(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const r=t.children;let n=-1;for(;!e&&++n<r.length;)e=_se(r[n])}return e}function _se(t){const e=t.spread;return e??t.children.length>1}function UOe(t,e){const r={},n=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(r.start=e.start);++s<n.length;){const o=n[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const i={type:"element",tagName:e.ordered?"ol":"ul",properties:r,children:t.wrap(n,!0)};return t.patch(e,i),t.applyData(e,i)}function zOe(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function HOe(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function WOe(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function VOe(t,e){const r=t.all(e),n=r.shift(),s=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(e.children[0],o),s.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},l=H6(e.children[1]),c=rse(e.children[e.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function qOe(t,e,r){const n=r?r.children:void 0,i=(n?n.indexOf(e):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:e.children.length;let c=-1;const u=[];for(;++c<l;){const h=e.children[c],f={},p=o?o[c]:void 0;p&&(f.align=p);let g={type:"element",tagName:i,properties:f,children:[]};h&&(g.children=t.all(h),t.patch(h,g),g=t.applyData(h,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:t.wrap(u,!0)};return t.patch(e,d),t.applyData(e,d)}function GOe(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const s9=9,i9=32;function KOe(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),s=0;const i=[];for(;n;)i.push(a9(e.slice(s,n.index),s>0,!0),n[0]),s=n.index+n[0].length,n=r.exec(e);return i.push(a9(e.slice(s),s>0,!1)),i.join("")}function a9(t,e,r){let n=0,s=t.length;if(e){let i=t.codePointAt(n);for(;i===s9||i===i9;)n++,i=t.codePointAt(n)}if(r){let i=t.codePointAt(s-1);for(;i===s9||i===i9;)s--,i=t.codePointAt(s-1)}return s>n?t.slice(n,s):""}function YOe(t,e){const r={type:"text",value:KOe(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function XOe(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const QOe={blockquote:AOe,break:EOe,code:COe,delete:kOe,emphasis:TOe,footnoteReference:POe,heading:OOe,html:IOe,imageReference:ROe,image:MOe,inlineCode:DOe,linkReference:LOe,link:FOe,listItem:$Oe,list:UOe,paragraph:zOe,root:HOe,strong:WOe,table:VOe,tableCell:GOe,tableRow:qOe,text:YOe,thematicBreak:XOe,toml:mN,yaml:mN,definition:mN,footnoteDefinition:mN};function mN(){}const jse=-1,$T=0,gw=1,rC=2,X6=3,Q6=4,Z6=5,J6=6,Sse=7,Nse=8,o9=typeof self=="object"?self:globalThis,ZOe=(t,e)=>{const r=(s,i)=>(t.set(i,s),s),n=s=>{if(t.has(s))return t.get(s);const[i,o]=e[s];switch(i){case $T:case jse:return r(o,s);case gw:{const l=r([],s);for(const c of o)l.push(n(c));return l}case rC:{const l=r({},s);for(const[c,u]of o)l[n(c)]=n(u);return l}case X6:return r(new Date(o),s);case Q6:{const{source:l,flags:c}=o;return r(new RegExp(l,c),s)}case Z6:{const l=r(new Map,s);for(const[c,u]of o)l.set(n(c),n(u));return l}case J6:{const l=r(new Set,s);for(const c of o)l.add(n(c));return l}case Sse:{const{name:l,message:c}=o;return r(new o9[l](c),s)}case Nse:return r(BigInt(o),s);case"BigInt":return r(Object(BigInt(o)),s);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new o9[i](o),s)};return n},l9=t=>ZOe(new Map,t)(0),Og="",{toString:JOe}={},{keys:eIe}=Object,Zb=t=>{const e=typeof t;if(e!=="object"||!t)return[$T,e];const r=JOe.call(t).slice(8,-1);switch(r){case"Array":return[gw,Og];case"Object":return[rC,Og];case"Date":return[X6,Og];case"RegExp":return[Q6,Og];case"Map":return[Z6,Og];case"Set":return[J6,Og];case"DataView":return[gw,r]}return r.includes("Array")?[gw,r]:r.includes("Error")?[Sse,r]:[rC,r]},gN=([t,e])=>t===$T&&(e==="function"||e==="symbol"),tIe=(t,e,r,n)=>{const s=(o,l)=>{const c=n.push(o)-1;return r.set(l,c),c},i=o=>{if(r.has(o))return r.get(o);let[l,c]=Zb(o);switch(l){case $T:{let d=o;switch(c){case"bigint":l=Nse,d=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([jse],o)}return s([l,d],o)}case gw:{if(c){let f=o;return c==="DataView"?f=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(f=new Uint8Array(o)),s([c,[...f]],o)}const d=[],h=s([l,d],o);for(const f of o)d.push(i(f));return h}case rC:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(e&&"toJSON"in o)return i(o.toJSON());const d=[],h=s([l,d],o);for(const f of eIe(o))(t||!gN(Zb(o[f])))&&d.push([i(f),i(o[f])]);return h}case X6:return s([l,o.toISOString()],o);case Q6:{const{source:d,flags:h}=o;return s([l,{source:d,flags:h}],o)}case Z6:{const d=[],h=s([l,d],o);for(const[f,p]of o)(t||!(gN(Zb(f))||gN(Zb(p))))&&d.push([i(f),i(p)]);return h}case J6:{const d=[],h=s([l,d],o);for(const f of o)(t||!gN(Zb(f)))&&d.push(i(f));return h}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return i},c9=(t,{json:e,lossy:r}={})=>{const n=[];return tIe(!(e||r),!!e,new Map,n)(t),n},nC=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?l9(c9(t,e)):structuredClone(t):(t,e)=>l9(c9(t,e));function rIe(t,e){const r=[{type:"text",value:"↩"}];return e>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),r}function nIe(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function sIe(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||rIe,n=t.options.footnoteBackLabel||nIe,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<t.footnoteOrder.length;){const u=t.footnoteById.get(t.footnoteOrder[c]);if(!u)continue;const d=t.all(u),h=String(u.identifier).toUpperCase(),f=xb(h.toLowerCase());let p=0;const g=[],m=t.footnoteCounts.get(h);for(;m!==void 0&&++p<=m;){g.length>0&&g.push({type:"text",value:" "});let v=typeof r=="string"?r:r(c,p);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(c,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+f},children:t.wrap(d,!0)};t.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...nC(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:`
`}]}}const Ase=function(t){if(t==null)return lIe;if(typeof t=="function")return BT(t);if(typeof t=="object")return Array.isArray(t)?iIe(t):aIe(t);if(typeof t=="string")return oIe(t);throw new Error("Expected function, string, or object as test")};function iIe(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=Ase(t[r]);return BT(n);function n(...s){let i=-1;for(;++i<e.length;)if(e[i].apply(this,s))return!0;return!1}}function aIe(t){const e=t;return BT(r);function r(n){const s=n;let i;for(i in t)if(s[i]!==e[i])return!1;return!0}}function oIe(t){return BT(e);function e(r){return r&&r.type===t}}function BT(t){return e;function e(r,n,s){return!!(cIe(r)&&t.call(this,r,typeof n=="number"?n:void 0,s||void 0))}}function lIe(){return!0}function cIe(t){return t!==null&&typeof t=="object"&&"type"in t}const Ese=[],uIe=!0,u9=!1,dIe="skip";function hIe(t,e,r,n){let s;typeof e=="function"&&typeof r!="function"?(n=r,r=e):s=e;const i=Ase(s),o=n?-1:1;l(t,void 0,[])();function l(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const p=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=Ese,g,m,x;if((!e||i(c,u,d[d.length-1]||void 0))&&(p=fIe(r(c,d)),p[0]===u9))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==dIe)for(m=(n?y.children.length:-1)+o,x=d.concat(y);m>-1&&m<y.children.length;){const v=y.children[m];if(g=l(v,m,x)(),g[0]===u9)return g;m=typeof g[1]=="number"?g[1]:m+o}}return p}}}function fIe(t){return Array.isArray(t)?t:typeof t=="number"?[uIe,t]:t==null?Ese:[t]}function Cse(t,e,r,n){let s,i,o;typeof e=="function"&&typeof r!="function"?(i=void 0,o=e,s=r):(i=e,o=r,s=n),hIe(t,i,l,s);function l(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return o(c,h,d)}}const f4={}.hasOwnProperty,pIe={};function mIe(t,e){const r=e||pIe,n=new Map,s=new Map,i=new Map,o={...QOe,...r.handlers},l={all:u,applyData:yIe,definitionById:n,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:r,patch:gIe,wrap:vIe};return Cse(t,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?n:s,f=String(d.identifier).toUpperCase();h.has(f)||h.set(f,d)}}),l;function c(d,h){const f=d.type,p=l.handlers[f];if(f4.call(l.handlers,f)&&p)return p(l,d,h);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in d){const{children:m,...x}=d,y=nC(x);return y.children=l.all(d),y}return nC(d)}return(l.options.unknownHandler||xIe)(l,d,h)}function u(d){const h=[];if("children"in d){const f=d.children;let p=-1;for(;++p<f.length;){const g=l.one(f[p],d);if(g){if(p&&f[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=d9(g.value)),!Array.isArray(g)&&g.type==="element")){const m=g.children[0];m&&m.type==="text"&&(m.value=d9(m.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function gIe(t,e){t.position&&(e.position=JTe(t))}function yIe(t,e){let r=e;if(t&&t.data){const n=t.data.hName,s=t.data.hChildren,i=t.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&i&&Object.assign(r.properties,nC(i)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function xIe(t,e){const r=e.data||{},n="value"in e&&!(f4.call(r,"hProperties")||f4.call(r,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function vIe(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
`});++n<t.length;)n&&r.push({type:"text",value:`
`}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
`}),r}function d9(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function h9(t,e){const r=mIe(t,e),n=r.one(t,void 0),s=sIe(r),i=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
`},s),i}function bIe(t,e){return t&&"run"in t?async function(r,n){const s=h9(r,{file:n,...e});await t.run(s,n)}:function(r,n){return h9(r,{file:n,...t||e})}}function f9(t){if(t)throw t}var NA=Object.prototype.hasOwnProperty,kse=Object.prototype.toString,p9=Object.defineProperty,m9=Object.getOwnPropertyDescriptor,g9=function(e){return typeof Array.isArray=="function"?Array.isArray(e):kse.call(e)==="[object Array]"},y9=function(e){if(!e||kse.call(e)!=="[object Object]")return!1;var r=NA.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&NA.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var s;for(s in e);return typeof s>"u"||NA.call(e,s)},x9=function(e,r){p9&&r.name==="__proto__"?p9(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},v9=function(e,r){if(r==="__proto__")if(NA.call(e,r)){if(m9)return m9(e,r).value}else return;return e[r]},wIe=function t(){var e,r,n,s,i,o,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(e=arguments[c],e!=null)for(r in e)n=v9(l,r),s=v9(e,r),l!==s&&(d&&s&&(y9(s)||(i=g9(s)))?(i?(i=!1,o=n&&g9(n)?n:[]):o=n&&y9(n)?n:{},x9(l,{name:r,newValue:t(d,o,s)})):typeof s<"u"&&x9(l,{name:r,newValue:s}));return l};const yO=qt(wIe);function p4(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function _Ie(){const t=[],e={run:r,use:n};return e;function r(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(c,...u){const d=t[++i];let h=-1;if(c){o(c);return}for(;++h<s.length;)(u[h]===null||u[h]===void 0)&&(u[h]=s[h]);s=u,d?jIe(d,l)(...u):o(null,...u)}}function n(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function jIe(t,e){let r;return n;function n(...o){const l=t.length>o.length;let c;l&&o.push(s);try{c=t.apply(this,o)}catch(u){const d=u;if(l&&r)throw d;return s(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){r||(r=!0,e(o,...l))}function i(o){s(null,o)}}const Tl={basename:SIe,dirname:NIe,extname:AIe,join:EIe,sep:"/"};function SIe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Zj(t);let r=0,n=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){r=s+1;break}}else n<0&&(i=!0,n=s+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let o=-1,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){r=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(n=s):(l=-1,n=o));return r===n?n=o:n<0&&(n=t.length),t.slice(r,n)}function NIe(t){if(Zj(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function AIe(t){Zj(t);let e=t.length,r=-1,n=0,s=-1,i=0,o;for(;e--;){const l=t.codePointAt(e);if(l===47){if(o){n=e+1;break}continue}r<0&&(o=!0,r=e+1),l===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||r<0||i===0||i===1&&s===r-1&&s===n+1?"":t.slice(s,r)}function EIe(...t){let e=-1,r;for(;++e<t.length;)Zj(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":CIe(r)}function CIe(t){Zj(t);const e=t.codePointAt(0)===47;let r=kIe(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function kIe(t,e){let r="",n=0,s=-1,i=0,o=-1,l,c;for(;++o<=t.length;){if(o<t.length)l=t.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(c=r.lastIndexOf("/"),c!==r.length-1){c<0?(r="",n=0):(r=r.slice(0,c),n=r.length-1-r.lastIndexOf("/")),s=o,i=0;continue}}else if(r.length>0){r="",n=0,s=o,i=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(s+1,o):r=t.slice(s+1,o),n=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return r}function Zj(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const TIe={cwd:PIe};function PIe(){return"/"}function m4(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function OIe(t){if(typeof t=="string")t=new URL(t);else if(!m4(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return IIe(t)}function IIe(t){if(t.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const e=t.pathname;let r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){const n=e.codePointAt(r+2);if(n===70||n===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const xO=["history","path","basename","stem","extname","dirname"];class Tse{constructor(e){let r;e?m4(e)?r={path:e}:typeof e=="string"||RIe(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":TIe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<xO.length;){const i=xO[n];i in r&&r[i]!==void 0&&r[i]!==null&&(this[i]=i==="history"?[...r[i]]:r[i])}let s;for(s in r)xO.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?Tl.basename(this.path):void 0}set basename(e){bO(e,"basename"),vO(e,"basename"),this.path=Tl.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Tl.dirname(this.path):void 0}set dirname(e){b9(this.basename,"dirname"),this.path=Tl.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Tl.extname(this.path):void 0}set extname(e){if(vO(e,"extname"),b9(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Tl.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){m4(e)&&(e=OIe(e)),bO(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Tl.basename(this.path,this.extname):void 0}set stem(e){bO(e,"stem"),vO(e,"stem"),this.path=Tl.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){const s=this.message(e,r,n);throw s.fatal=!0,s}info(e,r,n){const s=this.message(e,r,n);return s.fatal=void 0,s}message(e,r,n){const s=new ii(e,r,n);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function vO(t,e){if(t&&t.includes(Tl.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Tl.sep+"`")}function bO(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function b9(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function RIe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const MIe=function(t){const n=this.constructor.prototype,s=n[t],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,n),i},DIe={}.hasOwnProperty;class e$ extends MIe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=_Ie()}copy(){const e=new e$;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(yO(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(jO("data",this.frozen),this.namespace[e]=r,this):DIe.call(this.namespace,e)&&this.namespace[e]||void 0:e?(jO("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const s=r.call(e,...n);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const r=yN(e),n=this.parser||this.Parser;return wO("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),wO("process",this.parser||this.Parser),_O("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(i,o){const l=yN(e),c=n.parse(l);n.run(c,l,function(d,h,f){if(d||!h||!f)return u(d);const p=h,g=n.stringify(p,f);$Ie(g)?f.value=g:f.result=g,u(d,f)});function u(d,h){d||!h?o(d):i?i(h):r(void 0,h)}}}processSync(e){let r=!1,n;return this.freeze(),wO("processSync",this.parser||this.Parser),_O("processSync",this.compiler||this.Compiler),this.process(e,s),_9("processSync","process",r),n;function s(i,o){r=!0,f9(i),n=o}}run(e,r,n){w9(e),this.freeze();const s=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?i(void 0,n):new Promise(i);function i(o,l){const c=yN(r);s.run(e,c,u);function u(d,h,f){const p=h||e;d?l(d):o?o(p):n(void 0,p,f)}}}runSync(e,r){let n=!1,s;return this.run(e,r,i),_9("runSync","run",n),s;function i(o,l){f9(o),s=l,n=!0}}stringify(e,r){this.freeze();const n=yN(r),s=this.compiler||this.Compiler;return _O("stringify",s),w9(e),s(e,n)}use(e,...r){const n=this.attachers,s=this.namespace;if(jO("use",this.frozen),e!=null)if(typeof e=="function")c(e,r);else if(typeof e=="object")Array.isArray(e)?l(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(s.settings=yO(!0,s.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,f=-1;for(;++h<n.length;)if(n[h][0]===u){f=h;break}if(f===-1)n.push([u,...d]);else if(d.length>0){let[p,...g]=d;const m=n[f][1];p4(m)&&p4(p)&&(p=yO(!0,m,p)),n[f]=[u,p,...g]}}}}const LIe=new e$().freeze();function wO(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function _O(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function jO(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function w9(t){if(!p4(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function _9(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function yN(t){return FIe(t)?t:new Tse(t)}function FIe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function $Ie(t){return typeof t=="string"||BIe(t)}function BIe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const UIe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",j9=[],S9={allowDangerousHtml:!0},zIe=/^(https?|ircs?|mailto|xmpp)$/i,HIe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function fc(t){const e=WIe(t),r=VIe(t);return qIe(e.runSync(e.parse(r),r),t)}function WIe(t){const e=t.rehypePlugins||j9,r=t.remarkPlugins||j9,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...S9}:S9;return LIe().use(NOe).use(r).use(bIe,n).use(e)}function VIe(t){const e=t.children||"",r=new Tse;return typeof e=="string"&&(r.value=e),r}function qIe(t,e){const r=e.allowedElements,n=e.allowElement,s=e.components,i=e.disallowedElements,o=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||GIe;for(const d of HIe)Object.hasOwn(e,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+UIe+d.id,void 0);return Cse(t,u),s2e(t,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in pO)if(Object.hasOwn(pO,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],m=pO[p];(m===null||m.includes(d.tagName))&&(d.properties[p]=c(String(g||""),p,d))}}if(d.type==="element"){let p=r?!r.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&n&&typeof h=="number"&&(p=!n(d,h,f)),p&&f&&typeof h=="number")return l&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function GIe(t){const e=t.indexOf(":"),r=t.indexOf("?"),n=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||r!==-1&&e>r||n!==-1&&e>n||zIe.test(t.slice(0,e))?t:""}function N9(){const[t,e]=S.useState(()=>{try{const c=sessionStorage.getItem("platform_assistant_messages");return c?JSON.parse(c):[{id:1,content:"Hi! I'm your Academly assistant. Ask me anything about the platform or your thesis! 👋",sender:"ai"}]}catch{return[{id:1,content:"Hi! I'm your Academly assistant. Ask me anything about the platform or your thesis! 👋",sender:"ai"}]}}),[r,n]=S.useState(""),[s,i]=S.useState(!1);S.useEffect(()=>{try{sessionStorage.setItem("platform_assistant_messages",JSON.stringify(t))}catch{}},[t]);const o=async c=>{if(c.preventDefault(),!r.trim()||s)return;const u=r.trim(),d=[...t,{id:t.length+1,content:u,sender:"user"}];e(d),n(""),i(!0);try{const h=t.map(g=>({role:g.sender==="ai"?"assistant":"user",content:g.content})),{data:f,error:p}=await be.functions.invoke("platform-assistant",{body:{message:u,chat_history:h}});if(p)throw p;e([...d,{id:d.length+1,content:(f==null?void 0:f.message)||"Sorry, I couldn't process that.",sender:"ai"}])}catch{e([...d,{id:d.length+1,content:"Something went wrong. Please try again.",sender:"ai"}])}finally{i(!1)}},l=c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),o(c))};return a.jsxs(Hne,{size:"md",position:"bottom-right",icon:a.jsx(UJ,{className:"h-6 w-6"}),children:[a.jsx(Wne,{children:a.jsxs("div",{className:"flex flex-col",children:[a.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Academly Assistant ✨"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask me anything about the platform"})]})}),a.jsx(Vne,{children:a.jsxs(Kne,{smooth:!0,children:[t.map(c=>a.jsxs(OH,{variant:c.sender==="ai"?"received":"sent",layout:"ai",children:[c.sender==="ai"&&a.jsx(RH,{fallback:"🎓"}),a.jsx(IH,{variant:c.sender==="ai"?"received":"sent",children:c.sender==="ai"?a.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&>p]:mb-2 [&>p]:leading-relaxed",children:a.jsx(fc,{children:c.content})}):c.content})]},c.id)),s&&a.jsxs(OH,{variant:"received",layout:"ai",children:[a.jsx(RH,{fallback:"🎓"}),a.jsx(IH,{isLoading:!0})]})]})}),a.jsx(qne,{children:a.jsxs("form",{onSubmit:o,className:"flex items-end gap-2",children:[a.jsx(zne,{value:r,onChange:c=>n(c.target.value),onKeyDown:l,placeholder:"Type your message...",className:"min-h-12 resize-none rounded-lg bg-background border-0 p-3 shadow-none focus-visible:ring-0",disabled:s}),a.jsx("div",{className:"flex flex-col gap-1",children:a.jsxs(ye,{type:"submit",size:"sm",disabled:s||!r.trim(),className:"gap-1.5",children:["Send",a.jsx($ve,{className:"h-3.5 w-3.5"})]})})]})})]})}const er=({children:t,showSidebar:e=!1,pageTitle:r="Dashboard",fullWidth:n=!1,hidePlatformAssistant:s=!1})=>{const{user:i}=Pt(),[o,l]=S.useState(!0),[c,u]=S.useState(!1),[d,h]=S.useState(!1),f=o||c;return e&&i?a.jsxs("div",{className:"ta-layout astro-gradient-bg min-h-screen",children:[a.jsx(aTe,{isExpanded:o,isHovered:c,isMobileOpen:d,onHoverChange:u,onMobileClose:()=>h(!1)}),a.jsxs("div",{className:`ta-main ${f?"ta-main-expanded":"ta-main-collapsed"}`,children:[a.jsx(TH,{pageTitle:r,onToggleSidebar:()=>l(!o),onToggleMobile:()=>h(!d),isMobileOpen:d}),a.jsx("main",{className:"ta-content animate-fade-in",children:a.jsx("div",{className:n?"":"max-w-screen-xl mx-auto",children:t})})]}),!s&&a.jsx(N9,{})]}):a.jsxs("div",{className:"min-h-screen flex flex-col w-full bg-background",children:[a.jsx(TH,{showSidebarControls:!1}),a.jsx("main",{className:"flex-1 w-full",children:t}),a.jsx(Ds,{}),!s&&a.jsx(N9,{})]})};function KIe(){const[t,e]=S.useState(null),[r,n]=S.useState(!0),[s,i]=S.useState(null),o=async()=>{try{n(!0),i(null);const{data:l,error:c}=await be.from("v_dashboard_stats").select("*").single();if(c)throw c;e(l)}catch(l){console.error("Error fetching dashboard stats:",l),i(l)}finally{n(!1)}};return S.useEffect(()=>{o()},[]),{stats:t,loading:r,error:s,refetch:o}}const Me=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{ref:r,className:Ie("rounded-3xl border border-border/50 bg-card/80 backdrop-blur-sm text-card-foreground","shadow-lg shadow-primary/5 hover:shadow-xl hover:shadow-primary/10","transition-all duration-300 ease-out","dark:bg-card/90 dark:border-border/30 dark:shadow-black/20 dark:hover:shadow-primary/20",t),...e}));Me.displayName="Card";const qe=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{ref:r,className:Ie("flex flex-col space-y-1.5 px-6 py-5",t),...e}));qe.displayName="CardHeader";const Je=S.forwardRef(({className:t,...e},r)=>a.jsx("h3",{ref:r,className:Ie("text-base font-semibold leading-none tracking-tight text-foreground",t),...e}));Je.displayName="CardTitle";const mn=S.forwardRef(({className:t,...e},r)=>a.jsx("p",{ref:r,className:Ie("text-sm text-muted-foreground",t),...e}));mn.displayName="CardDescription";const Be=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{ref:r,className:Ie("px-6 pb-6 pt-0",t),...e}));Be.displayName="CardContent";const YIe=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{ref:r,className:Ie("flex items-center px-6 pb-6 pt-0",t),...e}));YIe.displayName="CardFooter";var t$="Progress",r$=100,[XIe,qyt]=Bn(t$),[QIe,ZIe]=XIe(t$),Pse=S.forwardRef((t,e)=>{const{__scopeProgress:r,value:n=null,max:s,getValueLabel:i=JIe,...o}=t;(s||s===0)&&!A9(s)&&console.error(eRe(`${s}`,"Progress"));const l=A9(s)?s:r$;n!==null&&!E9(n,l)&&console.error(tRe(`${n}`,"Progress"));const c=E9(n,l)?n:null,u=sC(c)?i(c,l):void 0;return a.jsx(QIe,{scope:r,value:c,max:l,children:a.jsx(et.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":sC(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":Rse(c,l),"data-value":c??void 0,"data-max":l,...o,ref:e})})});Pse.displayName=t$;var Ose="ProgressIndicator",Ise=S.forwardRef((t,e)=>{const{__scopeProgress:r,...n}=t,s=ZIe(Ose,r);return a.jsx(et.div,{"data-state":Rse(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...n,ref:e})});Ise.displayName=Ose;function JIe(t,e){return`${Math.round(t/e*100)}%`}function Rse(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function sC(t){return typeof t=="number"}function A9(t){return sC(t)&&!isNaN(t)&&t>0}function E9(t,e){return sC(t)&&!isNaN(t)&&t<=e&&t>=0}function eRe(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${r$}\`.`}function tRe(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
- a positive number
- less than the value passed to \`max\` (or ${r$} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`}var Mse=Pse,rRe=Ise;const Dse=S.createContext({});function nRe(t){const e=S.useRef(null);return e.current===null&&(e.current=t()),e.current}const n$=typeof window<"u",sRe=n$?S.useLayoutEffect:S.useEffect,s$=S.createContext(null);function i$(t,e){t.indexOf(e)===-1&&t.push(e)}function a$(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}const Zu=(t,e,r)=>r>e?e:r<t?t:r;let iC=()=>{};const Ju={},Lse=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Fse(t){return typeof t=="object"&&t!==null}const $se=t=>/^0[^.\s]+$/u.test(t);function o$(t){let e;return()=>(e===void 0&&(e=t()),e)}const yo=t=>t,iRe=(t,e)=>r=>e(t(r)),Jj=(...t)=>t.reduce(iRe),n1=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n};class l${constructor(){this.subscriptions=[]}add(e){return i$(this.subscriptions,e),()=>a$(this.subscriptions,e)}notify(e,r,n){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,r,n);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,r,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const pc=t=>t*1e3,uo=t=>t/1e3;function Bse(t,e){return e?t*(1e3/e):0}const Use=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,aRe=1e-7,oRe=12;function lRe(t,e,r,n,s){let i,o,l=0;do o=e+(r-e)/2,i=Use(o,n,s)-t,i>0?r=o:e=o;while(Math.abs(i)>aRe&&++l<oRe);return o}function eS(t,e,r,n){if(t===e&&r===n)return yo;const s=i=>lRe(i,0,1,t,r);return i=>i===0||i===1?i:Use(s(i),e,n)}const zse=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Hse=t=>e=>1-t(1-e),Wse=eS(.33,1.53,.69,.99),c$=Hse(Wse),Vse=zse(c$),qse=t=>(t*=2)<1?.5*c$(t):.5*(2-Math.pow(2,-10*(t-1))),u$=t=>1-Math.sin(Math.acos(t)),Gse=Hse(u$),Kse=zse(u$),cRe=eS(.42,0,1,1),uRe=eS(0,0,.58,1),Yse=eS(.42,0,.58,1),dRe=t=>Array.isArray(t)&&typeof t[0]!="number",Xse=t=>Array.isArray(t)&&typeof t[0]=="number",C9={linear:yo,easeIn:cRe,easeInOut:Yse,easeOut:uRe,circIn:u$,circInOut:Kse,circOut:Gse,backIn:c$,backInOut:Vse,backOut:Wse,anticipate:qse},hRe=t=>typeof t=="string",k9=t=>{if(Xse(t)){iC(t.length===4);const[e,r,n,s]=t;return eS(e,r,n,s)}else if(hRe(t))return iC(C9[t]!==void 0),C9[t];return t},xN=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],T9={value:null,addProjectionMetrics:null};function fRe(t,e){let r=new Set,n=new Set,s=!1,i=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},c=0;function u(h){o.has(h)&&(d.schedule(h),t()),c++,h(l)}const d={schedule:(h,f=!1,p=!1)=>{const m=p&&s?r:n;return f&&o.add(h),m.has(h)||m.add(h),h},cancel:h=>{n.delete(h),o.delete(h)},process:h=>{if(l=h,s){i=!0;return}s=!0,[r,n]=[n,r],r.forEach(u),e&&T9.value&&T9.value.frameloop[e].push(c),c=0,r.clear(),s=!1,i&&(i=!1,d.process(h))}};return d}const pRe=40;function Qse(t,e){let r=!1,n=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>r=!0,o=xN.reduce((b,w)=>(b[w]=fRe(i,e?w:void 0),b),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:h,preRender:f,render:p,postRender:g}=o,m=()=>{const b=Ju.useManualTiming?s.timestamp:performance.now();r=!1,Ju.useManualTiming||(s.delta=n?1e3/60:Math.max(Math.min(b-s.timestamp,pRe),1)),s.timestamp=b,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),h.process(s),f.process(s),p.process(s),g.process(s),s.isProcessing=!1,r&&e&&(n=!1,t(m))},x=()=>{r=!0,n=!0,s.isProcessing||t(m)};return{schedule:xN.reduce((b,w)=>{const j=o[w];return b[w]=(N,C=!1,k=!1)=>(r||x(),j.schedule(N,C,k)),b},{}),cancel:b=>{for(let w=0;w<xN.length;w++)o[xN[w]].cancel(b)},state:s,steps:o}}const{schedule:Zr,cancel:ef,state:Ss,steps:SO}=Qse(typeof requestAnimationFrame<"u"?requestAnimationFrame:yo,!0);let AA;function mRe(){AA=void 0}const zi={now:()=>(AA===void 0&&zi.set(Ss.isProcessing||Ju.useManualTiming?Ss.timestamp:performance.now()),AA),set:t=>{AA=t,queueMicrotask(mRe)}},Zse=t=>e=>typeof e=="string"&&e.startsWith(t),Jse=Zse("--"),gRe=Zse("var(--"),d$=t=>gRe(t)?yRe.test(t.split("/*")[0].trim()):!1,yRe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,vb={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},s1={...vb,transform:t=>Zu(0,1,t)},vN={...vb,default:1},yw=t=>Math.round(t*1e5)/1e5,h$=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function xRe(t){return t==null}const vRe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,f$=(t,e)=>r=>!!(typeof r=="string"&&vRe.test(r)&&r.startsWith(t)||e&&!xRe(r)&&Object.prototype.hasOwnProperty.call(r,e)),eie=(t,e,r)=>n=>{if(typeof n!="string")return n;const[s,i,o,l]=n.match(h$);return{[t]:parseFloat(s),[e]:parseFloat(i),[r]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},bRe=t=>Zu(0,255,t),NO={...vb,transform:t=>Math.round(bRe(t))},ap={test:f$("rgb","red"),parse:eie("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+NO.transform(t)+", "+NO.transform(e)+", "+NO.transform(r)+", "+yw(s1.transform(n))+")"};function wRe(t){let e="",r="",n="",s="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),s=t.substring(4,5),e+=e,r+=r,n+=n,s+=s),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:s?parseInt(s,16)/255:1}}const g4={test:f$("#"),parse:wRe,transform:ap.transform},tS=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Nd=tS("deg"),mc=tS("%"),_t=tS("px"),_Re=tS("vh"),jRe=tS("vw"),P9={...mc,parse:t=>mc.parse(t)/100,transform:t=>mc.transform(t*100)},cy={test:f$("hsl","hue"),parse:eie("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+mc.transform(yw(e))+", "+mc.transform(yw(r))+", "+yw(s1.transform(n))+")"},Rn={test:t=>ap.test(t)||g4.test(t)||cy.test(t),parse:t=>ap.test(t)?ap.parse(t):cy.test(t)?cy.parse(t):g4.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?ap.transform(t):cy.transform(t),getAnimatableNone:t=>{const e=Rn.parse(t);return e.alpha=0,Rn.transform(e)}},SRe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function NRe(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(h$))==null?void 0:e.length)||0)+(((r=t.match(SRe))==null?void 0:r.length)||0)>0}const tie="number",rie="color",ARe="var",ERe="var(",O9="${}",CRe=/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 i1(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},s=[];let i=0;const l=e.replace(CRe,c=>(Rn.test(c)?(n.color.push(i),s.push(rie),r.push(Rn.parse(c))):c.startsWith(ERe)?(n.var.push(i),s.push(ARe),r.push(c)):(n.number.push(i),s.push(tie),r.push(parseFloat(c))),++i,O9)).split(O9);return{values:r,split:l,indexes:n,types:s}}function nie(t){return i1(t).values}function sie(t){const{split:e,types:r}=i1(t),n=e.length;return s=>{let i="";for(let o=0;o<n;o++)if(i+=e[o],s[o]!==void 0){const l=r[o];l===tie?i+=yw(s[o]):l===rie?i+=Rn.transform(s[o]):i+=s[o]}return i}}const kRe=t=>typeof t=="number"?0:Rn.test(t)?Rn.getAnimatableNone(t):t;function TRe(t){const e=nie(t);return sie(t)(e.map(kRe))}const tf={test:NRe,parse:nie,createTransformer:sie,getAnimatableNone:TRe};function AO(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function PRe({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let s=0,i=0,o=0;if(!e)s=i=o=r;else{const l=r<.5?r*(1+e):r+e-r*e,c=2*r-l;s=AO(c,l,t+1/3),i=AO(c,l,t),o=AO(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:n}}function aC(t,e){return r=>r>0?e:t}const nn=(t,e,r)=>t+(e-t)*r,EO=(t,e,r)=>{const n=t*t,s=r*(e*e-n)+n;return s<0?0:Math.sqrt(s)},ORe=[g4,ap,cy],IRe=t=>ORe.find(e=>e.test(t));function I9(t){const e=IRe(t);if(!e)return!1;let r=e.parse(t);return e===cy&&(r=PRe(r)),r}const R9=(t,e)=>{const r=I9(t),n=I9(e);if(!r||!n)return aC(t,e);const s={...r};return i=>(s.red=EO(r.red,n.red,i),s.green=EO(r.green,n.green,i),s.blue=EO(r.blue,n.blue,i),s.alpha=nn(r.alpha,n.alpha,i),ap.transform(s))},y4=new Set(["none","hidden"]);function RRe(t,e){return y4.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function MRe(t,e){return r=>nn(t,e,r)}function p$(t){return typeof t=="number"?MRe:typeof t=="string"?d$(t)?aC:Rn.test(t)?R9:FRe:Array.isArray(t)?iie:typeof t=="object"?Rn.test(t)?R9:DRe:aC}function iie(t,e){const r=[...t],n=r.length,s=t.map((i,o)=>p$(i)(i,e[o]));return i=>{for(let o=0;o<n;o++)r[o]=s[o](i);return r}}function DRe(t,e){const r={...t,...e},n={};for(const s in r)t[s]!==void 0&&e[s]!==void 0&&(n[s]=p$(t[s])(t[s],e[s]));return s=>{for(const i in n)r[i]=n[i](s);return r}}function LRe(t,e){const r=[],n={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const i=e.types[s],o=t.indexes[i][n[i]],l=t.values[o]??0;r[s]=l,n[i]++}return r}const FRe=(t,e)=>{const r=tf.createTransformer(e),n=i1(t),s=i1(e);return n.indexes.var.length===s.indexes.var.length&&n.indexes.color.length===s.indexes.color.length&&n.indexes.number.length>=s.indexes.number.length?y4.has(t)&&!s.values.length||y4.has(e)&&!n.values.length?RRe(t,e):Jj(iie(LRe(n,s),s.values),r):aC(t,e)};function aie(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?nn(t,e,r):p$(t)(t,e)}const $Re=t=>{const e=({timestamp:r})=>t(r);return{start:(r=!0)=>Zr.update(e,r),stop:()=>ef(e),now:()=>Ss.isProcessing?Ss.timestamp:zi.now()}},oie=(t,e,r=10)=>{let n="";const s=Math.max(Math.round(e/r),2);for(let i=0;i<s;i++)n+=Math.round(t(i/(s-1))*1e4)/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},oC=2e4;function m$(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e<oC;)e+=r,n=t.next(e);return e>=oC?1/0:e}function BRe(t,e=100,r){const n=r({...t,keyframes:[0,e]}),s=Math.min(m$(n),oC);return{type:"keyframes",ease:i=>n.next(s*i).value/e,duration:uo(s)}}const URe=5;function lie(t,e,r){const n=Math.max(e-URe,0);return Bse(r-t(n),e-n)}const hn={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},CO=.001;function zRe({duration:t=hn.duration,bounce:e=hn.bounce,velocity:r=hn.velocity,mass:n=hn.mass}){let s,i,o=1-e;o=Zu(hn.minDamping,hn.maxDamping,o),t=Zu(hn.minDuration,hn.maxDuration,uo(t)),o<1?(s=u=>{const d=u*o,h=d*t,f=d-r,p=x4(u,o),g=Math.exp(-h);return CO-f/p*g},i=u=>{const h=u*o*t,f=h*r+r,p=Math.pow(o,2)*Math.pow(u,2)*t,g=Math.exp(-h),m=x4(Math.pow(u,2),o);return(-s(u)+CO>0?-1:1)*((f-p)*g)/m}):(s=u=>{const d=Math.exp(-u*t),h=(u-r)*t+1;return-CO+d*h},i=u=>{const d=Math.exp(-u*t),h=(r-u)*(t*t);return d*h});const l=5/t,c=WRe(s,i,l);if(t=pc(t),isNaN(c))return{stiffness:hn.stiffness,damping:hn.damping,duration:t};{const u=Math.pow(c,2)*n;return{stiffness:u,damping:o*2*Math.sqrt(n*u),duration:t}}}const HRe=12;function WRe(t,e,r){let n=r;for(let s=1;s<HRe;s++)n=n-t(n)/e(n);return n}function x4(t,e){return t*Math.sqrt(1-e*e)}const VRe=["duration","bounce"],qRe=["stiffness","damping","mass"];function M9(t,e){return e.some(r=>t[r]!==void 0)}function GRe(t){let e={velocity:hn.velocity,stiffness:hn.stiffness,damping:hn.damping,mass:hn.mass,isResolvedFromDuration:!1,...t};if(!M9(t,qRe)&&M9(t,VRe))if(t.visualDuration){const r=t.visualDuration,n=2*Math.PI/(r*1.2),s=n*n,i=2*Zu(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:hn.mass,stiffness:s,damping:i}}else{const r=zRe(t);e={...e,...r,mass:hn.mass},e.isResolvedFromDuration=!0}return e}function lC(t=hn.visualDuration,e=hn.bounce){const r=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:n,restDelta:s}=r;const i=r.keyframes[0],o=r.keyframes[r.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:h,velocity:f,isResolvedFromDuration:p}=GRe({...r,velocity:-uo(r.velocity||0)}),g=f||0,m=u/(2*Math.sqrt(c*d)),x=o-i,y=uo(Math.sqrt(c/d)),v=Math.abs(x)<5;n||(n=v?hn.restSpeed.granular:hn.restSpeed.default),s||(s=v?hn.restDelta.granular:hn.restDelta.default);let b;if(m<1){const j=x4(y,m);b=N=>{const C=Math.exp(-m*y*N);return o-C*((g+m*y*x)/j*Math.sin(j*N)+x*Math.cos(j*N))}}else if(m===1)b=j=>o-Math.exp(-y*j)*(x+(g+y*x)*j);else{const j=y*Math.sqrt(m*m-1);b=N=>{const C=Math.exp(-m*y*N),k=Math.min(j*N,300);return o-C*((g+m*y*x)*Math.sinh(k)+j*x*Math.cosh(k))/j}}const w={calculatedDuration:p&&h||null,next:j=>{const N=b(j);if(p)l.done=j>=h;else{let C=j===0?g:0;m<1&&(C=j===0?pc(g):lie(b,j,N));const k=Math.abs(C)<=n,E=Math.abs(o-N)<=s;l.done=k&&E}return l.value=l.done?o:N,l},toString:()=>{const j=Math.min(m$(w),oC),N=oie(C=>w.next(j*C).value,j,30);return j+"ms "+N},toTransition:()=>{}};return w}lC.applyToOptions=t=>{const e=BRe(t,100,lC);return t.ease=e.ease,t.duration=pc(e.duration),t.type="keyframes",t};function v4({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const h=t[0],f={done:!1,value:h},p=k=>l!==void 0&&k<l||c!==void 0&&k>c,g=k=>l===void 0?c:c===void 0||Math.abs(l-k)<Math.abs(c-k)?l:c;let m=r*e;const x=h+m,y=o===void 0?x:o(x);y!==x&&(m=y-h);const v=k=>-m*Math.exp(-k/n),b=k=>y+v(k),w=k=>{const E=v(k),M=b(k);f.done=Math.abs(E)<=u,f.value=f.done?y:M};let j,N;const C=k=>{p(f.value)&&(j=k,N=lC({keyframes:[f.value,g(f.value)],velocity:lie(b,k,f.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return C(0),{calculatedDuration:null,next:k=>{let E=!1;return!N&&j===void 0&&(E=!0,w(k),C(k)),j!==void 0&&k>=j?N.next(k-j):(!E&&w(k),f)}}}function KRe(t,e,r){const n=[],s=r||Ju.mix||aie,i=t.length-1;for(let o=0;o<i;o++){let l=s(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||yo:e;l=Jj(c,l)}n.push(l)}return n}function YRe(t,e,{clamp:r=!0,ease:n,mixer:s}={}){const i=t.length;if(iC(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=KRe(e,n,s),c=l.length,u=d=>{if(o&&d<t[0])return e[0];let h=0;if(c>1)for(;h<t.length-2&&!(d<t[h+1]);h++);const f=n1(t[h],t[h+1],d);return l[h](f)};return r?d=>u(Zu(t[0],t[i-1],d)):u}function XRe(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const s=n1(0,e,n);t.push(nn(r,1,s))}}function QRe(t){const e=[0];return XRe(e,t.length-1),e}function ZRe(t,e){return t.map(r=>r*e)}function JRe(t,e){return t.map(()=>e||Yse).splice(0,t.length-1)}function xw({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const s=dRe(n)?n.map(k9):k9(n),i={done:!1,value:e[0]},o=ZRe(r&&r.length===e.length?r:QRe(e),t),l=YRe(o,e,{ease:Array.isArray(s)?s:JRe(e,s)});return{calculatedDuration:t,next:c=>(i.value=l(c),i.done=c>=t,i)}}const eMe=t=>t!==null;function g$(t,{repeat:e,repeatType:r="loop"},n,s=1){const i=t.filter(eMe),l=s<0||e&&r!=="loop"&&e%2===1?0:i.length-1;return!l||n===void 0?i[l]:n}const tMe={decay:v4,inertia:v4,tween:xw,keyframes:xw,spring:lC};function cie(t){typeof t.type=="string"&&(t.type=tMe[t.type])}class y${constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,r){return this.finished.then(e,r)}}const rMe=t=>t/100;class x$ extends y${constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var n,s;const{motionValue:r}=this.options;r&&r.updatedAt!==zi.now()&&this.tick(zi.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(n=this.options).onStop)==null||s.call(n))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;cie(e);const{type:r=xw,repeat:n=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=e;let{keyframes:l}=e;const c=r||xw;c!==xw&&typeof l[0]!="number"&&(this.mixKeyframes=Jj(rMe,aie(l[0],l[1])),l=[0,100]);const u=c({...e,keyframes:l});i==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=m$(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(n+1)-s,this.generator=u}updateTime(e){const r=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(e,r=!1){const{generator:n,totalDuration:s,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return n.next(0);const{delay:u=0,keyframes:d,repeat:h,repeatType:f,repeatDelay:p,type:g,onUpdate:m,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),r?this.currentTime=e:this.updateTime(e);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>s;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let b=this.currentTime,w=n;if(h){const k=Math.min(this.currentTime,s)/l;let E=Math.floor(k),M=k%1;!M&&k>=1&&(M=1),M===1&&E--,E=Math.min(E,h+1),!!(E%2)&&(f==="reverse"?(M=1-M,p&&(M-=p/l)):f==="mirror"&&(w=o)),b=Zu(0,1,M)*l}const j=v?{done:!1,value:d[0]}:w.next(b);i&&(j.value=i(j.value));let{done:N}=j;!v&&c!==null&&(N=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return C&&g!==v4&&(j.value=g$(d,this.options,x,this.speed)),m&&m(j.value),C&&this.finish(),j}then(e,r){return this.finished.then(e,r)}get duration(){return uo(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+uo(e)}get time(){return uo(this.currentTime)}set time(e){var r;e=pc(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(r=this.driver)==null||r.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(zi.now());const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=uo(this.currentTime))}play(){var s,i;if(this.isStopped)return;const{driver:e=$Re,startTime:r}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(i=(s=this.options).onPlay)==null||i.call(s);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(zi.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,r;this.notifyFinished(),this.teardown(),this.state="finished",(r=(e=this.options).onComplete)==null||r.call(e)}cancel(){var e,r;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(r=(e=this.options).onCancel)==null||r.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var r;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(r=this.driver)==null||r.stop(),e.observe(this)}}function nMe(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const op=t=>t*180/Math.PI,b4=t=>{const e=op(Math.atan2(t[1],t[0]));return w4(e)},sMe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:b4,rotateZ:b4,skewX:t=>op(Math.atan(t[1])),skewY:t=>op(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},w4=t=>(t=t%360,t<0&&(t+=360),t),D9=b4,L9=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),F9=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),iMe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:L9,scaleY:F9,scale:t=>(L9(t)+F9(t))/2,rotateX:t=>w4(op(Math.atan2(t[6],t[5]))),rotateY:t=>w4(op(Math.atan2(-t[2],t[0]))),rotateZ:D9,rotate:D9,skewX:t=>op(Math.atan(t[4])),skewY:t=>op(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function _4(t){return t.includes("scale")?1:0}function j4(t,e){if(!t||t==="none")return _4(e);const r=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,s;if(r)n=iMe,s=r;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=sMe,s=l}if(!s)return _4(e);const i=n[e],o=s[1].split(",").map(oMe);return typeof i=="function"?i(o):o[i]}const aMe=(t,e)=>{const{transform:r="none"}=getComputedStyle(t);return j4(r,e)};function oMe(t){return parseFloat(t.trim())}const bb=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],wb=new Set(bb),$9=t=>t===vb||t===_t,lMe=new Set(["x","y","z"]),cMe=bb.filter(t=>!lMe.has(t));function uMe(t){const e=[];return cMe.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const Pm={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>j4(e,"x"),y:(t,{transform:e})=>j4(e,"y")};Pm.translateX=Pm.x;Pm.translateY=Pm.y;const Om=new Set;let S4=!1,N4=!1,A4=!1;function uie(){if(N4){const t=Array.from(Om).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const s=uMe(n);s.length&&(r.set(n,s),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const s=r.get(n);s&&s.forEach(([i,o])=>{var l;(l=n.getValue(i))==null||l.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}N4=!1,S4=!1,Om.forEach(t=>t.complete(A4)),Om.clear()}function die(){Om.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(N4=!0)})}function dMe(){A4=!0,die(),uie(),A4=!1}class v${constructor(e,r,n,s,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Om.add(this),S4||(S4=!0,Zr.read(die),Zr.resolveKeyframes(uie))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:s}=this;if(e[0]===null){const i=s==null?void 0:s.get(),o=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&r){const l=n.readValue(r,o);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=o),s&&i===void 0&&s.set(e[0])}nMe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Om.delete(this)}cancel(){this.state==="scheduled"&&(Om.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const hMe=t=>t.startsWith("--");function fMe(t,e,r){hMe(e)?t.style.setProperty(e,r):t.style[e]=r}const pMe=o$(()=>window.ScrollTimeline!==void 0),mMe={};function gMe(t,e){const r=o$(t);return()=>mMe[e]??r()}const hie=gMe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),E0=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,B9={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:E0([0,.65,.55,1]),circOut:E0([.55,0,1,.45]),backIn:E0([.31,.01,.66,-.59]),backOut:E0([.33,1.53,.69,.99])};function fie(t,e){if(t)return typeof t=="function"?hie()?oie(t,e):"ease-out":Xse(t)?E0(t):Array.isArray(t)?t.map(r=>fie(r,e)||B9.easeOut):B9[t]}function yMe(t,e,r,{delay:n=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[e]:r};c&&(d.offset=c);const h=fie(l,s);Array.isArray(h)&&(d.easing=h);const f={delay:n,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return u&&(f.pseudoElement=u),t.animate(d,f)}function pie(t){return typeof t=="function"&&"applyToOptions"in t}function xMe({type:t,...e}){return pie(t)&&hie()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class vMe extends y${constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:r,name:n,keyframes:s,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,iC(typeof e.type!="string");const u=xMe(e);this.animation=yMe(r,n,s,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=g$(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):fMe(r,n,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,r;(r=(e=this.animation).finish)==null||r.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,r;this.isPseudoElement||(r=(e=this.animation).commitStyles)==null||r.call(e)}get duration(){var r,n;const e=((n=(r=this.animation.effect)==null?void 0:r.getComputedTiming)==null?void 0:n.call(r).duration)||0;return uo(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+uo(e)}get time(){return uo(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=pc(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:r}){var n;return this.allowFlatten&&((n=this.animation.effect)==null||n.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&pMe()?(this.animation.timeline=e,yo):r(this)}}const mie={anticipate:qse,backInOut:Vse,circInOut:Kse};function bMe(t){return t in mie}function wMe(t){typeof t.ease=="string"&&bMe(t.ease)&&(t.ease=mie[t.ease])}const U9=10;class _Me extends vMe{constructor(e){wMe(e),cie(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:r,onUpdate:n,onComplete:s,element:i,...o}=this.options;if(!r)return;if(e!==void 0){r.set(e);return}const l=new x$({...o,autoplay:!1}),c=pc(this.finishedTime??this.time);r.setWithVelocity(l.sample(c-U9).value,l.sample(c).value,U9),l.stop()}}const z9=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(tf.test(t)||t==="0")&&!t.startsWith("url("));function jMe(t){const e=t[0];if(t.length===1)return!0;for(let r=0;r<t.length;r++)if(t[r]!==e)return!0}function SMe(t,e,r,n){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=z9(s,e),l=z9(i,e);return!o||!l?!1:jMe(t)||(r==="spring"||pie(r))&&n}function E4(t){t.duration=0,t.type="keyframes"}const NMe=new Set(["opacity","clipPath","filter","transform"]),AMe=o$(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function EMe(t){var d;const{motionValue:e,name:r,repeatDelay:n,repeatType:s,damping:i,type:o}=t;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=e.owner.getProps();return AMe()&&r&&NMe.has(r)&&(r!=="transform"||!u)&&!c&&!n&&s!=="mirror"&&i!==0&&o!=="inertia"}const CMe=40;class kMe extends y${constructor({autoplay:e=!0,delay:r=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",keyframes:l,name:c,motionValue:u,element:d,...h}){var g;super(),this.stop=()=>{var m,x;this._animation&&(this._animation.stop(),(m=this.stopTimeline)==null||m.call(this)),(x=this.keyframeResolver)==null||x.cancel()},this.createdAt=zi.now();const f={autoplay:e,delay:r,type:n,repeat:s,repeatDelay:i,repeatType:o,name:c,motionValue:u,element:d,...h},p=(d==null?void 0:d.KeyframeResolver)||v$;this.keyframeResolver=new p(l,(m,x,y)=>this.onKeyframesResolved(m,x,f,!y),c,u,d),(g=this.keyframeResolver)==null||g.scheduleResolve()}onKeyframesResolved(e,r,n,s){this.keyframeResolver=void 0;const{name:i,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=n;this.resolvedAt=zi.now(),SMe(e,i,o,l)||((Ju.instantAnimations||!c)&&(d==null||d(g$(e,n,r))),e[0]=e[e.length-1],E4(n),n.repeat=0);const f={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>CMe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...n,keyframes:e},p=!u&&EMe(f)?new _Me({...f,element:f.motionValue.owner.current}):new x$(f);p.finished.then(()=>this.notifyFinished()).catch(yo),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(e,r){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),dMe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}const TMe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function PMe(t){const e=TMe.exec(t);if(!e)return[,];const[,r,n,s]=e;return[`--${r??n}`,s]}function gie(t,e,r=1){const[n,s]=PMe(t);if(!n)return;const i=window.getComputedStyle(e).getPropertyValue(n);if(i){const o=i.trim();return Lse(o)?parseFloat(o):o}return d$(s)?gie(s,e,r+1):s}function b$(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const yie=new Set(["width","height","top","left","right","bottom",...bb]),OMe={test:t=>t==="auto",parse:t=>t},xie=t=>e=>e.test(t),vie=[vb,_t,mc,Nd,jRe,_Re,OMe],H9=t=>vie.find(xie(t));function IMe(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||$se(t):!0}const RMe=new Set(["brightness","contrast","saturate","opacity"]);function MMe(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(h$)||[];if(!n)return t;const s=r.replace(n,"");let i=RMe.has(e)?1:0;return n!==r&&(i*=100),e+"("+i+s+")"}const DMe=/\b([a-z-]*)\(.*?\)/gu,C4={...tf,getAnimatableNone:t=>{const e=t.match(DMe);return e?e.map(MMe).join(" "):t}},W9={...vb,transform:Math.round},LMe={rotate:Nd,rotateX:Nd,rotateY:Nd,rotateZ:Nd,scale:vN,scaleX:vN,scaleY:vN,scaleZ:vN,skew:Nd,skewX:Nd,skewY:Nd,distance:_t,translateX:_t,translateY:_t,translateZ:_t,x:_t,y:_t,z:_t,perspective:_t,transformPerspective:_t,opacity:s1,originX:P9,originY:P9,originZ:_t},w$={borderWidth:_t,borderTopWidth:_t,borderRightWidth:_t,borderBottomWidth:_t,borderLeftWidth:_t,borderRadius:_t,radius:_t,borderTopLeftRadius:_t,borderTopRightRadius:_t,borderBottomRightRadius:_t,borderBottomLeftRadius:_t,width:_t,maxWidth:_t,height:_t,maxHeight:_t,top:_t,right:_t,bottom:_t,left:_t,padding:_t,paddingTop:_t,paddingRight:_t,paddingBottom:_t,paddingLeft:_t,margin:_t,marginTop:_t,marginRight:_t,marginBottom:_t,marginLeft:_t,backgroundPositionX:_t,backgroundPositionY:_t,...LMe,zIndex:W9,fillOpacity:s1,strokeOpacity:s1,numOctaves:W9},FMe={...w$,color:Rn,backgroundColor:Rn,outlineColor:Rn,fill:Rn,stroke:Rn,borderColor:Rn,borderTopColor:Rn,borderRightColor:Rn,borderBottomColor:Rn,borderLeftColor:Rn,filter:C4,WebkitFilter:C4},bie=t=>FMe[t];function wie(t,e){let r=bie(t);return r!==C4&&(r=tf),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const $Me=new Set(["auto","none","0"]);function BMe(t,e,r){let n=0,s;for(;n<t.length&&!s;){const i=t[n];typeof i=="string"&&!$Me.has(i)&&i1(i).values.length&&(s=t[n]),n++}if(s&&r)for(const i of e)t[i]=wie(r,s)}class UMe extends v${constructor(e,r,n,s,i){super(e,r,n,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:r,name:n}=this;if(!r||!r.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let u=e[c];if(typeof u=="string"&&(u=u.trim(),d$(u))){const d=gie(u,r.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!yie.has(n)||e.length!==2)return;const[s,i]=e,o=H9(s),l=H9(i);if(o!==l)if($9(o)&&$9(l))for(let c=0;c<e.length;c++){const u=e[c];typeof u=="string"&&(e[c]=parseFloat(u))}else Pm[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:r}=this,n=[];for(let s=0;s<e.length;s++)(e[s]===null||IMe(e[s]))&&n.push(s);n.length&&BMe(e,n,r)}measureInitialState(){const{element:e,unresolvedKeyframes:r,name:n}=this;if(!e||!e.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Pm[n](e.measureViewportBox(),window.getComputedStyle(e.current)),r[0]=this.measuredOrigin;const s=r[r.length-1];s!==void 0&&e.getValue(n,s).jump(s,!1)}measureEndState(){var l;const{element:e,name:r,unresolvedKeyframes:n}=this;if(!e||!e.current)return;const s=e.getValue(r);s&&s.jump(this.measuredOrigin,!1);const i=n.length-1,o=n[i];n[i]=Pm[r](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,u])=>{e.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function _ie(t,e,r){if(t instanceof EventTarget)return[t];if(typeof t=="string"){const s=document.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}const jie=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function zMe(t){return Fse(t)&&"offsetHeight"in t}const V9=30,HMe=t=>!isNaN(parseFloat(t));class WMe{constructor(e,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{var i;const s=zi.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=zi.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=HMe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new l$);const n=this.events[e].add(r);return e==="change"?()=>{n(),Zr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=zi.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>V9)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,V9);return Bse(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(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 e,r;(e=this.dependents)==null||e.clear(),(r=this.events.destroy)==null||r.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Sv(t,e){return new WMe(t,e)}const{schedule:_$,cancel:Gyt}=Qse(queueMicrotask,!1),Ro={x:!1,y:!1};function Sie(){return Ro.x||Ro.y}function VMe(t){return t==="x"||t==="y"?Ro[t]?null:(Ro[t]=!0,()=>{Ro[t]=!1}):Ro.x||Ro.y?null:(Ro.x=Ro.y=!0,()=>{Ro.x=Ro.y=!1})}function Nie(t,e){const r=_ie(t),n=new AbortController,s={passive:!0,...e,signal:n.signal};return[r,s,()=>n.abort()]}function q9(t){return!(t.pointerType==="touch"||Sie())}function qMe(t,e,r={}){const[n,s,i]=Nie(t,r),o=l=>{if(!q9(l))return;const{target:c}=l,u=e(c,l);if(typeof u!="function"||!c)return;const d=h=>{q9(h)&&(u(h),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,s)};return n.forEach(l=>{l.addEventListener("pointerenter",o,s)}),i}const Aie=(t,e)=>e?t===e?!0:Aie(t,e.parentElement):!1,j$=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,GMe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function KMe(t){return GMe.has(t.tagName)||t.tabIndex!==-1}const EA=new WeakSet;function G9(t){return e=>{e.key==="Enter"&&t(e)}}function kO(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const YMe=(t,e)=>{const r=t.currentTarget;if(!r)return;const n=G9(()=>{if(EA.has(r))return;kO(r,"down");const s=G9(()=>{kO(r,"up")}),i=()=>kO(r,"cancel");r.addEventListener("keyup",s,e),r.addEventListener("blur",i,e)});r.addEventListener("keydown",n,e),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),e)};function K9(t){return j$(t)&&!Sie()}function XMe(t,e,r={}){const[n,s,i]=Nie(t,r),o=l=>{const c=l.currentTarget;if(!K9(l))return;EA.add(c);const u=e(c,l),d=(p,g)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",f),EA.has(c)&&EA.delete(c),K9(p)&&typeof u=="function"&&u(p,{success:g})},h=p=>{d(p,c===window||c===document||r.useGlobalTarget||Aie(c,p.target))},f=p=>{d(p,!1)};window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",f,s)};return n.forEach(l=>{(r.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),zMe(l)&&(l.addEventListener("focus",u=>YMe(u,s)),!KMe(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),i}function Eie(t){return Fse(t)&&"ownerSVGElement"in t}function QMe(t){return Eie(t)&&t.tagName==="svg"}const Qs=t=>!!(t&&t.getVelocity),ZMe=[...vie,Rn,tf],JMe=t=>ZMe.find(xie(t)),Cie=S.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function eDe(t=!0){const e=S.useContext(s$);if(e===null)return[!0,null];const{isPresent:r,onExitComplete:n,register:s}=e,i=S.useId();S.useEffect(()=>{if(t)return s(i)},[t]);const o=S.useCallback(()=>t&&n&&n(i),[i,n,t]);return!r&&n?[!1,o]:[!0]}const kie=S.createContext({strict:!1}),Y9={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"]},Nv={};for(const t in Y9)Nv[t]={isEnabled:e=>Y9[t].some(r=>!!e[r])};function tDe(t){for(const e in t)Nv[e]={...Nv[e],...t[e]}}const rDe=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","ignoreStrict","viewport"]);function cC(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||rDe.has(t)}let Tie=t=>!cC(t);function nDe(t){typeof t=="function"&&(Tie=e=>e.startsWith("on")?!cC(e):t(e))}try{nDe(require("@emotion/is-prop-valid").default)}catch{}function sDe(t,e,r){const n={};for(const s in t)s==="values"&&typeof t.values=="object"||(Tie(s)||r===!0&&cC(s)||!e&&!cC(s)||t.draggable&&s.startsWith("onDrag"))&&(n[s]=t[s]);return n}const UT=S.createContext({});function zT(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function a1(t){return typeof t=="string"||Array.isArray(t)}const S$=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],N$=["initial",...S$];function HT(t){return zT(t.animate)||N$.some(e=>a1(t[e]))}function Pie(t){return!!(HT(t)||t.variants)}function iDe(t,e){if(HT(t)){const{initial:r,animate:n}=t;return{initial:r===!1||a1(r)?r:void 0,animate:a1(n)?n:void 0}}return t.inherit!==!1?e:{}}function aDe(t){const{initial:e,animate:r}=iDe(t,S.useContext(UT));return S.useMemo(()=>({initial:e,animate:r}),[X9(e),X9(r)])}function X9(t){return Array.isArray(t)?t.join(" "):t}function Q9(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Jb={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(_t.test(t))t=parseFloat(t);else return t;const r=Q9(t,e.target.x),n=Q9(t,e.target.y);return`${r}% ${n}%`}},oDe={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,s=tf.parse(t);if(s.length>5)return n;const i=tf.createTransformer(t),o=typeof s[0]!="number"?1:0,l=r.x.scale*e.x,c=r.y.scale*e.y;s[0+o]/=l,s[1+o]/=c;const u=nn(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}},k4={borderRadius:{...Jb,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Jb,borderTopRightRadius:Jb,borderBottomLeftRadius:Jb,borderBottomRightRadius:Jb,boxShadow:oDe};function Oie(t,{layout:e,layoutId:r}){return wb.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!k4[t]||t==="opacity")}const lDe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},cDe=bb.length;function uDe(t,e,r){let n="",s=!0;for(let i=0;i<cDe;i++){const o=bb[i],l=t[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||r){const u=jie(l,w$[o]);if(!c){s=!1;const d=lDe[o]||o;n+=`${d}(${u}) `}r&&(e[o]=u)}}return n=n.trim(),r?n=r(e,s?"":n):s&&(n="none"),n}function A$(t,e,r){const{style:n,vars:s,transformOrigin:i}=t;let o=!1,l=!1;for(const c in e){const u=e[c];if(wb.has(c)){o=!0;continue}else if(Jse(c)){s[c]=u;continue}else{const d=jie(u,w$[c]);c.startsWith("origin")?(l=!0,i[c]=d):n[c]=d}}if(e.transform||(o||r?n.transform=uDe(e,t.transform,r):n.transform&&(n.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;n.transformOrigin=`${c} ${u} ${d}`}}const E$=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Iie(t,e,r){for(const n in e)!Qs(e[n])&&!Oie(n,r)&&(t[n]=e[n])}function dDe({transformTemplate:t},e){return S.useMemo(()=>{const r=E$();return A$(r,e,t),Object.assign({},r.vars,r.style)},[e])}function hDe(t,e){const r=t.style||{},n={};return Iie(n,r,t),Object.assign(n,dDe(t,e)),n}function fDe(t,e){const r={},n=hDe(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const pDe={offset:"stroke-dashoffset",array:"stroke-dasharray"},mDe={offset:"strokeDashoffset",array:"strokeDasharray"};function gDe(t,e,r=1,n=0,s=!0){t.pathLength=1;const i=s?pDe:mDe;t[i.offset]=_t.transform(-n);const o=_t.transform(e),l=_t.transform(r);t[i.array]=`${o} ${l}`}function Rie(t,{attrX:e,attrY:r,attrScale:n,pathLength:s,pathSpacing:i=1,pathOffset:o=0,...l},c,u,d){if(A$(t,l,u),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:f}=t;h.transform&&(f.transform=h.transform,delete h.transform),(f.transform||h.transformOrigin)&&(f.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),f.transform&&(f.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete h.transformBox),e!==void 0&&(h.x=e),r!==void 0&&(h.y=r),n!==void 0&&(h.scale=n),s!==void 0&&gDe(h,s,i,o,!1)}const Mie=()=>({...E$(),attrs:{}}),Die=t=>typeof t=="string"&&t.toLowerCase()==="svg";function yDe(t,e,r,n){const s=S.useMemo(()=>{const i=Mie();return Rie(i,e,Die(n),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};Iie(i,t.style,t),s.style={...i,...s.style}}return s}const xDe=["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 C$(t){return typeof t!="string"||t.includes("-")?!1:!!(xDe.indexOf(t)>-1||/[A-Z]/u.test(t))}function vDe(t,e,r,{latestValues:n},s,i=!1){const l=(C$(t)?yDe:fDe)(e,n,s,t),c=sDe(e,typeof t=="string",i),u=t!==S.Fragment?{...c,...l,ref:r}:{},{children:d}=e,h=S.useMemo(()=>Qs(d)?d.get():d,[d]);return S.createElement(t,{...u,children:h})}function Z9(t){const e=[{},{}];return t==null||t.values.forEach((r,n)=>{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function k$(t,e,r,n){if(typeof e=="function"){const[s,i]=Z9(n);e=e(r!==void 0?r:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=Z9(n);e=e(r!==void 0?r:t.custom,s,i)}return e}function CA(t){return Qs(t)?t.get():t}function bDe({scrapeMotionValuesFromProps:t,createRenderState:e},r,n,s){return{latestValues:wDe(r,n,s,t),renderState:e()}}function wDe(t,e,r,n){const s={},i=n(t,{});for(const f in i)s[f]=CA(i[f]);let{initial:o,animate:l}=t;const c=HT(t),u=Pie(t);e&&u&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const h=d?l:o;if(h&&typeof h!="boolean"&&!zT(h)){const f=Array.isArray(h)?h:[h];for(let p=0;p<f.length;p++){const g=k$(t,f[p]);if(g){const{transitionEnd:m,transition:x,...y}=g;for(const v in y){let b=y[v];if(Array.isArray(b)){const w=d?b.length-1:0;b=b[w]}b!==null&&(s[v]=b)}for(const v in m)s[v]=m[v]}}}return s}const Lie=t=>(e,r)=>{const n=S.useContext(UT),s=S.useContext(s$),i=()=>bDe(t,e,n,s);return r?i():nRe(i)};function T$(t,e,r){var i;const{style:n}=t,s={};for(const o in n)(Qs(n[o])||e.style&&Qs(e.style[o])||Oie(o,t)||((i=r==null?void 0:r.getValue(o))==null?void 0:i.liveStyle)!==void 0)&&(s[o]=n[o]);return s}const _De=Lie({scrapeMotionValuesFromProps:T$,createRenderState:E$});function Fie(t,e,r){const n=T$(t,e,r);for(const s in t)if(Qs(t[s])||Qs(e[s])){const i=bb.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;n[i]=t[s]}return n}const jDe=Lie({scrapeMotionValuesFromProps:Fie,createRenderState:Mie}),SDe=Symbol.for("motionComponentSymbol");function uy(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function NDe(t,e,r){return S.useCallback(n=>{n&&t.onMount&&t.onMount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):uy(r)&&(r.current=n))},[e])}const P$=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ADe="framerAppearId",$ie="data-"+P$(ADe),Bie=S.createContext({});function EDe(t,e,r,n,s){var m,x;const{visualElement:i}=S.useContext(UT),o=S.useContext(kie),l=S.useContext(s$),c=S.useContext(Cie).reducedMotion,u=S.useRef(null);n=n||o.renderer,!u.current&&n&&(u.current=n(t,{visualState:e,parent:i,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const d=u.current,h=S.useContext(Bie);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&CDe(u.current,r,s,h);const f=S.useRef(!1);S.useInsertionEffect(()=>{d&&f.current&&d.update(r,l)});const p=r[$ie],g=S.useRef(!!p&&!((m=window.MotionHandoffIsComplete)!=null&&m.call(window,p))&&((x=window.MotionHasOptimisedAnimation)==null?void 0:x.call(window,p)));return sRe(()=>{d&&(f.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),g.current&&d.animationState&&d.animationState.animateChanges())}),S.useEffect(()=>{d&&(!g.current&&d.animationState&&d.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)==null||y.call(window,p)}),g.current=!1),d.enteringChildren=void 0)}),d}function CDe(t,e,r,n){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:d}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:Uie(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&uy(l),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:n,crossfade:d,layoutScroll:c,layoutRoot:u})}function Uie(t){if(t)return t.options.allowProjection!==!1?t.projection:Uie(t.parent)}function TO(t,{forwardMotionProps:e=!1}={},r,n){r&&tDe(r);const s=C$(t)?jDe:_De;function i(l,c){let u;const d={...S.useContext(Cie),...l,layoutId:kDe(l)},{isStatic:h}=d,f=aDe(l),p=s(l,h);if(!h&&n$){TDe();const g=PDe(d);u=g.MeasureLayout,f.visualElement=EDe(t,p,d,n,g.ProjectionNode)}return a.jsxs(UT.Provider,{value:f,children:[u&&f.visualElement?a.jsx(u,{visualElement:f.visualElement,...d}):null,vDe(t,l,NDe(p,f.visualElement,c),p,h,e)]})}i.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=S.forwardRef(i);return o[SDe]=t,o}function kDe({layoutId:t}){const e=S.useContext(Dse).id;return e&&t!==void 0?e+"-"+t:t}function TDe(t,e){S.useContext(kie).strict}function PDe(t){const{drag:e,layout:r}=Nv;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function ODe(t,e){if(typeof Proxy>"u")return TO;const r=new Map,n=(i,o)=>TO(i,o,t,e),s=(i,o)=>n(i,o);return new Proxy(s,{get:(i,o)=>o==="create"?n:(r.has(o)||r.set(o,TO(o,void 0,t,e)),r.get(o))})}function zie({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function IDe({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function RDe(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function PO(t){return t===void 0||t===1}function T4({scale:t,scaleX:e,scaleY:r}){return!PO(t)||!PO(e)||!PO(r)}function Wf(t){return T4(t)||Hie(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Hie(t){return J9(t.x)||J9(t.y)}function J9(t){return t&&t!=="0%"}function uC(t,e,r){const n=t-r,s=e*n;return r+s}function eW(t,e,r,n,s){return s!==void 0&&(t=uC(t,s,n)),uC(t,r,n)+e}function P4(t,e=0,r=1,n,s){t.min=eW(t.min,e,r,n,s),t.max=eW(t.max,e,r,n,s)}function Wie(t,{x:e,y:r}){P4(t.x,e.translate,e.scale,e.originPoint),P4(t.y,r.translate,r.scale,r.originPoint)}const tW=.999999999999,rW=1.0000000000001;function MDe(t,e,r,n=!1){const s=r.length;if(!s)return;e.x=e.y=1;let i,o;for(let l=0;l<s;l++){i=r[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&hy(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,Wie(t,o)),n&&Wf(i.latestValues)&&hy(t,i.latestValues))}e.x<rW&&e.x>tW&&(e.x=1),e.y<rW&&e.y>tW&&(e.y=1)}function dy(t,e){t.min=t.min+e,t.max=t.max+e}function nW(t,e,r,n,s=.5){const i=nn(t.min,t.max,s);P4(t,e,r,i,n)}function hy(t,e){nW(t.x,e.x,e.scaleX,e.scale,e.originX),nW(t.y,e.y,e.scaleY,e.scale,e.originY)}function Vie(t,e){return zie(RDe(t.getBoundingClientRect(),e))}function DDe(t,e,r){const n=Vie(t,r),{scroll:s}=e;return s&&(dy(n.x,s.offset.x),dy(n.y,s.offset.y)),n}const sW=()=>({translate:0,scale:1,origin:0,originPoint:0}),fy=()=>({x:sW(),y:sW()}),iW=()=>({min:0,max:0}),Gn=()=>({x:iW(),y:iW()}),O4={current:null},qie={current:!1};function LDe(){if(qie.current=!0,!!n$)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>O4.current=t.matches;t.addEventListener("change",e),e()}else O4.current=!1}const FDe=new WeakMap;function $De(t,e,r){for(const n in e){const s=e[n],i=r[n];if(Qs(s))t.addValue(n,s);else if(Qs(i))t.addValue(n,Sv(s,{owner:t}));else if(i!==s)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(n);t.addValue(n,Sv(o!==void 0?o:s,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const aW=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class BDe{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=v$,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},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 f=zi.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,Zr.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=r.initial?{...c}:{},this.renderState=u,this.parent=e,this.props=r,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=HT(r),this.isVariantNode=Pie(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...h}=this.scrapeMotionValuesFromProps(r,{},this);for(const f in h){const p=h[f];c[f]!==void 0&&Qs(p)&&p.set(c[f])}}mount(e){var r;this.current=e,FDe.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),qie.current||LDe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:O4.current,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),ef(this.notifyUpdate),ef(this.render),this.valueSubscriptions.forEach(r=>r()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.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(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=wb.has(e);n&&this.onBindTransform&&this.onBindTransform();const s=r.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Zr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{s(),i&&i(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Nv){const r=Nv[e];if(!r)continue;const{isEnabled:n,Feature:s}=r;if(!this.features[e]&&s&&n(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Gn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;n<aW.length;n++){const s=aW[n];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=e[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=$De(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]: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(e){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(e),()=>r.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=Sv(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n=="string"&&(Lse(n)||$se(n))?n=parseFloat(n):!JMe(n)&&tf.test(r)&&(n=wie(e,r)),this.setBaseTarget(e,Qs(n)?n.get():n)),Qs(n)?n.get():n}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var i;const{initial:r}=this.props;let n;if(typeof r=="string"||typeof r=="object"){const o=k$(this.props,r,(i=this.presenceContext)==null?void 0:i.custom);o&&(n=o[e])}if(r&&n!==void 0)return n;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qs(s)?s:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new l$),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}scheduleRenderMicrotask(){_$.render(this.render)}}class Gie extends BDe{constructor(){super(...arguments),this.KeyframeResolver=UMe}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qs(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function Kie(t,{style:e,vars:r},n,s){const i=t.style;let o;for(o in e)i[o]=e[o];s==null||s.applyProjectionStyles(i,n);for(o in r)i.setProperty(o,r[o])}function UDe(t){return window.getComputedStyle(t)}class zDe extends Gie{constructor(){super(...arguments),this.type="html",this.renderInstance=Kie}readValueFromInstance(e,r){var n;if(wb.has(r))return(n=this.projection)!=null&&n.isProjecting?_4(r):aMe(e,r);{const s=UDe(e),i=(Jse(r)?s.getPropertyValue(r):s[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return Vie(e,r)}build(e,r,n){A$(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return T$(e,r,n)}}const Yie=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"]);function HDe(t,e,r,n){Kie(t,e,void 0,n);for(const s in e.attrs)t.setAttribute(Yie.has(s)?s:P$(s),e.attrs[s])}class WDe extends Gie{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Gn}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(wb.has(r)){const n=bie(r);return n&&n.default||0}return r=Yie.has(r)?r:P$(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return Fie(e,r,n)}build(e,r,n){Rie(e,r,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,r,n,s){HDe(e,r,n,s)}mount(e){this.isSVGTag=Die(e.tagName),super.mount(e)}}const VDe=(t,e)=>C$(t)?new WDe(e):new zDe(e,{allowProjection:t!==S.Fragment});function Ly(t,e,r){const n=t.getProps();return k$(n,e,r!==void 0?r:n.custom,t)}const I4=t=>Array.isArray(t);function qDe(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,Sv(r))}function GDe(t){return I4(t)?t[t.length-1]||0:t}function KDe(t,e){const r=Ly(t,e);let{transitionEnd:n={},transition:s={},...i}=r||{};i={...i,...n};for(const o in i){const l=GDe(i[o]);qDe(t,o,l)}}function YDe(t){return!!(Qs(t)&&t.add)}function R4(t,e){const r=t.getValue("willChange");if(YDe(r))return r.add(e);if(!r&&Ju.WillChange){const n=new Ju.WillChange("auto");t.addValue("willChange",n),n.add(e)}}function Xie(t){return t.props[$ie]}const XDe=t=>t!==null;function QDe(t,{repeat:e,repeatType:r="loop"},n){const s=t.filter(XDe),i=e&&r!=="loop"&&e%2===1?0:s.length-1;return!i||n===void 0?s[i]:n}const ZDe={type:"spring",stiffness:500,damping:25,restSpeed:10},JDe=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),e4e={type:"keyframes",duration:.8},t4e={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},r4e=(t,{keyframes:e})=>e.length>2?e4e:wb.has(t)?t.startsWith("scale")?JDe(e[1]):ZDe:t4e;function n4e({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const O$=(t,e,r,n={},s,i)=>o=>{const l=b$(n,t)||{},c=l.delay||n.delay||0;let{elapsed:u=0}=n;u=u-pc(c);const d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-u,onUpdate:f=>{e.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:i?void 0:s};n4e(l)||Object.assign(d,r4e(t,d)),d.duration&&(d.duration=pc(d.duration)),d.repeatDelay&&(d.repeatDelay=pc(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(E4(d),d.delay===0&&(h=!0)),(Ju.instantAnimations||Ju.skipAnimations)&&(h=!0,E4(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,h&&!i&&e.get()!==void 0){const f=QDe(d.keyframes,l);if(f!==void 0){Zr.update(()=>{d.onUpdate(f),d.onComplete()});return}}return l.isSync?new x$(d):new kMe(d)};function s4e({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function Qie(t,e,{delay:r=0,transitionOverride:n,type:s}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:o,...l}=e;n&&(i=n);const c=[],u=s&&t.animationState&&t.animationState.getState()[s];for(const d in l){const h=t.getValue(d,t.latestValues[d]??null),f=l[d];if(f===void 0||u&&s4e(u,d))continue;const p={delay:r,...b$(i||{},d)},g=h.get();if(g!==void 0&&!h.isAnimating&&!Array.isArray(f)&&f===g&&!p.velocity)continue;let m=!1;if(window.MotionHandoffAnimation){const y=Xie(t);if(y){const v=window.MotionHandoffAnimation(y,d,Zr);v!==null&&(p.startTime=v,m=!0)}}R4(t,d),h.start(O$(d,h,f,t.shouldReduceMotion&&yie.has(d)?{type:!1}:p,t,m));const x=h.animation;x&&c.push(x)}return o&&Promise.all(c).then(()=>{Zr.update(()=>{o&&KDe(t,o)})}),c}function Zie(t,e,r,n=0,s=1){const i=Array.from(t).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),o=t.size,l=(o-1)*n;return typeof r=="function"?r(i,o):s===1?i*n:l-i*n}function M4(t,e,r={}){var c;const n=Ly(t,e,r.type==="exit"?(c=t.presenceContext)==null?void 0:c.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(s=r.transitionOverride);const i=n?()=>Promise.all(Qie(t,n,r)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:f}=s;return i4e(t,e,u,d,h,f,r)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,d]=l==="beforeChildren"?[i,o]:[o,i];return u().then(()=>d())}else return Promise.all([i(),o(r.delay)])}function i4e(t,e,r=0,n=0,s=0,i=1,o){const l=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),l.push(M4(c,e,{...o,delay:r+(typeof n=="function"?0:n)+Zie(t.variantChildren,c,n,s,i)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function a4e(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const s=e.map(i=>M4(t,i,r));n=Promise.all(s)}else if(typeof e=="string")n=M4(t,e,r);else{const s=typeof e=="function"?Ly(t,e,r.custom):e;n=Promise.all(Qie(t,s,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}function Jie(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}const o4e=N$.length;function eae(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?eae(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;r<o4e;r++){const n=N$[r],s=t.props[n];(a1(s)||s===!1)&&(e[n]=s)}return e}const l4e=[...S$].reverse(),c4e=S$.length;function u4e(t){return e=>Promise.all(e.map(({animation:r,options:n})=>a4e(t,r,n)))}function d4e(t){let e=u4e(t),r=oW(),n=!0;const s=c=>(u,d)=>{var f;const h=Ly(t,d,c==="exit"?(f=t.presenceContext)==null?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:g,...m}=h;u={...u,...m,...g}}return u};function i(c){e=c(t)}function o(c){const{props:u}=t,d=eae(t.parent)||{},h=[],f=new Set;let p={},g=1/0;for(let x=0;x<c4e;x++){const y=l4e[x],v=r[y],b=u[y]!==void 0?u[y]:d[y],w=a1(b),j=y===c?v.isActive:null;j===!1&&(g=x);let N=b===d[y]&&b!==u[y]&&w;if(N&&n&&t.manuallyAnimateOnMount&&(N=!1),v.protectedKeys={...p},!v.isActive&&j===null||!b&&!v.prevProp||zT(b)||typeof b=="boolean")continue;const C=h4e(v.prevProp,b);let k=C||y===c&&v.isActive&&!N&&w||x>g&&w,E=!1;const M=Array.isArray(b)?b:[b];let z=M.reduce(s(y),{});j===!1&&(z={});const{prevResolvedValues:P={}}=v,V={...P,...z},A=G=>{k=!0,f.has(G)&&(E=!0,f.delete(G)),v.needsAnimating[G]=!0;const Y=t.getValue(G);Y&&(Y.liveStyle=!1)};for(const G in V){const Y=z[G],H=P[G];if(p.hasOwnProperty(G))continue;let B=!1;I4(Y)&&I4(H)?B=!Jie(Y,H):B=Y!==H,B?Y!=null?A(G):f.add(G):Y!==void 0&&f.has(G)?A(G):v.protectedKeys[G]=!0}v.prevProp=b,v.prevResolvedValues=z,v.isActive&&(p={...p,...z}),n&&t.blockInitialAnimation&&(k=!1);const $=N&&C;k&&(!$||E)&&h.push(...M.map(G=>{const Y={type:y};if(typeof G=="string"&&n&&!$&&t.manuallyAnimateOnMount&&t.parent){const{parent:H}=t,B=Ly(H,G);if(H.enteringChildren&&B){const{delayChildren:L}=B.transition||{};Y.delay=Zie(H.enteringChildren,t,L)}}return{animation:G,options:Y}}))}if(f.size){const x={};if(typeof u.initial!="boolean"){const y=Ly(t,Array.isArray(u.initial)?u.initial[0]:u.initial);y&&y.transition&&(x.transition=y.transition)}f.forEach(y=>{const v=t.getBaseTarget(y),b=t.getValue(y);b&&(b.liveStyle=!0),x[y]=v??null}),h.push({animation:x})}let m=!!h.length;return n&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(m=!1),n=!1,m?e(h):Promise.resolve()}function l(c,u){var h;if(r[c].isActive===u)return Promise.resolve();(h=t.variantChildren)==null||h.forEach(f=>{var p;return(p=f.animationState)==null?void 0:p.setActive(c,u)}),r[c].isActive=u;const d=o(c);for(const f in r)r[f].protectedKeys={};return d}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>r,reset:()=>{r=oW()}}}function h4e(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Jie(e,t):!1}function If(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function oW(){return{animate:If(!0),whileInView:If(),whileHover:If(),whileTap:If(),whileDrag:If(),whileFocus:If(),exit:If()}}class vf{constructor(e){this.isMounted=!1,this.node=e}update(){}}class f4e extends vf{constructor(e){super(e),e.animationState||(e.animationState=d4e(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();zT(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let p4e=0;class m4e extends vf{constructor(){super(...arguments),this.id=p4e++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const s=this.node.animationState.setActive("exit",!e);r&&!e&&s.then(()=>{r(this.id)})}mount(){const{register:e,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const g4e={animation:{Feature:f4e},exit:{Feature:m4e}};function o1(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function rS(t){return{point:{x:t.pageX,y:t.pageY}}}const y4e=t=>e=>j$(e)&&t(e,rS(e));function vw(t,e,r,n){return o1(t,e,y4e(r),n)}const tae=1e-4,x4e=1-tae,v4e=1+tae,rae=.01,b4e=0-rae,w4e=0+rae;function xi(t){return t.max-t.min}function _4e(t,e,r){return Math.abs(t-e)<=r}function lW(t,e,r,n=.5){t.origin=n,t.originPoint=nn(e.min,e.max,t.origin),t.scale=xi(r)/xi(e),t.translate=nn(r.min,r.max,t.origin)-t.originPoint,(t.scale>=x4e&&t.scale<=v4e||isNaN(t.scale))&&(t.scale=1),(t.translate>=b4e&&t.translate<=w4e||isNaN(t.translate))&&(t.translate=0)}function bw(t,e,r,n){lW(t.x,e.x,r.x,n?n.originX:void 0),lW(t.y,e.y,r.y,n?n.originY:void 0)}function cW(t,e,r){t.min=r.min+e.min,t.max=t.min+xi(e)}function j4e(t,e,r){cW(t.x,e.x,r.x),cW(t.y,e.y,r.y)}function uW(t,e,r){t.min=e.min-r.min,t.max=t.min+xi(e)}function dC(t,e,r){uW(t.x,e.x,r.x),uW(t.y,e.y,r.y)}function Va(t){return[t("x"),t("y")]}const nae=({current:t})=>t?t.ownerDocument.defaultView:null,dW=(t,e)=>Math.abs(t-e);function S4e(t,e){const r=dW(t.x,e.x),n=dW(t.y,e.y);return Math.sqrt(r**2+n**2)}class sae{constructor(e,r,{transformPagePoint:n,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=IO(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=S4e(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!g)return;const{point:m}=f,{timestamp:x}=Ss;this.history.push({...m,timestamp:x});const{onStart:y,onMove:v}=this.handlers;p||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,f)},this.handlePointerMove=(f,p)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=OO(p,this.transformPagePoint),Zr.update(this.updatePoint,!0)},this.handlePointerUp=(f,p)=>{this.end();const{onEnd:g,onSessionEnd:m,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=IO(f.type==="pointercancel"?this.lastMoveEventInfo:OO(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(f,y),m&&m(f,y)},!j$(e))return;this.dragSnapToOrigin=i,this.handlers=r,this.transformPagePoint=n,this.distanceThreshold=o,this.contextWindow=s||window;const l=rS(e),c=OO(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=Ss;this.history=[{...u,timestamp:d}];const{onSessionStart:h}=r;h&&h(e,IO(c,this.history)),this.removeListeners=Jj(vw(this.contextWindow,"pointermove",this.handlePointerMove),vw(this.contextWindow,"pointerup",this.handlePointerUp),vw(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ef(this.updatePoint)}}function OO(t,e){return e?{point:e(t.point)}:t}function hW(t,e){return{x:t.x-e.x,y:t.y-e.y}}function IO({point:t},e){return{point:t,delta:hW(t,iae(e)),offset:hW(t,N4e(e)),velocity:A4e(e,.1)}}function N4e(t){return t[0]}function iae(t){return t[t.length-1]}function A4e(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const s=iae(t);for(;r>=0&&(n=t[r],!(s.timestamp-n.timestamp>pc(e)));)r--;if(!n)return{x:0,y:0};const i=uo(s.timestamp-n.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-n.x)/i,y:(s.y-n.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function E4e(t,{min:e,max:r},n){return e!==void 0&&t<e?t=n?nn(e,t,n.min):Math.max(t,e):r!==void 0&&t>r&&(t=n?nn(r,t,n.max):Math.min(t,r)),t}function fW(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function C4e(t,{top:e,left:r,bottom:n,right:s}){return{x:fW(t.x,r,s),y:fW(t.y,e,n)}}function pW(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.min<t.max-t.min&&([r,n]=[n,r]),{min:r,max:n}}function k4e(t,e){return{x:pW(t.x,e.x),y:pW(t.y,e.y)}}function T4e(t,e){let r=.5;const n=xi(t),s=xi(e);return s>n?r=n1(e.min,e.max-n,t.min):n>s&&(r=n1(t.min,t.max-s,e.min)),Zu(0,1,r)}function P4e(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const D4=.35;function O4e(t=D4){return t===!1?t=0:t===!0&&(t=D4),{x:mW(t,"left","right"),y:mW(t,"top","bottom")}}function mW(t,e,r){return{min:gW(t,e),max:gW(t,r)}}function gW(t,e){return typeof t=="number"?t:t[e]||0}const I4e=new WeakMap;class R4e{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Gn(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:r=!1,distanceThreshold:n}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=h=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(rS(h).point)},o=(h,f)=>{const{drag:p,dragPropagation:g,onDragStart:m}=this.getProps();if(p&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=VMe(p),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Va(y=>{let v=this.getAxisMotionValue(y).get()||0;if(mc.test(v)){const{projection:b}=this.visualElement;if(b&&b.layout){const w=b.layout.layoutBox[y];w&&(v=xi(w)*(parseFloat(v)/100))}}this.originPoint[y]=v}),m&&Zr.postRender(()=>m(h,f)),R4(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},l=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f;const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:m,onDrag:x}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:y}=f;if(g&&this.currentDirection===null){this.currentDirection=M4e(y),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),x&&x(h,f)},c=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f,this.stop(h,f),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>Va(h=>{var f;return this.getAnimationState(h)==="paused"&&((f=this.getAxisMotionValue(h).animation)==null?void 0:f.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new sae(e,{onSessionStart:i,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:n,contextWindow:nae(this.visualElement)})}stop(e,r){const n=e||this.latestPointerEvent,s=r||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!n)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&Zr.postRender(()=>l(n,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:s}=this.getProps();if(!n||!bN(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=E4e(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:e,dragElastic:r}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,s=this.constraints;e&&uy(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=C4e(n.layoutBox,e):this.constraints=!1,this.elastic=O4e(r),s!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&Va(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=P4e(n.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!uy(e))return!1;const n=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=DDe(n,s.root,this.visualElement.getTransformPagePoint());let o=k4e(s.layout.layoutBox,i);if(r){const l=r(IDe(o));this.hasMutatedConstraints=!!l,l&&(o=zie(l))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Va(d=>{if(!bN(d,r,this.currentDirection))return;let h=c&&c[d]||{};o&&(h={min:0,max:0});const f=s?200:1e6,p=s?40:1e7,g={type:"inertia",velocity:n?e[d]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return R4(this.visualElement,e),n.start(O$(e,n,0,r,this.visualElement,!1))}stopAnimation(){Va(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Va(e=>{var r;return(r=this.getAxisMotionValue(e).animation)==null?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)==null?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),s=n[r];return s||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){Va(r=>{const{drag:n}=this.getProps();if(!bN(r,n,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(r);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[r];i.set(e[r]-nn(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!uy(r)||!n||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Va(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=T4e({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),Va(o=>{if(!bN(o,e,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(nn(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;I4e.set(this.visualElement,this);const e=this.visualElement.current,r=vw(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),n=()=>{const{dragConstraints:c}=this.getProps();uy(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",n);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Zr.read(n);const o=o1(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Va(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=c[d].translate,h.set(h.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),r(),i(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=D4,dragMomentum:l=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function bN(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function M4e(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class D4e extends vf{constructor(e){super(e),this.removeGroupControls=yo,this.removeListeners=yo,this.controls=new R4e(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||yo}unmount(){this.removeGroupControls(),this.removeListeners()}}const yW=t=>(e,r)=>{t&&Zr.postRender(()=>t(e,r))};class L4e extends vf{constructor(){super(...arguments),this.removePointerDownListener=yo}onPointerDown(e){this.session=new sae(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:nae(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:s}=this.node.getProps();return{onSessionStart:yW(e),onStart:yW(r),onMove:n,onEnd:(i,o)=>{delete this.session,s&&Zr.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=vw(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const kA={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let RO=!1;class F4e extends S.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:s}=this.props,{projection:i}=e;i&&(r.group&&r.group.add(i),n&&n.register&&s&&n.register(i),RO&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),kA.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:s,isPresent:i}=this.props,{projection:o}=n;return o&&(o.isPresent=i,RO=!0,s||e.layoutDependency!==r||r===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||Zr.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),_$.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:s}=e;RO=!0,s&&(s.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(s),n&&n.deregister&&n.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function aae(t){const[e,r]=eDe(),n=S.useContext(Dse);return a.jsx(F4e,{...t,layoutGroup:n,switchLayoutGroup:S.useContext(Bie),isPresent:e,safeToRemove:r})}function $4e(t,e,r){const n=Qs(t)?t:Sv(t);return n.start(O$("",n,e,r)),n.animation}const B4e=(t,e)=>t.depth-e.depth;class U4e{constructor(){this.children=[],this.isDirty=!1}add(e){i$(this.children,e),this.isDirty=!0}remove(e){a$(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(B4e),this.isDirty=!1,this.children.forEach(e)}}function z4e(t,e){const r=zi.now(),n=({timestamp:s})=>{const i=s-r;i>=e&&(ef(n),t(i-e))};return Zr.setup(n,!0),()=>ef(n)}const oae=["TopLeft","TopRight","BottomLeft","BottomRight"],H4e=oae.length,xW=t=>typeof t=="string"?parseFloat(t):t,vW=t=>typeof t=="number"||_t.test(t);function W4e(t,e,r,n,s,i){s?(t.opacity=nn(0,r.opacity??1,V4e(n)),t.opacityExit=nn(e.opacity??1,0,q4e(n))):i&&(t.opacity=nn(e.opacity??1,r.opacity??1,n));for(let o=0;o<H4e;o++){const l=`border${oae[o]}Radius`;let c=bW(e,l),u=bW(r,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||vW(c)===vW(u)?(t[l]=Math.max(nn(xW(c),xW(u),n),0),(mc.test(u)||mc.test(c))&&(t[l]+="%")):t[l]=u}(e.rotate||r.rotate)&&(t.rotate=nn(e.rotate||0,r.rotate||0,n))}function bW(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const V4e=lae(0,.5,Gse),q4e=lae(.5,.95,yo);function lae(t,e,r){return n=>n<t?0:n>e?1:r(n1(t,e,n))}function wW(t,e){t.min=e.min,t.max=e.max}function To(t,e){wW(t.x,e.x),wW(t.y,e.y)}function _W(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function jW(t,e,r,n,s){return t-=e,t=uC(t,1/r,n),s!==void 0&&(t=uC(t,1/s,n)),t}function G4e(t,e=0,r=1,n=.5,s,i=t,o=t){if(mc.test(e)&&(e=parseFloat(e),e=nn(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=nn(i.min,i.max,n);t===i&&(l-=e),t.min=jW(t.min,e,r,l,s),t.max=jW(t.max,e,r,l,s)}function SW(t,e,[r,n,s],i,o){G4e(t,e[r],e[n],e[s],e.scale,i,o)}const K4e=["x","scaleX","originX"],Y4e=["y","scaleY","originY"];function NW(t,e,r,n){SW(t.x,e,K4e,r?r.x:void 0,n?n.x:void 0),SW(t.y,e,Y4e,r?r.y:void 0,n?n.y:void 0)}function AW(t){return t.translate===0&&t.scale===1}function cae(t){return AW(t.x)&&AW(t.y)}function EW(t,e){return t.min===e.min&&t.max===e.max}function X4e(t,e){return EW(t.x,e.x)&&EW(t.y,e.y)}function CW(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function uae(t,e){return CW(t.x,e.x)&&CW(t.y,e.y)}function kW(t){return xi(t.x)/xi(t.y)}function TW(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Q4e{constructor(){this.members=[]}add(e){i$(this.members,e),e.scheduleRender()}remove(e){if(a$(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(s=>e===s);if(r===0)return!1;let n;for(let s=r;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){n=i;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Z4e(t,e,r){let n="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((s||i||o)&&(n=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:u,rotate:d,rotateX:h,rotateY:f,skewX:p,skewY:g}=r;u&&(n=`perspective(${u}px) ${n}`),d&&(n+=`rotate(${d}deg) `),h&&(n+=`rotateX(${h}deg) `),f&&(n+=`rotateY(${f}deg) `),p&&(n+=`skewX(${p}deg) `),g&&(n+=`skewY(${g}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(n+=`scale(${l}, ${c})`),n||"none"}const MO=["","X","Y","Z"],J4e=1e3;let eLe=0;function DO(t,e,r,n){const{latestValues:s}=e;s[t]&&(r[t]=s[t],e.setStaticValue(t,0),n&&(n[t]=0))}function dae(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=Xie(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Zr,!(s||i))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&dae(n)}function hae({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=eLe++,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(nLe),this.nodes.forEach(oLe),this.nodes.forEach(lLe),this.nodes.forEach(sLe)},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 c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new U4e)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new l$),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=Eie(o)&&!QMe(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),t){let d,h=0;const f=()=>this.root.updateBlockedByResize=!1;Zr.read(()=>{h=window.innerWidth}),t(o,()=>{const p=window.innerWidth;p!==h&&(h=p,this.root.updateBlockedByResize=!0,d&&d(),d=z4e(f,250),kA.hasAnimatedSinceResize&&(kA.hasAnimatedSinceResize=!1,this.nodes.forEach(IW)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:h,hasRelativeLayoutChanged:f,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||fLe,{onLayoutAnimationStart:m,onLayoutAnimationComplete:x}=u.getProps(),y=!this.targetLayout||!uae(this.targetLayout,p),v=!h&&f;if(this.options.layoutRoot||this.resumeFrom||v||h&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const b={...b$(g,"layout"),onPlay:m,onComplete:x};(u.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b),this.setAnimationOrigin(d,v)}else h||IW(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}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(),ef(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(cLe),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&&dae(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const h=this.path[d];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(PW);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(OW);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(aLe),this.nodes.forEach(tLe),this.nodes.forEach(rLe)):this.nodes.forEach(OW),this.clearAllSnapshots();const l=zi.now();Ss.delta=Zu(0,1e3/60,l-Ss.timestamp),Ss.timestamp=l,Ss.isProcessing=!0,SO.update.process(Ss),SO.preRender.process(Ss),SO.render.process(Ss),Ss.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,_$.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(iLe),this.sharedNodes.forEach(uLe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Zr.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Zr.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!xi(this.snapshot.measuredBox.x)&&!xi(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 c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Gn(),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 c=n(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!cae(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||Wf(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),pLe(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return Gn();const l=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(mLe))){const{scroll:d}=this.root;d&&(dy(l.x,d.offset.x),dy(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=Gn();if(To(l,o),(c=this.scroll)!=null&&c.wasRoot)return l;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:h,options:f}=d;d!==this.root&&h&&f.layoutScroll&&(h.wasRoot&&To(l,o),dy(l.x,h.offset.x),dy(l.y,h.offset.y))}return l}applyTransform(o,l=!1){const c=Gn();To(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&hy(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Wf(d.latestValues)&&hy(c,d.latestValues)}return Wf(this.latestValues)&&hy(c,this.latestValues),c}removeTransform(o){const l=Gn();To(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Wf(u.latestValues))continue;T4(u.latestValues)&&u.updateSnapshot();const d=Gn(),h=u.measurePageBox();To(d,h),NW(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Wf(this.latestValues)&&NW(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!==Ss.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var p;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:h}=this.options;if(!this.layout||!(d||h))return;this.resolvedRelativeTargetAt=Ss.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Gn(),this.targetWithTransforms=Gn()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),j4e(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):To(this.target,this.layout.layoutBox),Wie(this.target,this.targetDelta)):To(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||T4(this.parent.latestValues)||Hie(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,c){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Gn(),this.relativeTargetOrigin=Gn(),dC(this.relativeTargetOrigin,l,c),To(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var g;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(g=this.parent)!=null&&g.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Ss.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;To(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,f=this.treeScale.y;MDe(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=Gn());const{target:p}=o;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(_W(this.prevProjectionDelta.x,this.projectionDelta.x),_W(this.prevProjectionDelta.y,this.projectionDelta.y)),bw(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==f||!TW(this.projectionDelta.x,this.prevProjectionDelta.x)||!TW(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=fy(),this.projectionDelta=fy(),this.projectionDeltaWithTransform=fy()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},h=fy();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=Gn(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,m=p!==g,x=this.getStack(),y=!x||x.members.length<=1,v=!!(m&&!y&&this.options.crossfade===!0&&!this.path.some(hLe));this.animationProgress=0;let b;this.mixTargetDelta=w=>{const j=w/1e3;RW(h.x,o.x,j),RW(h.y,o.y,j),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(dC(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),dLe(this.relativeTarget,this.relativeTargetOrigin,f,j),b&&X4e(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=Gn()),To(b,this.relativeTarget)),m&&(this.animationValues=d,W4e(d,u,this.latestValues,j,v,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=j},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(ef(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Zr.update(()=>{kA.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Sv(0)),this.currentAnimation=$4e(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},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(J4e),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&fae(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Gn();const h=xi(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+h;const f=xi(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+f}To(l,c),hy(l,d),bw(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Q4e),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.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:c}={}){const u=this.getStack();u&&u.promote(this,c),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:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&DO("z",o,u,this.animationValues);for(let d=0;d<MO.length;d++)DO(`rotate${MO[d]}`,o,u,this.animationValues),DO(`skew${MO[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=CA(l==null?void 0:l.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=CA(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!Wf(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let h=Z4e(this.projectionDeltaWithTransform,this.treeScale,d);c&&(h=c(d,h)),o.transform=h;const{x:f,y:p}=this.projectionDelta;o.transformOrigin=`${f.origin*100}% ${p.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const g in k4){if(d[g]===void 0)continue;const{correct:m,applyTo:x,isCSSVariable:y}=k4[g],v=h==="none"?d[g]:m(d[g],u);if(x){const b=x.length;for(let w=0;w<b;w++)o[x[w]]=v}else y?this.options.visualElement.renderState.vars[g]=v:o[g]=v}this.options.layoutId&&(o.pointerEvents=u===this?CA(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(PW),this.root.sharedNodes.clear()}}}function tLe(t){t.updateLayout()}function rLe(t){var r;const e=((r=t.resumeFrom)==null?void 0:r.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=t.layout,{animationType:i}=t.options,o=e.source!==t.layout.source;i==="size"?Va(h=>{const f=o?e.measuredBox[h]:e.layoutBox[h],p=xi(f);f.min=n[h].min,f.max=f.min+p}):fae(i,e.layoutBox,n)&&Va(h=>{const f=o?e.measuredBox[h]:e.layoutBox[h],p=xi(n[h]);f.max=f.min+p,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+p)});const l=fy();bw(l,n,e.layoutBox);const c=fy();o?bw(c,t.applyTransform(s,!0),e.measuredBox):bw(c,n,e.layoutBox);const u=!cae(l);let d=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:p}=h;if(f&&p){const g=Gn();dC(g,e.layoutBox,f.layoutBox);const m=Gn();dC(m,n,p.layoutBox),uae(g,m)||(d=!0),h.options.layoutRoot&&(t.relativeTarget=m,t.relativeTargetOrigin=g,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function nLe(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function sLe(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function iLe(t){t.clearSnapshot()}function PW(t){t.clearMeasurements()}function OW(t){t.isLayoutDirty=!1}function aLe(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function IW(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function oLe(t){t.resolveTargetDelta()}function lLe(t){t.calcProjection()}function cLe(t){t.resetSkewAndRotation()}function uLe(t){t.removeLeadSnapshot()}function RW(t,e,r){t.translate=nn(e.translate,0,r),t.scale=nn(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function MW(t,e,r,n){t.min=nn(e.min,r.min,n),t.max=nn(e.max,r.max,n)}function dLe(t,e,r,n){MW(t.x,e.x,r.x,n),MW(t.y,e.y,r.y,n)}function hLe(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const fLe={duration:.45,ease:[.4,0,.1,1]},DW=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),LW=DW("applewebkit/")&&!DW("chrome/")?Math.round:yo;function FW(t){t.min=LW(t.min),t.max=LW(t.max)}function pLe(t){FW(t.x),FW(t.y)}function fae(t,e,r){return t==="position"||t==="preserve-aspect"&&!_4e(kW(e),kW(r),.2)}function mLe(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const gLe=hae({attachResizeListener:(t,e)=>o1(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),LO={current:void 0},pae=hae({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!LO.current){const t=new gLe({});t.mount(window),t.setOptions({layoutScroll:!0}),LO.current=t}return LO.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),yLe={pan:{Feature:L4e},drag:{Feature:D4e,ProjectionNode:pae,MeasureLayout:aae}};function $W(t,e,r){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover",r==="Start");const s="onHover"+r,i=n[s];i&&Zr.postRender(()=>i(e,rS(e)))}class xLe extends vf{mount(){const{current:e}=this.node;e&&(this.unmount=qMe(e,(r,n)=>($W(this.node,n,"Start"),s=>$W(this.node,s,"End"))))}unmount(){}}class vLe extends vf{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=Jj(o1(this.node.current,"focus",()=>this.onFocus()),o1(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function BW(t,e,r){const{props:n}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&n.whileTap&&t.animationState.setActive("whileTap",r==="Start");const s="onTap"+(r==="End"?"":r),i=n[s];i&&Zr.postRender(()=>i(e,rS(e)))}class bLe extends vf{mount(){const{current:e}=this.node;e&&(this.unmount=XMe(e,(r,n)=>(BW(this.node,n,"Start"),(s,{success:i})=>BW(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const L4=new WeakMap,FO=new WeakMap,wLe=t=>{const e=L4.get(t.target);e&&e(t)},_Le=t=>{t.forEach(wLe)};function jLe({root:t,...e}){const r=t||document;FO.has(r)||FO.set(r,{});const n=FO.get(r),s=JSON.stringify(e);return n[s]||(n[s]=new IntersectionObserver(_Le,{root:t,...e})),n[s]}function SLe(t,e,r){const n=jLe(e);return L4.set(t,r),n.observe(t),()=>{L4.delete(t),n.unobserve(t)}}const NLe={some:0,all:1};class ALe extends vf{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:s="some",once:i}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof s=="number"?s:NLe[s]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),f=u?d:h;f&&f(c)};return SLe(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(ELe(e,r))&&this.startObserver()}unmount(){}}function ELe({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const CLe={inView:{Feature:ALe},tap:{Feature:bLe},focus:{Feature:vLe},hover:{Feature:xLe}},kLe={layout:{ProjectionNode:pae,MeasureLayout:aae}},TLe={...g4e,...CLe,...yLe,...kLe},el=ODe(TLe,VDe),PLe={some:0,all:1};function OLe(t,e,{root:r,margin:n,amount:s="some"}={}){const i=_ie(t),o=new WeakMap,l=u=>{u.forEach(d=>{const h=o.get(d.target);if(d.isIntersecting!==!!h)if(d.isIntersecting){const f=e(d.target,d);typeof f=="function"?o.set(d.target,f):c.unobserve(d.target)}else typeof h=="function"&&(h(d),o.delete(d.target))})},c=new IntersectionObserver(l,{root:r,rootMargin:n,threshold:typeof s=="number"?s:PLe[s]});return i.forEach(u=>c.observe(u)),()=>c.disconnect()}function ILe(t,{root:e,margin:r,amount:n,once:s=!1,initial:i=!1}={}){const[o,l]=S.useState(i);return S.useEffect(()=>{if(!t.current||s&&o)return;const c=()=>(l(!0),s?void 0:()=>l(!1)),u={root:e&&e.current||void 0,margin:r,amount:n};return OLe(t.current,c,u)},[e,t,r,s,n]),o}const RLe=od("relative overflow-hidden rounded-full bg-secondary",{variants:{variant:{default:"bg-secondary",primary:"bg-primary/10",secondary:"bg-secondary",destructive:"bg-destructive/10",outline:"bg-accent border border-border",success:"bg-success/10",warning:"bg-warning/10"},size:{sm:"h-1.5",default:"h-2.5",lg:"h-3"}},defaultVariants:{variant:"default",size:"default"}}),MLe=od("h-full w-full flex-1 rounded-full transition-all duration-500 ease-out",{variants:{variant:{default:"bg-primary",primary:"bg-primary",secondary:"bg-foreground",destructive:"bg-destructive",outline:"bg-primary",success:"bg-success",warning:"bg-warning"}},defaultVariants:{variant:"default"}}),nS=S.forwardRef(({className:t,value:e=0,variant:r,size:n,showValue:s=!1,animated:i=!0,label:o,...l},c)=>{const u=Math.min(Math.max(e,0),100);return a.jsxs("div",{className:"space-y-2",children:[o&&a.jsx("div",{className:"text-sm text-foreground",children:o}),a.jsx(Mse,{ref:c,className:Ie(RLe({variant:r,size:n}),t),...l,children:a.jsx(rRe,{className:Ie(MLe({variant:r})),asChild:!0,children:a.jsx(el.div,{initial:{transform:"translateX(-100%)"},animate:{transform:`translateX(-${100-u}%)`},transition:{duration:i?1.2:0,ease:"easeInOut"}})})}),s&&a.jsxs(el.div,{className:"text-right text-xs font-semibold text-muted-foreground tabular-nums",initial:{opacity:0,y:-5},animate:{opacity:1,y:0},transition:{delay:i?.3:0,duration:.2},children:[Math.round(u),"%"]})]})});nS.displayName=Mse.displayName;function DLe({stats:t}){const e=gr();if(!(t!=null&&t.active_thesis_id))return a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Timeline"})}),a.jsxs(Be,{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No thesis created yet. Create one to track your deadline."}),a.jsx(ye,{size:"sm",variant:"outline",onClick:()=>e("/thesis-manager"),children:"Go to My Thesis"})]})]});if(!(t!=null&&t.active_thesis_due_date))return a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Timeline"})}),a.jsxs(Be,{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No deadline set. Add one in your thesis."}),a.jsx(ye,{size:"sm",variant:"outline",onClick:()=>e("/thesis-manager"),children:"Go to My Thesis"})]})]});const r=new Date(t.active_thesis_due_date),n=new Date,s=t.active_thesis_created_at?new Date(t.active_thesis_created_at):new Date(n.getTime()-180*24*60*60*1e3),i=dO(r,s),o=dO(n,s),l=dO(r,n),c=i>0?Math.min(100,Math.max(0,o/i*100)):100,u=t.active_thesis_target_words||15e3,d=t.total_word_count||0,h=Math.max(0,u-d),f=l>0?Math.ceil(h/l):0;let p="success";return l<7?p="destructive":l<30&&(p="warning"),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Timeline"})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Deadline"}),a.jsx("span",{className:"font-semibold",children:t1(r,"MMMM d, yyyy",{locale:$6})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"font-semibold",children:l>0?`${l} days remaining`:"Overdue"}),a.jsxs("span",{className:"text-muted-foreground",children:[Math.round(c),"%"]})]}),a.jsx(nS,{value:c,variant:p,size:"default",animated:!0})]})]}),h>0&&l>0&&a.jsx("div",{className:"pt-3 border-t",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"text-muted-foreground",children:"Recommended:"}),a.jsxs("span",{className:"font-semibold text-primary",children:["~",f," words/day"]})]})})]})]})}function LLe({stats:t}){const e=(t==null?void 0:t.total_word_count)||0,r=(t==null?void 0:t.active_thesis_target_words)||15e3,n=Math.min(100,e/r*100),s=Math.max(0,r-e);return a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{className:"flex items-center gap-2",children:"Writing Progress"})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Words written"}),a.jsx("span",{className:"font-semibold",children:e.toLocaleString()})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("span",{className:"font-semibold",children:[Math.round(n),"%"]}),a.jsxs("span",{className:"text-muted-foreground",children:["Goal: ",r.toLocaleString()," words"]})]}),a.jsx(nS,{value:n,variant:"primary",size:"default",animated:!0})]})]}),s>0&&a.jsx("div",{className:"pt-3 border-t",children:a.jsx("div",{className:"flex items-center gap-2 text-sm",children:a.jsxs("span",{className:"text-muted-foreground",children:[s.toLocaleString()," words remaining to reach goal"]})})})]})]})}function FLe({stats:t}){const e=gr();return((t==null?void 0:t.total_codebooks)||0)>0||((t==null?void 0:t.total_interviews)||0)>0||((t==null?void 0:t.total_codings)||0)>0?a.jsxs(Me,{className:"h-full",children:[a.jsx(qe,{className:"pb-3",children:a.jsx(Je,{className:"flex items-center gap-2 text-base",children:"Qualitative Analysis"})}),a.jsx(Be,{className:"space-y-3",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(VJ,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Codebooks"})]}),a.jsx("span",{className:"font-semibold",children:(t==null?void 0:t.total_codebooks)||0})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Vm,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Interviews"})]}),a.jsx("span",{className:"font-semibold",children:(t==null?void 0:t.total_interviews)||0})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(DE,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Coded Segments"})]}),a.jsx("span",{className:"font-semibold",children:(t==null?void 0:t.total_codings)||0})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Hm,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Analyses"})]}),a.jsx("span",{className:"font-semibold",children:(t==null?void 0:t.total_analyses)||0})]})]})})]}):a.jsxs(Me,{className:"h-full",children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"flex items-center gap-2 text-base",children:[a.jsx(DE,{className:"h-5 w-5 text-primary"}),"Qualitative Analysis"]})}),a.jsxs(Be,{children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"No qualitative data yet"}),a.jsx(ye,{variant:"outline",size:"sm",className:"w-full",onClick:()=>e("/qualitative"),children:"Start Analysis"})]})]})}var $Le=Array.isArray,ta=$Le,BLe=typeof Wr=="object"&&Wr&&Wr.Object===Object&&Wr,mae=BLe,ULe=mae,zLe=typeof self=="object"&&self&&self.Object===Object&&self,HLe=ULe||zLe||Function("return this")(),kc=HLe,WLe=kc,VLe=WLe.Symbol,sS=VLe,UW=sS,gae=Object.prototype,qLe=gae.hasOwnProperty,GLe=gae.toString,e0=UW?UW.toStringTag:void 0;function KLe(t){var e=qLe.call(t,e0),r=t[e0];try{t[e0]=void 0;var n=!0}catch{}var s=GLe.call(t);return n&&(e?t[e0]=r:delete t[e0]),s}var YLe=KLe,XLe=Object.prototype,QLe=XLe.toString;function ZLe(t){return QLe.call(t)}var JLe=ZLe,zW=sS,e5e=YLe,t5e=JLe,r5e="[object Null]",n5e="[object Undefined]",HW=zW?zW.toStringTag:void 0;function s5e(t){return t==null?t===void 0?n5e:r5e:HW&&HW in Object(t)?e5e(t):t5e(t)}var cd=s5e;function i5e(t){return t!=null&&typeof t=="object"}var ud=i5e,a5e=cd,o5e=ud,l5e="[object Symbol]";function c5e(t){return typeof t=="symbol"||o5e(t)&&a5e(t)==l5e}var _b=c5e,u5e=ta,d5e=_b,h5e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,f5e=/^\w*$/;function p5e(t,e){if(u5e(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||d5e(t)?!0:f5e.test(t)||!h5e.test(t)||e!=null&&t in Object(e)}var I$=p5e;function m5e(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var bf=m5e;const jb=qt(bf);var g5e=cd,y5e=bf,x5e="[object AsyncFunction]",v5e="[object Function]",b5e="[object GeneratorFunction]",w5e="[object Proxy]";function _5e(t){if(!y5e(t))return!1;var e=g5e(t);return e==v5e||e==b5e||e==x5e||e==w5e}var R$=_5e;const Ft=qt(R$);var j5e=kc,S5e=j5e["__core-js_shared__"],N5e=S5e,$O=N5e,WW=function(){var t=/[^.]+$/.exec($O&&$O.keys&&$O.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function A5e(t){return!!WW&&WW in t}var E5e=A5e,C5e=Function.prototype,k5e=C5e.toString;function T5e(t){if(t!=null){try{return k5e.call(t)}catch{}try{return t+""}catch{}}return""}var yae=T5e,P5e=R$,O5e=E5e,I5e=bf,R5e=yae,M5e=/[\\^$.*+?()[\]{}|]/g,D5e=/^\[object .+?Constructor\]$/,L5e=Function.prototype,F5e=Object.prototype,$5e=L5e.toString,B5e=F5e.hasOwnProperty,U5e=RegExp("^"+$5e.call(B5e).replace(M5e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function z5e(t){if(!I5e(t)||O5e(t))return!1;var e=P5e(t)?U5e:D5e;return e.test(R5e(t))}var H5e=z5e;function W5e(t,e){return t==null?void 0:t[e]}var V5e=W5e,q5e=H5e,G5e=V5e;function K5e(t,e){var r=G5e(t,e);return q5e(r)?r:void 0}var fg=K5e,Y5e=fg,X5e=Y5e(Object,"create"),WT=X5e,VW=WT;function Q5e(){this.__data__=VW?VW(null):{},this.size=0}var Z5e=Q5e;function J5e(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var e3e=J5e,t3e=WT,r3e="__lodash_hash_undefined__",n3e=Object.prototype,s3e=n3e.hasOwnProperty;function i3e(t){var e=this.__data__;if(t3e){var r=e[t];return r===r3e?void 0:r}return s3e.call(e,t)?e[t]:void 0}var a3e=i3e,o3e=WT,l3e=Object.prototype,c3e=l3e.hasOwnProperty;function u3e(t){var e=this.__data__;return o3e?e[t]!==void 0:c3e.call(e,t)}var d3e=u3e,h3e=WT,f3e="__lodash_hash_undefined__";function p3e(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=h3e&&e===void 0?f3e:e,this}var m3e=p3e,g3e=Z5e,y3e=e3e,x3e=a3e,v3e=d3e,b3e=m3e;function Sb(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Sb.prototype.clear=g3e;Sb.prototype.delete=y3e;Sb.prototype.get=x3e;Sb.prototype.has=v3e;Sb.prototype.set=b3e;var w3e=Sb;function _3e(){this.__data__=[],this.size=0}var j3e=_3e;function S3e(t,e){return t===e||t!==t&&e!==e}var M$=S3e,N3e=M$;function A3e(t,e){for(var r=t.length;r--;)if(N3e(t[r][0],e))return r;return-1}var VT=A3e,E3e=VT,C3e=Array.prototype,k3e=C3e.splice;function T3e(t){var e=this.__data__,r=E3e(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():k3e.call(e,r,1),--this.size,!0}var P3e=T3e,O3e=VT;function I3e(t){var e=this.__data__,r=O3e(e,t);return r<0?void 0:e[r][1]}var R3e=I3e,M3e=VT;function D3e(t){return M3e(this.__data__,t)>-1}var L3e=D3e,F3e=VT;function $3e(t,e){var r=this.__data__,n=F3e(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var B3e=$3e,U3e=j3e,z3e=P3e,H3e=R3e,W3e=L3e,V3e=B3e;function Nb(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Nb.prototype.clear=U3e;Nb.prototype.delete=z3e;Nb.prototype.get=H3e;Nb.prototype.has=W3e;Nb.prototype.set=V3e;var qT=Nb,q3e=fg,G3e=kc,K3e=q3e(G3e,"Map"),D$=K3e,qW=w3e,Y3e=qT,X3e=D$;function Q3e(){this.size=0,this.__data__={hash:new qW,map:new(X3e||Y3e),string:new qW}}var Z3e=Q3e;function J3e(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var eFe=J3e,tFe=eFe;function rFe(t,e){var r=t.__data__;return tFe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var GT=rFe,nFe=GT;function sFe(t){var e=nFe(this,t).delete(t);return this.size-=e?1:0,e}var iFe=sFe,aFe=GT;function oFe(t){return aFe(this,t).get(t)}var lFe=oFe,cFe=GT;function uFe(t){return cFe(this,t).has(t)}var dFe=uFe,hFe=GT;function fFe(t,e){var r=hFe(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var pFe=fFe,mFe=Z3e,gFe=iFe,yFe=lFe,xFe=dFe,vFe=pFe;function Ab(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ab.prototype.clear=mFe;Ab.prototype.delete=gFe;Ab.prototype.get=yFe;Ab.prototype.has=xFe;Ab.prototype.set=vFe;var L$=Ab,xae=L$,bFe="Expected a function";function F$(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(bFe);var r=function(){var n=arguments,s=e?e.apply(this,n):n[0],i=r.cache;if(i.has(s))return i.get(s);var o=t.apply(this,n);return r.cache=i.set(s,o)||i,o};return r.cache=new(F$.Cache||xae),r}F$.Cache=xae;var vae=F$;const wFe=qt(vae);var _Fe=vae,jFe=500;function SFe(t){var e=_Fe(t,function(n){return r.size===jFe&&r.clear(),n}),r=e.cache;return e}var NFe=SFe,AFe=NFe,EFe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,CFe=/\\(\\)?/g,kFe=AFe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(EFe,function(r,n,s,i){e.push(s?i.replace(CFe,"$1"):n||r)}),e}),TFe=kFe;function PFe(t,e){for(var r=-1,n=t==null?0:t.length,s=Array(n);++r<n;)s[r]=e(t[r],r,t);return s}var $$=PFe,GW=sS,OFe=$$,IFe=ta,RFe=_b,MFe=1/0,KW=GW?GW.prototype:void 0,YW=KW?KW.toString:void 0;function bae(t){if(typeof t=="string")return t;if(IFe(t))return OFe(t,bae)+"";if(RFe(t))return YW?YW.call(t):"";var e=t+"";return e=="0"&&1/t==-MFe?"-0":e}var DFe=bae,LFe=DFe;function FFe(t){return t==null?"":LFe(t)}var wae=FFe,$Fe=ta,BFe=I$,UFe=TFe,zFe=wae;function HFe(t,e){return $Fe(t)?t:BFe(t,e)?[t]:UFe(zFe(t))}var _ae=HFe,WFe=_b,VFe=1/0;function qFe(t){if(typeof t=="string"||WFe(t))return t;var e=t+"";return e=="0"&&1/t==-VFe?"-0":e}var KT=qFe,GFe=_ae,KFe=KT;function YFe(t,e){e=GFe(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[KFe(e[r++])];return r&&r==n?t:void 0}var B$=YFe,XFe=B$;function QFe(t,e,r){var n=t==null?void 0:XFe(t,e);return n===void 0?r:n}var jae=QFe;const cl=qt(jae);function ZFe(t){return t==null}var JFe=ZFe;const Qt=qt(JFe);var e6e=cd,t6e=ta,r6e=ud,n6e="[object String]";function s6e(t){return typeof t=="string"||!t6e(t)&&r6e(t)&&e6e(t)==n6e}var i6e=s6e;const iS=qt(i6e);var Sae={exports:{}},yr={};/**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var U$=Symbol.for("react.element"),z$=Symbol.for("react.portal"),YT=Symbol.for("react.fragment"),XT=Symbol.for("react.strict_mode"),QT=Symbol.for("react.profiler"),ZT=Symbol.for("react.provider"),JT=Symbol.for("react.context"),a6e=Symbol.for("react.server_context"),e2=Symbol.for("react.forward_ref"),t2=Symbol.for("react.suspense"),r2=Symbol.for("react.suspense_list"),n2=Symbol.for("react.memo"),s2=Symbol.for("react.lazy"),o6e=Symbol.for("react.offscreen"),Nae;Nae=Symbol.for("react.module.reference");function Ao(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case U$:switch(t=t.type,t){case YT:case QT:case XT:case t2:case r2:return t;default:switch(t=t&&t.$$typeof,t){case a6e:case JT:case e2:case s2:case n2:case ZT:return t;default:return e}}case z$:return e}}}yr.ContextConsumer=JT;yr.ContextProvider=ZT;yr.Element=U$;yr.ForwardRef=e2;yr.Fragment=YT;yr.Lazy=s2;yr.Memo=n2;yr.Portal=z$;yr.Profiler=QT;yr.StrictMode=XT;yr.Suspense=t2;yr.SuspenseList=r2;yr.isAsyncMode=function(){return!1};yr.isConcurrentMode=function(){return!1};yr.isContextConsumer=function(t){return Ao(t)===JT};yr.isContextProvider=function(t){return Ao(t)===ZT};yr.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===U$};yr.isForwardRef=function(t){return Ao(t)===e2};yr.isFragment=function(t){return Ao(t)===YT};yr.isLazy=function(t){return Ao(t)===s2};yr.isMemo=function(t){return Ao(t)===n2};yr.isPortal=function(t){return Ao(t)===z$};yr.isProfiler=function(t){return Ao(t)===QT};yr.isStrictMode=function(t){return Ao(t)===XT};yr.isSuspense=function(t){return Ao(t)===t2};yr.isSuspenseList=function(t){return Ao(t)===r2};yr.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===YT||t===QT||t===XT||t===t2||t===r2||t===o6e||typeof t=="object"&&t!==null&&(t.$$typeof===s2||t.$$typeof===n2||t.$$typeof===ZT||t.$$typeof===JT||t.$$typeof===e2||t.$$typeof===Nae||t.getModuleId!==void 0)};yr.typeOf=Ao;Sae.exports=yr;var l6e=Sae.exports,c6e=cd,u6e=ud,d6e="[object Number]";function h6e(t){return typeof t=="number"||u6e(t)&&c6e(t)==d6e}var Aae=h6e;const f6e=qt(Aae);var p6e=Aae;function m6e(t){return p6e(t)&&t!=+t}var g6e=m6e;const aS=qt(g6e);var ho=function(e){return e===0?0:e>0?1:-1},lp=function(e){return iS(e)&&e.indexOf("%")===e.length-1},rt=function(e){return f6e(e)&&!aS(e)},Qn=function(e){return rt(e)||iS(e)},y6e=0,i2=function(e){var r=++y6e;return"".concat(e||"").concat(r)},Hi=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!rt(e)&&!iS(e))return n;var i;if(lp(e)){var o=e.indexOf("%");i=r*parseFloat(e.slice(0,o))/100}else i=+e;return aS(i)&&(i=n),s&&i>r&&(i=r),i},Bg=function(e){if(!e)return null;var r=Object.keys(e);return r&&r.length?e[r[0]]:null},x6e=function(e){if(!Array.isArray(e))return!1;for(var r=e.length,n={},s=0;s<r;s++)if(!n[e[s]])n[e[s]]=!0;else return!0;return!1},XW=function(e,r){return rt(e)&&rt(r)?function(n){return e+n*(r-e)}:function(){return r}};function F4(t,e,r){return!t||!t.length?null:t.find(function(n){return n&&(typeof e=="function"?e(n):cl(n,e))===r})}function $4(t,e){for(var r in t)if({}.hasOwnProperty.call(t,r)&&(!{}.hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if({}.hasOwnProperty.call(e,n)&&!{}.hasOwnProperty.call(t,n))return!1;return!0}function B4(t){"@babel/helpers - typeof";return B4=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},B4(t)}var v6e=["viewBox","children"],b6e=["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"],QW=["points","pathLength"],BO={svg:v6e,polygon:QW,polyline:QW},H$=["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"],hC=function(e,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(S.isValidElement(e)&&(n=e.props),!jb(n))return null;var s={};return Object.keys(n).forEach(function(i){H$.includes(i)&&(s[i]=r||function(o){return n[i](n,o)})}),s},w6e=function(e,r,n){return function(s){return e(r,n,s),null}},a2=function(e,r,n){if(!jb(e)||B4(e)!=="object")return null;var s=null;return Object.keys(e).forEach(function(i){var o=e[i];H$.includes(i)&&typeof o=="function"&&(s||(s={}),s[i]=w6e(o,r,n))}),s},_6e=["children"],j6e=["children"];function ZW(t,e){if(t==null)return{};var r=S6e(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function S6e(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var JW={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Fu=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},e7=null,UO=null,W$=function t(e){if(e===e7&&Array.isArray(UO))return UO;var r=[];return S.Children.forEach(e,function(n){Qt(n)||(l6e.isFragment(n)?r=r.concat(t(n.props.children)):r.push(n))}),UO=r,e7=e,r};function gc(t,e){var r=[],n=[];return Array.isArray(e)?n=e.map(function(s){return Fu(s)}):n=[Fu(e)],W$(t).forEach(function(s){var i=cl(s,"type.displayName")||cl(s,"type.name");n.indexOf(i)!==-1&&r.push(s)}),r}function ro(t,e){var r=gc(t,e);return r&&r[0]}var t7=function(e){if(!e||!e.props)return!1;var r=e.props,n=r.width,s=r.height;return!(!rt(n)||n<=0||!rt(s)||s<=0)},N6e=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],A6e=function(e){return e&&e.type&&iS(e.type)&&N6e.indexOf(e.type)>=0},E6e=function(e,r,n,s){var i,o=(i=BO==null?void 0:BO[s])!==null&&i!==void 0?i:[];return r.startsWith("data-")||!Ft(e)&&(s&&o.includes(r)||b6e.includes(r))||n&&H$.includes(r)},Lt=function(e,r,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var s=e;if(S.isValidElement(e)&&(s=e.props),!jb(s))return null;var i={};return Object.keys(s).forEach(function(o){var l;E6e((l=s)===null||l===void 0?void 0:l[o],o,r,n)&&(i[o]=s[o])}),i},U4=function t(e,r){if(e===r)return!0;var n=S.Children.count(e);if(n!==S.Children.count(r))return!1;if(n===0)return!0;if(n===1)return r7(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var s=0;s<n;s++){var i=e[s],o=r[s];if(Array.isArray(i)||Array.isArray(o)){if(!t(i,o))return!1}else if(!r7(i,o))return!1}return!0},r7=function(e,r){if(Qt(e)&&Qt(r))return!0;if(!Qt(e)&&!Qt(r)){var n=e.props||{},s=n.children,i=ZW(n,_6e),o=r.props||{},l=o.children,c=ZW(o,j6e);return s&&l?$4(i,c)&&U4(s,l):!s&&!l?$4(i,c):!1}return!1},n7=function(e,r){var n=[],s={};return W$(e).forEach(function(i,o){if(A6e(i))n.push(i);else if(i){var l=Fu(i.type),c=r[l]||{},u=c.handler,d=c.once;if(u&&(!d||!s[l])){var h=u(i,l,o);n.push(h),s[l]=!0}}}),n},C6e=function(e){var r=e&&e.type;return r&&JW[r]?JW[r]:null},k6e=function(e,r){return W$(r).indexOf(e)},T6e=["children","width","height","viewBox","className","style","title","desc"];function z4(){return z4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},z4.apply(this,arguments)}function P6e(t,e){if(t==null)return{};var r=O6e(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function O6e(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function H4(t){var e=t.children,r=t.width,n=t.height,s=t.viewBox,i=t.className,o=t.style,l=t.title,c=t.desc,u=P6e(t,T6e),d=s||{width:r,height:n,x:0,y:0},h=Jt("recharts-surface",i);return me.createElement("svg",z4({},Lt(u,!0,"svg"),{className:h,width:r,height:n,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),me.createElement("title",null,l),me.createElement("desc",null,c),e)}var I6e=["children","className"];function W4(){return W4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},W4.apply(this,arguments)}function R6e(t,e){if(t==null)return{};var r=M6e(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function M6e(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var xn=me.forwardRef(function(t,e){var r=t.children,n=t.className,s=R6e(t,I6e),i=Jt("recharts-layer",n);return me.createElement("g",W4({className:i},Lt(s,!0),{ref:e}),r)}),$u=function(e,r){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i]};function D6e(t,e,r){var n=-1,s=t.length;e<0&&(e=-e>s?0:s+e),r=r>s?s:r,r<0&&(r+=s),s=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(s);++n<s;)i[n]=t[n+e];return i}var L6e=D6e,F6e=L6e;function $6e(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:F6e(t,e,r)}var B6e=$6e,U6e="\\ud800-\\udfff",z6e="\\u0300-\\u036f",H6e="\\ufe20-\\ufe2f",W6e="\\u20d0-\\u20ff",V6e=z6e+H6e+W6e,q6e="\\ufe0e\\ufe0f",G6e="\\u200d",K6e=RegExp("["+G6e+U6e+V6e+q6e+"]");function Y6e(t){return K6e.test(t)}var Eae=Y6e;function X6e(t){return t.split("")}var Q6e=X6e,Cae="\\ud800-\\udfff",Z6e="\\u0300-\\u036f",J6e="\\ufe20-\\ufe2f",e$e="\\u20d0-\\u20ff",t$e=Z6e+J6e+e$e,r$e="\\ufe0e\\ufe0f",n$e="["+Cae+"]",V4="["+t$e+"]",q4="\\ud83c[\\udffb-\\udfff]",s$e="(?:"+V4+"|"+q4+")",kae="[^"+Cae+"]",Tae="(?:\\ud83c[\\udde6-\\uddff]){2}",Pae="[\\ud800-\\udbff][\\udc00-\\udfff]",i$e="\\u200d",Oae=s$e+"?",Iae="["+r$e+"]?",a$e="(?:"+i$e+"(?:"+[kae,Tae,Pae].join("|")+")"+Iae+Oae+")*",o$e=Iae+Oae+a$e,l$e="(?:"+[kae+V4+"?",V4,Tae,Pae,n$e].join("|")+")",c$e=RegExp(q4+"(?="+q4+")|"+l$e+o$e,"g");function u$e(t){return t.match(c$e)||[]}var d$e=u$e,h$e=Q6e,f$e=Eae,p$e=d$e;function m$e(t){return f$e(t)?p$e(t):h$e(t)}var g$e=m$e,y$e=B6e,x$e=Eae,v$e=g$e,b$e=wae;function w$e(t){return function(e){e=b$e(e);var r=x$e(e)?v$e(e):void 0,n=r?r[0]:e.charAt(0),s=r?y$e(r,1).join(""):e.slice(1);return n[t]()+s}}var _$e=w$e,j$e=_$e,S$e=j$e("toUpperCase"),N$e=S$e;const o2=qt(N$e);function Pr(t){return function(){return t}}const Rae=Math.cos,fC=Math.sin,xl=Math.sqrt,pC=Math.PI,l2=2*pC,G4=Math.PI,K4=2*G4,Vf=1e-6,A$e=K4-Vf;function Mae(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function E$e(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Mae;const r=10**e;return function(n){this._+=n[0];for(let s=1,i=n.length;s<i;++s)this._+=Math.round(arguments[s]*r)/r+n[s]}}class C$e{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?Mae:E$e(e)}moveTo(e,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,r){this._append`L${this._x1=+e},${this._y1=+r}`}quadraticCurveTo(e,r,n,s){this._append`Q${+e},${+r},${this._x1=+n},${this._y1=+s}`}bezierCurveTo(e,r,n,s,i,o){this._append`C${+e},${+r},${+n},${+s},${this._x1=+i},${this._y1=+o}`}arcTo(e,r,n,s,i){if(e=+e,r=+r,n=+n,s=+s,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=n-e,u=s-r,d=o-e,h=l-r,f=d*d+h*h;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(f>Vf)if(!(Math.abs(h*c-u*d)>Vf)||!i)this._append`L${this._x1=e},${this._y1=r}`;else{let p=n-o,g=s-l,m=c*c+u*u,x=p*p+g*g,y=Math.sqrt(m),v=Math.sqrt(f),b=i*Math.tan((G4-Math.acos((m+f-x)/(2*y*v)))/2),w=b/v,j=b/y;Math.abs(w-1)>Vf&&this._append`L${e+w*d},${r+w*h}`,this._append`A${i},${i},0,0,${+(h*p>d*g)},${this._x1=e+j*c},${this._y1=r+j*u}`}}arc(e,r,n,s,i,o){if(e=+e,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(s),c=n*Math.sin(s),u=e+l,d=r+c,h=1^o,f=o?s-i:i-s;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Vf||Math.abs(this._y1-d)>Vf)&&this._append`L${u},${d}`,n&&(f<0&&(f=f%K4+K4),f>A$e?this._append`A${n},${n},0,1,${h},${e-l},${r-c}A${n},${n},0,1,${h},${this._x1=u},${this._y1=d}`:f>Vf&&this._append`A${n},${n},0,${+(f>=G4)},${h},${this._x1=e+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(e,r,n,s){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+s}h${-n}Z`}toString(){return this._}}function V$(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new C$e(e)}function q$(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Dae(t){this._context=t}Dae.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function c2(t){return new Dae(t)}function Lae(t){return t[0]}function Fae(t){return t[1]}function $ae(t,e){var r=Pr(!0),n=null,s=c2,i=null,o=V$(l);t=typeof t=="function"?t:t===void 0?Lae:Pr(t),e=typeof e=="function"?e:e===void 0?Fae:Pr(e);function l(c){var u,d=(c=q$(c)).length,h,f=!1,p;for(n==null&&(i=s(p=o())),u=0;u<=d;++u)!(u<d&&r(h=c[u],u,c))===f&&((f=!f)?i.lineStart():i.lineEnd()),f&&i.point(+t(h,u,c),+e(h,u,c));if(p)return i=null,p+""||null}return l.x=function(c){return arguments.length?(t=typeof c=="function"?c:Pr(+c),l):t},l.y=function(c){return arguments.length?(e=typeof c=="function"?c:Pr(+c),l):e},l.defined=function(c){return arguments.length?(r=typeof c=="function"?c:Pr(!!c),l):r},l.curve=function(c){return arguments.length?(s=c,n!=null&&(i=s(n)),l):s},l.context=function(c){return arguments.length?(c==null?n=i=null:i=s(n=c),l):n},l}function wN(t,e,r){var n=null,s=Pr(!0),i=null,o=c2,l=null,c=V$(u);t=typeof t=="function"?t:t===void 0?Lae:Pr(+t),e=typeof e=="function"?e:Pr(e===void 0?0:+e),r=typeof r=="function"?r:r===void 0?Fae:Pr(+r);function u(h){var f,p,g,m=(h=q$(h)).length,x,y=!1,v,b=new Array(m),w=new Array(m);for(i==null&&(l=o(v=c())),f=0;f<=m;++f){if(!(f<m&&s(x=h[f],f,h))===y)if(y=!y)p=f,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),g=f-1;g>=p;--g)l.point(b[g],w[g]);l.lineEnd(),l.areaEnd()}y&&(b[f]=+t(x,f,h),w[f]=+e(x,f,h),l.point(n?+n(x,f,h):b[f],r?+r(x,f,h):w[f]))}if(v)return l=null,v+""||null}function d(){return $ae().defined(s).curve(o).context(i)}return u.x=function(h){return arguments.length?(t=typeof h=="function"?h:Pr(+h),n=null,u):t},u.x0=function(h){return arguments.length?(t=typeof h=="function"?h:Pr(+h),u):t},u.x1=function(h){return arguments.length?(n=h==null?null:typeof h=="function"?h:Pr(+h),u):n},u.y=function(h){return arguments.length?(e=typeof h=="function"?h:Pr(+h),r=null,u):e},u.y0=function(h){return arguments.length?(e=typeof h=="function"?h:Pr(+h),u):e},u.y1=function(h){return arguments.length?(r=h==null?null:typeof h=="function"?h:Pr(+h),u):r},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(r)},u.lineX1=function(){return d().x(n).y(e)},u.defined=function(h){return arguments.length?(s=typeof h=="function"?h:Pr(!!h),u):s},u.curve=function(h){return arguments.length?(o=h,i!=null&&(l=o(i)),u):o},u.context=function(h){return arguments.length?(h==null?i=l=null:l=o(i=h),u):i},u}class Bae{constructor(e,r){this._context=e,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(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}function k$e(t){return new Bae(t,!0)}function T$e(t){return new Bae(t,!1)}const G$={draw(t,e){const r=xl(e/pC);t.moveTo(r,0),t.arc(0,0,r,0,l2)}},P$e={draw(t,e){const r=xl(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},Uae=xl(1/3),O$e=Uae*2,I$e={draw(t,e){const r=xl(e/O$e),n=r*Uae;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},R$e={draw(t,e){const r=xl(e),n=-r/2;t.rect(n,n,r,r)}},M$e=.8908130915292852,zae=fC(pC/10)/fC(7*pC/10),D$e=fC(l2/10)*zae,L$e=-Rae(l2/10)*zae,F$e={draw(t,e){const r=xl(e*M$e),n=D$e*r,s=L$e*r;t.moveTo(0,-r),t.lineTo(n,s);for(let i=1;i<5;++i){const o=l2*i/5,l=Rae(o),c=fC(o);t.lineTo(c*r,-l*r),t.lineTo(l*n-c*s,c*n+l*s)}t.closePath()}},zO=xl(3),$$e={draw(t,e){const r=-xl(e/(zO*3));t.moveTo(0,r*2),t.lineTo(-zO*r,-r),t.lineTo(zO*r,-r),t.closePath()}},Ba=-.5,Ua=xl(3)/2,Y4=1/xl(12),B$e=(Y4/2+1)*3,U$e={draw(t,e){const r=xl(e/B$e),n=r/2,s=r*Y4,i=n,o=r*Y4+r,l=-i,c=o;t.moveTo(n,s),t.lineTo(i,o),t.lineTo(l,c),t.lineTo(Ba*n-Ua*s,Ua*n+Ba*s),t.lineTo(Ba*i-Ua*o,Ua*i+Ba*o),t.lineTo(Ba*l-Ua*c,Ua*l+Ba*c),t.lineTo(Ba*n+Ua*s,Ba*s-Ua*n),t.lineTo(Ba*i+Ua*o,Ba*o-Ua*i),t.lineTo(Ba*l+Ua*c,Ba*c-Ua*l),t.closePath()}};function z$e(t,e){let r=null,n=V$(s);t=typeof t=="function"?t:Pr(t||G$),e=typeof e=="function"?e:Pr(e===void 0?64:+e);function s(){let i;if(r||(r=i=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),i)return r=null,i+""||null}return s.type=function(i){return arguments.length?(t=typeof i=="function"?i:Pr(i),s):t},s.size=function(i){return arguments.length?(e=typeof i=="function"?i:Pr(+i),s):e},s.context=function(i){return arguments.length?(r=i??null,s):r},s}function mC(){}function gC(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function Hae(t){this._context=t}Hae.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:gC(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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);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:gC(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function H$e(t){return new Hae(t)}function Wae(t){this._context=t}Wae.prototype={areaStart:mC,areaEnd:mC,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:gC(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function W$e(t){return new Wae(t)}function Vae(t){this._context=t}Vae.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(t,e){switch(t=+t,e=+e,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+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:gC(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function V$e(t){return new Vae(t)}function qae(t){this._context=t}qae.prototype={areaStart:mC,areaEnd:mC,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function q$e(t){return new qae(t)}function s7(t){return t<0?-1:1}function i7(t,e,r){var n=t._x1-t._x0,s=e-t._x1,i=(t._y1-t._y0)/(n||s<0&&-0),o=(r-t._y1)/(s||n<0&&-0),l=(i*s+o*n)/(n+s);return(s7(i)+s7(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function a7(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function HO(t,e,r){var n=t._x0,s=t._y0,i=t._x1,o=t._y1,l=(i-n)/3;t._context.bezierCurveTo(n+l,s+l*e,i-l,o-l*r,i,o)}function yC(t){this._context=t}yC.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:HO(this,this._t0,a7(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,HO(this,a7(this,r=i7(this,t,e)),r);break;default:HO(this,this._t0,r=i7(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function Gae(t){this._context=new Kae(t)}(Gae.prototype=Object.create(yC.prototype)).point=function(t,e){yC.prototype.point.call(this,e,t)};function Kae(t){this._context=t}Kae.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,s,i){this._context.bezierCurveTo(e,t,n,r,i,s)}};function G$e(t){return new yC(t)}function K$e(t){return new Gae(t)}function Yae(t){this._context=t}Yae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=o7(t),s=o7(e),i=0,o=1;o<r;++i,++o)this._context.bezierCurveTo(n[0][i],s[0][i],n[1][i],s[1][i],t[o],e[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function o7(t){var e,r=t.length-1,n,s=new Array(r),i=new Array(r),o=new Array(r);for(s[0]=0,i[0]=2,o[0]=t[0]+2*t[1],e=1;e<r-1;++e)s[e]=1,i[e]=4,o[e]=4*t[e]+2*t[e+1];for(s[r-1]=2,i[r-1]=7,o[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=s[e]/i[e-1],i[e]-=n,o[e]-=n*o[e-1];for(s[r-1]=o[r-1]/i[r-1],e=r-2;e>=0;--e)s[e]=(o[e]-s[e+1])/i[e];for(i[r-1]=(t[r]+s[r-1])/2,e=0;e<r-1;++e)i[e]=2*t[e+1]-s[e+1];return[s,i]}function Y$e(t){return new Yae(t)}function u2(t,e){this._context=t,this._t=e}u2.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}};function X$e(t){return new u2(t,.5)}function Q$e(t){return new u2(t,0)}function Z$e(t){return new u2(t,1)}function Av(t,e){if((o=t.length)>1)for(var r=1,n,s,i=t[e[0]],o,l=i.length;r<o;++r)for(s=i,i=t[e[r]],n=0;n<l;++n)i[n][1]+=i[n][0]=isNaN(s[n][1])?s[n][0]:s[n][1]}function X4(t){for(var e=t.length,r=new Array(e);--e>=0;)r[e]=e;return r}function J$e(t,e){return t[e]}function e8e(t){const e=[];return e.key=t,e}function t8e(){var t=Pr([]),e=X4,r=Av,n=J$e;function s(i){var o=Array.from(t.apply(this,arguments),e8e),l,c=o.length,u=-1,d;for(const h of i)for(l=0,++u;l<c;++l)(o[l][u]=[0,+n(h,o[l].key,u,i)]).data=h;for(l=0,d=q$(e(o));l<c;++l)o[d[l]].index=l;return r(o,d),o}return s.keys=function(i){return arguments.length?(t=typeof i=="function"?i:Pr(Array.from(i)),s):t},s.value=function(i){return arguments.length?(n=typeof i=="function"?i:Pr(+i),s):n},s.order=function(i){return arguments.length?(e=i==null?X4:typeof i=="function"?i:Pr(Array.from(i)),s):e},s.offset=function(i){return arguments.length?(r=i??Av,s):r},s}function r8e(t,e){if((n=t.length)>0){for(var r,n,s=0,i=t[0].length,o;s<i;++s){for(o=r=0;r<n;++r)o+=t[r][s][1]||0;if(o)for(r=0;r<n;++r)t[r][s][1]/=o}Av(t,e)}}function n8e(t,e){if((s=t.length)>0){for(var r=0,n=t[e[0]],s,i=n.length;r<i;++r){for(var o=0,l=0;o<s;++o)l+=t[o][r][1]||0;n[r][1]+=n[r][0]=-l/2}Av(t,e)}}function s8e(t,e){if(!(!((o=t.length)>0)||!((i=(s=t[e[0]]).length)>0))){for(var r=0,n=1,s,i,o;n<i;++n){for(var l=0,c=0,u=0;l<o;++l){for(var d=t[e[l]],h=d[n][1]||0,f=d[n-1][1]||0,p=(h-f)/2,g=0;g<l;++g){var m=t[e[g]],x=m[n][1]||0,y=m[n-1][1]||0;p+=x-y}c+=h,u+=p*h}s[n-1][1]+=s[n-1][0]=r,c&&(r-=u/c)}s[n-1][1]+=s[n-1][0]=r,Av(t,e)}}function l1(t){"@babel/helpers - typeof";return l1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l1(t)}var i8e=["type","size","sizeType"];function Q4(){return Q4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Q4.apply(this,arguments)}function l7(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function c7(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?l7(Object(r),!0).forEach(function(n){a8e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):l7(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function a8e(t,e,r){return e=o8e(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o8e(t){var e=l8e(t,"string");return l1(e)=="symbol"?e:e+""}function l8e(t,e){if(l1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(l1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function c8e(t,e){if(t==null)return{};var r=u8e(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function u8e(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var Xae={symbolCircle:G$,symbolCross:P$e,symbolDiamond:I$e,symbolSquare:R$e,symbolStar:F$e,symbolTriangle:$$e,symbolWye:U$e},d8e=Math.PI/180,h8e=function(e){var r="symbol".concat(o2(e));return Xae[r]||G$},f8e=function(e,r,n){if(r==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var s=18*d8e;return 1.25*e*e*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),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}},p8e=function(e,r){Xae["symbol".concat(o2(e))]=r},K$=function(e){var r=e.type,n=r===void 0?"circle":r,s=e.size,i=s===void 0?64:s,o=e.sizeType,l=o===void 0?"area":o,c=c8e(e,i8e),u=c7(c7({},c),{},{type:n,size:i,sizeType:l}),d=function(){var x=h8e(n),y=z$e().type(x).size(f8e(i,l,n));return y()},h=u.className,f=u.cx,p=u.cy,g=Lt(u,!0);return f===+f&&p===+p&&i===+i?me.createElement("path",Q4({},g,{className:Jt("recharts-symbols",h),transform:"translate(".concat(f,", ").concat(p,")"),d:d()})):null};K$.registerSymbol=p8e;function Ev(t){"@babel/helpers - typeof";return Ev=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ev(t)}function Z4(){return Z4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Z4.apply(this,arguments)}function u7(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function m8e(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?u7(Object(r),!0).forEach(function(n){c1(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u7(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function g8e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function y8e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Zae(n.key),n)}}function x8e(t,e,r){return e&&y8e(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function v8e(t,e,r){return e=xC(e),b8e(t,Qae()?Reflect.construct(e,r||[],xC(t).constructor):e.apply(t,r))}function b8e(t,e){if(e&&(Ev(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return w8e(t)}function w8e(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Qae(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Qae=function(){return!!t})()}function xC(t){return xC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},xC(t)}function _8e(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&J4(t,e)}function J4(t,e){return J4=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},J4(t,e)}function c1(t,e,r){return e=Zae(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zae(t){var e=j8e(t,"string");return Ev(e)=="symbol"?e:e+""}function j8e(t,e){if(Ev(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ev(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var za=32,Y$=function(t){function e(){return g8e(this,e),v8e(this,e,arguments)}return _8e(e,t),x8e(e,[{key:"renderIcon",value:function(n){var s=this.props.inactiveColor,i=za/2,o=za/6,l=za/3,c=n.inactive?s:n.color;if(n.type==="plainline")return me.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:i,x2:za,y2:i,className:"recharts-legend-icon"});if(n.type==="line")return me.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(i,"h").concat(l,`
A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(i,`
H`).concat(za,"M").concat(2*l,",").concat(i,`
A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(n.type==="rect")return me.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(za/8,"h").concat(za,"v").concat(za*3/4,"h").concat(-za,"z"),className:"recharts-legend-icon"});if(me.isValidElement(n.legendIcon)){var u=m8e({},n);return delete u.legendIcon,me.cloneElement(n.legendIcon,u)}return me.createElement(K$,{fill:c,cx:i,cy:i,size:za,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,s=this.props,i=s.payload,o=s.iconSize,l=s.layout,c=s.formatter,u=s.inactiveColor,d={x:0,y:0,width:za,height:za},h={display:l==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(p,g){var m=p.formatter||c,x=Jt(c1(c1({"recharts-legend-item":!0},"legend-item-".concat(g),!0),"inactive",p.inactive));if(p.type==="none")return null;var y=Ft(p.value)?null:p.value;$u(!Ft(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var v=p.inactive?u:p.color;return me.createElement("li",Z4({className:x,style:h,key:"legend-item-".concat(g)},a2(n.props,p,g)),me.createElement(H4,{width:o,height:o,viewBox:d,style:f},n.renderIcon(p)),me.createElement("span",{className:"recharts-legend-item-text",style:{color:v}},m?m(y,p,g):y))})}},{key:"render",value:function(){var n=this.props,s=n.payload,i=n.layout,o=n.align;if(!s||!s.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return me.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(S.PureComponent);c1(Y$,"displayName","Legend");c1(Y$,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var S8e=qT;function N8e(){this.__data__=new S8e,this.size=0}var A8e=N8e;function E8e(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var C8e=E8e;function k8e(t){return this.__data__.get(t)}var T8e=k8e;function P8e(t){return this.__data__.has(t)}var O8e=P8e,I8e=qT,R8e=D$,M8e=L$,D8e=200;function L8e(t,e){var r=this.__data__;if(r instanceof I8e){var n=r.__data__;if(!R8e||n.length<D8e-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new M8e(n)}return r.set(t,e),this.size=r.size,this}var F8e=L8e,$8e=qT,B8e=A8e,U8e=C8e,z8e=T8e,H8e=O8e,W8e=F8e;function Eb(t){var e=this.__data__=new $8e(t);this.size=e.size}Eb.prototype.clear=B8e;Eb.prototype.delete=U8e;Eb.prototype.get=z8e;Eb.prototype.has=H8e;Eb.prototype.set=W8e;var Jae=Eb,V8e="__lodash_hash_undefined__";function q8e(t){return this.__data__.set(t,V8e),this}var G8e=q8e;function K8e(t){return this.__data__.has(t)}var Y8e=K8e,X8e=L$,Q8e=G8e,Z8e=Y8e;function vC(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new X8e;++e<r;)this.add(t[e])}vC.prototype.add=vC.prototype.push=Q8e;vC.prototype.has=Z8e;var eoe=vC;function J8e(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var toe=J8e;function eBe(t,e){return t.has(e)}var roe=eBe,tBe=eoe,rBe=toe,nBe=roe,sBe=1,iBe=2;function aBe(t,e,r,n,s,i){var o=r&sBe,l=t.length,c=e.length;if(l!=c&&!(o&&c>l))return!1;var u=i.get(t),d=i.get(e);if(u&&d)return u==e&&d==t;var h=-1,f=!0,p=r&iBe?new tBe:void 0;for(i.set(t,e),i.set(e,t);++h<l;){var g=t[h],m=e[h];if(n)var x=o?n(m,g,h,e,t,i):n(g,m,h,t,e,i);if(x!==void 0){if(x)continue;f=!1;break}if(p){if(!rBe(e,function(y,v){if(!nBe(p,v)&&(g===y||s(g,y,r,n,i)))return p.push(v)})){f=!1;break}}else if(!(g===m||s(g,m,r,n,i))){f=!1;break}}return i.delete(t),i.delete(e),f}var noe=aBe,oBe=kc,lBe=oBe.Uint8Array,cBe=lBe;function uBe(t){var e=-1,r=Array(t.size);return t.forEach(function(n,s){r[++e]=[s,n]}),r}var dBe=uBe;function hBe(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var X$=hBe,d7=sS,h7=cBe,fBe=M$,pBe=noe,mBe=dBe,gBe=X$,yBe=1,xBe=2,vBe="[object Boolean]",bBe="[object Date]",wBe="[object Error]",_Be="[object Map]",jBe="[object Number]",SBe="[object RegExp]",NBe="[object Set]",ABe="[object String]",EBe="[object Symbol]",CBe="[object ArrayBuffer]",kBe="[object DataView]",f7=d7?d7.prototype:void 0,WO=f7?f7.valueOf:void 0;function TBe(t,e,r,n,s,i,o){switch(r){case kBe:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case CBe:return!(t.byteLength!=e.byteLength||!i(new h7(t),new h7(e)));case vBe:case bBe:case jBe:return fBe(+t,+e);case wBe:return t.name==e.name&&t.message==e.message;case SBe:case ABe:return t==e+"";case _Be:var l=mBe;case NBe:var c=n&yBe;if(l||(l=gBe),t.size!=e.size&&!c)return!1;var u=o.get(t);if(u)return u==e;n|=xBe,o.set(t,e);var d=pBe(l(t),l(e),n,s,i,o);return o.delete(t),d;case EBe:if(WO)return WO.call(t)==WO.call(e)}return!1}var PBe=TBe;function OBe(t,e){for(var r=-1,n=e.length,s=t.length;++r<n;)t[s+r]=e[r];return t}var soe=OBe,IBe=soe,RBe=ta;function MBe(t,e,r){var n=e(t);return RBe(t)?n:IBe(n,r(t))}var DBe=MBe;function LBe(t,e){for(var r=-1,n=t==null?0:t.length,s=0,i=[];++r<n;){var o=t[r];e(o,r,t)&&(i[s++]=o)}return i}var FBe=LBe;function $Be(){return[]}var BBe=$Be,UBe=FBe,zBe=BBe,HBe=Object.prototype,WBe=HBe.propertyIsEnumerable,p7=Object.getOwnPropertySymbols,VBe=p7?function(t){return t==null?[]:(t=Object(t),UBe(p7(t),function(e){return WBe.call(t,e)}))}:zBe,qBe=VBe;function GBe(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var KBe=GBe,YBe=cd,XBe=ud,QBe="[object Arguments]";function ZBe(t){return XBe(t)&&YBe(t)==QBe}var JBe=ZBe,m7=JBe,eUe=ud,ioe=Object.prototype,tUe=ioe.hasOwnProperty,rUe=ioe.propertyIsEnumerable,nUe=m7(function(){return arguments}())?m7:function(t){return eUe(t)&&tUe.call(t,"callee")&&!rUe.call(t,"callee")},Q$=nUe,bC={exports:{}};function sUe(){return!1}var iUe=sUe;bC.exports;(function(t,e){var r=kc,n=iUe,s=e&&!e.nodeType&&e,i=s&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===s,l=o?r.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||n;t.exports=u})(bC,bC.exports);var aoe=bC.exports,aUe=9007199254740991,oUe=/^(?:0|[1-9]\d*)$/;function lUe(t,e){var r=typeof t;return e=e??aUe,!!e&&(r=="number"||r!="symbol"&&oUe.test(t))&&t>-1&&t%1==0&&t<e}var Z$=lUe,cUe=9007199254740991;function uUe(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=cUe}var J$=uUe,dUe=cd,hUe=J$,fUe=ud,pUe="[object Arguments]",mUe="[object Array]",gUe="[object Boolean]",yUe="[object Date]",xUe="[object Error]",vUe="[object Function]",bUe="[object Map]",wUe="[object Number]",_Ue="[object Object]",jUe="[object RegExp]",SUe="[object Set]",NUe="[object String]",AUe="[object WeakMap]",EUe="[object ArrayBuffer]",CUe="[object DataView]",kUe="[object Float32Array]",TUe="[object Float64Array]",PUe="[object Int8Array]",OUe="[object Int16Array]",IUe="[object Int32Array]",RUe="[object Uint8Array]",MUe="[object Uint8ClampedArray]",DUe="[object Uint16Array]",LUe="[object Uint32Array]",zr={};zr[kUe]=zr[TUe]=zr[PUe]=zr[OUe]=zr[IUe]=zr[RUe]=zr[MUe]=zr[DUe]=zr[LUe]=!0;zr[pUe]=zr[mUe]=zr[EUe]=zr[gUe]=zr[CUe]=zr[yUe]=zr[xUe]=zr[vUe]=zr[bUe]=zr[wUe]=zr[_Ue]=zr[jUe]=zr[SUe]=zr[NUe]=zr[AUe]=!1;function FUe(t){return fUe(t)&&hUe(t.length)&&!!zr[dUe(t)]}var $Ue=FUe;function BUe(t){return function(e){return t(e)}}var ooe=BUe,wC={exports:{}};wC.exports;(function(t,e){var r=mae,n=e&&!e.nodeType&&e,s=n&&!0&&t&&!t.nodeType&&t,i=s&&s.exports===n,o=i&&r.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();t.exports=l})(wC,wC.exports);var UUe=wC.exports,zUe=$Ue,HUe=ooe,g7=UUe,y7=g7&&g7.isTypedArray,WUe=y7?HUe(y7):zUe,loe=WUe,VUe=KBe,qUe=Q$,GUe=ta,KUe=aoe,YUe=Z$,XUe=loe,QUe=Object.prototype,ZUe=QUe.hasOwnProperty;function JUe(t,e){var r=GUe(t),n=!r&&qUe(t),s=!r&&!n&&KUe(t),i=!r&&!n&&!s&&XUe(t),o=r||n||s||i,l=o?VUe(t.length,String):[],c=l.length;for(var u in t)(e||ZUe.call(t,u))&&!(o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||YUe(u,c)))&&l.push(u);return l}var eze=JUe,tze=Object.prototype;function rze(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||tze;return t===r}var nze=rze;function sze(t,e){return function(r){return t(e(r))}}var coe=sze,ize=coe,aze=ize(Object.keys,Object),oze=aze,lze=nze,cze=oze,uze=Object.prototype,dze=uze.hasOwnProperty;function hze(t){if(!lze(t))return cze(t);var e=[];for(var r in Object(t))dze.call(t,r)&&r!="constructor"&&e.push(r);return e}var fze=hze,pze=R$,mze=J$;function gze(t){return t!=null&&mze(t.length)&&!pze(t)}var d2=gze,yze=eze,xze=fze,vze=d2;function bze(t){return vze(t)?yze(t):xze(t)}var e8=bze,wze=DBe,_ze=qBe,jze=e8;function Sze(t){return wze(t,jze,_ze)}var Nze=Sze,x7=Nze,Aze=1,Eze=Object.prototype,Cze=Eze.hasOwnProperty;function kze(t,e,r,n,s,i){var o=r&Aze,l=x7(t),c=l.length,u=x7(e),d=u.length;if(c!=d&&!o)return!1;for(var h=c;h--;){var f=l[h];if(!(o?f in e:Cze.call(e,f)))return!1}var p=i.get(t),g=i.get(e);if(p&&g)return p==e&&g==t;var m=!0;i.set(t,e),i.set(e,t);for(var x=o;++h<c;){f=l[h];var y=t[f],v=e[f];if(n)var b=o?n(v,y,f,e,t,i):n(y,v,f,t,e,i);if(!(b===void 0?y===v||s(y,v,r,n,i):b)){m=!1;break}x||(x=f=="constructor")}if(m&&!x){var w=t.constructor,j=e.constructor;w!=j&&"constructor"in t&&"constructor"in e&&!(typeof w=="function"&&w instanceof w&&typeof j=="function"&&j instanceof j)&&(m=!1)}return i.delete(t),i.delete(e),m}var Tze=kze,Pze=fg,Oze=kc,Ize=Pze(Oze,"DataView"),Rze=Ize,Mze=fg,Dze=kc,Lze=Mze(Dze,"Promise"),Fze=Lze,$ze=fg,Bze=kc,Uze=$ze(Bze,"Set"),uoe=Uze,zze=fg,Hze=kc,Wze=zze(Hze,"WeakMap"),Vze=Wze,eL=Rze,tL=D$,rL=Fze,nL=uoe,sL=Vze,doe=cd,Cb=yae,v7="[object Map]",qze="[object Object]",b7="[object Promise]",w7="[object Set]",_7="[object WeakMap]",j7="[object DataView]",Gze=Cb(eL),Kze=Cb(tL),Yze=Cb(rL),Xze=Cb(nL),Qze=Cb(sL),qf=doe;(eL&&qf(new eL(new ArrayBuffer(1)))!=j7||tL&&qf(new tL)!=v7||rL&&qf(rL.resolve())!=b7||nL&&qf(new nL)!=w7||sL&&qf(new sL)!=_7)&&(qf=function(t){var e=doe(t),r=e==qze?t.constructor:void 0,n=r?Cb(r):"";if(n)switch(n){case Gze:return j7;case Kze:return v7;case Yze:return b7;case Xze:return w7;case Qze:return _7}return e});var Zze=qf,VO=Jae,Jze=noe,eHe=PBe,tHe=Tze,S7=Zze,N7=ta,A7=aoe,rHe=loe,nHe=1,E7="[object Arguments]",C7="[object Array]",_N="[object Object]",sHe=Object.prototype,k7=sHe.hasOwnProperty;function iHe(t,e,r,n,s,i){var o=N7(t),l=N7(e),c=o?C7:S7(t),u=l?C7:S7(e);c=c==E7?_N:c,u=u==E7?_N:u;var d=c==_N,h=u==_N,f=c==u;if(f&&A7(t)){if(!A7(e))return!1;o=!0,d=!1}if(f&&!d)return i||(i=new VO),o||rHe(t)?Jze(t,e,r,n,s,i):eHe(t,e,c,r,n,s,i);if(!(r&nHe)){var p=d&&k7.call(t,"__wrapped__"),g=h&&k7.call(e,"__wrapped__");if(p||g){var m=p?t.value():t,x=g?e.value():e;return i||(i=new VO),s(m,x,r,n,i)}}return f?(i||(i=new VO),tHe(t,e,r,n,s,i)):!1}var aHe=iHe,oHe=aHe,T7=ud;function hoe(t,e,r,n,s){return t===e?!0:t==null||e==null||!T7(t)&&!T7(e)?t!==t&&e!==e:oHe(t,e,r,n,hoe,s)}var t8=hoe,lHe=Jae,cHe=t8,uHe=1,dHe=2;function hHe(t,e,r,n){var s=r.length,i=s,o=!n;if(t==null)return!i;for(t=Object(t);s--;){var l=r[s];if(o&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++s<i;){l=r[s];var c=l[0],u=t[c],d=l[1];if(o&&l[2]){if(u===void 0&&!(c in t))return!1}else{var h=new lHe;if(n)var f=n(u,d,c,t,e,h);if(!(f===void 0?cHe(d,u,uHe|dHe,n,h):f))return!1}}return!0}var fHe=hHe,pHe=bf;function mHe(t){return t===t&&!pHe(t)}var foe=mHe,gHe=foe,yHe=e8;function xHe(t){for(var e=yHe(t),r=e.length;r--;){var n=e[r],s=t[n];e[r]=[n,s,gHe(s)]}return e}var vHe=xHe;function bHe(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var poe=bHe,wHe=fHe,_He=vHe,jHe=poe;function SHe(t){var e=_He(t);return e.length==1&&e[0][2]?jHe(e[0][0],e[0][1]):function(r){return r===t||wHe(r,t,e)}}var NHe=SHe;function AHe(t,e){return t!=null&&e in Object(t)}var EHe=AHe,CHe=_ae,kHe=Q$,THe=ta,PHe=Z$,OHe=J$,IHe=KT;function RHe(t,e,r){e=CHe(e,t);for(var n=-1,s=e.length,i=!1;++n<s;){var o=IHe(e[n]);if(!(i=t!=null&&r(t,o)))break;t=t[o]}return i||++n!=s?i:(s=t==null?0:t.length,!!s&&OHe(s)&&PHe(o,s)&&(THe(t)||kHe(t)))}var MHe=RHe,DHe=EHe,LHe=MHe;function FHe(t,e){return t!=null&&LHe(t,e,DHe)}var $He=FHe,BHe=t8,UHe=jae,zHe=$He,HHe=I$,WHe=foe,VHe=poe,qHe=KT,GHe=1,KHe=2;function YHe(t,e){return HHe(t)&&WHe(e)?VHe(qHe(t),e):function(r){var n=UHe(r,t);return n===void 0&&n===e?zHe(r,t):BHe(e,n,GHe|KHe)}}var XHe=YHe;function QHe(t){return t}var kb=QHe;function ZHe(t){return function(e){return e==null?void 0:e[t]}}var JHe=ZHe,e9e=B$;function t9e(t){return function(e){return e9e(e,t)}}var r9e=t9e,n9e=JHe,s9e=r9e,i9e=I$,a9e=KT;function o9e(t){return i9e(t)?n9e(a9e(t)):s9e(t)}var l9e=o9e,c9e=NHe,u9e=XHe,d9e=kb,h9e=ta,f9e=l9e;function p9e(t){return typeof t=="function"?t:t==null?d9e:typeof t=="object"?h9e(t)?u9e(t[0],t[1]):c9e(t):f9e(t)}var wf=p9e;function m9e(t,e,r,n){for(var s=t.length,i=r+(n?1:-1);n?i--:++i<s;)if(e(t[i],i,t))return i;return-1}var g9e=m9e;function y9e(t){return t!==t}var x9e=y9e;function v9e(t,e,r){for(var n=r-1,s=t.length;++n<s;)if(t[n]===e)return n;return-1}var b9e=v9e,w9e=g9e,_9e=x9e,j9e=b9e;function S9e(t,e,r){return e===e?j9e(t,e,r):w9e(t,_9e,r)}var N9e=S9e,A9e=N9e;function E9e(t,e){var r=t==null?0:t.length;return!!r&&A9e(t,e,0)>-1}var C9e=E9e;function k9e(t,e,r){for(var n=-1,s=t==null?0:t.length;++n<s;)if(r(e,t[n]))return!0;return!1}var T9e=k9e;function P9e(){}var O9e=P9e,qO=uoe,I9e=O9e,R9e=X$,M9e=1/0,D9e=qO&&1/R9e(new qO([,-0]))[1]==M9e?function(t){return new qO(t)}:I9e,L9e=D9e,F9e=eoe,$9e=C9e,B9e=T9e,U9e=roe,z9e=L9e,H9e=X$,W9e=200;function V9e(t,e,r){var n=-1,s=$9e,i=t.length,o=!0,l=[],c=l;if(r)o=!1,s=B9e;else if(i>=W9e){var u=e?null:z9e(t);if(u)return H9e(u);o=!1,s=U9e,c=new F9e}else c=e?[]:l;e:for(;++n<i;){var d=t[n],h=e?e(d):d;if(d=r||d!==0?d:0,o&&h===h){for(var f=c.length;f--;)if(c[f]===h)continue e;e&&c.push(h),l.push(d)}else s(c,h,r)||(c!==l&&c.push(h),l.push(d))}return l}var q9e=V9e,G9e=wf,K9e=q9e;function Y9e(t,e){return t&&t.length?K9e(t,G9e(e)):[]}var X9e=Y9e;const P7=qt(X9e);function moe(t,e,r){return e===!0?P7(t,r):Ft(e)?P7(t,e):t}function Cv(t){"@babel/helpers - typeof";return Cv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cv(t)}var Q9e=["ref"];function O7(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Rc(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?O7(Object(r),!0).forEach(function(n){h2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):O7(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Z9e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function I7(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yoe(n.key),n)}}function J9e(t,e,r){return e&&I7(t.prototype,e),r&&I7(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function eWe(t,e,r){return e=_C(e),tWe(t,goe()?Reflect.construct(e,r||[],_C(t).constructor):e.apply(t,r))}function tWe(t,e){if(e&&(Cv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rWe(t)}function rWe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function goe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(goe=function(){return!!t})()}function _C(t){return _C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},_C(t)}function nWe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&iL(t,e)}function iL(t,e){return iL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},iL(t,e)}function h2(t,e,r){return e=yoe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yoe(t){var e=sWe(t,"string");return Cv(e)=="symbol"?e:e+""}function sWe(t,e){if(Cv(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Cv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function iWe(t,e){if(t==null)return{};var r=aWe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function aWe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function oWe(t){return t.value}function lWe(t,e){if(me.isValidElement(t))return me.cloneElement(t,e);if(typeof t=="function")return me.createElement(t,e);e.ref;var r=iWe(e,Q9e);return me.createElement(Y$,r)}var R7=1,Fy=function(t){function e(){var r;Z9e(this,e);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=eWe(this,e,[].concat(s)),h2(r,"lastBoundingBox",{width:-1,height:-1}),r}return nWe(e,t),J9e(e,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();return n.height=this.wrapperNode.offsetHeight,n.width=this.wrapperNode.offsetWidth,n}return null}},{key:"updateBBox",value:function(){var n=this.props.onBBoxUpdate,s=this.getBBox();s?(Math.abs(s.width-this.lastBoundingBox.width)>R7||Math.abs(s.height-this.lastBoundingBox.height)>R7)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,n&&n(s)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Rc({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var s=this.props,i=s.layout,o=s.align,l=s.verticalAlign,c=s.margin,u=s.chartWidth,d=s.chartHeight,h,f;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&i==="vertical"){var p=this.getBBoxSnapshot();h={left:((u||0)-p.width)/2}}else h=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(l==="middle"){var g=this.getBBoxSnapshot();f={top:((d||0)-g.height)/2}}else f=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Rc(Rc({},h),f)}},{key:"render",value:function(){var n=this,s=this.props,i=s.content,o=s.width,l=s.height,c=s.wrapperStyle,u=s.payloadUniqBy,d=s.payload,h=Rc(Rc({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return me.createElement("div",{className:"recharts-legend-wrapper",style:h,ref:function(p){n.wrapperNode=p}},lWe(i,Rc(Rc({},this.props),{},{payload:moe(d,u,oWe)})))}}],[{key:"getWithHeight",value:function(n,s){var i=Rc(Rc({},this.defaultProps),n.props),o=i.layout;return o==="vertical"&&rt(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||s}:null}}])}(S.PureComponent);h2(Fy,"displayName","Legend");h2(Fy,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var M7=sS,cWe=Q$,uWe=ta,D7=M7?M7.isConcatSpreadable:void 0;function dWe(t){return uWe(t)||cWe(t)||!!(D7&&t&&t[D7])}var hWe=dWe,fWe=soe,pWe=hWe;function xoe(t,e,r,n,s){var i=-1,o=t.length;for(r||(r=pWe),s||(s=[]);++i<o;){var l=t[i];e>0&&r(l)?e>1?xoe(l,e-1,r,n,s):fWe(s,l):n||(s[s.length]=l)}return s}var voe=xoe;function mWe(t){return function(e,r,n){for(var s=-1,i=Object(e),o=n(e),l=o.length;l--;){var c=o[t?l:++s];if(r(i[c],c,i)===!1)break}return e}}var gWe=mWe,yWe=gWe,xWe=yWe(),vWe=xWe,bWe=vWe,wWe=e8;function _We(t,e){return t&&bWe(t,e,wWe)}var boe=_We,jWe=d2;function SWe(t,e){return function(r,n){if(r==null)return r;if(!jWe(r))return t(r,n);for(var s=r.length,i=e?s:-1,o=Object(r);(e?i--:++i<s)&&n(o[i],i,o)!==!1;);return r}}var NWe=SWe,AWe=boe,EWe=NWe,CWe=EWe(AWe),r8=CWe,kWe=r8,TWe=d2;function PWe(t,e){var r=-1,n=TWe(t)?Array(t.length):[];return kWe(t,function(s,i,o){n[++r]=e(s,i,o)}),n}var woe=PWe;function OWe(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var IWe=OWe,L7=_b;function RWe(t,e){if(t!==e){var r=t!==void 0,n=t===null,s=t===t,i=L7(t),o=e!==void 0,l=e===null,c=e===e,u=L7(e);if(!l&&!u&&!i&&t>e||i&&o&&c&&!l&&!u||n&&o&&c||!r&&c||!s)return 1;if(!n&&!i&&!u&&t<e||u&&r&&s&&!n&&!i||l&&r&&s||!o&&s||!c)return-1}return 0}var MWe=RWe,DWe=MWe;function LWe(t,e,r){for(var n=-1,s=t.criteria,i=e.criteria,o=s.length,l=r.length;++n<o;){var c=DWe(s[n],i[n]);if(c){if(n>=l)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return t.index-e.index}var FWe=LWe,GO=$$,$We=B$,BWe=wf,UWe=woe,zWe=IWe,HWe=ooe,WWe=FWe,VWe=kb,qWe=ta;function GWe(t,e,r){e.length?e=GO(e,function(i){return qWe(i)?function(o){return $We(o,i.length===1?i[0]:i)}:i}):e=[VWe];var n=-1;e=GO(e,HWe(BWe));var s=UWe(t,function(i,o,l){var c=GO(e,function(u){return u(i)});return{criteria:c,index:++n,value:i}});return zWe(s,function(i,o){return WWe(i,o,r)})}var KWe=GWe;function YWe(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var XWe=YWe,QWe=XWe,F7=Math.max;function ZWe(t,e,r){return e=F7(e===void 0?t.length-1:e,0),function(){for(var n=arguments,s=-1,i=F7(n.length-e,0),o=Array(i);++s<i;)o[s]=n[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=n[s];return l[e]=r(o),QWe(t,this,l)}}var JWe=ZWe;function e7e(t){return function(){return t}}var t7e=e7e,r7e=fg,n7e=function(){try{var t=r7e(Object,"defineProperty");return t({},"",{}),t}catch{}}(),_oe=n7e,s7e=t7e,$7=_oe,i7e=kb,a7e=$7?function(t,e){return $7(t,"toString",{configurable:!0,enumerable:!1,value:s7e(e),writable:!0})}:i7e,o7e=a7e,l7e=800,c7e=16,u7e=Date.now;function d7e(t){var e=0,r=0;return function(){var n=u7e(),s=c7e-(n-r);if(r=n,s>0){if(++e>=l7e)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var h7e=d7e,f7e=o7e,p7e=h7e,m7e=p7e(f7e),g7e=m7e,y7e=kb,x7e=JWe,v7e=g7e;function b7e(t,e){return v7e(x7e(t,e,y7e),t+"")}var w7e=b7e,_7e=M$,j7e=d2,S7e=Z$,N7e=bf;function A7e(t,e,r){if(!N7e(r))return!1;var n=typeof e;return(n=="number"?j7e(r)&&S7e(e,r.length):n=="string"&&e in r)?_7e(r[e],t):!1}var f2=A7e,E7e=voe,C7e=KWe,k7e=w7e,B7=f2,T7e=k7e(function(t,e){if(t==null)return[];var r=e.length;return r>1&&B7(t,e[0],e[1])?e=[]:r>2&&B7(e[0],e[1],e[2])&&(e=[e[0]]),C7e(t,E7e(e,1),[])}),P7e=T7e;const n8=qt(P7e);function u1(t){"@babel/helpers - typeof";return u1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u1(t)}function aL(){return aL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},aL.apply(this,arguments)}function O7e(t,e){return D7e(t)||M7e(t,e)||R7e(t,e)||I7e()}function I7e(){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 R7e(t,e){if(t){if(typeof t=="string")return U7(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return U7(t,e)}}function U7(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function M7e(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function D7e(t){if(Array.isArray(t))return t}function z7(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function KO(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?z7(Object(r),!0).forEach(function(n){L7e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):z7(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function L7e(t,e,r){return e=F7e(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function F7e(t){var e=$7e(t,"string");return u1(e)=="symbol"?e:e+""}function $7e(t,e){if(u1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(u1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function B7e(t){return Array.isArray(t)&&Qn(t[0])&&Qn(t[1])?t.join(" ~ "):t}var U7e=function(e){var r=e.separator,n=r===void 0?" : ":r,s=e.contentStyle,i=s===void 0?{}:s,o=e.itemStyle,l=o===void 0?{}:o,c=e.labelStyle,u=c===void 0?{}:c,d=e.payload,h=e.formatter,f=e.itemSorter,p=e.wrapperClassName,g=e.labelClassName,m=e.label,x=e.labelFormatter,y=e.accessibilityLayer,v=y===void 0?!1:y,b=function(){if(d&&d.length){var P={padding:0,margin:0},V=(f?n8(d,f):d).map(function(A,$){if(A.type==="none")return null;var K=KO({display:"block",paddingTop:4,paddingBottom:4,color:A.color||"#000"},l),G=A.formatter||h||B7e,Y=A.value,H=A.name,B=Y,L=H;if(G&&B!=null&&L!=null){var F=G(Y,H,A,$,d);if(Array.isArray(F)){var W=O7e(F,2);B=W[0],L=W[1]}else B=F}return me.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat($),style:K},Qn(L)?me.createElement("span",{className:"recharts-tooltip-item-name"},L):null,Qn(L)?me.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,me.createElement("span",{className:"recharts-tooltip-item-value"},B),me.createElement("span",{className:"recharts-tooltip-item-unit"},A.unit||""))});return me.createElement("ul",{className:"recharts-tooltip-item-list",style:P},V)}return null},w=KO({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),j=KO({margin:0},u),N=!Qt(m),C=N?m:"",k=Jt("recharts-default-tooltip",p),E=Jt("recharts-tooltip-label",g);N&&x&&d!==void 0&&d!==null&&(C=x(m,d));var M=v?{role:"status","aria-live":"assertive"}:{};return me.createElement("div",aL({className:k,style:w},M),me.createElement("p",{className:E,style:j},me.isValidElement(C)?C:"".concat(C)),b())};function d1(t){"@babel/helpers - typeof";return d1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d1(t)}function jN(t,e,r){return e=z7e(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function z7e(t){var e=H7e(t,"string");return d1(e)=="symbol"?e:e+""}function H7e(t,e){if(d1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(d1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var t0="recharts-tooltip-wrapper",W7e={visibility:"hidden"};function V7e(t){var e=t.coordinate,r=t.translateX,n=t.translateY;return Jt(t0,jN(jN(jN(jN({},"".concat(t0,"-right"),rt(r)&&e&&rt(e.x)&&r>=e.x),"".concat(t0,"-left"),rt(r)&&e&&rt(e.x)&&r<e.x),"".concat(t0,"-bottom"),rt(n)&&e&&rt(e.y)&&n>=e.y),"".concat(t0,"-top"),rt(n)&&e&&rt(e.y)&&n<e.y))}function H7(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.key,s=t.offsetTopLeft,i=t.position,o=t.reverseDirection,l=t.tooltipDimension,c=t.viewBox,u=t.viewBoxDimension;if(i&&rt(i[n]))return i[n];var d=r[n]-l-s,h=r[n]+s;if(e[n])return o[n]?d:h;if(o[n]){var f=d,p=c[n];return f<p?Math.max(h,c[n]):Math.max(d,c[n])}var g=h+l,m=c[n]+u;return g>m?Math.max(d,c[n]):Math.max(h,c[n])}function q7e(t){var e=t.translateX,r=t.translateY,n=t.useTranslate3d;return{transform:n?"translate3d(".concat(e,"px, ").concat(r,"px, 0)"):"translate(".concat(e,"px, ").concat(r,"px)")}}function G7e(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.offsetTopLeft,s=t.position,i=t.reverseDirection,o=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,u,d,h;return o.height>0&&o.width>0&&r?(d=H7({allowEscapeViewBox:e,coordinate:r,key:"x",offsetTopLeft:n,position:s,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),h=H7({allowEscapeViewBox:e,coordinate:r,key:"y",offsetTopLeft:n,position:s,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=q7e({translateX:d,translateY:h,useTranslate3d:l})):u=W7e,{cssProperties:u,cssClasses:V7e({translateX:d,translateY:h,coordinate:r})}}function kv(t){"@babel/helpers - typeof";return kv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kv(t)}function W7(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function V7(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?W7(Object(r),!0).forEach(function(n){lL(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):W7(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function K7e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Y7e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Soe(n.key),n)}}function X7e(t,e,r){return e&&Y7e(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Q7e(t,e,r){return e=jC(e),Z7e(t,joe()?Reflect.construct(e,r||[],jC(t).constructor):e.apply(t,r))}function Z7e(t,e){if(e&&(kv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return J7e(t)}function J7e(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function joe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(joe=function(){return!!t})()}function jC(t){return jC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},jC(t)}function eVe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&oL(t,e)}function oL(t,e){return oL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},oL(t,e)}function lL(t,e,r){return e=Soe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Soe(t){var e=tVe(t,"string");return kv(e)=="symbol"?e:e+""}function tVe(t,e){if(kv(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(kv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var q7=1,rVe=function(t){function e(){var r;K7e(this,e);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=Q7e(this,e,[].concat(s)),lL(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),lL(r,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,u,d;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=r.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(u=(d=r.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&u!==void 0?u:0}})}}),r}return eVe(e,t),X7e(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();(Math.abs(n.width-this.state.lastBoundingBox.width)>q7||Math.abs(n.height-this.state.lastBoundingBox.height)>q7)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.children,d=s.coordinate,h=s.hasPayload,f=s.isAnimationActive,p=s.offset,g=s.position,m=s.reverseDirection,x=s.useTranslate3d,y=s.viewBox,v=s.wrapperStyle,b=G7e({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:x,viewBox:y}),w=b.cssClasses,j=b.cssProperties,N=V7(V7({transition:f&&i?"transform ".concat(l,"ms ").concat(c):void 0},j),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&h?"visible":"hidden",position:"absolute",top:0,left:0},v);return me.createElement("div",{tabIndex:-1,className:w,style:N,ref:function(k){n.wrapperNode=k}},u)}}])}(S.PureComponent),nVe=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Im={isSsr:nVe(),get:function(e){return Im[e]},set:function(e,r){if(typeof e=="string")Im[e]=r;else{var n=Object.keys(e);n&&n.length&&n.forEach(function(s){Im[s]=e[s]})}}};function Tv(t){"@babel/helpers - typeof";return Tv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tv(t)}function G7(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function K7(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?G7(Object(r),!0).forEach(function(n){s8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):G7(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function sVe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iVe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Aoe(n.key),n)}}function aVe(t,e,r){return e&&iVe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function oVe(t,e,r){return e=SC(e),lVe(t,Noe()?Reflect.construct(e,r||[],SC(t).constructor):e.apply(t,r))}function lVe(t,e){if(e&&(Tv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cVe(t)}function cVe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Noe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Noe=function(){return!!t})()}function SC(t){return SC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},SC(t)}function uVe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cL(t,e)}function cL(t,e){return cL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},cL(t,e)}function s8(t,e,r){return e=Aoe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Aoe(t){var e=dVe(t,"string");return Tv(e)=="symbol"?e:e+""}function dVe(t,e){if(Tv(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Tv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hVe(t){return t.dataKey}function fVe(t,e){return me.isValidElement(t)?me.cloneElement(t,e):typeof t=="function"?me.createElement(t,e):me.createElement(U7e,e)}var qc=function(t){function e(){return sVe(this,e),oVe(this,e,arguments)}return uVe(e,t),aVe(e,[{key:"render",value:function(){var n=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.content,d=s.coordinate,h=s.filterNull,f=s.isAnimationActive,p=s.offset,g=s.payload,m=s.payloadUniqBy,x=s.position,y=s.reverseDirection,v=s.useTranslate3d,b=s.viewBox,w=s.wrapperStyle,j=g??[];h&&j.length&&(j=moe(g.filter(function(C){return C.value!=null&&(C.hide!==!0||n.props.includeHidden)}),m,hVe));var N=j.length>0;return me.createElement(rVe,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:f,active:i,coordinate:d,hasPayload:N,offset:p,position:x,reverseDirection:y,useTranslate3d:v,viewBox:b,wrapperStyle:w},fVe(u,K7(K7({},this.props),{},{payload:j})))}}])}(S.PureComponent);s8(qc,"displayName","Tooltip");s8(qc,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Im.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var pVe=kc,mVe=function(){return pVe.Date.now()},gVe=mVe,yVe=/\s/;function xVe(t){for(var e=t.length;e--&&yVe.test(t.charAt(e)););return e}var vVe=xVe,bVe=vVe,wVe=/^\s+/;function _Ve(t){return t&&t.slice(0,bVe(t)+1).replace(wVe,"")}var jVe=_Ve,SVe=jVe,Y7=bf,NVe=_b,X7=NaN,AVe=/^[-+]0x[0-9a-f]+$/i,EVe=/^0b[01]+$/i,CVe=/^0o[0-7]+$/i,kVe=parseInt;function TVe(t){if(typeof t=="number")return t;if(NVe(t))return X7;if(Y7(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Y7(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=SVe(t);var r=EVe.test(t);return r||CVe.test(t)?kVe(t.slice(2),r?2:8):AVe.test(t)?X7:+t}var Eoe=TVe,PVe=bf,YO=gVe,Q7=Eoe,OVe="Expected a function",IVe=Math.max,RVe=Math.min;function MVe(t,e,r){var n,s,i,o,l,c,u=0,d=!1,h=!1,f=!0;if(typeof t!="function")throw new TypeError(OVe);e=Q7(e)||0,PVe(r)&&(d=!!r.leading,h="maxWait"in r,i=h?IVe(Q7(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(N){var C=n,k=s;return n=s=void 0,u=N,o=t.apply(k,C),o}function g(N){return u=N,l=setTimeout(y,e),d?p(N):o}function m(N){var C=N-c,k=N-u,E=e-C;return h?RVe(E,i-k):E}function x(N){var C=N-c,k=N-u;return c===void 0||C>=e||C<0||h&&k>=i}function y(){var N=YO();if(x(N))return v(N);l=setTimeout(y,m(N))}function v(N){return l=void 0,f&&n?p(N):(n=s=void 0,o)}function b(){l!==void 0&&clearTimeout(l),u=0,n=c=s=l=void 0}function w(){return l===void 0?o:v(YO())}function j(){var N=YO(),C=x(N);if(n=arguments,s=this,c=N,C){if(l===void 0)return g(c);if(h)return clearTimeout(l),l=setTimeout(y,e),p(c)}return l===void 0&&(l=setTimeout(y,e)),o}return j.cancel=b,j.flush=w,j}var DVe=MVe,LVe=DVe,FVe=bf,$Ve="Expected a function";function BVe(t,e,r){var n=!0,s=!0;if(typeof t!="function")throw new TypeError($Ve);return FVe(r)&&(n="leading"in r?!!r.leading:n,s="trailing"in r?!!r.trailing:s),LVe(t,e,{leading:n,maxWait:e,trailing:s})}var UVe=BVe;const Coe=qt(UVe);function h1(t){"@babel/helpers - typeof";return h1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h1(t)}function Z7(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function SN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Z7(Object(r),!0).forEach(function(n){zVe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Z7(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function zVe(t,e,r){return e=HVe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function HVe(t){var e=WVe(t,"string");return h1(e)=="symbol"?e:e+""}function WVe(t,e){if(h1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(h1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function VVe(t,e){return YVe(t)||KVe(t,e)||GVe(t,e)||qVe()}function qVe(){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 GVe(t,e){if(t){if(typeof t=="string")return J7(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return J7(t,e)}}function J7(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function KVe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function YVe(t){if(Array.isArray(t))return t}var koe=S.forwardRef(function(t,e){var r=t.aspect,n=t.initialDimension,s=n===void 0?{width:-1,height:-1}:n,i=t.width,o=i===void 0?"100%":i,l=t.height,c=l===void 0?"100%":l,u=t.minWidth,d=u===void 0?0:u,h=t.minHeight,f=t.maxHeight,p=t.children,g=t.debounce,m=g===void 0?0:g,x=t.id,y=t.className,v=t.onResize,b=t.style,w=b===void 0?{}:b,j=S.useRef(null),N=S.useRef();N.current=v,S.useImperativeHandle(e,function(){return Object.defineProperty(j.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),j.current},configurable:!0})});var C=S.useState({containerWidth:s.width,containerHeight:s.height}),k=VVe(C,2),E=k[0],M=k[1],z=S.useCallback(function(V,A){M(function($){var K=Math.round(V),G=Math.round(A);return $.containerWidth===K&&$.containerHeight===G?$:{containerWidth:K,containerHeight:G}})},[]);S.useEffect(function(){var V=function(H){var B,L=H[0].contentRect,F=L.width,W=L.height;z(F,W),(B=N.current)===null||B===void 0||B.call(N,F,W)};m>0&&(V=Coe(V,m,{trailing:!0,leading:!1}));var A=new ResizeObserver(V),$=j.current.getBoundingClientRect(),K=$.width,G=$.height;return z(K,G),A.observe(j.current),function(){A.disconnect()}},[z,m]);var P=S.useMemo(function(){var V=E.containerWidth,A=E.containerHeight;if(V<0||A<0)return null;$u(lp(o)||lp(c),`The width(%s) and height(%s) are both fixed numbers,
maybe you don't need to use a ResponsiveContainer.`,o,c),$u(!r||r>0,"The aspect(%s) must be greater than zero.",r);var $=lp(o)?V:o,K=lp(c)?A:c;r&&r>0&&($?K=$/r:K&&($=K*r),f&&K>f&&(K=f)),$u($>0||K>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.`,$,K,o,c,d,h,r);var G=!Array.isArray(p)&&Fu(p.type).endsWith("Chart");return me.Children.map(p,function(Y){return me.isValidElement(Y)?S.cloneElement(Y,SN({width:$,height:K},G?{style:SN({height:"100%",width:"100%",maxHeight:K,maxWidth:$},Y.props.style)}:{})):Y})},[r,p,c,f,h,d,E,o]);return me.createElement("div",{id:x?"".concat(x):void 0,className:Jt("recharts-responsive-container",y),style:SN(SN({},w),{},{width:o,height:c,minWidth:d,minHeight:h,maxHeight:f}),ref:j},P)}),Pv=function(e){return null};Pv.displayName="Cell";function f1(t){"@babel/helpers - typeof";return f1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f1(t)}function eV(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function uL(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?eV(Object(r),!0).forEach(function(n){XVe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):eV(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function XVe(t,e,r){return e=QVe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function QVe(t){var e=ZVe(t,"string");return f1(e)=="symbol"?e:e+""}function ZVe(t,e){if(f1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(f1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ig={widthCache:{},cacheCount:0},JVe=2e3,eqe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},tV="recharts_measurement_span";function tqe(t){var e=uL({},t);return Object.keys(e).forEach(function(r){e[r]||delete e[r]}),e}var rV=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Im.isSsr)return{width:0,height:0};var n=tqe(r),s=JSON.stringify({text:e,copyStyle:n});if(Ig.widthCache[s])return Ig.widthCache[s];try{var i=document.getElementById(tV);i||(i=document.createElement("span"),i.setAttribute("id",tV),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=uL(uL({},eqe),n);Object.assign(i.style,o),i.textContent="".concat(e);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return Ig.widthCache[s]=c,++Ig.cacheCount>JVe&&(Ig.cacheCount=0,Ig.widthCache={}),c}catch{return{width:0,height:0}}},rqe=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function p1(t){"@babel/helpers - typeof";return p1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p1(t)}function NC(t,e){return aqe(t)||iqe(t,e)||sqe(t,e)||nqe()}function nqe(){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 sqe(t,e){if(t){if(typeof t=="string")return nV(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nV(t,e)}}function nV(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function iqe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function aqe(t){if(Array.isArray(t))return t}function oqe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sV(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,cqe(n.key),n)}}function lqe(t,e,r){return e&&sV(t.prototype,e),r&&sV(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function cqe(t){var e=uqe(t,"string");return p1(e)=="symbol"?e:e+""}function uqe(t,e){if(p1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(p1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var iV=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,aV=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,dqe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,hqe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Toe={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},fqe=Object.keys(Toe),py="NaN";function pqe(t,e){return t*Toe[e]}var NN=function(){function t(e,r){oqe(this,t),this.num=e,this.unit=r,this.num=e,this.unit=r,Number.isNaN(e)&&(this.unit=""),r!==""&&!dqe.test(r)&&(this.num=NaN,this.unit=""),fqe.includes(r)&&(this.num=pqe(e,r),this.unit="px")}return lqe(t,[{key:"add",value:function(r){return this.unit!==r.unit?new t(NaN,""):new t(this.num+r.num,this.unit)}},{key:"subtract",value:function(r){return this.unit!==r.unit?new t(NaN,""):new t(this.num-r.num,this.unit)}},{key:"multiply",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new t(NaN,""):new t(this.num*r.num,this.unit||r.unit)}},{key:"divide",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new t(NaN,""):new t(this.num/r.num,this.unit||r.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(r){var n,s=(n=hqe.exec(r))!==null&&n!==void 0?n:[],i=NC(s,3),o=i[1],l=i[2];return new t(parseFloat(o),l??"")}}])}();function Poe(t){if(t.includes(py))return py;for(var e=t;e.includes("*")||e.includes("/");){var r,n=(r=iV.exec(e))!==null&&r!==void 0?r:[],s=NC(n,4),i=s[1],o=s[2],l=s[3],c=NN.parse(i??""),u=NN.parse(l??""),d=o==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return py;e=e.replace(iV,d.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var h,f=(h=aV.exec(e))!==null&&h!==void 0?h:[],p=NC(f,4),g=p[1],m=p[2],x=p[3],y=NN.parse(g??""),v=NN.parse(x??""),b=m==="+"?y.add(v):y.subtract(v);if(b.isNaN())return py;e=e.replace(aV,b.toString())}return e}var oV=/\(([^()]*)\)/;function mqe(t){for(var e=t;e.includes("(");){var r=oV.exec(e),n=NC(r,2),s=n[1];e=e.replace(oV,Poe(s))}return e}function gqe(t){var e=t.replace(/\s+/g,"");return e=mqe(e),e=Poe(e),e}function yqe(t){try{return gqe(t)}catch{return py}}function XO(t){var e=yqe(t.slice(5,-1));return e===py?"":e}var xqe=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],vqe=["dx","dy","angle","className","breakAll"];function dL(){return dL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},dL.apply(this,arguments)}function lV(t,e){if(t==null)return{};var r=bqe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function bqe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function cV(t,e){return Sqe(t)||jqe(t,e)||_qe(t,e)||wqe()}function wqe(){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 _qe(t,e){if(t){if(typeof t=="string")return uV(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uV(t,e)}}function uV(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function jqe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Sqe(t){if(Array.isArray(t))return t}var Ooe=/[ \f\n\r\t\v\u2028\u2029]+/,Ioe=function(e){var r=e.children,n=e.breakAll,s=e.style;try{var i=[];Qt(r)||(n?i=r.toString().split(""):i=r.toString().split(Ooe));var o=i.map(function(c){return{word:c,width:rV(c,s).width}}),l=n?0:rV(" ",s).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},Nqe=function(e,r,n,s,i){var o=e.maxLines,l=e.children,c=e.style,u=e.breakAll,d=rt(o),h=l,f=function(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return $.reduce(function(K,G){var Y=G.word,H=G.width,B=K[K.length-1];if(B&&(s==null||i||B.width+H+n<Number(s)))B.words.push(Y),B.width+=H+n;else{var L={words:[Y],width:H};K.push(L)}return K},[])},p=f(r),g=function($){return $.reduce(function(K,G){return K.width>G.width?K:G})};if(!d)return p;for(var m="…",x=function($){var K=h.slice(0,$),G=Ioe({breakAll:u,style:c,children:K+m}).wordsWithComputedWidth,Y=f(G),H=Y.length>o||g(Y).width>Number(s);return[H,Y]},y=0,v=h.length-1,b=0,w;y<=v&&b<=h.length-1;){var j=Math.floor((y+v)/2),N=j-1,C=x(N),k=cV(C,2),E=k[0],M=k[1],z=x(j),P=cV(z,1),V=P[0];if(!E&&!V&&(y=j+1),E&&V&&(v=j-1),!E&&V){w=M;break}b++}return w||p},dV=function(e){var r=Qt(e)?[]:e.toString().split(Ooe);return[{words:r}]},Aqe=function(e){var r=e.width,n=e.scaleToFit,s=e.children,i=e.style,o=e.breakAll,l=e.maxLines;if((r||n)&&!Im.isSsr){var c,u,d=Ioe({breakAll:o,children:s,style:i});if(d){var h=d.wordsWithComputedWidth,f=d.spaceWidth;c=h,u=f}else return dV(s);return Nqe({breakAll:o,children:s,maxLines:l,style:i},c,u,r,n)}return dV(s)},hV="#808080",Ov=function(e){var r=e.x,n=r===void 0?0:r,s=e.y,i=s===void 0?0:s,o=e.lineHeight,l=o===void 0?"1em":o,c=e.capHeight,u=c===void 0?"0.71em":c,d=e.scaleToFit,h=d===void 0?!1:d,f=e.textAnchor,p=f===void 0?"start":f,g=e.verticalAnchor,m=g===void 0?"end":g,x=e.fill,y=x===void 0?hV:x,v=lV(e,xqe),b=S.useMemo(function(){return Aqe({breakAll:v.breakAll,children:v.children,maxLines:v.maxLines,scaleToFit:h,style:v.style,width:v.width})},[v.breakAll,v.children,v.maxLines,h,v.style,v.width]),w=v.dx,j=v.dy,N=v.angle,C=v.className,k=v.breakAll,E=lV(v,vqe);if(!Qn(n)||!Qn(i))return null;var M=n+(rt(w)?w:0),z=i+(rt(j)?j:0),P;switch(m){case"start":P=XO("calc(".concat(u,")"));break;case"middle":P=XO("calc(".concat((b.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:P=XO("calc(".concat(b.length-1," * -").concat(l,")"));break}var V=[];if(h){var A=b[0].width,$=v.width;V.push("scale(".concat((rt($)?$/A:1)/A,")"))}return N&&V.push("rotate(".concat(N,", ").concat(M,", ").concat(z,")")),V.length&&(E.transform=V.join(" ")),me.createElement("text",dL({},Lt(E,!0),{x:M,y:z,className:Jt("recharts-text",C),textAnchor:p,fill:y.includes("url")?hV:y}),b.map(function(K,G){var Y=K.words.join(k?"":" ");return me.createElement("tspan",{x:M,dy:G===0?P:l,key:"".concat(Y,"-").concat(G)},Y)}))};function Gh(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Eqe(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function i8(t){let e,r,n;t.length!==2?(e=Gh,r=(l,c)=>Gh(t(l),c),n=(l,c)=>t(l)-c):(e=t===Gh||t===Eqe?t:Cqe,r=t,n=t);function s(l,c,u=0,d=l.length){if(u<d){if(e(c,c)!==0)return d;do{const h=u+d>>>1;r(l[h],c)<0?u=h+1:d=h}while(u<d)}return u}function i(l,c,u=0,d=l.length){if(u<d){if(e(c,c)!==0)return d;do{const h=u+d>>>1;r(l[h],c)<=0?u=h+1:d=h}while(u<d)}return u}function o(l,c,u=0,d=l.length){const h=s(l,c,u,d-1);return h>u&&n(l[h-1],c)>-n(l[h],c)?h-1:h}return{left:s,center:o,right:i}}function Cqe(){return 0}function Roe(t){return t===null?NaN:+t}function*kqe(t,e){for(let r of t)r!=null&&(r=+r)>=r&&(yield r)}const Tqe=i8(Gh),oS=Tqe.right;i8(Roe).center;class fV extends Map{constructor(e,r=Iqe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),e!=null)for(const[n,s]of e)this.set(n,s)}get(e){return super.get(pV(this,e))}has(e){return super.has(pV(this,e))}set(e,r){return super.set(Pqe(this,e),r)}delete(e){return super.delete(Oqe(this,e))}}function pV({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):r}function Pqe({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):(t.set(n,r),r)}function Oqe({_intern:t,_key:e},r){const n=e(r);return t.has(n)&&(r=t.get(n),t.delete(n)),r}function Iqe(t){return t!==null&&typeof t=="object"?t.valueOf():t}function Rqe(t=Gh){if(t===Gh)return Moe;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,r)=>{const n=t(e,r);return n||n===0?n:(t(r,r)===0)-(t(e,e)===0)}}function Moe(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const Mqe=Math.sqrt(50),Dqe=Math.sqrt(10),Lqe=Math.sqrt(2);function AC(t,e,r){const n=(e-t)/Math.max(0,r),s=Math.floor(Math.log10(n)),i=n/Math.pow(10,s),o=i>=Mqe?10:i>=Dqe?5:i>=Lqe?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/o,l=Math.round(t*u),c=Math.round(e*u),l/u<t&&++l,c/u>e&&--c,u=-u):(u=Math.pow(10,s)*o,l=Math.round(t/u),c=Math.round(e/u),l*u<t&&++l,c*u>e&&--c),c<l&&.5<=r&&r<2?AC(t,e,r*2):[l,c,u]}function hL(t,e,r){if(e=+e,t=+t,r=+r,!(r>0))return[];if(t===e)return[t];const n=e<t,[s,i,o]=n?AC(e,t,r):AC(t,e,r);if(!(i>=s))return[];const l=i-s+1,c=new Array(l);if(n)if(o<0)for(let u=0;u<l;++u)c[u]=(i-u)/-o;else for(let u=0;u<l;++u)c[u]=(i-u)*o;else if(o<0)for(let u=0;u<l;++u)c[u]=(s+u)/-o;else for(let u=0;u<l;++u)c[u]=(s+u)*o;return c}function fL(t,e,r){return e=+e,t=+t,r=+r,AC(t,e,r)[2]}function pL(t,e,r){e=+e,t=+t,r=+r;const n=e<t,s=n?fL(e,t,r):fL(t,e,r);return(n?-1:1)*(s<0?1/-s:s)}function mV(t,e){let r;for(const n of t)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function gV(t,e){let r;for(const n of t)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function Doe(t,e,r=0,n=1/0,s){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(t.length-1,n)),!(r<=e&&e<=n))return t;for(s=s===void 0?Moe:Rqe(s);n>r;){if(n-r>600){const c=n-r+1,u=e-r+1,d=Math.log(c),h=.5*Math.exp(2*d/3),f=.5*Math.sqrt(d*h*(c-h)/c)*(u-c/2<0?-1:1),p=Math.max(r,Math.floor(e-u*h/c+f)),g=Math.min(n,Math.floor(e+(c-u)*h/c+f));Doe(t,e,p,g,s)}const i=t[e];let o=r,l=n;for(r0(t,r,e),s(t[n],i)>0&&r0(t,r,n);o<l;){for(r0(t,o,l),++o,--l;s(t[o],i)<0;)++o;for(;s(t[l],i)>0;)--l}s(t[r],i)===0?r0(t,r,l):(++l,r0(t,l,n)),l<=e&&(r=l+1),e<=l&&(n=l-1)}return t}function r0(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function Fqe(t,e,r){if(t=Float64Array.from(kqe(t)),!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return gV(t);if(e>=1)return mV(t);var n,s=(n-1)*e,i=Math.floor(s),o=mV(Doe(t,i).subarray(0,i+1)),l=gV(t.subarray(i+1));return o+(l-o)*(s-i)}}function $qe(t,e,r=Roe){if(!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,s=(n-1)*e,i=Math.floor(s),o=+r(t[i],i,t),l=+r(t[i+1],i+1,t);return o+(l-o)*(s-i)}}function Bqe(t,e,r){t=+t,e=+e,r=(s=arguments.length)<2?(e=t,t=0,1):s<3?1:+r;for(var n=-1,s=Math.max(0,Math.ceil((e-t)/r))|0,i=new Array(s);++n<s;)i[n]=t+n*r;return i}function Eo(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function dd(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const mL=Symbol("implicit");function a8(){var t=new fV,e=[],r=[],n=mL;function s(i){let o=t.get(i);if(o===void 0){if(n!==mL)return n;t.set(i,o=e.push(i)-1)}return r[o%r.length]}return s.domain=function(i){if(!arguments.length)return e.slice();e=[],t=new fV;for(const o of i)t.has(o)||t.set(o,e.push(o)-1);return s},s.range=function(i){return arguments.length?(r=Array.from(i),s):r.slice()},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return a8(e,r).unknown(n)},Eo.apply(s,arguments),s}function m1(){var t=a8().unknown(void 0),e=t.domain,r=t.range,n=0,s=1,i,o,l=!1,c=0,u=0,d=.5;delete t.unknown;function h(){var f=e().length,p=s<n,g=p?s:n,m=p?n:s;i=(m-g)/Math.max(1,f-c+u*2),l&&(i=Math.floor(i)),g+=(m-g-i*(f-c))*d,o=i*(1-c),l&&(g=Math.round(g),o=Math.round(o));var x=Bqe(f).map(function(y){return g+i*y});return r(p?x.reverse():x)}return t.domain=function(f){return arguments.length?(e(f),h()):e()},t.range=function(f){return arguments.length?([n,s]=f,n=+n,s=+s,h()):[n,s]},t.rangeRound=function(f){return[n,s]=f,n=+n,s=+s,l=!0,h()},t.bandwidth=function(){return o},t.step=function(){return i},t.round=function(f){return arguments.length?(l=!!f,h()):l},t.padding=function(f){return arguments.length?(c=Math.min(1,u=+f),h()):c},t.paddingInner=function(f){return arguments.length?(c=Math.min(1,f),h()):c},t.paddingOuter=function(f){return arguments.length?(u=+f,h()):u},t.align=function(f){return arguments.length?(d=Math.max(0,Math.min(1,f)),h()):d},t.copy=function(){return m1(e(),[n,s]).round(l).paddingInner(c).paddingOuter(u).align(d)},Eo.apply(h(),arguments)}function Loe(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return Loe(e())},t}function ww(){return Loe(m1.apply(null,arguments).paddingInner(1))}function o8(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function Foe(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function lS(){}var g1=.7,EC=1/g1,$y="\\s*([+-]?\\d+)\\s*",y1="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Uqe=/^#([0-9a-f]{3,8})$/,zqe=new RegExp(`^rgb\\(${$y},${$y},${$y}\\)$`),Hqe=new RegExp(`^rgb\\(${yc},${yc},${yc}\\)$`),Wqe=new RegExp(`^rgba\\(${$y},${$y},${$y},${y1}\\)$`),Vqe=new RegExp(`^rgba\\(${yc},${yc},${yc},${y1}\\)$`),qqe=new RegExp(`^hsl\\(${y1},${yc},${yc}\\)$`),Gqe=new RegExp(`^hsla\\(${y1},${yc},${yc},${y1}\\)$`),yV={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};o8(lS,x1,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:xV,formatHex:xV,formatHex8:Kqe,formatHsl:Yqe,formatRgb:vV,toString:vV});function xV(){return this.rgb().formatHex()}function Kqe(){return this.rgb().formatHex8()}function Yqe(){return $oe(this).formatHsl()}function vV(){return this.rgb().formatRgb()}function x1(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Uqe.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?bV(e):r===3?new Wi(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?AN(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?AN(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=zqe.exec(t))?new Wi(e[1],e[2],e[3],1):(e=Hqe.exec(t))?new Wi(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Wqe.exec(t))?AN(e[1],e[2],e[3],e[4]):(e=Vqe.exec(t))?AN(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=qqe.exec(t))?jV(e[1],e[2]/100,e[3]/100,1):(e=Gqe.exec(t))?jV(e[1],e[2]/100,e[3]/100,e[4]):yV.hasOwnProperty(t)?bV(yV[t]):t==="transparent"?new Wi(NaN,NaN,NaN,0):null}function bV(t){return new Wi(t>>16&255,t>>8&255,t&255,1)}function AN(t,e,r,n){return n<=0&&(t=e=r=NaN),new Wi(t,e,r,n)}function Xqe(t){return t instanceof lS||(t=x1(t)),t?(t=t.rgb(),new Wi(t.r,t.g,t.b,t.opacity)):new Wi}function gL(t,e,r,n){return arguments.length===1?Xqe(t):new Wi(t,e,r,n??1)}function Wi(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}o8(Wi,gL,Foe(lS,{brighter(t){return t=t==null?EC:Math.pow(EC,t),new Wi(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?g1:Math.pow(g1,t),new Wi(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Wi(Rm(this.r),Rm(this.g),Rm(this.b),CC(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:wV,formatHex:wV,formatHex8:Qqe,formatRgb:_V,toString:_V}));function wV(){return`#${cp(this.r)}${cp(this.g)}${cp(this.b)}`}function Qqe(){return`#${cp(this.r)}${cp(this.g)}${cp(this.b)}${cp((isNaN(this.opacity)?1:this.opacity)*255)}`}function _V(){const t=CC(this.opacity);return`${t===1?"rgb(":"rgba("}${Rm(this.r)}, ${Rm(this.g)}, ${Rm(this.b)}${t===1?")":`, ${t})`}`}function CC(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Rm(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function cp(t){return t=Rm(t),(t<16?"0":"")+t.toString(16)}function jV(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new tl(t,e,r,n)}function $oe(t){if(t instanceof tl)return new tl(t.h,t.s,t.l,t.opacity);if(t instanceof lS||(t=x1(t)),!t)return new tl;if(t instanceof tl)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,s=Math.min(e,r,n),i=Math.max(e,r,n),o=NaN,l=i-s,c=(i+s)/2;return l?(e===i?o=(r-n)/l+(r<n)*6:r===i?o=(n-e)/l+2:o=(e-r)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new tl(o,l,c,t.opacity)}function Zqe(t,e,r,n){return arguments.length===1?$oe(t):new tl(t,e,r,n??1)}function tl(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}o8(tl,Zqe,Foe(lS,{brighter(t){return t=t==null?EC:Math.pow(EC,t),new tl(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?g1:Math.pow(g1,t),new tl(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,s=2*r-n;return new Wi(QO(t>=240?t-240:t+120,s,n),QO(t,s,n),QO(t<120?t+240:t-120,s,n),this.opacity)},clamp(){return new tl(SV(this.h),EN(this.s),EN(this.l),CC(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 t=CC(this.opacity);return`${t===1?"hsl(":"hsla("}${SV(this.h)}, ${EN(this.s)*100}%, ${EN(this.l)*100}%${t===1?")":`, ${t})`}`}}));function SV(t){return t=(t||0)%360,t<0?t+360:t}function EN(t){return Math.max(0,Math.min(1,t||0))}function QO(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const l8=t=>()=>t;function Jqe(t,e){return function(r){return t+r*e}}function eGe(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function tGe(t){return(t=+t)==1?Boe:function(e,r){return r-e?eGe(e,r,t):l8(isNaN(e)?r:e)}}function Boe(t,e){var r=e-t;return r?Jqe(t,r):l8(isNaN(t)?e:t)}const NV=function t(e){var r=tGe(e);function n(s,i){var o=r((s=gL(s)).r,(i=gL(i)).r),l=r(s.g,i.g),c=r(s.b,i.b),u=Boe(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return n.gamma=t,n}(1);function rGe(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),s;return function(i){for(s=0;s<r;++s)n[s]=t[s]*(1-i)+e[s]*i;return n}}function nGe(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function sGe(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,s=new Array(n),i=new Array(r),o;for(o=0;o<n;++o)s[o]=Tb(t[o],e[o]);for(;o<r;++o)i[o]=e[o];return function(l){for(o=0;o<n;++o)i[o]=s[o](l);return i}}function iGe(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function kC(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function aGe(t,e){var r={},n={},s;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(s in e)s in t?r[s]=Tb(t[s],e[s]):n[s]=e[s];return function(i){for(s in r)n[s]=r[s](i);return n}}var yL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ZO=new RegExp(yL.source,"g");function oGe(t){return function(){return t}}function lGe(t){return function(e){return t(e)+""}}function cGe(t,e){var r=yL.lastIndex=ZO.lastIndex=0,n,s,i,o=-1,l=[],c=[];for(t=t+"",e=e+"";(n=yL.exec(t))&&(s=ZO.exec(e));)(i=s.index)>r&&(i=e.slice(r,i),l[o]?l[o]+=i:l[++o]=i),(n=n[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:kC(n,s)})),r=ZO.lastIndex;return r<e.length&&(i=e.slice(r),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?lGe(c[0].x):oGe(e):(e=c.length,function(u){for(var d=0,h;d<e;++d)l[(h=c[d]).i]=h.x(u);return l.join("")})}function Tb(t,e){var r=typeof e,n;return e==null||r==="boolean"?l8(e):(r==="number"?kC:r==="string"?(n=x1(e))?(e=n,NV):cGe:e instanceof x1?NV:e instanceof Date?iGe:nGe(e)?rGe:Array.isArray(e)?sGe:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?aGe:kC)(t,e)}function c8(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}function uGe(t,e){e===void 0&&(e=t,t=Tb);for(var r=0,n=e.length-1,s=e[0],i=new Array(n<0?0:n);r<n;)i[r]=t(s,s=e[++r]);return function(o){var l=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return i[l](o-l)}}function dGe(t){return function(){return t}}function TC(t){return+t}var AV=[0,1];function vi(t){return t}function xL(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:dGe(isNaN(e)?NaN:.5)}function hGe(t,e){var r;return t>e&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function fGe(t,e,r){var n=t[0],s=t[1],i=e[0],o=e[1];return s<n?(n=xL(s,n),i=r(o,i)):(n=xL(n,s),i=r(i,o)),function(l){return i(n(l))}}function pGe(t,e,r){var n=Math.min(t.length,e.length)-1,s=new Array(n),i=new Array(n),o=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<n;)s[o]=xL(t[o],t[o+1]),i[o]=r(e[o],e[o+1]);return function(l){var c=oS(t,l,1,n)-1;return i[c](s[c](l))}}function cS(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function p2(){var t=AV,e=AV,r=Tb,n,s,i,o=vi,l,c,u;function d(){var f=Math.min(t.length,e.length);return o!==vi&&(o=hGe(t[0],t[f-1])),l=f>2?pGe:fGe,c=u=null,h}function h(f){return f==null||isNaN(f=+f)?i:(c||(c=l(t.map(n),e,r)))(n(o(f)))}return h.invert=function(f){return o(s((u||(u=l(e,t.map(n),kC)))(f)))},h.domain=function(f){return arguments.length?(t=Array.from(f,TC),d()):t.slice()},h.range=function(f){return arguments.length?(e=Array.from(f),d()):e.slice()},h.rangeRound=function(f){return e=Array.from(f),r=c8,d()},h.clamp=function(f){return arguments.length?(o=f?!0:vi,d()):o!==vi},h.interpolate=function(f){return arguments.length?(r=f,d()):r},h.unknown=function(f){return arguments.length?(i=f,h):i},function(f,p){return n=f,s=p,d()}}function u8(){return p2()(vi,vi)}function mGe(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function PC(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function Iv(t){return t=PC(Math.abs(t)),t?t[1]:NaN}function gGe(t,e){return function(r,n){for(var s=r.length,i=[],o=0,l=t[0],c=0;s>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),i.push(r.substring(s-=l,s+l)),!((c+=l+1)>n));)l=t[o=(o+1)%t.length];return i.reverse().join(e)}}function yGe(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var xGe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function v1(t){if(!(e=xGe.exec(t)))throw new Error("invalid format: "+t);var e;return new d8({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}v1.prototype=d8.prototype;function d8(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}d8.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 vGe(t){e:for(var e=t.length,r=1,n=-1,s;r<e;++r)switch(t[r]){case".":n=s=r;break;case"0":n===0&&(n=r),s=r;break;default:if(!+t[r])break e;n>0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(s+1):t}var Uoe;function bGe(t,e){var r=PC(t,e);if(!r)return t+"";var n=r[0],s=r[1],i=s-(Uoe=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=n.length;return i===o?n:i>o?n+new Array(i-o+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+PC(t,Math.max(0,e+i-1))[0]}function EV(t,e){var r=PC(t,e);if(!r)return t+"";var n=r[0],s=r[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}const CV={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:mGe,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>EV(t*100,e),r:EV,s:bGe,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function kV(t){return t}var TV=Array.prototype.map,PV=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function wGe(t){var e=t.grouping===void 0||t.thousands===void 0?kV:gGe(TV.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",s=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?kV:yGe(TV.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(h){h=v1(h);var f=h.fill,p=h.align,g=h.sign,m=h.symbol,x=h.zero,y=h.width,v=h.comma,b=h.precision,w=h.trim,j=h.type;j==="n"?(v=!0,j="g"):CV[j]||(b===void 0&&(b=12),w=!0,j="g"),(x||f==="0"&&p==="=")&&(x=!0,f="0",p="=");var N=m==="$"?r:m==="#"&&/[boxX]/.test(j)?"0"+j.toLowerCase():"",C=m==="$"?n:/[%p]/.test(j)?o:"",k=CV[j],E=/[defgprs%]/.test(j);b=b===void 0?6:/[gprs]/.test(j)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function M(z){var P=N,V=C,A,$,K;if(j==="c")V=k(z)+V,z="";else{z=+z;var G=z<0||1/z<0;if(z=isNaN(z)?c:k(Math.abs(z),b),w&&(z=vGe(z)),G&&+z==0&&g!=="+"&&(G=!1),P=(G?g==="("?g:l:g==="-"||g==="("?"":g)+P,V=(j==="s"?PV[8+Uoe/3]:"")+V+(G&&g==="("?")":""),E){for(A=-1,$=z.length;++A<$;)if(K=z.charCodeAt(A),48>K||K>57){V=(K===46?s+z.slice(A+1):z.slice(A))+V,z=z.slice(0,A);break}}}v&&!x&&(z=e(z,1/0));var Y=P.length+z.length+V.length,H=Y<y?new Array(y-Y+1).join(f):"";switch(v&&x&&(z=e(H+z,H.length?y-V.length:1/0),H=""),p){case"<":z=P+z+V+H;break;case"=":z=P+H+z+V;break;case"^":z=H.slice(0,Y=H.length>>1)+P+z+V+H.slice(Y);break;default:z=H+P+z+V;break}return i(z)}return M.toString=function(){return h+""},M}function d(h,f){var p=u((h=v1(h),h.type="f",h)),g=Math.max(-8,Math.min(8,Math.floor(Iv(f)/3)))*3,m=Math.pow(10,-g),x=PV[8+g/3];return function(y){return p(m*y)+x}}return{format:u,formatPrefix:d}}var CN,h8,zoe;_Ge({thousands:",",grouping:[3],currency:["$",""]});function _Ge(t){return CN=wGe(t),h8=CN.format,zoe=CN.formatPrefix,CN}function jGe(t){return Math.max(0,-Iv(Math.abs(t)))}function SGe(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Iv(e)/3)))*3-Iv(Math.abs(t)))}function NGe(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Iv(e)-Iv(t))+1}function Hoe(t,e,r,n){var s=pL(t,e,r),i;switch(n=v1(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(i=SGe(s,o))&&(n.precision=i),zoe(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=NGe(s,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=jGe(s))&&(n.precision=i-(n.type==="%")*2);break}}return h8(n)}function _f(t){var e=t.domain;return t.ticks=function(r){var n=e();return hL(n[0],n[n.length-1],r??10)},t.tickFormat=function(r,n){var s=e();return Hoe(s[0],s[s.length-1],r??10,n)},t.nice=function(r){r==null&&(r=10);var n=e(),s=0,i=n.length-1,o=n[s],l=n[i],c,u,d=10;for(l<o&&(u=o,o=l,l=u,u=s,s=i,i=u);d-- >0;){if(u=fL(o,l,r),u===c)return n[s]=o,n[i]=l,e(n);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return t},t}function OC(){var t=u8();return t.copy=function(){return cS(t,OC())},Eo.apply(t,arguments),_f(t)}function Woe(t){var e;function r(n){return n==null||isNaN(n=+n)?e:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(t=Array.from(n,TC),r):t.slice()},r.unknown=function(n){return arguments.length?(e=n,r):e},r.copy=function(){return Woe(t).unknown(e)},t=arguments.length?Array.from(t,TC):[0,1],_f(r)}function Voe(t,e){t=t.slice();var r=0,n=t.length-1,s=t[r],i=t[n],o;return i<s&&(o=r,r=n,n=o,o=s,s=i,i=o),t[r]=e.floor(s),t[n]=e.ceil(i),t}function OV(t){return Math.log(t)}function IV(t){return Math.exp(t)}function AGe(t){return-Math.log(-t)}function EGe(t){return-Math.exp(-t)}function CGe(t){return isFinite(t)?+("1e"+t):t<0?0:t}function kGe(t){return t===10?CGe:t===Math.E?Math.exp:e=>Math.pow(t,e)}function TGe(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function RV(t){return(e,r)=>-t(-e,r)}function f8(t){const e=t(OV,IV),r=e.domain;let n=10,s,i;function o(){return s=TGe(n),i=kGe(n),r()[0]<0?(s=RV(s),i=RV(i),t(AGe,EGe)):t(OV,IV),e}return e.base=function(l){return arguments.length?(n=+l,o()):n},e.domain=function(l){return arguments.length?(r(l),o()):r()},e.ticks=l=>{const c=r();let u=c[0],d=c[c.length-1];const h=d<u;h&&([u,d]=[d,u]);let f=s(u),p=s(d),g,m;const x=l==null?10:+l;let y=[];if(!(n%1)&&p-f<x){if(f=Math.floor(f),p=Math.ceil(p),u>0){for(;f<=p;++f)for(g=1;g<n;++g)if(m=f<0?g/i(-f):g*i(f),!(m<u)){if(m>d)break;y.push(m)}}else for(;f<=p;++f)for(g=n-1;g>=1;--g)if(m=f>0?g/i(-f):g*i(f),!(m<u)){if(m>d)break;y.push(m)}y.length*2<x&&(y=hL(u,d,x))}else y=hL(f,p,Math.min(p-f,x)).map(i);return h?y.reverse():y},e.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=v1(c)).precision==null&&(c.trim=!0),c=h8(c)),l===1/0)return c;const u=Math.max(1,n*l/e.ticks().length);return d=>{let h=d/i(Math.round(s(d)));return h*n<n-.5&&(h*=n),h<=u?c(d):""}},e.nice=()=>r(Voe(r(),{floor:l=>i(Math.floor(s(l))),ceil:l=>i(Math.ceil(s(l)))})),e}function qoe(){const t=f8(p2()).domain([1,10]);return t.copy=()=>cS(t,qoe()).base(t.base()),Eo.apply(t,arguments),t}function MV(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function DV(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function p8(t){var e=1,r=t(MV(e),DV(e));return r.constant=function(n){return arguments.length?t(MV(e=+n),DV(e)):e},_f(r)}function Goe(){var t=p8(p2());return t.copy=function(){return cS(t,Goe()).constant(t.constant())},Eo.apply(t,arguments)}function LV(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function PGe(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function OGe(t){return t<0?-t*t:t*t}function m8(t){var e=t(vi,vi),r=1;function n(){return r===1?t(vi,vi):r===.5?t(PGe,OGe):t(LV(r),LV(1/r))}return e.exponent=function(s){return arguments.length?(r=+s,n()):r},_f(e)}function g8(){var t=m8(p2());return t.copy=function(){return cS(t,g8()).exponent(t.exponent())},Eo.apply(t,arguments),t}function IGe(){return g8.apply(null,arguments).exponent(.5)}function FV(t){return Math.sign(t)*t*t}function RGe(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function Koe(){var t=u8(),e=[0,1],r=!1,n;function s(i){var o=RGe(t(i));return isNaN(o)?n:r?Math.round(o):o}return s.invert=function(i){return t.invert(FV(i))},s.domain=function(i){return arguments.length?(t.domain(i),s):t.domain()},s.range=function(i){return arguments.length?(t.range((e=Array.from(i,TC)).map(FV)),s):e.slice()},s.rangeRound=function(i){return s.range(i).round(!0)},s.round=function(i){return arguments.length?(r=!!i,s):r},s.clamp=function(i){return arguments.length?(t.clamp(i),s):t.clamp()},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return Koe(t.domain(),e).round(r).clamp(t.clamp()).unknown(n)},Eo.apply(s,arguments),_f(s)}function Yoe(){var t=[],e=[],r=[],n;function s(){var o=0,l=Math.max(1,e.length);for(r=new Array(l-1);++o<l;)r[o-1]=$qe(t,o/l);return i}function i(o){return o==null||isNaN(o=+o)?n:e[oS(r,o)]}return i.invertExtent=function(o){var l=e.indexOf(o);return l<0?[NaN,NaN]:[l>0?r[l-1]:t[0],l<r.length?r[l]:t[t.length-1]]},i.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let l of o)l!=null&&!isNaN(l=+l)&&t.push(l);return t.sort(Gh),s()},i.range=function(o){return arguments.length?(e=Array.from(o),s()):e.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.quantiles=function(){return r.slice()},i.copy=function(){return Yoe().domain(t).range(e).unknown(n)},Eo.apply(i,arguments)}function Xoe(){var t=0,e=1,r=1,n=[.5],s=[0,1],i;function o(c){return c!=null&&c<=c?s[oS(n,c,0,r)]:i}function l(){var c=-1;for(n=new Array(r);++c<r;)n[c]=((c+1)*e-(c-r)*t)/(r+1);return o}return o.domain=function(c){return arguments.length?([t,e]=c,t=+t,e=+e,l()):[t,e]},o.range=function(c){return arguments.length?(r=(s=Array.from(c)).length-1,l()):s.slice()},o.invertExtent=function(c){var u=s.indexOf(c);return u<0?[NaN,NaN]:u<1?[t,n[0]]:u>=r?[n[r-1],e]:[n[u-1],n[u]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return Xoe().domain([t,e]).range(s).unknown(i)},Eo.apply(_f(o),arguments)}function Qoe(){var t=[.5],e=[0,1],r,n=1;function s(i){return i!=null&&i<=i?e[oS(t,i,0,n)]:r}return s.domain=function(i){return arguments.length?(t=Array.from(i),n=Math.min(t.length,e.length-1),s):t.slice()},s.range=function(i){return arguments.length?(e=Array.from(i),n=Math.min(t.length,e.length-1),s):e.slice()},s.invertExtent=function(i){var o=e.indexOf(i);return[t[o-1],t[o]]},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return Qoe().domain(t).range(e).unknown(r)},Eo.apply(s,arguments)}const JO=new Date,eI=new Date;function ts(t,e,r,n){function s(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return s.floor=i=>(t(i=new Date(+i)),i),s.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),s.round=i=>{const o=s(i),l=s.ceil(i);return i-o<l-i?o:l},s.offset=(i,o)=>(e(i=new Date(+i),o==null?1:Math.floor(o)),i),s.range=(i,o,l)=>{const c=[];if(i=s.ceil(i),l=l==null?1:Math.floor(l),!(i<o)||!(l>0))return c;let u;do c.push(u=new Date(+i)),e(i,l),t(i);while(u<i&&i<o);return c},s.filter=i=>ts(o=>{if(o>=o)for(;t(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;e(o,-1),!i(o););else for(;--l>=0;)for(;e(o,1),!i(o););}),r&&(s.count=(i,o)=>(JO.setTime(+i),eI.setTime(+o),t(JO),t(eI),Math.floor(r(JO,eI))),s.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?s.filter(n?o=>n(o)%i===0:o=>s.count(0,o)%i===0):s)),s}const IC=ts(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);IC.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?ts(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):IC);IC.range;const Ru=1e3,fo=Ru*60,Mu=fo*60,ed=Mu*24,y8=ed*7,$V=ed*30,tI=ed*365,up=ts(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Ru)},(t,e)=>(e-t)/Ru,t=>t.getUTCSeconds());up.range;const x8=ts(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Ru)},(t,e)=>{t.setTime(+t+e*fo)},(t,e)=>(e-t)/fo,t=>t.getMinutes());x8.range;const v8=ts(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*fo)},(t,e)=>(e-t)/fo,t=>t.getUTCMinutes());v8.range;const b8=ts(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Ru-t.getMinutes()*fo)},(t,e)=>{t.setTime(+t+e*Mu)},(t,e)=>(e-t)/Mu,t=>t.getHours());b8.range;const w8=ts(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Mu)},(t,e)=>(e-t)/Mu,t=>t.getUTCHours());w8.range;const uS=ts(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*fo)/ed,t=>t.getDate()-1);uS.range;const m2=ts(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/ed,t=>t.getUTCDate()-1);m2.range;const Zoe=ts(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/ed,t=>Math.floor(t/ed));Zoe.range;function pg(t){return ts(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,r)=>{e.setDate(e.getDate()+r*7)},(e,r)=>(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*fo)/y8)}const g2=pg(0),RC=pg(1),MGe=pg(2),DGe=pg(3),Rv=pg(4),LGe=pg(5),FGe=pg(6);g2.range;RC.range;MGe.range;DGe.range;Rv.range;LGe.range;FGe.range;function mg(t){return ts(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCDate(e.getUTCDate()+r*7)},(e,r)=>(r-e)/y8)}const y2=mg(0),MC=mg(1),$Ge=mg(2),BGe=mg(3),Mv=mg(4),UGe=mg(5),zGe=mg(6);y2.range;MC.range;$Ge.range;BGe.range;Mv.range;UGe.range;zGe.range;const _8=ts(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());_8.range;const j8=ts(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());j8.range;const td=ts(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());td.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ts(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)});td.range;const rd=ts(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());rd.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ts(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)});rd.range;function Joe(t,e,r,n,s,i){const o=[[up,1,Ru],[up,5,5*Ru],[up,15,15*Ru],[up,30,30*Ru],[i,1,fo],[i,5,5*fo],[i,15,15*fo],[i,30,30*fo],[s,1,Mu],[s,3,3*Mu],[s,6,6*Mu],[s,12,12*Mu],[n,1,ed],[n,2,2*ed],[r,1,y8],[e,1,$V],[e,3,3*$V],[t,1,tI]];function l(u,d,h){const f=d<u;f&&([u,d]=[d,u]);const p=h&&typeof h.range=="function"?h:c(u,d,h),g=p?p.range(u,+d+1):[];return f?g.reverse():g}function c(u,d,h){const f=Math.abs(d-u)/h,p=i8(([,,x])=>x).right(o,f);if(p===o.length)return t.every(pL(u/tI,d/tI,h));if(p===0)return IC.every(Math.max(pL(u,d,h),1));const[g,m]=o[f/o[p-1][2]<o[p][2]/f?p-1:p];return g.every(m)}return[l,c]}const[HGe,WGe]=Joe(rd,j8,y2,Zoe,w8,v8),[VGe,qGe]=Joe(td,_8,g2,uS,b8,x8);function rI(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function nI(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function n0(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function GGe(t){var e=t.dateTime,r=t.date,n=t.time,s=t.periods,i=t.days,o=t.shortDays,l=t.months,c=t.shortMonths,u=s0(s),d=i0(s),h=s0(i),f=i0(i),p=s0(o),g=i0(o),m=s0(l),x=i0(l),y=s0(c),v=i0(c),b={a:G,A:Y,b:H,B,c:null,d:VV,e:VV,f:gKe,g:AKe,G:CKe,H:fKe,I:pKe,j:mKe,L:ele,m:yKe,M:xKe,p:L,q:F,Q:KV,s:YV,S:vKe,u:bKe,U:wKe,V:_Ke,w:jKe,W:SKe,x:null,X:null,y:NKe,Y:EKe,Z:kKe,"%":GV},w={a:W,A:X,b:oe,B:le,c:null,d:qV,e:qV,f:IKe,g:HKe,G:VKe,H:TKe,I:PKe,j:OKe,L:rle,m:RKe,M:MKe,p:U,q:R,Q:KV,s:YV,S:DKe,u:LKe,U:FKe,V:$Ke,w:BKe,W:UKe,x:null,X:null,y:zKe,Y:WKe,Z:qKe,"%":GV},j={a:M,A:z,b:P,B:V,c:A,d:HV,e:HV,f:cKe,g:zV,G:UV,H:WV,I:WV,j:iKe,L:lKe,m:sKe,M:aKe,p:E,q:nKe,Q:dKe,s:hKe,S:oKe,u:ZGe,U:JGe,V:eKe,w:QGe,W:tKe,x:$,X:K,y:zV,Y:UV,Z:rKe,"%":uKe};b.x=N(r,b),b.X=N(n,b),b.c=N(e,b),w.x=N(r,w),w.X=N(n,w),w.c=N(e,w);function N(ee,te){return function(Z){var J=[],he=-1,O=0,ie=ee.length,q,I,T;for(Z instanceof Date||(Z=new Date(+Z));++he<ie;)ee.charCodeAt(he)===37&&(J.push(ee.slice(O,he)),(I=BV[q=ee.charAt(++he)])!=null?q=ee.charAt(++he):I=q==="e"?" ":"0",(T=te[q])&&(q=T(Z,I)),J.push(q),O=he+1);return J.push(ee.slice(O,he)),J.join("")}}function C(ee,te){return function(Z){var J=n0(1900,void 0,1),he=k(J,ee,Z+="",0),O,ie;if(he!=Z.length)return null;if("Q"in J)return new Date(J.Q);if("s"in J)return new Date(J.s*1e3+("L"in J?J.L:0));if(te&&!("Z"in J)&&(J.Z=0),"p"in J&&(J.H=J.H%12+J.p*12),J.m===void 0&&(J.m="q"in J?J.q:0),"V"in J){if(J.V<1||J.V>53)return null;"w"in J||(J.w=1),"Z"in J?(O=nI(n0(J.y,0,1)),ie=O.getUTCDay(),O=ie>4||ie===0?MC.ceil(O):MC(O),O=m2.offset(O,(J.V-1)*7),J.y=O.getUTCFullYear(),J.m=O.getUTCMonth(),J.d=O.getUTCDate()+(J.w+6)%7):(O=rI(n0(J.y,0,1)),ie=O.getDay(),O=ie>4||ie===0?RC.ceil(O):RC(O),O=uS.offset(O,(J.V-1)*7),J.y=O.getFullYear(),J.m=O.getMonth(),J.d=O.getDate()+(J.w+6)%7)}else("W"in J||"U"in J)&&("w"in J||(J.w="u"in J?J.u%7:"W"in J?1:0),ie="Z"in J?nI(n0(J.y,0,1)).getUTCDay():rI(n0(J.y,0,1)).getDay(),J.m=0,J.d="W"in J?(J.w+6)%7+J.W*7-(ie+5)%7:J.w+J.U*7-(ie+6)%7);return"Z"in J?(J.H+=J.Z/100|0,J.M+=J.Z%100,nI(J)):rI(J)}}function k(ee,te,Z,J){for(var he=0,O=te.length,ie=Z.length,q,I;he<O;){if(J>=ie)return-1;if(q=te.charCodeAt(he++),q===37){if(q=te.charAt(he++),I=j[q in BV?te.charAt(he++):q],!I||(J=I(ee,Z,J))<0)return-1}else if(q!=Z.charCodeAt(J++))return-1}return J}function E(ee,te,Z){var J=u.exec(te.slice(Z));return J?(ee.p=d.get(J[0].toLowerCase()),Z+J[0].length):-1}function M(ee,te,Z){var J=p.exec(te.slice(Z));return J?(ee.w=g.get(J[0].toLowerCase()),Z+J[0].length):-1}function z(ee,te,Z){var J=h.exec(te.slice(Z));return J?(ee.w=f.get(J[0].toLowerCase()),Z+J[0].length):-1}function P(ee,te,Z){var J=y.exec(te.slice(Z));return J?(ee.m=v.get(J[0].toLowerCase()),Z+J[0].length):-1}function V(ee,te,Z){var J=m.exec(te.slice(Z));return J?(ee.m=x.get(J[0].toLowerCase()),Z+J[0].length):-1}function A(ee,te,Z){return k(ee,e,te,Z)}function $(ee,te,Z){return k(ee,r,te,Z)}function K(ee,te,Z){return k(ee,n,te,Z)}function G(ee){return o[ee.getDay()]}function Y(ee){return i[ee.getDay()]}function H(ee){return c[ee.getMonth()]}function B(ee){return l[ee.getMonth()]}function L(ee){return s[+(ee.getHours()>=12)]}function F(ee){return 1+~~(ee.getMonth()/3)}function W(ee){return o[ee.getUTCDay()]}function X(ee){return i[ee.getUTCDay()]}function oe(ee){return c[ee.getUTCMonth()]}function le(ee){return l[ee.getUTCMonth()]}function U(ee){return s[+(ee.getUTCHours()>=12)]}function R(ee){return 1+~~(ee.getUTCMonth()/3)}return{format:function(ee){var te=N(ee+="",b);return te.toString=function(){return ee},te},parse:function(ee){var te=C(ee+="",!1);return te.toString=function(){return ee},te},utcFormat:function(ee){var te=N(ee+="",w);return te.toString=function(){return ee},te},utcParse:function(ee){var te=C(ee+="",!0);return te.toString=function(){return ee},te}}}var BV={"-":"",_:" ",0:"0"},ms=/^\s*\d+/,KGe=/^%/,YGe=/[\\^$*+?|[\]().{}]/g;function ir(t,e,r){var n=t<0?"-":"",s=(n?-t:t)+"",i=s.length;return n+(i<r?new Array(r-i+1).join(e)+s:s)}function XGe(t){return t.replace(YGe,"\\$&")}function s0(t){return new RegExp("^(?:"+t.map(XGe).join("|")+")","i")}function i0(t){return new Map(t.map((e,r)=>[e.toLowerCase(),r]))}function QGe(t,e,r){var n=ms.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function ZGe(t,e,r){var n=ms.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function JGe(t,e,r){var n=ms.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function eKe(t,e,r){var n=ms.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function tKe(t,e,r){var n=ms.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function UV(t,e,r){var n=ms.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function zV(t,e,r){var n=ms.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function rKe(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function nKe(t,e,r){var n=ms.exec(e.slice(r,r+1));return n?(t.q=n[0]*3-3,r+n[0].length):-1}function sKe(t,e,r){var n=ms.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function HV(t,e,r){var n=ms.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function iKe(t,e,r){var n=ms.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function WV(t,e,r){var n=ms.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function aKe(t,e,r){var n=ms.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oKe(t,e,r){var n=ms.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function lKe(t,e,r){var n=ms.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function cKe(t,e,r){var n=ms.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function uKe(t,e,r){var n=KGe.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function dKe(t,e,r){var n=ms.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function hKe(t,e,r){var n=ms.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function VV(t,e){return ir(t.getDate(),e,2)}function fKe(t,e){return ir(t.getHours(),e,2)}function pKe(t,e){return ir(t.getHours()%12||12,e,2)}function mKe(t,e){return ir(1+uS.count(td(t),t),e,3)}function ele(t,e){return ir(t.getMilliseconds(),e,3)}function gKe(t,e){return ele(t,e)+"000"}function yKe(t,e){return ir(t.getMonth()+1,e,2)}function xKe(t,e){return ir(t.getMinutes(),e,2)}function vKe(t,e){return ir(t.getSeconds(),e,2)}function bKe(t){var e=t.getDay();return e===0?7:e}function wKe(t,e){return ir(g2.count(td(t)-1,t),e,2)}function tle(t){var e=t.getDay();return e>=4||e===0?Rv(t):Rv.ceil(t)}function _Ke(t,e){return t=tle(t),ir(Rv.count(td(t),t)+(td(t).getDay()===4),e,2)}function jKe(t){return t.getDay()}function SKe(t,e){return ir(RC.count(td(t)-1,t),e,2)}function NKe(t,e){return ir(t.getFullYear()%100,e,2)}function AKe(t,e){return t=tle(t),ir(t.getFullYear()%100,e,2)}function EKe(t,e){return ir(t.getFullYear()%1e4,e,4)}function CKe(t,e){var r=t.getDay();return t=r>=4||r===0?Rv(t):Rv.ceil(t),ir(t.getFullYear()%1e4,e,4)}function kKe(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ir(e/60|0,"0",2)+ir(e%60,"0",2)}function qV(t,e){return ir(t.getUTCDate(),e,2)}function TKe(t,e){return ir(t.getUTCHours(),e,2)}function PKe(t,e){return ir(t.getUTCHours()%12||12,e,2)}function OKe(t,e){return ir(1+m2.count(rd(t),t),e,3)}function rle(t,e){return ir(t.getUTCMilliseconds(),e,3)}function IKe(t,e){return rle(t,e)+"000"}function RKe(t,e){return ir(t.getUTCMonth()+1,e,2)}function MKe(t,e){return ir(t.getUTCMinutes(),e,2)}function DKe(t,e){return ir(t.getUTCSeconds(),e,2)}function LKe(t){var e=t.getUTCDay();return e===0?7:e}function FKe(t,e){return ir(y2.count(rd(t)-1,t),e,2)}function nle(t){var e=t.getUTCDay();return e>=4||e===0?Mv(t):Mv.ceil(t)}function $Ke(t,e){return t=nle(t),ir(Mv.count(rd(t),t)+(rd(t).getUTCDay()===4),e,2)}function BKe(t){return t.getUTCDay()}function UKe(t,e){return ir(MC.count(rd(t)-1,t),e,2)}function zKe(t,e){return ir(t.getUTCFullYear()%100,e,2)}function HKe(t,e){return t=nle(t),ir(t.getUTCFullYear()%100,e,2)}function WKe(t,e){return ir(t.getUTCFullYear()%1e4,e,4)}function VKe(t,e){var r=t.getUTCDay();return t=r>=4||r===0?Mv(t):Mv.ceil(t),ir(t.getUTCFullYear()%1e4,e,4)}function qKe(){return"+0000"}function GV(){return"%"}function KV(t){return+t}function YV(t){return Math.floor(+t/1e3)}var Rg,sle,ile;GKe({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 GKe(t){return Rg=GGe(t),sle=Rg.format,Rg.parse,ile=Rg.utcFormat,Rg.utcParse,Rg}function KKe(t){return new Date(t)}function YKe(t){return t instanceof Date?+t:+new Date(+t)}function S8(t,e,r,n,s,i,o,l,c,u){var d=u8(),h=d.invert,f=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),x=u("%I %p"),y=u("%a %d"),v=u("%b %d"),b=u("%B"),w=u("%Y");function j(N){return(c(N)<N?p:l(N)<N?g:o(N)<N?m:i(N)<N?x:n(N)<N?s(N)<N?y:v:r(N)<N?b:w)(N)}return d.invert=function(N){return new Date(h(N))},d.domain=function(N){return arguments.length?f(Array.from(N,YKe)):f().map(KKe)},d.ticks=function(N){var C=f();return t(C[0],C[C.length-1],N??10)},d.tickFormat=function(N,C){return C==null?j:u(C)},d.nice=function(N){var C=f();return(!N||typeof N.range!="function")&&(N=e(C[0],C[C.length-1],N??10)),N?f(Voe(C,N)):d},d.copy=function(){return cS(d,S8(t,e,r,n,s,i,o,l,c,u))},d}function XKe(){return Eo.apply(S8(VGe,qGe,td,_8,g2,uS,b8,x8,up,sle).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function QKe(){return Eo.apply(S8(HGe,WGe,rd,j8,y2,m2,w8,v8,up,ile).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function x2(){var t=0,e=1,r,n,s,i,o=vi,l=!1,c;function u(h){return h==null||isNaN(h=+h)?c:o(s===0?.5:(h=(i(h)-r)*s,l?Math.max(0,Math.min(1,h)):h))}u.domain=function(h){return arguments.length?([t,e]=h,r=i(t=+t),n=i(e=+e),s=r===n?0:1/(n-r),u):[t,e]},u.clamp=function(h){return arguments.length?(l=!!h,u):l},u.interpolator=function(h){return arguments.length?(o=h,u):o};function d(h){return function(f){var p,g;return arguments.length?([p,g]=f,o=h(p,g),u):[o(0),o(1)]}}return u.range=d(Tb),u.rangeRound=d(c8),u.unknown=function(h){return arguments.length?(c=h,u):c},function(h){return i=h,r=h(t),n=h(e),s=r===n?0:1/(n-r),u}}function jf(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function ale(){var t=_f(x2()(vi));return t.copy=function(){return jf(t,ale())},dd.apply(t,arguments)}function ole(){var t=f8(x2()).domain([1,10]);return t.copy=function(){return jf(t,ole()).base(t.base())},dd.apply(t,arguments)}function lle(){var t=p8(x2());return t.copy=function(){return jf(t,lle()).constant(t.constant())},dd.apply(t,arguments)}function N8(){var t=m8(x2());return t.copy=function(){return jf(t,N8()).exponent(t.exponent())},dd.apply(t,arguments)}function ZKe(){return N8.apply(null,arguments).exponent(.5)}function cle(){var t=[],e=vi;function r(n){if(n!=null&&!isNaN(n=+n))return e((oS(t,n,1)-1)/(t.length-1))}return r.domain=function(n){if(!arguments.length)return t.slice();t=[];for(let s of n)s!=null&&!isNaN(s=+s)&&t.push(s);return t.sort(Gh),r},r.interpolator=function(n){return arguments.length?(e=n,r):e},r.range=function(){return t.map((n,s)=>e(s/(t.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(s,i)=>Fqe(t,i/n))},r.copy=function(){return cle(e).domain(t)},dd.apply(r,arguments)}function v2(){var t=0,e=.5,r=1,n=1,s,i,o,l,c,u=vi,d,h=!1,f;function p(m){return isNaN(m=+m)?f:(m=.5+((m=+d(m))-i)*(n*m<n*i?l:c),u(h?Math.max(0,Math.min(1,m)):m))}p.domain=function(m){return arguments.length?([t,e,r]=m,s=d(t=+t),i=d(e=+e),o=d(r=+r),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),n=i<s?-1:1,p):[t,e,r]},p.clamp=function(m){return arguments.length?(h=!!m,p):h},p.interpolator=function(m){return arguments.length?(u=m,p):u};function g(m){return function(x){var y,v,b;return arguments.length?([y,v,b]=x,u=uGe(m,[y,v,b]),p):[u(0),u(.5),u(1)]}}return p.range=g(Tb),p.rangeRound=g(c8),p.unknown=function(m){return arguments.length?(f=m,p):f},function(m){return d=m,s=m(t),i=m(e),o=m(r),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),n=i<s?-1:1,p}}function ule(){var t=_f(v2()(vi));return t.copy=function(){return jf(t,ule())},dd.apply(t,arguments)}function dle(){var t=f8(v2()).domain([.1,1,10]);return t.copy=function(){return jf(t,dle()).base(t.base())},dd.apply(t,arguments)}function hle(){var t=p8(v2());return t.copy=function(){return jf(t,hle()).constant(t.constant())},dd.apply(t,arguments)}function A8(){var t=m8(v2());return t.copy=function(){return jf(t,A8()).exponent(t.exponent())},dd.apply(t,arguments)}function JKe(){return A8.apply(null,arguments).exponent(.5)}const XV=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:m1,scaleDiverging:ule,scaleDivergingLog:dle,scaleDivergingPow:A8,scaleDivergingSqrt:JKe,scaleDivergingSymlog:hle,scaleIdentity:Woe,scaleImplicit:mL,scaleLinear:OC,scaleLog:qoe,scaleOrdinal:a8,scalePoint:ww,scalePow:g8,scaleQuantile:Yoe,scaleQuantize:Xoe,scaleRadial:Koe,scaleSequential:ale,scaleSequentialLog:ole,scaleSequentialPow:N8,scaleSequentialQuantile:cle,scaleSequentialSqrt:ZKe,scaleSequentialSymlog:lle,scaleSqrt:IGe,scaleSymlog:Goe,scaleThreshold:Qoe,scaleTime:XKe,scaleUtc:QKe,tickFormat:Hoe},Symbol.toStringTag,{value:"Module"}));var eYe=_b;function tYe(t,e,r){for(var n=-1,s=t.length;++n<s;){var i=t[n],o=e(i);if(o!=null&&(l===void 0?o===o&&!eYe(o):r(o,l)))var l=o,c=i}return c}var b2=tYe;function rYe(t,e){return t>e}var fle=rYe,nYe=b2,sYe=fle,iYe=kb;function aYe(t){return t&&t.length?nYe(t,iYe,sYe):void 0}var oYe=aYe;const w2=qt(oYe);function lYe(t,e){return t<e}var ple=lYe,cYe=b2,uYe=ple,dYe=kb;function hYe(t){return t&&t.length?cYe(t,dYe,uYe):void 0}var fYe=hYe;const _2=qt(fYe);var pYe=$$,mYe=wf,gYe=woe,yYe=ta;function xYe(t,e){var r=yYe(t)?pYe:gYe;return r(t,mYe(e))}var vYe=xYe,bYe=voe,wYe=vYe;function _Ye(t,e){return bYe(wYe(t,e),1)}var jYe=_Ye;const SYe=qt(jYe);var NYe=t8;function AYe(t,e){return NYe(t,e)}var EYe=AYe;const E8=qt(EYe);var Pb=1e9,CYe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},k8,Jr=!0,_o="[DecimalError] ",Mm=_o+"Invalid argument: ",C8=_o+"Exponent out of range: ",Ob=Math.floor,Gf=Math.pow,kYe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ea,hs=1e7,Hr=7,mle=9007199254740991,DC=Ob(mle/Hr),ut={};ut.absoluteValue=ut.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};ut.comparedTo=ut.cmp=function(t){var e,r,n,s,i=this;if(t=new i.constructor(t),i.s!==t.s)return i.s||-t.s;if(i.e!==t.e)return i.e>t.e^i.s<0?1:-1;for(n=i.d.length,s=t.d.length,e=0,r=n<s?n:s;e<r;++e)if(i.d[e]!==t.d[e])return i.d[e]>t.d[e]^i.s<0?1:-1;return n===s?0:n>s^i.s<0?1:-1};ut.decimalPlaces=ut.dp=function(){var t=this,e=t.d.length-1,r=(e-t.e)*Hr;if(e=t.d[e],e)for(;e%10==0;e/=10)r--;return r<0?0:r};ut.dividedBy=ut.div=function(t){return Bu(this,new this.constructor(t))};ut.dividedToIntegerBy=ut.idiv=function(t){var e=this,r=e.constructor;return Sr(Bu(e,new r(t),0,1),r.precision)};ut.equals=ut.eq=function(t){return!this.cmp(t)};ut.exponent=function(){return Fn(this)};ut.greaterThan=ut.gt=function(t){return this.cmp(t)>0};ut.greaterThanOrEqualTo=ut.gte=function(t){return this.cmp(t)>=0};ut.isInteger=ut.isint=function(){return this.e>this.d.length-2};ut.isNegative=ut.isneg=function(){return this.s<0};ut.isPositive=ut.ispos=function(){return this.s>0};ut.isZero=function(){return this.s===0};ut.lessThan=ut.lt=function(t){return this.cmp(t)<0};ut.lessThanOrEqualTo=ut.lte=function(t){return this.cmp(t)<1};ut.logarithm=ut.log=function(t){var e,r=this,n=r.constructor,s=n.precision,i=s+5;if(t===void 0)t=new n(10);else if(t=new n(t),t.s<1||t.eq(Ea))throw Error(_o+"NaN");if(r.s<1)throw Error(_o+(r.s?"NaN":"-Infinity"));return r.eq(Ea)?new n(0):(Jr=!1,e=Bu(b1(r,i),b1(t,i),i),Jr=!0,Sr(e,s))};ut.minus=ut.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?xle(e,t):gle(e,(t.s=-t.s,t))};ut.modulo=ut.mod=function(t){var e,r=this,n=r.constructor,s=n.precision;if(t=new n(t),!t.s)throw Error(_o+"NaN");return r.s?(Jr=!1,e=Bu(r,t,0,1).times(t),Jr=!0,r.minus(e)):Sr(new n(r),s)};ut.naturalExponential=ut.exp=function(){return yle(this)};ut.naturalLogarithm=ut.ln=function(){return b1(this)};ut.negated=ut.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};ut.plus=ut.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?gle(e,t):xle(e,(t.s=-t.s,t))};ut.precision=ut.sd=function(t){var e,r,n,s=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Mm+t);if(e=Fn(s)+1,n=s.d.length-1,r=n*Hr+1,n=s.d[n],n){for(;n%10==0;n/=10)r--;for(n=s.d[0];n>=10;n/=10)r++}return t&&e>r?e:r};ut.squareRoot=ut.sqrt=function(){var t,e,r,n,s,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(_o+"NaN")}for(t=Fn(l),Jr=!1,s=Math.sqrt(+l),s==0||s==1/0?(e=oc(l.d),(e.length+t)%2==0&&(e+="0"),s=Math.sqrt(e),t=Ob((t+1)/2)-(t<0||t%2),s==1/0?e="5e"+t:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),n=new c(e)):n=new c(s.toString()),r=c.precision,s=o=r+3;;)if(i=n,n=i.plus(Bu(l,i,o+2)).times(.5),oc(i.d).slice(0,o)===(e=oc(n.d)).slice(0,o)){if(e=e.slice(o-3,o+1),s==o&&e=="4999"){if(Sr(i,r+1,0),i.times(i).eq(l)){n=i;break}}else if(e!="9999")break;o+=4}return Jr=!0,Sr(n,r)};ut.times=ut.mul=function(t){var e,r,n,s,i,o,l,c,u,d=this,h=d.constructor,f=d.d,p=(t=new h(t)).d;if(!d.s||!t.s)return new h(0);for(t.s*=d.s,r=d.e+t.e,c=f.length,u=p.length,c<u&&(i=f,f=p,p=i,o=c,c=u,u=o),i=[],o=c+u,n=o;n--;)i.push(0);for(n=u;--n>=0;){for(e=0,s=c+n;s>n;)l=i[s]+p[n]*f[s-n-1]+e,i[s--]=l%hs|0,e=l/hs|0;i[s]=(i[s]+e)%hs|0}for(;!i[--o];)i.pop();return e?++r:i.shift(),t.d=i,t.e=r,Jr?Sr(t,h.precision):t};ut.toDecimalPlaces=ut.todp=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(_c(t,0,Pb),e===void 0?e=n.rounding:_c(e,0,8),Sr(r,t+Fn(r)+1,e))};ut.toExponential=function(t,e){var r,n=this,s=n.constructor;return t===void 0?r=Xm(n,!0):(_c(t,0,Pb),e===void 0?e=s.rounding:_c(e,0,8),n=Sr(new s(n),t+1,e),r=Xm(n,!0,t+1)),r};ut.toFixed=function(t,e){var r,n,s=this,i=s.constructor;return t===void 0?Xm(s):(_c(t,0,Pb),e===void 0?e=i.rounding:_c(e,0,8),n=Sr(new i(s),t+Fn(s)+1,e),r=Xm(n.abs(),!1,t+Fn(n)+1),s.isneg()&&!s.isZero()?"-"+r:r)};ut.toInteger=ut.toint=function(){var t=this,e=t.constructor;return Sr(new e(t),Fn(t)+1,e.rounding)};ut.toNumber=function(){return+this};ut.toPower=ut.pow=function(t){var e,r,n,s,i,o,l=this,c=l.constructor,u=12,d=+(t=new c(t));if(!t.s)return new c(Ea);if(l=new c(l),!l.s){if(t.s<1)throw Error(_o+"Infinity");return l}if(l.eq(Ea))return l;if(n=c.precision,t.eq(Ea))return Sr(l,n);if(e=t.e,r=t.d.length-1,o=e>=r,i=l.s,o){if((r=d<0?-d:d)<=mle){for(s=new c(Ea),e=Math.ceil(n/Hr+4),Jr=!1;r%2&&(s=s.times(l),ZV(s.d,e)),r=Ob(r/2),r!==0;)l=l.times(l),ZV(l.d,e);return Jr=!0,t.s<0?new c(Ea).div(s):Sr(s,n)}}else if(i<0)throw Error(_o+"NaN");return i=i<0&&t.d[Math.max(e,r)]&1?-1:1,l.s=1,Jr=!1,s=t.times(b1(l,n+u)),Jr=!0,s=yle(s),s.s=i,s};ut.toPrecision=function(t,e){var r,n,s=this,i=s.constructor;return t===void 0?(r=Fn(s),n=Xm(s,r<=i.toExpNeg||r>=i.toExpPos)):(_c(t,1,Pb),e===void 0?e=i.rounding:_c(e,0,8),s=Sr(new i(s),t,e),r=Fn(s),n=Xm(s,t<=r||r<=i.toExpNeg,t)),n};ut.toSignificantDigits=ut.tosd=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(_c(t,1,Pb),e===void 0?e=n.rounding:_c(e,0,8)),Sr(new n(r),t,e)};ut.toString=ut.valueOf=ut.val=ut.toJSON=ut[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Fn(t),r=t.constructor;return Xm(t,e<=r.toExpNeg||e>=r.toExpPos)};function gle(t,e){var r,n,s,i,o,l,c,u,d=t.constructor,h=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),Jr?Sr(e,h):e;if(c=t.d,u=e.d,o=t.e,s=e.e,c=c.slice(),i=o-s,i){for(i<0?(n=c,i=-i,l=u.length):(n=u,s=o,l=c.length),o=Math.ceil(h/Hr),l=o>l?o+1:l+1,i>l&&(i=l,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(l=c.length,i=u.length,l-i<0&&(i=l,n=u,u=c,c=n),r=0;i;)r=(c[--i]=c[i]+u[i]+r)/hs|0,c[i]%=hs;for(r&&(c.unshift(r),++s),l=c.length;c[--l]==0;)c.pop();return e.d=c,e.e=s,Jr?Sr(e,h):e}function _c(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Mm+t)}function oc(t){var e,r,n,s=t.length-1,i="",o=t[0];if(s>0){for(i+=o,e=1;e<s;e++)n=t[e]+"",r=Hr-n.length,r&&(i+=kd(r)),i+=n;o=t[e],n=o+"",r=Hr-n.length,r&&(i+=kd(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var Bu=function(){function t(n,s){var i,o=0,l=n.length;for(n=n.slice();l--;)i=n[l]*s+o,n[l]=i%hs|0,o=i/hs|0;return o&&n.unshift(o),n}function e(n,s,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(n[l]!=s[l]){c=n[l]>s[l]?1:-1;break}return c}function r(n,s,i){for(var o=0;i--;)n[i]-=o,o=n[i]<s[i]?1:0,n[i]=o*hs+n[i]-s[i];for(;!n[0]&&n.length>1;)n.shift()}return function(n,s,i,o){var l,c,u,d,h,f,p,g,m,x,y,v,b,w,j,N,C,k,E=n.constructor,M=n.s==s.s?1:-1,z=n.d,P=s.d;if(!n.s)return new E(n);if(!s.s)throw Error(_o+"Division by zero");for(c=n.e-s.e,C=P.length,j=z.length,p=new E(M),g=p.d=[],u=0;P[u]==(z[u]||0);)++u;if(P[u]>(z[u]||0)&&--c,i==null?v=i=E.precision:o?v=i+(Fn(n)-Fn(s))+1:v=i,v<0)return new E(0);if(v=v/Hr+2|0,u=0,C==1)for(d=0,P=P[0],v++;(u<j||d)&&v--;u++)b=d*hs+(z[u]||0),g[u]=b/P|0,d=b%P|0;else{for(d=hs/(P[0]+1)|0,d>1&&(P=t(P,d),z=t(z,d),C=P.length,j=z.length),w=C,m=z.slice(0,C),x=m.length;x<C;)m[x++]=0;k=P.slice(),k.unshift(0),N=P[0],P[1]>=hs/2&&++N;do d=0,l=e(P,m,C,x),l<0?(y=m[0],C!=x&&(y=y*hs+(m[1]||0)),d=y/N|0,d>1?(d>=hs&&(d=hs-1),h=t(P,d),f=h.length,x=m.length,l=e(h,m,f,x),l==1&&(d--,r(h,C<f?k:P,f))):(d==0&&(l=d=1),h=P.slice()),f=h.length,f<x&&h.unshift(0),r(m,h,x),l==-1&&(x=m.length,l=e(P,m,C,x),l<1&&(d++,r(m,C<x?k:P,x))),x=m.length):l===0&&(d++,m=[0]),g[u++]=d,l&&m[0]?m[x++]=z[w]||0:(m=[z[w]],x=1);while((w++<j||m[0]!==void 0)&&v--)}return g[0]||g.shift(),p.e=c,Sr(p,o?i+Fn(p)+1:i)}}();function yle(t,e){var r,n,s,i,o,l,c=0,u=0,d=t.constructor,h=d.precision;if(Fn(t)>16)throw Error(C8+Fn(t));if(!t.s)return new d(Ea);for(e==null?(Jr=!1,l=h):l=e,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),u+=5;for(n=Math.log(Gf(2,u))/Math.LN10*2+5|0,l+=n,r=s=i=new d(Ea),d.precision=l;;){if(s=Sr(s.times(t),l),r=r.times(++c),o=i.plus(Bu(s,r,l)),oc(o.d).slice(0,l)===oc(i.d).slice(0,l)){for(;u--;)i=Sr(i.times(i),l);return d.precision=h,e==null?(Jr=!0,Sr(i,h)):i}i=o}}function Fn(t){for(var e=t.e*Hr,r=t.d[0];r>=10;r/=10)e++;return e}function sI(t,e,r){if(e>t.LN10.sd())throw Jr=!0,r&&(t.precision=r),Error(_o+"LN10 precision limit exceeded");return Sr(new t(t.LN10),e)}function kd(t){for(var e="";t--;)e+="0";return e}function b1(t,e){var r,n,s,i,o,l,c,u,d,h=1,f=10,p=t,g=p.d,m=p.constructor,x=m.precision;if(p.s<1)throw Error(_o+(p.s?"NaN":"-Infinity"));if(p.eq(Ea))return new m(0);if(e==null?(Jr=!1,u=x):u=e,p.eq(10))return e==null&&(Jr=!0),sI(m,u);if(u+=f,m.precision=u,r=oc(g),n=r.charAt(0),i=Fn(p),Math.abs(i)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(t),r=oc(p.d),n=r.charAt(0),h++;i=Fn(p),n>1?(p=new m("0."+r),i++):p=new m(n+"."+r.slice(1))}else return c=sI(m,u+2,x).times(i+""),p=b1(new m(n+"."+r.slice(1)),u-f).plus(c),m.precision=x,e==null?(Jr=!0,Sr(p,x)):p;for(l=o=p=Bu(p.minus(Ea),p.plus(Ea),u),d=Sr(p.times(p),u),s=3;;){if(o=Sr(o.times(d),u),c=l.plus(Bu(o,new m(s),u)),oc(c.d).slice(0,u)===oc(l.d).slice(0,u))return l=l.times(2),i!==0&&(l=l.plus(sI(m,u+2,x).times(i+""))),l=Bu(l,new m(h),u),m.precision=x,e==null?(Jr=!0,Sr(l,x)):l;l=c,s+=2}}function QV(t,e){var r,n,s;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;e.charCodeAt(n)===48;)++n;for(s=e.length;e.charCodeAt(s-1)===48;)--s;if(e=e.slice(n,s),e){if(s-=n,r=r-n-1,t.e=Ob(r/Hr),t.d=[],n=(r+1)%Hr,r<0&&(n+=Hr),n<s){for(n&&t.d.push(+e.slice(0,n)),s-=Hr;n<s;)t.d.push(+e.slice(n,n+=Hr));e=e.slice(n),n=Hr-e.length}else n-=s;for(;n--;)e+="0";if(t.d.push(+e),Jr&&(t.e>DC||t.e<-DC))throw Error(C8+r)}else t.s=0,t.e=0,t.d=[0];return t}function Sr(t,e,r){var n,s,i,o,l,c,u,d,h=t.d;for(o=1,i=h[0];i>=10;i/=10)o++;if(n=e-o,n<0)n+=Hr,s=e,u=h[d=0];else{if(d=Math.ceil((n+1)/Hr),i=h.length,d>=i)return t;for(u=i=h[d],o=1;i>=10;i/=10)o++;n%=Hr,s=n-Hr+o}if(r!==void 0&&(i=Gf(10,o-s-1),l=u/i%10|0,c=e<0||h[d+1]!==void 0||u%i,c=r<4?(l||c)&&(r==0||r==(t.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?s>0?u/Gf(10,o-s):0:h[d-1])%10&1||r==(t.s<0?8:7))),e<1||!h[0])return c?(i=Fn(t),h.length=1,e=e-i-1,h[0]=Gf(10,(Hr-e%Hr)%Hr),t.e=Ob(-e/Hr)||0):(h.length=1,h[0]=t.e=t.s=0),t;if(n==0?(h.length=d,i=1,d--):(h.length=d+1,i=Gf(10,Hr-n),h[d]=s>0?(u/Gf(10,o-s)%Gf(10,s)|0)*i:0),c)for(;;)if(d==0){(h[0]+=i)==hs&&(h[0]=1,++t.e);break}else{if(h[d]+=i,h[d]!=hs)break;h[d--]=0,i=1}for(n=h.length;h[--n]===0;)h.pop();if(Jr&&(t.e>DC||t.e<-DC))throw Error(C8+Fn(t));return t}function xle(t,e){var r,n,s,i,o,l,c,u,d,h,f=t.constructor,p=f.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new f(t),Jr?Sr(e,p):e;if(c=t.d,h=e.d,n=e.e,u=t.e,c=c.slice(),o=u-n,o){for(d=o<0,d?(r=c,o=-o,l=h.length):(r=h,n=u,l=c.length),s=Math.max(Math.ceil(p/Hr),l)+2,o>s&&(o=s,r.length=1),r.reverse(),s=o;s--;)r.push(0);r.reverse()}else{for(s=c.length,l=h.length,d=s<l,d&&(l=s),s=0;s<l;s++)if(c[s]!=h[s]){d=c[s]<h[s];break}o=0}for(d&&(r=c,c=h,h=r,e.s=-e.s),l=c.length,s=h.length-l;s>0;--s)c[l++]=0;for(s=h.length;s>o;){if(c[--s]<h[s]){for(i=s;i&&c[--i]===0;)c[i]=hs-1;--c[i],c[s]+=hs}c[s]-=h[s]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(e.d=c,e.e=n,Jr?Sr(e,p):e):new f(0)}function Xm(t,e,r){var n,s=Fn(t),i=oc(t.d),o=i.length;return e?(r&&(n=r-o)>0?i=i.charAt(0)+"."+i.slice(1)+kd(n):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s<0?"e":"e+")+s):s<0?(i="0."+kd(-s-1)+i,r&&(n=r-o)>0&&(i+=kd(n))):s>=o?(i+=kd(s+1-o),r&&(n=r-s-1)>0&&(i=i+"."+kd(n))):((n=s+1)<o&&(i=i.slice(0,n)+"."+i.slice(n)),r&&(n=r-o)>0&&(s+1===o&&(i+="."),i+=kd(n))),t.s<0?"-"+i:i}function ZV(t,e){if(t.length>e)return t.length=e,!0}function vle(t){var e,r,n;function s(i){var o=this;if(!(o instanceof s))return new s(i);if(o.constructor=s,i instanceof s){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(Mm+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return QV(o,i.toString())}else if(typeof i!="string")throw Error(Mm+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,kYe.test(i))QV(o,i);else throw Error(Mm+i)}if(s.prototype=ut,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=vle,s.config=s.set=TYe,t===void 0&&(t={}),t)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return s.config(t),s}function TYe(t){if(!t||typeof t!="object")throw Error(_o+"Object expected");var e,r,n,s=["precision",1,Pb,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<s.length;e+=3)if((n=t[r=s[e]])!==void 0)if(Ob(n)===n&&n>=s[e+1]&&n<=s[e+2])this[r]=n;else throw Error(Mm+r+": "+n);if((n=t[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Mm+r+": "+n);return this}var k8=vle(CYe);Ea=new k8(1);const br=k8;function PYe(t){return MYe(t)||RYe(t)||IYe(t)||OYe()}function OYe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IYe(t,e){if(t){if(typeof t=="string")return vL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vL(t,e)}}function RYe(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function MYe(t){if(Array.isArray(t))return vL(t)}function vL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var DYe=function(e){return e},ble={"@@functional/placeholder":!0},wle=function(e){return e===ble},JV=function(e){return function r(){return arguments.length===0||arguments.length===1&&wle(arguments.length<=0?void 0:arguments[0])?r:e.apply(void 0,arguments)}},LYe=function t(e,r){return e===1?r:JV(function(){for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];var o=s.filter(function(l){return l!==ble}).length;return o>=e?r.apply(void 0,s):t(e-o,JV(function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var d=s.map(function(h){return wle(h)?c.shift():h});return r.apply(void 0,PYe(d).concat(c))}))})},j2=function(e){return LYe(e.length,e)},bL=function(e,r){for(var n=[],s=e;s<r;++s)n[s-e]=s;return n},FYe=j2(function(t,e){return Array.isArray(e)?e.map(t):Object.keys(e).map(function(r){return e[r]}).map(t)}),$Ye=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r.length)return DYe;var s=r.reverse(),i=s[0],o=s.slice(1);return function(){return o.reduce(function(l,c){return c(l)},i.apply(void 0,arguments))}},wL=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},_le=function(e){var r=null,n=null;return function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];return r&&i.every(function(l,c){return l===r[c]})||(r=i,n=e.apply(void 0,i)),n}};function BYe(t){var e;return t===0?e=1:e=Math.floor(new br(t).abs().log(10).toNumber())+1,e}function UYe(t,e,r){for(var n=new br(t),s=0,i=[];n.lt(e)&&s<1e5;)i.push(n.toNumber()),n=n.add(r),s++;return i}var zYe=j2(function(t,e,r){var n=+t,s=+e;return n+r*(s-n)}),HYe=j2(function(t,e,r){var n=e-+t;return n=n||1/0,(r-t)/n}),WYe=j2(function(t,e,r){var n=e-+t;return n=n||1/0,Math.max(0,Math.min(1,(r-t)/n))});const S2={rangeStep:UYe,getDigitCount:BYe,interpolateNumber:zYe,uninterpolateNumber:HYe,uninterpolateTruncation:WYe};function _L(t){return GYe(t)||qYe(t)||jle(t)||VYe()}function VYe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qYe(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function GYe(t){if(Array.isArray(t))return jL(t)}function w1(t,e){return XYe(t)||YYe(t,e)||jle(t,e)||KYe()}function KYe(){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 jle(t,e){if(t){if(typeof t=="string")return jL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jL(t,e)}}function jL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function YYe(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var r=[],n=!0,s=!1,i=void 0;try{for(var o=t[Symbol.iterator](),l;!(n=(l=o.next()).done)&&(r.push(l.value),!(e&&r.length===e));n=!0);}catch(c){s=!0,i=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(s)throw i}}return r}}function XYe(t){if(Array.isArray(t))return t}function Sle(t){var e=w1(t,2),r=e[0],n=e[1],s=r,i=n;return r>n&&(s=n,i=r),[s,i]}function Nle(t,e,r){if(t.lte(0))return new br(0);var n=S2.getDigitCount(t.toNumber()),s=new br(10).pow(n),i=t.div(s),o=n!==1?.05:.1,l=new br(Math.ceil(i.div(o).toNumber())).add(r).mul(o),c=l.mul(s);return e?c:new br(Math.ceil(c))}function QYe(t,e,r){var n=1,s=new br(t);if(!s.isint()&&r){var i=Math.abs(t);i<1?(n=new br(10).pow(S2.getDigitCount(t)-1),s=new br(Math.floor(s.div(n).toNumber())).mul(n)):i>1&&(s=new br(Math.floor(t)))}else t===0?s=new br(Math.floor((e-1)/2)):r||(s=new br(Math.floor(t)));var o=Math.floor((e-1)/2),l=$Ye(FYe(function(c){return s.add(new br(c-o).mul(n)).toNumber()}),bL);return l(0,e)}function Ale(t,e,r,n){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(r-1)))return{step:new br(0),tickMin:new br(0),tickMax:new br(0)};var i=Nle(new br(e).sub(t).div(r-1),n,s),o;t<=0&&e>=0?o=new br(0):(o=new br(t).add(e).div(2),o=o.sub(new br(o).mod(i)));var l=Math.ceil(o.sub(t).div(i).toNumber()),c=Math.ceil(new br(e).sub(o).div(i).toNumber()),u=l+c+1;return u>r?Ale(t,e,r,n,s+1):(u<r&&(c=e>0?c+(r-u):c,l=e>0?l:l+(r-u)),{step:i,tickMin:o.sub(new br(l).mul(i)),tickMax:o.add(new br(c).mul(i))})}function ZYe(t){var e=w1(t,2),r=e[0],n=e[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(s,2),l=Sle([r,n]),c=w1(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var h=d===1/0?[u].concat(_L(bL(0,s-1).map(function(){return 1/0}))):[].concat(_L(bL(0,s-1).map(function(){return-1/0})),[d]);return r>n?wL(h):h}if(u===d)return QYe(u,s,i);var f=Ale(u,d,o,i),p=f.step,g=f.tickMin,m=f.tickMax,x=S2.rangeStep(g,m.add(new br(.1).mul(p)),p);return r>n?wL(x):x}function JYe(t,e){var r=w1(t,2),n=r[0],s=r[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Sle([n,s]),l=w1(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[n,s];if(c===u)return[c];var d=Math.max(e,2),h=Nle(new br(u).sub(c).div(d-1),i,0),f=[].concat(_L(S2.rangeStep(new br(c),new br(u).sub(new br(.99).mul(h)),h)),[u]);return n>s?wL(f):f}var eXe=_le(ZYe),tXe=_le(JYe),rXe="Invariant failed";function Dv(t,e){throw new Error(rXe)}var nXe=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Lv(t){"@babel/helpers - typeof";return Lv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lv(t)}function LC(){return LC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},LC.apply(this,arguments)}function sXe(t,e){return lXe(t)||oXe(t,e)||aXe(t,e)||iXe()}function iXe(){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 aXe(t,e){if(t){if(typeof t=="string")return eq(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eq(t,e)}}function eq(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function oXe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function lXe(t){if(Array.isArray(t))return t}function cXe(t,e){if(t==null)return{};var r=uXe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function uXe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function dXe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hXe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kle(n.key),n)}}function fXe(t,e,r){return e&&hXe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function pXe(t,e,r){return e=FC(e),mXe(t,Ele()?Reflect.construct(e,r||[],FC(t).constructor):e.apply(t,r))}function mXe(t,e){if(e&&(Lv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gXe(t)}function gXe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ele(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ele=function(){return!!t})()}function FC(t){return FC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},FC(t)}function yXe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&SL(t,e)}function SL(t,e){return SL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},SL(t,e)}function Cle(t,e,r){return e=kle(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kle(t){var e=xXe(t,"string");return Lv(e)=="symbol"?e:e+""}function xXe(t,e){if(Lv(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Lv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var T8=function(t){function e(){return dXe(this,e),pXe(this,e,arguments)}return yXe(e,t),fXe(e,[{key:"render",value:function(){var n=this.props,s=n.offset,i=n.layout,o=n.width,l=n.dataKey,c=n.data,u=n.dataPointFormatter,d=n.xAxis,h=n.yAxis,f=cXe(n,nXe),p=Lt(f,!1);this.props.direction==="x"&&d.type!=="number"&&Dv();var g=c.map(function(m){var x=u(m,l),y=x.x,v=x.y,b=x.value,w=x.errorVal;if(!w)return null;var j=[],N,C;if(Array.isArray(w)){var k=sXe(w,2);N=k[0],C=k[1]}else N=C=w;if(i==="vertical"){var E=d.scale,M=v+s,z=M+o,P=M-o,V=E(b-N),A=E(b+C);j.push({x1:A,y1:z,x2:A,y2:P}),j.push({x1:V,y1:M,x2:A,y2:M}),j.push({x1:V,y1:z,x2:V,y2:P})}else if(i==="horizontal"){var $=h.scale,K=y+s,G=K-o,Y=K+o,H=$(b-N),B=$(b+C);j.push({x1:G,y1:B,x2:Y,y2:B}),j.push({x1:K,y1:H,x2:K,y2:B}),j.push({x1:G,y1:H,x2:Y,y2:H})}return me.createElement(xn,LC({className:"recharts-errorBar",key:"bar-".concat(j.map(function(L){return"".concat(L.x1,"-").concat(L.x2,"-").concat(L.y1,"-").concat(L.y2)}))},p),j.map(function(L){return me.createElement("line",LC({},L,{key:"line-".concat(L.x1,"-").concat(L.x2,"-").concat(L.y1,"-").concat(L.y2)}))}))});return me.createElement(xn,{className:"recharts-errorBars"},g)}}])}(me.Component);Cle(T8,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});Cle(T8,"displayName","ErrorBar");function _1(t){"@babel/helpers - typeof";return _1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_1(t)}function tq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Rf(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?tq(Object(r),!0).forEach(function(n){vXe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function vXe(t,e,r){return e=bXe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bXe(t){var e=wXe(t,"string");return _1(e)=="symbol"?e:e+""}function wXe(t,e){if(_1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(_1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Tle=function(e){var r=e.children,n=e.formattedGraphicalItems,s=e.legendWidth,i=e.legendContent,o=ro(r,Fy);if(!o)return null;var l=Fy.defaultProps,c=l!==void 0?Rf(Rf({},l),o.props):{},u;return o.props&&o.props.payload?u=o.props&&o.props.payload:i==="children"?u=(n||[]).reduce(function(d,h){var f=h.item,p=h.props,g=p.sectors||p.data||[];return d.concat(g.map(function(m){return{type:o.props.iconType||f.props.legendType,value:m.name,color:m.fill,payload:m}}))},[]):u=(n||[]).map(function(d){var h=d.item,f=h.type.defaultProps,p=f!==void 0?Rf(Rf({},f),h.props):{},g=p.dataKey,m=p.name,x=p.legendType,y=p.hide;return{inactive:y,dataKey:g,type:c.iconType||x||"square",color:P8(h),value:m||g,payload:p}}),Rf(Rf(Rf({},c),Fy.getWithHeight(o,s)),{},{payload:u,item:o})};function j1(t){"@babel/helpers - typeof";return j1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j1(t)}function rq(t){return NXe(t)||SXe(t)||jXe(t)||_Xe()}function _Xe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jXe(t,e){if(t){if(typeof t=="string")return NL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return NL(t,e)}}function SXe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function NXe(t){if(Array.isArray(t))return NL(t)}function NL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function nq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function pn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nq(Object(r),!0).forEach(function(n){By(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function By(t,e,r){return e=AXe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function AXe(t){var e=EXe(t,"string");return j1(e)=="symbol"?e:e+""}function EXe(t,e){if(j1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(j1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ca(t,e,r){return Qt(t)||Qt(e)?r:Qn(e)?cl(t,e,r):Ft(e)?e(t):r}function _w(t,e,r,n){var s=SYe(t,function(l){return Ca(l,e)});if(r==="number"){var i=s.filter(function(l){return rt(l)||parseFloat(l)});return i.length?[_2(i),w2(i)]:[1/0,-1/0]}var o=n?s.filter(function(l){return!Qt(l)}):s;return o.map(function(l){return Qn(l)||l instanceof Date?l:""})}var CXe=function(e){var r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,u=0;u<l;u++){var d=u>0?s[u-1].coordinate:s[l-1].coordinate,h=s[u].coordinate,f=u>=l-1?s[0].coordinate:s[u+1].coordinate,p=void 0;if(ho(h-d)!==ho(f-h)){var g=[];if(ho(f-h)===ho(c[1]-c[0])){p=f;var m=h+c[1]-c[0];g[0]=Math.min(m,(m+d)/2),g[1]=Math.max(m,(m+d)/2)}else{p=d;var x=f+c[1]-c[0];g[0]=Math.min(h,(x+h)/2),g[1]=Math.max(h,(x+h)/2)}var y=[Math.min(h,(p+h)/2),Math.max(h,(p+h)/2)];if(e>y[0]&&e<=y[1]||e>=g[0]&&e<=g[1]){o=s[u].index;break}}else{var v=Math.min(d,f),b=Math.max(d,f);if(e>(v+h)/2&&e<=(b+h)/2){o=s[u].index;break}}}else for(var w=0;w<l;w++)if(w===0&&e<=(n[w].coordinate+n[w+1].coordinate)/2||w>0&&w<l-1&&e>(n[w].coordinate+n[w-1].coordinate)/2&&e<=(n[w].coordinate+n[w+1].coordinate)/2||w===l-1&&e>(n[w].coordinate+n[w-1].coordinate)/2){o=n[w].index;break}return o},P8=function(e){var r,n=e,s=n.type.displayName,i=(r=e.type)!==null&&r!==void 0&&r.defaultProps?pn(pn({},e.type.defaultProps),e.props):e.props,o=i.stroke,l=i.fill,c;switch(s){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},kXe=function(e){var r=e.barSize,n=e.totalSize,s=e.stackGroups,i=s===void 0?{}:s;if(!i)return{};for(var o={},l=Object.keys(i),c=0,u=l.length;c<u;c++)for(var d=i[l[c]].stackGroups,h=Object.keys(d),f=0,p=h.length;f<p;f++){var g=d[h[f]],m=g.items,x=g.cateAxisId,y=m.filter(function(C){return Fu(C.type).indexOf("Bar")>=0});if(y&&y.length){var v=y[0].type.defaultProps,b=v!==void 0?pn(pn({},v),y[0].props):y[0].props,w=b.barSize,j=b[x];o[j]||(o[j]=[]);var N=Qt(w)?r:w;o[j].push({item:y[0],stackList:y.slice(1),barSize:Qt(N)?void 0:Hi(N,n,0)})}}return o},TXe=function(e){var r=e.barGap,n=e.barCategoryGap,s=e.bandSize,i=e.sizeList,o=i===void 0?[]:i,l=e.maxBarSize,c=o.length;if(c<1)return null;var u=Hi(r,s,0,!0),d,h=[];if(o[0].barSize===+o[0].barSize){var f=!1,p=s/c,g=o.reduce(function(w,j){return w+j.barSize||0},0);g+=(c-1)*u,g>=s&&(g-=(c-1)*u,u=0),g>=s&&p>0&&(f=!0,p*=.9,g=c*p);var m=(s-g)/2>>0,x={offset:m-u,size:0};d=o.reduce(function(w,j){var N={item:j.item,position:{offset:x.offset+x.size+u,size:f?p:j.barSize}},C=[].concat(rq(w),[N]);return x=C[C.length-1].position,j.stackList&&j.stackList.length&&j.stackList.forEach(function(k){C.push({item:k,position:x})}),C},h)}else{var y=Hi(n,s,0,!0);s-2*y-(c-1)*u<=0&&(u=0);var v=(s-2*y-(c-1)*u)/c;v>1&&(v>>=0);var b=l===+l?Math.min(v,l):v;d=o.reduce(function(w,j,N){var C=[].concat(rq(w),[{item:j.item,position:{offset:y+(v+u)*N+(v-b)/2,size:b}}]);return j.stackList&&j.stackList.length&&j.stackList.forEach(function(k){C.push({item:k,position:C[C.length-1].position})}),C},h)}return d},PXe=function(e,r,n,s){var i=n.children,o=n.width,l=n.margin,c=o-(l.left||0)-(l.right||0),u=Tle({children:i,legendWidth:c});if(u){var d=s||{},h=d.width,f=d.height,p=u.align,g=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&g==="middle")&&p!=="center"&&rt(e[p]))return pn(pn({},e),{},By({},p,e[p]+(h||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&g!=="middle"&&rt(e[g]))return pn(pn({},e),{},By({},g,e[g]+(f||0)))}return e},OXe=function(e,r,n){return Qt(r)?!0:e==="horizontal"?r==="yAxis":e==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},Ple=function(e,r,n,s,i){var o=r.props.children,l=gc(o,T8).filter(function(u){return OXe(s,i,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return e.reduce(function(u,d){var h=Ca(d,n);if(Qt(h))return u;var f=Array.isArray(h)?[_2(h),w2(h)]:[h,h],p=c.reduce(function(g,m){var x=Ca(d,m,0),y=f[0]-Math.abs(Array.isArray(x)?x[0]:x),v=f[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(y,g[0]),Math.max(v,g[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},IXe=function(e,r,n,s,i){var o=r.map(function(l){return Ple(e,l,n,i,s)}).filter(function(l){return!Qt(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},Ole=function(e,r,n,s,i){var o=r.map(function(c){var u=c.props.dataKey;return n==="number"&&u&&Ple(e,c,u,s)||_w(e,u,n,i)});if(n==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var d=0,h=u.length;d<h;d++)l[u[d]]||(l[u[d]]=!0,c.push(u[d]));return c},[])},Ile=function(e,r){return e==="horizontal"&&r==="xAxis"||e==="vertical"&&r==="yAxis"||e==="centric"&&r==="angleAxis"||e==="radial"&&r==="radiusAxis"},C0=function(e,r,n){if(!e)return null;var s=e.scale,i=e.duplicateDomain,o=e.type,l=e.range,c=e.realScaleType==="scaleBand"?s.bandwidth()/2:2,u=(r||n)&&o==="category"&&s.bandwidth?s.bandwidth()/c:0;if(u=e.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?ho(l[0]-l[1])*2*u:u,r&&(e.ticks||e.niceTicks)){var d=(e.ticks||e.niceTicks).map(function(h){var f=i?i.indexOf(h):h;return{coordinate:s(f)+u,value:h,offset:u}});return d.filter(function(h){return!aS(h.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(h,f){return{coordinate:s(h)+u,value:h,index:f,offset:u}}):s.ticks&&!n?s.ticks(e.tickCount).map(function(h){return{coordinate:s(h)+u,value:h,offset:u}}):s.domain().map(function(h,f){return{coordinate:s(h)+u,value:i?i[h]:h,index:f,offset:u}})},iI=new WeakMap,kN=function(e,r){if(typeof r!="function")return e;iI.has(e)||iI.set(e,new WeakMap);var n=iI.get(e);if(n.has(r))return n.get(r);var s=function(){e.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,s),s},RXe=function(e,r,n){var s=e.scale,i=e.type,o=e.layout,l=e.axisType;if(s==="auto")return o==="radial"&&l==="radiusAxis"?{scale:m1(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:OC(),realScaleType:"linear"}:i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:ww(),realScaleType:"point"}:i==="category"?{scale:m1(),realScaleType:"band"}:{scale:OC(),realScaleType:"linear"};if(iS(s)){var c="scale".concat(o2(s));return{scale:(XV[c]||ww)(),realScaleType:XV[c]?c:"point"}}return Ft(s)?{scale:s}:{scale:ww(),realScaleType:"point"}},sq=1e-4,MXe=function(e){var r=e.domain();if(!(!r||r.length<=2)){var n=r.length,s=e.range(),i=Math.min(s[0],s[1])-sq,o=Math.max(s[0],s[1])+sq,l=e(r[0]),c=e(r[n-1]);(l<i||l>o||c<i||c>o)&&e.domain([r[0],r[n-1]])}},DXe=function(e){var r=e.length;if(!(r<=0))for(var n=0,s=e[0].length;n<s;++n)for(var i=0,o=0,l=0;l<r;++l){var c=aS(e[l][n][1])?e[l][n][0]:e[l][n][1];c>=0?(e[l][n][0]=i,e[l][n][1]=i+c,i=e[l][n][1]):(e[l][n][0]=o,e[l][n][1]=o+c,o=e[l][n][1])}},LXe=function(e){var r=e.length;if(!(r<=0))for(var n=0,s=e[0].length;n<s;++n)for(var i=0,o=0;o<r;++o){var l=aS(e[o][n][1])?e[o][n][0]:e[o][n][1];l>=0?(e[o][n][0]=i,e[o][n][1]=i+l,i=e[o][n][1]):(e[o][n][0]=0,e[o][n][1]=0)}},FXe={sign:DXe,expand:r8e,none:Av,silhouette:n8e,wiggle:s8e,positive:LXe},$Xe=function(e,r,n){var s=r.map(function(l){return l.props.dataKey}),i=FXe[n],o=t8e().keys(s).value(function(l,c){return+Ca(l,c,0)}).order(X4).offset(i);return o(e)},BXe=function(e,r,n,s,i,o){if(!e)return null;var l=o?r.reverse():r,c={},u=l.reduce(function(h,f){var p,g=(p=f.type)!==null&&p!==void 0&&p.defaultProps?pn(pn({},f.type.defaultProps),f.props):f.props,m=g.stackId,x=g.hide;if(x)return h;var y=g[n],v=h[y]||{hasStack:!1,stackGroups:{}};if(Qn(m)){var b=v.stackGroups[m]||{numericAxisId:n,cateAxisId:s,items:[]};b.items.push(f),v.hasStack=!0,v.stackGroups[m]=b}else v.stackGroups[i2("_stackId_")]={numericAxisId:n,cateAxisId:s,items:[f]};return pn(pn({},h),{},By({},y,v))},c),d={};return Object.keys(u).reduce(function(h,f){var p=u[f];if(p.hasStack){var g={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,x){var y=p.stackGroups[x];return pn(pn({},m),{},By({},x,{numericAxisId:n,cateAxisId:s,items:y.items,stackedData:$Xe(e,y.items,i)}))},g)}return pn(pn({},h),{},By({},f,p))},d)},UXe=function(e,r){var n=r.realScaleType,s=r.type,i=r.tickCount,o=r.originalDomain,l=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&s==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=e.domain();if(!u.length)return null;var d=eXe(u,i,l);return e.domain([_2(d),w2(d)]),{niceTicks:d}}if(i&&s==="number"){var h=e.domain(),f=tXe(h,i,l);return{niceTicks:f}}return null},zXe=function(e,r){var n,s=(n=e.type)!==null&&n!==void 0&&n.defaultProps?pn(pn({},e.type.defaultProps),e.props):e.props,i=s.stackId;if(Qn(i)){var o=r[i];if(o){var l=o.items.indexOf(e);return l>=0?o.stackedData[l]:null}}return null},HXe=function(e){return e.reduce(function(r,n){return[_2(n.concat([r[0]]).filter(rt)),w2(n.concat([r[1]]).filter(rt))]},[1/0,-1/0])},Rle=function(e,r,n){return Object.keys(e).reduce(function(s,i){var o=e[i],l=o.stackedData,c=l.reduce(function(u,d){var h=HXe(d.slice(r,n+1));return[Math.min(u[0],h[0]),Math.max(u[1],h[1])]},[1/0,-1/0]);return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},iq=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,aq=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,AL=function(e,r,n){if(Ft(e))return e(r,n);if(!Array.isArray(e))return r;var s=[];if(rt(e[0]))s[0]=n?e[0]:Math.min(e[0],r[0]);else if(iq.test(e[0])){var i=+iq.exec(e[0])[1];s[0]=r[0]-i}else Ft(e[0])?s[0]=e[0](r[0]):s[0]=r[0];if(rt(e[1]))s[1]=n?e[1]:Math.max(e[1],r[1]);else if(aq.test(e[1])){var o=+aq.exec(e[1])[1];s[1]=r[1]+o}else Ft(e[1])?s[1]=e[1](r[1]):s[1]=r[1];return s},EL=function(e,r,n){if(e&&e.scale&&e.scale.bandwidth){var s=e.scale.bandwidth();if(!n||s>0)return s}if(e&&r&&r.length>=2){for(var i=n8(r,function(h){return h.coordinate}),o=1/0,l=1,c=i.length;l<c;l++){var u=i[l],d=i[l-1];o=Math.min((u.coordinate||0)-(d.coordinate||0),o)}return o===1/0?0:o}return n?void 0:0},oq=function(e,r,n){return!e||!e.length||E8(e,cl(n,"type.defaultProps.domain"))?r:e},WXe=function(e,r){var n=e.type.defaultProps?pn(pn({},e.type.defaultProps),e.props):e.props,s=n.dataKey,i=n.name,o=n.unit,l=n.formatter,c=n.tooltipType,u=n.chartType,d=n.hide;return pn(pn({},Lt(e,!1)),{},{dataKey:s,unit:o,formatter:l,name:i||s,color:P8(e),value:Ca(r,s),type:c,payload:r,chartType:u,hide:d})};function S1(t){"@babel/helpers - typeof";return S1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S1(t)}function lq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Gc(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?lq(Object(r),!0).forEach(function(n){Mle(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Mle(t,e,r){return e=VXe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function VXe(t){var e=qXe(t,"string");return S1(e)=="symbol"?e:e+""}function qXe(t,e){if(S1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(S1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function GXe(t,e){return QXe(t)||XXe(t,e)||YXe(t,e)||KXe()}function KXe(){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 YXe(t,e){if(t){if(typeof t=="string")return cq(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return cq(t,e)}}function cq(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function XXe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function QXe(t){if(Array.isArray(t))return t}var $C=Math.PI/180,ZXe=function(e){return e*180/Math.PI},Mr=function(e,r,n,s){return{x:e+Math.cos(-$C*s)*n,y:r+Math.sin(-$C*s)*n}},Dle=function(e,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(e-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},JXe=function(e,r,n,s,i){var o=e.width,l=e.height,c=e.startAngle,u=e.endAngle,d=Hi(e.cx,o,o/2),h=Hi(e.cy,l,l/2),f=Dle(o,l,n),p=Hi(e.innerRadius,f,0),g=Hi(e.outerRadius,f,f*.8),m=Object.keys(r);return m.reduce(function(x,y){var v=r[y],b=v.domain,w=v.reversed,j;if(Qt(v.range))s==="angleAxis"?j=[c,u]:s==="radiusAxis"&&(j=[p,g]),w&&(j=[j[1],j[0]]);else{j=v.range;var N=j,C=GXe(N,2);c=C[0],u=C[1]}var k=RXe(v,i),E=k.realScaleType,M=k.scale;M.domain(b).range(j),MXe(M);var z=UXe(M,Gc(Gc({},v),{},{realScaleType:E})),P=Gc(Gc(Gc({},v),z),{},{range:j,radius:g,realScaleType:E,scale:M,cx:d,cy:h,innerRadius:p,outerRadius:g,startAngle:c,endAngle:u});return Gc(Gc({},x),{},Mle({},y,P))},{})},eQe=function(e,r){var n=e.x,s=e.y,i=r.x,o=r.y;return Math.sqrt(Math.pow(n-i,2)+Math.pow(s-o,2))},tQe=function(e,r){var n=e.x,s=e.y,i=r.cx,o=r.cy,l=eQe({x:n,y:s},{x:i,y:o});if(l<=0)return{radius:l};var c=(n-i)/l,u=Math.acos(c);return s>o&&(u=2*Math.PI-u),{radius:l,angle:ZXe(u),angleInRadian:u}},rQe=function(e){var r=e.startAngle,n=e.endAngle,s=Math.floor(r/360),i=Math.floor(n/360),o=Math.min(s,i);return{startAngle:r-o*360,endAngle:n-o*360}},nQe=function(e,r){var n=r.startAngle,s=r.endAngle,i=Math.floor(n/360),o=Math.floor(s/360),l=Math.min(i,o);return e+l*360},uq=function(e,r){var n=e.x,s=e.y,i=tQe({x:n,y:s},r),o=i.radius,l=i.angle,c=r.innerRadius,u=r.outerRadius;if(o<c||o>u)return!1;if(o===0)return!0;var d=rQe(r),h=d.startAngle,f=d.endAngle,p=l,g;if(h<=f){for(;p>f;)p-=360;for(;p<h;)p+=360;g=p>=h&&p<=f}else{for(;p>h;)p-=360;for(;p<f;)p+=360;g=p>=f&&p<=h}return g?Gc(Gc({},r),{},{radius:o,angle:nQe(p,r)}):null},Lle=function(e){return!S.isValidElement(e)&&!Ft(e)&&typeof e!="boolean"?e.className:""};function N1(t){"@babel/helpers - typeof";return N1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N1(t)}var sQe=["offset"];function iQe(t){return cQe(t)||lQe(t)||oQe(t)||aQe()}function aQe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oQe(t,e){if(t){if(typeof t=="string")return CL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return CL(t,e)}}function lQe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function cQe(t){if(Array.isArray(t))return CL(t)}function CL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function uQe(t,e){if(t==null)return{};var r=dQe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function dQe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function dq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Un(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?dq(Object(r),!0).forEach(function(n){hQe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):dq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function hQe(t,e,r){return e=fQe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fQe(t){var e=pQe(t,"string");return N1(e)=="symbol"?e:e+""}function pQe(t,e){if(N1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(N1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function A1(){return A1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},A1.apply(this,arguments)}var mQe=function(e){var r=e.value,n=e.formatter,s=Qt(e.children)?r:e.children;return Ft(n)?n(s):s},gQe=function(e,r){var n=ho(r-e),s=Math.min(Math.abs(r-e),360);return n*s},yQe=function(e,r,n){var s=e.position,i=e.viewBox,o=e.offset,l=e.className,c=i,u=c.cx,d=c.cy,h=c.innerRadius,f=c.outerRadius,p=c.startAngle,g=c.endAngle,m=c.clockWise,x=(h+f)/2,y=gQe(p,g),v=y>=0?1:-1,b,w;s==="insideStart"?(b=p+v*o,w=m):s==="insideEnd"?(b=g-v*o,w=!m):s==="end"&&(b=g+v*o,w=m),w=y<=0?w:!w;var j=Mr(u,d,x,b),N=Mr(u,d,x,b+(w?1:-1)*359),C="M".concat(j.x,",").concat(j.y,`
A`).concat(x,",").concat(x,",0,1,").concat(w?0:1,`,
`).concat(N.x,",").concat(N.y),k=Qt(e.id)?i2("recharts-radial-line-"):e.id;return me.createElement("text",A1({},n,{dominantBaseline:"central",className:Jt("recharts-radial-bar-label",l)}),me.createElement("defs",null,me.createElement("path",{id:k,d:C})),me.createElement("textPath",{xlinkHref:"#".concat(k)},r))},xQe=function(e){var r=e.viewBox,n=e.offset,s=e.position,i=r,o=i.cx,l=i.cy,c=i.innerRadius,u=i.outerRadius,d=i.startAngle,h=i.endAngle,f=(d+h)/2;if(s==="outside"){var p=Mr(o,l,u+n,f),g=p.x,m=p.y;return{x:g,y:m,textAnchor:g>=o?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var x=(c+u)/2,y=Mr(o,l,x,f),v=y.x,b=y.y;return{x:v,y:b,textAnchor:"middle",verticalAnchor:"middle"}},vQe=function(e){var r=e.viewBox,n=e.parentViewBox,s=e.offset,i=e.position,o=r,l=o.x,c=o.y,u=o.width,d=o.height,h=d>=0?1:-1,f=h*s,p=h>0?"end":"start",g=h>0?"start":"end",m=u>=0?1:-1,x=m*s,y=m>0?"end":"start",v=m>0?"start":"end";if(i==="top"){var b={x:l+u/2,y:c-h*s,textAnchor:"middle",verticalAnchor:p};return Un(Un({},b),n?{height:Math.max(c-n.y,0),width:u}:{})}if(i==="bottom"){var w={x:l+u/2,y:c+d+f,textAnchor:"middle",verticalAnchor:g};return Un(Un({},w),n?{height:Math.max(n.y+n.height-(c+d),0),width:u}:{})}if(i==="left"){var j={x:l-x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"};return Un(Un({},j),n?{width:Math.max(j.x-n.x,0),height:d}:{})}if(i==="right"){var N={x:l+u+x,y:c+d/2,textAnchor:v,verticalAnchor:"middle"};return Un(Un({},N),n?{width:Math.max(n.x+n.width-N.x,0),height:d}:{})}var C=n?{width:u,height:d}:{};return i==="insideLeft"?Un({x:l+x,y:c+d/2,textAnchor:v,verticalAnchor:"middle"},C):i==="insideRight"?Un({x:l+u-x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"},C):i==="insideTop"?Un({x:l+u/2,y:c+f,textAnchor:"middle",verticalAnchor:g},C):i==="insideBottom"?Un({x:l+u/2,y:c+d-f,textAnchor:"middle",verticalAnchor:p},C):i==="insideTopLeft"?Un({x:l+x,y:c+f,textAnchor:v,verticalAnchor:g},C):i==="insideTopRight"?Un({x:l+u-x,y:c+f,textAnchor:y,verticalAnchor:g},C):i==="insideBottomLeft"?Un({x:l+x,y:c+d-f,textAnchor:v,verticalAnchor:p},C):i==="insideBottomRight"?Un({x:l+u-x,y:c+d-f,textAnchor:y,verticalAnchor:p},C):jb(i)&&(rt(i.x)||lp(i.x))&&(rt(i.y)||lp(i.y))?Un({x:l+Hi(i.x,u),y:c+Hi(i.y,d),textAnchor:"end",verticalAnchor:"end"},C):Un({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},C)},bQe=function(e){return"cx"in e&&rt(e.cx)};function Es(t){var e=t.offset,r=e===void 0?5:e,n=uQe(t,sQe),s=Un({offset:r},n),i=s.viewBox,o=s.position,l=s.value,c=s.children,u=s.content,d=s.className,h=d===void 0?"":d,f=s.textBreakAll;if(!i||Qt(l)&&Qt(c)&&!S.isValidElement(u)&&!Ft(u))return null;if(S.isValidElement(u))return S.cloneElement(u,s);var p;if(Ft(u)){if(p=S.createElement(u,s),S.isValidElement(p))return p}else p=mQe(s);var g=bQe(i),m=Lt(s,!0);if(g&&(o==="insideStart"||o==="insideEnd"||o==="end"))return yQe(s,p,m);var x=g?xQe(s):vQe(s);return me.createElement(Ov,A1({className:Jt("recharts-label",h)},m,x,{breakAll:f}),p)}Es.displayName="Label";var Fle=function(e){var r=e.cx,n=e.cy,s=e.angle,i=e.startAngle,o=e.endAngle,l=e.r,c=e.radius,u=e.innerRadius,d=e.outerRadius,h=e.x,f=e.y,p=e.top,g=e.left,m=e.width,x=e.height,y=e.clockWise,v=e.labelViewBox;if(v)return v;if(rt(m)&&rt(x)){if(rt(h)&&rt(f))return{x:h,y:f,width:m,height:x};if(rt(p)&&rt(g))return{x:p,y:g,width:m,height:x}}return rt(h)&&rt(f)?{x:h,y:f,width:0,height:0}:rt(r)&&rt(n)?{cx:r,cy:n,startAngle:i||s||0,endAngle:o||s||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:y}:e.viewBox?e.viewBox:{}},wQe=function(e,r){return e?e===!0?me.createElement(Es,{key:"label-implicit",viewBox:r}):Qn(e)?me.createElement(Es,{key:"label-implicit",viewBox:r,value:e}):S.isValidElement(e)?e.type===Es?S.cloneElement(e,{key:"label-implicit",viewBox:r}):me.createElement(Es,{key:"label-implicit",content:e,viewBox:r}):Ft(e)?me.createElement(Es,{key:"label-implicit",content:e,viewBox:r}):jb(e)?me.createElement(Es,A1({viewBox:r},e,{key:"label-implicit"})):null:null},_Qe=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var s=e.children,i=Fle(e),o=gc(s,Es).map(function(c,u){return S.cloneElement(c,{viewBox:r||i,key:"label-".concat(u)})});if(!n)return o;var l=wQe(e.label,r||i);return[l].concat(iQe(o))};Es.parseViewBox=Fle;Es.renderCallByParent=_Qe;function jQe(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var SQe=jQe;const NQe=qt(SQe);function E1(t){"@babel/helpers - typeof";return E1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E1(t)}var AQe=["valueAccessor"],EQe=["data","dataKey","clockWise","id","textBreakAll"];function CQe(t){return OQe(t)||PQe(t)||TQe(t)||kQe()}function kQe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TQe(t,e){if(t){if(typeof t=="string")return kL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kL(t,e)}}function PQe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function OQe(t){if(Array.isArray(t))return kL(t)}function kL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function BC(){return BC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},BC.apply(this,arguments)}function hq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function fq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hq(Object(r),!0).forEach(function(n){IQe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function IQe(t,e,r){return e=RQe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function RQe(t){var e=MQe(t,"string");return E1(e)=="symbol"?e:e+""}function MQe(t,e){if(E1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(E1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pq(t,e){if(t==null)return{};var r=DQe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function DQe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var LQe=function(e){return Array.isArray(e.value)?NQe(e.value):e.value};function Dm(t){var e=t.valueAccessor,r=e===void 0?LQe:e,n=pq(t,AQe),s=n.data,i=n.dataKey,o=n.clockWise,l=n.id,c=n.textBreakAll,u=pq(n,EQe);return!s||!s.length?null:me.createElement(xn,{className:"recharts-label-list"},s.map(function(d,h){var f=Qt(i)?r(d,h):Ca(d&&d.payload,i),p=Qt(l)?{}:{id:"".concat(l,"-").concat(h)};return me.createElement(Es,BC({},Lt(d,!0),u,p,{parentViewBox:d.parentViewBox,value:f,textBreakAll:c,viewBox:Es.parseViewBox(Qt(o)?d:fq(fq({},d),{},{clockWise:o})),key:"label-".concat(h),index:h}))}))}Dm.displayName="LabelList";function FQe(t,e){return t?t===!0?me.createElement(Dm,{key:"labelList-implicit",data:e}):me.isValidElement(t)||Ft(t)?me.createElement(Dm,{key:"labelList-implicit",data:e,content:t}):jb(t)?me.createElement(Dm,BC({data:e},t,{key:"labelList-implicit"})):null:null}function $Qe(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var n=t.children,s=gc(n,Dm).map(function(o,l){return S.cloneElement(o,{data:e,key:"labelList-".concat(l)})});if(!r)return s;var i=FQe(t.label,e);return[i].concat(CQe(s))}Dm.renderCallByParent=$Qe;function C1(t){"@babel/helpers - typeof";return C1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C1(t)}function TL(){return TL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},TL.apply(this,arguments)}function mq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function gq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?mq(Object(r),!0).forEach(function(n){BQe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):mq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function BQe(t,e,r){return e=UQe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function UQe(t){var e=zQe(t,"string");return C1(e)=="symbol"?e:e+""}function zQe(t,e){if(C1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(C1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var HQe=function(e,r){var n=ho(r-e),s=Math.min(Math.abs(r-e),359.999);return n*s},TN=function(e){var r=e.cx,n=e.cy,s=e.radius,i=e.angle,o=e.sign,l=e.isExternal,c=e.cornerRadius,u=e.cornerIsExternal,d=c*(l?1:-1)+s,h=Math.asin(c/d)/$C,f=u?i:i+o*h,p=Mr(r,n,d,f),g=Mr(r,n,s,f),m=u?i-o*h:i,x=Mr(r,n,d*Math.cos(h*$C),m);return{center:p,circleTangency:g,lineTangency:x,theta:h}},$le=function(e){var r=e.cx,n=e.cy,s=e.innerRadius,i=e.outerRadius,o=e.startAngle,l=e.endAngle,c=HQe(o,l),u=o+c,d=Mr(r,n,i,o),h=Mr(r,n,i,u),f="M ".concat(d.x,",").concat(d.y,`
A `).concat(i,",").concat(i,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(o>u),`,
`).concat(h.x,",").concat(h.y,`
`);if(s>0){var p=Mr(r,n,s,o),g=Mr(r,n,s,u);f+="L ".concat(g.x,",").concat(g.y,`
A `).concat(s,",").concat(s,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`,
`).concat(p.x,",").concat(p.y," Z")}else f+="L ".concat(r,",").concat(n," Z");return f},WQe=function(e){var r=e.cx,n=e.cy,s=e.innerRadius,i=e.outerRadius,o=e.cornerRadius,l=e.forceCornerRadius,c=e.cornerIsExternal,u=e.startAngle,d=e.endAngle,h=ho(d-u),f=TN({cx:r,cy:n,radius:i,angle:u,sign:h,cornerRadius:o,cornerIsExternal:c}),p=f.circleTangency,g=f.lineTangency,m=f.theta,x=TN({cx:r,cy:n,radius:i,angle:d,sign:-h,cornerRadius:o,cornerIsExternal:c}),y=x.circleTangency,v=x.lineTangency,b=x.theta,w=c?Math.abs(u-d):Math.abs(u-d)-m-b;if(w<0)return l?"M ".concat(g.x,",").concat(g.y,`
a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
`):$le({cx:r,cy:n,innerRadius:s,outerRadius:i,startAngle:u,endAngle:d});var j="M ".concat(g.x,",").concat(g.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(p.x,",").concat(p.y,`
A`).concat(i,",").concat(i,",0,").concat(+(w>180),",").concat(+(h<0),",").concat(y.x,",").concat(y.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(v.x,",").concat(v.y,`
`);if(s>0){var N=TN({cx:r,cy:n,radius:s,angle:u,sign:h,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),C=N.circleTangency,k=N.lineTangency,E=N.theta,M=TN({cx:r,cy:n,radius:s,angle:d,sign:-h,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),z=M.circleTangency,P=M.lineTangency,V=M.theta,A=c?Math.abs(u-d):Math.abs(u-d)-E-V;if(A<0&&o===0)return"".concat(j,"L").concat(r,",").concat(n,"Z");j+="L".concat(P.x,",").concat(P.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(z.x,",").concat(z.y,`
A`).concat(s,",").concat(s,",0,").concat(+(A>180),",").concat(+(h>0),",").concat(C.x,",").concat(C.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(k.x,",").concat(k.y,"Z")}else j+="L".concat(r,",").concat(n,"Z");return j},VQe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Ble=function(e){var r=gq(gq({},VQe),e),n=r.cx,s=r.cy,i=r.innerRadius,o=r.outerRadius,l=r.cornerRadius,c=r.forceCornerRadius,u=r.cornerIsExternal,d=r.startAngle,h=r.endAngle,f=r.className;if(o<i||d===h)return null;var p=Jt("recharts-sector",f),g=o-i,m=Hi(l,g,0,!0),x;return m>0&&Math.abs(d-h)<360?x=WQe({cx:n,cy:s,innerRadius:i,outerRadius:o,cornerRadius:Math.min(m,g/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:h}):x=$le({cx:n,cy:s,innerRadius:i,outerRadius:o,startAngle:d,endAngle:h}),me.createElement("path",TL({},Lt(r,!0),{className:p,d:x,role:"img"}))};function k1(t){"@babel/helpers - typeof";return k1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k1(t)}function PL(){return PL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},PL.apply(this,arguments)}function yq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function xq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yq(Object(r),!0).forEach(function(n){qQe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function qQe(t,e,r){return e=GQe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function GQe(t){var e=KQe(t,"string");return k1(e)=="symbol"?e:e+""}function KQe(t,e){if(k1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(k1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var vq={curveBasisClosed:W$e,curveBasisOpen:V$e,curveBasis:H$e,curveBumpX:k$e,curveBumpY:T$e,curveLinearClosed:q$e,curveLinear:c2,curveMonotoneX:G$e,curveMonotoneY:K$e,curveNatural:Y$e,curveStep:X$e,curveStepAfter:Z$e,curveStepBefore:Q$e},PN=function(e){return e.x===+e.x&&e.y===+e.y},a0=function(e){return e.x},o0=function(e){return e.y},YQe=function(e,r){if(Ft(e))return e;var n="curve".concat(o2(e));return(n==="curveMonotone"||n==="curveBump")&&r?vq["".concat(n).concat(r==="vertical"?"Y":"X")]:vq[n]||c2},XQe=function(e){var r=e.type,n=r===void 0?"linear":r,s=e.points,i=s===void 0?[]:s,o=e.baseLine,l=e.layout,c=e.connectNulls,u=c===void 0?!1:c,d=YQe(n,l),h=u?i.filter(function(m){return PN(m)}):i,f;if(Array.isArray(o)){var p=u?o.filter(function(m){return PN(m)}):o,g=h.map(function(m,x){return xq(xq({},m),{},{base:p[x]})});return l==="vertical"?f=wN().y(o0).x1(a0).x0(function(m){return m.base.x}):f=wN().x(a0).y1(o0).y0(function(m){return m.base.y}),f.defined(PN).curve(d),f(g)}return l==="vertical"&&rt(o)?f=wN().y(o0).x1(a0).x0(o):rt(o)?f=wN().x(a0).y1(o0).y0(o):f=$ae().x(a0).y(o0),f.defined(PN).curve(d),f(h)},OL=function(e){var r=e.className,n=e.points,s=e.path,i=e.pathRef;if((!n||!n.length)&&!s)return null;var o=n&&n.length?XQe(e):s;return S.createElement("path",PL({},Lt(e,!1),hC(e),{className:Jt("recharts-curve",r),d:o,ref:i}))},Ule={exports:{}},QQe="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ZQe=QQe,JQe=ZQe;function zle(){}function Hle(){}Hle.resetWarningCache=zle;var eZe=function(){function t(n,s,i,o,l,c){if(c!==JQe){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Hle,resetWarningCache:zle};return r.PropTypes=r,r};Ule.exports=eZe();var tZe=Ule.exports;const cr=qt(tZe);var rZe=Object.getOwnPropertyNames,nZe=Object.getOwnPropertySymbols,sZe=Object.prototype.hasOwnProperty;function bq(t,e){return function(n,s,i){return t(n,s,i)&&e(n,s,i)}}function ON(t){return function(r,n,s){if(!r||!n||typeof r!="object"||typeof n!="object")return t(r,n,s);var i=s.cache,o=i.get(r),l=i.get(n);if(o&&l)return o===n&&l===r;i.set(r,n),i.set(n,r);var c=t(r,n,s);return i.delete(r),i.delete(n),c}}function wq(t){return rZe(t).concat(nZe(t))}var iZe=Object.hasOwn||function(t,e){return sZe.call(t,e)};function gg(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var aZe="__v",oZe="__o",lZe="_owner",_q=Object.getOwnPropertyDescriptor,jq=Object.keys;function cZe(t,e,r){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function uZe(t,e){return gg(t.getTime(),e.getTime())}function dZe(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function hZe(t,e){return t===e}function Sq(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var s=new Array(n),i=t.entries(),o,l,c=0;(o=i.next())&&!o.done;){for(var u=e.entries(),d=!1,h=0;(l=u.next())&&!l.done;){if(s[h]){h++;continue}var f=o.value,p=l.value;if(r.equals(f[0],p[0],c,h,t,e,r)&&r.equals(f[1],p[1],f[0],p[0],t,e,r)){d=s[h]=!0;break}h++}if(!d)return!1;c++}return!0}var fZe=gg;function pZe(t,e,r){var n=jq(t),s=n.length;if(jq(e).length!==s)return!1;for(;s-- >0;)if(!Wle(t,e,r,n[s]))return!1;return!0}function l0(t,e,r){var n=wq(t),s=n.length;if(wq(e).length!==s)return!1;for(var i,o,l;s-- >0;)if(i=n[s],!Wle(t,e,r,i)||(o=_q(t,i),l=_q(e,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function mZe(t,e){return gg(t.valueOf(),e.valueOf())}function gZe(t,e){return t.source===e.source&&t.flags===e.flags}function Nq(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var s=new Array(n),i=t.values(),o,l;(o=i.next())&&!o.done;){for(var c=e.values(),u=!1,d=0;(l=c.next())&&!l.done;){if(!s[d]&&r.equals(o.value,l.value,o.value,l.value,t,e,r)){u=s[d]=!0;break}d++}if(!u)return!1}return!0}function yZe(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function xZe(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Wle(t,e,r,n){return(n===lZe||n===oZe||n===aZe)&&(t.$$typeof||e.$$typeof)?!0:iZe(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var vZe="[object Arguments]",bZe="[object Boolean]",wZe="[object Date]",_Ze="[object Error]",jZe="[object Map]",SZe="[object Number]",NZe="[object Object]",AZe="[object RegExp]",EZe="[object Set]",CZe="[object String]",kZe="[object URL]",TZe=Array.isArray,Aq=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Eq=Object.assign,PZe=Object.prototype.toString.call.bind(Object.prototype.toString);function OZe(t){var e=t.areArraysEqual,r=t.areDatesEqual,n=t.areErrorsEqual,s=t.areFunctionsEqual,i=t.areMapsEqual,o=t.areNumbersEqual,l=t.areObjectsEqual,c=t.arePrimitiveWrappersEqual,u=t.areRegExpsEqual,d=t.areSetsEqual,h=t.areTypedArraysEqual,f=t.areUrlsEqual;return function(g,m,x){if(g===m)return!0;if(g==null||m==null)return!1;var y=typeof g;if(y!==typeof m)return!1;if(y!=="object")return y==="number"?o(g,m,x):y==="function"?s(g,m,x):!1;var v=g.constructor;if(v!==m.constructor)return!1;if(v===Object)return l(g,m,x);if(TZe(g))return e(g,m,x);if(Aq!=null&&Aq(g))return h(g,m,x);if(v===Date)return r(g,m,x);if(v===RegExp)return u(g,m,x);if(v===Map)return i(g,m,x);if(v===Set)return d(g,m,x);var b=PZe(g);return b===wZe?r(g,m,x):b===AZe?u(g,m,x):b===jZe?i(g,m,x):b===EZe?d(g,m,x):b===NZe?typeof g.then!="function"&&typeof m.then!="function"&&l(g,m,x):b===kZe?f(g,m,x):b===_Ze?n(g,m,x):b===vZe?l(g,m,x):b===bZe||b===SZe||b===CZe?c(g,m,x):!1}}function IZe(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,s={areArraysEqual:n?l0:cZe,areDatesEqual:uZe,areErrorsEqual:dZe,areFunctionsEqual:hZe,areMapsEqual:n?bq(Sq,l0):Sq,areNumbersEqual:fZe,areObjectsEqual:n?l0:pZe,arePrimitiveWrappersEqual:mZe,areRegExpsEqual:gZe,areSetsEqual:n?bq(Nq,l0):Nq,areTypedArraysEqual:n?l0:yZe,areUrlsEqual:xZe};if(r&&(s=Eq({},s,r(s))),e){var i=ON(s.areArraysEqual),o=ON(s.areMapsEqual),l=ON(s.areObjectsEqual),c=ON(s.areSetsEqual);s=Eq({},s,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return s}function RZe(t){return function(e,r,n,s,i,o,l){return t(e,r,l)}}function MZe(t){var e=t.circular,r=t.comparator,n=t.createState,s=t.equals,i=t.strict;if(n)return function(c,u){var d=n(),h=d.cache,f=h===void 0?e?new WeakMap:void 0:h,p=d.meta;return r(c,u,{cache:f,equals:s,meta:p,strict:i})};if(e)return function(c,u){return r(c,u,{cache:new WeakMap,equals:s,meta:void 0,strict:i})};var o={cache:void 0,equals:s,meta:void 0,strict:i};return function(c,u){return r(c,u,o)}}var DZe=Sf();Sf({strict:!0});Sf({circular:!0});Sf({circular:!0,strict:!0});Sf({createInternalComparator:function(){return gg}});Sf({strict:!0,createInternalComparator:function(){return gg}});Sf({circular:!0,createInternalComparator:function(){return gg}});Sf({circular:!0,createInternalComparator:function(){return gg},strict:!0});function Sf(t){t===void 0&&(t={});var e=t.circular,r=e===void 0?!1:e,n=t.createInternalComparator,s=t.createState,i=t.strict,o=i===void 0?!1:i,l=IZe(t),c=OZe(l),u=n?n(c):RZe(c);return MZe({circular:r,comparator:c,createState:s,equals:u,strict:o})}function LZe(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function Cq(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function s(i){r<0&&(r=i),i-r>e?(t(i),r=-1):LZe(s)};requestAnimationFrame(n)}function IL(t){"@babel/helpers - typeof";return IL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},IL(t)}function FZe(t){return zZe(t)||UZe(t)||BZe(t)||$Ze()}function $Ze(){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 BZe(t,e){if(t){if(typeof t=="string")return kq(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kq(t,e)}}function kq(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function UZe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function zZe(t){if(Array.isArray(t))return t}function HZe(){var t={},e=function(){return null},r=!1,n=function s(i){if(!r){if(Array.isArray(i)){if(!i.length)return;var o=i,l=FZe(o),c=l[0],u=l.slice(1);if(typeof c=="number"){Cq(s.bind(null,u),c);return}s(c),Cq(s.bind(null,u));return}IL(i)==="object"&&(t=i,e(t)),typeof i=="function"&&i()}};return{stop:function(){r=!0},start:function(i){r=!1,n(i)},subscribe:function(i){return e=i,function(){e=function(){return null}}}}}function T1(t){"@babel/helpers - typeof";return T1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T1(t)}function Tq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Pq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Tq(Object(r),!0).forEach(function(n){Vle(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Vle(t,e,r){return e=WZe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function WZe(t){var e=VZe(t,"string");return T1(e)==="symbol"?e:String(e)}function VZe(t,e){if(T1(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(T1(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var qZe=function(e,r){return[Object.keys(e),Object.keys(r)].reduce(function(n,s){return n.filter(function(i){return s.includes(i)})})},GZe=function(e){return e},KZe=function(e){return e.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},jw=function(e,r){return Object.keys(r).reduce(function(n,s){return Pq(Pq({},n),{},Vle({},s,e(s,r[s])))},{})},Oq=function(e,r,n){return e.map(function(s){return"".concat(KZe(s)," ").concat(r,"ms ").concat(n)}).join(",")};function YZe(t,e){return ZZe(t)||QZe(t,e)||qle(t,e)||XZe()}function XZe(){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 QZe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function ZZe(t){if(Array.isArray(t))return t}function JZe(t){return rJe(t)||tJe(t)||qle(t)||eJe()}function eJe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qle(t,e){if(t){if(typeof t=="string")return RL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return RL(t,e)}}function tJe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function rJe(t){if(Array.isArray(t))return RL(t)}function RL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var UC=1e-4,Gle=function(e,r){return[0,3*e,3*r-6*e,3*e-3*r+1]},Kle=function(e,r){return e.map(function(n,s){return n*Math.pow(r,s)}).reduce(function(n,s){return n+s})},Iq=function(e,r){return function(n){var s=Gle(e,r);return Kle(s,n)}},nJe=function(e,r){return function(n){var s=Gle(e,r),i=[].concat(JZe(s.map(function(o,l){return o*l}).slice(1)),[0]);return Kle(i,n)}},Rq=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var s=r[0],i=r[1],o=r[2],l=r[3];if(r.length===1)switch(r[0]){case"linear":s=0,i=0,o=1,l=1;break;case"ease":s=.25,i=.1,o=.25,l=1;break;case"ease-in":s=.42,i=0,o=1,l=1;break;case"ease-out":s=.42,i=0,o=.58,l=1;break;case"ease-in-out":s=0,i=0,o=.58,l=1;break;default:{var c=r[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var u=c[1].split(")")[0].split(",").map(function(x){return parseFloat(x)}),d=YZe(u,4);s=d[0],i=d[1],o=d[2],l=d[3]}}}var h=Iq(s,o),f=Iq(i,l),p=nJe(s,o),g=function(y){return y>1?1:y<0?0:y},m=function(y){for(var v=y>1?1:y,b=v,w=0;w<8;++w){var j=h(b)-v,N=p(b);if(Math.abs(j-v)<UC||N<UC)return f(b);b=g(b-j/N)}return f(b)};return m.isStepper=!1,m},sJe=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.stiff,n=r===void 0?100:r,s=e.damping,i=s===void 0?8:s,o=e.dt,l=o===void 0?17:o,c=function(d,h,f){var p=-(d-h)*n,g=f*i,m=f+(p-g)*l/1e3,x=f*l/1e3+d;return Math.abs(x-h)<UC&&Math.abs(m)<UC?[h,0]:[x,m]};return c.isStepper=!0,c.dt=l,c},iJe=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var s=r[0];if(typeof s=="string")switch(s){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Rq(s);case"spring":return sJe();default:if(s.split("(")[0]==="cubic-bezier")return Rq(s)}return typeof s=="function"?s:null};function P1(t){"@babel/helpers - typeof";return P1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P1(t)}function Mq(t){return lJe(t)||oJe(t)||Yle(t)||aJe()}function aJe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oJe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lJe(t){if(Array.isArray(t))return DL(t)}function Dq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function _s(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Dq(Object(r),!0).forEach(function(n){ML(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Dq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ML(t,e,r){return e=cJe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function cJe(t){var e=uJe(t,"string");return P1(e)==="symbol"?e:String(e)}function uJe(t,e){if(P1(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(P1(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dJe(t,e){return pJe(t)||fJe(t,e)||Yle(t,e)||hJe()}function hJe(){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 Yle(t,e){if(t){if(typeof t=="string")return DL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return DL(t,e)}}function DL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function fJe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function pJe(t){if(Array.isArray(t))return t}var zC=function(e,r,n){return e+(r-e)*n},LL=function(e){var r=e.from,n=e.to;return r!==n},mJe=function t(e,r,n){var s=jw(function(i,o){if(LL(o)){var l=e(o.from,o.to,o.velocity),c=dJe(l,2),u=c[0],d=c[1];return _s(_s({},o),{},{from:u,velocity:d})}return o},r);return n<1?jw(function(i,o){return LL(o)?_s(_s({},o),{},{velocity:zC(o.velocity,s[i].velocity,n),from:zC(o.from,s[i].from,n)}):o},r):t(e,s,n-1)};const gJe=function(t,e,r,n,s){var i=qZe(t,e),o=i.reduce(function(x,y){return _s(_s({},x),{},ML({},y,[t[y],e[y]]))},{}),l=i.reduce(function(x,y){return _s(_s({},x),{},ML({},y,{from:t[y],velocity:0,to:e[y]}))},{}),c=-1,u,d,h=function(){return null},f=function(){return jw(function(y,v){return v.from},l)},p=function(){return!Object.values(l).filter(LL).length},g=function(y){u||(u=y);var v=y-u,b=v/r.dt;l=mJe(r,l,b),s(_s(_s(_s({},t),e),f())),u=y,p()||(c=requestAnimationFrame(h))},m=function(y){d||(d=y);var v=(y-d)/n,b=jw(function(j,N){return zC.apply(void 0,Mq(N).concat([r(v)]))},o);if(s(_s(_s(_s({},t),e),b)),v<1)c=requestAnimationFrame(h);else{var w=jw(function(j,N){return zC.apply(void 0,Mq(N).concat([r(1)]))},o);s(_s(_s(_s({},t),e),w))}};return h=r.isStepper?g:m,function(){return requestAnimationFrame(h),function(){cancelAnimationFrame(c)}}};function Fv(t){"@babel/helpers - typeof";return Fv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fv(t)}var yJe=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function xJe(t,e){if(t==null)return{};var r=vJe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function vJe(t,e){if(t==null)return{};var r={},n=Object.keys(t),s,i;for(i=0;i<n.length;i++)s=n[i],!(e.indexOf(s)>=0)&&(r[s]=t[s]);return r}function aI(t){return jJe(t)||_Je(t)||wJe(t)||bJe()}function bJe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wJe(t,e){if(t){if(typeof t=="string")return FL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return FL(t,e)}}function _Je(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function jJe(t){if(Array.isArray(t))return FL(t)}function FL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Lq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Po(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Lq(Object(r),!0).forEach(function(n){k0(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Lq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function k0(t,e,r){return e=Xle(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function SJe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function NJe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Xle(n.key),n)}}function AJe(t,e,r){return e&&NJe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Xle(t){var e=EJe(t,"string");return Fv(e)==="symbol"?e:String(e)}function EJe(t,e){if(Fv(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Fv(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function CJe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&$L(t,e)}function $L(t,e){return $L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},$L(t,e)}function kJe(t){var e=TJe();return function(){var n=HC(t),s;if(e){var i=HC(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return BL(this,s)}}function BL(t,e){if(e&&(Fv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return UL(t)}function UL(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function TJe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function HC(t){return HC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},HC(t)}var rf=function(t){CJe(r,t);var e=kJe(r);function r(n,s){var i;SJe(this,r),i=e.call(this,n,s);var o=i.props,l=o.isActive,c=o.attributeName,u=o.from,d=o.to,h=o.steps,f=o.children,p=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(UL(i)),i.changeStyle=i.changeStyle.bind(UL(i)),!l||p<=0)return i.state={style:{}},typeof f=="function"&&(i.state={style:d}),BL(i);if(h&&h.length)i.state={style:h[0].style};else if(u){if(typeof f=="function")return i.state={style:u},BL(i);i.state={style:c?k0({},c,u):u}}else i.state={style:{}};return i}return AJe(r,[{key:"componentDidMount",value:function(){var s=this.props,i=s.isActive,o=s.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,u=i.shouldReAnimate,d=i.to,h=i.from,f=this.state.style;if(l){if(!o){var p={style:c?k0({},c,d):d};this.state&&f&&(c&&f[c]!==d||!c&&f!==d)&&this.setState(p);return}if(!(DZe(s.to,d)&&s.canBegin&&s.isActive)){var g=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=g||u?h:s.to;if(this.state&&f){var x={style:c?k0({},c,m):m};(c&&f[c]!==m||!c&&f!==m)&&this.setState(x)}this.runAnimation(Po(Po({},this.props),{},{from:m,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var i=this,o=s.from,l=s.to,c=s.duration,u=s.easing,d=s.begin,h=s.onAnimationEnd,f=s.onAnimationStart,p=gJe(o,l,iJe(u),c,this.changeStyle),g=function(){i.stopJSAnimation=p()};this.manager.start([f,d,g,c,h])}},{key:"runStepAnimation",value:function(s){var i=this,o=s.steps,l=s.begin,c=s.onAnimationStart,u=o[0],d=u.style,h=u.duration,f=h===void 0?0:h,p=function(m,x,y){if(y===0)return m;var v=x.duration,b=x.easing,w=b===void 0?"ease":b,j=x.style,N=x.properties,C=x.onAnimationEnd,k=y>0?o[y-1]:x,E=N||Object.keys(j);if(typeof w=="function"||w==="spring")return[].concat(aI(m),[i.runJSAnimation.bind(i,{from:k.style,to:j,duration:v,easing:w}),v]);var M=Oq(E,v,w),z=Po(Po(Po({},k.style),j),{},{transition:M});return[].concat(aI(m),[z,v,C]).filter(GZe)};return this.manager.start([c].concat(aI(o.reduce(p,[d,Math.max(f,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=HZe());var i=s.begin,o=s.duration,l=s.attributeName,c=s.to,u=s.easing,d=s.onAnimationStart,h=s.onAnimationEnd,f=s.steps,p=s.children,g=this.manager;if(this.unSubscribe=g.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(s);return}if(f.length>1){this.runStepAnimation(s);return}var m=l?k0({},l,c):c,x=Oq(Object.keys(m),o,u);g.start([d,i,Po(Po({},m),{},{transition:x}),o,h])}},{key:"render",value:function(){var s=this.props,i=s.children;s.begin;var o=s.duration;s.attributeName,s.easing;var l=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var c=xJe(s,yJe),u=S.Children.count(i),d=this.state.style;if(typeof i=="function")return i(d);if(!l||u===0||o<=0)return i;var h=function(p){var g=p.props,m=g.style,x=m===void 0?{}:m,y=g.className,v=S.cloneElement(p,Po(Po({},c),{},{style:Po(Po({},x),d),className:y}));return v};return u===1?h(S.Children.only(i)):me.createElement("div",null,S.Children.map(i,function(f){return h(f)}))}}]),r}(S.PureComponent);rf.displayName="Animate";rf.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};rf.propTypes={from:cr.oneOfType([cr.object,cr.string]),to:cr.oneOfType([cr.object,cr.string]),attributeName:cr.string,duration:cr.number,begin:cr.number,easing:cr.oneOfType([cr.string,cr.func]),steps:cr.arrayOf(cr.shape({duration:cr.number.isRequired,style:cr.object.isRequired,easing:cr.oneOfType([cr.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),cr.func]),properties:cr.arrayOf("string"),onAnimationEnd:cr.func})),children:cr.oneOfType([cr.node,cr.func]),isActive:cr.bool,canBegin:cr.bool,onAnimationEnd:cr.func,shouldReAnimate:cr.bool,onAnimationStart:cr.func,onAnimationReStart:cr.func};function O1(t){"@babel/helpers - typeof";return O1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O1(t)}function WC(){return WC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},WC.apply(this,arguments)}function PJe(t,e){return MJe(t)||RJe(t,e)||IJe(t,e)||OJe()}function OJe(){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 IJe(t,e){if(t){if(typeof t=="string")return Fq(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fq(t,e)}}function Fq(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function RJe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function MJe(t){if(Array.isArray(t))return t}function $q(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Bq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?$q(Object(r),!0).forEach(function(n){DJe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$q(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function DJe(t,e,r){return e=LJe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function LJe(t){var e=FJe(t,"string");return O1(e)=="symbol"?e:e+""}function FJe(t,e){if(O1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(O1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Uq=function(e,r,n,s,i){var o=Math.min(Math.abs(n)/2,Math.abs(s)/2),l=s>=0?1:-1,c=n>=0?1:-1,u=s>=0&&n>=0||s<0&&n<0?1:0,d;if(o>0&&i instanceof Array){for(var h=[0,0,0,0],f=0,p=4;f<p;f++)h[f]=i[f]>o?o:i[f];d="M".concat(e,",").concat(r+l*h[0]),h[0]>0&&(d+="A ".concat(h[0],",").concat(h[0],",0,0,").concat(u,",").concat(e+c*h[0],",").concat(r)),d+="L ".concat(e+n-c*h[1],",").concat(r),h[1]>0&&(d+="A ".concat(h[1],",").concat(h[1],",0,0,").concat(u,`,
`).concat(e+n,",").concat(r+l*h[1])),d+="L ".concat(e+n,",").concat(r+s-l*h[2]),h[2]>0&&(d+="A ".concat(h[2],",").concat(h[2],",0,0,").concat(u,`,
`).concat(e+n-c*h[2],",").concat(r+s)),d+="L ".concat(e+c*h[3],",").concat(r+s),h[3]>0&&(d+="A ".concat(h[3],",").concat(h[3],",0,0,").concat(u,`,
`).concat(e,",").concat(r+s-l*h[3])),d+="Z"}else if(o>0&&i===+i&&i>0){var g=Math.min(o,i);d="M ".concat(e,",").concat(r+l*g,`
A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+c*g,",").concat(r,`
L `).concat(e+n-c*g,",").concat(r,`
A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+n,",").concat(r+l*g,`
L `).concat(e+n,",").concat(r+s-l*g,`
A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+n-c*g,",").concat(r+s,`
L `).concat(e+c*g,",").concat(r+s,`
A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e,",").concat(r+s-l*g," Z")}else d="M ".concat(e,",").concat(r," h ").concat(n," v ").concat(s," h ").concat(-n," Z");return d},$Je=function(e,r){if(!e||!r)return!1;var n=e.x,s=e.y,i=r.x,o=r.y,l=r.width,c=r.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(i,i+l),d=Math.max(i,i+l),h=Math.min(o,o+c),f=Math.max(o,o+c);return n>=u&&n<=d&&s>=h&&s<=f}return!1},BJe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},O8=function(e){var r=Bq(Bq({},BJe),e),n=S.useRef(),s=S.useState(-1),i=PJe(s,2),o=i[0],l=i[1];S.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var w=n.current.getTotalLength();w&&l(w)}catch{}},[]);var c=r.x,u=r.y,d=r.width,h=r.height,f=r.radius,p=r.className,g=r.animationEasing,m=r.animationDuration,x=r.animationBegin,y=r.isAnimationActive,v=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||h!==+h||d===0||h===0)return null;var b=Jt("recharts-rectangle",p);return v?me.createElement(rf,{canBegin:o>0,from:{width:d,height:h,x:c,y:u},to:{width:d,height:h,x:c,y:u},duration:m,animationEasing:g,isActive:v},function(w){var j=w.width,N=w.height,C=w.x,k=w.y;return me.createElement(rf,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:m,isActive:y,easing:g},me.createElement("path",WC({},Lt(r,!0),{className:b,d:Uq(C,k,j,N,f),ref:n})))}):me.createElement("path",WC({},Lt(r,!0),{className:b,d:Uq(c,u,d,h,f)}))},UJe=["points","className","baseLinePoints","connectNulls"];function my(){return my=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},my.apply(this,arguments)}function zJe(t,e){if(t==null)return{};var r=HJe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function HJe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function zq(t){return GJe(t)||qJe(t)||VJe(t)||WJe()}function WJe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VJe(t,e){if(t){if(typeof t=="string")return zL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zL(t,e)}}function qJe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function GJe(t){if(Array.isArray(t))return zL(t)}function zL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Hq=function(e){return e&&e.x===+e.x&&e.y===+e.y},KJe=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return e.forEach(function(n){Hq(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),Hq(e[0])&&r[r.length-1].push(e[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},Sw=function(e,r){var n=KJe(e);r&&(n=[n.reduce(function(i,o){return[].concat(zq(i),zq(o))},[])]);var s=n.map(function(i){return i.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return n.length===1?"".concat(s,"Z"):s},YJe=function(e,r,n){var s=Sw(e,n);return"".concat(s.slice(-1)==="Z"?s.slice(0,-1):s,"L").concat(Sw(r.reverse(),n).slice(1))},XJe=function(e){var r=e.points,n=e.className,s=e.baseLinePoints,i=e.connectNulls,o=zJe(e,UJe);if(!r||!r.length)return null;var l=Jt("recharts-polygon",n);if(s&&s.length){var c=o.stroke&&o.stroke!=="none",u=YJe(r,s,i);return me.createElement("g",{className:l},me.createElement("path",my({},Lt(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),c?me.createElement("path",my({},Lt(o,!0),{fill:"none",d:Sw(r,i)})):null,c?me.createElement("path",my({},Lt(o,!0),{fill:"none",d:Sw(s,i)})):null)}var d=Sw(r,i);return me.createElement("path",my({},Lt(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:l,d}))};function HL(){return HL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},HL.apply(this,arguments)}var I8=function(e){var r=e.cx,n=e.cy,s=e.r,i=e.className,o=Jt("recharts-dot",i);return r===+r&&n===+n&&s===+s?S.createElement("circle",HL({},Lt(e,!1),hC(e),{className:o,cx:r,cy:n,r:s})):null};function I1(t){"@babel/helpers - typeof";return I1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I1(t)}var QJe=["x","y","top","left","width","height","className"];function WL(){return WL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},WL.apply(this,arguments)}function Wq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function ZJe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Wq(Object(r),!0).forEach(function(n){JJe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Wq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function JJe(t,e,r){return e=eet(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eet(t){var e=tet(t,"string");return I1(e)=="symbol"?e:e+""}function tet(t,e){if(I1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(I1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ret(t,e){if(t==null)return{};var r=net(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function net(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var set=function(e,r,n,s,i,o){return"M".concat(e,",").concat(i,"v").concat(s,"M").concat(o,",").concat(r,"h").concat(n)},iet=function(e){var r=e.x,n=r===void 0?0:r,s=e.y,i=s===void 0?0:s,o=e.top,l=o===void 0?0:o,c=e.left,u=c===void 0?0:c,d=e.width,h=d===void 0?0:d,f=e.height,p=f===void 0?0:f,g=e.className,m=ret(e,QJe),x=ZJe({x:n,y:i,top:l,left:u,width:h,height:p},m);return!rt(n)||!rt(i)||!rt(h)||!rt(p)||!rt(l)||!rt(u)?null:me.createElement("path",WL({},Lt(x,!0),{className:Jt("recharts-cross",g),d:set(n,i,h,p,l,u)}))},aet=b2,oet=fle,cet=wf;function uet(t,e){return t&&t.length?aet(t,cet(e),oet):void 0}var det=uet;const het=qt(det);var fet=b2,pet=wf,met=ple;function get(t,e){return t&&t.length?fet(t,pet(e),met):void 0}var yet=get;const xet=qt(yet);var vet=["cx","cy","angle","ticks","axisLine"],bet=["ticks","tick","angle","tickFormatter","stroke"];function $v(t){"@babel/helpers - typeof";return $v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$v(t)}function Nw(){return Nw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Nw.apply(this,arguments)}function Vq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Mf(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Vq(Object(r),!0).forEach(function(n){N2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Vq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function qq(t,e){if(t==null)return{};var r=wet(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function wet(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function _et(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gq(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Zle(n.key),n)}}function jet(t,e,r){return e&&Gq(t.prototype,e),r&&Gq(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Net(t,e,r){return e=VC(e),Aet(t,Qle()?Reflect.construct(e,r||[],VC(t).constructor):e.apply(t,r))}function Aet(t,e){if(e&&($v(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Eet(t)}function Eet(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Qle(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Qle=function(){return!!t})()}function VC(t){return VC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},VC(t)}function Cet(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&VL(t,e)}function VL(t,e){return VL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},VL(t,e)}function N2(t,e,r){return e=Zle(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zle(t){var e=ket(t,"string");return $v(e)=="symbol"?e:e+""}function ket(t,e){if($v(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if($v(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var A2=function(t){function e(){return _et(this,e),Net(this,e,arguments)}return Cet(e,t),jet(e,[{key:"getTickValueCoord",value:function(n){var s=n.coordinate,i=this.props,o=i.angle,l=i.cx,c=i.cy;return Mr(l,c,s,o)}},{key:"getTickTextAnchor",value:function(){var n=this.props.orientation,s;switch(n){case"left":s="end";break;case"right":s="start";break;default:s="middle";break}return s}},{key:"getViewBox",value:function(){var n=this.props,s=n.cx,i=n.cy,o=n.angle,l=n.ticks,c=het(l,function(d){return d.coordinate||0}),u=xet(l,function(d){return d.coordinate||0});return{cx:s,cy:i,startAngle:o,endAngle:o,innerRadius:u.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var n=this.props,s=n.cx,i=n.cy,o=n.angle,l=n.ticks,c=n.axisLine,u=qq(n,vet),d=l.reduce(function(g,m){return[Math.min(g[0],m.coordinate),Math.max(g[1],m.coordinate)]},[1/0,-1/0]),h=Mr(s,i,d[0],o),f=Mr(s,i,d[1],o),p=Mf(Mf(Mf({},Lt(u,!1)),{},{fill:"none"},Lt(c,!1)),{},{x1:h.x,y1:h.y,x2:f.x,y2:f.y});return me.createElement("line",Nw({className:"recharts-polar-radius-axis-line"},p))}},{key:"renderTicks",value:function(){var n=this,s=this.props,i=s.ticks,o=s.tick,l=s.angle,c=s.tickFormatter,u=s.stroke,d=qq(s,bet),h=this.getTickTextAnchor(),f=Lt(d,!1),p=Lt(o,!1),g=i.map(function(m,x){var y=n.getTickValueCoord(m),v=Mf(Mf(Mf(Mf({textAnchor:h,transform:"rotate(".concat(90-l,", ").concat(y.x,", ").concat(y.y,")")},f),{},{stroke:"none",fill:u},p),{},{index:x},y),{},{payload:m});return me.createElement(xn,Nw({className:Jt("recharts-polar-radius-axis-tick",Lle(o)),key:"tick-".concat(m.coordinate)},a2(n.props,m,x)),e.renderTickItem(o,v,c?c(m.value,x):m.value))});return me.createElement(xn,{className:"recharts-polar-radius-axis-ticks"},g)}},{key:"render",value:function(){var n=this.props,s=n.ticks,i=n.axisLine,o=n.tick;return!s||!s.length?null:me.createElement(xn,{className:Jt("recharts-polar-radius-axis",this.props.className)},i&&this.renderAxisLine(),o&&this.renderTicks(),Es.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(n,s,i){var o;return me.isValidElement(n)?o=me.cloneElement(n,s):Ft(n)?o=n(s):o=me.createElement(Ov,Nw({},s,{className:"recharts-polar-radius-axis-tick-value"}),i),o}}])}(S.PureComponent);N2(A2,"displayName","PolarRadiusAxis");N2(A2,"axisType","radiusAxis");N2(A2,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function Bv(t){"@babel/helpers - typeof";return Bv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bv(t)}function Jf(){return Jf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Jf.apply(this,arguments)}function Kq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Df(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Kq(Object(r),!0).forEach(function(n){E2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Kq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Tet(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yq(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ece(n.key),n)}}function Pet(t,e,r){return e&&Yq(t.prototype,e),r&&Yq(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Oet(t,e,r){return e=qC(e),Iet(t,Jle()?Reflect.construct(e,r||[],qC(t).constructor):e.apply(t,r))}function Iet(t,e){if(e&&(Bv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ret(t)}function Ret(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Jle(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jle=function(){return!!t})()}function qC(t){return qC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},qC(t)}function Met(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qL(t,e)}function qL(t,e){return qL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},qL(t,e)}function E2(t,e,r){return e=ece(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ece(t){var e=Det(t,"string");return Bv(e)=="symbol"?e:e+""}function Det(t,e){if(Bv(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Bv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Let=Math.PI/180,Xq=1e-5,C2=function(t){function e(){return Tet(this,e),Oet(this,e,arguments)}return Met(e,t),Pet(e,[{key:"getTickLineCoord",value:function(n){var s=this.props,i=s.cx,o=s.cy,l=s.radius,c=s.orientation,u=s.tickSize,d=u||8,h=Mr(i,o,l,n.coordinate),f=Mr(i,o,l+(c==="inner"?-1:1)*d,n.coordinate);return{x1:h.x,y1:h.y,x2:f.x,y2:f.y}}},{key:"getTickTextAnchor",value:function(n){var s=this.props.orientation,i=Math.cos(-n.coordinate*Let),o;return i>Xq?o=s==="outer"?"start":"end":i<-Xq?o=s==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var n=this.props,s=n.cx,i=n.cy,o=n.radius,l=n.axisLine,c=n.axisLineType,u=Df(Df({},Lt(this.props,!1)),{},{fill:"none"},Lt(l,!1));if(c==="circle")return me.createElement(I8,Jf({className:"recharts-polar-angle-axis-line"},u,{cx:s,cy:i,r:o}));var d=this.props.ticks,h=d.map(function(f){return Mr(s,i,o,f.coordinate)});return me.createElement(XJe,Jf({className:"recharts-polar-angle-axis-line"},u,{points:h}))}},{key:"renderTicks",value:function(){var n=this,s=this.props,i=s.ticks,o=s.tick,l=s.tickLine,c=s.tickFormatter,u=s.stroke,d=Lt(this.props,!1),h=Lt(o,!1),f=Df(Df({},d),{},{fill:"none"},Lt(l,!1)),p=i.map(function(g,m){var x=n.getTickLineCoord(g),y=n.getTickTextAnchor(g),v=Df(Df(Df({textAnchor:y},d),{},{stroke:"none",fill:u},h),{},{index:m,payload:g,x:x.x2,y:x.y2});return me.createElement(xn,Jf({className:Jt("recharts-polar-angle-axis-tick",Lle(o)),key:"tick-".concat(g.coordinate)},a2(n.props,g,m)),l&&me.createElement("line",Jf({className:"recharts-polar-angle-axis-tick-line"},f,x)),o&&e.renderTickItem(o,v,c?c(g.value,m):g.value))});return me.createElement(xn,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var n=this.props,s=n.ticks,i=n.radius,o=n.axisLine;return i<=0||!s||!s.length?null:me.createElement(xn,{className:Jt("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,s,i){var o;return me.isValidElement(n)?o=me.cloneElement(n,s):Ft(n)?o=n(s):o=me.createElement(Ov,Jf({},s,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])}(S.PureComponent);E2(C2,"displayName","PolarAngleAxis");E2(C2,"axisType","angleAxis");E2(C2,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var Fet=coe,$et=Fet(Object.getPrototypeOf,Object),Bet=$et,Uet=cd,zet=Bet,Het=ud,Wet="[object Object]",Vet=Function.prototype,qet=Object.prototype,tce=Vet.toString,Get=qet.hasOwnProperty,Ket=tce.call(Object);function Yet(t){if(!Het(t)||Uet(t)!=Wet)return!1;var e=zet(t);if(e===null)return!0;var r=Get.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&tce.call(r)==Ket}var Xet=Yet;const Qet=qt(Xet);var Zet=cd,Jet=ud,ett="[object Boolean]";function ttt(t){return t===!0||t===!1||Jet(t)&&Zet(t)==ett}var rtt=ttt;const ntt=qt(rtt);function R1(t){"@babel/helpers - typeof";return R1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R1(t)}function GC(){return GC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},GC.apply(this,arguments)}function stt(t,e){return ltt(t)||ott(t,e)||att(t,e)||itt()}function itt(){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 att(t,e){if(t){if(typeof t=="string")return Qq(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Qq(t,e)}}function Qq(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ott(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function ltt(t){if(Array.isArray(t))return t}function Zq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Jq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Zq(Object(r),!0).forEach(function(n){ctt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Zq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ctt(t,e,r){return e=utt(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function utt(t){var e=dtt(t,"string");return R1(e)=="symbol"?e:e+""}function dtt(t,e){if(R1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(R1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var eG=function(e,r,n,s,i){var o=n-s,l;return l="M ".concat(e,",").concat(r),l+="L ".concat(e+n,",").concat(r),l+="L ".concat(e+n-o/2,",").concat(r+i),l+="L ".concat(e+n-o/2-s,",").concat(r+i),l+="L ".concat(e,",").concat(r," Z"),l},htt={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},ftt=function(e){var r=Jq(Jq({},htt),e),n=S.useRef(),s=S.useState(-1),i=stt(s,2),o=i[0],l=i[1];S.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var b=n.current.getTotalLength();b&&l(b)}catch{}},[]);var c=r.x,u=r.y,d=r.upperWidth,h=r.lowerWidth,f=r.height,p=r.className,g=r.animationEasing,m=r.animationDuration,x=r.animationBegin,y=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||h!==+h||f!==+f||d===0&&h===0||f===0)return null;var v=Jt("recharts-trapezoid",p);return y?me.createElement(rf,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:f,x:c,y:u},to:{upperWidth:d,lowerWidth:h,height:f,x:c,y:u},duration:m,animationEasing:g,isActive:y},function(b){var w=b.upperWidth,j=b.lowerWidth,N=b.height,C=b.x,k=b.y;return me.createElement(rf,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:m,easing:g},me.createElement("path",GC({},Lt(r,!0),{className:v,d:eG(C,k,w,j,N),ref:n})))}):me.createElement("g",null,me.createElement("path",GC({},Lt(r,!0),{className:v,d:eG(c,u,d,h,f)})))},ptt=["option","shapeType","propTransformer","activeClassName","isActive"];function M1(t){"@babel/helpers - typeof";return M1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M1(t)}function mtt(t,e){if(t==null)return{};var r=gtt(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function gtt(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function tG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function KC(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?tG(Object(r),!0).forEach(function(n){ytt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ytt(t,e,r){return e=xtt(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xtt(t){var e=vtt(t,"string");return M1(e)=="symbol"?e:e+""}function vtt(t,e){if(M1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(M1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function btt(t,e){return KC(KC({},e),t)}function wtt(t,e){return t==="symbols"}function rG(t){var e=t.shapeType,r=t.elementProps;switch(e){case"rectangle":return me.createElement(O8,r);case"trapezoid":return me.createElement(ftt,r);case"sector":return me.createElement(Ble,r);case"symbols":if(wtt(e))return me.createElement(K$,r);break;default:return null}}function _tt(t){return S.isValidElement(t)?t.props:t}function jtt(t){var e=t.option,r=t.shapeType,n=t.propTransformer,s=n===void 0?btt:n,i=t.activeClassName,o=i===void 0?"recharts-active-shape":i,l=t.isActive,c=mtt(t,ptt),u;if(S.isValidElement(e))u=S.cloneElement(e,KC(KC({},c),_tt(e)));else if(Ft(e))u=e(c);else if(Qet(e)&&!ntt(e)){var d=s(e,c);u=me.createElement(rG,{shapeType:r,elementProps:d})}else{var h=c;u=me.createElement(rG,{shapeType:r,elementProps:h})}return l?me.createElement(xn,{className:o},u):u}function k2(t,e){return e!=null&&"trapezoids"in t.props}function T2(t,e){return e!=null&&"sectors"in t.props}function D1(t,e){return e!=null&&"points"in t.props}function Stt(t,e){var r,n,s=t.x===(e==null||(r=e.labelViewBox)===null||r===void 0?void 0:r.x)||t.x===e.x,i=t.y===(e==null||(n=e.labelViewBox)===null||n===void 0?void 0:n.y)||t.y===e.y;return s&&i}function Ntt(t,e){var r=t.endAngle===e.endAngle,n=t.startAngle===e.startAngle;return r&&n}function Att(t,e){var r=t.x===e.x,n=t.y===e.y,s=t.z===e.z;return r&&n&&s}function Ett(t,e){var r;return k2(t,e)?r=Stt:T2(t,e)?r=Ntt:D1(t,e)&&(r=Att),r}function Ctt(t,e){var r;return k2(t,e)?r="trapezoids":T2(t,e)?r="sectors":D1(t,e)&&(r="points"),r}function ktt(t,e){if(k2(t,e)){var r;return(r=e.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(T2(t,e)){var n;return(n=e.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return D1(t,e)?e.payload:{}}function Ttt(t){var e=t.activeTooltipItem,r=t.graphicalItem,n=t.itemData,s=Ctt(r,e),i=ktt(r,e),o=n.filter(function(c,u){var d=E8(i,c),h=r.props[s].filter(function(g){var m=Ett(r,e);return m(g,e)}),f=r.props[s].indexOf(h[h.length-1]),p=u===f;return d&&p}),l=n.indexOf(o[o.length-1]);return l}var TA;function Uv(t){"@babel/helpers - typeof";return Uv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uv(t)}function gy(){return gy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},gy.apply(this,arguments)}function nG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Tr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nG(Object(r),!0).forEach(function(n){oo(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ptt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sG(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,nce(n.key),n)}}function Ott(t,e,r){return e&&sG(t.prototype,e),r&&sG(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Itt(t,e,r){return e=YC(e),Rtt(t,rce()?Reflect.construct(e,r||[],YC(t).constructor):e.apply(t,r))}function Rtt(t,e){if(e&&(Uv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mtt(t)}function Mtt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rce=function(){return!!t})()}function YC(t){return YC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},YC(t)}function Dtt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&GL(t,e)}function GL(t,e){return GL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},GL(t,e)}function oo(t,e,r){return e=nce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nce(t){var e=Ltt(t,"string");return Uv(e)=="symbol"?e:e+""}function Ltt(t,e){if(Uv(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Uv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Tc=function(t){function e(r){var n;return Ptt(this,e),n=Itt(this,e,[r]),oo(n,"pieRef",null),oo(n,"sectorRefs",[]),oo(n,"id",i2("recharts-pie-")),oo(n,"handleAnimationEnd",function(){var s=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),Ft(s)&&s()}),oo(n,"handleAnimationStart",function(){var s=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),Ft(s)&&s()}),n.state={isAnimationFinished:!r.isAnimationActive,prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,sectorToFocus:0},n}return Dtt(e,t),Ott(e,[{key:"isActiveIndex",value:function(n){var s=this.props.activeIndex;return Array.isArray(s)?s.indexOf(n)!==-1:n===s}},{key:"hasActiveIndex",value:function(){var n=this.props.activeIndex;return Array.isArray(n)?n.length!==0:n||n===0}},{key:"renderLabels",value:function(n){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.label,l=i.labelLine,c=i.dataKey,u=i.valueKey,d=Lt(this.props,!1),h=Lt(o,!1),f=Lt(l,!1),p=o&&o.offsetRadius||20,g=n.map(function(m,x){var y=(m.startAngle+m.endAngle)/2,v=Mr(m.cx,m.cy,m.outerRadius+p,y),b=Tr(Tr(Tr(Tr({},d),m),{},{stroke:"none"},h),{},{index:x,textAnchor:e.getTextAnchor(v.x,m.cx)},v),w=Tr(Tr(Tr(Tr({},d),m),{},{fill:"none",stroke:m.fill},f),{},{index:x,points:[Mr(m.cx,m.cy,m.outerRadius,y),v]}),j=c;return Qt(c)&&Qt(u)?j="value":Qt(c)&&(j=u),me.createElement(xn,{key:"label-".concat(m.startAngle,"-").concat(m.endAngle,"-").concat(m.midAngle,"-").concat(x)},l&&e.renderLabelLineItem(l,w,"line"),e.renderLabelItem(o,b,Ca(m,j)))});return me.createElement(xn,{className:"recharts-pie-labels"},g)}},{key:"renderSectorsStatically",value:function(n){var s=this,i=this.props,o=i.activeShape,l=i.blendStroke,c=i.inactiveShape;return n.map(function(u,d){if((u==null?void 0:u.startAngle)===0&&(u==null?void 0:u.endAngle)===0&&n.length!==1)return null;var h=s.isActiveIndex(d),f=c&&s.hasActiveIndex()?c:null,p=h?o:f,g=Tr(Tr({},u),{},{stroke:l?u.fill:u.stroke,tabIndex:-1});return me.createElement(xn,gy({ref:function(x){x&&!s.sectorRefs.includes(x)&&s.sectorRefs.push(x)},tabIndex:-1,className:"recharts-pie-sector"},a2(s.props,u,d),{key:"sector-".concat(u==null?void 0:u.startAngle,"-").concat(u==null?void 0:u.endAngle,"-").concat(u.midAngle,"-").concat(d)}),me.createElement(jtt,gy({option:p,isActive:h,shapeType:"sector"},g)))})}},{key:"renderSectorsWithAnimation",value:function(){var n=this,s=this.props,i=s.sectors,o=s.isAnimationActive,l=s.animationBegin,c=s.animationDuration,u=s.animationEasing,d=s.animationId,h=this.state,f=h.prevSectors,p=h.prevIsAnimationActive;return me.createElement(rf,{begin:l,duration:c,isActive:o,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d,"-").concat(p),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(g){var m=g.t,x=[],y=i&&i[0],v=y.startAngle;return i.forEach(function(b,w){var j=f&&f[w],N=w>0?cl(b,"paddingAngle",0):0;if(j){var C=XW(j.endAngle-j.startAngle,b.endAngle-b.startAngle),k=Tr(Tr({},b),{},{startAngle:v+N,endAngle:v+C(m)+N});x.push(k),v=k.endAngle}else{var E=b.endAngle,M=b.startAngle,z=XW(0,E-M),P=z(m),V=Tr(Tr({},b),{},{startAngle:v+N,endAngle:v+P+N});x.push(V),v=V.endAngle}}),me.createElement(xn,null,n.renderSectorsStatically(x))})}},{key:"attachKeyboardHandlers",value:function(n){var s=this;n.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var o=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[o].focus(),s.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[l].focus(),s.setState({sectorToFocus:l});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,s=n.sectors,i=n.isAnimationActive,o=this.state.prevSectors;return i&&s&&s.length&&(!o||!E8(o,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,s=this.props,i=s.hide,o=s.sectors,l=s.className,c=s.label,u=s.cx,d=s.cy,h=s.innerRadius,f=s.outerRadius,p=s.isAnimationActive,g=this.state.isAnimationFinished;if(i||!o||!o.length||!rt(u)||!rt(d)||!rt(h)||!rt(f))return null;var m=Jt("recharts-pie",l);return me.createElement(xn,{tabIndex:this.props.rootTabIndex,className:m,ref:function(y){n.pieRef=y}},this.renderSectors(),c&&this.renderLabels(o),Es.renderCallByParent(this.props,null,!1),(!p||g)&&Dm.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,s){return s.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==s.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:n.sectors!==s.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,s){return n>s?"start":n<s?"end":"middle"}},{key:"renderLabelLineItem",value:function(n,s,i){if(me.isValidElement(n))return me.cloneElement(n,s);if(Ft(n))return n(s);var o=Jt("recharts-pie-label-line",typeof n!="boolean"?n.className:"");return me.createElement(OL,gy({},s,{key:i,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(n,s,i){if(me.isValidElement(n))return me.cloneElement(n,s);var o=i;if(Ft(n)&&(o=n(s),me.isValidElement(o)))return o;var l=Jt("recharts-pie-label-text",typeof n!="boolean"&&!Ft(n)?n.className:"");return me.createElement(Ov,gy({},s,{alignmentBaseline:"middle",className:l}),o)}}])}(S.PureComponent);TA=Tc;oo(Tc,"displayName","Pie");oo(Tc,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!Im.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});oo(Tc,"parseDeltaAngle",function(t,e){var r=ho(e-t),n=Math.min(Math.abs(e-t),360);return r*n});oo(Tc,"getRealPieData",function(t){var e=t.data,r=t.children,n=Lt(t,!1),s=gc(r,Pv);return e&&e.length?e.map(function(i,o){return Tr(Tr(Tr({payload:i},n),i),s&&s[o]&&s[o].props)}):s&&s.length?s.map(function(i){return Tr(Tr({},n),i.props)}):[]});oo(Tc,"parseCoordinateOfPie",function(t,e){var r=e.top,n=e.left,s=e.width,i=e.height,o=Dle(s,i),l=n+Hi(t.cx,s,s/2),c=r+Hi(t.cy,i,i/2),u=Hi(t.innerRadius,o,0),d=Hi(t.outerRadius,o,o*.8),h=t.maxRadius||Math.sqrt(s*s+i*i)/2;return{cx:l,cy:c,innerRadius:u,outerRadius:d,maxRadius:h}});oo(Tc,"getComposedData",function(t){var e=t.item,r=t.offset,n=e.type.defaultProps!==void 0?Tr(Tr({},e.type.defaultProps),e.props):e.props,s=TA.getRealPieData(n);if(!s||!s.length)return null;var i=n.cornerRadius,o=n.startAngle,l=n.endAngle,c=n.paddingAngle,u=n.dataKey,d=n.nameKey,h=n.valueKey,f=n.tooltipType,p=Math.abs(n.minAngle),g=TA.parseCoordinateOfPie(n,r),m=TA.parseDeltaAngle(o,l),x=Math.abs(m),y=u;Qt(u)&&Qt(h)?($u(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),y="value"):Qt(u)&&($u(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),y=h);var v=s.filter(function(k){return Ca(k,y,0)!==0}).length,b=(x>=360?v:v-1)*c,w=x-v*p-b,j=s.reduce(function(k,E){var M=Ca(E,y,0);return k+(rt(M)?M:0)},0),N;if(j>0){var C;N=s.map(function(k,E){var M=Ca(k,y,0),z=Ca(k,d,E),P=(rt(M)?M:0)/j,V;E?V=C.endAngle+ho(m)*c*(M!==0?1:0):V=o;var A=V+ho(m)*((M!==0?p:0)+P*w),$=(V+A)/2,K=(g.innerRadius+g.outerRadius)/2,G=[{name:z,value:M,payload:k,dataKey:y,type:f}],Y=Mr(g.cx,g.cy,K,$);return C=Tr(Tr(Tr({percent:P,cornerRadius:i,name:z,tooltipPayload:G,midAngle:$,middleRadius:K,tooltipPosition:Y},k),g),{},{value:Ca(k,y),startAngle:V,endAngle:A,payload:k,paddingAngle:ho(m)*c}),C})}return Tr(Tr({},g),{},{sectors:N,data:s})});var Ftt=Math.ceil,$tt=Math.max;function Btt(t,e,r,n){for(var s=-1,i=$tt(Ftt((e-t)/(r||1)),0),o=Array(i);i--;)o[n?i:++s]=t,t+=r;return o}var Utt=Btt,ztt=Eoe,iG=1/0,Htt=17976931348623157e292;function Wtt(t){if(!t)return t===0?t:0;if(t=ztt(t),t===iG||t===-iG){var e=t<0?-1:1;return e*Htt}return t===t?t:0}var Vtt=Wtt,qtt=Utt,Gtt=f2,oI=Vtt;function Ktt(t){return function(e,r,n){return n&&typeof n!="number"&&Gtt(e,r,n)&&(r=n=void 0),e=oI(e),r===void 0?(r=e,e=0):r=oI(r),n=n===void 0?e<r?1:-1:oI(n),qtt(e,r,n,t)}}var Ytt=Ktt,Xtt=Ytt,Qtt=Xtt(),Ztt=Qtt;const XC=qt(Ztt);function L1(t){"@babel/helpers - typeof";return L1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L1(t)}function aG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function oG(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?aG(Object(r),!0).forEach(function(n){sce(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):aG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function sce(t,e,r){return e=Jtt(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Jtt(t){var e=ert(t,"string");return L1(e)=="symbol"?e:e+""}function ert(t,e){if(L1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(L1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var trt=["Webkit","Moz","O","ms"],rrt=function(e,r){var n=e.replace(/(\w)/,function(i){return i.toUpperCase()}),s=trt.reduce(function(i,o){return oG(oG({},i),{},sce({},o+n,r))},{});return s[e]=r,s};function zv(t){"@babel/helpers - typeof";return zv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zv(t)}function QC(){return QC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},QC.apply(this,arguments)}function lG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function lI(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?lG(Object(r),!0).forEach(function(n){aa(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function nrt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cG(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ace(n.key),n)}}function srt(t,e,r){return e&&cG(t.prototype,e),r&&cG(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function irt(t,e,r){return e=ZC(e),art(t,ice()?Reflect.construct(e,r||[],ZC(t).constructor):e.apply(t,r))}function art(t,e){if(e&&(zv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ort(t)}function ort(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ice(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ice=function(){return!!t})()}function ZC(t){return ZC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ZC(t)}function lrt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&KL(t,e)}function KL(t,e){return KL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},KL(t,e)}function aa(t,e,r){return e=ace(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ace(t){var e=crt(t,"string");return zv(e)=="symbol"?e:e+""}function crt(t,e){if(zv(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(zv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var urt=function(e){var r=e.data,n=e.startIndex,s=e.endIndex,i=e.x,o=e.width,l=e.travellerWidth;if(!r||!r.length)return{};var c=r.length,u=ww().domain(XC(0,c)).range([i,i+o-l]),d=u.domain().map(function(h){return u(h)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(n),endX:u(s),scale:u,scaleValues:d}},uG=function(e){return e.changedTouches&&!!e.changedTouches.length},Hv=function(t){function e(r){var n;return nrt(this,e),n=irt(this,e,[r]),aa(n,"handleDrag",function(s){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(s):n.state.isSlideMoving&&n.handleSlideDrag(s)}),aa(n,"handleTouchMove",function(s){s.changedTouches!=null&&s.changedTouches.length>0&&n.handleDrag(s.changedTouches[0])}),aa(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=n.props,i=s.endIndex,o=s.onDragEnd,l=s.startIndex;o==null||o({endIndex:i,startIndex:l})}),n.detachDragEndListener()}),aa(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),aa(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),aa(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),aa(n,"handleSlideDragStart",function(s){var i=uG(s)?s.changedTouches[0]:s;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return lrt(e,t),srt(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var s=n.startX,i=n.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,h=Math.min(s,i),f=Math.max(s,i),p=e.getIndexInRange(o,h),g=e.getIndexInRange(o,f);return{startIndex:p-p%c,endIndex:g===d?d:g-g%c}}},{key:"getTextOfTick",value:function(n){var s=this.props,i=s.data,o=s.tickFormatter,l=s.dataKey,c=Ca(i[n],l,n);return Ft(o)?o(c,n):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var s=this.state,i=s.slideMoveStartX,o=s.startX,l=s.endX,c=this.props,u=c.x,d=c.width,h=c.travellerWidth,f=c.startIndex,p=c.endIndex,g=c.onChange,m=n.pageX-i;m>0?m=Math.min(m,u+d-h-l,u+d-h-o):m<0&&(m=Math.max(m,u-o,u-l));var x=this.getIndex({startX:o+m,endX:l+m});(x.startIndex!==f||x.endIndex!==p)&&g&&g(x),this.setState({startX:o+m,endX:l+m,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,s){var i=uG(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var s=this.state,i=s.brushMoveStartX,o=s.movingTravellerId,l=s.endX,c=s.startX,u=this.state[o],d=this.props,h=d.x,f=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,x=d.data,y={startX:this.state.startX,endX:this.state.endX},v=n.pageX-i;v>0?v=Math.min(v,h+f-p-u):v<0&&(v=Math.max(v,h-u)),y[o]=u+v;var b=this.getIndex(y),w=b.startIndex,j=b.endIndex,N=function(){var k=x.length-1;return o==="startX"&&(l>c?w%m===0:j%m===0)||l<c&&j===k||o==="endX"&&(l>c?j%m===0:w%m===0)||l>c&&j===k};this.setState(aa(aa({},o,u+v),"brushMoveStartX",n.pageX),function(){g&&N()&&g(b)})}},{key:"handleTravellerMoveKeyboard",value:function(n,s){var i=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,d=this.state[s],h=l.indexOf(d);if(h!==-1){var f=h+n;if(!(f===-1||f>=l.length)){var p=l[f];s==="startX"&&p>=u||s==="endX"&&p<=c||this.setState(aa({},s,p),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,s=n.x,i=n.y,o=n.width,l=n.height,c=n.fill,u=n.stroke;return me.createElement("rect",{stroke:u,fill:c,x:s,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var n=this.props,s=n.x,i=n.y,o=n.width,l=n.height,c=n.data,u=n.children,d=n.padding,h=S.Children.only(u);return h?me.cloneElement(h,{x:s,y:i,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,s){var i,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,h=c.height,f=c.traveller,p=c.ariaLabel,g=c.data,m=c.startIndex,x=c.endIndex,y=Math.max(n,this.props.x),v=lI(lI({},Lt(this.props,!1)),{},{x:y,y:u,width:d,height:h}),b=p||"Min value: ".concat((i=g[m])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=g[x])===null||o===void 0?void 0:o.name);return me.createElement(xn,{tabIndex:0,role:"slider","aria-label":b,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(j){["ArrowLeft","ArrowRight"].includes(j.key)&&(j.preventDefault(),j.stopPropagation(),l.handleTravellerMoveKeyboard(j.key==="ArrowRight"?1:-1,s))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(f,v))}},{key:"renderSlide",value:function(n,s){var i=this.props,o=i.y,l=i.height,c=i.stroke,u=i.travellerWidth,d=Math.min(n,s)+u,h=Math.max(Math.abs(s-n)-u,0);return me.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:o,width:h,height:l})}},{key:"renderText",value:function(){var n=this.props,s=n.startIndex,i=n.endIndex,o=n.y,l=n.height,c=n.travellerWidth,u=n.stroke,d=this.state,h=d.startX,f=d.endX,p=5,g={pointerEvents:"none",fill:u};return me.createElement(xn,{className:"recharts-brush-texts"},me.createElement(Ov,QC({textAnchor:"end",verticalAnchor:"middle",x:Math.min(h,f)-p,y:o+l/2},g),this.getTextOfTick(s)),me.createElement(Ov,QC({textAnchor:"start",verticalAnchor:"middle",x:Math.max(h,f)+c+p,y:o+l/2},g),this.getTextOfTick(i)))}},{key:"render",value:function(){var n=this.props,s=n.data,i=n.className,o=n.children,l=n.x,c=n.y,u=n.width,d=n.height,h=n.alwaysShowText,f=this.state,p=f.startX,g=f.endX,m=f.isTextActive,x=f.isSlideMoving,y=f.isTravellerMoving,v=f.isTravellerFocused;if(!s||!s.length||!rt(l)||!rt(c)||!rt(u)||!rt(d)||u<=0||d<=0)return null;var b=Jt("recharts-brush",i),w=me.Children.count(o)===1,j=rrt("userSelect","none");return me.createElement(xn,{className:b,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:j},this.renderBackground(),w&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||x||y||v||h)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var s=n.x,i=n.y,o=n.width,l=n.height,c=n.stroke,u=Math.floor(i+l/2)-1;return me.createElement(me.Fragment,null,me.createElement("rect",{x:s,y:i,width:o,height:l,fill:c,stroke:"none"}),me.createElement("line",{x1:s+1,y1:u,x2:s+o-1,y2:u,fill:"none",stroke:"#fff"}),me.createElement("line",{x1:s+1,y1:u+2,x2:s+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,s){var i;return me.isValidElement(n)?i=me.cloneElement(n,s):Ft(n)?i=n(s):i=e.renderDefaultTraveller(s),i}},{key:"getDerivedStateFromProps",value:function(n,s){var i=n.data,o=n.width,l=n.x,c=n.travellerWidth,u=n.updateId,d=n.startIndex,h=n.endIndex;if(i!==s.prevData||u!==s.prevUpdateId)return lI({prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},i&&i.length?urt({data:i,width:o,x:l,travellerWidth:c,startIndex:d,endIndex:h}):{scale:null,scaleValues:null});if(s.scale&&(o!==s.prevWidth||l!==s.prevX||c!==s.prevTravellerWidth)){s.scale.range([l,l+o-c]);var f=s.scale.domain().map(function(p){return s.scale(p)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:s.scale(n.startIndex),endX:s.scale(n.endIndex),scaleValues:f}}return null}},{key:"getIndexInRange",value:function(n,s){for(var i=n.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);n[c]>s?l=c:o=c}return s>=n[l]?l:o}}])}(S.PureComponent);aa(Hv,"displayName","Brush");aa(Hv,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var drt=r8;function hrt(t,e){var r;return drt(t,function(n,s,i){return r=e(n,s,i),!r}),!!r}var frt=hrt,prt=toe,mrt=wf,grt=frt,yrt=ta,xrt=f2;function vrt(t,e,r){var n=yrt(t)?prt:grt;return r&&xrt(t,e,r)&&(e=void 0),n(t,mrt(e))}var brt=vrt;const wrt=qt(brt);var xc=function(e,r){var n=e.alwaysShow,s=e.ifOverflow;return n&&(s="extendDomain"),s===r},dG=_oe;function _rt(t,e,r){e=="__proto__"&&dG?dG(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var jrt=_rt,Srt=jrt,Nrt=boe,Art=wf;function Ert(t,e){var r={};return e=Art(e),Nrt(t,function(n,s,i){Srt(r,s,e(n,s,i))}),r}var Crt=Ert;const krt=qt(Crt);function Trt(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var Prt=Trt,Ort=r8;function Irt(t,e){var r=!0;return Ort(t,function(n,s,i){return r=!!e(n,s,i),r}),r}var Rrt=Irt,Mrt=Prt,Drt=Rrt,Lrt=wf,Frt=ta,$rt=f2;function Brt(t,e,r){var n=Frt(t)?Mrt:Drt;return r&&$rt(t,e,r)&&(e=void 0),n(t,Lrt(e))}var Urt=Brt;const zrt=qt(Urt);function F1(t){"@babel/helpers - typeof";return F1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F1(t)}function Hrt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hG(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,oce(n.key),n)}}function Wrt(t,e,r){return e&&hG(t.prototype,e),r&&hG(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function fG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function IN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?fG(Object(r),!0).forEach(function(n){R8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function R8(t,e,r){return e=oce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function oce(t){var e=Vrt(t,"string");return F1(e)=="symbol"?e:e+""}function Vrt(t,e){if(F1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(F1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var lce=function(e,r){var n=e.x,s=e.y,i=r.x,o=r.y;return{x:Math.min(n,i),y:Math.min(s,o),width:Math.abs(i-n),height:Math.abs(o-s)}},qrt=function(e){var r=e.x1,n=e.y1,s=e.x2,i=e.y2;return lce({x:r,y:n},{x:s,y:i})},cce=function(){function t(e){Hrt(this,t),this.scale=e}return Wrt(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.bandAware,i=n.position;if(r!==void 0){if(i)switch(i){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(r)+l}default:return this.scale(r)}if(s){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),s=n[0],i=n[n.length-1];return s<=i?r>=s&&r<=i:r>=i&&r<=s}}],[{key:"create",value:function(r){return new t(r)}}])}();R8(cce,"EPS",1e-4);var M8=function(e){var r=Object.keys(e).reduce(function(n,s){return IN(IN({},n),{},R8({},s,cce.create(e[s])))},{});return IN(IN({},r),{},{apply:function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return krt(s,function(c,u){return r[u].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return zrt(s,function(i,o){return r[o].isInRange(i)})}})},Grt=wFe(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),uce=S.createContext(void 0),dce=S.createContext(void 0),hce=S.createContext(void 0),Krt=S.createContext({}),fce=S.createContext(void 0),Yrt=S.createContext(0),Xrt=S.createContext(0),pG=function(e){var r=e.state,n=r.xAxisMap,s=r.yAxisMap,i=r.offset,o=e.clipPathId,l=e.children,c=e.width,u=e.height,d=Grt(i);return me.createElement(uce.Provider,{value:n},me.createElement(dce.Provider,{value:s},me.createElement(Krt.Provider,{value:i},me.createElement(hce.Provider,{value:d},me.createElement(fce.Provider,{value:o},me.createElement(Yrt.Provider,{value:u},me.createElement(Xrt.Provider,{value:c},l)))))))},Qrt=function(){return S.useContext(fce)},Zrt=function(e){var r=S.useContext(uce);r==null&&Dv();var n=r[e];return n==null&&Dv(),n},Jrt=function(e){var r=S.useContext(dce);r==null&&Dv();var n=r[e];return n==null&&Dv(),n},ent=function(){var e=S.useContext(hce);return e};function Wv(t){"@babel/helpers - typeof";return Wv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wv(t)}function tnt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rnt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,mce(n.key),n)}}function nnt(t,e,r){return e&&rnt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function snt(t,e,r){return e=JC(e),int(t,pce()?Reflect.construct(e,r||[],JC(t).constructor):e.apply(t,r))}function int(t,e){if(e&&(Wv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ant(t)}function ant(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pce=function(){return!!t})()}function JC(t){return JC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},JC(t)}function ont(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&YL(t,e)}function YL(t,e){return YL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},YL(t,e)}function mG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function gG(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?mG(Object(r),!0).forEach(function(n){D8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):mG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function D8(t,e,r){return e=mce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mce(t){var e=lnt(t,"string");return Wv(e)=="symbol"?e:e+""}function lnt(t,e){if(Wv(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Wv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function cnt(t,e){return fnt(t)||hnt(t,e)||dnt(t,e)||unt()}function unt(){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 dnt(t,e){if(t){if(typeof t=="string")return yG(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yG(t,e)}}function yG(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function hnt(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function fnt(t){if(Array.isArray(t))return t}function XL(){return XL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},XL.apply(this,arguments)}var pnt=function(e,r){var n;return me.isValidElement(e)?n=me.cloneElement(e,r):Ft(e)?n=e(r):n=me.createElement("line",XL({},r,{className:"recharts-reference-line-line"})),n},mnt=function(e,r,n,s,i,o,l,c,u){var d=i.x,h=i.y,f=i.width,p=i.height;if(n){var g=u.y,m=e.y.apply(g,{position:o});if(xc(u,"discard")&&!e.y.isInRange(m))return null;var x=[{x:d+f,y:m},{x:d,y:m}];return c==="left"?x.reverse():x}if(r){var y=u.x,v=e.x.apply(y,{position:o});if(xc(u,"discard")&&!e.x.isInRange(v))return null;var b=[{x:v,y:h+p},{x:v,y:h}];return l==="top"?b.reverse():b}if(s){var w=u.segment,j=w.map(function(N){return e.apply(N,{position:o})});return xc(u,"discard")&&wrt(j,function(N){return!e.isInRange(N)})?null:j}return null};function gnt(t){var e=t.x,r=t.y,n=t.segment,s=t.xAxisId,i=t.yAxisId,o=t.shape,l=t.className,c=t.alwaysShow,u=Qrt(),d=Zrt(s),h=Jrt(i),f=ent();if(!u||!f)return null;$u(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=M8({x:d.scale,y:h.scale}),g=Qn(e),m=Qn(r),x=n&&n.length===2,y=mnt(p,g,m,x,f,t.position,d.orientation,h.orientation,t);if(!y)return null;var v=cnt(y,2),b=v[0],w=b.x,j=b.y,N=v[1],C=N.x,k=N.y,E=xc(t,"hidden")?"url(#".concat(u,")"):void 0,M=gG(gG({clipPath:E},Lt(t,!0)),{},{x1:w,y1:j,x2:C,y2:k});return me.createElement(xn,{className:Jt("recharts-reference-line",l)},pnt(o,M),Es.renderCallByParent(t,qrt({x1:w,y1:j,x2:C,y2:k})))}var L8=function(t){function e(){return tnt(this,e),snt(this,e,arguments)}return ont(e,t),nnt(e,[{key:"render",value:function(){return me.createElement(gnt,this.props)}}])}(me.Component);D8(L8,"displayName","ReferenceLine");D8(L8,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function QL(){return QL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},QL.apply(this,arguments)}function Vv(t){"@babel/helpers - typeof";return Vv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vv(t)}function xG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function vG(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xG(Object(r),!0).forEach(function(n){P2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ynt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xnt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yce(n.key),n)}}function vnt(t,e,r){return e&&xnt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function bnt(t,e,r){return e=ek(e),wnt(t,gce()?Reflect.construct(e,r||[],ek(t).constructor):e.apply(t,r))}function wnt(t,e){if(e&&(Vv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _nt(t)}function _nt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function gce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gce=function(){return!!t})()}function ek(t){return ek=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ek(t)}function jnt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ZL(t,e)}function ZL(t,e){return ZL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},ZL(t,e)}function P2(t,e,r){return e=yce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yce(t){var e=Snt(t,"string");return Vv(e)=="symbol"?e:e+""}function Snt(t,e){if(Vv(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Vv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Nnt=function(e){var r=e.x,n=e.y,s=e.xAxis,i=e.yAxis,o=M8({x:s.scale,y:i.scale}),l=o.apply({x:r,y:n},{bandAware:!0});return xc(e,"discard")&&!o.isInRange(l)?null:l},O2=function(t){function e(){return ynt(this,e),bnt(this,e,arguments)}return jnt(e,t),vnt(e,[{key:"render",value:function(){var n=this.props,s=n.x,i=n.y,o=n.r,l=n.alwaysShow,c=n.clipPathId,u=Qn(s),d=Qn(i);if($u(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var h=Nnt(this.props);if(!h)return null;var f=h.x,p=h.y,g=this.props,m=g.shape,x=g.className,y=xc(this.props,"hidden")?"url(#".concat(c,")"):void 0,v=vG(vG({clipPath:y},Lt(this.props,!0)),{},{cx:f,cy:p});return me.createElement(xn,{className:Jt("recharts-reference-dot",x)},e.renderDot(m,v),Es.renderCallByParent(this.props,{x:f-o,y:p-o,width:2*o,height:2*o}))}}])}(me.Component);P2(O2,"displayName","ReferenceDot");P2(O2,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});P2(O2,"renderDot",function(t,e){var r;return me.isValidElement(t)?r=me.cloneElement(t,e):Ft(t)?r=t(e):r=me.createElement(I8,QL({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),r});function JL(){return JL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},JL.apply(this,arguments)}function qv(t){"@babel/helpers - typeof";return qv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qv(t)}function bG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function wG(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bG(Object(r),!0).forEach(function(n){I2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ant(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ent(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,vce(n.key),n)}}function Cnt(t,e,r){return e&&Ent(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function knt(t,e,r){return e=tk(e),Tnt(t,xce()?Reflect.construct(e,r||[],tk(t).constructor):e.apply(t,r))}function Tnt(t,e){if(e&&(qv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pnt(t)}function Pnt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function xce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xce=function(){return!!t})()}function tk(t){return tk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},tk(t)}function Ont(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&e5(t,e)}function e5(t,e){return e5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},e5(t,e)}function I2(t,e,r){return e=vce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vce(t){var e=Int(t,"string");return qv(e)=="symbol"?e:e+""}function Int(t,e){if(qv(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(qv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Rnt=function(e,r,n,s,i){var o=i.x1,l=i.x2,c=i.y1,u=i.y2,d=i.xAxis,h=i.yAxis;if(!d||!h)return null;var f=M8({x:d.scale,y:h.scale}),p={x:e?f.x.apply(o,{position:"start"}):f.x.rangeMin,y:n?f.y.apply(c,{position:"start"}):f.y.rangeMin},g={x:r?f.x.apply(l,{position:"end"}):f.x.rangeMax,y:s?f.y.apply(u,{position:"end"}):f.y.rangeMax};return xc(i,"discard")&&(!f.isInRange(p)||!f.isInRange(g))?null:lce(p,g)},R2=function(t){function e(){return Ant(this,e),knt(this,e,arguments)}return Ont(e,t),Cnt(e,[{key:"render",value:function(){var n=this.props,s=n.x1,i=n.x2,o=n.y1,l=n.y2,c=n.className,u=n.alwaysShow,d=n.clipPathId;$u(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var h=Qn(s),f=Qn(i),p=Qn(o),g=Qn(l),m=this.props.shape;if(!h&&!f&&!p&&!g&&!m)return null;var x=Rnt(h,f,p,g,this.props);if(!x&&!m)return null;var y=xc(this.props,"hidden")?"url(#".concat(d,")"):void 0;return me.createElement(xn,{className:Jt("recharts-reference-area",c)},e.renderRect(m,wG(wG({clipPath:y},Lt(this.props,!0)),x)),Es.renderCallByParent(this.props,x))}}])}(me.Component);I2(R2,"displayName","ReferenceArea");I2(R2,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});I2(R2,"renderRect",function(t,e){var r;return me.isValidElement(t)?r=me.cloneElement(t,e):Ft(t)?r=t(e):r=me.createElement(O8,JL({},e,{className:"recharts-reference-area-rect"})),r});function _G(t){return Fnt(t)||Lnt(t)||Dnt(t)||Mnt()}function Mnt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dnt(t,e){if(t){if(typeof t=="string")return t5(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t5(t,e)}}function Lnt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Fnt(t){if(Array.isArray(t))return t5(t)}function t5(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var r5=function(e,r,n,s,i){var o=gc(e,L8),l=gc(e,O2),c=[].concat(_G(o),_G(l)),u=gc(e,R2),d="".concat(s,"Id"),h=s[0],f=r;if(c.length&&(f=c.reduce(function(m,x){if(x.props[d]===n&&xc(x.props,"extendDomain")&&rt(x.props[h])){var y=x.props[h];return[Math.min(m[0],y),Math.max(m[1],y)]}return m},f)),u.length){var p="".concat(h,"1"),g="".concat(h,"2");f=u.reduce(function(m,x){if(x.props[d]===n&&xc(x.props,"extendDomain")&&rt(x.props[p])&&rt(x.props[g])){var y=x.props[p],v=x.props[g];return[Math.min(m[0],y,v),Math.max(m[1],y,v)]}return m},f)}return i&&i.length&&(f=i.reduce(function(m,x){return rt(x)?[Math.min(m[0],x),Math.max(m[1],x)]:m},f)),f},bce={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function s(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new s(d,h||c,f),g=r?r+u:u;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],p]:c._events[g].push(p):(c._events[g]=p,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,h;if(this._eventsCount===0)return u;for(h in d=this._events)e.call(d,h)&&u.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=r?r+u:u,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,p=h.length,g=new Array(p);f<p;f++)g[f]=h[f].fn;return g},l.prototype.listenerCount=function(u){var d=r?r+u:u,h=this._events[d];return h?h.fn?1:h.length:0},l.prototype.emit=function(u,d,h,f,p,g){var m=r?r+u:u;if(!this._events[m])return!1;var x=this._events[m],y=arguments.length,v,b;if(x.fn){switch(x.once&&this.removeListener(u,x.fn,void 0,!0),y){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,d),!0;case 3:return x.fn.call(x.context,d,h),!0;case 4:return x.fn.call(x.context,d,h,f),!0;case 5:return x.fn.call(x.context,d,h,f,p),!0;case 6:return x.fn.call(x.context,d,h,f,p,g),!0}for(b=1,v=new Array(y-1);b<y;b++)v[b-1]=arguments[b];x.fn.apply(x.context,v)}else{var w=x.length,j;for(b=0;b<w;b++)switch(x[b].once&&this.removeListener(u,x[b].fn,void 0,!0),y){case 1:x[b].fn.call(x[b].context);break;case 2:x[b].fn.call(x[b].context,d);break;case 3:x[b].fn.call(x[b].context,d,h);break;case 4:x[b].fn.call(x[b].context,d,h,f);break;default:if(!v)for(j=1,v=new Array(y-1);j<y;j++)v[j-1]=arguments[j];x[b].fn.apply(x[b].context,v)}}return!0},l.prototype.on=function(u,d,h){return i(this,u,d,h,!1)},l.prototype.once=function(u,d,h){return i(this,u,d,h,!0)},l.prototype.removeListener=function(u,d,h,f){var p=r?r+u:u;if(!this._events[p])return this;if(!d)return o(this,p),this;var g=this._events[p];if(g.fn)g.fn===d&&(!f||g.once)&&(!h||g.context===h)&&o(this,p);else{for(var m=0,x=[],y=g.length;m<y;m++)(g[m].fn!==d||f&&!g[m].once||h&&g[m].context!==h)&&x.push(g[m]);x.length?this._events[p]=x.length===1?x[0]:x:o(this,p)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=r?r+u:u,this._events[d]&&o(this,d)):(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,t.exports=l})(bce);var $nt=bce.exports;const Bnt=qt($nt);var cI=new Bnt,uI="recharts.syncMouseEvents";function $1(t){"@babel/helpers - typeof";return $1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$1(t)}function Unt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function znt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,wce(n.key),n)}}function Hnt(t,e,r){return e&&znt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function dI(t,e,r){return e=wce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wce(t){var e=Wnt(t,"string");return $1(e)=="symbol"?e:e+""}function Wnt(t,e){if($1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if($1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Vnt=function(){function t(){Unt(this,t),dI(this,"activeIndex",0),dI(this,"coordinateList",[]),dI(this,"layout","horizontal")}return Hnt(t,[{key:"setDetails",value:function(r){var n,s=r.coordinateList,i=s===void 0?null:s,o=r.container,l=o===void 0?null:o,c=r.layout,u=c===void 0?null:c,d=r.offset,h=d===void 0?null:d,f=r.mouseHandlerCallback,p=f===void 0?null:f;this.coordinateList=(n=i??this.coordinateList)!==null&&n!==void 0?n:[],this.container=l??this.container,this.layout=u??this.layout,this.offset=h??this.offset,this.mouseHandlerCallback=p??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var s=this.container.getBoundingClientRect(),i=s.x,o=s.y,l=s.height,c=this.coordinateList[this.activeIndex].coordinate,u=((r=window)===null||r===void 0?void 0:r.scrollX)||0,d=((n=window)===null||n===void 0?void 0:n.scrollY)||0,h=i+c+u,f=o+this.offset.top+l/2+d;this.mouseHandlerCallback({pageX:h,pageY:f})}}}])}();function qnt(t,e,r){if(r==="number"&&e===!0&&Array.isArray(t)){var n=t==null?void 0:t[0],s=t==null?void 0:t[1];if(n&&s&&rt(n)&&rt(s))return!0}return!1}function Gnt(t,e,r,n){var s=n/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-s:r.left+.5,y:t==="horizontal"?r.top+.5:e.y-s,width:t==="horizontal"?n:r.width-1,height:t==="horizontal"?r.height-1:n}}function _ce(t){var e=t.cx,r=t.cy,n=t.radius,s=t.startAngle,i=t.endAngle,o=Mr(e,r,n,s),l=Mr(e,r,n,i);return{points:[o,l],cx:e,cy:r,radius:n,startAngle:s,endAngle:i}}function Knt(t,e,r){var n,s,i,o;if(t==="horizontal")n=e.x,i=n,s=r.top,o=r.top+r.height;else if(t==="vertical")s=e.y,o=s,n=r.left,i=r.left+r.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var l=e.cx,c=e.cy,u=e.innerRadius,d=e.outerRadius,h=e.angle,f=Mr(l,c,u,h),p=Mr(l,c,d,h);n=f.x,s=f.y,i=p.x,o=p.y}else return _ce(e);return[{x:n,y:s},{x:i,y:o}]}function B1(t){"@babel/helpers - typeof";return B1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},B1(t)}function jG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function RN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jG(Object(r),!0).forEach(function(n){Ynt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ynt(t,e,r){return e=Xnt(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Xnt(t){var e=Qnt(t,"string");return B1(e)=="symbol"?e:e+""}function Qnt(t,e){if(B1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(B1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Znt(t){var e,r,n=t.element,s=t.tooltipEventType,i=t.isActive,o=t.activeCoordinate,l=t.activePayload,c=t.offset,u=t.activeTooltipIndex,d=t.tooltipAxisBandSize,h=t.layout,f=t.chartName,p=(e=n.props.cursor)!==null&&e!==void 0?e:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!p||!i||!o||f!=="ScatterChart"&&s!=="axis")return null;var g,m=OL;if(f==="ScatterChart")g=o,m=iet;else if(f==="BarChart")g=Gnt(h,o,c,d),m=O8;else if(h==="radial"){var x=_ce(o),y=x.cx,v=x.cy,b=x.radius,w=x.startAngle,j=x.endAngle;g={cx:y,cy:v,startAngle:w,endAngle:j,innerRadius:b,outerRadius:b},m=Ble}else g={points:Knt(h,o,c)},m=OL;var N=RN(RN(RN(RN({stroke:"#ccc",pointerEvents:"none"},c),g),Lt(p,!1)),{},{payload:l,payloadIndex:u,className:Jt("recharts-tooltip-cursor",p.className)});return S.isValidElement(p)?S.cloneElement(p,N):S.createElement(m,N)}var Jnt=["item"],est=["children","className","width","height","style","compact","title","desc"];function Gv(t){"@babel/helpers - typeof";return Gv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gv(t)}function yy(){return yy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},yy.apply(this,arguments)}function SG(t,e){return nst(t)||rst(t,e)||Sce(t,e)||tst()}function tst(){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 rst(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function nst(t){if(Array.isArray(t))return t}function NG(t,e){if(t==null)return{};var r=sst(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function sst(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function ist(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ast(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Nce(n.key),n)}}function ost(t,e,r){return e&&ast(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function lst(t,e,r){return e=rk(e),cst(t,jce()?Reflect.construct(e,r||[],rk(t).constructor):e.apply(t,r))}function cst(t,e){if(e&&(Gv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ust(t)}function ust(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jce=function(){return!!t})()}function rk(t){return rk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},rk(t)}function dst(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n5(t,e)}function n5(t,e){return n5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},n5(t,e)}function Kv(t){return pst(t)||fst(t)||Sce(t)||hst()}function hst(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sce(t,e){if(t){if(typeof t=="string")return s5(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s5(t,e)}}function fst(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function pst(t){if(Array.isArray(t))return s5(t)}function s5(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function AG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function ke(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?AG(Object(r),!0).forEach(function(n){bt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):AG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function bt(t,e,r){return e=Nce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Nce(t){var e=mst(t,"string");return Gv(e)=="symbol"?e:e+""}function mst(t,e){if(Gv(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Gv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var gst={xAxis:["bottom","top"],yAxis:["left","right"]},yst={width:"100%",height:"100%"},Ace={x:0,y:0};function MN(t){return t}var xst=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},vst=function(e,r,n,s){var i=r.find(function(d){return d&&d.index===n});if(i){if(e==="horizontal")return{x:i.coordinate,y:s.y};if(e==="vertical")return{x:s.x,y:i.coordinate};if(e==="centric"){var o=i.coordinate,l=s.radius;return ke(ke(ke({},s),Mr(s.cx,s.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,u=s.angle;return ke(ke(ke({},s),Mr(s.cx,s.cy,c,u)),{},{angle:u,radius:c})}return Ace},M2=function(e,r){var n=r.graphicalItems,s=r.dataStartIndex,i=r.dataEndIndex,o=(n??[]).reduce(function(l,c){var u=c.props.data;return u&&u.length?[].concat(Kv(l),Kv(u)):l},[]);return o.length>0?o:e&&e.length&&rt(s)&&rt(i)?e.slice(s,i+1):[]};function Ece(t){return t==="number"?[0,"auto"]:void 0}var i5=function(e,r,n,s){var i=e.graphicalItems,o=e.tooltipAxis,l=M2(r,e);return n<0||!i||!i.length||n>=l.length?null:i.reduce(function(c,u){var d,h=(d=u.props.data)!==null&&d!==void 0?d:r;h&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(h=h.slice(e.dataStartIndex,e.dataEndIndex+1));var f;if(o.dataKey&&!o.allowDuplicatedCategory){var p=h===void 0?l:h;f=F4(p,o.dataKey,s)}else f=h&&h[n]||l[n];return f?[].concat(Kv(c),[WXe(u,f)]):c},[])},EG=function(e,r,n,s){var i=s||{x:e.chartX,y:e.chartY},o=xst(i,n),l=e.orderedTooltipTicks,c=e.tooltipAxis,u=e.tooltipTicks,d=CXe(o,l,u,c);if(d>=0&&u){var h=u[d]&&u[d].value,f=i5(e,r,d,h),p=vst(n,l,d,i);return{activeTooltipIndex:d,activeLabel:h,activePayload:f,activeCoordinate:p}}return null},bst=function(e,r){var n=r.axes,s=r.graphicalItems,i=r.axisType,o=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=e.layout,h=e.children,f=e.stackOffset,p=Ile(d,i);return n.reduce(function(g,m){var x,y=m.type.defaultProps!==void 0?ke(ke({},m.type.defaultProps),m.props):m.props,v=y.type,b=y.dataKey,w=y.allowDataOverflow,j=y.allowDuplicatedCategory,N=y.scale,C=y.ticks,k=y.includeHidden,E=y[o];if(g[E])return g;var M=M2(e.data,{graphicalItems:s.filter(function(F){var W,X=o in F.props?F.props[o]:(W=F.type.defaultProps)===null||W===void 0?void 0:W[o];return X===E}),dataStartIndex:c,dataEndIndex:u}),z=M.length,P,V,A;qnt(y.domain,w,v)&&(P=AL(y.domain,null,w),p&&(v==="number"||N!=="auto")&&(A=_w(M,b,"category")));var $=Ece(v);if(!P||P.length===0){var K,G=(K=y.domain)!==null&&K!==void 0?K:$;if(b){if(P=_w(M,b,v),v==="category"&&p){var Y=x6e(P);j&&Y?(V=P,P=XC(0,z)):j||(P=oq(G,P,m).reduce(function(F,W){return F.indexOf(W)>=0?F:[].concat(Kv(F),[W])},[]))}else if(v==="category")j?P=P.filter(function(F){return F!==""&&!Qt(F)}):P=oq(G,P,m).reduce(function(F,W){return F.indexOf(W)>=0||W===""||Qt(W)?F:[].concat(Kv(F),[W])},[]);else if(v==="number"){var H=IXe(M,s.filter(function(F){var W,X,oe=o in F.props?F.props[o]:(W=F.type.defaultProps)===null||W===void 0?void 0:W[o],le="hide"in F.props?F.props.hide:(X=F.type.defaultProps)===null||X===void 0?void 0:X.hide;return oe===E&&(k||!le)}),b,i,d);H&&(P=H)}p&&(v==="number"||N!=="auto")&&(A=_w(M,b,"category"))}else p?P=XC(0,z):l&&l[E]&&l[E].hasStack&&v==="number"?P=f==="expand"?[0,1]:Rle(l[E].stackGroups,c,u):P=Ole(M,s.filter(function(F){var W=o in F.props?F.props[o]:F.type.defaultProps[o],X="hide"in F.props?F.props.hide:F.type.defaultProps.hide;return W===E&&(k||!X)}),v,d,!0);if(v==="number")P=r5(h,P,E,i,C),G&&(P=AL(G,P,w));else if(v==="category"&&G){var B=G,L=P.every(function(F){return B.indexOf(F)>=0});L&&(P=B)}}return ke(ke({},g),{},bt({},E,ke(ke({},y),{},{axisType:i,domain:P,categoricalDomain:A,duplicateDomain:V,originalDomain:(x=y.domain)!==null&&x!==void 0?x:$,isCategorical:p,layout:d})))},{})},wst=function(e,r){var n=r.graphicalItems,s=r.Axis,i=r.axisType,o=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=e.layout,h=e.children,f=M2(e.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:u}),p=f.length,g=Ile(d,i),m=-1;return n.reduce(function(x,y){var v=y.type.defaultProps!==void 0?ke(ke({},y.type.defaultProps),y.props):y.props,b=v[o],w=Ece("number");if(!x[b]){m++;var j;return g?j=XC(0,p):l&&l[b]&&l[b].hasStack?(j=Rle(l[b].stackGroups,c,u),j=r5(h,j,b,i)):(j=AL(w,Ole(f,n.filter(function(N){var C,k,E=o in N.props?N.props[o]:(C=N.type.defaultProps)===null||C===void 0?void 0:C[o],M="hide"in N.props?N.props.hide:(k=N.type.defaultProps)===null||k===void 0?void 0:k.hide;return E===b&&!M}),"number",d),s.defaultProps.allowDataOverflow),j=r5(h,j,b,i)),ke(ke({},x),{},bt({},b,ke(ke({axisType:i},s.defaultProps),{},{hide:!0,orientation:cl(gst,"".concat(i,".").concat(m%2),null),domain:j,originalDomain:w,isCategorical:g,layout:d})))}return x},{})},_st=function(e,r){var n=r.axisType,s=n===void 0?"xAxis":n,i=r.AxisComp,o=r.graphicalItems,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=e.children,h="".concat(s,"Id"),f=gc(d,i),p={};return f&&f.length?p=bst(e,{axes:f,graphicalItems:o,axisType:s,axisIdKey:h,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(p=wst(e,{Axis:i,graphicalItems:o,axisType:s,axisIdKey:h,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},jst=function(e){var r=Bg(e),n=C0(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:n8(n,function(s){return s.coordinate}),tooltipAxis:r,tooltipAxisBandSize:EL(r,n)}},CG=function(e){var r=e.children,n=e.defaultShowTooltip,s=ro(r,Hv),i=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(i=s.props.startIndex),s.props.endIndex>=0&&(o=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},Sst=function(e){return!e||!e.length?!1:e.some(function(r){var n=Fu(r&&r.type);return n&&n.indexOf("Bar")>=0})},kG=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Nst=function(e,r){var n=e.props,s=e.graphicalItems,i=e.xAxisMap,o=i===void 0?{}:i,l=e.yAxisMap,c=l===void 0?{}:l,u=n.width,d=n.height,h=n.children,f=n.margin||{},p=ro(h,Hv),g=ro(h,Fy),m=Object.keys(c).reduce(function(j,N){var C=c[N],k=C.orientation;return!C.mirror&&!C.hide?ke(ke({},j),{},bt({},k,j[k]+C.width)):j},{left:f.left||0,right:f.right||0}),x=Object.keys(o).reduce(function(j,N){var C=o[N],k=C.orientation;return!C.mirror&&!C.hide?ke(ke({},j),{},bt({},k,cl(j,"".concat(k))+C.height)):j},{top:f.top||0,bottom:f.bottom||0}),y=ke(ke({},x),m),v=y.bottom;p&&(y.bottom+=p.props.height||Hv.defaultProps.height),g&&r&&(y=PXe(y,s,n,r));var b=u-y.left-y.right,w=d-y.top-y.bottom;return ke(ke({brushBottom:v},y),{},{width:Math.max(b,0),height:Math.max(w,0)})},Ast=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},Est=function(e){var r=e.chartName,n=e.GraphicalChild,s=e.defaultTooltipEventType,i=s===void 0?"axis":s,o=e.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,h=e.defaultProps,f=function(y,v){var b=v.graphicalItems,w=v.stackGroups,j=v.offset,N=v.updateId,C=v.dataStartIndex,k=v.dataEndIndex,E=y.barSize,M=y.layout,z=y.barGap,P=y.barCategoryGap,V=y.maxBarSize,A=kG(M),$=A.numericAxisName,K=A.cateAxisName,G=Sst(b),Y=[];return b.forEach(function(H,B){var L=M2(y.data,{graphicalItems:[H],dataStartIndex:C,dataEndIndex:k}),F=H.type.defaultProps!==void 0?ke(ke({},H.type.defaultProps),H.props):H.props,W=F.dataKey,X=F.maxBarSize,oe=F["".concat($,"Id")],le=F["".concat(K,"Id")],U={},R=c.reduce(function(ue,re){var pe=v["".concat(re.axisType,"Map")],ve=F["".concat(re.axisType,"Id")];pe&&pe[ve]||re.axisType==="zAxis"||Dv();var xe=pe[ve];return ke(ke({},ue),{},bt(bt({},re.axisType,xe),"".concat(re.axisType,"Ticks"),C0(xe)))},U),ee=R[K],te=R["".concat(K,"Ticks")],Z=w&&w[oe]&&w[oe].hasStack&&zXe(H,w[oe].stackGroups),J=Fu(H.type).indexOf("Bar")>=0,he=EL(ee,te),O=[],ie=G&&kXe({barSize:E,stackGroups:w,totalSize:Ast(R,K)});if(J){var q,I,T=Qt(X)?V:X,D=(q=(I=EL(ee,te,!0))!==null&&I!==void 0?I:T)!==null&&q!==void 0?q:0;O=TXe({barGap:z,barCategoryGap:P,bandSize:D!==he?D:he,sizeList:ie[le],maxBarSize:T}),D!==he&&(O=O.map(function(ue){return ke(ke({},ue),{},{position:ke(ke({},ue.position),{},{offset:ue.position.offset-D/2})})}))}var ne=H&&H.type&&H.type.getComposedData;ne&&Y.push({props:ke(ke({},ne(ke(ke({},R),{},{displayedData:L,props:y,dataKey:W,item:H,bandSize:he,barPosition:O,offset:j,stackedData:Z,layout:M,dataStartIndex:C,dataEndIndex:k}))),{},bt(bt(bt({key:H.key||"item-".concat(B)},$,R[$]),K,R[K]),"animationId",N)),childIndex:k6e(H,y.children),item:H})}),Y},p=function(y,v){var b=y.props,w=y.dataStartIndex,j=y.dataEndIndex,N=y.updateId;if(!t7({props:b}))return null;var C=b.children,k=b.layout,E=b.stackOffset,M=b.data,z=b.reverseStackOrder,P=kG(k),V=P.numericAxisName,A=P.cateAxisName,$=gc(C,n),K=BXe(M,$,"".concat(V,"Id"),"".concat(A,"Id"),E,z),G=c.reduce(function(F,W){var X="".concat(W.axisType,"Map");return ke(ke({},F),{},bt({},X,_st(b,ke(ke({},W),{},{graphicalItems:$,stackGroups:W.axisType===V&&K,dataStartIndex:w,dataEndIndex:j}))))},{}),Y=Nst(ke(ke({},G),{},{props:b,graphicalItems:$}),v==null?void 0:v.legendBBox);Object.keys(G).forEach(function(F){G[F]=d(b,G[F],Y,F.replace("Map",""),r)});var H=G["".concat(A,"Map")],B=jst(H),L=f(b,ke(ke({},G),{},{dataStartIndex:w,dataEndIndex:j,updateId:N,graphicalItems:$,stackGroups:K,offset:Y}));return ke(ke({formattedGraphicalItems:L,graphicalItems:$,offset:Y,stackGroups:K},B),G)},g=function(x){function y(v){var b,w,j;return ist(this,y),j=lst(this,y,[v]),bt(j,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),bt(j,"accessibilityManager",new Vnt),bt(j,"handleLegendBBoxUpdate",function(N){if(N){var C=j.state,k=C.dataStartIndex,E=C.dataEndIndex,M=C.updateId;j.setState(ke({legendBBox:N},p({props:j.props,dataStartIndex:k,dataEndIndex:E,updateId:M},ke(ke({},j.state),{},{legendBBox:N}))))}}),bt(j,"handleReceiveSyncEvent",function(N,C,k){if(j.props.syncId===N){if(k===j.eventEmitterSymbol&&typeof j.props.syncMethod!="function")return;j.applySyncEvent(C)}}),bt(j,"handleBrushChange",function(N){var C=N.startIndex,k=N.endIndex;if(C!==j.state.dataStartIndex||k!==j.state.dataEndIndex){var E=j.state.updateId;j.setState(function(){return ke({dataStartIndex:C,dataEndIndex:k},p({props:j.props,dataStartIndex:C,dataEndIndex:k,updateId:E},j.state))}),j.triggerSyncEvent({dataStartIndex:C,dataEndIndex:k})}}),bt(j,"handleMouseEnter",function(N){var C=j.getMouseInfo(N);if(C){var k=ke(ke({},C),{},{isTooltipActive:!0});j.setState(k),j.triggerSyncEvent(k);var E=j.props.onMouseEnter;Ft(E)&&E(k,N)}}),bt(j,"triggeredAfterMouseMove",function(N){var C=j.getMouseInfo(N),k=C?ke(ke({},C),{},{isTooltipActive:!0}):{isTooltipActive:!1};j.setState(k),j.triggerSyncEvent(k);var E=j.props.onMouseMove;Ft(E)&&E(k,N)}),bt(j,"handleItemMouseEnter",function(N){j.setState(function(){return{isTooltipActive:!0,activeItem:N,activePayload:N.tooltipPayload,activeCoordinate:N.tooltipPosition||{x:N.cx,y:N.cy}}})}),bt(j,"handleItemMouseLeave",function(){j.setState(function(){return{isTooltipActive:!1}})}),bt(j,"handleMouseMove",function(N){N.persist(),j.throttleTriggeredAfterMouseMove(N)}),bt(j,"handleMouseLeave",function(N){j.throttleTriggeredAfterMouseMove.cancel();var C={isTooltipActive:!1};j.setState(C),j.triggerSyncEvent(C);var k=j.props.onMouseLeave;Ft(k)&&k(C,N)}),bt(j,"handleOuterEvent",function(N){var C=C6e(N),k=cl(j.props,"".concat(C));if(C&&Ft(k)){var E,M;/.*touch.*/i.test(C)?M=j.getMouseInfo(N.changedTouches[0]):M=j.getMouseInfo(N),k((E=M)!==null&&E!==void 0?E:{},N)}}),bt(j,"handleClick",function(N){var C=j.getMouseInfo(N);if(C){var k=ke(ke({},C),{},{isTooltipActive:!0});j.setState(k),j.triggerSyncEvent(k);var E=j.props.onClick;Ft(E)&&E(k,N)}}),bt(j,"handleMouseDown",function(N){var C=j.props.onMouseDown;if(Ft(C)){var k=j.getMouseInfo(N);C(k,N)}}),bt(j,"handleMouseUp",function(N){var C=j.props.onMouseUp;if(Ft(C)){var k=j.getMouseInfo(N);C(k,N)}}),bt(j,"handleTouchMove",function(N){N.changedTouches!=null&&N.changedTouches.length>0&&j.throttleTriggeredAfterMouseMove(N.changedTouches[0])}),bt(j,"handleTouchStart",function(N){N.changedTouches!=null&&N.changedTouches.length>0&&j.handleMouseDown(N.changedTouches[0])}),bt(j,"handleTouchEnd",function(N){N.changedTouches!=null&&N.changedTouches.length>0&&j.handleMouseUp(N.changedTouches[0])}),bt(j,"handleDoubleClick",function(N){var C=j.props.onDoubleClick;if(Ft(C)){var k=j.getMouseInfo(N);C(k,N)}}),bt(j,"handleContextMenu",function(N){var C=j.props.onContextMenu;if(Ft(C)){var k=j.getMouseInfo(N);C(k,N)}}),bt(j,"triggerSyncEvent",function(N){j.props.syncId!==void 0&&cI.emit(uI,j.props.syncId,N,j.eventEmitterSymbol)}),bt(j,"applySyncEvent",function(N){var C=j.props,k=C.layout,E=C.syncMethod,M=j.state.updateId,z=N.dataStartIndex,P=N.dataEndIndex;if(N.dataStartIndex!==void 0||N.dataEndIndex!==void 0)j.setState(ke({dataStartIndex:z,dataEndIndex:P},p({props:j.props,dataStartIndex:z,dataEndIndex:P,updateId:M},j.state)));else if(N.activeTooltipIndex!==void 0){var V=N.chartX,A=N.chartY,$=N.activeTooltipIndex,K=j.state,G=K.offset,Y=K.tooltipTicks;if(!G)return;if(typeof E=="function")$=E(Y,N);else if(E==="value"){$=-1;for(var H=0;H<Y.length;H++)if(Y[H].value===N.activeLabel){$=H;break}}var B=ke(ke({},G),{},{x:G.left,y:G.top}),L=Math.min(V,B.x+B.width),F=Math.min(A,B.y+B.height),W=Y[$]&&Y[$].value,X=i5(j.state,j.props.data,$),oe=Y[$]?{x:k==="horizontal"?Y[$].coordinate:L,y:k==="horizontal"?F:Y[$].coordinate}:Ace;j.setState(ke(ke({},N),{},{activeLabel:W,activeCoordinate:oe,activePayload:X,activeTooltipIndex:$}))}else j.setState(N)}),bt(j,"renderCursor",function(N){var C,k=j.state,E=k.isTooltipActive,M=k.activeCoordinate,z=k.activePayload,P=k.offset,V=k.activeTooltipIndex,A=k.tooltipAxisBandSize,$=j.getTooltipEventType(),K=(C=N.props.active)!==null&&C!==void 0?C:E,G=j.props.layout,Y=N.key||"_recharts-cursor";return me.createElement(Znt,{key:Y,activeCoordinate:M,activePayload:z,activeTooltipIndex:V,chartName:r,element:N,isActive:K,layout:G,offset:P,tooltipAxisBandSize:A,tooltipEventType:$})}),bt(j,"renderPolarAxis",function(N,C,k){var E=cl(N,"type.axisType"),M=cl(j.state,"".concat(E,"Map")),z=N.type.defaultProps,P=z!==void 0?ke(ke({},z),N.props):N.props,V=M&&M[P["".concat(E,"Id")]];return S.cloneElement(N,ke(ke({},V),{},{className:Jt(E,V.className),key:N.key||"".concat(C,"-").concat(k),ticks:C0(V,!0)}))}),bt(j,"renderPolarGrid",function(N){var C=N.props,k=C.radialLines,E=C.polarAngles,M=C.polarRadius,z=j.state,P=z.radiusAxisMap,V=z.angleAxisMap,A=Bg(P),$=Bg(V),K=$.cx,G=$.cy,Y=$.innerRadius,H=$.outerRadius;return S.cloneElement(N,{polarAngles:Array.isArray(E)?E:C0($,!0).map(function(B){return B.coordinate}),polarRadius:Array.isArray(M)?M:C0(A,!0).map(function(B){return B.coordinate}),cx:K,cy:G,innerRadius:Y,outerRadius:H,key:N.key||"polar-grid",radialLines:k})}),bt(j,"renderLegend",function(){var N=j.state.formattedGraphicalItems,C=j.props,k=C.children,E=C.width,M=C.height,z=j.props.margin||{},P=E-(z.left||0)-(z.right||0),V=Tle({children:k,formattedGraphicalItems:N,legendWidth:P,legendContent:u});if(!V)return null;var A=V.item,$=NG(V,Jnt);return S.cloneElement(A,ke(ke({},$),{},{chartWidth:E,chartHeight:M,margin:z,onBBoxUpdate:j.handleLegendBBoxUpdate}))}),bt(j,"renderTooltip",function(){var N,C=j.props,k=C.children,E=C.accessibilityLayer,M=ro(k,qc);if(!M)return null;var z=j.state,P=z.isTooltipActive,V=z.activeCoordinate,A=z.activePayload,$=z.activeLabel,K=z.offset,G=(N=M.props.active)!==null&&N!==void 0?N:P;return S.cloneElement(M,{viewBox:ke(ke({},K),{},{x:K.left,y:K.top}),active:G,label:$,payload:G?A:[],coordinate:V,accessibilityLayer:E})}),bt(j,"renderBrush",function(N){var C=j.props,k=C.margin,E=C.data,M=j.state,z=M.offset,P=M.dataStartIndex,V=M.dataEndIndex,A=M.updateId;return S.cloneElement(N,{key:N.key||"_recharts-brush",onChange:kN(j.handleBrushChange,N.props.onChange),data:E,x:rt(N.props.x)?N.props.x:z.left,y:rt(N.props.y)?N.props.y:z.top+z.height+z.brushBottom-(k.bottom||0),width:rt(N.props.width)?N.props.width:z.width,startIndex:P,endIndex:V,updateId:"brush-".concat(A)})}),bt(j,"renderReferenceElement",function(N,C,k){if(!N)return null;var E=j,M=E.clipPathId,z=j.state,P=z.xAxisMap,V=z.yAxisMap,A=z.offset,$=N.type.defaultProps||{},K=N.props,G=K.xAxisId,Y=G===void 0?$.xAxisId:G,H=K.yAxisId,B=H===void 0?$.yAxisId:H;return S.cloneElement(N,{key:N.key||"".concat(C,"-").concat(k),xAxis:P[Y],yAxis:V[B],viewBox:{x:A.left,y:A.top,width:A.width,height:A.height},clipPathId:M})}),bt(j,"renderActivePoints",function(N){var C=N.item,k=N.activePoint,E=N.basePoint,M=N.childIndex,z=N.isRange,P=[],V=C.props.key,A=C.item.type.defaultProps!==void 0?ke(ke({},C.item.type.defaultProps),C.item.props):C.item.props,$=A.activeDot,K=A.dataKey,G=ke(ke({index:M,dataKey:K,cx:k.x,cy:k.y,r:4,fill:P8(C.item),strokeWidth:2,stroke:"#fff",payload:k.payload,value:k.value},Lt($,!1)),hC($));return P.push(y.renderActiveDot($,G,"".concat(V,"-activePoint-").concat(M))),E?P.push(y.renderActiveDot($,ke(ke({},G),{},{cx:E.x,cy:E.y}),"".concat(V,"-basePoint-").concat(M))):z&&P.push(null),P}),bt(j,"renderGraphicChild",function(N,C,k){var E=j.filterFormatItem(N,C,k);if(!E)return null;var M=j.getTooltipEventType(),z=j.state,P=z.isTooltipActive,V=z.tooltipAxis,A=z.activeTooltipIndex,$=z.activeLabel,K=j.props.children,G=ro(K,qc),Y=E.props,H=Y.points,B=Y.isRange,L=Y.baseLine,F=E.item.type.defaultProps!==void 0?ke(ke({},E.item.type.defaultProps),E.item.props):E.item.props,W=F.activeDot,X=F.hide,oe=F.activeBar,le=F.activeShape,U=!!(!X&&P&&G&&(W||oe||le)),R={};M!=="axis"&&G&&G.props.trigger==="click"?R={onClick:kN(j.handleItemMouseEnter,N.props.onClick)}:M!=="axis"&&(R={onMouseLeave:kN(j.handleItemMouseLeave,N.props.onMouseLeave),onMouseEnter:kN(j.handleItemMouseEnter,N.props.onMouseEnter)});var ee=S.cloneElement(N,ke(ke({},E.props),R));function te(re){return typeof V.dataKey=="function"?V.dataKey(re.payload):null}if(U)if(A>=0){var Z,J;if(V.dataKey&&!V.allowDuplicatedCategory){var he=typeof V.dataKey=="function"?te:"payload.".concat(V.dataKey.toString());Z=F4(H,he,$),J=B&&L&&F4(L,he,$)}else Z=H==null?void 0:H[A],J=B&&L&&L[A];if(le||oe){var O=N.props.activeIndex!==void 0?N.props.activeIndex:A;return[S.cloneElement(N,ke(ke(ke({},E.props),R),{},{activeIndex:O})),null,null]}if(!Qt(Z))return[ee].concat(Kv(j.renderActivePoints({item:E,activePoint:Z,basePoint:J,childIndex:A,isRange:B})))}else{var ie,q=(ie=j.getItemByXY(j.state.activeCoordinate))!==null&&ie!==void 0?ie:{graphicalItem:ee},I=q.graphicalItem,T=I.item,D=T===void 0?N:T,ne=I.childIndex,ue=ke(ke(ke({},E.props),R),{},{activeIndex:ne});return[S.cloneElement(D,ue),null,null]}return B?[ee,null,null]:[ee,null]}),bt(j,"renderCustomized",function(N,C,k){return S.cloneElement(N,ke(ke({key:"recharts-customized-".concat(k)},j.props),j.state))}),bt(j,"renderMap",{CartesianGrid:{handler:MN,once:!0},ReferenceArea:{handler:j.renderReferenceElement},ReferenceLine:{handler:MN},ReferenceDot:{handler:j.renderReferenceElement},XAxis:{handler:MN},YAxis:{handler:MN},Brush:{handler:j.renderBrush,once:!0},Bar:{handler:j.renderGraphicChild},Line:{handler:j.renderGraphicChild},Area:{handler:j.renderGraphicChild},Radar:{handler:j.renderGraphicChild},RadialBar:{handler:j.renderGraphicChild},Scatter:{handler:j.renderGraphicChild},Pie:{handler:j.renderGraphicChild},Funnel:{handler:j.renderGraphicChild},Tooltip:{handler:j.renderCursor,once:!0},PolarGrid:{handler:j.renderPolarGrid,once:!0},PolarAngleAxis:{handler:j.renderPolarAxis},PolarRadiusAxis:{handler:j.renderPolarAxis},Customized:{handler:j.renderCustomized}}),j.clipPathId="".concat((b=v.id)!==null&&b!==void 0?b:i2("recharts"),"-clip"),j.throttleTriggeredAfterMouseMove=Coe(j.triggeredAfterMouseMove,(w=v.throttleDelay)!==null&&w!==void 0?w:1e3/60),j.state={},j}return dst(y,x),ost(y,[{key:"componentDidMount",value:function(){var b,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(b=this.props.margin.left)!==null&&b!==void 0?b:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var b=this.props,w=b.children,j=b.data,N=b.height,C=b.layout,k=ro(w,qc);if(k){var E=k.props.defaultIndex;if(!(typeof E!="number"||E<0||E>this.state.tooltipTicks.length-1)){var M=this.state.tooltipTicks[E]&&this.state.tooltipTicks[E].value,z=i5(this.state,j,E,M),P=this.state.tooltipTicks[E].coordinate,V=(this.state.offset.top+N)/2,A=C==="horizontal",$=A?{x:P,y:V}:{y:P,x:V},K=this.state.formattedGraphicalItems.find(function(Y){var H=Y.item;return H.type.name==="Scatter"});K&&($=ke(ke({},$),K.props.points[E].tooltipPosition),z=K.props.points[E].tooltipPayload);var G={activeTooltipIndex:E,isTooltipActive:!0,activeLabel:M,activePayload:z,activeCoordinate:$};this.setState(G),this.renderCursor(k),this.accessibilityManager.setIndex(E)}}}},{key:"getSnapshotBeforeUpdate",value:function(b,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==b.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==b.margin){var j,N;this.accessibilityManager.setDetails({offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0}})}return null}},{key:"componentDidUpdate",value:function(b){U4([ro(b.children,qc)],[ro(this.props.children,qc)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var b=ro(this.props.children,qc);if(b&&typeof b.props.shared=="boolean"){var w=b.props.shared?"axis":"item";return l.indexOf(w)>=0?w:i}return i}},{key:"getMouseInfo",value:function(b){if(!this.container)return null;var w=this.container,j=w.getBoundingClientRect(),N=rqe(j),C={chartX:Math.round(b.pageX-N.left),chartY:Math.round(b.pageY-N.top)},k=j.width/w.offsetWidth||1,E=this.inRange(C.chartX,C.chartY,k);if(!E)return null;var M=this.state,z=M.xAxisMap,P=M.yAxisMap,V=this.getTooltipEventType(),A=EG(this.state,this.props.data,this.props.layout,E);if(V!=="axis"&&z&&P){var $=Bg(z).scale,K=Bg(P).scale,G=$&&$.invert?$.invert(C.chartX):null,Y=K&&K.invert?K.invert(C.chartY):null;return ke(ke({},C),{},{xValue:G,yValue:Y},A)}return A?ke(ke({},C),A):null}},{key:"inRange",value:function(b,w){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,N=this.props.layout,C=b/j,k=w/j;if(N==="horizontal"||N==="vertical"){var E=this.state.offset,M=C>=E.left&&C<=E.left+E.width&&k>=E.top&&k<=E.top+E.height;return M?{x:C,y:k}:null}var z=this.state,P=z.angleAxisMap,V=z.radiusAxisMap;if(P&&V){var A=Bg(P);return uq({x:C,y:k},A)}return null}},{key:"parseEventsOfWrapper",value:function(){var b=this.props.children,w=this.getTooltipEventType(),j=ro(b,qc),N={};j&&w==="axis"&&(j.props.trigger==="click"?N={onClick:this.handleClick}:N={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var C=hC(this.props,this.handleOuterEvent);return ke(ke({},C),N)}},{key:"addListener",value:function(){cI.on(uI,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){cI.removeListener(uI,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(b,w,j){for(var N=this.state.formattedGraphicalItems,C=0,k=N.length;C<k;C++){var E=N[C];if(E.item===b||E.props.key===b.key||w===Fu(E.item.type)&&j===E.childIndex)return E}return null}},{key:"renderClipPath",value:function(){var b=this.clipPathId,w=this.state.offset,j=w.left,N=w.top,C=w.height,k=w.width;return me.createElement("defs",null,me.createElement("clipPath",{id:b},me.createElement("rect",{x:j,y:N,height:C,width:k})))}},{key:"getXScales",value:function(){var b=this.state.xAxisMap;return b?Object.entries(b).reduce(function(w,j){var N=SG(j,2),C=N[0],k=N[1];return ke(ke({},w),{},bt({},C,k.scale))},{}):null}},{key:"getYScales",value:function(){var b=this.state.yAxisMap;return b?Object.entries(b).reduce(function(w,j){var N=SG(j,2),C=N[0],k=N[1];return ke(ke({},w),{},bt({},C,k.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(b){var w;return(w=this.state.xAxisMap)===null||w===void 0||(w=w[b])===null||w===void 0?void 0:w.scale}},{key:"getYScaleByAxisId",value:function(b){var w;return(w=this.state.yAxisMap)===null||w===void 0||(w=w[b])===null||w===void 0?void 0:w.scale}},{key:"getItemByXY",value:function(b){var w=this.state,j=w.formattedGraphicalItems,N=w.activeItem;if(j&&j.length)for(var C=0,k=j.length;C<k;C++){var E=j[C],M=E.props,z=E.item,P=z.type.defaultProps!==void 0?ke(ke({},z.type.defaultProps),z.props):z.props,V=Fu(z.type);if(V==="Bar"){var A=(M.data||[]).find(function(Y){return $Je(b,Y)});if(A)return{graphicalItem:E,payload:A}}else if(V==="RadialBar"){var $=(M.data||[]).find(function(Y){return uq(b,Y)});if($)return{graphicalItem:E,payload:$}}else if(k2(E,N)||T2(E,N)||D1(E,N)){var K=Ttt({graphicalItem:E,activeTooltipItem:N,itemData:P.data}),G=P.activeIndex===void 0?K:P.activeIndex;return{graphicalItem:ke(ke({},E),{},{childIndex:G}),payload:D1(E,N)?P.data[K]:E.props.data[K]}}}return null}},{key:"render",value:function(){var b=this;if(!t7(this))return null;var w=this.props,j=w.children,N=w.className,C=w.width,k=w.height,E=w.style,M=w.compact,z=w.title,P=w.desc,V=NG(w,est),A=Lt(V,!1);if(M)return me.createElement(pG,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},me.createElement(H4,yy({},A,{width:C,height:k,title:z,desc:P}),this.renderClipPath(),n7(j,this.renderMap)));if(this.props.accessibilityLayer){var $,K;A.tabIndex=($=this.props.tabIndex)!==null&&$!==void 0?$:0,A.role=(K=this.props.role)!==null&&K!==void 0?K:"application",A.onKeyDown=function(Y){b.accessibilityManager.keyboardEvent(Y)},A.onFocus=function(){b.accessibilityManager.focus()}}var G=this.parseEventsOfWrapper();return me.createElement(pG,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},me.createElement("div",yy({className:Jt("recharts-wrapper",N),style:ke({position:"relative",cursor:"default",width:C,height:k},E)},G,{ref:function(H){b.container=H}}),me.createElement(H4,yy({},A,{width:C,height:k,title:z,desc:P,style:yst}),this.renderClipPath(),n7(j,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(S.Component);bt(g,"displayName",r),bt(g,"defaultProps",ke({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},h)),bt(g,"getDerivedStateFromProps",function(x,y){var v=x.dataKey,b=x.data,w=x.children,j=x.width,N=x.height,C=x.layout,k=x.stackOffset,E=x.margin,M=y.dataStartIndex,z=y.dataEndIndex;if(y.updateId===void 0){var P=CG(x);return ke(ke(ke({},P),{},{updateId:0},p(ke(ke({props:x},P),{},{updateId:0}),y)),{},{prevDataKey:v,prevData:b,prevWidth:j,prevHeight:N,prevLayout:C,prevStackOffset:k,prevMargin:E,prevChildren:w})}if(v!==y.prevDataKey||b!==y.prevData||j!==y.prevWidth||N!==y.prevHeight||C!==y.prevLayout||k!==y.prevStackOffset||!$4(E,y.prevMargin)){var V=CG(x),A={chartX:y.chartX,chartY:y.chartY,isTooltipActive:y.isTooltipActive},$=ke(ke({},EG(y,b,C)),{},{updateId:y.updateId+1}),K=ke(ke(ke({},V),A),$);return ke(ke(ke({},K),p(ke({props:x},K),y)),{},{prevDataKey:v,prevData:b,prevWidth:j,prevHeight:N,prevLayout:C,prevStackOffset:k,prevMargin:E,prevChildren:w})}if(!U4(w,y.prevChildren)){var G,Y,H,B,L=ro(w,Hv),F=L&&(G=(Y=L.props)===null||Y===void 0?void 0:Y.startIndex)!==null&&G!==void 0?G:M,W=L&&(H=(B=L.props)===null||B===void 0?void 0:B.endIndex)!==null&&H!==void 0?H:z,X=F!==M||W!==z,oe=!Qt(b),le=oe&&!X?y.updateId:y.updateId+1;return ke(ke({updateId:le},p(ke(ke({props:x},y),{},{updateId:le,dataStartIndex:F,dataEndIndex:W}),y)),{},{prevChildren:w,dataStartIndex:F,dataEndIndex:W})}return null}),bt(g,"renderActiveDot",function(x,y,v){var b;return S.isValidElement(x)?b=S.cloneElement(x,y):Ft(x)?b=x(y):b=me.createElement(I8,y),me.createElement(xn,{className:"recharts-active-dot",key:v},b)});var m=S.forwardRef(function(y,v){return me.createElement(g,yy({},y,{ref:v}))});return m.displayName=g.displayName,m},Cce=Est({chartName:"PieChart",GraphicalChild:Tc,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:C2},{axisType:"radiusAxis",AxisComp:A2}],formatAxisMap:JXe,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function Cst(){const{studentPoints:t}=Pt(),e=(t==null?void 0:t.remaining)||0,r=(t==null?void 0:t.total)||0,n=r>0?e/r*100:0,s=[{name:"remaining",value:n},{name:"used",value:Math.max(0,100-n)}],o=(l=>l>=50?"hsl(var(--success))":l>=25?"hsl(var(--warning))":"hsl(var(--destructive))")(n);return a.jsx(Me,{className:"astro-card h-full overflow-hidden",children:a.jsxs(Be,{className:"py-4 px-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Student Points"}),n<25&&a.jsxs("div",{className:"flex items-center gap-1 text-destructive",children:[a.jsx(xbe,{className:"w-3 h-3"}),a.jsx("span",{className:"text-xs font-medium",children:"Low"})]})]}),a.jsxs("div",{className:"relative h-[140px]",children:[a.jsx(koe,{width:"100%",height:"100%",children:a.jsxs(Cce,{children:[a.jsx("defs",{children:a.jsxs("filter",{id:"glow-sp",children:[a.jsx("feGaussianBlur",{stdDeviation:"3",result:"coloredBlur"}),a.jsxs("feMerge",{children:[a.jsx("feMergeNode",{in:"coloredBlur"}),a.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),a.jsxs(Tc,{data:s,cx:"50%",cy:"50%",innerRadius:45,outerRadius:60,startAngle:90,endAngle:-270,paddingAngle:2,dataKey:"value",strokeWidth:0,filter:n>=50?"url(#glow-sp)":void 0,children:[a.jsx(Pv,{fill:o}),a.jsx(Pv,{fill:"hsl(var(--muted))"})]})]})}),a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:a.jsxs("span",{className:"text-3xl font-bold text-foreground",children:[Math.round(n),"%"]})})]}),a.jsx("div",{className:"text-center mt-1",children:a.jsxs("p",{className:"text-xs text-muted-foreground",children:[Math.round(n),"% of ",r.toLocaleString()," SP remaining"]})})]})})}function kst({stats:t}){const e=gr(),r=[{label:"Create Coding",icon:VJ,onClick:()=>e("/qualitative/kodieren"),variant:"outline"},{label:"Create Analysis",icon:Hm,onClick:()=>e("/qualitative/auswertung"),variant:"outline"},{label:"Show Codebook Grid",icon:Kve,onClick:()=>e("/qualitative/kodierbogen-grid"),variant:"outline"}],n=[];((t==null?void 0:t.total_documents)||0)===0&&n.push({label:"Upload Literature",icon:Ku,onClick:()=>e("/my-documents"),variant:"default"}),((t==null?void 0:t.total_documents)||0)>0&&((t==null?void 0:t.total_theories)||0)===0&&n.push({label:"Generate Theory",icon:Js,onClick:()=>e("/theory-builder"),variant:"default"}),((t==null?void 0:t.total_documents)||0)>0&&((t==null?void 0:t.total_summaries)||0)===0&&n.push({label:"Create Summary",icon:Nr,onClick:()=>e("/new-summary"),variant:"outline"}),!(t!=null&&t.active_thesis_id)&&((t==null?void 0:t.total_theses)||0)===0&&n.push({label:"Create Thesis",icon:Js,onClick:()=>e("/thesis-manager"),variant:"default"}),((t==null?void 0:t.total_documents)||0)>0&&((t==null?void 0:t.total_methods)||0)===0&&n.push({label:"Create Methodology",icon:DE,onClick:()=>e("/methods-approach"),variant:"outline"});const s=n.slice(0,3);return a.jsxs(Me,{className:"h-full",children:[a.jsx(qe,{className:"pb-3",children:a.jsx(Je,{className:"flex items-center gap-2 text-base",children:"Quick Actions"})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsx("div",{className:"space-y-2",children:a.jsx("div",{className:"space-y-2",children:r.map((i,o)=>a.jsxs(ye,{variant:i.variant,size:"sm",className:"w-full justify-start",onClick:i.onClick,children:[a.jsx(i.icon,{className:"h-4 w-4 mr-2"}),i.label]},o))})}),s.length>0&&a.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[a.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Suggested"}),a.jsx("div",{className:"space-y-2",children:s.map((i,o)=>a.jsxs(ye,{variant:i.variant,size:"sm",className:"w-full justify-start",onClick:i.onClick,children:[a.jsx(i.icon,{className:"h-4 w-4 mr-2"}),i.label]},o))})]})]})]})}function kce(){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsx(Me,{className:"lg:col-span-2 astro-card",children:a.jsxs("div",{className:"flex items-center gap-6 p-6",children:[a.jsx(ar,{className:"h-20 w-20 rounded-full"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(ar,{className:"h-4 w-24"}),a.jsx(ar,{className:"h-8 w-48"}),a.jsx(ar,{className:"h-6 w-64"})]})]})}),a.jsx(Me,{className:"astro-card",children:a.jsxs(Be,{className:"py-4 px-4",children:[a.jsx(ar,{className:"h-4 w-24 mb-2"}),a.jsx("div",{className:"flex items-center justify-center h-[140px]",children:a.jsx(ar,{className:"h-[120px] w-[120px] rounded-full"})}),a.jsx(ar,{className:"h-4 w-32 mx-auto mt-1"})]})})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[1,2,3].map(t=>a.jsx(Me,{className:"astro-card",children:a.jsxs(Be,{className:"py-3 px-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(ar,{className:"h-7 w-7 rounded-lg"}),a.jsx(ar,{className:"h-4 w-20"})]}),a.jsx("div",{className:"flex items-center justify-center h-[70px]",children:a.jsx(ar,{className:"h-16 w-32 rounded-t-full"})})]})},t))}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ar,{className:"h-6 w-32"})}),a.jsxs(Be,{className:"space-y-3",children:[a.jsx(ar,{className:"h-12 w-full"}),a.jsx(ar,{className:"h-4 w-3/4"})]})]}),a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ar,{className:"h-6 w-40"})}),a.jsxs(Be,{className:"space-y-3",children:[a.jsx(ar,{className:"h-12 w-full"}),a.jsx(ar,{className:"h-4 w-3/4"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ar,{className:"h-6 w-36"})}),a.jsx(Be,{className:"space-y-3",children:a.jsxs("div",{className:"flex justify-between",children:[a.jsx(ar,{className:"h-10 w-16"}),a.jsx(ar,{className:"h-10 w-16"}),a.jsx(ar,{className:"h-10 w-16"})]})})]}),a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ar,{className:"h-6 w-44"})}),a.jsx(Be,{className:"space-y-3",children:a.jsxs("div",{className:"flex justify-between",children:[a.jsx(ar,{className:"h-10 w-16"}),a.jsx(ar,{className:"h-10 w-16"}),a.jsx(ar,{className:"h-10 w-16"})]})})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ar,{className:"h-6 w-32"})}),a.jsx(Be,{children:a.jsx(ar,{className:"h-16 w-full"})})]}),a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ar,{className:"h-6 w-28"})}),a.jsxs(Be,{className:"space-y-2",children:[a.jsx(ar,{className:"h-10 w-full"}),a.jsx(ar,{className:"h-10 w-full"})]})]})]})]})}const TG=["Focus is key.","Let's make some progress.","Action time.","You've got this.","Great to see you working.","Keep the momentum.","Power through.","Another productive day.","Let's dive in.","Good work day ahead.","Onward and upward."];function Tst({stats:t}){const{researchProfile:e}=Pt(),[r,n]=S.useState(null),s=(e==null?void 0:e.nickname)||"Researcher",i=t==null?void 0:t.active_thesis_title;S.useEffect(()=>{(async()=>{const u=await Ry(e==null?void 0:e.avatar_url);n(u)})()},[e==null?void 0:e.avatar_url]);const o=S.useMemo(()=>TG[Math.floor(Math.random()*TG.length)],[]),l=s.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2);return a.jsxs("div",{className:"flex items-center gap-6 p-6",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute -inset-1 bg-gradient-to-r from-primary via-primary/60 to-primary/30 rounded-full blur-sm opacity-60"}),a.jsxs(kT,{className:"relative h-20 w-20 ring-4 ring-primary/20 ring-offset-2 ring-offset-background",children:[a.jsx(TT,{src:r||void 0,alt:s,className:"object-cover"}),a.jsx(PT,{className:"bg-gradient-to-br from-primary/20 to-primary/5 text-primary text-2xl font-bold",children:l||"R"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ji,{className:"w-5 h-5 text-primary/70"}),a.jsx("span",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wide",children:"Welcome back"})]}),a.jsx("h2",{className:"text-3xl font-bold text-foreground",children:s}),i?a.jsxs("div",{className:"mt-1 space-y-1",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.jsx("span",{children:"Working on "}),a.jsx("span",{className:"font-medium text-foreground",children:i})]}),a.jsx("p",{className:"text-muted-foreground/70 italic mt-2 my-[22px] text-sm",children:o})]}):a.jsx("p",{className:"text-sm text-muted-foreground",children:"Ready to start your research journey?"})]})]})}function Pst({stats:t}){const e=(t==null?void 0:t.active_thesis_progress)??0,r=t==null?void 0:t.active_thesis_title,n=l=>l<=25?"The start is made.":l<=50?"Well on your way! Keep the pace.":l<=75?"Halfway done and you're great!":"The final stretch is on. Almost there!",s=[{name:"completed",value:e},{name:"remaining",value:Math.max(0,100-e)}],i=l=>l>=75?"hsl(var(--success))":l>=50?"hsl(var(--warning))":l>=25?"hsl(var(--primary))":"hsl(var(--muted-foreground))";if(!r)return a.jsx(Me,{className:"astro-card h-full",children:a.jsxs(Be,{className:"flex flex-col items-center justify-center h-full py-8",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-muted/50 flex items-center justify-center mb-4",children:a.jsx(GJ,{className:"w-8 h-8 text-muted-foreground"})}),a.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"No active thesis yet"}),a.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Create one to track progress"})]})});const o=i(e);return a.jsx(Me,{className:"astro-card h-full overflow-hidden",children:a.jsxs(Be,{className:"py-4 px-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Thesis Progress"}),e>=50&&a.jsxs("div",{className:"flex items-center gap-1 text-success",children:[a.jsx(vbe,{className:"w-3 h-3"}),a.jsx("span",{className:"text-xs font-medium",children:"On track"})]})]}),a.jsxs("div",{className:"relative h-[140px]",children:[a.jsx(koe,{width:"100%",height:"100%",children:a.jsxs(Cce,{children:[a.jsx("defs",{children:a.jsxs("filter",{id:"glow",children:[a.jsx("feGaussianBlur",{stdDeviation:"3",result:"coloredBlur"}),a.jsxs("feMerge",{children:[a.jsx("feMergeNode",{in:"coloredBlur"}),a.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),a.jsxs(Tc,{data:s,cx:"50%",cy:"50%",innerRadius:45,outerRadius:60,startAngle:90,endAngle:-270,paddingAngle:2,dataKey:"value",strokeWidth:0,filter:e>=50?"url(#glow)":void 0,children:[a.jsx(Pv,{fill:o}),a.jsx(Pv,{fill:"hsl(var(--muted))"})]})]})}),a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:a.jsxs("span",{className:"text-4xl font-bold text-foreground",children:[Math.round(e),"%"]})})]}),a.jsx("p",{className:"text-muted-foreground text-center mt-2 italic text-sm",children:n(e)})]})})}const DN=({title:t,currentValue:e,targetValue:r,excellentThreshold:n,icon:s,progressColor:i="hsl(var(--primary))",className:o})=>{const l=S.useRef(null),c=ILe(l,{once:!0,margin:"-20%"}),{progressPercentage:u,circumference:d,strokeDashoffset:h}=S.useMemo(()=>{const g=2*Math.PI*45,m=Math.min(Math.max(e/r*100,0),100),x=g*(1-m/100);return{progressPercentage:Math.round(m),circumference:g,strokeDashoffset:x}},[e,r]),f=n&&e>=n;return a.jsx(Me,{ref:l,className:Ie("astro-card",o),children:a.jsx(Be,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"relative h-20 w-20 flex-shrink-0",children:[a.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100",role:"img","aria-label":`Progress: ${u}%`,children:a.jsxs("g",{transform:"rotate(-90, 50, 50)",children:[a.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"transparent",stroke:"hsl(var(--muted))",strokeWidth:"8"}),a.jsx(el.circle,{cx:"50",cy:"50",r:"45",fill:"transparent",stroke:i,strokeWidth:"8",strokeLinecap:"round",strokeDasharray:d,initial:{strokeDashoffset:d},animate:c?{strokeDashoffset:h}:{},transition:{duration:1.2,ease:"easeOut"}})]})}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx(s,{className:"h-6 w-6",style:{color:i}})})]}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsxs("span",{className:"text-2xl font-bold text-foreground",children:[e,a.jsxs("span",{className:"text-sm font-normal text-muted-foreground ml-1",children:["/ ",r]})]}),a.jsx("span",{className:"text-sm text-muted-foreground truncate",children:t}),f&&a.jsx("span",{className:"text-xs font-medium mt-1",style:{color:i},children:"✓ Excellent"})]})]})})})};function Ost(){const{stats:t,loading:e}=KIe(),{userProfile:r}=Pt();return e?a.jsx(kce,{}):a.jsxs("div",{className:"space-y-6 animate-fade-in",children:[(r==null?void 0:r.plan)==="free"&&a.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-xl p-4 mb-6 flex items-start gap-3",children:[a.jsx(Ji,{className:"h-5 w-5 text-amber-600 mt-0.5 shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-amber-900 dark:text-amber-200",children:"Welcome to Academly Beta! 🎉"}),a.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-300 mt-1",children:"As a beta tester, we've credited your account with 2,000 Student Points — enough to explore all features. Your honest feedback helps us build something great."}),a.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 mt-2",children:"Beta period · Free access · No credit card needed"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 lg:gap-6",children:[a.jsx(Me,{className:"astro-card animate-slide-up",style:{animationDelay:"0ms"},children:a.jsx(Tst,{stats:t})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"50ms"},children:a.jsx(Cst,{})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"100ms"},children:a.jsx(Pst,{stats:t})})]}),a.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4",children:[a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"100ms"},children:a.jsx(DN,{currentValue:(t==null?void 0:t.total_documents)??0,targetValue:5,excellentThreshold:7,title:"Documents",icon:Nr,progressColor:"hsl(var(--primary))"})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"150ms"},children:a.jsx(DN,{currentValue:(t==null?void 0:t.total_theories)??0,targetValue:4,excellentThreshold:7,title:"Theory Blocks",icon:Js,progressColor:"hsl(142, 76%, 41%)"})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"200ms"},children:a.jsx(DN,{currentValue:(t==null?void 0:t.total_methods)??0,targetValue:4,excellentThreshold:7,title:"Methodologies",icon:XJ,progressColor:"hsl(270, 70%, 60%)"})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"250ms"},children:a.jsx(DN,{currentValue:(t==null?void 0:t.total_interviews)??0,targetValue:5,excellentThreshold:8,title:"Interviews",icon:ree,progressColor:"hsl(38, 92%, 50%)"})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 lg:gap-6",children:[a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"250ms"},children:a.jsx(DLe,{stats:t})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"300ms"},children:a.jsx(LLe,{stats:t})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 lg:gap-6",children:[a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"350ms"},children:a.jsx(kst,{stats:t})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"400ms"},children:a.jsx(FLe,{stats:t})})]})]})}const Fe=S.forwardRef(({className:t,type:e,...r},n)=>a.jsx("input",{type:e,className:Ie("flex h-11 w-full rounded-lg border border-input bg-background","px-4 py-2.5 text-sm text-foreground","shadow-theme-xs","placeholder:text-muted-foreground","focus:border-brand-300 focus:outline-none focus:ring-3 focus:ring-brand-500/10","disabled:cursor-not-allowed disabled:opacity-50","dark:border-gray-800 dark:bg-gray-900 dark:text-white",t),ref:n,...r}));Fe.displayName="Input";var Ist="Label",Tce=S.forwardRef((t,e)=>a.jsx(et.label,{...t,ref:e,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Tce.displayName=Ist;var Pce=Tce;const Rst=od("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),_e=S.forwardRef(({className:t,...e},r)=>a.jsx(Pce,{ref:r,className:Ie(Rst(),t),...e}));_e.displayName=Pce.displayName;function F8(t){const e=S.useRef({value:t,previous:t});return S.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Mst=[" ","Enter","ArrowUp","ArrowDown"],Dst=[" ","Enter"],Qm="Select",[D2,L2,Lst]=Tj(Qm),[Ib,Yyt]=Bn(Qm,[Lst,ff]),F2=ff(),[Fst,Nf]=Ib(Qm),[$st,Bst]=Ib(Qm),Oce=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:f,required:p,form:g}=t,m=F2(e),[x,y]=S.useState(null),[v,b]=S.useState(null),[w,j]=S.useState(!1),N=cg(u),[C,k]=Ms({prop:n,defaultProp:s??!1,onChange:i,caller:Qm}),[E,M]=Ms({prop:o,defaultProp:l,onChange:c,caller:Qm}),z=S.useRef(null),P=x?g||!!x.closest("form"):!0,[V,A]=S.useState(new Set),$=Array.from(V).map(K=>K.props.value).join(";");return a.jsx(cT,{...m,children:a.jsxs(Fst,{required:p,scope:e,trigger:x,onTriggerChange:y,valueNode:v,onValueNodeChange:b,valueNodeHasChildren:w,onValueNodeHasChildrenChange:j,contentId:Yi(),value:E,onValueChange:M,open:C,onOpenChange:k,dir:N,triggerPointerDownPosRef:z,disabled:f,children:[a.jsx(D2.Provider,{scope:e,children:a.jsx($st,{scope:t.__scopeSelect,onNativeOptionAdd:S.useCallback(K=>{A(G=>new Set(G).add(K))},[]),onNativeOptionRemove:S.useCallback(K=>{A(G=>{const Y=new Set(G);return Y.delete(K),Y})},[]),children:r})}),P?a.jsxs(rue,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:h,value:E,onChange:K=>M(K.target.value),disabled:f,form:g,children:[E===void 0?a.jsx("option",{value:""}):null,Array.from(V)]},$):null]})})};Oce.displayName=Qm;var Ice="SelectTrigger",Rce=S.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...s}=t,i=F2(r),o=Nf(Ice,r),l=o.disabled||n,c=Nt(e,o.onTriggerChange),u=L2(r),d=S.useRef("touch"),[h,f,p]=sue(m=>{const x=u().filter(b=>!b.disabled),y=x.find(b=>b.value===o.value),v=iue(x,m,y);v!==void 0&&o.onValueChange(v.value)}),g=m=>{l||(o.onOpenChange(!0),p()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(Mj,{asChild:!0,...i,children:a.jsx(et.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":nue(o.value)?"":void 0,...s,ref:c,onClick:ze(s.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:ze(s.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:ze(s.onKeyDown,m=>{const x=h.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&f(m.key),!(x&&m.key===" ")&&Mst.includes(m.key)&&(g(),m.preventDefault())})})})});Rce.displayName=Ice;var Mce="SelectValue",Dce=S.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,children:i,placeholder:o="",...l}=t,c=Nf(Mce,r),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,h=Nt(e,c.onValueNodeChange);return vn(()=>{u(d)},[u,d]),a.jsx(et.span,{...l,ref:h,style:{pointerEvents:"none"},children:nue(c.value)?a.jsx(a.Fragment,{children:o}):i})});Dce.displayName=Mce;var Ust="SelectIcon",Lce=S.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...s}=t;return a.jsx(et.span,{"aria-hidden":!0,...s,ref:e,children:n||"▼"})});Lce.displayName=Ust;var zst="SelectPortal",Fce=t=>a.jsx(nb,{asChild:!0,...t});Fce.displayName=zst;var Zm="SelectContent",$ce=S.forwardRef((t,e)=>{const r=Nf(Zm,t.__scopeSelect),[n,s]=S.useState();if(vn(()=>{s(new DocumentFragment)},[]),!r.open){const i=n;return i?Ac.createPortal(a.jsx(Bce,{scope:t.__scopeSelect,children:a.jsx(D2.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),i):null}return a.jsx(Uce,{...t,ref:e})});$ce.displayName=Zm;var Mo=10,[Bce,Af]=Ib(Zm),Hst="SelectContentImpl",Wst=Qh("SelectContent.RemoveScroll"),Uce=S.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:x,...y}=t,v=Nf(Zm,r),[b,w]=S.useState(null),[j,N]=S.useState(null),C=Nt(e,U=>w(U)),[k,E]=S.useState(null),[M,z]=S.useState(null),P=L2(r),[V,A]=S.useState(!1),$=S.useRef(!1);S.useEffect(()=>{if(b)return ST(b)},[b]),jT();const K=S.useCallback(U=>{const[R,...ee]=P().map(J=>J.ref.current),[te]=ee.slice(-1),Z=document.activeElement;for(const J of U)if(J===Z||(J==null||J.scrollIntoView({block:"nearest"}),J===R&&j&&(j.scrollTop=0),J===te&&j&&(j.scrollTop=j.scrollHeight),J==null||J.focus(),document.activeElement!==Z))return},[P,j]),G=S.useCallback(()=>K([k,b]),[K,k,b]);S.useEffect(()=>{V&&G()},[V,G]);const{onOpenChange:Y,triggerPointerDownPosRef:H}=v;S.useEffect(()=>{if(b){let U={x:0,y:0};const R=te=>{var Z,J;U={x:Math.abs(Math.round(te.pageX)-(((Z=H.current)==null?void 0:Z.x)??0)),y:Math.abs(Math.round(te.pageY)-(((J=H.current)==null?void 0:J.y)??0))}},ee=te=>{U.x<=10&&U.y<=10?te.preventDefault():b.contains(te.target)||Y(!1),document.removeEventListener("pointermove",R),H.current=null};return H.current!==null&&(document.addEventListener("pointermove",R),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",R),document.removeEventListener("pointerup",ee,{capture:!0})}}},[b,Y,H]),S.useEffect(()=>{const U=()=>Y(!1);return window.addEventListener("blur",U),window.addEventListener("resize",U),()=>{window.removeEventListener("blur",U),window.removeEventListener("resize",U)}},[Y]);const[B,L]=sue(U=>{const R=P().filter(Z=>!Z.disabled),ee=R.find(Z=>Z.ref.current===document.activeElement),te=iue(R,U,ee);te&&setTimeout(()=>te.ref.current.focus())}),F=S.useCallback((U,R,ee)=>{const te=!$.current&&!ee;(v.value!==void 0&&v.value===R||te)&&(E(U),te&&($.current=!0))},[v.value]),W=S.useCallback(()=>b==null?void 0:b.focus(),[b]),X=S.useCallback((U,R,ee)=>{const te=!$.current&&!ee;(v.value!==void 0&&v.value===R||te)&&z(U)},[v.value]),oe=n==="popper"?a5:zce,le=oe===a5?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:x}:{};return a.jsx(Bce,{scope:r,content:b,viewport:j,onViewportChange:N,itemRefCallback:F,selectedItem:k,onItemLeave:W,itemTextRefCallback:X,focusSelectedItem:G,selectedItemText:M,position:n,isPositioned:V,searchRef:B,children:a.jsx(zj,{as:Wst,allowPinchZoom:!0,children:a.jsx(Bj,{asChild:!0,trapped:v.open,onMountAutoFocus:U=>{U.preventDefault()},onUnmountAutoFocus:ze(s,U=>{var R;(R=v.trigger)==null||R.focus({preventScroll:!0}),U.preventDefault()}),children:a.jsx(og,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:U=>U.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:a.jsx(oe,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:U=>U.preventDefault(),...y,...le,onPlaced:()=>A(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ze(y.onKeyDown,U=>{const R=U.ctrlKey||U.altKey||U.metaKey;if(U.key==="Tab"&&U.preventDefault(),!R&&U.key.length===1&&L(U.key),["ArrowUp","ArrowDown","Home","End"].includes(U.key)){let te=P().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);if(["ArrowUp","End"].includes(U.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(U.key)){const Z=U.target,J=te.indexOf(Z);te=te.slice(J+1)}setTimeout(()=>K(te)),U.preventDefault()}})})})})})})});Uce.displayName=Hst;var Vst="SelectItemAlignedPosition",zce=S.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...s}=t,i=Nf(Zm,r),o=Af(Zm,r),[l,c]=S.useState(null),[u,d]=S.useState(null),h=Nt(e,C=>d(C)),f=L2(r),p=S.useRef(!1),g=S.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:y,focusSelectedItem:v}=o,b=S.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&m&&x&&y){const C=i.trigger.getBoundingClientRect(),k=u.getBoundingClientRect(),E=i.valueNode.getBoundingClientRect(),M=y.getBoundingClientRect();if(i.dir!=="rtl"){const Z=M.left-k.left,J=E.left-Z,he=C.left-J,O=C.width+he,ie=Math.max(O,k.width),q=window.innerWidth-Mo,I=s4(J,[Mo,Math.max(Mo,q-ie)]);l.style.minWidth=O+"px",l.style.left=I+"px"}else{const Z=k.right-M.right,J=window.innerWidth-E.right-Z,he=window.innerWidth-C.right-J,O=C.width+he,ie=Math.max(O,k.width),q=window.innerWidth-Mo,I=s4(J,[Mo,Math.max(Mo,q-ie)]);l.style.minWidth=O+"px",l.style.right=I+"px"}const z=f(),P=window.innerHeight-Mo*2,V=m.scrollHeight,A=window.getComputedStyle(u),$=parseInt(A.borderTopWidth,10),K=parseInt(A.paddingTop,10),G=parseInt(A.borderBottomWidth,10),Y=parseInt(A.paddingBottom,10),H=$+K+V+Y+G,B=Math.min(x.offsetHeight*5,H),L=window.getComputedStyle(m),F=parseInt(L.paddingTop,10),W=parseInt(L.paddingBottom,10),X=C.top+C.height/2-Mo,oe=P-X,le=x.offsetHeight/2,U=x.offsetTop+le,R=$+K+U,ee=H-R;if(R<=X){const Z=z.length>0&&x===z[z.length-1].ref.current;l.style.bottom="0px";const J=u.clientHeight-m.offsetTop-m.offsetHeight,he=Math.max(oe,le+(Z?W:0)+J+G),O=R+he;l.style.height=O+"px"}else{const Z=z.length>0&&x===z[0].ref.current;l.style.top="0px";const he=Math.max(X,$+m.offsetTop+(Z?F:0)+le)+ee;l.style.height=he+"px",m.scrollTop=R-X+m.offsetTop}l.style.margin=`${Mo}px 0`,l.style.minHeight=B+"px",l.style.maxHeight=P+"px",n==null||n(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,l,u,m,x,y,i.dir,n]);vn(()=>b(),[b]);const[w,j]=S.useState();vn(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const N=S.useCallback(C=>{C&&g.current===!0&&(b(),v==null||v(),g.current=!1)},[b,v]);return a.jsx(Gst,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:N,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:a.jsx(et.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});zce.displayName=Vst;var qst="SelectPopperPosition",a5=S.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Mo,...i}=t,o=F2(r);return a.jsx(uT,{...o,...i,ref:e,align:n,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});a5.displayName=qst;var[Gst,$8]=Ib(Zm,{}),o5="SelectViewport",Hce=S.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:n,...s}=t,i=Af(o5,r),o=$8(o5,r),l=Nt(e,i.onViewportChange),c=S.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),a.jsx(D2.Slot,{scope:r,children:a.jsx(et.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ze(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&h){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Mo*2,m=parseFloat(h.style.minHeight),x=parseFloat(h.style.height),y=Math.max(m,x);if(y<g){const v=y+p,b=Math.min(g,v),w=v-b;h.style.height=b+"px",h.style.bottom==="0px"&&(d.scrollTop=w>0?w:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Hce.displayName=o5;var Wce="SelectGroup",[Kst,Yst]=Ib(Wce),Xst=S.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=Yi();return a.jsx(Kst,{scope:r,id:s,children:a.jsx(et.div,{role:"group","aria-labelledby":s,...n,ref:e})})});Xst.displayName=Wce;var Vce="SelectLabel",qce=S.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=Yst(Vce,r);return a.jsx(et.div,{id:s.id,...n,ref:e})});qce.displayName=Vce;var nk="SelectItem",[Qst,Gce]=Ib(nk),Kce=S.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:i,...o}=t,l=Nf(nk,r),c=Af(nk,r),u=l.value===n,[d,h]=S.useState(i??""),[f,p]=S.useState(!1),g=Nt(e,v=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,v,n,s)}),m=Yi(),x=S.useRef("touch"),y=()=>{s||(l.onValueChange(n),l.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(Qst,{scope:r,value:n,disabled:s,textId:m,isSelected:u,onItemTextChange:S.useCallback(v=>{h(b=>b||((v==null?void 0:v.textContent)??"").trim())},[]),children:a.jsx(D2.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:a.jsx(et.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:ze(o.onFocus,()=>p(!0)),onBlur:ze(o.onBlur,()=>p(!1)),onClick:ze(o.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:ze(o.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:ze(o.onPointerDown,v=>{x.current=v.pointerType}),onPointerMove:ze(o.onPointerMove,v=>{var b;x.current=v.pointerType,s?(b=c.onItemLeave)==null||b.call(c):x.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ze(o.onPointerLeave,v=>{var b;v.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:ze(o.onKeyDown,v=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&v.key===" "||(Dst.includes(v.key)&&y(),v.key===" "&&v.preventDefault())})})})})});Kce.displayName=nk;var T0="SelectItemText",Yce=S.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,...i}=t,o=Nf(T0,r),l=Af(T0,r),c=Gce(T0,r),u=Bst(T0,r),[d,h]=S.useState(null),f=Nt(e,y=>h(y),c.onItemTextChange,y=>{var v;return(v=l.itemTextRefCallback)==null?void 0:v.call(l,y,c.value,c.disabled)}),p=d==null?void 0:d.textContent,g=S.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return vn(()=>(m(g),()=>x(g)),[m,x,g]),a.jsxs(a.Fragment,{children:[a.jsx(et.span,{id:c.textId,...i,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Ac.createPortal(i.children,o.valueNode):null]})});Yce.displayName=T0;var Xce="SelectItemIndicator",Qce=S.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return Gce(Xce,r).isSelected?a.jsx(et.span,{"aria-hidden":!0,...n,ref:e}):null});Qce.displayName=Xce;var l5="SelectScrollUpButton",Zce=S.forwardRef((t,e)=>{const r=Af(l5,t.__scopeSelect),n=$8(l5,t.__scopeSelect),[s,i]=S.useState(!1),o=Nt(e,n.onScrollButtonChange);return vn(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?a.jsx(eue,{...t,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Zce.displayName=l5;var c5="SelectScrollDownButton",Jce=S.forwardRef((t,e)=>{const r=Af(c5,t.__scopeSelect),n=$8(c5,t.__scopeSelect),[s,i]=S.useState(!1),o=Nt(e,n.onScrollButtonChange);return vn(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?a.jsx(eue,{...t,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Jce.displayName=c5;var eue=S.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=t,i=Af("SelectScrollButton",r),o=S.useRef(null),l=L2(r),c=S.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return S.useEffect(()=>()=>c(),[c]),vn(()=>{var d;const u=l().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),a.jsx(et.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:ze(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(n,50))}),onPointerMove:ze(s.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(n,50))}),onPointerLeave:ze(s.onPointerLeave,()=>{c()})})}),Zst="SelectSeparator",tue=S.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return a.jsx(et.div,{"aria-hidden":!0,...n,ref:e})});tue.displayName=Zst;var u5="SelectArrow",Jst=S.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=F2(r),i=Nf(u5,r),o=Af(u5,r);return i.open&&o.position==="popper"?a.jsx(dT,{...s,...n,ref:e}):null});Jst.displayName=u5;var eit="SelectBubbleInput",rue=S.forwardRef(({__scopeSelect:t,value:e,...r},n)=>{const s=S.useRef(null),i=Nt(n,s),o=F8(e);return S.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&d){const h=new Event("change",{bubbles:!0});d.call(l,e),l.dispatchEvent(h)}},[o,e]),a.jsx(et.select,{...r,style:{...vJ,...r.style},ref:i,defaultValue:e})});rue.displayName=eit;function nue(t){return t===""||t===void 0}function sue(t){const e=gn(t),r=S.useRef(""),n=S.useRef(0),s=S.useCallback(o=>{const l=r.current+o;e(l),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),i=S.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return S.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,i]}function iue(t,e,r){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let o=tit(t,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function tit(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var rit=Oce,aue=Rce,nit=Dce,sit=Lce,iit=Fce,oue=$ce,ait=Hce,lue=qce,cue=Kce,oit=Yce,lit=Qce,uue=Zce,due=Jce,hue=tue;const at=rit,ot=nit,nt=S.forwardRef(({className:t,children:e,...r},n)=>a.jsxs(aue,{ref:n,className:Ie("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[e,a.jsx(sit,{asChild:!0,children:a.jsx(vc,{className:"h-4 w-4 opacity-50"})})]}));nt.displayName=aue.displayName;const fue=S.forwardRef(({className:t,...e},r)=>a.jsx(uue,{ref:r,className:Ie("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(WJ,{className:"h-4 w-4"})}));fue.displayName=uue.displayName;const pue=S.forwardRef(({className:t,...e},r)=>a.jsx(due,{ref:r,className:Ie("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(vc,{className:"h-4 w-4"})}));pue.displayName=due.displayName;const st=S.forwardRef(({className:t,children:e,position:r="popper",...n},s)=>a.jsx(iit,{children:a.jsxs(oue,{ref:s,className:Ie("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...n,children:[a.jsx(fue,{}),a.jsx(ait,{className:Ie("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(pue,{})]})}));st.displayName=oue.displayName;const cit=S.forwardRef(({className:t,...e},r)=>a.jsx(lue,{ref:r,className:Ie("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));cit.displayName=lue.displayName;const Te=S.forwardRef(({className:t,children:e,...r},n)=>a.jsxs(cue,{ref:n,className:Ie("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(lit,{children:a.jsx(yn,{className:"h-4 w-4"})})}),a.jsx(oit,{children:e})]}));Te.displayName=cue.displayName;const uit=S.forwardRef(({className:t,...e},r)=>a.jsx(hue,{ref:r,className:Ie("-mx-1 my-1 h-px bg-muted",t),...e}));uit.displayName=hue.displayName;const mue=({currentAvatarUrl:t,onSelectPublic:e,onUploadCustom:r,disabled:n})=>{const[s,i]=S.useState(!1),[o,l]=S.useState(!1),[c,u]=S.useState(null),[d,h]=S.useState([]),[f,p]=S.useState(!0),g=S.useRef(null),{toast:m}=on();S.useEffect(()=>{(async()=>{const w=await Ry(t);u(w)})()},[t]),S.useEffect(()=>{(async()=>{p(!0);try{const{data:w,error:j}=await be.storage.from("avatars-public").list("",{limit:20});if(j){console.error("Error loading public avatars:",j);return}if(w){const N=w.filter(C=>C.name.match(/\.(png|jpg|jpeg|webp|svg)$/i)).map(C=>({name:C.name,url:`https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/avatars-public/${C.name}`}));h(N)}}catch(w){console.error("Error loading public avatars:",w)}finally{p(!1)}})()},[]);const x=async b=>{var N;const w=(N=b.target.files)==null?void 0:N[0];if(!w)return;if(!w.type.startsWith("image/")){m({title:"Error",description:"Please select an image file",variant:"destructive"});return}if(w.size>2*1024*1024){m({title:"Error",description:"File is too large. Maximum 2MB allowed.",variant:"destructive"});return}const j=new FileReader;j.onloadend=()=>{u(j.result)},j.readAsDataURL(w),i(!0);try{await r(w),m({title:"Success",description:"Avatar uploaded successfully"})}catch(C){console.error("Avatar upload error:",C),m({title:"Error",description:"Failed to upload avatar",variant:"destructive"});const k=await Ry(t);u(k)}finally{i(!1)}},y=async b=>{if(!(n||o)){l(!0),u(b.url);try{await e(b.url),m({title:"Success",description:"Avatar selected successfully"})}catch(w){console.error("Avatar selection error:",w),m({title:"Error",description:"Failed to select avatar",variant:"destructive"});const j=await Ry(t);u(j)}finally{l(!1)}}},v=b=>t===b||c===b;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-6",children:[a.jsxs("div",{className:"relative w-40 h-40 rounded-full overflow-hidden bg-muted cursor-pointer group flex-shrink-0",onClick:()=>{var b;return!n&&((b=g.current)==null?void 0:b.click())},children:[c?a.jsx("img",{src:c,alt:"Avatar",className:"w-full h-full object-cover"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center",children:a.jsx(Ij,{className:"w-20 h-20 text-muted-foreground"})}),!n&&a.jsx("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s?a.jsx(St,{className:"w-8 h-8 text-white animate-spin"}):a.jsx(Ku,{className:"w-8 h-8 text-white"})})]}),a.jsx("input",{ref:g,type:"file",accept:"image/jpeg,image/png,image/webp",onChange:x,className:"hidden",disabled:n||s}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"Profile Picture"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose a default avatar or upload your own (max 2MB)"})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Or choose a default avatar"}),f?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(St,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):d.length>0?a.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 gap-5",children:d.map(b=>a.jsxs("button",{onClick:()=>y(b),disabled:n||o||s,className:Ie("relative w-24 h-24 rounded-full overflow-hidden border-2 transition-all","hover:scale-105 hover:border-primary focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100",v(b.url)?"border-primary ring-2 ring-primary ring-offset-2":"border-border hover:border-primary/50"),children:[a.jsx("img",{src:b.url,alt:b.name,className:"w-full h-full object-cover"}),v(b.url)&&a.jsx("div",{className:"absolute inset-0 bg-primary/20 flex items-center justify-center",children:a.jsx(yn,{className:"w-8 h-8 text-primary"})})]},b.name))}):a.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No default avatars available"})]})]})},dit=["Germany","Austria","Switzerland","United States","United Kingdom","France","Spain","Italy","Netherlands","Belgium","Poland","Sweden","Norway","Denmark","Finland","Australia","Canada","Other"],hit=[{value:"bachelor",label:"Bachelor"},{value:"master",label:"Master"},{value:"phd",label:"PhD / Doctorate"},{value:"postdoc",label:"Postdoc"},{value:"other",label:"Other"}],fit=["Business & Economics","Computer Science","Education","Engineering","Health Sciences","Humanities","Law","Natural Sciences","Psychology","Social Sciences","Other"],pit=[{value:"quantitative",label:"Quantitative"},{value:"qualitative",label:"Qualitative"},{value:"mixed",label:"Mixed Methods"}],mit=[{value:"de",label:"Deutsch"},{value:"en",label:"English"},{value:"fr",label:"Français"},{value:"es",label:"Español"},{value:"it",label:"Italiano"}];function LN({label:t,tooltip:e,required:r}){return a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs(_e,{className:"text-foreground font-medium",children:[t,r&&a.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),a.jsx(Ai,{children:a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Wm,{className:"w-3.5 h-3.5 text-muted-foreground cursor-help"})}),a.jsx(Vt,{side:"top",className:"max-w-[250px] text-xs",children:e})]})})]})}function git({open:t,onComplete:e}){const{user:r,updateResearchProfile:n,uploadAvatar:s,selectPublicAvatar:i,researchProfile:o}=Pt(),[l,c]=S.useState(!1),[u,d]=S.useState((o==null?void 0:o.nickname)||""),[h,f]=S.useState((o==null?void 0:o.study_country)||""),[p,g]=S.useState((o==null?void 0:o.degree_type)||null),[m,x]=S.useState((o==null?void 0:o.discipline)||""),[y,v]=S.useState((o==null?void 0:o.university)||""),[b,w]=S.useState((o==null?void 0:o.methodology)||null),[j,N]=S.useState((o==null?void 0:o.preferred_language)||"de"),C=async z=>{await i(z)},k=async z=>await s(z),E=async()=>{if(!u.trim()){$e.error("Please enter a nickname");return}c(!0);try{await n({nickname:u.trim(),study_country:h||null,degree_type:p,discipline:m||null,university:y||null,methodology:b,preferred_language:j}),$e.success("Profile saved! Welcome to Academly."),e()}catch(z){console.error("Error saving profile:",z),$e.error("Failed to save profile. Please try again.")}finally{c(!1)}},M=async()=>{c(!0);try{await n({preferred_language:"de"}),e()}catch(z){console.error("Error creating minimal profile:",z),e()}finally{c(!1)}};return a.jsx(qr,{open:t,onOpenChange:()=>{},children:a.jsxs(Dr,{className:"sm:max-w-[500px] max-h-[90vh] overflow-y-auto",onPointerDownOutside:z=>z.preventDefault(),onEscapeKeyDown:z=>z.preventDefault(),children:[a.jsxs(Lr,{className:"text-center pb-2",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:a.jsx(Ji,{className:"w-6 h-6 text-primary"})}),a.jsx(Fr,{className:"text-xl",children:"Welcome to Academly!"}),a.jsx(gb,{children:"Tell us a bit about yourself to personalize your experience."})]}),a.jsxs("div",{className:"space-y-5 py-4",children:[a.jsx(mue,{currentAvatarUrl:(o==null?void 0:o.avatar_url)||null,onSelectPublic:C,onUploadCustom:k}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{className:"text-foreground font-medium",children:["Nickname ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Fe,{value:u,onChange:z=>d(z.target.value),placeholder:"How should we call you?",className:"h-10"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(LN,{label:"Study Country",tooltip:"Helps us tailor language support and citation styles for your region in future updates."}),a.jsxs(at,{value:h,onValueChange:f,children:[a.jsx(nt,{className:"h-10",children:a.jsx(ot,{placeholder:"Select your country"})}),a.jsx(st,{children:dit.map(z=>a.jsx(Te,{value:z,children:z},z))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(LN,{label:"Degree Type",tooltip:"Helps us customize academic requirements and formatting options."}),a.jsxs(at,{value:p||"",onValueChange:z=>g(z),children:[a.jsx(nt,{className:"h-10",children:a.jsx(ot,{placeholder:"Select your degree"})}),a.jsx(st,{children:hit.map(z=>a.jsx(Te,{value:z.value||"",children:z.label},z.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(LN,{label:"Discipline",tooltip:"Enables discipline-specific citation styles and terminology suggestions."}),a.jsxs(at,{value:m,onValueChange:x,children:[a.jsx(nt,{className:"h-10",children:a.jsx(ot,{placeholder:"Select your field"})}),a.jsx(st,{children:fit.map(z=>a.jsx(Te,{value:z,children:z},z))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{className:"text-foreground font-medium",children:"University"}),a.jsx(Fe,{value:y,onChange:z=>v(z.target.value),placeholder:"Your university name",className:"h-10"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{className:"text-foreground font-medium",children:"Research Methodology"}),a.jsxs(at,{value:b||"",onValueChange:z=>w(z),children:[a.jsx(nt,{className:"h-10",children:a.jsx(ot,{placeholder:"Select methodology"})}),a.jsx(st,{children:pit.map(z=>a.jsx(Te,{value:z.value||"",children:z.label},z.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(LN,{label:"Preferred Language",tooltip:"We'll prioritize adding features and translations in your preferred language."}),a.jsxs(at,{value:j,onValueChange:z=>N(z),children:[a.jsx(nt,{className:"h-10",children:a.jsx(ot,{placeholder:"Select language"})}),a.jsx(st,{children:mit.map(z=>a.jsx(Te,{value:z.value,children:z.label},z.value))})]})]})]}),a.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[a.jsx(ye,{onClick:E,disabled:l||!u.trim(),className:"w-full h-11 rounded-full",children:l?"Saving...":"Save & Continue"}),a.jsx("button",{type:"button",onClick:M,disabled:l,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Skip for now"})]})]})})}const yit=()=>{const{user:t,loading:e,researchProfile:r}=Pt(),n=gr(),[s,i]=S.useState(!1);S.useEffect(()=>{!t&&!e&&n("/login")},[t,e,n]),S.useEffect(()=>{if(t&&!e){const l=!r||!r.nickname;i(l)}else i(!1)},[t,e,r]);const o=()=>{i(!1)};return e?a.jsx(er,{showSidebar:!0,children:a.jsx(kce,{})}):t?a.jsxs(er,{showSidebar:!0,children:[a.jsx(Ost,{}),a.jsx(git,{open:s,onComplete:o})]}):null},Jn=()=>{const{user:t}=Pt(),[e,r]=S.useState(!1),n="https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/logo_new.png",s=[{label:"Topic Generator",subtitle:"Free thesis topic ideas",href:"/topic-ideas",icon:hf},{label:"Literature Keywords",subtitle:"Discover relevant sources",href:"/literature-search",icon:ll}],i=[{label:"ChatGPT",href:"/vs/chatgpt",icon:UJ},{label:"Jenni AI",href:"/vs/jenni-ai",icon:Ji},{label:"Perplexity",href:"/vs/perplexity",icon:Gve},{label:"Claude",href:"/vs/claude",icon:zJ}];return a.jsxs("header",{className:"absolute inset-x-0 top-0 z-50",children:[a.jsxs("nav",{className:"mx-auto flex max-w-7xl items-center justify-between px-6 py-5 lg:px-12",children:[a.jsx(tt,{to:"/",className:"flex items-center gap-2",children:a.jsx("img",{src:n,alt:"Academly.ai",className:"h-9 w-auto"})}),a.jsxs("div",{className:"hidden lg:flex lg:items-center lg:gap-8",children:[a.jsx(tt,{to:"/#features",className:"text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:"Features"}),a.jsx(tt,{to:"/topic-ideas",className:"text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:"Topic Generator"}),a.jsx(tt,{to:"/pricing",className:"text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:"Pricing"}),a.jsx(tt,{to:"/blog",className:"text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:"Blog"}),a.jsxs("div",{className:"relative group",children:[a.jsxs("button",{type:"button",className:"flex items-center gap-1 text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:["Demo",a.jsx(vc,{className:"h-3.5 w-3.5 transition-transform group-hover:rotate-180"})]}),a.jsx("div",{className:"invisible absolute left-1/2 top-full z-50 w-72 -translate-x-1/2 pt-3 opacity-0 transition-all duration-150 group-hover:visible group-hover:opacity-100",children:a.jsx("div",{className:"rounded-xl border border-border bg-background p-2 shadow-lg",children:s.map(o=>{const l=o.icon;return a.jsxs(tt,{to:o.href,className:"flex items-start gap-3 rounded-lg p-3 transition-colors hover:bg-muted",children:[a.jsx("div",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:a.jsx(l,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold text-foreground",children:o.label}),a.jsx("div",{className:"text-xs text-muted-foreground",children:o.subtitle})]})]},o.href)})})})]}),a.jsxs("div",{className:"relative group",children:[a.jsxs("button",{type:"button",className:"flex items-center gap-1 text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:["Compare",a.jsx(vc,{className:"h-3.5 w-3.5 transition-transform group-hover:rotate-180"})]}),a.jsx("div",{className:"invisible absolute left-1/2 top-full z-50 w-64 -translate-x-1/2 pt-3 opacity-0 transition-all duration-150 group-hover:visible group-hover:opacity-100",children:a.jsx("div",{className:"rounded-xl border border-border bg-background p-2 shadow-lg",children:i.map(o=>{const l=o.icon;return a.jsxs(tt,{to:o.href,className:"flex items-center gap-3 rounded-lg p-3 transition-colors hover:bg-muted",children:[a.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:a.jsx(l,{className:"h-4 w-4"})}),a.jsxs("div",{className:"text-sm font-semibold text-foreground",children:["Academly vs ",o.label]})]},o.href)})})})]})]}),a.jsx("div",{className:"hidden lg:flex lg:items-center lg:gap-4",children:t?a.jsx(ye,{asChild:!0,className:"rounded-full px-6",children:a.jsx(tt,{to:"/dashboard",children:"Dashboard"})}):a.jsxs(a.Fragment,{children:[a.jsx(tt,{to:"/login",className:"text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:"Login"}),a.jsx(ye,{asChild:!0,className:"rounded-full px-6","data-umami-event":"cta-signup-click","data-umami-event-location":"header-desktop",children:a.jsx(tt,{to:"/login?mode=signup",children:"Start Writing Free"})})]})}),a.jsx("div",{className:"flex items-center gap-3 lg:hidden",children:a.jsx("button",{onClick:()=>r(!e),className:"flex h-10 w-10 items-center justify-center rounded-lg text-foreground/80 hover:bg-muted",children:e?a.jsx(En,{className:"h-5 w-5"}):a.jsx(BF,{className:"h-5 w-5"})})})]}),e&&a.jsx("div",{className:"lg:hidden",children:a.jsxs("div",{className:"border-t border-border bg-background/95 backdrop-blur-lg px-6 py-4 space-y-4",children:[a.jsx(tt,{to:"/#features",className:"block text-sm font-medium text-foreground/80",onClick:()=>r(!1),children:"Features"}),a.jsx(tt,{to:"/topic-ideas",className:"block text-sm font-medium text-foreground/80",onClick:()=>r(!1),children:"Topic Generator"}),a.jsx(tt,{to:"/pricing",className:"block text-sm font-medium text-foreground/80",onClick:()=>r(!1),children:"Pricing"}),a.jsx(tt,{to:"/blog",className:"block text-sm font-medium text-foreground/80",onClick:()=>r(!1),children:"Blog"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Demo"}),s.map(o=>a.jsx(tt,{to:o.href,className:"block text-sm text-foreground/80 pl-2",onClick:()=>r(!1),children:o.label},o.href))]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Compare"}),i.map(o=>a.jsxs(tt,{to:o.href,className:"block text-sm text-foreground/80 pl-2",onClick:()=>r(!1),children:["Academly vs ",o.label]},o.href))]}),a.jsx("div",{className:"pt-4 border-t border-border",children:t?a.jsx(ye,{asChild:!0,className:"w-full rounded-full",children:a.jsx(tt,{to:"/dashboard",children:"Dashboard"})}):a.jsxs("div",{className:"space-y-3",children:[a.jsx(tt,{to:"/login",className:"block text-sm font-medium text-foreground/80",onClick:()=>r(!1),children:"Login"}),a.jsx(ye,{asChild:!0,className:"w-full rounded-full","data-umami-event":"cta-signup-click","data-umami-event-location":"header-mobile",children:a.jsx(tt,{to:"/login?mode=signup",children:"Start Writing Free"})})]})})]})})]})},xit="/assets/logo-icon-FLGou0Tt.png",vit=["Citations only from uploaded PDFs","Verified page references","No hallucinated references","GDPR compliant","EU hosted"],bit=()=>a.jsxs("div",{className:"relative",id:"home",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 grid grid-cols-2 -space-x-52 opacity-40 dark:opacity-20",children:[a.jsx("div",{className:"blur-[106px] h-56 bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-32 bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(jr,{children:a.jsx("div",{className:"relative pt-36 ml-auto",children:a.jsxs("div",{className:"max-w-3xl text-center mx-auto",children:[a.jsxs("h1",{className:"text-foreground text-balance font-bold text-5xl md:text-6xl xl:text-7xl",children:["Write your thesis with ",a.jsx("span",{className:"text-primary",children:"real citations"})," from your own sources."]}),a.jsx("div",{className:"flex justify-center my-10",children:a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 blur-3xl bg-primary/30 rounded-full scale-150"}),a.jsx("img",{src:xit,alt:"Academly.ai Logo",className:"relative w-36 h-36 md:w-48 md:h-48 object-contain drop-shadow-2xl animate-fade-in"})]})}),a.jsx("p",{className:"mt-8 text-muted-foreground text-lg",children:"Upload academic PDFs, generate structured thesis chapters, and keep every citation connected to real research with verified page references."}),a.jsxs("div",{className:"mt-12 flex flex-wrap justify-center gap-y-4 gap-x-6",children:[a.jsx(tt,{to:"/login?mode=signup",className:"relative flex h-12 w-full items-center justify-center px-8 before:absolute before:inset-0 before:rounded-full before:bg-primary before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 sm:w-max","data-umami-event":"cta-signup-click","data-umami-event-location":"hero",children:a.jsx("span",{className:"relative text-base font-semibold text-primary-foreground",children:"Start Writing Free"})}),a.jsx("a",{href:"#how-it-works",className:"relative flex h-12 w-full items-center justify-center px-8 before:absolute before:inset-0 before:rounded-full before:border before:border-transparent before:bg-primary/10 before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 dark:before:border-gray-700 dark:before:bg-gray-800 sm:w-max",children:a.jsx("span",{className:"relative text-base font-semibold text-primary dark:text-white",children:"See How It Works"})})]}),a.jsx("ul",{className:"mt-10 flex flex-wrap items-center justify-center gap-x-5 gap-y-2 text-sm text-muted-foreground",children:vit.map(t=>a.jsxs("li",{className:"flex items-center gap-1.5",children:[a.jsx(yn,{className:"h-4 w-4 text-primary shrink-0"}),a.jsx("span",{children:t})]},t))})]})})})]}),PG="Burnout in Remote Work Environments",hI="Burnout in remote work environments has emerged as a critical concern in contemporary organizational research (Maslach & Jackson, 1981, p. 99). The Maslach Burnout Inventory (MBI) identifies three core dimensions: emotional exhaustion, depersonalization, and reduced personal accomplishment. Remote work conditions have been shown to significantly amplify emotional exhaustion due to the blurring of work-life boundaries (Meyer et al., 2022, p. 45). Furthermore, the absence of social interaction in remote settings contributes to increased depersonalization among employees (Meyer et al., 2022, p. 47).",wit=80,_it=18,jit=1500,OG=500,Sit=1e3,IG=500,Nit=4e3,Ait=600,Eit=[{text:"The Maslach Burnout Inventory (MBI) has become the leading measure of burnout, encompassing emotional exhaustion, depersonalization, and personal accomplishment.",cite:"(Maslach & Jackson, 1981, p. 99)"},{text:"Remote work environments create unique stressors that significantly contribute to emotional exhaustion, particularly through the erosion of work-life boundaries.",cite:"(Meyer et al., 2022, p. 45)"}],Cit=()=>{const[t,e]=S.useState(""),[r,n]=S.useState(""),[s,i]=S.useState(!1),[o,l]=S.useState(0),[c,u]=S.useState(!1),d=S.useRef([]);S.useEffect(()=>{let f=!1;const p=(m,x)=>{const y=setTimeout(()=>{f||m()},x);d.current.push(y)},g=()=>{f||(u(!1),e(""),n(""),i(!1),l(0),p(()=>{let m=0;const x=()=>{f||(m+=1,e(PG.slice(0,m)),m<PG.length?p(x,wit):(i(!0),p(()=>i(!1),OG),p(()=>{let y=0;const v=()=>{f||(y+=1,n(hI.slice(0,y)),y<hI.length?p(v,_it):p(()=>{l(1),p(()=>l(2),IG),p(()=>{u(!0),p(g,Ait)},IG+Nit)},Sit))};v()},OG)))};x()},jit))};return g(),()=>{f=!0,d.current.forEach(clearTimeout),d.current=[]}},[]);const h=[{name:"leseprobe_burnout_2021.pdf",pages:24,selected:!1},{name:"maslach_burnout_inventory.pdf",pages:18,selected:!0},{name:"meyer_remote_work_2022.pdf",pages:12,selected:!0}];return a.jsx("section",{className:"py-8",children:a.jsx(jr,{children:a.jsxs("div",{className:"max-w-5xl mx-auto rounded-2xl border border-border bg-card shadow-lg overflow-hidden",children:[a.jsxs("div",{className:`grid grid-cols-1 md:grid-cols-5 transition-opacity duration-500 ${c?"opacity-0":"opacity-100"}`,children:[a.jsxs("div",{className:"md:col-span-2 bg-muted/30 p-6 md:border-r border-border space-y-5",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Paragraph Configuration"}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-medium text-foreground mb-2",children:["Select Documents ",a.jsx("span",{className:"text-primary",children:"*"})]}),a.jsx("div",{className:"space-y-1.5",children:h.map(f=>a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[a.jsx("span",{className:`flex-shrink-0 h-4 w-4 rounded-full border-2 ${f.selected?"bg-primary border-primary":"border-muted-foreground/40"}`}),a.jsx(Nr,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),a.jsx("span",{className:"text-xs text-foreground truncate flex-1",children:f.name}),a.jsxs("span",{className:"text-[11px] text-muted-foreground flex-shrink-0",children:["(",f.pages," pages)"]})]},f.name))}),a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1.5",children:"2 of 3 selected"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-foreground mb-2",children:"Page Selection"}),a.jsx("div",{className:"space-y-1.5",children:[{name:"maslach_burnout_inventory...",from:95,to:105,total:18,count:"10p"},{name:"meyer_remote_work_2022...",from:40,to:48,total:12,count:"8p"}].map(f=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-foreground",children:[a.jsx("span",{className:"flex-1 truncate",children:f.name}),a.jsx("span",{className:"text-muted-foreground",children:"p."}),a.jsx("span",{className:"rounded border border-border bg-background px-2 py-0.5 w-10 text-center",children:f.from}),a.jsx("span",{className:"text-muted-foreground",children:"-"}),a.jsx("span",{className:"rounded border border-border bg-background px-2 py-0.5 w-10 text-center",children:f.to}),a.jsxs("span",{className:"text-muted-foreground",children:["/ ",f.total]}),a.jsx("span",{className:"text-primary font-medium ml-1",children:f.count})]},f.name))})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-medium text-foreground mb-2",children:["Topic / Research Question ",a.jsx("span",{className:"text-primary",children:"*"})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-background px-3 py-2 min-h-[48px] text-sm text-foreground",children:[t,a.jsx("span",{className:"inline-block w-[2px] h-4 bg-primary align-middle ml-0.5 animate-pulse"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-medium text-foreground mb-1",children:"Mode"}),a.jsxs("div",{className:"rounded-lg border border-border bg-background px-3 py-2 text-xs text-foreground flex items-center justify-between",children:["Short (300 Tokens)",a.jsx("span",{className:"text-muted-foreground",children:"▾"})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-medium text-foreground mb-1",children:"Citation Style"}),a.jsxs("div",{className:"rounded-lg border border-border bg-background px-3 py-2 text-xs text-foreground flex items-center justify-between",children:["APA7",a.jsx("span",{className:"text-muted-foreground",children:"▾"})]})]})]}),a.jsx("div",{className:`w-full rounded-lg bg-primary text-primary-foreground text-sm font-medium py-2.5 text-center transition-transform ${s?"scale-105 shadow-lg shadow-primary/30":"scale-100"}`,children:"Generate Paragraph"})]}),a.jsxs("div",{className:"md:col-span-3 bg-card p-6 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Result"}),a.jsx("span",{className:"text-xs rounded-full bg-muted border border-border px-3 py-1 text-muted-foreground",children:"Live Preview"})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-bold text-foreground text-lg",children:"Theory & Background"}),a.jsxs("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[a.jsx("span",{className:"text-[11px] rounded-md bg-primary/10 text-primary px-2 py-0.5",children:"maslach_burnout_inventory.pdf"}),a.jsx("span",{className:"text-[11px] rounded-md bg-primary/10 text-primary px-2 py-0.5",children:"meyer_remote_work_2022.pdf"})]}),a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1.5",children:"Short | APA7 | 9/5/2026"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:"Generated Text"}),a.jsx("div",{className:"rounded-xl border border-border bg-background p-4 min-h-[180px]",children:a.jsxs("p",{className:"text-sm leading-relaxed text-foreground",children:[r,r.length>0&&r.length<hI.length&&a.jsx("span",{className:"inline-block w-[2px] h-4 bg-primary align-middle ml-0.5 animate-pulse"})]})})]}),o>0&&a.jsxs("div",{className:"animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Original Quotes"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Original Language"}),a.jsx("div",{className:"w-8 h-4 rounded-full bg-primary/30 relative",children:a.jsx("div",{className:"absolute right-0.5 top-0.5 w-3 h-3 rounded-full bg-primary"})})]})]}),a.jsx("div",{className:"space-y-2",children:Eit.slice(0,o).map((f,p)=>a.jsxs("div",{className:"border-l-4 border-primary bg-muted/40 rounded-r-lg p-3 animate-fade-in",children:[a.jsxs("p",{className:"text-xs italic text-foreground leading-relaxed",children:['"',f.text,'"']}),a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1.5",children:f.cite})]},p))})]})]})]}),a.jsxs("div",{className:"border-t border-border px-6 py-5 text-center bg-muted/30",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"This is what Academly generates from your PDFs"}),a.jsx(ye,{asChild:!0,className:"rounded-full px-6",children:a.jsxs(tt,{to:"/login",children:["Try it with your own sources",a.jsx(Oa,{className:"h-4 w-4 ml-2"})]})})]})]})})})},RG="AI in Education",kit=80,Tit=1e3,Pit=500,Oit=400,Iit=5e3,Rit=600,Mit=[{title:"Burnout in Remote Work Environments",questions:["How does remote work contribute to emotional exhaustion among employees?","What role does work-life balance play in preventing burnout?"],method:"Mixed-methods approach combining quantitative surveys with qualitative interviews to assess burnout levels in remote settings.",relevance:"Understanding burnout in remote settings is critical for organizational health and employee wellbeing in the post-pandemic era.",sources:[{text:"Maslach, C. & Jackson, S.E. (1981). The measurement of experienced burnout.",doi:"10.1002/job.4030020205"},{text:"Meyer, B. et al. (2022). Remote work and stress.",doi:"10.1007/s11528-022-00731-4"}]},{title:"AI-Driven Personalized Learning in Higher Education",questions:["How can AI algorithms adapt learning paths to individual student needs?","What impact does personalized learning have on academic performance?"],method:"Comparative analysis of traditional teaching versus AI-driven personalization using case studies from three universities.",relevance:"AI personalization has the potential to revolutionize higher education by addressing diverse learning styles and improving outcomes.",sources:[{text:"Holmes, W. et al. (2019). Artificial Intelligence in Education.",doi:"10.1007/s11528-019-00422-5"},{text:"Baker, R.S. (2016). Big data and education.",doi:"10.1007/s11528-016-0104-0"}]}],Dit=()=>{const[t,e]=S.useState(""),[r,n]=S.useState(!1),[s,i]=S.useState(0),[o,l]=S.useState(!1);return S.useEffect(()=>{let c=[],u=[],d=!1;const h=()=>{d||(e(""),n(!1),i(0),l(!1),c.push(setTimeout(()=>{let f=0;const p=setInterval(()=>{f++,e(RG.slice(0,f)),f>=RG.length&&(clearInterval(p),c.push(setTimeout(()=>{n(!0),c.push(setTimeout(()=>n(!1),Pit)),c.push(setTimeout(()=>{i(1),c.push(setTimeout(()=>i(2),Oit)),c.push(setTimeout(()=>{l(!0),c.push(setTimeout(h,Rit))},Iit))},500))},200)))},kit);u.push(p)},Tit)))};return h(),()=>{d=!0,c.forEach(clearTimeout),u.forEach(clearInterval)}},[]),a.jsx("section",{className:"py-8",children:a.jsx("div",{className:"max-w-5xl mx-auto px-6",children:a.jsxs("div",{className:`transition-opacity duration-500 ${o?"opacity-0":"opacity-100"}`,children:[a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6 mb-8",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-5",children:[a.jsx("div",{className:"rounded-lg bg-primary/10 p-2 text-primary",children:a.jsx(hf,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-foreground",children:"Generate Topic Suggestions"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter your basic idea and receive structured suggestions"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-10 gap-4 mb-4",children:[a.jsxs("div",{className:"md:col-span-7",children:[a.jsx("p",{className:"text-xs font-medium text-foreground mb-1.5",children:"Working Title / Topic Idea"}),a.jsxs("div",{className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground min-h-[40px] flex items-center",children:[t,a.jsx("span",{className:"inline-block w-[2px] h-4 bg-primary ml-0.5 animate-pulse"})]})]}),a.jsxs("div",{className:"md:col-span-3",children:[a.jsx("p",{className:"text-xs font-medium text-foreground mb-1.5",children:"Output Language"}),a.jsxs("div",{className:"rounded-lg border border-border bg-background p-1 flex text-xs",children:[a.jsx("div",{className:"flex-1 text-center py-1.5 rounded text-muted-foreground",children:"DE"}),a.jsx("div",{className:"flex-1 text-center py-1.5 rounded bg-primary text-primary-foreground font-medium",children:"EN"})]})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"text-xs font-medium text-foreground mb-1.5",children:"Description / Context"}),a.jsx("div",{className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-muted-foreground min-h-[72px]",children:"Describe program, scope, methodology, context..."})]}),a.jsx("div",{className:`w-full rounded-lg bg-primary text-primary-foreground text-sm font-medium py-2.5 text-center transition-transform ${r?"scale-[1.02] shadow-lg shadow-primary/30":"scale-100"}`,children:"Generate Suggestions"})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:Mit.map((c,u)=>a.jsxs("div",{className:`rounded-xl border border-border bg-card shadow-sm p-5 transition-opacity duration-500 ${s>u?"opacity-100":"opacity-0"}`,children:[a.jsx("h4",{className:"font-bold text-lg text-foreground mb-4",children:c.title}),a.jsxs("div",{className:"mb-3",children:[a.jsx("p",{className:"font-semibold text-sm text-primary mb-1",children:"Research Questions"}),a.jsx("ul",{className:"text-sm text-foreground space-y-1 list-disc list-inside",children:c.questions.map(d=>a.jsx("li",{children:d},d))})]}),a.jsxs("div",{className:"mb-3",children:[a.jsx("p",{className:"font-semibold text-sm text-primary mb-1",children:"Method"}),a.jsx("p",{className:"text-sm text-foreground",children:c.method})]}),a.jsxs("div",{className:"mb-3",children:[a.jsx("p",{className:"font-semibold text-sm text-primary mb-1",children:"Relevance"}),a.jsx("p",{className:"text-sm text-foreground",children:c.relevance})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"font-semibold text-sm text-primary mb-1",children:"Initial Sources"}),a.jsx("ul",{className:"space-y-1",children:c.sources.map(d=>a.jsxs("li",{className:"text-xs text-muted-foreground",children:[d.text,a.jsx("br",{}),a.jsxs("span",{className:"text-[11px]",children:["DOI: ",d.doi]})]},d.doi))})]}),a.jsx(ye,{variant:"outline",className:"w-full opacity-50 cursor-not-allowed",disabled:!0,children:"Select"})]},c.title))})]})})})},Lit=[{icon:Ove,title:"Real Sources Only",text:"Academly only works with your uploaded academic PDFs."},{icon:qJ,title:"Verified Page References",text:"Every citation can be traced back to specific pages."},{icon:pbe,title:"No Hallucinated References",text:"No invented books, papers or authors."},{icon:$F,title:"GDPR & EU Hosted",text:"Built for privacy-conscious students and universities."}],Fit=()=>a.jsx("section",{className:"py-16 lg:py-24",children:a.jsxs(jr,{children:[a.jsxs("div",{className:"max-w-2xl mx-auto text-center mb-12",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-primary mb-3",children:"Academic trust"}),a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Built for academic trust."}),a.jsx("p",{className:"text-muted-foreground text-lg",children:"Unlike generic AI tools, Academly is designed around verifiable academic work."})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-5",children:Lit.map(t=>{const e=t.icon;return a.jsxs("div",{className:"rounded-2xl border border-border bg-card p-6 transition hover:shadow-xl hover:shadow-primary/5",children:[a.jsx("div",{className:"w-11 h-11 rounded-xl bg-primary/10 text-primary flex items-center justify-center mb-4",children:a.jsx(e,{className:"w-5 h-5"})}),a.jsx("h3",{className:"font-semibold text-foreground mb-2",children:t.title}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t.text})]},t.title)})})]})}),MG=[{icon:Ku,title:"Upload Interviews"},{icon:KJ,title:"Create Categories"},{icon:Hm,title:"Analyze Findings"},{icon:Nr,title:"Generate Discussion"}],$it=()=>a.jsx("section",{className:"py-16 lg:py-24 bg-muted/30",children:a.jsxs(jr,{children:[a.jsxs("div",{className:"max-w-2xl mx-auto text-center mb-12",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-primary mb-3",children:"Qualitative Analysis"}),a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4",children:"The only thesis platform with integrated Mayring analysis."}),a.jsx("p",{className:"text-muted-foreground text-lg",children:"From interview coding to discussion chapter — all in one workflow."})]}),a.jsx("div",{className:"flex flex-col md:flex-row items-stretch md:items-center justify-center gap-4 md:gap-3 max-w-5xl mx-auto mb-10",children:MG.map((t,e)=>{const r=t.icon;return a.jsxs("div",{className:"flex items-center gap-4 md:gap-3 md:flex-col md:flex-1",children:[a.jsxs("div",{className:"flex-1 md:flex-none w-full rounded-2xl border border-border bg-card p-5 text-center shadow-sm",children:[a.jsx("div",{className:"w-11 h-11 rounded-xl bg-primary/10 text-primary mx-auto flex items-center justify-center mb-3",children:a.jsx(r,{className:"w-5 h-5"})}),a.jsx("p",{className:"text-sm font-semibold text-foreground",children:t.title}),a.jsxs("p",{className:"text-[11px] uppercase tracking-widest text-muted-foreground mt-1",children:["Step ",e+1]})]}),e<MG.length-1&&a.jsx(Oa,{className:"hidden md:block w-5 h-5 text-muted-foreground shrink-0 md:-mx-1"})]},t.title)})}),a.jsx("div",{className:"text-center",children:a.jsx(ye,{asChild:!0,className:"rounded-full px-8",children:a.jsx(tt,{to:"/login?mode=signup",children:"Explore Qualitative Analysis"})})})]})}),Bit=[{icon:LE,title:"Turn research into thesis chapters",description:"Generate structured theory, methods, discussion and conclusion chapters directly from your sources."},{icon:Hm,title:"Complete Mayring workflow in one place",description:"Code interviews, create categories and generate findings without switching tools."},{icon:Vm,title:"Get feedback before your supervisor sees it",description:"Identify weak arguments, missing sections and unclear writing before submission."},{icon:ab,title:"Never lose track of a source again",description:"Every citation stays connected to real PDFs and verified page references."}],Uit=()=>a.jsx("div",{id:"features",className:"py-16 lg:py-24",children:a.jsxs(jr,{children:[a.jsxs("div",{className:"md:w-2/3 lg:w-1/2",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-primary mb-3",children:"Why Academly"}),a.jsx("h2",{className:"my-4 text-2xl font-bold text-foreground md:text-4xl",children:"Built for thesis writing — not generic chatting."}),a.jsx("p",{className:"text-muted-foreground",children:"Outcomes you can't get from ChatGPT, Claude or Gemini: source-backed chapters, verifiable citations and a complete academic workflow."})]}),a.jsx("div",{className:"mt-12 grid divide-x divide-y divide-border overflow-hidden rounded-3xl border border-border text-muted-foreground sm:grid-cols-2 lg:grid-cols-4 lg:divide-y-0",children:Bit.map((t,e)=>a.jsx("div",{className:"group relative bg-card transition hover:z-[1] hover:shadow-2xl hover:shadow-gray-600/10",children:a.jsxs("div",{className:"relative space-y-6 py-10 p-7",children:[a.jsx(t.icon,{className:"w-10 h-10 text-primary"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h3",{className:"text-lg font-semibold text-foreground transition group-hover:text-primary",children:t.title}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t.description})]})]})},e))}),a.jsxs("div",{className:"mt-24 max-w-3xl mx-auto",children:[a.jsx("p",{className:"text-center text-xs font-semibold uppercase tracking-widest text-primary mb-3",children:"ChatGPT vs Academly"}),a.jsx("h3",{className:"text-center text-2xl md:text-3xl font-bold text-foreground mb-3",children:"Why students switch from ChatGPT to Academly"}),a.jsxs("p",{className:"text-center text-muted-foreground mb-10",children:["ChatGPT helps you write. Academly helps you write ",a.jsx("em",{children:"academically"}),"."]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"rounded-2xl bg-primary p-7 text-primary-foreground",children:[a.jsx("p",{className:"font-bold text-lg mb-6",children:"Academly"}),a.jsx("ul",{className:"space-y-3",children:["Source-backed citations from your PDFs","Verified page numbers","Thesis-specific structure","AI Thesis Supervisor for feedback","Full Mayring qualitative workflow"].map(t=>a.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[a.jsx(yn,{className:"w-4 h-4 mt-0.5 shrink-0 opacity-90"}),a.jsx("span",{children:t})]},t))})]}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card p-7",children:[a.jsx("p",{className:"font-bold text-lg text-muted-foreground mb-6",children:"ChatGPT"}),a.jsx("ul",{className:"space-y-3",children:["Can invent citations","No source traceability","No thesis workflow","No qualitative analysis workflow","Generic chat without academic structure"].map(t=>a.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[a.jsx(En,{className:"w-4 h-4 mt-0.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"text-muted-foreground",children:t})]},t))})]})]}),a.jsx("div",{className:"text-center mt-8",children:a.jsx(ye,{asChild:!0,variant:"outline",className:"rounded-full px-8",children:a.jsx(tt,{to:"/vs/chatgpt",children:"Compare Academly vs ChatGPT"})})})]})]})}),zit=[{icon:Ku,title:"Upload academic sources",text:"Add the PDFs, papers and interviews you want your thesis to be built on."},{icon:obe,title:"Select relevant pages",text:"Pick the exact pages and passages Academly should write from."},{icon:Ji,title:"Generate source-based drafts",text:"Produce theory, methods, discussion and conclusion text grounded in those sources."},{icon:Pve,title:"Verify citations",text:"Every quote and reference links back to the original PDF and page number."},{icon:Js,title:"Build your thesis",text:"Assemble verified chapters into a structured Bachelor or Master thesis."}],Hit=()=>a.jsx("section",{id:"how-it-works",className:"py-16 lg:py-24",children:a.jsxs(jr,{children:[a.jsxs("div",{className:"max-w-2xl mx-auto text-center mb-12",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-primary mb-3",children:"Workflow"}),a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground",children:"How Academly works"})]}),a.jsx("ol",{className:"grid gap-4 md:grid-cols-5 max-w-6xl mx-auto",children:zit.map((t,e)=>{const r=t.icon;return a.jsxs("li",{className:"relative rounded-2xl border border-border bg-card p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 text-primary flex items-center justify-center",children:a.jsx(r,{className:"w-4 h-4"})}),a.jsxs("span",{className:"text-[11px] font-bold uppercase tracking-widest text-primary/60",children:["Step ",e+1]})]}),a.jsx("h3",{className:"font-semibold text-foreground mb-1.5 text-sm",children:t.title}),a.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:t.text})]},t.title)})})]})}),Wit=od("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-success-50 text-success-600 dark:bg-success-500/20 dark:text-success-400",warning:"border-transparent bg-warning-50 text-warning-600 dark:bg-warning-500/20 dark:text-warning-400",error:"border-transparent bg-error-50 text-error-600 dark:bg-error-500/20 dark:text-error-400"}},defaultVariants:{variant:"default"}});function gt({className:t,variant:e,...r}){return a.jsx("div",{className:Ie(Wit({variant:e}),t),...r})}const DG=[{quarter:"Q3 2025",title:"Core Platform",description:"Dashboard, Document Library, PDF Upload, Text Extractor, Page Selector",icon:a.jsx(dc,{className:"h-4 w-4"})},{quarter:"Q4 2025",title:"Writing Suite",description:"Topic Explorer (Ideas, Outline, Keywords), Theory & Background, Methods & Approach, Discussion Generator",icon:a.jsx(dc,{className:"h-4 w-4"})},{quarter:"Q1 2026",title:"Analysis & Completion",description:"Qualitative Analysis (Full Mayring workflow), Citation Manager, Conclusion Generator, AI Thesis Supervisor",icon:a.jsx(dc,{className:"h-4 w-4"})}],fI=[{key:"student-hub",label:"Student Hub",icon:a.jsx(ree,{className:"h-4 w-4"}),timeline:[{quarter:"Q1 2026",title:"Development",description:"Building user exchange and community chat features."},{quarter:"Q1 2026",title:"Beta Testing",description:"Early adopters test collaboration and resource sharing."},{quarter:"Q2 2026",title:"Fully Integrated",description:"Student Hub launches with matching and community tools."}],items:[{title:"Community Chat & Exchange",description:"Connect with fellow students, share experiences and get peer feedback on your research.",status:"planned",why:"Collaboration accelerates learning."},{title:"Resource Sharing",description:"Share and discover literature, templates, and research resources within your discipline.",status:"planned",why:"Great research builds on shared knowledge."},{title:"Project Matching",description:"Find study partners and collaborators matched by discipline and research interests.",status:"exploring",why:"The right team makes all the difference."}]},{key:"transcription",label:"Transcription",icon:a.jsx(sbe,{className:"h-4 w-4"}),timeline:[{quarter:"Q2 2026",title:"Development",description:"Core audio/video transcription engine for interviews."},{quarter:"Q2 2026",title:"Beta Multilanguage",description:"Testing German, English and additional language support."},{quarter:"Q3 2026",title:"Fully Integrated",description:"Seamless transcription pipeline for all users."}],items:[{title:"Audio/Video Transcription",description:"Automatically transcribe interview recordings into structured text for analysis.",status:"planned",why:"Saves hours of manual transcription work."},{title:"Multilanguage Support",description:"Full platform support for German, English and additional languages.",status:"planned",why:"Research is global — your tools should be too."}]},{key:"quantitative-module",label:"Quantitative Module",icon:a.jsx(Hm,{className:"h-4 w-4"}),timeline:[{quarter:"Q2 2026",title:"Exploring Modular Design",description:"Defining the architecture for pluggable analysis modules."},{quarter:"Q2 2026",title:"Data Visualization",description:"Developing charts, boxplots and visual analysis tools."},{quarter:"Q3 2026",title:"Beta Testing",description:"Validating statistical workflows with early testers."},{quarter:"Q3 2026",title:"Going Live",description:"Full quantitative analysis module available to all users."}],items:[{title:"Quantitative Analysis",description:"Statistical analysis tools for survey data, experiments, and quantitative research methods.",status:"exploring",why:"Complete your methodology toolkit."},{title:"Data Visualization",description:"Generate charts, boxplots, and graphs directly from your research data.",status:"exploring",why:"Visual evidence strengthens your thesis."},{title:"Automated Insights",description:"AI-assisted pattern detection and key findings from your datasets.",status:"exploring",why:"Discover what your data is telling you."}]},{key:"citations",label:"Citation Styles",icon:a.jsx(ab,{className:"h-4 w-4"}),timeline:[{quarter:"Q2 2026",title:"Development",description:"Implementing MLA, Chicago, Harvard and Vancouver parsers."},{quarter:"Q2 2026",title:"Beta Testing",description:"Testing citation accuracy across multiple style guides."},{quarter:"Q3 2026",title:"Shipping",description:"All new citation styles available for every user."}],items:[{title:"MLA & Chicago",description:"Support for MLA 9th edition and Chicago (Notes & Bibliography + Author-Date).",status:"planned",why:"Essential for humanities and social sciences."},{title:"Harvard & Vancouver",description:"Harvard referencing and Vancouver (numbered) citation styles.",status:"planned",why:"Required by many European and medical universities."},{title:"IEEE",description:"IEEE citation format for engineering and computer science papers.",status:"planned",why:"Standard in technical disciplines."}]}],Vit={done:{label:"Done",variant:"success"},planned:{label:"Planned",variant:"default"},exploring:{label:"Exploring",variant:"warning"}},qit=({milestones:t})=>a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"hidden md:block relative mb-10",children:[a.jsx("div",{className:"absolute top-4 left-0 right-0 h-0.5 bg-border"}),a.jsx("div",{className:"grid gap-8 relative",style:{gridTemplateColumns:`repeat(${t.length}, minmax(0, 1fr))`},children:t.map((e,r)=>a.jsxs(el.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.3,delay:r*.1},className:"flex flex-col items-center text-center",children:[a.jsx("div",{className:"relative z-10 mb-3 flex h-8 w-8 items-center justify-center rounded-full bg-muted border border-border text-muted-foreground shadow-sm",children:a.jsx(uz,{className:"h-3.5 w-3.5"})}),a.jsx(gt,{variant:"default",className:"mb-1 text-[10px]",children:e.quarter}),a.jsx("p",{className:"text-sm font-medium text-foreground",children:e.title}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 max-w-[180px] leading-relaxed",children:e.description})]},r))})]}),a.jsxs("div",{className:"md:hidden space-y-4 relative pl-7 mb-8",children:[a.jsx("div",{className:"absolute left-[13px] top-0 bottom-0 w-0.5 bg-border"}),t.map((e,r)=>a.jsxs(el.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{duration:.3,delay:r*.08},className:"relative",children:[a.jsx("div",{className:"absolute -left-7 top-0.5 z-10 flex h-6 w-6 items-center justify-center rounded-full bg-muted border border-border text-muted-foreground",children:a.jsx(uz,{className:"h-3 w-3"})}),a.jsx(gt,{variant:"default",className:"mb-0.5 text-[10px]",children:e.quarter}),a.jsx("p",{className:"text-sm font-medium text-foreground",children:e.title}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:e.description})]},r))]})]}),Git=()=>{const[t,e]=S.useState(fI[0].key),r=fI.find(n=>n.key===t);return a.jsx("section",{id:"roadmap",className:"py-20 sm:py-28 bg-muted/30",children:a.jsxs(jr,{children:[a.jsxs(el.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.5},className:"text-center mb-16",children:[a.jsx(gt,{variant:"secondary",className:"mb-4",children:"Roadmap"}),a.jsx("h2",{className:"text-3xl sm:text-4xl font-bold tracking-tight text-foreground mb-4",children:"Building the Future of Academic Writing"}),a.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto text-lg",children:"Academly assists your research process — you remain the author. This roadmap shows planned features and may evolve based on community feedback."})]}),a.jsxs("div",{className:"mb-20",children:[a.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-muted-foreground mb-8 text-center",children:"What we've shipped"}),a.jsxs("div",{className:"hidden md:block relative",children:[a.jsx("div",{className:"absolute top-5 left-0 right-0 h-0.5 bg-border"}),a.jsx("div",{className:"grid grid-cols-3 gap-8 relative",children:DG.map((n,s)=>a.jsxs(el.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.4,delay:s*.15},className:"flex flex-col items-center text-center",children:[a.jsx("div",{className:"relative z-10 mb-4 flex h-10 w-10 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-md shadow-primary/20",children:n.icon}),a.jsx(gt,{variant:"success",className:"mb-2",children:n.quarter}),a.jsx("p",{className:"font-semibold text-foreground mb-1",children:n.title}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:n.description})]},n.quarter))})]}),a.jsxs("div",{className:"md:hidden space-y-6 relative pl-8",children:[a.jsx("div",{className:"absolute left-[15px] top-0 bottom-0 w-0.5 bg-border"}),DG.map((n,s)=>a.jsxs(el.div,{initial:{opacity:0,x:-10},whileInView:{opacity:1,x:0},viewport:{once:!0},transition:{duration:.4,delay:s*.1},className:"relative",children:[a.jsx("div",{className:"absolute -left-8 top-1 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-md shadow-primary/20",children:n.icon}),a.jsx(gt,{variant:"success",className:"mb-1",children:n.quarter}),a.jsx("p",{className:"font-semibold text-foreground",children:n.title}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]},n.quarter))]})]}),a.jsxs("div",{children:[a.jsxs(el.div,{initial:{opacity:0,y:16},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.4},className:"text-center mb-8",children:[a.jsx("h3",{className:"text-2xl sm:text-3xl font-bold tracking-tight text-foreground mb-2",children:"What's Next"}),a.jsx("p",{className:"text-muted-foreground max-w-xl mx-auto",children:"Explore the development tracks we're working on — select a track to see details and timelines."})]}),a.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2 mb-10",children:fI.map(n=>a.jsxs("button",{onClick:()=>e(n.key),className:`inline-flex items-center gap-2 rounded-full px-4 py-2 text-sm font-medium transition-all duration-200 ${t===n.key?"bg-primary text-primary-foreground shadow-md shadow-primary/20":"bg-card border border-border/50 text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[n.icon,n.label]},n.key))}),a.jsxs(el.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.3},children:[r.timeline&&a.jsx(qit,{milestones:r.timeline}),a.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:r.items.map((n,s)=>{const i=Vit[n.status];return a.jsx(Me,{className:"flex flex-col",children:a.jsxs(Be,{className:"pt-6 flex flex-col flex-1",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[a.jsx("h4",{className:"font-semibold text-foreground leading-snug",children:n.title}),a.jsx(gt,{variant:i.variant,className:"shrink-0",children:i.label})]}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mb-3 flex-1",children:n.description}),a.jsxs("p",{className:"text-xs text-muted-foreground/70 flex items-start gap-1.5",children:[a.jsx(hf,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),n.why]})]})},s)})})]},t)]})]})})},Kit=()=>a.jsxs("div",{className:"relative py-16 lg:py-24",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 h-max w-full m-auto grid grid-cols-2 -space-x-52 opacity-40 dark:opacity-20",children:[a.jsx("div",{className:"blur-[106px] h-56 bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-32 bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(jr,{children:a.jsxs("div",{className:"relative m-auto space-y-6 md:w-9/12 lg:w-8/12",children:[a.jsx("h2",{className:"text-center text-4xl font-bold text-foreground md:text-5xl",children:"Stop wasting weeks organizing sources."}),a.jsx("p",{className:"text-center text-xl text-muted-foreground",children:"Write faster, stay academically safe and keep every citation connected to real research."}),a.jsxs("div",{className:"flex flex-wrap justify-center gap-6 pt-2",children:[a.jsx(tt,{to:"/login?mode=signup",className:"relative flex h-12 w-full items-center justify-center px-8 before:absolute before:inset-0 before:rounded-full before:bg-primary before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 sm:w-max","data-umami-event":"cta-signup-click","data-umami-event-location":"final-cta",children:a.jsx("span",{className:"relative text-base font-semibold text-primary-foreground",children:"Start Free"})}),a.jsx("a",{href:"#source-demo",className:"relative flex h-12 w-full items-center justify-center px-8 before:absolute before:inset-0 before:rounded-full before:border before:border-transparent before:bg-primary/10 before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 dark:before:border-gray-700 dark:before:bg-gray-800 sm:w-max",children:a.jsx("span",{className:"relative text-base font-semibold text-primary dark:text-white",children:"See Source Demo"})})]})]})})]}),ai=({title:t,description:e,canonical:r,ogImage:n="https://academly.ai/og-image.png",jsonLd:s,noIndex:i=!1})=>a.jsxs(Pxe,{children:[a.jsx("title",{children:t}),a.jsx("meta",{name:"description",content:e}),a.jsx("link",{rel:"canonical",href:r}),i?a.jsx("meta",{name:"robots",content:"noindex, nofollow"}):a.jsx("meta",{name:"robots",content:"index, follow"}),a.jsx("meta",{property:"og:title",content:t}),a.jsx("meta",{property:"og:description",content:e}),a.jsx("meta",{property:"og:url",content:r}),a.jsx("meta",{property:"og:type",content:"website"}),a.jsx("meta",{property:"og:image",content:n}),a.jsx("meta",{property:"og:site_name",content:"Academly.ai"}),a.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),a.jsx("meta",{name:"twitter:title",content:t}),a.jsx("meta",{name:"twitter:description",content:e}),a.jsx("meta",{name:"twitter:image",content:n}),s&&a.jsx("script",{type:"application/ld+json",children:JSON.stringify(s)})]}),Yit=[{"@context":"https://schema.org","@type":"Organization",name:"Academly.ai",url:"https://academly.ai",logo:"https://academly.ai/og-image.png",sameAs:[]},{"@context":"https://schema.org","@type":"SoftwareApplication",name:"Academly.ai",applicationCategory:"EducationalApplication",operatingSystem:"Web",description:"Thesis platform for source-backed academic writing. Upload PDFs and generate structured thesis chapters with verified citations.",url:"https://academly.ai",offers:{"@type":"Offer",price:"0",priceCurrency:"USD"}}],Xit=()=>{const[t,e]=S.useState(!0);return a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"Academly.ai — Thesis platform with real, source-backed citations",description:"Upload academic PDFs, generate structured thesis chapters and keep every citation connected to real research with verified page references. APA7, Harvard, MLA.",canonical:"https://academly.ai/",jsonLd:Yit}),a.jsx(Jn,{}),a.jsxs("main",{children:[a.jsx(bit,{}),a.jsx("section",{id:"source-demo",className:"pt-8 pb-4",children:a.jsxs("div",{className:"max-w-5xl mx-auto px-6 text-center mb-6",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-primary mb-3",children:"Source-backed writing"}),a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-3",children:"See exactly how Academly writes from your research."}),a.jsx("p",{className:"text-muted-foreground text-lg",children:"Upload PDFs, select source pages, generate academic text and verify every citation."})]})}),a.jsx(Cit,{}),a.jsxs("div",{className:"max-w-5xl mx-auto px-6 -mt-4 mb-12 text-center",children:[a.jsx("p",{className:"text-foreground font-medium mb-4",children:"Every statement stays connected to real academic sources."}),a.jsx(ye,{asChild:!0,className:"rounded-full px-8",children:a.jsx(tt,{to:"/login?mode=signup",children:"Try it with your own sources"})})]}),a.jsx(Fit,{}),a.jsx("section",{className:"pt-8 pb-4",children:a.jsxs("div",{className:"max-w-5xl mx-auto px-6 text-center mb-2",children:[a.jsx("span",{className:"inline-block text-[11px] font-bold uppercase tracking-widest text-primary bg-primary/10 rounded-full px-3 py-1 mb-4",children:"Free tool"}),a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-3",children:"Free Bachelor & Master Thesis Topic Generator"}),a.jsx("p",{className:"text-muted-foreground text-lg mb-2",children:"Generate thesis ideas, research questions and methodology suggestions in seconds."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Perfect for students who don't know what to write about."})]})}),a.jsx(Dit,{}),a.jsx("div",{className:"max-w-5xl mx-auto px-6 -mt-6 mb-16 text-center",children:a.jsx(ye,{asChild:!0,className:"rounded-full px-8",children:a.jsx(tt,{to:"/topic-ideas",children:"Generate Thesis Topics Free"})})}),a.jsx("section",{className:"py-12",children:a.jsxs("div",{className:"max-w-5xl mx-auto px-6",children:[a.jsx("p",{className:"text-center text-muted-foreground text-sm uppercase tracking-wider mb-6",children:"See Academly in action"}),a.jsxs("div",{className:"relative rounded-2xl overflow-hidden shadow-2xl group",children:[a.jsx("video",{src:"/hero.mp4",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,"aria-label":"Academly platform demo",className:"w-full"}),a.jsxs("div",{className:"absolute inset-0 flex items-end justify-between p-4 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.jsx("button",{onClick:()=>{const r=document.querySelector("video");r&&(r.muted=!r.muted,e(r.muted))},className:"bg-black/50 text-white rounded-full p-2","aria-label":t?"Unmute":"Mute",children:t?a.jsx(wbe,{size:20}):a.jsx(bbe,{size:20})}),a.jsx("button",{onClick:()=>{const r=document.querySelector("video");r&&r.requestFullscreen()},className:"bg-black/50 text-white rounded-full p-2","aria-label":"Fullscreen",children:a.jsx(ebe,{size:20})})]})]})]})}),a.jsx(Uit,{}),a.jsx($it,{}),a.jsx(Hit,{}),a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsx("div",{className:"relative overflow-hidden rounded-3xl p-[1.5px] bg-gradient-to-r from-amber-300 via-orange-400 to-amber-300 shadow-2xl shadow-amber-500/20",children:a.jsxs("div",{className:"relative rounded-3xl bg-gradient-to-br from-amber-50 via-white to-orange-50 dark:from-amber-950/60 dark:via-background dark:to-orange-950/40 px-8 py-8 md:px-12 md:py-10",children:[a.jsx("div",{"aria-hidden":"true",className:"absolute -top-24 -right-24 w-64 h-64 rounded-full bg-amber-400/20 blur-3xl"}),a.jsx("div",{"aria-hidden":"true",className:"absolute -bottom-24 -left-24 w-64 h-64 rounded-full bg-orange-400/20 blur-3xl"}),a.jsxs("div",{className:"relative flex flex-col md:flex-row items-center gap-6 text-center md:text-left",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-amber-500/15 border border-amber-500/30 shrink-0",children:[a.jsxs("span",{className:"relative flex h-2 w-2",children:[a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-amber-500 opacity-75 animate-ping"}),a.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-amber-500"})]}),a.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-amber-700 dark:text-amber-300",children:"Beta Live"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"text-xl md:text-2xl font-bold text-foreground mb-1",children:["Completely free : get ",a.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"2,000 credits"})," on signup"]}),a.jsx("p",{className:"text-sm md:text-base text-muted-foreground",children:"Help shape Academly during our beta. No credit card required."})]}),a.jsx("a",{href:"https://discord.gg/YFHAZY8d9",target:"_blank",rel:"noreferrer",className:"shrink-0 inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-foreground text-background text-sm font-semibold hover:scale-105 transition-transform shadow-lg",children:"Join Discord →"})]})]})})})}),a.jsx(Git,{}),a.jsx(Kit,{})]}),a.jsx(Ds,{})]})};function gue(){const{user:t,userProfile:e}=Pt(),[r,n]=S.useState(!1);return{loading:r,createCheckoutSession:async l=>{if(!t){$e.error("Please log in to subscribe");return}n(!0);try{const{data:c,error:u}=await kr.functions.invoke("create-checkout-session",{body:{plan:l}});if(u)throw u;if(c!=null&&c.url)window.location.href=c.url;else throw new Error("No checkout URL received")}catch(c){console.error("Checkout error:",c),$e.error(c.message||"Failed to create checkout session")}finally{n(!1)}},openCustomerPortal:async l=>{if(!t){$e.error("Please log in to manage subscription");return}n(!0);try{const{data:c,error:u}=await kr.functions.invoke("create-customer-portal",{body:{targetPlan:l}});if(u)throw u;if(c!=null&&c.url)window.location.href=c.url;else throw new Error("No portal URL received")}catch(c){console.error("Portal error:",c),$e.error(c.message||"Failed to open customer portal")}finally{n(!1)}},getSubscriptionStatus:()=>e?{plan:e.plan,status:e.subscription_status,endsAt:e.subscription_ends_at,isActive:e.subscription_status==="active",hasSubscription:!!e.stripe_subscription_id}:null}}const Qit=!1,Zit=250,Jit=[{id:"free",name:"Free",originalPrice:null,price:"0",discount:null,points:"60",description:"Perfect for getting started",features:["60 Student Points on signup","PDF upload up to 5 MB","Basic summaries","Automatic citations"],popular:!1,launchOffer:!1,enabled:!0},{id:"pro",name:"Pro",originalPrice:"24.99",price:"15.99",discount:36,points:"2,000",description:"Ideal for active researchers",features:["2,000 Student Points per month","PDF upload up to 50 MB","Advanced summaries","Methodology Builder","Theory Builder","Discussion Builder","Qualitative Analysis","Export to multiple formats"],popular:!0,launchOffer:!0,enabled:!0},{id:"author",name:"Author",originalPrice:"39.99",price:"24.99",discount:37,points:"4,000",description:"For students & professionals",features:["4,000 Student Points per month","PDF upload up to 50 MB","All Pro features","AI-powered text blocks","Collaboration features","Custom citation styles"],popular:!1,launchOffer:!0,enabled:!0},{id:"lifetime",name:"Lifetime",originalPrice:null,price:"199",discount:null,points:"4,000",description:"One-time payment, lifetime access",features:["4,000 Student Points (renew monthly)","Lifetime access to all features","All Author features included","No monthly payments ever","Future feature updates included"],popular:!1,launchOffer:!1,isLifetime:!0,enabled:Qit}],eat=Jit.filter(t=>t.enabled!==!1),tat={"@context":"https://schema.org","@type":"WebPage",name:"Pricing - AI Academic Writing Plans",description:"Simple, transparent pricing for AI thesis writing. Free tier available.",url:"https://academly.ai/pricing"},rat=()=>{const t=gr(),{user:e,userProfile:r,loading:n}=Pt(),{createCheckoutSession:s,openCustomerPortal:i,loading:o}=gue(),[l,c]=S.useState(null),u=(r==null?void 0:r.plan)||"free",d=(r==null?void 0:r.subscription_status)==="active";S.useEffect(()=>{(async()=>{const{data:m,error:x}=await kr.rpc("get_lifetime_sold_count");!x&&m!==null&&c(m)})()},[]),S.useEffect(()=>{typeof window<"u"&&window.umami&&window.umami.track("pricing-page-view")},[]);const h=async g=>{if(g==="free"){t(e?"/dashboard":"/login");return}if(!e){t("/login");return}if(g==="lifetime"){await s(g);return}if(u===g&&d){await i();return}if(d){await i(g);return}await s(g)},f=g=>g==="free"?e?"Current Plan":"Get Started":g==="lifetime"?u==="lifetime"?"Current Plan":"Buy Lifetime Access":e?u===g&&d?"Manage Plan":d?"Change Plan":"Subscribe Now":"Start Trial",p=g=>g==="lifetime"&&u==="lifetime"||g==="free"&&(u==="free"||u==="starter")&&!d?!0:u===g&&d;return a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"Pricing - AI Academic Writing Plans | Academly",description:"Simple, transparent pricing for AI thesis writing. Free tier available. Generate theory sections, methodology chapters, and more with real citations.",canonical:"https://academly.ai/pricing",jsonLd:tat}),a.jsx(Jn,{}),a.jsxs("section",{className:"relative pt-32 pb-20 overflow-visible",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 -bottom-[600px] grid grid-cols-2 -space-x-52 opacity-40 dark:opacity-20 pointer-events-none overflow-visible",children:[a.jsx("div",{className:"blur-[106px] h-[400px] bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-[300px] bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(jr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-3xl mx-auto",children:[a.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:["Simple, Transparent",a.jsx("span",{className:"text-primary",children:" Pricing"})]}),a.jsx("p",{className:"text-xl text-muted-foreground",children:"Choose the plan that fits your research needs. No hidden fees, cancel anytime."})]})})]}),a.jsx("section",{className:"relative py-20 overflow-visible",children:a.jsxs(jr,{className:"max-w-screen-xl",children:[a.jsx("div",{className:"grid md:grid-cols-2 xl:grid-cols-4 gap-8",children:eat.map(g=>a.jsxs("div",{className:`relative rounded-3xl p-8 transition-all duration-300 hover:shadow-2xl ${g.popular?"bg-primary text-primary-foreground scale-105 shadow-2xl":g.isLifetime?"bg-card border-2 border-purple-500 ring-2 ring-purple-500/20 hover:ring-purple-500/40 shadow-lg shadow-purple-500/10":"bg-card border border-border hover:border-primary/50"}`,children:[a.jsxs("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 flex gap-2",children:[g.popular&&a.jsx("span",{className:"bg-orange-500 text-white text-sm font-medium px-4 py-1 rounded-full whitespace-nowrap",children:"Most Popular"}),g.isLifetime&&a.jsxs("span",{className:"bg-gradient-to-r from-purple-600 to-violet-500 text-white text-sm font-medium px-4 py-1 rounded-full whitespace-nowrap flex items-center gap-1.5",children:[a.jsx(sb,{className:"h-3.5 w-3.5"}),"Limited Offer"]})]}),g.launchOffer&&a.jsx("div",{className:"absolute -top-3 right-4",children:a.jsxs("span",{className:"bg-gradient-to-r from-amber-500 to-orange-500 text-white text-xs font-bold px-3 py-1 rounded-full flex items-center gap-1",children:[a.jsx(Ji,{className:"h-3 w-3"}),"-",g.discount,"%"]})}),g.isLifetime&&l!==null&&a.jsx("div",{className:"absolute -top-3 right-4",children:a.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-300 text-xs font-bold px-3 py-1 rounded-full",children:[l,"/",Zit," sold"]})}),a.jsxs("div",{className:"text-center mb-8 mt-2",children:[a.jsx("h3",{className:`text-2xl font-bold mb-2 ${g.popular?"":"text-foreground"}`,children:g.name}),a.jsx("p",{className:`text-sm mb-4 ${g.popular?"text-primary-foreground/80":"text-muted-foreground"}`,children:g.description}),a.jsxs("div",{className:"mb-2",children:[g.originalPrice&&a.jsxs("span",{className:`text-lg line-through ${g.popular?"text-primary-foreground/50":"text-muted-foreground"}`,children:["$",g.originalPrice]}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-4xl font-bold",children:["$",g.price]}),g.id!=="free"&&!g.isLifetime&&a.jsx("span",{className:g.popular?"text-primary-foreground/80":"text-muted-foreground",children:"/month"})]})]}),a.jsx("p",{className:`text-sm ${g.popular?"text-primary-foreground/80":"text-muted-foreground"}`,children:g.isLifetime?"4,000 Student Points (renew monthly)":g.id!=="free"?`${g.points} Student Points per month`:`${g.points} Student Points`})]}),a.jsx("ul",{className:"space-y-4 mb-8",children:g.features.map((m,x)=>a.jsxs("li",{className:"flex items-start gap-3",children:[a.jsx(gl,{className:`h-5 w-5 flex-shrink-0 mt-0.5 ${g.popular?"text-primary-foreground":"text-primary"}`}),a.jsx("span",{className:`text-sm ${g.popular?"":"text-muted-foreground"}`,children:m})]},x))}),a.jsx(ye,{onClick:()=>h(g.id),disabled:o||n||p(g.id),className:`w-full rounded-full h-12 text-base font-semibold ${g.popular?"bg-white text-primary hover:bg-white/90":""}`,variant:g.popular?"secondary":"default","data-umami-event":"pricing-plan-click","data-umami-event-plan":g.id,children:o?a.jsx(St,{className:"h-4 w-4 animate-spin"}):p(g.id)?"Current Plan":f(g.id)})]},g.name))}),a.jsxs("div",{className:"text-center mt-16",children:[a.jsx("p",{className:"text-muted-foreground mb-4"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Need a custom plan?"," ",a.jsx("a",{href:"mailto:contact@academly.ai",className:"text-primary hover:underline",children:"Contact us"})]})]})]})}),a.jsx(Ds,{})]})};var B8={};(function t(e,r,n,s){var i=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),o=typeof Path2D=="function"&&typeof DOMMatrix=="function",l=function(){if(!e.OffscreenCanvas)return!1;try{var B=new OffscreenCanvas(1,1),L=B.getContext("2d");L.fillRect(0,0,1,1);var F=B.transferToImageBitmap();L.createPattern(F,"no-repeat")}catch{return!1}return!0}();function c(){}function u(B){var L=r.exports.Promise,F=L!==void 0?L:e.Promise;return typeof F=="function"?new F(B):(B(c,c),null)}var d=function(B,L){return{transform:function(F){if(B)return F;if(L.has(F))return L.get(F);var W=new OffscreenCanvas(F.width,F.height),X=W.getContext("2d");return X.drawImage(F,0,0),L.set(F,W),W},clear:function(){L.clear()}}}(l,new Map),h=function(){var B=Math.floor(16.666666666666668),L,F,W={},X=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(L=function(oe){var le=Math.random();return W[le]=requestAnimationFrame(function U(R){X===R||X+B-1<R?(X=R,delete W[le],oe()):W[le]=requestAnimationFrame(U)}),le},F=function(oe){W[oe]&&cancelAnimationFrame(W[oe])}):(L=function(oe){return setTimeout(oe,B)},F=function(oe){return clearTimeout(oe)}),{frame:L,cancel:F}}(),f=function(){var B,L,F={};function W(X){function oe(le,U){X.postMessage({options:le||{},callback:U})}X.init=function(U){var R=U.transferControlToOffscreen();X.postMessage({canvas:R},[R])},X.fire=function(U,R,ee){if(L)return oe(U,null),L;var te=Math.random().toString(36).slice(2);return L=u(function(Z){function J(he){he.data.callback===te&&(delete F[te],X.removeEventListener("message",J),L=null,d.clear(),ee(),Z())}X.addEventListener("message",J),oe(U,te),F[te]=J.bind(null,{data:{callback:te}})}),L},X.reset=function(){X.postMessage({reset:!0});for(var U in F)F[U](),delete F[U]}}return function(){if(B)return B;if(!n&&i){var X=["var CONFETTI, SIZE = {}, module = {};","("+t.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
`);try{B=new Worker(URL.createObjectURL(new Blob([X])))}catch(oe){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",oe),null}W(B)}return B}}(),p={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function g(B,L){return L?L(B):B}function m(B){return B!=null}function x(B,L,F){return g(B&&m(B[L])?B[L]:p[L],F)}function y(B){return B<0?0:Math.floor(B)}function v(B,L){return Math.floor(Math.random()*(L-B))+B}function b(B){return parseInt(B,16)}function w(B){return B.map(j)}function j(B){var L=String(B).replace(/[^0-9a-f]/gi,"");return L.length<6&&(L=L[0]+L[0]+L[1]+L[1]+L[2]+L[2]),{r:b(L.substring(0,2)),g:b(L.substring(2,4)),b:b(L.substring(4,6))}}function N(B){var L=x(B,"origin",Object);return L.x=x(L,"x",Number),L.y=x(L,"y",Number),L}function C(B){B.width=document.documentElement.clientWidth,B.height=document.documentElement.clientHeight}function k(B){var L=B.getBoundingClientRect();B.width=L.width,B.height=L.height}function E(B){var L=document.createElement("canvas");return L.style.position="fixed",L.style.top="0px",L.style.left="0px",L.style.pointerEvents="none",L.style.zIndex=B,L}function M(B,L,F,W,X,oe,le,U,R){B.save(),B.translate(L,F),B.rotate(oe),B.scale(W,X),B.arc(0,0,1,le,U,R),B.restore()}function z(B){var L=B.angle*(Math.PI/180),F=B.spread*(Math.PI/180);return{x:B.x,y:B.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:B.startVelocity*.5+Math.random()*B.startVelocity,angle2D:-L+(.5*F-Math.random()*F),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:B.color,shape:B.shape,tick:0,totalTicks:B.ticks,decay:B.decay,drift:B.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:B.gravity*3,ovalScalar:.6,scalar:B.scalar,flat:B.flat}}function P(B,L){L.x+=Math.cos(L.angle2D)*L.velocity+L.drift,L.y+=Math.sin(L.angle2D)*L.velocity+L.gravity,L.velocity*=L.decay,L.flat?(L.wobble=0,L.wobbleX=L.x+10*L.scalar,L.wobbleY=L.y+10*L.scalar,L.tiltSin=0,L.tiltCos=0,L.random=1):(L.wobble+=L.wobbleSpeed,L.wobbleX=L.x+10*L.scalar*Math.cos(L.wobble),L.wobbleY=L.y+10*L.scalar*Math.sin(L.wobble),L.tiltAngle+=.1,L.tiltSin=Math.sin(L.tiltAngle),L.tiltCos=Math.cos(L.tiltAngle),L.random=Math.random()+2);var F=L.tick++/L.totalTicks,W=L.x+L.random*L.tiltCos,X=L.y+L.random*L.tiltSin,oe=L.wobbleX+L.random*L.tiltCos,le=L.wobbleY+L.random*L.tiltSin;if(B.fillStyle="rgba("+L.color.r+", "+L.color.g+", "+L.color.b+", "+(1-F)+")",B.beginPath(),o&&L.shape.type==="path"&&typeof L.shape.path=="string"&&Array.isArray(L.shape.matrix))B.fill(G(L.shape.path,L.shape.matrix,L.x,L.y,Math.abs(oe-W)*.1,Math.abs(le-X)*.1,Math.PI/10*L.wobble));else if(L.shape.type==="bitmap"){var U=Math.PI/10*L.wobble,R=Math.abs(oe-W)*.1,ee=Math.abs(le-X)*.1,te=L.shape.bitmap.width*L.scalar,Z=L.shape.bitmap.height*L.scalar,J=new DOMMatrix([Math.cos(U)*R,Math.sin(U)*R,-Math.sin(U)*ee,Math.cos(U)*ee,L.x,L.y]);J.multiplySelf(new DOMMatrix(L.shape.matrix));var he=B.createPattern(d.transform(L.shape.bitmap),"no-repeat");he.setTransform(J),B.globalAlpha=1-F,B.fillStyle=he,B.fillRect(L.x-te/2,L.y-Z/2,te,Z),B.globalAlpha=1}else if(L.shape==="circle")B.ellipse?B.ellipse(L.x,L.y,Math.abs(oe-W)*L.ovalScalar,Math.abs(le-X)*L.ovalScalar,Math.PI/10*L.wobble,0,2*Math.PI):M(B,L.x,L.y,Math.abs(oe-W)*L.ovalScalar,Math.abs(le-X)*L.ovalScalar,Math.PI/10*L.wobble,0,2*Math.PI);else if(L.shape==="star")for(var O=Math.PI/2*3,ie=4*L.scalar,q=8*L.scalar,I=L.x,T=L.y,D=5,ne=Math.PI/D;D--;)I=L.x+Math.cos(O)*q,T=L.y+Math.sin(O)*q,B.lineTo(I,T),O+=ne,I=L.x+Math.cos(O)*ie,T=L.y+Math.sin(O)*ie,B.lineTo(I,T),O+=ne;else B.moveTo(Math.floor(L.x),Math.floor(L.y)),B.lineTo(Math.floor(L.wobbleX),Math.floor(X)),B.lineTo(Math.floor(oe),Math.floor(le)),B.lineTo(Math.floor(W),Math.floor(L.wobbleY));return B.closePath(),B.fill(),L.tick<L.totalTicks}function V(B,L,F,W,X){var oe=L.slice(),le=B.getContext("2d"),U,R,ee=u(function(te){function Z(){U=R=null,le.clearRect(0,0,W.width,W.height),d.clear(),X(),te()}function J(){n&&!(W.width===s.width&&W.height===s.height)&&(W.width=B.width=s.width,W.height=B.height=s.height),!W.width&&!W.height&&(F(B),W.width=B.width,W.height=B.height),le.clearRect(0,0,W.width,W.height),oe=oe.filter(function(he){return P(le,he)}),oe.length?U=h.frame(J):Z()}U=h.frame(J),R=Z});return{addFettis:function(te){return oe=oe.concat(te),ee},canvas:B,promise:ee,reset:function(){U&&h.cancel(U),R&&R()}}}function A(B,L){var F=!B,W=!!x(L||{},"resize"),X=!1,oe=x(L,"disableForReducedMotion",Boolean),le=i&&!!x(L||{},"useWorker"),U=le?f():null,R=F?C:k,ee=B&&U?!!B.__confetti_initialized:!1,te=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,Z;function J(O,ie,q){for(var I=x(O,"particleCount",y),T=x(O,"angle",Number),D=x(O,"spread",Number),ne=x(O,"startVelocity",Number),ue=x(O,"decay",Number),re=x(O,"gravity",Number),pe=x(O,"drift",Number),ve=x(O,"colors",w),xe=x(O,"ticks",Number),ae=x(O,"shapes"),de=x(O,"scalar"),ge=!!x(O,"flat"),we=N(O),je=I,Se=[],Ue=B.width*we.x,Ae=B.height*we.y;je--;)Se.push(z({x:Ue,y:Ae,angle:T,spread:D,startVelocity:ne,color:ve[je%ve.length],shape:ae[v(0,ae.length)],ticks:xe,decay:ue,gravity:re,drift:pe,scalar:de,flat:ge}));return Z?Z.addFettis(Se):(Z=V(B,Se,R,ie,q),Z.promise)}function he(O){var ie=oe||x(O,"disableForReducedMotion",Boolean),q=x(O,"zIndex",Number);if(ie&&te)return u(function(ne){ne()});F&&Z?B=Z.canvas:F&&!B&&(B=E(q),document.body.appendChild(B)),W&&!ee&&R(B);var I={width:B.width,height:B.height};U&&!ee&&U.init(B),ee=!0,U&&(B.__confetti_initialized=!0);function T(){if(U){var ne={getBoundingClientRect:function(){if(!F)return B.getBoundingClientRect()}};R(ne),U.postMessage({resize:{width:ne.width,height:ne.height}});return}I.width=I.height=null}function D(){Z=null,W&&(X=!1,e.removeEventListener("resize",T)),F&&B&&(document.body.contains(B)&&document.body.removeChild(B),B=null,ee=!1)}return W&&!X&&(X=!0,e.addEventListener("resize",T,!1)),U?U.fire(O,I,D):J(O,I,D)}return he.reset=function(){U&&U.reset(),Z&&Z.reset()},he}var $;function K(){return $||($=A(null,{useWorker:!0,resize:!0})),$}function G(B,L,F,W,X,oe,le){var U=new Path2D(B),R=new Path2D;R.addPath(U,new DOMMatrix(L));var ee=new Path2D;return ee.addPath(R,new DOMMatrix([Math.cos(le)*X,Math.sin(le)*X,-Math.sin(le)*oe,Math.cos(le)*oe,F,W])),ee}function Y(B){if(!o)throw new Error("path confetti are not supported in this browser");var L,F;typeof B=="string"?L=B:(L=B.path,F=B.matrix);var W=new Path2D(L),X=document.createElement("canvas"),oe=X.getContext("2d");if(!F){for(var le=1e3,U=le,R=le,ee=0,te=0,Z,J,he=0;he<le;he+=2)for(var O=0;O<le;O+=2)oe.isPointInPath(W,he,O,"nonzero")&&(U=Math.min(U,he),R=Math.min(R,O),ee=Math.max(ee,he),te=Math.max(te,O));Z=ee-U,J=te-R;var ie=10,q=Math.min(ie/Z,ie/J);F=[q,0,0,q,-Math.round(Z/2+U)*q,-Math.round(J/2+R)*q]}return{type:"path",path:L,matrix:F}}function H(B){var L,F=1,W="#000000",X='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof B=="string"?L=B:(L=B.text,F="scalar"in B?B.scalar:F,X="fontFamily"in B?B.fontFamily:X,W="color"in B?B.color:W);var oe=10*F,le=""+oe+"px "+X,U=new OffscreenCanvas(oe,oe),R=U.getContext("2d");R.font=le;var ee=R.measureText(L),te=Math.ceil(ee.actualBoundingBoxRight+ee.actualBoundingBoxLeft),Z=Math.ceil(ee.actualBoundingBoxAscent+ee.actualBoundingBoxDescent),J=2,he=ee.actualBoundingBoxLeft+J,O=ee.actualBoundingBoxAscent+J;te+=J+J,Z+=J+J,U=new OffscreenCanvas(te,Z),R=U.getContext("2d"),R.font=le,R.fillStyle=W,R.fillText(L,he,O);var ie=1/F;return{type:"bitmap",bitmap:U.transferToImageBitmap(),matrix:[ie,0,0,ie,-te*ie/2,-Z*ie/2]}}r.exports=function(){return K().apply(this,arguments)},r.exports.reset=function(){K().reset()},r.exports.create=A,r.exports.shapeFromPath=Y,r.exports.shapeFromText=H})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),B8,!1);const nat=B8.exports;B8.exports.create;const LG={pro:"Pro",author:"Author",lifetime:"Lifetime"},sat=()=>{const{userProfile:t,refreshProfile:e}=Pt(),[r]=Dj(),n=r.get("upgraded")==="true",[s,i]=S.useState(n),[o,l]=S.useState(0),c=S.useMemo(()=>{const d=t==null?void 0:t.plan;return d&&LG[d]?LG[d]:"Premium"},[t==null?void 0:t.plan]);S.useEffect(()=>{if(!n||!s)return;if(o>=10){i(!1);return}const d=setTimeout(async()=>{await(e==null?void 0:e()),l(h=>h+1)},1500);return()=>clearTimeout(d)},[n,s,o,e]),S.useEffect(()=>{s||nat({particleCount:100,spread:70,origin:{y:.6}})},[s]),S.useEffect(()=>{n&&(t!=null&&t.plan)&&t.plan!=="pro"&&i(!1)},[t==null?void 0:t.plan,n]);const u=a.jsx(ai,{title:"Subscription Confirmed | Academly.ai",description:"Private page on Academly.ai.",canonical:"https://academly.ai/subscription/success",noIndex:!0});return s?a.jsxs("div",{className:"min-h-screen bg-background",children:[u,a.jsx(Jn,{}),a.jsx("section",{className:"relative pt-32 pb-20",children:a.jsx(jr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-2xl mx-auto",children:[a.jsx("div",{className:"w-20 h-20 bg-primary/10 rounded-full flex items-center justify-center mx-auto mb-6",children:a.jsx(St,{className:"h-10 w-10 text-primary animate-spin"})}),a.jsx("h1",{className:"text-3xl font-bold text-foreground mb-4",children:"Finalizing your upgrade..."}),a.jsx("p",{className:"text-muted-foreground",children:"Just a moment while we activate your new plan."})]})})}),a.jsx(Ds,{})]}):a.jsxs("div",{className:"min-h-screen bg-background",children:[u,a.jsx(Jn,{}),a.jsxs("section",{className:"relative pt-32 pb-20",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsx(jr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-2xl mx-auto",children:[a.jsx("div",{className:"w-20 h-20 bg-primary/10 rounded-full flex items-center justify-center mx-auto mb-6",children:a.jsx(gl,{className:"h-10 w-10 text-primary"})}),a.jsxs("h1",{className:"text-4xl md:text-5xl font-bold text-foreground mb-4",children:["Welcome to ",a.jsx("span",{className:"text-primary",children:c}),"!"]}),a.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"Your subscription is now active. You have full access to all premium features."}),a.jsxs("div",{className:"bg-card border border-border rounded-2xl p-6 mb-8",children:[a.jsxs("div",{className:"flex items-center justify-center gap-2 mb-4",children:[a.jsx(Ji,{className:"h-5 w-5 text-primary"}),a.jsx("span",{className:"font-semibold",children:"Your Student Points have been credited"})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Check your dashboard to see your updated balance."})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[a.jsx(ye,{asChild:!0,size:"lg",className:"rounded-full",children:a.jsx(tt,{to:"/dashboard",children:"Go to Dashboard"})}),a.jsx(ye,{asChild:!0,variant:"outline",size:"lg",className:"rounded-full",children:a.jsx(tt,{to:"/summary",children:"Create Your First Summary"})})]})]})})]}),a.jsx(Ds,{})]})},iat=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"Checkout Cancelled | Academly.ai",description:"Private page on Academly.ai.",canonical:"https://academly.ai/subscription/cancel",noIndex:!0}),a.jsx(Jn,{}),a.jsxs("section",{className:"relative pt-32 pb-20",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-muted/50 via-transparent to-transparent"}),a.jsx(jr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-2xl mx-auto",children:[a.jsx("div",{className:"w-20 h-20 bg-muted rounded-full flex items-center justify-center mx-auto mb-6",children:a.jsx(Dve,{className:"h-10 w-10 text-muted-foreground"})}),a.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-foreground mb-4",children:"Checkout Cancelled"}),a.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"No worries! Your checkout was cancelled and you haven't been charged."}),a.jsx("div",{className:"bg-card border border-border rounded-2xl p-6 mb-8",children:a.jsx("p",{className:"text-muted-foreground",children:"If you have any questions or need help choosing the right plan, feel free to reach out to our support team."})}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[a.jsx(ye,{asChild:!0,size:"lg",className:"rounded-full",children:a.jsxs(tt,{to:"/pricing",children:[a.jsx(Tve,{className:"mr-2 h-4 w-4"}),"Back to Pricing"]})}),a.jsx(ye,{asChild:!0,variant:"outline",size:"lg",className:"rounded-full",children:a.jsx(tt,{to:"/dashboard",children:"Go to Dashboard"})})]})]})})]}),a.jsx(Ds,{})]}),aat=[{icon:Nr,title:"Thesis Builder",description:"Generate structured thesis sections with AI assistance. Create introduction, theory, methodology, and conclusion chapters with proper academic citations.",highlights:["Auto-generate chapter structures","Proper citation formatting (APA, Harvard, etc.)","Word count tracking & deadlines","Export to Word/PDF"],color:"bg-blue-500/10 text-blue-500 dark:bg-blue-500/20"},{icon:DE,title:"Methodology Builder",description:"Design your research methodology with AI-powered suggestions. Get guidance on research design, data collection, and analysis methods.",highlights:["Research design templates","Method justification assistance","Sample size recommendations","Validity & reliability checks"],color:"bg-purple-500/10 text-purple-500 dark:bg-purple-500/20"},{icon:Js,title:"Theory Builder",description:"Build your theoretical framework systematically. Extract and organize key concepts from your literature sources.",highlights:["Concept extraction from PDFs","Framework visualization","Literature synthesis","Gap analysis"],color:"bg-emerald-500/10 text-emerald-500 dark:bg-emerald-500/20"},{icon:nbe,title:"Qualitative Analysis",description:"Powerful tools for qualitative research. Code interviews, build codebooks, and analyze themes across your data.",highlights:["Interview transcription","Codebook management","Theme extraction","Cross-case analysis"],color:"bg-orange-500/10 text-orange-500 dark:bg-orange-500/20"}],oat=[{step:"01",icon:Ku,title:"Upload Your Documents",description:"Simply drag and drop your PDFs. We support academic papers, textbooks, and research documents up to 100MB."},{step:"02",icon:Ji,title:"AI Analysis",description:"Our AI analyzes your documents, extracting key information, citations, and relevant content for your research."},{step:"03",icon:mo,title:"Export & Integrate",description:"Download your summaries, citations, and generated content in various formats ready for your thesis."}],lat={"@context":"https://schema.org","@type":"WebPage",name:"How It Works - AI Thesis Writing Assistant",description:"Learn how Academly helps you structure academic papers with AI assistance. Upload PDFs, organize sources, and create properly cited drafts.",url:"https://academly.ai/how-it-works"},cat=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"How It Works - AI Thesis Writing Assistant | Academly",description:"Upload academic PDFs, let AI help you identify key information with page numbers, structure theory and methodology sections with proper citations. Simple 3-step workflow.",canonical:"https://academly.ai/how-it-works",jsonLd:lat}),a.jsx(Jn,{}),a.jsxs("section",{className:"relative pt-32 pb-32 overflow-visible",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-primary/3 to-transparent pointer-events-none"}),a.jsx("div",{className:"absolute -bottom-32 left-0 right-0 h-64 bg-gradient-to-b from-primary/3 to-transparent pointer-events-none"}),a.jsx("div",{className:"absolute top-20 left-1/4 w-72 h-72 bg-primary/20 rounded-full blur-3xl pointer-events-none"}),a.jsx("div",{className:"absolute top-40 right-1/4 w-96 h-96 bg-purple-500/10 rounded-full blur-3xl pointer-events-none"}),a.jsx(jr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-4xl mx-auto",children:[a.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:["Your Complete",a.jsx("span",{className:"text-primary",children:" Research Toolkit"})]}),a.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"From literature review to final thesis, Academly provides all the tools you need to succeed in academic research."})]})})]}),a.jsx("section",{className:"py-20",children:a.jsxs(jr,{children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Powerful Features"}),a.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Everything you need to write better academic papers, faster."})]}),a.jsx("div",{className:"grid md:grid-cols-2 gap-8",children:aat.map((t,e)=>{const r=t.icon;return a.jsxs(el.div,{className:"group relative overflow-hidden rounded-3xl border border-border bg-card p-8 transition-all duration-300 hover:shadow-2xl hover:border-primary/50 hover:-translate-y-1",initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.5,delay:e*.1},children:[a.jsx("div",{className:"absolute left-1/2 top-0 -z-10 h-1/2 w-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/10 blur-3xl opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),a.jsx("div",{className:`w-16 h-16 rounded-2xl ${t.color} flex items-center justify-center mb-6`,children:a.jsx(r,{className:"w-8 h-8"})}),a.jsx("h3",{className:"text-2xl font-bold text-foreground mb-3",children:t.title}),a.jsx("p",{className:"text-muted-foreground mb-6",children:t.description}),a.jsx("ul",{className:"space-y-3",children:t.highlights.map((n,s)=>a.jsxs("li",{className:"flex items-center gap-3",children:[a.jsx(gl,{className:"w-5 h-5 text-primary flex-shrink-0"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:n})]},s))})]},e)})})]})}),a.jsx("section",{className:"py-20 bg-muted/30",children:a.jsxs(jr,{children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Simple 3-Step Workflow"}),a.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Get started in minutes. No complex setup required."})]}),a.jsx("div",{className:"grid md:grid-cols-3 gap-8 max-w-5xl mx-auto",children:oat.map((t,e)=>{const r=t.icon;return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"relative mb-6",children:[a.jsx("div",{className:"w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center mx-auto",children:a.jsx(r,{className:"w-10 h-10 text-primary"})}),a.jsx("span",{className:"absolute -top-2 -right-2 w-8 h-8 rounded-full bg-primary text-primary-foreground text-sm font-bold flex items-center justify-center",children:t.step})]}),a.jsx("h3",{className:"text-xl font-bold text-foreground mb-3",children:t.title}),a.jsx("p",{className:"text-muted-foreground",children:t.description})]},e)})})]})}),a.jsx("section",{className:"py-20",children:a.jsx(jr,{children:a.jsxs("div",{className:"relative rounded-3xl bg-gradient-to-br from-primary to-primary/80 p-12 md:p-16 text-center overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzLTItMi00LTJsLTIgMnYyaDJ2Mmw0LTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),a.jsxs("div",{className:"relative",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-primary-foreground mb-4",children:"Ready to Transform Your Research?"}),a.jsx("p",{className:"text-xl text-primary-foreground/80 mb-8 max-w-2xl mx-auto",children:"Join thousands of students and researchers who are writing better papers with Academly."}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[a.jsx(ye,{asChild:!0,size:"lg",className:"rounded-full h-14 px-8 text-base font-semibold bg-white text-primary hover:bg-white/90",children:a.jsx(tt,{to:"/login",children:"Get Started Free"})}),a.jsx(ye,{asChild:!0,size:"lg",variant:"outline",className:"rounded-full h-14 px-8 text-base font-semibold border-white/30 text-white hover:bg-white/10",children:a.jsx(tt,{to:"/pricing",children:"View Pricing"})})]})]})]})})}),a.jsx(Ds,{})]});var yue="Toggle",U8=S.forwardRef((t,e)=>{const{pressed:r,defaultPressed:n,onPressedChange:s,...i}=t,[o,l]=Ms({prop:r,onChange:s,defaultProp:n??!1,caller:yue});return a.jsx(et.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...i,ref:e,onClick:ze(t.onClick,()=>{t.disabled||l(!o)})})});U8.displayName=yue;var xue=U8,Ef="ToggleGroup",[vue,Xyt]=Bn(Ef,[mb]),bue=mb(),z8=me.forwardRef((t,e)=>{const{type:r,...n}=t;if(r==="single"){const s=n;return a.jsx(uat,{...s,ref:e})}if(r==="multiple"){const s=n;return a.jsx(dat,{...s,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${Ef}\``)});z8.displayName=Ef;var[wue,_ue]=vue(Ef),uat=me.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...i}=t,[o,l]=Ms({prop:r,defaultProp:n??"",onChange:s,caller:Ef});return a.jsx(wue,{scope:t.__scopeToggleGroup,type:"single",value:me.useMemo(()=>o?[o]:[],[o]),onItemActivate:l,onItemDeactivate:me.useCallback(()=>l(""),[l]),children:a.jsx(jue,{...i,ref:e})})}),dat=me.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...i}=t,[o,l]=Ms({prop:r,defaultProp:n??[],onChange:s,caller:Ef}),c=me.useCallback(d=>l((h=[])=>[...h,d]),[l]),u=me.useCallback(d=>l((h=[])=>h.filter(f=>f!==d)),[l]);return a.jsx(wue,{scope:t.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:c,onItemDeactivate:u,children:a.jsx(jue,{...i,ref:e})})});z8.displayName=Ef;var[hat,fat]=vue(Ef),jue=me.forwardRef((t,e)=>{const{__scopeToggleGroup:r,disabled:n=!1,rovingFocus:s=!0,orientation:i,dir:o,loop:l=!0,...c}=t,u=bue(r),d=cg(o),h={role:"group",dir:d,...c};return a.jsx(hat,{scope:r,rovingFocus:s,disabled:n,children:s?a.jsx(m6,{asChild:!0,...u,orientation:i,dir:d,loop:l,children:a.jsx(et.div,{...h,ref:e})}):a.jsx(et.div,{...h,ref:e})})}),sk="ToggleGroupItem",Sue=me.forwardRef((t,e)=>{const r=_ue(sk,t.__scopeToggleGroup),n=fat(sk,t.__scopeToggleGroup),s=bue(t.__scopeToggleGroup),i=r.value.includes(t.value),o=n.disabled||t.disabled,l={...t,pressed:i,disabled:o},c=me.useRef(null);return n.rovingFocus?a.jsx(g6,{asChild:!0,...s,focusable:!o,active:i,ref:c,children:a.jsx(FG,{...l,ref:e})}):a.jsx(FG,{...l,ref:e})});Sue.displayName=sk;var FG=me.forwardRef((t,e)=>{const{__scopeToggleGroup:r,value:n,...s}=t,i=_ue(sk,r),o={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},l=i.type==="single"?o:void 0;return a.jsx(U8,{...l,...s,ref:e,onPressedChange:c=>{c?i.onItemActivate(n):i.onItemDeactivate(n)}})}),Nue=z8,Aue=Sue;const Eue=od("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),pat=S.forwardRef(({className:t,variant:e,size:r,...n},s)=>a.jsx(xue,{ref:s,className:Ie(Eue({variant:e,size:r,className:t})),...n}));pat.displayName=xue.displayName;const Cue=S.createContext({size:"default",variant:"default"}),Rb=S.forwardRef(({className:t,variant:e,size:r,children:n,...s},i)=>a.jsx(Nue,{ref:i,className:Ie("flex items-center justify-center gap-1",t),...s,children:a.jsx(Cue.Provider,{value:{variant:e,size:r},children:n})}));Rb.displayName=Nue.displayName;const pl=S.forwardRef(({className:t,children:e,variant:r,size:n,...s},i)=>{const o=S.useContext(Cue);return a.jsx(Aue,{ref:i,className:Ie(Eue({variant:o.variant||r,size:o.size||n}),t),...s,children:e})});pl.displayName=Aue.displayName;const mat="https://nqibmbtqcjucktqcreob.supabase.co",gat="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5xaWJtYnRxY2p1Y2t0cWNyZW9iIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ1NTk5MTAsImV4cCI6MjA3MDEzNTkxMH0.UnFk-GqYCZtlkXNlxyHUTaFAnS6Q4hIgDgWKANrxEHg";function yat(){const{toast:t}=on(),[e,r]=S.useState("EN"),[n,s]=S.useState(""),[i,o]=S.useState(""),[l,c]=S.useState(!1),[u,d]=S.useState([]),[h,f]=S.useState(null),[p,g]=S.useState(!1),m=b=>{navigator.clipboard.writeText(b).then(()=>{t({title:"Copied!",description:"Copied to clipboard."})})},x=async()=>{if(n.trim()){c(!0),g(!1),f(null);try{const b=await fetch(`${mat}/functions/v1/demo-topic-ideas`,{method:"POST",headers:{"Content-Type":"application/json",apikey:gat},body:JSON.stringify({topic:n,context:i,language:e})});if(b.status===429){g(!0),d([]);return}const w=await b.json();if(!b.ok||w.error)throw new Error(w.error||"Request failed");const j=(w.suggestions||[]).map((N,C)=>{var k;return{id:((k=crypto.randomUUID)==null?void 0:k.call(crypto))||String(C),title:N.title,research_questions:N.research_questions??N.researchQuestions??[],method:N.method,relevance:N.relevance,sources:Array.isArray(N.sources)?N.sources:[]}});d(j)}catch(b){console.error(b),t({title:"Error",description:"Generation failed. Please try again.",variant:"destructive"})}finally{c(!1)}}},y=b=>{f(b),setTimeout(()=>{var w;(w=document.getElementById("selected-topic"))==null||w.scrollIntoView({behavior:"smooth",block:"start"})},50)},v=b=>{var j;let w=`${b.title}
Research Questions:
${b.research_questions.map((N,C)=>`${C+1}. ${N}`).join(`
`)}
Method:
${b.method}
Relevance:
${b.relevance}`;return(j=b.sources)!=null&&j.length&&(w+=`
Initial Sources:
${b.sources.map((N,C)=>`${C+1}. ${N.title}${N.doi?` (DOI: ${N.doi})`:""}${N.isbn?` (ISBN: ${N.isbn})`:""}`).join(`
`)}`),w};return a.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[a.jsx(Jn,{}),a.jsxs("section",{className:"relative pt-32 pb-16 overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsxs("div",{className:"relative max-w-4xl mx-auto px-6 text-center",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-primary mb-4 font-medium",children:"Free Demo"}),a.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:"Find Your Perfect Research Topic"}),a.jsxs("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto leading-relaxed",children:["Try our Topic Ideas generator — no account needed.",a.jsx("br",{}),"3 free generations per day."]})]})]}),a.jsxs("main",{className:"flex-1 w-full",children:[a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-6",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-2.5 text-primary",children:a.jsx(hf,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Generate Topic Suggestions"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter your basic idea and receive structured suggestions"})]})]}),a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-10 gap-5",children:[a.jsxs("div",{className:"space-y-2 lg:col-span-7",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Working Title / Topic Idea"}),a.jsx(Fe,{placeholder:"e.g., AI in Education",value:n,onChange:b=>s(b.target.value),className:"h-12 rounded-xl text-base"})]}),a.jsxs("div",{className:"space-y-2 lg:col-span-3",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Language"}),a.jsxs(Rb,{type:"single",value:e,onValueChange:b=>b&&r(b),className:"justify-start h-12",children:[a.jsx(pl,{value:"DE",className:"h-10 px-5",children:"DE"}),a.jsx(pl,{value:"EN",className:"h-10 px-5",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Description / Context (optional)"}),a.jsx(Ht,{placeholder:"Describe program, scope, methodology, context...",value:i,onChange:b=>o(b.target.value),rows:4,className:"rounded-xl text-base resize-none"})]}),a.jsx(ye,{onClick:x,disabled:!n.trim()||l,className:"w-full rounded-full h-12 text-base font-semibold",children:l?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Suggestions"})]})]})})}),p&&a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-amber-500/30 bg-amber-50/50 dark:bg-amber-950/20 p-8 md:p-10",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(sb,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"}),a.jsx("h3",{className:"text-lg font-bold text-amber-900 dark:text-amber-200",children:"Daily limit reached"})]}),a.jsx("p",{className:"text-sm text-amber-900/80 dark:text-amber-200/80 mb-6 leading-relaxed",children:"You've used your 3 free demo generations today. Come back tomorrow — or sign up free for unlimited access."}),a.jsx(ye,{asChild:!0,className:"rounded-full h-12 px-8",children:a.jsxs(tt,{to:"/login",children:["Get started free ",a.jsx(Oa,{className:"h-4 w-4 ml-2"})]})})]})})}),u.length>0&&!p&&a.jsx("section",{className:"py-16",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6",children:[a.jsxs("div",{className:"text-center mb-12",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-muted-foreground mb-3",children:"Generated for you"}),a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground",children:"Topic Suggestions"})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:u.map(b=>a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6 hover:border-primary/30 transition-colors flex flex-col",children:[a.jsx("h3",{className:"text-xl font-bold text-foreground mb-5",children:b.title}),a.jsxs("div",{className:"space-y-4 flex-1",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm text-primary mb-2",children:"Research Questions"}),a.jsx("ul",{className:"text-sm text-muted-foreground space-y-1.5",children:b.research_questions.map((w,j)=>a.jsxs("li",{className:"flex gap-2",children:[a.jsx("span",{className:"text-primary mt-0.5",children:"•"}),a.jsx("span",{children:w})]},j))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm text-primary mb-2",children:"Method"}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:b.method})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm text-primary mb-2",children:"Relevance"}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:b.relevance})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm text-primary mb-2",children:"Initial Sources"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:b.sources.map((w,j)=>a.jsx("span",{className:"inline-flex items-center rounded-full bg-muted px-3 py-1.5 text-xs text-muted-foreground",children:w.title},j))})]})]}),a.jsxs("div",{className:"flex gap-3 pt-5 mt-5 border-t border-border",children:[a.jsxs(ye,{size:"sm",onClick:()=>y(b),className:"flex-1 rounded-full h-10",children:["Select ",a.jsx(Oa,{className:"h-4 w-4 ml-1"})]}),a.jsx(ye,{size:"sm",variant:"outline",onClick:()=>m(v(b)),className:"rounded-full h-10 w-10 p-0",children:a.jsx(bn,{className:"h-4 w-4"})})]})]},b.id))})]})}),h&&a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsx("div",{id:"selected-topic",className:"rounded-3xl border border-border bg-card shadow-sm overflow-hidden",children:a.jsxs("div",{className:"p-8 md:p-10",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-2.5 text-primary",children:a.jsx(Js,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Your Topic Structure"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Based on your selected topic idea"})]})]}),a.jsxs("div",{className:"bg-muted/30 p-6 md:p-8 rounded-2xl space-y-6 text-foreground",children:[a.jsx("h3",{className:"text-2xl font-bold",children:h.title}),h.research_questions.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold text-primary mb-3",children:"Research Questions"}),a.jsx("ul",{className:"space-y-2",children:h.research_questions.map((b,w)=>a.jsxs("li",{className:"flex gap-2 text-sm",children:[a.jsx("span",{className:"text-primary mt-0.5",children:"•"}),a.jsx("span",{className:"leading-relaxed",children:b})]},w))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold text-primary mb-3",children:"Method"}),a.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",children:h.method})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold text-primary mb-3",children:"Relevance"}),a.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",children:h.relevance})]}),h.sources.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold text-primary mb-3",children:"Sources"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:h.sources.map((b,w)=>a.jsx("span",{className:"inline-flex items-center rounded-full bg-background border border-border px-3 py-1.5 text-xs text-foreground",children:b.title},w))})]})]}),a.jsx("div",{className:"rounded-2xl border border-primary/20 bg-primary/5 p-6 mt-6",children:a.jsxs("p",{className:"text-sm text-foreground leading-relaxed",children:[a.jsx("span",{className:"font-semibold",children:"Want to continue with this topic?"}),a.jsx("br",{}),"Sign up free to generate a full outline, theory chapter, and methodology."]})}),a.jsxs("div",{className:"flex flex-wrap gap-3 mt-6",children:[a.jsx(ye,{asChild:!0,className:"rounded-full h-12 px-8",children:a.jsxs(tt,{to:"/login",children:["Continue in Academly"," ",a.jsx(Oa,{className:"h-4 w-4 ml-2"})]})}),a.jsxs(ye,{variant:"outline",onClick:()=>m(v(h)),className:"rounded-full h-12 px-6",children:[a.jsx(bn,{className:"h-4 w-4 mr-2"}),"Copy"]})]})]})})})})]}),a.jsx(Ds,{})]})}const xat="https://nqibmbtqcjucktqcreob.supabase.co",$G="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5xaWJtYnRxY2p1Y2t0cWNyZW9iIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ1NTk5MTAsImV4cCI6MjA3MDEzNTkxMH0.UnFk-GqYCZtlkXNlxyHUTaFAnS6Q4hIgDgWKANrxEHg";function vat(){var M,z,P,V;const{toast:t}=on(),[e,r]=S.useState("EN"),[n,s]=S.useState(""),[i,o]=S.useState(""),[l,c]=S.useState(!1),[u,d]=S.useState(null),[h,f]=S.useState(!1),[p,g]=S.useState(!1),[m,x]=S.useState(""),[y,v]=S.useState([]),[b,w]=S.useState(1),j=A=>{navigator.clipboard.writeText(A).then(()=>{t({title:"Copied!",description:"Copied to clipboard."})})},N=async A=>fetch(`${xat}/functions/v1/demo-keywords`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${$G}`,apikey:$G},body:JSON.stringify(A)}),C=async A=>{if(A.trim()){g(!0);try{const $=await N({action:"search_literature",keywords:A,language:e});if($.status===429){f(!0);return}const K=await $.json();if(!$.ok||K.error)throw new Error(K.error||"Search failed");v(K.results||[]),w(1)}catch($){console.error($),t({title:"Error",description:"Literature search failed.",variant:"destructive"})}finally{g(!1)}}},k=async()=>{var A,$;if(n.trim()){c(!0),f(!1),v([]);try{const K=await N({action:"keywords",title:n,research_questions:i.split(`
`).map(B=>B.trim()).filter(B=>B),language:e});if(K.status===429){f(!0),d(null);return}const G=await K.json();if(!K.ok||G.error)throw new Error(G.error||"Request failed");const Y=G.keywords||G;d(Y);const H=(($=(A=Y==null?void 0:Y.keyword_combinations)==null?void 0:A[0])==null?void 0:$.combination)||n;x(H),await C(H)}catch(K){console.error(K),t({title:"Error",description:"Generation failed. Please try again.",variant:"destructive"})}finally{c(!1)}}},E=()=>{var $,K,G,Y;if(!u)return;const A=[];($=u.keyword_combinations)!=null&&$.length&&(A.push("Search Combinations:"),u.keyword_combinations.forEach(H=>A.push(`- ${H.combination} — ${H.purpose}`))),(K=u.known_authors)!=null&&K.length&&(A.push(`
Known Authors:`),u.known_authors.forEach(H=>A.push(`- ${H.name} (${H.relevance})`))),(G=u.known_works)!=null&&G.length&&(A.push(`
Known Works:`),u.known_works.forEach(H=>A.push(`- ${H.title} — ${H.author} (${H.year}): ${H.relevance}`))),(Y=u.database_suggestions)!=null&&Y.length&&(A.push(`
Recommended Databases:`),A.push(u.database_suggestions.join(", "))),u.search_tips&&(A.push(`
Search Tips:`),A.push(u.search_tips)),j(A.join(`
`))};return a.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[a.jsx(Jn,{}),a.jsxs("section",{className:"relative pt-32 pb-16 overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsxs("div",{className:"relative max-w-4xl mx-auto px-6 text-center",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-primary mb-4 font-medium",children:"Free Demo"}),a.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:"Find the Right Literature Keywords"}),a.jsxs("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto leading-relaxed",children:["Generate search terms for your thesis — no account needed.",a.jsx("br",{}),"3 free generations per day."]})]})]}),a.jsxs("main",{className:"flex-1 w-full",children:[a.jsx("section",{className:"py-12",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-6",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-2.5 text-primary",children:a.jsx(ll,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Find Literature Keywords"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Generate search terms and find relevant literature for your topic"})]})]}),a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-10 gap-5",children:[a.jsxs("div",{className:"space-y-2 lg:col-span-7",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Title / Topic *"}),a.jsx(Fe,{placeholder:"e.g., AI in Education",value:n,onChange:A=>s(A.target.value),className:"h-12 rounded-xl text-base"})]}),a.jsxs("div",{className:"space-y-2 lg:col-span-3",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Language"}),a.jsxs(Rb,{type:"single",value:e,onValueChange:A=>A&&r(A),className:"justify-start h-12",children:[a.jsx(pl,{value:"DE",className:"h-10 px-5",children:"DE"}),a.jsx(pl,{value:"EN",className:"h-10 px-5",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Research Questions (optional)"}),a.jsx(Ht,{placeholder:"One question per line...",value:i,onChange:A=>o(A.target.value),rows:3,className:"rounded-xl text-base resize-none"})]}),a.jsx(ye,{onClick:k,disabled:!n.trim()||l||p,className:"w-full rounded-full h-12 text-base font-semibold",children:l||p?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating & Searching..."]}):"Generate Keywords"})]})]})})}),h&&a.jsx("section",{className:"py-12",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-amber-500/30 bg-amber-50/50 dark:bg-amber-950/20 p-8 md:p-10",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(sb,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"}),a.jsx("h3",{className:"text-lg font-bold text-amber-900 dark:text-amber-200",children:"Daily limit reached"})]}),a.jsx("p",{className:"text-sm text-amber-900/80 dark:text-amber-200/80 mb-6 leading-relaxed",children:"You've used your 3 free demo generations today. Come back tomorrow — or sign up free for unlimited access."}),a.jsx(ye,{asChild:!0,className:"rounded-full h-12 px-8",children:a.jsxs(tt,{to:"/login",children:["Get started free ",a.jsx(Oa,{className:"h-4 w-4 ml-2"})]})})]})})}),u&&!h&&a.jsx("section",{className:"py-12",children:a.jsxs("div",{className:"max-w-5xl mx-auto px-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-8 flex-wrap gap-4",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground",children:"Keywords & Search Terms"}),a.jsxs(ye,{variant:"outline",onClick:E,className:"rounded-full",children:[a.jsx(bn,{className:"h-4 w-4 mr-2"}),"Copy All"]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(hf,{className:"h-5 w-5 text-primary"}),a.jsx("h3",{className:"text-xl font-bold text-foreground",children:"Search Combinations"})]}),a.jsx("ul",{className:"space-y-2",children:(M=u.keyword_combinations)==null?void 0:M.map((A,$)=>a.jsxs("li",{onClick:()=>j(A.combination),className:"cursor-pointer bg-muted/50 hover:bg-muted rounded-md p-2 transition-colors",children:[a.jsx("code",{className:"font-mono text-sm text-foreground block",children:A.combination}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:A.purpose})]},$))})]}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Ij,{className:"h-5 w-5 text-primary"}),a.jsx("h3",{className:"text-xl font-bold text-foreground",children:"Known Authors"})]}),a.jsx("ul",{className:"space-y-2",children:(z=u.known_authors)==null?void 0:z.map((A,$)=>a.jsxs("li",{onClick:()=>j(A.name),className:"cursor-pointer bg-muted/50 hover:bg-muted rounded-md p-2 transition-colors",children:[a.jsx("p",{className:"font-medium text-sm text-foreground",children:A.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:A.relevance})]},$))})]}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Js,{className:"h-5 w-5 text-primary"}),a.jsx("h3",{className:"text-xl font-bold text-foreground",children:"Known Works"})]}),a.jsx("ul",{className:"space-y-2",children:(P=u.known_works)==null?void 0:P.map((A,$)=>a.jsxs("li",{onClick:()=>j(A.title),className:"cursor-pointer bg-muted/50 hover:bg-muted rounded-md p-2 transition-colors",children:[a.jsx("p",{className:"font-medium text-sm text-foreground",children:A.title}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[A.author," (",A.year,")"]}),a.jsx("p",{className:"text-xs italic text-muted-foreground mt-0.5",children:A.relevance})]},$))})]}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(ll,{className:"h-5 w-5 text-primary"}),a.jsx("h3",{className:"text-xl font-bold text-foreground",children:"Recommended Databases"})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:(V=u.database_suggestions)==null?void 0:V.map((A,$)=>a.jsx(gt,{variant:"secondary",children:A},$))}),u.search_tips&&a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap leading-relaxed",children:u.search_tips})]})]}),a.jsxs("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-6 md:p-8 mt-10",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Js,{className:"h-5 w-5 text-primary"}),a.jsx("h3",{className:"text-xl font-bold text-foreground",children:"Literature Search"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-6",children:[a.jsx(Fe,{value:m,onChange:A=>x(A.target.value),placeholder:"Search query...",className:"h-12 rounded-xl text-base flex-1"}),a.jsx(ye,{onClick:()=>C(m),disabled:!m.trim()||p,className:"rounded-full h-12 px-6",children:p?a.jsx(St,{className:"h-4 w-4 animate-spin"}):a.jsxs(a.Fragment,{children:[a.jsx(ll,{className:"h-4 w-4 mr-2"})," Search"]})})]}),y.length>0?a.jsx("ul",{className:"space-y-3",children:y.slice((b-1)*10,b*10).map((A,$)=>a.jsxs("li",{className:"rounded-xl border border-border bg-muted/30 p-4",children:[a.jsx("p",{className:"font-medium text-foreground",children:A.title||"Untitled"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[Array.isArray(A.authors)?A.authors.join(", "):A.authors,A.year?` (${A.year})`:"",A.journal?` — ${A.journal}`:""]}),A.abstract&&a.jsx("p",{className:"text-sm text-muted-foreground mt-2 line-clamp-3",children:A.abstract}),(A.url||A.doi)&&a.jsx("a",{href:A.url||`https://doi.org/${A.doi}`,target:"_blank",rel:"noreferrer",className:"text-xs text-primary mt-2 inline-block hover:underline",children:"View source →"})]},$))}):!p&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"No results yet."}),y.length>10&&a.jsxs("div",{className:"flex items-center justify-between mt-6",children:[a.jsx(ye,{variant:"outline",size:"sm",disabled:b===1,onClick:()=>w(A=>A-1),children:"Previous"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Page ",b," of"," ",Math.ceil(y.length/10)]}),a.jsx(ye,{variant:"outline",size:"sm",disabled:b*10>=y.length,onClick:()=>w(A=>A+1),children:"Next"})]})]}),a.jsx("div",{className:"rounded-3xl border border-primary/20 bg-primary/5 p-8 md:p-10 mt-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-2.5 text-primary shrink-0",children:a.jsx(Ji,{className:"h-5 w-5"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-xl font-bold text-foreground mb-2",children:"Want to search real academic papers?"}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mb-5",children:"Sign up free to access our full Literature Search — powered by CrossRef and OpenAlex. Find and cite real papers directly in your thesis."}),a.jsx(ye,{asChild:!0,className:"rounded-full h-12 px-8",children:a.jsxs(tt,{to:"/login",children:["Get started free ",a.jsx(Oa,{className:"h-4 w-4 ml-2"})]})})]})]})})]})})]}),a.jsx(Ds,{})]})}const bat=[{name:"Dom",role:"Founder",description:"Cloud technologist with a strong focus on privacy-first infrastructure. Passionate about AI applications in academic work. Bachelor of Science."},{name:"Rebecca",role:"Marketing & IT Security",description:"IT security specialist and penetration tester with a background in secure systems and communication. Bachelor of Science."},{name:"Nicole",role:"Platform Design & IT Security",description:"IT security specialist focused on platform architecture and usability. Bachelor of Science, Master of Science."}],wat=[{icon:zF,title:"GDPR Compliant",description:"Fully compliant with European data protection regulations."},{icon:$F,title:"Security-First",description:"Built by IT security specialists with penetration testing expertise."},{icon:Wve,title:"No Training on User Documents",description:"Your academic work stays yours. We never train AI models on your data."}];function _at(){return a.jsxs(a.Fragment,{children:[a.jsx(ai,{title:"Meet the Team - Academly | Security & AI Experts",description:"Built by professionals with a background in technology, IT security, and academic research. Meet the team behind Academly.",canonical:"https://academly.ai/team"}),a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(Jn,{}),a.jsxs("div",{className:"relative pt-32 pb-16",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 grid grid-cols-2 -space-x-52 opacity-40 dark:opacity-20",children:[a.jsx("div",{className:"blur-[106px] h-56 bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-32 bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(jr,{children:a.jsx("div",{className:"relative",children:a.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[a.jsxs("h1",{className:"text-4xl font-bold tracking-tight text-foreground sm:text-5xl md:text-6xl",children:["The team behind"," ",a.jsx("span",{className:"text-primary",children:"Academly"})]}),a.jsx("p",{className:"mt-6 text-lg leading-8 text-muted-foreground",children:"Built by professionals with a background in technology, security, and academic research."})]})})})]}),a.jsx("section",{className:"pb-16",children:a.jsx(jr,{children:a.jsx("div",{className:"mx-auto max-w-3xl space-y-6",children:bat.map((t,e)=>a.jsxs("div",{className:"group flex items-start gap-6 rounded-3xl border border-border bg-card p-6 sm:p-8 shadow-lg shadow-primary/5 transition-all duration-300 hover:shadow-xl hover:shadow-primary/10 animate-fade-in",style:{animationDelay:`${e*100}ms`},children:[a.jsx("div",{className:"flex h-20 w-20 sm:h-24 sm:w-24 flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-primary/20 to-primary/5 ring-2 ring-primary/10 group-hover:ring-primary/20 transition-all duration-300 overflow-hidden",children:a.jsx("span",{className:"text-2xl sm:text-3xl font-bold text-primary",children:t.name.slice(0,2).toUpperCase()})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-xl sm:text-2xl font-semibold text-foreground group-hover:text-primary transition-colors",children:t.name}),a.jsx("p",{className:"text-sm font-medium text-primary mt-1",children:t.role}),a.jsx("p",{className:"mt-3 text-muted-foreground leading-relaxed",children:t.description})]})]},t.name))})})}),a.jsxs("section",{className:"relative py-20",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 h-max w-full m-auto grid grid-cols-2 -space-x-52 opacity-20 dark:opacity-10",children:[a.jsx("div",{className:"blur-[106px] h-40 bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-24 bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(jr,{children:a.jsxs("div",{className:"relative",children:[a.jsx("h2",{className:"text-center text-2xl sm:text-3xl font-bold text-foreground mb-12",children:"Your data is safe with us"}),a.jsx("div",{className:"grid gap-8 sm:grid-cols-3",children:wat.map((t,e)=>a.jsxs("div",{className:"text-center group animate-fade-in",style:{animationDelay:`${e*100}ms`},children:[a.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-primary/20 to-primary/5 shadow-lg shadow-primary/10 group-hover:shadow-xl group-hover:shadow-primary/20 transition-all duration-300",children:a.jsx(t.icon,{className:"h-8 w-8 text-primary"})}),a.jsx("h3",{className:"font-semibold text-foreground text-lg",children:t.title}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:t.description})]},t.title))})]})})]}),a.jsx(Ds,{})]})]})}var $2="Checkbox",[jat,Qyt]=Bn($2),[Sat,H8]=jat($2);function Nat(t){const{__scopeCheckbox:e,checked:r,children:n,defaultChecked:s,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=t,[f,p]=Ms({prop:r,defaultProp:s??!1,onChange:c,caller:$2}),[g,m]=S.useState(null),[x,y]=S.useState(null),v=S.useRef(!1),b=g?!!o||!!g.closest("form"):!0,w={checked:f,disabled:i,setChecked:p,control:g,setControl:m,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:Kh(s)?!1:s,isFormControl:b,bubbleInput:x,setBubbleInput:y};return a.jsx(Sat,{scope:e,...w,children:Aat(h)?h(w):n})}var kue="CheckboxTrigger",Tue=S.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:r,...n},s)=>{const{control:i,value:o,disabled:l,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:g}=H8(kue,t),m=Nt(s,d),x=S.useRef(c);return S.useEffect(()=>{const y=i==null?void 0:i.form;if(y){const v=()=>h(x.current);return y.addEventListener("reset",v),()=>y.removeEventListener("reset",v)}},[i,h]),a.jsx(et.button,{type:"button",role:"checkbox","aria-checked":Kh(c)?"mixed":c,"aria-required":u,"data-state":Mue(c),"data-disabled":l?"":void 0,disabled:l,value:o,...n,ref:m,onKeyDown:ze(e,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:ze(r,y=>{h(v=>Kh(v)?!0:!v),g&&p&&(f.current=y.isPropagationStopped(),f.current||y.stopPropagation())})})});Tue.displayName=kue;var W8=S.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:d,...h}=t;return a.jsx(Nat,{__scopeCheckbox:r,checked:s,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:n,form:d,value:c,internal_do_not_use_render:({isFormControl:f})=>a.jsxs(a.Fragment,{children:[a.jsx(Tue,{...h,ref:e,__scopeCheckbox:r}),f&&a.jsx(Rue,{__scopeCheckbox:r})]})})});W8.displayName=$2;var Pue="CheckboxIndicator",Oue=S.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:n,...s}=t,i=H8(Pue,r);return a.jsx(es,{present:n||Kh(i.checked)||i.checked===!0,children:a.jsx(et.span,{"data-state":Mue(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...t.style}})})});Oue.displayName=Pue;var Iue="CheckboxBubbleInput",Rue=S.forwardRef(({__scopeCheckbox:t,...e},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:d,form:h,bubbleInput:f,setBubbleInput:p}=H8(Iue,t),g=Nt(r,p),m=F8(i),x=XF(n);S.useEffect(()=>{const v=f;if(!v)return;const b=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(b,"checked").set,N=!s.current;if(m!==i&&j){const C=new Event("click",{bubbles:N});v.indeterminate=Kh(i),j.call(v,Kh(i)?!1:i),v.dispatchEvent(C)}},[f,m,i,s]);const y=S.useRef(Kh(i)?!1:i);return a.jsx(et.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:l,disabled:c,name:u,value:d,form:h,...e,tabIndex:-1,ref:g,style:{...e.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Rue.displayName=Iue;function Aat(t){return typeof t=="function"}function Kh(t){return t==="indeterminate"}function Mue(t){return Kh(t)?"indeterminate":t?"checked":"unchecked"}const xo=S.forwardRef(({className:t,...e},r)=>a.jsx(W8,{ref:r,className:Ie("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(Oue,{className:Ie("flex items-center justify-center text-current"),children:a.jsx(yn,{className:"h-4 w-4"})})}));xo.displayName=W8.displayName;function Due({id:t,checked:e,onCheckedChange:r,required:n=!1,className:s,children:i}){return a.jsxs("div",{className:Ie("flex items-start gap-3",s),children:[a.jsx(xo,{id:t,checked:e,onCheckedChange:o=>r(o===!0),required:n,className:"mt-0.5 flex-shrink-0"}),a.jsx("label",{htmlFor:t,className:"text-sm text-muted-foreground leading-relaxed cursor-pointer select-none",children:i})]})}var Eat=Object.defineProperty,Lue=t=>{throw TypeError(t)},Cat=(t,e,r)=>e in t?Eat(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,bd=(t,e,r)=>Cat(t,typeof e!="symbol"?e+"":e,r),kat=(t,e,r)=>e.has(t)||Lue("Cannot "+r),BG=(t,e,r)=>(kat(t,e,"read from private field"),e.get(t)),Tat=(t,e,r)=>e.has(t)?Lue("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);function Pat(t){return t==null?[]:Array.isArray(t)?t:[t]}var UG=t=>(t==null?void 0:t.constructor.name)==="Array",Oat=(t,e)=>{if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!V8(t[r],e[r]))return!1;return!0},V8=(t,e)=>{if(Object.is(t,e))return!0;if(t==null&&e!=null||t!=null&&e==null)return!1;if(typeof(t==null?void 0:t.isEqual)=="function"&&typeof(e==null?void 0:e.isEqual)=="function")return t.isEqual(e);if(typeof t=="function"&&typeof e=="function")return t.toString()===e.toString();if(UG(t)&&UG(e))return Oat(Array.from(t),Array.from(e));if(typeof t!="object"||typeof e!="object")return!1;const r=Object.keys(e??Object.create(null)),n=r.length;for(let s=0;s<n;s++)if(!Reflect.has(t,r[s]))return!1;for(let s=0;s<n;s++){const i=r[s];if(!V8(t[i],e[i]))return!1}return!0},Iat=t=>t!=null&&typeof t=="object",PA=t=>typeof t=="string",dp=t=>typeof t=="function",Fue=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Rat=t=>Object.prototype.toString.call(t),$ue=Function.prototype.toString,Mat=$ue.call(Object),Dat=t=>{if(!Iat(t)||Rat(t)!="[object Object]"||$at(t))return!1;const e=Object.getPrototypeOf(t);if(e===null)return!0;const r=Fue(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&$ue.call(r)==Mat},Lat=t=>typeof t=="object"&&t!==null&&"$$typeof"in t&&"props"in t,Fat=t=>typeof t=="object"&&t!==null&&"__v_isVNode"in t,$at=t=>Lat(t)||Fat(t),Bat=t=>t(),Uat=(...t)=>(...e)=>{t.forEach(function(r){r==null||r(...e)})};function Bue(t,e,...r){var s;if(t in e){const i=e[t];return dp(i)?i(...r):i}const n=new Error(`No matching key: ${JSON.stringify(t)} in ${JSON.stringify(Object.keys(e))}`);throw(s=Error.captureStackTrace)==null||s.call(Error,n,Bue),n}var{floor:Zyt,abs:Jyt,round:ext,min:zat,max:Hat,pow:txt,sign:rxt}=Math,Wat=t=>Number.isNaN(t),Vat=t=>Wat(t)?0:t,qat=(t,e,r)=>zat(Hat(Vat(t),e),r);function Uue(t){if(!Dat(t)||t===void 0)return t;const e=Reflect.ownKeys(t).filter(n=>typeof n=="string"),r={};for(const n of e){const s=t[n];s!==void 0&&(r[n]=Uue(s))}return r}var FN=()=>performance.now(),OA,zue=class{constructor(t){this.onTick=t,bd(this,"frameId",null),bd(this,"pausedAtMs",null),bd(this,"context"),bd(this,"cancelFrame",()=>{this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null)}),bd(this,"setStartMs",e=>{this.context.startMs=e}),bd(this,"start",()=>{if(this.frameId!==null)return;const e=FN();this.pausedAtMs!==null?(this.context.startMs+=e-this.pausedAtMs,this.pausedAtMs=null):this.context.startMs=e,this.frameId=requestAnimationFrame(BG(this,OA))}),bd(this,"pause",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=FN())}),bd(this,"stop",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=null)}),Tat(this,OA,e=>{if(this.context.now=e,this.context.deltaMs=e-this.context.startMs,this.onTick(this.context)===!1){this.stop();return}this.frameId=requestAnimationFrame(BG(this,OA))}),this.context={now:0,startMs:FN(),deltaMs:0}}get elapsedMs(){return this.pausedAtMs!==null?this.pausedAtMs-this.context.startMs:FN()-this.context.startMs}};OA=new WeakMap;function Gat(t,e){const r=new zue(({now:n,deltaMs:s})=>{if(s>=e){const i=e>0?n-s%e:n;r.setStartMs(i),t({startMs:i,deltaMs:s})}});return r.start(),()=>r.stop()}function Kat(t,e){const r=new zue(({deltaMs:n})=>{if(n>=e)return t(),!1});return r.start(),()=>r.stop()}function zG(...t){const e=t.length===1?t[0]:t[1],r=t.length===2?t[0]:!0}function Yat(t,e){if(t==null)throw new Error(e())}var Hue=t=>typeof t=="object"&&t!==null,Xat=9,Qat=t=>Hue(t)&&t.nodeType===Xat,Zat=t=>Hue(t)&&t===t.window;function Jat(t){if(!t)return!1;const e=t.getRootNode();return Wue(e)===t}function eot(t){return Qat(t)?t:Zat(t)?t.document:(t==null?void 0:t.ownerDocument)??document}function Wue(t){let e=t.activeElement;for(;e!=null&&e.shadowRoot;){const r=e.shadowRoot.activeElement;if(!r||r===e)break;e=r}return e}var tot=(...t)=>t.map(e=>{var r;return(r=e==null?void 0:e.trim)==null?void 0:r.call(e)}).filter(Boolean).join(" "),rot=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,HG=t=>{const e={};let r;for(;r=rot.exec(t);)e[r[1]]=r[2];return e},not=(t,e)=>{if(PA(t)){if(PA(e))return`${t};${e}`;t=HG(t)}else PA(e)&&(e=HG(e));return Object.assign({},t??{},e??{})};function B2(...t){let e={};for(let r of t){if(!r)continue;for(let s in e){if(s.startsWith("on")&&typeof e[s]=="function"&&typeof r[s]=="function"){e[s]=Uat(r[s],e[s]);continue}if(s==="className"||s==="class"){e[s]=tot(e[s],r[s]);continue}if(s==="style"){e[s]=not(e[s],r[s]);continue}e[s]=r[s]!==void 0?r[s]:e[s]}for(let s in r)e[s]===void 0&&(e[s]=r[s]);const n=Object.getOwnPropertySymbols(r);for(let s of n)e[s]=r[s]}return e}function sot(t,e,r){let n=[],s;return i=>{const o=t(i);return(o.length!==n.length||o.some((c,u)=>!V8(n[u],c)))&&(n=o,s=e(o,i)),s}}var Ug=(t=>(t.NotStarted="Not Started",t.Started="Started",t.Stopped="Stopped",t))(Ug||{}),pI="__init__";function iot(t){const e=()=>{var o;return((o=t.getRootNode)==null?void 0:o.call(t))??document},r=()=>eot(e());return{...t,getRootNode:e,getDoc:r,getWin:()=>r().defaultView??window,getActiveElement:()=>Wue(e()),isActiveElement:Jat,getById:o=>e().getElementById(o)}}function aot(t){return new Proxy({},{get(e,r){return r==="style"?n=>t({style:n}).style:t}})}var oot=()=>t=>Array.from(new Set(t)),Vue=typeof globalThis.document<"u"?S.useLayoutEffect:S.useEffect;function ik(t){const e=t().value??t().defaultValue,r=t().isEqual??Object.is,[n]=S.useState(e),[s,i]=S.useState(n),o=t().value!==void 0,l=S.useRef(s);l.current=o?t().value:s;const c=S.useRef(l.current);Vue(()=>{c.current=l.current},[s,t().value]);const u=h=>{var g,m;const f=c.current,p=dp(h)?h(f):h;t().debug&&console.log(`[bindable > ${t().debug}] setValue`,{next:p,prev:f}),o||i(p),r(p,f)||(m=(g=t()).onChange)==null||m.call(g,p,f)};function d(){return o?t().value:s}return{initial:n,ref:l,get:d,set(h){(t().sync?Ac.flushSync:Bat)(()=>u(h))},invoke(h,f){var p,g;(g=(p=t()).onChange)==null||g.call(p,h,f)},hash(h){var f,p;return((p=(f=t()).hash)==null?void 0:p.call(f,h))??String(h)}}}ik.cleanup=t=>{S.useEffect(()=>t,[])};ik.ref=t=>{const e=S.useRef(t);return{get:()=>e.current,set:r=>{e.current=r}}};function lot(t){const e=S.useRef(t);return{get(r){return e.current[r]},set(r,n){e.current[r]=n}}}var cot=(t,e)=>{const r=S.useRef(!1),n=S.useRef(!1);S.useEffect(()=>{if(r.current&&n.current)return e();n.current=!0},[...(t??[]).map(s=>typeof s=="function"?s():s)]),S.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[])};function uot(t,e={}){var z,P,V,A;const r=S.useMemo(()=>{const{id:$,ids:K,getRootNode:G}=e;return iot({id:$,ids:K,getRootNode:G})},[e]),n=(...$)=>{t.debug&&console.log(...$)},s=((z=t.props)==null?void 0:z.call(t,{props:Uue(e),scope:r}))??e,i=dot(s),o=(P=t.context)==null?void 0:P.call(t,{prop:i,bindable:ik,scope:r,flush:WG,getContext(){return c},getComputed(){return j},getRefs(){return m},getEvent(){return p()}}),l=que(o),c={get($){var K;return(K=l.current)==null?void 0:K[$].ref.current},set($,K){var G;(G=l.current)==null||G[$].set(K)},initial($){var K;return(K=l.current)==null?void 0:K[$].initial},hash($){var G,Y;const K=(G=l.current)==null?void 0:G[$].get();return(Y=l.current)==null?void 0:Y[$].hash(K)}},u=S.useRef(new Map),d=S.useRef(null),h=S.useRef(null),f=S.useRef({type:""}),p=()=>({...f.current,current(){return f.current},previous(){return h.current}}),g=()=>({...N,matches(...$){return $.includes(N.ref.current)},hasTag($){var K,G;return!!((G=(K=t.states[N.ref.current])==null?void 0:K.tags)!=null&&G.includes($))}}),m=lot(((V=t.refs)==null?void 0:V.call(t,{prop:i,context:c}))??{}),x=()=>({state:g(),context:c,event:p(),prop:i,send:M,action:y,guard:v,track:cot,refs:m,computed:j,flush:WG,scope:r,choose:w}),y=$=>{const K=dp($)?$(x()):$;if(!K)return;const G=K.map(Y=>{var B,L;const H=(L=(B=t.implementations)==null?void 0:B.actions)==null?void 0:L[Y];return H||zG(`[zag-js] No implementation found for action "${JSON.stringify(Y)}"`),H});for(const Y of G)Y==null||Y(x())},v=$=>{var K,G;return dp($)?$(x()):(G=(K=t.implementations)==null?void 0:K.guards)==null?void 0:G[$](x())},b=$=>{const K=dp($)?$(x()):$;if(!K)return;const G=K.map(H=>{var L,F;const B=(F=(L=t.implementations)==null?void 0:L.effects)==null?void 0:F[H];return B||zG(`[zag-js] No implementation found for effect "${JSON.stringify(H)}"`),B}),Y=[];for(const H of G){const B=H==null?void 0:H(x());B&&Y.push(B)}return()=>Y.forEach(H=>H==null?void 0:H())},w=$=>Pat($).find(K=>{let G=!K.guard;return PA(K.guard)?G=!!v(K.guard):dp(K.guard)&&(G=K.guard(x())),G}),j=$=>{Yat(t.computed,()=>"[zag-js] No computed object found on machine");const K=t.computed[$];return K({context:c,event:p(),prop:i,refs:m,scope:r,computed:j})},N=ik(()=>({defaultValue:t.initialState({prop:i}),onChange($,K){var Y,H,B,L;if(K){const F=u.current.get(K);F==null||F(),u.current.delete(K)}K&&y((Y=t.states[K])==null?void 0:Y.exit),y((H=d.current)==null?void 0:H.actions);const G=b((B=t.states[$])==null?void 0:B.effects);if(G&&u.current.set($,G),K===pI){y(t.entry);const F=b(t.effects);F&&u.current.set(pI,F)}y((L=t.states[$])==null?void 0:L.entry)}})),C=S.useRef(void 0),k=S.useRef(Ug.NotStarted);Vue(()=>{queueMicrotask(()=>{const G=k.current===Ug.Started;k.current=Ug.Started,n(G?"rehydrating...":"initializing...");const Y=C.current??N.initial;N.invoke(Y,G?N.get():pI)});const $=u.current,K=N.ref.current;return()=>{n("unmounting..."),C.current=K,k.current=Ug.Stopped,$.forEach(G=>G==null?void 0:G()),u.current=new Map,d.current=null,queueMicrotask(()=>{y(t.exit)})}},[]);const E=()=>"ref"in N?N.ref.current:N.get(),M=$=>{queueMicrotask(()=>{var L,F;if(k.current!==Ug.Started)return;h.current=f.current,f.current=$;let K=E();const G=((L=t.states[K].on)==null?void 0:L[$.type])??((F=t.on)==null?void 0:F[$.type]),Y=w(G);if(!Y)return;d.current=Y;const H=Y.target??K;n("transition",$.type,Y.target||K,`(${Y.actions})`);const B=H!==K;B?Ac.flushSync(()=>N.set(H)):Y.reenter&&!B?N.invoke(K,K):y(Y.actions??[])})};return(A=t.watch)==null||A.call(t,x()),{state:g(),send:M,context:c,prop:i,scope:r,refs:m,computed:j,event:p(),getStatus:()=>k.current}}function que(t){const e=S.useRef(t);return e.current=t,e}function dot(t){const e=que(t);return function(n){return e.current[n]}}function WG(t){queueMicrotask(()=>{Ac.flushSync(()=>t())})}var hot=aot(t=>t);const Gue=()=>(t,e)=>e.reduce((r,n)=>{const[s,i]=r,o=n;return i[o]!==void 0&&(s[o]=i[o]),delete i[o],[s,i]},[{},{...t}]);function fot(...t){return e=>{const r=[];for(const n of t)if(typeof n=="function"){const s=n(e);typeof s=="function"&&r.push(s)}else n&&(n.current=e);if(r.length)return()=>{for(const n of r)n()}}}function pot(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}const mI=t=>{const e=S.memo(S.forwardRef((r,n)=>{const{asChild:s,children:i,...o}=r;if(!s)return S.createElement(t,{...o,ref:n},i);if(!S.isValidElement(i))return null;const l=S.Children.only(i),c=pot(l);return S.cloneElement(l,{...B2(o,l.props),ref:n?fot(n,c):c})}));return e.displayName=t.displayName||t.name,e},mot=()=>{const t=new Map;return new Proxy(mI,{apply(e,r,n){return mI(n[0])},get(e,r){const n=r;return t.has(n)||t.set(n,mI(n)),t.get(n)}})},q8=mot();function got(t,e){return`${t} returned \`undefined\`. Seems you forgot to wrap component within ${e}`}function Kue(t={}){const{name:e,strict:r=!0,hookName:n="useContext",providerName:s="Provider",errorMessage:i,defaultValue:o}=t,l=S.createContext(o);l.displayName=e;function c(){const u=S.useContext(l);if(!u&&r){const d=new Error(i??got(n,s));throw d.name="ContextError",Fue(Error,"captureStackTrace")&&dp(Error.captureStackTrace)&&Error.captureStackTrace(d,c),d}return u}return[l.Provider,c,l]}const[yot,Yue]=Kue({name:"TimerContext",hookName:"useTimerContext",providerName:"<TimerProvider />"}),Xue=S.forwardRef((t,e)=>{const r=Yue(),n=B2(r.getAreaProps(),t);return a.jsx(q8.div,{...n,ref:e})});Xue.displayName="TimerArea";const xot=Gue(),P0=S.forwardRef((t,e)=>{const[r,n]=xot(t,["type"]),s=Yue(),i=B2(s.getItemProps(r),n);return a.jsx(q8.div,{...i,ref:e,children:s.formattedTime[r.type]})});P0.displayName="TimerItem";var O0=(t,e=[])=>({parts:(...r)=>{if(vot(e))return O0(t,r);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...r)=>O0(t,[...e,...r]),omit:(...r)=>O0(t,e.filter(n=>!r.includes(n))),rename:r=>O0(r,e),keys:()=>e,build:()=>[...new Set(e)].reduce((r,n)=>Object.assign(r,{[n]:{selector:[`&[data-scope="${Mg(t)}"][data-part="${Mg(n)}"]`,`& [data-scope="${Mg(t)}"][data-part="${Mg(n)}"]`].join(", "),attrs:{"data-scope":Mg(t),"data-part":Mg(n)}}}),{})}),Mg=t=>t.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),vot=t=>t.length===0,bot=O0("timer").parts("root","area","control","item","itemValue","itemLabel","actionTrigger","separator"),wd=bot.build(),wot=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`timer:${t.id}:root`},_ot=t=>{var e;return((e=t.ids)==null?void 0:e.area)??`timer:${t.id}:area`},VG=new Set(["start","pause","resume","reset","restart"]);function jot(t,e){const{state:r,send:n,computed:s,scope:i}=t,o=r.matches("running"),l=r.matches("paused"),c=s("time"),u=s("formattedTime"),d=s("progressPercent");return{running:o,paused:l,time:c,formattedTime:u,progressPercent:d,start(){n({type:"START"})},pause(){n({type:"PAUSE"})},resume(){n({type:"RESUME"})},reset(){n({type:"RESET"})},restart(){n({type:"RESTART"})},getRootProps(){return e.element({id:wot(i),...wd.root.attrs})},getAreaProps(){return e.element({role:"timer",id:_ot(i),"aria-label":`${c.days} days ${u.hours}:${u.minutes}:${u.seconds}`,"aria-atomic":!0,...wd.area.attrs})},getControlProps(){return e.element({...wd.control.attrs})},getItemProps(h){const f=c[h.type];return e.element({...wd.item.attrs,"data-type":h.type,style:{"--value":f}})},getItemLabelProps(h){return e.element({...wd.itemLabel.attrs,"data-type":h.type})},getItemValueProps(h){return e.element({...wd.itemValue.attrs,"data-type":h.type})},getSeparatorProps(){return e.element({"aria-hidden":!0,...wd.separator.attrs})},getActionTriggerProps(h){if(!VG.has(h.action))throw new Error(`[zag-js] Invalid action: ${h.action}. Must be one of: ${Array.from(VG).join(", ")}`);return e.button({...wd.actionTrigger.attrs,hidden:Bue(h.action,{start:()=>o||l,pause:()=>!o,reset:()=>!o&&!l,resume:()=>!l,restart:()=>!1}),type:"button",onClick(f){f.defaultPrevented||n({type:h.action.toUpperCase()})}})}}}var Sot={props({props:t}){return Cot(t),{interval:1e3,startMs:0,...t}},initialState({prop:t}){return t("autoStart")?"running":"idle"},context({prop:t,bindable:e}){return{currentMs:e(()=>({defaultValue:t("startMs")}))}},watch({track:t,send:e,prop:r}){t([()=>r("startMs")],()=>{e({type:"RESTART"})})},on:{RESTART:{target:"running:temp",actions:["resetTime"]}},computed:{time:({context:t})=>Not(t.get("currentMs")),formattedTime:({computed:t})=>Eot(t("time")),progressPercent:sot(({context:t,prop:e})=>[t.get("currentMs"),e("targetMs"),e("startMs"),e("countdown")],([t,e=0,r,n])=>{const s=n?qG(t,e,r):qG(t,r,e);return qat(s,0,1)})},states:{idle:{on:{START:{target:"running"},RESET:{actions:["resetTime"]}}},"running:temp":{effects:["waitForNextTick"],on:{CONTINUE:{target:"running"}}},running:{effects:["keepTicking"],on:{PAUSE:{target:"paused"},TICK:[{target:"idle",guard:"hasReachedTarget",actions:["invokeOnComplete"]},{actions:["updateTime","invokeOnTick"]}],RESET:{actions:["resetTime"]}}},paused:{on:{RESUME:{target:"running"},RESET:{target:"idle",actions:["resetTime"]}}}},implementations:{effects:{keepTicking({prop:t,send:e}){return Gat(({deltaMs:r})=>{e({type:"TICK",deltaMs:r})},t("interval"))},waitForNextTick({send:t}){return Kat(()=>{t({type:"CONTINUE"})},0)}},actions:{updateTime({context:t,prop:e,event:r}){const n=e("countdown")?-1:1,s=Aot(r.deltaMs,e("interval"));t.set("currentMs",i=>{const o=i+n*s;let l=e("targetMs");return l==null&&e("countdown")&&(l=0),e("countdown")&&l!=null?Math.max(o,l):!e("countdown")&&l!=null?Math.min(o,l):o})},resetTime({context:t,prop:e}){let r=e("targetMs");r==null&&e("countdown")&&(r=0),t.set("currentMs",e("startMs")??0)},invokeOnTick({context:t,prop:e,computed:r}){var n;(n=e("onTick"))==null||n({value:t.get("currentMs"),time:r("time"),formattedTime:r("formattedTime")})},invokeOnComplete({prop:t}){var e;(e=t("onComplete"))==null||e()}},guards:{hasReachedTarget:({context:t,prop:e})=>{let r=e("targetMs");if(r==null&&e("countdown")&&(r=0),r==null)return!1;const n=t.get("currentMs");return e("countdown")?n<=r:n>=r}}}};function Not(t){const e=Math.max(0,t),r=e%1e3,n=Math.floor(e/1e3)%60,s=Math.floor(e/(1e3*60))%60,i=Math.floor(e/(1e3*60*60))%24;return{days:Math.floor(e/(1e3*60*60*24)),hours:i,minutes:s,seconds:n,milliseconds:r}}function qG(t,e,r){const n=r-e;return n===0?0:(t-e)/n}function c0(t,e=2){return t.toString().padStart(e,"0")}function Aot(t,e){return Math.floor(t/e)*e}function Eot(t){const{days:e,hours:r,minutes:n,seconds:s}=t;return{days:c0(e),hours:c0(r),minutes:c0(n),seconds:c0(s),milliseconds:c0(t.milliseconds,3)}}function Cot(t){const{startMs:e,targetMs:r,countdown:n,interval:s}=t;if(s!=null&&(typeof s!="number"||s<=0))throw new Error(`[timer] Invalid interval: ${s}. Must be a positive number.`);if(e!=null&&(typeof e!="number"||e<0))throw new Error(`[timer] Invalid startMs: ${e}. Must be a non-negative number.`);if(r!=null&&(typeof r!="number"||r<0))throw new Error(`[timer] Invalid targetMs: ${r}. Must be a non-negative number.`);if(n&&e!=null&&r!=null&&e<=r)throw new Error(`[timer] Invalid countdown configuration: startMs (${e}) must be greater than targetMs (${r}).`);if(!n&&e!=null&&r!=null&&e>=r)throw new Error(`[timer] Invalid stopwatch configuration: startMs (${e}) must be less than targetMs (${r}).`);if(n&&r==null&&e!=null&&e<=0)throw new Error(`[timer] Invalid countdown configuration: startMs (${e}) must be greater than 0 when no targetMs is provided.`)}oot()(["autoStart","countdown","getRootNode","id","ids","interval","onComplete","onTick","startMs","targetMs"]);const[nxt,kot]=Kue({name:"EnvironmentContext",hookName:"useEnvironmentContext",providerName:"<EnvironmentProvider />",strict:!1,defaultValue:{getRootNode:()=>document,getDocument:()=>document,getWindow:()=>window}}),Tot=t=>{const e=S.useId(),{getRootNode:r}=kot(),n={id:e,getRootNode:r,...t},s=uot(Sot,n);return jot(s,hot)},Pot=Gue(),Que=S.forwardRef((t,e)=>{const[r,n]=Pot(t,["id","ids","autoStart","interval","countdown","startMs","targetMs","onComplete","onTick"]),s=Tot(r),i=B2(s.getRootProps(),n);return a.jsx(yot,{value:s,children:a.jsx(q8.div,{...i,ref:e})})});Que.displayName="TimerRoot";const Oot="2026-05-04",Iot=[{value:"may_2026",label:"May 2026"},{value:"June_2026",label:"June 2026"},{value:"July_2026",label:"July 2026"},{value:"later",label:"Later / not sure yet"}],Rot=[{value:"qualitative",label:"Qualitative"},{value:"quantitative",label:"Quantitative"},{value:"mixed",label:"Mixed methods"},{value:"not_sure",label:"Not sure yet"}];function Mot(){const[t,e]=S.useState(""),[r,n]=S.useState(""),[s,i]=S.useState(""),[o,l]=S.useState(!1),[c,u]=S.useState(!1),[d,h]=S.useState(!1),f=async m=>{if(m.preventDefault(),!t){$e.error("Please enter your email address");return}if(!o){$e.error("Please accept the privacy terms to join the waitlist");return}u(!0);try{const x=new Date().toISOString(),{error:y}=await be.from("waitlist_signups").insert({email:t.toLowerCase().trim(),planned_start:r||null,research_method:s||null,source:"landingpage",privacy_accepted_at:x,privacy_version:Oot,marketing_consent:!0,marketing_consent_at:x});if(y)if(y.code==="23505")$e.error("This email is already on the waitlist!");else throw y;else h(!0),$e.success("You're on the list!")}catch(x){console.error("Waitlist signup error:",x),$e.error("Something went wrong. Please try again.")}finally{u(!1)}},g=(()=>{const m=new Date("2026-05-30T23:59:59"),x=new Date;return Math.max(0,m.getTime()-x.getTime())})();return a.jsxs(a.Fragment,{children:[a.jsx(ai,{title:"Join the Waitlist - Early Access to Academly",description:"Join the Academly beta — AI thesis writing tool for Bachelor and Master students. Real citations from your own PDFs. Free to try.",canonical:"https://academly.ai/waitlist"}),a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(Jn,{}),a.jsxs("div",{className:"relative pt-32 pb-20",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 grid grid-cols-2 -space-x-52 opacity-40 dark:opacity-20",children:[a.jsx("div",{className:"blur-[106px] h-56 bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-32 bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(jr,{children:a.jsx("div",{className:"relative",children:a.jsxs("div",{className:"mx-auto max-w-2xl text-center",children:[a.jsxs("h1",{className:"text-4xl font-bold tracking-tight text-foreground sm:text-5xl md:text-6xl",children:["Get early access to ",a.jsx("span",{className:"text-primary",children:"Academly"})]}),a.jsx("p",{className:"mt-6 text-lg leading-8 text-muted-foreground",children:"Join the waitlist to be among the first students and researchers using AI for structured academic work."}),a.jsx("div",{className:"mt-12",children:g>0?a.jsx(Que,{autoStart:!0,countdown:!0,startMs:g,children:a.jsxs(Xue,{className:"flex flex-col items-center",children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-4 uppercase tracking-wider",children:"Public Beta Launches In"}),a.jsxs("div",{className:"flex items-center gap-2 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-col items-center rounded-2xl bg-card border border-border px-4 py-3 sm:px-6 sm:py-4 shadow-lg shadow-primary/5",children:[a.jsx(P0,{type:"days",className:"text-3xl sm:text-5xl font-bold text-foreground tabular-nums"}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"days"})]}),a.jsx("span",{className:"text-2xl sm:text-4xl font-light text-muted-foreground/50",children:":"}),a.jsxs("div",{className:"flex flex-col items-center rounded-2xl bg-card border border-border px-4 py-3 sm:px-6 sm:py-4 shadow-lg shadow-primary/5",children:[a.jsx(P0,{type:"hours",className:"text-3xl sm:text-5xl font-bold text-foreground tabular-nums"}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"hrs"})]}),a.jsx("span",{className:"text-2xl sm:text-4xl font-light text-muted-foreground/50",children:":"}),a.jsxs("div",{className:"flex flex-col items-center rounded-2xl bg-card border border-border px-4 py-3 sm:px-6 sm:py-4 shadow-lg shadow-primary/5",children:[a.jsx(P0,{type:"minutes",className:"text-3xl sm:text-5xl font-bold text-foreground tabular-nums"}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"min"})]}),a.jsx("span",{className:"text-2xl sm:text-4xl font-light text-muted-foreground/50",children:":"}),a.jsxs("div",{className:"flex flex-col items-center rounded-2xl bg-card border border-border px-4 py-3 sm:px-6 sm:py-4 shadow-lg shadow-primary/5",children:[a.jsx(P0,{type:"seconds",className:"text-3xl sm:text-5xl font-bold text-foreground tabular-nums"}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"sec"})]})]})]})}):a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-4 uppercase tracking-wider",children:"Public Beta"}),a.jsx("p",{className:"text-3xl sm:text-5xl font-bold text-primary",children:"Launching soon!"})]})})]})})})]}),a.jsx("section",{className:"pb-20 px-6 lg:px-12",children:a.jsx(jr,{children:a.jsx("div",{className:"mx-auto max-w-md",children:d?a.jsxs("div",{className:"rounded-3xl border border-border bg-card p-8 shadow-xl shadow-primary/5 text-center animate-fade-in",children:[a.jsx("div",{className:"mx-auto mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-success/10",children:a.jsx(gl,{className:"h-8 w-8 text-success"})}),a.jsx("h3",{className:"text-2xl font-semibold text-foreground",children:"You're on the list!"}),a.jsx("p",{className:"mt-3 text-muted-foreground",children:"We'll notify you when we launch. Check your inbox for updates."})]}):a.jsx("form",{onSubmit:f,className:"rounded-3xl border border-border bg-card p-8 shadow-xl shadow-primary/5",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"email",className:"flex items-center gap-2",children:[a.jsx(YJ,{className:"h-4 w-4 text-muted-foreground"}),"Email address ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Fe,{id:"email",type:"email",placeholder:"you@university.edu",value:t,onChange:m=>e(m.target.value),required:!0,className:"h-12"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"planned-start",children:"Planned start (optional)"}),a.jsxs(at,{value:r,onValueChange:n,children:[a.jsx(nt,{id:"planned-start",className:"h-12",children:a.jsx(ot,{placeholder:"Select..."})}),a.jsx(st,{children:Iot.map(m=>a.jsx(Te,{value:m.value,children:m.label},m.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"research-method",children:"Research method (optional)"}),a.jsxs(at,{value:s,onValueChange:i,children:[a.jsx(nt,{id:"research-method",className:"h-12",children:a.jsx(ot,{placeholder:"Select..."})}),a.jsx(st,{children:Rot.map(m=>a.jsx(Te,{value:m.value,children:m.label},m.value))})]})]}),a.jsxs(Due,{id:"marketing-consent",checked:o,onCheckedChange:l,required:!0,children:["I agree that Academly may contact me about early access and product updates. I have read the"," ",a.jsx(tt,{to:"/legal?tab=privacy",className:"text-primary hover:underline font-medium",target:"_blank",children:"Privacy Policy"}),"."]}),a.jsx(ye,{type:"submit",size:"lg",className:"w-full h-12 text-base font-semibold rounded-full",disabled:c||!o,children:c?"Joining...":"Join the Waitlist"}),a.jsxs("p",{className:"flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[a.jsx($F,{className:"h-3 w-3"}),"No spam. No data sharing. Unsubscribe anytime."]})]})})})})}),a.jsx(Ds,{})]})]})}var U2="Tabs",[Dot,sxt]=Bn(U2,[mb]),Zue=mb(),[Lot,G8]=Dot(U2),Jue=S.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=t,d=cg(l),[h,f]=Ms({prop:n,onChange:s,defaultProp:i??"",caller:U2});return a.jsx(Lot,{scope:r,baseId:Yi(),value:h,onValueChange:f,orientation:o,dir:d,activationMode:c,children:a.jsx(et.div,{dir:d,"data-orientation":o,...u,ref:e})})});Jue.displayName=U2;var ede="TabsList",tde=S.forwardRef((t,e)=>{const{__scopeTabs:r,loop:n=!0,...s}=t,i=G8(ede,r),o=Zue(r);return a.jsx(m6,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:n,children:a.jsx(et.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});tde.displayName=ede;var rde="TabsTrigger",nde=S.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...i}=t,o=G8(rde,r),l=Zue(r),c=ade(o.baseId,n),u=ode(o.baseId,n),d=n===o.value;return a.jsx(g6,{asChild:!0,...l,focusable:!s,active:d,children:a.jsx(et.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:ze(t.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?o.onValueChange(n):h.preventDefault()}),onKeyDown:ze(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(n)}),onFocus:ze(t.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!s&&h&&o.onValueChange(n)})})})});nde.displayName=rde;var sde="TabsContent",ide=S.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,forceMount:s,children:i,...o}=t,l=G8(sde,r),c=ade(l.baseId,n),u=ode(l.baseId,n),d=n===l.value,h=S.useRef(d);return S.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),a.jsx(es,{present:s||d,children:({present:f})=>a.jsx(et.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:u,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:h.current?"0s":void 0},children:f&&i})})});ide.displayName=sde;function ade(t,e){return`${t}-trigger-${e}`}function ode(t,e){return`${t}-content-${e}`}var Fot=Jue,lde=tde,cde=nde,ude=ide;const d5=Fot,ak=S.forwardRef(({className:t,...e},r)=>a.jsx(lde,{ref:r,className:Ie("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));ak.displayName=lde.displayName;const Id=S.forwardRef(({className:t,...e},r)=>a.jsx(cde,{ref:r,className:Ie("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...e}));Id.displayName=cde.displayName;const Rd=S.forwardRef(({className:t,...e},r)=>a.jsx(ude,{ref:r,className:Ie("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));Rd.displayName=ude.displayName;const $ot=()=>{const[t]=Dj(),e=t.get("tab"),[r,n]=S.useState(e==="privacy"?"privacy":"terms");return S.useEffect(()=>{(e==="privacy"||e==="terms")&&n(e)},[e]),a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"Terms of Service & Privacy Policy | Academly.ai",description:"Terms of Service and Privacy Policy for Academly.ai — GDPR compliant AI thesis writing platform.",canonical:"https://academly.ai/legal"}),a.jsx(Jn,{}),a.jsxs("section",{className:"relative pt-32 pb-12",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsx(jr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-3xl mx-auto",children:[a.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-foreground mb-6",children:"Legal Information"}),a.jsx("p",{className:"text-xl text-muted-foreground",children:"Transparency and trust are important to us"})]})})]}),a.jsx("section",{className:"py-12 pb-20",children:a.jsx(jr,{children:a.jsx("div",{className:"max-w-4xl mx-auto",children:a.jsxs(d5,{value:r,onValueChange:n,className:"w-full",children:[a.jsxs(ak,{className:"grid w-full grid-cols-2 rounded-full p-1 h-14 bg-muted",children:[a.jsx(Id,{value:"terms",className:"rounded-full data-[state=active]:bg-background data-[state=active]:shadow-sm h-12 text-base font-medium",children:"Terms of Service"}),a.jsx(Id,{value:"privacy",className:"rounded-full data-[state=active]:bg-background data-[state=active]:shadow-sm h-12 text-base font-medium",children:"Privacy Policy"})]}),a.jsx(Rd,{value:"terms",className:"mt-8",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card p-8 md:p-12",children:[a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"TERMS OF SERVICE"}),a.jsxs("p",{className:"text-muted-foreground mb-8",children:["for the use of the SaaS platform Academly.ai",a.jsx("br",{}),"Effective: 15 January 2026, last amended May 2026"]}),a.jsxs("div",{className:"space-y-8 text-muted-foreground leading-relaxed",children:[a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"1. Scope and Contracting Parties"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.1 Provider"}),a.jsx("p",{children:'The provider of the platform available under the domain academly.ai (hereinafter the "Platform" or "Service") is:'}),a.jsxs("p",{className:"mt-2",children:["Academly (Dominik Dunst)",a.jsx("br",{}),"Contact: contact@academly.ai"]}),a.jsx("p",{className:"mt-2",children:"Academly.ai is currently intended exclusively for consumers (B2C). Use for commercial or business purposes is only permitted if the Provider expressly agrees to this on a case-by-case basis."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.2 Scope of these Terms"}),a.jsx("p",{children:'These Terms of Service govern the contractual relationship between the Provider and users of the Platform ("Users"). They apply to all functions offered via the Platform, in particular AI-assisted processing, document processing, quota/credit models ("Student Points"), as well as export and storage functions.'}),a.jsx("p",{className:"mt-2",children:"Any deviating, conflicting, or additional terms of the User shall not become part of the contract unless the Provider expressly agrees to them in writing."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.3 Changes to these Terms"}),a.jsx("p",{children:"The Provider may amend these Terms with effect for the future if there are objective reasons for doing so (e.g., changes in law, technical developments, adjustments to the Service). Changes that are not merely insignificant for Users will be announced at least four (4) weeks before they take effect by email to the address stored in the User account. If the User does not object within that period, the changes will be deemed accepted. The User will be explicitly informed of this consequence in the change notice."}),a.jsx("p",{className:"mt-2",children:"If the User objects in due time, the Provider may terminate the contract as of the date the new Terms would take effect."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"2. Service Description"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.1 Description of the Platform"}),a.jsx("p",{children:"The Platform is an AI-supported, web-based software-as-a-service (SaaS) solution designed to support academic workflows. In particular, it enables the uploading and processing of documents, the generation of summaries, outlines and text drafts, as well as additional functions for structuring academic content."}),a.jsx("p",{className:"mt-2",children:"Which features are available in detail depends on the plan selected by the User and may change as the product evolves."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.2 AI-assisted Functions"}),a.jsx("p",{children:"Academly.ai provides AI-assisted features that may vary depending on the selected plan. These include in particular:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"AI-generated summaries of uploaded content, structured and condensed;"}),a.jsx("li",{children:"outline/structure and drafting functions (e.g., theory, methodology, or structural building blocks);"}),a.jsx("li",{children:"document analysis (e.g., identification of relevant passages, structural suggestions, extraction)."})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Important:"})," All AI outputs are working drafts. They do not replace the User's own academic work. Outputs may contain errors, omissions, or outdated information and must be reviewed independently by the User."]}),a.jsx("p",{className:"mt-2",children:"To provide AI features, the Provider may use technical subcontractors (e.g., AI models via API providers). Details on service providers, data categories, and any transfers to third countries (if applicable) are set out in the Privacy Policy."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.3 Document Processing"}),a.jsx("p",{children:"Users may upload documents (e.g., PDF and other supported formats) to the Platform. Supported formats and any upload limits (e.g., file size, number of uploads, quotas) depend on the selected plan and are displayed within the Platform and/or on the pricing page. The Provider may adjust such limits for technical or security reasons."}),a.jsx("p",{className:"mt-2",children:"The User represents that they are entitled to use and upload the respective documents and that no third-party rights are infringed."}),a.jsx("p",{className:"mt-2",children:"Uploaded documents are stored and processed in order to provide Platform functionality. Details on data processing and service providers are governed by the Privacy Policy."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.4 Export and Backup Features"}),a.jsx("p",{children:"Users may export generated content—especially summaries, outlines, and drafts—in common formats (e.g., DOCX, TXT) and store it locally."}),a.jsx("p",{className:"mt-2",children:"The Platform may provide features for exporting/transferring User-related content. The Provider recommends regularly creating exports of your content. The Provider does not guarantee permanent storage of all User data beyond the term of the contract."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.5 Use in Different Countries"}),a.jsx("p",{children:"The Services are not intended for use in jurisdictions where providing or using the Services would violate applicable laws or regulations or would subject the Provider to special registration, licensing, or supervisory requirements. Users accessing the Platform from outside Austria do so on their own initiative and are solely responsible for complying with local legal requirements to the extent applicable."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.6 Changes, Corrections and Further Development"}),a.jsx("p",{children:"The Provider is entitled to develop, change, supplement, or restrict the Platform and individual functions, insofar as (i) this is necessary to improve the Service, maintain security, or ensure legal compliance, or (ii) it is reasonable for the User and does not materially impair the purpose of the contract. Obvious errors (e.g., in displays, descriptions, or calculations) may be corrected at any time."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.7 Third-party Offers and Links"}),a.jsx("p",{children:"To the extent the Platform contains links to websites or content of third parties, these are provided for informational purposes only. The respective third party is solely responsible for the content, availability, and data protection practices. The Provider only reviews such content to the extent required by law."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"3. Registration and User Account"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.1 Registration Requirements"}),a.jsx("p",{children:"Use of the Platform is only permitted for persons who have reached the age of 18. By registering, the User confirms that they are of legal age."}),a.jsx("p",{className:"mt-2",children:"The User must provide truthful and complete information during registration. As a rule, only one account per User is permitted. Access credentials must not be shared."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.2 Account Security"}),a.jsx("p",{children:"The User must keep their password confidential and take appropriate measures to prevent unauthorized access. Activities carried out using the account will generally be attributed to the User to the extent the User is responsible for the misuse."}),a.jsx("p",{className:"mt-2",children:"If misuse or security incidents are suspected, the Provider must be informed without undue delay at contact@academly.ai."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.3 Account Termination and Deletion"}),a.jsx("p",{children:"The User may terminate their account at any time—either via available account functions or by notifying contact@academly.ai. Personal data will be deleted in accordance with the GDPR unless statutory retention obligations or legitimate interests (e.g., legal enforcement) require further storage."}),a.jsx("p",{className:"mt-2",children:"The Provider may block or delete accounts in the event of violations of these Terms. As a rule, the User will receive a prior warning. In the case of serious violations, immediate suspension may be carried out."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"4. Subscriptions and Payments"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.1 Available Plans"}),a.jsx("p",{children:"The Platform offers plans that differ in particular with respect to quotas (e.g., Student Points), feature scope, support level, and usage limits. Current plans and details are displayed within the Platform and on the pricing page and form part of the service description."}),a.jsx("p",{className:"mt-2",children:"Prices are stated inclusive of VAT where applicable, or plus any taxes that may apply depending on the User's country of residence/billing location."}),a.jsx("p",{className:"mt-2",children:"The Provider may adjust prices and plan details for future billing periods. Changes will be announced before becoming effective; ongoing subscriptions are only affected from the next renewal."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.2 Payments via Stripe"}),a.jsx("p",{children:"Payments are processed via Stripe. For processing, necessary payment data is transmitted to Stripe. The Provider does not store full payment details (e.g., credit card numbers). In the event of payment default or failed charges, the Provider may suspend access to paid features until outstanding amounts are settled."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.3 Right of Withdrawal (Consumers) – Austria"}),a.jsx("p",{children:"Consumers generally have a statutory right of withdrawal. The withdrawal period is fourteen (14) days from the conclusion of the contract unless otherwise provided by law."}),a.jsx("p",{className:"mt-2",children:"To exercise the right of withdrawal, the User must inform the Provider of the decision to withdraw by an unequivocal statement (e.g., by email or post). Withdrawal notices should be sent to: Email: contact@academly.ai"}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Consequences of withdrawal:"})," In the event of an effective withdrawal, services received shall be returned/refunded in accordance with statutory provisions."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Early expiry of the right of withdrawal:"})," For digital content and digital services, the right of withdrawal may expire early if the User expressly requests that the Provider begin performance before the withdrawal period ends and the User confirms that they thereby lose the right of withdrawal once the service has been provided or made available."]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"5. Usage Rights and Restrictions"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"5.1 Granted Usage Rights"}),a.jsx("p",{children:"The Provider grants the User a non-exclusive, non-transferable, non-sublicensable right to use the Platform during the term of the contract within the scope of the booked plan. Use is limited to personal, academic purposes. Any commercial use requires prior written consent of the Provider."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"5.2 Prohibited Use"}),a.jsx("p",{children:"In particular, it is prohibited to use the Platform to create unlawful content or to infringe third-party rights. It is also prohibited to bypass security mechanisms, conduct automated mass access without permission, share accounts, or distribute malware or spam."}),a.jsx("p",{className:"mt-2",children:"The Platform must not be used to present AI outputs as the User's own academic work without appropriate own contribution and without proper labeling/citation work."}),a.jsx("p",{className:"mt-2",children:"In particular, the following is also prohibited:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"systematically reading or extracting data (scraping) without permission;"}),a.jsx("li",{children:"bypassing or manipulating technical protection measures;"}),a.jsx("li",{children:"reverse engineering, decompilation, or other analysis of the Platform unless mandatory law permits it;"}),a.jsx("li",{children:"using automated systems or scripts that place excessive load on the Platform;"}),a.jsx("li",{children:"using the Platform to deceive third parties (e.g., phishing, identity misuse);"}),a.jsx("li",{children:"uploading content that infringes third-party rights;"}),a.jsx("li",{children:"introducing malware or other disruptions;"}),a.jsx("li",{children:"account sharing or allowing multiple persons to use one account."})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"5.3 Fair Use and Abuse Prevention"}),a.jsx("p",{children:"The Provider may restrict use if abusive or excessive usage is identified, in particular in cases of systematic mass processing, circumvention of plan limits, or usage by multiple persons via one account. Where possible, the User will be informed in advance, unless immediate action is necessary to prevent harm."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"6. Intellectual Property"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.1 Rights in the Platform"}),a.jsx("p",{children:"All rights in the Platform (software, design, logos, texts, trademarks) remain with the Provider or its licensors. The User receives no rights beyond the granted usage right."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Trademark notice:"}),` "Academly.ai" is currently used as a product/project name. To the best of the Provider's knowledge, no registered trademark exists at this time.`]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.2 Rights in User Content"}),a.jsx("p",{children:'The User retains all rights in content uploaded to the Platform ("User Content"). By uploading, the User grants the Provider the right to store and process such content insofar as necessary to provide the Services.'})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.3 Rights in AI-generated Content"}),a.jsx("p",{children:"AI-generated content may be used by the User within the scope of Platform usage. The User acknowledges that AI outputs may not constitute works protected by copyright and that third-party rights cannot be excluded in individual cases. The User is responsible for review, use, and proper citation."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.4 Feedback"}),a.jsx("p",{children:"If the User voluntarily submits feedback, ideas, or improvement suggestions to the Provider, the Provider may use them free of charge, worldwide and without time limitation, to improve the Platform. Personal data will only be processed in accordance with the Privacy Policy."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"7. Academic Integrity and Notices"}),a.jsx("p",{children:"Academly.ai is a tool. The Provider does not guarantee academic success. Users are required to independently review content, cite sources correctly, and comply with the rules of their university/institution. The Provider assumes no liability for consequences arising from plagiarism, violations of academic rules, or improper use of the content."})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"8. Limitation of Liability"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:'8.1 Platform Availability ("Best Effort")'}),a.jsx("p",{children:'The Provider uses reasonable efforts to ensure high availability of the Platform within technical and operational possibilities ("best effort"). There is no entitlement to uninterrupted availability at all times. In particular, maintenance, further development, security measures, technical issues, or force majeure events may lead to temporary restrictions.'}),a.jsx("p",{className:"mt-2",children:"Planned maintenance will be announced in advance where possible and, where feasible, carried out during times of lower usage. The Provider is not liable for outages or restrictions caused by circumstances outside its control, in particular issues with third-party providers and subcontractors (e.g., hosting, database, payment, or AI providers) or general network failures."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"8.2 Data Loss"}),a.jsx("p",{children:"The Provider takes reasonable measures for data backup but does not guarantee full recoverability in all cases. Users should regularly create exports/backups of their content."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"8.3 Liability Cap"}),a.jsx("p",{children:"In cases of slight negligence, the Provider is only liable if essential contractual obligations (cardinal obligations) are breached, and then only for foreseeable, typical damage. To the extent legally permissible, the Provider's total liability is limited in amount to the fees actually paid by the User to the Provider during the last twelve (12) months before the damaging event occurred."}),a.jsx("p",{className:"mt-2",children:"These limitations do not apply in cases of intent or gross negligence, injury to life, body or health, or mandatory statutory liability provisions."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"9. Final Provisions"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.1 Governing Law"}),a.jsx("p",{children:"Austrian law applies, excluding the UN Convention on Contracts for the International Sale of Goods (CISG). Mandatory consumer protection provisions of the User's country of residence remain unaffected."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.2 Jurisdiction and Dispute Resolution"}),a.jsxs("p",{children:["For consumers, the statutory places of jurisdiction apply. The Provider is neither obliged nor willing to participate in dispute resolution proceedings before a consumer arbitration board. The EU Online Dispute Resolution platform is available at:"," ",a.jsx("a",{href:"https://ec.europa.eu/consumers/odr",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://ec.europa.eu/consumers/odr"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.3 Severability"}),a.jsx("p",{children:"If any provision of these Terms is or becomes invalid, the remainder of the agreement remains effective. An effective provision that most closely reflects the economic purpose of the invalid provision shall be deemed agreed."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.4 Contact"}),a.jsx("p",{children:"Questions or complaints may be sent to contact@academly.ai."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.5 Electronic Communication"}),a.jsx("p",{children:"The User agrees that contractual notices and declarations by the Provider may generally be made electronically (e.g., by email or within the Platform), to the extent legally permissible."})]})]})]})]})]})}),a.jsx(Rd,{value:"privacy",className:"mt-8",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card p-8 md:p-12",children:[a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"PRIVACY POLICY"}),a.jsxs("p",{className:"text-muted-foreground mb-8",children:["for the use of the SaaS platform Academly.ai",a.jsx("br",{}),"Last updated: May 2026"]}),a.jsxs("div",{className:"space-y-8 text-muted-foreground leading-relaxed",children:[a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"1. Introduction and Controller"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.1 Controller name and contact details"}),a.jsx("p",{children:"The controller within the meaning of the General Data Protection Regulation (GDPR) and other applicable data protection laws is:"}),a.jsxs("p",{className:"mt-2",children:["Academly (Dominik Dunst)",a.jsx("br",{}),"Email: contact@academly.ai"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.2 Data Protection Officer"}),a.jsx("p",{children:"The appointment of a Data Protection Officer is currently not required under Art. 37 GDPR, as the statutory requirements are not met."}),a.jsx("p",{className:"mt-2",children:"For any data protection inquiries, please contact us using the contact details above."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.3 Scope of this Privacy Policy"}),a.jsx("p",{children:"This Privacy Policy applies to the platform accessible under the domain academly.ai and all related services, including mobile access and linked subdomains. It informs you about the nature, scope and purposes of the collection and use of personal data by the controller."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"2. Principles of Data Processing"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.1 Legal bases for processing"}),a.jsx("p",{children:"We process personal data only on the basis of one of the following legal bases under Art. 6(1) GDPR:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-2",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"(a) Consent (Art. 6(1)(a) GDPR)"}),a.jsx("br",{}),"Where we obtain your consent for specific processing activities, your consent forms the legal basis. You may withdraw your consent at any time with effect for the future."]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"(b) Performance of a contract (Art. 6(1)(b) GDPR)"}),a.jsx("br",{}),"Where processing is necessary for the performance of a contract to which you are a party, or in order to take steps at your request prior to entering into a contract, Art. 6(1)(b) GDPR is the legal basis."]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"(c) Legal obligation (Art. 6(1)(c) GDPR)"}),a.jsx("br",{}),"Where processing is necessary for compliance with a legal obligation to which we are subject, Art. 6(1)(c) GDPR is the legal basis."]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"(d) Legitimate interests (Art. 6(1)(f) GDPR)"}),a.jsx("br",{}),"Where processing is necessary for the purposes of our legitimate interests or those of a third party, and your interests or fundamental rights and freedoms do not override those interests, Art. 6(1)(f) GDPR is the legal basis. Our legitimate interests include, in particular, providing and improving our services, ensuring IT security, and preventing fraud."]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.2 Categories of data processed"}),a.jsx("p",{children:"When you use our platform, we may process the following categories of personal data:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Account data:"})," email address, nickname, profile information (university, degree program), account-related information"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Usage data:"})," IP address, access time, pages accessed, browser type, operating system, referrer URL, device information"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Content data:"})," uploaded documents, AI-generated content (summaries, thesis drafts, analyses), stored projects and notes"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Payment-related data:"})," billing address, payment history, subscription status (full payment details are processed exclusively by Stripe)"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Meta and communication data:"})," token usage, student points, activity history, communication with support"]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.3 Purposes of processing"}),a.jsx("p",{children:"We process personal data for the following purposes:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Providing the platform and its features"}),a.jsx("li",{children:"User account administration and authentication"}),a.jsx("li",{children:"Processing documents for AI-assisted analysis"}),a.jsx("li",{children:"Generating summaries, thesis drafts and other AI-generated outputs"}),a.jsx("li",{children:"Payment processing and subscription management"}),a.jsx("li",{children:"Ensuring IT security and fraud prevention"}),a.jsx("li",{children:"Analytics and service improvement"}),a.jsx("li",{children:"Compliance with statutory retention obligations"}),a.jsx("li",{children:"Communication with users (support and service messages)"})]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"3. Data Collection When Using the Platform"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.1 Registration and user account"}),a.jsx("p",{children:"When you register for a user account, we collect:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Email address:"})," required to create an account, authenticate you and communicate with you"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Password:"})," stored only in hashed form; plaintext passwords are never stored or transmitted"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Profile information (optional):"})," nickname, university, degree program, research interests"]})]}),a.jsx("p",{className:"mt-2",children:"Authentication is provided via Supabase Auth, a specialized authentication service. Processing is necessary for the performance of the contract (Art. 6(1)(b) GDPR)."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.2 Document upload and processing"}),a.jsx("p",{children:"Users may upload documents (in particular PDF files) to the platform. These documents are:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Stored securely in Supabase Storage"}),a.jsx("li",{children:"Processed to provide AI-assisted analysis features"}),a.jsx("li",{children:"Retained for the duration of the account use or until deleted by the user"})]}),a.jsx("p",{className:"mt-2",children:"This processing is necessary for the performance of the contract, as it constitutes a core function of the platform (Art. 6(1)(b) GDPR)."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Note:"})," Users are responsible for ensuring that they are authorized to use and upload the relevant documents and that no third-party rights are infringed."]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.3 AI-generated content"}),a.jsx("p",{children:"In the course of using the platform, AI-generated content is created, including:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Thesis drafts and outlines"}),a.jsx("li",{children:"Summaries of uploaded documents"}),a.jsx("li",{children:"Theory building blocks and methodology suggestions"}),a.jsx("li",{children:"Document analyses and structure suggestions"})]}),a.jsx("p",{className:"mt-2",children:"This content is stored in the user account and can be exported or deleted by the user. The legal basis is performance of the contract (Art. 6(1)(b) GDPR)."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.4 Usage data and statistics"}),a.jsx("p",{children:"To provide and improve our services, we collect:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Token usage:"})," for billing and quota monitoring"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Student points:"})," to manage the credit system"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Activity history:"})," to track usage history"]})]}),a.jsx("p",{className:"mt-2",children:"Processing is based on our legitimate interests in service improvement and fraud prevention (Art. 6(1)(f) GDPR)."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"4. Hosting and Infrastructure"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.1 Vercel (frontend hosting)"}),a.jsx("p",{children:"Our frontend is hosted by Vercel Inc. Each time you access the platform, the following data may be processed automatically:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"IP address of the accessing device"}),a.jsx("li",{children:"Date and time of access"}),a.jsx("li",{children:"Browser type and version"}),a.jsx("li",{children:"Operating system"}),a.jsx("li",{children:"Referrer URL"})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Provider:"})," Vercel Inc., 340 S Lemon Ave #4133, Walnut, CA 91789, USA"]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Server locations:"})," Vercel operates a global edge network. Data may be processed in various data centers worldwide, including in the USA and the EU."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," legitimate interest in the technical provision of the platform (Art. 6(1)(f) GDPR)."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"International transfers:"})," where data is transferred to the USA, we rely on Standard Contractual Clauses pursuant to Art. 46(2)(c) GDPR and, where applicable, on the EU–US Data Privacy Framework for appropriately certified companies, as well as supplementary technical and organizational measures."]}),a.jsxs("p",{className:"mt-2",children:["Further information:"," ",a.jsx("a",{href:"https://vercel.com/legal/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://vercel.com/legal/privacy-policy"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.2 Supabase (backend infrastructure)"}),a.jsx("p",{children:"We use Supabase for backend services, including:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Database:"})," storage of account data, projects and generated content"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Authentication:"})," user account and login management"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"File storage:"})," secure storage of uploaded documents"]})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Provider:"})," Supabase Inc., 970 Toa Payoh North #07-04, Singapore 318992"]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Server location:"})," our Supabase instance is hosted in the EU region (Frankfurt, Germany)."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," performance of the contract (Art. 6(1)(b) GDPR) and legitimate interests (Art. 6(1)(f) GDPR)."]}),a.jsx("p",{className:"mt-2",children:"Supabase acts as a processor pursuant to Art. 28 GDPR. We enter into data processing agreements (Art. 28 GDPR) with processors where applicable or otherwise ensure that appropriate agreements are in place."}),a.jsxs("p",{className:"mt-2",children:["Further information:"," ",a.jsx("a",{href:"https://supabase.com/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://supabase.com/privacy"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.3 Edge Functions (serverless)"}),a.jsx("p",{children:"To process AI requests, we use serverless functions (edge functions) executed on Supabase infrastructure. These functions:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Process requests to AI APIs in real time"}),a.jsx("li",{children:"Are executed in the EU region"}),a.jsx("li",{children:"Do not store persistent data outside the database"})]}),a.jsx("p",{className:"mt-2",children:"Processing is necessary for performance of the contract (Art. 6(1)(b) GDPR)."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"5. Payment Processing"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"5.1 Stripe as payment service provider"}),a.jsx("p",{children:"Payments are processed via Stripe, an external payment service provider. Stripe processes:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Credit card or other payment information"}),a.jsx("li",{children:"Billing address"}),a.jsx("li",{children:"Email address"}),a.jsx("li",{children:"Transaction data"})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Provider:"})," Stripe Payments Europe Ltd., 1 Grand Canal Street Lower, Grand Canal Dock, Dublin, D02 H210, Ireland"]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Important note:"})," We do not store full payment details (e.g., credit card numbers) on our servers. These are processed and stored exclusively by Stripe."]}),a.jsx("p",{className:"mt-2",children:"With respect to payment data, Stripe acts as an independent controller and is subject to its own data protection obligations."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," performance of the contract (Art. 6(1)(b) GDPR)."]}),a.jsxs("p",{className:"mt-2",children:["Further information:"," ",a.jsx("a",{href:"https://stripe.com/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://stripe.com/privacy"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"5.2 Invoice data"}),a.jsx("p",{children:"Invoice data (billing address, invoice amounts, invoice date) is stored for tax and accounting purposes."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," compliance with legal obligations (Art. 6(1)(c) GDPR) in conjunction with Austrian tax and commercial retention obligations."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Retention period:"})," 7 years under Austrian tax law."]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"6. Analytics and Tracking"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.1 Plausible Analytics"}),a.jsx("p",{children:"We use Plausible Analytics, a privacy-friendly web analytics service."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Provider:"})," Plausible Insights OÜ, Västriku tn 2, 50403, Tartu, Estonia"]}),a.jsx("p",{className:"mt-2",children:a.jsx("strong",{className:"text-foreground",children:"Key characteristics:"})}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"No cookies"}),a.jsx("li",{children:"No collection of directly identifying personal data"}),a.jsx("li",{children:"No cross-device tracking"}),a.jsx("li",{children:"GDPR-compliant without consent"}),a.jsx("li",{children:"Servers located in the EU"})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Data processed:"})," aggregated, anonymized usage statistics (page views, time on page, device type, country based on anonymized IP)."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," legitimate interest in analytics and optimization of our platform (Art. 6(1)(f) GDPR)."]}),a.jsxs("p",{className:"mt-2",children:["Further information:"," ",a.jsx("a",{href:"https://plausible.io/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://plausible.io/privacy"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.2 Cookie policy"}),a.jsx("p",{children:"Our platform uses only technically necessary cookies required for operating the platform, such as:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Authentication cookies (session management)"}),a.jsx("li",{children:"Security cookies (CSRF protection)"})]}),a.jsx("p",{className:"mt-2",children:"These cookies are essential for the operation of the platform and do not require consent under applicable ePrivacy rules."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Analytics cookies:"})," currently not used. Plausible Analytics works without cookies."]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.3 Notice regarding possible future use of Google Analytics"}),a.jsx("p",{children:"We do not currently use Google Analytics. If we implement Google Analytics or comparable tools requiring consent in the future, this will only occur after you have given prior consent via a cookie/consent banner (Art. 6(1)(a) GDPR in conjunction with applicable ePrivacy rules). In that case, we will update this Privacy Policy in advance and provide transparent information, in particular on the provider, data categories, retention periods and any international transfers."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"7. Email Communication"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"7.1 Transactional emails"}),a.jsx("p",{children:"We send transactional emails that are necessary for performing the contract, such as:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Account confirmation upon registration"}),a.jsx("li",{children:"Password reset"}),a.jsx("li",{children:"Payment confirmations and invoices"}),a.jsx("li",{children:"Important service messages (e.g., changes to the Terms of Service)"})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," performance of the contract (Art. 6(1)(b) GDPR)."]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"7.2 Marketing and product updates"}),a.jsx("p",{children:"By creating an account or joining our waitlist, you consent to receive occasional product updates, feature announcements, tips for using the platform, and promotional offers from Academly by email. Legal basis: consent (Art. 6(1)(a) GDPR). Frequency: We typically send 1-4 emails per month. We do not share your email address with third parties for their marketing purposes. Opt-out: Every marketing email contains an unsubscribe link. You can withdraw your consent at any time by clicking 'Unsubscribe' in any email or by contacting us at contact@academly.ai. Withdrawal of consent does not affect the lawfulness of processing based on consent before its withdrawal. Unsubscribing from marketing emails does not affect transactional emails necessary for providing the service."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"8. Disclosure to Third Parties"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"8.1 Service providers"}),a.jsx("p",{children:"To provide the platform, we use service providers. Where these providers process personal data on our behalf, they act as processors within the meaning of Art. 28 GDPR. Where service providers process data for their own purposes (e.g., payment processing), they act as independent controllers and are subject to their own data protection obligations."}),a.jsx("div",{className:"mt-4 overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse border border-border text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-muted",children:[a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Provider"}),a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Role"}),a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Purpose"}),a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Location"})]})}),a.jsxs("tbody",{children:[a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Supabase Inc."}),a.jsx("td",{className:"border border-border p-2",children:"Processor"}),a.jsx("td",{className:"border border-border p-2",children:"Database, authentication, storage"}),a.jsx("td",{className:"border border-border p-2",children:"EU (Frankfurt)"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Vercel Inc."}),a.jsx("td",{className:"border border-border p-2",children:"Processor"}),a.jsx("td",{className:"border border-border p-2",children:"Frontend hosting/delivery"}),a.jsx("td",{className:"border border-border p-2",children:"Global (including EU/USA)"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Plausible Insights OÜ"}),a.jsx("td",{className:"border border-border p-2",children:"Processor"}),a.jsx("td",{className:"border border-border p-2",children:"Web analytics (aggregated, cookie-free)"}),a.jsx("td",{className:"border border-border p-2",children:"EU (Estonia)"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"OpenAI, LLC"}),a.jsx("td",{className:"border border-border p-2",children:"Processor"}),a.jsx("td",{className:"border border-border p-2",children:"AI processing via API"}),a.jsx("td",{className:"border border-border p-2",children:"USA"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Stripe Payments Europe Ltd."}),a.jsx("td",{className:"border border-border p-2",children:"Independent controller"}),a.jsx("td",{className:"border border-border p-2",children:"Payment processing"}),a.jsx("td",{className:"border border-border p-2",children:"Ireland/EU"})]})]})]})}),a.jsx("p",{className:"mt-2",children:"Where providers act as processors, we enter into data processing agreements (Art. 28 GDPR) and/or otherwise ensure that appropriate agreements are in place."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"8.2 International transfers"}),a.jsx("p",{children:"Where personal data is transferred to third countries outside the EU/EEA, this is done on the basis of appropriate safeguards, in particular:"}),a.jsx("p",{className:"mt-2",children:a.jsx("strong",{className:"text-foreground",children:"USA:"})}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Standard Contractual Clauses pursuant to Art. 46(2)(c) GDPR (SCCs)"}),a.jsx("li",{children:"Where applicable: EU–US Data Privacy Framework for appropriately certified companies"}),a.jsx("li",{children:"Supplementary technical and organizational measures"})]}),a.jsx("p",{className:"mt-2",children:a.jsx("strong",{className:"text-foreground",children:"Affected services:"})}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Vercel Inc. (hosting) – SCCs; where applicable EU–US DPF"}),a.jsx("li",{children:"OpenAI, LLC (AI processing) – SCCs"})]}),a.jsx("p",{className:"mt-2",children:"Users may request copies of the Standard Contractual Clauses by contacting contact@academly.ai."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"8.3 AI Provider — Important Notice"}),a.jsxs("p",{children:[a.jsx("strong",{className:"text-foreground",children:"OpenAI, LLC"}),a.jsx("br",{}),"3180 18th Street, San Francisco, CA 94110, USA"]}),a.jsx("p",{className:"mt-2",children:"When you use the following features, content from your uploaded documents and interactions is transmitted to OpenAI for processing:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Theory & Background Builder"}),a.jsx("li",{children:"Methods & Approach Builder"}),a.jsx("li",{children:"Supervisor Chat"}),a.jsx("li",{children:"Qualitative Analysis (interview evaluation, codebooks)"}),a.jsx("li",{children:"Document Summaries"}),a.jsx("li",{children:"Topic Explorer"})]}),a.jsxs("p",{className:"mt-2",children:["This means: interview transcripts, research documents, and chat messages you enter are sent to OpenAI's API for analysis. According to OpenAI's API data usage policy, data transmitted via the API is ",a.jsx("strong",{className:"text-foreground",children:"not used to train their models"}),"."]}),a.jsx("p",{className:"mt-2",children:a.jsx("strong",{className:"text-foreground",children:"Important notes:"})}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Transmission is encrypted"}),a.jsx("li",{children:"Standard Contractual Clauses apply for international transfers"}),a.jsx("li",{children:"Data transmitted via the API is not used by OpenAI to train its models, according to OpenAI's API data usage policy"})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," performance of the contract (Art. 6(1)(b) GDPR), as AI processing is a core feature of the platform."]}),a.jsxs("p",{className:"mt-2",children:["Further information:"," ",a.jsx("a",{href:"https://openai.com/policies/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://openai.com/policies/privacy-policy"})]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"9. Retention and Deletion"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.1 Retention periods by data category"}),a.jsx("div",{className:"mt-4 overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse border border-border text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-muted",children:[a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Data category"}),a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Retention period"}),a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Reason"})]})}),a.jsxs("tbody",{children:[a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Account data"}),a.jsx("td",{className:"border border-border p-2",children:"Until account deletion"}),a.jsx("td",{className:"border border-border p-2",children:"Performance of contract"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Documents"}),a.jsx("td",{className:"border border-border p-2",children:"Per user settings or upon account deletion"}),a.jsx("td",{className:"border border-border p-2",children:"Performance of contract"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"AI-generated content"}),a.jsx("td",{className:"border border-border p-2",children:"Until deleted by user or account deletion"}),a.jsx("td",{className:"border border-border p-2",children:"Performance of contract"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Usage statistics"}),a.jsx("td",{className:"border border-border p-2",children:"12 months"}),a.jsx("td",{className:"border border-border p-2",children:"Legitimate interests"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Payment/invoice data"}),a.jsx("td",{className:"border border-border p-2",children:"7 years"}),a.jsx("td",{className:"border border-border p-2",children:"Statutory retention obligation"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Server logs"}),a.jsx("td",{className:"border border-border p-2",children:"30 days"}),a.jsx("td",{className:"border border-border p-2",children:"IT security"})]})]})]})})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.2 Automatic deletion of inactive accounts"}),a.jsx("p",{children:"Inactive accounts are automatically deleted after 24 months without login and/or without active use, unless statutory retention obligations or legitimate interests (e.g., legal enforcement) prevent deletion. Before deletion, we will inform users by email where possible and provide an opportunity to export data."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.3 Backup retention"}),a.jsx("p",{children:"To ensure data integrity, daily full backups are created. Backups are retained on a rolling basis for 7 days; the oldest backup is overwritten thereafter. Backup retention is intended solely for disaster recovery and is not an archiving service."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"10. Data Security"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"10.1 Technical measures"}),a.jsx("p",{children:"We implement technical measures to protect personal data, including:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Encryption:"})," all data transmissions via TLS/HTTPS (at least TLS 1.2)"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Password hashing:"})," passwords stored using secure, up-to-date hashing algorithms"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Row Level Security (RLS):"})," database access restricted via row-level policies"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Access controls:"})," restricting access to authorized systems"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Regular updates:"})," applying security patches and updates"]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"10.2 Organizational measures"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Access to personal data is limited to what is necessary"}),a.jsx("li",{children:"Security-relevant accesses are logged where appropriate"}),a.jsx("li",{children:"Security measures are reviewed regularly"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"10.3 Incident response"}),a.jsx("p",{children:"In the event of a personal data breach, we will:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Notify the competent supervisory authority within 72 hours where required under Art. 33 GDPR"}),a.jsx("li",{children:"Notify affected individuals without undue delay where required under Art. 34 GDPR"}),a.jsx("li",{children:"Document the incident and take remedial measures"})]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"11. Data Subject Rights"}),a.jsx("p",{className:"mb-4",children:"You have the following rights regarding your personal data:"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.1 Right of access (Art. 15 GDPR)"}),a.jsx("p",{children:"You have the right to obtain information about personal data processed by us. The platform provides a data export function allowing you to download your data."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.2 Right to rectification (Art. 16 GDPR)"}),a.jsx("p",{children:"You have the right to request correction of inaccurate personal data. Many data fields can be edited directly in your account."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.3 Right to erasure (Art. 17 GDPR)"}),a.jsx("p",{children:"You have the right to request deletion of your personal data, unless statutory retention obligations apply. Full deletion can be performed via the account deletion function or by contacting contact@academly.ai."}),a.jsxs("div",{className:"mt-4 p-4 bg-muted/50 rounded-lg border border-border",children:[a.jsx("h5",{className:"font-medium text-foreground mb-3",children:"What happens when you delete your account:"}),a.jsx("p",{className:"text-sm mb-2",children:a.jsx("strong",{className:"text-foreground",children:"Immediately and permanently deleted:"})}),a.jsxs("ul",{className:"list-disc list-inside text-sm space-y-1 mb-4",children:[a.jsx("li",{children:"Your email address and profile information (nickname, university, research interests)"}),a.jsx("li",{children:"All uploaded documents and PDFs"}),a.jsx("li",{children:"All generated summaries and analyses"}),a.jsx("li",{children:"All thesis drafts, chapters, and sections"}),a.jsx("li",{children:"All research setups and topic explorations"}),a.jsx("li",{children:"All qualitative coding data (interviews, codebooks, coded segments)"}),a.jsx("li",{children:"All files stored in our cloud storage"})]}),a.jsx("p",{className:"text-sm mb-2",children:a.jsx("strong",{className:"text-foreground",children:"Anonymized (retained without personal reference):"})}),a.jsxs("ul",{className:"list-disc list-inside text-sm space-y-1 mb-4",children:[a.jsx("li",{children:"Transaction records required for tax/accounting compliance (§ 132 BAO Austria: 7 years)"}),a.jsx("li",{children:"Usage statistics (aggregated, with no possibility of personal identification)"})]}),a.jsx("p",{className:"text-sm mb-2",children:a.jsx("strong",{className:"text-foreground",children:"Third-party data:"})}),a.jsx("p",{className:"text-sm mb-4",children:"We will cancel any active subscription with Stripe. Stripe retains payment records according to their own retention policy (typically 7 years for tax/legal compliance). For deletion of data held by Stripe, please contact Stripe directly or visit their privacy portal."}),a.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/50 p-3 rounded-md border border-amber-200 dark:border-amber-800",children:a.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[a.jsx("strong",{children:"Important:"}),' Before deleting your account, we recommend downloading a complete backup of your data using the "Download Backup" function in your account settings. This backup includes all your documents, summaries, thesis drafts, and qualitative coding data in standard formats.']})})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.4 Right to restriction of processing (Art. 18 GDPR)"}),a.jsx("p",{children:"Under certain conditions, you have the right to request restriction of processing."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.5 Right to data portability (Art. 20 GDPR)"}),a.jsx("p",{children:"You have the right to receive your personal data in a structured, commonly used and machine-readable format. The platform offers export functions (DOCX, TXT, backup ZIP) for your content."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.6 Right to object (Art. 21 GDPR)"}),a.jsx("p",{children:"You have the right to object, on grounds relating to your particular situation, at any time to processing based on Art. 6(1)(f) GDPR."}),a.jsx("p",{className:"mt-2",children:"You may object to direct marketing at any time without giving reasons."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.7 Withdrawal of consent (Art. 7(3) GDPR)"}),a.jsx("p",{children:"Where processing is based on consent, you may withdraw your consent at any time with effect for the future. The lawfulness of processing prior to withdrawal remains unaffected."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.8 Right to lodge a complaint with a supervisory authority"}),a.jsx("p",{children:"You have the right to lodge a complaint with a data protection supervisory authority. The competent authority for us is:"}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Austrian Data Protection Authority (Österreichische Datenschutzbehörde)"}),a.jsx("br",{}),"Barichgasse 40-42",a.jsx("br",{}),"1030 Vienna, Austria",a.jsx("br",{}),"Email: dsb@dsb.gv.at"]}),a.jsxs("p",{className:"mt-2",children:["Website:"," ",a.jsx("a",{href:"https://www.dsb.gv.at",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://www.dsb.gv.at"})]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"12. Special Notes on AI Processing"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"12.1 Automated decision-making"}),a.jsx("p",{children:"We do not carry out automated decision-making, including profiling, that produces legal effects concerning users or similarly significantly affects them (Art. 22 GDPR)."}),a.jsx("p",{className:"mt-2",children:"AI-generated content is provided as working drafts only and has no legal or academic binding effect."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"12.2 Use of data for AI training"}),a.jsxs("p",{children:[a.jsx("strong",{className:"text-foreground",children:"Important note:"})," User data is not used to train external AI models."]}),a.jsx("p",{className:"mt-2",children:"Data transmitted to OpenAI via our API integration is not used to train models according to OpenAI's API data usage policy."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"12.3 AI-generated content"}),a.jsx("p",{children:"AI-generated content may be labeled as such, in particular where this is required for transparency or to meet regulatory requirements. This is intended to be in line with applicable transparency requirements, including those arising under the EU AI Act (Regulation (EU) 2024/1689)."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Note:"})," AI-generated content may contain errors, inaccuracies, or outdated information. Users are responsible for reviewing and deciding how to use such content."]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"13. Changes to this Privacy Policy"}),a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"13.1 Updates"}),a.jsx("p",{children:"We reserve the right to update this Privacy Policy to reflect changes in legal requirements or changes to our services."}),a.jsx("p",{className:"mt-2",children:"In the event of material changes, registered users will be informed by email. The current version is available on our platform at academly.ai/legal."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Date of last update:"})," May 2026"]})]})})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"14. Contact"}),a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"14.1 Data protection inquiries"}),a.jsx("p",{children:"For questions about data protection, exercising your rights, or complaints, please contact:"}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Email:"})," contact@academly.ai"]}),a.jsx("p",{className:"mt-2",children:"We aim to respond to requests within one month."})]})})]})]})]})})]})})})}),a.jsx(Ds,{})]})},Bot=od("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),nd=S.forwardRef(({className:t,variant:e,...r},n)=>a.jsx("div",{ref:n,role:"alert",className:Ie(Bot({variant:e}),t),...r}));nd.displayName="Alert";const K8=S.forwardRef(({className:t,...e},r)=>a.jsx("h5",{ref:r,className:Ie("mb-1 font-medium leading-none tracking-tight",t),...e}));K8.displayName="AlertTitle";const sd=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{ref:r,className:Ie("text-sm [&_p]:leading-relaxed",t),...e}));sd.displayName="AlertDescription";const GG="2026-01-15",Uot=!1;function zot({defaultIsLogin:t=!1}){const[e,r]=S.useState(t),[n,s]=S.useState(""),[i,o]=S.useState(""),[l,c]=S.useState(""),[u,d]=S.useState(!1),[h,f]=S.useState(!1),[p,g]=S.useState(""),[m,x]=S.useState(!1),[y,v]=S.useState(!1),[b,w]=S.useState(""),[j,N]=S.useState(!1),[C,k]=S.useState(!1),[E,M]=S.useState(""),[z,P]=S.useState(!1),[V,A]=S.useState(!1),{signIn:$,signUp:K}=Pt(),G=async B=>{if(B.preventDefault(),v(!0),w(""),e){const{error:L}=await $(n,i);L&&w(L.message)}else{if(i!==l){w("Passwords do not match"),v(!1);return}if(!m){w("Please accept the Terms of Service and Privacy Policy"),v(!1);return}const L={terms_accepted_at:new Date().toISOString(),privacy_accepted_at:new Date().toISOString(),terms_version:GG,privacy_version:GG},{error:F}=await K(n,i,L);F?w(F.message):N(!0)}v(!1)},Y=async B=>{B.preventDefault(),A(!0),w("");try{const{error:L}=await be.auth.resetPasswordForEmail(E,{redirectTo:"https://academly.ai/reset-password"});if(L)throw L;P(!0)}catch(L){w(L.message||"Failed to send reset email")}finally{A(!1)}},H=()=>{r(!e),k(!1),c(""),d(!1),f(!1),g(""),x(!1),w(""),N(!1),P(!1)};return j?a.jsxs("div",{className:"w-full max-w-5xl mx-auto grid lg:grid-cols-2 gap-12 lg:gap-16 items-center",children:[a.jsxs("div",{className:"text-center lg:text-left space-y-8",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("h1",{className:"text-4xl md:text-5xl font-bold text-foreground",children:["Welcome to",a.jsx("span",{className:"text-primary",children:" Academly"})]}),a.jsx("p",{className:"text-xl text-muted-foreground",children:"Your AI-powered research assistant. Structure your thesis, manage sources, and create properly cited drafts."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3.5",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(LE,{className:"w-4.5 h-4.5 text-primary"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"AI Writing Suite"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Theory, Methods, Discussion & Conclusion"})]})]}),a.jsxs("div",{className:"flex items-start gap-3.5",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-emerald-500/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(Hm,{className:"w-4.5 h-4.5 text-emerald-500"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Qualitative Analysis"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Full Mayring workflow — codebook, coding & findings"})]})]}),a.jsxs("div",{className:"flex items-start gap-3.5",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-orange-500/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(Vm,{className:"w-4.5 h-4.5 text-orange-500"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"AI Supervisor"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Your personal thesis coach, available 24/7"})]})]})]})]}),a.jsx("div",{className:"w-full max-w-md mx-auto lg:mx-0",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card p-8 shadow-xl text-center",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 flex items-center justify-center mx-auto mb-6",children:a.jsx(dc,{className:"w-8 h-8 text-emerald-500"})}),a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Check your inbox!"}),a.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground mb-6",children:[a.jsx(YJ,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm",children:n})]}),a.jsx("p",{className:"text-muted-foreground mb-8",children:"We've sent a confirmation email to your address. Please click the link in the email to activate your account."}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Didn't receive the email? Check your spam folder or try again."}),a.jsx(ye,{variant:"outline",onClick:H,className:"w-full h-12 rounded-full",children:"Back to Login"})]})]})})]}):a.jsxs("div",{className:"w-full max-w-5xl mx-auto grid lg:grid-cols-2 gap-12 lg:gap-16 items-center",children:[a.jsxs("div",{className:"text-center lg:text-left space-y-8",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("h1",{className:"text-4xl md:text-5xl font-bold text-foreground",children:["Welcome to",a.jsx("span",{className:"text-primary",children:" Academly"})]}),a.jsx("p",{className:"text-xl text-muted-foreground",children:"Your AI-powered research assistant. Structure your thesis, manage sources, and create properly cited drafts."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3.5 group",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(LE,{className:"w-4.5 h-4.5 text-primary"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"AI Writing Suite"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Theory, Methods, Discussion & Conclusion"})]})]}),a.jsxs("div",{className:"flex items-start gap-3.5 group",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-emerald-500/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(Hm,{className:"w-4.5 h-4.5 text-emerald-500"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Qualitative Analysis"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Full Mayring workflow — codebook, coding & findings"})]})]}),a.jsxs("div",{className:"flex items-start gap-3.5 group",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-orange-500/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(Vm,{className:"w-4.5 h-4.5 text-orange-500"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"AI Supervisor"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Your personal thesis coach, available 24/7"})]})]})]})]}),a.jsx("div",{className:"w-full max-w-md mx-auto lg:mx-0",children:a.jsx("div",{className:"rounded-3xl border border-border bg-card p-8 shadow-xl",children:C?a.jsx("div",{children:z?a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 flex items-center justify-center mx-auto mb-6",children:a.jsx(dc,{className:"w-8 h-8 text-emerald-500"})}),a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Reset email sent!"}),a.jsx("p",{className:"text-muted-foreground mb-8",children:"Check your inbox for the reset link."}),a.jsx(ye,{variant:"outline",onClick:()=>{k(!1),P(!1)},className:"w-full h-12 rounded-full",children:"Back to Login"})]}):a.jsxs("form",{onSubmit:Y,className:"space-y-5",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Reset Password"}),a.jsx("p",{className:"text-muted-foreground",children:"Enter your email to receive a reset link."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"forgotEmail",className:"text-foreground font-medium",children:"Email"}),a.jsx(Fe,{id:"forgotEmail",type:"email",value:E,onChange:B=>M(B.target.value),required:!0,className:"h-12 rounded-xl",placeholder:"your@email.com"})]}),b&&a.jsx(nd,{className:"border-destructive/50 bg-destructive/10",children:a.jsx(sd,{className:"text-destructive",children:b})}),a.jsx(ye,{type:"submit",disabled:V,className:"w-full h-12 rounded-full text-base font-semibold",children:V?"Sending...":"Send Reset Link"}),a.jsx("div",{className:"text-center pt-2",children:a.jsx("button",{type:"button",onClick:()=>{k(!1),w("")},className:"text-sm text-primary hover:underline font-medium",children:"Back to Login"})})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:e?"Sign In":"Create Account"}),a.jsx("p",{className:"text-muted-foreground",children:e?"Welcome back! Sign in to continue.":"Get started with Academly"})]}),a.jsxs("form",{onSubmit:G,className:"space-y-5",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"email",className:"text-foreground font-medium",children:"Email"}),a.jsx(Fe,{id:"email",type:"email",value:n,onChange:B=>s(B.target.value),required:!0,className:"h-12 rounded-xl",placeholder:"your@email.com"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"password",className:"text-foreground font-medium",children:"Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Fe,{id:"password",type:u?"text":"password",value:i,onChange:B=>o(B.target.value),required:!0,className:"h-12 rounded-xl pr-12",placeholder:"At least 6 characters"}),a.jsx("button",{type:"button",onClick:()=>d(!u),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:u?a.jsx(ME,{className:"h-5 w-5"}):a.jsx(Qi,{className:"h-5 w-5"})})]})]}),e&&a.jsx("div",{className:"text-right",children:a.jsx("button",{type:"button",onClick:()=>{k(!0),M(n),w("")},className:"text-sm text-primary hover:underline",children:"Forgot password?"})}),!e&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"confirmPassword",className:"text-foreground font-medium",children:"Confirm Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Fe,{id:"confirmPassword",type:h?"text":"password",value:l,onChange:B=>c(B.target.value),required:!0,className:"h-12 rounded-xl pr-12",placeholder:"Repeat your password"}),a.jsx("button",{type:"button",onClick:()=>f(!h),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:h?a.jsx(ME,{className:"h-5 w-5"}):a.jsx(Qi,{className:"h-5 w-5"})})]})]}),!e&&Uot&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"inviteCode",className:"text-foreground font-medium",children:"Invite Code"}),a.jsx(Fe,{id:"inviteCode",type:"text",value:p,onChange:B=>g(B.target.value),required:!0,className:"h-12 rounded-xl",placeholder:"Enter your beta invite code"})]}),!e&&a.jsxs(Due,{id:"terms-consent",checked:m,onCheckedChange:x,required:!0,children:["I agree to the"," ",a.jsx(tt,{to:"/legal?tab=terms",className:"text-primary hover:underline font-medium",target:"_blank",children:"Terms of Service"})," ","and acknowledge the"," ",a.jsx(tt,{to:"/legal?tab=privacy",className:"text-primary hover:underline font-medium",target:"_blank",children:"Privacy Policy"}),"."]}),b&&a.jsx(nd,{className:"border-destructive/50 bg-destructive/10",children:a.jsx(sd,{className:"text-destructive",children:b})}),a.jsx(ye,{type:"submit",disabled:y||!e&&!m,className:"w-full h-12 rounded-full text-base font-semibold",children:y?"Loading...":e?"Sign In":"Create Account"}),!e&&a.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"We'll send you account-related emails and occasional product updates. You can unsubscribe anytime."}),a.jsx("div",{className:"text-center pt-2",children:a.jsx("button",{type:"button",onClick:H,className:"text-sm text-primary hover:underline font-medium",children:e?"Don't have an account? Sign up":"Already have an account? Sign in"})})]})]})})})]})}const Hot=()=>{const{user:t,loading:e}=Pt(),r=gr(),[n]=Dj(),i=n.get("mode")!=="signup";return S.useEffect(()=>{t&&!e&&r("/dashboard")},[t,e,r]),e?a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(Jn,{}),a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})]}):t?null:a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"Sign In | Academly.ai",description:"Private page on Academly.ai.",canonical:"https://academly.ai/login",noIndex:!0}),a.jsx(Jn,{}),a.jsxs("div",{className:"fixed inset-0 -z-10",children:[a.jsx("div",{className:"absolute top-20 left-1/4 w-72 h-72 bg-primary/20 rounded-full blur-3xl"}),a.jsx("div",{className:"absolute top-40 right-1/4 w-96 h-96 bg-purple-500/10 rounded-full blur-3xl"})]}),a.jsx("section",{className:"pt-32 pb-20",children:a.jsx(jr,{children:a.jsx(zot,{defaultIsLogin:i})})})]})},Wot=()=>{const t=gr(),[e,r]=S.useState(""),[n,s]=S.useState(""),[i,o]=S.useState(!1),[l,c]=S.useState(!1),[u,d]=S.useState(!1),[h,f]=S.useState(""),[p,g]=S.useState(!1);S.useEffect(()=>{const{data:{subscription:x}}=be.auth.onAuthStateChange((y,v)=>{y==="PASSWORD_RECOVERY"||(y==="SIGNED_OUT"||!v&&!window.location.hash.includes("access_token"))&&t("/login")});return()=>x.unsubscribe()},[t]);const m=async()=>{if(f(""),e!==n){f("Passwords do not match");return}if(e.length<6){f("Password must be at least 6 characters");return}d(!0);try{const{error:x}=await be.auth.updateUser({password:e});if(x)throw x;g(!0),setTimeout(()=>t("/login"),3e3)}catch(x){f(x.message||"Failed to update password")}finally{d(!1)}};return a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"Reset Password | Academly.ai",description:"Private page on Academly.ai.",canonical:"https://academly.ai/reset-password",noIndex:!0}),a.jsx(Jn,{}),a.jsxs("div",{className:"fixed inset-0 -z-10",children:[a.jsx("div",{className:"absolute top-20 left-1/4 w-72 h-72 bg-primary/20 rounded-full blur-3xl"}),a.jsx("div",{className:"absolute top-40 right-1/4 w-96 h-96 bg-purple-500/10 rounded-full blur-3xl"})]}),a.jsx("section",{className:"pt-32 pb-20",children:a.jsx(jr,{children:a.jsx("div",{className:"max-w-md mx-auto",children:a.jsxs(Me,{children:[a.jsxs(qe,{className:"text-center",children:[a.jsx(Je,{className:"text-2xl",children:"Set new password"}),a.jsx(mn,{children:"Enter your new password below."})]}),a.jsx(Be,{children:p?a.jsxs("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[a.jsx(gl,{className:"w-12 h-12 text-green-500"}),a.jsx("p",{className:"text-lg font-medium",children:"Password updated successfully!"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Redirecting to login…"})]}):a.jsxs("form",{onSubmit:x=>{x.preventDefault(),m()},className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"password",children:"New Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Fe,{id:"password",type:i?"text":"password",value:e,onChange:x=>r(x.target.value),placeholder:"Min. 6 characters",required:!0}),a.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>o(!i),children:i?a.jsx(ME,{className:"w-4 h-4"}):a.jsx(Qi,{className:"w-4 h-4"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"confirm",children:"Confirm Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Fe,{id:"confirm",type:l?"text":"password",value:n,onChange:x=>s(x.target.value),placeholder:"Repeat password",required:!0}),a.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>c(!l),children:l?a.jsx(ME,{className:"w-4 h-4"}):a.jsx(Qi,{className:"w-4 h-4"})})]})]}),h&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[a.jsx(Ww,{className:"w-4 h-4 shrink-0"}),h]}),a.jsx(ye,{type:"submit",className:"w-full",disabled:u,children:u?"Updating…":"Update Password"})]})})]})})})})]})},Vot=[{feature:"Citations from your own PDFs",academly:{icon:"check",text:"Yes"},chatgpt:{icon:"x",text:"No"}},{feature:"Page-accurate citations",academly:{icon:"check",text:"Yes"},chatgpt:{icon:"x",text:"No"}},{feature:"Hallucinated references",academly:{icon:"x",text:"Never"},chatgpt:{icon:"warning",text:"Frequent"}},{feature:"Qualitative Analysis (Mayring)",academly:{icon:"check",text:"Full workflow"},chatgpt:{icon:"x",text:"No"}},{feature:"Thesis-specific structure",academly:{icon:"check",text:"Yes"},chatgpt:{icon:"warning",text:"Generic"}},{feature:"APA7 citation formatting",academly:{icon:"check",text:"Built-in"},chatgpt:{icon:"warning",text:"Inconsistent"}},{feature:"German language support",academly:{icon:"check",text:"Native"},chatgpt:{icon:"warning",text:"Partial"}},{feature:"Works with uploaded PDFs",academly:{icon:"check",text:"Core feature"},chatgpt:{icon:"x",text:"No"}},{feature:"Free to start",academly:{icon:"check",text:"Yes"},chatgpt:{icon:"check",text:"Yes (limited)"}},{feature:"GDPR compliant (EU)",academly:{icon:"check",text:"Frankfurt servers"},chatgpt:{icon:"warning",text:"US servers"}}],KG=({type:t})=>t==="check"?a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-emerald-600 dark:text-emerald-400 font-medium",children:[a.jsx(yn,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Yes"})]}):t==="x"?a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-red-500 dark:text-red-400 font-medium",children:[a.jsx(En,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"No"})]}):a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-600 dark:text-amber-400 font-medium",children:[a.jsx(Ia,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Frequent"})]}),YG=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"Academly vs ChatGPT for Thesis Writing | Academly.ai",description:"ChatGPT invents citations. Academly only cites your own uploaded sources — with exact page numbers.",canonical:"https://academly.ai/vs/chatgpt"}),a.jsx(Jn,{}),a.jsxs("main",{children:[a.jsxs("section",{className:"relative pt-32 pb-16 overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsxs("div",{className:"relative max-w-4xl mx-auto px-6 text-center",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-primary mb-4 font-medium",children:"Comparison"}),a.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:"Academly vs ChatGPT for Thesis Writing"}),a.jsxs("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto leading-relaxed",children:["ChatGPT is impressive — but it invents citations.",a.jsx("br",{}),"Academly only uses sources you upload."]})]})]}),a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-4xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"p-6 md:p-8 border-b border-border",children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground",children:"Feature Comparison"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"How Academly stacks up against ChatGPT for academic writing."})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/50",children:[a.jsx("th",{className:"text-left px-6 py-4 font-semibold text-foreground",children:"Feature"}),a.jsx("th",{className:"text-center px-6 py-4 font-semibold text-primary min-w-[140px]",children:"Academly"}),a.jsx("th",{className:"text-center px-6 py-4 font-semibold text-muted-foreground min-w-[140px]",children:"ChatGPT"})]})}),a.jsx("tbody",{children:Vot.map((t,e)=>a.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-muted/30 transition-colors",children:[a.jsx("td",{className:"px-6 py-4 text-foreground font-medium",children:t.feature}),a.jsxs("td",{className:"px-6 py-4 text-center",children:[a.jsx(KG,{type:t.academly.icon}),a.jsx("span",{className:"sr-only",children:t.academly.text})]}),a.jsxs("td",{className:"px-6 py-4 text-center",children:[a.jsx(KG,{type:t.chatgpt.icon}),a.jsx("span",{className:"sr-only",children:t.chatgpt.text})]})]},e))})]})})]})})}),a.jsx("section",{className:"py-16",children:a.jsxs("div",{className:"max-w-4xl mx-auto px-6 space-y-16",children:[a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(Ia,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"Why ChatGPT Hallucinates Citations"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"ChatGPT is a language model trained on internet text. When generating citations, it produces what a citation probably looks like based on patterns — not actual sources. This fails for specific editions, regional journals, and recently published papers."})]})]})}),a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(zF,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"How Academly Solves This"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"You upload your PDFs. Academly extracts text by page and only passes that text to the AI. The AI can only cite what you uploaded — the constraint is architectural, not instructional."})]})]})}),a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(zJ,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"When ChatGPT Is Still Useful"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Great for brainstorming, concept explanations, grammar checking. Not reliable for citations or chapter generation that needs traceable sources."})]})]})})]})}),a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-primary/20 bg-primary/5 p-10 md:p-14 text-center",children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"Try Academly free"}),a.jsx("p",{className:"text-muted-foreground mb-8 max-w-lg mx-auto leading-relaxed",children:"2,000 credits, no credit card needed."}),a.jsx(ye,{asChild:!0,className:"rounded-full h-12 px-8 text-base font-semibold",children:a.jsxs(tt,{to:"/login",children:["Get started free ",a.jsx(Oa,{className:"h-4 w-4 ml-2"})]})})]})})})]}),a.jsx(Ds,{})]}),qot=[{feature:"Upload & cite your own PDFs",academly:{icon:"check",text:"Core feature"},jenni:{icon:"warning",text:"Limited"}},{feature:"Page-accurate citations",academly:{icon:"check",text:"Yes"},jenni:{icon:"warning",text:"Inconsistent"}},{feature:"Qualitative Analysis (Mayring)",academly:{icon:"check",text:"Full workflow"},jenni:{icon:"x",text:"No"}},{feature:"Theory chapter generation",academly:{icon:"check",text:"From your sources"},jenni:{icon:"warning",text:"Generic"}},{feature:"Methods & Approach Builder",academly:{icon:"check",text:"Yes"},jenni:{icon:"x",text:"No"}},{feature:"Topic Explorer",academly:{icon:"check",text:"Yes"},jenni:{icon:"x",text:"No"}},{feature:"AI Thesis Supervisor",academly:{icon:"check",text:"Yes"},jenni:{icon:"x",text:"No"}},{feature:"Literature search",academly:{icon:"check",text:"CrossRef + OpenAlex"},jenni:{icon:"x",text:"No"}},{feature:"German language (native)",academly:{icon:"check",text:"Yes"},jenni:{icon:"warning",text:"Partial"}},{feature:"Mayring workflow",academly:{icon:"check",text:"Yes"},jenni:{icon:"x",text:"No"}},{feature:"GDPR / EU data storage",academly:{icon:"check",text:"Frankfurt"},jenni:{icon:"x",text:"US"}},{feature:"Free tier",academly:{icon:"check",text:"2,000 credits"},jenni:{icon:"warning",text:"Very limited"}},{feature:"Price",academly:{icon:"text",text:"From €15.99/mo"},jenni:{icon:"text",text:"From $20/mo"}}],XG=({type:t,text:e})=>t==="check"?a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-emerald-600 dark:text-emerald-400 font-medium",children:[a.jsx(yn,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:e})]}):t==="x"?a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-red-500 dark:text-red-400 font-medium",children:[a.jsx(En,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:e})]}):t==="text"?a.jsx("span",{className:"text-foreground font-medium",children:e}):a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-600 dark:text-amber-400 font-medium",children:[a.jsx(Ia,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:e})]}),QG=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"Academly vs Jenni AI — Thesis Writing | Academly.ai",description:"Jenni AI helps you write. Academly helps you write from your own sources — Mayring, APA7, no hallucinated references.",canonical:"https://academly.ai/vs/jenni-ai"}),a.jsx(Jn,{}),a.jsxs("main",{children:[a.jsxs("section",{className:"relative pt-32 pb-16 overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsxs("div",{className:"relative max-w-4xl mx-auto px-6 text-center",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-primary mb-4 font-medium",children:"Comparison"}),a.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:"Academly vs Jenni AI for Thesis Writing"}),a.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto leading-relaxed",children:"Jenni helps you write. Academly helps you write from your own sources."})]})]}),a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-4xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"p-6 md:p-8 border-b border-border",children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground",children:"Feature Comparison"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"How Academly stacks up against Jenni AI for academic writing."})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/50",children:[a.jsx("th",{className:"text-left px-6 py-4 font-semibold text-foreground",children:"Feature"}),a.jsx("th",{className:"text-center px-6 py-4 font-semibold text-primary min-w-[160px]",children:"Academly"}),a.jsx("th",{className:"text-center px-6 py-4 font-semibold text-muted-foreground min-w-[160px]",children:"Jenni AI"})]})}),a.jsx("tbody",{children:qot.map((t,e)=>a.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-muted/30 transition-colors",children:[a.jsx("td",{className:"px-6 py-4 text-foreground font-medium",children:t.feature}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsx(XG,{type:t.academly.icon,text:t.academly.text})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsx(XG,{type:t.jenni.icon,text:t.jenni.text})})]},e))})]})})]})})}),a.jsx("section",{className:"py-16",children:a.jsxs("div",{className:"max-w-4xl mx-auto px-6 space-y-16",children:[a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(KJ,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"Writing Assistant vs Thesis Platform"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Jenni AI is a writing assistant — it suggests sentences as you type. Academly is a thesis platform — it structures chapters, cites your uploaded PDFs by page number, and guides you through the entire research workflow from topic to conclusion."})]})]})}),a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(Js,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"The Mayring Difference"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Qualitative content analysis by Mayring is a standard method in German-speaking academia. Academly includes a full qualitative workflow — codebook creation, interview coding, and category-based analysis. Jenni AI does not support qualitative research methods."})]})]})}),a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(LE,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"When Jenni AI Might Be Better"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"If you only need sentence-level suggestions and paraphrasing for short essays, Jenni AI is fast and lightweight. For thesis work that requires source-based citations, chapter structure, and methodological rigor, Academly is purpose-built."})]})]})})]})}),a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-primary/20 bg-primary/5 p-10 md:p-14 text-center",children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"Try Academly free"}),a.jsx("p",{className:"text-muted-foreground mb-8 max-w-lg mx-auto leading-relaxed",children:"No credit card needed."}),a.jsx(ye,{asChild:!0,className:"rounded-full h-12 px-8 text-base font-semibold",children:a.jsxs(tt,{to:"/login",children:["Get started free ",a.jsx(Oa,{className:"h-4 w-4 ml-2"})]})})]})})})]}),a.jsx(Ds,{})]}),Got=[{feature:"Citations from your own uploaded PDFs",academly:!0,other:!1},{feature:"Page-accurate citations",academly:!0,other:!1},{feature:"Structured thesis chapters (Theory, Methods, Discussion)",academly:!0,other:!1},{feature:"Qualitative analysis (Mayring workflow)",academly:!0,other:!1},{feature:"AI Thesis Supervisor feedback",academly:!0,other:!1},{feature:"Live web search results",academly:!1,other:!0},{feature:"Built specifically for academic writing",academly:!0,other:!1},{feature:"EU hosted / GDPR compliant",academly:!0,other:!1}],Kot=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"Academly vs Perplexity — Source-backed thesis writing vs web answers",description:"Perplexity searches the web. Academly writes thesis chapters from your own academic PDFs with verified page-level citations.",canonical:"https://academly.ai/vs/perplexity"}),a.jsx(Jn,{}),a.jsx("main",{className:"pt-32 pb-20",children:a.jsxs("div",{className:"max-w-4xl mx-auto px-6",children:[a.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-foreground text-center mb-4",children:"Academly vs Perplexity"}),a.jsxs("p",{className:"text-lg text-muted-foreground text-center mb-12",children:["Perplexity answers questions with web sources. Academly is a thesis platform that writes structured chapters from ",a.jsx("em",{children:"your"})," academic PDFs with verified page citations."]}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card overflow-hidden mb-12",children:[a.jsxs("div",{className:"grid grid-cols-3 bg-muted/40 text-sm font-semibold text-foreground",children:[a.jsx("div",{className:"p-4",children:"Feature"}),a.jsx("div",{className:"p-4 text-center",children:"Academly"}),a.jsx("div",{className:"p-4 text-center",children:"Perplexity"})]}),Got.map(t=>a.jsxs("div",{className:"grid grid-cols-3 border-t border-border text-sm",children:[a.jsx("div",{className:"p-4 text-foreground",children:t.feature}),a.jsx("div",{className:"p-4 flex justify-center",children:t.academly?a.jsx(yn,{className:"w-5 h-5 text-primary"}):a.jsx(En,{className:"w-5 h-5 text-muted-foreground"})}),a.jsx("div",{className:"p-4 flex justify-center",children:t.other?a.jsx(yn,{className:"w-5 h-5 text-primary"}):a.jsx(En,{className:"w-5 h-5 text-muted-foreground"})})]},t.feature))]}),a.jsx("div",{className:"text-center",children:a.jsx(ye,{asChild:!0,className:"rounded-full px-8",children:a.jsxs(tt,{to:"/login?mode=signup",children:["Start Writing Free ",a.jsx(Oa,{className:"w-4 h-4 ml-2"})]})})})]})}),a.jsx(Ds,{})]}),Yot=[{feature:"Citations only from your uploaded PDFs",academly:!0,other:!1},{feature:"Verified page-level references",academly:!0,other:!1},{feature:"Never invents references",academly:!0,other:!1},{feature:"Structured thesis chapters",academly:!0,other:!1},{feature:"Qualitative analysis (Mayring)",academly:!0,other:!1},{feature:"AI Thesis Supervisor",academly:!0,other:!1},{feature:"General-purpose chat assistant",academly:!1,other:!0},{feature:"Built specifically for thesis writing",academly:!0,other:!1}],Xot=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"Academly vs Claude — Thesis platform vs general AI assistant",description:"Claude is a general AI chat assistant. Academly is a thesis platform that writes from your uploaded sources with verified citations and a full academic workflow.",canonical:"https://academly.ai/vs/claude"}),a.jsx(Jn,{}),a.jsx("main",{className:"pt-32 pb-20",children:a.jsxs("div",{className:"max-w-4xl mx-auto px-6",children:[a.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-foreground text-center mb-4",children:"Academly vs Claude"}),a.jsx("p",{className:"text-lg text-muted-foreground text-center mb-12",children:"Claude is a powerful general assistant. Academly is purpose-built for thesis writing — with source-backed chapters, verified page references and a full academic workflow."}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card overflow-hidden mb-12",children:[a.jsxs("div",{className:"grid grid-cols-3 bg-muted/40 text-sm font-semibold text-foreground",children:[a.jsx("div",{className:"p-4",children:"Feature"}),a.jsx("div",{className:"p-4 text-center",children:"Academly"}),a.jsx("div",{className:"p-4 text-center",children:"Claude"})]}),Yot.map(t=>a.jsxs("div",{className:"grid grid-cols-3 border-t border-border text-sm",children:[a.jsx("div",{className:"p-4 text-foreground",children:t.feature}),a.jsx("div",{className:"p-4 flex justify-center",children:t.academly?a.jsx(yn,{className:"w-5 h-5 text-primary"}):a.jsx(En,{className:"w-5 h-5 text-muted-foreground"})}),a.jsx("div",{className:"p-4 flex justify-center",children:t.other?a.jsx(yn,{className:"w-5 h-5 text-primary"}):a.jsx(En,{className:"w-5 h-5 text-muted-foreground"})})]},t.feature))]}),a.jsx("div",{className:"text-center",children:a.jsx(ye,{asChild:!0,className:"rounded-full px-8",children:a.jsxs(tt,{to:"/login?mode=signup",children:["Start Writing Free ",a.jsx(Oa,{className:"w-4 h-4 ml-2"})]})})})]})}),a.jsx(Ds,{})]}),Qot=[{category:"Comparisons",title:"Academly vs ChatGPT for Thesis Writing",description:"ChatGPT invents citations. See how Academly only cites your own uploaded sources, with exact page numbers.",href:"/vs/chatgpt",readTime:"5 min"},{category:"Comparisons",title:"Academly vs Jenni AI for Thesis Writing",description:"Jenni helps you write. Academly helps you write from your own sources — with Mayring, APA7, and zero hallucinations.",href:"/vs/jenni-ai",readTime:"5 min"}],Zot=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ai,{title:"Blog — Thesis Writing Guides & Academic Tips | Academly",description:"Step-by-step guides for Bachelor and Master thesis students. Mayring analysis, APA7 citations, research methodology and more.",canonical:"https://academly.ai/blog"}),a.jsx(Jn,{}),a.jsxs("main",{children:[a.jsxs("section",{className:"relative pt-32 pb-16 overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsxs("div",{className:"relative max-w-4xl mx-auto px-6 text-center",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-primary mb-4 font-medium",children:"Blog"}),a.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:"Thesis Writing Guides"}),a.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto leading-relaxed",children:"Practical guides for Bachelor and Master students — from research methods to citations."})]})]}),a.jsx("section",{className:"pb-24",children:a.jsx("div",{className:"max-w-5xl mx-auto px-6",children:a.jsx("div",{className:"grid md:grid-cols-2 gap-6",children:Qot.map(t=>a.jsxs(tt,{to:t.href,className:"group rounded-3xl border border-border bg-card shadow-sm p-8 hover:shadow-md hover:border-primary/30 transition-all flex flex-col",children:[a.jsx("span",{className:"inline-flex items-center self-start rounded-full bg-primary/10 text-primary text-xs font-semibold uppercase tracking-wider px-3 py-1 mb-4",children:t.category}),a.jsx("h2",{className:"text-xl md:text-2xl font-bold text-foreground mb-3 group-hover:text-primary transition-colors",children:t.title}),a.jsx("p",{className:"text-muted-foreground leading-relaxed line-clamp-2 mb-6",children:t.description}),a.jsxs("div",{className:"mt-auto flex items-center justify-between text-sm",children:[a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(sb,{className:"h-4 w-4"}),t.readTime]}),a.jsxs("span",{className:"inline-flex items-center gap-1 font-semibold text-primary",children:["Read more",a.jsx(Oa,{className:"h-4 w-4 transition-transform group-hover:translate-x-0.5"})]})]})]},t.href))})})})]}),a.jsx(Ds,{})]}),vl=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:r,className:Ie("w-full caption-bottom text-sm",t),...e})}));vl.displayName="Table";const bl=S.forwardRef(({className:t,...e},r)=>a.jsx("thead",{ref:r,className:Ie("[&_tr]:border-b",t),...e}));bl.displayName="TableHeader";const wl=S.forwardRef(({className:t,...e},r)=>a.jsx("tbody",{ref:r,className:Ie("[&_tr:last-child]:border-0",t),...e}));wl.displayName="TableBody";const Jot=S.forwardRef(({className:t,...e},r)=>a.jsx("tfoot",{ref:r,className:Ie("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));Jot.displayName="TableFooter";const Cn=S.forwardRef(({className:t,...e},r)=>a.jsx("tr",{ref:r,className:Ie("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));Cn.displayName="TableRow";const yt=S.forwardRef(({className:t,...e},r)=>a.jsx("th",{ref:r,className:Ie("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));yt.displayName="TableHead";const xt=S.forwardRef(({className:t,...e},r)=>a.jsx("td",{ref:r,className:Ie("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));xt.displayName="TableCell";const elt=S.forwardRef(({className:t,...e},r)=>a.jsx("caption",{ref:r,className:Ie("mt-4 text-sm text-muted-foreground",t),...e}));elt.displayName="TableCaption";var dde="AlertDialog",[tlt,ixt]=Bn(dde,[nne]),hd=nne(),hde=t=>{const{__scopeAlertDialog:e,...r}=t,n=hd(e);return a.jsx(P6,{...n,...r,modal:!0})};hde.displayName=dde;var rlt="AlertDialogTrigger",fde=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=hd(r);return a.jsx(O6,{...s,...n,ref:e})});fde.displayName=rlt;var nlt="AlertDialogPortal",pde=t=>{const{__scopeAlertDialog:e,...r}=t,n=hd(e);return a.jsx(I6,{...n,...r})};pde.displayName=nlt;var slt="AlertDialogOverlay",mde=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=hd(r);return a.jsx(Vj,{...s,...n,ref:e})});mde.displayName=slt;var Uy="AlertDialogContent",[ilt,alt]=tlt(Uy),olt=mJ("AlertDialogContent"),gde=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,children:n,...s}=t,i=hd(r),o=S.useRef(null),l=Nt(e,o),c=S.useRef(null);return a.jsx(cCe,{contentName:Uy,titleName:yde,docsSlug:"alert-dialog",children:a.jsx(ilt,{scope:r,cancelRef:c,children:a.jsxs(qj,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:ze(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[a.jsx(olt,{children:n}),a.jsx(clt,{contentRef:o})]})})})});gde.displayName=Uy;var yde="AlertDialogTitle",xde=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=hd(r);return a.jsx(Gj,{...s,...n,ref:e})});xde.displayName=yde;var vde="AlertDialogDescription",bde=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=hd(r);return a.jsx(Kj,{...s,...n,ref:e})});bde.displayName=vde;var llt="AlertDialogAction",wde=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=hd(r);return a.jsx(IT,{...s,...n,ref:e})});wde.displayName=llt;var _de="AlertDialogCancel",jde=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,{cancelRef:s}=alt(_de,r),i=hd(r),o=Nt(e,s);return a.jsx(IT,{...i,...n,ref:o})});jde.displayName=_de;var clt=({contentRef:t})=>{const e=`\`${Uy}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${Uy}\` by passing a \`${vde}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Uy}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return S.useEffect(()=>{var n;document.getElementById((n=t.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},ult=hde,dlt=fde,hlt=pde,Sde=mde,Nde=gde,Ade=wde,Ede=jde,Cde=xde,kde=bde;const ji=ult,jo=dlt,flt=hlt,Tde=S.forwardRef(({className:t,...e},r)=>a.jsx(Sde,{className:Ie("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:r}));Tde.displayName=Sde.displayName;const ei=S.forwardRef(({className:t,...e},r)=>a.jsxs(flt,{children:[a.jsx(Tde,{}),a.jsx(Nde,{ref:r,className:Ie("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));ei.displayName=Nde.displayName;const ti=({className:t,...e})=>a.jsx("div",{className:Ie("flex flex-col space-y-2 text-center sm:text-left",t),...e});ti.displayName="AlertDialogHeader";const ri=({className:t,...e})=>a.jsx("div",{className:Ie("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ri.displayName="AlertDialogFooter";const ni=S.forwardRef(({className:t,...e},r)=>a.jsx(Cde,{ref:r,className:Ie("text-lg font-semibold",t),...e}));ni.displayName=Cde.displayName;const si=S.forwardRef(({className:t,...e},r)=>a.jsx(kde,{ref:r,className:Ie("text-sm text-muted-foreground",t),...e}));si.displayName=kde.displayName;const Os=S.forwardRef(({className:t,...e},r)=>a.jsx(Ade,{ref:r,className:Ie(p6(),t),...e}));Os.displayName=Ade.displayName;const Ls=S.forwardRef(({className:t,...e},r)=>a.jsx(Ede,{ref:r,className:Ie(p6({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Ls.displayName=Ede.displayName;const pi=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),h5=[.001,0,0,.001,0,0],gI=1.35,_a={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Md={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Pde="pdfjs_internal_editor_",kt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101,COMMENT:102},Kt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},plt={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},zs={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},IA={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},On={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},zg={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},z2={ERRORS:0,WARNINGS:1,INFOS:5},ok={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},$N={moveTo:0,lineTo:1,curveTo:2,closePath:3},mlt={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let H2=z2.WARNINGS;function glt(t){Number.isInteger(t)&&(H2=t)}function ylt(){return H2}function W2(t){H2>=z2.INFOS&&console.log(`Info: ${t}`)}function Tt(t){H2>=z2.WARNINGS&&console.log(`Warning: ${t}`)}function _r(t){throw new Error(t)}function Ln(t,e){t||_r(e)}function xlt(t){switch(t==null?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Ode(t,e=null,r=null){if(!t)return null;if(r&&typeof t=="string"){if(r.addDefaultProtocol&&t.startsWith("www.")){const s=t.match(/\./g);(s==null?void 0:s.length)>=2&&(t=`http://${t}`)}if(r.tryConvertEncoding)try{t=jlt(t)}catch{}}const n=e?URL.parse(t,e):URL.parse(t);return xlt(n)?n:null}function Ide(t,e,r=!1){const n=URL.parse(t);return n?(n.hash=e,n.href):r&&Ode(t,"http://example.com")?t.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Ut(t,e,r,n=!1){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!0,writable:!1}),r}const yg=function(){function e(r,n){this.message=r,this.name=n}return e.prototype=new Error,e.constructor=e,e}();class ZG extends yg{constructor(e,r){super(e,"PasswordException"),this.code=r}}class yI extends yg{constructor(e,r){super(e,"UnknownErrorException"),this.details=r}}class f5 extends yg{constructor(e){super(e,"InvalidPDFException")}}class lk extends yg{constructor(e,r,n){super(e,"ResponseException"),this.status=r,this.missing=n}}class vlt extends yg{constructor(e){super(e,"FormatError")}}class nf extends yg{constructor(e){super(e,"AbortException")}}function Rde(t){(typeof t!="object"||(t==null?void 0:t.length)===void 0)&&_r("Invalid argument for bytesToString");const e=t.length,r=8192;if(e<r)return String.fromCharCode.apply(null,t);const n=[];for(let s=0;s<e;s+=r){const i=Math.min(s+r,e),o=t.subarray(s,i);n.push(String.fromCharCode.apply(null,o))}return n.join("")}function dS(t){typeof t!="string"&&_r("Invalid argument for stringToBytes");const e=t.length,r=new Uint8Array(e);for(let n=0;n<e;++n)r[n]=t.charCodeAt(n)&255;return r}function blt(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255)}function wlt(){const t=new Uint8Array(4);return t[0]=1,new Uint32Array(t.buffer,0,1)[0]===1}function _lt(){try{return new Function(""),!0}catch{return!1}}class Is{static get isLittleEndian(){return Ut(this,"isLittleEndian",wlt())}static get isEvalSupported(){return Ut(this,"isEvalSupported",_lt())}static get isOffscreenCanvasSupported(){return Ut(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Ut(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:r}=navigator;return Ut(this,"platform",{isAndroid:r.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:r.includes("Firefox")})}static get isCSSRoundSupported(){var e,r;return Ut(this,"isCSSRoundSupported",(r=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:r.call(e,"width: round(1.5px, 1px)"))}}const xI=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));var zu,RA,p5;class pt{static makeHexColor(e,r,n){return`#${xI[e]}${xI[r]}${xI[n]}`}static scaleMinMax(e,r){let n;e[0]?(e[0]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=e[0],r[2]*=e[0],e[3]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=e[3],r[3]*=e[3]):(n=r[0],r[0]=r[1],r[1]=n,n=r[2],r[2]=r[3],r[3]=n,e[1]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=e[1],r[3]*=e[1],e[2]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=e[2],r[2]*=e[2]),r[0]+=e[4],r[1]+=e[5],r[2]+=e[4],r[3]+=e[5]}static transform(e,r){return[e[0]*r[0]+e[2]*r[1],e[1]*r[0]+e[3]*r[1],e[0]*r[2]+e[2]*r[3],e[1]*r[2]+e[3]*r[3],e[0]*r[4]+e[2]*r[5]+e[4],e[1]*r[4]+e[3]*r[5]+e[5]]}static applyTransform(e,r,n=0){const s=e[n],i=e[n+1];e[n]=s*r[0]+i*r[2]+r[4],e[n+1]=s*r[1]+i*r[3]+r[5]}static applyTransformToBezier(e,r,n=0){const s=r[0],i=r[1],o=r[2],l=r[3],c=r[4],u=r[5];for(let d=0;d<6;d+=2){const h=e[n+d],f=e[n+d+1];e[n+d]=h*s+f*o+c,e[n+d+1]=h*i+f*l+u}}static applyInverseTransform(e,r){const n=e[0],s=e[1],i=r[0]*r[3]-r[1]*r[2];e[0]=(n*r[3]-s*r[2]+r[2]*r[5]-r[4]*r[3])/i,e[1]=(-n*r[1]+s*r[0]+r[4]*r[1]-r[5]*r[0])/i}static axialAlignedBoundingBox(e,r,n){const s=r[0],i=r[1],o=r[2],l=r[3],c=r[4],u=r[5],d=e[0],h=e[1],f=e[2],p=e[3];let g=s*d+c,m=g,x=s*f+c,y=x,v=l*h+u,b=v,w=l*p+u,j=w;if(i!==0||o!==0){const N=i*d,C=i*f,k=o*h,E=o*p;g+=k,y+=k,x+=E,m+=E,v+=N,j+=N,w+=C,b+=C}n[0]=Math.min(n[0],g,x,m,y),n[1]=Math.min(n[1],v,w,b,j),n[2]=Math.max(n[2],g,x,m,y),n[3]=Math.max(n[3],v,w,b,j)}static inverseTransform(e){const r=e[0]*e[3]-e[1]*e[2];return[e[3]/r,-e[1]/r,-e[2]/r,e[0]/r,(e[2]*e[5]-e[4]*e[3])/r,(e[4]*e[1]-e[5]*e[0])/r]}static singularValueDecompose2dScale(e,r){const n=e[0],s=e[1],i=e[2],o=e[3],l=n**2+s**2,c=n*i+s*o,u=i**2+o**2,d=(l+u)/2,h=Math.sqrt(d**2-(l*u-c**2));r[0]=Math.sqrt(d+h||1),r[1]=Math.sqrt(d-h||1)}static normalizeRect(e){const r=e.slice(0);return e[0]>e[2]&&(r[0]=e[2],r[2]=e[0]),e[1]>e[3]&&(r[1]=e[3],r[3]=e[1]),r}static intersect(e,r){const n=Math.max(Math.min(e[0],e[2]),Math.min(r[0],r[2])),s=Math.min(Math.max(e[0],e[2]),Math.max(r[0],r[2]));if(n>s)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(r[1],r[3])),o=Math.min(Math.max(e[1],e[3]),Math.max(r[1],r[3]));return i>o?null:[n,i,s,o]}static pointBoundingBox(e,r,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],r),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],r)}static rectBoundingBox(e,r,n,s,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],r,s),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],r,s)}static bezierBoundingBox(e,r,n,s,i,o,l,c,u){u[0]=Math.min(u[0],e,l),u[1]=Math.min(u[1],r,c),u[2]=Math.max(u[2],e,l),u[3]=Math.max(u[3],r,c),ce(this,zu,p5).call(this,e,n,i,l,r,s,o,c,3*(-e+3*(n-i)+l),6*(e-2*n+i),3*(n-e),u),ce(this,zu,p5).call(this,e,n,i,l,r,s,o,c,3*(-r+3*(s-o)+c),6*(r-2*s+o),3*(s-r),u)}}zu=new WeakSet,RA=function(e,r,n,s,i,o,l,c,u,d){if(u<=0||u>=1)return;const h=1-u,f=u*u,p=f*u,g=h*(h*(h*e+3*u*r)+3*f*n)+p*s,m=h*(h*(h*i+3*u*o)+3*f*l)+p*c;d[0]=Math.min(d[0],g),d[1]=Math.min(d[1],m),d[2]=Math.max(d[2],g),d[3]=Math.max(d[3],m)},p5=function(e,r,n,s,i,o,l,c,u,d,h,f){if(Math.abs(u)<1e-12){Math.abs(d)>=1e-12&&ce(this,zu,RA).call(this,e,r,n,s,i,o,l,c,-h/d,f);return}const p=d**2-4*h*u;if(p<0)return;const g=Math.sqrt(p),m=2*u;ce(this,zu,RA).call(this,e,r,n,s,i,o,l,c,(-d+g)/m,f),ce(this,zu,RA).call(this,e,r,n,s,i,o,l,c,(-d-g)/m,f)},se(pt,zu);function jlt(t){return decodeURIComponent(escape(t))}let vI=null,JG=null;function Slt(t){return vI||(vI=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,JG=new Map([["ſt","ſt"]])),t.replaceAll(vI,(e,r,n)=>r?r.normalize("NFKC"):JG.get(n))}function Mde(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),Rde(t)}const Y8="pdfjs_internal_id_";function Nlt(t,e,r){if(!Array.isArray(r)||r.length<2)return!1;const[n,s,...i]=r;if(!t(n)&&!Number.isInteger(n)||!e(s))return!1;const o=i.length;let l=!0;switch(s.name){case"XYZ":if(o<2||o>3)return!1;break;case"Fit":case"FitB":return o===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(o>1)return!1;break;case"FitR":if(o!==4)return!1;l=!1;break;default:return!1}for(const c of i)if(!(typeof c=="number"||l&&c===null))return!1;return!0}function mi(t,e,r){return Math.min(Math.max(t,e),r)}function Dde(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(Rde(t))}function Alt(t){return Uint8Array.fromBase64?Uint8Array.fromBase64(t):dS(atob(t))}typeof Promise.try!="function"&&(Promise.try=function(t,...e){return new Promise(r=>{r(t(...e))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(t){return t.reduce((e,r)=>e+r,0)});const Bc="http://www.w3.org/2000/svg",ep=class ep{};Le(ep,"CSS",96),Le(ep,"PDF",72),Le(ep,"PDF_TO_CSS_UNITS",ep.CSS/ep.PDF);let sf=ep;async function hS(t,e="text"){if(I0(t,document.baseURI)){const r=await fetch(t);if(!r.ok)throw new Error(r.statusText);switch(e){case"arraybuffer":return r.arrayBuffer();case"blob":return r.blob();case"json":return r.json()}return r.text()}return new Promise((r,n)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType=e,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(s.status===200||s.status===0){switch(e){case"arraybuffer":case"blob":case"json":r(s.response);return}r(s.responseText);return}n(new Error(s.statusText))}},s.send(null)})}class fS{constructor({viewBox:e,userUnit:r,scale:n,rotation:s,offsetX:i=0,offsetY:o=0,dontFlip:l=!1}){this.viewBox=e,this.userUnit=r,this.scale=n,this.rotation=s,this.offsetX=i,this.offsetY=o,n*=r;const c=(e[2]+e[0])/2,u=(e[3]+e[1])/2;let d,h,f,p;switch(s%=360,s<0&&(s+=360),s){case 180:d=-1,h=0,f=0,p=1;break;case 90:d=0,h=1,f=1,p=0;break;case 270:d=0,h=-1,f=-1,p=0;break;case 0:d=1,h=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}l&&(f=-f,p=-p);let g,m,x,y;d===0?(g=Math.abs(u-e[1])*n+i,m=Math.abs(c-e[0])*n+o,x=(e[3]-e[1])*n,y=(e[2]-e[0])*n):(g=Math.abs(c-e[0])*n+i,m=Math.abs(u-e[1])*n+o,x=(e[2]-e[0])*n,y=(e[3]-e[1])*n),this.transform=[d*n,h*n,f*n,p*n,g-d*n*c-f*n*u,m-h*n*c-p*n*u],this.width=x,this.height=y}get rawDims(){const e=this.viewBox;return Ut(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:r=this.rotation,offsetX:n=this.offsetX,offsetY:s=this.offsetY,dontFlip:i=!1}={}){return new fS({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:r,offsetX:n,offsetY:s,dontFlip:i})}convertToViewportPoint(e,r){const n=[e,r];return pt.applyTransform(n,this.transform),n}convertToViewportRectangle(e){const r=[e[0],e[1]];pt.applyTransform(r,this.transform);const n=[e[2],e[3]];return pt.applyTransform(n,this.transform),[r[0],r[1],n[0],n[1]]}convertToPdfPoint(e,r){const n=[e,r];return pt.applyInverseTransform(n,this.transform),n}}class X8 extends yg{constructor(e,r=0){super(e,"RenderingCancelledException"),this.extraDelay=r}}function V2(t){const e=t.length;let r=0;for(;r<e&&t[r].trim()==="";)r++;return t.substring(r,r+5).toLowerCase()==="data:"}function Q8(t){return typeof t=="string"&&/\.pdf$/i.test(t)}function Elt(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function Clt(t,e="document.pdf"){if(typeof t!="string")return e;if(V2(t))return Tt('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const n=(l=>{try{return new URL(l)}catch{try{return new URL(decodeURIComponent(l))}catch{try{return new URL(l,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(l),"https://foo.bar")}catch{return null}}}}})(t);if(!n)return e;const s=l=>{try{let c=decodeURIComponent(l);return c.includes("/")?(c=c.split("/").at(-1),c.test(/^\.pdf$/i)?c:l):c}catch{return l}},i=/\.pdf$/i,o=n.pathname.split("/").at(-1);if(i.test(o))return s(o);if(n.searchParams.size>0){const l=Array.from(n.searchParams.values()).reverse();for(const u of l)if(i.test(u))return s(u);const c=Array.from(n.searchParams.keys()).reverse();for(const u of c)if(i.test(u))return s(u)}if(n.hash){const c=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(c)return s(c[0])}return e}class eK{constructor(){Le(this,"started",Object.create(null));Le(this,"times",[])}time(e){e in this.started&&Tt(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Tt(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let r=0;for(const{name:n}of this.times)r=Math.max(n.length,r);for(const{name:n,start:s,end:i}of this.times)e.push(`${n.padEnd(r)} ${i-s}ms
`);return e.join("")}}function I0(t,e){const r=e?URL.parse(t,e):URL.parse(t);return(r==null?void 0:r.protocol)==="http:"||(r==null?void 0:r.protocol)==="https:"}function So(t){t.preventDefault()}function Mn(t){t.preventDefault(),t.stopPropagation()}function klt(t){console.log("Deprecated API usage: "+t)}var X1;class ck{static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;_(this,X1)||Q(this,X1,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const r=_(this,X1).exec(e);if(!r)return null;const n=parseInt(r[1],10);let s=parseInt(r[2],10);s=s>=1&&s<=12?s-1:0;let i=parseInt(r[3],10);i=i>=1&&i<=31?i:1;let o=parseInt(r[4],10);o=o>=0&&o<=23?o:0;let l=parseInt(r[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(r[6],10);c=c>=0&&c<=59?c:0;const u=r[7]||"Z";let d=parseInt(r[8],10);d=d>=0&&d<=23?d:0;let h=parseInt(r[9],10)||0;return h=h>=0&&h<=59?h:0,u==="-"?(o+=d,l+=h):u==="+"&&(o-=d,l-=h),new Date(Date.UTC(n,s,i,o,l,c))}}X1=new WeakMap,se(ck,X1);function Tlt(t,{scale:e=1,rotation:r=0}){const{width:n,height:s}=t.attributes.style,i=[0,0,parseInt(n),parseInt(s)];return new fS({viewBox:i,userUnit:1,scale:e,rotation:r})}function q2(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(e=>parseInt(e)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(Tt(`Not a valid color format: "${t}"`),[0,0,0])}function Plt(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const r of t.keys()){e.style.color=r;const n=window.getComputedStyle(e).color;t.set(r,q2(n))}e.remove()}function tn(t){const{a:e,b:r,c:n,d:s,e:i,f:o}=t.getTransform();return[e,r,n,s,i,o]}function Nl(t){const{a:e,b:r,c:n,d:s,e:i,f:o}=t.getTransform().invertSelf();return[e,r,n,s,i,o]}function Jm(t,e,r=!1,n=!0){if(e instanceof fS){const{pageWidth:s,pageHeight:i}=e.rawDims,{style:o}=t,l=Is.isCSSRoundSupported,c=`var(--total-scale-factor) * ${s}px`,u=`var(--total-scale-factor) * ${i}px`,d=l?`round(down, ${c}, var(--scale-round-x))`:`calc(${c})`,h=l?`round(down, ${u}, var(--scale-round-y))`:`calc(${u})`;!r||e.rotation%180===0?(o.width=d,o.height=h):(o.width=h,o.height=d)}n&&t.setAttribute("data-main-rotation",e.rotation)}class jc{constructor(){const{pixelRatio:e}=jc;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,r,n,s,i=-1){let o=1/0,l=1/0,c=1/0;n=jc.capPixels(n,i),n>0&&(o=Math.sqrt(n/(e*r))),s!==-1&&(l=s/e,c=s/r);const u=Math.min(o,l,c);return this.sx>u||this.sy>u?(this.sx=u,this.sy=u,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,r){if(r>=0){const n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+r/100));return e>0?Math.min(e,n):n}return e}}const m5=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];var qd,Gd,Ka,Jc,Q1,nx,sx,Z1,wk,Lde,Cs,Fde,$de,Hg,R0;const Kc=class Kc{constructor(e){se(this,Cs);se(this,qd,null);se(this,Gd,null);se(this,Ka);se(this,Jc,null);se(this,Q1,null);se(this,nx,null);se(this,sx,null);Q(this,Ka,e),_(Kc,Z1)||Q(Kc,Z1,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const e=Q(this,qd,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const r=_(this,Ka)._uiManager._signal;e.addEventListener("contextmenu",So,{signal:r}),e.addEventListener("pointerdown",ce(Kc,wk,Lde),{signal:r});const n=Q(this,Jc,document.createElement("div"));n.className="buttons",e.append(n);const s=_(this,Ka).toolbarPosition;if(s){const{style:i}=e,o=_(this,Ka)._uiManager.direction==="ltr"?1-s[0]:s[0];i.insetInlineEnd=`${100*o}%`,i.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return _(this,qd)}hide(){var e;_(this,qd).classList.add("hidden"),(e=_(this,Gd))==null||e.hideDropdown()}show(){var e,r;_(this,qd).classList.remove("hidden"),(e=_(this,Q1))==null||e.shown(),(r=_(this,nx))==null||r.shown()}addDeleteButton(){const{editorType:e,_uiManager:r}=_(this,Ka),n=document.createElement("button");n.className="delete",n.tabIndex=0,n.setAttribute("data-l10n-id",_(Kc,Z1)[e]),ce(this,Cs,Hg).call(this,n),n.addEventListener("click",s=>{r.delete()},{signal:r._signal}),_(this,Jc).append(n)}async addAltText(e){const r=await e.render();ce(this,Cs,Hg).call(this,r),_(this,Jc).append(r,_(this,Cs,R0)),Q(this,Q1,e)}addComment(e){if(_(this,nx))return;const r=e.render();r&&(ce(this,Cs,Hg).call(this,r),_(this,Jc).prepend(r,_(this,Cs,R0)),Q(this,nx,e),e.toolbar=this)}addColorPicker(e){if(_(this,Gd))return;Q(this,Gd,e);const r=e.renderButton();ce(this,Cs,Hg).call(this,r),_(this,Jc).append(r,_(this,Cs,R0))}async addEditSignatureButton(e){const r=Q(this,sx,await e.renderEditButton(_(this,Ka)));ce(this,Cs,Hg).call(this,r),_(this,Jc).append(r,_(this,Cs,R0))}async addButton(e,r){switch(e){case"colorPicker":this.addColorPicker(r);break;case"altText":await this.addAltText(r);break;case"editSignature":await this.addEditSignatureButton(r);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(r);break}}updateEditSignatureButton(e){_(this,sx)&&(_(this,sx).title=e)}remove(){var e;_(this,qd).remove(),(e=_(this,Gd))==null||e.destroy(),Q(this,Gd,null)}};qd=new WeakMap,Gd=new WeakMap,Ka=new WeakMap,Jc=new WeakMap,Q1=new WeakMap,nx=new WeakMap,sx=new WeakMap,Z1=new WeakMap,wk=new WeakSet,Lde=function(e){e.stopPropagation()},Cs=new WeakSet,Fde=function(e){_(this,Ka)._focusEventsAllowed=!1,Mn(e)},$de=function(e){_(this,Ka)._focusEventsAllowed=!0,Mn(e)},Hg=function(e){const r=_(this,Ka)._uiManager._signal;e.addEventListener("focusin",ce(this,Cs,Fde).bind(this),{capture:!0,signal:r}),e.addEventListener("focusout",ce(this,Cs,$de).bind(this),{capture:!0,signal:r}),e.addEventListener("contextmenu",So,{signal:r})},R0=function(){const e=document.createElement("div");return e.className="divider",e},se(Kc,wk),se(Kc,Z1,null);let g5=Kc;var J1,Sp,Np,af,Bde,Ude,zde;class Olt{constructor(e){se(this,af);se(this,J1,null);se(this,Sp,null);se(this,Np);Q(this,Np,e)}show(e,r,n){const[s,i]=ce(this,af,Ude).call(this,r,n),{style:o}=_(this,Sp)||Q(this,Sp,ce(this,af,Bde).call(this));e.append(_(this,Sp)),o.insetInlineEnd=`${100*s}%`,o.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){_(this,Sp).remove()}}J1=new WeakMap,Sp=new WeakMap,Np=new WeakMap,af=new WeakSet,Bde=function(){const e=Q(this,Sp,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",So,{signal:_(this,Np)._signal});const r=Q(this,J1,document.createElement("div"));return r.className="buttons",e.append(r),ce(this,af,zde).call(this),e},Ude=function(e,r){let n=0,s=0;for(const i of e){const o=i.y+i.height;if(o<n)continue;const l=i.x+(r?i.width:0);if(o>n){s=l,n=o;continue}r?l>s&&(s=l):l<s&&(s=l)}return[r?1-s:s,n]},zde=function(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const r=document.createElement("span");e.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const n=_(this,Np)._signal;e.addEventListener("contextmenu",So,{signal:n}),e.addEventListener("click",()=>{_(this,Np).highlightSelection("floating_button")},{signal:n}),_(this,J1).append(e)};function Hde(t,e,r){for(const n of r)e.addEventListener(n,t[n].bind(t))}var _k;class Ilt{constructor(){se(this,_k,0)}get id(){return`${Pde}${ns(this,_k)._++}`}}_k=new WeakMap;var ix,e_,qs,ax,MA;const IB=class IB{constructor(){se(this,ax);se(this,ix,Mde());se(this,e_,0);se(this,qs,null)}static get _isSVGFittingCanvas(){const e='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src=e;const i=s.decode().then(()=>(n.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return Ut(this,"_isSVGFittingCanvas",i)}async getFromFile(e){const{lastModified:r,name:n,size:s,type:i}=e;return ce(this,ax,MA).call(this,`${r}_${n}_${s}_${i}`,e)}async getFromUrl(e){return ce(this,ax,MA).call(this,e,e)}async getFromBlob(e,r){const n=await r;return ce(this,ax,MA).call(this,e,n)}async getFromId(e){_(this,qs)||Q(this,qs,new Map);const r=_(this,qs).get(e);if(!r)return null;if(r.bitmap)return r.refCounter+=1,r;if(r.file)return this.getFromFile(r.file);if(r.blobPromise){const{blobPromise:n}=r;return delete r.blobPromise,this.getFromBlob(r.id,n)}return this.getFromUrl(r.url)}getFromCanvas(e,r){_(this,qs)||Q(this,qs,new Map);let n=_(this,qs).get(e);if(n!=null&&n.bitmap)return n.refCounter+=1,n;const s=new OffscreenCanvas(r.width,r.height);return s.getContext("2d").drawImage(r,0,0),n={bitmap:s.transferToImageBitmap(),id:`image_${_(this,ix)}_${ns(this,e_)._++}`,refCounter:1,isSvg:!1},_(this,qs).set(e,n),_(this,qs).set(n.id,n),n}getSvgUrl(e){const r=_(this,qs).get(e);return r!=null&&r.isSvg?r.svgUrl:null}deleteId(e){var s;_(this,qs)||Q(this,qs,new Map);const r=_(this,qs).get(e);if(!r||(r.refCounter-=1,r.refCounter!==0))return;const{bitmap:n}=r;if(!r.url&&!r.file){const i=new OffscreenCanvas(n.width,n.height);i.getContext("bitmaprenderer").transferFromImageBitmap(n),r.blobPromise=i.convertToBlob()}(s=n.close)==null||s.call(n),r.bitmap=null}isValidId(e){return e.startsWith(`image_${_(this,ix)}_`)}};ix=new WeakMap,e_=new WeakMap,qs=new WeakMap,ax=new WeakSet,MA=async function(e,r){_(this,qs)||Q(this,qs,new Map);let n=_(this,qs).get(e);if(n===null)return null;if(n!=null&&n.bitmap)return n.refCounter+=1,n;try{n||(n={bitmap:null,id:`image_${_(this,ix)}_${ns(this,e_)._++}`,refCounter:0,isSvg:!1});let s;if(typeof r=="string"?(n.url=r,s=await hS(r,"blob")):r instanceof File?s=n.file=r:r instanceof Blob&&(s=r),s.type==="image/svg+xml"){const i=IB._isSVGFittingCanvas,o=new FileReader,l=new Image,c=new Promise((u,d)=>{l.onload=()=>{n.bitmap=l,n.isSvg=!0,u()},o.onload=async()=>{const h=n.svgUrl=o.result;l.src=await i?`${h}#svgView(preserveAspectRatio(none))`:h},l.onerror=o.onerror=d});o.readAsDataURL(s),await c}else n.bitmap=await createImageBitmap(s);n.refCounter=1}catch(s){Tt(s),n=null}return _(this,qs).set(e,n),n&&_(this,qs).set(n.id,n),n};let y5=IB;var _n,Kd,t_,en;class Rlt{constructor(e=128){se(this,_n,[]);se(this,Kd,!1);se(this,t_);se(this,en,-1);Q(this,t_,e)}add({cmd:e,undo:r,post:n,mustExec:s,type:i=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(s&&e(),_(this,Kd))return;const c={cmd:e,undo:r,post:n,type:i};if(_(this,en)===-1){_(this,_n).length>0&&(_(this,_n).length=0),Q(this,en,0),_(this,_n).push(c);return}if(o&&_(this,_n)[_(this,en)].type===i){l&&(c.undo=_(this,_n)[_(this,en)].undo),_(this,_n)[_(this,en)]=c;return}const u=_(this,en)+1;u===_(this,t_)?_(this,_n).splice(0,1):(Q(this,en,u),u<_(this,_n).length&&_(this,_n).splice(u)),_(this,_n).push(c)}undo(){if(_(this,en)===-1)return;Q(this,Kd,!0);const{undo:e,post:r}=_(this,_n)[_(this,en)];e(),r==null||r(),Q(this,Kd,!1),Q(this,en,_(this,en)-1)}redo(){if(_(this,en)<_(this,_n).length-1){Q(this,en,_(this,en)+1),Q(this,Kd,!0);const{cmd:e,post:r}=_(this,_n)[_(this,en)];e(),r==null||r(),Q(this,Kd,!1)}}hasSomethingToUndo(){return _(this,en)!==-1}hasSomethingToRedo(){return _(this,en)<_(this,_n).length-1}cleanType(e){if(_(this,en)!==-1){for(let r=_(this,en);r>=0;r--)if(_(this,_n)[r].type!==e){_(this,_n).splice(r+1,_(this,en)-r),Q(this,en,r);return}_(this,_n).length=0,Q(this,en,-1)}}destroy(){Q(this,_n,null)}}_n=new WeakMap,Kd=new WeakMap,t_=new WeakMap,en=new WeakMap;var jk,Wde;class pS{constructor(e){se(this,jk);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:r}=Is.platform;for(const[n,s,i={}]of e)for(const o of n){const l=o.startsWith("mac+");r&&l?(this.callbacks.set(o.slice(4),{callback:s,options:i}),this.allKeys.add(o.split("+").at(-1))):!r&&!l&&(this.callbacks.set(o,{callback:s,options:i}),this.allKeys.add(o.split("+").at(-1)))}}exec(e,r){if(!this.allKeys.has(r.key))return;const n=this.callbacks.get(ce(this,jk,Wde).call(this,r));if(!n)return;const{callback:s,options:{bubbles:i=!1,args:o=[],checker:l=null}}=n;l&&!l(e,r)||(s.bind(e,...o,r)(),i||Mn(r))}}jk=new WeakSet,Wde=function(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const r=this.buffer.join("+");return this.buffer.length=0,r};const Sk=class Sk{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return Plt(e),Ut(this,"_colors",e)}convert(e){const r=q2(e);if(!window.matchMedia("(forced-colors: active)").matches)return r;for(const[n,s]of this._colors)if(s.every((i,o)=>i===r[o]))return Sk._colorsMapping.get(n);return r}getHexCode(e){const r=this._colors.get(e);return r?pt.makeHexColor(...r):e}};Le(Sk,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let x5=Sk;var ox,oa,Vn,gs,lx,eu,cx,Ya,Ap,Yd,Xd,ux,Ep,Dl,Bo,Cp,r_,n_,dx,s_,Ll,Qd,hx,Zd,Fl,Nk,Jd,i_,eh,kp,fx,th,a_,ss,fr,tu,rh,nh,o_,l_,sh,$l,ru,c_,u_,Xa,Qe,DA,v5,Vde,qde,LA,Gde,Kde,Yde,b5,Xde,w5,_5,Qde,oi,Uc,Zde,Jde,j5,ehe,M0,S5;const by=class by{constructor(e,r,n,s,i,o,l,c,u,d,h,f,p,g,m,x){se(this,Qe);se(this,ox,new AbortController);se(this,oa,null);se(this,Vn,new Map);se(this,gs,new Map);se(this,lx,null);se(this,eu,null);se(this,cx,null);se(this,Ya,new Rlt);se(this,Ap,null);se(this,Yd,null);se(this,Xd,null);se(this,ux,0);se(this,Ep,new Set);se(this,Dl,null);se(this,Bo,null);se(this,Cp,new Set);Le(this,"_editorUndoBar",null);se(this,r_,!1);se(this,n_,!1);se(this,dx,!1);se(this,s_,null);se(this,Ll,null);se(this,Qd,null);se(this,hx,null);se(this,Zd,!1);se(this,Fl,null);se(this,Nk,new Ilt);se(this,Jd,!1);se(this,i_,!1);se(this,eh,null);se(this,kp,null);se(this,fx,null);se(this,th,null);se(this,a_,null);se(this,ss,kt.NONE);se(this,fr,new Set);se(this,tu,null);se(this,rh,null);se(this,nh,null);se(this,o_,null);se(this,l_,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});se(this,sh,[0,0]);se(this,$l,null);se(this,ru,null);se(this,c_,null);se(this,u_,null);se(this,Xa,null);const y=this._signal=_(this,ox).signal;Q(this,ru,e),Q(this,c_,r),Q(this,u_,n),Q(this,lx,s),Q(this,Ap,i),Q(this,rh,o),this._eventBus=l,l._on("editingaction",this.onEditingAction.bind(this),{signal:y}),l._on("pagechanging",this.onPageChanging.bind(this),{signal:y}),l._on("scalechanging",this.onScaleChanging.bind(this),{signal:y}),l._on("rotationchanging",this.onRotationChanging.bind(this),{signal:y}),l._on("setpreference",this.onSetPreference.bind(this),{signal:y}),l._on("switchannotationeditorparams",v=>this.updateParams(v.type,v.value),{signal:y}),ce(this,Qe,Gde).call(this),ce(this,Qe,Qde).call(this),ce(this,Qe,b5).call(this),Q(this,eu,c.annotationStorage),Q(this,s_,c.filterFactory),Q(this,nh,u),Q(this,hx,d||null),Q(this,r_,h),Q(this,n_,f),Q(this,dx,p),Q(this,a_,g||null),this.viewParameters={realScale:sf.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=m||null,this._supportsPinchToZoom=x!==!1}static get _keyboardManager(){const e=by.prototype,r=o=>_(o,ru).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&o.hasSomethingToControl(),n=(o,{target:l})=>{if(l instanceof HTMLInputElement){const{type:c}=l;return c!=="text"&&c!=="number"}return!0},s=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return Ut(this,"_keyboardManager",new pS([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],e.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:n}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&_(o,ru).contains(l)&&!o.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&_(o,ru).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:r}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:r}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:r}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:r}]]))}destroy(){var e,r,n,s,i,o,l,c,u;(e=_(this,Xa))==null||e.resolve(),Q(this,Xa,null),(r=_(this,ox))==null||r.abort(),Q(this,ox,null),this._signal=null;for(const d of _(this,gs).values())d.destroy();_(this,gs).clear(),_(this,Vn).clear(),_(this,Cp).clear(),(n=_(this,th))==null||n.clear(),Q(this,oa,null),_(this,fr).clear(),_(this,Ya).destroy(),(s=_(this,lx))==null||s.destroy(),(i=_(this,Ap))==null||i.destroy(),(o=_(this,rh))==null||o.destroy(),(l=_(this,Fl))==null||l.hide(),Q(this,Fl,null),(c=_(this,fx))==null||c.destroy(),Q(this,fx,null),_(this,Ll)&&(clearTimeout(_(this,Ll)),Q(this,Ll,null)),_(this,$l)&&(clearTimeout(_(this,$l)),Q(this,$l,null)),(u=this._editorUndoBar)==null||u.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return _(this,a_)}get useNewAltTextFlow(){return _(this,n_)}get useNewAltTextWhenAddingImage(){return _(this,dx)}get hcmFilter(){return Ut(this,"hcmFilter",_(this,nh)?_(this,s_).addHCMFilter(_(this,nh).foreground,_(this,nh).background):"none")}get direction(){return Ut(this,"direction",getComputedStyle(_(this,ru)).direction)}get _highlightColors(){return Ut(this,"_highlightColors",_(this,hx)?new Map(_(this,hx).split(",").map(e=>(e=e.split("=").map(r=>r.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return Ut(this,"highlightColors",null);const r=new Map,n=!!_(this,nh);for(const[s,i]of e){const o=s.endsWith("_HCM");if(n&&o){r.set(s.replace("_HCM",""),i);continue}!n&&!o&&r.set(s,i)}return Ut(this,"highlightColors",r)}get highlightColorNames(){return Ut(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;const r=this.highlightColorNames.get(e);return this._highlightColors.get(r)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),Q(this,Xd,e)}setMainHighlightColorPicker(e){Q(this,fx,e)}editAltText(e,r=!1){var n;(n=_(this,lx))==null||n.editAltText(this,e,r)}hasCommentManager(){return!!_(this,Ap)}editComment(e,r){var n;(n=_(this,Ap))==null||n.open(this,e,r)}getSignature(e){var r;(r=_(this,rh))==null||r.getSignature({uiManager:this,editor:e})}get signatureManager(){return _(this,rh)}switchToMode(e,r){this._eventBus.on("annotationeditormodechanged",r,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,r){this._eventBus.dispatch("setpreference",{source:this,name:e,value:r})}onSetPreference({name:e,value:r}){switch(e){case"enableNewAltTextWhenAddingImage":Q(this,dx,r);break}}onPageChanging({pageNumber:e}){Q(this,ux,e-1)}focusMainContainer(){_(this,ru).focus()}findParent(e,r){for(const n of _(this,gs).values()){const{x:s,y:i,width:o,height:l}=n.div.getBoundingClientRect();if(e>=s&&e<=s+o&&r>=i&&r<=i+l)return n}return null}disableUserSelect(e=!1){_(this,c_).classList.toggle("noUserSelect",e)}addShouldRescale(e){_(this,Cp).add(e)}removeShouldRescale(e){_(this,Cp).delete(e)}onScaleChanging({scale:e}){var r;this.commitOrRemove(),this.viewParameters.realScale=e*sf.PDF_TO_CSS_UNITS;for(const n of _(this,Cp))n.onScaleChanging();(r=_(this,Xd))==null||r.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const r=document.getSelection();if(!r||r.isCollapsed)return;const{anchorNode:n,anchorOffset:s,focusNode:i,focusOffset:o}=r,l=r.toString(),u=ce(this,Qe,DA).call(this,r).closest(".textLayer"),d=this.getSelectionBoxes(u);if(!d)return;r.empty();const h=ce(this,Qe,v5).call(this,u),f=_(this,ss)===kt.NONE,p=()=>{h==null||h.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:n,anchorOffset:s,focusNode:i,focusOffset:o,text:l}),f&&this.showAllEditors("highlight",!0,!0)};if(f){this.switchToMode(kt.HIGHLIGHT,p);return}p()}addToAnnotationStorage(e){!e.isEmpty()&&_(this,eu)&&!_(this,eu).has(e.id)&&_(this,eu).setValue(e.id,e)}a11yAlert(e,r=null){const n=_(this,u_);n&&(n.setAttribute("data-l10n-id",e),r?n.setAttribute("data-l10n-args",JSON.stringify(r)):n.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,_(this,Zd)&&(Q(this,Zd,!1),ce(this,Qe,LA).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const r of _(this,fr))if(r.div.contains(e)){Q(this,kp,[r,e]),r._focusEventsAllowed=!1;break}}focus(){if(!_(this,kp))return;const[e,r]=_(this,kp);Q(this,kp,null),r.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),r.focus()}addEditListeners(){ce(this,Qe,b5).call(this),ce(this,Qe,w5).call(this)}removeEditListeners(){ce(this,Qe,Xde).call(this),ce(this,Qe,_5).call(this)}dragOver(e){for(const{type:r}of e.dataTransfer.items)for(const n of _(this,Bo))if(n.isHandlingMimeForPasting(r)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const r of e.dataTransfer.items)for(const n of _(this,Bo))if(n.isHandlingMimeForPasting(r.type)){n.paste(r,this.currentLayer),e.preventDefault();return}}copy(e){var n;if(e.preventDefault(),(n=_(this,oa))==null||n.commitOrRemove(),!this.hasSelection)return;const r=[];for(const s of _(this,fr)){const i=s.serialize(!0);i&&r.push(i)}r.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(r))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:r}=e;for(const i of r.items)for(const o of _(this,Bo))if(o.isHandlingMimeForPasting(i.type)){o.paste(i,this.currentLayer);return}let n=r.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(i){Tt(`paste: "${i.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const s=this.currentLayer;try{const i=[];for(const c of n){const u=await s.deserialize(c);if(!u)return;i.push(u)}const o=()=>{for(const c of i)ce(this,Qe,j5).call(this,c);ce(this,Qe,S5).call(this,i)},l=()=>{for(const c of i)c.remove()};this.addCommands({cmd:o,undo:l,mustExec:!0})}catch(i){Tt(`paste: "${i.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),_(this,ss)!==kt.NONE&&!this.isEditorHandlingKeyboard&&by._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,_(this,Zd)&&(Q(this,Zd,!1),ce(this,Qe,LA).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(e){e?(ce(this,Qe,Kde).call(this),ce(this,Qe,w5).call(this),ce(this,Qe,oi).call(this,{isEditing:_(this,ss)!==kt.NONE,isEmpty:ce(this,Qe,M0).call(this),hasSomethingToUndo:_(this,Ya).hasSomethingToUndo(),hasSomethingToRedo:_(this,Ya).hasSomethingToRedo(),hasSelectedEditor:!1})):(ce(this,Qe,Yde).call(this),ce(this,Qe,_5).call(this),ce(this,Qe,oi).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!_(this,Bo)){Q(this,Bo,e);for(const r of _(this,Bo))ce(this,Qe,Uc).call(this,r.defaultPropertiesToUpdate)}}getId(){return _(this,Nk).id}get currentLayer(){return _(this,gs).get(_(this,ux))}getLayer(e){return _(this,gs).get(e)}get currentPageIndex(){return _(this,ux)}addLayer(e){_(this,gs).set(e.pageIndex,e),_(this,Jd)?e.enable():e.disable()}removeLayer(e){_(this,gs).delete(e.pageIndex)}async updateMode(e,r=null,n=!1,s=!1,i=!1){var o,l,c;if(_(this,ss)!==e&&!(_(this,Xa)&&(await _(this,Xa).promise,!_(this,Xa)))){if(Q(this,Xa,Promise.withResolvers()),(o=_(this,Xd))==null||o.commitOrRemove(),Q(this,ss,e),e===kt.NONE){this.setEditingState(!1),ce(this,Qe,Jde).call(this),(l=this._editorUndoBar)==null||l.hide(),_(this,Xa).resolve();return}e===kt.SIGNATURE&&await((c=_(this,rh))==null?void 0:c.loadSignatures()),this.setEditingState(!0),await ce(this,Qe,Zde).call(this),this.unselectAll();for(const u of _(this,gs).values())u.updateMode(e);if(!r){n&&this.addNewEditorFromKeyboard(),_(this,Xa).resolve();return}for(const u of _(this,Vn).values())u.annotationElementId===r||u.id===r?(this.setSelected(u),i?u.editComment():s&&u.enterInEditMode()):u.unselect();_(this,Xa).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==_(this,ss)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,r){if(_(this,Bo)){switch(e){case Kt.CREATE:this.currentLayer.addNewEditor(r);return;case Kt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(_(this,o_)||Q(this,o_,new Map)).set(e,r),this.showAllEditors("highlight",r);break}if(this.hasSelection)for(const n of _(this,fr))n.updateParams(e,r);else for(const n of _(this,Bo))n.updateDefaultParams(e,r)}}showAllEditors(e,r,n=!1){var i;for(const o of _(this,Vn).values())o.editorType===e&&o.show(r);(((i=_(this,o_))==null?void 0:i.get(Kt.HIGHLIGHT_SHOW_ALL))??!0)!==r&&ce(this,Qe,Uc).call(this,[[Kt.HIGHLIGHT_SHOW_ALL,r]])}enableWaiting(e=!1){if(_(this,i_)!==e){Q(this,i_,e);for(const r of _(this,gs).values())e?r.disableClick():r.enableClick(),r.div.classList.toggle("waiting",e)}}getEditors(e){const r=[];for(const n of _(this,Vn).values())n.pageIndex===e&&r.push(n);return r}getEditor(e){return _(this,Vn).get(e)}addEditor(e){_(this,Vn).set(e.id,e)}removeEditor(e){var r,n;e.div.contains(document.activeElement)&&(_(this,Ll)&&clearTimeout(_(this,Ll)),Q(this,Ll,setTimeout(()=>{this.focusMainContainer(),Q(this,Ll,null)},0))),_(this,Vn).delete(e.id),e.annotationElementId&&((r=_(this,th))==null||r.delete(e.annotationElementId)),this.unselect(e),(!e.annotationElementId||!_(this,Ep).has(e.annotationElementId))&&((n=_(this,eu))==null||n.remove(e.id))}addDeletedAnnotationElement(e){_(this,Ep).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return _(this,Ep).has(e)}removeDeletedAnnotationElement(e){_(this,Ep).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){_(this,oa)!==e&&(Q(this,oa,e),e&&ce(this,Qe,Uc).call(this,e.propertiesToUpdate))}updateUI(e){_(this,Qe,ehe)===e&&ce(this,Qe,Uc).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){ce(this,Qe,Uc).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(_(this,fr).has(e)){_(this,fr).delete(e),e.unselect(),ce(this,Qe,oi).call(this,{hasSelectedEditor:this.hasSelection});return}_(this,fr).add(e),e.select(),ce(this,Qe,Uc).call(this,e.propertiesToUpdate),ce(this,Qe,oi).call(this,{hasSelectedEditor:!0})}setSelected(e){var r;this.updateToolbar({mode:e.mode,editId:e.id}),(r=_(this,Xd))==null||r.commitOrRemove();for(const n of _(this,fr))n!==e&&n.unselect();_(this,fr).clear(),_(this,fr).add(e),e.select(),ce(this,Qe,Uc).call(this,e.propertiesToUpdate),ce(this,Qe,oi).call(this,{hasSelectedEditor:!0})}isSelected(e){return _(this,fr).has(e)}get firstSelectedEditor(){return _(this,fr).values().next().value}unselect(e){e.unselect(),_(this,fr).delete(e),ce(this,Qe,oi).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return _(this,fr).size!==0}get isEnterHandled(){return _(this,fr).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;_(this,Ya).undo(),ce(this,Qe,oi).call(this,{hasSomethingToUndo:_(this,Ya).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:ce(this,Qe,M0).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){_(this,Ya).redo(),ce(this,Qe,oi).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:_(this,Ya).hasSomethingToRedo(),isEmpty:ce(this,Qe,M0).call(this)})}addCommands(e){_(this,Ya).add(e),ce(this,Qe,oi).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:ce(this,Qe,M0).call(this)})}cleanUndoStack(e){_(this,Ya).cleanType(e)}delete(){var i;this.commitOrRemove();const e=(i=this.currentLayer)==null?void 0:i.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const r=e?[e]:[..._(this,fr)],n=()=>{var o;(o=this._editorUndoBar)==null||o.show(s,r.length===1?r[0].editorType:r.length);for(const l of r)l.remove()},s=()=>{for(const o of r)ce(this,Qe,j5).call(this,o)};this.addCommands({cmd:n,undo:s,mustExec:!0})}commitOrRemove(){var e;(e=_(this,oa))==null||e.commitOrRemove()}hasSomethingToControl(){return _(this,oa)||this.hasSelection}selectAll(){for(const e of _(this,fr))e.commit();ce(this,Qe,S5).call(this,_(this,Vn).values())}unselectAll(){var e;if(!(_(this,oa)&&(_(this,oa).commitOrRemove(),_(this,ss)!==kt.NONE))&&!((e=_(this,Xd))!=null&&e.commitOrRemove())&&this.hasSelection){for(const r of _(this,fr))r.unselect();_(this,fr).clear(),ce(this,Qe,oi).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,r,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;_(this,sh)[0]+=e,_(this,sh)[1]+=r;const[s,i]=_(this,sh),o=[..._(this,fr)],l=1e3;_(this,$l)&&clearTimeout(_(this,$l)),Q(this,$l,setTimeout(()=>{Q(this,$l,null),_(this,sh)[0]=_(this,sh)[1]=0,this.addCommands({cmd:()=>{for(const c of o)_(this,Vn).has(c.id)&&(c.translateInPage(s,i),c.translationDone())},undo:()=>{for(const c of o)_(this,Vn).has(c.id)&&(c.translateInPage(-s,-i),c.translationDone())},mustExec:!1})},l));for(const c of o)c.translateInPage(e,r),c.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),Q(this,Dl,new Map);for(const e of _(this,fr))_(this,Dl).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!_(this,Dl))return!1;this.disableUserSelect(!1);const e=_(this,Dl);Q(this,Dl,null);let r=!1;for(const[{x:s,y:i,pageIndex:o},l]of e)l.newX=s,l.newY=i,l.newPageIndex=o,r||(r=s!==l.savedX||i!==l.savedY||o!==l.savedPageIndex);if(!r)return!1;const n=(s,i,o,l)=>{if(_(this,Vn).has(s.id)){const c=_(this,gs).get(l);c?s._setParentAndPosition(c,i,o):(s.pageIndex=l,s.x=i,s.y=o)}};return this.addCommands({cmd:()=>{for(const[s,{newX:i,newY:o,newPageIndex:l}]of e)n(s,i,o,l)},undo:()=>{for(const[s,{savedX:i,savedY:o,savedPageIndex:l}]of e)n(s,i,o,l)},mustExec:!0}),!0}dragSelectedEditors(e,r){if(_(this,Dl))for(const n of _(this,Dl).keys())n.drag(e,r)}rebuild(e){if(e.parent===null){const r=this.getLayer(e.pageIndex);r?(r.changeParent(e),r.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||_(this,fr).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return _(this,oa)===e}getActive(){return _(this,oa)}getMode(){return _(this,ss)}get imageManager(){return Ut(this,"imageManager",new y5)}getSelectionBoxes(e){if(!e)return null;const r=document.getSelection();for(let u=0,d=r.rangeCount;u<d;u++)if(!e.contains(r.getRangeAt(u).commonAncestorContainer))return null;const{x:n,y:s,width:i,height:o}=e.getBoundingClientRect();let l;switch(e.getAttribute("data-main-rotation")){case"90":l=(u,d,h,f)=>({x:(d-s)/o,y:1-(u+h-n)/i,width:f/o,height:h/i});break;case"180":l=(u,d,h,f)=>({x:1-(u+h-n)/i,y:1-(d+f-s)/o,width:h/i,height:f/o});break;case"270":l=(u,d,h,f)=>({x:1-(d+f-s)/o,y:(u-n)/i,width:f/o,height:h/i});break;default:l=(u,d,h,f)=>({x:(u-n)/i,y:(d-s)/o,width:h/i,height:f/o});break}const c=[];for(let u=0,d=r.rangeCount;u<d;u++){const h=r.getRangeAt(u);if(!h.collapsed)for(const{x:f,y:p,width:g,height:m}of h.getClientRects())g===0||m===0||c.push(l(f,p,g,m))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:e,id:r}){(_(this,cx)||Q(this,cx,new Map)).set(e,r)}removeChangedExistingAnnotation({annotationElementId:e}){var r;(r=_(this,cx))==null||r.delete(e)}renderAnnotationElement(e){var s;const r=(s=_(this,cx))==null?void 0:s.get(e.data.id);if(!r)return;const n=_(this,eu).getRawValue(r);n&&(_(this,ss)===kt.NONE&&!n.hasBeenModified||n.renderAnnotationElement(e))}setMissingCanvas(e,r,n){var i;const s=(i=_(this,th))==null?void 0:i.get(e);s&&(s.setCanvas(r,n),_(this,th).delete(e))}addMissingCanvas(e,r){(_(this,th)||Q(this,th,new Map)).set(e,r)}};ox=new WeakMap,oa=new WeakMap,Vn=new WeakMap,gs=new WeakMap,lx=new WeakMap,eu=new WeakMap,cx=new WeakMap,Ya=new WeakMap,Ap=new WeakMap,Yd=new WeakMap,Xd=new WeakMap,ux=new WeakMap,Ep=new WeakMap,Dl=new WeakMap,Bo=new WeakMap,Cp=new WeakMap,r_=new WeakMap,n_=new WeakMap,dx=new WeakMap,s_=new WeakMap,Ll=new WeakMap,Qd=new WeakMap,hx=new WeakMap,Zd=new WeakMap,Fl=new WeakMap,Nk=new WeakMap,Jd=new WeakMap,i_=new WeakMap,eh=new WeakMap,kp=new WeakMap,fx=new WeakMap,th=new WeakMap,a_=new WeakMap,ss=new WeakMap,fr=new WeakMap,tu=new WeakMap,rh=new WeakMap,nh=new WeakMap,o_=new WeakMap,l_=new WeakMap,sh=new WeakMap,$l=new WeakMap,ru=new WeakMap,c_=new WeakMap,u_=new WeakMap,Xa=new WeakMap,Qe=new WeakSet,DA=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},v5=function(e){const{currentLayer:r}=this;if(r.hasTextLayer(e))return r;for(const n of _(this,gs).values())if(n.hasTextLayer(e))return n;return null},Vde=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const n=ce(this,Qe,DA).call(this,e).closest(".textLayer"),s=this.getSelectionBoxes(n);s&&(_(this,Fl)||Q(this,Fl,new Olt(this)),_(this,Fl).show(n,s,this.direction==="ltr"))},qde=function(){var i,o,l;const e=document.getSelection();if(!e||e.isCollapsed){_(this,tu)&&((i=_(this,Fl))==null||i.hide(),Q(this,tu,null),ce(this,Qe,oi).call(this,{hasSelectedText:!1}));return}const{anchorNode:r}=e;if(r===_(this,tu))return;const s=ce(this,Qe,DA).call(this,e).closest(".textLayer");if(!s){_(this,tu)&&((o=_(this,Fl))==null||o.hide(),Q(this,tu,null),ce(this,Qe,oi).call(this,{hasSelectedText:!1}));return}if((l=_(this,Fl))==null||l.hide(),Q(this,tu,r),ce(this,Qe,oi).call(this,{hasSelectedText:!0}),!(_(this,ss)!==kt.HIGHLIGHT&&_(this,ss)!==kt.NONE)&&(_(this,ss)===kt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),Q(this,Zd,this.isShiftKeyDown),!this.isShiftKeyDown)){const c=_(this,ss)===kt.HIGHLIGHT?ce(this,Qe,v5).call(this,s):null;c==null||c.toggleDrawing();const u=new AbortController,d=this.combinedSignal(u),h=f=>{f.type==="pointerup"&&f.button!==0||(u.abort(),c==null||c.toggleDrawing(!0),f.type==="pointerup"&&ce(this,Qe,LA).call(this,"main_toolbar"))};window.addEventListener("pointerup",h,{signal:d}),window.addEventListener("blur",h,{signal:d})}},LA=function(e=""){_(this,ss)===kt.HIGHLIGHT?this.highlightSelection(e):_(this,r_)&&ce(this,Qe,Vde).call(this)},Gde=function(){document.addEventListener("selectionchange",ce(this,Qe,qde).bind(this),{signal:this._signal})},Kde=function(){if(_(this,Qd))return;Q(this,Qd,new AbortController);const e=this.combinedSignal(_(this,Qd));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},Yde=function(){var e;(e=_(this,Qd))==null||e.abort(),Q(this,Qd,null)},b5=function(){if(_(this,eh))return;Q(this,eh,new AbortController);const e=this.combinedSignal(_(this,eh));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},Xde=function(){var e;(e=_(this,eh))==null||e.abort(),Q(this,eh,null)},w5=function(){if(_(this,Yd))return;Q(this,Yd,new AbortController);const e=this.combinedSignal(_(this,Yd));document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})},_5=function(){var e;(e=_(this,Yd))==null||e.abort(),Q(this,Yd,null)},Qde=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},oi=function(e){Object.entries(e).some(([n,s])=>_(this,l_)[n]!==s)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(_(this,l_),e)}),_(this,ss)===kt.HIGHLIGHT&&e.hasSelectedEditor===!1&&ce(this,Qe,Uc).call(this,[[Kt.HIGHLIGHT_FREE,!0]]))},Uc=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},Zde=async function(){if(!_(this,Jd)){Q(this,Jd,!0);const e=[];for(const r of _(this,gs).values())e.push(r.enable());await Promise.all(e);for(const r of _(this,Vn).values())r.enable()}},Jde=function(){if(this.unselectAll(),_(this,Jd)){Q(this,Jd,!1);for(const e of _(this,gs).values())e.disable();for(const e of _(this,Vn).values())e.disable()}},j5=function(e){const r=_(this,gs).get(e.pageIndex);r?r.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},ehe=function(){let e=null;for(e of _(this,fr));return e},M0=function(){if(_(this,Vn).size===0)return!0;if(_(this,Vn).size===1)for(const e of _(this,Vn).values())return e.isEmpty();return!1},S5=function(e){for(const r of _(this,fr))r.unselect();_(this,fr).clear();for(const r of e)r.isEmpty()||(_(this,fr).add(r),r.select());ce(this,Qe,oi).call(this,{hasSelectedEditor:this.hasSelection})},Le(by,"TRANSLATE_SMALL",1),Le(by,"TRANSLATE_BIG",10);let eg=by;var is,Bl,Uo,px,Ul,la,mx,zl,Ri,nu,Tp,Hl,ih,il,D0,FA;const li=class li{constructor(e){se(this,il);se(this,is,null);se(this,Bl,!1);se(this,Uo,null);se(this,px,null);se(this,Ul,null);se(this,la,null);se(this,mx,!1);se(this,zl,null);se(this,Ri,null);se(this,nu,null);se(this,Tp,null);se(this,Hl,!1);Q(this,Ri,e),Q(this,Hl,e._uiManager.useNewAltTextFlow),_(li,ih)||Q(li,ih,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(e){li._l10n??(li._l10n=e)}async render(){const e=Q(this,Uo,document.createElement("button"));e.className="altText",e.tabIndex="0";const r=Q(this,px,document.createElement("span"));e.append(r),_(this,Hl)?(e.classList.add("new"),e.setAttribute("data-l10n-id",_(li,ih).missing),r.setAttribute("data-l10n-id",_(li,ih)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),r.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const n=_(this,Ri)._uiManager._signal;e.addEventListener("contextmenu",So,{signal:n}),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:n});const s=i=>{i.preventDefault(),_(this,Ri)._uiManager.editAltText(_(this,Ri)),_(this,Hl)&&_(this,Ri)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:_(this,il,D0)}})};return e.addEventListener("click",s,{capture:!0,signal:n}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&(Q(this,mx,!0),s(i))},{signal:n}),await ce(this,il,FA).call(this),e}finish(){_(this,Uo)&&(_(this,Uo).focus({focusVisible:_(this,mx)}),Q(this,mx,!1))}isEmpty(){return _(this,Hl)?_(this,is)===null:!_(this,is)&&!_(this,Bl)}hasData(){return _(this,Hl)?_(this,is)!==null||!!_(this,nu):this.isEmpty()}get guessedText(){return _(this,nu)}async setGuessedText(e){_(this,is)===null&&(Q(this,nu,e),Q(this,Tp,await li._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),ce(this,il,FA).call(this))}toggleAltTextBadge(e=!1){var r;if(!_(this,Hl)||_(this,is)){(r=_(this,zl))==null||r.remove(),Q(this,zl,null);return}if(!_(this,zl)){const n=Q(this,zl,document.createElement("div"));n.className="noAltTextBadge",_(this,Ri).div.append(n)}_(this,zl).classList.toggle("hidden",!e)}serialize(e){let r=_(this,is);return!e&&_(this,nu)===r&&(r=_(this,Tp)),{altText:r,decorative:_(this,Bl),guessedText:_(this,nu),textWithDisclaimer:_(this,Tp)}}get data(){return{altText:_(this,is),decorative:_(this,Bl)}}set data({altText:e,decorative:r,guessedText:n,textWithDisclaimer:s,cancel:i=!1}){n&&(Q(this,nu,n),Q(this,Tp,s)),!(_(this,is)===e&&_(this,Bl)===r)&&(i||(Q(this,is,e),Q(this,Bl,r)),ce(this,il,FA).call(this))}toggle(e=!1){_(this,Uo)&&(!e&&_(this,la)&&(clearTimeout(_(this,la)),Q(this,la,null)),_(this,Uo).disabled=!e)}shown(){_(this,Ri)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:_(this,il,D0)}})}destroy(){var e,r;(e=_(this,Uo))==null||e.remove(),Q(this,Uo,null),Q(this,px,null),Q(this,Ul,null),(r=_(this,zl))==null||r.remove(),Q(this,zl,null)}};is=new WeakMap,Bl=new WeakMap,Uo=new WeakMap,px=new WeakMap,Ul=new WeakMap,la=new WeakMap,mx=new WeakMap,zl=new WeakMap,Ri=new WeakMap,nu=new WeakMap,Tp=new WeakMap,Hl=new WeakMap,ih=new WeakMap,il=new WeakSet,D0=function(){return _(this,is)&&"added"||_(this,is)===null&&this.guessedText&&"review"||"missing"},FA=async function(){var s,i,o;const e=_(this,Uo);if(!e)return;if(_(this,Hl)){if(e.classList.toggle("done",!!_(this,is)),e.setAttribute("data-l10n-id",_(li,ih)[_(this,il,D0)]),(s=_(this,px))==null||s.setAttribute("data-l10n-id",_(li,ih)[`${_(this,il,D0)}-label`]),!_(this,is)){(i=_(this,Ul))==null||i.remove();return}}else{if(!_(this,is)&&!_(this,Bl)){e.classList.remove("done"),(o=_(this,Ul))==null||o.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let r=_(this,Ul);if(!r){Q(this,Ul,r=document.createElement("span")),r.className="tooltip",r.setAttribute("role","tooltip"),r.id=`alt-text-tooltip-${_(this,Ri).id}`;const l=100,c=_(this,Ri)._uiManager._signal;c.addEventListener("abort",()=>{clearTimeout(_(this,la)),Q(this,la,null)},{once:!0}),e.addEventListener("mouseenter",()=>{Q(this,la,setTimeout(()=>{Q(this,la,null),_(this,Ul).classList.add("show"),_(this,Ri)._reportTelemetry({action:"alt_text_tooltip"})},l))},{signal:c}),e.addEventListener("mouseleave",()=>{var u;_(this,la)&&(clearTimeout(_(this,la)),Q(this,la,null)),(u=_(this,Ul))==null||u.classList.remove("show")},{signal:c})}_(this,Bl)?r.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(r.removeAttribute("data-l10n-id"),r.textContent=_(this,is)),r.parentNode||e.append(r);const n=_(this,Ri).getElementForAltText();n==null||n.setAttribute("aria-describedby",r.id)},se(li,ih,null),Le(li,"_l10n",null);let uk=li;var Wl,Pp,zo,d_,su,gx,ah,VX;let BN=(VX=class{constructor(e){se(this,Wl,null);se(this,Pp,!1);se(this,zo,null);se(this,d_,null);se(this,su,null);se(this,gx,null);se(this,ah,!1);Q(this,zo,e),this.toolbar=null}render(){if(!_(this,zo)._uiManager.hasCommentManager())return null;const e=Q(this,Wl,document.createElement("button"));e.className="comment",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button");const r=_(this,zo)._uiManager._signal;e.addEventListener("contextmenu",So,{signal:r}),e.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:r});const n=s=>{s.preventDefault(),this.edit()};return e.addEventListener("click",n,{capture:!0,signal:r}),e.addEventListener("keydown",s=>{s.target===e&&s.key==="Enter"&&(Q(this,Pp,!0),n(s))},{signal:r}),e}edit(){const{bottom:e,left:r,right:n}=_(this,zo).getClientDimensions(),s={top:e};_(this,zo)._uiManager.direction==="ltr"?s.right=n:s.left=r,_(this,zo)._uiManager.editComment(_(this,zo),s)}finish(){_(this,Wl)&&(_(this,Wl).focus({focusVisible:_(this,Pp)}),Q(this,Pp,!1))}isDeleted(){return _(this,ah)||_(this,su)===""}hasBeenEdited(){return this.isDeleted()||_(this,su)!==_(this,d_)}serialize(){return this.data}get data(){return{text:_(this,su),date:_(this,gx),deleted:_(this,ah)}}set data(e){if(e===null){Q(this,su,""),Q(this,ah,!0);return}Q(this,su,e),Q(this,gx,new Date),Q(this,ah,!1)}setInitialText(e){Q(this,d_,e),this.data=e}toggle(e=!1){_(this,Wl)&&(_(this,Wl).disabled=!e)}shown(){}destroy(){var e;(e=_(this,Wl))==null||e.remove(),Q(this,Wl,null),Q(this,su,""),Q(this,gx,null),Q(this,zo,null),Q(this,Pp,!1),Q(this,ah,!1)}},Wl=new WeakMap,Pp=new WeakMap,zo=new WeakMap,d_=new WeakMap,su=new WeakMap,gx=new WeakMap,ah=new WeakMap,VX);var yx,Op,h_,f_,p_,m_,g_,iu,Ip,au,Rp,ou,of,the,rhe,nhe;const RB=class RB{constructor({container:e,isPinchingDisabled:r=null,isPinchingStopped:n=null,onPinchStart:s=null,onPinching:i=null,onPinchEnd:o=null,signal:l}){se(this,of);se(this,yx);se(this,Op,!1);se(this,h_,null);se(this,f_);se(this,p_);se(this,m_);se(this,g_);se(this,iu,null);se(this,Ip);se(this,au,null);se(this,Rp);se(this,ou,null);Q(this,yx,e),Q(this,h_,n),Q(this,f_,r),Q(this,p_,s),Q(this,m_,i),Q(this,g_,o),Q(this,Rp,new AbortController),Q(this,Ip,AbortSignal.any([l,_(this,Rp).signal])),e.addEventListener("touchstart",ce(this,of,the).bind(this),{passive:!1,signal:_(this,Ip)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/jc.pixelRatio}destroy(){var e,r;(e=_(this,Rp))==null||e.abort(),Q(this,Rp,null),(r=_(this,iu))==null||r.abort(),Q(this,iu,null)}};yx=new WeakMap,Op=new WeakMap,h_=new WeakMap,f_=new WeakMap,p_=new WeakMap,m_=new WeakMap,g_=new WeakMap,iu=new WeakMap,Ip=new WeakMap,au=new WeakMap,Rp=new WeakMap,ou=new WeakMap,of=new WeakSet,the=function(e){var s,i,o;if((s=_(this,f_))!=null&&s.call(this))return;if(e.touches.length===1){if(_(this,iu))return;const l=Q(this,iu,new AbortController),c=AbortSignal.any([_(this,Ip),l.signal]),u=_(this,yx),d={capture:!0,signal:c,passive:!1},h=f=>{var p;f.pointerType==="touch"&&((p=_(this,iu))==null||p.abort(),Q(this,iu,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(Mn(f),h(f))},d),u.addEventListener("pointerup",h,d),u.addEventListener("pointercancel",h,d);return}if(!_(this,ou)){Q(this,ou,new AbortController);const l=AbortSignal.any([_(this,Ip),_(this,ou).signal]),c=_(this,yx),u={signal:l,capture:!1,passive:!1};c.addEventListener("touchmove",ce(this,of,rhe).bind(this),u);const d=ce(this,of,nhe).bind(this);c.addEventListener("touchend",d,u),c.addEventListener("touchcancel",d,u),u.capture=!0,c.addEventListener("pointerdown",Mn,u),c.addEventListener("pointermove",Mn,u),c.addEventListener("pointercancel",Mn,u),c.addEventListener("pointerup",Mn,u),(i=_(this,p_))==null||i.call(this)}if(Mn(e),e.touches.length!==2||(o=_(this,h_))!=null&&o.call(this)){Q(this,au,null);return}let[r,n]=e.touches;r.identifier>n.identifier&&([r,n]=[n,r]),Q(this,au,{touch0X:r.screenX,touch0Y:r.screenY,touch1X:n.screenX,touch1Y:n.screenY})},rhe=function(e){var w;if(!_(this,au)||e.touches.length!==2)return;Mn(e);let[r,n]=e.touches;r.identifier>n.identifier&&([r,n]=[n,r]);const{screenX:s,screenY:i}=r,{screenX:o,screenY:l}=n,c=_(this,au),{touch0X:u,touch0Y:d,touch1X:h,touch1Y:f}=c,p=h-u,g=f-d,m=o-s,x=l-i,y=Math.hypot(m,x)||1,v=Math.hypot(p,g)||1;if(!_(this,Op)&&Math.abs(v-y)<=RB.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=s,c.touch0Y=i,c.touch1X=o,c.touch1Y=l,!_(this,Op)){Q(this,Op,!0);return}const b=[(s+o)/2,(i+l)/2];(w=_(this,m_))==null||w.call(this,b,v,y)},nhe=function(e){var r;e.touches.length>=2||(_(this,ou)&&(_(this,ou).abort(),Q(this,ou,null),(r=_(this,g_))==null||r.call(this)),_(this,au)&&(Mn(e),Q(this,au,null),Q(this,Op,!1)))};let dk=RB;var Mp,Ho,Kr,ys,xx,oh,y_,Dp,xs,Lp,lu,lh,x_,Fp,ca,v_,$p,cu,Vl,vx,bx,Qa,Bp,b_,Ak,vt,N5,w_,A5,$A,she,ihe,E5,BA,C5,ahe,ohe,lhe,k5,che,T5,uhe,dhe,hhe,P5,L0;const Dt=class Dt{constructor(e){se(this,vt);se(this,Mp,null);se(this,Ho,null);se(this,Kr,null);se(this,ys,null);se(this,xx,!1);se(this,oh,null);se(this,y_,"");se(this,Dp,!1);se(this,xs,null);se(this,Lp,null);se(this,lu,null);se(this,lh,null);se(this,x_,"");se(this,Fp,!1);se(this,ca,null);se(this,v_,!1);se(this,$p,!1);se(this,cu,!1);se(this,Vl,null);se(this,vx,0);se(this,bx,0);se(this,Qa,null);se(this,Bp,null);Le(this,"isSelected",!1);Le(this,"_isCopy",!1);Le(this,"_editToolbar",null);Le(this,"_initialOptions",Object.create(null));Le(this,"_initialData",null);Le(this,"_isVisible",!0);Le(this,"_uiManager",null);Le(this,"_focusEventsAllowed",!0);se(this,b_,!1);se(this,Ak,Dt._zIndex++);this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null;const{rotation:r,rawDims:{pageWidth:n,pageHeight:s,pageX:i,pageY:o}}=this.parent.viewport;this.rotation=r,this.pageRotation=(360+r-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,s],this.pageTranslation=[i,o];const[l,c]=this.parentDimensions;this.x=e.x/l,this.y=e.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=Dt.prototype._resizeWithKeyboard,r=eg.TRANSLATE_SMALL,n=eg.TRANSLATE_BIG;return Ut(this,"_resizerKeyboardManager",new pS([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-r,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[r,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-r]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,r]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,n]}],[["Escape","mac+Escape"],Dt.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Ut(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const r=new Mlt({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});r.annotationElementId=e.annotationElementId,r.deleted=!0,r._uiManager.addToAnnotationStorage(r)}static initialize(e,r){if(Dt._l10n??(Dt._l10n=e),Dt._l10nResizer||(Dt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),Dt._borderLineWidth!==-1)return;const n=getComputedStyle(document.documentElement);Dt._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,r){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,r){_r("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return _(this,b_)}set _isDraggable(e){var r;Q(this,b_,e),(r=this.div)==null||r.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,r]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*r/(e*2),this.y+=this.width*e/(r*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*r/(e*2),this.y-=this.width*e/(r*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=_(this,Ak)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):ce(this,vt,L0).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(_(this,Fp)?Q(this,Fp,!1):this.parent.setSelected(this))}focusout(e){var n;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const r=e.relatedTarget;r!=null&&r.closest(`#${this.id}`)||(e.preventDefault(),(n=this.parent)!=null&&n.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,r,n,s){const[i,o]=this.parentDimensions;[n,s]=this.screenToPageTranslation(n,s),this.x=(e+n)/i,this.y=(r+s)/o,this.fixAndSetPosition()}_moveAfterPaste(e,r){const[n,s]=this.parentDimensions;this.setAt(e*n,r*s,this.width*n,this.height*s),this._onTranslated()}translate(e,r){ce(this,vt,N5).call(this,this.parentDimensions,e,r)}translateInPage(e,r){_(this,ca)||Q(this,ca,[this.x,this.y,this.width,this.height]),ce(this,vt,N5).call(this,this.pageDimensions,e,r),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,r){_(this,ca)||Q(this,ca,[this.x,this.y,this.width,this.height]);const{div:n,parentDimensions:[s,i]}=this;if(this.x+=e/s,this.y+=r/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:h,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:o,y:l}=this;const[c,u]=this.getBaseTranslation();o+=c,l+=u;const{style:d}=n;d.left=`${(100*o).toFixed(2)}%`,d.top=`${(100*l).toFixed(2)}%`,this._onTranslating(o,l),n.scrollIntoView({block:"nearest"})}_onTranslating(e,r){}_onTranslated(e,r){}get _hasBeenMoved(){return!!_(this,ca)&&(_(this,ca)[0]!==this.x||_(this,ca)[1]!==this.y)}get _hasBeenResized(){return!!_(this,ca)&&(_(this,ca)[2]!==this.width||_(this,ca)[3]!==this.height)}getBaseTranslation(){const[e,r]=this.parentDimensions,{_borderLineWidth:n}=Dt,s=n/e,i=n/r;switch(this.rotation){case 90:return[-s,i];case 180:return[s,i];case 270:return[s,-i];default:return[-s,-i]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:r},pageDimensions:[n,s]}=this;let{x:i,y:o,width:l,height:c}=this;if(l*=n,c*=s,i*=n,o*=s,this._mustFixPosition)switch(e){case 0:i=mi(i,0,n-l),o=mi(o,0,s-c);break;case 90:i=mi(i,0,n-c),o=mi(o,l,s);break;case 180:i=mi(i,l,n),o=mi(o,c,s);break;case 270:i=mi(i,c,n),o=mi(o,0,s-l);break}this.x=i/=n,this.y=o/=s;const[u,d]=this.getBaseTranslation();i+=u,o+=d,r.left=`${(100*i).toFixed(2)}%`,r.top=`${(100*o).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,r){var n;return ce(n=Dt,w_,A5).call(n,e,r,this.parentRotation)}pageTranslationToScreen(e,r){var n;return ce(n=Dt,w_,A5).call(n,e,r,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[r,n]}=this;return[r*e,n*e]}setDims(e,r){const[n,s]=this.parentDimensions,{style:i}=this.div;i.width=`${(100*e/n).toFixed(2)}%`,_(this,Dp)||(i.height=`${(100*r/s).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:r,width:n}=e,s=n.endsWith("%"),i=!_(this,Dp)&&r.endsWith("%");if(s&&i)return;const[o,l]=this.parentDimensions;s||(e.width=`${(100*parseFloat(n)/o).toFixed(2)}%`),!_(this,Dp)&&!i&&(e.height=`${(100*parseFloat(r)/l).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=_(this,Kr))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||_(this,$p))return this._editToolbar;this._editToolbar=new g5(this),this.div.append(this._editToolbar.render()),this._editToolbar.addButton("comment",this.addCommentButton());const{toolbarButtons:e}=this;if(e)for(const[r,n]of e)await this._editToolbar.addButton(r,n);return this._editToolbar.addButton("delete"),this._editToolbar}removeEditToolbar(){var e;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(e=_(this,Kr))==null||e.destroy())}addContainer(e){var n;const r=(n=this._editToolbar)==null?void 0:n.div;r?r.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return _(this,Kr)||(uk.initialize(Dt._l10n),Q(this,Kr,new uk(this)),_(this,Mp)&&(_(this,Kr).data=_(this,Mp),Q(this,Mp,null))),_(this,Kr)}get altTextData(){var e;return(e=_(this,Kr))==null?void 0:e.data}set altTextData(e){_(this,Kr)&&(_(this,Kr).data=e)}get guessedAltText(){var e;return(e=_(this,Kr))==null?void 0:e.guessedText}async setGuessedAltText(e){var r;await((r=_(this,Kr))==null?void 0:r.setGuessedText(e))}serializeAltText(e){var r;return(r=_(this,Kr))==null?void 0:r.serialize(e)}hasAltText(){return!!_(this,Kr)&&!_(this,Kr).isEmpty()}hasAltTextData(){var e;return((e=_(this,Kr))==null?void 0:e.hasData())??!1}addCommentButton(){return _(this,ys)?_(this,ys):Q(this,ys,new BN(this))}get commentColor(){return null}get comment(){const e=_(this,ys);return{text:e.data.text,date:e.data.date,deleted:e.isDeleted(),color:this.commentColor}}set comment(e){_(this,ys)||Q(this,ys,new BN(this)),_(this,ys).data=e}setCommentData(e){_(this,ys)||Q(this,ys,new BN(this)),_(this,ys).setInitialText(e)}get hasEditedComment(){var e;return(e=_(this,ys))==null?void 0:e.hasBeenEdited()}async editComment(){_(this,ys)||Q(this,ys,new BN(this)),_(this,ys).edit()}addComment(e){this.hasEditedComment&&(e.popup={contents:this.comment.text,deleted:this.comment.deleted})}render(){var o;const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=_(this,xx)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),ce(this,vt,T5).call(this);const[r,n]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*n/r).toFixed(2)}%`,e.style.maxHeight=`${(100*r/n).toFixed(2)}%`);const[s,i]=this.getInitialTranslation();return this.translate(s,i),Hde(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(_(this,Bp)||Q(this,Bp,new dk({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:ce(this,vt,ahe).bind(this),onPinching:ce(this,vt,ohe).bind(this),onPinchEnd:ce(this,vt,lhe).bind(this),signal:this._uiManager._signal}))),(o=this._uiManager._editorUndoBar)==null||o.hide(),e}pointerdown(e){const{isMac:r}=Is.platform;if(e.button!==0||e.ctrlKey&&r){e.preventDefault();return}if(Q(this,Fp,!0),this._isDraggable){ce(this,vt,che).call(this,e);return}ce(this,vt,k5).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){_(this,Vl)&&clearTimeout(_(this,Vl)),Q(this,Vl,setTimeout(()=>{var e;Q(this,Vl,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,r,n){e.changeParent(this),this.x=r,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,r,n=this.rotation){const s=this.parentScale,[i,o]=this.pageDimensions,[l,c]=this.pageTranslation,u=e/s,d=r/s,h=this.x*i,f=this.y*o,p=this.width*i,g=this.height*o;switch(n){case 0:return[h+u+l,o-f-d-g+c,h+u+p+l,o-f-d+c];case 90:return[h+d+l,o-f+u+c,h+d+g+l,o-f+u+p+c];case 180:return[h-u-p+l,o-f+d+c,h-u+l,o-f+d+g+c];case 270:return[h-d-g+l,o-f-u-p+c,h-d+l,o-f-u+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,r){const[n,s,i,o]=e,l=i-n,c=o-s;switch(this.rotation){case 0:return[n,r-o,l,c];case 90:return[n,r-s,c,l];case 180:return[i,r-s,l,c];case 270:return[i,r-o,c,l];default:throw new Error("Invalid rotation")}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),Q(this,$p,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),Q(this,$p,!1),!0):!1}isInEditMode(){return _(this,$p)}shouldGetKeyboardEvents(){return _(this,cu)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:r,bottom:n,right:s}=this.getClientDimensions(),{innerHeight:i,innerWidth:o}=window;return r<o&&s>0&&e<i&&n>0}rebuild(){ce(this,vt,T5).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,r=null){_r("An editor must be serializable")}static async deserialize(e,r,n){const s=new this.prototype.constructor({parent:r,id:r.getNextId(),uiManager:n,annotationElementId:e.annotationElementId});s.rotation=e.rotation,Q(s,Mp,e.accessibilityData),s._isCopy=e.isCopy||!1;const[i,o]=s.pageDimensions,[l,c,u,d]=s.getRectInCurrentCoords(e.rect,o);return s.x=l/i,s.y=c/o,s.width=u/i,s.height=d/o,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,r;if((e=_(this,lh))==null||e.abort(),Q(this,lh,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),_(this,Vl)&&(clearTimeout(_(this,Vl)),Q(this,Vl,null)),ce(this,vt,L0).call(this),this.removeEditToolbar(),_(this,Qa)){for(const n of _(this,Qa).values())clearTimeout(n);Q(this,Qa,null)}this.parent=null,(r=_(this,Bp))==null||r.destroy(),Q(this,Bp,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(ce(this,vt,she).call(this),_(this,xs).classList.remove("hidden"))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),Q(this,lu,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const r=_(this,xs).children;if(!_(this,Ho)){Q(this,Ho,Array.from(r));const o=ce(this,vt,uhe).bind(this),l=ce(this,vt,dhe).bind(this),c=this._uiManager._signal;for(const u of _(this,Ho)){const d=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",o,{signal:c}),u.addEventListener("blur",l,{signal:c}),u.addEventListener("focus",ce(this,vt,hhe).bind(this,d),{signal:c}),u.setAttribute("data-l10n-id",Dt._l10nResizer[d])}}const n=_(this,Ho)[0];let s=0;for(const o of r){if(o===n)break;s++}const i=(360-this.rotation+this.parentRotation)%360/90*(_(this,Ho).length/4);if(i!==s){if(i<s)for(let l=0;l<s-i;l++)_(this,xs).append(_(this,xs).firstChild);else if(i>s)for(let l=0;l<i-s;l++)_(this,xs).firstChild.before(_(this,xs).lastChild);let o=0;for(const l of r){const u=_(this,Ho)[o++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",Dt._l10nResizer[u])}}ce(this,vt,P5).call(this,0),Q(this,cu,!0),_(this,xs).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,r){_(this,cu)&&ce(this,vt,C5).call(this,_(this,x_),{deltaX:e,deltaY:r,fromKeyboard:!0})}_stopResizingWithKeyboard(){ce(this,vt,L0).call(this),this.div.focus()}select(){var e,r,n;if(!(this.isSelected&&this._editToolbar)){if(this.isSelected=!0,this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var s,i;(s=this.div)!=null&&s.classList.contains("selectedEditor")&&((i=this._editToolbar)==null||i.show())});return}(r=this._editToolbar)==null||r.show(),(n=_(this,Kr))==null||n.toggleAltTextBadge(!1)}}unselect(){var e,r,n,s,i;this.isSelected&&(this.isSelected=!1,(e=_(this,xs))==null||e.classList.add("hidden"),(r=this.div)==null||r.classList.remove("selectedEditor"),(n=this.div)!=null&&n.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(s=this._editToolbar)==null||s.hide(),(i=_(this,Kr))==null||i.toggleAltTextBadge(!0))}updateParams(e,r){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return _(this,v_)}set isEditing(e){Q(this,v_,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,r){Q(this,Dp,!0);const n=e/r,{style:s}=this.div;s.aspectRatio=n,s.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,r=!1){if(r){_(this,Qa)||Q(this,Qa,new Map);const{action:n}=e;let s=_(this,Qa).get(n);s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(e),_(this,Qa).delete(n),_(this,Qa).size===0&&Q(this,Qa,null)},Dt._telemetryTimeout),_(this,Qa).set(n,s);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),Q(this,xx,!1)}disable(){this.div&&(this.div.tabIndex=-1),Q(this,xx,!0)}renderAnnotationElement(e){let r=e.container.querySelector(".annotationContent");if(!r)r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),e.container.prepend(r);else if(r.nodeName==="CANVAS"){const n=r;r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),n.before(r)}return r}resetAnnotationElement(e){const{firstChild:r}=e.container;(r==null?void 0:r.nodeName)==="DIV"&&r.classList.contains("annotationContent")&&r.remove()}};Mp=new WeakMap,Ho=new WeakMap,Kr=new WeakMap,ys=new WeakMap,xx=new WeakMap,oh=new WeakMap,y_=new WeakMap,Dp=new WeakMap,xs=new WeakMap,Lp=new WeakMap,lu=new WeakMap,lh=new WeakMap,x_=new WeakMap,Fp=new WeakMap,ca=new WeakMap,v_=new WeakMap,$p=new WeakMap,cu=new WeakMap,Vl=new WeakMap,vx=new WeakMap,bx=new WeakMap,Qa=new WeakMap,Bp=new WeakMap,b_=new WeakMap,Ak=new WeakMap,vt=new WeakSet,N5=function([e,r],n,s){[n,s]=this.screenToPageTranslation(n,s),this.x+=n/e,this.y+=s/r,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},w_=new WeakSet,A5=function(e,r,n){switch(n){case 90:return[r,-e];case 180:return[-e,-r];case 270:return[-r,e];default:return[e,r]}},$A=function(e){switch(e){case 90:{const[r,n]=this.pageDimensions;return[0,-r/n,n/r,0]}case 180:return[-1,0,0,-1];case 270:{const[r,n]=this.pageDimensions;return[0,r/n,-n/r,0]}default:return[1,0,0,1]}},she=function(){if(_(this,xs))return;Q(this,xs,document.createElement("div")),_(this,xs).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],r=this._uiManager._signal;for(const n of e){const s=document.createElement("div");_(this,xs).append(s),s.classList.add("resizer",n),s.setAttribute("data-resizer-name",n),s.addEventListener("pointerdown",ce(this,vt,ihe).bind(this,n),{signal:r}),s.addEventListener("contextmenu",So,{signal:r}),s.tabIndex=-1}this.div.prepend(_(this,xs))},ihe=function(e,r){var d;r.preventDefault();const{isMac:n}=Is.platform;if(r.button!==0||r.ctrlKey&&n)return;(d=_(this,Kr))==null||d.toggle(!1);const s=this._isDraggable;this._isDraggable=!1,Q(this,Lp,[r.screenX,r.screenY]);const i=new AbortController,o=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",ce(this,vt,C5).bind(this,e),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",Mn,{passive:!1,signal:o}),window.addEventListener("contextmenu",So,{signal:o}),Q(this,lu,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const l=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(r.target).cursor;const u=()=>{var h;i.abort(),this.parent.togglePointerEvents(!0),(h=_(this,Kr))==null||h.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=l,this.div.style.cursor=c,ce(this,vt,BA).call(this)};window.addEventListener("pointerup",u,{signal:o}),window.addEventListener("blur",u,{signal:o})},E5=function(e,r,n,s){this.width=n,this.height=s,this.x=e,this.y=r;const[i,o]=this.parentDimensions;this.setDims(i*n,o*s),this.fixAndSetPosition(),this._onResized()},BA=function(){if(!_(this,lu))return;const{savedX:e,savedY:r,savedWidth:n,savedHeight:s}=_(this,lu);Q(this,lu,null);const i=this.x,o=this.y,l=this.width,c=this.height;i===e&&o===r&&l===n&&c===s||this.addCommands({cmd:ce(this,vt,E5).bind(this,i,o,l,c),undo:ce(this,vt,E5).bind(this,e,r,n,s),mustExec:!0})},C5=function(e,r){const[n,s]=this.parentDimensions,i=this.x,o=this.y,l=this.width,c=this.height,u=Dt.MIN_SIZE/n,d=Dt.MIN_SIZE/s,h=ce(this,vt,$A).call(this,this.rotation),f=(K,G)=>[h[0]*K+h[2]*G,h[1]*K+h[3]*G],p=ce(this,vt,$A).call(this,360-this.rotation),g=(K,G)=>[p[0]*K+p[2]*G,p[1]*K+p[3]*G];let m,x,y=!1,v=!1;switch(e){case"topLeft":y=!0,m=(K,G)=>[0,0],x=(K,G)=>[K,G];break;case"topMiddle":m=(K,G)=>[K/2,0],x=(K,G)=>[K/2,G];break;case"topRight":y=!0,m=(K,G)=>[K,0],x=(K,G)=>[0,G];break;case"middleRight":v=!0,m=(K,G)=>[K,G/2],x=(K,G)=>[0,G/2];break;case"bottomRight":y=!0,m=(K,G)=>[K,G],x=(K,G)=>[0,0];break;case"bottomMiddle":m=(K,G)=>[K/2,G],x=(K,G)=>[K/2,0];break;case"bottomLeft":y=!0,m=(K,G)=>[0,G],x=(K,G)=>[K,0];break;case"middleLeft":v=!0,m=(K,G)=>[0,G/2],x=(K,G)=>[K,G/2];break}const b=m(l,c),w=x(l,c);let j=f(...w);const N=Dt._round(i+j[0]),C=Dt._round(o+j[1]);let k=1,E=1,M,z;if(r.fromKeyboard)({deltaX:M,deltaY:z}=r);else{const{screenX:K,screenY:G}=r,[Y,H]=_(this,Lp);[M,z]=this.screenToPageTranslation(K-Y,G-H),_(this,Lp)[0]=K,_(this,Lp)[1]=G}if([M,z]=g(M/n,z/s),y){const K=Math.hypot(l,c);k=E=Math.max(Math.min(Math.hypot(w[0]-b[0]-M,w[1]-b[1]-z)/K,1/l,1/c),u/l,d/c)}else v?k=mi(Math.abs(w[0]-b[0]-M),u,1)/l:E=mi(Math.abs(w[1]-b[1]-z),d,1)/c;const P=Dt._round(l*k),V=Dt._round(c*E);j=f(...x(P,V));const A=N-j[0],$=C-j[1];_(this,ca)||Q(this,ca,[this.x,this.y,this.width,this.height]),this.width=P,this.height=V,this.x=A,this.y=$,this.setDims(n*P,s*V),this.fixAndSetPosition(),this._onResizing()},ahe=function(){var e;Q(this,lu,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=_(this,Kr))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},ohe=function(e,r,n){let i=.7*(n/r)+1-.7;if(i===1)return;const o=ce(this,vt,$A).call(this,this.rotation),l=(N,C)=>[o[0]*N+o[2]*C,o[1]*N+o[3]*C],[c,u]=this.parentDimensions,d=this.x,h=this.y,f=this.width,p=this.height,g=Dt.MIN_SIZE/c,m=Dt.MIN_SIZE/u;i=Math.max(Math.min(i,1/f,1/p),g/f,m/p);const x=Dt._round(f*i),y=Dt._round(p*i);if(x===f&&y===p)return;_(this,ca)||Q(this,ca,[d,h,f,p]);const v=l(f/2,p/2),b=Dt._round(d+v[0]),w=Dt._round(h+v[1]),j=l(x/2,y/2);this.x=b-j[0],this.y=w-j[1],this.width=x,this.height=y,this.setDims(c*x,u*y),this.fixAndSetPosition(),this._onResizing()},lhe=function(){var e;(e=_(this,Kr))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),ce(this,vt,BA).call(this)},k5=function(e){const{isMac:r}=Is.platform;e.ctrlKey&&!r||e.shiftKey||e.metaKey&&r?this.parent.toggleSelected(this):this.parent.setSelected(this)},che=function(e){const{isSelected:r}=this;this._uiManager.setUpDragSession();let n=!1;const s=new AbortController,i=this._uiManager.combinedSignal(s),o={capture:!0,passive:!1,signal:i},l=u=>{s.abort(),Q(this,oh,null),Q(this,Fp,!1),this._uiManager.endDragSession()||ce(this,vt,k5).call(this,u),n&&this._onStopDragging()};r&&(Q(this,vx,e.clientX),Q(this,bx,e.clientY),Q(this,oh,e.pointerId),Q(this,y_,e.pointerType),window.addEventListener("pointermove",u=>{n||(n=!0,this._onStartDragging());const{clientX:d,clientY:h,pointerId:f}=u;if(f!==_(this,oh)){Mn(u);return}const[p,g]=this.screenToPageTranslation(d-_(this,vx),h-_(this,bx));Q(this,vx,d),Q(this,bx,h),this._uiManager.dragSelectedEditors(p,g)},o),window.addEventListener("touchmove",Mn,o),window.addEventListener("pointerdown",u=>{u.pointerType===_(this,y_)&&(_(this,Bp)||u.isPrimary)&&l(u),Mn(u)},o));const c=u=>{if(!_(this,oh)||_(this,oh)===u.pointerId){l(u);return}Mn(u)};window.addEventListener("pointerup",c,{signal:i}),window.addEventListener("blur",c,{signal:i})},T5=function(){if(_(this,lh)||!this.div)return;Q(this,lh,new AbortController);const e=this._uiManager.combinedSignal(_(this,lh));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},uhe=function(e){Dt._resizerKeyboardManager.exec(this,e)},dhe=function(e){var r;_(this,cu)&&((r=e.relatedTarget)==null?void 0:r.parentNode)!==_(this,xs)&&ce(this,vt,L0).call(this)},hhe=function(e){Q(this,x_,_(this,cu)?e:"")},P5=function(e){if(_(this,Ho))for(const r of _(this,Ho))r.tabIndex=e},L0=function(){Q(this,cu,!1),ce(this,vt,P5).call(this,-1),ce(this,vt,BA).call(this)},se(Dt,w_),Le(Dt,"_l10n",null),Le(Dt,"_l10nResizer",null),Le(Dt,"_borderLineWidth",-1),Le(Dt,"_colorManager",new x5),Le(Dt,"_zIndex",1),Le(Dt,"_telemetryTimeout",1e3);let Rr=Dt;class Mlt extends Rr{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const tK=3285377520,Ha=4294901760,Al=65535;class fhe{constructor(e){this.h1=e?e&4294967295:tK,this.h2=e?e&4294967295:tK}update(e){let r,n;if(typeof e=="string"){r=new Uint8Array(e.length*2),n=0;for(let m=0,x=e.length;m<x;m++){const y=e.charCodeAt(m);y<=255?r[n++]=y:(r[n++]=y>>>8,r[n++]=y&255)}}else if(ArrayBuffer.isView(e))r=e.slice(),n=r.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const s=n>>2,i=n-s*4,o=new Uint32Array(r.buffer,0,s);let l=0,c=0,u=this.h1,d=this.h2;const h=3432918353,f=461845907,p=h&Al,g=f&Al;for(let m=0;m<s;m++)m&1?(l=o[m],l=l*h&Ha|l*p&Al,l=l<<15|l>>>17,l=l*f&Ha|l*g&Al,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=o[m],c=c*h&Ha|c*p&Al,c=c<<15|c>>>17,c=c*f&Ha|c*g&Al,d^=c,d=d<<13|d>>>19,d=d*5+3864292196);switch(l=0,i){case 3:l^=r[s*4+2]<<16;case 2:l^=r[s*4+1]<<8;case 1:l^=r[s*4],l=l*h&Ha|l*p&Al,l=l<<15|l>>>17,l=l*f&Ha|l*g&Al,s&1?u^=l:d^=l}this.h1=u,this.h2=d}hexdigest(){let e=this.h1,r=this.h2;return e^=r>>>1,e=e*3981806797&Ha|e*36045&Al,r=r*4283543511&Ha|((r<<16|e>>>16)*2950163797&Ha)>>>16,e^=r>>>1,e=e*444984403&Ha|e*60499&Al,r=r*3301882366&Ha|((r<<16|e>>>16)*3120437893&Ha)>>>16,e^=r>>>1,(e>>>0).toString(16).padStart(8,"0")+(r>>>0).toString(16).padStart(8,"0")}}const O5=Object.freeze({map:null,hash:"",transfer:void 0});var Up,zp,vs,Ek,phe;class Z8{constructor(){se(this,Ek);se(this,Up,!1);se(this,zp,null);se(this,vs,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,r){const n=_(this,vs).get(e);return n===void 0?r:Object.assign(r,n)}getRawValue(e){return _(this,vs).get(e)}remove(e){if(_(this,vs).delete(e),_(this,vs).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const r of _(this,vs).values())if(r instanceof Rr)return;this.onAnnotationEditor(null)}}setValue(e,r){const n=_(this,vs).get(e);let s=!1;if(n!==void 0)for(const[i,o]of Object.entries(r))n[i]!==o&&(s=!0,n[i]=o);else s=!0,_(this,vs).set(e,r);s&&ce(this,Ek,phe).call(this),r instanceof Rr&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(r.constructor._type)}has(e){return _(this,vs).has(e)}get size(){return _(this,vs).size}resetModified(){_(this,Up)&&(Q(this,Up,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new mhe(this)}get serializable(){if(_(this,vs).size===0)return O5;const e=new Map,r=new fhe,n=[],s=Object.create(null);let i=!1;for(const[o,l]of _(this,vs)){const c=l instanceof Rr?l.serialize(!1,s):l;c&&(e.set(o,c),r.update(`${o}:${JSON.stringify(c)}`),i||(i=!!c.bitmap))}if(i)for(const o of e.values())o.bitmap&&n.push(o.bitmap);return e.size>0?{map:e,hash:r.hexdigest(),transfer:n}:O5}get editorStats(){let e=null;const r=new Map;for(const n of _(this,vs).values()){if(!(n instanceof Rr))continue;const s=n.telemetryFinalData;if(!s)continue;const{type:i}=s;r.has(i)||r.set(i,Object.getPrototypeOf(n).constructor),e||(e=Object.create(null));const o=e[i]||(e[i]=new Map);for(const[l,c]of Object.entries(s)){if(l==="type")continue;let u=o.get(l);u||(u=new Map,o.set(l,u));const d=u.get(c)??0;u.set(c,d+1)}}for(const[n,s]of r)e[n]=s.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){Q(this,zp,null)}get modifiedIds(){if(_(this,zp))return _(this,zp);const e=[];for(const r of _(this,vs).values())!(r instanceof Rr)||!r.annotationElementId||!r.serialize()||e.push(r.annotationElementId);return Q(this,zp,{ids:new Set(e),hash:e.join(",")})}[Symbol.iterator](){return _(this,vs).entries()}}Up=new WeakMap,zp=new WeakMap,vs=new WeakMap,Ek=new WeakSet,phe=function(){_(this,Up)||(Q(this,Up,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var __;class mhe extends Z8{constructor(r){super();se(this,__);const{map:n,hash:s,transfer:i}=r.serializable,o=structuredClone(n,i?{transfer:i}:null);Q(this,__,{map:o,hash:s,transfer:i})}get print(){_r("Should not call PrintAnnotationStorage.print")}get serializable(){return _(this,__)}get modifiedIds(){return Ut(this,"modifiedIds",{ids:new Set,hash:""})}}__=new WeakMap;var wx;class Dlt{constructor({ownerDocument:e=globalThis.document,styleElement:r=null}){se(this,wx,new Set);this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const r=this.styleElement.sheet;r.insertRule(e,r.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),_(this,wx).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:r,_inspectFont:n}){if(!(!e||_(this,wx).has(e.loadedName))){if(Ln(!r,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:i,style:o}=e,l=new FontFace(s,i,o);this.addNativeFontFace(l);try{await l.load(),_(this,wx).add(s),n==null||n(e)}catch{Tt(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}_r("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const n=e.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(s){throw Tt(`Failed to load font '${n.family}': '${s}'.`),e.disableFontFace=!0,s}}return}const r=e.createFontFaceRule();if(r){if(this.insertRule(r),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const s=this._queueLoadingCallback(n);this._prepareFontLoadEvent(e,s)})}}get isFontLoadingAPISupported(){var r;const e=!!((r=this._document)!=null&&r.fonts);return Ut(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return Ut(this,"isSyncFontLoadingSupported",pi||Is.platform.isFirefox)}_queueLoadingCallback(e){function r(){for(Ln(!s.done,"completeRequest() cannot be called twice."),s.done=!0;n.length>0&&n[0].done;){const i=n.shift();setTimeout(i.callback,0)}}const{loadingRequests:n}=this,s={done:!1,complete:r,callback:e};return n.push(s),s}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Ut(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,r){function n(w,j){return w.charCodeAt(j)<<24|w.charCodeAt(j+1)<<16|w.charCodeAt(j+2)<<8|w.charCodeAt(j+3)&255}function s(w,j,N,C){const k=w.substring(0,j),E=w.substring(j+N);return k+C+E}let i,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d");let u=0;function d(w,j){if(++u>30){Tt("Load test font never loaded."),j();return}if(c.font="30px "+w,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){j();return}setTimeout(d.bind(null,w,j))}const h=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=s(f,976,h.length,h);const g=16,m=1482184792;let x=n(f,g);for(i=0,o=h.length-3;i<o;i+=4)x=x-m+n(h,i)|0;i<h.length&&(x=x-m+n(h+"XXX",i)|0),f=s(f,g,4,blt(x));const y=`url(data:font/opentype;base64,${btoa(f)});`,v=`@font-face {font-family:"${h}";src:${y}}`;this.insertRule(v);const b=this._document.createElement("div");b.style.visibility="hidden",b.style.width=b.style.height="10px",b.style.position="absolute",b.style.top=b.style.left="0px";for(const w of[e.loadedName,h]){const j=this._document.createElement("span");j.textContent="Hi",j.style.fontFamily=w,b.append(j)}this._document.body.append(b),d(h,()=>{b.remove(),r.complete()})}}wx=new WeakMap;class Llt{constructor(e,r=null){this.compiledGlyphs=Object.create(null);for(const n in e)this[n]=e[n];this._inspectFont=r}createNativeFontFace(){var r;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const n={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(n.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,n)}return(r=this._inspectFont)==null||r.call(this,this),e}createFontFaceRule(){var n;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${Dde(this.data)});`;let r;if(!this.cssFontInfo)r=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let s=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(s+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),r=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${s}src:${e}}`}return(n=this._inspectFont)==null||n.call(this,this,e),r}getPathGenerator(e,r){if(this.compiledGlyphs[r]!==void 0)return this.compiledGlyphs[r];const n=this.loadedName+"_path_"+r;let s;try{s=e.get(n)}catch(o){Tt(`getPathGenerator - ignoring character: "${o}".`)}const i=new Path2D(s||"");return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[r]=i}}function Flt(t){if(t instanceof URL)return t.href;if(typeof t=="string"){if(pi)return t;const e=URL.parse(t,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function $lt(t){if(pi&&typeof Buffer<"u"&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if(typeof t=="string")return dS(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||typeof t=="object"&&!isNaN(t==null?void 0:t.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function UN(t){if(typeof t!="string")return null;if(t.endsWith("/"))return t;throw new Error(`Invalid factory url: "${t}" must include trailing slash.`)}const I5=t=>typeof t=="object"&&Number.isInteger(t==null?void 0:t.num)&&t.num>=0&&Number.isInteger(t==null?void 0:t.gen)&&t.gen>=0,Blt=t=>typeof t=="object"&&typeof(t==null?void 0:t.name)=="string",Ult=Nlt.bind(null,I5,Blt);var uu,Ck;class zlt{constructor(){se(this,uu,new Map);se(this,Ck,Promise.resolve())}postMessage(e,r){const n={data:structuredClone(e,r?{transfer:r}:null)};_(this,Ck).then(()=>{for(const[s]of _(this,uu))s.call(this,n)})}addEventListener(e,r,n=null){let s=null;if((n==null?void 0:n.signal)instanceof AbortSignal){const{signal:i}=n;if(i.aborted){Tt("LoopbackPort - cannot use an `aborted` signal.");return}const o=()=>this.removeEventListener(e,r);s=()=>i.removeEventListener("abort",o),i.addEventListener("abort",o)}_(this,uu).set(r,s)}removeEventListener(e,r){const n=_(this,uu).get(r);n==null||n(),_(this,uu).delete(r)}terminate(){for(const[,e]of _(this,uu))e==null||e();_(this,uu).clear()}}uu=new WeakMap,Ck=new WeakMap;const zN={DATA:1,ERROR:2},Pn={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function rK(){}function Ti(t){if(t instanceof nf||t instanceof f5||t instanceof ZG||t instanceof lk||t instanceof yI)return t;switch(t instanceof Error||typeof t=="object"&&t!==null||_r('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new nf(t.message);case"InvalidPDFException":return new f5(t.message);case"PasswordException":return new ZG(t.message,t.code);case"ResponseException":return new lk(t.message,t.status,t.missing);case"UnknownErrorException":return new yI(t.message,t.details)}return new yI(t.message,t.toString())}var _x,vo,ghe,yhe,xhe,UA;class F0{constructor(e,r,n){se(this,vo);se(this,_x,new AbortController);this.sourceName=e,this.targetName=r,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),n.addEventListener("message",ce(this,vo,ghe).bind(this),{signal:_(this,_x).signal})}on(e,r){const n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=r}send(e,r,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:r},n)}sendWithPromise(e,r,n){const s=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[s]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:s,data:r},n)}catch(o){i.reject(o)}return i.promise}sendWithStream(e,r,n,s){const i=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:u=>{const d=Promise.withResolvers();return this.streamControllers[i]={controller:u,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:o,targetName:l,action:e,streamId:i,data:r,desiredSize:u.desiredSize},s),d.promise},pull:u=>{const d=Promise.withResolvers();return this.streamControllers[i].pullCall=d,c.postMessage({sourceName:o,targetName:l,stream:Pn.PULL,streamId:i,desiredSize:u.desiredSize}),d.promise},cancel:u=>{Ln(u instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[i].cancelCall=d,this.streamControllers[i].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:Pn.CANCEL,streamId:i,reason:Ti(u)}),d.promise}},n)}destroy(){var e;(e=_(this,_x))==null||e.abort(),Q(this,_x,null)}}_x=new WeakMap,vo=new WeakSet,ghe=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){ce(this,vo,xhe).call(this,e);return}if(e.callback){const n=e.callbackId,s=this.callbackCapabilities[n];if(!s)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],e.callback===zN.DATA)s.resolve(e.data);else if(e.callback===zN.ERROR)s.reject(Ti(e.reason));else throw new Error("Unexpected callback case");return}const r=this.actionHandler[e.action];if(!r)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const n=this.sourceName,s=e.sourceName,i=this.comObj;Promise.try(r,e.data).then(function(o){i.postMessage({sourceName:n,targetName:s,callback:zN.DATA,callbackId:e.callbackId,data:o})},function(o){i.postMessage({sourceName:n,targetName:s,callback:zN.ERROR,callbackId:e.callbackId,reason:Ti(o)})});return}if(e.streamId){ce(this,vo,yhe).call(this,e);return}r(e.data)},yhe=function(e){const r=e.streamId,n=this.sourceName,s=e.sourceName,i=this.comObj,o=this,l=this.actionHandler[e.action],c={enqueue(u,d=1,h){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=d,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:s,stream:Pn.ENQUEUE,streamId:r,chunk:u},h)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:s,stream:Pn.CLOSE,streamId:r}),delete o.streamSinks[r])},error(u){Ln(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:s,stream:Pn.ERROR,streamId:r,reason:Ti(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[r]=c,Promise.try(l,e.data,c).then(function(){i.postMessage({sourceName:n,targetName:s,stream:Pn.START_COMPLETE,streamId:r,success:!0})},function(u){i.postMessage({sourceName:n,targetName:s,stream:Pn.START_COMPLETE,streamId:r,reason:Ti(u)})})},xhe=function(e){const r=e.streamId,n=this.sourceName,s=e.sourceName,i=this.comObj,o=this.streamControllers[r],l=this.streamSinks[r];switch(e.stream){case Pn.START_COMPLETE:e.success?o.startCall.resolve():o.startCall.reject(Ti(e.reason));break;case Pn.PULL_COMPLETE:e.success?o.pullCall.resolve():o.pullCall.reject(Ti(e.reason));break;case Pn.PULL:if(!l){i.postMessage({sourceName:n,targetName:s,stream:Pn.PULL_COMPLETE,streamId:r,success:!0});break}l.desiredSize<=0&&e.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=e.desiredSize,Promise.try(l.onPull||rK).then(function(){i.postMessage({sourceName:n,targetName:s,stream:Pn.PULL_COMPLETE,streamId:r,success:!0})},function(u){i.postMessage({sourceName:n,targetName:s,stream:Pn.PULL_COMPLETE,streamId:r,reason:Ti(u)})});break;case Pn.ENQUEUE:if(Ln(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(e.chunk);break;case Pn.CLOSE:if(Ln(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),ce(this,vo,UA).call(this,o,r);break;case Pn.ERROR:Ln(o,"error should have stream controller"),o.controller.error(Ti(e.reason)),ce(this,vo,UA).call(this,o,r);break;case Pn.CANCEL_COMPLETE:e.success?o.cancelCall.resolve():o.cancelCall.reject(Ti(e.reason)),ce(this,vo,UA).call(this,o,r);break;case Pn.CANCEL:if(!l)break;const c=Ti(e.reason);Promise.try(l.onCancel||rK,c).then(function(){i.postMessage({sourceName:n,targetName:s,stream:Pn.CANCEL_COMPLETE,streamId:r,success:!0})},function(u){i.postMessage({sourceName:n,targetName:s,stream:Pn.CANCEL_COMPLETE,streamId:r,reason:Ti(u)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[r];break;default:throw new Error("Unexpected stream case")}},UA=async function(e,r){var n,s,i;await Promise.allSettled([(n=e.startCall)==null?void 0:n.promise,(s=e.pullCall)==null?void 0:s.promise,(i=e.cancelCall)==null?void 0:i.promise]),delete this.streamControllers[r]};var j_;class vhe{constructor({enableHWA:e=!1}){se(this,j_,!1);Q(this,j_,e)}create(e,r){if(e<=0||r<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(e,r);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!_(this,j_)})}}reset(e,r,n){if(!e.canvas)throw new Error("Canvas is not specified");if(r<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=r,e.canvas.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,r){_r("Abstract method `_createCanvas` called.")}}j_=new WeakMap;class Hlt extends vhe{constructor({ownerDocument:e=globalThis.document,enableHWA:r=!1}){super({enableHWA:r}),this._document=e}_createCanvas(e,r){const n=this._document.createElement("canvas");return n.width=e,n.height=r,n}}class bhe{constructor({baseUrl:e=null,isCompressed:r=!0}){this.baseUrl=e,this.isCompressed=r}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const r=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(r).then(n=>({cMapData:n,isCompressed:this.isCompressed})).catch(n=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${r}`)})}async _fetch(e){_r("Abstract method `_fetch` called.")}}class nK extends bhe{async _fetch(e){const r=await hS(e,this.isCompressed?"arraybuffer":"text");return r instanceof ArrayBuffer?new Uint8Array(r):dS(r)}}class whe{addFilter(e){return"none"}addHCMFilter(e,r){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,r,n,s,i){return"none"}destroy(e=!1){}}var Hp,jx,du,hu,Gs,Wp,Vp,it,Hs,$0,Wg,zA,Vg,_he,R5,qg,B0,U0,M5,z0;class Wlt extends whe{constructor({docId:r,ownerDocument:n=globalThis.document}){super();se(this,it);se(this,Hp);se(this,jx);se(this,du);se(this,hu);se(this,Gs);se(this,Wp);se(this,Vp,0);Q(this,hu,r),Q(this,Gs,n)}addFilter(r){if(!r)return"none";let n=_(this,it,Hs).get(r);if(n)return n;const[s,i,o]=ce(this,it,zA).call(this,r),l=r.length===1?s:`${s}${i}${o}`;if(n=_(this,it,Hs).get(l),n)return _(this,it,Hs).set(r,n),n;const c=`g_${_(this,hu)}_transfer_map_${ns(this,Vp)._++}`,u=ce(this,it,Vg).call(this,c);_(this,it,Hs).set(r,u),_(this,it,Hs).set(l,u);const d=ce(this,it,qg).call(this,c);return ce(this,it,U0).call(this,s,i,o,d),u}addHCMFilter(r,n){var g;const s=`${r}-${n}`,i="base";let o=_(this,it,$0).get(i);if((o==null?void 0:o.key)===s||(o?((g=o.filter)==null||g.remove(),o.key=s,o.url="none",o.filter=null):(o={key:s,url:"none",filter:null},_(this,it,$0).set(i,o)),!r||!n))return o.url;const l=ce(this,it,z0).call(this,r);r=pt.makeHexColor(...l);const c=ce(this,it,z0).call(this,n);if(n=pt.makeHexColor(...c),_(this,it,Wg).style.color="",r==="#000000"&&n==="#ffffff"||r===n)return o.url;const u=new Array(256);for(let m=0;m<=255;m++){const x=m/255;u[m]=x<=.03928?x/12.92:((x+.055)/1.055)**2.4}const d=u.join(","),h=`g_${_(this,hu)}_hcm_filter`,f=o.filter=ce(this,it,qg).call(this,h);ce(this,it,U0).call(this,d,d,d,f),ce(this,it,R5).call(this,f);const p=(m,x)=>{const y=l[m]/255,v=c[m]/255,b=new Array(x+1);for(let w=0;w<=x;w++)b[w]=y+w/x*(v-y);return b.join(",")};return ce(this,it,U0).call(this,p(0,5),p(1,5),p(2,5),f),o.url=ce(this,it,Vg).call(this,h),o.url}addAlphaFilter(r){let n=_(this,it,Hs).get(r);if(n)return n;const[s]=ce(this,it,zA).call(this,[r]),i=`alpha_${s}`;if(n=_(this,it,Hs).get(i),n)return _(this,it,Hs).set(r,n),n;const o=`g_${_(this,hu)}_alpha_map_${ns(this,Vp)._++}`,l=ce(this,it,Vg).call(this,o);_(this,it,Hs).set(r,l),_(this,it,Hs).set(i,l);const c=ce(this,it,qg).call(this,o);return ce(this,it,M5).call(this,s,c),l}addLuminosityFilter(r){let n=_(this,it,Hs).get(r||"luminosity");if(n)return n;let s,i;if(r?([s]=ce(this,it,zA).call(this,[r]),i=`luminosity_${s}`):i="luminosity",n=_(this,it,Hs).get(i),n)return _(this,it,Hs).set(r,n),n;const o=`g_${_(this,hu)}_luminosity_map_${ns(this,Vp)._++}`,l=ce(this,it,Vg).call(this,o);_(this,it,Hs).set(r,l),_(this,it,Hs).set(i,l);const c=ce(this,it,qg).call(this,o);return ce(this,it,_he).call(this,c),r&&ce(this,it,M5).call(this,s,c),l}addHighlightHCMFilter(r,n,s,i,o){var v;const l=`${n}-${s}-${i}-${o}`;let c=_(this,it,$0).get(r);if((c==null?void 0:c.key)===l||(c?((v=c.filter)==null||v.remove(),c.key=l,c.url="none",c.filter=null):(c={key:l,url:"none",filter:null},_(this,it,$0).set(r,c)),!n||!s))return c.url;const[u,d]=[n,s].map(ce(this,it,z0).bind(this));let h=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),f=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[p,g]=[i,o].map(ce(this,it,z0).bind(this));f<h&&([h,f,p,g]=[f,h,g,p]),_(this,it,Wg).style.color="";const m=(b,w,j)=>{const N=new Array(256),C=(f-h)/j,k=b/255,E=(w-b)/(255*j);let M=0;for(let z=0;z<=j;z++){const P=Math.round(h+z*C),V=k+z*E;for(let A=M;A<=P;A++)N[A]=V;M=P+1}for(let z=M;z<256;z++)N[z]=N[M-1];return N.join(",")},x=`g_${_(this,hu)}_hcm_${r}_filter`,y=c.filter=ce(this,it,qg).call(this,x);return ce(this,it,R5).call(this,y),ce(this,it,U0).call(this,m(p[0],g[0],5),m(p[1],g[1],5),m(p[2],g[2],5),y),c.url=ce(this,it,Vg).call(this,x),c.url}destroy(r=!1){var n,s,i,o;r&&((n=_(this,Wp))!=null&&n.size)||((s=_(this,du))==null||s.parentNode.parentNode.remove(),Q(this,du,null),(i=_(this,jx))==null||i.clear(),Q(this,jx,null),(o=_(this,Wp))==null||o.clear(),Q(this,Wp,null),Q(this,Vp,0))}}Hp=new WeakMap,jx=new WeakMap,du=new WeakMap,hu=new WeakMap,Gs=new WeakMap,Wp=new WeakMap,Vp=new WeakMap,it=new WeakSet,Hs=function(){return _(this,jx)||Q(this,jx,new Map)},$0=function(){return _(this,Wp)||Q(this,Wp,new Map)},Wg=function(){if(!_(this,du)){const r=_(this,Gs).createElement("div"),{style:n}=r;n.visibility="hidden",n.contain="strict",n.width=n.height=0,n.position="absolute",n.top=n.left=0,n.zIndex=-1;const s=_(this,Gs).createElementNS(Bc,"svg");s.setAttribute("width",0),s.setAttribute("height",0),Q(this,du,_(this,Gs).createElementNS(Bc,"defs")),r.append(s),s.append(_(this,du)),_(this,Gs).body.append(r)}return _(this,du)},zA=function(r){if(r.length===1){const u=r[0],d=new Array(256);for(let f=0;f<256;f++)d[f]=u[f]/255;const h=d.join(",");return[h,h,h]}const[n,s,i]=r,o=new Array(256),l=new Array(256),c=new Array(256);for(let u=0;u<256;u++)o[u]=n[u]/255,l[u]=s[u]/255,c[u]=i[u]/255;return[o.join(","),l.join(","),c.join(",")]},Vg=function(r){if(_(this,Hp)===void 0){Q(this,Hp,"");const n=_(this,Gs).URL;n!==_(this,Gs).baseURI&&(V2(n)?Tt('#createUrl: ignore "data:"-URL for performance reasons.'):Q(this,Hp,Ide(n,"")))}return`url(${_(this,Hp)}#${r})`},_he=function(r){const n=_(this,Gs).createElementNS(Bc,"feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),r.append(n)},R5=function(r){const n=_(this,Gs).createElementNS(Bc,"feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),r.append(n)},qg=function(r){const n=_(this,Gs).createElementNS(Bc,"filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",r),_(this,it,Wg).append(n),n},B0=function(r,n,s){const i=_(this,Gs).createElementNS(Bc,n);i.setAttribute("type","discrete"),i.setAttribute("tableValues",s),r.append(i)},U0=function(r,n,s,i){const o=_(this,Gs).createElementNS(Bc,"feComponentTransfer");i.append(o),ce(this,it,B0).call(this,o,"feFuncR",r),ce(this,it,B0).call(this,o,"feFuncG",n),ce(this,it,B0).call(this,o,"feFuncB",s)},M5=function(r,n){const s=_(this,Gs).createElementNS(Bc,"feComponentTransfer");n.append(s),ce(this,it,B0).call(this,s,"feFuncA",r)},z0=function(r){return _(this,it,Wg).style.color=r,q2(getComputedStyle(_(this,it,Wg)).getPropertyValue("color"))};class jhe{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const r=`${this.baseUrl}${e}`;return this._fetch(r).catch(n=>{throw new Error(`Unable to load font data at: ${r}`)})}async _fetch(e){_r("Abstract method `_fetch` called.")}}class sK extends jhe{async _fetch(e){const r=await hS(e,"arraybuffer");return new Uint8Array(r)}}class She{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const r=`${this.baseUrl}${e}`;return this._fetch(r).catch(n=>{throw new Error(`Unable to load wasm data at: ${r}`)})}async _fetch(e){_r("Abstract method `_fetch` called.")}}class iK extends She{async _fetch(e){const r=await hS(e,"arraybuffer");return new Uint8Array(r)}}pi&&Tt("Please use the `legacy` build in Node.js environments.");async function J8(t){const r=await process.getBuiltinModule("fs").promises.readFile(t);return new Uint8Array(r)}class Vlt extends whe{}class qlt extends vhe{_createCanvas(e,r){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,r)}}class Glt extends bhe{async _fetch(e){return J8(e)}}class Klt extends jhe{async _fetch(e){return J8(e)}}class Ylt extends She{async _fetch(e){return J8(e)}}const Ns={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function D5(t,e){if(!e)return;const r=e[2]-e[0],n=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],r,n),t.clip(s)}class eB{isModifyingCurrentTransform(){return!1}getPattern(){_r("Abstract method `getPattern` called.")}}class Xlt extends eB{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let r;this._type==="axial"?r=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(r=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const n of this._colorStops)r.addColorStop(n[0],n[1]);return r}getPattern(e,r,n,s){let i;if(s===Ns.STROKE||s===Ns.FILL){const o=r.current.getClippedPathBoundingBox(s,tn(e))||[0,0,0,0],l=Math.ceil(o[2]-o[0])||1,c=Math.ceil(o[3]-o[1])||1,u=r.cachedCanvases.getCanvas("pattern",l,c),d=u.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-o[0],-o[1]),n=pt.transform(n,[1,0,0,1,o[0],o[1]]),d.transform(...r.baseTransform),this.matrix&&d.transform(...this.matrix),D5(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),i=e.createPattern(u.canvas,"no-repeat");const h=new DOMMatrix(n);i.setTransform(h)}else D5(e,this._bbox),i=this._createGradient(e);return i}}function bI(t,e,r,n,s,i,o,l){const c=e.coords,u=e.colors,d=t.data,h=t.width*4;let f;c[r+1]>c[n+1]&&(f=r,r=n,n=f,f=i,i=o,o=f),c[n+1]>c[s+1]&&(f=n,n=s,s=f,f=o,o=l,l=f),c[r+1]>c[n+1]&&(f=r,r=n,n=f,f=i,i=o,o=f);const p=(c[r]+e.offsetX)*e.scaleX,g=(c[r+1]+e.offsetY)*e.scaleY,m=(c[n]+e.offsetX)*e.scaleX,x=(c[n+1]+e.offsetY)*e.scaleY,y=(c[s]+e.offsetX)*e.scaleX,v=(c[s+1]+e.offsetY)*e.scaleY;if(g>=v)return;const b=u[i],w=u[i+1],j=u[i+2],N=u[o],C=u[o+1],k=u[o+2],E=u[l],M=u[l+1],z=u[l+2],P=Math.round(g),V=Math.round(v);let A,$,K,G,Y,H,B,L;for(let F=P;F<=V;F++){if(F<x){const U=F<g?0:(g-F)/(g-x);A=p-(p-m)*U,$=b-(b-N)*U,K=w-(w-C)*U,G=j-(j-k)*U}else{let U;F>v?U=1:x===v?U=0:U=(x-F)/(x-v),A=m-(m-y)*U,$=N-(N-E)*U,K=C-(C-M)*U,G=k-(k-z)*U}let W;F<g?W=0:F>v?W=1:W=(g-F)/(g-v),Y=p-(p-y)*W,H=b-(b-E)*W,B=w-(w-M)*W,L=j-(j-z)*W;const X=Math.round(Math.min(A,Y)),oe=Math.round(Math.max(A,Y));let le=h*F+X*4;for(let U=X;U<=oe;U++)W=(A-U)/(A-Y),W<0?W=0:W>1&&(W=1),d[le++]=$-($-H)*W|0,d[le++]=K-(K-B)*W|0,d[le++]=G-(G-L)*W|0,d[le++]=255}}function Qlt(t,e,r){const n=e.coords,s=e.colors;let i,o;switch(e.type){case"lattice":const l=e.verticesPerRow,c=Math.floor(n.length/l)-1,u=l-1;for(i=0;i<c;i++){let d=i*l;for(let h=0;h<u;h++,d++)bI(t,r,n[d],n[d+1],n[d+l],s[d],s[d+1],s[d+l]),bI(t,r,n[d+l+1],n[d+1],n[d+l],s[d+l+1],s[d+1],s[d+l])}break;case"triangles":for(i=0,o=n.length;i<o;i+=3)bI(t,r,n[i],n[i+1],n[i+2],s[i],s[i+1],s[i+2]);break;default:throw new Error("illegal figure")}}class Zlt extends eB{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null}_createMeshCanvas(e,r,n){const l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-l,d=Math.ceil(this._bounds[3])-c,h=Math.min(Math.ceil(Math.abs(u*e[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(d*e[1]*1.1)),3e3),p=u/h,g=d/f,m={coords:this._coords,colors:this._colors,offsetX:-l,offsetY:-c,scaleX:1/p,scaleY:1/g},x=h+2*2,y=f+2*2,v=n.getCanvas("mesh",x,y),b=v.context,w=b.createImageData(h,f);if(r){const N=w.data;for(let C=0,k=N.length;C<k;C+=4)N[C]=r[0],N[C+1]=r[1],N[C+2]=r[2],N[C+3]=255}for(const N of this._figures)Qlt(w,N,m);return b.putImageData(w,2,2),{canvas:v.canvas,offsetX:l-2*p,offsetY:c-2*g,scaleX:p,scaleY:g}}isModifyingCurrentTransform(){return!0}getPattern(e,r,n,s){D5(e,this._bbox);const i=new Float32Array(2);if(s===Ns.SHADING)pt.singularValueDecompose2dScale(tn(e),i);else if(this.matrix){pt.singularValueDecompose2dScale(this.matrix,i);const[l,c]=i;pt.singularValueDecompose2dScale(r.baseTransform,i),i[0]*=l,i[1]*=c}else pt.singularValueDecompose2dScale(r.baseTransform,i);const o=this._createMeshCanvas(i,s===Ns.SHADING?null:this._background,r.cachedCanvases);return s!==Ns.SHADING&&(e.setTransform(...r.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(o.offsetX,o.offsetY),e.scale(o.scaleX,o.scaleY),e.createPattern(o.canvas,"no-repeat")}}class Jlt extends eB{getPattern(){return"hotpink"}}function ect(t){switch(t[0]){case"RadialAxial":return new Xlt(t);case"Mesh":return new Zlt(t);case"Dummy":return new Jlt}throw new Error(`Unknown IR type: ${t[0]}`)}const aK={COLORED:1,UNCOLORED:2},kk=class kk{constructor(e,r,n,s){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.ctx=r,this.canvasGraphicsFactory=n,this.baseTransform=s}createPatternCanvas(e){const{bbox:r,operatorList:n,paintType:s,tilingType:i,color:o,canvasGraphicsFactory:l}=this;let{xstep:c,ystep:u}=this;c=Math.abs(c),u=Math.abs(u),W2("TilingType: "+i);const d=r[0],h=r[1],f=r[2],p=r[3],g=f-d,m=p-h,x=new Float32Array(2);pt.singularValueDecompose2dScale(this.matrix,x);const[y,v]=x;pt.singularValueDecompose2dScale(this.baseTransform,x);const b=y*x[0],w=v*x[1];let j=g,N=m,C=!1,k=!1;const E=Math.ceil(c*b),M=Math.ceil(u*w),z=Math.ceil(g*b),P=Math.ceil(m*w);E>=z?j=c:C=!0,M>=P?N=u:k=!0;const V=this.getSizeAndScale(j,this.ctx.canvas.width,b),A=this.getSizeAndScale(N,this.ctx.canvas.height,w),$=e.cachedCanvases.getCanvas("pattern",V.size,A.size),K=$.context,G=l.createCanvasGraphics(K);if(G.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(G,s,o),K.translate(-V.scale*d,-A.scale*h),G.transform(V.scale,0,0,A.scale,0,0),K.save(),this.clipBbox(G,d,h,f,p),G.baseTransform=tn(G.ctx),G.executeOperatorList(n),G.endDrawing(),K.restore(),C||k){const Y=$.canvas;C&&(j=c),k&&(N=u);const H=this.getSizeAndScale(j,this.ctx.canvas.width,b),B=this.getSizeAndScale(N,this.ctx.canvas.height,w),L=H.size,F=B.size,W=e.cachedCanvases.getCanvas("pattern-workaround",L,F),X=W.context,oe=C?Math.floor(g/c):0,le=k?Math.floor(m/u):0;for(let U=0;U<=oe;U++)for(let R=0;R<=le;R++)X.drawImage(Y,L*U,F*R,L,F,0,0,L,F);return{canvas:W.canvas,scaleX:H.scale,scaleY:B.scale,offsetX:d,offsetY:h}}return{canvas:$.canvas,scaleX:V.scale,scaleY:A.scale,offsetX:d,offsetY:h}}getSizeAndScale(e,r,n){const s=Math.max(kk.MAX_PATTERN_SIZE,r);let i=Math.ceil(e*n);return i>=s?i=s:n=i/e,{scale:n,size:i}}clipBbox(e,r,n,s,i){const o=s-r,l=i-n;e.ctx.rect(r,n,o,l),pt.axialAlignedBoundingBox([r,n,s,i],tn(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,r,n){const s=e.ctx,i=e.current;switch(r){case aK.COLORED:const{fillStyle:o,strokeStyle:l}=this.ctx;s.fillStyle=i.fillColor=o,s.strokeStyle=i.strokeColor=l;break;case aK.UNCOLORED:s.fillStyle=s.strokeStyle=n,i.fillColor=i.strokeColor=n;break;default:throw new vlt(`Unsupported paint type: ${r}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,r,n,s){let i=n;s!==Ns.SHADING&&(i=pt.transform(i,r.baseTransform),this.matrix&&(i=pt.transform(i,this.matrix)));const o=this.createPatternCanvas(r);let l=new DOMMatrix(i);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const c=e.createPattern(o.canvas,"repeat");return c.setTransform(l),c}};Le(kk,"MAX_PATTERN_SIZE",3e3);let L5=kk;function tct({src:t,srcPos:e=0,dest:r,width:n,height:s,nonBlackColor:i=4294967295,inverseDecode:o=!1}){const l=Is.isLittleEndian?4278190080:255,[c,u]=o?[i,l]:[l,i],d=n>>3,h=n&7,f=t.length;r=new Uint32Array(r.buffer);let p=0;for(let g=0;g<s;g++){for(const x=e+d;e<x;e++){const y=e<f?t[e]:255;r[p++]=y&128?u:c,r[p++]=y&64?u:c,r[p++]=y&32?u:c,r[p++]=y&16?u:c,r[p++]=y&8?u:c,r[p++]=y&4?u:c,r[p++]=y&2?u:c,r[p++]=y&1?u:c}if(h===0)continue;const m=e<f?t[e++]:255;for(let x=0;x<h;x++)r[p++]=m&1<<7-x?u:c}return{srcPos:e,destPos:p}}const oK=16,lK=100,rct=15,cK=10,Fi=16,wI=new DOMMatrix,Sa=new Float32Array(2),xy=new Float32Array([1/0,1/0,-1/0,-1/0]);function nct(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(r,n){e.translate(r,n),this.__originalTranslate(r,n)},t.scale=function(r,n){e.scale(r,n),this.__originalScale(r,n)},t.transform=function(r,n,s,i,o,l){e.transform(r,n,s,i,o,l),this.__originalTransform(r,n,s,i,o,l)},t.setTransform=function(r,n,s,i,o,l){e.setTransform(r,n,s,i,o,l),this.__originalSetTransform(r,n,s,i,o,l)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(r){e.rotate(r),this.__originalRotate(r)},t.clip=function(r){e.clip(r),this.__originalClip(r)},t.moveTo=function(r,n){e.moveTo(r,n),this.__originalMoveTo(r,n)},t.lineTo=function(r,n){e.lineTo(r,n),this.__originalLineTo(r,n)},t.bezierCurveTo=function(r,n,s,i,o,l){e.bezierCurveTo(r,n,s,i,o,l),this.__originalBezierCurveTo(r,n,s,i,o,l)},t.rect=function(r,n,s,i){e.rect(r,n,s,i),this.__originalRect(r,n,s,i)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class sct{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,r,n){let s;return this.cache[e]!==void 0?(s=this.cache[e],this.canvasFactory.reset(s,r,n)):(s=this.canvasFactory.create(r,n),this.cache[e]=s),s}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const r=this.cache[e];this.canvasFactory.destroy(r),delete this.cache[e]}}}function HN(t,e,r,n,s,i,o,l,c,u){const[d,h,f,p,g,m]=tn(t);if(h===0&&f===0){const v=o*d+g,b=Math.round(v),w=l*p+m,j=Math.round(w),N=(o+c)*d+g,C=Math.abs(Math.round(N)-b)||1,k=(l+u)*p+m,E=Math.abs(Math.round(k)-j)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(p),b,j),t.drawImage(e,r,n,s,i,0,0,C,E),t.setTransform(d,h,f,p,g,m),[C,E]}if(d===0&&p===0){const v=l*f+g,b=Math.round(v),w=o*h+m,j=Math.round(w),N=(l+u)*f+g,C=Math.abs(Math.round(N)-b)||1,k=(o+c)*h+m,E=Math.abs(Math.round(k)-j)||1;return t.setTransform(0,Math.sign(h),Math.sign(f),0,b,j),t.drawImage(e,r,n,s,i,0,0,E,C),t.setTransform(d,h,f,p,g,m),[E,C]}t.drawImage(e,r,n,s,i,o,l,c,u);const x=Math.hypot(d,h),y=Math.hypot(f,p);return[x*c,y*u]}class uK{constructor(e,r){Le(this,"alphaIsShape",!1);Le(this,"fontSize",0);Le(this,"fontSizeScale",1);Le(this,"textMatrix",null);Le(this,"textMatrixScale",1);Le(this,"fontMatrix",h5);Le(this,"leading",0);Le(this,"x",0);Le(this,"y",0);Le(this,"lineX",0);Le(this,"lineY",0);Le(this,"charSpacing",0);Le(this,"wordSpacing",0);Le(this,"textHScale",1);Le(this,"textRenderingMode",zs.FILL);Le(this,"textRise",0);Le(this,"fillColor","#000000");Le(this,"strokeColor","#000000");Le(this,"patternFill",!1);Le(this,"patternStroke",!1);Le(this,"fillAlpha",1);Le(this,"strokeAlpha",1);Le(this,"lineWidth",1);Le(this,"activeSMask",null);Le(this,"transferMaps","none");this.clipBox=new Float32Array([0,0,e,r]),this.minMax=xy.slice()}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=Ns.FILL,r=null){const n=this.minMax.slice();if(e===Ns.STROKE){r||_r("Stroke bounding box must include transform."),pt.singularValueDecompose2dScale(r,Sa);const s=Sa[0]*this.lineWidth/2,i=Sa[1]*this.lineWidth/2;n[0]-=s,n[1]-=i,n[2]+=s,n[3]+=i}return n}updateClipFromPath(){const e=pt.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(xy,0)}getClippedPathBoundingBox(e=Ns.FILL,r=null){return pt.intersect(this.clipBox,this.getPathBoundingBox(e,r))}}function dK(t,e){if(e instanceof ImageData){t.putImageData(e,0,0);return}const r=e.height,n=e.width,s=r%Fi,i=(r-s)/Fi,o=s===0?i:i+1,l=t.createImageData(n,Fi);let c=0,u;const d=e.data,h=l.data;let f,p,g,m;if(e.kind===IA.GRAYSCALE_1BPP){const x=d.byteLength,y=new Uint32Array(h.buffer,0,h.byteLength>>2),v=y.length,b=n+7>>3,w=4294967295,j=Is.isLittleEndian?4278190080:255;for(f=0;f<o;f++){for(g=f<i?Fi:s,u=0,p=0;p<g;p++){const N=x-c;let C=0;const k=N>b?n:N*8-7,E=k&-8;let M=0,z=0;for(;C<E;C+=8)z=d[c++],y[u++]=z&128?w:j,y[u++]=z&64?w:j,y[u++]=z&32?w:j,y[u++]=z&16?w:j,y[u++]=z&8?w:j,y[u++]=z&4?w:j,y[u++]=z&2?w:j,y[u++]=z&1?w:j;for(;C<k;C++)M===0&&(z=d[c++],M=128),y[u++]=z&M?w:j,M>>=1}for(;u<v;)y[u++]=0;t.putImageData(l,0,f*Fi)}}else if(e.kind===IA.RGBA_32BPP){for(p=0,m=n*Fi*4,f=0;f<i;f++)h.set(d.subarray(c,c+m)),c+=m,t.putImageData(l,0,p),p+=Fi;f<o&&(m=n*s*4,h.set(d.subarray(c,c+m)),t.putImageData(l,0,p))}else if(e.kind===IA.RGB_24BPP)for(g=Fi,m=n*g,f=0;f<o;f++){for(f>=i&&(g=s,m=n*g),u=0,p=m;p--;)h[u++]=d[c++],h[u++]=d[c++],h[u++]=d[c++],h[u++]=255;t.putImageData(l,0,f*Fi)}else throw new Error(`bad image kind: ${e.kind}`)}function hK(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}const r=e.height,n=e.width,s=r%Fi,i=(r-s)/Fi,o=s===0?i:i+1,l=t.createImageData(n,Fi);let c=0;const u=e.data,d=l.data;for(let h=0;h<o;h++){const f=h<i?Fi:s;({srcPos:c}=tct({src:u,srcPos:c,dest:d,width:n,height:f,nonBlackColor:0})),t.putImageData(l,0,h*Fi)}}function u0(t,e){const r=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of r)t[n]!==void 0&&(e[n]=t[n]);t.setLineDash!==void 0&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function WN(t){t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",t.setLineDash!==void 0&&(t.setLineDash([]),t.lineDashOffset=0);const{filter:e}=t;e!=="none"&&e!==""&&(t.filter="none")}function fK(t,e){if(e)return!0;pt.singularValueDecompose2dScale(t,Sa);const r=Math.fround(jc.pixelRatio*sf.PDF_TO_CSS_UNITS);return Sa[0]<=r&&Sa[1]<=r}const ict=["butt","round","square"],act=["miter","round","bevel"],oct={},pK={};var ml,F5,$5,B5;const MB=class MB{constructor(e,r,n,s,i,{optionalContentConfig:o,markedContentStack:l=null},c,u){se(this,ml);this.ctx=e,this.current=new uK(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=r,this.objs=n,this.canvasFactory=s,this.filterFactory=i,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=l||[],this.optionalContentConfig=o,this.cachedCanvases=new sct(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,r=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):r}beginDrawing({transform:e,viewport:r,transparency:n=!1,background:s=null}){const i=this.ctx.canvas.width,o=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,i,o),this.ctx.fillStyle=l,n){const c=this.cachedCanvases.getCanvas("transparent",i,o);this.compositeCtx=this.ctx,this.transparentCanvas=c.canvas,this.ctx=c.context,this.ctx.save(),this.ctx.transform(...tn(this.compositeCtx))}this.ctx.save(),WN(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...r.transform),this.viewportScale=r.scale,this.baseTransform=tn(this.ctx)}executeOperatorList(e,r,n,s){const i=e.argsArray,o=e.fnArray;let l=r||0;const c=i.length;if(c===l)return l;const u=c-l>cK&&typeof n=="function",d=u?Date.now()+rct:0;let h=0;const f=this.commonObjs,p=this.objs;let g;for(;;){if(s!==void 0&&l===s.nextBreakPoint)return s.breakIt(l,n),l;if(g=o[l],g!==ok.dependency)this[g].apply(this,i[l]);else for(const m of i[l]){const x=m.startsWith("g_")?f:p;if(!x.has(m))return x.get(m,n),l}if(l++,l===c)return l;if(u&&++h>cK){if(Date.now()>d)return n(),l;h=0}}}endDrawing(){ce(this,ml,F5).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const r of e.values())typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&(r.width=r.height=0);e.clear()}this._cachedBitmapsMap.clear(),ce(this,ml,$5).call(this)}_scaleImage(e,r){const n=e.width??e.displayWidth,s=e.height??e.displayHeight;let i=Math.max(Math.hypot(r[0],r[1]),1),o=Math.max(Math.hypot(r[2],r[3]),1),l=n,c=s,u="prescale1",d,h;for(;i>2&&l>1||o>2&&c>1;){let f=l,p=c;i>2&&l>1&&(f=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),i/=l/f),o>2&&c>1&&(p=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,o/=c/p),d=this.cachedCanvases.getCanvas(u,f,p),h=d.context,h.clearRect(0,0,f,p),h.drawImage(e,0,0,l,c,0,0,f,p),e=d.canvas,l=f,c=p,u=u==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}_createMaskCanvas(e){const r=this.ctx,{width:n,height:s}=e,i=this.current.fillColor,o=this.current.patternFill,l=tn(r);let c,u,d,h;if((e.bitmap||e.data)&&e.count>1){const E=e.bitmap||e.data.buffer;u=JSON.stringify(o?l:[l.slice(0,4),i]),c=this._cachedBitmapsMap.get(E),c||(c=new Map,this._cachedBitmapsMap.set(E,c));const M=c.get(u);if(M&&!o){const z=Math.round(Math.min(l[0],l[2])+l[4]),P=Math.round(Math.min(l[1],l[3])+l[5]);return{canvas:M,offsetX:z,offsetY:P}}d=M}d||(h=this.cachedCanvases.getCanvas("maskCanvas",n,s),hK(h.context,e));let f=pt.transform(l,[1/n,0,0,-1/s,0,0]);f=pt.transform(f,[1,0,0,1,0,-s]);const p=xy.slice();pt.axialAlignedBoundingBox([0,0,n,s],f,p);const[g,m,x,y]=p,v=Math.round(x-g)||1,b=Math.round(y-m)||1,w=this.cachedCanvases.getCanvas("fillCanvas",v,b),j=w.context,N=g,C=m;j.translate(-N,-C),j.transform(...f),d||(d=this._scaleImage(h.canvas,Nl(j)),d=d.img,c&&o&&c.set(u,d)),j.imageSmoothingEnabled=fK(tn(j),e.interpolate),HN(j,d,0,0,d.width,d.height,0,0,n,s),j.globalCompositeOperation="source-in";const k=pt.transform(Nl(j),[1,0,0,1,-N,-C]);return j.fillStyle=o?i.getPattern(r,this,k,Ns.FILL):i,j.fillRect(0,0,n,s),c&&!o&&(this.cachedCanvases.delete("fillCanvas"),c.set(u,w.canvas)),{canvas:w.canvas,offsetX:Math.round(N),offsetY:Math.round(C)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=ict[e]}setLineJoin(e){this.ctx.lineJoin=act[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,r){const n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(e),n.lineDashOffset=r)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[r,n]of e)switch(r){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.ctx.globalAlpha=this.current.fillAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,r=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(n,e,r);this.suspendedCtx=this.ctx;const i=this.ctx=s.context;i.setTransform(this.suspendedCtx.getTransform()),u0(this.suspendedCtx,i),nct(i,this.suspendedCtx),this.setGState([["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),u0(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const r=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,r,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,r,n,s){const i=s[0],o=s[1],l=s[2]-i,c=s[3]-o;l===0||c===0||(this.genericComposeSMask(r.context,n,l,c,r.subtype,r.backdrop,r.transferMap,i,o,r.offsetX,r.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore())}genericComposeSMask(e,r,n,s,i,o,l,c,u,d,h){let f=e.canvas,p=c-d,g=u-h;if(o)if(p<0||g<0||p+n>f.width||g+s>f.height){const x=this.cachedCanvases.getCanvas("maskExtension",n,s),y=x.context;y.drawImage(f,-p,-g),y.globalCompositeOperation="destination-atop",y.fillStyle=o,y.fillRect(0,0,n,s),y.globalCompositeOperation="source-over",f=x.canvas,p=g=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const x=new Path2D;x.rect(p,g,n,s),e.clip(x),e.globalCompositeOperation="destination-atop",e.fillStyle=o,e.fillRect(p,g,n,s),e.restore()}r.save(),r.globalAlpha=1,r.setTransform(1,0,0,1,0,0),i==="Alpha"&&l?r.filter=this.filterFactory.addAlphaFilter(l):i==="Luminosity"&&(r.filter=this.filterFactory.addLuminosityFilter(l));const m=new Path2D;m.rect(c,u,n,s),r.clip(m),r.globalCompositeOperation="destination-in",r.drawImage(f,p,g,n,s,c,u,n,s),r.restore()}save(){this.inSMaskMode&&u0(this.ctx,this.suspendedCtx),this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){if(this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&u0(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,r,n,s,i,o){this.ctx.transform(e,r,n,s,i,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,r,n){let[s]=r;if(!n){s||(s=r[0]=new Path2D),this[e](s);return}if(!(s instanceof Path2D)){const i=r[0]=new Path2D;for(let o=0,l=s.length;o<l;)switch(s[o++]){case $N.moveTo:i.moveTo(s[o++],s[o++]);break;case $N.lineTo:i.lineTo(s[o++],s[o++]);break;case $N.curveTo:i.bezierCurveTo(s[o++],s[o++],s[o++],s[o++],s[o++],s[o++]);break;case $N.closePath:i.closePath();break;default:Tt(`Unrecognized drawing path operator: ${s[o-1]}`);break}s=i}pt.axialAlignedBoundingBox(n,tn(this.ctx),this.current.minMax),this[e](s)}closePath(){this.ctx.closePath()}stroke(e,r=!0){const n=this.ctx,s=this.current.strokeColor;if(n.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof s=="object"&&(s!=null&&s.getPattern)){const i=s.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.strokeStyle=s.getPattern(n,this,Nl(n),Ns.STROKE),i){const o=new Path2D;o.addPath(e,n.getTransform().invertSelf().multiplySelf(i)),e=o}this.rescaleAndStroke(e,!1),n.restore()}else this.rescaleAndStroke(e,!0);r&&this.consumePath(e,this.current.getClippedPathBoundingBox(Ns.STROKE,tn(this.ctx))),n.globalAlpha=this.current.fillAlpha}closeStroke(e){this.stroke(e)}fill(e,r=!0){const n=this.ctx,s=this.current.fillColor,i=this.current.patternFill;let o=!1;if(i){const c=s.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.fillStyle=s.getPattern(n,this,Nl(n),Ns.FILL),c){const u=new Path2D;u.addPath(e,n.getTransform().invertSelf().multiplySelf(c)),e=u}o=!0}const l=this.current.getClippedPathBoundingBox();this.contentVisible&&l!==null&&(this.pendingEOFill?(n.fill(e,"evenodd"),this.pendingEOFill=!1):n.fill(e)),o&&n.restore(),r&&this.consumePath(e,l)}eoFill(e){this.pendingEOFill=!0,this.fill(e)}fillStroke(e){this.fill(e,!1),this.stroke(e,!1),this.consumePath(e)}eoFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}closeFillStroke(e){this.fillStroke(e)}closeEOFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}endPath(e){this.consumePath(e)}rawFillPath(e){this.ctx.fill(e)}clip(){this.pendingClip=oct}eoClip(){this.pendingClip=pK}beginText(){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,r=this.ctx;if(e===void 0)return;const n=new Path2D,s=r.getTransform().invertSelf();for(const{transform:i,x:o,y:l,fontSize:c,path:u}of e)u&&n.addPath(u,new DOMMatrix(i).preMultiplySelf(s).translate(o,l).scale(c,-c));r.clip(n),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,r){var d;const n=this.commonObjs.get(e),s=this.current;if(!n)throw new Error(`Can't find font for ${e}`);if(s.fontMatrix=n.fontMatrix||h5,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&Tt("Invalid font matrix for font "+e),r<0?(r=-r,s.fontDirection=-1):s.fontDirection=1,this.current.font=n,this.current.fontSize=r,n.isType3Font)return;const i=n.loadedName||"sans-serif",o=((d=n.systemFontInfo)==null?void 0:d.css)||`"${i}", ${n.fallbackName}`;let l="normal";n.black?l="900":n.bold&&(l="bold");const c=n.italic?"italic":"normal";let u=r;r<oK?u=oK:r>lK&&(u=lK),this.current.fontSizeScale=r/u,this.ctx.font=`${c} ${l} ${u}px ${o}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,r){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=r}setLeadingMoveText(e,r){this.setLeading(-r),this.moveText(e,r)}setTextMatrix(e){const{current:r}=this;r.textMatrix=e,r.textMatrixScale=Math.hypot(e[0],e[1]),r.x=r.lineX=0,r.y=r.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,r,n,s,i){const o=this.ctx,l=this.current,c=l.font,u=l.textRenderingMode,d=l.fontSize/l.fontSizeScale,h=u&zs.FILL_STROKE_MASK,f=!!(u&zs.ADD_TO_PATH_FLAG),p=l.patternFill&&!c.missingFile,g=l.patternStroke&&!c.missingFile;let m;if((c.disableFontFace||f||p||g)&&!c.missingFile&&(m=c.getPathGenerator(this.commonObjs,e)),m&&(c.disableFontFace||p||g)){o.save(),o.translate(r,n),o.scale(d,-d);let x;if((h===zs.FILL||h===zs.FILL_STROKE)&&(s?(x=o.getTransform(),o.setTransform(...s),o.fill(ce(this,ml,B5).call(this,m,x,s))):o.fill(m)),h===zs.STROKE||h===zs.FILL_STROKE)if(i){x||(x=o.getTransform()),o.setTransform(...i);const{a:y,b:v,c:b,d:w}=x,j=pt.inverseTransform(i),N=pt.transform([y,v,b,w,0,0],j);pt.singularValueDecompose2dScale(N,Sa),o.lineWidth*=Math.max(Sa[0],Sa[1])/d,o.stroke(ce(this,ml,B5).call(this,m,x,i))}else o.lineWidth/=d,o.stroke(m);o.restore()}else(h===zs.FILL||h===zs.FILL_STROKE)&&o.fillText(e,r,n),(h===zs.STROKE||h===zs.FILL_STROKE)&&o.strokeText(e,r,n);f&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:tn(o),x:r,y:n,fontSize:d,path:m})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const r=e.getImageData(0,0,10,10).data;let n=!1;for(let s=3;s<r.length;s+=4)if(r[s]>0&&r[s]<255){n=!0;break}return Ut(this,"isFontSubpixelAAEnabled",n)}showText(e){const r=this.current,n=r.font;if(n.isType3Font)return this.showType3Text(e);const s=r.fontSize;if(s===0)return;const i=this.ctx,o=r.fontSizeScale,l=r.charSpacing,c=r.wordSpacing,u=r.fontDirection,d=r.textHScale*u,h=e.length,f=n.vertical,p=f?1:-1,g=n.defaultVMetrics,m=s*r.fontMatrix[0],x=r.textRenderingMode===zs.FILL&&!n.disableFontFace&&!r.patternFill;i.save(),r.textMatrix&&i.transform(...r.textMatrix),i.translate(r.x,r.y+r.textRise),u>0?i.scale(d,-1):i.scale(d,1);let y,v;if(r.patternFill){i.save();const C=r.fillColor.getPattern(i,this,Nl(i),Ns.FILL);y=tn(i),i.restore(),i.fillStyle=C}if(r.patternStroke){i.save();const C=r.strokeColor.getPattern(i,this,Nl(i),Ns.STROKE);v=tn(i),i.restore(),i.strokeStyle=C}let b=r.lineWidth;const w=r.textMatrixScale;if(w===0||b===0){const C=r.textRenderingMode&zs.FILL_STROKE_MASK;(C===zs.STROKE||C===zs.FILL_STROKE)&&(b=this.getSinglePixelWidth())}else b/=w;if(o!==1&&(i.scale(o,o),b/=o),i.lineWidth=b,n.isInvalidPDFjsFont){const C=[];let k=0;for(const E of e)C.push(E.unicode),k+=E.width;i.fillText(C.join(""),0,0),r.x+=k*m*d,i.restore(),this.compose();return}let j=0,N;for(N=0;N<h;++N){const C=e[N];if(typeof C=="number"){j+=p*C*s/1e3;continue}let k=!1;const E=(C.isSpace?c:0)+l,M=C.fontChar,z=C.accent;let P,V,A=C.width;if(f){const K=C.vmetric||g,G=-(C.vmetric?K[1]:A*.5)*m,Y=K[2]*m;A=K?-K[0]:A,P=G/o,V=(j+Y)/o}else P=j/o,V=0;if(n.remeasure&&A>0){const K=i.measureText(M).width*1e3/s*o;if(A<K&&this.isFontSubpixelAAEnabled){const G=A/K;k=!0,i.save(),i.scale(G,1),P/=G}else A!==K&&(P+=(A-K)/2e3*s/o)}if(this.contentVisible&&(C.isInFont||n.missingFile)){if(x&&!z)i.fillText(M,P,V);else if(this.paintChar(M,P,V,y,v),z){const K=P+s*z.offset.x/o,G=V-s*z.offset.y/o;this.paintChar(z.fontChar,K,G,y,v)}}const $=f?A*m-E*u:A*m+E*u;j+=$,k&&i.restore()}f?r.y-=j:r.x+=j*d,i.restore(),this.compose()}showType3Text(e){const r=this.ctx,n=this.current,s=n.font,i=n.fontSize,o=n.fontDirection,l=s.vertical?1:-1,c=n.charSpacing,u=n.wordSpacing,d=n.textHScale*o,h=n.fontMatrix||h5,f=e.length,p=n.textRenderingMode===zs.INVISIBLE;let g,m,x,y;if(!(p||i===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,r.save(),n.textMatrix&&r.transform(...n.textMatrix),r.translate(n.x,n.y+n.textRise),r.scale(d,o),g=0;g<f;++g){if(m=e[g],typeof m=="number"){y=l*m*i/1e3,this.ctx.translate(y,0),n.x+=y*d;continue}const v=(m.isSpace?u:0)+c,b=s.charProcOperatorList[m.operatorListId];b?this.contentVisible&&(this.save(),r.scale(i,i),r.transform(...h),this.executeOperatorList(b),this.restore()):Tt(`Type3 character "${m.operatorListId}" is not available.`);const w=[m.width,0];pt.applyTransform(w,h),x=w[0]*i+v,r.translate(x,0),n.x+=x*d}r.restore()}}setCharWidth(e,r){}setCharWidthAndBounds(e,r,n,s,i,o){const l=new Path2D;l.rect(n,s,i-n,o-s),this.ctx.clip(l),this.endPath()}getColorN_Pattern(e){let r;if(e[0]==="TilingPattern"){const n=this.baseTransform||tn(this.ctx),s={createCanvasGraphics:i=>new MB(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};r=new L5(e,this.ctx,s,n)}else r=this._getPattern(e[1],e[2]);return r}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e){this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e){this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,r=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=ect(this.getObject(e)),this.cachedPatterns.set(e,n)),r&&(n.matrix=r),n}shadingFill(e){if(!this.contentVisible)return;const r=this.ctx;this.save();const n=this._getPattern(e);r.fillStyle=n.getPattern(r,this,Nl(r),Ns.SHADING);const s=Nl(r);if(s){const{width:i,height:o}=r.canvas,l=xy.slice();pt.axialAlignedBoundingBox([0,0,i,o],s,l);const[c,u,d,h]=l;this.ctx.fillRect(c,u,d-c,h-u)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){_r("Should not call beginInlineImage")}beginImageData(){_r("Should not call beginImageData")}paintFormXObjectBegin(e,r){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=tn(this.ctx),r)){pt.axialAlignedBoundingBox(r,this.baseTransform,this.current.minMax);const[n,s,i,o]=r,l=new Path2D;l.rect(n,s,i-n,o-s),this.ctx.clip(l),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const r=this.ctx;e.isolated||W2("TODO: Support non-isolated groups."),e.knockout&&Tt("Knockout groups not supported.");const n=tn(r);if(e.matrix&&r.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let s=xy.slice();pt.axialAlignedBoundingBox(e.bbox,tn(r),s);const i=[0,0,r.canvas.width,r.canvas.height];s=pt.intersect(s,i)||[0,0,0,0];const o=Math.floor(s[0]),l=Math.floor(s[1]),c=Math.max(Math.ceil(s[2])-o,1),u=Math.max(Math.ceil(s[3])-l,1);this.current.startNewPathAndClipBox([0,0,c,u]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);const h=this.cachedCanvases.getCanvas(d,c,u),f=h.context;f.translate(-o,-l),f.transform(...n);let p=new Path2D;const[g,m,x,y]=e.bbox;if(p.rect(g,m,x-g,y-m),e.matrix){const v=new Path2D;v.addPath(p,new DOMMatrix(e.matrix)),p=v}f.clip(p),e.smask?this.smaskStack.push({canvas:h.canvas,context:f,offsetX:o,offsetY:l,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(r.setTransform(1,0,0,1,0,0),r.translate(o,l),r.save()),u0(r,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(r),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const r=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const s=tn(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...s);const i=xy.slice();pt.axialAlignedBoundingBox([0,0,r.canvas.width,r.canvas.height],s,i),this.ctx.drawImage(r.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(e,r,n,s,i){if(ce(this,ml,F5).call(this),WN(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),r){const o=r[2]-r[0],l=r[3]-r[1];if(i&&this.annotationCanvasMap){n=n.slice(),n[4]-=r[0],n[5]-=r[1],r=r.slice(),r[0]=r[1]=0,r[2]=o,r[3]=l,pt.singularValueDecompose2dScale(tn(this.ctx),Sa);const{viewportScale:c}=this,u=Math.ceil(o*this.outputScaleX*c),d=Math.ceil(l*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,d);const{canvas:h,context:f}=this.annotationCanvas;this.annotationCanvasMap.set(e,h),this.annotationCanvas.savedCtx=this.ctx,this.ctx=f,this.ctx.save(),this.ctx.setTransform(Sa[0],0,0,-Sa[1],0,l*Sa[1]),WN(this.ctx)}else{WN(this.ctx),this.endPath();const c=new Path2D;c.rect(r[0],r[1],o,l),this.ctx.clip(c)}}this.current=new uK(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),ce(this,ml,$5).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const r=e.count;e=this.getObject(e.data,e),e.count=r;const n=this.ctx,s=this._createMaskCanvas(e),i=s.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(i,s.offsetX,s.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,r,n=0,s=0,i,o){if(!this.contentVisible)return;e=this.getObject(e.data,e);const l=this.ctx;l.save();const c=tn(l);l.transform(r,n,s,i,0,0);const u=this._createMaskCanvas(e);l.setTransform(1,0,0,1,u.offsetX-c[4],u.offsetY-c[5]);for(let d=0,h=o.length;d<h;d+=2){const f=pt.transform(c,[r,n,s,i,o[d],o[d+1]]);l.drawImage(u.canvas,f[4],f[5])}l.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const r=this.ctx,n=this.current.fillColor,s=this.current.patternFill;for(const i of e){const{data:o,width:l,height:c,transform:u}=i,d=this.cachedCanvases.getCanvas("maskCanvas",l,c),h=d.context;h.save();const f=this.getObject(o,i);hK(h,f),h.globalCompositeOperation="source-in",h.fillStyle=s?n.getPattern(h,this,Nl(r),Ns.FILL):n,h.fillRect(0,0,l,c),h.restore(),r.save(),r.transform(...u),r.scale(1,-1),HN(r,d.canvas,0,0,l,c,0,-1,1,1),r.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const r=this.getObject(e);if(!r){Tt("Dependent image isn't ready yet");return}this.paintInlineImageXObject(r)}paintImageXObjectRepeat(e,r,n,s){if(!this.contentVisible)return;const i=this.getObject(e);if(!i){Tt("Dependent image isn't ready yet");return}const o=i.width,l=i.height,c=[];for(let u=0,d=s.length;u<d;u+=2)c.push({transform:[r,0,0,n,s[u],s[u+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(i,c)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:r,width:n,height:s}=e,i=this.cachedCanvases.getCanvas("inlineImage",n,s),o=i.context;return o.filter=this.current.transferMaps,o.drawImage(r,0,0),o.filter="none",i.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const r=e.width,n=e.height,s=this.ctx;this.save();const{filter:i}=s;i!=="none"&&i!==""&&(s.filter="none"),s.scale(1/r,-1/n);let o;if(e.bitmap)o=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)o=e;else{const u=this.cachedCanvases.getCanvas("inlineImage",r,n).context;dK(u,e),o=this.applyTransferMapsToCanvas(u)}const l=this._scaleImage(o,Nl(s));s.imageSmoothingEnabled=fK(tn(s),e.interpolate),HN(s,l.img,0,0,l.paintWidth,l.paintHeight,0,-n,r,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,r){if(!this.contentVisible)return;const n=this.ctx;let s;if(e.bitmap)s=e.bitmap;else{const i=e.width,o=e.height,c=this.cachedCanvases.getCanvas("inlineImage",i,o).context;dK(c,e),s=this.applyTransferMapsToCanvas(c)}for(const i of r)n.save(),n.transform(...i.transform),n.scale(1,-1),HN(n,s,i.x,i.y,i.w,i.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,r){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,r){e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(r)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e,r){const n=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(r);const s=this.ctx;this.pendingClip&&(n||(this.pendingClip===pK?s.clip(e,"evenodd"):s.clip(e)),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=tn(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const r=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),s=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,s)/r}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:r,b:n,c:s,d:i}=this.ctx.getTransform();let o,l;if(n===0&&s===0){const c=Math.abs(r),u=Math.abs(i);if(c===u)if(e===0)o=l=1/c;else{const d=c*e;o=l=d<1?1/d:1}else if(e===0)o=1/c,l=1/u;else{const d=c*e,h=u*e;o=d<1?1/d:1,l=h<1?1/h:1}}else{const c=Math.abs(r*i-n*s),u=Math.hypot(r,n),d=Math.hypot(s,i);if(e===0)o=d/c,l=u/c;else{const h=e*c;o=d>h?d/h:1,l=u>h?u/h:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(e,r){const{ctx:n,current:{lineWidth:s}}=this,[i,o]=this.getScaleForStroking();if(i===o){n.lineWidth=(s||1)*i,n.stroke(e);return}const l=n.getLineDash();r&&n.save(),n.scale(i,o),wI.a=1/i,wI.d=1/o;const c=new Path2D;if(c.addPath(e,wI),l.length>0){const u=Math.max(i,o);n.setLineDash(l.map(d=>d/u)),n.lineDashOffset/=u}n.lineWidth=s||1,n.stroke(c),r&&n.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};ml=new WeakSet,F5=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},$5=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const r=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=r}}},B5=function(e,r,n){const s=new Path2D;return s.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(r)),s};let zy=MB;for(const t in ok)zy.prototype[t]!==void 0&&(zy.prototype[ok[t]]=zy.prototype[t]);var S_,N_;class ic{static get workerPort(){return _(this,S_)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");Q(this,S_,e)}static get workerSrc(){return _(this,N_)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");Q(this,N_,e)}}S_=new WeakMap,N_=new WeakMap,se(ic,S_,null),se(ic,N_,"");var Sx,A_;class lct{constructor({parsedData:e,rawData:r}){se(this,Sx);se(this,A_);Q(this,Sx,e),Q(this,A_,r)}getRaw(){return _(this,A_)}get(e){return _(this,Sx).get(e)??null}[Symbol.iterator](){return _(this,Sx).entries()}}Sx=new WeakMap,A_=new WeakMap;const Gg=Symbol("INTERNAL");var E_,C_,k_,Nx;class cct{constructor(e,{name:r,intent:n,usage:s,rbGroups:i}){se(this,E_,!1);se(this,C_,!1);se(this,k_,!1);se(this,Nx,!0);Q(this,E_,!!(e&_a.DISPLAY)),Q(this,C_,!!(e&_a.PRINT)),this.name=r,this.intent=n,this.usage=s,this.rbGroups=i}get visible(){if(_(this,k_))return _(this,Nx);if(!_(this,Nx))return!1;const{print:e,view:r}=this.usage;return _(this,E_)?(r==null?void 0:r.viewState)!=="OFF":_(this,C_)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,r,n=!1){e!==Gg&&_r("Internal method `_setVisible` called."),Q(this,k_,n),Q(this,Nx,r)}}E_=new WeakMap,C_=new WeakMap,k_=new WeakMap,Nx=new WeakMap;var ch,vr,Ax,Ex,T_,U5;class uct{constructor(e,r=_a.DISPLAY){se(this,T_);se(this,ch,null);se(this,vr,new Map);se(this,Ax,null);se(this,Ex,null);if(this.renderingIntent=r,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,Q(this,Ex,e.order);for(const n of e.groups)_(this,vr).set(n.id,new cct(r,n));if(e.baseState==="OFF")for(const n of _(this,vr).values())n._setVisible(Gg,!1);for(const n of e.on)_(this,vr).get(n)._setVisible(Gg,!0);for(const n of e.off)_(this,vr).get(n)._setVisible(Gg,!1);Q(this,Ax,this.getHash())}}isVisible(e){if(_(this,vr).size===0)return!0;if(!e)return W2("Optional content group not defined."),!0;if(e.type==="OCG")return _(this,vr).has(e.id)?_(this,vr).get(e.id).visible:(Tt(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return ce(this,T_,U5).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const r of e.ids){if(!_(this,vr).has(r))return Tt(`Optional content group not found: ${r}`),!0;if(_(this,vr).get(r).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const r of e.ids){if(!_(this,vr).has(r))return Tt(`Optional content group not found: ${r}`),!0;if(!_(this,vr).get(r).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const r of e.ids){if(!_(this,vr).has(r))return Tt(`Optional content group not found: ${r}`),!0;if(!_(this,vr).get(r).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const r of e.ids){if(!_(this,vr).has(r))return Tt(`Optional content group not found: ${r}`),!0;if(_(this,vr).get(r).visible)return!1}return!0}return Tt(`Unknown optional content policy ${e.policy}.`),!0}return Tt(`Unknown group type ${e.type}.`),!0}setVisibility(e,r=!0,n=!0){var i;const s=_(this,vr).get(e);if(!s){Tt(`Optional content group not found: ${e}`);return}if(n&&r&&s.rbGroups.length)for(const o of s.rbGroups)for(const l of o)l!==e&&((i=_(this,vr).get(l))==null||i._setVisible(Gg,!1,!0));s._setVisible(Gg,!!r,!0),Q(this,ch,null)}setOCGState({state:e,preserveRB:r}){let n;for(const s of e){switch(s){case"ON":case"OFF":case"Toggle":n=s;continue}const i=_(this,vr).get(s);if(i)switch(n){case"ON":this.setVisibility(s,!0,r);break;case"OFF":this.setVisibility(s,!1,r);break;case"Toggle":this.setVisibility(s,!i.visible,r);break}}Q(this,ch,null)}get hasInitialVisibility(){return _(this,Ax)===null||this.getHash()===_(this,Ax)}getOrder(){return _(this,vr).size?_(this,Ex)?_(this,Ex).slice():[..._(this,vr).keys()]:null}getGroup(e){return _(this,vr).get(e)||null}getHash(){if(_(this,ch)!==null)return _(this,ch);const e=new fhe;for(const[r,n]of _(this,vr))e.update(`${r}:${n.visible}`);return Q(this,ch,e.hexdigest())}[Symbol.iterator](){return _(this,vr).entries()}}ch=new WeakMap,vr=new WeakMap,Ax=new WeakMap,Ex=new WeakMap,T_=new WeakSet,U5=function(e){const r=e.length;if(r<2)return!0;const n=e[0];for(let s=1;s<r;s++){const i=e[s];let o;if(Array.isArray(i))o=ce(this,T_,U5).call(this,i);else if(_(this,vr).has(i))o=_(this,vr).get(i).visible;else return Tt(`Optional content group not found: ${i}`),!0;switch(n){case"And":if(!o)return!1;break;case"Or":if(o)return!0;break;case"Not":return!o;default:return!0}}return n==="And"};class dct{constructor(e,{disableRange:r=!1,disableStream:n=!1}){Ln(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:i,progressiveDone:o,contentDispositionFilename:l}=e;if(this._queuedChunks=[],this._progressiveDone=o,this._contentDispositionFilename=l,(i==null?void 0:i.length)>0){const c=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!n,this._isRangeSupported=!r,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((c,u)=>{this._onReceiveData({begin:c,chunk:u})}),e.addProgressListener((c,u)=>{this._onProgress({loaded:c,total:u})}),e.addProgressiveReadListener(c=>{this._onReceiveData({chunk:c})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:r}){const n=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{const s=this._rangeReaders.some(function(i){return i._begin!==e?!1:(i._enqueue(n),!0)});Ln(s,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var r,n,s,i;e.total===void 0?(n=(r=this._rangeReaders[0])==null?void 0:r.onProgress)==null||n.call(r,{loaded:e.loaded}):(i=(s=this._fullRequestReader)==null?void 0:s.onProgress)==null||i.call(s,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const r=this._rangeReaders.indexOf(e);r>=0&&this._rangeReaders.splice(r,1)}getFullReader(){Ln(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new hct(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,r){if(r<=this._progressiveDataLength)return null;const n=new fct(this,e,r);return this._pdfDataRangeTransport.requestDataRange(e,r),this._rangeReaders.push(n),n}cancelAllRequests(e){var r;(r=this._fullRequestReader)==null||r.cancel(e);for(const n of this._rangeReaders.slice(0))n.cancel(e);this._pdfDataRangeTransport.abort()}}class hct{constructor(e,r,n=!1,s=null){this._stream=e,this._done=n||!1,this._filename=Q8(s)?s:null,this._queuedChunks=r||[],this._loaded=0;for(const i of this._queuedChunks)this._loaded+=i.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class fct{constructor(e,r,n){this._stream=e,this._begin=r,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function pct(t){let e=!0,r=n("filename\\*","i").exec(t);if(r){r=r[1];let d=l(r);return d=unescape(d),d=c(d),d=u(d),i(d)}if(r=o(t),r){const d=u(r);return i(d)}if(r=n("filename","i").exec(t),r){r=r[1];let d=l(r);return d=u(d),i(d)}function n(d,h){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',h)}function s(d,h){if(d){if(!/^[\x00-\xFF]+$/.test(h))return h;try{const f=new TextDecoder(d,{fatal:!0}),p=dS(h);h=f.decode(p),e=!1}catch{}}return h}function i(d){return e&&/[\x80-\xff]/.test(d)&&(d=s("utf-8",d),e&&(d=s("iso-8859-1",d))),d}function o(d){const h=[];let f;const p=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(d))!==null;){let[,m,x,y]=f;if(m=parseInt(m,10),m in h){if(m===0)break;continue}h[m]=[x,y]}const g=[];for(let m=0;m<h.length&&m in h;++m){let[x,y]=h[m];y=l(y),x&&(y=unescape(y),m===0&&(y=c(y))),g.push(y)}return g.join("")}function l(d){if(d.startsWith('"')){const h=d.slice(1).split('\\"');for(let f=0;f<h.length;++f){const p=h[f].indexOf('"');p!==-1&&(h[f]=h[f].slice(0,p),h.length=f+1),h[f]=h[f].replaceAll(/\\(.)/g,"$1")}d=h.join('"')}return d}function c(d){const h=d.indexOf("'");if(h===-1)return d;const f=d.slice(0,h),g=d.slice(h+1).replace(/^[^']*'/,"");return s(f,g)}function u(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(h,f,p,g){if(p==="q"||p==="Q")return g=g.replaceAll("_"," "),g=g.replaceAll(/=([0-9a-fA-F]{2})/g,function(m,x){return String.fromCharCode(parseInt(x,16))}),s(f,g);try{g=atob(g)}catch{}return s(f,g)})}return""}function Nhe(t,e){const r=new Headers;if(!t||!e||typeof e!="object")return r;for(const n in e){const s=e[n];s!==void 0&&r.append(n,s)}return r}function G2(t){var e;return((e=URL.parse(t))==null?void 0:e.origin)??null}function Ahe({responseHeaders:t,isHttp:e,rangeChunkSize:r,disableRange:n}){const s={allowRangeRequests:!1,suggestedLength:void 0},i=parseInt(t.get("Content-Length"),10);return!Number.isInteger(i)||(s.suggestedLength=i,i<=2*r)||n||!e||t.get("Accept-Ranges")!=="bytes"||(t.get("Content-Encoding")||"identity")!=="identity"||(s.allowRangeRequests=!0),s}function Ehe(t){const e=t.get("Content-Disposition");if(e){let r=pct(e);if(r.includes("%"))try{r=decodeURIComponent(r)}catch{}if(Q8(r))return r}return null}function mS(t,e){return new lk(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t,t===404||t===0&&e.startsWith("file:"))}function Che(t){return t===200||t===206}function khe(t,e,r){return{method:"GET",headers:t,signal:r.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function The(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Tt(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class mct{constructor(e){Le(this,"_responseOrigin",null);this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=Nhe(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return Ln(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new gct(this),this._fullRequestReader}getRangeReader(e,r){if(r<=this._progressiveDataLength)return null;const n=new yct(this,e,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var r;(r=this._fullRequestReader)==null||r.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class gct{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const r=e.source;this._withCredentials=r.withCredentials||!1,this._contentLength=r.length,this._headersCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange;const n=new Headers(e.headers),s=r.url;fetch(s,khe(n,this._withCredentials,this._abortController)).then(i=>{if(e._responseOrigin=G2(i.url),!Che(i.status))throw mS(i.status,s);this._reader=i.body.getReader(),this._headersCapability.resolve();const o=i.headers,{allowRangeRequests:l,suggestedLength:c}=Ahe({responseHeaders:o,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=l,this._contentLength=c||this._contentLength,this._filename=Ehe(o),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new nf("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;await this._headersCapability.promise;const{value:e,done:r}=await this._reader.read();return r?{value:e,done:r}:(this._loaded+=e.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded,total:this._contentLength}),{value:The(e),done:!1})}cancel(e){var r;(r=this._reader)==null||r.cancel(e),this._abortController.abort()}}class yct{constructor(e,r,n){this._stream=e,this._reader=null,this._loaded=0;const s=e.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController;const i=new Headers(e.headers);i.append("Range",`bytes=${r}-${n-1}`);const o=s.url;fetch(o,khe(i,this._withCredentials,this._abortController)).then(l=>{const c=G2(l.url);if(c!==e._responseOrigin)throw new Error(`Expected range response-origin "${c}" to match "${e._responseOrigin}".`);if(!Che(l.status))throw mS(l.status,o);this._readCapability.resolve(),this._reader=l.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;await this._readCapability.promise;const{value:e,done:r}=await this._reader.read();return r?{value:e,done:r}:(this._loaded+=e.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded}),{value:The(e),done:!1})}cancel(e){var r;(r=this._reader)==null||r.cancel(e),this._abortController.abort()}}const _I=200,jI=206;function xct(t){const e=t.response;return typeof e!="string"?e:dS(e).buffer}class vct{constructor({url:e,httpHeaders:r,withCredentials:n}){Le(this,"_responseOrigin",null);this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Nhe(this.isHttp,r),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const r=new XMLHttpRequest,n=this.currXhrId++,s=this.pendingRequests[n]={xhr:r};r.open("GET",this.url),r.withCredentials=this.withCredentials;for(const[i,o]of this.headers)r.setRequestHeader(i,o);return this.isHttp&&"begin"in e&&"end"in e?(r.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),s.expectedStatus=jI):s.expectedStatus=_I,r.responseType="arraybuffer",Ln(e.onError,"Expected `onError` callback to be provided."),r.onerror=()=>{e.onError(r.status)},r.onreadystatechange=this.onStateChange.bind(this,n),r.onprogress=this.onProgress.bind(this,n),s.onHeadersReceived=e.onHeadersReceived,s.onDone=e.onDone,s.onError=e.onError,s.onProgress=e.onProgress,r.send(null),n}onProgress(e,r){var s;const n=this.pendingRequests[e];n&&((s=n.onProgress)==null||s.call(n,r))}onStateChange(e,r){const n=this.pendingRequests[e];if(!n)return;const s=n.xhr;if(s.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),s.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],s.status===0&&this.isHttp){n.onError(s.status);return}const i=s.status||_I;if(!(i===_I&&n.expectedStatus===jI)&&i!==n.expectedStatus){n.onError(s.status);return}const l=xct(s);if(i===jI){const c=s.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(c);u?n.onDone({begin:parseInt(u[1],10),chunk:l}):(Tt('Missing or invalid "Content-Range" header.'),n.onError(0))}else l?n.onDone({begin:0,chunk:l}):n.onError(s.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const r=this.pendingRequests[e].xhr;delete this.pendingRequests[e],r.abort()}}class bct{constructor(e){this._source=e,this._manager=new vct(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const r=this._rangeRequestReaders.indexOf(e);r>=0&&this._rangeRequestReaders.splice(r,1)}getFullReader(){return Ln(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new wct(this._manager,this._source),this._fullRequestReader}getRangeReader(e,r){const n=new _ct(this._manager,e,r);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var r;(r=this._fullRequestReader)==null||r.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class wct{constructor(e,r){this._manager=e,this._url=r.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._contentLength=r.length,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,r=this._manager.getRequestXhr(e);this._manager._responseOrigin=G2(r.responseURL);const n=r.getAllResponseHeaders(),s=new Headers(n?n.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(l=>{const[c,...u]=l.split(": ");return[c,u.join(": ")]}):[]),{allowRangeRequests:i,suggestedLength:o}=Ahe({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=Ehe(s),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=mS(e,this._url),this._headersCapability.reject(this._storedError);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){var r;(r=this.onProgress)==null||r.call(this,{loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class _ct{constructor(e,r,n){this._manager=e,this._url=e.url,this._requestId=e.request({begin:r,end:n,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var r;const e=G2((r=this._manager.getRequestXhr(this._requestId))==null?void 0:r.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var e;(e=this.onClosed)==null||e.call(this,this)}_onDone(e){const r=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:r,done:!1}):this._queuedChunk=r,this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??(this._storedError=mS(e,this._url));for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var r;this.isStreamingSupported||(r=this.onProgress)==null||r.call(this,{loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const jct=/^[a-z][a-z0-9\-+.]+:/i;function Sct(t){if(jct.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}class Nct{constructor(e){this.source=e,this.url=Sct(e.url),Ln(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return Ln(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new Act(this),this._fullRequestReader}getRangeReader(e,r){if(r<=this._progressiveDataLength)return null;const n=new Ect(this,e,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var r;(r=this._fullRequestReader)==null||r.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class Act{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const r=e.source;this._contentLength=r.length,this._loaded=0,this._filename=null,this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const n=process.getBuiltinModule("fs");n.promises.lstat(this._url).then(s=>{this._contentLength=s.size,this._setReadableStream(n.createReadStream(this._url)),this._headersCapability.resolve()},s=>{s.code==="ENOENT"&&(s=mS(0,this._url.href)),this._storedError=s,this._headersCapability.reject(s)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",r=>{this._error(r)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new nf("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Ect{constructor(e,r,n){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const s=e.source;this._isStreamingSupported=!s.disableStream;const i=process.getBuiltinModule("fs");this._setReadableStream(i.createReadStream(this._url,{start:r,end:n-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",r=>{this._error(r)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const d0=Symbol("INITIAL_DATA");var ua,P_,z5;class Phe{constructor(){se(this,P_);se(this,ua,Object.create(null))}get(e,r=null){if(r){const s=ce(this,P_,z5).call(this,e);return s.promise.then(()=>r(s.data)),null}const n=_(this,ua)[e];if(!n||n.data===d0)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){const r=_(this,ua)[e];return!!r&&r.data!==d0}delete(e){const r=_(this,ua)[e];return!r||r.data===d0?!1:(delete _(this,ua)[e],!0)}resolve(e,r=null){const n=ce(this,P_,z5).call(this,e);n.data=r,n.resolve()}clear(){var e;for(const r in _(this,ua)){const{data:n}=_(this,ua)[r];(e=n==null?void 0:n.bitmap)==null||e.close()}Q(this,ua,Object.create(null))}*[Symbol.iterator](){for(const e in _(this,ua)){const{data:r}=_(this,ua)[e];r!==d0&&(yield[e,r])}}}ua=new WeakMap,P_=new WeakSet,z5=function(e){var r;return(r=_(this,ua))[e]||(r[e]={...Promise.withResolvers(),data:d0})};const Cct=1e5,mK=30;var qX,uh,Mi,O_,I_,qp,fu,R_,M_,Gp,Cx,kx,dh,Tx,D_,Px,Kp,L_,F_,Ox,Yp,$_,hh,Ix,id,Ohe,Ihe,H5,Ma,HA,W5,Rhe,Mhe;const Hn=class Hn{constructor({textContentSource:e,container:r,viewport:n}){se(this,id);se(this,uh,Promise.withResolvers());se(this,Mi,null);se(this,O_,!1);se(this,I_,!!((qX=globalThis.FontInspector)!=null&&qX.enabled));se(this,qp,null);se(this,fu,null);se(this,R_,0);se(this,M_,0);se(this,Gp,null);se(this,Cx,null);se(this,kx,0);se(this,dh,0);se(this,Tx,Object.create(null));se(this,D_,[]);se(this,Px,null);se(this,Kp,[]);se(this,L_,new WeakMap);se(this,F_,null);var c;if(e instanceof ReadableStream)Q(this,Px,e);else if(typeof e=="object")Q(this,Px,new ReadableStream({start(u){u.enqueue(e),u.close()}}));else throw new Error('No "textContentSource" parameter specified.');Q(this,Mi,Q(this,Cx,r)),Q(this,dh,n.scale*jc.pixelRatio),Q(this,kx,n.rotation),Q(this,fu,{div:null,properties:null,ctx:null});const{pageWidth:s,pageHeight:i,pageX:o,pageY:l}=n.rawDims;Q(this,F_,[1,0,0,-1,-o,l+i]),Q(this,M_,s),Q(this,R_,i),ce(c=Hn,Ma,Rhe).call(c),Jm(r,n),_(this,uh).promise.finally(()=>{_(Hn,Ix).delete(this),Q(this,fu,null),Q(this,Tx,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:r}=Is.platform;return Ut(this,"fontFamilyMap",new Map([["sans-serif",`${e&&r?"Calibri, ":""}sans-serif`],["monospace",`${e&&r?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{_(this,Gp).read().then(({value:r,done:n})=>{if(n){_(this,uh).resolve();return}_(this,qp)??Q(this,qp,r.lang),Object.assign(_(this,Tx),r.styles),ce(this,id,Ohe).call(this,r.items),e()},_(this,uh).reject)};return Q(this,Gp,_(this,Px).getReader()),_(Hn,Ix).add(this),e(),_(this,uh).promise}update({viewport:e,onBefore:r=null}){var i;const n=e.scale*jc.pixelRatio,s=e.rotation;if(s!==_(this,kx)&&(r==null||r(),Q(this,kx,s),Jm(_(this,Cx),{rotation:s})),n!==_(this,dh)){r==null||r(),Q(this,dh,n);const o={div:null,properties:null,ctx:ce(i=Hn,Ma,HA).call(i,_(this,qp))};for(const l of _(this,Kp))o.properties=_(this,L_).get(l),o.div=l,ce(this,id,H5).call(this,o)}}cancel(){var r;const e=new nf("TextLayer task cancelled.");(r=_(this,Gp))==null||r.cancel(e).catch(()=>{}),Q(this,Gp,null),_(this,uh).reject(e)}get textDivs(){return _(this,Kp)}get textContentItemsStr(){return _(this,D_)}static cleanup(){if(!(_(this,Ix).size>0)){_(this,Ox).clear();for(const{canvas:e}of _(this,Yp).values())e.remove();_(this,Yp).clear()}}};uh=new WeakMap,Mi=new WeakMap,O_=new WeakMap,I_=new WeakMap,qp=new WeakMap,fu=new WeakMap,R_=new WeakMap,M_=new WeakMap,Gp=new WeakMap,Cx=new WeakMap,kx=new WeakMap,dh=new WeakMap,Tx=new WeakMap,D_=new WeakMap,Px=new WeakMap,Kp=new WeakMap,L_=new WeakMap,F_=new WeakMap,Ox=new WeakMap,Yp=new WeakMap,$_=new WeakMap,hh=new WeakMap,Ix=new WeakMap,id=new WeakSet,Ohe=function(e){var s,i;if(_(this,O_))return;(i=_(this,fu)).ctx??(i.ctx=ce(s=Hn,Ma,HA).call(s,_(this,qp)));const r=_(this,Kp),n=_(this,D_);for(const o of e){if(r.length>Cct){Tt("Ignoring additional textDivs for performance reasons."),Q(this,O_,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){const l=_(this,Mi);Q(this,Mi,document.createElement("span")),_(this,Mi).classList.add("markedContent"),o.id&&_(this,Mi).setAttribute("id",`${o.id}`),l.append(_(this,Mi))}else o.type==="endMarkedContent"&&Q(this,Mi,_(this,Mi).parentNode);continue}n.push(o.str),ce(this,id,Ihe).call(this,o)}},Ihe=function(e){var m;const r=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};_(this,Kp).push(r);const s=pt.transform(_(this,F_),e.transform);let i=Math.atan2(s[1],s[0]);const o=_(this,Tx)[e.fontName];o.vertical&&(i+=Math.PI/2);let l=_(this,I_)&&o.fontSubstitution||o.fontFamily;l=Hn.fontFamilyMap.get(l)||l;const c=Math.hypot(s[2],s[3]),u=c*ce(m=Hn,Ma,Mhe).call(m,l,o,_(this,qp));let d,h;i===0?(d=s[4],h=s[5]-u):(d=s[4]+u*Math.sin(i),h=s[5]-u*Math.cos(i));const f="calc(var(--total-scale-factor) *",p=r.style;_(this,Mi)===_(this,Cx)?(p.left=`${(100*d/_(this,M_)).toFixed(2)}%`,p.top=`${(100*h/_(this,R_)).toFixed(2)}%`):(p.left=`${f}${d.toFixed(2)}px)`,p.top=`${f}${h.toFixed(2)}px)`),p.fontSize=`${f}${(_(Hn,hh)*c).toFixed(2)}px)`,p.fontFamily=l,n.fontSize=c,r.setAttribute("role","presentation"),r.textContent=e.str,r.dir=e.dir,_(this,I_)&&(r.dataset.fontName=o.fontSubstitutionLoadedName||e.fontName),i!==0&&(n.angle=i*(180/Math.PI));let g=!1;if(e.str.length>1)g=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const x=Math.abs(e.transform[0]),y=Math.abs(e.transform[3]);x!==y&&Math.max(x,y)/Math.min(x,y)>1.5&&(g=!0)}if(g&&(n.canvasWidth=o.vertical?e.height:e.width),_(this,L_).set(r,n),_(this,fu).div=r,_(this,fu).properties=n,ce(this,id,H5).call(this,_(this,fu)),n.hasText&&_(this,Mi).append(r),n.hasEOL){const x=document.createElement("br");x.setAttribute("role","presentation"),_(this,Mi).append(x)}},H5=function(e){var l;const{div:r,properties:n,ctx:s}=e,{style:i}=r;let o="";if(_(Hn,hh)>1&&(o=`scale(${1/_(Hn,hh)})`),n.canvasWidth!==0&&n.hasText){const{fontFamily:c}=i,{canvasWidth:u,fontSize:d}=n;ce(l=Hn,Ma,W5).call(l,s,d*_(this,dh),c);const{width:h}=s.measureText(r.textContent);h>0&&(o=`scaleX(${u*_(this,dh)/h}) ${o}`)}n.angle!==0&&(o=`rotate(${n.angle}deg) ${o}`),o.length>0&&(i.transform=o)},Ma=new WeakSet,HA=function(e=null){let r=_(this,Yp).get(e||(e=""));if(!r){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=e,document.body.append(n),r=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),_(this,Yp).set(e,r),_(this,$_).set(r,{size:0,family:""})}return r},W5=function(e,r,n){const s=_(this,$_).get(e);r===s.size&&n===s.family||(e.font=`${r}px ${n}`,s.size=r,s.family=n)},Rhe=function(){if(_(this,hh)!==null)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),Q(this,hh,e.getBoundingClientRect().height),e.remove()},Mhe=function(e,r,n){const s=_(this,Ox).get(e);if(s)return s;const i=ce(this,Ma,HA).call(this,n);i.canvas.width=i.canvas.height=mK,ce(this,Ma,W5).call(this,i,mK,e);const o=i.measureText(""),l=o.fontBoundingBoxAscent,c=Math.abs(o.fontBoundingBoxDescent);i.canvas.width=i.canvas.height=0;let u=.8;return l?u=l/(l+c):(Is.platform.isFirefox&&Tt("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),r.ascent?u=r.ascent:r.descent&&(u=1+r.descent)),_(this,Ox).set(e,u),u},se(Hn,Ma),se(Hn,Ox,new Map),se(Hn,Yp,new Map),se(Hn,$_,new WeakMap),se(Hn,hh,null),se(Hn,Ix,new Set);let U1=Hn;class z1{static textContent(e){const r=[],n={items:r,styles:Object.create(null)};function s(i){var c;if(!i)return;let o=null;const l=i.name;if(l==="#text")o=i.value;else if(z1.shouldBuildText(l))(c=i==null?void 0:i.attributes)!=null&&c.textContent?o=i.attributes.textContent:i.value&&(o=i.value);else return;if(o!==null&&r.push({str:o}),!!i.children)for(const u of i.children)s(u)}return s(e),n}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const kct=100;function Dhe(t={}){typeof t=="string"||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new V5,{docId:r}=e,n=t.url?Flt(t.url):null,s=t.data?$lt(t.data):null,i=t.httpHeaders||null,o=t.withCredentials===!0,l=t.password??null,c=t.range instanceof Lhe?t.range:null,u=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:2**16;let d=t.worker instanceof H1?t.worker:null;const h=t.verbosity,f=typeof t.docBaseUrl=="string"&&!V2(t.docBaseUrl)?t.docBaseUrl:null,p=UN(t.cMapUrl),g=t.cMapPacked!==!1,m=t.CMapReaderFactory||(pi?Glt:nK),x=UN(t.iccUrl),y=UN(t.standardFontDataUrl),v=t.StandardFontDataFactory||(pi?Klt:sK),b=UN(t.wasmUrl),w=t.WasmFactory||(pi?Ylt:iK),j=t.stopAtErrors!==!0,N=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,C=t.isEvalSupported!==!1,k=typeof t.isOffscreenCanvasSupported=="boolean"?t.isOffscreenCanvasSupported:!pi,E=typeof t.isImageDecoderSupported=="boolean"?t.isImageDecoderSupported:!pi&&(Is.platform.isFirefox||!globalThis.chrome),M=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,z=typeof t.disableFontFace=="boolean"?t.disableFontFace:pi,P=t.fontExtraProperties===!0,V=t.enableXfa===!0,A=t.ownerDocument||globalThis.document,$=t.disableRange===!0,K=t.disableStream===!0,G=t.disableAutoFetch===!0,Y=t.pdfBug===!0,H=t.CanvasFactory||(pi?qlt:Hlt),B=t.FilterFactory||(pi?Vlt:Wlt),L=t.enableHWA===!0,F=t.useWasm!==!1,W=c?c.length:t.length??NaN,X=typeof t.useSystemFonts=="boolean"?t.useSystemFonts:!pi&&!z,oe=typeof t.useWorkerFetch=="boolean"?t.useWorkerFetch:!!(m===nK&&v===sK&&w===iK&&p&&y&&b&&I0(p,document.baseURI)&&I0(y,document.baseURI)&&I0(b,document.baseURI)),le=null;glt(h);const U={canvasFactory:new H({ownerDocument:A,enableHWA:L}),filterFactory:new B({docId:r,ownerDocument:A}),cMapReaderFactory:oe?null:new m({baseUrl:p,isCompressed:g}),standardFontDataFactory:oe?null:new v({baseUrl:y}),wasmFactory:oe?null:new w({baseUrl:b})};d||(d=H1.create({verbosity:h,port:ic.workerPort}),e._worker=d);const R={docId:r,apiVersion:"5.4.54",data:s,password:l,disableAutoFetch:G,rangeChunkSize:u,length:W,docBaseUrl:f,enableXfa:V,evaluatorOptions:{maxImageSize:N,disableFontFace:z,ignoreErrors:j,isEvalSupported:C,isOffscreenCanvasSupported:k,isImageDecoderSupported:E,canvasMaxAreaInBytes:M,fontExtraProperties:P,useSystemFonts:X,useWasm:F,useWorkerFetch:oe,cMapUrl:p,iccUrl:x,standardFontDataUrl:y,wasmUrl:b}},ee={ownerDocument:A,pdfBug:Y,styleElement:le,loadingParams:{disableAutoFetch:G,enableXfa:V}};return d.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const te=d.messageHandler.sendWithPromise("GetDocRequest",R,s?[s.buffer]:null);let Z;if(c)Z=new dct(c,{disableRange:$,disableStream:K});else if(!s){if(!n)throw new Error("getDocument - no `url` parameter provided.");const J=I0(n)?mct:pi?Nct:bct;Z=new J({url:n,length:W,httpHeaders:i,withCredentials:o,rangeChunkSize:u,disableRange:$,disableStream:K})}return te.then(J=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const he=new F0(r,J,d.port),O=new Oct(he,e,Z,ee,U,L);e._transport=O,he.send("Ready",null)})}).catch(e._capability.reject),e}var Tk;const Pk=class Pk{constructor(){Le(this,"_capability",Promise.withResolvers());Le(this,"_transport",null);Le(this,"_worker",null);Le(this,"docId",`d${ns(Pk,Tk)._++}`);Le(this,"destroyed",!1);Le(this,"onPassword",null);Le(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var e,r,n,s;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((r=this._transport)==null?void 0:r.destroy())}catch(i){throw(n=this._worker)!=null&&n.port&&delete this._worker._pendingDestroy,i}this._transport=null,(s=this._worker)==null||s.destroy(),this._worker=null}async getData(){return this._transport.getData()}};Tk=new WeakMap,se(Pk,Tk,0);let V5=Pk;var Xp,B_,U_,z_,H_;class Lhe{constructor(e,r,n=!1,s=null){se(this,Xp,Promise.withResolvers());se(this,B_,[]);se(this,U_,[]);se(this,z_,[]);se(this,H_,[]);this.length=e,this.initialData=r,this.progressiveDone=n,this.contentDispositionFilename=s}addRangeListener(e){_(this,H_).push(e)}addProgressListener(e){_(this,z_).push(e)}addProgressiveReadListener(e){_(this,U_).push(e)}addProgressiveDoneListener(e){_(this,B_).push(e)}onDataRange(e,r){for(const n of _(this,H_))n(e,r)}onDataProgress(e,r){_(this,Xp).promise.then(()=>{for(const n of _(this,z_))n(e,r)})}onDataProgressiveRead(e){_(this,Xp).promise.then(()=>{for(const r of _(this,U_))r(e)})}onDataProgressiveDone(){_(this,Xp).promise.then(()=>{for(const e of _(this,B_))e()})}transportReady(){_(this,Xp).resolve()}requestDataRange(e,r){_r("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}Xp=new WeakMap,B_=new WeakMap,U_=new WeakMap,z_=new WeakMap,H_=new WeakMap;class Tct{constructor(e,r){this._pdfInfo=e,this._transport=r}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Ut(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(r)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var pu,Qp,H0;class Pct{constructor(e,r,n,s=!1){se(this,Qp);se(this,pu,!1);this._pageIndex=e,this._pageInfo=r,this._transport=n,this._stats=s?new eK:null,this._pdfBug=s,this.commonObjs=n.commonObjs,this.objs=new Phe,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:r=this.rotate,offsetX:n=0,offsetY:s=0,dontFlip:i=!1}={}){return new fS({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:r,offsetX:n,offsetY:s,dontFlip:i})}getAnnotations({intent:e="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,r)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Ut(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,canvas:r=e.canvas,viewport:n,intent:s="display",annotationMode:i=Md.ENABLE,transform:o=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:u=null,pageColors:d=null,printAnnotationStorage:h=null,isEditing:f=!1}){var j,N;(j=this._stats)==null||j.time("Overall");const p=this._transport.getRenderingIntent(s,i,h,f),{renderingIntent:g,cacheKey:m}=p;Q(this,pu,!1),c||(c=this._transport.getOptionalContentConfig(g));let x=this._intentStates.get(m);x||(x=Object.create(null),this._intentStates.set(m,x)),x.streamReaderCancelTimeout&&(clearTimeout(x.streamReaderCancelTimeout),x.streamReaderCancelTimeout=null);const y=!!(g&_a.PRINT);x.displayReadyCapability||(x.displayReadyCapability=Promise.withResolvers(),x.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(N=this._stats)==null||N.time("Page Request"),this._pumpOperatorList(p));const v=C=>{var k;x.renderTasks.delete(b),y&&Q(this,pu,!0),ce(this,Qp,H0).call(this),C?(b.capability.reject(C),this._abortOperatorList({intentState:x,reason:C instanceof Error?C:new Error(C)})):b.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(k=globalThis.Stats)!=null&&k.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},b=new q5({callback:v,params:{canvas:r,canvasContext:e,viewport:n,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:x.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,pageColors:d,enableHWA:this._transport.enableHWA});(x.renderTasks||(x.renderTasks=new Set)).add(b);const w=b.task;return Promise.all([x.displayReadyCapability.promise,c]).then(([C,k])=>{var E;if(this.destroyed){v();return}if((E=this._stats)==null||E.time("Rendering"),!(k.renderingIntent&g))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");b.initializeGraphics({transparency:C,optionalContentConfig:k}),b.operatorListChanged()}).catch(v),w}getOperatorList({intent:e="display",annotationMode:r=Md.ENABLE,printAnnotationStorage:n=null,isEditing:s=!1}={}){var u;function i(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c))}const o=this._transport.getRenderingIntent(e,r,n,s,!0);let l=this._intentStates.get(o.cacheKey);l||(l=Object.create(null),this._intentStates.set(o.cacheKey,l));let c;return l.opListReadCapability||(c=Object.create(null),c.operatorListChanged=i,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||(l.renderTasks=new Set)).add(c),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(u=this._stats)==null||u.time("Page Request"),this._pumpOperatorList(o)),l.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:r=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:r===!0},{highWaterMark:100,size(s){return s.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>z1.textContent(n));const r=this.streamTextContent(e);return new Promise(function(n,s){function i(){o.read().then(function({value:c,done:u}){if(u){n(l);return}l.lang??(l.lang=c.lang),Object.assign(l.styles,c.styles),l.items.push(...c.items),i()},s)}const o=r.getReader(),l={items:[],styles:Object.create(null),lang:null};i()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const r of this._intentStates.values())if(this._abortOperatorList({intentState:r,reason:new Error("Page was destroyed."),force:!0}),!r.opListReadCapability)for(const n of r.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),Q(this,pu,!1),Promise.all(e)}cleanup(e=!1){Q(this,pu,!0);const r=ce(this,Qp,H0).call(this);return e&&r&&this._stats&&(this._stats=new eK),r}_startRenderPage(e,r){var s,i;const n=this._intentStates.get(r);n&&((s=this._stats)==null||s.timeEnd("Page Request"),(i=n.displayReadyCapability)==null||i.resolve(e))}_renderPageChunk(e,r){for(let n=0,s=e.length;n<s;n++)r.operatorList.fnArray.push(e.fnArray[n]),r.operatorList.argsArray.push(e.argsArray[n]);r.operatorList.lastChunk=e.lastChunk,r.operatorList.separateAnnots=e.separateAnnots;for(const n of r.renderTasks)n.operatorListChanged();e.lastChunk&&ce(this,Qp,H0).call(this)}_pumpOperatorList({renderingIntent:e,cacheKey:r,annotationStorageSerializable:n,modifiedIds:s}){const{map:i,transfer:o}=n,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:r,annotationStorage:i,modifiedIds:s},o).getReader(),u=this._intentStates.get(r);u.streamReader=c;const d=()=>{c.read().then(({value:h,done:f})=>{if(f){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,u),d())},h=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(const f of u.renderTasks)f.operatorListChanged();ce(this,Qp,H0).call(this)}if(u.displayReadyCapability)u.displayReadyCapability.reject(h);else if(u.opListReadCapability)u.opListReadCapability.reject(h);else throw h}})};d()}_abortOperatorList({intentState:e,reason:r,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(r instanceof X8){let s=kct;r.extraDelay>0&&r.extraDelay<1e3&&(s+=r.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:r,force:!0})},s);return}}if(e.streamReader.cancel(new nf(r.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[s,i]of this._intentStates)if(i===e){this._intentStates.delete(s);break}this.cleanup()}}}get stats(){return this._stats}}pu=new WeakMap,Qp=new WeakSet,H0=function(){if(!_(this,pu)||this.destroyed)return!1;for(const{renderTasks:e,operatorList:r}of this._intentStates.values())if(e.size>0||!r.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),Q(this,pu,!1),!0};var fh,Wo,mu,Zp,Ok,Jp,em,bi,WA,Fhe,$he,W0,Rx,VA;const Gr=class Gr{constructor({name:e=null,port:r=null,verbosity:n=ylt()}={}){se(this,bi);se(this,fh,Promise.withResolvers());se(this,Wo,null);se(this,mu,null);se(this,Zp,null);if(this.name=e,this.destroyed=!1,this.verbosity=n,r){if(_(Gr,em).has(r))throw new Error("Cannot use more than one PDFWorker per port.");_(Gr,em).set(r,this),ce(this,bi,Fhe).call(this,r)}else ce(this,bi,$he).call(this)}get promise(){return _(this,fh).promise}get port(){return _(this,mu)}get messageHandler(){return _(this,Wo)}destroy(){var e,r;this.destroyed=!0,(e=_(this,Zp))==null||e.terminate(),Q(this,Zp,null),_(Gr,em).delete(_(this,mu)),Q(this,mu,null),(r=_(this,Wo))==null||r.destroy(),Q(this,Wo,null)}static create(e){const r=_(this,em).get(e==null?void 0:e.port);if(r){if(r._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return r}return new Gr(e)}static get workerSrc(){if(ic.workerSrc)return ic.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Ut(this,"_setupFakeWorkerGlobal",(async()=>_(this,Rx,VA)?_(this,Rx,VA):(await import(this.workerSrc)).WorkerMessageHandler)())}};fh=new WeakMap,Wo=new WeakMap,mu=new WeakMap,Zp=new WeakMap,Ok=new WeakMap,Jp=new WeakMap,em=new WeakMap,bi=new WeakSet,WA=function(){_(this,fh).resolve(),_(this,Wo).send("configure",{verbosity:this.verbosity})},Fhe=function(e){Q(this,mu,e),Q(this,Wo,new F0("main","worker",e)),_(this,Wo).on("ready",()=>{}),ce(this,bi,WA).call(this)},$he=function(){if(_(Gr,Jp)||_(Gr,Rx,VA)){ce(this,bi,W0).call(this);return}let{workerSrc:e}=Gr;try{Gr._isSameOrigin(window.location,e)||(e=Gr._createCDNWrapper(new URL(e,window.location).href));const r=new Worker(e,{type:"module"}),n=new F0("main","worker",r),s=()=>{i.abort(),n.destroy(),r.terminate(),this.destroyed?_(this,fh).reject(new Error("Worker was destroyed")):ce(this,bi,W0).call(this)},i=new AbortController;r.addEventListener("error",()=>{_(this,Zp)||s()},{signal:i.signal}),n.on("test",l=>{if(i.abort(),this.destroyed||!l){s();return}Q(this,Wo,n),Q(this,mu,r),Q(this,Zp,r),ce(this,bi,WA).call(this)}),n.on("ready",l=>{if(i.abort(),this.destroyed){s();return}try{o()}catch{ce(this,bi,W0).call(this)}});const o=()=>{const l=new Uint8Array;n.send("test",l,[l.buffer])};o();return}catch{W2("The worker has been disabled.")}ce(this,bi,W0).call(this)},W0=function(){_(Gr,Jp)||(Tt("Setting up fake worker."),Q(Gr,Jp,!0)),Gr._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){_(this,fh).reject(new Error("Worker was destroyed"));return}const r=new zlt;Q(this,mu,r);const n=`fake${ns(Gr,Ok)._++}`,s=new F0(n+"_worker",n,r);e.setup(s,r),Q(this,Wo,new F0(n,n+"_worker",r)),ce(this,bi,WA).call(this)}).catch(e=>{_(this,fh).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},Rx=new WeakSet,VA=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},se(Gr,Rx),se(Gr,Ok,0),se(Gr,Jp,!1),se(Gr,em,new WeakMap),pi&&(Q(Gr,Jp,!0),ic.workerSrc||(ic.workerSrc="./pdf.worker.mjs")),Gr._isSameOrigin=(e,r)=>{const n=URL.parse(e);if(!(n!=null&&n.origin)||n.origin==="null")return!1;const s=new URL(r,n);return n.origin===s.origin},Gr._createCDNWrapper=e=>{const r=`await import("${e}");`;return URL.createObjectURL(new Blob([r],{type:"text/javascript"}))},Gr.fromPort=e=>{if(klt("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return Gr.create(e)};let H1=Gr;var gu,ql,Mx,Dx,yu,tm,V0;class Oct{constructor(e,r,n,s,i,o){se(this,tm);se(this,gu,new Map);se(this,ql,new Map);se(this,Mx,new Map);se(this,Dx,new Map);se(this,yu,null);this.messageHandler=e,this.loadingTask=r,this.commonObjs=new Phe,this.fontLoader=new Dlt({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.cMapReaderFactory=i.cMapReaderFactory,this.standardFontDataFactory=i.standardFontDataFactory,this.wasmFactory=i.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=o,this.setupMessageHandler()}get annotationStorage(){return Ut(this,"annotationStorage",new Z8)}getRenderingIntent(e,r=Md.ENABLE,n=null,s=!1,i=!1){let o=_a.DISPLAY,l=O5;switch(e){case"any":o=_a.ANY;break;case"display":break;case"print":o=_a.PRINT;break;default:Tt(`getRenderingIntent - invalid intent: ${e}`)}const c=o&_a.PRINT&&n instanceof mhe?n:this.annotationStorage;switch(r){case Md.DISABLE:o+=_a.ANNOTATIONS_DISABLE;break;case Md.ENABLE:break;case Md.ENABLE_FORMS:o+=_a.ANNOTATIONS_FORMS;break;case Md.ENABLE_STORAGE:o+=_a.ANNOTATIONS_STORAGE,l=c.serializable;break;default:Tt(`getRenderingIntent - invalid annotationMode: ${r}`)}s&&(o+=_a.IS_EDITING),i&&(o+=_a.OPLIST);const{ids:u,hash:d}=c.modifiedIds,h=[o,l.hash,d];return{renderingIntent:o,cacheKey:h.join("_"),annotationStorageSerializable:l,modifiedIds:u}}destroy(){var n;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(n=_(this,yu))==null||n.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const s of _(this,ql).values())e.push(s._destroy());_(this,ql).clear(),_(this,Mx).clear(),_(this,Dx).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const r=this.messageHandler.sendWithPromise("Terminate",null);return e.push(r),Promise.all(e).then(()=>{var s,i;this.commonObjs.clear(),this.fontLoader.clear(),_(this,gu).clear(),this.filterFactory.destroy(),U1.cleanup(),(s=this._networkStream)==null||s.cancelAllRequests(new nf("Worker was terminated.")),(i=this.messageHandler)==null||i.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:r}=this;e.on("GetReader",(n,s)=>{Ln(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=i=>{this._lastProgress={loaded:i.loaded,total:i.total}},s.onPull=()=>{this._fullReader.read().then(function({value:i,done:o}){if(o){s.close();return}Ln(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(i),1,[i])}).catch(i=>{s.error(i)})},s.onCancel=i=>{this._fullReader.cancel(i),s.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("ReaderHeadersReady",async n=>{var l;await this._fullReader.headersReady;const{isStreamingSupported:s,isRangeSupported:i,contentLength:o}=this._fullReader;return(!s||!i)&&(this._lastProgress&&((l=r.onProgress)==null||l.call(r,this._lastProgress)),this._fullReader.onProgress=c=>{var u;(u=r.onProgress)==null||u.call(r,{loaded:c.loaded,total:c.total})}),{isStreamingSupported:s,isRangeSupported:i,contentLength:o}}),e.on("GetRangeReader",(n,s)=>{Ln(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(n.begin,n.end);if(!i){s.close();return}s.onPull=()=>{i.read().then(function({value:o,done:l}){if(l){s.close();return}Ln(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{s.error(o)})},s.onCancel=o=>{i.cancel(o),s.ready.catch(l=>{if(!this.destroyed)throw l})}}),e.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,r._capability.resolve(new Tct(n,this))}),e.on("DocException",n=>{r._capability.reject(Ti(n))}),e.on("PasswordRequest",n=>{Q(this,yu,Promise.withResolvers());try{if(!r.onPassword)throw Ti(n);const s=i=>{i instanceof Error?_(this,yu).reject(i):_(this,yu).resolve({password:i})};r.onPassword(s,n.code)}catch(s){_(this,yu).reject(s)}return _(this,yu).promise}),e.on("DataLoaded",n=>{var s;(s=r.onProgress)==null||s.call(r,{loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),e.on("StartRenderPage",n=>{if(this.destroyed)return;_(this,ql).get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),e.on("commonobj",([n,s,i])=>{var o;if(this.destroyed||this.commonObjs.has(n))return null;switch(s){case"Font":if("error"in i){const d=i.error;Tt(`Error during font loading: ${d}`),this.commonObjs.resolve(n,d);break}const l=this._params.pdfBug&&((o=globalThis.FontInspector)!=null&&o.enabled)?(d,h)=>globalThis.FontInspector.fontAdded(d,h):null,c=new Llt(i,l);this.fontLoader.bind(c).catch(()=>e.sendWithPromise("FontFallback",{id:n})).finally(()=>{!c.fontExtraProperties&&c.data&&(c.data=null),this.commonObjs.resolve(n,c)});break;case"CopyLocalImage":const{imageRef:u}=i;Ln(u,"The imageRef must be defined.");for(const d of _(this,ql).values())for(const[,h]of d.objs)if((h==null?void 0:h.ref)===u)return h.dataLen?(this.commonObjs.resolve(n,structuredClone(h)),h.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,i);break;default:throw new Error(`Got unknown common object type ${s}`)}return null}),e.on("obj",([n,s,i,o])=>{var c;if(this.destroyed)return;const l=_(this,ql).get(s);if(!l.objs.has(n)){if(l._intentStates.size===0){(c=o==null?void 0:o.bitmap)==null||c.close();return}switch(i){case"Image":case"Pattern":l.objs.resolve(n,o);break;default:throw new Error(`Got unknown object type ${i}`)}}}),e.on("DocProgress",n=>{var s;this.destroyed||(s=r.onProgress)==null||s.call(r,{loaded:n.loaded,total:n.total})}),e.on("FetchBinaryData",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");const s=this[n.type];if(!s)throw new Error(`${n.type} not initialized, see the \`useWorkerFetch\` parameter.`);return s.fetch(n)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var n;this.annotationStorage.size<=0&&Tt("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:r}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((n=this._fullReader)==null?void 0:n.filename)??null},r).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const r=e-1,n=_(this,Mx).get(r);if(n)return n;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:r}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&_(this,Dx).set(i.refStr,e);const o=new Pct(r,i,this,this._params.pdfBug);return _(this,ql).set(r,o),o});return _(this,Mx).set(r,s),s}getPageIndex(e){return I5(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,r){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:r})}getFieldObjects(){return ce(this,tm,V0).call(this,"GetFieldObjects")}hasJSActions(){return ce(this,tm,V0).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return ce(this,tm,V0).call(this,"GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return ce(this,tm,V0).call(this,"GetOptionalContentConfig").then(r=>new uct(r,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",r=_(this,gu).get(e);if(r)return r;const n=this.messageHandler.sendWithPromise(e,null).then(s=>{var i,o;return{info:s[0],metadata:s[1]?new lct(s[1]):null,contentDispositionFilename:((i=this._fullReader)==null?void 0:i.filename)??null,contentLength:((o=this._fullReader)==null?void 0:o.contentLength)??null}});return _(this,gu).set(e,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const r of _(this,ql).values())if(!r.cleanup())throw new Error(`startCleanup: Page ${r.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),_(this,gu).clear(),this.filterFactory.destroy(!0),U1.cleanup()}}cachedPageNumber(e){if(!I5(e))return null;const r=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return _(this,Dx).get(r)??null}}gu=new WeakMap,ql=new WeakMap,Mx=new WeakMap,Dx=new WeakMap,yu=new WeakMap,tm=new WeakSet,V0=function(e,r=null){const n=_(this,gu).get(e);if(n)return n;const s=this.messageHandler.sendWithPromise(e,r);return _(this,gu).set(e,s),s};var ph;class Ict{constructor(e){se(this,ph,null);Le(this,"onContinue",null);Le(this,"onError",null);Q(this,ph,e)}get promise(){return _(this,ph).capability.promise}cancel(e=0){_(this,ph).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=_(this,ph).operatorList;if(!e)return!1;const{annotationCanvasMap:r}=_(this,ph);return e.form||e.canvas&&(r==null?void 0:r.size)>0}}ph=new WeakMap;var mh,rm;const tp=class tp{constructor({callback:e,params:r,objs:n,commonObjs:s,annotationCanvasMap:i,operatorList:o,pageIndex:l,canvasFactory:c,filterFactory:u,useRequestAnimationFrame:d=!1,pdfBug:h=!1,pageColors:f=null,enableHWA:p=!1}){se(this,mh,null);this.callback=e,this.params=r,this.objs=n,this.commonObjs=s,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=u,this._pdfBug=h,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Ict(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=r.canvas,this._canvasContext=r.canvas?null:r.canvasContext,this._enableHWA=p}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:r}){var l,c;if(this.cancelled)return;if(this._canvas){if(_(tp,rm).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");_(tp,rm).add(this._canvas)}this._pdfBug&&((l=globalThis.StepperManager)!=null&&l.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:n,transform:s,background:i}=this.params,o=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new zy(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:r},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:n,transparency:e,background:i}),this.operatorListIdx=0,this.graphicsReady=!0,(c=this.graphicsReadyCallback)==null||c.call(this)}cancel(e=null,r=0){var n,s,i;this.running=!1,this.cancelled=!0,(n=this.gfx)==null||n.endDrawing(),_(this,mh)&&(window.cancelAnimationFrame(_(this,mh)),Q(this,mh,null)),_(tp,rm).delete(this._canvas),e||(e=new X8(`Rendering cancelled, page ${this._pageIndex+1}`,r)),this.callback(e),(i=(s=this.task).onError)==null||i.call(s,e)}operatorListChanged(){var e;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.stepper)==null||e.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?Q(this,mh,window.requestAnimationFrame(()=>{Q(this,mh,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),_(tp,rm).delete(this._canvas),this.callback())))}};mh=new WeakMap,rm=new WeakMap,se(tp,rm,new WeakSet);let q5=tp;const Bhe="5.4.54",Rct="295fb3ec4";var da,nm,Lx,qn,W_,Fx,xu,V_,gh,Vo,q_,wr,G5,K5,Y5,Kf,Uhe,Ad;const Pi=class Pi{constructor({editor:e=null,uiManager:r=null}){se(this,wr);se(this,da,null);se(this,nm,null);se(this,Lx);se(this,qn,null);se(this,W_,!1);se(this,Fx,!1);se(this,xu,null);se(this,V_);se(this,gh,null);se(this,Vo,null);var n,s;e?(Q(this,Fx,!1),Q(this,xu,e)):Q(this,Fx,!0),Q(this,Vo,(e==null?void 0:e._uiManager)||r),Q(this,V_,_(this,Vo)._eventBus),Q(this,Lx,((n=e==null?void 0:e.color)==null?void 0:n.toUpperCase())||((s=_(this,Vo))==null?void 0:s.highlightColors.values().next().value)||"#FFFF98"),_(Pi,q_)||Q(Pi,q_,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Ut(this,"_keyboardManager",new pS([[["Escape","mac+Escape"],Pi.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Pi.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Pi.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Pi.prototype._moveToPrevious],[["Home","mac+Home"],Pi.prototype._moveToBeginning],[["End","mac+End"],Pi.prototype._moveToEnd]]))}renderButton(){const e=Q(this,da,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",_(this,xu)&&(e.ariaControls=`${_(this,xu).id}_colorpicker_dropdown`);const r=_(this,Vo)._signal;e.addEventListener("click",ce(this,wr,Kf).bind(this),{signal:r}),e.addEventListener("keydown",ce(this,wr,Y5).bind(this),{signal:r});const n=Q(this,nm,document.createElement("span"));return n.className="swatch",n.ariaHidden="true",n.style.backgroundColor=_(this,Lx),e.append(n),e}renderMainDropdown(){const e=Q(this,qn,ce(this,wr,G5).call(this));return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}_colorSelectFromKeyboard(e){if(e.target===_(this,da)){ce(this,wr,Kf).call(this,e);return}const r=e.target.getAttribute("data-color");r&&ce(this,wr,K5).call(this,r,e)}_moveToNext(e){var r,n;if(!_(this,wr,Ad)){ce(this,wr,Kf).call(this,e);return}if(e.target===_(this,da)){(r=_(this,qn).firstChild)==null||r.focus();return}(n=e.target.nextSibling)==null||n.focus()}_moveToPrevious(e){var r,n;if(e.target===((r=_(this,qn))==null?void 0:r.firstChild)||e.target===_(this,da)){_(this,wr,Ad)&&this._hideDropdownFromKeyboard();return}_(this,wr,Ad)||ce(this,wr,Kf).call(this,e),(n=e.target.previousSibling)==null||n.focus()}_moveToBeginning(e){var r;if(!_(this,wr,Ad)){ce(this,wr,Kf).call(this,e);return}(r=_(this,qn).firstChild)==null||r.focus()}_moveToEnd(e){var r;if(!_(this,wr,Ad)){ce(this,wr,Kf).call(this,e);return}(r=_(this,qn).lastChild)==null||r.focus()}hideDropdown(){var e,r;(e=_(this,qn))==null||e.classList.add("hidden"),_(this,da).ariaExpanded="false",(r=_(this,gh))==null||r.abort(),Q(this,gh,null)}_hideDropdownFromKeyboard(){var e;if(!_(this,Fx)){if(!_(this,wr,Ad)){(e=_(this,xu))==null||e.unselect();return}this.hideDropdown(),_(this,da).focus({preventScroll:!0,focusVisible:_(this,W_)})}}updateColor(e){if(_(this,nm)&&(_(this,nm).style.backgroundColor=e),!_(this,qn))return;const r=_(this,Vo).highlightColors.values();for(const n of _(this,qn).children)n.ariaSelected=r.next().value===e.toUpperCase()}destroy(){var e,r;(e=_(this,da))==null||e.remove(),Q(this,da,null),Q(this,nm,null),(r=_(this,qn))==null||r.remove(),Q(this,qn,null)}};da=new WeakMap,nm=new WeakMap,Lx=new WeakMap,qn=new WeakMap,W_=new WeakMap,Fx=new WeakMap,xu=new WeakMap,V_=new WeakMap,gh=new WeakMap,Vo=new WeakMap,q_=new WeakMap,wr=new WeakSet,G5=function(){const e=document.createElement("div"),r=_(this,Vo)._signal;e.addEventListener("contextmenu",So,{signal:r}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),_(this,xu)&&(e.id=`${_(this,xu).id}_colorpicker_dropdown`);for(const[n,s]of _(this,Vo).highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",s),i.title=n,i.setAttribute("data-l10n-id",_(Pi,q_)[n]);const o=document.createElement("span");i.append(o),o.className="swatch",o.style.backgroundColor=s,i.ariaSelected=s===_(this,Lx),i.addEventListener("click",ce(this,wr,K5).bind(this,s),{signal:r}),e.append(i)}return e.addEventListener("keydown",ce(this,wr,Y5).bind(this),{signal:r}),e},K5=function(e,r){r.stopPropagation(),_(this,V_).dispatch("switchannotationeditorparams",{source:this,type:Kt.HIGHLIGHT_COLOR,value:e}),this.updateColor(e)},Y5=function(e){Pi._keyboardManager.exec(this,e)},Kf=function(e){if(_(this,wr,Ad)){this.hideDropdown();return}if(Q(this,W_,e.detail===0),_(this,gh)||(Q(this,gh,new AbortController),window.addEventListener("pointerdown",ce(this,wr,Uhe).bind(this),{signal:_(this,Vo).combinedSignal(_(this,gh))})),_(this,da).ariaExpanded="true",_(this,qn)){_(this,qn).classList.remove("hidden");return}const r=Q(this,qn,ce(this,wr,G5).call(this));_(this,da).append(r)},Uhe=function(e){var r;(r=_(this,qn))!=null&&r.contains(e.target)||this.hideDropdown()},Ad=function(){return _(this,qn)&&!_(this,qn).classList.contains("hidden")},se(Pi,q_,null);let hk=Pi;var Gl,G_,$x,K_;const rp=class rp{constructor(e){se(this,Gl,null);se(this,G_,null);se(this,$x,null);Q(this,G_,e),Q(this,$x,e._uiManager),_(rp,K_)||Q(rp,K_,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(_(this,Gl))return _(this,Gl);const{editorType:e,colorType:r,colorValue:n}=_(this,G_),s=Q(this,Gl,document.createElement("input"));return s.type="color",s.value=n||"#000000",s.className="basicColorPicker",s.tabIndex=0,s.setAttribute("data-l10n-id",_(rp,K_)[e]),s.addEventListener("input",()=>{_(this,$x).updateParams(r,s.value)},{signal:_(this,$x)._signal}),s}update(e){_(this,Gl)&&(_(this,Gl).value=e)}destroy(){var e;(e=_(this,Gl))==null||e.remove(),Q(this,Gl,null)}hideDropdown(){}};Gl=new WeakMap,G_=new WeakMap,$x=new WeakMap,K_=new WeakMap,se(rp,K_,null);let fk=rp;function gK(t){return Math.floor(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,"0")}function h0(t){return Math.max(0,Math.min(255,255*t))}class yK{static CMYK_G([e,r,n,s]){return["G",1-Math.min(1,.3*e+.59*n+.11*r+s)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=h0(e),[e,e,e]}static G_HTML([e]){const r=gK(e);return`#${r}${r}${r}`}static RGB_G([e,r,n]){return["G",.3*e+.59*r+.11*n]}static RGB_rgb(e){return e.map(h0)}static RGB_HTML(e){return`#${e.map(gK).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,r,n,s]){return["RGB",1-Math.min(1,e+s),1-Math.min(1,n+s),1-Math.min(1,r+s)]}static CMYK_rgb([e,r,n,s]){return[h0(1-Math.min(1,e+s)),h0(1-Math.min(1,n+s)),h0(1-Math.min(1,r+s))]}static CMYK_HTML(e){const r=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(r)}static RGB_CMYK([e,r,n]){const s=1-e,i=1-r,o=1-n,l=Math.min(s,i,o);return["CMYK",s,i,o,l]}}class Mct{create(e,r,n=!1){if(e<=0||r<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),n||(s.setAttribute("width",`${e}px`),s.setAttribute("height",`${r}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${e} ${r}`),s}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){_r("Abstract method `_createSVG` called.")}}class pk extends Mct{_createSVG(e){return document.createElementNS(Bc,e)}}class zhe{static setupStorage(e,r,n,s,i){const o=s.getValue(r,{value:null});switch(n.name){case"textarea":if(o.value!==null&&(e.textContent=o.value),i==="print")break;e.addEventListener("input",l=>{s.setValue(r,{value:l.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(o.value===n.attributes.xfaOn?e.setAttribute("checked",!0):o.value===n.attributes.xfaOff&&e.removeAttribute("checked"),i==="print")break;e.addEventListener("change",l=>{s.setValue(r,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(o.value!==null&&e.setAttribute("value",o.value),i==="print")break;e.addEventListener("input",l=>{s.setValue(r,{value:l.target.value})})}break;case"select":if(o.value!==null){e.setAttribute("value",o.value);for(const l of n.children)l.attributes.value===o.value?l.attributes.selected=!0:l.attributes.hasOwnProperty("selected")&&delete l.attributes.selected}e.addEventListener("input",l=>{const c=l.target.options,u=c.selectedIndex===-1?"":c[c.selectedIndex].value;s.setValue(r,{value:u})});break}}static setAttributes({html:e,element:r,storage:n=null,intent:s,linkService:i}){const{attributes:o}=r,l=e instanceof HTMLAnchorElement;o.type==="radio"&&(o.name=`${o.name}-${s}`);for(const[c,u]of Object.entries(o))if(u!=null)switch(c){case"class":u.length&&e.setAttribute(c,u.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",u);break;case"style":Object.assign(e.style,u);break;case"textContent":e.textContent=u;break;default:(!l||c!=="href"&&c!=="newWindow")&&e.setAttribute(c,u)}l&&i.addLinkAttributes(e,o.href,o.newWindow),n&&o.dataId&&this.setupStorage(e,o.dataId,r,n)}static render(e){var h,f;const r=e.annotationStorage,n=e.linkService,s=e.xfaHtml,i=e.intent||"display",o=document.createElement(s.name);s.attributes&&this.setAttributes({html:o,element:s,intent:i,linkService:n});const l=i!=="richText",c=e.div;if(c.append(o),e.viewport){const p=`matrix(${e.viewport.transform.join(",")})`;c.style.transform=p}l&&c.setAttribute("class","xfaLayer xfaFont");const u=[];if(s.children.length===0){if(s.value){const p=document.createTextNode(s.value);o.append(p),l&&z1.shouldBuildText(s.name)&&u.push(p)}return{textDivs:u}}const d=[[s,-1,o]];for(;d.length>0;){const[p,g,m]=d.at(-1);if(g+1===p.children.length){d.pop();continue}const x=p.children[++d.at(-1)[1]];if(x===null)continue;const{name:y}=x;if(y==="#text"){const b=document.createTextNode(x.value);u.push(b),m.append(b);continue}const v=(h=x==null?void 0:x.attributes)!=null&&h.xmlns?document.createElementNS(x.attributes.xmlns,y):document.createElement(y);if(m.append(v),x.attributes&&this.setAttributes({html:v,element:x,storage:r,intent:i,linkService:n}),((f=x.children)==null?void 0:f.length)>0)d.push([x,-1,v]);else if(x.value){const b=document.createTextNode(x.value);l&&z1.shouldBuildText(y)&&u.push(b),v.append(b)}}for(const p of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))p.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const r=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=r,e.div.hidden=!1}}const Dct=9,tg=new WeakSet,Lct=new Date().getTimezoneOffset()*60*1e3;class xK{static create(e){switch(e.data.annotationType){case On.LINK:return new tB(e);case On.TEXT:return new Fct(e);case On.WIDGET:switch(e.data.fieldType){case"Tx":return new $ct(e);case"Btn":return e.data.radioButton?new Vhe(e):e.data.checkBox?new Uct(e):new zct(e);case"Ch":return new Hct(e);case"Sig":return new Bct(e)}return new xg(e);case On.POPUP:return new Q5(e);case On.FREETEXT:return new Xhe(e);case On.LINE:return new Vct(e);case On.SQUARE:return new qct(e);case On.CIRCLE:return new Gct(e);case On.POLYLINE:return new Qhe(e);case On.CARET:return new Yct(e);case On.INK:return new rB(e);case On.POLYGON:return new Kct(e);case On.HIGHLIGHT:return new Zhe(e);case On.UNDERLINE:return new Xct(e);case On.SQUIGGLY:return new Qct(e);case On.STRIKEOUT:return new Zct(e);case On.STAMP:return new Jhe(e);case On.FILEATTACHMENT:return new Jct(e);default:return new kn(e)}}}var sm,Bx,vu,Y_,X5;const DB=class DB{constructor(e,{isRenderable:r=!1,ignoreBorder:n=!1,createQuadrilaterals:s=!1}={}){se(this,Y_);se(this,sm,null);se(this,Bx,!1);se(this,vu,null);this.isRenderable=r,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,r&&(this.container=this._createContainer(n)),s&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:r}){return!!(e!=null&&e.str||r!=null&&r.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return DB._hasPopupData(this.data)}updateEdited(e){var i;if(!this.container)return;e.rect&&(_(this,sm)||Q(this,sm,{rect:this.data.rect.slice(0)}));const{rect:r,popup:n}=e;r&&ce(this,Y_,X5).call(this,r);let s=((i=_(this,vu))==null?void 0:i.popup)||this.popup;!s&&(n!=null&&n.text)&&(this._createPopup(n),s=_(this,vu).popup),s&&(s.updateEdited(e),n!=null&&n.deleted&&(s.remove(),Q(this,vu,null),this.popup=null))}resetEdited(){var e;_(this,sm)&&(ce(this,Y_,X5).call(this,_(this,sm).rect),(e=_(this,vu))==null||e.popup.resetEdited(),Q(this,sm,null))}_createContainer(e){const{data:r,parent:{page:n,viewport:s}}=this,i=document.createElement("section");i.setAttribute("data-annotation-id",r.id),!(this instanceof xg)&&!(this instanceof tB)&&(i.tabIndex=0);const{style:o}=i;if(o.zIndex=this.parent.zIndex++,r.alternativeText&&(i.title=r.alternativeText),r.noRotate&&i.classList.add("norotate"),!r.rect||this instanceof Q5){const{rotation:m}=r;return!r.hasOwnCanvas&&m!==0&&this.setRotation(m,i),i}const{width:l,height:c}=this;if(!e&&r.borderStyle.width>0){o.borderWidth=`${r.borderStyle.width}px`;const m=r.borderStyle.horizontalCornerRadius,x=r.borderStyle.verticalCornerRadius;if(m>0||x>0){const v=`calc(${m}px * var(--total-scale-factor)) / calc(${x}px * var(--total-scale-factor))`;o.borderRadius=v}else if(this instanceof Vhe){const v=`calc(${l}px * var(--total-scale-factor)) / calc(${c}px * var(--total-scale-factor))`;o.borderRadius=v}switch(r.borderStyle.style){case zg.SOLID:o.borderStyle="solid";break;case zg.DASHED:o.borderStyle="dashed";break;case zg.BEVELED:Tt("Unimplemented border style: beveled");break;case zg.INSET:Tt("Unimplemented border style: inset");break;case zg.UNDERLINE:o.borderBottomStyle="solid";break}const y=r.borderColor||null;y?(Q(this,Bx,!0),o.borderColor=pt.makeHexColor(y[0]|0,y[1]|0,y[2]|0)):o.borderWidth=0}const u=pt.normalizeRect([r.rect[0],n.view[3]-r.rect[1]+n.view[1],r.rect[2],n.view[3]-r.rect[3]+n.view[1]]),{pageWidth:d,pageHeight:h,pageX:f,pageY:p}=s.rawDims;o.left=`${100*(u[0]-f)/d}%`,o.top=`${100*(u[1]-p)/h}%`;const{rotation:g}=r;return r.hasOwnCanvas||g===0?(o.width=`${100*l/d}%`,o.height=`${100*c/h}%`):this.setRotation(g,i),i}setRotation(e,r=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:s}=this.parent.viewport.rawDims;let{width:i,height:o}=this;e%180!==0&&([i,o]=[o,i]),r.style.width=`${100*i/n}%`,r.style.height=`${100*o/s}%`,r.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(r,n,s)=>{const i=s.detail[r],o=i[0],l=i.slice(1);s.target.style[n]=yK[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[n]:yK[`${o}_rgb`](l)})};return Ut(this,"_commonActions",{display:r=>{const{display:n}=r.detail,s=n%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:n===1||n===2})},print:r=>{this.annotationStorage.setValue(this.data.id,{noPrint:!r.detail.print})},hidden:r=>{const{hidden:n}=r.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:r=>{setTimeout(()=>r.target.focus({preventScroll:!1}),0)},userName:r=>{r.target.title=r.detail.userName},readonly:r=>{r.target.disabled=r.detail.readonly},required:r=>{this._setRequired(r.target,r.detail.required)},bgColor:r=>{e("bgColor","backgroundColor",r)},fillColor:r=>{e("fillColor","backgroundColor",r)},fgColor:r=>{e("fgColor","color",r)},textColor:r=>{e("textColor","color",r)},borderColor:r=>{e("borderColor","borderColor",r)},strokeColor:r=>{e("strokeColor","borderColor",r)},rotation:r=>{const n=r.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(e,r){const n=this._commonActions;for(const s of Object.keys(r.detail)){const i=e[s]||n[s];i==null||i(r)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const r=this.annotationStorage.getRawValue(this.data.id);if(!r)return;const n=this._commonActions;for(const[s,i]of Object.entries(r)){const o=n[s];if(o){const l={detail:{[s]:i},target:e};o(l),delete r[s]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[r,n,s,i]=this.data.rect.map(m=>Math.fround(m));if(e.length===8){const[m,x,y,v]=e.subarray(2,6);if(s===m&&i===x&&r===y&&n===v)return}const{style:o}=this.container;let l;if(_(this,Bx)){const{borderColor:m,borderWidth:x}=o;o.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${m}" stroke-width="${x}">`],this.container.classList.add("hasBorder")}const c=s-r,u=i-n,{svgFactory:d}=this,h=d.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0),h.role="none";const f=d.createElement("defs");h.append(f);const p=d.createElement("clipPath"),g=`clippath_${this.data.id}`;p.setAttribute("id",g),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let m=2,x=e.length;m<x;m+=8){const y=e[m],v=e[m+1],b=e[m+2],w=e[m+3],j=d.createElement("rect"),N=(b-r)/c,C=(i-v)/u,k=(y-b)/c,E=(v-w)/u;j.setAttribute("x",N),j.setAttribute("y",C),j.setAttribute("width",k),j.setAttribute("height",E),p.append(j),l==null||l.push(`<rect vector-effect="non-scaling-stroke" x="${N}" y="${C}" width="${k}" height="${E}"/>`)}_(this,Bx)&&(l.push("</g></svg>')"),o.backgroundImage=l.join("")),this.container.append(h),this.container.style.clipPath=`url(#${g})`}_createPopup(e=null){const{data:r}=this;let n,s;e?(n={str:e.text},s=e.date):(n=r.contentsObj,s=r.modificationDate);const i=Q(this,vu,new Q5({data:{color:r.color,titleObj:r.titleObj,modificationDate:s,contentsObj:n,richText:r.richText,parentRect:r.rect,borderStyle:0,id:`popup_${r.id}`,rotation:r.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}));this.parent.div.append(i.render())}get hasPopupElement(){return!!(_(this,vu)||this.popup||this.data.popupRef)}render(){_r("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,r=null){const n=[];if(this._fieldObjects){const s=this._fieldObjects[e];if(s)for(const{page:i,id:o,exportValues:l}of s){if(i===-1||o===r)continue;const c=typeof l=="string"?l:null,u=document.querySelector(`[data-element-id="${o}"]`);if(u&&!tg.has(u)){Tt(`_getElementsByName - element not allowed: ${o}`);continue}n.push({id:o,exportValue:c,domElement:u})}return n}for(const s of document.getElementsByName(e)){const{exportValue:i}=s,o=s.getAttribute("data-element-id");o!==r&&tg.has(s)&&n.push({id:o,exportValue:i,domElement:s})}return n}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const r of e)r.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:r}}=this;this.container.addEventListener("dblclick",()=>{var n;(n=this.linkService.eventBus)==null||n.dispatch("switchannotationeditormode",{source:this,mode:e,editId:r,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};sm=new WeakMap,Bx=new WeakMap,vu=new WeakMap,Y_=new WeakSet,X5=function(e){const{container:{style:r},data:{rect:n,rotation:s},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:o,pageX:l,pageY:c}}}}=this;n==null||n.splice(0,4,...e),r.left=`${100*(e[0]-l)/i}%`,r.top=`${100*(o-e[3]+c)/o}%`,s===0?(r.width=`${100*(e[2]-e[0])/i}%`,r.height=`${100*(e[3]-e[1])/o}%`):this.setRotation(s)};let kn=DB;var Aa,Yf,Hhe,Whe;class tB extends kn{constructor(r,n=null){super(r,{isRenderable:!0,ignoreBorder:!!(n!=null&&n.ignoreBorder),createQuadrilaterals:!0});se(this,Aa);this.isTooltipOnly=r.data.isTooltipOnly}render(){const{data:r,linkService:n}=this,s=document.createElement("a");s.setAttribute("data-element-id",r.id);let i=!1;return r.url?(n.addLinkAttributes(s,r.url,r.newWindow),i=!0):r.action?(this._bindNamedAction(s,r.action,r.overlaidText),i=!0):r.attachment?(ce(this,Aa,Hhe).call(this,s,r.attachment,r.overlaidText,r.attachmentDest),i=!0):r.setOCGState?(ce(this,Aa,Whe).call(this,s,r.setOCGState,r.overlaidText),i=!0):r.dest?(this._bindLink(s,r.dest,r.overlaidText),i=!0):(r.actions&&(r.actions.Action||r.actions["Mouse Up"]||r.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,r),i=!0),r.resetForm?(this._bindResetFormAction(s,r.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(s,""),i=!0)),this.container.classList.add("linkAnnotation"),i&&this.container.append(s),this.container}_bindLink(r,n,s=""){r.href=this.linkService.getDestinationHash(n),r.onclick=()=>(n&&this.linkService.goToDestination(n),!1),(n||n==="")&&ce(this,Aa,Yf).call(this),s&&(r.title=s)}_bindNamedAction(r,n,s=""){r.href=this.linkService.getAnchorUrl(""),r.onclick=()=>(this.linkService.executeNamedAction(n),!1),s&&(r.title=s),ce(this,Aa,Yf).call(this)}_bindJSAction(r,n){r.href=this.linkService.getAnchorUrl("");const s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const i of Object.keys(n.actions)){const o=s.get(i);o&&(r[o]=()=>{var l;return(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n.id,name:i}}),!1})}n.overlaidText&&(r.title=n.overlaidText),r.onclick||(r.onclick=()=>!1),ce(this,Aa,Yf).call(this)}_bindResetFormAction(r,n){const s=r.onclick;if(s||(r.href=this.linkService.getAnchorUrl("")),ce(this,Aa,Yf).call(this),!this._fieldObjects){Tt('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(r.onclick=()=>!1);return}r.onclick=()=>{var h;s==null||s();const{fields:i,refs:o,include:l}=n,c=[];if(i.length!==0||o.length!==0){const f=new Set(o);for(const p of i){const g=this._fieldObjects[p]||[];for(const{id:m}of g)f.add(m)}for(const p of Object.values(this._fieldObjects))for(const g of p)f.has(g.id)===l&&c.push(g)}else for(const f of Object.values(this._fieldObjects))c.push(...f);const u=this.annotationStorage,d=[];for(const f of c){const{id:p}=f;switch(d.push(p),f.type){case"text":{const m=f.defaultValue||"";u.setValue(p,{value:m});break}case"checkbox":case"radiobutton":{const m=f.defaultValue===f.exportValues;u.setValue(p,{value:m});break}case"combobox":case"listbox":{const m=f.defaultValue||"";u.setValue(p,{value:m});break}default:continue}const g=document.querySelector(`[data-element-id="${p}"]`);if(g){if(!tg.has(g)){Tt(`_bindResetFormAction - element not allowed: ${p}`);continue}}else continue;g.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((h=this.linkService.eventBus)==null||h.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}Aa=new WeakSet,Yf=function(){this.container.setAttribute("data-internal-link","")},Hhe=function(r,n,s="",i=null){r.href=this.linkService.getAnchorUrl(""),n.description?r.title=n.description:s&&(r.title=s),r.onclick=()=>{var o;return(o=this.downloadManager)==null||o.openOrDownloadData(n.content,n.filename,i),!1},ce(this,Aa,Yf).call(this)},Whe=function(r,n,s=""){r.href=this.linkService.getAnchorUrl(""),r.onclick=()=>(this.linkService.executeSetOCGState(n),!1),s&&(r.title=s),ce(this,Aa,Yf).call(this)};class Fct extends kn{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class xg extends kn{render(){return this.container}showElementAndHideCanvas(e){var r;this.data.hasOwnCanvas&&(((r=e.previousSibling)==null?void 0:r.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Is.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,r,n,s,i){n.includes("mouse")?e.addEventListener(n,o=>{var l;(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:i(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):e.addEventListener(n,o=>{var l;if(n==="blur"){if(!r.focused||!o.relatedTarget)return;r.focused=!1}else if(n==="focus"){if(r.focused)return;r.focused=!0}i&&((l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:i(o)}}))})}_setEventListeners(e,r,n,s){var i,o,l;for(const[c,u]of n)(u==="Action"||(i=this.data.actions)!=null&&i[u])&&((u==="Focus"||u==="Blur")&&(r||(r={focused:!1})),this._setEventListener(e,r,c,u,s),u==="Focus"&&!((o=this.data.actions)!=null&&o.Blur)?this._setEventListener(e,r,"blur","Blur",null):u==="Blur"&&!((l=this.data.actions)!=null&&l.Focus)&&this._setEventListener(e,r,"focus","Focus",null))}_setBackgroundColor(e){const r=this.data.backgroundColor||null;e.style.backgroundColor=r===null?"transparent":pt.makeHexColor(r[0],r[1],r[2])}_setTextStyle(e){const r=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||Dct,i=e.style;let o;const l=2,c=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-l),d=Math.round(u/(gI*s))||1,h=u/d;o=Math.min(s,c(h/gI))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(s,c(u/gI))}i.fontSize=`calc(${o}px * var(--total-scale-factor))`,i.color=pt.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(i.textAlign=r[this.data.textAlignment])}_setRequired(e,r){r?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",r)}}class $ct extends xg{constructor(e){const r=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:r})}setPropertyOnSiblings(e,r,n,s){const i=this.annotationStorage;for(const o of this._getElementsByName(e.name,e.id))o.domElement&&(o.domElement[r]=n),i.setValue(o.id,{[s]:n})}render(){var s,i;const e=this.annotationStorage,r=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const o=e.getValue(r,{value:this.data.fieldValue});let l=o.value||"";const c=e.getValue(r,{charLimit:this.data.maxLen}).charLimit;c&&l.length>c&&(l=l.slice(0,c));let u=o.formattedValue||((s=this.data.textContent)==null?void 0:s.join(`
`))||null;u&&this.data.comb&&(u=u.replaceAll(/\s+/g,""));const d={userValue:l,formattedValue:u,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=u??l,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type=this.data.password?"password":"text",n.setAttribute("value",u??l),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),tg.add(n),n.setAttribute("data-element-id",r),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;const{datetimeFormat:h,datetimeType:f,timeStep:p}=this.data,g=!!f&&this.enableScripting;h&&(n.title=h),this._setRequired(n,this.data.required),c&&(n.maxLength=c),n.addEventListener("input",x=>{e.setValue(r,{value:x.target.value}),this.setPropertyOnSiblings(n,"value",x.target.value,"value"),d.formattedValue=null}),n.addEventListener("resetform",x=>{const y=this.data.defaultFieldValue??"";n.value=d.userValue=y,d.formattedValue=null});let m=x=>{const{formattedValue:y}=d;y!=null&&(x.target.value=y),x.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",y=>{var b;if(d.focused)return;const{target:v}=y;if(g&&(v.type=f,p&&(v.step=p)),d.userValue){const w=d.userValue;if(g)if(f==="time"){const j=new Date(w),N=[j.getHours(),j.getMinutes(),j.getSeconds()];v.value=N.map(C=>C.toString().padStart(2,"0")).join(":")}else v.value=new Date(w-Lct).toISOString().split(f==="date"?"T":".",1)[0];else v.value=w}d.lastCommittedValue=v.value,d.commitKey=1,(b=this.data.actions)!=null&&b.Focus||(d.focused=!0)}),n.addEventListener("updatefromsandbox",y=>{this.showElementAndHideCanvas(y.target);const v={value(b){d.userValue=b.detail.value??"",g||e.setValue(r,{value:d.userValue.toString()}),b.target.value=d.userValue},formattedValue(b){const{formattedValue:w}=b.detail;d.formattedValue=w,w!=null&&b.target!==document.activeElement&&(b.target.value=w);const j={formattedValue:w};g&&(j.value=w),e.setValue(r,j)},selRange(b){b.target.setSelectionRange(...b.detail.selRange)},charLimit:b=>{var C;const{charLimit:w}=b.detail,{target:j}=b;if(w===0){j.removeAttribute("maxLength");return}j.setAttribute("maxLength",w);let N=d.userValue;!N||N.length<=w||(N=N.slice(0,w),j.value=d.userValue=N,e.setValue(r,{value:N}),(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:N,willCommit:!0,commitKey:1,selStart:j.selectionStart,selEnd:j.selectionEnd}}))}};this._dispatchEventFromSandbox(v,y)}),n.addEventListener("keydown",y=>{var w;d.commitKey=1;let v=-1;if(y.key==="Escape"?v=0:y.key==="Enter"&&!this.data.multiLine?v=2:y.key==="Tab"&&(d.commitKey=3),v===-1)return;const{value:b}=y.target;d.lastCommittedValue!==b&&(d.lastCommittedValue=b,d.userValue=b,(w=this.linkService.eventBus)==null||w.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:b,willCommit:!0,commitKey:v,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});const x=m;m=null,n.addEventListener("blur",y=>{var w,j;if(!d.focused||!y.relatedTarget)return;(w=this.data.actions)!=null&&w.Blur||(d.focused=!1);const{target:v}=y;let{value:b}=v;if(g){if(b&&f==="time"){const N=b.split(":").map(C=>parseInt(C,10));b=new Date(2e3,0,1,N[0],N[1],N[2]||0).valueOf(),v.step=""}else b=new Date(b).valueOf();v.type="text"}d.userValue=b,d.lastCommittedValue!==b&&((j=this.linkService.eventBus)==null||j.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:b,willCommit:!0,commitKey:d.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}})),x(y)}),(i=this.data.actions)!=null&&i.Keystroke&&n.addEventListener("beforeinput",y=>{var E;d.lastCommittedValue=null;const{data:v,target:b}=y,{value:w,selectionStart:j,selectionEnd:N}=b;let C=j,k=N;switch(y.inputType){case"deleteWordBackward":{const M=w.substring(0,j).match(/\w*[^\w]*$/);M&&(C-=M[0].length);break}case"deleteWordForward":{const M=w.substring(j).match(/^[^\w]*\w*/);M&&(k+=M[0].length);break}case"deleteContentBackward":j===N&&(C-=1);break;case"deleteContentForward":j===N&&(k+=1);break}y.preventDefault(),(E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:w,change:v||"",willCommit:!1,selStart:C,selEnd:k}})}),this._setEventListeners(n,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(m&&n.addEventListener("blur",m),this.data.comb){const y=(this.data.rect[2]-this.data.rect[0])/c;n.classList.add("comb"),n.style.letterSpacing=`calc(${y}px * var(--total-scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Bct extends xg{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class Uct extends xg{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,r=this.data,n=r.id;let s=e.getValue(n,{value:r.exportValue===r.fieldValue}).value;typeof s=="string"&&(s=s!=="Off",e.setValue(n,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");return tg.add(i),i.setAttribute("data-element-id",n),i.disabled=r.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=r.fieldName,s&&i.setAttribute("checked",!0),i.setAttribute("exportValue",r.exportValue),i.tabIndex=0,i.addEventListener("change",o=>{const{name:l,checked:c}=o.target;for(const u of this._getElementsByName(l,n)){const d=c&&u.exportValue===r.exportValue;u.domElement&&(u.domElement.checked=d),e.setValue(u.id,{value:d})}e.setValue(n,{value:c})}),i.addEventListener("resetform",o=>{const l=r.defaultFieldValue||"Off";o.target.checked=l===r.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",o=>{const l={value(c){c.target.checked=c.detail.value!=="Off",e.setValue(n,{value:c.target.checked})}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Vhe extends xg{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,r=this.data,n=r.id;let s=e.getValue(n,{value:r.fieldValue===r.buttonValue}).value;if(typeof s=="string"&&(s=s!==r.buttonValue,e.setValue(n,{value:s})),s)for(const o of this._getElementsByName(r.fieldName,n))e.setValue(o.id,{value:!1});const i=document.createElement("input");if(tg.add(i),i.setAttribute("data-element-id",n),i.disabled=r.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=r.fieldName,s&&i.setAttribute("checked",!0),i.tabIndex=0,i.addEventListener("change",o=>{const{name:l,checked:c}=o.target;for(const u of this._getElementsByName(l,n))e.setValue(u.id,{value:!1});e.setValue(n,{value:c})}),i.addEventListener("resetform",o=>{const l=r.defaultFieldValue;o.target.checked=l!=null&&l===r.buttonValue}),this.enableScripting&&this.hasJSActions){const o=r.buttonValue;i.addEventListener("updatefromsandbox",l=>{const c={value:u=>{const d=o===u.detail.value;for(const h of this._getElementsByName(u.target.name)){const f=d&&h.id===n;h.domElement&&(h.domElement.checked=f),e.setValue(h.id,{value:f})}}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],l=>l.target.checked)}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class zct extends tB{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const r=e.lastChild;return this.enableScripting&&this.hasJSActions&&r&&(this._setDefaultPropertiesFromJS(r),r.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),e}}class Hct extends xg{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,r=this.data.id,n=e.getValue(r,{value:this.data.fieldValue}),s=document.createElement("select");tg.add(s),s.setAttribute("data-element-id",r),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=0;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",d=>{const h=this.data.defaultFieldValue;for(const f of s.options)f.selected=f.value===h});for(const d of this.data.options){const h=document.createElement("option");h.textContent=d.displayValue,h.value=d.exportValue,n.value.includes(d.exportValue)&&(h.setAttribute("selected",!0),i=!1),s.append(h)}let o=null;if(i){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),s.prepend(d),o=()=>{d.remove(),s.removeEventListener("input",o),o=null},s.addEventListener("input",o)}const l=d=>{const h=d?"value":"textContent",{options:f,multiple:p}=s;return p?Array.prototype.filter.call(f,g=>g.selected).map(g=>g[h]):f.selectedIndex===-1?null:f[f.selectedIndex][h]};let c=l(!1);const u=d=>{const h=d.target.options;return Array.prototype.map.call(h,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",d=>{const h={value(f){o==null||o();const p=f.detail.value,g=new Set(Array.isArray(p)?p:[p]);for(const m of s.options)m.selected=g.has(m.value);e.setValue(r,{value:l(!0)}),c=l(!1)},multipleSelection(f){s.multiple=!0},remove(f){const p=s.options,g=f.detail.remove;p[g].selected=!1,s.remove(g),p.length>0&&Array.prototype.findIndex.call(p,x=>x.selected)===-1&&(p[0].selected=!0),e.setValue(r,{value:l(!0),items:u(f)}),c=l(!1)},clear(f){for(;s.length!==0;)s.remove(0);e.setValue(r,{value:null,items:[]}),c=l(!1)},insert(f){const{index:p,displayValue:g,exportValue:m}=f.detail.insert,x=s.children[p],y=document.createElement("option");y.textContent=g,y.value=m,x?x.before(y):s.append(y),e.setValue(r,{value:l(!0),items:u(f)}),c=l(!1)},items(f){const{items:p}=f.detail;for(;s.length!==0;)s.remove(0);for(const g of p){const{displayValue:m,exportValue:x}=g,y=document.createElement("option");y.textContent=m,y.value=x,s.append(y)}s.options.length>0&&(s.options[0].selected=!0),e.setValue(r,{value:l(!0),items:u(f)}),c=l(!1)},indices(f){const p=new Set(f.detail.indices);for(const g of f.target.options)g.selected=p.has(g.index);e.setValue(r,{value:l(!0)}),c=l(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(h,d)}),s.addEventListener("input",d=>{var p;const h=l(!0),f=l(!1);e.setValue(r,{value:h}),d.preventDefault(),(p=this.linkService.eventBus)==null||p.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:c,change:f,changeEx:h,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):s.addEventListener("input",function(d){e.setValue(r,{value:l(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Q5 extends kn{constructor(e){const{data:r,elements:n}=e;super(e,{isRenderable:kn._hasPopupData(r)}),this.elements=n,this.popup=null}render(){const{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";const r=this.popup=new Wct({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),n=[];for(const s of this.elements)s.popup=r,s.container.ariaHasPopup="dialog",n.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",n.map(s=>`${Y8}${s}`).join(",")),this.container}}var Ux,Ik,Rk,zx,Hx,un,bu,yh,Wx,X_,Vx,Kl,ha,xh,wu,Q_,_u,qx,im,vh,sr,qA,GA,Z5,qhe,Ghe,Khe,Yhe,KA,YA,J5;class Wct{constructor({container:e,color:r,elements:n,titleObj:s,modificationDate:i,contentsObj:o,richText:l,parent:c,rect:u,parentRect:d,open:h}){se(this,sr);se(this,Ux,ce(this,sr,Khe).bind(this));se(this,Ik,ce(this,sr,J5).bind(this));se(this,Rk,ce(this,sr,YA).bind(this));se(this,zx,ce(this,sr,KA).bind(this));se(this,Hx,null);se(this,un,null);se(this,bu,null);se(this,yh,null);se(this,Wx,null);se(this,X_,null);se(this,Vx,null);se(this,Kl,!1);se(this,ha,null);se(this,xh,null);se(this,wu,null);se(this,Q_,null);se(this,_u,null);se(this,qx,null);se(this,im,null);se(this,vh,!1);Q(this,un,e),Q(this,qx,s),Q(this,bu,o),Q(this,_u,l),Q(this,X_,c),Q(this,Hx,r),Q(this,Q_,u),Q(this,Vx,d),Q(this,Wx,n),Q(this,yh,ck.toDateObject(i)),this.trigger=n.flatMap(f=>f.getElementsToTriggerPopup()),ce(this,sr,qA).call(this),_(this,un).hidden=!0,h&&ce(this,sr,KA).call(this)}render(){var s;if(_(this,ha))return;const e=Q(this,ha,document.createElement("div"));if(e.className="popup",_(this,Hx)){const i=e.style.outlineColor=pt.makeHexColor(..._(this,Hx));e.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}const r=document.createElement("span");if(r.className="header",(s=_(this,qx))!=null&&s.str){const i=document.createElement("span");i.className="title",r.append(i),{dir:i.dir,str:i.textContent}=_(this,qx)}if(e.append(r),_(this,yh)){const i=document.createElement("time");i.className="popupDate",i.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),i.setAttribute("data-l10n-args",JSON.stringify({dateObj:_(this,yh).valueOf()})),i.dateTime=_(this,yh).toISOString(),r.append(i)}const n=_(this,sr,GA);if(n)zhe.render({xfaHtml:n,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const i=this._formatContents(_(this,bu));e.append(i)}_(this,un).append(e)}_formatContents({str:e,dir:r}){const n=document.createElement("p");n.classList.add("popupContent"),n.dir=r;const s=e.split(/(?:\r\n?|\n)/);for(let i=0,o=s.length;i<o;++i){const l=s[i];n.append(document.createTextNode(l)),i<o-1&&n.append(document.createElement("br"))}return n}updateEdited({rect:e,popup:r,deleted:n}){var s;if(n||r!=null&&r.deleted){this.remove();return}ce(this,sr,qA).call(this),_(this,im)||Q(this,im,{contentsObj:_(this,bu),richText:_(this,_u)}),e&&Q(this,wu,null),r&&(Q(this,_u,ce(this,sr,Ghe).call(this,r.text)),Q(this,yh,ck.toDateObject(r.date)),Q(this,bu,null)),(s=_(this,ha))==null||s.remove(),Q(this,ha,null)}resetEdited(){var e;_(this,im)&&({contentsObj:ns(this,bu)._,richText:ns(this,_u)._}=_(this,im),Q(this,im,null),(e=_(this,ha))==null||e.remove(),Q(this,ha,null),Q(this,wu,null))}remove(){var e,r;(e=_(this,xh))==null||e.abort(),Q(this,xh,null),(r=_(this,ha))==null||r.remove(),Q(this,ha,null),Q(this,vh,!1),Q(this,Kl,!1);for(const n of this.trigger)n.classList.remove("popupTriggerArea")}forceHide(){Q(this,vh,this.isVisible),_(this,vh)&&(_(this,un).hidden=!0)}maybeShow(){ce(this,sr,qA).call(this),_(this,vh)&&(_(this,ha)||ce(this,sr,YA).call(this),Q(this,vh,!1),_(this,un).hidden=!1)}get isVisible(){return _(this,un).hidden===!1}}Ux=new WeakMap,Ik=new WeakMap,Rk=new WeakMap,zx=new WeakMap,Hx=new WeakMap,un=new WeakMap,bu=new WeakMap,yh=new WeakMap,Wx=new WeakMap,X_=new WeakMap,Vx=new WeakMap,Kl=new WeakMap,ha=new WeakMap,xh=new WeakMap,wu=new WeakMap,Q_=new WeakMap,_u=new WeakMap,qx=new WeakMap,im=new WeakMap,vh=new WeakMap,sr=new WeakSet,qA=function(){var r;if(_(this,xh))return;Q(this,xh,new AbortController);const{signal:e}=_(this,xh);for(const n of this.trigger)n.addEventListener("click",_(this,zx),{signal:e}),n.addEventListener("mouseenter",_(this,Rk),{signal:e}),n.addEventListener("mouseleave",_(this,Ik),{signal:e}),n.classList.add("popupTriggerArea");for(const n of _(this,Wx))(r=n.container)==null||r.addEventListener("keydown",_(this,Ux),{signal:e})},GA=function(){const e=_(this,_u),r=_(this,bu);return e!=null&&e.str&&(!(r!=null&&r.str)||r.str===e.str)&&_(this,_u).html||null},Z5=function(){var e,r,n;return((n=(r=(e=_(this,sr,GA))==null?void 0:e.attributes)==null?void 0:r.style)==null?void 0:n.fontSize)||0},qhe=function(){var e,r,n;return((n=(r=(e=_(this,sr,GA))==null?void 0:e.attributes)==null?void 0:r.style)==null?void 0:n.color)||null},Ghe=function(e){const r=[],n={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:r}]}},s={style:{color:_(this,sr,qhe),fontSize:_(this,sr,Z5)?`calc(${_(this,sr,Z5)}px * var(--total-scale-factor))`:""}};for(const i of e.split(`
`))r.push({name:"span",value:i,attributes:s});return n},Khe=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&_(this,Kl))&&ce(this,sr,KA).call(this)},Yhe=function(){if(_(this,wu)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:r,pageHeight:n,pageX:s,pageY:i}}}=_(this,X_);let o=!!_(this,Vx),l=o?_(this,Vx):_(this,Q_);for(const g of _(this,Wx))if(!l||pt.intersect(g.data.rect,l)!==null){l=g.data.rect,o=!0;break}const c=pt.normalizeRect([l[0],e[3]-l[1]+e[1],l[2],e[3]-l[3]+e[1]]),d=o?l[2]-l[0]+5:0,h=c[0]+d,f=c[1];Q(this,wu,[100*(h-s)/r,100*(f-i)/n]);const{style:p}=_(this,un);p.left=`${_(this,wu)[0]}%`,p.top=`${_(this,wu)[1]}%`},KA=function(){Q(this,Kl,!_(this,Kl)),_(this,Kl)?(ce(this,sr,YA).call(this),_(this,un).addEventListener("click",_(this,zx)),_(this,un).addEventListener("keydown",_(this,Ux))):(ce(this,sr,J5).call(this),_(this,un).removeEventListener("click",_(this,zx)),_(this,un).removeEventListener("keydown",_(this,Ux)))},YA=function(){_(this,ha)||this.render(),this.isVisible?_(this,Kl)&&_(this,un).classList.add("focused"):(ce(this,sr,Yhe).call(this),_(this,un).hidden=!1,_(this,un).style.zIndex=parseInt(_(this,un).style.zIndex)+1e3)},J5=function(){_(this,un).classList.remove("focused"),!(_(this,Kl)||!this.isVisible)&&(_(this,un).hidden=!0,_(this,un).style.zIndex=parseInt(_(this,un).style.zIndex)-1e3)};class Xhe extends kn{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=kt.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const r of this.textContent){const n=document.createElement("span");n.textContent=r,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Z_;class Vct extends kn{constructor(r){super(r,{isRenderable:!0,ignoreBorder:!0});se(this,Z_,null)}render(){this.container.classList.add("lineAnnotation");const{data:r,width:n,height:s}=this,i=this.svgFactory.create(n,s,!0),o=Q(this,Z_,this.svgFactory.createElement("svg:line"));return o.setAttribute("x1",r.rect[2]-r.lineCoordinates[0]),o.setAttribute("y1",r.rect[3]-r.lineCoordinates[1]),o.setAttribute("x2",r.rect[2]-r.lineCoordinates[2]),o.setAttribute("y2",r.rect[3]-r.lineCoordinates[3]),o.setAttribute("stroke-width",r.borderStyle.width||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),i.append(o),this.container.append(i),!r.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,Z_)}addHighlightArea(){this.container.classList.add("highlightArea")}}Z_=new WeakMap;var J_;class qct extends kn{constructor(r){super(r,{isRenderable:!0,ignoreBorder:!0});se(this,J_,null)}render(){this.container.classList.add("squareAnnotation");const{data:r,width:n,height:s}=this,i=this.svgFactory.create(n,s,!0),o=r.borderStyle.width,l=Q(this,J_,this.svgFactory.createElement("svg:rect"));return l.setAttribute("x",o/2),l.setAttribute("y",o/2),l.setAttribute("width",n-o),l.setAttribute("height",s-o),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),i.append(l),this.container.append(i),!r.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,J_)}addHighlightArea(){this.container.classList.add("highlightArea")}}J_=new WeakMap;var ej;class Gct extends kn{constructor(r){super(r,{isRenderable:!0,ignoreBorder:!0});se(this,ej,null)}render(){this.container.classList.add("circleAnnotation");const{data:r,width:n,height:s}=this,i=this.svgFactory.create(n,s,!0),o=r.borderStyle.width,l=Q(this,ej,this.svgFactory.createElement("svg:ellipse"));return l.setAttribute("cx",n/2),l.setAttribute("cy",s/2),l.setAttribute("rx",n/2-o/2),l.setAttribute("ry",s/2-o/2),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),i.append(l),this.container.append(i),!r.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,ej)}addHighlightArea(){this.container.classList.add("highlightArea")}}ej=new WeakMap;var tj;class Qhe extends kn{constructor(r){super(r,{isRenderable:!0,ignoreBorder:!0});se(this,tj,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:r,vertices:n,borderStyle:s,popupRef:i},width:o,height:l}=this;if(!n)return this.container;const c=this.svgFactory.create(o,l,!0);let u=[];for(let h=0,f=n.length;h<f;h+=2){const p=n[h]-r[0],g=r[3]-n[h+1];u.push(`${p},${g}`)}u=u.join(" ");const d=Q(this,tj,this.svgFactory.createElement(this.svgElementName));return d.setAttribute("points",u),d.setAttribute("stroke-width",s.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),c.append(d),this.container.append(c),!i&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,tj)}addHighlightArea(){this.container.classList.add("highlightArea")}}tj=new WeakMap;class Kct extends Qhe{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Yct extends kn{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var rj,am,nj,e3;class rB extends kn{constructor(r){super(r,{isRenderable:!0,ignoreBorder:!0});se(this,nj);se(this,rj,null);se(this,am,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?kt.HIGHLIGHT:kt.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:r,rotation:n,inkLists:s,borderStyle:i,popupRef:o}}=this,{transform:l,width:c,height:u}=ce(this,nj,e3).call(this,n,r),d=this.svgFactory.create(c,u,!0),h=Q(this,rj,this.svgFactory.createElement("svg:g"));d.append(h),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round"),h.setAttribute("stroke-miterlimit",10),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),h.setAttribute("transform",l);for(let f=0,p=s.length;f<p;f++){const g=this.svgFactory.createElement(this.svgElementName);_(this,am).push(g),g.setAttribute("points",s[f].join(",")),h.append(g)}return!o&&this.hasPopupData&&this._createPopup(),this.container.append(d),this._editOnDoubleClick(),this.container}updateEdited(r){super.updateEdited(r);const{thickness:n,points:s,rect:i}=r,o=_(this,rj);if(n>=0&&o.setAttribute("stroke-width",n||1),s)for(let l=0,c=_(this,am).length;l<c;l++)_(this,am)[l].setAttribute("points",s[l].join(","));if(i){const{transform:l,width:c,height:u}=ce(this,nj,e3).call(this,this.data.rotation,i);o.parentElement.setAttribute("viewBox",`0 0 ${c} ${u}`),o.setAttribute("transform",l)}}getElementsToTriggerPopup(){return _(this,am)}addHighlightArea(){this.container.classList.add("highlightArea")}}rj=new WeakMap,am=new WeakMap,nj=new WeakSet,e3=function(r,n){switch(r){case 90:return{transform:`rotate(90) translate(${-n[0]},${n[1]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};case 180:return{transform:`rotate(180) translate(${-n[2]},${n[1]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]};case 270:return{transform:`rotate(270) translate(${-n[2]},${n[3]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};default:return{transform:`translate(${-n[0]},${n[3]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]}}};class Zhe extends kn{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=kt.HIGHLIGHT}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),e){const n=document.createElement("mark");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class Xct extends kn{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),e){const n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class Qct extends kn{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),e){const n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class Zct extends kn{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),e){const n=document.createElement("s");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class Jhe extends kn{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=kt.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var sj,ij,t3;class Jct extends kn{constructor(r){var s;super(r,{isRenderable:!0});se(this,ij);se(this,sj,null);const{file:n}=this.data;this.filename=n.filename,this.content=n.content,(s=this.linkService.eventBus)==null||s.dispatch("fileattachmentannotation",{source:this,...n})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:r,data:n}=this;let s;n.hasAppearance||n.fillAlpha===0?s=document.createElement("div"):(s=document.createElement("img"),s.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(n.name)?"paperclip":"pushpin"}.svg`,n.fillAlpha&&n.fillAlpha<1&&(s.style=`filter: opacity(${Math.round(n.fillAlpha*100)}%);`)),s.addEventListener("dblclick",ce(this,ij,t3).bind(this)),Q(this,sj,s);const{isMac:i}=Is.platform;return r.addEventListener("keydown",o=>{o.key==="Enter"&&(i?o.metaKey:o.ctrlKey)&&ce(this,ij,t3).call(this)}),!n.popupRef&&this.hasPopupData?this._createPopup():s.classList.add("popupTriggerArea"),r.append(s),r}getElementsToTriggerPopup(){return _(this,sj)}addHighlightArea(){this.container.classList.add("highlightArea")}}sj=new WeakMap,ij=new WeakSet,t3=function(){var r;(r=this.downloadManager)==null||r.openOrDownloadData(this.content,this.filename)};var aj,om,bh,oj,lf,n3,s3;const LB=class LB{constructor({div:e,accessibilityManager:r,annotationCanvasMap:n,annotationEditorUIManager:s,page:i,viewport:o,structTreeLayer:l}){se(this,lf);se(this,aj,null);se(this,om,null);se(this,bh,new Map);se(this,oj,null);this.div=e,Q(this,aj,r),Q(this,om,n),Q(this,oj,l||null),this.page=i,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=s}hasEditableAnnotations(){return _(this,bh).size>0}async render(e){var o;const{annotations:r}=e,n=this.div;Jm(n,this.viewport);const s=new Map,i={data:null,layer:n,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new pk,annotationStorage:e.annotationStorage||new Z8,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const l of r){if(l.noHTML)continue;const c=l.annotationType===On.POPUP;if(c){const h=s.get(l.id);if(!h)continue;i.elements=h}else if(l.rect[2]===l.rect[0]||l.rect[3]===l.rect[1])continue;i.data=l;const u=xK.create(i);if(!u.isRenderable)continue;if(!c&&l.popupRef){const h=s.get(l.popupRef);h?h.push(u):s.set(l.popupRef,[u])}const d=u.render();l.hidden&&(d.style.visibility="hidden"),await ce(this,lf,n3).call(this,d,l.id,i.elements),u._isEditable&&(_(this,bh).set(u.data.id,u),(o=this._annotationEditorUIManager)==null||o.renderAnnotationElement(u))}ce(this,lf,s3).call(this)}async addLinkAnnotations(e,r){const n={data:null,layer:this.div,linkService:r,svgFactory:new pk,parent:this};for(const s of e){s.borderStyle||(s.borderStyle=LB._defaultBorderStyle),n.data=s;const i=xK.create(n);if(!i.isRenderable)continue;const o=i.render();await ce(this,lf,n3).call(this,o,s.id,null)}}update({viewport:e}){const r=this.div;this.viewport=e,Jm(r,{rotation:e.rotation}),ce(this,lf,s3).call(this),r.hidden=!1}getEditableAnnotations(){return Array.from(_(this,bh).values())}getEditableAnnotation(e){return _(this,bh).get(e)}static get _defaultBorderStyle(){return Ut(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:zg.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};aj=new WeakMap,om=new WeakMap,bh=new WeakMap,oj=new WeakMap,lf=new WeakSet,n3=async function(e,r,n){var l,c;const s=e.firstChild||e,i=s.id=`${Y8}${r}`,o=await((l=_(this,oj))==null?void 0:l.getAriaAttributes(i));if(o)for(const[u,d]of o)s.setAttribute(u,d);n?n.at(-1).container.after(e):(this.div.append(e),(c=_(this,aj))==null||c.moveElementInDOM(this.div,e,s,!1))},s3=function(){var r;if(!_(this,om))return;const e=this.div;for(const[n,s]of _(this,om)){const i=e.querySelector(`[data-annotation-id="${n}"]`);if(!i)continue;s.className="annotationContent";const{firstChild:o}=i;o?o.nodeName==="CANVAS"?o.replaceWith(s):o.classList.contains("annotationContent")?o.after(s):o.before(s):i.append(s);const l=_(this,bh).get(n);l&&(l._hasNoCanvas?((r=this._annotationEditorUIManager)==null||r.setMissingCanvas(n,i.id,s),l._hasNoCanvas=!1):l.canvas=s)}_(this,om).clear()};let r3=LB;const VN=/\r\n?|\n/g;var Za,fa,lj,lm,pa,$n,efe,tfe,rfe,XA,Hu,QA,ZA,nfe,a3,sfe;const Er=class Er extends Rr{constructor(r){super({...r,name:"freeTextEditor"});se(this,$n);se(this,Za);se(this,fa,"");se(this,lj,`${this.id}-editor`);se(this,lm,null);se(this,pa);Le(this,"_colorPicker",null);Q(this,Za,r.color||Er._defaultColor||Rr._defaultLineColor),Q(this,pa,r.fontSize||Er._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static get _keyboardManager(){const r=Er.prototype,n=o=>o.isEmpty(),s=eg.TRANSLATE_SMALL,i=eg.TRANSLATE_BIG;return Ut(this,"_keyboardManager",new pS([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],r.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],r.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],r._translateEmpty,{args:[-s,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],r._translateEmpty,{args:[-i,0],checker:n}],[["ArrowRight","mac+ArrowRight"],r._translateEmpty,{args:[s,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],r._translateEmpty,{args:[i,0],checker:n}],[["ArrowUp","mac+ArrowUp"],r._translateEmpty,{args:[0,-s],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],r._translateEmpty,{args:[0,-i],checker:n}],[["ArrowDown","mac+ArrowDown"],r._translateEmpty,{args:[0,s],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],r._translateEmpty,{args:[0,i],checker:n}]]))}static initialize(r,n){Rr.initialize(r,n);const s=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(s.getPropertyValue("--freetext-padding"))}static updateDefaultParams(r,n){switch(r){case Kt.FREETEXT_SIZE:Er._defaultFontSize=n;break;case Kt.FREETEXT_COLOR:Er._defaultColor=n;break}}updateParams(r,n){switch(r){case Kt.FREETEXT_SIZE:ce(this,$n,efe).call(this,n);break;case Kt.FREETEXT_COLOR:ce(this,$n,tfe).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[Kt.FREETEXT_SIZE,Er._defaultFontSize],[Kt.FREETEXT_COLOR,Er._defaultColor||Rr._defaultLineColor]]}get propertiesToUpdate(){return[[Kt.FREETEXT_SIZE,_(this,pa)],[Kt.FREETEXT_COLOR,_(this,Za)]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new fk(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Kt.FREETEXT_COLOR}get colorValue(){return _(this,Za)}_translateEmpty(r,n){this._uiManager.translateSelectedEditors(r,n,!0)}getInitialTranslation(){const r=this.parentScale;return[-Er._internalPadding*r,-(Er._internalPadding+_(this,pa))*r]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),Q(this,lm,new AbortController);const r=this._uiManager.combinedSignal(_(this,lm));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:r}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:r}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:r}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:r}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:r}),!0}disableEditMode(){var r;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",_(this,lj)),this._isDraggable=!0,(r=_(this,lm))==null||r.abort(),Q(this,lm,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(r){this._focusEventsAllowed&&(super.focusin(r),r.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(r){var n;this.width||(this.enableEditMode(),r&&this.editorDiv.focus(),(n=this._initialOptions)!=null&&n.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const r=_(this,fa),n=Q(this,fa,ce(this,$n,rfe).call(this).trimEnd());if(r===n)return;const s=i=>{if(Q(this,fa,i),!i){this.remove();return}ce(this,$n,ZA).call(this),this._uiManager.rebuild(this),ce(this,$n,XA).call(this)};this.addCommands({cmd:()=>{s(n)},undo:()=>{s(r)},mustExec:!1}),ce(this,$n,XA).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(r){r.target===this.div&&r.key==="Enter"&&(this.enterInEditMode(),r.preventDefault())}editorDivKeydown(r){Er._keyboardManager.exec(this,r)}editorDivFocus(r){this.isEditing=!0}editorDivBlur(r){this.isEditing=!1}editorDivInput(r){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let r,n;(this._isCopy||this.annotationElementId)&&(r=this.x,n=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",_(this,lj)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:s}=this.editorDiv;if(s.fontSize=`calc(${_(this,pa)}px * var(--total-scale-factor))`,s.color=_(this,Za),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[i,o]=this.parentDimensions;if(this.annotationElementId){const{position:l}=this._initialData;let[c,u]=this.getInitialTranslation();[c,u]=this.pageTranslationToScreen(c,u);const[d,h]=this.pageDimensions,[f,p]=this.pageTranslation;let g,m;switch(this.rotation){case 0:g=r+(l[0]-f)/d,m=n+this.height-(l[1]-p)/h;break;case 90:g=r+(l[0]-f)/d,m=n-(l[1]-p)/h,[c,u]=[u,-c];break;case 180:g=r-this.width+(l[0]-f)/d,m=n-(l[1]-p)/h,[c,u]=[-c,-u];break;case 270:g=r+(l[0]-f-this.height*h)/d,m=n+(l[1]-p-this.width*d)/h,[c,u]=[-u,c];break}this.setAt(g*i,m*o,c,u)}else this._moveAfterPaste(r,n);ce(this,$n,ZA).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(r){var g,m,x;const n=r.clipboardData||window.clipboardData,{types:s}=n;if(s.length===1&&s[0]==="text/plain")return;r.preventDefault();const i=ce(g=Er,Hu,a3).call(g,n.getData("text")||"").replaceAll(VN,`
`);if(!i)return;const o=window.getSelection();if(!o.rangeCount)return;this.editorDiv.normalize(),o.deleteFromDocument();const l=o.getRangeAt(0);if(!i.includes(`
`)){l.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),o.collapseToStart();return}const{startContainer:c,startOffset:u}=l,d=[],h=[];if(c.nodeType===Node.TEXT_NODE){const y=c.parentElement;if(h.push(c.nodeValue.slice(u).replaceAll(VN,"")),y!==this.editorDiv){let v=d;for(const b of this.editorDiv.childNodes){if(b===y){v=h;continue}v.push(ce(m=Er,Hu,QA).call(m,b))}}d.push(c.nodeValue.slice(0,u).replaceAll(VN,""))}else if(c===this.editorDiv){let y=d,v=0;for(const b of this.editorDiv.childNodes)v++===u&&(y=h),y.push(ce(x=Er,Hu,QA).call(x,b))}Q(this,fa,`${d.join(`
`)}${i}${h.join(`
`)}`),ce(this,$n,ZA).call(this);const f=new Range;let p=Math.sumPrecise(d.map(y=>y.length));for(const{firstChild:y}of this.editorDiv.childNodes)if(y.nodeType===Node.TEXT_NODE){const v=y.nodeValue.length;if(p<=v){f.setStart(y,p),f.setEnd(y,p);break}p-=v}o.removeAllRanges(),o.addRange(f)}get contentDiv(){return this.editorDiv}static async deserialize(r,n,s){var l;let i=null;if(r instanceof Xhe){const{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:d,rotation:h,id:f,popupRef:p,contentsObj:g},textContent:m,textPosition:x,parent:{page:{pageNumber:y}}}=r;if(!m||m.length===0)return null;i=r={annotationType:kt.FREETEXT,color:Array.from(u),fontSize:c,value:m.join(`
`),position:x,pageIndex:y-1,rect:d.slice(0),rotation:h,annotationElementId:f,id:f,deleted:!1,popupRef:p,comment:(g==null?void 0:g.str)||null}}const o=await super.deserialize(r,n,s);return Q(o,pa,r.fontSize),Q(o,Za,pt.makeHexColor(...r.color)),Q(o,fa,ce(l=Er,Hu,a3).call(l,r.value)),o._initialData=i,r.comment&&o.setCommentData(r.comment),o}serialize(r=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n=Er._internalPadding*this.parentScale,s=this.getRect(n,n),i=Rr._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:_(this,Za)),o={annotationType:kt.FREETEXT,color:i,fontSize:_(this,pa),value:ce(this,$n,nfe).call(this),pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return this.addComment(o),r?(o.isCopy=!0,o):this.annotationElementId&&!ce(this,$n,sfe).call(this,o)?null:(o.id=this.annotationElementId,o)}renderAnnotationElement(r){const n=super.renderAnnotationElement(r),{style:s}=n;s.fontSize=`calc(${_(this,pa)}px * var(--total-scale-factor))`,s.color=_(this,Za),n.replaceChildren();for(const l of _(this,fa).split(`
`)){const c=document.createElement("div");c.append(l?document.createTextNode(l):document.createElement("br")),n.append(c)}const i=Er._internalPadding*this.parentScale,o={rect:this.getRect(i,i)};return o.popup=this.hasEditedComment?this.comment:{text:_(this,fa)},r.updateEdited(o),n}resetAnnotationElement(r){super.resetAnnotationElement(r),r.resetEdited()}};Za=new WeakMap,fa=new WeakMap,lj=new WeakMap,lm=new WeakMap,pa=new WeakMap,$n=new WeakSet,efe=function(r){const n=i=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--total-scale-factor))`,this.translate(0,-(i-_(this,pa))*this.parentScale),Q(this,pa,i),ce(this,$n,XA).call(this)},s=_(this,pa);this.addCommands({cmd:n.bind(this,r),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Kt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},tfe=function(r){const n=i=>{var o;Q(this,Za,this.editorDiv.style.color=i),(o=this._colorPicker)==null||o.update(i)},s=_(this,Za);this.addCommands({cmd:n.bind(this,r),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Kt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},rfe=function(){var s;const r=[];this.editorDiv.normalize();let n=null;for(const i of this.editorDiv.childNodes)(n==null?void 0:n.nodeType)===Node.TEXT_NODE&&i.nodeName==="BR"||(r.push(ce(s=Er,Hu,QA).call(s,i)),n=i);return r.join(`
`)},XA=function(){const[r,n]=this.parentDimensions;let s;if(this.isAttachedToDOM)s=this.div.getBoundingClientRect();else{const{currentLayer:i,div:o}=this,l=o.style.display,c=o.classList.contains("hidden");o.classList.remove("hidden"),o.style.display="hidden",i.div.append(this.div),s=o.getBoundingClientRect(),o.remove(),o.style.display=l,o.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=s.width/r,this.height=s.height/n):(this.width=s.height/r,this.height=s.width/n),this.fixAndSetPosition()},Hu=new WeakSet,QA=function(r){return(r.nodeType===Node.TEXT_NODE?r.nodeValue:r.innerText).replaceAll(VN,"")},ZA=function(){if(this.editorDiv.replaceChildren(),!!_(this,fa))for(const r of _(this,fa).split(`
`)){const n=document.createElement("div");n.append(r?document.createTextNode(r):document.createElement("br")),this.editorDiv.append(n)}},nfe=function(){return _(this,fa).replaceAll(" "," ")},a3=function(r){return r.replaceAll(" "," ")},sfe=function(r){const{value:n,fontSize:s,color:i,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||r.value!==n||r.fontSize!==s||r.color.some((l,c)=>l!==i[c])||r.pageIndex!==o},se(Er,Hu),Le(Er,"_freeTextDefaultContent",""),Le(Er,"_internalPadding",0),Le(Er,"_defaultColor",null),Le(Er,"_defaultFontSize",10),Le(Er,"_type","freetext"),Le(Er,"_editorType",kt.FREETEXT);let i3=Er;class lt{toSVGPath(){_r("Abstract method `toSVGPath` must be implemented.")}get box(){_r("Abstract getter `box` must be implemented.")}serialize(e,r){_r("Abstract method `serialize` must be implemented.")}static _rescale(e,r,n,s,i,o){o||(o=new Float32Array(e.length));for(let l=0,c=e.length;l<c;l+=2)o[l]=r+e[l]*s,o[l+1]=n+e[l+1]*i;return o}static _rescaleAndSwap(e,r,n,s,i,o){o||(o=new Float32Array(e.length));for(let l=0,c=e.length;l<c;l+=2)o[l]=r+e[l+1]*s,o[l+1]=n+e[l]*i;return o}static _translate(e,r,n,s){s||(s=new Float32Array(e.length));for(let i=0,o=e.length;i<o;i+=2)s[i]=r+e[i],s[i+1]=n+e[i+1];return s}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,r,n,s,i){switch(i){case 90:return[1-r/n,e/s];case 180:return[1-e/n,1-r/s];case 270:return[r/n,1-e/s];default:return[e/n,r/s]}}static _normalizePagePoint(e,r,n){switch(n){case 90:return[1-r,e];case 180:return[1-e,1-r];case 270:return[r,1-e];default:return[e,r]}}static createBezierPoints(e,r,n,s,i,o){return[(e+5*n)/6,(r+5*s)/6,(5*n+i)/6,(5*s+o)/6,(n+i)/2,(s+o)/2]}}Le(lt,"PRECISION",1e-4);var ma,qo,Gx,Kx,Yl,Bt,cm,um,cj,uj,Yx,Xx,wh,dj,Mk,Dk,Zn,q0,ife,afe,ofe,lfe,cfe,ufe;const Yc=class Yc{constructor({x:e,y:r},n,s,i,o,l=0){se(this,Zn);se(this,ma);se(this,qo,[]);se(this,Gx);se(this,Kx);se(this,Yl,[]);se(this,Bt,new Float32Array(18));se(this,cm);se(this,um);se(this,cj);se(this,uj);se(this,Yx);se(this,Xx);se(this,wh,[]);Q(this,ma,n),Q(this,Xx,i*s),Q(this,Kx,o),_(this,Bt).set([NaN,NaN,NaN,NaN,e,r],6),Q(this,Gx,l),Q(this,uj,_(Yc,dj)*s),Q(this,cj,_(Yc,Dk)*s),Q(this,Yx,s),_(this,wh).push(e,r)}isEmpty(){return isNaN(_(this,Bt)[8])}add({x:e,y:r}){var E;Q(this,cm,e),Q(this,um,r);const[n,s,i,o]=_(this,ma);let[l,c,u,d]=_(this,Bt).subarray(8,12);const h=e-u,f=r-d,p=Math.hypot(h,f);if(p<_(this,cj))return!1;const g=p-_(this,uj),m=g/p,x=m*h,y=m*f;let v=l,b=c;l=u,c=d,u+=x,d+=y,(E=_(this,wh))==null||E.push(e,r);const w=-y/g,j=x/g,N=w*_(this,Xx),C=j*_(this,Xx);return _(this,Bt).set(_(this,Bt).subarray(2,8),0),_(this,Bt).set([u+N,d+C],4),_(this,Bt).set(_(this,Bt).subarray(14,18),12),_(this,Bt).set([u-N,d-C],16),isNaN(_(this,Bt)[6])?(_(this,Yl).length===0&&(_(this,Bt).set([l+N,c+C],2),_(this,Yl).push(NaN,NaN,NaN,NaN,(l+N-n)/i,(c+C-s)/o),_(this,Bt).set([l-N,c-C],14),_(this,qo).push(NaN,NaN,NaN,NaN,(l-N-n)/i,(c-C-s)/o)),_(this,Bt).set([v,b,l,c,u,d],6),!this.isEmpty()):(_(this,Bt).set([v,b,l,c,u,d],6),Math.abs(Math.atan2(b-c,v-l)-Math.atan2(y,x))<Math.PI/2?([l,c,u,d]=_(this,Bt).subarray(2,6),_(this,Yl).push(NaN,NaN,NaN,NaN,((l+u)/2-n)/i,((c+d)/2-s)/o),[l,c,v,b]=_(this,Bt).subarray(14,18),_(this,qo).push(NaN,NaN,NaN,NaN,((v+l)/2-n)/i,((b+c)/2-s)/o),!0):([v,b,l,c,u,d]=_(this,Bt).subarray(0,6),_(this,Yl).push(((v+5*l)/6-n)/i,((b+5*c)/6-s)/o,((5*l+u)/6-n)/i,((5*c+d)/6-s)/o,((l+u)/2-n)/i,((c+d)/2-s)/o),[u,d,l,c,v,b]=_(this,Bt).subarray(12,18),_(this,qo).push(((v+5*l)/6-n)/i,((b+5*c)/6-s)/o,((5*l+u)/6-n)/i,((5*c+d)/6-s)/o,((l+u)/2-n)/i,((c+d)/2-s)/o),!0))}toSVGPath(){if(this.isEmpty())return"";const e=_(this,Yl),r=_(this,qo);if(isNaN(_(this,Bt)[6])&&!this.isEmpty())return ce(this,Zn,ife).call(this);const n=[];n.push(`M${e[4]} ${e[5]}`);for(let s=6;s<e.length;s+=6)isNaN(e[s])?n.push(`L${e[s+4]} ${e[s+5]}`):n.push(`C${e[s]} ${e[s+1]} ${e[s+2]} ${e[s+3]} ${e[s+4]} ${e[s+5]}`);ce(this,Zn,ofe).call(this,n);for(let s=r.length-6;s>=6;s-=6)isNaN(r[s])?n.push(`L${r[s+4]} ${r[s+5]}`):n.push(`C${r[s]} ${r[s+1]} ${r[s+2]} ${r[s+3]} ${r[s+4]} ${r[s+5]}`);return ce(this,Zn,afe).call(this,n),n.join(" ")}newFreeDrawOutline(e,r,n,s,i,o){return new dfe(e,r,n,s,i,o)}getOutlines(){var h;const e=_(this,Yl),r=_(this,qo),n=_(this,Bt),[s,i,o,l]=_(this,ma),c=new Float32Array((((h=_(this,wh))==null?void 0:h.length)??0)+2);for(let f=0,p=c.length-2;f<p;f+=2)c[f]=(_(this,wh)[f]-s)/o,c[f+1]=(_(this,wh)[f+1]-i)/l;if(c[c.length-2]=(_(this,cm)-s)/o,c[c.length-1]=(_(this,um)-i)/l,isNaN(n[6])&&!this.isEmpty())return ce(this,Zn,lfe).call(this,c);const u=new Float32Array(_(this,Yl).length+24+_(this,qo).length);let d=e.length;for(let f=0;f<d;f+=2){if(isNaN(e[f])){u[f]=u[f+1]=NaN;continue}u[f]=e[f],u[f+1]=e[f+1]}d=ce(this,Zn,ufe).call(this,u,d);for(let f=r.length-6;f>=6;f-=6)for(let p=0;p<6;p+=2){if(isNaN(r[f+p])){u[d]=u[d+1]=NaN,d+=2;continue}u[d]=r[f+p],u[d+1]=r[f+p+1],d+=2}return ce(this,Zn,cfe).call(this,u,d),this.newFreeDrawOutline(u,c,_(this,ma),_(this,Yx),_(this,Gx),_(this,Kx))}};ma=new WeakMap,qo=new WeakMap,Gx=new WeakMap,Kx=new WeakMap,Yl=new WeakMap,Bt=new WeakMap,cm=new WeakMap,um=new WeakMap,cj=new WeakMap,uj=new WeakMap,Yx=new WeakMap,Xx=new WeakMap,wh=new WeakMap,dj=new WeakMap,Mk=new WeakMap,Dk=new WeakMap,Zn=new WeakSet,q0=function(){const e=_(this,Bt).subarray(4,6),r=_(this,Bt).subarray(16,18),[n,s,i,o]=_(this,ma);return[(_(this,cm)+(e[0]-r[0])/2-n)/i,(_(this,um)+(e[1]-r[1])/2-s)/o,(_(this,cm)+(r[0]-e[0])/2-n)/i,(_(this,um)+(r[1]-e[1])/2-s)/o]},ife=function(){const[e,r,n,s]=_(this,ma),[i,o,l,c]=ce(this,Zn,q0).call(this);return`M${(_(this,Bt)[2]-e)/n} ${(_(this,Bt)[3]-r)/s} L${(_(this,Bt)[4]-e)/n} ${(_(this,Bt)[5]-r)/s} L${i} ${o} L${l} ${c} L${(_(this,Bt)[16]-e)/n} ${(_(this,Bt)[17]-r)/s} L${(_(this,Bt)[14]-e)/n} ${(_(this,Bt)[15]-r)/s} Z`},afe=function(e){const r=_(this,qo);e.push(`L${r[4]} ${r[5]} Z`)},ofe=function(e){const[r,n,s,i]=_(this,ma),o=_(this,Bt).subarray(4,6),l=_(this,Bt).subarray(16,18),[c,u,d,h]=ce(this,Zn,q0).call(this);e.push(`L${(o[0]-r)/s} ${(o[1]-n)/i} L${c} ${u} L${d} ${h} L${(l[0]-r)/s} ${(l[1]-n)/i}`)},lfe=function(e){const r=_(this,Bt),[n,s,i,o]=_(this,ma),[l,c,u,d]=ce(this,Zn,q0).call(this),h=new Float32Array(36);return h.set([NaN,NaN,NaN,NaN,(r[2]-n)/i,(r[3]-s)/o,NaN,NaN,NaN,NaN,(r[4]-n)/i,(r[5]-s)/o,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(r[16]-n)/i,(r[17]-s)/o,NaN,NaN,NaN,NaN,(r[14]-n)/i,(r[15]-s)/o],0),this.newFreeDrawOutline(h,e,_(this,ma),_(this,Yx),_(this,Gx),_(this,Kx))},cfe=function(e,r){const n=_(this,qo);return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],r),r+=6},ufe=function(e,r){const n=_(this,Bt).subarray(4,6),s=_(this,Bt).subarray(16,18),[i,o,l,c]=_(this,ma),[u,d,h,f]=ce(this,Zn,q0).call(this);return e.set([NaN,NaN,NaN,NaN,(n[0]-i)/l,(n[1]-o)/c,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,h,f,NaN,NaN,NaN,NaN,(s[0]-i)/l,(s[1]-o)/c],r),r+=24},se(Yc,dj,8),se(Yc,Mk,2),se(Yc,Dk,_(Yc,dj)+_(Yc,Mk));let mk=Yc;var Qx,dm,ju,hj,ga,fj,jn,Lk,hfe;class dfe extends lt{constructor(r,n,s,i,o,l){super();se(this,Lk);se(this,Qx);se(this,dm,new Float32Array(4));se(this,ju);se(this,hj);se(this,ga);se(this,fj);se(this,jn);Q(this,jn,r),Q(this,ga,n),Q(this,Qx,s),Q(this,fj,i),Q(this,ju,o),Q(this,hj,l),this.lastPoint=[NaN,NaN],ce(this,Lk,hfe).call(this,l);const[c,u,d,h]=_(this,dm);for(let f=0,p=r.length;f<p;f+=2)r[f]=(r[f]-c)/d,r[f+1]=(r[f+1]-u)/h;for(let f=0,p=n.length;f<p;f+=2)n[f]=(n[f]-c)/d,n[f+1]=(n[f+1]-u)/h}toSVGPath(){const r=[`M${_(this,jn)[4]} ${_(this,jn)[5]}`];for(let n=6,s=_(this,jn).length;n<s;n+=6){if(isNaN(_(this,jn)[n])){r.push(`L${_(this,jn)[n+4]} ${_(this,jn)[n+5]}`);continue}r.push(`C${_(this,jn)[n]} ${_(this,jn)[n+1]} ${_(this,jn)[n+2]} ${_(this,jn)[n+3]} ${_(this,jn)[n+4]} ${_(this,jn)[n+5]}`)}return r.push("Z"),r.join(" ")}serialize([r,n,s,i],o){const l=s-r,c=i-n;let u,d;switch(o){case 0:u=lt._rescale(_(this,jn),r,i,l,-c),d=lt._rescale(_(this,ga),r,i,l,-c);break;case 90:u=lt._rescaleAndSwap(_(this,jn),r,n,l,c),d=lt._rescaleAndSwap(_(this,ga),r,n,l,c);break;case 180:u=lt._rescale(_(this,jn),s,n,-l,c),d=lt._rescale(_(this,ga),s,n,-l,c);break;case 270:u=lt._rescaleAndSwap(_(this,jn),s,i,-l,-c),d=lt._rescaleAndSwap(_(this,ga),s,i,-l,-c);break}return{outline:Array.from(u),points:[Array.from(d)]}}get box(){return _(this,dm)}newOutliner(r,n,s,i,o,l=0){return new mk(r,n,s,i,o,l)}getNewOutline(r,n){const[s,i,o,l]=_(this,dm),[c,u,d,h]=_(this,Qx),f=o*d,p=l*h,g=s*d+c,m=i*h+u,x=this.newOutliner({x:_(this,ga)[0]*f+g,y:_(this,ga)[1]*p+m},_(this,Qx),_(this,fj),r,_(this,hj),n??_(this,ju));for(let y=2;y<_(this,ga).length;y+=2)x.add({x:_(this,ga)[y]*f+g,y:_(this,ga)[y+1]*p+m});return x.getOutlines()}}Qx=new WeakMap,dm=new WeakMap,ju=new WeakMap,hj=new WeakMap,ga=new WeakMap,fj=new WeakMap,jn=new WeakMap,Lk=new WeakSet,hfe=function(r){const n=_(this,jn);let s=n[4],i=n[5];const o=[s,i,s,i];let l=s,c=i;const u=r?Math.max:Math.min;for(let h=6,f=n.length;h<f;h+=6){const p=n[h+4],g=n[h+5];if(isNaN(n[h]))pt.pointBoundingBox(p,g,o),c<g?(l=p,c=g):c===g&&(l=u(l,p));else{const m=[1/0,1/0,-1/0,-1/0];pt.bezierBoundingBox(s,i,...n.slice(h,h+6),m),pt.rectBoundingBox(...m,o),c<m[3]?(l=m[2],c=m[3]):c===m[3]&&(l=u(l,m[2]))}s=p,i=g}const d=_(this,dm);d[0]=o[0]-_(this,ju),d[1]=o[1]-_(this,ju),d[2]=o[2]-o[0]+2*_(this,ju),d[3]=o[3]-o[1]+2*_(this,ju),this.lastPoint=[l,c]};var pj,mj,_h,Go,_i,ffe,JA,pfe,mfe,l3;class o3{constructor(e,r=0,n=0,s=!0){se(this,_i);se(this,pj);se(this,mj);se(this,_h,[]);se(this,Go,[]);const i=[1/0,1/0,-1/0,-1/0],l=10**-4;for(const{x:g,y:m,width:x,height:y}of e){const v=Math.floor((g-r)/l)*l,b=Math.ceil((g+x+r)/l)*l,w=Math.floor((m-r)/l)*l,j=Math.ceil((m+y+r)/l)*l,N=[v,w,j,!0],C=[b,w,j,!1];_(this,_h).push(N,C),pt.rectBoundingBox(v,w,b,j,i)}const c=i[2]-i[0]+2*n,u=i[3]-i[1]+2*n,d=i[0]-n,h=i[1]-n,f=_(this,_h).at(s?-1:-2),p=[f[0],f[2]];for(const g of _(this,_h)){const[m,x,y]=g;g[0]=(m-d)/c,g[1]=(x-h)/u,g[2]=(y-h)/u}Q(this,pj,new Float32Array([d,h,c,u])),Q(this,mj,p)}getOutlines(){_(this,_h).sort((r,n)=>r[0]-n[0]||r[1]-n[1]||r[2]-n[2]);const e=[];for(const r of _(this,_h))r[3]?(e.push(...ce(this,_i,l3).call(this,r)),ce(this,_i,pfe).call(this,r)):(ce(this,_i,mfe).call(this,r),e.push(...ce(this,_i,l3).call(this,r)));return ce(this,_i,ffe).call(this,e)}}pj=new WeakMap,mj=new WeakMap,_h=new WeakMap,Go=new WeakMap,_i=new WeakSet,ffe=function(e){const r=[],n=new Set;for(const o of e){const[l,c,u]=o;r.push([l,c,o],[l,u,o])}r.sort((o,l)=>o[1]-l[1]||o[0]-l[0]);for(let o=0,l=r.length;o<l;o+=2){const c=r[o][2],u=r[o+1][2];c.push(u),u.push(c),n.add(c),n.add(u)}const s=[];let i;for(;n.size>0;){const o=n.values().next().value;let[l,c,u,d,h]=o;n.delete(o);let f=l,p=c;for(i=[l,u],s.push(i);;){let g;if(n.has(d))g=d;else if(n.has(h))g=h;else break;n.delete(g),[l,c,u,d,h]=g,f!==l&&(i.push(f,p,l,p===c?c:u),f=l),p=p===c?u:c}i.push(f,p)}return new eut(s,_(this,pj),_(this,mj))},JA=function(e){const r=_(this,Go);let n=0,s=r.length-1;for(;n<=s;){const i=n+s>>1,o=r[i][0];if(o===e)return i;o<e?n=i+1:s=i-1}return s+1},pfe=function([,e,r]){const n=ce(this,_i,JA).call(this,e);_(this,Go).splice(n,0,[e,r])},mfe=function([,e,r]){const n=ce(this,_i,JA).call(this,e);for(let s=n;s<_(this,Go).length;s++){const[i,o]=_(this,Go)[s];if(i!==e)break;if(i===e&&o===r){_(this,Go).splice(s,1);return}}for(let s=n-1;s>=0;s--){const[i,o]=_(this,Go)[s];if(i!==e)break;if(i===e&&o===r){_(this,Go).splice(s,1);return}}},l3=function(e){const[r,n,s]=e,i=[[r,n,s]],o=ce(this,_i,JA).call(this,s);for(let l=0;l<o;l++){const[c,u]=_(this,Go)[l];for(let d=0,h=i.length;d<h;d++){const[,f,p]=i[d];if(!(u<=f||p<=c)){if(f>=c){if(p>u)i[d][1]=u;else{if(h===1)return[];i.splice(d,1),d--,h--}continue}i[d][2]=c,p>u&&i.push([r,u,p])}}}return i};var gj,Zx;class eut extends lt{constructor(r,n,s){super();se(this,gj);se(this,Zx);Q(this,Zx,r),Q(this,gj,n),this.lastPoint=s}toSVGPath(){const r=[];for(const n of _(this,Zx)){let[s,i]=n;r.push(`M${s} ${i}`);for(let o=2;o<n.length;o+=2){const l=n[o],c=n[o+1];l===s?(r.push(`V${c}`),i=c):c===i&&(r.push(`H${l}`),s=l)}r.push("Z")}return r.join(" ")}serialize([r,n,s,i],o){const l=[],c=s-r,u=i-n;for(const d of _(this,Zx)){const h=new Array(d.length);for(let f=0;f<d.length;f+=2)h[f]=r+d[f]*c,h[f+1]=i-d[f+1]*u;l.push(h)}return l}get box(){return _(this,gj)}get classNamesForOutlining(){return["highlightOutline"]}}gj=new WeakMap,Zx=new WeakMap;class c3 extends mk{newFreeDrawOutline(e,r,n,s,i,o){return new tut(e,r,n,s,i,o)}}class tut extends dfe{newOutliner(e,r,n,s,i,o=0){return new c3(e,r,n,s,i,o)}}var Jx,yj,Su,hm,xj,Di,vj,bj,fm,Ja,ya,bs,ev,Nu,Ks,tv,eo,wj,It,u3,eE,gfe,yfe,xfe,d3,Xf,lo,Kg,vfe,tE,G0,bfe,wfe,_fe,jfe,Sfe;const or=class or extends Rr{constructor(r){super({...r,name:"highlightEditor"});se(this,It);se(this,Jx,null);se(this,yj,0);se(this,Su);se(this,hm,null);se(this,xj,null);se(this,Di,null);se(this,vj,null);se(this,bj,0);se(this,fm,null);se(this,Ja,null);se(this,ya,null);se(this,bs,!1);se(this,ev,null);se(this,Nu);se(this,Ks,null);se(this,tv,"");se(this,eo);se(this,wj,"");this.color=r.color||or._defaultColor,Q(this,eo,r.thickness||or._defaultThickness),Q(this,Nu,r.opacity||or._defaultOpacity),Q(this,Su,r.boxes||null),Q(this,wj,r.methodOfCreation||""),Q(this,tv,r.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",r.highlightId>-1?(Q(this,bs,!0),ce(this,It,eE).call(this,r),ce(this,It,Xf).call(this)):_(this,Su)&&(Q(this,Jx,r.anchorNode),Q(this,yj,r.anchorOffset),Q(this,vj,r.focusNode),Q(this,bj,r.focusOffset),ce(this,It,u3).call(this),ce(this,It,Xf).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const r=or.prototype;return Ut(this,"_keyboardManager",new pS([[["ArrowLeft","mac+ArrowLeft"],r._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],r._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],r._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],r._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:_(this,bs)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:_(this,eo),methodOfCreation:_(this,wj)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}get commentColor(){return this.color}static computeTelemetryFinalData(r){return{numberOfColors:r.get("color").size}}static initialize(r,n){var s;Rr.initialize(r,n),or._defaultColor||(or._defaultColor=((s=n.highlightColors)==null?void 0:s.values().next().value)||"#fff066")}static updateDefaultParams(r,n){switch(r){case Kt.HIGHLIGHT_COLOR:or._defaultColor=n;break;case Kt.HIGHLIGHT_THICKNESS:or._defaultThickness=n;break}}translateInPage(r,n){}get toolbarPosition(){return _(this,ev)}updateParams(r,n){switch(r){case Kt.HIGHLIGHT_COLOR:ce(this,It,gfe).call(this,n);break;case Kt.HIGHLIGHT_THICKNESS:ce(this,It,yfe).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[Kt.HIGHLIGHT_COLOR,or._defaultColor],[Kt.HIGHLIGHT_THICKNESS,or._defaultThickness]]}get propertiesToUpdate(){return[[Kt.HIGHLIGHT_COLOR,this.color||or._defaultColor],[Kt.HIGHLIGHT_THICKNESS,_(this,eo)||or._defaultThickness],[Kt.HIGHLIGHT_FREE,_(this,bs)]]}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",Q(this,xj,new hk({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(ce(this,It,G0).call(this))}getBaseTranslation(){return[0,0]}getRect(r,n){return super.getRect(r,n,ce(this,It,G0).call(this))}onceAdded(r){this.annotationElementId||this.parent.addUndoableEditor(this),r&&this.div.focus()}remove(){ce(this,It,d3).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(ce(this,It,Xf).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(r){var s;let n=!1;this.parent&&!r?ce(this,It,d3).call(this):r&&(ce(this,It,Xf).call(this,r),n=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(r),this.show(this._isVisible),n&&this.select()}rotate(r){var i,o,l;const{drawLayer:n}=this.parent;let s;_(this,bs)?(r=(r-this.rotation+360)%360,s=ce(i=or,lo,Kg).call(i,_(this,Ja).box,r)):s=ce(o=or,lo,Kg).call(o,[this.x,this.y,this.width,this.height],r),n.updateProperties(_(this,ya),{bbox:s,root:{"data-main-rotation":r}}),n.updateProperties(_(this,Ks),{bbox:ce(l=or,lo,Kg).call(l,_(this,Di).box,r),root:{"data-main-rotation":r}})}render(){if(this.div)return this.div;const r=super.render();_(this,tv)&&(r.setAttribute("aria-label",_(this,tv)),r.setAttribute("role","mark")),_(this,bs)?r.classList.add("free"):this.div.addEventListener("keydown",ce(this,It,vfe).bind(this),{signal:this._uiManager._signal});const n=Q(this,fm,document.createElement("div"));r.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",n.style.clipPath=_(this,hm);const[s,i]=this.parentDimensions;return this.setDims(this.width*s,this.height*i),Hde(this,_(this,fm),["pointerover","pointerleave"]),this.enableEditing(),r}pointerover(){var r;this.isSelected||(r=this.parent)==null||r.drawLayer.updateProperties(_(this,Ks),{rootClass:{hovered:!0}})}pointerleave(){var r;this.isSelected||(r=this.parent)==null||r.drawLayer.updateProperties(_(this,Ks),{rootClass:{hovered:!1}})}_moveCaret(r){switch(this.parent.unselect(this),r){case 0:case 2:ce(this,It,tE).call(this,!0);break;case 1:case 3:ce(this,It,tE).call(this,!1);break}}select(){var r;super.select(),_(this,Ks)&&((r=this.parent)==null||r.drawLayer.updateProperties(_(this,Ks),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var r;super.unselect(),_(this,Ks)&&((r=this.parent)==null||r.drawLayer.updateProperties(_(this,Ks),{rootClass:{selected:!1}}),_(this,bs)||ce(this,It,tE).call(this,!1))}get _mustFixPosition(){return!_(this,bs)}show(r=this._isVisible){super.show(r),this.parent&&(this.parent.drawLayer.updateProperties(_(this,ya),{rootClass:{hidden:!r}}),this.parent.drawLayer.updateProperties(_(this,Ks),{rootClass:{hidden:!r}}))}static startHighlighting(r,n,{target:s,x:i,y:o}){const{x:l,y:c,width:u,height:d}=s.getBoundingClientRect(),h=new AbortController,f=r.combinedSignal(h),p=g=>{h.abort(),ce(this,lo,jfe).call(this,r,g)};window.addEventListener("blur",p,{signal:f}),window.addEventListener("pointerup",p,{signal:f}),window.addEventListener("pointerdown",Mn,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",So,{signal:f}),s.addEventListener("pointermove",ce(this,lo,_fe).bind(this,r),{signal:f}),this._freeHighlight=new c3({x:i,y:o},[l,c,u,d],r.scale,this._defaultThickness/2,n,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=r.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(r,n,s){var m,x,y,v;let i=null;if(r instanceof Zhe){const{data:{quadPoints:b,rect:w,rotation:j,id:N,color:C,opacity:k,popupRef:E,contentsObj:M},parent:{page:{pageNumber:z}}}=r;i=r={annotationType:kt.HIGHLIGHT,color:Array.from(C),opacity:k,quadPoints:b,boxes:null,pageIndex:z-1,rect:w.slice(0),rotation:j,annotationElementId:N,id:N,deleted:!1,popupRef:E,comment:(M==null?void 0:M.str)||null}}else if(r instanceof rB){const{data:{inkLists:b,rect:w,rotation:j,id:N,color:C,borderStyle:{rawWidth:k},popupRef:E,contentsObj:M},parent:{page:{pageNumber:z}}}=r;i=r={annotationType:kt.HIGHLIGHT,color:Array.from(C),thickness:k,inkLists:b,boxes:null,pageIndex:z-1,rect:w.slice(0),rotation:j,annotationElementId:N,id:N,deleted:!1,popupRef:E,comment:(M==null?void 0:M.str)||null}}const{color:o,quadPoints:l,inkLists:c,opacity:u}=r,d=await super.deserialize(r,n,s);d.color=pt.makeHexColor(...o),Q(d,Nu,u||1),c&&Q(d,eo,r.thickness),d._initialData=i,r.comment&&d.setCommentData(r.comment);const[h,f]=d.pageDimensions,[p,g]=d.pageTranslation;if(l){const b=Q(d,Su,[]);for(let w=0;w<l.length;w+=8)b.push({x:(l[w]-p)/h,y:1-(l[w+1]-g)/f,width:(l[w+2]-l[w])/h,height:(l[w+1]-l[w+5])/f});ce(m=d,It,u3).call(m),ce(x=d,It,Xf).call(x),d.rotate(d.rotation)}else if(c){Q(d,bs,!0);const b=c[0],w={x:b[0]-p,y:f-(b[1]-g)},j=new c3(w,[0,0,h,f],1,_(d,eo)/2,!0,.001);for(let k=0,E=b.length;k<E;k+=2)w.x=b[k]-p,w.y=f-(b[k+1]-g),j.add(w);const{id:N,clipPathId:C}=n.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:d.color,"fill-opacity":d._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:j.toSVGPath()}},!0,!0);ce(y=d,It,eE).call(y,{highlightOutlines:j.getOutlines(),highlightId:N,clipPathId:C}),ce(v=d,It,Xf).call(v),d.rotate(d.parentRotation)}return d}serialize(r=!1){if(this.isEmpty()||r)return null;if(this.deleted)return this.serializeDeleted();const n=this.getRect(0,0),s=Rr._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i={annotationType:kt.HIGHLIGHT,color:s,opacity:_(this,Nu),thickness:_(this,eo),quadPoints:ce(this,It,bfe).call(this),outlines:ce(this,It,wfe).call(this,n),pageIndex:this.pageIndex,rect:n,rotation:ce(this,It,G0).call(this),structTreeParentId:this._structTreeParentId};return this.addComment(i),this.annotationElementId&&!ce(this,It,Sfe).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(r){const n={rect:this.getRect(0,0)};return this.hasEditedComment&&(n.popup=this.comment),r.updateEdited(n),null}static canCreateNewEmptyEditor(){return!1}};Jx=new WeakMap,yj=new WeakMap,Su=new WeakMap,hm=new WeakMap,xj=new WeakMap,Di=new WeakMap,vj=new WeakMap,bj=new WeakMap,fm=new WeakMap,Ja=new WeakMap,ya=new WeakMap,bs=new WeakMap,ev=new WeakMap,Nu=new WeakMap,Ks=new WeakMap,tv=new WeakMap,eo=new WeakMap,wj=new WeakMap,It=new WeakSet,u3=function(){const r=new o3(_(this,Su),.001);Q(this,Ja,r.getOutlines()),[this.x,this.y,this.width,this.height]=_(this,Ja).box;const n=new o3(_(this,Su),.0025,.001,this._uiManager.direction==="ltr");Q(this,Di,n.getOutlines());const{lastPoint:s}=_(this,Di);Q(this,ev,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])},eE=function({highlightOutlines:r,highlightId:n,clipPathId:s}){var h,f;if(Q(this,Ja,r),Q(this,Di,r.getNewOutline(_(this,eo)/2+1.5,.0025)),n>=0)Q(this,ya,n),Q(this,hm,s),this.parent.drawLayer.finalizeDraw(n,{bbox:r.box,path:{d:r.toSVGPath()}}),Q(this,Ks,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:_(this,Di).box,path:{d:_(this,Di).toSVGPath()}},!0));else if(this.parent){const p=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(_(this,ya),{bbox:ce(h=or,lo,Kg).call(h,_(this,Ja).box,(p-this.rotation+360)%360),path:{d:r.toSVGPath()}}),this.parent.drawLayer.updateProperties(_(this,Ks),{bbox:ce(f=or,lo,Kg).call(f,_(this,Di).box,p),path:{d:_(this,Di).toSVGPath()}})}const[o,l,c,u]=r.box;switch(this.rotation){case 0:this.x=o,this.y=l,this.width=c,this.height=u;break;case 90:{const[p,g]=this.parentDimensions;this.x=l,this.y=1-o,this.width=c*g/p,this.height=u*p/g;break}case 180:this.x=1-o,this.y=1-l,this.width=c,this.height=u;break;case 270:{const[p,g]=this.parentDimensions;this.x=1-l,this.y=o,this.width=c*g/p,this.height=u*p/g;break}}const{lastPoint:d}=_(this,Di);Q(this,ev,[(d[0]-o)/c,(d[1]-l)/u])},gfe=function(r){const n=(o,l)=>{var c,u;this.color=o,Q(this,Nu,l),(c=this.parent)==null||c.drawLayer.updateProperties(_(this,ya),{root:{fill:o,"fill-opacity":l}}),(u=_(this,xj))==null||u.updateColor(o)},s=this.color,i=_(this,Nu);this.addCommands({cmd:n.bind(this,r,or._defaultOpacity),undo:n.bind(this,s,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Kt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(r)},!0)},yfe=function(r){const n=_(this,eo),s=i=>{Q(this,eo,i),ce(this,It,xfe).call(this,i)};this.addCommands({cmd:s.bind(this,r),undo:s.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Kt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:r},!0)},xfe=function(r){if(!_(this,bs))return;ce(this,It,eE).call(this,{highlightOutlines:_(this,Ja).getNewOutline(r/2)}),this.fixAndSetPosition();const[n,s]=this.parentDimensions;this.setDims(this.width*n,this.height*s)},d3=function(){_(this,ya)===null||!this.parent||(this.parent.drawLayer.remove(_(this,ya)),Q(this,ya,null),this.parent.drawLayer.remove(_(this,Ks)),Q(this,Ks,null))},Xf=function(r=this.parent){_(this,ya)===null&&({id:ns(this,ya)._,clipPathId:ns(this,hm)._}=r.drawLayer.draw({bbox:_(this,Ja).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":_(this,Nu)},rootClass:{highlight:!0,free:_(this,bs)},path:{d:_(this,Ja).toSVGPath()}},!1,!0),Q(this,Ks,r.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:_(this,bs)},bbox:_(this,Di).box,path:{d:_(this,Di).toSVGPath()}},_(this,bs))),_(this,fm)&&(_(this,fm).style.clipPath=_(this,hm)))},lo=new WeakSet,Kg=function([r,n,s,i],o){switch(o){case 90:return[1-n-i,r,i,s];case 180:return[1-r-s,1-n-i,s,i];case 270:return[n,1-r-s,i,s]}return[r,n,s,i]},vfe=function(r){or._keyboardManager.exec(this,r)},tE=function(r){if(!_(this,Jx))return;const n=window.getSelection();r?n.setPosition(_(this,Jx),_(this,yj)):n.setPosition(_(this,vj),_(this,bj))},G0=function(){return _(this,bs)?this.rotation:0},bfe=function(){if(_(this,bs))return null;const[r,n]=this.pageDimensions,[s,i]=this.pageTranslation,o=_(this,Su),l=new Float32Array(o.length*8);let c=0;for(const{x:u,y:d,width:h,height:f}of o){const p=u*r+s,g=(1-d)*n+i;l[c]=l[c+4]=p,l[c+1]=l[c+3]=g,l[c+2]=l[c+6]=p+h*r,l[c+5]=l[c+7]=g-f*n,c+=8}return l},wfe=function(r){return _(this,Ja).serialize(r,ce(this,It,G0).call(this))},_fe=function(r,n){this._freeHighlight.add(n)&&r.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},jfe=function(r,n){this._freeHighlight.isEmpty()?r.drawLayer.remove(this._freeHighlightId):r.createAndAddNewEditor(n,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},Sfe=function(r){const{color:n}=this._initialData;return this.hasEditedComment||r.color.some((s,i)=>s!==n[i])},se(or,lo),Le(or,"_defaultColor",null),Le(or,"_defaultOpacity",1),Le(or,"_defaultThickness",12),Le(or,"_type","highlight"),Le(or,"_editorType",kt.HIGHLIGHT),Le(or,"_freeHighlightId",-1),Le(or,"_freeHighlight",null),Le(or,"_freeHighlightClipId","");let gk=or;var pm;class Nfe{constructor(){se(this,pm,Object.create(null))}updateProperty(e,r){this[e]=r,this.updateSVGProperty(e,r)}updateProperties(e){if(e)for(const[r,n]of Object.entries(e))r.startsWith("_")||this.updateProperty(r,n)}updateSVGProperty(e,r){_(this,pm)[e]=r}toSVGProperties(){const e=_(this,pm);return Q(this,pm,Object.create(null)),{root:e}}reset(){Q(this,pm,Object.create(null))}updateAll(e=this){this.updateProperties(e)}clone(){_r("Not implemented")}}pm=new WeakMap;var xa,rv,as,mm,gm,jh,Sh,Nh,ym,rr,h3,f3,p3,K0,Afe,rE,Y0,Yg;const dt=class dt extends Rr{constructor(r){super(r);se(this,rr);se(this,xa,null);se(this,rv);Le(this,"_colorPicker",null);Le(this,"_drawId",null);Q(this,rv,r.mustBeCommitted||!1),this._addOutlines(r)}_addOutlines(r){r.drawOutlines&&(ce(this,rr,h3).call(this,r),ce(this,rr,K0).call(this))}static _mergeSVGProperties(r,n){const s=new Set(Object.keys(r));for(const[i,o]of Object.entries(n))s.has(i)?Object.assign(r[i],o):r[i]=o;return r}static getDefaultDrawingOptions(r){_r("Not implemented")}static get typesMap(){_r("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(r,n){const s=this.typesMap.get(r);s&&this._defaultDrawingOptions.updateProperty(s,n),this._currentParent&&(_(dt,as).updateProperty(s,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(r,n){const s=this.constructor.typesMap.get(r);s&&this._updateProperty(r,s,n)}static get defaultPropertiesToUpdate(){const r=[],n=this._defaultDrawingOptions;for(const[s,i]of this.typesMap)r.push([s,n[i]]);return r}get propertiesToUpdate(){const r=[],{_drawingOptions:n}=this;for(const[s,i]of this.constructor.typesMap)r.push([s,n[i]]);return r}_updateProperty(r,n,s){const i=this._drawingOptions,o=i[n],l=c=>{var d,h;i.updateProperty(n,c);const u=_(this,xa).updateProperty(n,c);u&&ce(this,rr,Y0).call(this,u),(d=this.parent)==null||d.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),r===this.colorType&&((h=this._colorPicker)==null||h.update(c))};this.addCommands({cmd:l.bind(this,s),undo:l.bind(this,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:r,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var r;(r=this.parent)==null||r.drawLayer.updateProperties(this._drawId,dt._mergeSVGProperties(_(this,xa).getPathResizingSVGProperties(ce(this,rr,rE).call(this)),{bbox:ce(this,rr,Yg).call(this)}))}_onResized(){var r;(r=this.parent)==null||r.drawLayer.updateProperties(this._drawId,dt._mergeSVGProperties(_(this,xa).getPathResizedSVGProperties(ce(this,rr,rE).call(this)),{bbox:ce(this,rr,Yg).call(this)}))}_onTranslating(r,n){var s;(s=this.parent)==null||s.drawLayer.updateProperties(this._drawId,{bbox:ce(this,rr,Yg).call(this)})}_onTranslated(){var r;(r=this.parent)==null||r.drawLayer.updateProperties(this._drawId,dt._mergeSVGProperties(_(this,xa).getPathTranslatedSVGProperties(ce(this,rr,rE).call(this),this.parentDimensions),{bbox:ce(this,rr,Yg).call(this)}))}_onStartDragging(){var r;(r=this.parent)==null||r.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var r;(r=this.parent)==null||r.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(r){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,_(this,rv)&&(Q(this,rv,!1),this.commit(),this.parent.setSelected(this),r&&this.isOnScreen&&this.div.focus())}remove(){ce(this,rr,p3).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(ce(this,rr,K0).call(this),ce(this,rr,Y0).call(this,_(this,xa).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(r){var s;let n=!1;this.parent&&!r?(this._uiManager.removeShouldRescale(this),ce(this,rr,p3).call(this)):r&&(this._uiManager.addShouldRescale(this),ce(this,rr,K0).call(this,r),n=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(r),n&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,dt._mergeSVGProperties({bbox:ce(this,rr,Yg).call(this)},_(this,xa).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&ce(this,rr,Y0).call(this,_(this,xa).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let r,n;this._isCopy&&(r=this.x,n=this.y);const s=super.render();s.classList.add("draw");const i=document.createElement("div");s.append(i),i.setAttribute("aria-hidden","true"),i.className="internal";const[o,l]=this.parentDimensions;return this.setDims(this.width*o,this.height*l),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(r,n),s}static createDrawerInstance(r,n,s,i,o){_r("Not implemented")}static startDrawing(r,n,s,i){var x;const{target:o,offsetX:l,offsetY:c,pointerId:u,pointerType:d}=i;if(_(dt,Sh)&&_(dt,Sh)!==d)return;const{viewport:{rotation:h}}=r,{width:f,height:p}=o.getBoundingClientRect(),g=Q(dt,mm,new AbortController),m=r.combinedSignal(g);if(_(dt,jh)||Q(dt,jh,u),_(dt,Sh)??Q(dt,Sh,d),window.addEventListener("pointerup",y=>{var v;_(dt,jh)===y.pointerId?this._endDraw(y):(v=_(dt,Nh))==null||v.delete(y.pointerId)},{signal:m}),window.addEventListener("pointercancel",y=>{var v;_(dt,jh)===y.pointerId?this._currentParent.endDrawingSession():(v=_(dt,Nh))==null||v.delete(y.pointerId)},{signal:m}),window.addEventListener("pointerdown",y=>{_(dt,Sh)===y.pointerType&&((_(dt,Nh)||Q(dt,Nh,new Set)).add(y.pointerId),_(dt,as).isCancellable()&&(_(dt,as).removeLastElement(),_(dt,as).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",So,{signal:m}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:m}),o.addEventListener("touchmove",y=>{y.timeStamp===_(dt,ym)&&Mn(y)},{signal:m}),r.toggleDrawing(),(x=n._editorUndoBar)==null||x.hide(),_(dt,as)){r.drawLayer.updateProperties(this._currentDrawId,_(dt,as).startNew(l,c,f,p,h));return}n.updateUIForDefaultProperties(this),Q(dt,as,this.createDrawerInstance(l,c,f,p,h)),Q(dt,gm,this.getDefaultDrawingOptions()),this._currentParent=r,{id:this._currentDrawId}=r.drawLayer.draw(this._mergeSVGProperties(_(dt,gm).toSVGProperties(),_(dt,as).defaultSVGProperties),!0,!1)}static _drawMove(r){var o;if(Q(dt,ym,-1),!_(dt,as))return;const{offsetX:n,offsetY:s,pointerId:i}=r;if(_(dt,jh)===i){if(((o=_(dt,Nh))==null?void 0:o.size)>=1){this._endDraw(r);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,_(dt,as).add(n,s)),Q(dt,ym,r.timeStamp),Mn(r)}}static _cleanup(r){r&&(this._currentDrawId=-1,this._currentParent=null,Q(dt,as,null),Q(dt,gm,null),Q(dt,Sh,null),Q(dt,ym,NaN)),_(dt,mm)&&(_(dt,mm).abort(),Q(dt,mm,null),Q(dt,jh,NaN),Q(dt,Nh,null))}static _endDraw(r){const n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),(r==null?void 0:r.target)===n.div&&n.drawLayer.updateProperties(this._currentDrawId,_(dt,as).end(r.offsetX,r.offsetY)),this.supportMultipleDrawings){const s=_(dt,as),i=this._currentDrawId,o=s.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(i,s.setLastElement(o))},undo:()=>{n.drawLayer.updateProperties(i,s.removeLastElement())},mustExec:!1,type:Kt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(r){const n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(Kt.DRAW_STEP),!_(dt,as).isEmpty()){const{pageDimensions:[s,i],scale:o}=n,l=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:_(dt,as).getOutlines(s*o,i*o,o,this._INNER_MARGIN),drawingOptions:_(dt,gm),mustBeCommitted:!r});return this._cleanup(!0),l}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(r){}static deserializeDraw(r,n,s,i,o,l){_r("Not implemented")}static async deserialize(r,n,s){var h,f;const{rawDims:{pageWidth:i,pageHeight:o,pageX:l,pageY:c}}=n.viewport,u=this.deserializeDraw(l,c,i,o,this._INNER_MARGIN,r),d=await super.deserialize(r,n,s);return d.createDrawingOptions(r),ce(h=d,rr,h3).call(h,{drawOutlines:u}),ce(f=d,rr,K0).call(f),d.onScaleChanging(),d.rotate(),d}serializeDraw(r){const[n,s]=this.pageTranslation,[i,o]=this.pageDimensions;return _(this,xa).serialize([n,s,i,o],r)}renderAnnotationElement(r){return r.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};xa=new WeakMap,rv=new WeakMap,as=new WeakMap,mm=new WeakMap,gm=new WeakMap,jh=new WeakMap,Sh=new WeakMap,Nh=new WeakMap,ym=new WeakMap,rr=new WeakSet,h3=function({drawOutlines:r,drawId:n,drawingOptions:s}){Q(this,xa,r),this._drawingOptions||(this._drawingOptions=s),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),n>=0?(this._drawId=n,this.parent.drawLayer.finalizeDraw(n,r.defaultProperties)):this._drawId=ce(this,rr,f3).call(this,r,this.parent),ce(this,rr,Y0).call(this,r.box)},f3=function(r,n){const{id:s}=n.drawLayer.draw(dt._mergeSVGProperties(this._drawingOptions.toSVGProperties(),r.defaultSVGProperties),!1,!1);return s},p3=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},K0=function(r=this.parent){if(!(this._drawId!==null&&this.parent===r)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,r.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=ce(this,rr,f3).call(this,_(this,xa),r)}},Afe=function([r,n,s,i]){const{parentDimensions:[o,l],rotation:c}=this;switch(c){case 90:return[n,1-r,s*(l/o),i*(o/l)];case 180:return[1-r,1-n,s,i];case 270:return[1-n,r,s*(l/o),i*(o/l)];default:return[r,n,s,i]}},rE=function(){const{x:r,y:n,width:s,height:i,parentDimensions:[o,l],rotation:c}=this;switch(c){case 90:return[1-n,r,s*(o/l),i*(l/o)];case 180:return[1-r,1-n,s,i];case 270:return[n,1-r,s*(o/l),i*(l/o)];default:return[r,n,s,i]}},Y0=function(r){if([this.x,this.y,this.width,this.height]=ce(this,rr,Afe).call(this,r),this.div){this.fixAndSetPosition();const[n,s]=this.parentDimensions;this.setDims(this.width*n,this.height*s)}this._onResized()},Yg=function(){const{x:r,y:n,width:s,height:i,rotation:o,parentRotation:l,parentDimensions:[c,u]}=this;switch((o*4+l)/90){case 1:return[1-n-i,r,i,s];case 2:return[1-r-s,1-n-i,s,i];case 3:return[n,1-r-s,i,s];case 4:return[r,n-s*(c/u),i*(u/c),s*(c/u)];case 5:return[1-n,r,s*(c/u),i*(u/c)];case 6:return[1-r-i*(u/c),1-n,i*(u/c),s*(c/u)];case 7:return[n-s*(c/u),1-r-i*(u/c),s*(c/u),i*(u/c)];case 8:return[r-s,n-i,s,i];case 9:return[1-n,r-s,i,s];case 10:return[1-r,1-n,s,i];case 11:return[n-i,1-r,i,s];case 12:return[r-i*(u/c),n,i*(u/c),s*(c/u)];case 13:return[1-n-s*(c/u),r-i*(u/c),s*(c/u),i*(u/c)];case 14:return[1-r,1-n-s*(c/u),i*(u/c),s*(c/u)];case 15:return[n,1-r,s*(c/u),i*(u/c)];default:return[r,n,s,i]}},Le(dt,"_currentDrawId",-1),Le(dt,"_currentParent",null),se(dt,as,null),se(dt,mm,null),se(dt,gm,null),se(dt,jh,NaN),se(dt,Sh,null),se(dt,Nh,null),se(dt,ym,NaN),Le(dt,"_INNER_MARGIN",3);let yk=dt;var Xl,os,ls,xm,nv,di,ws,to,vm,bm,wm,sv,nE;class rut{constructor(e,r,n,s,i,o){se(this,sv);se(this,Xl,new Float64Array(6));se(this,os);se(this,ls);se(this,xm);se(this,nv);se(this,di);se(this,ws,"");se(this,to,0);se(this,vm,new gS);se(this,bm);se(this,wm);Q(this,bm,n),Q(this,wm,s),Q(this,xm,i),Q(this,nv,o),[e,r]=ce(this,sv,nE).call(this,e,r);const l=Q(this,os,[NaN,NaN,NaN,NaN,e,r]);Q(this,di,[e,r]),Q(this,ls,[{line:l,points:_(this,di)}]),_(this,Xl).set(l,0)}updateProperty(e,r){e==="stroke-width"&&Q(this,nv,r)}isEmpty(){return!_(this,ls)||_(this,ls).length===0}isCancellable(){return _(this,di).length<=10}add(e,r){[e,r]=ce(this,sv,nE).call(this,e,r);const[n,s,i,o]=_(this,Xl).subarray(2,6),l=e-i,c=r-o;return Math.hypot(_(this,bm)*l,_(this,wm)*c)<=2?null:(_(this,di).push(e,r),isNaN(n)?(_(this,Xl).set([i,o,e,r],2),_(this,os).push(NaN,NaN,NaN,NaN,e,r),{path:{d:this.toSVGPath()}}):(isNaN(_(this,Xl)[0])&&_(this,os).splice(6,6),_(this,Xl).set([n,s,i,o,e,r],0),_(this,os).push(...lt.createBezierPoints(n,s,i,o,e,r)),{path:{d:this.toSVGPath()}}))}end(e,r){const n=this.add(e,r);return n||(_(this,di).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,r,n,s,i){Q(this,bm,n),Q(this,wm,s),Q(this,xm,i),[e,r]=ce(this,sv,nE).call(this,e,r);const o=Q(this,os,[NaN,NaN,NaN,NaN,e,r]);Q(this,di,[e,r]);const l=_(this,ls).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),_(this,ls).push({line:o,points:_(this,di)}),_(this,Xl).set(o,0),Q(this,to,0),this.toSVGPath(),null}getLastElement(){return _(this,ls).at(-1)}setLastElement(e){return _(this,ls)?(_(this,ls).push(e),Q(this,os,e.line),Q(this,di,e.points),Q(this,to,0),{path:{d:this.toSVGPath()}}):_(this,vm).setLastElement(e)}removeLastElement(){if(!_(this,ls))return _(this,vm).removeLastElement();_(this,ls).pop(),Q(this,ws,"");for(let e=0,r=_(this,ls).length;e<r;e++){const{line:n,points:s}=_(this,ls)[e];Q(this,os,n),Q(this,di,s),Q(this,to,0),this.toSVGPath()}return{path:{d:_(this,ws)}}}toSVGPath(){const e=lt.svgRound(_(this,os)[4]),r=lt.svgRound(_(this,os)[5]);if(_(this,di).length===2)return Q(this,ws,`${_(this,ws)} M ${e} ${r} Z`),_(this,ws);if(_(this,di).length<=6){const s=_(this,ws).lastIndexOf("M");Q(this,ws,`${_(this,ws).slice(0,s)} M ${e} ${r}`),Q(this,to,6)}if(_(this,di).length===4){const s=lt.svgRound(_(this,os)[10]),i=lt.svgRound(_(this,os)[11]);return Q(this,ws,`${_(this,ws)} L ${s} ${i}`),Q(this,to,12),_(this,ws)}const n=[];_(this,to)===0&&(n.push(`M ${e} ${r}`),Q(this,to,6));for(let s=_(this,to),i=_(this,os).length;s<i;s+=6){const[o,l,c,u,d,h]=_(this,os).slice(s,s+6).map(lt.svgRound);n.push(`C${o} ${l} ${c} ${u} ${d} ${h}`)}return Q(this,ws,_(this,ws)+n.join(" ")),Q(this,to,_(this,os).length),_(this,ws)}getOutlines(e,r,n,s){const i=_(this,ls).at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),_(this,vm).build(_(this,ls),e,r,n,_(this,xm),_(this,nv),s),Q(this,Xl,null),Q(this,os,null),Q(this,ls,null),Q(this,ws,null),_(this,vm)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}Xl=new WeakMap,os=new WeakMap,ls=new WeakMap,xm=new WeakMap,nv=new WeakMap,di=new WeakMap,ws=new WeakMap,to=new WeakMap,vm=new WeakMap,bm=new WeakMap,wm=new WeakMap,sv=new WeakSet,nE=function(e,r){return lt._normalizePoint(e,r,_(this,bm),_(this,wm),_(this,xm))};var hi,_j,jj,va,Ql,Zl,iv,av,_m,As,zc,Efe,Cfe,kfe;class gS extends lt{constructor(){super(...arguments);se(this,As);se(this,hi);se(this,_j,0);se(this,jj);se(this,va);se(this,Ql);se(this,Zl);se(this,iv);se(this,av);se(this,_m)}build(r,n,s,i,o,l,c){Q(this,Ql,n),Q(this,Zl,s),Q(this,iv,i),Q(this,av,o),Q(this,_m,l),Q(this,jj,c??0),Q(this,va,r),ce(this,As,Cfe).call(this)}get thickness(){return _(this,_m)}setLastElement(r){return _(this,va).push(r),{path:{d:this.toSVGPath()}}}removeLastElement(){return _(this,va).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const r=[];for(const{line:n}of _(this,va)){if(r.push(`M${lt.svgRound(n[4])} ${lt.svgRound(n[5])}`),n.length===6){r.push("Z");continue}if(n.length===12&&isNaN(n[6])){r.push(`L${lt.svgRound(n[10])} ${lt.svgRound(n[11])}`);continue}for(let s=6,i=n.length;s<i;s+=6){const[o,l,c,u,d,h]=n.subarray(s,s+6).map(lt.svgRound);r.push(`C${o} ${l} ${c} ${u} ${d} ${h}`)}}return r.join("")}serialize([r,n,s,i],o){const l=[],c=[],[u,d,h,f]=ce(this,As,Efe).call(this);let p,g,m,x,y,v,b,w,j;switch(_(this,av)){case 0:j=lt._rescale,p=r,g=n+i,m=s,x=-i,y=r+u*s,v=n+(1-d-f)*i,b=r+(u+h)*s,w=n+(1-d)*i;break;case 90:j=lt._rescaleAndSwap,p=r,g=n,m=s,x=i,y=r+d*s,v=n+u*i,b=r+(d+f)*s,w=n+(u+h)*i;break;case 180:j=lt._rescale,p=r+s,g=n,m=-s,x=i,y=r+(1-u-h)*s,v=n+d*i,b=r+(1-u)*s,w=n+(d+f)*i;break;case 270:j=lt._rescaleAndSwap,p=r+s,g=n+i,m=-s,x=-i,y=r+(1-d-f)*s,v=n+(1-u-h)*i,b=r+(1-d)*s,w=n+(1-u)*i;break}for(const{line:N,points:C}of _(this,va))l.push(j(N,p,g,m,x,o?new Array(N.length):null)),c.push(j(C,p,g,m,x,o?new Array(C.length):null));return{lines:l,points:c,rect:[y,v,b,w]}}static deserialize(r,n,s,i,o,{paths:{lines:l,points:c},rotation:u,thickness:d}){const h=[];let f,p,g,m,x;switch(u){case 0:x=lt._rescale,f=-r/s,p=n/i+1,g=1/s,m=-1/i;break;case 90:x=lt._rescaleAndSwap,f=-n/i,p=-r/s,g=1/i,m=1/s;break;case 180:x=lt._rescale,f=r/s+1,p=-n/i,g=-1/s,m=1/i;break;case 270:x=lt._rescaleAndSwap,f=n/i+1,p=r/s+1,g=-1/i,m=-1/s;break}if(!l){l=[];for(const v of c){const b=v.length;if(b===2){l.push(new Float32Array([NaN,NaN,NaN,NaN,v[0],v[1]]));continue}if(b===4){l.push(new Float32Array([NaN,NaN,NaN,NaN,v[0],v[1],NaN,NaN,NaN,NaN,v[2],v[3]]));continue}const w=new Float32Array(3*(b-2));l.push(w);let[j,N,C,k]=v.subarray(0,4);w.set([NaN,NaN,NaN,NaN,j,N],0);for(let E=4;E<b;E+=2){const M=v[E],z=v[E+1];w.set(lt.createBezierPoints(j,N,C,k,M,z),(E-2)*3),[j,N,C,k]=[C,k,M,z]}}}for(let v=0,b=l.length;v<b;v++)h.push({line:x(l[v].map(w=>w??NaN),f,p,g,m),points:x(c[v].map(w=>w??NaN),f,p,g,m)});const y=new this.prototype.constructor;return y.build(h,s,i,1,u,d,o),y}get box(){return _(this,hi)}updateProperty(r,n){return r==="stroke-width"?ce(this,As,kfe).call(this,n):null}updateParentDimensions([r,n],s){const[i,o]=ce(this,As,zc).call(this);Q(this,Ql,r),Q(this,Zl,n),Q(this,iv,s);const[l,c]=ce(this,As,zc).call(this),u=l-i,d=c-o,h=_(this,hi);return h[0]-=u,h[1]-=d,h[2]+=2*u,h[3]+=2*d,h}updateRotation(r){return Q(this,_j,r),{path:{transform:this.rotationTransform}}}get viewBox(){return _(this,hi).map(lt.svgRound).join(" ")}get defaultProperties(){const[r,n]=_(this,hi);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${lt.svgRound(r)} ${lt.svgRound(n)}`}}}get rotationTransform(){const[,,r,n]=_(this,hi);let s=0,i=0,o=0,l=0,c=0,u=0;switch(_(this,_j)){case 90:i=n/r,o=-r/n,c=r;break;case 180:s=-1,l=-1,c=r,u=n;break;case 270:i=-n/r,o=r/n,u=n;break;default:return""}return`matrix(${s} ${i} ${o} ${l} ${lt.svgRound(c)} ${lt.svgRound(u)})`}getPathResizingSVGProperties([r,n,s,i]){const[o,l]=ce(this,As,zc).call(this),[c,u,d,h]=_(this,hi);if(Math.abs(d-o)<=lt.PRECISION||Math.abs(h-l)<=lt.PRECISION){const x=r+s/2-(c+d/2),y=n+i/2-(u+h/2);return{path:{"transform-origin":`${lt.svgRound(r)} ${lt.svgRound(n)}`,transform:`${this.rotationTransform} translate(${x} ${y})`}}}const f=(s-2*o)/(d-2*o),p=(i-2*l)/(h-2*l),g=d/s,m=h/i;return{path:{"transform-origin":`${lt.svgRound(c)} ${lt.svgRound(u)}`,transform:`${this.rotationTransform} scale(${g} ${m}) translate(${lt.svgRound(o)} ${lt.svgRound(l)}) scale(${f} ${p}) translate(${lt.svgRound(-o)} ${lt.svgRound(-l)})`}}}getPathResizedSVGProperties([r,n,s,i]){const[o,l]=ce(this,As,zc).call(this),c=_(this,hi),[u,d,h,f]=c;if(c[0]=r,c[1]=n,c[2]=s,c[3]=i,Math.abs(h-o)<=lt.PRECISION||Math.abs(f-l)<=lt.PRECISION){const y=r+s/2-(u+h/2),v=n+i/2-(d+f/2);for(const{line:b,points:w}of _(this,va))lt._translate(b,y,v,b),lt._translate(w,y,v,w);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${lt.svgRound(r)} ${lt.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const p=(s-2*o)/(h-2*o),g=(i-2*l)/(f-2*l),m=-p*(u+o)+r+o,x=-g*(d+l)+n+l;if(p!==1||g!==1||m!==0||x!==0)for(const{line:y,points:v}of _(this,va))lt._rescale(y,m,x,p,g,y),lt._rescale(v,m,x,p,g,v);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${lt.svgRound(r)} ${lt.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([r,n],s){const[i,o]=s,l=_(this,hi),c=r-l[0],u=n-l[1];if(_(this,Ql)===i&&_(this,Zl)===o)for(const{line:d,points:h}of _(this,va))lt._translate(d,c,u,d),lt._translate(h,c,u,h);else{const d=_(this,Ql)/i,h=_(this,Zl)/o;Q(this,Ql,i),Q(this,Zl,o);for(const{line:f,points:p}of _(this,va))lt._rescale(f,c,u,d,h,f),lt._rescale(p,c,u,d,h,p);l[2]*=d,l[3]*=h}return l[0]=r,l[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${lt.svgRound(r)} ${lt.svgRound(n)}`}}}get defaultSVGProperties(){const r=_(this,hi);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${lt.svgRound(r[0])} ${lt.svgRound(r[1])}`,transform:this.rotationTransform||null},bbox:r}}}hi=new WeakMap,_j=new WeakMap,jj=new WeakMap,va=new WeakMap,Ql=new WeakMap,Zl=new WeakMap,iv=new WeakMap,av=new WeakMap,_m=new WeakMap,As=new WeakSet,zc=function(r=_(this,_m)){const n=_(this,jj)+r/2*_(this,iv);return _(this,av)%180===0?[n/_(this,Ql),n/_(this,Zl)]:[n/_(this,Zl),n/_(this,Ql)]},Efe=function(){const[r,n,s,i]=_(this,hi),[o,l]=ce(this,As,zc).call(this,0);return[r+o,n+l,s-2*o,i-2*l]},Cfe=function(){const r=Q(this,hi,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:i}of _(this,va)){if(i.length<=12){for(let c=4,u=i.length;c<u;c+=6)pt.pointBoundingBox(i[c],i[c+1],r);continue}let o=i[4],l=i[5];for(let c=6,u=i.length;c<u;c+=6){const[d,h,f,p,g,m]=i.subarray(c,c+6);pt.bezierBoundingBox(o,l,d,h,f,p,g,m,r),o=g,l=m}}const[n,s]=ce(this,As,zc).call(this);r[0]=mi(r[0]-n,0,1),r[1]=mi(r[1]-s,0,1),r[2]=mi(r[2]+n,0,1),r[3]=mi(r[3]+s,0,1),r[2]-=r[0],r[3]-=r[1]},kfe=function(r){const[n,s]=ce(this,As,zc).call(this);Q(this,_m,r);const[i,o]=ce(this,As,zc).call(this),[l,c]=[i-n,o-s],u=_(this,hi);return u[0]-=l,u[1]-=c,u[2]+=2*l,u[3]+=2*c,u};class K2 extends Nfe{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:Rr._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,r){e==="stroke-width"&&(r??(r=this["stroke-width"]),r*=this._viewParameters.realScale),super.updateSVGProperty(e,r)}clone(){const e=new K2(this._viewParameters);return e.updateAll(this),e}}var Fk,Tfe;const wy=class wy extends yk{constructor(r){super({...r,name:"inkEditor"});se(this,Fk);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(r,n){Rr.initialize(r,n),this._defaultDrawingOptions=new K2(n.viewParameters)}static getDefaultDrawingOptions(r){const n=this._defaultDrawingOptions.clone();return n.updateProperties(r),n}static get supportMultipleDrawings(){return!0}static get typesMap(){return Ut(this,"typesMap",new Map([[Kt.INK_THICKNESS,"stroke-width"],[Kt.INK_COLOR,"stroke"],[Kt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(r,n,s,i,o){return new rut(r,n,s,i,o,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(r,n,s,i,o,l){return gS.deserialize(r,n,s,i,o,l)}static async deserialize(r,n,s){let i=null;if(r instanceof rB){const{data:{inkLists:l,rect:c,rotation:u,id:d,color:h,opacity:f,borderStyle:{rawWidth:p},popupRef:g,contentsObj:m},parent:{page:{pageNumber:x}}}=r;i=r={annotationType:kt.INK,color:Array.from(h),thickness:p,opacity:f,paths:{points:l},boxes:null,pageIndex:x-1,rect:c.slice(0),rotation:u,annotationElementId:d,id:d,deleted:!1,popupRef:g,comment:(m==null?void 0:m.str)||null}}const o=await super.deserialize(r,n,s);return o._initialData=i,r.comment&&o.setCommentData(r.comment),o}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new fk(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Kt.INK_COLOR}get colorValue(){return this._drawingOptions.stroke}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:r,_drawingOptions:n,parent:s}=this;n.updateSVGProperty("stroke-width"),s.drawLayer.updateProperties(r,n.toSVGProperties())}static onScaleChangingWhenDrawing(){const r=this._currentParent;r&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),r.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:r,thickness:n,opacity:s}){this._drawingOptions=wy.getDefaultDrawingOptions({stroke:pt.makeHexColor(...r),"stroke-width":n,"stroke-opacity":s})}serialize(r=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:n,points:s,rect:i}=this.serializeDraw(r),{_drawingOptions:{stroke:o,"stroke-opacity":l,"stroke-width":c}}=this,u={annotationType:kt.INK,color:Rr._colorManager.convert(o),opacity:l,thickness:c,paths:{lines:n,points:s},pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return this.addComment(u),r?(u.isCopy=!0,u):this.annotationElementId&&!ce(this,Fk,Tfe).call(this,u)?null:(u.id=this.annotationElementId,u)}renderAnnotationElement(r){const{points:n,rect:s}=this.serializeDraw(!1),i={rect:s,thickness:this._drawingOptions["stroke-width"],points:n};return this.hasEditedComment&&(i.popup=this.comment),r.updateEdited(i),null}};Fk=new WeakSet,Tfe=function(r){const{color:n,thickness:s,opacity:i,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||r.color.some((l,c)=>l!==n[c])||r.thickness!==s||r.opacity!==i||r.pageIndex!==o},Le(wy,"_type","ink"),Le(wy,"_editorType",kt.INK),Le(wy,"_defaultDrawingOptions",null);let m3=wy;class g3 extends gS{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}const qN=8,f0=3;var jm,hr,y3,Ko,Pfe,Ofe,x3,sE,Ife,Rfe,Mfe,v3,b3,Dfe;class Pu{static extractContoursFromText(e,{fontFamily:r,fontStyle:n,fontWeight:s},i,o,l,c){let u=new OffscreenCanvas(1,1),d=u.getContext("2d",{alpha:!1});const h=200,f=d.font=`${n} ${s} ${h}px ${r}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:g,actualBoundingBoxAscent:m,actualBoundingBoxDescent:x,fontBoundingBoxAscent:y,fontBoundingBoxDescent:v,width:b}=d.measureText(e),w=1.5,j=Math.ceil(Math.max(Math.abs(p)+Math.abs(g)||0,b)*w),N=Math.ceil(Math.max(Math.abs(m)+Math.abs(x)||h,Math.abs(y)+Math.abs(v)||h)*w);u=new OffscreenCanvas(j,N),d=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),d.font=f,d.filter="grayscale(1)",d.fillStyle="white",d.fillRect(0,0,j,N),d.fillStyle="black",d.fillText(e,j*(w-1)/2,N*(3-w)/2);const C=ce(this,hr,v3).call(this,d.getImageData(0,0,j,N).data),k=ce(this,hr,Mfe).call(this,C),E=ce(this,hr,b3).call(this,k),M=ce(this,hr,x3).call(this,C,j,N,E);return this.processDrawnLines({lines:{curves:M,width:j,height:N},pageWidth:i,pageHeight:o,rotation:l,innerMargin:c,mustSmooth:!0,areContours:!0})}static process(e,r,n,s,i){const[o,l,c]=ce(this,hr,Dfe).call(this,e),[u,d]=ce(this,hr,Rfe).call(this,o,l,c,Math.hypot(l,c)*_(this,jm).sigmaSFactor,_(this,jm).sigmaR,_(this,jm).kernelSize),h=ce(this,hr,b3).call(this,d),f=ce(this,hr,x3).call(this,u,l,c,h);return this.processDrawnLines({lines:{curves:f,width:l,height:c},pageWidth:r,pageHeight:n,rotation:s,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:r,pageHeight:n,rotation:s,innerMargin:i,mustSmooth:o,areContours:l}){s%180!==0&&([r,n]=[n,r]);const{curves:c,width:u,height:d}=e,h=e.thickness??0,f=[],p=Math.min(r/u,n/d),g=p/r,m=p/n,x=[];for(const{points:v}of c){const b=o?ce(this,hr,Ife).call(this,v):v;if(!b)continue;x.push(b);const w=b.length,j=new Float32Array(w),N=new Float32Array(3*(w===2?2:w-2));if(f.push({line:N,points:j}),w===2){j[0]=b[0]*g,j[1]=b[1]*m,N.set([NaN,NaN,NaN,NaN,j[0],j[1]],0);continue}let[C,k,E,M]=b;C*=g,k*=m,E*=g,M*=m,j.set([C,k,E,M],0),N.set([NaN,NaN,NaN,NaN,C,k],0);for(let z=4;z<w;z+=2){const P=j[z]=b[z]*g,V=j[z+1]=b[z+1]*m;N.set(lt.createBezierPoints(C,k,E,M,P,V),(z-2)*3),[C,k,E,M]=[E,M,P,V]}}if(f.length===0)return null;const y=l?new g3:new gS;return y.build(f,r,n,1,s,l?0:h,i),{outline:y,newCurves:x,areContours:l,thickness:h,width:u,height:d}}static async compressSignature({outlines:e,areContours:r,thickness:n,width:s,height:i}){let o=1/0,l=-1/0,c=0;for(const b of e){c+=b.length;for(let w=2,j=b.length;w<j;w++){const N=b[w]-b[w-2];o=Math.min(o,N),l=Math.max(l,N)}}let u;o>=-128&&l<=127?u=Int8Array:o>=-32768&&l<=32767?u=Int16Array:u=Int32Array;const d=e.length,h=qN+f0*d,f=new Uint32Array(h);let p=0;f[p++]=h*Uint32Array.BYTES_PER_ELEMENT+(c-2*d)*u.BYTES_PER_ELEMENT,f[p++]=0,f[p++]=s,f[p++]=i,f[p++]=r?0:1,f[p++]=Math.max(0,Math.floor(n??0)),f[p++]=d,f[p++]=u.BYTES_PER_ELEMENT;for(const b of e)f[p++]=b.length-2,f[p++]=b[0],f[p++]=b[1];const g=new CompressionStream("deflate-raw"),m=g.writable.getWriter();await m.ready,m.write(f);const x=u.prototype.constructor;for(const b of e){const w=new x(b.length-2);for(let j=2,N=b.length;j<N;j++)w[j-2]=b[j]-b[j-2];m.write(w)}m.close();const y=await new Response(g.readable).arrayBuffer(),v=new Uint8Array(y);return Dde(v)}static async decompressSignature(e){try{const r=Alt(e),{readable:n,writable:s}=new DecompressionStream("deflate-raw"),i=s.getWriter();await i.ready,i.write(r).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let o=null,l=0;for await(const b of n)o||(o=new Uint8Array(new Uint32Array(b.buffer,0,4)[0])),o.set(b,l),l+=b.length;const c=new Uint32Array(o.buffer,0,o.length>>2),u=c[1];if(u!==0)throw new Error(`Invalid version: ${u}`);const d=c[2],h=c[3],f=c[4]===0,p=c[5],g=c[6],m=c[7],x=[],y=(qN+f0*g)*Uint32Array.BYTES_PER_ELEMENT;let v;switch(m){case Int8Array.BYTES_PER_ELEMENT:v=new Int8Array(o.buffer,y);break;case Int16Array.BYTES_PER_ELEMENT:v=new Int16Array(o.buffer,y);break;case Int32Array.BYTES_PER_ELEMENT:v=new Int32Array(o.buffer,y);break}l=0;for(let b=0;b<g;b++){const w=c[f0*b+qN],j=new Float32Array(w+2);x.push(j);for(let N=0;N<f0-1;N++)j[N]=c[f0*b+qN+N+1];for(let N=0;N<w;N++)j[N+2]=j[N]+v[l++]}return{areContours:f,thickness:p,outlines:x,width:d,height:h}}catch(r){return Tt(`decompressSignature: ${r}`),null}}}jm=new WeakMap,hr=new WeakSet,y3=function(e,r,n,s){return n-=e,s-=r,n===0?s>0?0:4:n===1?s+6:2-s},Ko=new WeakMap,Pfe=function(e,r,n,s,i,o,l){const c=ce(this,hr,y3).call(this,n,s,i,o);for(let u=0;u<8;u++){const d=(-u+c-l+16)%8,h=_(this,Ko)[2*d],f=_(this,Ko)[2*d+1];if(e[(n+h)*r+(s+f)]!==0)return d}return-1},Ofe=function(e,r,n,s,i,o,l){const c=ce(this,hr,y3).call(this,n,s,i,o);for(let u=0;u<8;u++){const d=(u+c+l+16)%8,h=_(this,Ko)[2*d],f=_(this,Ko)[2*d+1];if(e[(n+h)*r+(s+f)]!==0)return d}return-1},x3=function(e,r,n,s){const i=e.length,o=new Int32Array(i);for(let d=0;d<i;d++)o[d]=e[d]<=s?1:0;for(let d=1;d<n-1;d++)o[d*r]=o[d*r+r-1]=0;for(let d=0;d<r;d++)o[d]=o[r*n-1-d]=0;let l=1,c;const u=[];for(let d=1;d<n-1;d++){c=1;for(let h=1;h<r-1;h++){const f=d*r+h,p=o[f];if(p===0)continue;let g=d,m=h;if(p===1&&o[f-1]===0)l+=1,m-=1;else if(p>=1&&o[f+1]===0)l+=1,m+=1,p>1&&(c=p);else{p!==1&&(c=Math.abs(p));continue}const x=[h,d],y=m===h+1,v={isHole:y,points:x,id:l,parent:0};u.push(v);let b;for(const z of u)if(z.id===c){b=z;break}b?b.isHole?v.parent=y?b.parent:c:v.parent=y?c:b.parent:v.parent=y?c:0;const w=ce(this,hr,Pfe).call(this,o,r,d,h,g,m,0);if(w===-1){o[f]=-l,o[f]!==1&&(c=Math.abs(o[f]));continue}let j=_(this,Ko)[2*w],N=_(this,Ko)[2*w+1];const C=d+j,k=h+N;g=C,m=k;let E=d,M=h;for(;;){const z=ce(this,hr,Ofe).call(this,o,r,E,M,g,m,1);j=_(this,Ko)[2*z],N=_(this,Ko)[2*z+1];const P=E+j,V=M+N;x.push(V,P);const A=E*r+M;if(o[A+1]===0?o[A]=-l:o[A]===1&&(o[A]=l),P===d&&V===h&&E===C&&M===k){o[f]!==1&&(c=Math.abs(o[f]));break}else g=E,m=M,E=P,M=V}}}return u},sE=function(e,r,n,s){if(n-r<=4){for(let C=r;C<n-2;C+=2)s.push(e[C],e[C+1]);return}const i=e[r],o=e[r+1],l=e[n-4]-i,c=e[n-3]-o,u=Math.hypot(l,c),d=l/u,h=c/u,f=d*o-h*i,p=c/l,g=1/u,m=Math.atan(p),x=Math.cos(m),y=Math.sin(m),v=g*(Math.abs(x)+Math.abs(y)),b=g*(1-v+v**2),w=Math.max(Math.atan(Math.abs(y+x)*b),Math.atan(Math.abs(y-x)*b));let j=0,N=r;for(let C=r+2;C<n-2;C+=2){const k=Math.abs(f-d*e[C+1]+h*e[C]);k>j&&(N=C,j=k)}j>(u*w)**2?(ce(this,hr,sE).call(this,e,r,N+2,s),ce(this,hr,sE).call(this,e,N,n,s)):s.push(i,o)},Ife=function(e){const r=[],n=e.length;return ce(this,hr,sE).call(this,e,0,n,r),r.push(e[n-2],e[n-1]),r.length<=4?null:r},Rfe=function(e,r,n,s,i,o){const l=new Float32Array(o**2),c=-2*s**2,u=o>>1;for(let m=0;m<o;m++){const x=(m-u)**2;for(let y=0;y<o;y++)l[m*o+y]=Math.exp((x+(y-u)**2)/c)}const d=new Float32Array(256),h=-2*i**2;for(let m=0;m<256;m++)d[m]=Math.exp(m**2/h);const f=e.length,p=new Uint8Array(f),g=new Uint32Array(256);for(let m=0;m<n;m++)for(let x=0;x<r;x++){const y=m*r+x,v=e[y];let b=0,w=0;for(let N=0;N<o;N++){const C=m+N-u;if(!(C<0||C>=n))for(let k=0;k<o;k++){const E=x+k-u;if(E<0||E>=r)continue;const M=e[C*r+E],z=l[N*o+k]*d[Math.abs(M-v)];b+=M*z,w+=z}}const j=p[y]=Math.round(b/w);g[j]++}return[p,g]},Mfe=function(e){const r=new Uint32Array(256);for(const n of e)r[n]++;return r},v3=function(e){const r=e.length,n=new Uint8ClampedArray(r>>2);let s=-1/0,i=1/0;for(let l=0,c=n.length;l<c;l++){const u=n[l]=e[l<<2];s=Math.max(s,u),i=Math.min(i,u)}const o=255/(s-i);for(let l=0,c=n.length;l<c;l++)n[l]=(n[l]-i)*o;return n},b3=function(e){let r,n=-1/0,s=-1/0;const i=e.findIndex(c=>c!==0);let o=i,l=i;for(r=i;r<256;r++){const c=e[r];c>n&&(r-o>s&&(s=r-o,l=r-1),n=c,o=r)}for(r=l-1;r>=0&&!(e[r]>e[r+1]);r--);return r},Dfe=function(e){const r=e,{width:n,height:s}=e,{maxDim:i}=_(this,jm);let o=n,l=s;if(n>i||s>i){let f=n,p=s,g=Math.log2(Math.max(n,s)/i);const m=Math.floor(g);g=g===m?m-1:m;for(let y=0;y<g;y++){o=Math.ceil(f/2),l=Math.ceil(p/2);const v=new OffscreenCanvas(o,l);v.getContext("2d").drawImage(e,0,0,f,p,0,0,o,l),f=o,p=l,e!==r&&e.close(),e=v.transferToImageBitmap()}const x=Math.min(i/o,i/l);o=Math.round(o*x),l=Math.round(l*x)}const u=new OffscreenCanvas(o,l).getContext("2d",{willReadFrequently:!0});u.fillStyle="white",u.fillRect(0,0,o,l),u.filter="grayscale(1)",u.drawImage(e,0,0,e.width,e.height,0,0,o,l);const d=u.getImageData(0,0,o,l).data;return[ce(this,hr,v3).call(this,d),o,l]},se(Pu,hr),se(Pu,jm,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),se(Pu,Ko,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class nB extends Nfe{constructor(){super(),super.updateProperties({fill:Rr._defaultLineColor,"stroke-width":0})}clone(){const e=new nB;return e.updateAll(this),e}}class sB extends K2{constructor(e){super(e),super.updateProperties({stroke:Rr._defaultLineColor,"stroke-width":1})}clone(){const e=new sB(this._viewParameters);return e.updateAll(this),e}}var Ah,Jl,Eh,Sm;const ia=class ia extends yk{constructor(r){super({...r,mustBeCommitted:!0,name:"signatureEditor"});se(this,Ah,!1);se(this,Jl,null);se(this,Eh,null);se(this,Sm,null);this._willKeepAspectRatio=!0,Q(this,Eh,r.signatureData||null),Q(this,Jl,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(r,n){Rr.initialize(r,n),this._defaultDrawingOptions=new nB,this._defaultDrawnSignatureOptions=new sB(n.viewParameters)}static getDefaultDrawingOptions(r){const n=this._defaultDrawingOptions.clone();return n.updateProperties(r),n}static get supportMultipleDrawings(){return!1}static get typesMap(){return Ut(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!_(this,Jl)}}static computeTelemetryFinalData(r){const n=r.get("hasDescription");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let r,n;const{_isCopy:s}=this;if(s&&(this._isCopy=!1,r=this.x,n=this.y),super.render(),this._drawId===null)if(_(this,Eh)){const{lines:i,mustSmooth:o,areContours:l,description:c,uuid:u,heightInPage:d}=_(this,Eh),{rawDims:{pageWidth:h,pageHeight:f},rotation:p}=this.parent.viewport,g=Pu.processDrawnLines({lines:i,pageWidth:h,pageHeight:f,rotation:p,innerMargin:ia._INNER_MARGIN,mustSmooth:o,areContours:l});this.addSignature(g,d,c,u)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:_(this,Jl)||""}));return s&&(this._isCopy=!0,this._moveAfterPaste(r,n)),this.div}setUuid(r){Q(this,Sm,r),this.addEditToolbar()}getUuid(){return _(this,Sm)}get description(){return _(this,Jl)}set description(r){Q(this,Jl,r),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:r})),super.addEditToolbar().then(n=>{n==null||n.updateEditSignatureButton(r)}))}getSignaturePreview(){const{newCurves:r,areContours:n,thickness:s,width:i,height:o}=_(this,Eh),l=Math.max(i,o),c=Pu.processDrawnLines({lines:{curves:r.map(u=>({points:u})),thickness:s,width:i,height:o},pageWidth:l,pageHeight:l,rotation:0,innerMargin:0,mustSmooth:!1,areContours:n});return{areContours:n,outline:c.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(r,n,s,i){const{x:o,y:l}=this,{outline:c}=Q(this,Eh,r);Q(this,Ah,c instanceof g3),this.description=s;let u;_(this,Ah)?u=ia.getDefaultDrawingOptions():(u=ia._defaultDrawnSignatureOptions.clone(),u.updateProperties({"stroke-width":c.thickness})),this._addOutlines({drawOutlines:c,drawingOptions:u});const[d,h]=this.parentDimensions,[,f]=this.pageDimensions;let p=n/f;p=p>=1?.5:p,this.width*=p/this.height,this.width>=1&&(p*=.9/this.width,this.width=.9),this.height=p,this.setDims(d*this.width,h*this.height),this.x=o,this.y=l,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!i,hasDescription:!!s}}),this.div.hidden=!1}getFromImage(r){const{rawDims:{pageWidth:n,pageHeight:s},rotation:i}=this.parent.viewport;return Pu.process(r,n,s,i,ia._INNER_MARGIN)}getFromText(r,n){const{rawDims:{pageWidth:s,pageHeight:i},rotation:o}=this.parent.viewport;return Pu.extractContoursFromText(r,n,s,i,o,ia._INNER_MARGIN)}getDrawnSignature(r){const{rawDims:{pageWidth:n,pageHeight:s},rotation:i}=this.parent.viewport;return Pu.processDrawnLines({lines:r,pageWidth:n,pageHeight:s,rotation:i,innerMargin:ia._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:r,thickness:n}){r?this._drawingOptions=ia.getDefaultDrawingOptions():(this._drawingOptions=ia._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(r=!1){if(this.isEmpty())return null;const{lines:n,points:s,rect:i}=this.serializeDraw(r),{_drawingOptions:{"stroke-width":o}}=this,l={annotationType:kt.SIGNATURE,isSignature:!0,areContours:_(this,Ah),color:[0,0,0],thickness:_(this,Ah)?0:o,pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return this.addComment(l),r?(l.paths={lines:n,points:s},l.uuid=_(this,Sm),l.isCopy=!0):l.lines=n,_(this,Jl)&&(l.accessibilityData={type:"Figure",alt:_(this,Jl)}),l}static deserializeDraw(r,n,s,i,o,l){return l.areContours?g3.deserialize(r,n,s,i,o,l):gS.deserialize(r,n,s,i,o,l)}static async deserialize(r,n,s){var o;const i=await super.deserialize(r,n,s);return Q(i,Ah,r.areContours),i.description=((o=r.accessibilityData)==null?void 0:o.alt)||"",Q(i,Sm,r.uuid),i}};Ah=new WeakMap,Jl=new WeakMap,Eh=new WeakMap,Sm=new WeakMap,Le(ia,"_type","signature"),Le(ia,"_editorType",kt.SIGNATURE),Le(ia,"_defaultDrawingOptions",null);let w3=ia;var Yr,cs,Ch,Au,kh,ov,Eu,Nm,ec,ba,lv,nr,X0,Q0,iE,aE,oE,j3,lE,Lfe;class _3 extends Rr{constructor(r){super({...r,name:"stampEditor"});se(this,nr);se(this,Yr,null);se(this,cs,null);se(this,Ch,null);se(this,Au,null);se(this,kh,null);se(this,ov,"");se(this,Eu,null);se(this,Nm,!1);se(this,ec,null);se(this,ba,!1);se(this,lv,!1);Q(this,Au,r.bitmapUrl),Q(this,kh,r.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(r,n){Rr.initialize(r,n)}static isHandlingMimeForPasting(r){return m5.includes(r)}static paste(r,n){n.pasteEditor({mode:kt.STAMP},{bitmapFile:r.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var r;return{type:"stamp",hasAltText:!!((r=this.altTextData)!=null&&r.altText)}}static computeTelemetryFinalData(r){const n=r.get("hasAltText");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}async mlGuessAltText(r=null,n=!0){if(this.hasAltTextData())return null;const{mlManager:s}=this._uiManager;if(!s)throw new Error("No ML.");if(!await s.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:i,width:o,height:l}=r||this.copyCanvas(null,null,!0).imageData,c=await s.guess({name:"altText",request:{data:i,width:o,height:l,channels:i.length/(o*l)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const u=c.output;return await this.setGuessedAltText(u),n&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}remove(){var r;_(this,cs)&&(Q(this,Yr,null),this._uiManager.imageManager.deleteId(_(this,cs)),(r=_(this,Eu))==null||r.remove(),Q(this,Eu,null),_(this,ec)&&(clearTimeout(_(this,ec)),Q(this,ec,null))),super.remove()}rebuild(){if(!this.parent){_(this,cs)&&ce(this,nr,iE).call(this);return}super.rebuild(),this.div!==null&&(_(this,cs)&&_(this,Eu)===null&&ce(this,nr,iE).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(r){this._isDraggable=!0,r&&this.div.focus()}isEmpty(){return!(_(this,Ch)||_(this,Yr)||_(this,Au)||_(this,kh)||_(this,cs)||_(this,Nm))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let r,n;return this._isCopy&&(r=this.x,n=this.y),super.render(),this.div.hidden=!0,this.createAltText(),_(this,Nm)||(_(this,Yr)?ce(this,nr,aE).call(this):ce(this,nr,iE).call(this)),this._isCopy&&this._moveAfterPaste(r,n),this._uiManager.addShouldRescale(this),this.div}setCanvas(r,n){const{id:s,bitmap:i}=this._uiManager.imageManager.getFromCanvas(r,n);n.remove(),s&&this._uiManager.imageManager.isValidId(s)&&(Q(this,cs,s),i&&Q(this,Yr,i),Q(this,Nm,!1),ce(this,nr,aE).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;_(this,ec)!==null&&clearTimeout(_(this,ec)),Q(this,ec,setTimeout(()=>{Q(this,ec,null),ce(this,nr,j3).call(this)},200))}copyCanvas(r,n,s=!1){var p;r||(r=224);const{width:i,height:o}=_(this,Yr),l=new jc;let c=_(this,Yr),u=i,d=o,h=null;if(n){if(i>n||o>n){const k=Math.min(n/i,n/o);u=Math.floor(i*k),d=Math.floor(o*k)}h=document.createElement("canvas");const g=h.width=Math.ceil(u*l.sx),m=h.height=Math.ceil(d*l.sy);_(this,ba)||(c=ce(this,nr,oE).call(this,g,m));const x=h.getContext("2d");x.filter=this._uiManager.hcmFilter;let y="white",v="#cfcfd8";this._uiManager.hcmFilter!=="none"?v="black":(p=window.matchMedia)!=null&&p.call(window,"(prefers-color-scheme: dark)").matches&&(y="#8f8f9d",v="#42414d");const b=15,w=b*l.sx,j=b*l.sy,N=new OffscreenCanvas(w*2,j*2),C=N.getContext("2d");C.fillStyle=y,C.fillRect(0,0,w*2,j*2),C.fillStyle=v,C.fillRect(0,0,w,j),C.fillRect(w,j,w,j),x.fillStyle=x.createPattern(N,"repeat"),x.fillRect(0,0,g,m),x.drawImage(c,0,0,c.width,c.height,0,0,g,m)}let f=null;if(s){let g,m;if(l.symmetric&&c.width<r&&c.height<r)g=c.width,m=c.height;else if(c=_(this,Yr),i>r||o>r){const v=Math.min(r/i,r/o);g=Math.floor(i*v),m=Math.floor(o*v),_(this,ba)||(c=ce(this,nr,oE).call(this,g,m))}const y=new OffscreenCanvas(g,m).getContext("2d",{willReadFrequently:!0});y.drawImage(c,0,0,c.width,c.height,0,0,g,m),f={width:g,height:m,data:y.getImageData(0,0,g,m).data}}return{canvas:h,width:u,height:d,imageData:f}}static async deserialize(r,n,s){var x;let i=null,o=!1;if(r instanceof Jhe){const{data:{rect:y,rotation:v,id:b,structParent:w,popupRef:j,contentsObj:N},container:C,parent:{page:{pageNumber:k}},canvas:E}=r;let M,z;E?(delete r.canvas,{id:M,bitmap:z}=s.imageManager.getFromCanvas(C.id,E),E.remove()):(o=!0,r._hasNoCanvas=!0);const P=((x=await n._structTree.getAriaAttributes(`${Y8}${b}`))==null?void 0:x.get("aria-label"))||"";i=r={annotationType:kt.STAMP,bitmapId:M,bitmap:z,pageIndex:k-1,rect:y.slice(0),rotation:v,annotationElementId:b,id:b,deleted:!1,accessibilityData:{decorative:!1,altText:P},isSvg:!1,structParent:w,popupRef:j,comment:(N==null?void 0:N.str)||null}}const l=await super.deserialize(r,n,s),{rect:c,bitmap:u,bitmapUrl:d,bitmapId:h,isSvg:f,accessibilityData:p}=r;o?(s.addMissingCanvas(r.id,l),Q(l,Nm,!0)):h&&s.imageManager.isValidId(h)?(Q(l,cs,h),u&&Q(l,Yr,u)):Q(l,Au,d),Q(l,ba,f);const[g,m]=l.pageDimensions;return l.width=(c[2]-c[0])/g,l.height=(c[3]-c[1])/m,p&&(l.altTextData=p),l._initialData=i,r.comment&&l.setCommentData(r.comment),Q(l,lv,!!i),l}serialize(r=!1,n=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s={annotationType:kt.STAMP,bitmapId:_(this,cs),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:_(this,ba),structTreeParentId:this._structTreeParentId};if(this.addComment(s),r)return s.bitmapUrl=ce(this,nr,lE).call(this,!0),s.accessibilityData=this.serializeAltText(!0),s.isCopy=!0,s;const{decorative:i,altText:o}=this.serializeAltText(!1);if(!i&&o&&(s.accessibilityData={type:"Figure",alt:o}),this.annotationElementId){const c=ce(this,nr,Lfe).call(this,s);if(c.isSame)return null;c.isSameAltText?delete s.accessibilityData:s.accessibilityData.structParent=this._initialData.structParent??-1}if(s.id=this.annotationElementId,n===null)return s;n.stamps||(n.stamps=new Map);const l=_(this,ba)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!n.stamps.has(_(this,cs)))n.stamps.set(_(this,cs),{area:l,serialized:s}),s.bitmap=ce(this,nr,lE).call(this,!1);else if(_(this,ba)){const c=n.stamps.get(_(this,cs));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=ce(this,nr,lE).call(this,!1))}return s}renderAnnotationElement(r){const n={rect:this.getRect(0,0)};return this.hasEditedComment&&(n.popup=this.comment),r.updateEdited(n),null}}Yr=new WeakMap,cs=new WeakMap,Ch=new WeakMap,Au=new WeakMap,kh=new WeakMap,ov=new WeakMap,Eu=new WeakMap,Nm=new WeakMap,ec=new WeakMap,ba=new WeakMap,lv=new WeakMap,nr=new WeakSet,X0=function(r,n=!1){if(!r){this.remove();return}Q(this,Yr,r.bitmap),n||(Q(this,cs,r.id),Q(this,ba,r.isSvg)),r.file&&Q(this,ov,r.file.name),ce(this,nr,aE).call(this)},Q0=function(){if(Q(this,Ch,null),this._uiManager.enableWaiting(!1),!!_(this,Eu)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&_(this,Yr)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&_(this,Yr)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},iE=function(){if(_(this,cs)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(_(this,cs)).then(s=>ce(this,nr,X0).call(this,s,!0)).finally(()=>ce(this,nr,Q0).call(this));return}if(_(this,Au)){const s=_(this,Au);Q(this,Au,null),this._uiManager.enableWaiting(!0),Q(this,Ch,this._uiManager.imageManager.getFromUrl(s).then(i=>ce(this,nr,X0).call(this,i)).finally(()=>ce(this,nr,Q0).call(this)));return}if(_(this,kh)){const s=_(this,kh);Q(this,kh,null),this._uiManager.enableWaiting(!0),Q(this,Ch,this._uiManager.imageManager.getFromFile(s).then(i=>ce(this,nr,X0).call(this,i)).finally(()=>ce(this,nr,Q0).call(this)));return}const r=document.createElement("input");r.type="file",r.accept=m5.join(",");const n=this._uiManager._signal;Q(this,Ch,new Promise(s=>{r.addEventListener("change",async()=>{if(!r.files||r.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(r.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),ce(this,nr,X0).call(this,i)}s()},{signal:n}),r.addEventListener("cancel",()=>{this.remove(),s()},{signal:n})}).finally(()=>ce(this,nr,Q0).call(this))),r.click()},aE=function(){var h;const{div:r}=this;let{width:n,height:s}=_(this,Yr);const[i,o]=this.pageDimensions,l=.75;if(this.width)n=this.width*i,s=this.height*o;else if(n>l*i||s>l*o){const f=Math.min(l*i/n,l*o/s);n*=f,s*=f}const[c,u]=this.parentDimensions;this.setDims(n*c/i,s*u/o),this._uiManager.enableWaiting(!1);const d=Q(this,Eu,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),this.width=n/i,this.height=s/o,(h=this._initialOptions)!=null&&h.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(r.hidden=!1),ce(this,nr,j3).call(this),_(this,lv)||(this.parent.addUndoableEditor(this),Q(this,lv,!0)),this._reportTelemetry({action:"inserted_image"}),_(this,ov)&&this.div.setAttribute("aria-description",_(this,ov)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},oE=function(r,n){const{width:s,height:i}=_(this,Yr);let o=s,l=i,c=_(this,Yr);for(;o>2*r||l>2*n;){const u=o,d=l;o>2*r&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2)),l>2*n&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2));const h=new OffscreenCanvas(o,l);h.getContext("2d").drawImage(c,0,0,u,d,0,0,o,l),c=h.transferToImageBitmap()}return c},j3=function(){const[r,n]=this.parentDimensions,{width:s,height:i}=this,o=new jc,l=Math.ceil(s*r*o.sx),c=Math.ceil(i*n*o.sy),u=_(this,Eu);if(!u||u.width===l&&u.height===c)return;u.width=l,u.height=c;const d=_(this,ba)?_(this,Yr):ce(this,nr,oE).call(this,l,c),h=u.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(d,0,0,d.width,d.height,0,0,l,c)},lE=function(r){if(r){if(_(this,ba)){const i=this._uiManager.imageManager.getSvgUrl(_(this,cs));if(i)return i}const n=document.createElement("canvas");return{width:n.width,height:n.height}=_(this,Yr),n.getContext("2d").drawImage(_(this,Yr),0,0),n.toDataURL()}if(_(this,ba)){const[n,s]=this.pageDimensions,i=Math.round(this.width*n*sf.PDF_TO_CSS_UNITS),o=Math.round(this.height*s*sf.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(i,o);return l.getContext("2d").drawImage(_(this,Yr),0,0,_(this,Yr).width,_(this,Yr).height,0,0,i,o),l.transferToImageBitmap()}return structuredClone(_(this,Yr))},Lfe=function(r){var l;const{pageIndex:n,accessibilityData:{altText:s}}=this._initialData,i=r.pageIndex===n,o=(((l=r.accessibilityData)==null?void 0:l.alt)||"")===s;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&o,isSameAltText:o}},Le(_3,"_type","stamp"),Le(_3,"_editorType",kt.STAMP);var Am,cv,tc,Th,Cu,wa,Ph,uv,Em,Yo,ku,us,Tu,Oh,dv,ft,Ih,Xr,Ffe,Cl,N3,A3,cE;const Do=class Do{constructor({uiManager:e,pageIndex:r,div:n,structTreeLayer:s,accessibilityManager:i,annotationLayer:o,drawLayer:l,textLayer:c,viewport:u,l10n:d}){se(this,Xr);se(this,Am);se(this,cv,!1);se(this,tc,null);se(this,Th,null);se(this,Cu,null);se(this,wa,new Map);se(this,Ph,!1);se(this,uv,!1);se(this,Em,!1);se(this,Yo,null);se(this,ku,null);se(this,us,null);se(this,Tu,null);se(this,Oh,null);se(this,dv,-1);se(this,ft);const h=[..._(Do,Ih).values()];if(!Do._initialized){Do._initialized=!0;for(const f of h)f.initialize(d,e)}e.registerEditorTypes(h),Q(this,ft,e),this.pageIndex=r,this.div=n,Q(this,Am,i),Q(this,tc,o),this.viewport=u,Q(this,us,c),this.drawLayer=l,this._structTree=s,_(this,ft).addLayer(this)}get isEmpty(){return _(this,wa).size===0}get isInvisible(){return this.isEmpty&&_(this,ft).getMode()===kt.NONE}updateToolbar(e){_(this,ft).updateToolbar(e)}updateMode(e=_(this,ft).getMode()){switch(ce(this,Xr,cE).call(this),e){case kt.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case kt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case kt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:r}=this.div;for(const n of _(Do,Ih).values())r.toggle(`${n._type}Editing`,e===n._editorType);this.div.hidden=!1}hasTextLayer(e){var r;return e===((r=_(this,us))==null?void 0:r.div)}setEditingState(e){_(this,ft).setEditingState(e)}addCommands(e){_(this,ft).addCommands(e)}cleanUndoStack(e){_(this,ft).cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var r;(r=_(this,tc))==null||r.div.classList.toggle("disabled",!e)}async enable(){var n;Q(this,Em,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),(n=_(this,Oh))==null||n.abort(),Q(this,Oh,null);const e=new Set;for(const s of _(this,wa).values())s.enableEditing(),s.show(!0),s.annotationElementId&&(_(this,ft).removeChangedExistingAnnotation(s),e.add(s.annotationElementId));if(!_(this,tc)){Q(this,Em,!1);return}const r=_(this,tc).getEditableAnnotations();for(const s of r){if(s.hide(),_(this,ft).isDeletedAnnotationElement(s.data.id)||e.has(s.data.id))continue;const i=await this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}Q(this,Em,!1)}disable(){var s;if(Q(this,uv,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),_(this,us)&&!_(this,Oh)){Q(this,Oh,new AbortController);const i=_(this,ft).combinedSignal(_(this,Oh));_(this,us).div.addEventListener("pointerdown",o=>{const{clientX:c,clientY:u,timeStamp:d}=o,h=_(this,dv);if(d-h>500){Q(this,dv,d);return}Q(this,dv,-1);const{classList:f}=this.div;f.toggle("getElements",!0);const p=document.elementsFromPoint(c,u);if(f.toggle("getElements",!1),!this.div.contains(p[0]))return;let g;const m=new RegExp(`^${Pde}[0-9]+$`);for(const y of p)if(m.test(y.id)){g=y.id;break}if(!g)return;const x=_(this,wa).get(g);(x==null?void 0:x.annotationElementId)===null&&(o.stopPropagation(),o.preventDefault(),x.dblclick())},{signal:i,capture:!0})}const e=new Map,r=new Map;for(const i of _(this,wa).values())if(i.disableEditing(),!!i.annotationElementId){if(i.serialize()!==null){e.set(i.annotationElementId,i);continue}else r.set(i.annotationElementId,i);(s=this.getEditableAnnotation(i.annotationElementId))==null||s.show(),i.remove()}if(_(this,tc)){const i=_(this,tc).getEditableAnnotations();for(const o of i){const{id:l}=o.data;if(_(this,ft).isDeletedAnnotationElement(l)){o.updateEdited({deleted:!0});continue}let c=r.get(l);if(c){c.resetAnnotationElement(o),c.show(!1),o.show();continue}c=e.get(l),c&&(_(this,ft).addChangedExistingAnnotation(c),c.renderAnnotationElement(o)&&c.show(!1)),o.show()}}ce(this,Xr,cE).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const i of _(Do,Ih).values())n.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),Q(this,uv,!1)}getEditableAnnotation(e){var r;return((r=_(this,tc))==null?void 0:r.getEditableAnnotation(e))||null}setActiveEditor(e){_(this,ft).getActive()!==e&&_(this,ft).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=_(this,us))!=null&&e.div&&!_(this,Tu)){Q(this,Tu,new AbortController);const r=_(this,ft).combinedSignal(_(this,Tu));_(this,us).div.addEventListener("pointerdown",ce(this,Xr,Ffe).bind(this),{signal:r}),_(this,us).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=_(this,us))!=null&&e.div&&_(this,Tu)&&(_(this,Tu).abort(),Q(this,Tu,null),_(this,us).div.classList.remove("highlighting"))}enableClick(){if(_(this,Th))return;Q(this,Th,new AbortController);const e=_(this,ft).combinedSignal(_(this,Th));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const r=this.pointerup.bind(this);this.div.addEventListener("pointerup",r,{signal:e}),this.div.addEventListener("pointercancel",r,{signal:e})}disableClick(){var e;(e=_(this,Th))==null||e.abort(),Q(this,Th,null)}attach(e){_(this,wa).set(e.id,e);const{annotationElementId:r}=e;r&&_(this,ft).isDeletedAnnotationElement(r)&&_(this,ft).removeDeletedAnnotationElement(e)}detach(e){var r;_(this,wa).delete(e.id),(r=_(this,Am))==null||r.removePointerInTextLayer(e.contentDiv),!_(this,uv)&&e.annotationElementId&&_(this,ft).addDeletedAnnotationElement(e)}remove(e){this.detach(e),_(this,ft).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){var r;e.parent!==this&&(e.parent&&e.annotationElementId&&(_(this,ft).addDeletedAnnotationElement(e.annotationElementId),Rr.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(r=e.parent)==null||r.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),_(this,ft).addEditor(e),this.attach(e),!e.isAttachedToDOM){const r=e.render();this.div.append(r),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!_(this,Em)),_(this,ft).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var n;if(!e.isAttachedToDOM)return;const{activeElement:r}=document;e.div.contains(r)&&!_(this,Cu)&&(e._focusEventsAllowed=!1,Q(this,Cu,setTimeout(()=>{Q(this,Cu,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:_(this,ft)._signal}),r.focus())},0))),e._structTreeParentId=(n=_(this,Am))==null?void 0:n.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const r=()=>e._uiManager.rebuild(e),n=()=>{e.remove()};this.addCommands({cmd:r,undo:n,mustExec:!1})}getNextId(){return _(this,ft).getId()}combinedSignal(e){return _(this,ft).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=_(this,Xr,Cl))==null?void 0:e.canCreateNewEmptyEditor()}async pasteEditor(e,r){this.updateToolbar(e),await _(this,ft).updateMode(e.mode);const{offsetX:n,offsetY:s}=ce(this,Xr,A3).call(this),i=this.getNextId(),o=ce(this,Xr,N3).call(this,{parent:this,id:i,x:n,y:s,uiManager:_(this,ft),isCentered:!0,...r});o&&this.add(o)}async deserialize(e){var r;return await((r=_(Do,Ih).get(e.annotationType??e.annotationEditorType))==null?void 0:r.deserialize(e,this,_(this,ft)))||null}createAndAddNewEditor(e,r,n={}){const s=this.getNextId(),i=ce(this,Xr,N3).call(this,{parent:this,id:s,x:e.offsetX,y:e.offsetY,uiManager:_(this,ft),isCentered:r,...n});return i&&this.add(i),i}addNewEditor(e={}){this.createAndAddNewEditor(ce(this,Xr,A3).call(this),!0,e)}setSelected(e){_(this,ft).setSelected(e)}toggleSelected(e){_(this,ft).toggleSelected(e)}unselect(e){_(this,ft).unselect(e)}pointerup(e){var s;const{isMac:r}=Is.platform;if(e.button!==0||e.ctrlKey&&r||e.target!==this.div||!_(this,Ph)||(Q(this,Ph,!1),(s=_(this,Xr,Cl))!=null&&s.isDrawer&&_(this,Xr,Cl).supportMultipleDrawings))return;if(!_(this,cv)){Q(this,cv,!0);return}const n=_(this,ft).getMode();if(n===kt.STAMP||n===kt.SIGNATURE){_(this,ft).unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){var s;if(_(this,ft).getMode()===kt.HIGHLIGHT&&this.enableTextSelection(),_(this,Ph)){Q(this,Ph,!1);return}const{isMac:r}=Is.platform;if(e.button!==0||e.ctrlKey&&r||e.target!==this.div)return;if(Q(this,Ph,!0),(s=_(this,Xr,Cl))!=null&&s.isDrawer){this.startDrawingSession(e);return}const n=_(this,ft).getActive();Q(this,cv,!n||n.isEmpty())}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),_(this,Yo)){_(this,Xr,Cl).startDrawing(this,_(this,ft),!1,e);return}_(this,ft).setCurrentDrawingSession(this),Q(this,Yo,new AbortController);const r=_(this,ft).combinedSignal(_(this,Yo));this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(Q(this,ku,null),this.commitOrRemove())},{signal:r}),_(this,Xr,Cl).startDrawing(this,_(this,ft),!1,e)}pause(e){if(e){const{activeElement:r}=document;this.div.contains(r)&&Q(this,ku,r);return}_(this,ku)&&setTimeout(()=>{var r;(r=_(this,ku))==null||r.focus(),Q(this,ku,null)},0)}endDrawingSession(e=!1){return _(this,Yo)?(_(this,ft).setCurrentDrawingSession(null),_(this,Yo).abort(),Q(this,Yo,null),Q(this,ku,null),_(this,Xr,Cl).endDrawing(e)):null}findNewParent(e,r,n){const s=_(this,ft).findParent(r,n);return s===null||s===this?!1:(s.changeParent(e),!0)}commitOrRemove(){return _(this,Yo)?(this.endDrawingSession(),!0):!1}onScaleChanging(){_(this,Yo)&&_(this,Xr,Cl).onScaleChangingWhenDrawing(this)}destroy(){var e,r;this.commitOrRemove(),((e=_(this,ft).getActive())==null?void 0:e.parent)===this&&(_(this,ft).commitOrRemove(),_(this,ft).setActiveEditor(null)),_(this,Cu)&&(clearTimeout(_(this,Cu)),Q(this,Cu,null));for(const n of _(this,wa).values())(r=_(this,Am))==null||r.removePointerInTextLayer(n.contentDiv),n.setParent(null),n.isAttachedToDOM=!1,n.div.remove();this.div=null,_(this,wa).clear(),_(this,ft).removeLayer(this)}render({viewport:e}){this.viewport=e,Jm(this.div,e);for(const r of _(this,ft).getEditors(this.pageIndex))this.add(r),r.rebuild();this.updateMode()}update({viewport:e}){_(this,ft).commitOrRemove(),ce(this,Xr,cE).call(this);const r=this.viewport.rotation,n=e.rotation;if(this.viewport=e,Jm(this.div,{rotation:n}),r!==n)for(const s of _(this,wa).values())s.rotate(n)}get pageDimensions(){const{pageWidth:e,pageHeight:r}=this.viewport.rawDims;return[e,r]}get scale(){return _(this,ft).viewParameters.realScale}};Am=new WeakMap,cv=new WeakMap,tc=new WeakMap,Th=new WeakMap,Cu=new WeakMap,wa=new WeakMap,Ph=new WeakMap,uv=new WeakMap,Em=new WeakMap,Yo=new WeakMap,ku=new WeakMap,us=new WeakMap,Tu=new WeakMap,Oh=new WeakMap,dv=new WeakMap,ft=new WeakMap,Ih=new WeakMap,Xr=new WeakSet,Ffe=function(e){_(this,ft).unselectAll();const{target:r}=e;if(r===_(this,us).div||(r.getAttribute("role")==="img"||r.classList.contains("endOfContent"))&&_(this,us).div.contains(r)){const{isMac:n}=Is.platform;if(e.button!==0||e.ctrlKey&&n)return;_(this,ft).showAllEditors("highlight",!0,!0),_(this,us).div.classList.add("free"),this.toggleDrawing(),gk.startHighlighting(this,_(this,ft).direction==="ltr",{target:_(this,us).div,x:e.x,y:e.y}),_(this,us).div.addEventListener("pointerup",()=>{_(this,us).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:_(this,ft)._signal}),e.preventDefault()}},Cl=function(){return _(Do,Ih).get(_(this,ft).getMode())},N3=function(e){const r=_(this,Xr,Cl);return r?new r.prototype.constructor(e):null},A3=function(){const{x:e,y:r,width:n,height:s}=this.div.getBoundingClientRect(),i=Math.max(0,e),o=Math.max(0,r),l=Math.min(window.innerWidth,e+n),c=Math.min(window.innerHeight,r+s),u=(i+l)/2-e,d=(o+c)/2-r,[h,f]=this.viewport.rotation%180===0?[u,d]:[d,u];return{offsetX:h,offsetY:f}},cE=function(){for(const e of _(this,wa).values())e.isEmpty()&&e.remove()},Le(Do,"_initialized",!1),se(Do,Ih,new Map([i3,m3,_3,gk,w3].map(e=>[e._editorType,e])));let S3=Do;var Xo,fi,Cm,Sj,$k,$fe,Nc,C3,Bfe,k3;const Wn=class Wn{constructor({pageIndex:e}){se(this,Nc);se(this,Xo,null);se(this,fi,new Map);se(this,Cm,new Map);this.pageIndex=e}setParent(e){if(!_(this,Xo)){Q(this,Xo,e);return}if(_(this,Xo)!==e){if(_(this,fi).size>0)for(const r of _(this,fi).values())r.remove(),e.append(r);Q(this,Xo,e)}}static get _svgFactory(){return Ut(this,"_svgFactory",new pk)}draw(e,r=!1,n=!1){const s=ns(Wn,Sj)._++,i=ce(this,Nc,C3).call(this),o=Wn._svgFactory.createElement("defs");i.append(o);const l=Wn._svgFactory.createElement("path");o.append(l);const c=`path_p${this.pageIndex}_${s}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),r&&_(this,Cm).set(s,l);const u=n?ce(this,Nc,Bfe).call(this,o,c):null,d=Wn._svgFactory.createElement("use");return i.append(d),d.setAttribute("href",`#${c}`),this.updateProperties(i,e),_(this,fi).set(s,i),{id:s,clipPathId:`url(#${u})`}}drawOutline(e,r){const n=ns(Wn,Sj)._++,s=ce(this,Nc,C3).call(this),i=Wn._svgFactory.createElement("defs");s.append(i);const o=Wn._svgFactory.createElement("path");i.append(o);const l=`path_p${this.pageIndex}_${n}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke");let c;if(r){const h=Wn._svgFactory.createElement("mask");i.append(h),c=`mask_p${this.pageIndex}_${n}`,h.setAttribute("id",c),h.setAttribute("maskUnits","objectBoundingBox");const f=Wn._svgFactory.createElement("rect");h.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const p=Wn._svgFactory.createElement("use");h.append(p),p.setAttribute("href",`#${l}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const u=Wn._svgFactory.createElement("use");s.append(u),u.setAttribute("href",`#${l}`),c&&u.setAttribute("mask",`url(#${c})`);const d=u.cloneNode();return s.append(d),u.classList.add("mainOutline"),d.classList.add("secondaryOutline"),this.updateProperties(s,e),_(this,fi).set(n,s),n}finalizeDraw(e,r){_(this,Cm).delete(e),this.updateProperties(e,r)}updateProperties(e,r){var c;if(!r)return;const{root:n,bbox:s,rootClass:i,path:o}=r,l=typeof e=="number"?_(this,fi).get(e):e;if(l){if(n&&ce(this,Nc,k3).call(this,l,n),s&&ce(c=Wn,$k,$fe).call(c,l,s),i){const{classList:u}=l;for(const[d,h]of Object.entries(i))u.toggle(d,h)}if(o){const d=l.firstChild.firstChild;ce(this,Nc,k3).call(this,d,o)}}}updateParent(e,r){if(r===this)return;const n=_(this,fi).get(e);n&&(_(r,Xo).append(n),_(this,fi).delete(e),_(r,fi).set(e,n))}remove(e){_(this,Cm).delete(e),_(this,Xo)!==null&&(_(this,fi).get(e).remove(),_(this,fi).delete(e))}destroy(){Q(this,Xo,null);for(const e of _(this,fi).values())e.remove();_(this,fi).clear(),_(this,Cm).clear()}};Xo=new WeakMap,fi=new WeakMap,Cm=new WeakMap,Sj=new WeakMap,$k=new WeakSet,$fe=function(e,[r,n,s,i]){const{style:o}=e;o.top=`${100*n}%`,o.left=`${100*r}%`,o.width=`${100*s}%`,o.height=`${100*i}%`},Nc=new WeakSet,C3=function(){const e=Wn._svgFactory.create(1,1,!0);return _(this,Xo).append(e),e.setAttribute("aria-hidden",!0),e},Bfe=function(e,r){const n=Wn._svgFactory.createElement("clipPath");e.append(n);const s=`clip_${r}`;n.setAttribute("id",s),n.setAttribute("clipPathUnits","objectBoundingBox");const i=Wn._svgFactory.createElement("use");return n.append(i),i.setAttribute("href",`#${r}`),i.classList.add("clip"),s},k3=function(e,r){for(const[n,s]of Object.entries(r))s===null?e.removeAttribute(n):e.setAttribute(n,s)},se(Wn,$k),se(Wn,Sj,0);let E3=Wn;globalThis._pdfjsTestingUtils={HighlightOutliner:o3};globalThis.pdfjsLib={AbortException:nf,AnnotationEditorLayer:S3,AnnotationEditorParamsType:Kt,AnnotationEditorType:kt,AnnotationEditorUIManager:eg,AnnotationLayer:r3,AnnotationMode:Md,AnnotationType:On,build:Rct,ColorPicker:hk,createValidAbsoluteUrl:Ode,DOMSVGFactory:pk,DrawLayer:E3,FeatureTest:Is,fetchData:hS,getDocument:Dhe,getFilenameFromUrl:Elt,getPdfFilenameFromUrl:Clt,getRGB:q2,getUuid:Mde,getXfaPageViewport:Tlt,GlobalWorkerOptions:ic,ImageKind:IA,InvalidPDFException:f5,isDataScheme:V2,isPdfFile:Q8,isValidExplicitDest:Ult,MathClamp:mi,noContextMenu:So,normalizeUnicode:Slt,OPS:ok,OutputScale:jc,PasswordResponses:mlt,PDFDataRangeTransport:Lhe,PDFDateString:ck,PDFWorker:H1,PermissionFlag:plt,PixelsPerInch:sf,RenderingCancelledException:X8,ResponseException:lk,setLayerDimensions:Jm,shadow:Ut,SignatureExtractor:Pu,stopEvent:Mn,SupportedImageMimeTypes:m5,TextLayer:U1,TouchManager:dk,updateUrlHash:Ide,Util:pt,VerbosityLevel:z2,version:Bhe,XfaLayer:zhe};ic.workerSrc=`https://unpkg.com/pdfjs-dist@${Bhe}/build/pdf.worker.min.mjs`;function nut({open:t,onOpenChange:e,pdfUrl:r,title:n}){const[s,i]=S.useState(null),[o,l]=S.useState(1),[c,u]=S.useState(0),[d,h]=S.useState(1),[f,p]=S.useState(!0),[g,m]=S.useState(null),[x,y]=S.useState(!0),[v,b]=S.useState(!1),[w,j]=S.useState([]),[N,C]=S.useState([]),k=S.useRef(null),E=S.useRef([]),M=S.useRef(null);S.useEffect(()=>{if(!t||!r)return;p(!0),m(null),i(null),j([]),C([]),l(1),(async()=>{try{const F=await Dhe(r).promise;i(F),u(F.numPages),p(!1)}catch(L){console.error("Error loading PDF:",L),m("Failed to load PDF. Please try again."),p(!1)}})()},[t,r]),S.useEffect(()=>{if(!s||N.length>0)return;(async()=>{const L=[];for(let F=1;F<=s.numPages;F++)try{const W=await s.getPage(F),X=W.getViewport({scale:d}),oe=document.createElement("canvas"),le=oe.getContext("2d");if(!le)continue;oe.height=X.height,oe.width=X.width,await W.render({canvasContext:le,viewport:X,canvas:oe}).promise,L.push(oe.toDataURL("image/png",.9))}catch(W){console.error(`Error rendering page ${F}:`,W)}C(L)})()},[s,d]),S.useEffect(()=>{!s||!t||C([])},[d]),S.useEffect(()=>{if(!s||w.length>0)return;(async()=>{const L=[];for(let F=1;F<=Math.min(s.numPages,50);F++)try{const W=await s.getPage(F),X=W.getViewport({scale:.2}),oe=document.createElement("canvas"),le=oe.getContext("2d");if(!le)continue;oe.height=X.height,oe.width=X.width,await W.render({canvasContext:le,viewport:X,canvas:oe}).promise,L.push(oe.toDataURL())}catch(W){console.error(`Error generating thumbnail for page ${F}:`,W)}j(L)})()},[s,w.length]),S.useEffect(()=>{const B=M.current;if(!B||N.length===0)return;const L=()=>{const F=B.scrollTop,W=B.clientHeight;for(let X=0;X<E.current.length;X++){const oe=E.current[X];if(!oe)continue;const le=oe.offsetTop,U=oe.offsetHeight,R=le+U/2;if(R>F&&R<F+W){l(X+1);break}}};return B.addEventListener("scroll",L),()=>B.removeEventListener("scroll",L)},[N]);const z=S.useCallback(B=>{const L=E.current[B-1];L&&M.current&&(L.scrollIntoView({behavior:"smooth",block:"start"}),l(B))},[]),P=()=>{o>1&&z(o-1)},V=()=>{o<c&&z(o+1)},A=B=>{const L=parseInt(B.target.value);L>=1&&L<=c&&z(L)},$=B=>{if(B.key==="Enter"){const L=parseInt(B.target.value);L>=1&&L<=c&&z(L)}},K=()=>h(B=>Math.min(B+.25,3)),G=()=>h(B=>Math.max(B-.25,.5)),Y=()=>{if(k.current&&s){const B=k.current.clientWidth-48;s.getPage(1).then(L=>{const F=L.getViewport({scale:1});h(B/F.width)})}},H=()=>{const B=document.createElement("a");B.href=r,B.download=n||"document.pdf",B.click()};return S.useEffect(()=>{if(!t)return;const B=L=>{L.key==="ArrowLeft"&&P(),L.key==="ArrowRight"&&V(),(L.key==="+"||L.key==="=")&&K(),L.key==="-"&&G()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[t,o,c]),a.jsx(qr,{open:t,onOpenChange:e,children:a.jsxs(Dr,{className:Ie("p-0 gap-0 overflow-hidden",v?"max-w-[100vw] h-[100vh] rounded-none":"max-w-6xl h-[90vh]"),children:[a.jsx(Lr,{className:"px-4 py-3 border-b bg-muted/30",children:a.jsx(Fr,{className:"text-base font-medium truncate pr-8",children:n||"PDF Document"})}),a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted/20 backdrop-blur-sm",children:[a.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>y(!x),className:"h-8 w-8 p-0",children:x?a.jsx(lbe,{className:"h-4 w-4"}):a.jsx(cbe,{className:"h-4 w-4"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ye,{variant:"ghost",size:"sm",onClick:P,disabled:o<=1,className:"h-8 w-8 p-0",children:a.jsx(Ive,{className:"h-4 w-4"})}),a.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[a.jsx(Fe,{type:"number",min:1,max:c,value:o,onChange:A,onKeyDown:$,className:"w-14 h-7 text-center text-sm [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"}),a.jsxs("span",{className:"text-muted-foreground",children:["of ",c]})]}),a.jsx(ye,{variant:"ghost",size:"sm",onClick:V,disabled:o>=c,className:"h-8 w-8 p-0",children:a.jsx(HJ,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(ye,{variant:"ghost",size:"sm",onClick:G,disabled:d<=.5,className:"h-8 w-8 p-0",children:a.jsx(jbe,{className:"h-4 w-4"})}),a.jsxs(ye,{variant:"ghost",size:"sm",onClick:Y,className:"h-8 px-2 text-xs",children:[Math.round(d*100),"%"]}),a.jsx(ye,{variant:"ghost",size:"sm",onClick:K,disabled:d>=3,className:"h-8 w-8 p-0",children:a.jsx(_be,{className:"h-4 w-4"})}),a.jsx("div",{className:"w-px h-5 bg-border mx-1"}),a.jsx(ye,{variant:"ghost",size:"sm",onClick:H,className:"h-8 w-8 p-0",children:a.jsx(mo,{className:"h-4 w-4"})}),a.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>b(!v),className:"h-8 w-8 p-0",children:v?a.jsx(ibe,{className:"h-4 w-4"}):a.jsx(Jve,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"flex flex-1 overflow-hidden",ref:k,children:[x&&a.jsx("div",{className:"w-32 border-r bg-muted/10 flex-shrink-0",children:a.jsx(Yj,{className:"h-full",children:a.jsxs("div",{className:"p-2 space-y-2",children:[w.map((B,L)=>a.jsxs("button",{onClick:()=>z(L+1),className:Ie("w-full rounded-lg border-2 overflow-hidden transition-all",o===L+1?"border-primary shadow-md":"border-transparent hover:border-muted-foreground/30"),children:[a.jsx("img",{src:B,alt:`Page ${L+1}`,className:"w-full"}),a.jsx("div",{className:"text-xs text-muted-foreground py-1",children:L+1})]},L)),w.length===0&&!f&&a.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"Loading thumbnails..."})]})})}),a.jsx("div",{ref:M,className:"flex-1 overflow-auto bg-muted/5",children:f?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(St,{className:"h-8 w-8 animate-spin text-primary"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading PDF..."})]})}):g?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-destructive mb-2",children:g}),a.jsx(ye,{variant:"outline",onClick:()=>e(!1),children:"Close"})]})}):N.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(St,{className:"h-8 w-8 animate-spin text-primary"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Rendering pages..."})]})}):a.jsx("div",{className:"flex flex-col items-center gap-4 p-6",children:N.map((B,L)=>a.jsxs("div",{ref:F=>E.current[L]=F,className:"relative",children:[a.jsx("img",{src:B,alt:`Page ${L+1}`,className:"shadow-lg rounded-sm max-w-full"}),a.jsxs("div",{className:"absolute -bottom-3 left-1/2 -translate-x-1/2 bg-muted/80 backdrop-blur-sm px-2 py-0.5 rounded text-xs text-muted-foreground",children:["Page ",L+1]})]},L))})})]})]})})}function sut({documentId:t}){const[e,r]=S.useState(null),[n,s]=S.useState(0),[i,o]=S.useState(""),[l,c]=S.useState(!1),[u,d]=S.useState(!0),[h,f]=S.useState(!1);S.useEffect(()=>{p()},[t]);const p=async()=>{var C;d(!0);const[w,j]=await Promise.all([be.from("pages").select("page_number").eq("document_id",t).order("page_number",{ascending:!0}).limit(1).maybeSingle(),be.from("pages").select("id",{count:"exact",head:!0}).eq("document_id",t)]),N=((C=w.data)==null?void 0:C.page_number)??null;r(N),s(j.count??0),o(N!=null?String(N):""),d(!1)},g=parseInt(i,10),m=!isNaN(g)&&i.trim()!=="",x=m&&e!=null?g-e:0,y=e!=null&&e!==1,v=()=>{if(x===0){$e.info("No correction needed — the start page is already correct.");return}f(!0)},b=async()=>{f(!1),c(!0);try{const{data:w,error:j}=await be.from("pages").select("id, page_number").eq("document_id",t);if(j)throw j;if(!w||w.length===0){$e.error("No pages found for this document.");return}const N=w.map(M=>be.from("pages").update({page_number:(M.page_number??0)+x}).eq("id",M.id)),k=(await Promise.all(N)).filter(M=>M.error);if(k.length>0){console.error("Some page updates failed:",k),$e.error(`${k.length} page(s) could not be updated.`);return}const E=x>0?"+":"";$e.success(`Page numbers corrected (Offset: ${E}${x})`),await p()}catch(w){console.error("Page correction error:",w),$e.error("Error correcting page numbers.")}finally{c(!1)}};return u?a.jsxs(a.Fragment,{children:[a.jsx(Ps,{}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-2",children:[a.jsx(Xs,{className:"w-4 h-4 animate-spin"}),"Loading page data..."]})]}):n===0?null:a.jsxs(a.Fragment,{children:[a.jsx(Ps,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold",children:"Correct Original Page Numbers"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"If this PDF is an excerpt (e.g. from a journal), enter the real page number of the first PDF page."})]}),y&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/30 p-2 rounded-md",children:[a.jsx(Ia,{className:"w-3.5 h-3.5 shrink-0 text-destructive"}),"Pages already shifted — first page is currently ",e,"."]}),a.jsxs("div",{className:"flex items-end gap-3",children:[a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(_e,{htmlFor:"page-start",className:"text-xs",children:"PDF page 1 corresponds to original page:"}),a.jsx(Fe,{id:"page-start",type:"number",value:i,onChange:w=>o(w.target.value),placeholder:"e.g. 413",className:"h-9"})]}),a.jsx(ye,{size:"sm",onClick:v,disabled:!m||x===0||l,className:"h-9",children:l?a.jsx(Xs,{className:"w-4 h-4 animate-spin"}):"Correct Pages"})]}),m&&x!==0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[n," page(s) will be shifted by ",x>0?"+":"",x,". Page ",e," → ",g,", Page ",(e??0)+n-1," → ",g+n-1,"."]})]}),a.jsx(ji,{open:h,onOpenChange:f,children:a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Correct Page Numbers?"}),a.jsxs(si,{children:["All ",n," page(s) will be shifted by ",x>0?"+":"",x,". Page ",e," becomes ",g,", Page ",(e??0)+n-1," becomes ",g+n-1,". This cannot be easily undone."]})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:b,children:"Correct Pages"})]})]})})]})}function iut({documents:t,documentPages:e,onDocumentDeleted:r,currentPage:n,itemsPerPage:s,totalItems:i,onPageChange:o}){const l=gr(),{userProfile:c}=Pt(),[u,d]=S.useState(new Set),[h,f]=S.useState({}),[p,g]=S.useState(new Set),[m,x]=S.useState(new Set),[y,v]=S.useState(""),[b,w]=S.useState(!1),[j,N]=S.useState(null);S.useEffect(()=>{DT(t,"documents").then(f)},[t]);const C=H=>{var F,W,X,oe;const B=H.book_title;if(B)return B;const L=H.bib_meta;if(!L)return null;if(L.title&&typeof L.title=="string")return L.title;if((F=L.google_books_data)!=null&&F.title)return L.google_books_data.title;if((X=(W=L.crossref_data)==null?void 0:W.crossref_metadata)!=null&&X.title){const le=L.crossref_data.crossref_metadata.title;return Array.isArray(le)?le[0]:le}if((oe=L.crossref_payload)!=null&&oe.title){const le=L.crossref_payload.title;return Array.isArray(le)?le[0]:le}return null},k=async H=>{const B=t.find(L=>L.id===H);if(B){d(L=>new Set(L).add(H));try{const{error:L}=await be.from("summaries").delete().eq("document_id",H).eq("user_id",c==null?void 0:c.id);if(L)throw L;const{error:F}=await be.from("documents").delete().eq("id",H).eq("user_id",c==null?void 0:c.id);if(F)throw F;try{B.storage_path&&await be.storage.from("documents").remove([B.storage_path])}catch(W){console.warn("Could not delete file from storage:",W)}$e.success("Document deleted successfully"),r()}catch(L){console.error("Delete error:",L),$e.error("Error deleting. Please try again.")}finally{d(L=>{const F=new Set(L);return F.delete(H),F})}}},E=async(H,B)=>{try{await navigator.clipboard.writeText(H),g(L=>new Set(L).add(B)),$e.success("Citation copied to clipboard"),setTimeout(()=>{g(L=>{const F=new Set(L);return F.delete(B),F})},2e3)}catch{$e.error("Error copying to clipboard")}},M=(H,B)=>{x(L=>new Set(L).add(H)),v(B)},z=async H=>{try{const{error:B}=await be.from("documents").update({citation_apa:y}).eq("id",H).eq("user_id",c==null?void 0:c.id);if(B)throw B;$e.success("Citation updated successfully"),r(),x(L=>{const F=new Set(L);return F.delete(H),F})}catch(B){console.error("Save citation error:",B),$e.error("Error saving citation")}},P=H=>{x(B=>{const L=new Set(B);return L.delete(H),L}),v("")},V=H=>h[H.id]||null,A=H=>e[H]||!1?a.jsx(gt,{className:"bg-green-100 text-green-800 hover:bg-green-200",children:"Completed"}):a.jsx(gt,{variant:"secondary",children:"open"}),$=H=>new Date(H).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),K=Math.ceil(i/s),G=(n-1)*s+1,Y=Math.min(n*s,i);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(vl,{children:[a.jsx(bl,{children:a.jsxs(Cn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Pages"}),a.jsx(yt,{children:"ISBN/DOI"}),a.jsx(yt,{children:"Index Status"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(wl,{children:t.map(H=>{const B=u.has(H.id),L=p.has(H.id),F=m.has(H.id);return a.jsxs(Cn,{children:[a.jsx(xt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Nr,{className:"w-4 h-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-sm",children:H.original_filename||H.title}),(()=>{const W=C(H),X=H.original_filename||H.title||"";if(W&&W!==X){const oe=W.length>70?W.substring(0,70)+"...":W;return a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(cz,{className:"w-3 h-3"}),oe]})}return null})()]})]})}),a.jsxs(xt,{className:"text-muted-foreground",children:[H.page_count||"?"," Pages"]}),a.jsx(xt,{className:"text-muted-foreground",children:H.isbn?`ISBN: ${H.isbn}`:H.doi?`DOI: ${H.doi}`:"–"}),a.jsx(xt,{children:A(H.id)}),a.jsx(xt,{className:"text-muted-foreground",children:$(H.created_at)}),a.jsx(xt,{className:"text-right",children:a.jsx(Ai,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",onClick:()=>{V(H)?(N(H),w(!0)):$e.error("PDF URL not available")},children:a.jsx(Qi,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View PDF"})})]}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx("a",{href:V(H)||"#",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center w-8 h-8 p-0 rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground",onClick:W=>{V(H)||(W.preventDefault(),$e.error("PDF URL not available"))},children:a.jsx(ib,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Open in New Tab"})})]}),a.jsxs(qr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(fl,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",disabled:!H.citation_apa,children:a.jsx(ab,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:H.citation_apa?"View APA Citation":"No citation available"})})]}),a.jsxs(Dr,{className:"max-w-lg",children:[a.jsxs(Lr,{children:[a.jsxs(Fr,{className:"flex items-center gap-2",children:[a.jsx(cz,{className:"w-5 h-5"}),"Book Information"]}),a.jsx(gb,{children:"Automatically detected data for this document"})]}),H.bib_meta&&(()=>{var xe,ae,de,ge,we,je,Se,Ue,Ae,fe,Ee,Ce,Ge;const W=H.bib_meta,X=W==null?void 0:W.google_books_data,oe=W==null?void 0:W.crossref_payload,le=W==null?void 0:W.crossref_data,U=oe||le,R=(W==null?void 0:W.method)==="manual_entry"||(W==null?void 0:W.method)==="parsed_paste",ee=((xe=U==null?void 0:U.author)==null?void 0:xe.map(ht=>`${ht.given||""} ${ht.family||""}`.trim()).join(", "))||((ae=le==null?void 0:le.authors)==null?void 0:ae.join(", ")),te=((we=(ge=(de=U==null?void 0:U.issued)==null?void 0:de["date-parts"])==null?void 0:ge[0])==null?void 0:we.join("-"))||((Ue=(Se=(je=U==null?void 0:U.published)==null?void 0:je["date-parts"])==null?void 0:Se[0])==null?void 0:Ue.join("-"))||(le==null?void 0:le.year),Z=Array.isArray(U==null?void 0:U.title)?U.title[0]:U==null?void 0:U.title,J=Array.isArray(U==null?void 0:U["container-title"])?U["container-title"][0]:(U==null?void 0:U["container-title"])||(le==null?void 0:le.journal),he=(U==null?void 0:U.page)||(le==null?void 0:le.pages),O=((Ae=U==null?void 0:U.ISBN)==null?void 0:Ae[0])||((Ee=(fe=le==null?void 0:le.crossref_metadata)==null?void 0:fe.ISBN)==null?void 0:Ee[0]),ie=(U==null?void 0:U.type)||((Ce=le==null?void 0:le.crossref_metadata)==null?void 0:Ce.type),q=R?W.title:(X==null?void 0:X.title)||Z,I=R?Array.isArray(W.authors)?W.authors.join(", "):W.authors:((Ge=X==null?void 0:X.authors)==null?void 0:Ge.join(", "))||ee,T=R?W.publisher:(X==null?void 0:X.publisher)||(U==null?void 0:U.publisher),D=R?W.published_year:(X==null?void 0:X.publishedDate)||te,ne=R?W.pages:he||(X==null?void 0:X.pageCount),ue=R?W.edition:null,re=R?W.language:null,pe=R?W.series:null,ve=R?W.type:ie;return a.jsxs("div",{className:"space-y-2 p-4 bg-muted/50 rounded-lg border",children:[q&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Title:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:q})]}),ve&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Type:"}),a.jsx("span",{className:"text-sm font-medium text-right capitalize",children:String(ve).replace("-"," ")})]}),I&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Author(s):"}),a.jsx("span",{className:"text-sm font-medium text-right",children:I})]}),J&&!R&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Journal:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:J})]}),T&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Publisher:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:T})]}),D&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Published:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:D})]}),ue&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Edition:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:ue})]}),((U==null?void 0:U.volume)||(U==null?void 0:U.issue))&&!R&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Volume/Issue:"}),a.jsxs("span",{className:"text-sm font-medium text-right",children:[(U==null?void 0:U.volume)&&`Vol. ${U.volume}`,(U==null?void 0:U.volume)&&(U==null?void 0:U.issue)&&", ",(U==null?void 0:U.issue)&&`Issue ${U.issue}`]})]}),ne&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Pages:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:ne})]}),re&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Language:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:re})]}),pe&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Series:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:pe})]}),(O||(X==null?void 0:X.isbn)||H.isbn)&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"ISBN:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:O||(X==null?void 0:X.isbn)||H.isbn})]}),(H.doi||(U==null?void 0:U.DOI)||(U==null?void 0:U.doi))&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"DOI:"}),a.jsx("a",{href:`https://doi.org/${(H.doi||(U==null?void 0:U.DOI)||(U==null?void 0:U.doi)).replace("https://doi.org/","")}`,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-primary hover:underline text-right break-all",children:(H.doi||(U==null?void 0:U.DOI)||(U==null?void 0:U.doi)).replace("https://doi.org/","")})]}),(U==null?void 0:U.ISSN)&&!R&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"ISSN:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:Array.isArray(U.ISSN)?U.ISSN[0]:U.ISSN})]}),(W==null?void 0:W.method)&&a.jsxs("div",{className:"flex justify-between gap-4 pt-2 border-t border-border/50 mt-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Source:"}),a.jsx(gt,{variant:"secondary",className:"text-xs",children:W.method==="manual_entry"?"Manual Entry":W.method==="parsed_paste"?"Parsed Paste":W.method==="crossref"?"CrossRef":W.method==="google_books"?"Google Books":W.method})]})]})})(),!H.bib_meta&&a.jsx("div",{className:"p-4 bg-muted/50 rounded-lg border text-center text-sm text-muted-foreground",children:'No metadata available. Click "Detect APA" to fetch data.'}),a.jsx(sut,{documentId:H.id}),a.jsx(Ps,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold",children:"APA-7 Citation"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically detected citation for this document"})]}),F?a.jsxs("div",{className:"space-y-3",children:[a.jsx(Ht,{value:y,onChange:W=>v(W.target.value),className:"min-h-[100px] text-sm",placeholder:"Edit APA citation..."}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ye,{onClick:()=>z(H.id),size:"sm",className:"flex items-center gap-2",children:[a.jsx(yD,{className:"w-4 h-4"}),"Save"]}),a.jsxs(ye,{onClick:()=>P(H.id),size:"sm",variant:"outline",className:"flex items-center gap-2",children:[a.jsx(En,{className:"w-4 h-4"}),"Cancel"]})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"p-4 bg-muted rounded-lg",children:a.jsx("p",{className:"text-sm leading-relaxed",children:H.citation_apa||"No citation available"})}),H.citation_apa&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ye,{onClick:()=>E(H.citation_apa,H.id),variant:L?"default":"outline",className:"flex items-center gap-2",children:L?"Copied!":"Copy"}),a.jsxs(ye,{onClick:()=>M(H.id,H.citation_apa),variant:"outline",className:"flex items-center gap-2",children:[a.jsx(ZJ,{className:"w-4 h-4"}),"Edit"]})]})]})]})]})]}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",onClick:()=>l(`/reference-checker?document=${H.id}`),children:a.jsx(gl,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Check with Reference Checker"})})]}),a.jsxs(ji,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(jo,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:B,children:B?a.jsx(Xs,{className:"w-4 h-4 animate-spin"}):a.jsx(Ts,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Delete Document"}),a.jsxs(si,{children:['Are you sure you want to delete "',H.original_filename||H.title,'"? This action cannot be undone.']})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:()=>k(H.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},H.id)})})]}),K>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[G,"-",Y," of ",i," Documents"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>o(n-1),disabled:n===1,children:"Back"}),a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>o(n+1),disabled:n===K,children:"Next"})]})]}),a.jsx(nut,{open:b,onOpenChange:w,pdfUrl:j&&h[j.id]||"",title:(j==null?void 0:j.title)||(j==null?void 0:j.original_filename)||"PDF Document"})]})}function vK(t){return!t||!t.length?"- –":t.map(e=>`- ${e}`).join(`
`)}function bK(t){if(!t)return"";const e=t.intro?`${t.intro}
`:"",r=(t.questions??[]).map((n,s)=>{const i=(n.probes??[]).map(l=>` - ${l}`).join(`
`),o=n.maps_to_rq?` *(zu ${n.maps_to_rq})*`:"";return`${s+1}. **${n.question}**${o}
${i?`
${i}
`:""}`}).join(`
`);return`${e}${r}`}function aut(t){const e=(t==null?void 0:t.meta)??{},r=(t==null?void 0:t.participant_interview)??{},n=(t==null?void 0:t.expert_interview)??{},s=(t==null?void 0:t.notes)??{},i=e.title||"Research Setup",o=(e.derived_research_questions??[]).map(l=>`- ${l}`).join(`
`);return[`# ${i}`,"",`**Objective:** ${e.aim??"–"}`,`**Degree:** ${e.degree??"–"} | **Discipline:** ${e.discipline??"–"} | **Language:** ${e.language??"–"}`,"","## Research Questions",o||"- –","","## Guidelines: Participant Interviews",bK(r)||"- –","","## Guidelines: Expert Interviews",bK(n)||"- –","","## Sampling & Criteria",`**Sampling-Strategy**
${s.sampling??"–"}`,"",`**Inclusion Criteria**
${vK(s.inclusion)}`,"",`**Exclusion Criteria**
${vK(s.exclusion)}`,"","## Ethics",s.ethics??"–","","## Piloting",s.pilot??"–"].join(`
`)}function out(t){let e=`# ${t.title}
`;return e+=`${t.content}
`,t.literature&&t.literature.length>0&&(e+=`## Literaturverzeichnis
`,t.literature.forEach(r=>{e+=`- ${r}
`}),e+=`
`),t.proof_of_material&&t.proof_of_material.length>0&&(e+=`## Quellennachweis
`,t.proof_of_material.forEach((r,n)=>{e+=`**[${n+1}] ${r.citation}**
`,e+=`> ${r.original_text}
`,r.page_number&&(e+=`*Seite ${r.page_number}*`),r.document_title&&(e+=` - ${r.document_title}`),e+=`
`})),e.trim()}function xk(t,e){var r,n,s,i,o;if(e==="research_setup")try{if(t.trim().startsWith("#"))return t;const l=JSON.parse(t);return aut(l)}catch(l){return console.error("Failed to parse research setup data:",l),t||"Error displaying research setup data"}if(e==="topic_explorer")try{if(t.trim().startsWith("#"))return t;const l=JSON.parse(t);let c=`# ${l.title}
`;return l.introduction&&(c+=`## Introduction
${l.introduction}
`),l.problem&&(c+=`## Problem Statement
${l.problem}
`),l.objectives&&(c+=`## Objectives
${l.objectives}
`),(n=(r=l.original_selection)==null?void 0:r.researchQuestions)!=null&&n.length&&(c+=`## Research Questions?
`,l.original_selection.researchQuestions.forEach((u,d)=>{c+=`${d+1}. ${u}
`}),c+=`
`),(s=l.original_selection)!=null&&s.method&&(c+=`## Methodology
${l.original_selection.method}
`),(o=(i=l.original_selection)==null?void 0:i.sources)!=null&&o.length&&(c+=`## Literature Recommendations
`,l.original_selection.sources.forEach((u,d)=>{c+=`${d+1}. ${u.title}`,u.doi&&(c+=` (DOI: ${u.doi})`),u.isbn&&(c+=` (ISBN: ${u.isbn})`),c+=`
`}),c+=`
`),c.trim()}catch(l){return console.error("Failed to parse topic explorer data:",l),t||"Error displaying topic explorer data"}if(e==="thesis_builder"||e==="theory"||e==="paragraph"||e==="outline")try{if(t.trim().startsWith("#"))return t;const l=JSON.parse(t);return out(l)}catch(l){return console.warn("Could not parse thesis builder data:",l),t||"No content available"}return t||"No text available"}function wK(t){var e,r,n,s,i;if(t.summary_mode==="research_setup")try{return(e=t.summary_text)!=null&&e.trim().startsWith("#")?t.summary_text.split(`
`)[0].replace(/^#+\s*/,""):((r=JSON.parse(t.summary_text||"{}").meta)==null?void 0:r.title)||"Research Setup"}catch{return"Research Setup"}if(t.summary_mode==="topic_explorer")try{return(n=t.summary_text)!=null&&n.trim().startsWith("#")?t.summary_text.split(`
`)[0].replace(/^#+\s*/,""):(JSON.parse(t.summary_text||"{}").title||"Topic Explorer Struktur").replace(/^#+\s*/,"")}catch{return"Topic Explorer Struktur"}return((s=t.documents)==null?void 0:s.original_filename)||((i=t.documents)==null?void 0:i.title)||"Unbekanntes Dokument"}function _K(t){return t==="research_setup"?"Research Setup":t==="topic_explorer"?"Topic Explorer":{small:"Kurz",medium:"Mittel",large:"Lang",detailed:"Detailliert",big:"Ausführlich",deep15:"Detailliert"}[t||""]||t||""}function lut({summaries:t,onSummaryDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){const{userProfile:o}=Pt(),[l,c]=S.useState(new Set),[u,d]=S.useState({});S.useEffect(()=>{DT(t,"summaries").then(d)},[t]);const h=async v=>{c(b=>new Set(b).add(v));try{const{error:b}=await be.from("summaries").delete().eq("id",v).eq("user_id",o==null?void 0:o.id);if(b)throw b;$e.success("Summary deleted successfully"),e()}catch(b){console.error("Delete error:",b),$e.error("Error deleting. Please try again.")}finally{c(b=>{const w=new Set(b);return w.delete(v),w})}},f=async v=>{try{await navigator.clipboard.writeText(v),$e.success("Copied to clipboard")}catch{$e.error("Error copying")}},p=v=>new Date(v).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),g=v=>u[v.id]||null,m=Math.ceil(s/n),x=(r-1)*n+1,y=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(vl,{children:[a.jsx(bl,{children:a.jsxs(Cn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Mode"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(wl,{children:t.map(v=>{const b=l.has(v.id),w=g(v);return a.jsxs(Cn,{children:[a.jsx(xt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Nr,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:wK(v)})})]})}),a.jsx(xt,{children:a.jsx(gt,{variant:"outline",children:_K(v.summary_mode||"")})}),a.jsx(xt,{className:"text-muted-foreground",children:p(v.created_at)}),a.jsx(xt,{className:"text-right",children:a.jsx(Ai,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(qr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(fl,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Qi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View Text"})})]}),a.jsxs(Dr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Summary"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:wK(v)}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Mode: ",_K(v.summary_mode||"")," | Created: ",p(v.created_at)]})]}),a.jsx("div",{className:"prose max-w-none",children:a.jsx("div",{className:"whitespace-pre-wrap",children:xk(v.summary_text||"",v.summary_mode||"")})}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ye,{onClick:()=>f(xk(v.summary_text||"",v.summary_mode||"")),className:"flex items-center space-x-2",children:[a.jsx(bn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),w&&a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",onClick:()=>window.open(w,"_blank"),children:a.jsx(ib,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Open PDF"})})]}),a.jsxs(ji,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(jo,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:b,children:b?a.jsx(Xs,{className:"w-4 h-4 animate-spin"}):a.jsx(Ts,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Delete Summary"}),a.jsx(si,{children:"Are you sure you want to delete this summary? This action cannot be undone."})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:()=>h(v.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},v.id)})})]}),m>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[x,"-",y," of ",s," Summaries"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===m,children:"Next"})]})]})]})}function cut({methods:t,onMethodDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){const{userProfile:o}=Pt(),[l,c]=S.useState(new Set),[u,d]=S.useState({});S.useEffect(()=>{DT(t,"summaries").then(d)},[t]);const h=async w=>{c(j=>new Set(j).add(w));try{const{error:j}=await be.from("methods").delete().eq("id",w).eq("user_id",o==null?void 0:o.id);if(j)throw j;$e.success("Methodology deleted successfully"),e()}catch(j){console.error("Delete error:",j),$e.error("Error deleting. Please try again.")}finally{c(j=>{const N=new Set(j);return N.delete(w),N})}},f=async w=>{try{await navigator.clipboard.writeText(w),$e.success("Copied to clipboard")}catch{$e.error("Error copying")}},p=w=>new Date(w).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),g=w=>u[w.id]||null,m=w=>{var j,N;return((j=w.documents)==null?void 0:j.title)||((N=w.documents)==null?void 0:N.original_filename)||w.title||"Unknown Document"},x=w=>{switch(w){case"small":return"Short";case"medium":return"Medium";case"big":return"Long";default:return"Methods"}},y=Math.ceil(s/n),v=(r-1)*n+1,b=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(vl,{children:[a.jsx(bl,{children:a.jsxs(Cn,{children:[a.jsx(yt,{children:"Title"}),a.jsx(yt,{children:"Document Sources"}),a.jsx(yt,{children:"Mode"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(wl,{children:t.map(w=>{var C,k,E;const j=l.has(w.id),N=g(w);return a.jsxs(Cn,{children:[a.jsx(xt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Nr,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:((k=(C=w.method_text)==null?void 0:C.split(`
`)[0])==null?void 0:k.trim())||w.title||"Methods & Approach"})})]})}),a.jsx(xt,{className:"text-muted-foreground",children:a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-medium",children:m(w)}),a.jsxs("span",{className:"text-xs",children:[((E=w.documents)==null?void 0:E.page_count)||"?"," Pages"]})]})}),a.jsx(xt,{children:a.jsx(gt,{variant:"outline",children:x(w.mode||"")})}),a.jsx(xt,{className:"text-muted-foreground",children:p(w.created_at)}),a.jsx(xt,{className:"text-right",children:a.jsx(Ai,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(qr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(fl,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Qi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View Text"})})]}),a.jsxs(Dr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Methodology"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:w.title||"Methods & Approach"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Document: ",m(w)," | Mode: ",x(w.mode||"")," | Created: ",p(w.created_at)]})]}),a.jsx("div",{className:"prose max-w-none",children:a.jsx("div",{className:"whitespace-pre-wrap",children:w.method_text||""})}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ye,{onClick:()=>f(w.method_text||""),className:"flex items-center space-x-2",children:[a.jsx(bn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),N&&a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",onClick:()=>window.open(N,"_blank"),children:a.jsx(ib,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Open PDF"})})]}),a.jsxs(ji,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(jo,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:j,children:j?a.jsx(Xs,{className:"w-4 h-4 animate-spin"}):a.jsx(Ts,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Delete Methodology"}),a.jsx(si,{children:"Are you sure you want to delete this methodology? This action cannot be undone."})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:()=>h(w.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},w.id)})})]}),y>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[v,"-",b," of ",s," Methodology Entries"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===y,children:"Next"})]})]})]})}const uut=({theories:t,onTheoryDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i})=>{const{userProfile:o}=Pt(),[l,c]=S.useState(new Set),[u,d]=S.useState({});S.useEffect(()=>{DT(t,"summaries").then(d)},[t]);const h=async w=>{c(j=>new Set(j).add(w));try{const{error:j}=await be.from("theory_backgrounds").delete().eq("id",w).eq("user_id",o==null?void 0:o.id);if(j)throw j;$e.success("Theory/Background deleted successfully"),e()}catch(j){console.error("Delete error:",j),$e.error("Error deleting. Please try again.")}finally{c(j=>{const N=new Set(j);return N.delete(w),N})}},f=async w=>{try{await navigator.clipboard.writeText(w),$e.success("Copied to clipboard")}catch{$e.error("Error copying")}},p=w=>new Date(w).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),g=w=>u[w.id]||null,m=w=>{var j,N;return((j=w.documents)==null?void 0:j.title)||((N=w.documents)==null?void 0:N.original_filename)||"Unknown Document"},x=w=>{if(!w||w==="theory")return"Theory & Background";switch(w){case"paragraph":return"Paragraph";case"outline":return"Outline";default:return w}},y=Math.ceil(s/n),v=(r-1)*n+1,b=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(vl,{children:[a.jsx(bl,{children:a.jsxs(Cn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Document Sources"}),a.jsx(yt,{children:"Mode"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(wl,{children:t.map(w=>{var C,k,E;const j=l.has(w.id),N=g(w);return a.jsxs(Cn,{children:[a.jsx(xt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Nr,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:((k=(C=w.theory_text)==null?void 0:C.split(`
`)[0])==null?void 0:k.trim())||w.title||"Theory & Background"})})]})}),a.jsx(xt,{className:"text-muted-foreground",children:a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-medium",children:m(w)}),a.jsxs("span",{className:"text-xs",children:[((E=w.documents)==null?void 0:E.page_count)||"?"," Pages"]})]})}),a.jsx(xt,{children:a.jsx(gt,{variant:"outline",children:x(w.mode)})}),a.jsx(xt,{className:"text-muted-foreground",children:p(w.created_at)}),a.jsx(xt,{className:"text-right",children:a.jsx(Ai,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(qr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(fl,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Qi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View Text"})})]}),a.jsxs(Dr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Theory & Background"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:w.title||"Theory & Background"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Document: ",m(w)," | Mode: ",x(w.mode)," | Created: ",p(w.created_at)]})]}),a.jsx("div",{className:"prose max-w-none",children:a.jsx("div",{className:"whitespace-pre-wrap",children:xk(w.theory_text||"",w.mode||"theory")})}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ye,{onClick:()=>f(w.theory_text||""),className:"flex items-center space-x-2",children:[a.jsx(bn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),N&&a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",onClick:()=>window.open(N,"_blank"),children:a.jsx(ib,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Open PDF"})})]}),a.jsxs(ji,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(jo,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:j,children:j?a.jsx(Xs,{className:"w-4 h-4 animate-spin"}):a.jsx(Ts,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Delete Theory/Background"}),a.jsx(si,{children:"Are you sure you want to delete this Theory/Background? This action cannot be undone."})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:()=>h(w.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},w.id)})})]}),y>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[v,"-",b," of ",s," Theory & Background"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===y,children:"Next"})]})]})]})},dut=({analyses:t,onAnalysisDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i})=>{const{userProfile:o}=Pt(),[l,c]=S.useState(new Set),u=async y=>{c(v=>new Set(v).add(y));try{const{error:v}=await be.from("analysis_results").delete().eq("id",y).eq("user_id",o==null?void 0:o.id);if(v)throw v;$e.success("Analysis deleted successfully"),e()}catch(v){console.error("Delete error:",v),$e.error("Error deleting. Please try again.")}finally{c(v=>{const b=new Set(v);return b.delete(y),b})}},d=y=>new Date(y).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),h=y=>{switch(y){case"small":return"Short";case"medium":return"Medium";case"big":return"Long";default:return y||"–"}},f=y=>{var v;return((v=y.categories)==null?void 0:v.category_title)||"No Category"},p=y=>{var v;return((v=y.codebooks)==null?void 0:v.title)||"No Codebook"},g=Math.ceil(s/n),m=(r-1)*n+1,x=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(vl,{children:[a.jsx(bl,{children:a.jsxs(Cn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Codebook"}),a.jsx(yt,{children:"Mode"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(wl,{children:t.map(y=>{var b;const v=l.has(y.id);return a.jsxs(Cn,{children:[a.jsx(xt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Nr,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:f(y)})})]})}),a.jsx(xt,{className:"text-muted-foreground text-sm",children:p(y)}),a.jsx(xt,{children:a.jsx(gt,{variant:"outline",children:h(y.mode)})}),a.jsx(xt,{className:"text-muted-foreground",children:d(y.created_at)}),a.jsx(xt,{className:"text-right",children:a.jsx(Ai,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(qr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(fl,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Qi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View Analysis"})})]}),a.jsxs(Dr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Qualitative Analysis"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:f(y)}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Codebook: ",p(y)," | Mode: ",h(y.mode)," | Created: ",d(y.created_at)]})]}),a.jsx("div",{className:"prose max-w-none",children:a.jsx("div",{className:"whitespace-pre-wrap",children:y.result_text||"No content available"})}),((b=y.categories)==null?void 0:b.category_conclusion)&&a.jsxs(a.Fragment,{children:[a.jsx("hr",{className:"my-6 border-border"}),a.jsxs("div",{className:"prose max-w-none",children:[a.jsxs("p",{className:"font-bold underline mb-2",children:["Fazit Kategorie: ",y.categories.category_title]}),a.jsx("p",{className:"whitespace-pre-wrap",children:y.categories.category_conclusion})]})]})]})]})]}),a.jsxs(ji,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(jo,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:v,children:v?a.jsx(Xs,{className:"w-4 h-4 animate-spin"}):a.jsx(Ts,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Delete Analysis"}),a.jsx(si,{children:"Are you sure you want to delete this analysis? This action cannot be undone."})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:()=>u(y.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},y.id)})})]}),g>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[m,"-",x," of ",s," Analyses"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===g,children:"Next"})]})]})]})};function hut({topics:t,onTopicDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){Pt();const[o,l]=S.useState(new Set),c=async g=>{l(m=>new Set(m).add(g));try{const{error:m}=await be.from("topic_explorations").delete().eq("id",g);if(m)throw m;$e.success("Topic exploration deleted successfully"),e()}catch(m){console.error("Delete error:",m),$e.error("Error deleting. Please try again.")}finally{l(m=>{const x=new Set(m);return x.delete(g),x})}},u=async g=>{var x,y,v,b,w,j,N,C;let m=`# ${g.title}
`;g.introduction&&(m+=`## Introduction
${g.introduction}
`),g.problem_statement&&(m+=`## Problem Statement
${g.problem_statement}
`),g.objectives&&(m+=`## Objectives
${g.objectives}
`),Array.isArray(g.research_questions)&&g.research_questions.length>0&&(m+=`## Research Questions
${g.research_questions.join(`
`)}
`),g.method&&(m+=`## Methodology
${g.method}
`),(x=g.outline_json)!=null&&x.chapters&&(m+=`## Outline
`,g.outline_json.chapters.forEach(k=>{m+=`${k.number}. ${k.title}
`,k.subchapters&&k.subchapters.forEach(E=>{m+=` ${E.number} ${E.title}
`})}),m+=`
`),(y=g.keywords_json)!=null&&y.primary_keywords&&(m+=`## Primary Keywords
${g.keywords_json.primary_keywords.join(", ")}
`),(v=g.keywords_json)!=null&&v.german_equivalents&&(m+=`## German Keywords
${g.keywords_json.german_equivalents.join(", ")}
`),(b=g.keywords_json)!=null&&b.english_equivalents&&(m+=`## English Keywords
${g.keywords_json.english_equivalents.join(", ")}
`),(w=g.keywords_json)!=null&&w.keyword_combinations&&(m+=`## Search Combinations
`,g.keywords_json.keyword_combinations.forEach(k=>{m+=`- ${k.combination} (${k.purpose})
`}),m+=`
`),(j=g.keywords_json)!=null&&j.database_suggestions&&(m+=`## Recommended Databases
${g.keywords_json.database_suggestions.join(", ")}
`),(N=g.keywords_json)!=null&&N.known_authors&&(m+=`## Known Authors
`,g.keywords_json.known_authors.forEach(k=>{m+=`- ${k.name}: ${k.relevance}
`}),m+=`
`),(C=g.keywords_json)!=null&&C.known_works&&(m+=`## Known Works
`,g.keywords_json.known_works.forEach(k=>{m+=`- ${k.title} (${k.author}${k.year?`, ${k.year}`:""})
`}),m+=`
`);try{await navigator.clipboard.writeText(m.trim()),$e.success("Copied to clipboard")}catch{$e.error("Error copying")}},d=g=>new Date(g).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),h=Math.ceil(s/n),f=(r-1)*n+1,p=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(vl,{children:[a.jsx(bl,{children:a.jsxs(Cn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Source"}),a.jsx(yt,{children:"Language"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(wl,{children:t.map(g=>{var x,y,v,b,w,j,N,C,k,E;const m=o.has(g.id);return a.jsxs(Cn,{children:[a.jsx(xt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(hf,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:g.title||"Untitled Topic"})})]})}),a.jsx(xt,{children:a.jsx(gt,{variant:"secondary",children:g.feature_type==="outline"?"Outline":g.feature_type==="keywords"?"Literature Keywords":"Topic Ideas"})}),a.jsx(xt,{children:a.jsx(gt,{variant:"outline",children:g.language||"DE"})}),a.jsx(xt,{className:"text-muted-foreground",children:d(g.created_at)}),a.jsx(xt,{className:"text-right",children:a.jsx(Ai,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(qr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(fl,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Qi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View"})})]}),a.jsxs(Dr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Lr,{children:a.jsx(Fr,{children:g.title})}),a.jsxs("div",{className:"space-y-6",children:[g.feature_type&&a.jsx(gt,{variant:"secondary",className:"mb-2",children:g.feature_type==="outline"?"Thesis Outline":g.feature_type==="keywords"?"Literature Keywords":"Topic Ideas"}),g.introduction&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Introduction"}),a.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:g.introduction})]}),g.problem_statement&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Problem Statement"}),a.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:g.problem_statement})]}),g.objectives&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Objectives"}),a.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:g.objectives})]}),g.research_questions&&Array.isArray(g.research_questions)&&g.research_questions.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Research Questions"}),a.jsx("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:g.research_questions.map((M,z)=>a.jsx("li",{children:M},z))})]}),g.method&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Methodology"}),a.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:g.method})]}),((x=g.outline_json)==null?void 0:x.chapters)&&g.outline_json.chapters.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Thesis Outline"}),g.outline_json.estimated_pages&&a.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Estimated pages: ",g.outline_json.estimated_pages]}),a.jsx("div",{className:"space-y-3",children:g.outline_json.chapters.map((M,z)=>a.jsxs("div",{className:"border rounded-lg p-3",children:[a.jsxs("span",{className:"font-medium",children:[M.number,". ",M.title]}),M.subchapters&&M.subchapters.length>0&&a.jsx("div",{className:"ml-4 mt-2 space-y-1 border-l-2 pl-3",children:M.subchapters.map((P,V)=>a.jsxs("div",{className:"text-sm text-muted-foreground",children:[P.number," ",P.title]},V))})]},z))}),g.outline_json.notes&&a.jsx("p",{className:"text-sm text-muted-foreground mt-3 italic",children:g.outline_json.notes})]}),((y=g.keywords_json)==null?void 0:y.primary_keywords)&&g.keywords_json.primary_keywords.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Primary Keywords"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:g.keywords_json.primary_keywords.map((M,z)=>a.jsx(gt,{variant:"secondary",children:M},z))})]}),((v=g.keywords_json)==null?void 0:v.german_equivalents)&&g.keywords_json.german_equivalents.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"German Keywords"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:g.keywords_json.german_equivalents.map((M,z)=>a.jsx(gt,{variant:"outline",children:M},z))})]}),((b=g.keywords_json)==null?void 0:b.english_equivalents)&&g.keywords_json.english_equivalents.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"English Keywords"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:g.keywords_json.english_equivalents.map((M,z)=>a.jsx(gt,{variant:"outline",children:M},z))})]}),((w=g.keywords_json)==null?void 0:w.alternative_terms)&&g.keywords_json.alternative_terms.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Alternative Terms"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:g.keywords_json.alternative_terms.map((M,z)=>a.jsx(gt,{variant:"outline",children:M},z))})]}),((j=g.keywords_json)==null?void 0:j.keyword_combinations)&&g.keywords_json.keyword_combinations.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Search Combinations"}),a.jsx("div",{className:"space-y-2",children:g.keywords_json.keyword_combinations.map((M,z)=>a.jsxs("div",{className:"border rounded p-2",children:[a.jsx("code",{className:"text-sm font-mono bg-muted px-1 rounded",children:M.combination}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:M.purpose})]},z))})]}),((N=g.keywords_json)==null?void 0:N.database_suggestions)&&g.keywords_json.database_suggestions.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Recommended Databases"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:g.keywords_json.database_suggestions.map((M,z)=>a.jsx(gt,{variant:"outline",children:M},z))})]}),((C=g.keywords_json)==null?void 0:C.known_authors)&&g.keywords_json.known_authors.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Known Authors"}),a.jsx("div",{className:"space-y-2",children:g.keywords_json.known_authors.map((M,z)=>a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:M.name}),a.jsxs("span",{className:"text-muted-foreground",children:[" - ",M.relevance]})]},z))})]}),((k=g.keywords_json)==null?void 0:k.known_works)&&g.keywords_json.known_works.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Known Works"}),a.jsx("div",{className:"space-y-2",children:g.keywords_json.known_works.map((M,z)=>a.jsxs("div",{className:"text-sm border rounded p-2",children:[a.jsx("span",{className:"font-medium",children:M.title}),M.year&&a.jsxs("span",{className:"text-muted-foreground",children:[" (",M.year,")"]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:M.author}),a.jsx("p",{className:"text-xs text-muted-foreground italic mt-1",children:M.relevance})]},z))})]}),((E=g.keywords_json)==null?void 0:E.search_tips)&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Search Tips"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:g.keywords_json.search_tips})]}),g.known_sources_json&&Array.isArray(g.known_sources_json)&&g.known_sources_json.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Known Sources"}),a.jsx("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:g.known_sources_json.map((M,z)=>a.jsx("li",{children:M.citation||M.title||JSON.stringify(M)},z))})]}),g.sources&&Array.isArray(g.sources)&&g.sources.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Sources"}),a.jsx("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:g.sources.map((M,z)=>a.jsxs("li",{children:[M.title,M.doi&&a.jsxs("span",{className:"text-xs ml-2",children:["DOI: ",M.doi]}),M.isbn&&a.jsxs("span",{className:"text-xs ml-2",children:["ISBN: ",M.isbn]})]},z))})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ye,{onClick:()=>u(g),className:"flex items-center space-x-2",children:[a.jsx(bn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),a.jsxs(ji,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(jo,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:m,children:m?a.jsx(Xs,{className:"w-4 h-4 animate-spin"}):a.jsx(Ts,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Delete Topic Exploration"}),a.jsx(si,{children:"Are you sure you want to delete this topic exploration? This action cannot be undone."})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:()=>c(g.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},g.id)})})]}),h>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[f,"-",p," of ",s," Topics"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===h,children:"Next"})]})]})]})}function fut({setups:t,onSetupDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){Pt();const[o,l]=S.useState(new Set),c=async m=>{l(x=>new Set(x).add(m));try{const{error:x}=await be.from("research_setups").delete().eq("id",m);if(x)throw x;$e.success("Research setup deleted successfully"),e()}catch(x){console.error("Delete error:",x),$e.error("Error deleting. Please try again.")}finally{l(x=>{const y=new Set(x);return y.delete(m),y})}},u=async m=>{const x=m.markdown_text||m.title;try{await navigator.clipboard.writeText(x),$e.success("Copied to clipboard")}catch{$e.error("Error copying")}},d=m=>new Date(m).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),h=m=>{switch(m){case"bachelor":return"Bachelor";case"master":return"Master";default:return m||"N/A"}},f=Math.ceil(s/n),p=(r-1)*n+1,g=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(vl,{children:[a.jsx(bl,{children:a.jsxs(Cn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Language"}),a.jsx(yt,{children:"Discipline"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(wl,{children:t.map(m=>{var y;const x=o.has(m.id);return a.jsxs(Cn,{children:[a.jsx(xt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Lve,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:m.title||"Untitled Setup"})})]})}),a.jsx(xt,{children:a.jsx(gt,{variant:"outline",children:((y=m.language)==null?void 0:y.toUpperCase())||"N/A"})}),a.jsx(xt,{className:"text-muted-foreground",children:m.discipline||"N/A"}),a.jsx(xt,{className:"text-muted-foreground",children:d(m.created_at)}),a.jsx(xt,{className:"text-right",children:a.jsx(Ai,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(qr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(fl,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Qi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View"})})]}),a.jsxs(Dr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Lr,{children:a.jsx(Fr,{children:m.title})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsx(gt,{variant:"secondary",children:h(m.degree)}),m.discipline&&a.jsx(gt,{variant:"outline",children:m.discipline}),m.language&&a.jsx(gt,{variant:"outline",children:m.language.toUpperCase()})]}),m.markdown_text?a.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:a.jsx(fc,{children:m.markdown_text})}):a.jsxs("div",{className:"space-y-4",children:[m.aim&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Research Aim"}),a.jsx("p",{className:"text-muted-foreground",children:m.aim})]}),m.derived_research_questions&&Array.isArray(m.derived_research_questions)&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Research Questions"}),a.jsx("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:m.derived_research_questions.map((v,b)=>a.jsx("li",{children:v},b))})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ye,{onClick:()=>u(m),className:"flex items-center space-x-2",children:[a.jsx(bn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),a.jsxs(ji,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(jo,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:x,children:x?a.jsx(Xs,{className:"w-4 h-4 animate-spin"}):a.jsx(Ts,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Delete Research Setup"}),a.jsx(si,{children:"Are you sure you want to delete this research setup? This action cannot be undone."})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:()=>c(m.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},m.id)})})]}),f>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[p,"-",g," of ",s," Setups"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===f,children:"Next"})]})]})]})}function put({discussions:t,onDiscussionDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){const{user:o}=Pt(),[l,c]=S.useState(new Set),u=async x=>{c(y=>new Set(y).add(x));try{const{error:y}=await be.from("results_discussions").delete().eq("id",x).eq("user_id",o==null?void 0:o.id);if(y)throw y;$e.success("Discussion deleted successfully"),e()}catch(y){console.error("Delete error:",y),$e.error("Error deleting. Please try again.")}finally{c(y=>{const v=new Set(y);return v.delete(x),v})}},d=async x=>{try{await navigator.clipboard.writeText(x),$e.success("Copied to clipboard")}catch{$e.error("Error copying")}},h=x=>new Date(x).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),f=x=>{switch(x){case"de":return"DE";case"en":return"EN";default:return(x==null?void 0:x.toUpperCase())||"N/A"}},p=Math.ceil(s/n),g=(r-1)*n+1,m=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(vl,{children:[a.jsx(bl,{children:a.jsxs(Cn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Language"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(wl,{children:t.map(x=>{const y=l.has(x.id);return a.jsxs(Cn,{children:[a.jsx(xt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Vm,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:x.title||"Discussion"})})]})}),a.jsx(xt,{children:a.jsx(gt,{variant:"outline",children:f(x.language)})}),a.jsx(xt,{className:"text-muted-foreground",children:h(x.created_at)}),a.jsx(xt,{className:"text-right",children:a.jsx(Ai,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(qr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(fl,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Qi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View Text"})})]}),a.jsxs(Dr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Discussion"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:x.title||"Discussion"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Language: ",f(x.language)," | Created: ",h(x.created_at)]})]}),a.jsx("div",{className:"prose max-w-none",children:a.jsx(fc,{children:x.discussion_text||""})}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ye,{onClick:()=>d(x.discussion_text||""),className:"flex items-center space-x-2",children:[a.jsx(bn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),a.jsxs(ji,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(jo,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:y,children:y?a.jsx(Xs,{className:"w-4 h-4 animate-spin"}):a.jsx(Ts,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Delete Discussion"}),a.jsx(si,{children:"Are you sure you want to delete this discussion? This action cannot be undone."})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:()=>u(x.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},x.id)})})]}),p>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[g,"-",m," of ",s," Discussions"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===p,children:"Next"})]})]})]})}function mut({codings:t,onCodingDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){const[o,l]=S.useState(new Set),c=async g=>{l(m=>new Set(m).add(g));try{const{error:m}=await be.from("coding_results").delete().eq("id",g);if(m)throw m;$e.success("Coding deleted successfully"),e()}catch(m){console.error("Delete error:",m),$e.error("Error deleting. Please try again.")}finally{l(m=>{const x=new Set(m);return x.delete(g),x})}},u=async g=>{const m=g.result_text||g.title||"";try{await navigator.clipboard.writeText(m),$e.success("Copied to clipboard")}catch{$e.error("Error copying")}},d=g=>new Date(g).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),h=Math.ceil(s/n),f=(r-1)*n+1,p=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(vl,{children:[a.jsx(bl,{children:a.jsxs(Cn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Interviews"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(wl,{children:t.map(g=>{var x,y,v;const m=o.has(g.id);return a.jsxs(Cn,{children:[a.jsx(xt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Fve,{className:"w-4 h-4 text-primary"})}),a.jsx("p",{className:"font-medium text-sm",children:g.title||"Untitled Coding"})]})}),a.jsx(xt,{className:"text-muted-foreground text-sm",children:((x=g.interviews)==null?void 0:x.title)||"–"}),a.jsx(xt,{className:"text-muted-foreground",children:d(g.created_at)}),a.jsx(xt,{className:"text-right",children:a.jsx(Ai,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(qr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(fl,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Qi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View"})})]}),a.jsxs(Dr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Lr,{children:a.jsx(Fr,{children:g.title||"Coding Result"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[((y=g.codebooks)==null?void 0:y.title)&&a.jsx(gt,{variant:"secondary",children:g.codebooks.title}),((v=g.interviews)==null?void 0:v.title)&&a.jsx(gt,{variant:"outline",children:g.interviews.title}),g.language&&a.jsx(gt,{variant:"outline",children:g.language.toUpperCase()}),a.jsxs(gt,{variant:"outline",children:[g.created_segments??0," Segments"]})]}),g.result_text?a.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:a.jsx(fc,{children:g.result_text})}):a.jsx("p",{className:"text-muted-foreground",children:"No content available."}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ye,{onClick:()=>u(g),className:"flex items-center space-x-2",children:[a.jsx(bn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),a.jsxs(ji,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(jo,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:m,children:m?a.jsx(Xs,{className:"w-4 h-4 animate-spin"}):a.jsx(Ts,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Delete Coding"}),a.jsx(si,{children:"Are you sure you want to delete this coding result? This action cannot be undone."})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:()=>c(g.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},g.id)})})]}),h>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[f,"-",p," of ",s," Codings"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===h,children:"Next"})]})]})]})}function gut({onDocumentUploaded:t}){const{userProfile:e}=Pt(),[r,n]=S.useState(!1),[s,i]=S.useState("idle"),[o,l]=S.useState(null),[c,u]=S.useState(!1),d=S.useRef(null);function h(j){return j.replace(/\.pdf$/i,"").replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/Ä/g,"Ae").replace(/Ö/g,"Oe").replace(/Ü/g,"Ue").replace(/ß/g,"ss").normalize("NFKD").replace(/[^\w\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-").toLowerCase().slice(0,90)}const f=j=>{if(j.type!=="application/pdf")return"Only PDF files are allowed.";const N=50*1024*1024;return j.size>N?"The file is too large. The maximum allowed size is 50MB.":j.size<1024?"The file is too small. At least 1KB is required.":null},p=S.useCallback(j=>{const N=f(j);if(N){$e.error(N);return}l(j)},[]),g=S.useCallback(j=>{j.preventDefault(),j.stopPropagation()},[]),m=S.useCallback(j=>{j.preventDefault(),j.stopPropagation(),u(!0)},[]),x=S.useCallback(j=>{j.preventDefault(),j.stopPropagation(),u(!1)},[]),y=S.useCallback(j=>{j.preventDefault(),j.stopPropagation(),u(!1);const N=j.dataTransfer.files;N&&N[0]&&p(N[0])},[p]),v=j=>{var C;const N=(C=j.target.files)==null?void 0:C[0];N&&p(N)},b=()=>{l(null),d.current&&(d.current.value="")},w=async()=>{if(!(!o||!e||r)){n(!0),i("uploading");try{const j=o.name,N=h(j)||"dokument",C=`${Date.now()}-${N}.pdf`,k=`${e.id}/${C}`,{error:E}=await kr.storage.from("documents").upload(k,o,{cacheControl:"3600",upsert:!1});if(E)throw E;const{data:M,error:z}=await kr.from("documents").insert({user_id:e.id,title:N,original_filename:j,storage_path:k,page_count:null}).select().single();if(z)throw await kr.storage.from("documents").remove([k]),z;i("extracting");const P=kr.functions.invoke("ingest_document",{body:{document_id:M.id}}).catch($=>console.error("ingest_document call failed",$)),V=kr.functions.invoke("pdf_extract",{body:{document_id:M.id,overwrite:!0,also_block:!1}}).catch($=>console.error("pdf_extract call failed",$)),A=kr.functions.invoke("detect_bibliography",{body:{document_id:M.id}}).catch($=>console.error("detect_bibliography call failed",$));await Promise.all([P,V,A]),$e.success("PDF successfully uploaded and extracted!"),l(null),d.current&&(d.current.value=""),t()}catch(j){console.error("Upload error:",j),$e.error("Error uploading. Please try again.")}finally{n(!1),i("idle")}}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:`
relative border-2 border-dashed rounded-lg p-6 text-center
transition-all duration-200 h-[200px] flex flex-col items-center justify-center
${c?"border-primary bg-primary/5":o?"border-green-500 bg-green-50/50":"border-muted-foreground/25 hover:border-primary/50"}
${r?"pointer-events-none opacity-50":"cursor-pointer"}
`,onDragEnter:m,onDragLeave:x,onDragOver:g,onDrop:y,onClick:()=>{var j;return!o&&((j=d.current)==null?void 0:j.click())},children:[o?a.jsxs("div",{className:"space-y-3",children:[a.jsx(gl,{className:"w-8 h-8 text-green-600 mx-auto"}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(Vve,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm font-medium truncate max-w-[200px]",children:o.name}),a.jsx("button",{onClick:j=>{j.stopPropagation(),b()},className:"p-1 hover:bg-red-100 rounded-full",children:a.jsx(En,{className:"w-4 h-4 text-red-500"})})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[Math.round(o.size/1024)," KB"]})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsx(Ku,{className:"w-8 h-8 text-muted-foreground mx-auto"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Drag PDF or click here"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Max 50MB, PDFs Only"})]})]}),a.jsx(Fe,{ref:d,type:"file",accept:".pdf",onChange:v,className:"hidden"})]}),o&&a.jsx(ye,{onClick:w,disabled:r,className:"w-full",children:r?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),s==="extracting"?"Extract text...":"Uploading..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ku,{className:"w-4 h-4 mr-2"}),"Upload PDF"]})})]})}const yut=t=>t.title||t.original_filename||t.book_title||"",xut=t=>{var e,r;return((e=t.documents)==null?void 0:e.title)||((r=t.documents)==null?void 0:r.original_filename)||t.summary_mode||""},vut=t=>{var e,r,n,s;return((r=(e=t.method_text)==null?void 0:e.split(`
`)[0])==null?void 0:r.trim())||t.title||((n=t.documents)==null?void 0:n.title)||((s=t.documents)==null?void 0:s.original_filename)||""},but=t=>{var e,r,n;return((r=(e=t.theory_text)==null?void 0:e.split(`
`)[0])==null?void 0:r.trim())||t.title||((n=t.documents)==null?void 0:n.title)||""},wut=t=>{var e;return((e=t.codebooks)==null?void 0:e.title)||""},_ut=t=>t.title||"",jut=t=>t.title||"",Sut=t=>t.title||"",Nut=t=>t.title||"";function Mc(t,e,r,n){let s=t;if(e){const i=e.toLowerCase();s=t.filter(o=>n(o).toLowerCase().includes(i))}return[...s].sort((i,o)=>r==="alphabetical"?n(i).localeCompare(n(o)):new Date(o.created_at).getTime()-new Date(i.created_at).getTime())}const Aut=()=>{const{user:t,loading:e}=Pt(),r=gr(),[n,s]=S.useState([]),[i,o]=S.useState(!0),[l,c]=S.useState([]),[u,d]=S.useState([]),[h,f]=S.useState([]),[p,g]=S.useState([]),[m,x]=S.useState([]),[y,v]=S.useState([]),[b,w]=S.useState([]),[j,N]=S.useState([]),[C,k]=S.useState({}),[E,M]=S.useState(""),[z,P]=S.useState("all"),[V,A]=S.useState("newest"),[$,K]=S.useState(1),[G,Y]=S.useState(1),[H,B]=S.useState(1),[L,F]=S.useState(1),[W,X]=S.useState(1),[oe,le]=S.useState(1),[U,R]=S.useState(1),[ee,te]=S.useState(1),[Z,J]=S.useState(1),[he,O]=S.useState(0),[ie,q]=S.useState(0),[I,T]=S.useState(0),[D,ne]=S.useState(0),[ue,re]=S.useState(0),[pe,ve]=S.useState(0),[xe,ae]=S.useState(0),[de,ge]=S.useState(0),[we,je]=S.useState(0),Se=20;S.useEffect(()=>{!t&&!e&&r("/login")},[t,e,r]),S.useEffect(()=>{t&&Ue()},[t,$,G,H,L,W,oe,U,ee,Z]);const Ue=async()=>{if(t){o(!0);try{const{count:Ct}=await be.from("v_documents_with_status").select("*",{count:"exact",head:!0}).eq("user_id",t.id);O(Ct||0);const{data:Ve,error:mt}=await be.from("v_documents_with_status").select("*").eq("user_id",t.id).order("created_at",{ascending:!1}).range(($-1)*Se,$*Se-1);if(mt){console.error("Error loading documents:",mt);return}s(Ve||[]);const{data:Et,error:Fs}=await be.from("pages").select("document_id").in("document_id",(Ve||[]).map(MS=>MS.id));if(!Fs&&Et){const MS={};Ve==null||Ve.forEach(FB=>{MS[FB.id]=Et.some(Eme=>Eme.document_id===FB.id)}),k(MS)}const{count:rs}=await be.from("summaries").select("*",{count:"exact",head:!0}).eq("user_id",t.id);q(rs||0);const{data:ra,error:$a}=await be.from("summaries").select("*, documents(title, page_count, original_filename)").eq("user_id",t.id).order("created_at",{ascending:!1}).range((G-1)*Se,G*Se-1);$a||c(ra||[]);const{count:$s}=await be.from("methods").select("*",{count:"exact",head:!0}).eq("user_id",t.id);T($s||0);const{data:na,error:lP}=await be.from("methods").select("*, documents(title, page_count, original_filename)").eq("user_id",t.id).order("created_at",{ascending:!1}).range((H-1)*Se,H*Se-1);lP||d(na||[]);const{count:jS}=await be.from("theory_backgrounds").select("*",{count:"exact",head:!0}).eq("user_id",t.id);ne(jS||0);const{data:SS,error:NS}=await be.from("theory_backgrounds").select("*, documents(title, page_count, original_filename)").eq("user_id",t.id).order("created_at",{ascending:!1}).range((L-1)*Se,L*Se-1);NS||f(SS||[]);const{count:AS}=await be.from("analysis_results").select("*",{count:"exact",head:!0}).eq("user_id",t.id);re(AS||0);const{data:ES,error:CS}=await be.from("analysis_results").select("*, codebooks(title)").eq("user_id",t.id).order("created_at",{ascending:!1}).range((W-1)*Se,W*Se-1);CS||g(ES||[]);const{count:kS}=await be.from("topic_explorations").select("*",{count:"exact",head:!0}).eq("user_id",t.id);ve(kS||0);const{data:TS,error:PS}=await be.from("topic_explorations").select("*").eq("user_id",t.id).order("created_at",{ascending:!1}).range((oe-1)*Se,oe*Se-1);PS||x(TS||[]);const{count:OS}=await be.from("research_setups").select("*",{count:"exact",head:!0}).eq("user_id",t.id);ae(OS||0);const{data:IS,error:RS}=await be.from("research_setups").select("*").eq("user_id",t.id).order("created_at",{ascending:!1}).range((U-1)*Se,U*Se-1);RS||v(IS||[]);const{count:jl}=await be.from("results_discussions").select("*",{count:"exact",head:!0}).eq("user_id",t.id);ge(jl||0);const{data:_me,error:jme}=await be.from("results_discussions").select("*").eq("user_id",t.id).order("created_at",{ascending:!1}).range((ee-1)*Se,ee*Se-1);jme||w(_me||[]);const{count:Sme}=await be.from("coding_results").select("*",{count:"exact",head:!0}).eq("user_id",t.id);je(Sme||0);const{data:Nme,error:Ame}=await be.from("coding_results").select("*, codebooks(title), interviews(title)").eq("user_id",t.id).order("created_at",{ascending:!1}).range((Z-1)*Se,Z*Se-1);Ame||N(Nme||[])}catch(Ct){console.error("Error in loadDocuments:",Ct)}finally{o(!1)}}},Ae=()=>{Ue()},fe=S.useMemo(()=>Mc(n,E,V,yut),[n,E,V]),Ee=S.useMemo(()=>Mc(l,E,V,xut),[l,E,V]),Ce=S.useMemo(()=>Mc(u,E,V,vut),[u,E,V]),Ge=S.useMemo(()=>Mc(h,E,V,but),[h,E,V]),ht=S.useMemo(()=>Mc(p,E,V,wut),[p,E,V]),Ne=S.useMemo(()=>Mc(m,E,V,_ut),[m,E,V]),Ze=S.useMemo(()=>Mc(y,E,V,jut),[y,E,V]),Ke=S.useMemo(()=>Mc(b,E,V,Sut),[b,E,V]),Xe=S.useMemo(()=>Mc(j,E,V,Nut),[j,E,V]),Ye=Ct=>z==="all"||z===Ct;return e||i?a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsx(er,{showSidebar:!0,children:a.jsxs("div",{className:"space-y-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"My Library"}),a.jsx("p",{className:"text-muted-foreground",children:"Overview of all uploaded PDFs and generated content"})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Ku,{className:"h-5 w-5"}),"Upload PDF"]}),a.jsx(mn,{children:"Add new documents to your library"})]}),a.jsx(Be,{children:a.jsx(gut,{onDocumentUploaded:Ae})})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(ll,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Fe,{placeholder:"Search by name...",value:E,onChange:Ct=>M(Ct.target.value),className:"pl-9"})]}),a.jsxs(at,{value:z,onValueChange:P,children:[a.jsx(nt,{className:"w-full sm:w-[240px]",children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"all",children:"All types"}),a.jsxs(Te,{value:"documents",children:["Documents (",he,")"]}),a.jsxs(Te,{value:"summaries",children:["Summaries (",ie,")"]}),a.jsxs(Te,{value:"methods",children:["Methods (",I,")"]}),a.jsxs(Te,{value:"theories",children:["Theory & Background (",D,")"]}),a.jsxs(Te,{value:"analyses",children:["Analysis (",ue,")"]}),a.jsxs(Te,{value:"topics",children:["Topic Explorations (",pe,")"]}),a.jsxs(Te,{value:"setups",children:["Research Setups (",xe,")"]}),a.jsxs(Te,{value:"discussions",children:["Discussions (",de,")"]}),a.jsxs(Te,{value:"codings",children:["Codings (",we,")"]})]})]}),a.jsxs(at,{value:V,onValueChange:Ct=>A(Ct),children:[a.jsx(nt,{className:"w-full sm:w-[180px]",children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"newest",children:"Newest first"}),a.jsx(Te,{value:"alphabetical",children:"A → Z"})]})]})]}),Ye("documents")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Documents"})}),a.jsx(Be,{children:fe.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No documents found"}):a.jsx(iut,{documents:fe,documentPages:C,onDocumentDeleted:Ae,currentPage:$,itemsPerPage:Se,totalItems:he,onPageChange:K})})]}),Ye("summaries")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Summaries"})}),a.jsx(Be,{children:Ee.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No summaries found"}):a.jsx(lut,{summaries:Ee,onSummaryDeleted:Ae,currentPage:G,itemsPerPage:Se,totalItems:ie,onPageChange:Y})})]}),Ye("methods")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Methods"})}),a.jsx(Be,{children:Ce.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No methods found"}):a.jsx(cut,{methods:Ce,onMethodDeleted:Ae,currentPage:H,itemsPerPage:Se,totalItems:I,onPageChange:B})})]}),Ye("theories")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Theory & Background"})}),a.jsx(Be,{children:Ge.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No theories found"}):a.jsx(uut,{theories:Ge,onTheoryDeleted:Ae,currentPage:L,itemsPerPage:Se,totalItems:D,onPageChange:F})})]}),Ye("analyses")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Analysis"})}),a.jsx(Be,{children:ht.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No analyses found"}):a.jsx(dut,{analyses:ht,onAnalysisDeleted:Ae,currentPage:W,itemsPerPage:Se,totalItems:ue,onPageChange:X})})]}),Ye("topics")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Topic Explorations"})}),a.jsx(Be,{children:Ne.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No topic explorations found"}):a.jsx(hut,{topics:Ne,onTopicDeleted:Ae,currentPage:oe,itemsPerPage:Se,totalItems:pe,onPageChange:le})})]}),Ye("setups")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Research Setups"})}),a.jsx(Be,{children:Ze.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No research setups found"}):a.jsx(fut,{setups:Ze,onSetupDeleted:Ae,currentPage:U,itemsPerPage:Se,totalItems:xe,onPageChange:R})})]}),Ye("discussions")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Discussions"})}),a.jsx(Be,{children:Ke.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No discussions found"}):a.jsx(put,{discussions:Ke,onDiscussionDeleted:Ae,currentPage:ee,itemsPerPage:Se,totalItems:de,onPageChange:te})})]}),Ye("codings")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Codings"})}),a.jsx(Be,{children:Xe.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No codings found"}):a.jsx(mut,{codings:Xe,onCodingDeleted:Ae,currentPage:Z,itemsPerPage:Se,totalItems:we,onPageChange:J})})]})]})}):null};function Pc({open:t,onClose:e,remainingPoints:r}){const n=gr();return a.jsx(qr,{open:t,onOpenChange:e,children:a.jsxs(Dr,{className:"sm:max-w-md",children:[a.jsxs(Lr,{className:"items-center text-center",children:[a.jsx("div",{className:"mx-auto mb-2 flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10",children:a.jsx(Ia,{className:"h-6 w-6 text-destructive"})}),a.jsx(Fr,{children:"Student Points exhausted"}),a.jsxs(gb,{children:["You currently have ",a.jsx("span",{className:"font-semibold text-foreground",children:Math.round(r)})," ","Student Points. You need more points to use this feature."]})]}),a.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[a.jsx(ye,{onClick:()=>{e(),n("/pricing")},children:"View Plans"}),a.jsx(ye,{variant:"outline",onClick:e,children:"Close"})]})]})})}const jK={small:{label:"Small - Brief Overview",description:"2-3 sentences, approx. 200-300 tokens"},medium:{label:"Medium - Detailed Summary",description:"1 paragraph, approx. 400-600 tokens"},big:{label:"Big - Comprehensive Analysis",description:"2-3 paragraphs, approx. 800-1200 tokens"},deep15:{label:"Deep - In-depth Analysis",description:"~15% of input, structured with introduction, key points, conclusion"}},Eut={small:1,medium:1,big:1.25,deep15:1.5};function Cut({documents:t,onSummaryCreated:e}){const{userProfile:r,user:n,checkStudentPoints:s,studentPoints:i}=Pt(),[o,l]=S.useState(!1),[c,u]=S.useState(""),[d,h]=S.useState(""),[f,p]=S.useState(""),[g,m]=S.useState(!1),[x,y]=S.useState(null),[v,b]=S.useState(null),[w,j]=S.useState(null),[N,C]=S.useState(null),k=F=>F.replace(/[^\d,\-–\s]/g,"").trim(),E=F=>{const W=k(F);if(!W)return[];const X=[],oe=W.split(",").map(le=>le.trim());for(const le of oe)if(le.includes("–")||le.includes("-")){const[U,R]=le.split(/[–-]/).map(ee=>parseInt(ee.trim()));if(!isNaN(U)&&!isNaN(R)&&U>0&&R>0&&U<=R&&R<=1e3)for(let ee=U;ee<=R;ee++)X.includes(ee)||X.push(ee)}else{const U=parseInt(le);!isNaN(U)&&U>0&&U<=1e3&&!X.includes(U)&&X.push(U)}return X.sort((le,U)=>le-U)},M=F=>{if(!F.trim())return"Please select at least one page.";const W=E(F);if(W.length===0)return"Invalid format. Use e.g. 1-5, 8, 12";const X=t.find(oe=>oe.id===c);if(X&&X.page_count){const oe=W.filter(le=>le>X.page_count);if(oe.length>0)return`Document only has ${X.page_count} pages. Invalid pages: ${oe.join(", ")}`}return W.length>50?"Maximum 50 pages per summary.":null},z=F=>{h(F);const W=M(F);b(W)},P=t.find(F=>F.id===c),V=E(d),A=V.length,$=f?Eut[f]:1,K=Math.ceil(A*$),G=P&&A>0&&f&&r&&!v,Y=r?r.current_token_balance>=K:!1,H=async()=>{if(!s()){l(!0);return}if(!(!G||!r||!n)){m(!0),y(null),j(null),C(null);try{const{data:{session:F}}=await kr.auth.getSession();if(!(F!=null&&F.access_token))throw new Error("No valid login found");const W=crypto.randomUUID(),{data:X,error:oe}=await kr.functions.invoke("summarize",{body:{client_request_id:W,document_id:c,selected_pages:V,mode:f}});if(console.log("summarize response",{data:X,error:oe}),oe){C({text:oe.message||"Invoke error",isError:!0});return}if(X!=null&&X.error){const U=X.message||"Error";C({text:U,isError:!0}),$e.error(U);return}const le=X==null?void 0:X.summary_text;if(!le){$e.error("No summary returned");return}C({text:le,isError:!1}),y(le),j({mode:(X==null?void 0:X.summary_mode)||f,pagesCharged:(X==null?void 0:X.pages_selected)||K,remainingAfter:r.current_token_balance}),console.log("summary_id",X==null?void 0:X.summary_id),$e.success(`Summary created successfully! ${(X==null?void 0:X.pages_selected)||K} pages processed.`),u(""),h(""),p(""),b(null),e()}catch(F){console.error("Summary generation error:",F),C({text:F.message||"Error creating summary. Please try again.",isError:!0}),F.message.includes("Plan upgraden")?$e.error("Page limit reached – please upgrade plan.",{action:{label:"View Pricing",onClick:()=>window.open("/pricing","_blank")}}):$e.error(F.message||"Error creating summary. Please try again.")}finally{m(!1)}}},B=async()=>{if(x)try{await navigator.clipboard.writeText(x),$e.success("Copied to clipboard")}catch{$e.error("Copy failed")}},L=f?jK[f]:null;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[t.length===0?a.jsxs(nd,{children:[a.jsx(Ia,{className:"h-4 w-4"}),a.jsx(sd,{children:"No documents available. Upload a PDF in Step 1 first."})]}):a.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"document-select",children:"Select Document"}),a.jsxs(at,{value:c,onValueChange:u,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Choose document..."})}),a.jsx(st,{children:t.map(F=>a.jsxs(Te,{value:F.id,children:[F.title," (",F.page_count||"?"," pages)"]},F.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"summary-mode",children:"Summary Mode"}),a.jsxs(at,{value:f,onValueChange:p,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Choose mode..."})}),a.jsx(st,{children:Object.entries(jK).map(([F,W])=>a.jsx(Te,{value:F,children:W.label},F))})]}),L&&a.jsx("p",{className:"text-xs text-muted-foreground",children:L.description})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"page-selection",children:"Page Selection"}),a.jsx(Fe,{id:"page-selection",value:d,onChange:F=>z(F.target.value),placeholder:"e.g. 2-5, 7, 12",maxLength:100,className:v?"border-destructive":""}),v?a.jsx("p",{className:"text-sm text-destructive",children:v}):a.jsx("p",{className:"text-xs text-muted-foreground",children:"Format: Individual pages (7) or ranges (2-5), separated by comma. Max. 50 pages per summary."}),V.length>0&&!v&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("p",{className:"text-sm text-primary",children:["Selected pages: ",V.join(", ")," (",A," pages)"]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["This selection will use approximately ",K," pages from your monthly limit (pages ×"," ",$," multiplier = ",K,")."]})]})]}),!Y&&A>0&&a.jsxs(nd,{className:"border-destructive/50 bg-destructive/5",children:[a.jsx(Ia,{className:"h-4 w-4 text-destructive"}),a.jsxs(sd,{children:["Not enough pages available! You need ",K," pages, but only have"," ",r==null?void 0:r.current_token_balance," remaining."]})]}),a.jsx(ye,{onClick:H,disabled:!G||g,className:"w-full",children:g?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Creating summary..."]}):"➤ Summarize Now"}),(N==null?void 0:N.isError)&&a.jsx("div",{className:"border rounded-lg p-4 border-destructive/50 bg-destructive/5",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(Ia,{className:"w-5 h-5 text-destructive mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"space-y-2 flex-1",children:[a.jsx("h4",{className:"font-medium text-destructive",children:"Summary Error"}),a.jsx("p",{className:"text-sm text-destructive/80",children:N.text})]})]})})]}),x&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h4",{className:"text-lg font-semibold",children:"Summary"}),a.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 text-green-600",children:[a.jsx(gl,{className:"w-4 h-4"}),a.jsx("span",{children:"Saved"})]}),w&&a.jsxs("div",{className:"text-muted-foreground",children:[w.pagesCharged," pages used • ",w.remainingAfter," remaining"]})]})]}),a.jsx("div",{className:"border rounded-lg p-4 bg-muted/20",children:a.jsx(Ht,{value:x,readOnly:!0,className:"border-none bg-transparent resize-none focus:ring-0 p-0 w-full",style:{height:"auto",minHeight:"200px",overflow:"hidden"},rows:x?x.split(`
`).length+5:10})}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(ye,{onClick:B,variant:"outline",size:"sm",children:[a.jsx(bn,{className:"w-4 h-4 mr-2"}),"Copy to Clipboard"]}),a.jsxs(ye,{variant:"outline",size:"sm",disabled:!0,children:[a.jsx(hz,{className:"w-4 h-4 mr-2"}),"Export as PDF"]}),a.jsxs(ye,{variant:"outline",size:"sm",disabled:!0,children:[a.jsx(hz,{className:"w-4 h-4 mr-2"}),"Export as DOCX"]}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>window.location.href="/documents",children:[a.jsx(ib,{className:"w-4 h-4 mr-2"}),"Open in Library"]})]})]}),a.jsx(Pc,{open:o,onClose:()=>l(!1),remainingPoints:(i==null?void 0:i.remaining)??0})]})}const kut=()=>{const{user:t,loading:e}=Pt(),r=gr(),[n,s]=S.useState([]),[i,o]=S.useState(!1);S.useEffect(()=>{!t&&!e&&r("/login")},[t,e,r]);const l=async()=>{if(t){o(!0);try{const{data:u,error:d}=await kr.from("documents").select("id, user_id, title, original_file_url, page_count, created_at").eq("user_id",t.id).order("created_at",{ascending:!1});d?console.error("Error fetching documents:",d):s(u||[])}catch(u){console.error("Error fetching documents:",u)}finally{o(!1)}}};S.useEffect(()=>{t&&l()},[t]);const c=()=>{l()};return e?a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsx(er,{showSidebar:!0,children:a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Summaries"}),a.jsx("p",{className:"text-muted-foreground",children:"Create summaries based on your uploaded documents"})]}),a.jsxs(Me,{className:"panze-content-card",children:[a.jsxs(qe,{children:[a.jsx(Je,{className:"flex items-center gap-3",children:"Create Summary"}),a.jsx(mn,{children:"Select a document and configure your summary options"})]}),a.jsx(Be,{children:a.jsx(Cut,{documents:n,onSummaryCreated:c})})]})]})}):null},SK=(t,e,r,n)=>{switch(n){case"theory":return 60;case"theory-fox40":return 60;case"methods":return 60;case"methods-fox40":return 40;case"discussion":return 30;case"conclusion":return 30;case"summary":return 20;case"supervisor":return 5;case"topic_exp":return 5;case"platform_assistant":return 2;case"analysis_r":return 10;case"codeapply":return 15;case"r_setup":return 5;default:return 0}},Tut=()=>{const{user:t,loading:e}=Pt(),r=gr(),[n,s]=S.useState([]),[i,o]=S.useState([]),[l,c]=S.useState(!0),[u,d]=S.useState("all");S.useEffect(()=>{!t&&!e?r("/login"):t&&h()},[t,e,r]);const h=async()=>{try{const[v,b,w,j,N,C,k,E]=await Promise.all([be.from("summaries").select("id, summary_text, citation_style, created_at, summary_mode, documents(title)").order("created_at",{ascending:!1}),be.from("theory_backgrounds").select("id, title, theory_text, citation_style, created_at, mode").order("created_at",{ascending:!1}),be.from("methods").select("id, title, method_text, citation_style, created_at, mode").order("created_at",{ascending:!1}),be.from("analysis_results").select("id, result_text, citation_style, created_at, mode").order("created_at",{ascending:!1}),be.from("qualitative_summaries").select("id, title, summary_text, created_at").order("created_at",{ascending:!1}),be.from("topic_explorations").select("id, title, introduction, created_at, language").order("created_at",{ascending:!1}),be.from("research_setups").select("id, title, aim, degree, discipline, created_at").order("created_at",{ascending:!1}),be.from("usage_log").select("id, tokens_used, prompt_tokens, completion_tokens, model, source, timestamp").order("timestamp",{ascending:!1}).limit(100)]),M=[];v.data&&v.data.forEach(z=>{var P;M.push({id:z.id,type:"summary",title:((P=z.documents)==null?void 0:P.title)||"Summary",content:z.summary_text||"",created_at:z.created_at||"",citation_style:z.citation_style||void 0,mode:z.summary_mode||void 0})}),b.data&&b.data.forEach(z=>{M.push({id:z.id,type:"theory",title:z.title||"Theory Background",content:z.theory_text||"",created_at:z.created_at,citation_style:z.citation_style||void 0,mode:z.mode||void 0})}),w.data&&w.data.forEach(z=>{M.push({id:z.id,type:"method",title:z.title||"Methodology",content:z.method_text||"",created_at:z.created_at,citation_style:z.citation_style||void 0,mode:z.mode||void 0})}),j.data&&j.data.forEach(z=>{M.push({id:z.id,type:"analysis",title:"Analysis Result",content:z.result_text||"",created_at:z.created_at,citation_style:z.citation_style||void 0,mode:z.mode||void 0})}),N.data&&N.data.forEach(z=>{M.push({id:z.id,type:"qualitative",title:z.title||"Qualitative Summary",content:z.summary_text||"",created_at:z.created_at})}),C.data&&C.data.forEach(z=>{M.push({id:z.id,type:"topic_explorer",title:z.title||"Topic Exploration",content:z.introduction||"",created_at:z.created_at,mode:z.language||void 0})}),k.data&&k.data.forEach(z=>{M.push({id:z.id,type:"research_setup",title:z.title||"Research Setup",content:z.aim||"",created_at:z.created_at,mode:z.degree||void 0})}),M.sort((z,P)=>new Date(P.created_at).getTime()-new Date(z.created_at).getTime()),s(M),o(E.data||[])}catch(v){console.error("Error fetching history:",v),$e.error("Error loading history")}finally{c(!1)}},f=async(v,b)=>{$e.info(`Preparing ${b.toUpperCase()} export...`)},p=v=>{switch(v){case"summary":return"default";case"theory":return"secondary";case"method":return"outline";case"analysis":return"default";case"qualitative":return"secondary";case"topic_explorer":return"default";case"research_setup":return"secondary";default:return"outline"}},g=v=>{switch(v){case"summary":return"Summary";case"theory":return"Theory";case"method":return"Method";case"analysis":return"Analysis";case"qualitative":return"Qualitative";case"topic_explorer":return"Topic Explorer";case"research_setup":return"Research Setup";default:return v}},m=v=>new Date(v).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0});if(e||l)return a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})});if(!t)return null;const x=i.reduce((v,b)=>v+SK(b.prompt_tokens,b.completion_tokens,b.model,b.source),0),y=i.filter(v=>new Date(v.timestamp).toDateString()===new Date().toDateString()).length;return a.jsx(er,{showSidebar:!0,children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"History & Exports"}),a.jsx("p",{className:"text-muted-foreground",children:"Overview of all your activities and download options"})]}),a.jsx("div",{className:"flex items-center gap-4",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(qve,{className:"h-4 w-4"}),a.jsxs(at,{value:u,onValueChange:v=>d(v),children:[a.jsx(nt,{className:"w-44",children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"all",children:"All Activities"}),a.jsx(Te,{value:"generations",children:"AI Generations"}),a.jsx(Te,{value:"usage",children:"Usage History"})]})]})]})})]}),a.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-sm font-medium flex items-center gap-2",children:[a.jsx(Ji,{className:"h-4 w-4 text-primary"}),"Total AI Generations"]})}),a.jsx(Be,{children:a.jsx("div",{className:"text-3xl font-bold",children:n.length})})]}),a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-sm font-medium flex items-center gap-2",children:[a.jsx(oz,{className:"h-4 w-4 text-primary"}),"Student Points Used"]})}),a.jsx(Be,{children:a.jsxs("div",{className:"text-3xl font-bold",children:[x.toFixed(2)," SP"]})})]}),a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-sm font-medium flex items-center gap-2",children:[a.jsx(dz,{className:"h-4 w-4 text-primary"}),"Activities Today"]})}),a.jsx(Be,{children:a.jsx("div",{className:"text-3xl font-bold",children:y})})]})]}),(u==="all"||u==="generations")&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("h2",{className:"text-xl font-semibold",children:"AI Generations"}),n.length===0?a.jsx(Me,{children:a.jsxs(Be,{className:"text-center py-12",children:[a.jsx(Nr,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium mb-2",children:"No AI generations yet"}),a.jsx("p",{className:"text-muted-foreground",children:"Start creating summaries, theories, or methodologies to see them here"})]})}):a.jsx("div",{className:"grid gap-4",children:n.map(v=>a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx("div",{className:"flex items-start justify-between",children:a.jsxs("div",{children:[a.jsx(Je,{className:"text-lg",children:v.title}),a.jsxs(mn,{className:"flex items-center gap-3 mt-2 flex-wrap",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(dz,{className:"h-4 w-4"}),m(v.created_at)]}),a.jsx(gt,{variant:p(v.type),children:g(v.type)}),v.citation_style&&a.jsx(gt,{variant:"outline",children:v.citation_style})]})]})})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsx("div",{className:"bg-muted/30 rounded-lg p-4",children:a.jsx("p",{className:"text-sm leading-relaxed line-clamp-3",children:v.content?xk(v.content,v.mode):"No content available"})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>f(v,"pdf"),children:[a.jsx(mo,{className:"h-4 w-4 mr-2"}),"PDF"]}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>f(v,"docx"),children:[a.jsx(mo,{className:"h-4 w-4 mr-2"}),"DOCX"]}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>f(v,"txt"),children:[a.jsx(mo,{className:"h-4 w-4 mr-2"}),"TXT"]})]})]})]},`${v.type}-${v.id}`))})]}),(u==="all"||u==="usage")&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("h2",{className:"text-xl font-semibold",children:"Usage History"}),i.length===0?a.jsx(Me,{children:a.jsxs(Be,{className:"text-center py-12",children:[a.jsx(oz,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium mb-2",children:"No activity recorded yet"}),a.jsx("p",{className:"text-muted-foreground",children:"Your usage history will appear here"})]})}):a.jsx(Me,{children:a.jsx(Be,{className:"p-0",children:a.jsx("div",{className:"max-h-96 overflow-y-auto",children:i.map(v=>{const b=SK(v.prompt_tokens,v.completion_tokens,v.model,v.source);return a.jsxs("div",{className:"flex items-center justify-between p-4 border-b last:border-b-0",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:v.source||"Unknown"}),a.jsx("div",{className:"text-sm text-muted-foreground",children:m(v.timestamp)})]}),a.jsxs(gt,{variant:"secondary",className:"font-mono",children:[b.toFixed(3)," SP"]})]},v.id)})})})})]})]})})};function GN(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ufe={exports:{}};/*!
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
<http://stuartk.com/jszip>
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/main/LICENSE
*/(function(t,e){(function(r){t.exports=r()})(function(){return function r(n,s,i){function o(u,d){if(!s[u]){if(!n[u]){var h=typeof GN=="function"&&GN;if(!d&&h)return h(u,!0);if(l)return l(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=s[u]={exports:{}};n[u][0].call(p.exports,function(g){var m=n[u][1][g];return o(m||g)},p,p.exports,r,n,s,i)}return s[u].exports}for(var l=typeof GN=="function"&&GN,c=0;c<i.length;c++)o(i[c]);return o}({1:[function(r,n,s){var i=r("./utils"),o=r("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(c){for(var u,d,h,f,p,g,m,x=[],y=0,v=c.length,b=v,w=i.getTypeOf(c)!=="string";y<c.length;)b=v-y,h=w?(u=c[y++],d=y<v?c[y++]:0,y<v?c[y++]:0):(u=c.charCodeAt(y++),d=y<v?c.charCodeAt(y++):0,y<v?c.charCodeAt(y++):0),f=u>>2,p=(3&u)<<4|d>>4,g=1<b?(15&d)<<2|h>>6:64,m=2<b?63&h:64,x.push(l.charAt(f)+l.charAt(p)+l.charAt(g)+l.charAt(m));return x.join("")},s.decode=function(c){var u,d,h,f,p,g,m=0,x=0,y="data:";if(c.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var v,b=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&b--,c.charAt(c.length-2)===l.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=o.uint8array?new Uint8Array(0|b):new Array(0|b);m<c.length;)u=l.indexOf(c.charAt(m++))<<2|(f=l.indexOf(c.charAt(m++)))>>4,d=(15&f)<<4|(p=l.indexOf(c.charAt(m++)))>>2,h=(3&p)<<6|(g=l.indexOf(c.charAt(m++))),v[x++]=u,p!==64&&(v[x++]=d),g!==64&&(v[x++]=h);return v}},{"./support":30,"./utils":32}],2:[function(r,n,s){var i=r("./external"),o=r("./stream/DataWorker"),l=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(d,h,f,p,g){this.compressedSize=d,this.uncompressedSize=h,this.crc32=f,this.compression=p,this.compressedContent=g}u.prototype={getContentWorker:function(){var d=new o(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new o(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,h,f){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(h.compressWorker(f)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var i=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var i=r("./utils"),o=function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c}();n.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?function(u,d,h,f){var p=o,g=f+h;u^=-1;for(var m=f;m<g;m++)u=u>>>8^p[255&(u^d[m])];return-1^u}(0|c,l,l.length,0):function(u,d,h,f){var p=o,g=f+h;u^=-1;for(var m=f;m<g;m++)u=u>>>8^p[255&(u^d.charCodeAt(m))];return-1^u}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(r,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(r,n,s){var i=null;i=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:i}},{lie:37}],7:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=r("pako"),l=r("./utils"),c=r("./stream/GenericWorker"),u=i?"uint8array":"array";function d(h,f){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=f,this.meta={}}s.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,h.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(f){h.push({data:f,meta:h.meta})}},s.compressWorker=function(h){return new d("Deflate",h)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function i(p,g){var m,x="";for(m=0;m<g;m++)x+=String.fromCharCode(255&p),p>>>=8;return x}function o(p,g,m,x,y,v){var b,w,j=p.file,N=p.compression,C=v!==u.utf8encode,k=l.transformTo("string",v(j.name)),E=l.transformTo("string",u.utf8encode(j.name)),M=j.comment,z=l.transformTo("string",v(M)),P=l.transformTo("string",u.utf8encode(M)),V=E.length!==j.name.length,A=P.length!==M.length,$="",K="",G="",Y=j.dir,H=j.date,B={crc32:0,compressedSize:0,uncompressedSize:0};g&&!m||(B.crc32=p.crc32,B.compressedSize=p.compressedSize,B.uncompressedSize=p.uncompressedSize);var L=0;g&&(L|=8),C||!V&&!A||(L|=2048);var F=0,W=0;Y&&(F|=16),y==="UNIX"?(W=798,F|=function(oe,le){var U=oe;return oe||(U=le?16893:33204),(65535&U)<<16}(j.unixPermissions,Y)):(W=20,F|=function(oe){return 63&(oe||0)}(j.dosPermissions)),b=H.getUTCHours(),b<<=6,b|=H.getUTCMinutes(),b<<=5,b|=H.getUTCSeconds()/2,w=H.getUTCFullYear()-1980,w<<=4,w|=H.getUTCMonth()+1,w<<=5,w|=H.getUTCDate(),V&&(K=i(1,1)+i(d(k),4)+E,$+="up"+i(K.length,2)+K),A&&(G=i(1,1)+i(d(z),4)+P,$+="uc"+i(G.length,2)+G);var X="";return X+=`
\0`,X+=i(L,2),X+=N.magic,X+=i(b,2),X+=i(w,2),X+=i(B.crc32,4),X+=i(B.compressedSize,4),X+=i(B.uncompressedSize,4),X+=i(k.length,2),X+=i($.length,2),{fileRecord:h.LOCAL_FILE_HEADER+X+k+$,dirRecord:h.CENTRAL_FILE_HEADER+i(W,2)+X+i(z.length,2)+"\0\0\0\0"+i(F,4)+i(x,4)+k+$+z}}var l=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),h=r("../signature");function f(p,g,m,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=m,this.encodeFileName=x,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(f,c),f.prototype.push=function(p){var g=p.meta.percent||0,m=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(g+100*(m-x-1))/m:100}}))},f.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var g=this.streamFiles&&!p.file.dir;if(g){var m=o(p,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(p){this.accumulate=!1;var g=this.streamFiles&&!p.file.dir,m=o(p,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),g)this.push({data:function(x){return h.DATA_DESCRIPTOR+i(x.crc32,4)+i(x.compressedSize,4)+i(x.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var p=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var m=this.bytesWritten-p,x=function(y,v,b,w,j){var N=l.transformTo("string",j(w));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(y,2)+i(y,2)+i(v,4)+i(b,4)+i(N.length,2)+N}(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(p){this._sources.push(p);var g=this;return p.on("data",function(m){g.processChunk(m)}),p.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),p.on("error",function(m){g.error(m)}),this},f.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(p){var g=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var m=0;m<g.length;m++)try{g[m].error(p)}catch{}return!0},f.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,g=0;g<p.length;g++)p[g].lock()},n.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,n,s){var i=r("../compressions"),o=r("./ZipFileWorker");s.generateWorker=function(l,c,u){var d=new o(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{l.forEach(function(f,p){h++;var g=function(v,b){var w=v||b,j=i[w];if(!j)throw new Error(w+" is not a valid compression method !");return j}(p.options.compression,c.compression),m=p.options.compressionOptions||c.compressionOptions||{},x=p.dir,y=p.date;p._compressWorker(g,m).withStreamInfo("file",{name:f,dir:x,date:y,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=h}catch(f){d.error(f)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,n,s){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new i;for(var l in this)typeof this[l]!="function"&&(o[l]=this[l]);return o}}(i.prototype=r("./object")).loadAsync=r("./load"),i.support=r("./support"),i.defaults=r("./defaults"),i.version="3.10.1",i.loadAsync=function(o,l){return new i().loadAsync(o,l)},i.external=r("./external"),n.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,n,s){var i=r("./utils"),o=r("./external"),l=r("./utf8"),c=r("./zipEntries"),u=r("./stream/Crc32Probe"),d=r("./nodejsUtils");function h(f){return new o.Promise(function(p,g){var m=f.decompressed.getContentWorker().pipe(new u);m.on("error",function(x){g(x)}).on("end",function(){m.streamInfo.crc32!==f.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}n.exports=function(f,p){var g=this;return p=i.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",f,!0,p.optimizedBinaryString,p.base64).then(function(m){var x=new c(p);return x.load(m),x}).then(function(m){var x=[o.Promise.resolve(m)],y=m.files;if(p.checkCRC32)for(var v=0;v<y.length;v++)x.push(h(y[v]));return o.Promise.all(x)}).then(function(m){for(var x=m.shift(),y=x.files,v=0;v<y.length;v++){var b=y[v],w=b.fileNameStr,j=i.resolve(b.fileNameStr);g.file(j,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:p.createFolders}),b.dir||(g.file(j).unsafeOriginalName=w)}return x.zipComment.length&&(g.comment=x.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,n,s){var i=r("../utils"),o=r("../stream/GenericWorker");function l(c,u){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(l,o),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,n,s){var i=r("readable-stream").Readable;function o(l,c,u){i.call(this,c),this._helper=l;var d=this;l.on("data",function(h,f){d.push(h)||d._helper.pause(),u&&u(f)}).on("error",function(h){d.emit("error",h)}).on("end",function(){d.push(null)})}r("../utils").inherits(o,i),o.prototype._read=function(){this._helper.resume()},n.exports=o},{"../utils":32,"readable-stream":16}],14:[function(r,n,s){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,o);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,o)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var o=new Buffer(i);return o.fill(0),o},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(r,n,s){function i(j,N,C){var k,E=l.getTypeOf(N),M=l.extend(C||{},d);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(j=y(j)),M.createFolders&&(k=x(j))&&v.call(this,k,!0);var z=E==="string"&&M.binary===!1&&M.base64===!1;C&&C.binary!==void 0||(M.binary=!z),(N instanceof h&&N.uncompressedSize===0||M.dir||!N||N.length===0)&&(M.base64=!1,M.binary=!0,N="",M.compression="STORE",E="string");var P=null;P=N instanceof h||N instanceof c?N:g.isNode&&g.isStream(N)?new m(j,N):l.prepareContent(j,N,M.binary,M.optimizedBinaryString,M.base64);var V=new f(j,P,M);this.files[j]=V}var o=r("./utf8"),l=r("./utils"),c=r("./stream/GenericWorker"),u=r("./stream/StreamHelper"),d=r("./defaults"),h=r("./compressedObject"),f=r("./zipObject"),p=r("./generate"),g=r("./nodejsUtils"),m=r("./nodejs/NodejsStreamInputAdapter"),x=function(j){j.slice(-1)==="/"&&(j=j.substring(0,j.length-1));var N=j.lastIndexOf("/");return 0<N?j.substring(0,N):""},y=function(j){return j.slice(-1)!=="/"&&(j+="/"),j},v=function(j,N){return N=N!==void 0?N:d.createFolders,j=y(j),this.files[j]||i.call(this,j,null,{dir:!0,createFolders:N}),this.files[j]};function b(j){return Object.prototype.toString.call(j)==="[object RegExp]"}var w={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(j){var N,C,k;for(N in this.files)k=this.files[N],(C=N.slice(this.root.length,N.length))&&N.slice(0,this.root.length)===this.root&&j(C,k)},filter:function(j){var N=[];return this.forEach(function(C,k){j(C,k)&&N.push(k)}),N},file:function(j,N,C){if(arguments.length!==1)return j=this.root+j,i.call(this,j,N,C),this;if(b(j)){var k=j;return this.filter(function(M,z){return!z.dir&&k.test(M)})}var E=this.files[this.root+j];return E&&!E.dir?E:null},folder:function(j){if(!j)return this;if(b(j))return this.filter(function(E,M){return M.dir&&j.test(E)});var N=this.root+j,C=v.call(this,N),k=this.clone();return k.root=C.name,k},remove:function(j){j=this.root+j;var N=this.files[j];if(N||(j.slice(-1)!=="/"&&(j+="/"),N=this.files[j]),N&&!N.dir)delete this.files[j];else for(var C=this.filter(function(E,M){return M.name.slice(0,j.length)===j}),k=0;k<C.length;k++)delete this.files[C[k].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(j){var N,C={};try{if((C=l.extend(j||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");l.checkSupport(C.type),C.platform!=="darwin"&&C.platform!=="freebsd"&&C.platform!=="linux"&&C.platform!=="sunos"||(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var k=C.comment||this.comment||"";N=p.generateWorker(this,C,k)}catch(E){(N=new c("error")).error(E)}return new u(N,C.type||"string",C.mimeType)},generateAsync:function(j,N){return this.generateInternalStream(j).accumulate(N)},generateNodeStream:function(j,N){return(j=j||{}).type||(j.type="nodebuffer"),this.generateInternalStream(j).toNodejsStream(N)}};n.exports=w},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,n,s){n.exports=r("stream")},{stream:void 0}],17:[function(r,n,s){var i=r("./DataReader");function o(l){i.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data[this.zero+l]},o.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===c&&this.data[f+1]===u&&this.data[f+2]===d&&this.data[f+3]===h)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),f=this.readData(4);return c===f[0]&&u===f[1]&&d===f[2]&&h===f[3]},o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],18:[function(r,n,s){var i=r("../utils");function o(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return i.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},n.exports=o},{"../utils":32}],19:[function(r,n,s){var i=r("./Uint8ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var i=r("./DataReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},o.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},o.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var i=r("./ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var i=r("../utils"),o=r("../support"),l=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(h){var f=i.getTypeOf(h);return i.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new u(h):o.uint8array?new d(i.transformTo("uint8array",h)):new l(i.transformTo("array",h)):new c(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var i=r("./GenericWorker"),o=r("../utils");function l(c){i.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(l,i),l.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},n.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var i=r("./GenericWorker"),o=r("../crc32");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(l,i),l.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.inherits(l,o),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}o.prototype.processChunk.call(this,c)},n.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(l,o),l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function i(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,l){return this._listeners[o].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,l){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,l)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var l=this;return o.on("data",function(c){l.processChunk(c)}),o.on("end",function(){l.end()}),o.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,l){return this.extraStreamInfo[o]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},n.exports=i},{}],29:[function(r,n,s){var i=r("../utils"),o=r("./ConvertWorker"),l=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),h=null;if(u.nodestream)try{h=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(g,m){return new d.Promise(function(x,y){var v=[],b=g._internalType,w=g._outputType,j=g._mimeType;g.on("data",function(N,C){v.push(N),m&&m(C)}).on("error",function(N){v=[],y(N)}).on("end",function(){try{var N=function(C,k,E){switch(C){case"blob":return i.newBlob(i.transformTo("arraybuffer",k),E);case"base64":return c.encode(k);default:return i.transformTo(C,k)}}(w,function(C,k){var E,M=0,z=null,P=0;for(E=0;E<k.length;E++)P+=k[E].length;switch(C){case"string":return k.join("");case"array":return Array.prototype.concat.apply([],k);case"uint8array":for(z=new Uint8Array(P),E=0;E<k.length;E++)z.set(k[E],M),M+=k[E].length;return z;case"nodebuffer":return Buffer.concat(k);default:throw new Error("concat : unsupported type '"+C+"'")}}(b,v),j);x(N)}catch(C){y(C)}v=[]}).resume()})}function p(g,m,x){var y=m;switch(m){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=m,this._mimeType=x,i.checkSupport(y),this._worker=g.pipe(new o(y)),g.lock()}catch(v){this._worker=new l("error"),this._worker.error(v)}}p.prototype={accumulate:function(g){return f(this,g)},on:function(g,m){var x=this;return g==="data"?this._worker.on(g,function(y){m.call(x,y.data,y.meta)}):this._worker.on(g,function(){i.delay(m,arguments,x)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},g)}},n.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,n,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var i=new ArrayBuffer(0);try{s.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(i),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var i=r("./utils"),o=r("./support"),l=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function h(){c.call(this,"utf-8 decode"),this.leftOver=null}function f(){c.call(this,"utf-8 encode")}s.utf8encode=function(p){return o.nodebuffer?l.newBufferFrom(p,"utf-8"):function(g){var m,x,y,v,b,w=g.length,j=0;for(v=0;v<w;v++)(64512&(x=g.charCodeAt(v)))==55296&&v+1<w&&(64512&(y=g.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),v++),j+=x<128?1:x<2048?2:x<65536?3:4;for(m=o.uint8array?new Uint8Array(j):new Array(j),v=b=0;b<j;v++)(64512&(x=g.charCodeAt(v)))==55296&&v+1<w&&(64512&(y=g.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),v++),x<128?m[b++]=x:(x<2048?m[b++]=192|x>>>6:(x<65536?m[b++]=224|x>>>12:(m[b++]=240|x>>>18,m[b++]=128|x>>>12&63),m[b++]=128|x>>>6&63),m[b++]=128|63&x);return m}(p)},s.utf8decode=function(p){return o.nodebuffer?i.transformTo("nodebuffer",p).toString("utf-8"):function(g){var m,x,y,v,b=g.length,w=new Array(2*b);for(m=x=0;m<b;)if((y=g[m++])<128)w[x++]=y;else if(4<(v=u[y]))w[x++]=65533,m+=v-1;else{for(y&=v===2?31:v===3?15:7;1<v&&m<b;)y=y<<6|63&g[m++],v--;1<v?w[x++]=65533:y<65536?w[x++]=y:(y-=65536,w[x++]=55296|y>>10&1023,w[x++]=56320|1023&y)}return w.length!==x&&(w.subarray?w=w.subarray(0,x):w.length=x),i.applyFromCharCode(w)}(p=i.transformTo(o.uint8array?"uint8array":"array",p))},i.inherits(h,c),h.prototype.processChunk=function(p){var g=i.transformTo(o.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=g;(g=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),g.set(m,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var x=function(v,b){var w;for((b=b||v.length)>v.length&&(b=v.length),w=b-1;0<=w&&(192&v[w])==128;)w--;return w<0||w===0?b:w+u[v[w]]>b?w:b}(g),y=g;x!==g.length&&(o.uint8array?(y=g.subarray(0,x),this.leftOver=g.subarray(x,g.length)):(y=g.slice(0,x),this.leftOver=g.slice(x,g.length))),this.push({data:s.utf8decode(y),meta:p.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=h,i.inherits(f,c),f.prototype.processChunk=function(p){this.push({data:s.utf8encode(p.data),meta:p.meta})},s.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var i=r("./support"),o=r("./base64"),l=r("./nodejsUtils"),c=r("./external");function u(m){return m}function d(m,x){for(var y=0;y<m.length;++y)x[y]=255&m.charCodeAt(y);return x}r("setimmediate"),s.newBlob=function(m,x){s.checkSupport("blob");try{return new Blob([m],{type:x})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(m),y.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(m,x,y){var v=[],b=0,w=m.length;if(w<=y)return String.fromCharCode.apply(null,m);for(;b<w;)x==="array"||x==="nodebuffer"?v.push(String.fromCharCode.apply(null,m.slice(b,Math.min(b+y,w)))):v.push(String.fromCharCode.apply(null,m.subarray(b,Math.min(b+y,w)))),b+=y;return v.join("")},stringifyByChar:function(m){for(var x="",y=0;y<m.length;y++)x+=String.fromCharCode(m[y]);return x},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}}()}};function f(m){var x=65536,y=s.getTypeOf(m),v=!0;if(y==="uint8array"?v=h.applyCanBeUsed.uint8array:y==="nodebuffer"&&(v=h.applyCanBeUsed.nodebuffer),v)for(;1<x;)try{return h.stringifyByChunk(m,y,x)}catch{x=Math.floor(x/2)}return h.stringifyByChar(m)}function p(m,x){for(var y=0;y<m.length;y++)x[y]=m[y];return x}s.applyFromCharCode=f;var g={};g.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return g.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,l.allocBuffer(m.length))}},g.array={string:f,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(m)}},g.arraybuffer={string:function(m){return f(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:u,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(new Uint8Array(m))}},g.uint8array={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return l.newBufferFrom(m)}},g.nodebuffer={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return g.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:u},s.transformTo=function(m,x){if(x=x||"",!m)return x;s.checkSupport(m);var y=s.getTypeOf(x);return g[y][m](x)},s.resolve=function(m){for(var x=m.split("/"),y=[],v=0;v<x.length;v++){var b=x[v];b==="."||b===""&&v!==0&&v!==x.length-1||(b===".."?y.pop():y.push(b))}return y.join("/")},s.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(m)?"nodebuffer":i.uint8array&&m instanceof Uint8Array?"uint8array":i.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(m){if(!i[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(m){var x,y,v="";for(y=0;y<(m||"").length;y++)v+="\\x"+((x=m.charCodeAt(y))<16?"0":"")+x.toString(16).toUpperCase();return v},s.delay=function(m,x,y){setImmediate(function(){m.apply(y||null,x||[])})},s.inherits=function(m,x){function y(){}y.prototype=x.prototype,m.prototype=new y},s.extend=function(){var m,x,y={};for(m=0;m<arguments.length;m++)for(x in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],x)&&y[x]===void 0&&(y[x]=arguments[m][x]);return y},s.prepareContent=function(m,x,y,v,b){return c.Promise.resolve(x).then(function(w){return i.blob&&(w instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(w))!==-1)&&typeof FileReader<"u"?new c.Promise(function(j,N){var C=new FileReader;C.onload=function(k){j(k.target.result)},C.onerror=function(k){N(k.target.error)},C.readAsArrayBuffer(w)}):w}).then(function(w){var j=s.getTypeOf(w);return j?(j==="arraybuffer"?w=s.transformTo("uint8array",w):j==="string"&&(b?w=o.decode(w):y&&v!==!0&&(w=function(N){return d(N,i.uint8array?new Uint8Array(N.length):new Array(N.length))}(w))),w):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,n,s){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./signature"),c=r("./zipEntry"),u=r("./support");function d(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(h)+")")}},isSignature:function(h,f){var p=this.reader.index;this.reader.setIndex(h);var g=this.reader.readString(4)===f;return this.reader.setIndex(p),g},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var h=this.reader.readData(this.zipCommentLength),f=u.uint8array?"uint8array":"array",p=o.transformTo(f,h);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var h,f,p,g=this.zip64EndOfCentralSize-44;0<g;)h=this.reader.readInt(2),f=this.reader.readInt(4),p=this.reader.readData(f),this.zip64ExtensibleData[h]={id:h,length:f,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var h,f;for(h=0;h<this.files.length;h++)f=this.files[h],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var h=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(h);var f=h;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(h=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var g=f-p;if(0<g)this.isSignature(f,l.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(h){this.reader=i(h)},load:function(h){this.prepareReader(h),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,n,s){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./compressedObject"),c=r("./crc32"),u=r("./utf8"),d=r("./compressions"),h=r("./support");function f(p,g){this.options=p,this.loadOptions=g}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var g,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((g=function(x){for(var y in d)if(Object.prototype.hasOwnProperty.call(d,y)&&d[y].magic===x)return d[y];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,g,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var g=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(g),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=i(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var g,m,x,y=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<y;)g=p.readInt(2),m=p.readInt(2),x=p.readData(m),this.extraFields[g]={id:g,length:m,value:x};p.setIndex(y)},handleUTF8:function(){var p=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var m=o.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var y=o.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var g=i(p.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var g=i(p.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null}},n.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,n,s){function i(g,m,x){this.name=g,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=m,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var o=r("./stream/StreamHelper"),l=r("./stream/DataWorker"),c=r("./utf8"),u=r("./compressedObject"),d=r("./stream/GenericWorker");i.prototype={internalStream:function(g){var m=null,x="string";try{if(!g)throw new Error("No output type specified.");var y=(x=g.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!y&&(m=m.pipe(new c.Utf8EncodeWorker)),!v&&y&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(b){(m=new d("error")).error(b)}return new o(m,x,"")},async:function(g,m){return this.internalStream(g).accumulate(m)},nodeStream:function(g,m){return this.internalStream(g||"nodebuffer").toNodejsStream(m)},_compressWorker:function(g,m){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,g,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<h.length;p++)i.prototype[h[p]]=f;n.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,n,s){(function(i){var o,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,d=new c(g),h=i.document.createTextNode("");d.observe(h,{characterData:!0}),o=function(){h.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)o="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var m=i.document.createElement("script");m.onreadystatechange=function(){g(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},i.document.documentElement.appendChild(m)}:function(){setTimeout(g,0)};else{var f=new i.MessageChannel;f.port1.onmessage=g,o=function(){f.port2.postMessage(0)}}var p=[];function g(){var m,x;l=!0;for(var y=p.length;y;){for(x=p,p=[],m=-1;++m<y;)x[m]();y=p.length}l=!1}n.exports=function(m){p.push(m)!==1||l||o()}}).call(this,typeof Wr<"u"?Wr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,n,s){var i=r("immediate");function o(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,y!==o&&m(this,y)}function f(y,v,b){this.promise=y,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function p(y,v,b){i(function(){var w;try{w=v(b)}catch(j){return l.reject(y,j)}w===y?l.reject(y,new TypeError("Cannot resolve promise with itself")):l.resolve(y,w)})}function g(y){var v=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof v=="function")return function(){v.apply(y,arguments)}}function m(y,v){var b=!1;function w(C){b||(b=!0,l.reject(y,C))}function j(C){b||(b=!0,l.resolve(y,C))}var N=x(function(){v(j,w)});N.status==="error"&&w(N.value)}function x(y,v){var b={};try{b.value=y(v),b.status="success"}catch(w){b.status="error",b.value=w}return b}(n.exports=h).prototype.finally=function(y){if(typeof y!="function")return this;var v=this.constructor;return this.then(function(b){return v.resolve(y()).then(function(){return b})},function(b){return v.resolve(y()).then(function(){throw b})})},h.prototype.catch=function(y){return this.then(null,y)},h.prototype.then=function(y,v){if(typeof y!="function"&&this.state===u||typeof v!="function"&&this.state===c)return this;var b=new this.constructor(o);return this.state!==d?p(b,this.state===u?y:v,this.outcome):this.queue.push(new f(b,y,v)),b},f.prototype.callFulfilled=function(y){l.resolve(this.promise,y)},f.prototype.otherCallFulfilled=function(y){p(this.promise,this.onFulfilled,y)},f.prototype.callRejected=function(y){l.reject(this.promise,y)},f.prototype.otherCallRejected=function(y){p(this.promise,this.onRejected,y)},l.resolve=function(y,v){var b=x(g,v);if(b.status==="error")return l.reject(y,b.value);var w=b.value;if(w)m(y,w);else{y.state=u,y.outcome=v;for(var j=-1,N=y.queue.length;++j<N;)y.queue[j].callFulfilled(v)}return y},l.reject=function(y,v){y.state=c,y.outcome=v;for(var b=-1,w=y.queue.length;++b<w;)y.queue[b].callRejected(v);return y},h.resolve=function(y){return y instanceof this?y:l.resolve(new this(o),y)},h.reject=function(y){var v=new this(o);return l.reject(v,y)},h.all=function(y){var v=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=y.length,w=!1;if(!b)return this.resolve([]);for(var j=new Array(b),N=0,C=-1,k=new this(o);++C<b;)E(y[C],C);return k;function E(M,z){v.resolve(M).then(function(P){j[z]=P,++N!==b||w||(w=!0,l.resolve(k,j))},function(P){w||(w=!0,l.reject(k,P))})}},h.race=function(y){var v=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=y.length,w=!1;if(!b)return this.resolve([]);for(var j=-1,N=new this(o);++j<b;)C=y[j],v.resolve(C).then(function(k){w||(w=!0,l.resolve(N,k))},function(k){w||(w=!0,l.reject(N,k))});var C;return N}},{immediate:36}],38:[function(r,n,s){var i={};(0,r("./lib/utils/common").assign)(i,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),n.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,n,s){var i=r("./zlib/deflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/messages"),u=r("./zlib/zstream"),d=Object.prototype.toString,h=0,f=-1,p=0,g=8;function m(y){if(!(this instanceof m))return new m(y);this.options=o.assign({level:f,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},y||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=i.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(b!==h)throw new Error(c[b]);if(v.header&&i.deflateSetHeader(this.strm,v.header),v.dictionary){var w;if(w=typeof v.dictionary=="string"?l.string2buf(v.dictionary):d.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(b=i.deflateSetDictionary(this.strm,w))!==h)throw new Error(c[b]);this._dict_set=!0}}function x(y,v){var b=new m(v);if(b.push(y,!0),b.err)throw b.msg||c[b.err];return b.result}m.prototype.push=function(y,v){var b,w,j=this.strm,N=this.options.chunkSize;if(this.ended)return!1;w=v===~~v?v:v===!0?4:0,typeof y=="string"?j.input=l.string2buf(y):d.call(y)==="[object ArrayBuffer]"?j.input=new Uint8Array(y):j.input=y,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new o.Buf8(N),j.next_out=0,j.avail_out=N),(b=i.deflate(j,w))!==1&&b!==h)return this.onEnd(b),!(this.ended=!0);j.avail_out!==0&&(j.avail_in!==0||w!==4&&w!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(o.shrinkBuf(j.output,j.next_out))):this.onData(o.shrinkBuf(j.output,j.next_out)))}while((0<j.avail_in||j.avail_out===0)&&b!==1);return w===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===h):w!==2||(this.onEnd(h),!(j.avail_out=0))},m.prototype.onData=function(y){this.chunks.push(y)},m.prototype.onEnd=function(y){y===h&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},s.Deflate=m,s.deflate=x,s.deflateRaw=function(y,v){return(v=v||{}).raw=!0,x(y,v)},s.gzip=function(y,v){return(v=v||{}).gzip=!0,x(y,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,n,s){var i=r("./zlib/inflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/constants"),u=r("./zlib/messages"),d=r("./zlib/zstream"),h=r("./zlib/gzheader"),f=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},m||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||m&&m.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&!(15&x.windowBits)&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=i.inflateInit2(this.strm,x.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new h,i.inflateGetHeader(this.strm,this.header)}function g(m,x){var y=new p(x);if(y.push(m,!0),y.err)throw y.msg||u[y.err];return y.result}p.prototype.push=function(m,x){var y,v,b,w,j,N,C=this.strm,k=this.options.chunkSize,E=this.options.dictionary,M=!1;if(this.ended)return!1;v=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?C.input=l.binstring2buf(m):f.call(m)==="[object ArrayBuffer]"?C.input=new Uint8Array(m):C.input=m,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new o.Buf8(k),C.next_out=0,C.avail_out=k),(y=i.inflate(C,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&E&&(N=typeof E=="string"?l.string2buf(E):f.call(E)==="[object ArrayBuffer]"?new Uint8Array(E):E,y=i.inflateSetDictionary(this.strm,N)),y===c.Z_BUF_ERROR&&M===!0&&(y=c.Z_OK,M=!1),y!==c.Z_STREAM_END&&y!==c.Z_OK)return this.onEnd(y),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&y!==c.Z_STREAM_END&&(C.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=l.utf8border(C.output,C.next_out),w=C.next_out-b,j=l.buf2string(C.output,b),C.next_out=w,C.avail_out=k-w,w&&o.arraySet(C.output,C.output,b,w,0),this.onData(j)):this.onData(o.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(M=!0)}while((0<C.avail_in||C.avail_out===0)&&y!==c.Z_STREAM_END);return y===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(y=i.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===c.Z_OK):v!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(C.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},s.Inflate=p,s.inflate=g,s.inflateRaw=function(m,x){return(x=x||{}).raw=!0,g(m,x)},s.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}return c},s.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var o={arraySet:function(c,u,d,h,f){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),f);else for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){var u,d,h,f,p,g;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(g=new Uint8Array(h),u=f=0,d=c.length;u<d;u++)p=c[u],g.set(p,f),f+=p.length;return g}},l={arraySet:function(c,u,d,h,f){for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};s.setTyped=function(c){c?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,o)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,l))},s.setTyped(i)},{}],42:[function(r,n,s){var i=r("./common"),o=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new i.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(h,f){if(f<65537&&(h.subarray&&l||!h.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(h,f));for(var p="",g=0;g<f;g++)p+=String.fromCharCode(h[g]);return p}c[254]=c[254]=1,s.string2buf=function(h){var f,p,g,m,x,y=h.length,v=0;for(m=0;m<y;m++)(64512&(p=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),m++),v+=p<128?1:p<2048?2:p<65536?3:4;for(f=new i.Buf8(v),m=x=0;x<v;m++)(64512&(p=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),m++),p<128?f[x++]=p:(p<2048?f[x++]=192|p>>>6:(p<65536?f[x++]=224|p>>>12:(f[x++]=240|p>>>18,f[x++]=128|p>>>12&63),f[x++]=128|p>>>6&63),f[x++]=128|63&p);return f},s.buf2binstring=function(h){return d(h,h.length)},s.binstring2buf=function(h){for(var f=new i.Buf8(h.length),p=0,g=f.length;p<g;p++)f[p]=h.charCodeAt(p);return f},s.buf2string=function(h,f){var p,g,m,x,y=f||h.length,v=new Array(2*y);for(p=g=0;p<y;)if((m=h[p++])<128)v[g++]=m;else if(4<(x=c[m]))v[g++]=65533,p+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&p<y;)m=m<<6|63&h[p++],x--;1<x?v[g++]=65533:m<65536?v[g++]=m:(m-=65536,v[g++]=55296|m>>10&1023,v[g++]=56320|1023&m)}return d(v,g)},s.utf8border=function(h,f){var p;for((f=f||h.length)>h.length&&(f=h.length),p=f-1;0<=p&&(192&h[p])==128;)p--;return p<0||p===0?f:p+c[h[p]]>f?p:f}},{"./common":41}],43:[function(r,n,s){n.exports=function(i,o,l,c){for(var u=65535&i|0,d=i>>>16&65535|0,h=0;l!==0;){for(l-=h=2e3<l?2e3:l;d=d+(u=u+o[c++]|0)|0,--h;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(r,n,s){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,n,s){var i=function(){for(var o,l=[],c=0;c<256;c++){o=c;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l}();n.exports=function(o,l,c,u){var d=i,h=u+c;o^=-1;for(var f=u;f<h;f++)o=o>>>8^d[255&(o^l[f])];return-1^o}},{}],46:[function(r,n,s){var i,o=r("../utils/common"),l=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),h=0,f=4,p=0,g=-2,m=-1,x=4,y=2,v=8,b=9,w=286,j=30,N=19,C=2*w+1,k=15,E=3,M=258,z=M+E+1,P=42,V=113,A=1,$=2,K=3,G=4;function Y(O,ie){return O.msg=d[ie],ie}function H(O){return(O<<1)-(4<O?9:0)}function B(O){for(var ie=O.length;0<=--ie;)O[ie]=0}function L(O){var ie=O.state,q=ie.pending;q>O.avail_out&&(q=O.avail_out),q!==0&&(o.arraySet(O.output,ie.pending_buf,ie.pending_out,q,O.next_out),O.next_out+=q,ie.pending_out+=q,O.total_out+=q,O.avail_out-=q,ie.pending-=q,ie.pending===0&&(ie.pending_out=0))}function F(O,ie){l._tr_flush_block(O,0<=O.block_start?O.block_start:-1,O.strstart-O.block_start,ie),O.block_start=O.strstart,L(O.strm)}function W(O,ie){O.pending_buf[O.pending++]=ie}function X(O,ie){O.pending_buf[O.pending++]=ie>>>8&255,O.pending_buf[O.pending++]=255&ie}function oe(O,ie){var q,I,T=O.max_chain_length,D=O.strstart,ne=O.prev_length,ue=O.nice_match,re=O.strstart>O.w_size-z?O.strstart-(O.w_size-z):0,pe=O.window,ve=O.w_mask,xe=O.prev,ae=O.strstart+M,de=pe[D+ne-1],ge=pe[D+ne];O.prev_length>=O.good_match&&(T>>=2),ue>O.lookahead&&(ue=O.lookahead);do if(pe[(q=ie)+ne]===ge&&pe[q+ne-1]===de&&pe[q]===pe[D]&&pe[++q]===pe[D+1]){D+=2,q++;do;while(pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&D<ae);if(I=M-(ae-D),D=ae-M,ne<I){if(O.match_start=ie,ue<=(ne=I))break;de=pe[D+ne-1],ge=pe[D+ne]}}while((ie=xe[ie&ve])>re&&--T!=0);return ne<=O.lookahead?ne:O.lookahead}function le(O){var ie,q,I,T,D,ne,ue,re,pe,ve,xe=O.w_size;do{if(T=O.window_size-O.lookahead-O.strstart,O.strstart>=xe+(xe-z)){for(o.arraySet(O.window,O.window,xe,xe,0),O.match_start-=xe,O.strstart-=xe,O.block_start-=xe,ie=q=O.hash_size;I=O.head[--ie],O.head[ie]=xe<=I?I-xe:0,--q;);for(ie=q=xe;I=O.prev[--ie],O.prev[ie]=xe<=I?I-xe:0,--q;);T+=xe}if(O.strm.avail_in===0)break;if(ne=O.strm,ue=O.window,re=O.strstart+O.lookahead,pe=T,ve=void 0,ve=ne.avail_in,pe<ve&&(ve=pe),q=ve===0?0:(ne.avail_in-=ve,o.arraySet(ue,ne.input,ne.next_in,ve,re),ne.state.wrap===1?ne.adler=c(ne.adler,ue,ve,re):ne.state.wrap===2&&(ne.adler=u(ne.adler,ue,ve,re)),ne.next_in+=ve,ne.total_in+=ve,ve),O.lookahead+=q,O.lookahead+O.insert>=E)for(D=O.strstart-O.insert,O.ins_h=O.window[D],O.ins_h=(O.ins_h<<O.hash_shift^O.window[D+1])&O.hash_mask;O.insert&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[D+E-1])&O.hash_mask,O.prev[D&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=D,D++,O.insert--,!(O.lookahead+O.insert<E)););}while(O.lookahead<z&&O.strm.avail_in!==0)}function U(O,ie){for(var q,I;;){if(O.lookahead<z){if(le(O),O.lookahead<z&&ie===h)return A;if(O.lookahead===0)break}if(q=0,O.lookahead>=E&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,q=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),q!==0&&O.strstart-q<=O.w_size-z&&(O.match_length=oe(O,q)),O.match_length>=E)if(I=l._tr_tally(O,O.strstart-O.match_start,O.match_length-E),O.lookahead-=O.match_length,O.match_length<=O.max_lazy_match&&O.lookahead>=E){for(O.match_length--;O.strstart++,O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,q=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart,--O.match_length!=0;);O.strstart++}else O.strstart+=O.match_length,O.match_length=0,O.ins_h=O.window[O.strstart],O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+1])&O.hash_mask;else I=l._tr_tally(O,0,O.window[O.strstart]),O.lookahead--,O.strstart++;if(I&&(F(O,!1),O.strm.avail_out===0))return A}return O.insert=O.strstart<E-1?O.strstart:E-1,ie===f?(F(O,!0),O.strm.avail_out===0?K:G):O.last_lit&&(F(O,!1),O.strm.avail_out===0)?A:$}function R(O,ie){for(var q,I,T;;){if(O.lookahead<z){if(le(O),O.lookahead<z&&ie===h)return A;if(O.lookahead===0)break}if(q=0,O.lookahead>=E&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,q=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),O.prev_length=O.match_length,O.prev_match=O.match_start,O.match_length=E-1,q!==0&&O.prev_length<O.max_lazy_match&&O.strstart-q<=O.w_size-z&&(O.match_length=oe(O,q),O.match_length<=5&&(O.strategy===1||O.match_length===E&&4096<O.strstart-O.match_start)&&(O.match_length=E-1)),O.prev_length>=E&&O.match_length<=O.prev_length){for(T=O.strstart+O.lookahead-E,I=l._tr_tally(O,O.strstart-1-O.prev_match,O.prev_length-E),O.lookahead-=O.prev_length-1,O.prev_length-=2;++O.strstart<=T&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,q=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),--O.prev_length!=0;);if(O.match_available=0,O.match_length=E-1,O.strstart++,I&&(F(O,!1),O.strm.avail_out===0))return A}else if(O.match_available){if((I=l._tr_tally(O,0,O.window[O.strstart-1]))&&F(O,!1),O.strstart++,O.lookahead--,O.strm.avail_out===0)return A}else O.match_available=1,O.strstart++,O.lookahead--}return O.match_available&&(I=l._tr_tally(O,0,O.window[O.strstart-1]),O.match_available=0),O.insert=O.strstart<E-1?O.strstart:E-1,ie===f?(F(O,!0),O.strm.avail_out===0?K:G):O.last_lit&&(F(O,!1),O.strm.avail_out===0)?A:$}function ee(O,ie,q,I,T){this.good_length=O,this.max_lazy=ie,this.nice_length=q,this.max_chain=I,this.func=T}function te(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*C),this.dyn_dtree=new o.Buf16(2*(2*j+1)),this.bl_tree=new o.Buf16(2*(2*N+1)),B(this.dyn_ltree),B(this.dyn_dtree),B(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(k+1),this.heap=new o.Buf16(2*w+1),B(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*w+1),B(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Z(O){var ie;return O&&O.state?(O.total_in=O.total_out=0,O.data_type=y,(ie=O.state).pending=0,ie.pending_out=0,ie.wrap<0&&(ie.wrap=-ie.wrap),ie.status=ie.wrap?P:V,O.adler=ie.wrap===2?0:1,ie.last_flush=h,l._tr_init(ie),p):Y(O,g)}function J(O){var ie=Z(O);return ie===p&&function(q){q.window_size=2*q.w_size,B(q.head),q.max_lazy_match=i[q.level].max_lazy,q.good_match=i[q.level].good_length,q.nice_match=i[q.level].nice_length,q.max_chain_length=i[q.level].max_chain,q.strstart=0,q.block_start=0,q.lookahead=0,q.insert=0,q.match_length=q.prev_length=E-1,q.match_available=0,q.ins_h=0}(O.state),ie}function he(O,ie,q,I,T,D){if(!O)return g;var ne=1;if(ie===m&&(ie=6),I<0?(ne=0,I=-I):15<I&&(ne=2,I-=16),T<1||b<T||q!==v||I<8||15<I||ie<0||9<ie||D<0||x<D)return Y(O,g);I===8&&(I=9);var ue=new te;return(O.state=ue).strm=O,ue.wrap=ne,ue.gzhead=null,ue.w_bits=I,ue.w_size=1<<ue.w_bits,ue.w_mask=ue.w_size-1,ue.hash_bits=T+7,ue.hash_size=1<<ue.hash_bits,ue.hash_mask=ue.hash_size-1,ue.hash_shift=~~((ue.hash_bits+E-1)/E),ue.window=new o.Buf8(2*ue.w_size),ue.head=new o.Buf16(ue.hash_size),ue.prev=new o.Buf16(ue.w_size),ue.lit_bufsize=1<<T+6,ue.pending_buf_size=4*ue.lit_bufsize,ue.pending_buf=new o.Buf8(ue.pending_buf_size),ue.d_buf=1*ue.lit_bufsize,ue.l_buf=3*ue.lit_bufsize,ue.level=ie,ue.strategy=D,ue.method=q,J(O)}i=[new ee(0,0,0,0,function(O,ie){var q=65535;for(q>O.pending_buf_size-5&&(q=O.pending_buf_size-5);;){if(O.lookahead<=1){if(le(O),O.lookahead===0&&ie===h)return A;if(O.lookahead===0)break}O.strstart+=O.lookahead,O.lookahead=0;var I=O.block_start+q;if((O.strstart===0||O.strstart>=I)&&(O.lookahead=O.strstart-I,O.strstart=I,F(O,!1),O.strm.avail_out===0)||O.strstart-O.block_start>=O.w_size-z&&(F(O,!1),O.strm.avail_out===0))return A}return O.insert=0,ie===f?(F(O,!0),O.strm.avail_out===0?K:G):(O.strstart>O.block_start&&(F(O,!1),O.strm.avail_out),A)}),new ee(4,4,8,4,U),new ee(4,5,16,8,U),new ee(4,6,32,32,U),new ee(4,4,16,16,R),new ee(8,16,32,32,R),new ee(8,16,128,128,R),new ee(8,32,128,256,R),new ee(32,128,258,1024,R),new ee(32,258,258,4096,R)],s.deflateInit=function(O,ie){return he(O,ie,v,15,8,0)},s.deflateInit2=he,s.deflateReset=J,s.deflateResetKeep=Z,s.deflateSetHeader=function(O,ie){return O&&O.state?O.state.wrap!==2?g:(O.state.gzhead=ie,p):g},s.deflate=function(O,ie){var q,I,T,D;if(!O||!O.state||5<ie||ie<0)return O?Y(O,g):g;if(I=O.state,!O.output||!O.input&&O.avail_in!==0||I.status===666&&ie!==f)return Y(O,O.avail_out===0?-5:g);if(I.strm=O,q=I.last_flush,I.last_flush=ie,I.status===P)if(I.wrap===2)O.adler=0,W(I,31),W(I,139),W(I,8),I.gzhead?(W(I,(I.gzhead.text?1:0)+(I.gzhead.hcrc?2:0)+(I.gzhead.extra?4:0)+(I.gzhead.name?8:0)+(I.gzhead.comment?16:0)),W(I,255&I.gzhead.time),W(I,I.gzhead.time>>8&255),W(I,I.gzhead.time>>16&255),W(I,I.gzhead.time>>24&255),W(I,I.level===9?2:2<=I.strategy||I.level<2?4:0),W(I,255&I.gzhead.os),I.gzhead.extra&&I.gzhead.extra.length&&(W(I,255&I.gzhead.extra.length),W(I,I.gzhead.extra.length>>8&255)),I.gzhead.hcrc&&(O.adler=u(O.adler,I.pending_buf,I.pending,0)),I.gzindex=0,I.status=69):(W(I,0),W(I,0),W(I,0),W(I,0),W(I,0),W(I,I.level===9?2:2<=I.strategy||I.level<2?4:0),W(I,3),I.status=V);else{var ne=v+(I.w_bits-8<<4)<<8;ne|=(2<=I.strategy||I.level<2?0:I.level<6?1:I.level===6?2:3)<<6,I.strstart!==0&&(ne|=32),ne+=31-ne%31,I.status=V,X(I,ne),I.strstart!==0&&(X(I,O.adler>>>16),X(I,65535&O.adler)),O.adler=1}if(I.status===69)if(I.gzhead.extra){for(T=I.pending;I.gzindex<(65535&I.gzhead.extra.length)&&(I.pending!==I.pending_buf_size||(I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),L(O),T=I.pending,I.pending!==I.pending_buf_size));)W(I,255&I.gzhead.extra[I.gzindex]),I.gzindex++;I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),I.gzindex===I.gzhead.extra.length&&(I.gzindex=0,I.status=73)}else I.status=73;if(I.status===73)if(I.gzhead.name){T=I.pending;do{if(I.pending===I.pending_buf_size&&(I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),L(O),T=I.pending,I.pending===I.pending_buf_size)){D=1;break}D=I.gzindex<I.gzhead.name.length?255&I.gzhead.name.charCodeAt(I.gzindex++):0,W(I,D)}while(D!==0);I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),D===0&&(I.gzindex=0,I.status=91)}else I.status=91;if(I.status===91)if(I.gzhead.comment){T=I.pending;do{if(I.pending===I.pending_buf_size&&(I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),L(O),T=I.pending,I.pending===I.pending_buf_size)){D=1;break}D=I.gzindex<I.gzhead.comment.length?255&I.gzhead.comment.charCodeAt(I.gzindex++):0,W(I,D)}while(D!==0);I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),D===0&&(I.status=103)}else I.status=103;if(I.status===103&&(I.gzhead.hcrc?(I.pending+2>I.pending_buf_size&&L(O),I.pending+2<=I.pending_buf_size&&(W(I,255&O.adler),W(I,O.adler>>8&255),O.adler=0,I.status=V)):I.status=V),I.pending!==0){if(L(O),O.avail_out===0)return I.last_flush=-1,p}else if(O.avail_in===0&&H(ie)<=H(q)&&ie!==f)return Y(O,-5);if(I.status===666&&O.avail_in!==0)return Y(O,-5);if(O.avail_in!==0||I.lookahead!==0||ie!==h&&I.status!==666){var ue=I.strategy===2?function(re,pe){for(var ve;;){if(re.lookahead===0&&(le(re),re.lookahead===0)){if(pe===h)return A;break}if(re.match_length=0,ve=l._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++,ve&&(F(re,!1),re.strm.avail_out===0))return A}return re.insert=0,pe===f?(F(re,!0),re.strm.avail_out===0?K:G):re.last_lit&&(F(re,!1),re.strm.avail_out===0)?A:$}(I,ie):I.strategy===3?function(re,pe){for(var ve,xe,ae,de,ge=re.window;;){if(re.lookahead<=M){if(le(re),re.lookahead<=M&&pe===h)return A;if(re.lookahead===0)break}if(re.match_length=0,re.lookahead>=E&&0<re.strstart&&(xe=ge[ae=re.strstart-1])===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]){de=re.strstart+M;do;while(xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&ae<de);re.match_length=M-(de-ae),re.match_length>re.lookahead&&(re.match_length=re.lookahead)}if(re.match_length>=E?(ve=l._tr_tally(re,1,re.match_length-E),re.lookahead-=re.match_length,re.strstart+=re.match_length,re.match_length=0):(ve=l._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++),ve&&(F(re,!1),re.strm.avail_out===0))return A}return re.insert=0,pe===f?(F(re,!0),re.strm.avail_out===0?K:G):re.last_lit&&(F(re,!1),re.strm.avail_out===0)?A:$}(I,ie):i[I.level].func(I,ie);if(ue!==K&&ue!==G||(I.status=666),ue===A||ue===K)return O.avail_out===0&&(I.last_flush=-1),p;if(ue===$&&(ie===1?l._tr_align(I):ie!==5&&(l._tr_stored_block(I,0,0,!1),ie===3&&(B(I.head),I.lookahead===0&&(I.strstart=0,I.block_start=0,I.insert=0))),L(O),O.avail_out===0))return I.last_flush=-1,p}return ie!==f?p:I.wrap<=0?1:(I.wrap===2?(W(I,255&O.adler),W(I,O.adler>>8&255),W(I,O.adler>>16&255),W(I,O.adler>>24&255),W(I,255&O.total_in),W(I,O.total_in>>8&255),W(I,O.total_in>>16&255),W(I,O.total_in>>24&255)):(X(I,O.adler>>>16),X(I,65535&O.adler)),L(O),0<I.wrap&&(I.wrap=-I.wrap),I.pending!==0?p:1)},s.deflateEnd=function(O){var ie;return O&&O.state?(ie=O.state.status)!==P&&ie!==69&&ie!==73&&ie!==91&&ie!==103&&ie!==V&&ie!==666?Y(O,g):(O.state=null,ie===V?Y(O,-3):p):g},s.deflateSetDictionary=function(O,ie){var q,I,T,D,ne,ue,re,pe,ve=ie.length;if(!O||!O.state||(D=(q=O.state).wrap)===2||D===1&&q.status!==P||q.lookahead)return g;for(D===1&&(O.adler=c(O.adler,ie,ve,0)),q.wrap=0,ve>=q.w_size&&(D===0&&(B(q.head),q.strstart=0,q.block_start=0,q.insert=0),pe=new o.Buf8(q.w_size),o.arraySet(pe,ie,ve-q.w_size,q.w_size,0),ie=pe,ve=q.w_size),ne=O.avail_in,ue=O.next_in,re=O.input,O.avail_in=ve,O.next_in=0,O.input=ie,le(q);q.lookahead>=E;){for(I=q.strstart,T=q.lookahead-(E-1);q.ins_h=(q.ins_h<<q.hash_shift^q.window[I+E-1])&q.hash_mask,q.prev[I&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=I,I++,--T;);q.strstart=I,q.lookahead=E-1,le(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=E-1,q.match_available=0,O.next_in=ue,O.input=re,O.avail_in=ne,q.wrap=D,p},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,n,s){n.exports=function(){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}},{}],48:[function(r,n,s){n.exports=function(i,o){var l,c,u,d,h,f,p,g,m,x,y,v,b,w,j,N,C,k,E,M,z,P,V,A,$;l=i.state,c=i.next_in,A=i.input,u=c+(i.avail_in-5),d=i.next_out,$=i.output,h=d-(o-i.avail_out),f=d+(i.avail_out-257),p=l.dmax,g=l.wsize,m=l.whave,x=l.wnext,y=l.window,v=l.hold,b=l.bits,w=l.lencode,j=l.distcode,N=(1<<l.lenbits)-1,C=(1<<l.distbits)-1;e:do{b<15&&(v+=A[c++]<<b,b+=8,v+=A[c++]<<b,b+=8),k=w[v&N];t:for(;;){if(v>>>=E=k>>>24,b-=E,(E=k>>>16&255)===0)$[d++]=65535&k;else{if(!(16&E)){if(!(64&E)){k=w[(65535&k)+(v&(1<<E)-1)];continue t}if(32&E){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}M=65535&k,(E&=15)&&(b<E&&(v+=A[c++]<<b,b+=8),M+=v&(1<<E)-1,v>>>=E,b-=E),b<15&&(v+=A[c++]<<b,b+=8,v+=A[c++]<<b,b+=8),k=j[v&C];r:for(;;){if(v>>>=E=k>>>24,b-=E,!(16&(E=k>>>16&255))){if(!(64&E)){k=j[(65535&k)+(v&(1<<E)-1)];continue r}i.msg="invalid distance code",l.mode=30;break e}if(z=65535&k,b<(E&=15)&&(v+=A[c++]<<b,(b+=8)<E&&(v+=A[c++]<<b,b+=8)),p<(z+=v&(1<<E)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(v>>>=E,b-=E,(E=d-h)<z){if(m<(E=z-E)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(V=y,(P=0)===x){if(P+=g-E,E<M){for(M-=E;$[d++]=y[P++],--E;);P=d-z,V=$}}else if(x<E){if(P+=g+x-E,(E-=x)<M){for(M-=E;$[d++]=y[P++],--E;);if(P=0,x<M){for(M-=E=x;$[d++]=y[P++],--E;);P=d-z,V=$}}}else if(P+=x-E,E<M){for(M-=E;$[d++]=y[P++],--E;);P=d-z,V=$}for(;2<M;)$[d++]=V[P++],$[d++]=V[P++],$[d++]=V[P++],M-=3;M&&($[d++]=V[P++],1<M&&($[d++]=V[P++]))}else{for(P=d-z;$[d++]=$[P++],$[d++]=$[P++],$[d++]=$[P++],2<(M-=3););M&&($[d++]=$[P++],1<M&&($[d++]=$[P++]))}break}}break}}while(c<u&&d<f);c-=M=b>>3,v&=(1<<(b-=M<<3))-1,i.next_in=c,i.next_out=d,i.avail_in=c<u?u-c+5:5-(c-u),i.avail_out=d<f?f-d+257:257-(d-f),l.hold=v,l.bits=b}},{}],49:[function(r,n,s){var i=r("../utils/common"),o=r("./adler32"),l=r("./crc32"),c=r("./inffast"),u=r("./inftrees"),d=1,h=2,f=0,p=-2,g=1,m=852,x=592;function y(P){return(P>>>24&255)+(P>>>8&65280)+((65280&P)<<8)+((255&P)<<24)}function v(){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 i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(P){var V;return P&&P.state?(V=P.state,P.total_in=P.total_out=V.total=0,P.msg="",V.wrap&&(P.adler=1&V.wrap),V.mode=g,V.last=0,V.havedict=0,V.dmax=32768,V.head=null,V.hold=0,V.bits=0,V.lencode=V.lendyn=new i.Buf32(m),V.distcode=V.distdyn=new i.Buf32(x),V.sane=1,V.back=-1,f):p}function w(P){var V;return P&&P.state?((V=P.state).wsize=0,V.whave=0,V.wnext=0,b(P)):p}function j(P,V){var A,$;return P&&P.state?($=P.state,V<0?(A=0,V=-V):(A=1+(V>>4),V<48&&(V&=15)),V&&(V<8||15<V)?p:($.window!==null&&$.wbits!==V&&($.window=null),$.wrap=A,$.wbits=V,w(P))):p}function N(P,V){var A,$;return P?($=new v,(P.state=$).window=null,(A=j(P,V))!==f&&(P.state=null),A):p}var C,k,E=!0;function M(P){if(E){var V;for(C=new i.Buf32(512),k=new i.Buf32(32),V=0;V<144;)P.lens[V++]=8;for(;V<256;)P.lens[V++]=9;for(;V<280;)P.lens[V++]=7;for(;V<288;)P.lens[V++]=8;for(u(d,P.lens,0,288,C,0,P.work,{bits:9}),V=0;V<32;)P.lens[V++]=5;u(h,P.lens,0,32,k,0,P.work,{bits:5}),E=!1}P.lencode=C,P.lenbits=9,P.distcode=k,P.distbits=5}function z(P,V,A,$){var K,G=P.state;return G.window===null&&(G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new i.Buf8(G.wsize)),$>=G.wsize?(i.arraySet(G.window,V,A-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):($<(K=G.wsize-G.wnext)&&(K=$),i.arraySet(G.window,V,A-$,K,G.wnext),($-=K)?(i.arraySet(G.window,V,A-$,$,0),G.wnext=$,G.whave=G.wsize):(G.wnext+=K,G.wnext===G.wsize&&(G.wnext=0),G.whave<G.wsize&&(G.whave+=K))),0}s.inflateReset=w,s.inflateReset2=j,s.inflateResetKeep=b,s.inflateInit=function(P){return N(P,15)},s.inflateInit2=N,s.inflate=function(P,V){var A,$,K,G,Y,H,B,L,F,W,X,oe,le,U,R,ee,te,Z,J,he,O,ie,q,I,T=0,D=new i.Buf8(4),ne=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!P||!P.state||!P.output||!P.input&&P.avail_in!==0)return p;(A=P.state).mode===12&&(A.mode=13),Y=P.next_out,K=P.output,B=P.avail_out,G=P.next_in,$=P.input,H=P.avail_in,L=A.hold,F=A.bits,W=H,X=B,ie=f;e:for(;;)switch(A.mode){case g:if(A.wrap===0){A.mode=13;break}for(;F<16;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(2&A.wrap&&L===35615){D[A.check=0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0),F=L=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&L)<<8)+(L>>8))%31){P.msg="incorrect header check",A.mode=30;break}if((15&L)!=8){P.msg="unknown compression method",A.mode=30;break}if(F-=4,O=8+(15&(L>>>=4)),A.wbits===0)A.wbits=O;else if(O>A.wbits){P.msg="invalid window size",A.mode=30;break}A.dmax=1<<O,P.adler=A.check=1,A.mode=512&L?10:12,F=L=0;break;case 2:for(;F<16;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(A.flags=L,(255&A.flags)!=8){P.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){P.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=L>>8&1),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0,A.mode=3;case 3:for(;F<32;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.head&&(A.head.time=L),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,D[2]=L>>>16&255,D[3]=L>>>24&255,A.check=l(A.check,D,4,0)),F=L=0,A.mode=4;case 4:for(;F<16;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.head&&(A.head.xflags=255&L,A.head.os=L>>8),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0,A.mode=5;case 5:if(1024&A.flags){for(;F<16;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.length=L,A.head&&(A.head.extra_len=L),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(H<(oe=A.length)&&(oe=H),oe&&(A.head&&(O=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),i.arraySet(A.head.extra,$,G,oe,O)),512&A.flags&&(A.check=l(A.check,$,oe,G)),H-=oe,G+=oe,A.length-=oe),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(H===0)break e;for(oe=0;O=$[G+oe++],A.head&&O&&A.length<65536&&(A.head.name+=String.fromCharCode(O)),O&&oe<H;);if(512&A.flags&&(A.check=l(A.check,$,oe,G)),H-=oe,G+=oe,O)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if(H===0)break e;for(oe=0;O=$[G+oe++],A.head&&O&&A.length<65536&&(A.head.comment+=String.fromCharCode(O)),O&&oe<H;);if(512&A.flags&&(A.check=l(A.check,$,oe,G)),H-=oe,G+=oe,O)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;F<16;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(L!==(65535&A.check)){P.msg="header crc mismatch",A.mode=30;break}F=L=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),P.adler=A.check=0,A.mode=12;break;case 10:for(;F<32;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}P.adler=A.check=y(L),F=L=0,A.mode=11;case 11:if(A.havedict===0)return P.next_out=Y,P.avail_out=B,P.next_in=G,P.avail_in=H,A.hold=L,A.bits=F,2;P.adler=A.check=1,A.mode=12;case 12:if(V===5||V===6)break e;case 13:if(A.last){L>>>=7&F,F-=7&F,A.mode=27;break}for(;F<3;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}switch(A.last=1&L,F-=1,3&(L>>>=1)){case 0:A.mode=14;break;case 1:if(M(A),A.mode=20,V!==6)break;L>>>=2,F-=2;break e;case 2:A.mode=17;break;case 3:P.msg="invalid block type",A.mode=30}L>>>=2,F-=2;break;case 14:for(L>>>=7&F,F-=7&F;F<32;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if((65535&L)!=(L>>>16^65535)){P.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&L,F=L=0,A.mode=15,V===6)break e;case 15:A.mode=16;case 16:if(oe=A.length){if(H<oe&&(oe=H),B<oe&&(oe=B),oe===0)break e;i.arraySet(K,$,G,oe,Y),H-=oe,G+=oe,B-=oe,Y+=oe,A.length-=oe;break}A.mode=12;break;case 17:for(;F<14;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(A.nlen=257+(31&L),L>>>=5,F-=5,A.ndist=1+(31&L),L>>>=5,F-=5,A.ncode=4+(15&L),L>>>=4,F-=4,286<A.nlen||30<A.ndist){P.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;F<3;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.lens[ne[A.have++]]=7&L,L>>>=3,F-=3}for(;A.have<19;)A.lens[ne[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,q={bits:A.lenbits},ie=u(0,A.lens,0,19,A.lencode,0,A.work,q),A.lenbits=q.bits,ie){P.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;ee=(T=A.lencode[L&(1<<A.lenbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(te<16)L>>>=R,F-=R,A.lens[A.have++]=te;else{if(te===16){for(I=R+2;F<I;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(L>>>=R,F-=R,A.have===0){P.msg="invalid bit length repeat",A.mode=30;break}O=A.lens[A.have-1],oe=3+(3&L),L>>>=2,F-=2}else if(te===17){for(I=R+3;F<I;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}F-=R,O=0,oe=3+(7&(L>>>=R)),L>>>=3,F-=3}else{for(I=R+7;F<I;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}F-=R,O=0,oe=11+(127&(L>>>=R)),L>>>=7,F-=7}if(A.have+oe>A.nlen+A.ndist){P.msg="invalid bit length repeat",A.mode=30;break}for(;oe--;)A.lens[A.have++]=O}}if(A.mode===30)break;if(A.lens[256]===0){P.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,q={bits:A.lenbits},ie=u(d,A.lens,0,A.nlen,A.lencode,0,A.work,q),A.lenbits=q.bits,ie){P.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,q={bits:A.distbits},ie=u(h,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,q),A.distbits=q.bits,ie){P.msg="invalid distances set",A.mode=30;break}if(A.mode=20,V===6)break e;case 20:A.mode=21;case 21:if(6<=H&&258<=B){P.next_out=Y,P.avail_out=B,P.next_in=G,P.avail_in=H,A.hold=L,A.bits=F,c(P,X),Y=P.next_out,K=P.output,B=P.avail_out,G=P.next_in,$=P.input,H=P.avail_in,L=A.hold,F=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;ee=(T=A.lencode[L&(1<<A.lenbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(ee&&!(240&ee)){for(Z=R,J=ee,he=te;ee=(T=A.lencode[he+((L&(1<<Z+J)-1)>>Z)])>>>16&255,te=65535&T,!(Z+(R=T>>>24)<=F);){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}L>>>=Z,F-=Z,A.back+=Z}if(L>>>=R,F-=R,A.back+=R,A.length=te,ee===0){A.mode=26;break}if(32&ee){A.back=-1,A.mode=12;break}if(64&ee){P.msg="invalid literal/length code",A.mode=30;break}A.extra=15&ee,A.mode=22;case 22:if(A.extra){for(I=A.extra;F<I;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.length+=L&(1<<A.extra)-1,L>>>=A.extra,F-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;ee=(T=A.distcode[L&(1<<A.distbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(!(240&ee)){for(Z=R,J=ee,he=te;ee=(T=A.distcode[he+((L&(1<<Z+J)-1)>>Z)])>>>16&255,te=65535&T,!(Z+(R=T>>>24)<=F);){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}L>>>=Z,F-=Z,A.back+=Z}if(L>>>=R,F-=R,A.back+=R,64&ee){P.msg="invalid distance code",A.mode=30;break}A.offset=te,A.extra=15&ee,A.mode=24;case 24:if(A.extra){for(I=A.extra;F<I;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.offset+=L&(1<<A.extra)-1,L>>>=A.extra,F-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){P.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(B===0)break e;if(oe=X-B,A.offset>oe){if((oe=A.offset-oe)>A.whave&&A.sane){P.msg="invalid distance too far back",A.mode=30;break}le=oe>A.wnext?(oe-=A.wnext,A.wsize-oe):A.wnext-oe,oe>A.length&&(oe=A.length),U=A.window}else U=K,le=Y-A.offset,oe=A.length;for(B<oe&&(oe=B),B-=oe,A.length-=oe;K[Y++]=U[le++],--oe;);A.length===0&&(A.mode=21);break;case 26:if(B===0)break e;K[Y++]=A.length,B--,A.mode=21;break;case 27:if(A.wrap){for(;F<32;){if(H===0)break e;H--,L|=$[G++]<<F,F+=8}if(X-=B,P.total_out+=X,A.total+=X,X&&(P.adler=A.check=A.flags?l(A.check,K,X,Y-X):o(A.check,K,X,Y-X)),X=B,(A.flags?L:y(L))!==A.check){P.msg="incorrect data check",A.mode=30;break}F=L=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;F<32;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(L!==(4294967295&A.total)){P.msg="incorrect length check",A.mode=30;break}F=L=0}A.mode=29;case 29:ie=1;break e;case 30:ie=-3;break e;case 31:return-4;case 32:default:return p}return P.next_out=Y,P.avail_out=B,P.next_in=G,P.avail_in=H,A.hold=L,A.bits=F,(A.wsize||X!==P.avail_out&&A.mode<30&&(A.mode<27||V!==4))&&z(P,P.output,P.next_out,X-P.avail_out)?(A.mode=31,-4):(W-=P.avail_in,X-=P.avail_out,P.total_in+=W,P.total_out+=X,A.total+=X,A.wrap&&X&&(P.adler=A.check=A.flags?l(A.check,K,X,P.next_out-X):o(A.check,K,X,P.next_out-X)),P.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(W==0&&X===0||V===4)&&ie===f&&(ie=-5),ie)},s.inflateEnd=function(P){if(!P||!P.state)return p;var V=P.state;return V.window&&(V.window=null),P.state=null,f},s.inflateGetHeader=function(P,V){var A;return P&&P.state&&2&(A=P.state).wrap?((A.head=V).done=!1,f):p},s.inflateSetDictionary=function(P,V){var A,$=V.length;return P&&P.state?(A=P.state).wrap!==0&&A.mode!==11?p:A.mode===11&&o(1,V,$,0)!==A.check?-3:z(P,V,$,$)?(A.mode=31,-4):(A.havedict=1,f):p},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,n,s){var i=r("../utils/common"),o=[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],l=[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],c=[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],u=[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];n.exports=function(d,h,f,p,g,m,x,y){var v,b,w,j,N,C,k,E,M,z=y.bits,P=0,V=0,A=0,$=0,K=0,G=0,Y=0,H=0,B=0,L=0,F=null,W=0,X=new i.Buf16(16),oe=new i.Buf16(16),le=null,U=0;for(P=0;P<=15;P++)X[P]=0;for(V=0;V<p;V++)X[h[f+V]]++;for(K=z,$=15;1<=$&&X[$]===0;$--);if($<K&&(K=$),$===0)return g[m++]=20971520,g[m++]=20971520,y.bits=1,0;for(A=1;A<$&&X[A]===0;A++);for(K<A&&(K=A),P=H=1;P<=15;P++)if(H<<=1,(H-=X[P])<0)return-1;if(0<H&&(d===0||$!==1))return-1;for(oe[1]=0,P=1;P<15;P++)oe[P+1]=oe[P]+X[P];for(V=0;V<p;V++)h[f+V]!==0&&(x[oe[h[f+V]]++]=V);if(C=d===0?(F=le=x,19):d===1?(F=o,W-=257,le=l,U-=257,256):(F=c,le=u,-1),P=A,N=m,Y=V=L=0,w=-1,j=(B=1<<(G=K))-1,d===1&&852<B||d===2&&592<B)return 1;for(;;){for(k=P-Y,M=x[V]<C?(E=0,x[V]):x[V]>C?(E=le[U+x[V]],F[W+x[V]]):(E=96,0),v=1<<P-Y,A=b=1<<G;g[N+(L>>Y)+(b-=v)]=k<<24|E<<16|M|0,b!==0;);for(v=1<<P-1;L&v;)v>>=1;if(v!==0?(L&=v-1,L+=v):L=0,V++,--X[P]==0){if(P===$)break;P=h[f+x[V]]}if(K<P&&(L&j)!==w){for(Y===0&&(Y=K),N+=A,H=1<<(G=P-Y);G+Y<$&&!((H-=X[G+Y])<=0);)G++,H<<=1;if(B+=1<<G,d===1&&852<B||d===2&&592<B)return 1;g[w=L&j]=K<<24|G<<16|N-m|0}}return L!==0&&(g[N+L]=P-Y<<24|64<<16|0),y.bits=K,0}},{"../utils/common":41}],51:[function(r,n,s){n.exports={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"}},{}],52:[function(r,n,s){var i=r("../utils/common"),o=0,l=1;function c(T){for(var D=T.length;0<=--D;)T[D]=0}var u=0,d=29,h=256,f=h+1+d,p=30,g=19,m=2*f+1,x=15,y=16,v=7,b=256,w=16,j=17,N=18,C=[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],k=[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],E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],z=new Array(2*(f+2));c(z);var P=new Array(2*p);c(P);var V=new Array(512);c(V);var A=new Array(256);c(A);var $=new Array(d);c($);var K,G,Y,H=new Array(p);function B(T,D,ne,ue,re){this.static_tree=T,this.extra_bits=D,this.extra_base=ne,this.elems=ue,this.max_length=re,this.has_stree=T&&T.length}function L(T,D){this.dyn_tree=T,this.max_code=0,this.stat_desc=D}function F(T){return T<256?V[T]:V[256+(T>>>7)]}function W(T,D){T.pending_buf[T.pending++]=255&D,T.pending_buf[T.pending++]=D>>>8&255}function X(T,D,ne){T.bi_valid>y-ne?(T.bi_buf|=D<<T.bi_valid&65535,W(T,T.bi_buf),T.bi_buf=D>>y-T.bi_valid,T.bi_valid+=ne-y):(T.bi_buf|=D<<T.bi_valid&65535,T.bi_valid+=ne)}function oe(T,D,ne){X(T,ne[2*D],ne[2*D+1])}function le(T,D){for(var ne=0;ne|=1&T,T>>>=1,ne<<=1,0<--D;);return ne>>>1}function U(T,D,ne){var ue,re,pe=new Array(x+1),ve=0;for(ue=1;ue<=x;ue++)pe[ue]=ve=ve+ne[ue-1]<<1;for(re=0;re<=D;re++){var xe=T[2*re+1];xe!==0&&(T[2*re]=le(pe[xe]++,xe))}}function R(T){var D;for(D=0;D<f;D++)T.dyn_ltree[2*D]=0;for(D=0;D<p;D++)T.dyn_dtree[2*D]=0;for(D=0;D<g;D++)T.bl_tree[2*D]=0;T.dyn_ltree[2*b]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function ee(T){8<T.bi_valid?W(T,T.bi_buf):0<T.bi_valid&&(T.pending_buf[T.pending++]=T.bi_buf),T.bi_buf=0,T.bi_valid=0}function te(T,D,ne,ue){var re=2*D,pe=2*ne;return T[re]<T[pe]||T[re]===T[pe]&&ue[D]<=ue[ne]}function Z(T,D,ne){for(var ue=T.heap[ne],re=ne<<1;re<=T.heap_len&&(re<T.heap_len&&te(D,T.heap[re+1],T.heap[re],T.depth)&&re++,!te(D,ue,T.heap[re],T.depth));)T.heap[ne]=T.heap[re],ne=re,re<<=1;T.heap[ne]=ue}function J(T,D,ne){var ue,re,pe,ve,xe=0;if(T.last_lit!==0)for(;ue=T.pending_buf[T.d_buf+2*xe]<<8|T.pending_buf[T.d_buf+2*xe+1],re=T.pending_buf[T.l_buf+xe],xe++,ue===0?oe(T,re,D):(oe(T,(pe=A[re])+h+1,D),(ve=C[pe])!==0&&X(T,re-=$[pe],ve),oe(T,pe=F(--ue),ne),(ve=k[pe])!==0&&X(T,ue-=H[pe],ve)),xe<T.last_lit;);oe(T,b,D)}function he(T,D){var ne,ue,re,pe=D.dyn_tree,ve=D.stat_desc.static_tree,xe=D.stat_desc.has_stree,ae=D.stat_desc.elems,de=-1;for(T.heap_len=0,T.heap_max=m,ne=0;ne<ae;ne++)pe[2*ne]!==0?(T.heap[++T.heap_len]=de=ne,T.depth[ne]=0):pe[2*ne+1]=0;for(;T.heap_len<2;)pe[2*(re=T.heap[++T.heap_len]=de<2?++de:0)]=1,T.depth[re]=0,T.opt_len--,xe&&(T.static_len-=ve[2*re+1]);for(D.max_code=de,ne=T.heap_len>>1;1<=ne;ne--)Z(T,pe,ne);for(re=ae;ne=T.heap[1],T.heap[1]=T.heap[T.heap_len--],Z(T,pe,1),ue=T.heap[1],T.heap[--T.heap_max]=ne,T.heap[--T.heap_max]=ue,pe[2*re]=pe[2*ne]+pe[2*ue],T.depth[re]=(T.depth[ne]>=T.depth[ue]?T.depth[ne]:T.depth[ue])+1,pe[2*ne+1]=pe[2*ue+1]=re,T.heap[1]=re++,Z(T,pe,1),2<=T.heap_len;);T.heap[--T.heap_max]=T.heap[1],function(ge,we){var je,Se,Ue,Ae,fe,Ee,Ce=we.dyn_tree,Ge=we.max_code,ht=we.stat_desc.static_tree,Ne=we.stat_desc.has_stree,Ze=we.stat_desc.extra_bits,Ke=we.stat_desc.extra_base,Xe=we.stat_desc.max_length,Ye=0;for(Ae=0;Ae<=x;Ae++)ge.bl_count[Ae]=0;for(Ce[2*ge.heap[ge.heap_max]+1]=0,je=ge.heap_max+1;je<m;je++)Xe<(Ae=Ce[2*Ce[2*(Se=ge.heap[je])+1]+1]+1)&&(Ae=Xe,Ye++),Ce[2*Se+1]=Ae,Ge<Se||(ge.bl_count[Ae]++,fe=0,Ke<=Se&&(fe=Ze[Se-Ke]),Ee=Ce[2*Se],ge.opt_len+=Ee*(Ae+fe),Ne&&(ge.static_len+=Ee*(ht[2*Se+1]+fe)));if(Ye!==0){do{for(Ae=Xe-1;ge.bl_count[Ae]===0;)Ae--;ge.bl_count[Ae]--,ge.bl_count[Ae+1]+=2,ge.bl_count[Xe]--,Ye-=2}while(0<Ye);for(Ae=Xe;Ae!==0;Ae--)for(Se=ge.bl_count[Ae];Se!==0;)Ge<(Ue=ge.heap[--je])||(Ce[2*Ue+1]!==Ae&&(ge.opt_len+=(Ae-Ce[2*Ue+1])*Ce[2*Ue],Ce[2*Ue+1]=Ae),Se--)}}(T,D),U(pe,de,T.bl_count)}function O(T,D,ne){var ue,re,pe=-1,ve=D[1],xe=0,ae=7,de=4;for(ve===0&&(ae=138,de=3),D[2*(ne+1)+1]=65535,ue=0;ue<=ne;ue++)re=ve,ve=D[2*(ue+1)+1],++xe<ae&&re===ve||(xe<de?T.bl_tree[2*re]+=xe:re!==0?(re!==pe&&T.bl_tree[2*re]++,T.bl_tree[2*w]++):xe<=10?T.bl_tree[2*j]++:T.bl_tree[2*N]++,pe=re,de=(xe=0)===ve?(ae=138,3):re===ve?(ae=6,3):(ae=7,4))}function ie(T,D,ne){var ue,re,pe=-1,ve=D[1],xe=0,ae=7,de=4;for(ve===0&&(ae=138,de=3),ue=0;ue<=ne;ue++)if(re=ve,ve=D[2*(ue+1)+1],!(++xe<ae&&re===ve)){if(xe<de)for(;oe(T,re,T.bl_tree),--xe!=0;);else re!==0?(re!==pe&&(oe(T,re,T.bl_tree),xe--),oe(T,w,T.bl_tree),X(T,xe-3,2)):xe<=10?(oe(T,j,T.bl_tree),X(T,xe-3,3)):(oe(T,N,T.bl_tree),X(T,xe-11,7));pe=re,de=(xe=0)===ve?(ae=138,3):re===ve?(ae=6,3):(ae=7,4)}}c(H);var q=!1;function I(T,D,ne,ue){X(T,(u<<1)+(ue?1:0),3),function(re,pe,ve,xe){ee(re),W(re,ve),W(re,~ve),i.arraySet(re.pending_buf,re.window,pe,ve,re.pending),re.pending+=ve}(T,D,ne)}s._tr_init=function(T){q||(function(){var D,ne,ue,re,pe,ve=new Array(x+1);for(re=ue=0;re<d-1;re++)for($[re]=ue,D=0;D<1<<C[re];D++)A[ue++]=re;for(A[ue-1]=re,re=pe=0;re<16;re++)for(H[re]=pe,D=0;D<1<<k[re];D++)V[pe++]=re;for(pe>>=7;re<p;re++)for(H[re]=pe<<7,D=0;D<1<<k[re]-7;D++)V[256+pe++]=re;for(ne=0;ne<=x;ne++)ve[ne]=0;for(D=0;D<=143;)z[2*D+1]=8,D++,ve[8]++;for(;D<=255;)z[2*D+1]=9,D++,ve[9]++;for(;D<=279;)z[2*D+1]=7,D++,ve[7]++;for(;D<=287;)z[2*D+1]=8,D++,ve[8]++;for(U(z,f+1,ve),D=0;D<p;D++)P[2*D+1]=5,P[2*D]=le(D,5);K=new B(z,C,h+1,f,x),G=new B(P,k,0,p,x),Y=new B(new Array(0),E,0,g,v)}(),q=!0),T.l_desc=new L(T.dyn_ltree,K),T.d_desc=new L(T.dyn_dtree,G),T.bl_desc=new L(T.bl_tree,Y),T.bi_buf=0,T.bi_valid=0,R(T)},s._tr_stored_block=I,s._tr_flush_block=function(T,D,ne,ue){var re,pe,ve=0;0<T.level?(T.strm.data_type===2&&(T.strm.data_type=function(xe){var ae,de=4093624447;for(ae=0;ae<=31;ae++,de>>>=1)if(1&de&&xe.dyn_ltree[2*ae]!==0)return o;if(xe.dyn_ltree[18]!==0||xe.dyn_ltree[20]!==0||xe.dyn_ltree[26]!==0)return l;for(ae=32;ae<h;ae++)if(xe.dyn_ltree[2*ae]!==0)return l;return o}(T)),he(T,T.l_desc),he(T,T.d_desc),ve=function(xe){var ae;for(O(xe,xe.dyn_ltree,xe.l_desc.max_code),O(xe,xe.dyn_dtree,xe.d_desc.max_code),he(xe,xe.bl_desc),ae=g-1;3<=ae&&xe.bl_tree[2*M[ae]+1]===0;ae--);return xe.opt_len+=3*(ae+1)+5+5+4,ae}(T),re=T.opt_len+3+7>>>3,(pe=T.static_len+3+7>>>3)<=re&&(re=pe)):re=pe=ne+5,ne+4<=re&&D!==-1?I(T,D,ne,ue):T.strategy===4||pe===re?(X(T,2+(ue?1:0),3),J(T,z,P)):(X(T,4+(ue?1:0),3),function(xe,ae,de,ge){var we;for(X(xe,ae-257,5),X(xe,de-1,5),X(xe,ge-4,4),we=0;we<ge;we++)X(xe,xe.bl_tree[2*M[we]+1],3);ie(xe,xe.dyn_ltree,ae-1),ie(xe,xe.dyn_dtree,de-1)}(T,T.l_desc.max_code+1,T.d_desc.max_code+1,ve+1),J(T,T.dyn_ltree,T.dyn_dtree)),R(T),ue&&ee(T)},s._tr_tally=function(T,D,ne){return T.pending_buf[T.d_buf+2*T.last_lit]=D>>>8&255,T.pending_buf[T.d_buf+2*T.last_lit+1]=255&D,T.pending_buf[T.l_buf+T.last_lit]=255&ne,T.last_lit++,D===0?T.dyn_ltree[2*ne]++:(T.matches++,D--,T.dyn_ltree[2*(A[ne]+h+1)]++,T.dyn_dtree[2*F(D)]++),T.last_lit===T.lit_bufsize-1},s._tr_align=function(T){X(T,2,3),oe(T,b,z),function(D){D.bi_valid===16?(W(D,D.bi_buf),D.bi_buf=0,D.bi_valid=0):8<=D.bi_valid&&(D.pending_buf[D.pending++]=255&D.bi_buf,D.bi_buf>>=8,D.bi_valid-=8)}(T)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){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}},{}],54:[function(r,n,s){(function(i){(function(o,l){if(!o.setImmediate){var c,u,d,h,f=1,p={},g=!1,m=o.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(o);x=x&&x.setTimeout?x:o,c={}.toString.call(o.process)==="[object process]"?function(w){process.nextTick(function(){v(w)})}:function(){if(o.postMessage&&!o.importScripts){var w=!0,j=o.onmessage;return o.onmessage=function(){w=!1},o.postMessage("","*"),o.onmessage=j,w}}()?(h="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",b,!1):o.attachEvent("onmessage",b),function(w){o.postMessage(h+w,"*")}):o.MessageChannel?((d=new MessageChannel).port1.onmessage=function(w){v(w.data)},function(w){d.port2.postMessage(w)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(w){var j=m.createElement("script");j.onreadystatechange=function(){v(w),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(w){setTimeout(v,0,w)},x.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var j=new Array(arguments.length-1),N=0;N<j.length;N++)j[N]=arguments[N+1];var C={callback:w,args:j};return p[f]=C,c(f),f++},x.clearImmediate=y}function y(w){delete p[w]}function v(w){if(g)setTimeout(v,0,w);else{var j=p[w];if(j){g=!0;try{(function(N){var C=N.callback,k=N.args;switch(k.length){case 0:C();break;case 1:C(k[0]);break;case 2:C(k[0],k[1]);break;case 3:C(k[0],k[1],k[2]);break;default:C.apply(l,k)}})(j)}finally{y(w),g=!1}}}}function b(w){w.source===o&&typeof w.data=="string"&&w.data.indexOf(h)===0&&v(+w.data.slice(h.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof Wr<"u"?Wr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Ufe);var Put=Ufe.exports;const Out=qt(Put);var zfe={exports:{}};/* @license
Papa Parse
v5.5.3
https://github.com/mholt/PapaParse
License: MIT
*/(function(t,e){((r,n)=>{t.exports=n()})(Wr,function r(){var n=typeof self<"u"?self:typeof window<"u"?window:n!==void 0?n:{},s,i=!n.document&&!!n.postMessage,o=n.IS_PAPA_WORKER||!1,l={},c=0,u={};function d(k){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(E){var M=j(E);M.chunkSize=parseInt(M.chunkSize),E.step||E.chunk||(M.chunkSize=null),this._handle=new m(M),(this._handle.streamer=this)._config=M}).call(this,k),this.parseChunk=function(E,M){var z=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<z){let V=this._config.newline;V||(P=this._config.quoteChar||'"',V=this._handle.guessLineEndings(E,P)),E=[...E.split(V).slice(z)].join(V)}this.isFirstChunk&&C(this._config.beforeFirstChunk)&&(P=this._config.beforeFirstChunk(E))!==void 0&&(E=P),this.isFirstChunk=!1,this._halted=!1;var z=this._partialLine+E,P=(this._partialLine="",this._handle.parse(z,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(E=P.meta.cursor,z=(this._finished||(this._partialLine=z.substring(E-this._baseIndex),this._baseIndex=E),P&&P.data&&(this._rowCount+=P.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)n.postMessage({results:P,workerId:u.WORKER_ID,finished:z});else if(C(this._config.chunk)&&!M){if(this._config.chunk(P,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=P=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(P.data),this._completeResults.errors=this._completeResults.errors.concat(P.errors),this._completeResults.meta=P.meta),this._completed||!z||!C(this._config.complete)||P&&P.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),z||P&&P.meta.paused||this._nextChunk(),P}this._halted=!0},this._sendError=function(E){C(this._config.error)?this._config.error(E):o&&this._config.error&&n.postMessage({workerId:u.WORKER_ID,error:E,finished:!1})}}function h(k){var E;(k=k||{}).chunkSize||(k.chunkSize=u.RemoteChunkSize),d.call(this,k),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(M){this._input=M,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(E=new XMLHttpRequest,this._config.withCredentials&&(E.withCredentials=this._config.withCredentials),i||(E.onload=N(this._chunkLoaded,this),E.onerror=N(this._chunkError,this)),E.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var M,z=this._config.downloadRequestHeaders;for(M in z)E.setRequestHeader(M,z[M])}var P;this._config.chunkSize&&(P=this._start+this._config.chunkSize-1,E.setRequestHeader("Range","bytes="+this._start+"-"+P));try{E.send(this._config.downloadRequestBody)}catch(V){this._chunkError(V.message)}i&&E.status===0&&this._chunkError()}},this._chunkLoaded=function(){E.readyState===4&&(E.status<200||400<=E.status?this._chunkError():(this._start+=this._config.chunkSize||E.responseText.length,this._finished=!this._config.chunkSize||this._start>=(M=>(M=M.getResponseHeader("Content-Range"))!==null?parseInt(M.substring(M.lastIndexOf("/")+1)):-1)(E),this.parseChunk(E.responseText)))},this._chunkError=function(M){M=E.statusText||M,this._sendError(new Error(M))}}function f(k){(k=k||{}).chunkSize||(k.chunkSize=u.LocalChunkSize),d.call(this,k);var E,M,z=typeof FileReader<"u";this.stream=function(P){this._input=P,M=P.slice||P.webkitSlice||P.mozSlice,z?((E=new FileReader).onload=N(this._chunkLoaded,this),E.onerror=N(this._chunkError,this)):E=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var P=this._input,V=(this._config.chunkSize&&(V=Math.min(this._start+this._config.chunkSize,this._input.size),P=M.call(P,this._start,V)),E.readAsText(P,this._config.encoding));z||this._chunkLoaded({target:{result:V}})},this._chunkLoaded=function(P){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(P.target.result)},this._chunkError=function(){this._sendError(E.error)}}function p(k){var E;d.call(this,k=k||{}),this.stream=function(M){return E=M,this._nextChunk()},this._nextChunk=function(){var M,z;if(!this._finished)return M=this._config.chunkSize,E=M?(z=E.substring(0,M),E.substring(M)):(z=E,""),this._finished=!E,this.parseChunk(z)}}function g(k){d.call(this,k=k||{});var E=[],M=!0,z=!1;this.pause=function(){d.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){d.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(P){this._input=P,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){z&&E.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),E.length?this.parseChunk(E.shift()):M=!0},this._streamData=N(function(P){try{E.push(typeof P=="string"?P:P.toString(this._config.encoding)),M&&(M=!1,this._checkIsFinished(),this.parseChunk(E.shift()))}catch(V){this._streamError(V)}},this),this._streamError=N(function(P){this._streamCleanUp(),this._sendError(P)},this),this._streamEnd=N(function(){this._streamCleanUp(),z=!0,this._streamData("")},this),this._streamCleanUp=N(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function m(k){var E,M,z,P,V=Math.pow(2,53),A=-V,$=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,K=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,G=this,Y=0,H=0,B=!1,L=!1,F=[],W={data:[],errors:[],meta:{}};function X(R){return k.skipEmptyLines==="greedy"?R.join("").trim()==="":R.length===1&&R[0].length===0}function oe(){if(W&&z&&(U("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),z=!1),k.skipEmptyLines&&(W.data=W.data.filter(function(Z){return!X(Z)})),le()){let Z=function(J,he){C(k.transformHeader)&&(J=k.transformHeader(J,he)),F.push(J)};if(W)if(Array.isArray(W.data[0])){for(var R=0;le()&&R<W.data.length;R++)W.data[R].forEach(Z);W.data.splice(0,1)}else W.data.forEach(Z)}function ee(Z,J){for(var he=k.header?{}:[],O=0;O<Z.length;O++){var ie=O,q=Z[O],q=((I,T)=>(D=>(k.dynamicTypingFunction&&k.dynamicTyping[D]===void 0&&(k.dynamicTyping[D]=k.dynamicTypingFunction(D)),(k.dynamicTyping[D]||k.dynamicTyping)===!0))(I)?T==="true"||T==="TRUE"||T!=="false"&&T!=="FALSE"&&((D=>{if($.test(D)&&(D=parseFloat(D),A<D&&D<V))return 1})(T)?parseFloat(T):K.test(T)?new Date(T):T===""?null:T):T)(ie=k.header?O>=F.length?"__parsed_extra":F[O]:ie,q=k.transform?k.transform(q,ie):q);ie==="__parsed_extra"?(he[ie]=he[ie]||[],he[ie].push(q)):he[ie]=q}return k.header&&(O>F.length?U("FieldMismatch","TooManyFields","Too many fields: expected "+F.length+" fields but parsed "+O,H+J):O<F.length&&U("FieldMismatch","TooFewFields","Too few fields: expected "+F.length+" fields but parsed "+O,H+J)),he}var te;W&&(k.header||k.dynamicTyping||k.transform)&&(te=1,!W.data.length||Array.isArray(W.data[0])?(W.data=W.data.map(ee),te=W.data.length):W.data=ee(W.data,0),k.header&&W.meta&&(W.meta.fields=F),H+=te)}function le(){return k.header&&F.length===0}function U(R,ee,te,Z){R={type:R,code:ee,message:te},Z!==void 0&&(R.row=Z),W.errors.push(R)}C(k.step)&&(P=k.step,k.step=function(R){W=R,le()?oe():(oe(),W.data.length!==0&&(Y+=R.data.length,k.preview&&Y>k.preview?M.abort():(W.data=W.data[0],P(W,G))))}),this.parse=function(R,ee,te){var Z=k.quoteChar||'"',Z=(k.newline||(k.newline=this.guessLineEndings(R,Z)),z=!1,k.delimiter?C(k.delimiter)&&(k.delimiter=k.delimiter(R),W.meta.delimiter=k.delimiter):((Z=((J,he,O,ie,q)=>{var I,T,D,ne;q=q||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var ue=0;ue<q.length;ue++){for(var re,pe=q[ue],ve=0,xe=0,ae=0,de=(D=void 0,new y({comments:ie,delimiter:pe,newline:he,preview:10}).parse(J)),ge=0;ge<de.data.length;ge++)O&&X(de.data[ge])?ae++:(re=de.data[ge].length,xe+=re,D===void 0?D=re:0<re&&(ve+=Math.abs(re-D),D=re));0<de.data.length&&(xe/=de.data.length-ae),(T===void 0||ve<=T)&&(ne===void 0||ne<xe)&&1.99<xe&&(T=ve,I=pe,ne=xe)}return{successful:!!(k.delimiter=I),bestDelimiter:I}})(R,k.newline,k.skipEmptyLines,k.comments,k.delimitersToGuess)).successful?k.delimiter=Z.bestDelimiter:(z=!0,k.delimiter=u.DefaultDelimiter),W.meta.delimiter=k.delimiter),j(k));return k.preview&&k.header&&Z.preview++,E=R,M=new y(Z),W=M.parse(E,ee,te),oe(),B?{meta:{paused:!0}}:W||{meta:{paused:!1}}},this.paused=function(){return B},this.pause=function(){B=!0,M.abort(),E=C(k.chunk)?"":E.substring(M.getCharIndex())},this.resume=function(){G.streamer._halted?(B=!1,G.streamer.parseChunk(E,!0)):setTimeout(G.resume,3)},this.aborted=function(){return L},this.abort=function(){L=!0,M.abort(),W.meta.aborted=!0,C(k.complete)&&k.complete(W),E=""},this.guessLineEndings=function(J,Z){J=J.substring(0,1048576);var Z=new RegExp(x(Z)+"([^]*?)"+x(Z),"gm"),te=(J=J.replace(Z,"")).split("\r"),Z=J.split(`
`),J=1<Z.length&&Z[0].length<te[0].length;if(te.length===1||J)return`
`;for(var he=0,O=0;O<te.length;O++)te[O][0]===`
`&&he++;return he>=te.length/2?`\r
`:"\r"}}function x(k){return k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function y(k){var E=(k=k||{}).delimiter,M=k.newline,z=k.comments,P=k.step,V=k.preview,A=k.fastMode,$=null,K=!1,G=k.quoteChar==null?'"':k.quoteChar,Y=G;if(k.escapeChar!==void 0&&(Y=k.escapeChar),(typeof E!="string"||-1<u.BAD_DELIMITERS.indexOf(E))&&(E=","),z===E)throw new Error("Comment character same as delimiter");z===!0?z="#":(typeof z!="string"||-1<u.BAD_DELIMITERS.indexOf(z))&&(z=!1),M!==`
`&&M!=="\r"&&M!==`\r
`&&(M=`
`);var H=0,B=!1;this.parse=function(L,F,W){if(typeof L!="string")throw new Error("Input must be a string");var X=L.length,oe=E.length,le=M.length,U=z.length,R=C(P),ee=[],te=[],Z=[],J=H=0;if(!L)return ve();if(A||A!==!1&&L.indexOf(G)===-1){for(var he=L.split(M),O=0;O<he.length;O++){if(Z=he[O],H+=Z.length,O!==he.length-1)H+=M.length;else if(W)return ve();if(!z||Z.substring(0,U)!==z){if(R){if(ee=[],ne(Z.split(E)),xe(),B)return ve()}else ne(Z.split(E));if(V&&V<=O)return ee=ee.slice(0,V),ve(!0)}}return ve()}for(var ie=L.indexOf(E,H),q=L.indexOf(M,H),I=new RegExp(x(Y)+x(G),"g"),T=L.indexOf(G,H);;)if(L[H]===G)for(T=H,H++;;){if((T=L.indexOf(G,T+1))===-1)return W||te.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:ee.length,index:H}),re();if(T===X-1)return re(L.substring(H,T).replace(I,G));if(G===Y&&L[T+1]===Y)T++;else if(G===Y||T===0||L[T-1]!==Y){ie!==-1&&ie<T+1&&(ie=L.indexOf(E,T+1));var D=ue((q=q!==-1&&q<T+1?L.indexOf(M,T+1):q)===-1?ie:Math.min(ie,q));if(L.substr(T+1+D,oe)===E){Z.push(L.substring(H,T).replace(I,G)),L[H=T+1+D+oe]!==G&&(T=L.indexOf(G,H)),ie=L.indexOf(E,H),q=L.indexOf(M,H);break}if(D=ue(q),L.substring(T+1+D,T+1+D+le)===M){if(Z.push(L.substring(H,T).replace(I,G)),pe(T+1+D+le),ie=L.indexOf(E,H),T=L.indexOf(G,H),R&&(xe(),B))return ve();if(V&&ee.length>=V)return ve(!0);break}te.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:ee.length,index:H}),T++}}else if(z&&Z.length===0&&L.substring(H,H+U)===z){if(q===-1)return ve();H=q+le,q=L.indexOf(M,H),ie=L.indexOf(E,H)}else if(ie!==-1&&(ie<q||q===-1))Z.push(L.substring(H,ie)),H=ie+oe,ie=L.indexOf(E,H);else{if(q===-1)break;if(Z.push(L.substring(H,q)),pe(q+le),R&&(xe(),B))return ve();if(V&&ee.length>=V)return ve(!0)}return re();function ne(ae){ee.push(ae),J=H}function ue(ae){var de=0;return de=ae!==-1&&(ae=L.substring(T+1,ae))&&ae.trim()===""?ae.length:de}function re(ae){return W||(ae===void 0&&(ae=L.substring(H)),Z.push(ae),H=X,ne(Z),R&&xe()),ve()}function pe(ae){H=ae,ne(Z),Z=[],q=L.indexOf(M,H)}function ve(ae){if(k.header&&!F&&ee.length&&!K){var de=ee[0],ge=Object.create(null),we=new Set(de);let je=!1;for(let Se=0;Se<de.length;Se++){let Ue=de[Se];if(ge[Ue=C(k.transformHeader)?k.transformHeader(Ue,Se):Ue]){let Ae,fe=ge[Ue];for(;Ae=Ue+"_"+fe,fe++,we.has(Ae););we.add(Ae),de[Se]=Ae,ge[Ue]++,je=!0,($=$===null?{}:$)[Ae]=Ue}else ge[Ue]=1,de[Se]=Ue;we.add(Ue)}je&&console.warn("Duplicate headers found and renamed."),K=!0}return{data:ee,errors:te,meta:{delimiter:E,linebreak:M,aborted:B,truncated:!!ae,cursor:J+(F||0),renamedHeaders:$}}}function xe(){P(ve()),ee=[],te=[]}},this.abort=function(){B=!0},this.getCharIndex=function(){return H}}function v(k){var E=k.data,M=l[E.workerId],z=!1;if(E.error)M.userError(E.error,E.file);else if(E.results&&E.results.data){var P={abort:function(){z=!0,b(E.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:w,resume:w};if(C(M.userStep)){for(var V=0;V<E.results.data.length&&(M.userStep({data:E.results.data[V],errors:E.results.errors,meta:E.results.meta},P),!z);V++);delete E.results}else C(M.userChunk)&&(M.userChunk(E.results,P,E.file),delete E.results)}E.finished&&!z&&b(E.workerId,E.results)}function b(k,E){var M=l[k];C(M.userComplete)&&M.userComplete(E),M.terminate(),delete l[k]}function w(){throw new Error("Not implemented.")}function j(k){if(typeof k!="object"||k===null)return k;var E,M=Array.isArray(k)?[]:{};for(E in k)M[E]=j(k[E]);return M}function N(k,E){return function(){k.apply(E,arguments)}}function C(k){return typeof k=="function"}return u.parse=function(k,E){var M=(E=E||{}).dynamicTyping||!1;if(C(M)&&(E.dynamicTypingFunction=M,M={}),E.dynamicTyping=M,E.transform=!!C(E.transform)&&E.transform,!E.worker||!u.WORKERS_SUPPORTED)return M=null,u.NODE_STREAM_INPUT,typeof k=="string"?(k=(z=>z.charCodeAt(0)!==65279?z:z.slice(1))(k),M=new(E.download?h:p)(E)):k.readable===!0&&C(k.read)&&C(k.on)?M=new g(E):(n.File&&k instanceof File||k instanceof Object)&&(M=new f(E)),M.stream(k);(M=(()=>{var z;return!!u.WORKERS_SUPPORTED&&(z=(()=>{var P=n.URL||n.webkitURL||null,V=r.toString();return u.BLOB_URL||(u.BLOB_URL=P.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",V,")();"],{type:"text/javascript"})))})(),(z=new n.Worker(z)).onmessage=v,z.id=c++,l[z.id]=z)})()).userStep=E.step,M.userChunk=E.chunk,M.userComplete=E.complete,M.userError=E.error,E.step=C(E.step),E.chunk=C(E.chunk),E.complete=C(E.complete),E.error=C(E.error),delete E.worker,M.postMessage({input:k,config:E,workerId:M.id})},u.unparse=function(k,E){var M=!1,z=!0,P=",",V=`\r
`,A='"',$=A+A,K=!1,G=null,Y=!1,H=((()=>{if(typeof E=="object"){if(typeof E.delimiter!="string"||u.BAD_DELIMITERS.filter(function(F){return E.delimiter.indexOf(F)!==-1}).length||(P=E.delimiter),typeof E.quotes!="boolean"&&typeof E.quotes!="function"&&!Array.isArray(E.quotes)||(M=E.quotes),typeof E.skipEmptyLines!="boolean"&&typeof E.skipEmptyLines!="string"||(K=E.skipEmptyLines),typeof E.newline=="string"&&(V=E.newline),typeof E.quoteChar=="string"&&(A=E.quoteChar),typeof E.header=="boolean"&&(z=E.header),Array.isArray(E.columns)){if(E.columns.length===0)throw new Error("Option columns is empty");G=E.columns}E.escapeChar!==void 0&&($=E.escapeChar+A),E.escapeFormulae instanceof RegExp?Y=E.escapeFormulae:typeof E.escapeFormulae=="boolean"&&E.escapeFormulae&&(Y=/^[=+\-@\t\r].*$/)}})(),new RegExp(x(A),"g"));if(typeof k=="string"&&(k=JSON.parse(k)),Array.isArray(k)){if(!k.length||Array.isArray(k[0]))return B(null,k,K);if(typeof k[0]=="object")return B(G||Object.keys(k[0]),k,K)}else if(typeof k=="object")return typeof k.data=="string"&&(k.data=JSON.parse(k.data)),Array.isArray(k.data)&&(k.fields||(k.fields=k.meta&&k.meta.fields||G),k.fields||(k.fields=Array.isArray(k.data[0])?k.fields:typeof k.data[0]=="object"?Object.keys(k.data[0]):[]),Array.isArray(k.data[0])||typeof k.data[0]=="object"||(k.data=[k.data])),B(k.fields||[],k.data||[],K);throw new Error("Unable to serialize unrecognized input");function B(F,W,X){var oe="",le=(typeof F=="string"&&(F=JSON.parse(F)),typeof W=="string"&&(W=JSON.parse(W)),Array.isArray(F)&&0<F.length),U=!Array.isArray(W[0]);if(le&&z){for(var R=0;R<F.length;R++)0<R&&(oe+=P),oe+=L(F[R],R);0<W.length&&(oe+=V)}for(var ee=0;ee<W.length;ee++){var te=(le?F:W[ee]).length,Z=!1,J=le?Object.keys(W[ee]).length===0:W[ee].length===0;if(X&&!le&&(Z=X==="greedy"?W[ee].join("").trim()==="":W[ee].length===1&&W[ee][0].length===0),X==="greedy"&&le){for(var he=[],O=0;O<te;O++){var ie=U?F[O]:O;he.push(W[ee][ie])}Z=he.join("").trim()===""}if(!Z){for(var q=0;q<te;q++){0<q&&!J&&(oe+=P);var I=le&&U?F[q]:q;oe+=L(W[ee][I],q)}ee<W.length-1&&(!X||0<te&&!J)&&(oe+=V)}}return oe}function L(F,W){var X,oe;return F==null?"":F.constructor===Date?JSON.stringify(F).slice(1,25):(oe=!1,Y&&typeof F=="string"&&Y.test(F)&&(F="'"+F,oe=!0),X=F.toString().replace(H,$),(oe=oe||M===!0||typeof M=="function"&&M(F,W)||Array.isArray(M)&&M[W]||((le,U)=>{for(var R=0;R<U.length;R++)if(-1<le.indexOf(U[R]))return!0;return!1})(X,u.BAD_DELIMITERS)||-1<X.indexOf(P)||X.charAt(0)===" "||X.charAt(X.length-1)===" ")?A+X+A:X)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!i&&!!n.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=y,u.ParserHandle=m,u.NetworkStreamer=h,u.FileStreamer=f,u.StringStreamer=p,u.ReadableStreamStreamer=g,n.jQuery&&((s=n.jQuery).fn.parse=function(k){var E=k.config||{},M=[];return this.each(function(V){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&n.FileReader)||!this.files||this.files.length===0)return!0;for(var A=0;A<this.files.length;A++)M.push({file:this.files[A],inputElem:this,instanceConfig:s.extend({},E)})}),z(),this;function z(){if(M.length===0)C(k.complete)&&k.complete();else{var V,A,$,K,G=M[0];if(C(k.before)){var Y=k.before(G.file,G.inputElem);if(typeof Y=="object"){if(Y.action==="abort")return V="AbortError",A=G.file,$=G.inputElem,K=Y.reason,void(C(k.error)&&k.error({name:V},A,$,K));if(Y.action==="skip")return void P();typeof Y.config=="object"&&(G.instanceConfig=s.extend(G.instanceConfig,Y.config))}else if(Y==="skip")return void P()}var H=G.instanceConfig.complete;G.instanceConfig.complete=function(B){C(H)&&H(B,G.file,G.inputElem),P()},u.parse(G.file,G.instanceConfig)}}function P(){M.splice(0,1),z()}}),o&&(n.onmessage=function(k){k=k.data,u.WORKER_ID===void 0&&k&&(u.WORKER_ID=k.workerId),typeof k.input=="string"?n.postMessage({workerId:u.WORKER_ID,results:u.parse(k.input,k.config),finished:!0}):(n.File&&k.input instanceof File||k.input instanceof Object)&&(k=u.parse(k.input,k.config))&&n.postMessage({workerId:u.WORKER_ID,results:k,finished:!0})}),(h.prototype=Object.create(d.prototype)).constructor=h,(f.prototype=Object.create(d.prototype)).constructor=f,(p.prototype=Object.create(p.prototype)).constructor=p,(g.prototype=Object.create(d.prototype)).constructor=g,u})})(zfe);var Iut=zfe.exports;const W1=qt(Iut);function Vi(t){return t?t.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/_([^_]+)_/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/^>\s+/gm,"").replace(/^[\*\+]\s+/gm,"- ").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/\n{3,}/g,`
`).trim():""}async function Rut(t,e,r){var C,k,E,M,z;const[n,s,i,o,l,c,u,d,h,f,p,g,m,x]=await Promise.all([be.from("theses").select("*").eq("user_id",t),be.from("chapters").select("*"),be.from("sections").select("*"),be.from("documents").select("id, title, original_filename, doi, isbn, citation_apa, page_count, created_at").eq("user_id",t),be.from("summaries").select("id, document_id, summary_text, summary_mode, citation_style, created_at").eq("user_id",t),be.from("theory_backgrounds").select("id, document_id, title, theory_text, mode, citation_style, created_at").eq("user_id",t),be.from("methods").select("id, document_id, title, method_text, mode, citation_style, created_at").eq("user_id",t),be.from("research_setups").select("*").eq("user_id",t),be.from("topic_explorations").select("*").eq("user_id",t),be.from("codebooks").select("*").eq("user_id",t),be.from("codebook_categories").select("*"),be.from("interviews").select("*").eq("user_id",t),be.from("coded_segments").select("*").eq("user_id",t),be.from("qualitative_summaries").select("*").eq("user_id",t)]),y=((C=n.data)==null?void 0:C.map(P=>P.id))||[],v=((k=s.data)==null?void 0:k.filter(P=>y.includes(P.thesis_id)))||[],b=v.map(P=>P.id),w=((E=i.data)==null?void 0:E.filter(P=>b.includes(P.chapter_id)))||[],j=((M=f.data)==null?void 0:M.map(P=>P.id))||[],N=((z=p.data)==null?void 0:z.filter(P=>j.includes(P.codebook_id)))||[];return{exportDate:new Date().toISOString(),version:"1.0",user:{id:t,email:e,nickname:r},thesis:{theses:n.data||[],chapters:v,sections:w},library:{documents:o.data||[],summaries:l.data||[],theoryBackgrounds:c.data||[],methods:u.data||[]},research:{researchSetups:d.data||[],topicExplorations:h.data||[]},qualitative:{codebooks:f.data||[],codebookCategories:N,interviews:g.data||[],codedSegments:m.data||[],qualitativeSummaries:x.data||[]}}}function Mut(t){const e=[`THESIS BACKUP
`];for(const r of t.thesis.theses){e.push(`${r.title}`),e.push(`Degree: ${r.degree==="bachelor"?"Bachelor":"Master"}`),r.due_date&&e.push(`Due Date: ${new Date(r.due_date).toLocaleDateString()}`),r.description&&e.push(`
${Vi(r.description)}`),e.push(`
---
`);const n=t.thesis.chapters.filter(s=>s.thesis_id===r.id).sort((s,i)=>s.order_index-i.order_index);for(let s=0;s<n.length;s++){const i=n[s];e.push(`${s+1}. ${i.title}
`);const o=t.thesis.sections.filter(l=>l.chapter_id===i.id).sort((l,c)=>l.order_index-c.order_index);for(let l=0;l<o.length;l++){const c=o[l],u=c.title||c.type;e.push(`${s+1}.${l+1} ${u}
`),e.push(Vi(c.content)||"[No content]"),e.push(`
`)}}e.push(`
---
`)}return e.join(`
`)}function Dut(t){const e=[`SUMMARIES
`];for(const r of t.library.summaries){const n=t.library.documents.find(i=>i.id===r.document_id),s=(n==null?void 0:n.title)||(n==null?void 0:n.original_filename)||"Unknown Document";e.push(`${s}`),e.push(`Mode: ${r.summary_mode||"Standard"}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),e.push(Vi(r.summary_text)||"[No summary text]"),e.push(`
---
`)}return e.join(`
`)}function Lut(t){const e=[`THEORY BACKGROUNDS
`];for(const r of t.library.theoryBackgrounds)e.push(`${r.title||"Untitled"}`),e.push(`Mode: ${r.mode||"Standard"}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),e.push(Vi(r.theory_text)||"[No text]"),e.push(`
---
`);return e.join(`
`)}function Fut(t){const e=[`METHODS
`];for(const r of t.library.methods)e.push(`${r.title||"Untitled"}`),e.push(`Mode: ${r.mode||"Standard"}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),e.push(Vi(r.method_text)||"[No text]"),e.push(`
---
`);return e.join(`
`)}function $ut(t){const e=[`INTERVIEWS
`];for(const r of t.qualitative.interviews)e.push(`${r.title}`),r.source&&e.push(`Source: ${r.source}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),e.push(Vi(r.raw_text)||"[No text]"),e.push(`
---
`);return e.join(`
`)}function But(t){const e=[`RESEARCH SETUPS
`];for(const r of t.research.researchSetups)e.push(`${r.title}`),r.aim&&e.push(`Aim: ${Vi(r.aim)}`),r.degree&&e.push(`Degree: ${r.degree}`),r.discipline&&e.push(`Discipline: ${r.discipline}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),r.derived_research_questions&&(e.push("Research Questions"),(Array.isArray(r.derived_research_questions)?r.derived_research_questions:[]).forEach((s,i)=>{e.push(`${i+1}. ${Vi(s)}`)}),e.push("")),r.markdown_text&&(e.push("Full Content"),e.push(Vi(r.markdown_text))),e.push(`
---
`);return e.join(`
`)}function Uut(t){const e=[`TOPIC EXPLORATIONS
`];for(const r of t.research.topicExplorations)e.push(`${r.title}`),r.degree_type&&e.push(`Degree: ${r.degree_type}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),r.problem_statement&&(e.push("Problem Statement"),e.push(Vi(r.problem_statement)),e.push("")),r.objectives&&(e.push("Objectives"),e.push(Vi(r.objectives)),e.push("")),r.introduction&&(e.push("Introduction"),e.push(Vi(r.introduction)),e.push("")),r.research_questions&&(e.push("Research Questions"),(Array.isArray(r.research_questions)?r.research_questions:[]).forEach((s,i)=>{e.push(`${i+1}. ${Vi(s)}`)}),e.push("")),e.push(`
---
`);return e.join(`
`)}function zut(t){const e=[`QUALITATIVE SUMMARIES
`];for(const r of t.qualitative.qualitativeSummaries){const n=t.qualitative.codebooks.find(s=>s.id===r.codebook_id);e.push(`${r.title||"Untitled"}`),n&&e.push(`Codebook: ${n.title}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),e.push(Vi(r.summary_text)||"[No text]"),e.push(`
---
`)}return e.join(`
`)}async function Hut(t,e,r){const n=r.qualitative.codebookCategories.filter(h=>h.codebook_id===t).sort((h,f)=>(h.order_index||0)-(f.order_index||0)),s=r.qualitative.codedSegments.filter(h=>h.codebook_id===t),i=[...new Set(s.map(h=>h.interview_id))],o=r.qualitative.interviews.filter(h=>i.includes(h.id)),c=[["Category","Definition","Coding Rule","Anchor Example",...o.map(h=>h.title)]];for(const h of n){const f=[(h.name||"").replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(h.definition||"").replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(h.coding_rule||"").replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(h.anchor_example||"").replace(/\r?\n/g," ").replace(/"/g,'""').trim()];for(const p of o){const m=s.filter(x=>x.category_id===h.id&&x.interview_id===p.id).map(x=>x.snippet).join(" | ").replace(/"/g,'""').replace(/\r?\n/g," ").trim();f.push(m)}c.push(f)}const u=W1.unparse(c,{delimiter:";",quotes:!0,escapeFormulae:!0,newline:`\r
`});return{filename:`codebook_${e.replace(/[^a-zA-Z0-9_\-]/g,"_").substring(0,50)}.csv`,content:"\uFEFF"+u}}function Wut(t){const e=new Date,r=e.toISOString().split("T")[0],n=e.toTimeString().split(":").slice(0,2).join(":");return`# Academly AI Backup
This backup contains all your data from Academly AI.
## Structure
- thesis/
- thesis_content.txt - Your thesis drafts in readable format
- library/
- summaries.txt - All document summaries
- theory_backgrounds.txt - Theory background texts
- methods.txt - Methodology texts
- research/
- research_setups.txt - Research setup documents
- topic_explorations.txt - Topic exploration notes
- qualitative/
- interviews.txt - All interview transcripts
- coding_summaries.txt - Qualitative analysis summaries
- codebook_*.csv - Codebook grids (Excel compatible)
## Notes
- CSV files use semicolon (;) as delimiter for Excel compatibility
- All text files are UTF-8 encoded with BOM
- Dates are in ISO format (YYYY-MM-DD)
## Data Ownership
${t.user.nickname?`Dear ${t.user.nickname}, your`:"Your"} data belongs to you! This backup ensures you always have access to your work.
---
Generated by Academly AI
${r} ${n}
`}async function Vut(t){const e=new Out;e.file("README.txt","\uFEFF"+Wut(t));const r=e.folder("thesis");t.thesis.theses.length>0&&(r==null||r.file("thesis_content.txt","\uFEFF"+Mut(t)));const n=e.folder("library");t.library.summaries.length>0&&(n==null||n.file("summaries.txt","\uFEFF"+Dut(t))),t.library.theoryBackgrounds.length>0&&(n==null||n.file("theory_backgrounds.txt","\uFEFF"+Lut(t))),t.library.methods.length>0&&(n==null||n.file("methods.txt","\uFEFF"+Fut(t)));const s=e.folder("research");t.research.researchSetups.length>0&&(s==null||s.file("research_setups.txt","\uFEFF"+But(t))),t.research.topicExplorations.length>0&&(s==null||s.file("topic_explorations.txt","\uFEFF"+Uut(t)));const i=e.folder("qualitative");t.qualitative.interviews.length>0&&(i==null||i.file("interviews.txt","\uFEFF"+$ut(t))),t.qualitative.qualitativeSummaries.length>0&&(i==null||i.file("coding_summaries.txt","\uFEFF"+zut(t)));for(const o of t.qualitative.codebooks){const l=await Hut(o.id,o.title,t);i==null||i.file(l.filename,l.content)}return await e.generateAsync({type:"blob",compression:"DEFLATE"})}const qut=[{value:"education",label:{de:"Bildungswissenschaften",en:"Education"}},{value:"arts_humanities",label:{de:"Kunst & Geisteswissenschaften",en:"Arts & Humanities"}},{value:"social_sciences",label:{de:"Sozialwissenschaften",en:"Social Sciences"}},{value:"business",label:{de:"Wirtschaftswissenschaften",en:"Business & Economics"}},{value:"law",label:{de:"Rechtswissenschaften",en:"Law"}},{value:"natural_sciences",label:{de:"Naturwissenschaften",en:"Natural Sciences"}},{value:"ict",label:{de:"Informatik & IT",en:"ICT"}},{value:"engineering",label:{de:"Ingenieurwissenschaften",en:"Engineering"}},{value:"health",label:{de:"Gesundheitswissenschaften",en:"Health Sciences"}},{value:"agriculture",label:{de:"Agrarwissenschaften",en:"Agriculture"}},{value:"services",label:{de:"Dienstleistungen",en:"Services"}}],Gut=[{value:"DE",label:"🇩🇪 Deutschland"},{value:"AT",label:"🇦🇹 Österreich"},{value:"CH",label:"🇨🇭 Schweiz"},{value:"US",label:"🇺🇸 USA"},{value:"GB",label:"🇬🇧 UK"},{value:"FR",label:"🇫🇷 Frankreich"},{value:"ES",label:"🇪🇸 Spanien"},{value:"IT",label:"🇮🇹 Italien"},{value:"NL",label:"🇳🇱 Niederlande"},{value:"BE",label:"🇧🇪 Belgien"},{value:"SE",label:"🇸🇪 Schweden"},{value:"NO",label:"🇳🇴 Norwegen"},{value:"DK",label:"🇩🇰 Dänemark"},{value:"FI",label:"🇫🇮 Finnland"},{value:"PL",label:"🇵🇱 Polen"},{value:"CZ",label:"🇨🇿 Tschechien"},{value:"OTHER",label:"🌍 Andere"}],Kut=[{value:"bachelor",label:{de:"Bachelor",en:"Bachelor"}},{value:"master",label:{de:"Master",en:"Master"}},{value:"phd",label:{de:"Promotion/PhD",en:"PhD"}},{value:"postdoc",label:{de:"Postdoc",en:"Postdoc"}},{value:"other",label:{de:"Sonstiges",en:"Other"}}],Yut=[{value:"qualitative",label:{de:"Qualitativ",en:"Qualitative"}},{value:"quantitative",label:{de:"Quantitativ",en:"Quantitative"}},{value:"mixed",label:{de:"Mixed Methods",en:"Mixed Methods"}}],Xut=[{value:"de",label:"🇩🇪 Deutsch"},{value:"en",label:"🇬🇧 English"},{value:"fr",label:"🇫🇷 Français"},{value:"es",label:"🇪🇸 Español"},{value:"it",label:"🇮🇹 Italiano"}],Qut=({initialData:t,onUpdate:e,disabled:r})=>{var f;const[n,s]=S.useState(t),[i,o]=S.useState(""),l=(p,g)=>{const m={...n,[p]:g};s(m),e({[p]:g})},c=()=>{if(!i.trim())return;const p=[...n.research_interests||[],i.trim()];l("research_interests",p),o("")},u=p=>{const g=[...n.research_interests||[]];g.splice(p,1),l("research_interests",g)},d=n.preferred_language||"de",h=p=>p[d]||p.de;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Country of Study"}),a.jsxs(at,{value:n.study_country||"",onValueChange:p=>l("study_country",p),disabled:r,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select country"})}),a.jsx(st,{children:Gut.map(p=>a.jsx(Te,{value:p.value,children:p.label},p.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Degree Type"}),a.jsxs(at,{value:n.degree_type||"",onValueChange:p=>l("degree_type",p),disabled:r,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select degree"})}),a.jsx(st,{children:Kut.map(p=>a.jsx(Te,{value:p.value,children:h(p.label)},p.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Discipline"}),a.jsxs(at,{value:n.discipline||"",onValueChange:p=>l("discipline",p),disabled:r,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Discipline auswählen"})}),a.jsx(st,{children:qut.map(p=>a.jsx(Te,{value:p.value,children:h(p.label)},p.value))})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"University (optional)"}),a.jsx(Fe,{value:n.university||"",onChange:p=>l("university",p.target.value),placeholder:"z.B. University Stanford",disabled:r})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Primary Methodology"}),a.jsxs(at,{value:n.methodology||"",onValueChange:p=>l("methodology",p),disabled:r,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select methodology"})}),a.jsx(st,{children:Yut.map(p=>a.jsx(Te,{value:p.value,children:h(p.label)},p.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Preferred Language"}),a.jsxs(at,{value:n.preferred_language||"en",onValueChange:p=>l("preferred_language",p),disabled:r,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select language"})}),a.jsx(st,{children:Xut.map(p=>a.jsx(Te,{value:p.value,children:p.label},p.value))})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Research Interests"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Fe,{value:i,onChange:p=>o(p.target.value),onKeyDown:p=>p.key==="Enter"&&(p.preventDefault(),c()),placeholder:"z.B. Künstliche Intelligenz",disabled:r}),a.jsx("button",{onClick:c,disabled:r||!i.trim(),className:"px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 disabled:opacity-50",children:"+"})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:(f=n.research_interests)==null?void 0:f.map((p,g)=>a.jsxs(gt,{variant:"secondary",className:"gap-1",children:[p,!r&&a.jsx(En,{className:"w-3 h-3 cursor-pointer",onClick:()=>u(g)})]},g))})]})]})},Zut=()=>{const{user:t,userProfile:e,researchProfile:r,studentPoints:n,loading:s,signOut:i,updateResearchProfile:o,uploadAvatar:l,selectPublicAvatar:c}=Pt(),{openCustomerPortal:u,loading:d}=gue(),h=gr(),[f,p]=S.useState(""),[g,m]=S.useState(""),[x,y]=S.useState(!1),[v,b]=S.useState(""),[w,j]=S.useState(""),[N,C]=S.useState(""),[k,E]=S.useState(!1),[M,z]=S.useState(null),[P,V]=S.useState(!1),[A,$]=S.useState(""),[K,G]=S.useState(!1),[Y,H]=S.useState(""),[B,L]=S.useState(!1),[F,W]=S.useState(!1),[X,oe]=S.useState(null);S.useEffect(()=>{const D=localStorage.getItem("lastBackupDate");D&&z(D)},[]),S.useEffect(()=>{(async()=>{if(!(r!=null&&r.avatar_url)){oe(null);return}const ne=await Ry(r.avatar_url);oe(ne)})()},[r==null?void 0:r.avatar_url]),S.useEffect(()=>{!t&&!s?h("/login"):t&&p(t.email||""),r!=null&&r.nickname&&m(r.nickname)},[t,r,s,h]);const le=async()=>{if(w!==N){$e.error("Passwords do not match");return}if(w.length<6){$e.error("Password must be at least 6 characters");return}$e.success("Password updated successfully"),b(""),j(""),C("")},U=async()=>{if(!t||Y!==t.email){$e.error("Please enter your email address correctly to confirm deletion");return}V(!0);try{$("Canceling subscription...");const{data:D,error:ne}=await be.functions.invoke("delete-account");if(ne)throw console.error("Delete account error:",ne),new Error(ne.message||"Failed to delete account");if(D!=null&&D.error)throw new Error(D.error);$e.success("Account successfully deleted. Goodbye!"),await i(),h("/")}catch(D){console.error("Delete account error:",D),$e.error("Failed to delete account: "+(D.message||"Unknown error")),V(!1),$("")}},R=()=>{G(!1),H(""),L(!1)},ee=async()=>{if(g.trim()){y(!0);try{await o({nickname:g.trim()}),$e.success("Nickname updated")}catch{$e.error("Failed to update nickname")}finally{y(!1)}}},te=async D=>await l(D),Z=async D=>{await c(D)},J=async D=>{try{await o(D)}catch{$e.error("Failed to update profile")}},he=async()=>{if(t){E(!0);try{const D=await Rut(t.id,t.email||"",(r==null?void 0:r.nickname)||void 0),ne=await Vut(D),ue=new Date().toISOString().split("T")[0],re=r!=null&&r.nickname?`${r.nickname}_Backup_${ue}.zip`:`User_Backup_${ue}.zip`,pe=URL.createObjectURL(ne),ve=document.createElement("a");ve.href=pe,ve.download=re,document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(pe);const xe=new Date().toISOString();localStorage.setItem("lastBackupDate",xe),z(xe),$e.success("Backup created successfully!")}catch(D){console.error("Backup error:",D),$e.error("Failed to create backup.")}finally{E(!1)}}};if(s)return a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})});if(!t||!e)return null;const O=(n==null?void 0:n.total)||0,ie=(n==null?void 0:n.used)||0,q=(n==null?void 0:n.remaining)||0,I=O>0?Math.round(ie/O*100):0,T=new Date(e.created_at).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return a.jsx(er,{showSidebar:!0,children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Manage Account"}),a.jsx("p",{className:"text-muted-foreground",children:"Manage your account settings and profile"})]}),a.jsx(Me,{children:a.jsx(Be,{className:"pt-6",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4",children:[a.jsxs("div",{onClick:()=>W(!0),className:"cursor-pointer group",children:[a.jsx("div",{className:"relative w-24 h-24 rounded-full overflow-hidden bg-muted border-2 border-transparent group-hover:border-primary transition-all",children:X?a.jsx("img",{src:X,alt:"Profile",className:"w-full h-full object-cover"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:a.jsx(Ij,{className:"w-12 h-12 text-muted-foreground"})})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center group-hover:text-primary transition-colors",children:"Click to change"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm font-medium",children:"Profile Picture"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose a default avatar or upload your own (max 2MB)"})]})]}),a.jsx(qr,{open:F,onOpenChange:W,children:a.jsxs(Dr,{className:"sm:max-w-[840px]",children:[a.jsxs(Lr,{children:[a.jsx(Fr,{children:"Choose Your Avatar"}),a.jsx(gb,{children:"Select a default avatar or upload your own"})]}),a.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:a.jsx(mue,{currentAvatarUrl:(r==null?void 0:r.avatar_url)||null,onSelectPublic:Z,onUploadCustom:te})})]})}),a.jsx(Ps,{}),a.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-4",children:[a.jsxs("div",{className:"flex gap-2 flex-1",children:[a.jsx(Fe,{placeholder:"Nickname (optional)",value:g,onChange:D=>m(D.target.value),className:"max-w-xs"}),a.jsx(ye,{onClick:ee,disabled:x||!g.trim(),children:"Save"})]}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[f," • Member since ",T]})]})]})})}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsx(Je,{children:"Research Profile"}),a.jsx(mn,{children:"Optional information for personalization and analytics (GDPR compliant)"})]}),a.jsx(Be,{children:a.jsx(Qut,{initialData:{study_country:(r==null?void 0:r.study_country)||null,degree_type:(r==null?void 0:r.degree_type)||null,discipline:(r==null?void 0:r.discipline)||null,research_interests:(r==null?void 0:r.research_interests)||null,university:(r==null?void 0:r.university)||null,methodology:(r==null?void 0:r.methodology)||null,preferred_language:(r==null?void 0:r.preferred_language)||null},onUpdate:J})})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Bve,{className:"h-5 w-5"}),"Subscription & Credits"]}),a.jsx(mn,{children:"Your plan and Student Points"})]}),a.jsx(Be,{children:a.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"Current Plan"}),a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("span",{className:"text-2xl font-bold capitalize",children:e.plan==="starter"?"Free":e.plan||"Free"}),e.subscription_status==="active"&&a.jsx(gt,{variant:"default",className:"bg-green-500/10 text-green-600 border-green-500/20",children:"Active"}),e.subscription_status==="canceled"&&a.jsx(gt,{variant:"secondary",className:"bg-amber-500/10 text-amber-600 border-amber-500/20",children:"Canceled"}),e.subscription_status==="past_due"&&a.jsx(gt,{variant:"destructive",children:"Past Due"})]}),e.subscription_ends_at&&a.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:e.subscription_status==="canceled"?`Access until ${new Date(e.subscription_ends_at).toLocaleDateString("en-US")}`:`Next billing: ${new Date(e.subscription_ends_at).toLocaleDateString("en-US")}`}),a.jsx("div",{className:"flex gap-2",children:e.stripe_subscription_id?a.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>u(),disabled:d,children:[d?a.jsx(St,{className:"h-4 w-4 animate-spin mr-2"}):null,"Manage Subscription"]}):a.jsx(ye,{variant:"outline",size:"sm",onClick:()=>h("/pricing"),children:"Upgrade Plan"})})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Student Points"}),a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Purchased"}),a.jsxs("p",{className:"text-lg font-bold",children:[O.toLocaleString("en-US")," SP"]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Used"}),a.jsxs("p",{className:"text-lg font-bold",children:[ie.toLocaleString("en-US",{maximumFractionDigits:1})," SP"]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Remaining"}),a.jsxs("p",{className:"text-lg font-bold text-primary",children:[q.toLocaleString("en-US",{maximumFractionDigits:1})," SP"]})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(nS,{value:I}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[I,"% used • 1 SP = $0.001"]})]})]})]})})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(zF,{className:"h-5 w-5"}),"Change Password"]}),a.jsx(mn,{children:"Update your password for security"})]}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"current-password",children:"Current Password"}),a.jsx(Fe,{id:"current-password",type:"password",value:v,onChange:D=>b(D.target.value)})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"new-password",children:"New Password"}),a.jsx(Fe,{id:"new-password",type:"password",value:w,onChange:D=>j(D.target.value)})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"confirm-password",children:"Confirm Password"}),a.jsx(Fe,{id:"confirm-password",type:"password",value:N,onChange:D=>C(D.target.value)})]})]}),a.jsx(ye,{onClick:le,children:"Update Password"})]})]}),e.stripe_subscription_id&&a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsx(Je,{children:"Billing & Invoices"}),a.jsx(mn,{children:"Manage your payment methods and view invoices"})]}),a.jsx(Be,{className:"space-y-4",children:a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:a.jsx("p",{children:"Access your complete billing history and manage payment methods through the Stripe Customer Portal."})}),a.jsxs(ye,{variant:"outline",onClick:()=>u(),disabled:d,children:[d?a.jsx(St,{className:"h-4 w-4 animate-spin mr-2"}):null,"Open Billing Portal"]})]})})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Yve,{className:"h-5 w-5"}),"Data Backup"]}),a.jsx(mn,{children:"Download a complete backup of all your data. Your data belongs to you."})]}),a.jsx(Be,{className:"space-y-4",children:a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Includes: Thesis drafts, library documents, summaries, research setups, qualitative coding data (as CSV), and all notes."}),M&&a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(sb,{className:"h-3 w-3"}),"Last backup:"," ",new Date(M).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),a.jsx(ye,{onClick:he,disabled:k,children:k?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"h-4 w-4 animate-spin mr-2"}),"Creating Backup..."]}):a.jsxs(a.Fragment,{children:[a.jsx(mo,{className:"h-4 w-4 mr-2"}),"Download Backup"]})})]})})]}),a.jsxs(Me,{className:"border-destructive",children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2 text-destructive",children:[a.jsx(Ts,{className:"h-5 w-5"}),"Danger Zone"]}),a.jsx(mn,{children:"These actions are irreversible. Please be careful."})]}),a.jsx(Be,{children:a.jsxs(ji,{open:B,onOpenChange:D=>{P||(L(D),D||R())},children:[a.jsx(jo,{asChild:!0,children:a.jsx(ye,{variant:"destructive",children:"Delete Account"})}),a.jsxs(ei,{className:"max-w-lg",children:[a.jsxs(ti,{children:[a.jsxs(ni,{className:"flex items-center gap-2 text-destructive",children:[a.jsx(Ia,{className:"h-5 w-5"}),"Delete Account Permanently"]}),a.jsx(si,{asChild:!0,children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{children:["This action is ",a.jsx("strong",{className:"text-foreground",children:"irreversible"}),". The following will be permanently deleted:"]}),a.jsxs("ul",{className:"list-disc list-inside text-sm space-y-1",children:[a.jsx("li",{children:"All documents and PDFs"}),a.jsx("li",{children:"All summaries and analyses"}),a.jsx("li",{children:"All thesis drafts and chapters"}),a.jsx("li",{children:"Research setups and topic explorations"}),a.jsx("li",{children:"Qualitative coding data (interviews, codebooks)"}),a.jsx("li",{children:"Your profile and account data"})]}),a.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/50 p-3 rounded-md border border-amber-200 dark:border-amber-800",children:a.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[a.jsx("strong",{children:"Tip:"})," Download a backup of your data before deleting your account."]})}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(xo,{id:"confirm-delete",checked:K,onCheckedChange:D=>G(D===!0),disabled:P}),a.jsx(_e,{htmlFor:"confirm-delete",className:"text-sm leading-tight cursor-pointer",children:"I understand that all my data will be permanently deleted and this action cannot be undone"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"confirm-email",children:"Type your email to confirm:"}),a.jsx(Fe,{id:"confirm-email",placeholder:(t==null?void 0:t.email)||"",value:Y,onChange:D=>H(D.target.value),disabled:P,className:"font-mono text-sm"})]})]})})]}),a.jsxs(ri,{children:[a.jsx(Ls,{disabled:P,children:"Cancel"}),a.jsx(ye,{variant:"destructive",onClick:U,disabled:!K||Y!==(t==null?void 0:t.email)||P,children:P?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"h-4 w-4 animate-spin mr-2"}),A||"Deleting..."]}):"Delete Account Permanently"})]})]})]})})]})]})})};async function Hfe(t){const e={kind:"generic"};try{if((t==null?void 0:t.name)==="FunctionsHttpError"&&(t==null?void 0:t.context)instanceof Response){const n=t.context,s=n.status,i=await n.clone().text(),o=i.toLowerCase();if(s===429||o.includes("429")||o.includes("tpm")||o.includes("too large")||o.includes("tokens per min")||o.includes("request too large")||o.includes("rate_limit")||o.includes("context_length_exceeded")||o.includes("maximum context length"))return{kind:"page_limit",status:s,serverMessage:i};if(s===401||s===403)return{kind:"unauthorized",status:s,serverMessage:i};try{const l=JSON.parse(i),c=l.error||l.details||l.message||"",u=c.toLowerCase();if(u.includes("429")||u.includes("tpm")||u.includes("too large")||u.includes("tokens per min")||u.includes("rate_limit"))return{kind:"page_limit",status:s,serverMessage:c}}catch{}return{kind:"generic",status:s,serverMessage:i}}const r=((t==null?void 0:t.message)||"").toLowerCase();if(r.includes("429")||r.includes("tpm")||r.includes("too large")||r.includes("tokens per min")||r.includes("request too large"))return{kind:"page_limit",serverMessage:t==null?void 0:t.message}}catch(r){console.error("Error parsing edge function error:",r)}return e}const NK=t=>t.is_extracted===!0?!0:t.page_count==null||t.extracted_pages==null?!1:t.page_count-t.extracted_pages<3;function Wfe({documents:t,selectedDocuments:e,onToggle:r,onUploadClick:n,emptyMessage:s="No documents available.",uploadLabel:i="Upload Document",className:o}){const l=gr(),[c,u]=S.useState(null),d=()=>{t.forEach(g=>{e.includes(g.id)||r(g.id)})},h=()=>{e.forEach(g=>r(g))},f=g=>{!NK(g)&&!e.includes(g.id)?u(g):r(g.id)},p=()=>{c&&l(`/pdf-extract?document=${c.id}`),u(null)};return t.length===0?a.jsx("div",{className:Ie("rounded-xl border border-border/50 bg-muted/30 p-6",o),children:a.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-3",children:[a.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:a.jsx(Nr,{className:"h-6 w-6 text-muted-foreground"})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:s}),n&&a.jsx(ye,{variant:"outline",size:"sm",onClick:n,children:i})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:Ie("space-y-3",o),children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.length," of ",t.length," selected"]}),a.jsxs("div",{className:"flex gap-1",children:[a.jsxs(ye,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:d,disabled:e.length===t.length,children:[a.jsx(yn,{className:"h-3 w-3 mr-1"}),"All"]}),a.jsxs(ye,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:h,disabled:e.length===0,children:[a.jsx(En,{className:"h-3 w-3 mr-1"}),"None"]})]})]}),a.jsx(Yj,{className:"h-[280px] rounded-xl border border-border/50 bg-gradient-to-b from-background to-muted/20",children:a.jsx("div",{className:"p-2 space-y-0.5",children:t.map(g=>{const m=e.includes(g.id),x=NK(g);return a.jsxs("label",{htmlFor:`doc-${g.id}`,className:Ie("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer transition-all duration-200","hover:bg-primary/5 group",m&&"bg-primary/10 border border-primary/20"),onClick:y=>{y.preventDefault(),f(g)},children:[a.jsx(xo,{id:`doc-${g.id}`,checked:m,onCheckedChange:()=>f(g),className:"h-3.5 w-3.5 data-[state=checked]:bg-primary data-[state=checked]:border-primary",onClick:y=>y.stopPropagation()}),a.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1.5",children:[a.jsx(Nr,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("p",{className:Ie("text-xs font-medium truncate transition-colors",m?"text-foreground":"text-muted-foreground group-hover:text-foreground"),children:g.title||g.original_filename}),a.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:["(",g.page_count||"?"," pages)"]}),!x&&a.jsx(Ai,{children:a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Ia,{className:"w-3 h-3 text-destructive shrink-0"})}),a.jsx(Vt,{children:a.jsxs("p",{children:["Document needs extraction (",g.extracted_pages||0,"/",g.page_count||"?",")"]})})]})})]})]},g.id)})})})]}),a.jsx(ji,{open:!!c,onOpenChange:g=>!g&&u(null),children:a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsxs(ni,{className:"flex items-center gap-2",children:[a.jsx(Ia,{className:"h-5 w-5 text-destructive"}),"Document Not Extracted"]}),a.jsxs(si,{className:"space-y-2",children:[a.jsxs("p",{children:["The document ",a.jsxs("strong",{children:['"',(c==null?void 0:c.title)||(c==null?void 0:c.original_filename),'"']})," has not been fully extracted yet."]}),a.jsxs("p",{children:["Only ",(c==null?void 0:c.extracted_pages)||0," of ",(c==null?void 0:c.page_count)||"?"," pages have been processed. Text content from unextracted pages will not be available for AI processing."]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Please extract the document first to ensure all pages are available."})]})]}),a.jsxs(ri,{className:"flex-col sm:flex-row gap-2",children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(ye,{variant:"outline",onClick:()=>{c&&r(c.id),u(null)},children:"Use Anyway"}),a.jsx(Os,{onClick:p,children:"Extract Now"})]})]})})]})}const Jut=()=>{const{user:t,loading:e,checkStudentPoints:r,studentPoints:n,fetchStudentPoints:s}=Pt(),[i,o]=S.useState(!1),l=gr(),{toast:c}=on(),[u,d]=S.useState([]),[h,f]=S.useState([]),[p,g]=S.useState({}),[m,x]=S.useState({}),[y,v]=S.useState(""),[b,w]=S.useState("small"),[j,N]=S.useState("en"),[C,k]=S.useState("fox41"),[E,M]=S.useState(null),[z,P]=S.useState("APA7"),[V,A]=S.useState(!1),[$,K]=S.useState(null),[G,Y]=S.useState(null),[H,B]=S.useState(!1),[L,F]=S.useState([]),[W,X]=S.useState(""),[oe,le]=S.useState([]),[U,R]=S.useState(!1),[ee,te]=S.useState(""),[Z,J]=S.useState(""),[he,O]=S.useState(!1);S.useEffect(()=>{!t&&!e&&l("/login")},[t,e,l]),S.useEffect(()=>{t&&(T(),ie())},[t]),S.useEffect(()=>{W?q():(le([]),te(""))},[W]);const ie=async()=>{const{data:de}=await be.from("theses").select("id, title").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});F(de||[])},q=async()=>{const{data:de}=await be.from("chapters").select("id, title, order_index").eq("thesis_id",W).order("order_index");le(de||[])},I=async()=>{if(!(!ee||!$)){O(!0);try{const{data:de}=await be.from("sections").select("order_index").eq("chapter_id",ee).order("order_index",{ascending:!1}).limit(1),ge=de!=null&&de.length?de[0].order_index+1:0;await be.from("sections").insert({chapter_id:ee,content:$.content,title:Z.trim()||null,type:"other",order_index:ge,status:"open"}),c({title:"Successfully imported",description:"Saved as section in chapter."}),R(!1),J(""),te("")}catch{c({title:"Error with Import",variant:"destructive"})}finally{O(!1)}}},T=async()=>{try{const{data:de,error:ge}=await be.from("v_documents_with_status").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(ge)throw ge;d(de||[])}catch(de){console.error("Error loading documents:",de),c({title:"Error",description:"Could not load documents.",variant:"destructive"})}},D=async de=>{var je,Se;const{data:ge}=await be.from("pages").select("page_number").eq("document_id",de).order("page_number",{ascending:!0}).limit(1),{data:we}=await be.from("pages").select("page_number").eq("document_id",de).order("page_number",{ascending:!1}).limit(1);return{min:((je=ge==null?void 0:ge[0])==null?void 0:je.page_number)??1,max:((Se=we==null?void 0:we[0])==null?void 0:Se.page_number)??1}},ne=async de=>{if(h.includes(de))f(we=>we.filter(je=>je!==de)),g(we=>{const je={...we};return delete je[de],je}),x(we=>{const je={...we};return delete je[de],je});else{const we=await D(de);x(je=>({...je,[de]:we})),f(je=>[...je,de]),g(je=>({...je,[de]:{from:we.min,to:Math.min(we.max,we.min+14)}}))}},ue=()=>h.reduce((de,ge)=>{const we=p[ge];return we?de+(we.to-we.from+1):de},0),re=(de,ge=40)=>de.length>ge?de.substring(0,ge)+"...":de,pe=(de,ge,we)=>{const je=m[de]||{min:1,max:999},Se=p[de]||{from:je.min,to:Math.min(je.max,je.min+14)};let Ue=ge==="from"?we:Se.from,Ae=ge==="to"?we:Se.to;Ue=Math.max(je.min,Math.min(Ue,je.max)),Ae=Math.max(je.min,Math.min(Ae,je.max)),ge==="from"&&Ue>Ae&&(Ae=Ue),ge==="to"&&Ae<Ue&&(Ue=Ae),g(fe=>({...fe,[de]:{from:Ue,to:Ae}}))},ve=async()=>{var de,ge,we;if(!r()){o(!0);return}if(h.length===0){c({title:"Error",description:"Please select at least one document.",variant:"destructive"});return}if(y.length<5){c({title:"Error",description:"Topic must be at least 5 characters.",variant:"destructive"});return}A(!0);try{const je=C==="fox40"?"thesis_builder_fox40":"thesis_builder",{data:Se,error:Ue}=await be.functions.invoke(je,{body:{document_ids:h,page_ranges:p,topic:y,mode:b,language:j,citation_style:z,save_pdf:!1}});if(Ue)throw Ue;if((Se==null?void 0:Se.error)==="rate_limit"){const Ae=Se.retry_after||10;M(Ae);let fe=Ae;const Ee=setInterval(()=>{fe-=1,M(fe),fe<=0&&(clearInterval(Ee),M(null),A(!1),ve())},1e3);return}K(Se),B(!0),c({title:"Success",description:"Theory & Background generated!"}),t&&(await new Promise(Ae=>setTimeout(Ae,4e3)),await s(t.id)),Y({prompt:((de=Se==null?void 0:Se.usage)==null?void 0:de.prompt_tokens)??void 0,completion:((ge=Se==null?void 0:Se.usage)==null?void 0:ge.completion_tokens)??void 0,total:((we=Se==null?void 0:Se.usage)==null?void 0:we.total_tokens)??void 0}),B(!0),c({title:"Success",description:"Theory & Background generated!"})}catch(je){console.error("Error generating thesis:",je);const Se=await Hfe(je);Se.kind==="page_limit"?c({title:"Processing Limit Reached",description:"The document could not be processed due to page limits. Please try using fewer pages by adjusting the page selector or selecting fewer documents.",variant:"destructive"}):Se.kind==="unauthorized"?c({title:"Session Expired",description:"Your session has expired. Please log in again.",variant:"destructive"}):c({title:"Error",description:"Something went wrong while generating the text. Please try again in a moment.",variant:"destructive"})}finally{A(!1)}},xe=async de=>{try{await navigator.clipboard.writeText(de),c({title:"Copied",description:"Text copied to clipboard."})}catch{c({title:"Error",description:"Could not copy text.",variant:"destructive"})}},ae=()=>{l("/documents")};return e?a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsxs(er,{showSidebar:!0,children:[a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Theory & Background"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Generate academic paragraphs from your documents with automatic citations."})]})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Paragraph Configuration"})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Documents *"}),a.jsx(Wfe,{documents:u,selectedDocuments:h,onToggle:ne,onUploadClick:()=>l("/summary"),emptyMessage:"No documents available.",uploadLabel:"Upload Document"})]}),h.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(_e,{className:"text-sm font-medium",children:"Page Selection"}),a.jsxs("span",{className:`text-xs ${ue()>15?"text-red-500 font-medium":"text-muted-foreground"}`,children:[ue()," / 15 pages selected"]})]}),a.jsx("div",{className:"space-y-2",children:h.map(de=>{const ge=u.find(Ae=>Ae.id===de);if(!ge)return null;const we=p[de]||{from:1,to:Math.min(ge.page_count||1,15)},je=m[de]||{min:1,max:ge.page_count||1},Se=re(ge.title||ge.original_filename||"Document"),Ue=we.to-we.from+1;return a.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md",children:[a.jsx("span",{className:"text-xs text-muted-foreground flex-1 truncate",title:ge.title||ge.original_filename,children:Se}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"p."}),a.jsx(Fe,{type:"number",min:je.min,max:je.max,value:we.from,onChange:Ae=>{const fe=parseInt(Ae.target.value);isNaN(fe)||g(Ee=>({...Ee,[de]:{...Ee[de],from:fe}}))},onBlur:Ae=>pe(de,"from",parseInt(Ae.target.value)||je.min),className:"w-14 h-7 text-xs text-center px-1"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"–"}),a.jsx(Fe,{type:"number",min:je.min,max:je.max,value:we.to,onChange:Ae=>{const fe=parseInt(Ae.target.value);isNaN(fe)||g(Ee=>({...Ee,[de]:{...Ee[de],to:fe}}))},onBlur:Ae=>pe(de,"to",parseInt(Ae.target.value)||je.min),className:"w-14 h-7 text-xs text-center px-1"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["/ ",je.max]}),a.jsxs(gt,{variant:Ue>15?"destructive":"secondary",className:"text-xs ml-1",children:[Ue,"p"]})]})]},de)})}),ue()>15&&a.jsxs(nd,{className:"border-red-500/50 bg-red-500/10",children:[a.jsx(Ia,{className:"h-4 w-4 text-red-600"}),a.jsx(sd,{className:"text-red-700 dark:text-red-400 text-xs",children:"Maximum 15 pages total across all documents. Please reduce your selection."})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"topic",children:"Topic / Research Question *"}),a.jsx(Ht,{id:"topic",value:y,onChange:de=>v(de.target.value),className:"min-h-[100px]",placeholder:"Describe your topic or research question..."}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[y.length,"/5 characters (minimum 5 required)"]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Mode"}),a.jsxs(at,{value:b,onValueChange:w,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"small",children:"Short (300 Tokens)"}),a.jsx(Te,{value:"medium",children:"Medium (600 Tokens)"}),a.jsx(Te,{value:"big",children:"Long (1200 Tokens)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(at,{value:j,onValueChange:N,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"de",children:"Deutsch"}),a.jsx(Te,{value:"en",children:"English"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Citation Style"}),a.jsxs(at,{value:z,onValueChange:P,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"APA7",children:"APA7"}),a.jsx(Te,{value:"Harvard",children:"Harvard"}),a.jsx(Te,{value:"Chicago",children:"Chicago"}),a.jsx(Te,{value:"MLA",children:"MLA"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"AI Model"}),a.jsx(Ai,{children:a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Wm,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),a.jsxs(Vt,{side:"top",className:"max-w-xs text-xs space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Fox 4.0:"})," Faster, lower SP consumption"]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Fox 4.1:"})," Higher quality, more SP consumption"]})]})]})})]}),a.jsxs(at,{value:C,onValueChange:k,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"fox41",children:"Fox 4.1 — Advanced"}),a.jsx(Te,{value:"fox40",children:"Fox 4.0 — Fast"})]})]})]}),a.jsx(ye,{onClick:ve,disabled:V||h.length===0||y.length<5||ue()>15,className:"w-full",children:E!==null?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Retrying in ",E,"s..."]}):V?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating..."]}):"Generate Paragraph"})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Result"})}),a.jsx(Be,{children:$?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-lg mb-2",children:$.title}),a.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:h.map(de=>{const ge=u.find(we=>we.id===de);return ge?a.jsx(gt,{variant:"secondary",className:"text-xs",children:ge.title||ge.original_filename},de):null})}),a.jsxs(gt,{variant:"outline",className:"text-xs",children:[b.charAt(0).toUpperCase()+b.slice(1)," | ",z," |"," ",new Date().toLocaleDateString("en-US")]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Generated Text"}),a.jsx("div",{className:"prose prose-sm max-w-none whitespace-pre-wrap",children:$.content.split(/Originaltextstellen:|Proof of Material:|Original quotes:/)[0].split("---")[0].trim()})]}),($.content.includes("Originaltextstellen")||$.content.includes("Proof of Material")||$.content.includes("Original quotes"))&&a.jsxs(a.Fragment,{children:[a.jsx(Ps,{}),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-semibold mb-3 flex items-center gap-2",children:[a.jsx(ab,{className:"h-4 w-4"}),"Original Quotes",a.jsx(gt,{variant:"outline",className:"text-xs font-normal",children:"Original Language"})]}),a.jsx("div",{className:"space-y-2",children:(()=>{var je,Se,Ue,Ae;let de=$.content.split("Originaltextstellen:")[1];de||(de=$.content.split("Original quotes:")[1]),de||(de=$.content.split("Proof of Material:")[1]);const ge=(Ae=(Ue=(Se=(je=de==null?void 0:de.split("---")[0])==null?void 0:je.split("=== APA7 Literatur ===")[0])==null?void 0:Se.split("## Literaturverzeichnis")[0])==null?void 0:Ue.split("## References")[0])==null?void 0:Ae.trim();if(!ge)return a.jsx("p",{className:"text-sm text-muted-foreground",children:"No original quotes available"});const we=ge.split(/\n(?=["„]|[A-Z][a-zäöü]+,?\s+\d{4})/).filter(fe=>fe.trim());return we.length>0?we.map((fe,Ee)=>a.jsx("div",{className:"bg-muted/50 border-l-4 border-primary/30 p-3 rounded-r-md",children:a.jsx("p",{className:"text-sm italic whitespace-pre-wrap",children:fe.trim()})},Ee)):a.jsx("div",{className:"bg-muted/50 border-l-4 border-primary/30 p-3 rounded-r-md",children:a.jsx("p",{className:"text-sm italic whitespace-pre-wrap",children:ge})})})()})]})]}),($.content.includes("Literaturverzeichnis")||$.content.includes("=== APA7 Literatur ===")||$.content.includes("References"))&&a.jsxs(a.Fragment,{children:[a.jsx(Ps,{}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"References"}),a.jsx("div",{className:"prose prose-sm max-w-none whitespace-pre-wrap bg-muted p-3 rounded-md text-sm",children:(()=>{let de=$.content.split("=== APA7 Literatur ===")[1];return de||(de=$.content.split("## Literaturverzeichnis")[1]),de||(de=$.content.split("## References")[1]),(de==null?void 0:de.trim())||(Array.isArray($.literature)?$.literature.join(`
`):$.literature)})()})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>xe($.content),children:[a.jsx(bn,{className:"mr-2 h-4 w-4"}),"Copy"]}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>R(!0),disabled:!$,children:[a.jsx(Oj,{className:"mr-2 h-4 w-4"}),"Import to Chapter"]}),a.jsxs(ye,{variant:"outline",size:"sm",disabled:!0,className:"opacity-50 cursor-not-allowed",children:[a.jsx(Nr,{className:"mr-2 h-4 w-4"}),"Create PDF (disabled)"]}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:ae,children:[a.jsx(Nr,{className:"mr-2 h-4 w-4"}),"View in Library"]})]})]}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Nr,{className:"mx-auto h-12 w-12 text-muted-foreground mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:'Configure the parameters on the left and click "Generate Paragraph".'})]})})]})]})]}),a.jsx(qr,{open:U,onOpenChange:R,children:a.jsxs(Dr,{children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Als Section importieren"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Thesis"}),a.jsxs(at,{value:W,onValueChange:X,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select thesis..."})}),a.jsx(st,{children:L.map(de=>a.jsx(Te,{value:de.id,children:de.title},de.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Target Chapter"}),a.jsxs(at,{value:ee,onValueChange:te,disabled:!W,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:W?"Select chapter...":"Select thesis first"})}),a.jsx(st,{children:oe.map(de=>a.jsx(Te,{value:de.id,children:de.title},de.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Section-Titel (optional)"}),a.jsx(Fe,{value:Z,onChange:de=>J(de.target.value),placeholder:"z.B. Theoretischer Hintergrund"})]})]}),a.jsxs(yf,{children:[a.jsx(ye,{variant:"outline",onClick:()=>R(!1),children:"Abbrechen"}),a.jsx(ye,{onClick:I,disabled:!ee||he,children:he?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Importiere..."]}):a.jsxs(a.Fragment,{children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"Importieren"]})})]})]})}),a.jsx(Pc,{open:i,onClose:()=>o(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]}):null},edt=()=>{const{user:t,loading:e,checkStudentPoints:r,studentPoints:n,fetchStudentPoints:s}=Pt(),[i,o]=S.useState(!1),l=gr(),{toast:c}=on(),[u,d]=S.useState([]),[h,f]=S.useState([]),[p,g]=S.useState({}),[m,x]=S.useState({}),[y,v]=S.useState("fox41"),[b,w]=S.useState(null),[j,N]=S.useState(""),[C,k]=S.useState("de"),[E,M]=S.useState("APA7"),[z,P]=S.useState(""),[V,A]=S.useState("small"),[$,K]=S.useState(0),[G,Y]=S.useState(null),[H,B]=S.useState(!1),[L,F]=S.useState(!1),[W,X]=S.useState(null),[oe,le]=S.useState([]),[U,R]=S.useState(""),[ee,te]=S.useState([]),[Z,J]=S.useState(!1),[he,O]=S.useState(""),[ie,q]=S.useState(""),[I,T]=S.useState(!1);S.useEffect(()=>{!t&&!e&&l("/login")},[t,e,l]),S.useEffect(()=>{t&&(we(),D())},[t]),S.useEffect(()=>{U?ne():(te([]),O(""))},[U]);const D=async()=>{const{data:Ne}=await be.from("theses").select("id, title").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});le(Ne||[])},ne=async()=>{const{data:Ne}=await be.from("chapters").select("id, title, order_index").eq("thesis_id",U).order("order_index");te(Ne||[])},ue=async()=>{if(!(!he||!W)){T(!0);try{const{data:Ne}=await be.from("sections").select("order_index").eq("chapter_id",he).order("order_index",{ascending:!1}).limit(1),Ze=Ne!=null&&Ne.length?Ne[0].order_index+1:0;await be.from("sections").insert({chapter_id:he,content:W.content,title:ie.trim()||null,type:"other",order_index:Ze,status:"open"}),c({title:"Successfully imported",description:"Saved as section in chapter."}),J(!1),q(""),O("")}catch{c({title:"Fehler beim Import",variant:"destructive"})}finally{T(!1)}}},re={small:{wordMin:200,wordMax:380,proofSnippets:1,overheadTokens:400},medium:{wordMin:350,wordMax:700,proofSnippets:2,overheadTokens:500},big:{wordMin:650,wordMax:1e3,proofSnippets:3,overheadTokens:650}},pe=Ne=>Math.round(Ne*1.4),ve=Ne=>Math.round(Ne/4),xe=1e3;function ae(Ne,Ze,Ke){const Xe=re[Ne]??re.small,Ye=pe((Xe.wordMin+Xe.wordMax)/2),Ve=Math.max(1,Ze*Math.max(1,Ke))*xe,mt=ve(Ve),Et=Xe.overheadTokens+mt;return{prompt:Et,completion:Ye,total:Et+Ye}}const de=()=>{if(h.length===0)return{tokens:{prompt:0,completion:0,total:0}};const Ne=h.map(Xe=>{var Ye;return((Ye=u.find(Ct=>Ct.id===Xe))==null?void 0:Ye.page_count)||0}),Ze=Math.max(1,Math.round(Ne.reduce((Xe,Ye)=>Xe+Ye,0)/(Ne.length||1))||5);return{tokens:ae(V,h.length,Ze)}},ge=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Ne=>{const Ze=(crypto.getRandomValues(new Uint8Array(1))[0]&15)>>0;return(Ne==="x"?Ze:Ze&3|8).toString(16)});S.useEffect(()=>{const Ne=de();K(Ne.tokens.total)},[V,h,u]);const we=async()=>{try{const{data:Ne,error:Ze}=await be.from("v_documents_with_status").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(Ze)throw Ze;d(Ne||[])}catch(Ne){console.error("Error loading documents:",Ne),c({title:"Error",description:"Documents could not be loaded.",variant:"destructive"})}},je=async Ne=>{var Xe,Ye;const{data:Ze}=await be.from("pages").select("page_number").eq("document_id",Ne).order("page_number",{ascending:!0}).limit(1),{data:Ke}=await be.from("pages").select("page_number").eq("document_id",Ne).order("page_number",{ascending:!1}).limit(1);return{min:((Xe=Ze==null?void 0:Ze[0])==null?void 0:Xe.page_number)??1,max:((Ye=Ke==null?void 0:Ke[0])==null?void 0:Ye.page_number)??1}},Se=async Ne=>{if(h.includes(Ne))f(Ke=>Ke.filter(Xe=>Xe!==Ne)),g(Ke=>{const Xe={...Ke};return delete Xe[Ne],Xe}),x(Ke=>{const Xe={...Ke};return delete Xe[Ne],Xe});else{const Ke=await je(Ne);x(Xe=>({...Xe,[Ne]:Ke})),f(Xe=>[...Xe,Ne]),g(Xe=>({...Xe,[Ne]:{from:Ke.min,to:Math.min(Ke.max,Ke.min+14)}}))}},Ue=()=>h.reduce((Ne,Ze)=>{const Ke=p[Ze];return Ke?Ne+(Ke.to-Ke.from+1):Ne},0),Ae=(Ne,Ze=40)=>Ne.length>Ze?Ne.substring(0,Ze)+"...":Ne,fe=(Ne,Ze,Ke)=>{const Xe=m[Ne]||{min:1,max:999},Ye=p[Ne]||{from:Xe.min,to:Math.min(Xe.max,Xe.min+14)};let Ct=Ze==="from"?Ke:Ye.from,Ve=Ze==="to"?Ke:Ye.to;Ct=Math.max(Xe.min,Math.min(Ct,Xe.max)),Ve=Math.max(Xe.min,Math.min(Ve,Xe.max)),Ze==="from"&&Ct>Ve&&(Ve=Ct),Ze==="to"&&Ve<Ct&&(Ct=Ve),g(mt=>({...mt,[Ne]:{from:Ct,to:Ve}}))},Ee=async()=>{var Ne,Ze,Ke;if(!r()){o(!0);return}if(!j.trim()){c({title:"Error",description:"Please enter a topic.",variant:"destructive"});return}B(!0);try{const Xe=y==="fox40"?"methodology_builder_fox40":"methodology_builder",{data:Ye,error:Ct}=await be.functions.invoke(Xe,{body:{document_ids:h,page_ranges:p,topic:j.trim(),language:C,citation_style:E,own_words:z.trim(),mode:V,client_request_id:ge()}});if(Ct)throw Ct;if((Ye==null?void 0:Ye.error)==="rate_limit"){const Ve=Ye.retry_after||10;w(Ve);let mt=Ve;const Et=setInterval(()=>{mt-=1,w(mt),mt<=0&&(clearInterval(Et),w(null),B(!1),Ee())},1e3);return}X(Ye),Y({prompt:((Ne=Ye==null?void 0:Ye.usage)==null?void 0:Ne.prompt_tokens)??void 0,completion:((Ze=Ye==null?void 0:Ye.usage)==null?void 0:Ze.completion_tokens)??void 0,total:((Ke=Ye==null?void 0:Ye.usage)==null?void 0:Ke.total_tokens)??void 0}),t&&(await new Promise(Ve=>setTimeout(Ve,4e3)),await s(t.id)),c({title:"Success",description:Ye.saved_to_library?"Methods & Approach generated and saved to library!":"Methods & Approach was generated!"})}catch(Xe){console.error("Error generating methodology:",Xe);const Ye=await Hfe(Xe);Ye.kind==="page_limit"?c({title:"Processing Limit Reached",description:"The document could not be processed due to page limits. Please try using fewer pages by adjusting the page selector or selecting fewer documents.",variant:"destructive"}):Ye.kind==="unauthorized"?c({title:"Session Expired",description:"Your session has expired. Please log in again.",variant:"destructive"}):c({title:"Error",description:"Something went wrong while generating the text. Please try again in a moment.",variant:"destructive"})}finally{B(!1)}},Ce=async()=>{if(!(!W||!z.trim())){F(!0);try{const{data:Ne,error:Ze}=await be.functions.invoke("methodology_builder",{body:{action:"refine",draft:W,own_words:z.trim(),language:C}});if(Ze)throw Ze;X(Ne),c({title:"Success",description:"Draft has been refined and merged!"})}catch(Ne){console.error("Error refining methodology:",Ne),c({title:"Error",description:Ne.message||"Error refining the draft.",variant:"destructive"})}finally{F(!1)}}},Ge=async Ne=>{try{await navigator.clipboard.writeText(Ne),c({title:"Copied",description:"Text has been copied to clipboard."})}catch{c({title:"Error",description:"Text could not be copied.",variant:"destructive"})}},ht=()=>{l("/documents")};return e?a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsxs(er,{showSidebar:!0,children:[a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Methods & Approach"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Develop a structured methodology based on your literature and your own approach."})]})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Paragraph Configuration"})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Sources (optional)"}),a.jsx(Wfe,{documents:u,selectedDocuments:h,onToggle:Se,onUploadClick:()=>l("/summary"),emptyMessage:"No documents available.",uploadLabel:"Upload Document"})]}),h.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(_e,{className:"text-sm font-medium",children:"Page Selection"}),a.jsxs("span",{className:`text-xs ${Ue()>15?"text-red-500 font-medium":"text-muted-foreground"}`,children:[Ue()," / 15 pages selected"]})]}),a.jsx("div",{className:"space-y-2",children:h.map(Ne=>{const Ze=u.find(Ve=>Ve.id===Ne);if(!Ze)return null;const Ke=m[Ne]||{min:1,max:Ze.page_count||1},Xe=p[Ne]||{from:Ke.min,to:Math.min(Ke.max,Ke.min+14)},Ye=Ae(Ze.title||Ze.original_filename||"Document"),Ct=Xe.to-Xe.from+1;return a.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md",children:[a.jsx("span",{className:"text-xs text-muted-foreground flex-1 truncate",children:Ye}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"p."}),a.jsx(Fe,{type:"number",min:Ke.min,max:Ke.max,value:Xe.from,onChange:Ve=>{const mt=parseInt(Ve.target.value);isNaN(mt)||g(Et=>({...Et,[Ne]:{...Et[Ne],from:mt}}))},onBlur:Ve=>fe(Ne,"from",parseInt(Ve.target.value)||Ke.min),className:"w-14 h-7 text-xs text-center px-1"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"–"}),a.jsx(Fe,{type:"number",min:Ke.min,max:Ke.max,value:Xe.to,onChange:Ve=>{const mt=parseInt(Ve.target.value);isNaN(mt)||g(Et=>({...Et,[Ne]:{...Et[Ne],to:mt}}))},onBlur:Ve=>fe(Ne,"to",parseInt(Ve.target.value)||Ke.min),className:"w-14 h-7 text-xs text-center px-1"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["/ ",Ke.max]}),a.jsxs(gt,{variant:Ct>15?"destructive":"secondary",className:"text-xs ml-1",children:[Ct,"p"]})]})]},Ne)})}),Ue()>15&&a.jsxs(nd,{className:"border-red-500/50 bg-red-500/10",children:[a.jsx(Ia,{className:"h-4 w-4 text-red-600"}),a.jsx(sd,{className:"text-red-700 dark:text-red-400 text-xs",children:"Maximum 15 pages total across all documents."})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"topic",children:"Topic / Focus *"}),a.jsx(Fe,{id:"topic",placeholder:"e.g. Mixed-methods evaluation of burnout prevention in nursing",value:j,onChange:Ne=>N(Ne.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(at,{value:C,onValueChange:k,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"de",children:"DE"}),a.jsx(Te,{value:"en",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Citation Style"}),a.jsxs(at,{value:E,onValueChange:M,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsx(st,{children:a.jsx(Te,{value:"APA7",children:"APA7"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Mode"}),a.jsxs(at,{value:V,onValueChange:A,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"small",children:"Short"}),a.jsx(Te,{value:"medium",children:"Medium"}),a.jsx(Te,{value:"big",children:"Long"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"ownProcedure",children:"Your Approach (optional)"}),a.jsx(Ht,{id:"ownProcedure",value:z,onChange:Ne=>P(Ne.target.value),className:"min-h-[120px]",placeholder:"Describe your own steps (sampling, tools, timeline, limitations, etc.)"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"AI Model"}),a.jsx(Ai,{children:a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Wm,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),a.jsxs(Vt,{side:"top",className:"max-w-xs text-xs space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Fox 4.0:"})," Faster, lower SP consumption"]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Fox 4.1:"})," Higher quality, more SP consumption"]})]})]})})]}),a.jsxs(at,{value:y,onValueChange:v,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"fox41",children:"Fox 4.1 — Advanced"}),a.jsx(Te,{value:"fox40",children:"Fox 4.0 — Fast"})]})]})]}),a.jsx(ye,{onClick:Ee,disabled:H||!j.trim()||Ue()>15,className:"w-full",children:b!==null?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Retrying in ",b,"s..."]}):H?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating Draft..."]}):"Generate Draft"})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Results"})}),a.jsx(Be,{children:W?a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{children:a.jsx("h3",{className:"font-semibold text-lg mb-2",children:W.title})}),a.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:a.jsx(fc,{components:{h1:({children:Ne})=>a.jsx("h1",{className:"text-lg font-semibold mt-6 mb-3 first:mt-0",children:Ne}),h2:({children:Ne})=>a.jsx("h2",{className:"text-base font-semibold mt-5 mb-2",children:Ne}),p:({children:Ne})=>a.jsx("p",{className:"mb-3 leading-relaxed",children:Ne}),ul:({children:Ne})=>a.jsx("ul",{className:"mb-3 ml-4 list-disc",children:Ne}),ol:({children:Ne})=>a.jsx("ol",{className:"mb-3 ml-4 list-decimal",children:Ne}),li:({children:Ne})=>a.jsx("li",{className:"mb-1",children:Ne})},children:W.content.split(/Originaltextstellen:|Proof of Material:|Original quotes:/)[0].split("---")[0].trim()})}),(W.content.includes("Originaltextstellen")||W.content.includes("Proof of Material")||W.content.includes("Original quotes"))&&a.jsxs(a.Fragment,{children:[a.jsx(Ps,{}),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-semibold mb-3 flex items-center gap-2",children:[a.jsx(ab,{className:"h-4 w-4"}),"Original Quotes",a.jsx(gt,{variant:"outline",className:"text-xs font-normal",children:"Original Language"})]}),a.jsx("div",{className:"space-y-2",children:(()=>{var Xe,Ye,Ct,Ve;let Ne=W.content.split("Originaltextstellen:")[1];Ne||(Ne=W.content.split("Original quotes:")[1]),Ne||(Ne=W.content.split("Proof of Material:")[1]);const Ze=(Ve=(Ct=(Ye=(Xe=Ne==null?void 0:Ne.split("---")[0])==null?void 0:Xe.split("=== APA7 Literatur ===")[0])==null?void 0:Ye.split("## Literaturverzeichnis")[0])==null?void 0:Ct.split("## References")[0])==null?void 0:Ve.trim();if(!Ze)return a.jsx("p",{className:"text-sm text-muted-foreground",children:"No original quotes available"});const Ke=Ze.split(/\n(?=["„]|[A-Z][a-zäöü]+,?\s+\d{4})/).filter(mt=>mt.trim());return Ke.length>0?Ke.map((mt,Et)=>a.jsx("div",{className:"bg-muted/50 border-l-4 border-primary/30 p-3 rounded-r-md",children:a.jsx("p",{className:"text-sm italic whitespace-pre-wrap",children:mt.trim()})},Et)):a.jsx("div",{className:"bg-muted/50 border-l-4 border-primary/30 p-3 rounded-r-md",children:a.jsx("p",{className:"text-sm italic whitespace-pre-wrap",children:Ze})})})()})]})]}),a.jsx(Ps,{}),W.literature&&W.literature.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"References"}),a.jsx("div",{className:"text-sm space-y-1",children:W.literature.map((Ne,Ze)=>a.jsx("div",{className:"text-sm text-muted-foreground",children:Ne},Ze))})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[z.trim()&&a.jsxs(ye,{variant:"outline",size:"sm",onClick:Ce,disabled:L,children:[L?a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(eee,{className:"mr-2 h-4 w-4"}),"Refine & Merge"]}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>{var Ne;return Ge(`${W.title}
${W.content}
References:
${((Ne=W.literature)==null?void 0:Ne.join(`
`))||""}`)},children:[a.jsx(bn,{className:"mr-2 h-4 w-4"}),"Copy All"]}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>J(!0),disabled:!W,children:[a.jsx(Oj,{className:"mr-2 h-4 w-4"}),"Import to Chapter"]}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:ht,children:[a.jsx(Nr,{className:"mr-2 h-4 w-4"}),"Go to Library"]})]})]}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Nr,{className:"mx-auto h-12 w-12 text-muted-foreground mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:'Fill in the parameters on the left and click "Generate Draft".'})]})})]})]})]}),a.jsx(qr,{open:Z,onOpenChange:J,children:a.jsxs(Dr,{children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Als Section importieren"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Thesis"}),a.jsxs(at,{value:U,onValueChange:R,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select thesis..."})}),a.jsx(st,{children:oe.map(Ne=>a.jsx(Te,{value:Ne.id,children:Ne.title},Ne.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Target Chapter"}),a.jsxs(at,{value:he,onValueChange:O,disabled:!U,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:U?"Select Chapter...":"Select thesis first"})}),a.jsx(st,{children:ee.map(Ne=>a.jsx(Te,{value:Ne.id,children:Ne.title},Ne.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Section Title (optional)"}),a.jsx(Fe,{value:ie,onChange:Ne=>q(Ne.target.value),placeholder:"e.g. Methodology & Approach"})]})]}),a.jsxs(yf,{children:[a.jsx(ye,{variant:"outline",onClick:()=>J(!1),children:"Abbrechen"}),a.jsx(ye,{onClick:ue,disabled:!he||I,children:I?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Importiere..."]}):a.jsxs(a.Fragment,{children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"Importieren"]})})]})]})}),a.jsx(Pc,{open:i,onClose:()=>o(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]}):null},tdt=["introduction","einleitung","methodology","methodik","methods","methoden","findings","ergebnisse","results","auswertung","analyse","analysis","interviews","discussion","diskussion","stand des wissens","theoretischer hintergrund","literature","literatur","theory","theorie"],rdt=()=>{const{user:t,loading:e,checkStudentPoints:r,studentPoints:n}=Pt(),[s,i]=S.useState(!1),o=gr(),{toast:l}=on(),[c,u]=S.useState([]),[d,h]=S.useState([]),[f,p]=S.useState(""),[g,m]=S.useState([]),[x,y]=S.useState("en"),[v,b]=S.useState("medium"),[w,j]=S.useState(!1),[N,C]=S.useState(null),[k,E]=S.useState(!1),[M,z]=S.useState(""),[P,V]=S.useState(""),[A,$]=S.useState(!1);S.useEffect(()=>{!t&&!e&&o("/login")},[t,e,o]),S.useEffect(()=>{t&&K()},[t]),S.useEffect(()=>{f&&(G(f),m([]),C(null))},[f]);const K=async()=>{try{const{data:X,error:oe}=await be.from("theses").select("id, title, degree").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(oe)throw oe;u(X||[]),X&&X.length>0&&!f&&p(X[0].id)}catch(X){console.error("Error loading theses:",X),l({title:"Error",description:"Could not load theses.",variant:"destructive"})}},G=async X=>{try{const{data:oe,error:le}=await be.from("chapters").select("id, title, order_index").eq("thesis_id",X).is("parent_id",null).order("order_index",{ascending:!0});if(le)throw le;const{data:U,error:R}=await be.from("sections").select("chapter_id, word_count").in("chapter_id",(oe||[]).map(Z=>Z.id));if(R)throw R;const ee={};(U||[]).forEach(Z=>{ee[Z.chapter_id]=(ee[Z.chapter_id]||0)+Z.word_count});const te=(oe||[]).map(Z=>({...Z,word_count:ee[Z.id]||0,isRecommended:tdt.some(J=>Z.title.toLowerCase().includes(J))}));h(te)}catch(oe){console.error("Error loading chapters:",oe),l({title:"Error",description:"Could not load chapters.",variant:"destructive"})}},Y=X=>{m(oe=>oe.includes(X)?oe.filter(le=>le!==X):[...oe,X])},H=S.useMemo(()=>d.filter(X=>X.word_count>0),[d]),B=async()=>{var X;if(!r()){i(!0);return}if(g.length===0){l({title:"Error",description:"Please select at least one chapter.",variant:"destructive"});return}j(!0);try{const{data:oe,error:le}=await be.functions.invoke("discussion_builder",{body:{thesis_id:f,chapter_ids:g,language:x,mode:v}});if(le)throw le;const U=(oe==null?void 0:oe.content)||(oe==null?void 0:oe.discussion_text)||((X=oe==null?void 0:oe.data)==null?void 0:X.content);if(console.log("Discussion response:",oe),typeof U=="string")C(U);else if(U!=null&&U.discussion_text)C(U.discussion_text);else throw new Error("Invalid response format");l({title:"Success",description:"Discussion generated successfully!"})}catch(oe){console.error("Error generating discussion:",oe),l({title:"Error",description:oe.message||"Error generating discussion.",variant:"destructive"})}finally{j(!1)}},L=async()=>{if(N)try{await navigator.clipboard.writeText(N),l({title:"Copied",description:"Text copied to clipboard."})}catch{l({title:"Error",description:"Could not copy text.",variant:"destructive"})}},F=async()=>{if(!(!N||!M)){$(!0);try{const{data:X,error:oe}=await be.from("sections").select("order_index").eq("chapter_id",M).order("order_index",{ascending:!1}).limit(1);if(oe)throw oe;const le=X&&X.length>0?X[0].order_index+1:0,{error:U}=await be.from("sections").insert({chapter_id:M,content:N,title:P.trim()||null,type:"other",order_index:le,status:"open"});if(U)throw U;l({title:"Imported",description:"Discussion imported as section."}),E(!1),V(""),z("")}catch(X){console.error("Error importing section:",X),l({title:"Error",description:X.message||"Error importing.",variant:"destructive"})}finally{$(!1)}}},W={small:"Short (~500 words)",medium:"Medium (~1000 words)",big:"Long (~2000 words)"};return e?a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsxs(er,{showSidebar:!0,children:[a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Discussion Generator"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Generate a discussion based on your thesis chapters."})]})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Settings"})}),a.jsxs(Be,{className:"space-y-5",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Thesis"}),a.jsxs(at,{value:f,onValueChange:p,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select thesis..."})}),a.jsx(st,{children:c.map(X=>a.jsx(Te,{value:X.id,children:X.title},X.id))})]})]}),f&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Chapters"}),d.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No chapters available."}):H.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No chapters with content available."}):a.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto border rounded-lg p-3",children:d.map(X=>{const oe=X.word_count>0;return a.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg transition-colors ${oe?"hover:bg-muted/50":"opacity-50"}`,children:[a.jsx(xo,{id:X.id,checked:g.includes(X.id),onCheckedChange:()=>Y(X.id),disabled:!oe}),a.jsx("label",{htmlFor:X.id,className:`flex-1 text-sm ${oe?"cursor-pointer":"cursor-not-allowed"}`,children:X.title}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[X.word_count," words"]}),X.isRecommended&&oe&&a.jsx(gt,{variant:"secondary",className:"text-xs",children:"Recommended"})]},X.id)})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.length," chapter(s) selected"]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(at,{value:x,onValueChange:X=>y(X),children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"de",children:"Deutsch"}),a.jsx(Te,{value:"en",children:"English"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Length"}),a.jsxs(at,{value:v,onValueChange:X=>b(X),children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"small",children:W.small}),a.jsx(Te,{value:"medium",children:W.medium}),a.jsx(Te,{value:"big",children:W.big})]})]})]}),a.jsx(ye,{onClick:B,disabled:w||g.length===0,className:"w-full",children:w?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating Discussion..."]}):"Generate Discussion"})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Result"})}),a.jsx(Be,{children:N?a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"prose prose-sm max-w-none text-sm max-h-[500px] overflow-y-auto",children:a.jsx(fc,{components:{h1:({children:X})=>a.jsx("h1",{className:"text-lg font-semibold mt-6 mb-3 first:mt-0",children:X}),h2:({children:X})=>a.jsx("h2",{className:"text-base font-semibold mt-5 mb-2",children:X}),h3:({children:X})=>a.jsx("h3",{className:"text-sm font-semibold mt-4 mb-2",children:X}),p:({children:X})=>a.jsx("p",{className:"mb-3 leading-relaxed",children:X}),ul:({children:X})=>a.jsx("ul",{className:"mb-3 ml-4 list-disc",children:X}),ol:({children:X})=>a.jsx("ol",{className:"mb-3 ml-4 list-decimal",children:X}),li:({children:X})=>a.jsx("li",{className:"mb-1",children:X})},children:N})}),a.jsxs("div",{className:"flex flex-wrap gap-2 pt-4 border-t",children:[a.jsxs(ye,{variant:"outline",size:"sm",onClick:L,children:[a.jsx(bn,{className:"mr-2 h-4 w-4"}),"Copy"]}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>E(!0),children:[a.jsx(Oj,{className:"mr-2 h-4 w-4"}),"Import to Chapter"]})]})]}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Nr,{className:"mx-auto h-12 w-12 text-muted-foreground mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:'Select a thesis and chapters, then click "Generate Discussion".'})]})})]})]})]}),a.jsx(qr,{open:k,onOpenChange:E,children:a.jsxs(Dr,{children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Import as Section"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Target Chapter"}),a.jsxs(at,{value:M,onValueChange:z,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select chapter..."})}),a.jsx(st,{children:d.map(X=>a.jsx(Te,{value:X.id,children:X.title},X.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Section Title (optional)"}),a.jsx(Fe,{value:P,onChange:X=>V(X.target.value),placeholder:"e.g. Discussion of Results"})]})]}),a.jsxs(yf,{children:[a.jsx(ye,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),a.jsx(ye,{onClick:F,disabled:!M||A,children:A?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"Import"]})})]})]})}),a.jsx(Pc,{open:s,onClose:()=>i(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]}):null},ndt=["introduction","einleitung","methodology","methodik","methods","methoden","findings","ergebnisse","results","auswertung","analyse","analysis","interviews","discussion","diskussion","stand des wissens","theoretischer hintergrund","literature","literatur","theory","theorie","zusammenfassung","summary","conclusion"],sdt=()=>{const{user:t,loading:e,checkStudentPoints:r,studentPoints:n}=Pt(),[s,i]=S.useState(!1),o=gr(),{toast:l}=on(),[c,u]=S.useState([]),[d,h]=S.useState([]),[f,p]=S.useState(""),[g,m]=S.useState([]),[x,y]=S.useState("en"),[v,b]=S.useState("medium"),[w,j]=S.useState(!0),[N,C]=S.useState(!0),[k,E]=S.useState(!1),[M,z]=S.useState(null),[P,V]=S.useState(!1),[A,$]=S.useState(""),[K,G]=S.useState(""),[Y,H]=S.useState(!1);S.useEffect(()=>{!t&&!e&&o("/login")},[t,e,o]),S.useEffect(()=>{t&&B()},[t]),S.useEffect(()=>{f&&(L(f),m([]),z(null))},[f]);const B=async()=>{try{const{data:R,error:ee}=await be.from("theses").select("id, title, degree").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(ee)throw ee;u(R||[]),R&&R.length>0&&!f&&p(R[0].id)}catch(R){console.error("Error loading theses:",R),l({title:"Error",description:"Could not load theses.",variant:"destructive"})}},L=async R=>{try{const{data:ee,error:te}=await be.from("chapters").select("id, title, order_index").eq("thesis_id",R).is("parent_id",null).order("order_index",{ascending:!0});if(te)throw te;const{data:Z,error:J}=await be.from("sections").select("chapter_id, word_count").in("chapter_id",(ee||[]).map(ie=>ie.id));if(J)throw J;const he={};(Z||[]).forEach(ie=>{he[ie.chapter_id]=(he[ie.chapter_id]||0)+ie.word_count});const O=(ee||[]).map(ie=>({...ie,word_count:he[ie.id]||0,isRecommended:ndt.some(q=>ie.title.toLowerCase().includes(q))}));h(O)}catch(ee){console.error("Error loading chapters:",ee),l({title:"Error",description:"Could not load chapters.",variant:"destructive"})}},F=R=>{m(ee=>ee.includes(R)?ee.filter(te=>te!==R):[...ee,R])},W=S.useMemo(()=>d.filter(R=>R.word_count>0),[d]),X=async()=>{if(!r()){i(!0);return}if(g.length===0){l({title:"Error",description:"Please select at least one chapter.",variant:"destructive"});return}E(!0);try{const{data:R,error:ee}=await be.functions.invoke("conclusion_builder",{body:{thesis_id:f,chapter_ids:g,language:x,mode:v,include_limitations:w,include_outlook:N}});if(ee)throw ee;const te=(R==null?void 0:R.conclusion_text)||(R==null?void 0:R.content);if(console.log("Conclusion response:",R),typeof te=="string")z(te);else throw new Error("Invalid response format");l({title:"Success",description:"Conclusion generated successfully!"})}catch(R){console.error("Error generating conclusion:",R),l({title:"Error",description:R.message||"Error generating conclusion.",variant:"destructive"})}finally{E(!1)}},oe=async()=>{if(M)try{await navigator.clipboard.writeText(M),l({title:"Copied",description:"Text copied to clipboard."})}catch{l({title:"Error",description:"Could not copy text.",variant:"destructive"})}},le=async()=>{if(!(!M||!A)){H(!0);try{const{data:R,error:ee}=await be.from("sections").select("order_index").eq("chapter_id",A).order("order_index",{ascending:!1}).limit(1);if(ee)throw ee;const te=R&&R.length>0?R[0].order_index+1:0,{error:Z}=await be.from("sections").insert({chapter_id:A,content:M,title:K.trim()||null,type:"other",order_index:te,status:"open"});if(Z)throw Z;l({title:"Imported",description:"Conclusion imported as section."}),V(!1),G(""),$("")}catch(R){console.error("Error importing section:",R),l({title:"Error",description:R.message||"Error importing.",variant:"destructive"})}finally{H(!1)}}},U={small:"Short (~500 words)",medium:"Medium (~1000 words)",big:"Long (~2000 words)"};return e?a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsxs(er,{showSidebar:!0,children:[a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Conclusion Generator"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Generate a conclusion based on your thesis chapters including limitations and outlook."})]})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Settings"})}),a.jsxs(Be,{className:"space-y-5",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Thesis"}),a.jsxs(at,{value:f,onValueChange:p,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select thesis..."})}),a.jsx(st,{children:c.map(R=>a.jsx(Te,{value:R.id,children:R.title},R.id))})]})]}),f&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Chapters"}),d.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No chapters available."}):W.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No chapters with content available."}):a.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto border rounded-lg p-3",children:d.map(R=>{const ee=R.word_count>0;return a.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg transition-colors ${ee?"hover:bg-muted/50":"opacity-50"}`,children:[a.jsx(xo,{id:R.id,checked:g.includes(R.id),onCheckedChange:()=>F(R.id),disabled:!ee}),a.jsx("label",{htmlFor:R.id,className:`flex-1 text-sm ${ee?"cursor-pointer":"cursor-not-allowed"}`,children:R.title}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[R.word_count," words"]}),R.isRecommended&&ee&&a.jsx(gt,{variant:"secondary",className:"text-xs",children:"Recommended"})]},R.id)})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.length," chapter(s) selected"]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(at,{value:x,onValueChange:R=>y(R),children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"de",children:"Deutsch"}),a.jsx(Te,{value:"en",children:"English"})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(_e,{children:"Include Sections"}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(xo,{id:"include-limitations",checked:w,onCheckedChange:R=>j(!!R)}),a.jsx("label",{htmlFor:"include-limitations",className:"text-sm cursor-pointer",children:"Limitations (Einschränkungen der Studie)"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(xo,{id:"include-outlook",checked:N,onCheckedChange:R=>C(!!R)}),a.jsx("label",{htmlFor:"include-outlook",className:"text-sm cursor-pointer",children:"Ausblick / Future Research"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Length"}),a.jsxs(at,{value:v,onValueChange:R=>b(R),children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"small",children:U.small}),a.jsx(Te,{value:"medium",children:U.medium}),a.jsx(Te,{value:"big",children:U.big})]})]})]}),a.jsx(ye,{onClick:X,disabled:k||g.length===0,className:"w-full",children:k?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating Conclusion..."]}):"Generate Conclusion"})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Result"})}),a.jsx(Be,{children:M?a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"prose prose-sm max-w-none text-sm max-h-[500px] overflow-y-auto",children:a.jsx(fc,{components:{h1:({children:R})=>a.jsx("h1",{className:"text-lg font-semibold mt-6 mb-3 first:mt-0",children:R}),h2:({children:R})=>a.jsx("h2",{className:"text-base font-semibold mt-5 mb-2",children:R}),h3:({children:R})=>a.jsx("h3",{className:"text-sm font-semibold mt-4 mb-2",children:R}),p:({children:R})=>a.jsx("p",{className:"mb-3 leading-relaxed",children:R}),ul:({children:R})=>a.jsx("ul",{className:"mb-3 ml-4 list-disc",children:R}),ol:({children:R})=>a.jsx("ol",{className:"mb-3 ml-4 list-decimal",children:R}),li:({children:R})=>a.jsx("li",{className:"mb-1",children:R})},children:M})}),a.jsxs("div",{className:"flex flex-wrap gap-2 pt-4 border-t",children:[a.jsxs(ye,{variant:"outline",size:"sm",onClick:oe,children:[a.jsx(bn,{className:"mr-2 h-4 w-4"}),"Copy"]}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>V(!0),children:[a.jsx(Oj,{className:"mr-2 h-4 w-4"}),"Import to Chapter"]})]})]}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Nr,{className:"mx-auto h-12 w-12 text-muted-foreground mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:'Select a thesis and chapters, then click "Generate Conclusion".'})]})})]})]})]}),a.jsx(qr,{open:P,onOpenChange:V,children:a.jsxs(Dr,{children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Import Conclusion as Section"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Target Chapter"}),a.jsxs(at,{value:A,onValueChange:$,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select chapter..."})}),a.jsx(st,{children:d.map(R=>a.jsx(Te,{value:R.id,children:R.title},R.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Section Title (optional)"}),a.jsx(Fe,{value:K,onChange:R=>G(R.target.value),placeholder:"e.g. Conclusion"})]})]}),a.jsxs(yf,{children:[a.jsx(ye,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),a.jsx(ye,{onClick:le,disabled:!A||Y,children:Y?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"Import"]})})]})]})}),a.jsx(Pc,{open:s,onClose:()=>i(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]}):null};var Y2="Collapsible",[idt,Vfe]=Bn(Y2),[adt,iB]=idt(Y2),qfe=S.forwardRef((t,e)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:i,onOpenChange:o,...l}=t,[c,u]=Ms({prop:n,defaultProp:s??!1,onChange:o,caller:Y2});return a.jsx(adt,{scope:r,disabled:i,contentId:Yi(),open:c,onOpenToggle:S.useCallback(()=>u(d=>!d),[u]),children:a.jsx(et.div,{"data-state":cB(c),"data-disabled":i?"":void 0,...l,ref:e})})});qfe.displayName=Y2;var Gfe="CollapsibleTrigger",aB=S.forwardRef((t,e)=>{const{__scopeCollapsible:r,...n}=t,s=iB(Gfe,r);return a.jsx(et.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":cB(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:e,onClick:ze(t.onClick,s.onOpenToggle)})});aB.displayName=Gfe;var oB="CollapsibleContent",lB=S.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=iB(oB,t.__scopeCollapsible);return a.jsx(es,{present:r||s.open,children:({present:i})=>a.jsx(odt,{...n,ref:e,present:i})})});lB.displayName=oB;var odt=S.forwardRef((t,e)=>{const{__scopeCollapsible:r,present:n,children:s,...i}=t,o=iB(oB,r),[l,c]=S.useState(n),u=S.useRef(null),d=Nt(e,u),h=S.useRef(0),f=h.current,p=S.useRef(0),g=p.current,m=o.open||l,x=S.useRef(m),y=S.useRef(void 0);return S.useEffect(()=>{const v=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(v)},[]),vn(()=>{const v=u.current;if(v){y.current=y.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const b=v.getBoundingClientRect();h.current=b.height,p.current=b.width,x.current||(v.style.transitionDuration=y.current.transitionDuration,v.style.animationName=y.current.animationName),c(n)}},[o.open,n]),a.jsx(et.div,{"data-state":cB(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...i,ref:d,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:m&&s})});function cB(t){return t?"open":"closed"}var Kfe=qfe,ldt=aB,cdt=lB,_l="Accordion",udt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[uB,ddt,hdt]=Tj(_l),[X2,oxt]=Bn(_l,[hdt,Vfe]),dB=Vfe(),Yfe=me.forwardRef((t,e)=>{const{type:r,...n}=t,s=n,i=n;return a.jsx(uB.Provider,{scope:t.__scopeAccordion,children:r==="multiple"?a.jsx(gdt,{...i,ref:e}):a.jsx(mdt,{...s,ref:e})})});Yfe.displayName=_l;var[Xfe,fdt]=X2(_l),[Qfe,pdt]=X2(_l,{collapsible:!1}),mdt=me.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},collapsible:i=!1,...o}=t,[l,c]=Ms({prop:r,defaultProp:n??"",onChange:s,caller:_l});return a.jsx(Xfe,{scope:t.__scopeAccordion,value:me.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:me.useCallback(()=>i&&c(""),[i,c]),children:a.jsx(Qfe,{scope:t.__scopeAccordion,collapsible:i,children:a.jsx(Zfe,{...o,ref:e})})})}),gdt=me.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...i}=t,[o,l]=Ms({prop:r,defaultProp:n??[],onChange:s,caller:_l}),c=me.useCallback(d=>l((h=[])=>[...h,d]),[l]),u=me.useCallback(d=>l((h=[])=>h.filter(f=>f!==d)),[l]);return a.jsx(Xfe,{scope:t.__scopeAccordion,value:o,onItemOpen:c,onItemClose:u,children:a.jsx(Qfe,{scope:t.__scopeAccordion,collapsible:!0,children:a.jsx(Zfe,{...i,ref:e})})})}),[ydt,Q2]=X2(_l),Zfe=me.forwardRef((t,e)=>{const{__scopeAccordion:r,disabled:n,dir:s,orientation:i="vertical",...o}=t,l=me.useRef(null),c=Nt(l,e),u=ddt(r),h=cg(s)==="ltr",f=ze(t.onKeyDown,p=>{var k;if(!udt.includes(p.key))return;const g=p.target,m=u().filter(E=>{var M;return!((M=E.ref.current)!=null&&M.disabled)}),x=m.findIndex(E=>E.ref.current===g),y=m.length;if(x===-1)return;p.preventDefault();let v=x;const b=0,w=y-1,j=()=>{v=x+1,v>w&&(v=b)},N=()=>{v=x-1,v<b&&(v=w)};switch(p.key){case"Home":v=b;break;case"End":v=w;break;case"ArrowRight":i==="horizontal"&&(h?j():N());break;case"ArrowDown":i==="vertical"&&j();break;case"ArrowLeft":i==="horizontal"&&(h?N():j());break;case"ArrowUp":i==="vertical"&&N();break}const C=v%y;(k=m[C].ref.current)==null||k.focus()});return a.jsx(ydt,{scope:r,disabled:n,direction:s,orientation:i,children:a.jsx(uB.Slot,{scope:r,children:a.jsx(et.div,{...o,"data-orientation":i,ref:c,onKeyDown:n?void 0:f})})})}),vk="AccordionItem",[xdt,hB]=X2(vk),Jfe=me.forwardRef((t,e)=>{const{__scopeAccordion:r,value:n,...s}=t,i=Q2(vk,r),o=fdt(vk,r),l=dB(r),c=Yi(),u=n&&o.value.includes(n)||!1,d=i.disabled||t.disabled;return a.jsx(xdt,{scope:r,open:u,disabled:d,triggerId:c,children:a.jsx(Kfe,{"data-orientation":i.orientation,"data-state":ipe(u),...l,...s,ref:e,disabled:d,open:u,onOpenChange:h=>{h?o.onItemOpen(n):o.onItemClose(n)}})})});Jfe.displayName=vk;var epe="AccordionHeader",tpe=me.forwardRef((t,e)=>{const{__scopeAccordion:r,...n}=t,s=Q2(_l,r),i=hB(epe,r);return a.jsx(et.h3,{"data-orientation":s.orientation,"data-state":ipe(i.open),"data-disabled":i.disabled?"":void 0,...n,ref:e})});tpe.displayName=epe;var T3="AccordionTrigger",rpe=me.forwardRef((t,e)=>{const{__scopeAccordion:r,...n}=t,s=Q2(_l,r),i=hB(T3,r),o=pdt(T3,r),l=dB(r);return a.jsx(uB.ItemSlot,{scope:r,children:a.jsx(ldt,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...l,...n,ref:e})})});rpe.displayName=T3;var npe="AccordionContent",spe=me.forwardRef((t,e)=>{const{__scopeAccordion:r,...n}=t,s=Q2(_l,r),i=hB(npe,r),o=dB(r);return a.jsx(cdt,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...o,...n,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});spe.displayName=npe;function ipe(t){return t?"open":"closed"}var vdt=Yfe,bdt=Jfe,wdt=tpe,ape=rpe,ope=spe;const lpe=vdt,fB=S.forwardRef(({className:t,...e},r)=>a.jsx(bdt,{ref:r,className:Ie("border-b",t),...e}));fB.displayName="AccordionItem";const pB=S.forwardRef(({className:t,children:e,...r},n)=>a.jsx(wdt,{className:"flex",children:a.jsxs(ape,{ref:n,className:Ie("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...r,children:[e,a.jsx(vc,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));pB.displayName=ape.displayName;const mB=S.forwardRef(({className:t,children:e,...r},n)=>a.jsx(ope,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:a.jsx("div",{className:Ie("pb-4 pt-0",t),children:e})}));mB.displayName=ope.displayName;var _dt=Object.defineProperty,jdt=Object.defineProperties,Sdt=Object.getOwnPropertyDescriptors,AK=Object.getOwnPropertySymbols,Ndt=Object.prototype.hasOwnProperty,Adt=Object.prototype.propertyIsEnumerable,P3=(t,e,r)=>e in t?_dt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zt=(t,e)=>{for(var r in e||(e={}))Ndt.call(e,r)&&P3(t,r,e[r]);if(AK)for(var r of AK(e))Adt.call(e,r)&&P3(t,r,e[r]);return t},Yv=(t,e)=>jdt(t,Sdt(e)),Pe=(t,e,r)=>P3(t,typeof e!="symbol"?e+"":e,r),Edt=(t,e,r)=>new Promise((n,s)=>{var i=c=>{try{l(r.next(c))}catch(u){s(u)}},o=c=>{try{l(r.throw(c))}catch(u){s(u)}},l=c=>c.done?n(c.value):Promise.resolve(c.value).then(i,o);l((r=r.apply(t,e)).next())});class bk{constructor(e){Pe(this,"rootKey"),this.rootKey=e}}const Cdt=Object.seal({});class Re extends bk{constructor(e){super(e),Pe(this,"root"),this.root=new Array}prepForXml(e){var r;e.stack.push(this);const n=this.root.map(s=>s instanceof bk?s.prepForXml(e):s).filter(s=>s!==void 0);return e.stack.pop(),{[this.rootKey]:n.length?n.length===1&&((r=n[0])!=null&&r._attr)?n[0]:n:Cdt}}addChildElement(e){return this.root.push(e),this}}class Z2 extends Re{prepForXml(e){const r=super.prepForXml(e);if(r&&(typeof r[this.rootKey]!="object"||Object.keys(r[this.rootKey]).length))return r}}class At extends bk{constructor(e){super("_attr"),Pe(this,"xmlKeys"),this.root=e}prepForXml(e){const r={};return Object.entries(this.root).forEach(([n,s])=>{if(s!==void 0){const i=this.xmlKeys&&this.xmlKeys[n]||n;r[i]=s}}),{_attr:r}}}class J2 extends bk{constructor(e){super("_attr"),this.root=e}prepForXml(e){return{_attr:Object.values(this.root).filter(({value:n})=>n!==void 0).reduce((n,{key:s,value:i})=>Yv(Zt({},n),{[s]:i}),{})}}}class wn extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}}var lc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cpe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var SI={},KN={exports:{}},EK;function gB(){if(EK)return KN.exports;EK=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(j,N,C){return Function.prototype.apply.call(j,N,C)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(j){return Object.getOwnPropertyNames(j).concat(Object.getOwnPropertySymbols(j))}:r=function(j){return Object.getOwnPropertyNames(j)};function n(w){console&&console.warn&&console.warn(w)}var s=Number.isNaN||function(j){return j!==j};function i(){i.init.call(this)}KN.exports=i,KN.exports.once=y,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function l(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(w){if(typeof w!="number"||w<0||s(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");o=w}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(j){if(typeof j!="number"||j<0||s(j))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+j+".");return this._maxListeners=j,this};function c(w){return w._maxListeners===void 0?i.defaultMaxListeners:w._maxListeners}i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(j){for(var N=[],C=1;C<arguments.length;C++)N.push(arguments[C]);var k=j==="error",E=this._events;if(E!==void 0)k=k&&E.error===void 0;else if(!k)return!1;if(k){var M;if(N.length>0&&(M=N[0]),M instanceof Error)throw M;var z=new Error("Unhandled error."+(M?" ("+M.message+")":""));throw z.context=M,z}var P=E[j];if(P===void 0)return!1;if(typeof P=="function")e(P,this,N);else for(var V=P.length,A=g(P,V),C=0;C<V;++C)e(A[C],this,N);return!0};function u(w,j,N,C){var k,E,M;if(l(N),E=w._events,E===void 0?(E=w._events=Object.create(null),w._eventsCount=0):(E.newListener!==void 0&&(w.emit("newListener",j,N.listener?N.listener:N),E=w._events),M=E[j]),M===void 0)M=E[j]=N,++w._eventsCount;else if(typeof M=="function"?M=E[j]=C?[N,M]:[M,N]:C?M.unshift(N):M.push(N),k=c(w),k>0&&M.length>k&&!M.warned){M.warned=!0;var z=new Error("Possible EventEmitter memory leak detected. "+M.length+" "+String(j)+" listeners added. Use emitter.setMaxListeners() to increase limit");z.name="MaxListenersExceededWarning",z.emitter=w,z.type=j,z.count=M.length,n(z)}return w}i.prototype.addListener=function(j,N){return u(this,j,N,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(j,N){return u(this,j,N,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(w,j,N){var C={fired:!1,wrapFn:void 0,target:w,type:j,listener:N},k=d.bind(C);return k.listener=N,C.wrapFn=k,k}i.prototype.once=function(j,N){return l(N),this.on(j,h(this,j,N)),this},i.prototype.prependOnceListener=function(j,N){return l(N),this.prependListener(j,h(this,j,N)),this},i.prototype.removeListener=function(j,N){var C,k,E,M,z;if(l(N),k=this._events,k===void 0)return this;if(C=k[j],C===void 0)return this;if(C===N||C.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete k[j],k.removeListener&&this.emit("removeListener",j,C.listener||N));else if(typeof C!="function"){for(E=-1,M=C.length-1;M>=0;M--)if(C[M]===N||C[M].listener===N){z=C[M].listener,E=M;break}if(E<0)return this;E===0?C.shift():m(C,E),C.length===1&&(k[j]=C[0]),k.removeListener!==void 0&&this.emit("removeListener",j,z||N)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(j){var N,C,k;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[j]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[j]),this;if(arguments.length===0){var E=Object.keys(C),M;for(k=0;k<E.length;++k)M=E[k],M!=="removeListener"&&this.removeAllListeners(M);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(N=C[j],typeof N=="function")this.removeListener(j,N);else if(N!==void 0)for(k=N.length-1;k>=0;k--)this.removeListener(j,N[k]);return this};function f(w,j,N){var C=w._events;if(C===void 0)return[];var k=C[j];return k===void 0?[]:typeof k=="function"?N?[k.listener||k]:[k]:N?x(k):g(k,k.length)}i.prototype.listeners=function(j){return f(this,j,!0)},i.prototype.rawListeners=function(j){return f(this,j,!1)},i.listenerCount=function(w,j){return typeof w.listenerCount=="function"?w.listenerCount(j):p.call(w,j)},i.prototype.listenerCount=p;function p(w){var j=this._events;if(j!==void 0){var N=j[w];if(typeof N=="function")return 1;if(N!==void 0)return N.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function g(w,j){for(var N=new Array(j),C=0;C<j;++C)N[C]=w[C];return N}function m(w,j){for(;j+1<w.length;j++)w[j]=w[j+1];w.pop()}function x(w){for(var j=new Array(w.length),N=0;N<j.length;++N)j[N]=w[N].listener||w[N];return j}function y(w,j){return new Promise(function(N,C){function k(M){w.removeListener(j,E),C(M)}function E(){typeof w.removeListener=="function"&&w.removeListener("error",k),N([].slice.call(arguments))}b(w,j,E,{once:!0}),j!=="error"&&v(w,k,{once:!0})})}function v(w,j,N){typeof w.on=="function"&&b(w,"error",j,N)}function b(w,j,N,C){if(typeof w.on=="function")C.once?w.once(j,N):w.on(j,N);else if(typeof w.addEventListener=="function")w.addEventListener(j,function k(E){C.once&&w.removeEventListener(j,k),N(E)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof w)}return KN.exports}var YN={exports:{}},CK;function Cf(){return CK||(CK=1,typeof Object.create=="function"?YN.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:YN.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}),YN.exports}function kdt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var upe={exports:{}},Tn=upe.exports={},Pl,Ol;function O3(){throw new Error("setTimeout has not been defined")}function I3(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Pl=setTimeout:Pl=O3}catch{Pl=O3}try{typeof clearTimeout=="function"?Ol=clearTimeout:Ol=I3}catch{Ol=I3}})();function dpe(t){if(Pl===setTimeout)return setTimeout(t,0);if((Pl===O3||!Pl)&&setTimeout)return Pl=setTimeout,setTimeout(t,0);try{return Pl(t,0)}catch{try{return Pl.call(null,t,0)}catch{return Pl.call(this,t,0)}}}function Tdt(t){if(Ol===clearTimeout)return clearTimeout(t);if((Ol===I3||!Ol)&&clearTimeout)return Ol=clearTimeout,clearTimeout(t);try{return Ol(t)}catch{try{return Ol.call(null,t)}catch{return Ol.call(this,t)}}}var Du=[],Hy=!1,hp,uE=-1;function Pdt(){!Hy||!hp||(Hy=!1,hp.length?Du=hp.concat(Du):uE=-1,Du.length&&hpe())}function hpe(){if(!Hy){var t=dpe(Pdt);Hy=!0;for(var e=Du.length;e;){for(hp=Du,Du=[];++uE<e;)hp&&hp[uE].run();uE=-1,e=Du.length}hp=null,Hy=!1,Tdt(t)}}Tn.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Du.push(new fpe(t,e)),Du.length===1&&!Hy&&dpe(hpe)};function fpe(t,e){this.fun=t,this.array=e}fpe.prototype.run=function(){this.fun.apply(null,this.array)};Tn.title="browser";Tn.browser=!0;Tn.env={};Tn.argv=[];Tn.version="";Tn.versions={};function fd(){}Tn.on=fd;Tn.addListener=fd;Tn.once=fd;Tn.off=fd;Tn.removeListener=fd;Tn.removeAllListeners=fd;Tn.emit=fd;Tn.prependListener=fd;Tn.prependOnceListener=fd;Tn.listeners=function(t){return[]};Tn.binding=function(t){throw new Error("process.binding is not supported")};Tn.cwd=function(){return"/"};Tn.chdir=function(t){throw new Error("process.chdir is not supported")};Tn.umask=function(){return 0};var Odt=upe.exports;const $t=kdt(Odt);var NI,kK;function ppe(){return kK||(kK=1,NI=gB().EventEmitter),NI}var AI={},p0={},TK;function Idt(){if(TK)return p0;TK=1,p0.byteLength=l,p0.toByteArray=u,p0.fromByteArray=f;for(var t=[],e=[],r=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,i=n.length;s<i;++s)t[s]=n[s],e[n.charCodeAt(s)]=s;e[45]=62,e[95]=63;function o(p){var g=p.length;if(g%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var m=p.indexOf("=");m===-1&&(m=g);var x=m===g?0:4-m%4;return[m,x]}function l(p){var g=o(p),m=g[0],x=g[1];return(m+x)*3/4-x}function c(p,g,m){return(g+m)*3/4-m}function u(p){var g,m=o(p),x=m[0],y=m[1],v=new r(c(p,x,y)),b=0,w=y>0?x-4:x,j;for(j=0;j<w;j+=4)g=e[p.charCodeAt(j)]<<18|e[p.charCodeAt(j+1)]<<12|e[p.charCodeAt(j+2)]<<6|e[p.charCodeAt(j+3)],v[b++]=g>>16&255,v[b++]=g>>8&255,v[b++]=g&255;return y===2&&(g=e[p.charCodeAt(j)]<<2|e[p.charCodeAt(j+1)]>>4,v[b++]=g&255),y===1&&(g=e[p.charCodeAt(j)]<<10|e[p.charCodeAt(j+1)]<<4|e[p.charCodeAt(j+2)]>>2,v[b++]=g>>8&255,v[b++]=g&255),v}function d(p){return t[p>>18&63]+t[p>>12&63]+t[p>>6&63]+t[p&63]}function h(p,g,m){for(var x,y=[],v=g;v<m;v+=3)x=(p[v]<<16&16711680)+(p[v+1]<<8&65280)+(p[v+2]&255),y.push(d(x));return y.join("")}function f(p){for(var g,m=p.length,x=m%3,y=[],v=16383,b=0,w=m-x;b<w;b+=v)y.push(h(p,b,b+v>w?w:b+v));return x===1?(g=p[m-1],y.push(t[g>>2]+t[g<<4&63]+"==")):x===2&&(g=(p[m-2]<<8)+p[m-1],y.push(t[g>>10]+t[g>>4&63]+t[g<<2&63]+"=")),y.join("")}return p0}var XN={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var PK;function Rdt(){return PK||(PK=1,XN.read=function(t,e,r,n,s){var i,o,l=s*8-n-1,c=(1<<l)-1,u=c>>1,d=-7,h=r?s-1:0,f=r?-1:1,p=t[e+h];for(h+=f,i=p&(1<<-d)-1,p>>=-d,d+=l;d>0;i=i*256+t[e+h],h+=f,d-=8);for(o=i&(1<<-d)-1,i>>=-d,d+=n;d>0;o=o*256+t[e+h],h+=f,d-=8);if(i===0)i=1-u;else{if(i===c)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,n),i=i-u}return(p?-1:1)*o*Math.pow(2,i-n)},XN.write=function(t,e,r,n,s,i){var o,l,c,u=i*8-s-1,d=(1<<u)-1,h=d>>1,f=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,g=n?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,o=d):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+h>=1?e+=f/c:e+=f*Math.pow(2,1-h),e*c>=2&&(o++,c/=2),o+h>=d?(l=0,o=d):o+h>=1?(l=(e*c-1)*Math.pow(2,s),o=o+h):(l=e*Math.pow(2,h-1)*Math.pow(2,s),o=0));s>=8;t[r+p]=l&255,p+=g,l/=256,s-=8);for(o=o<<s|l,u+=s;u>0;t[r+p]=o&255,p+=g,o/=256,u-=8);t[r+p-g]|=m*128}),XN}/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/var OK;function eP(){return OK||(OK=1,function(t){var e=Idt(),r=Rdt(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50;var s=2147483647;t.kMaxLength=s,l.TYPED_ARRAY_SUPPORT=i(),!l.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var q=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(q,I),q.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function o(q){if(q>s)throw new RangeError('The value "'+q+'" is invalid for option "size"');var I=new Uint8Array(q);return Object.setPrototypeOf(I,l.prototype),I}function l(q,I,T){if(typeof q=="number"){if(typeof I=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(q)}return c(q,I,T)}l.poolSize=8192;function c(q,I,T){if(typeof q=="string")return f(q,I);if(ArrayBuffer.isView(q))return g(q);if(q==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof q);if(he(q,ArrayBuffer)||q&&he(q.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(q,SharedArrayBuffer)||q&&he(q.buffer,SharedArrayBuffer)))return m(q,I,T);if(typeof q=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var D=q.valueOf&&q.valueOf();if(D!=null&&D!==q)return l.from(D,I,T);var ne=x(q);if(ne)return ne;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof q[Symbol.toPrimitive]=="function")return l.from(q[Symbol.toPrimitive]("string"),I,T);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof q)}l.from=function(q,I,T){return c(q,I,T)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function u(q){if(typeof q!="number")throw new TypeError('"size" argument must be of type number');if(q<0)throw new RangeError('The value "'+q+'" is invalid for option "size"')}function d(q,I,T){return u(q),q<=0?o(q):I!==void 0?typeof T=="string"?o(q).fill(I,T):o(q).fill(I):o(q)}l.alloc=function(q,I,T){return d(q,I,T)};function h(q){return u(q),o(q<0?0:y(q)|0)}l.allocUnsafe=function(q){return h(q)},l.allocUnsafeSlow=function(q){return h(q)};function f(q,I){if((typeof I!="string"||I==="")&&(I="utf8"),!l.isEncoding(I))throw new TypeError("Unknown encoding: "+I);var T=b(q,I)|0,D=o(T),ne=D.write(q,I);return ne!==T&&(D=D.slice(0,ne)),D}function p(q){for(var I=q.length<0?0:y(q.length)|0,T=o(I),D=0;D<I;D+=1)T[D]=q[D]&255;return T}function g(q){if(he(q,Uint8Array)){var I=new Uint8Array(q);return m(I.buffer,I.byteOffset,I.byteLength)}return p(q)}function m(q,I,T){if(I<0||q.byteLength<I)throw new RangeError('"offset" is outside of buffer bounds');if(q.byteLength<I+(T||0))throw new RangeError('"length" is outside of buffer bounds');var D;return I===void 0&&T===void 0?D=new Uint8Array(q):T===void 0?D=new Uint8Array(q,I):D=new Uint8Array(q,I,T),Object.setPrototypeOf(D,l.prototype),D}function x(q){if(l.isBuffer(q)){var I=y(q.length)|0,T=o(I);return T.length===0||q.copy(T,0,0,I),T}if(q.length!==void 0)return typeof q.length!="number"||O(q.length)?o(0):p(q);if(q.type==="Buffer"&&Array.isArray(q.data))return p(q.data)}function y(q){if(q>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return q|0}function v(q){return+q!=q&&(q=0),l.alloc(+q)}l.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==l.prototype},l.compare=function(I,T){if(he(I,Uint8Array)&&(I=l.from(I,I.offset,I.byteLength)),he(T,Uint8Array)&&(T=l.from(T,T.offset,T.byteLength)),!l.isBuffer(I)||!l.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===T)return 0;for(var D=I.length,ne=T.length,ue=0,re=Math.min(D,ne);ue<re;++ue)if(I[ue]!==T[ue]){D=I[ue],ne=T[ue];break}return D<ne?-1:ne<D?1:0},l.isEncoding=function(I){switch(String(I).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(I,T){if(!Array.isArray(I))throw new TypeError('"list" argument must be an Array of Buffers');if(I.length===0)return l.alloc(0);var D;if(T===void 0)for(T=0,D=0;D<I.length;++D)T+=I[D].length;var ne=l.allocUnsafe(T),ue=0;for(D=0;D<I.length;++D){var re=I[D];if(he(re,Uint8Array))ue+re.length>ne.length?l.from(re).copy(ne,ue):Uint8Array.prototype.set.call(ne,re,ue);else if(l.isBuffer(re))re.copy(ne,ue);else throw new TypeError('"list" argument must be an Array of Buffers');ue+=re.length}return ne};function b(q,I){if(l.isBuffer(q))return q.length;if(ArrayBuffer.isView(q)||he(q,ArrayBuffer))return q.byteLength;if(typeof q!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof q);var T=q.length,D=arguments.length>2&&arguments[2]===!0;if(!D&&T===0)return 0;for(var ne=!1;;)switch(I){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return R(q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T*2;case"hex":return T>>>1;case"base64":return Z(q).length;default:if(ne)return D?-1:R(q).length;I=(""+I).toLowerCase(),ne=!0}}l.byteLength=b;function w(q,I,T){var D=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0,I>>>=0,T<=I))return"";for(q||(q="utf8");;)switch(q){case"hex":return H(this,I,T);case"utf8":case"utf-8":return A(this,I,T);case"ascii":return G(this,I,T);case"latin1":case"binary":return Y(this,I,T);case"base64":return V(this,I,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,I,T);default:if(D)throw new TypeError("Unknown encoding: "+q);q=(q+"").toLowerCase(),D=!0}}l.prototype._isBuffer=!0;function j(q,I,T){var D=q[I];q[I]=q[T],q[T]=D}l.prototype.swap16=function(){var I=this.length;if(I%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var T=0;T<I;T+=2)j(this,T,T+1);return this},l.prototype.swap32=function(){var I=this.length;if(I%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var T=0;T<I;T+=4)j(this,T,T+3),j(this,T+1,T+2);return this},l.prototype.swap64=function(){var I=this.length;if(I%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var T=0;T<I;T+=8)j(this,T,T+7),j(this,T+1,T+6),j(this,T+2,T+5),j(this,T+3,T+4);return this},l.prototype.toString=function(){var I=this.length;return I===0?"":arguments.length===0?A(this,0,I):w.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(I){if(!l.isBuffer(I))throw new TypeError("Argument must be a Buffer");return this===I?!0:l.compare(this,I)===0},l.prototype.inspect=function(){var I="",T=t.INSPECT_MAX_BYTES;return I=this.toString("hex",0,T).replace(/(.{2})/g,"$1 ").trim(),this.length>T&&(I+=" ... "),"<Buffer "+I+">"},n&&(l.prototype[n]=l.prototype.inspect),l.prototype.compare=function(I,T,D,ne,ue){if(he(I,Uint8Array)&&(I=l.from(I,I.offset,I.byteLength)),!l.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(T===void 0&&(T=0),D===void 0&&(D=I?I.length:0),ne===void 0&&(ne=0),ue===void 0&&(ue=this.length),T<0||D>I.length||ne<0||ue>this.length)throw new RangeError("out of range index");if(ne>=ue&&T>=D)return 0;if(ne>=ue)return-1;if(T>=D)return 1;if(T>>>=0,D>>>=0,ne>>>=0,ue>>>=0,this===I)return 0;for(var re=ue-ne,pe=D-T,ve=Math.min(re,pe),xe=this.slice(ne,ue),ae=I.slice(T,D),de=0;de<ve;++de)if(xe[de]!==ae[de]){re=xe[de],pe=ae[de];break}return re<pe?-1:pe<re?1:0};function N(q,I,T,D,ne){if(q.length===0)return-1;if(typeof T=="string"?(D=T,T=0):T>2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),T=+T,O(T)&&(T=ne?0:q.length-1),T<0&&(T=q.length+T),T>=q.length){if(ne)return-1;T=q.length-1}else if(T<0)if(ne)T=0;else return-1;if(typeof I=="string"&&(I=l.from(I,D)),l.isBuffer(I))return I.length===0?-1:C(q,I,T,D,ne);if(typeof I=="number")return I=I&255,typeof Uint8Array.prototype.indexOf=="function"?ne?Uint8Array.prototype.indexOf.call(q,I,T):Uint8Array.prototype.lastIndexOf.call(q,I,T):C(q,[I],T,D,ne);throw new TypeError("val must be string, number or Buffer")}function C(q,I,T,D,ne){var ue=1,re=q.length,pe=I.length;if(D!==void 0&&(D=String(D).toLowerCase(),D==="ucs2"||D==="ucs-2"||D==="utf16le"||D==="utf-16le")){if(q.length<2||I.length<2)return-1;ue=2,re/=2,pe/=2,T/=2}function ve(we,je){return ue===1?we[je]:we.readUInt16BE(je*ue)}var xe;if(ne){var ae=-1;for(xe=T;xe<re;xe++)if(ve(q,xe)===ve(I,ae===-1?0:xe-ae)){if(ae===-1&&(ae=xe),xe-ae+1===pe)return ae*ue}else ae!==-1&&(xe-=xe-ae),ae=-1}else for(T+pe>re&&(T=re-pe),xe=T;xe>=0;xe--){for(var de=!0,ge=0;ge<pe;ge++)if(ve(q,xe+ge)!==ve(I,ge)){de=!1;break}if(de)return xe}return-1}l.prototype.includes=function(I,T,D){return this.indexOf(I,T,D)!==-1},l.prototype.indexOf=function(I,T,D){return N(this,I,T,D,!0)},l.prototype.lastIndexOf=function(I,T,D){return N(this,I,T,D,!1)};function k(q,I,T,D){T=Number(T)||0;var ne=q.length-T;D?(D=Number(D),D>ne&&(D=ne)):D=ne;var ue=I.length;D>ue/2&&(D=ue/2);for(var re=0;re<D;++re){var pe=parseInt(I.substr(re*2,2),16);if(O(pe))return re;q[T+re]=pe}return re}function E(q,I,T,D){return J(R(I,q.length-T),q,T,D)}function M(q,I,T,D){return J(ee(I),q,T,D)}function z(q,I,T,D){return J(Z(I),q,T,D)}function P(q,I,T,D){return J(te(I,q.length-T),q,T,D)}l.prototype.write=function(I,T,D,ne){if(T===void 0)ne="utf8",D=this.length,T=0;else if(D===void 0&&typeof T=="string")ne=T,D=this.length,T=0;else if(isFinite(T))T=T>>>0,isFinite(D)?(D=D>>>0,ne===void 0&&(ne="utf8")):(ne=D,D=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var ue=this.length-T;if((D===void 0||D>ue)&&(D=ue),I.length>0&&(D<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");ne||(ne="utf8");for(var re=!1;;)switch(ne){case"hex":return k(this,I,T,D);case"utf8":case"utf-8":return E(this,I,T,D);case"ascii":case"latin1":case"binary":return M(this,I,T,D);case"base64":return z(this,I,T,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,I,T,D);default:if(re)throw new TypeError("Unknown encoding: "+ne);ne=(""+ne).toLowerCase(),re=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function V(q,I,T){return I===0&&T===q.length?e.fromByteArray(q):e.fromByteArray(q.slice(I,T))}function A(q,I,T){T=Math.min(q.length,T);for(var D=[],ne=I;ne<T;){var ue=q[ne],re=null,pe=ue>239?4:ue>223?3:ue>191?2:1;if(ne+pe<=T){var ve,xe,ae,de;switch(pe){case 1:ue<128&&(re=ue);break;case 2:ve=q[ne+1],(ve&192)===128&&(de=(ue&31)<<6|ve&63,de>127&&(re=de));break;case 3:ve=q[ne+1],xe=q[ne+2],(ve&192)===128&&(xe&192)===128&&(de=(ue&15)<<12|(ve&63)<<6|xe&63,de>2047&&(de<55296||de>57343)&&(re=de));break;case 4:ve=q[ne+1],xe=q[ne+2],ae=q[ne+3],(ve&192)===128&&(xe&192)===128&&(ae&192)===128&&(de=(ue&15)<<18|(ve&63)<<12|(xe&63)<<6|ae&63,de>65535&&de<1114112&&(re=de))}}re===null?(re=65533,pe=1):re>65535&&(re-=65536,D.push(re>>>10&1023|55296),re=56320|re&1023),D.push(re),ne+=pe}return K(D)}var $=4096;function K(q){var I=q.length;if(I<=$)return String.fromCharCode.apply(String,q);for(var T="",D=0;D<I;)T+=String.fromCharCode.apply(String,q.slice(D,D+=$));return T}function G(q,I,T){var D="";T=Math.min(q.length,T);for(var ne=I;ne<T;++ne)D+=String.fromCharCode(q[ne]&127);return D}function Y(q,I,T){var D="";T=Math.min(q.length,T);for(var ne=I;ne<T;++ne)D+=String.fromCharCode(q[ne]);return D}function H(q,I,T){var D=q.length;(!I||I<0)&&(I=0),(!T||T<0||T>D)&&(T=D);for(var ne="",ue=I;ue<T;++ue)ne+=ie[q[ue]];return ne}function B(q,I,T){for(var D=q.slice(I,T),ne="",ue=0;ue<D.length-1;ue+=2)ne+=String.fromCharCode(D[ue]+D[ue+1]*256);return ne}l.prototype.slice=function(I,T){var D=this.length;I=~~I,T=T===void 0?D:~~T,I<0?(I+=D,I<0&&(I=0)):I>D&&(I=D),T<0?(T+=D,T<0&&(T=0)):T>D&&(T=D),T<I&&(T=I);var ne=this.subarray(I,T);return Object.setPrototypeOf(ne,l.prototype),ne};function L(q,I,T){if(q%1!==0||q<0)throw new RangeError("offset is not uint");if(q+I>T)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(I,T,D){I=I>>>0,T=T>>>0,D||L(I,T,this.length);for(var ne=this[I],ue=1,re=0;++re<T&&(ue*=256);)ne+=this[I+re]*ue;return ne},l.prototype.readUintBE=l.prototype.readUIntBE=function(I,T,D){I=I>>>0,T=T>>>0,D||L(I,T,this.length);for(var ne=this[I+--T],ue=1;T>0&&(ue*=256);)ne+=this[I+--T]*ue;return ne},l.prototype.readUint8=l.prototype.readUInt8=function(I,T){return I=I>>>0,T||L(I,1,this.length),this[I]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(I,T){return I=I>>>0,T||L(I,2,this.length),this[I]|this[I+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(I,T){return I=I>>>0,T||L(I,2,this.length),this[I]<<8|this[I+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(I,T){return I=I>>>0,T||L(I,4,this.length),(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(I,T){return I=I>>>0,T||L(I,4,this.length),this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},l.prototype.readIntLE=function(I,T,D){I=I>>>0,T=T>>>0,D||L(I,T,this.length);for(var ne=this[I],ue=1,re=0;++re<T&&(ue*=256);)ne+=this[I+re]*ue;return ue*=128,ne>=ue&&(ne-=Math.pow(2,8*T)),ne},l.prototype.readIntBE=function(I,T,D){I=I>>>0,T=T>>>0,D||L(I,T,this.length);for(var ne=T,ue=1,re=this[I+--ne];ne>0&&(ue*=256);)re+=this[I+--ne]*ue;return ue*=128,re>=ue&&(re-=Math.pow(2,8*T)),re},l.prototype.readInt8=function(I,T){return I=I>>>0,T||L(I,1,this.length),this[I]&128?(255-this[I]+1)*-1:this[I]},l.prototype.readInt16LE=function(I,T){I=I>>>0,T||L(I,2,this.length);var D=this[I]|this[I+1]<<8;return D&32768?D|4294901760:D},l.prototype.readInt16BE=function(I,T){I=I>>>0,T||L(I,2,this.length);var D=this[I+1]|this[I]<<8;return D&32768?D|4294901760:D},l.prototype.readInt32LE=function(I,T){return I=I>>>0,T||L(I,4,this.length),this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},l.prototype.readInt32BE=function(I,T){return I=I>>>0,T||L(I,4,this.length),this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},l.prototype.readFloatLE=function(I,T){return I=I>>>0,T||L(I,4,this.length),r.read(this,I,!0,23,4)},l.prototype.readFloatBE=function(I,T){return I=I>>>0,T||L(I,4,this.length),r.read(this,I,!1,23,4)},l.prototype.readDoubleLE=function(I,T){return I=I>>>0,T||L(I,8,this.length),r.read(this,I,!0,52,8)},l.prototype.readDoubleBE=function(I,T){return I=I>>>0,T||L(I,8,this.length),r.read(this,I,!1,52,8)};function F(q,I,T,D,ne,ue){if(!l.isBuffer(q))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>ne||I<ue)throw new RangeError('"value" argument is out of bounds');if(T+D>q.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(I,T,D,ne){if(I=+I,T=T>>>0,D=D>>>0,!ne){var ue=Math.pow(2,8*D)-1;F(this,I,T,D,ue,0)}var re=1,pe=0;for(this[T]=I&255;++pe<D&&(re*=256);)this[T+pe]=I/re&255;return T+D},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(I,T,D,ne){if(I=+I,T=T>>>0,D=D>>>0,!ne){var ue=Math.pow(2,8*D)-1;F(this,I,T,D,ue,0)}var re=D-1,pe=1;for(this[T+re]=I&255;--re>=0&&(pe*=256);)this[T+re]=I/pe&255;return T+D},l.prototype.writeUint8=l.prototype.writeUInt8=function(I,T,D){return I=+I,T=T>>>0,D||F(this,I,T,1,255,0),this[T]=I&255,T+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(I,T,D){return I=+I,T=T>>>0,D||F(this,I,T,2,65535,0),this[T]=I&255,this[T+1]=I>>>8,T+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(I,T,D){return I=+I,T=T>>>0,D||F(this,I,T,2,65535,0),this[T]=I>>>8,this[T+1]=I&255,T+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(I,T,D){return I=+I,T=T>>>0,D||F(this,I,T,4,4294967295,0),this[T+3]=I>>>24,this[T+2]=I>>>16,this[T+1]=I>>>8,this[T]=I&255,T+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(I,T,D){return I=+I,T=T>>>0,D||F(this,I,T,4,4294967295,0),this[T]=I>>>24,this[T+1]=I>>>16,this[T+2]=I>>>8,this[T+3]=I&255,T+4},l.prototype.writeIntLE=function(I,T,D,ne){if(I=+I,T=T>>>0,!ne){var ue=Math.pow(2,8*D-1);F(this,I,T,D,ue-1,-ue)}var re=0,pe=1,ve=0;for(this[T]=I&255;++re<D&&(pe*=256);)I<0&&ve===0&&this[T+re-1]!==0&&(ve=1),this[T+re]=(I/pe>>0)-ve&255;return T+D},l.prototype.writeIntBE=function(I,T,D,ne){if(I=+I,T=T>>>0,!ne){var ue=Math.pow(2,8*D-1);F(this,I,T,D,ue-1,-ue)}var re=D-1,pe=1,ve=0;for(this[T+re]=I&255;--re>=0&&(pe*=256);)I<0&&ve===0&&this[T+re+1]!==0&&(ve=1),this[T+re]=(I/pe>>0)-ve&255;return T+D},l.prototype.writeInt8=function(I,T,D){return I=+I,T=T>>>0,D||F(this,I,T,1,127,-128),I<0&&(I=255+I+1),this[T]=I&255,T+1},l.prototype.writeInt16LE=function(I,T,D){return I=+I,T=T>>>0,D||F(this,I,T,2,32767,-32768),this[T]=I&255,this[T+1]=I>>>8,T+2},l.prototype.writeInt16BE=function(I,T,D){return I=+I,T=T>>>0,D||F(this,I,T,2,32767,-32768),this[T]=I>>>8,this[T+1]=I&255,T+2},l.prototype.writeInt32LE=function(I,T,D){return I=+I,T=T>>>0,D||F(this,I,T,4,2147483647,-2147483648),this[T]=I&255,this[T+1]=I>>>8,this[T+2]=I>>>16,this[T+3]=I>>>24,T+4},l.prototype.writeInt32BE=function(I,T,D){return I=+I,T=T>>>0,D||F(this,I,T,4,2147483647,-2147483648),I<0&&(I=4294967295+I+1),this[T]=I>>>24,this[T+1]=I>>>16,this[T+2]=I>>>8,this[T+3]=I&255,T+4};function W(q,I,T,D,ne,ue){if(T+D>q.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function X(q,I,T,D,ne){return I=+I,T=T>>>0,ne||W(q,I,T,4),r.write(q,I,T,D,23,4),T+4}l.prototype.writeFloatLE=function(I,T,D){return X(this,I,T,!0,D)},l.prototype.writeFloatBE=function(I,T,D){return X(this,I,T,!1,D)};function oe(q,I,T,D,ne){return I=+I,T=T>>>0,ne||W(q,I,T,8),r.write(q,I,T,D,52,8),T+8}l.prototype.writeDoubleLE=function(I,T,D){return oe(this,I,T,!0,D)},l.prototype.writeDoubleBE=function(I,T,D){return oe(this,I,T,!1,D)},l.prototype.copy=function(I,T,D,ne){if(!l.isBuffer(I))throw new TypeError("argument should be a Buffer");if(D||(D=0),!ne&&ne!==0&&(ne=this.length),T>=I.length&&(T=I.length),T||(T=0),ne>0&&ne<D&&(ne=D),ne===D||I.length===0||this.length===0)return 0;if(T<0)throw new RangeError("targetStart out of bounds");if(D<0||D>=this.length)throw new RangeError("Index out of range");if(ne<0)throw new RangeError("sourceEnd out of bounds");ne>this.length&&(ne=this.length),I.length-T<ne-D&&(ne=I.length-T+D);var ue=ne-D;return this===I&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(T,D,ne):Uint8Array.prototype.set.call(I,this.subarray(D,ne),T),ue},l.prototype.fill=function(I,T,D,ne){if(typeof I=="string"){if(typeof T=="string"?(ne=T,T=0,D=this.length):typeof D=="string"&&(ne=D,D=this.length),ne!==void 0&&typeof ne!="string")throw new TypeError("encoding must be a string");if(typeof ne=="string"&&!l.isEncoding(ne))throw new TypeError("Unknown encoding: "+ne);if(I.length===1){var ue=I.charCodeAt(0);(ne==="utf8"&&ue<128||ne==="latin1")&&(I=ue)}}else typeof I=="number"?I=I&255:typeof I=="boolean"&&(I=Number(I));if(T<0||this.length<T||this.length<D)throw new RangeError("Out of range index");if(D<=T)return this;T=T>>>0,D=D===void 0?this.length:D>>>0,I||(I=0);var re;if(typeof I=="number")for(re=T;re<D;++re)this[re]=I;else{var pe=l.isBuffer(I)?I:l.from(I,ne),ve=pe.length;if(ve===0)throw new TypeError('The value "'+I+'" is invalid for argument "value"');for(re=0;re<D-T;++re)this[re+T]=pe[re%ve]}return this};var le=/[^+/0-9A-Za-z-_]/g;function U(q){if(q=q.split("=")[0],q=q.trim().replace(le,""),q.length<2)return"";for(;q.length%4!==0;)q=q+"=";return q}function R(q,I){I=I||1/0;for(var T,D=q.length,ne=null,ue=[],re=0;re<D;++re){if(T=q.charCodeAt(re),T>55295&&T<57344){if(!ne){if(T>56319){(I-=3)>-1&&ue.push(239,191,189);continue}else if(re+1===D){(I-=3)>-1&&ue.push(239,191,189);continue}ne=T;continue}if(T<56320){(I-=3)>-1&&ue.push(239,191,189),ne=T;continue}T=(ne-55296<<10|T-56320)+65536}else ne&&(I-=3)>-1&&ue.push(239,191,189);if(ne=null,T<128){if((I-=1)<0)break;ue.push(T)}else if(T<2048){if((I-=2)<0)break;ue.push(T>>6|192,T&63|128)}else if(T<65536){if((I-=3)<0)break;ue.push(T>>12|224,T>>6&63|128,T&63|128)}else if(T<1114112){if((I-=4)<0)break;ue.push(T>>18|240,T>>12&63|128,T>>6&63|128,T&63|128)}else throw new Error("Invalid code point")}return ue}function ee(q){for(var I=[],T=0;T<q.length;++T)I.push(q.charCodeAt(T)&255);return I}function te(q,I){for(var T,D,ne,ue=[],re=0;re<q.length&&!((I-=2)<0);++re)T=q.charCodeAt(re),D=T>>8,ne=T%256,ue.push(ne),ue.push(D);return ue}function Z(q){return e.toByteArray(U(q))}function J(q,I,T,D){for(var ne=0;ne<D&&!(ne+T>=I.length||ne>=q.length);++ne)I[ne+T]=q[ne];return ne}function he(q,I){return q instanceof I||q!=null&&q.constructor!=null&&q.constructor.name!=null&&q.constructor.name===I.name}function O(q){return q!==q}var ie=function(){for(var q="0123456789abcdef",I=new Array(256),T=0;T<16;++T)for(var D=T*16,ne=0;ne<16;++ne)I[D+ne]=q[T]+q[ne];return I}()}(AI)),AI}var EI={},CI={},kI,IK;function mpe(){return IK||(IK=1,kI=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var s=42;e[r]=s;for(var i in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,r);if(l.value!==s||l.enumerable!==!0)return!1}return!0}),kI}var TI,RK;function yB(){if(RK)return TI;RK=1;var t=mpe();return TI=function(){return t()&&!!Symbol.toStringTag},TI}var PI,MK;function gpe(){return MK||(MK=1,PI=Object),PI}var OI,DK;function Mdt(){return DK||(DK=1,OI=Error),OI}var II,LK;function Ddt(){return LK||(LK=1,II=EvalError),II}var RI,FK;function Ldt(){return FK||(FK=1,RI=RangeError),RI}var MI,$K;function Fdt(){return $K||($K=1,MI=ReferenceError),MI}var DI,BK;function ype(){return BK||(BK=1,DI=SyntaxError),DI}var LI,UK;function yS(){return UK||(UK=1,LI=TypeError),LI}var FI,zK;function $dt(){return zK||(zK=1,FI=URIError),FI}var $I,HK;function Bdt(){return HK||(HK=1,$I=Math.abs),$I}var BI,WK;function Udt(){return WK||(WK=1,BI=Math.floor),BI}var UI,VK;function zdt(){return VK||(VK=1,UI=Math.max),UI}var zI,qK;function Hdt(){return qK||(qK=1,zI=Math.min),zI}var HI,GK;function Wdt(){return GK||(GK=1,HI=Math.pow),HI}var WI,KK;function Vdt(){return KK||(KK=1,WI=Math.round),WI}var VI,YK;function qdt(){return YK||(YK=1,VI=Number.isNaN||function(e){return e!==e}),VI}var qI,XK;function Gdt(){if(XK)return qI;XK=1;var t=qdt();return qI=function(r){return t(r)||r===0?r:r<0?-1:1},qI}var GI,QK;function Kdt(){return QK||(QK=1,GI=Object.getOwnPropertyDescriptor),GI}var KI,ZK;function xS(){if(ZK)return KI;ZK=1;var t=Kdt();if(t)try{t([],"length")}catch{t=null}return KI=t,KI}var YI,JK;function tP(){if(JK)return YI;JK=1;var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return YI=t,YI}var XI,eY;function Ydt(){if(eY)return XI;eY=1;var t=typeof Symbol<"u"&&Symbol,e=mpe();return XI=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},XI}var QI,tY;function xpe(){return tY||(tY=1,QI=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),QI}var ZI,rY;function vpe(){if(rY)return ZI;rY=1;var t=gpe();return ZI=t.getPrototypeOf||null,ZI}var JI,nY;function Xdt(){if(nY)return JI;nY=1;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,r=Math.max,n="[object Function]",s=function(c,u){for(var d=[],h=0;h<c.length;h+=1)d[h]=c[h];for(var f=0;f<u.length;f+=1)d[f+c.length]=u[f];return d},i=function(c,u){for(var d=[],h=u,f=0;h<c.length;h+=1,f+=1)d[f]=c[h];return d},o=function(l,c){for(var u="",d=0;d<l.length;d+=1)u+=l[d],d+1<l.length&&(u+=c);return u};return JI=function(c){var u=this;if(typeof u!="function"||e.apply(u)!==n)throw new TypeError(t+u);for(var d=i(arguments,1),h,f=function(){if(this instanceof h){var y=u.apply(this,s(d,arguments));return Object(y)===y?y:this}return u.apply(c,s(d,arguments))},p=r(0,u.length-d.length),g=[],m=0;m<p;m++)g[m]="$"+m;if(h=Function("binder","return function ("+o(g,",")+"){ return binder.apply(this,arguments); }")(f),u.prototype){var x=function(){};x.prototype=u.prototype,h.prototype=new x,x.prototype=null}return h},JI}var eR,sY;function vS(){if(sY)return eR;sY=1;var t=Xdt();return eR=Function.prototype.bind||t,eR}var tR,iY;function xB(){return iY||(iY=1,tR=Function.prototype.call),tR}var rR,aY;function bpe(){return aY||(aY=1,rR=Function.prototype.apply),rR}var nR,oY;function Qdt(){return oY||(oY=1,nR=typeof Reflect<"u"&&Reflect&&Reflect.apply),nR}var sR,lY;function Zdt(){if(lY)return sR;lY=1;var t=vS(),e=bpe(),r=xB(),n=Qdt();return sR=n||t.call(r,e),sR}var iR,cY;function Jdt(){if(cY)return iR;cY=1;var t=vS(),e=yS(),r=xB(),n=Zdt();return iR=function(i){if(i.length<1||typeof i[0]!="function")throw new e("a function is required");return n(t,r,i)},iR}var aR,uY;function eht(){if(uY)return aR;uY=1;var t=Jdt(),e=xS(),r;try{r=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var n=!!r&&e&&e(Object.prototype,"__proto__"),s=Object,i=s.getPrototypeOf;return aR=n&&typeof n.get=="function"?t([n.get]):typeof i=="function"?function(l){return i(l==null?l:s(l))}:!1,aR}var oR,dY;function tht(){if(dY)return oR;dY=1;var t=xpe(),e=vpe(),r=eht();return oR=t?function(s){return t(s)}:e?function(s){if(!s||typeof s!="object"&&typeof s!="function")throw new TypeError("getProto: not an object");return e(s)}:r?function(s){return r(s)}:null,oR}var lR,hY;function rht(){if(hY)return lR;hY=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,r=vS();return lR=r.call(t,e),lR}var cR,fY;function vB(){if(fY)return cR;fY=1;var t,e=gpe(),r=Mdt(),n=Ddt(),s=Ldt(),i=Fdt(),o=ype(),l=yS(),c=$dt(),u=Bdt(),d=Udt(),h=zdt(),f=Hdt(),p=Wdt(),g=Vdt(),m=Gdt(),x=Function,y=function(ee){try{return x('"use strict"; return ('+ee+").constructor;")()}catch{}},v=xS(),b=tP(),w=function(){throw new l},j=v?function(){try{return arguments.callee,w}catch{try{return v(arguments,"callee").get}catch{return w}}}():w,N=Ydt()(),C=tht(),k=vpe(),E=xpe(),M=bpe(),z=xB(),P={},V=typeof Uint8Array>"u"||!C?t:C(Uint8Array),A={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":N&&C?C([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":P,"%AsyncGenerator%":P,"%AsyncGeneratorFunction%":P,"%AsyncIteratorPrototype%":P,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":n,"%Float16Array%":typeof Float16Array>"u"?t:Float16Array,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":x,"%GeneratorFunction%":P,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":N&&C?C(C([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!N||!C?t:C(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":v,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":s,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!N||!C?t:C(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":N&&C?C(""[Symbol.iterator]()):t,"%Symbol%":N?Symbol:t,"%SyntaxError%":o,"%ThrowTypeError%":j,"%TypedArray%":V,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":c,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet,"%Function.prototype.call%":z,"%Function.prototype.apply%":M,"%Object.defineProperty%":b,"%Object.getPrototypeOf%":k,"%Math.abs%":u,"%Math.floor%":d,"%Math.max%":h,"%Math.min%":f,"%Math.pow%":p,"%Math.round%":g,"%Math.sign%":m,"%Reflect.getPrototypeOf%":E};if(C)try{null.error}catch(ee){var $=C(C(ee));A["%Error.prototype%"]=$}var K=function ee(te){var Z;if(te==="%AsyncFunction%")Z=y("async function () {}");else if(te==="%GeneratorFunction%")Z=y("function* () {}");else if(te==="%AsyncGeneratorFunction%")Z=y("async function* () {}");else if(te==="%AsyncGenerator%"){var J=ee("%AsyncGeneratorFunction%");J&&(Z=J.prototype)}else if(te==="%AsyncIteratorPrototype%"){var he=ee("%AsyncGenerator%");he&&C&&(Z=C(he.prototype))}return A[te]=Z,Z},G={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Y=vS(),H=rht(),B=Y.call(z,Array.prototype.concat),L=Y.call(M,Array.prototype.splice),F=Y.call(z,String.prototype.replace),W=Y.call(z,String.prototype.slice),X=Y.call(z,RegExp.prototype.exec),oe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,le=/\\(\\)?/g,U=function(te){var Z=W(te,0,1),J=W(te,-1);if(Z==="%"&&J!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(J==="%"&&Z!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var he=[];return F(te,oe,function(O,ie,q,I){he[he.length]=q?F(I,le,"$1"):ie||O}),he},R=function(te,Z){var J=te,he;if(H(G,J)&&(he=G[J],J="%"+he[0]+"%"),H(A,J)){var O=A[J];if(O===P&&(O=K(J)),typeof O>"u"&&!Z)throw new l("intrinsic "+te+" exists, but is not available. Please file an issue!");return{alias:he,name:J,value:O}}throw new o("intrinsic "+te+" does not exist!")};return cR=function(te,Z){if(typeof te!="string"||te.length===0)throw new l("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Z!="boolean")throw new l('"allowMissing" argument must be a boolean');if(X(/^%?[^%]*%?$/,te)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var J=U(te),he=J.length>0?J[0]:"",O=R("%"+he+"%",Z),ie=O.name,q=O.value,I=!1,T=O.alias;T&&(he=T[0],L(J,B([0,1],T)));for(var D=1,ne=!0;D<J.length;D+=1){var ue=J[D],re=W(ue,0,1),pe=W(ue,-1);if((re==='"'||re==="'"||re==="`"||pe==='"'||pe==="'"||pe==="`")&&re!==pe)throw new o("property names with quotes must have matching quotes");if((ue==="constructor"||!ne)&&(I=!0),he+="."+ue,ie="%"+he+"%",H(A,ie))q=A[ie];else if(q!=null){if(!(ue in q)){if(!Z)throw new l("base intrinsic for "+te+" exists, but the property is not available.");return}if(v&&D+1>=J.length){var ve=v(q,ue);ne=!!ve,ne&&"get"in ve&&!("originalValue"in ve.get)?q=ve.get:q=q[ue]}else ne=H(q,ue),q=q[ue];ne&&!I&&(A[ie]=q)}}return q},cR}var uR={exports:{}},dR,pY;function nht(){if(pY)return dR;pY=1;var t=tP(),e=ype(),r=yS(),n=xS();return dR=function(i,o,l){if(!i||typeof i!="object"&&typeof i!="function")throw new r("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new r("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,f=!!n&&n(i,o);if(t)t(i,o,{configurable:d===null&&f?f.configurable:!d,enumerable:c===null&&f?f.enumerable:!c,value:l,writable:u===null&&f?f.writable:!u});else if(h||!c&&!u&&!d)i[o]=l;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},dR}var hR,mY;function sht(){if(mY)return hR;mY=1;var t=tP(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},hR=e,hR}var fR,gY;function iht(){if(gY)return fR;gY=1;var t=vB(),e=nht(),r=sht()(),n=xS(),s=yS(),i=t("%Math.floor%");return fR=function(l,c){if(typeof l!="function")throw new s("`fn` is not a function");if(typeof c!="number"||c<0||c>4294967295||i(c)!==c)throw new s("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],d=!0,h=!0;if("length"in l&&n){var f=n(l,"length");f&&!f.configurable&&(d=!1),f&&!f.writable&&(h=!1)}return(d||h||!u)&&(r?e(l,"length",c,!0,!0):e(l,"length",c)),l},fR}var yY;function wpe(){return yY||(yY=1,function(t){var e=vS(),r=vB(),n=iht(),s=yS(),i=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),l=r("%Reflect.apply%",!0)||e.call(o,i),c=tP(),u=r("%Math.max%");t.exports=function(f){if(typeof f!="function")throw new s("a function is required");var p=l(e,o,arguments);return n(p,1+u(0,f.length-(arguments.length-1)),!0)};var d=function(){return l(e,i,arguments)};c?c(t.exports,"apply",{value:d}):t.exports.apply=d}(uR)),uR.exports}var pR,xY;function _pe(){if(xY)return pR;xY=1;var t=vB(),e=wpe(),r=e(t("String.prototype.indexOf"));return pR=function(s,i){var o=t(s,!!i);return typeof o=="function"&&r(s,".prototype.")>-1?e(o):o},pR}var mR,vY;function aht(){if(vY)return mR;vY=1;var t=yB()(),e=_pe(),r=e("Object.prototype.toString"),n=function(l){return t&&l&&typeof l=="object"&&Symbol.toStringTag in l?!1:r(l)==="[object Arguments]"},s=function(l){return n(l)?!0:l!==null&&typeof l=="object"&&typeof l.length=="number"&&l.length>=0&&r(l)!=="[object Array]"&&r(l.callee)==="[object Function]"},i=function(){return n(arguments)}();return n.isLegacyArguments=s,mR=i?n:s,mR}var gR,bY;function oht(){if(bY)return gR;bY=1;var t=Object.prototype.toString,e=Function.prototype.toString,r=/^\s*(?:function)?\*/,n=yB()(),s=Object.getPrototypeOf,i=function(){if(!n)return!1;try{return Function("return function*() {}")()}catch{}},o;return gR=function(c){if(typeof c!="function")return!1;if(r.test(e.call(c)))return!0;if(!n){var u=t.call(c);return u==="[object GeneratorFunction]"}if(!s)return!1;if(typeof o>"u"){var d=i();o=d?s(d):!1}return s(c)===o},gR}var yR,wY;function lht(){if(wY)return yR;wY=1;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,r,n;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{r=Object.defineProperty({},"length",{get:function(){throw n}}),n={},e(function(){throw 42},null,r)}catch(v){v!==n&&(e=null)}else e=null;var s=/^\s*class\b/,i=function(b){try{var w=t.call(b);return s.test(w)}catch{return!1}},o=function(b){try{return i(b)?!1:(t.call(b),!0)}catch{return!1}},l=Object.prototype.toString,c="[object Object]",u="[object Function]",d="[object GeneratorFunction]",h="[object HTMLAllCollection]",f="[object HTML document.all class]",p="[object HTMLCollection]",g=typeof Symbol=="function"&&!!Symbol.toStringTag,m=!(0 in[,]),x=function(){return!1};if(typeof document=="object"){var y=document.all;l.call(y)===l.call(document.all)&&(x=function(b){if((m||!b)&&(typeof b>"u"||typeof b=="object"))try{var w=l.call(b);return(w===h||w===f||w===p||w===c)&&b("")==null}catch{}return!1})}return yR=e?function(b){if(x(b))return!0;if(!b||typeof b!="function"&&typeof b!="object")return!1;try{e(b,null,r)}catch(w){if(w!==n)return!1}return!i(b)&&o(b)}:function(b){if(x(b))return!0;if(!b||typeof b!="function"&&typeof b!="object")return!1;if(g)return o(b);if(i(b))return!1;var w=l.call(b);return w!==u&&w!==d&&!/^\[object HTML/.test(w)?!1:o(b)},yR}var xR,_Y;function cht(){if(_Y)return xR;_Y=1;var t=lht(),e=Object.prototype.toString,r=Object.prototype.hasOwnProperty,n=function(c,u,d){for(var h=0,f=c.length;h<f;h++)r.call(c,h)&&(d==null?u(c[h],h,c):u.call(d,c[h],h,c))},s=function(c,u,d){for(var h=0,f=c.length;h<f;h++)d==null?u(c.charAt(h),h,c):u.call(d,c.charAt(h),h,c)},i=function(c,u,d){for(var h in c)r.call(c,h)&&(d==null?u(c[h],h,c):u.call(d,c[h],h,c))},o=function(c,u,d){if(!t(u))throw new TypeError("iterator must be a function");var h;arguments.length>=3&&(h=d),e.call(c)==="[object Array]"?n(c,u,h):typeof c=="string"?s(c,u,h):i(c,u,h)};return xR=o,xR}var vR,jY;function uht(){return jY||(jY=1,vR=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),vR}var bR,SY;function dht(){if(SY)return bR;SY=1;var t=uht(),e=typeof globalThis>"u"?lc:globalThis;return bR=function(){for(var n=[],s=0;s<t.length;s++)typeof e[t[s]]=="function"&&(n[n.length]=t[s]);return n},bR}var wR,NY;function jpe(){if(NY)return wR;NY=1;var t=cht(),e=dht(),r=wpe(),n=_pe(),s=xS(),i=n("Object.prototype.toString"),o=yB()(),l=typeof globalThis>"u"?lc:globalThis,c=e(),u=n("String.prototype.slice"),d=Object.getPrototypeOf,h=n("Array.prototype.indexOf",!0)||function(x,y){for(var v=0;v<x.length;v+=1)if(x[v]===y)return v;return-1},f={__proto__:null};o&&s&&d?t(c,function(m){var x=new l[m];if(Symbol.toStringTag in x){var y=d(x),v=s(y,Symbol.toStringTag);if(!v){var b=d(y);v=s(b,Symbol.toStringTag)}f["$"+m]=r(v.get)}}):t(c,function(m){var x=new l[m],y=x.slice||x.set;y&&(f["$"+m]=r(y))});var p=function(x){var y=!1;return t(f,function(v,b){if(!y)try{"$"+v(x)===b&&(y=u(b,1))}catch{}}),y},g=function(x){var y=!1;return t(f,function(v,b){if(!y)try{v(x),y=u(b,1)}catch{}}),y};return wR=function(x){if(!x||typeof x!="object")return!1;if(!o){var y=u(i(x),8,-1);return h(c,y)>-1?y:y!=="Object"?!1:g(x)}return s?p(x):null},wR}var _R,AY;function hht(){if(AY)return _R;AY=1;var t=jpe();return _R=function(r){return!!t(r)},_R}var EY;function fht(){return EY||(EY=1,function(t){var e=aht(),r=oht(),n=jpe(),s=hht();function i(D){return D.call.bind(D)}var o=typeof BigInt<"u",l=typeof Symbol<"u",c=i(Object.prototype.toString),u=i(Number.prototype.valueOf),d=i(String.prototype.valueOf),h=i(Boolean.prototype.valueOf);if(o)var f=i(BigInt.prototype.valueOf);if(l)var p=i(Symbol.prototype.valueOf);function g(D,ne){if(typeof D!="object")return!1;try{return ne(D),!0}catch{return!1}}t.isArgumentsObject=e,t.isGeneratorFunction=r,t.isTypedArray=s;function m(D){return typeof Promise<"u"&&D instanceof Promise||D!==null&&typeof D=="object"&&typeof D.then=="function"&&typeof D.catch=="function"}t.isPromise=m;function x(D){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(D):s(D)||W(D)}t.isArrayBufferView=x;function y(D){return n(D)==="Uint8Array"}t.isUint8Array=y;function v(D){return n(D)==="Uint8ClampedArray"}t.isUint8ClampedArray=v;function b(D){return n(D)==="Uint16Array"}t.isUint16Array=b;function w(D){return n(D)==="Uint32Array"}t.isUint32Array=w;function j(D){return n(D)==="Int8Array"}t.isInt8Array=j;function N(D){return n(D)==="Int16Array"}t.isInt16Array=N;function C(D){return n(D)==="Int32Array"}t.isInt32Array=C;function k(D){return n(D)==="Float32Array"}t.isFloat32Array=k;function E(D){return n(D)==="Float64Array"}t.isFloat64Array=E;function M(D){return n(D)==="BigInt64Array"}t.isBigInt64Array=M;function z(D){return n(D)==="BigUint64Array"}t.isBigUint64Array=z;function P(D){return c(D)==="[object Map]"}P.working=typeof Map<"u"&&P(new Map);function V(D){return typeof Map>"u"?!1:P.working?P(D):D instanceof Map}t.isMap=V;function A(D){return c(D)==="[object Set]"}A.working=typeof Set<"u"&&A(new Set);function $(D){return typeof Set>"u"?!1:A.working?A(D):D instanceof Set}t.isSet=$;function K(D){return c(D)==="[object WeakMap]"}K.working=typeof WeakMap<"u"&&K(new WeakMap);function G(D){return typeof WeakMap>"u"?!1:K.working?K(D):D instanceof WeakMap}t.isWeakMap=G;function Y(D){return c(D)==="[object WeakSet]"}Y.working=typeof WeakSet<"u"&&Y(new WeakSet);function H(D){return Y(D)}t.isWeakSet=H;function B(D){return c(D)==="[object ArrayBuffer]"}B.working=typeof ArrayBuffer<"u"&&B(new ArrayBuffer);function L(D){return typeof ArrayBuffer>"u"?!1:B.working?B(D):D instanceof ArrayBuffer}t.isArrayBuffer=L;function F(D){return c(D)==="[object DataView]"}F.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&F(new DataView(new ArrayBuffer(1),0,1));function W(D){return typeof DataView>"u"?!1:F.working?F(D):D instanceof DataView}t.isDataView=W;var X=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function oe(D){return c(D)==="[object SharedArrayBuffer]"}function le(D){return typeof X>"u"?!1:(typeof oe.working>"u"&&(oe.working=oe(new X)),oe.working?oe(D):D instanceof X)}t.isSharedArrayBuffer=le;function U(D){return c(D)==="[object AsyncFunction]"}t.isAsyncFunction=U;function R(D){return c(D)==="[object Map Iterator]"}t.isMapIterator=R;function ee(D){return c(D)==="[object Set Iterator]"}t.isSetIterator=ee;function te(D){return c(D)==="[object Generator]"}t.isGeneratorObject=te;function Z(D){return c(D)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=Z;function J(D){return g(D,u)}t.isNumberObject=J;function he(D){return g(D,d)}t.isStringObject=he;function O(D){return g(D,h)}t.isBooleanObject=O;function ie(D){return o&&g(D,f)}t.isBigIntObject=ie;function q(D){return l&&g(D,p)}t.isSymbolObject=q;function I(D){return J(D)||he(D)||O(D)||ie(D)||q(D)}t.isBoxedPrimitive=I;function T(D){return typeof Uint8Array<"u"&&(L(D)||le(D))}t.isAnyArrayBuffer=T,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(D){Object.defineProperty(t,D,{enumerable:!1,value:function(){throw new Error(D+" is not supported in userland")}})})}(CI)),CI}var jR,CY;function pht(){return CY||(CY=1,jR=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),jR}var kY;function Spe(){return kY||(kY=1,function(t){var e=Object.getOwnPropertyDescriptors||function(W){for(var X=Object.keys(W),oe={},le=0;le<X.length;le++)oe[X[le]]=Object.getOwnPropertyDescriptor(W,X[le]);return oe},r=/%[sdj%]/g;t.format=function(F){if(!j(F)){for(var W=[],X=0;X<arguments.length;X++)W.push(o(arguments[X]));return W.join(" ")}for(var X=1,oe=arguments,le=oe.length,U=String(F).replace(r,function(ee){if(ee==="%%")return"%";if(X>=le)return ee;switch(ee){case"%s":return String(oe[X++]);case"%d":return Number(oe[X++]);case"%j":try{return JSON.stringify(oe[X++])}catch{return"[Circular]"}default:return ee}}),R=oe[X];X<le;R=oe[++X])v(R)||!E(R)?U+=" "+R:U+=" "+o(R);return U},t.deprecate=function(F,W){if(typeof $t<"u"&&$t.noDeprecation===!0)return F;if(typeof $t>"u")return function(){return t.deprecate(F,W).apply(this,arguments)};var X=!1;function oe(){if(!X){if($t.throwDeprecation)throw new Error(W);$t.traceDeprecation?console.trace(W):console.error(W),X=!0}return F.apply(this,arguments)}return oe};var n={},s=/^$/;if($t.env.NODE_DEBUG){var i=$t.env.NODE_DEBUG;i=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+i+"$","i")}t.debuglog=function(F){if(F=F.toUpperCase(),!n[F])if(s.test(F)){var W=$t.pid;n[F]=function(){var X=t.format.apply(t,arguments);console.error("%s %d: %s",F,W,X)}}else n[F]=function(){};return n[F]};function o(F,W){var X={seen:[],stylize:c};return arguments.length>=3&&(X.depth=arguments[2]),arguments.length>=4&&(X.colors=arguments[3]),y(W)?X.showHidden=W:W&&t._extend(X,W),C(X.showHidden)&&(X.showHidden=!1),C(X.depth)&&(X.depth=2),C(X.colors)&&(X.colors=!1),C(X.customInspect)&&(X.customInspect=!0),X.colors&&(X.stylize=l),d(X,F,X.depth)}t.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function l(F,W){var X=o.styles[W];return X?"\x1B["+o.colors[X][0]+"m"+F+"\x1B["+o.colors[X][1]+"m":F}function c(F,W){return F}function u(F){var W={};return F.forEach(function(X,oe){W[X]=!0}),W}function d(F,W,X){if(F.customInspect&&W&&P(W.inspect)&&W.inspect!==t.inspect&&!(W.constructor&&W.constructor.prototype===W)){var oe=W.inspect(X,F);return j(oe)||(oe=d(F,oe,X)),oe}var le=h(F,W);if(le)return le;var U=Object.keys(W),R=u(U);if(F.showHidden&&(U=Object.getOwnPropertyNames(W)),z(W)&&(U.indexOf("message")>=0||U.indexOf("description")>=0))return f(W);if(U.length===0){if(P(W)){var ee=W.name?": "+W.name:"";return F.stylize("[Function"+ee+"]","special")}if(k(W))return F.stylize(RegExp.prototype.toString.call(W),"regexp");if(M(W))return F.stylize(Date.prototype.toString.call(W),"date");if(z(W))return f(W)}var te="",Z=!1,J=["{","}"];if(x(W)&&(Z=!0,J=["[","]"]),P(W)){var he=W.name?": "+W.name:"";te=" [Function"+he+"]"}if(k(W)&&(te=" "+RegExp.prototype.toString.call(W)),M(W)&&(te=" "+Date.prototype.toUTCString.call(W)),z(W)&&(te=" "+f(W)),U.length===0&&(!Z||W.length==0))return J[0]+te+J[1];if(X<0)return k(W)?F.stylize(RegExp.prototype.toString.call(W),"regexp"):F.stylize("[Object]","special");F.seen.push(W);var O;return Z?O=p(F,W,X,R,U):O=U.map(function(ie){return g(F,W,X,R,ie,Z)}),F.seen.pop(),m(O,te,J)}function h(F,W){if(C(W))return F.stylize("undefined","undefined");if(j(W)){var X="'"+JSON.stringify(W).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return F.stylize(X,"string")}if(w(W))return F.stylize(""+W,"number");if(y(W))return F.stylize(""+W,"boolean");if(v(W))return F.stylize("null","null")}function f(F){return"["+Error.prototype.toString.call(F)+"]"}function p(F,W,X,oe,le){for(var U=[],R=0,ee=W.length;R<ee;++R)Y(W,String(R))?U.push(g(F,W,X,oe,String(R),!0)):U.push("");return le.forEach(function(te){te.match(/^\d+$/)||U.push(g(F,W,X,oe,te,!0))}),U}function g(F,W,X,oe,le,U){var R,ee,te;if(te=Object.getOwnPropertyDescriptor(W,le)||{value:W[le]},te.get?te.set?ee=F.stylize("[Getter/Setter]","special"):ee=F.stylize("[Getter]","special"):te.set&&(ee=F.stylize("[Setter]","special")),Y(oe,le)||(R="["+le+"]"),ee||(F.seen.indexOf(te.value)<0?(v(X)?ee=d(F,te.value,null):ee=d(F,te.value,X-1),ee.indexOf(`
`)>-1&&(U?ee=ee.split(`
`).map(function(Z){return" "+Z}).join(`
`).slice(2):ee=`
`+ee.split(`
`).map(function(Z){return" "+Z}).join(`
`))):ee=F.stylize("[Circular]","special")),C(R)){if(U&&le.match(/^\d+$/))return ee;R=JSON.stringify(""+le),R.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(R=R.slice(1,-1),R=F.stylize(R,"name")):(R=R.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),R=F.stylize(R,"string"))}return R+": "+ee}function m(F,W,X){var oe=F.reduce(function(le,U){return U.indexOf(`
`)>=0,le+U.replace(/\u001b\[\d\d?m/g,"").length+1},0);return oe>60?X[0]+(W===""?"":W+`
`)+" "+F.join(`,
`)+" "+X[1]:X[0]+W+" "+F.join(", ")+" "+X[1]}t.types=fht();function x(F){return Array.isArray(F)}t.isArray=x;function y(F){return typeof F=="boolean"}t.isBoolean=y;function v(F){return F===null}t.isNull=v;function b(F){return F==null}t.isNullOrUndefined=b;function w(F){return typeof F=="number"}t.isNumber=w;function j(F){return typeof F=="string"}t.isString=j;function N(F){return typeof F=="symbol"}t.isSymbol=N;function C(F){return F===void 0}t.isUndefined=C;function k(F){return E(F)&&A(F)==="[object RegExp]"}t.isRegExp=k,t.types.isRegExp=k;function E(F){return typeof F=="object"&&F!==null}t.isObject=E;function M(F){return E(F)&&A(F)==="[object Date]"}t.isDate=M,t.types.isDate=M;function z(F){return E(F)&&(A(F)==="[object Error]"||F instanceof Error)}t.isError=z,t.types.isNativeError=z;function P(F){return typeof F=="function"}t.isFunction=P;function V(F){return F===null||typeof F=="boolean"||typeof F=="number"||typeof F=="string"||typeof F=="symbol"||typeof F>"u"}t.isPrimitive=V,t.isBuffer=pht();function A(F){return Object.prototype.toString.call(F)}function $(F){return F<10?"0"+F.toString(10):F.toString(10)}var K=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function G(){var F=new Date,W=[$(F.getHours()),$(F.getMinutes()),$(F.getSeconds())].join(":");return[F.getDate(),K[F.getMonth()],W].join(" ")}t.log=function(){console.log("%s - %s",G(),t.format.apply(t,arguments))},t.inherits=Cf(),t._extend=function(F,W){if(!W||!E(W))return F;for(var X=Object.keys(W),oe=X.length;oe--;)F[X[oe]]=W[X[oe]];return F};function Y(F,W){return Object.prototype.hasOwnProperty.call(F,W)}var H=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;t.promisify=function(W){if(typeof W!="function")throw new TypeError('The "original" argument must be of type Function');if(H&&W[H]){var X=W[H];if(typeof X!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(X,H,{value:X,enumerable:!1,writable:!1,configurable:!0}),X}function X(){for(var oe,le,U=new Promise(function(te,Z){oe=te,le=Z}),R=[],ee=0;ee<arguments.length;ee++)R.push(arguments[ee]);R.push(function(te,Z){te?le(te):oe(Z)});try{W.apply(this,R)}catch(te){le(te)}return U}return Object.setPrototypeOf(X,Object.getPrototypeOf(W)),H&&Object.defineProperty(X,H,{value:X,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(X,e(W))},t.promisify.custom=H;function B(F,W){if(!F){var X=new Error("Promise was rejected with a falsy value");X.reason=F,F=X}return W(F)}function L(F){if(typeof F!="function")throw new TypeError('The "original" argument must be of type Function');function W(){for(var X=[],oe=0;oe<arguments.length;oe++)X.push(arguments[oe]);var le=X.pop();if(typeof le!="function")throw new TypeError("The last argument must be of type Function");var U=this,R=function(){return le.apply(U,arguments)};F.apply(this,X).then(function(ee){$t.nextTick(R.bind(null,null,ee))},function(ee){$t.nextTick(B.bind(null,ee,R))})}return Object.setPrototypeOf(W,Object.getPrototypeOf(F)),Object.defineProperties(W,e(F)),W}t.callbackify=L}(EI)),EI}var SR,TY;function mht(){if(TY)return SR;TY=1;function t(f,p){var g=Object.keys(f);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(f);p&&(m=m.filter(function(x){return Object.getOwnPropertyDescriptor(f,x).enumerable})),g.push.apply(g,m)}return g}function e(f){for(var p=1;p<arguments.length;p++){var g=arguments[p]!=null?arguments[p]:{};p%2?t(Object(g),!0).forEach(function(m){r(f,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(g)):t(Object(g)).forEach(function(m){Object.defineProperty(f,m,Object.getOwnPropertyDescriptor(g,m))})}return f}function r(f,p,g){return p in f?Object.defineProperty(f,p,{value:g,enumerable:!0,configurable:!0,writable:!0}):f[p]=g,f}function n(f,p){if(!(f instanceof p))throw new TypeError("Cannot call a class as a function")}function s(f,p){for(var g=0;g<p.length;g++){var m=p[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function i(f,p,g){return p&&s(f.prototype,p),f}var o=eP(),l=o.Buffer,c=Spe(),u=c.inspect,d=u&&u.custom||"inspect";function h(f,p,g){l.prototype.copy.call(f,p,g)}return SR=function(){function f(){n(this,f),this.head=null,this.tail=null,this.length=0}return i(f,[{key:"push",value:function(g){var m={data:g,next:null};this.length>0?this.tail.next=m:this.head=m,this.tail=m,++this.length}},{key:"unshift",value:function(g){var m={data:g,next:this.head};this.length===0&&(this.tail=m),this.head=m,++this.length}},{key:"shift",value:function(){if(this.length!==0){var g=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,g}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(g){if(this.length===0)return"";for(var m=this.head,x=""+m.data;m=m.next;)x+=g+m.data;return x}},{key:"concat",value:function(g){if(this.length===0)return l.alloc(0);for(var m=l.allocUnsafe(g>>>0),x=this.head,y=0;x;)h(x.data,m,y),y+=x.data.length,x=x.next;return m}},{key:"consume",value:function(g,m){var x;return g<this.head.data.length?(x=this.head.data.slice(0,g),this.head.data=this.head.data.slice(g)):g===this.head.data.length?x=this.shift():x=m?this._getString(g):this._getBuffer(g),x}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(g){var m=this.head,x=1,y=m.data;for(g-=y.length;m=m.next;){var v=m.data,b=g>v.length?v.length:g;if(b===v.length?y+=v:y+=v.slice(0,g),g-=b,g===0){b===v.length?(++x,m.next?this.head=m.next:this.head=this.tail=null):(this.head=m,m.data=v.slice(b));break}++x}return this.length-=x,y}},{key:"_getBuffer",value:function(g){var m=l.allocUnsafe(g),x=this.head,y=1;for(x.data.copy(m),g-=x.data.length;x=x.next;){var v=x.data,b=g>v.length?v.length:g;if(v.copy(m,m.length-g,0,b),g-=b,g===0){b===v.length?(++y,x.next?this.head=x.next:this.head=this.tail=null):(this.head=x,x.data=v.slice(b));break}++y}return this.length-=y,m}},{key:d,value:function(g,m){return u(this,e({},m,{depth:0,customInspect:!1}))}}]),f}(),SR}var NR,PY;function Npe(){if(PY)return NR;PY=1;function t(o,l){var c=this,u=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return u||d?(l?l(o):o&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,$t.nextTick(s,this,o)):$t.nextTick(s,this,o)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(o||null,function(h){!l&&h?c._writableState?c._writableState.errorEmitted?$t.nextTick(r,c):(c._writableState.errorEmitted=!0,$t.nextTick(e,c,h)):$t.nextTick(e,c,h):l?($t.nextTick(r,c),l(h)):$t.nextTick(r,c)}),this)}function e(o,l){s(o,l),r(o)}function r(o){o._writableState&&!o._writableState.emitClose||o._readableState&&!o._readableState.emitClose||o.emit("close")}function n(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(o,l){o.emit("error",l)}function i(o,l){var c=o._readableState,u=o._writableState;c&&c.autoDestroy||u&&u.autoDestroy?o.destroy(l):o.emit("error",l)}return NR={destroy:t,undestroy:n,errorOrDestroy:i},NR}var AR={},OY;function Mb(){if(OY)return AR;OY=1;function t(l,c){l.prototype=Object.create(c.prototype),l.prototype.constructor=l,l.__proto__=c}var e={};function r(l,c,u){u||(u=Error);function d(f,p,g){return typeof c=="string"?c:c(f,p,g)}var h=function(f){t(p,f);function p(g,m,x){return f.call(this,d(g,m,x))||this}return p}(u);h.prototype.name=u.name,h.prototype.code=l,e[l]=h}function n(l,c){if(Array.isArray(l)){var u=l.length;return l=l.map(function(d){return String(d)}),u>2?"one of ".concat(c," ").concat(l.slice(0,u-1).join(", "),", or ")+l[u-1]:u===2?"one of ".concat(c," ").concat(l[0]," or ").concat(l[1]):"of ".concat(c," ").concat(l[0])}else return"of ".concat(c," ").concat(String(l))}function s(l,c,u){return l.substr(0,c.length)===c}function i(l,c,u){return(u===void 0||u>l.length)&&(u=l.length),l.substring(u-c.length,u)===c}function o(l,c,u){return typeof u!="number"&&(u=0),u+c.length>l.length?!1:l.indexOf(c,u)!==-1}return r("ERR_INVALID_OPT_VALUE",function(l,c){return'The value "'+c+'" is invalid for option "'+l+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(l,c,u){var d;typeof c=="string"&&s(c,"not ")?(d="must not be",c=c.replace(/^not /,"")):d="must be";var h;if(i(l," argument"))h="The ".concat(l," ").concat(d," ").concat(n(c,"type"));else{var f=o(l,".")?"property":"argument";h='The "'.concat(l,'" ').concat(f," ").concat(d," ").concat(n(c,"type"))}return h+=". Received type ".concat(typeof u),h},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(l){return"The "+l+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(l){return"Cannot call "+l+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(l){return"Unknown encoding: "+l},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),AR.codes=e,AR}var ER,IY;function Ape(){if(IY)return ER;IY=1;var t=Mb().codes.ERR_INVALID_OPT_VALUE;function e(n,s,i){return n.highWaterMark!=null?n.highWaterMark:s?n[i]:null}function r(n,s,i,o){var l=e(s,o,i);if(l!=null){if(!(isFinite(l)&&Math.floor(l)===l)||l<0){var c=o?i:"highWaterMark";throw new t(c,l)}return Math.floor(l)}return n.objectMode?16:16*1024}return ER={getHighWaterMark:r},ER}var CR,RY;function ght(){if(RY)return CR;RY=1,CR=t;function t(r,n){if(e("noDeprecation"))return r;var s=!1;function i(){if(!s){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),s=!0}return r.apply(this,arguments)}return i}function e(r){try{if(!lc.localStorage)return!1}catch{return!1}var n=lc.localStorage[r];return n==null?!1:String(n).toLowerCase()==="true"}return CR}var kR,MY;function Epe(){if(MY)return kR;MY=1,kR=k;function t(le){var U=this;this.next=null,this.entry=null,this.finish=function(){oe(U,le)}}var e;k.WritableState=N;var r={deprecate:ght()},n=ppe(),s=eP().Buffer,i=lc.Uint8Array||function(){};function o(le){return s.from(le)}function l(le){return s.isBuffer(le)||le instanceof i}var c=Npe(),u=Ape(),d=u.getHighWaterMark,h=Mb().codes,f=h.ERR_INVALID_ARG_TYPE,p=h.ERR_METHOD_NOT_IMPLEMENTED,g=h.ERR_MULTIPLE_CALLBACK,m=h.ERR_STREAM_CANNOT_PIPE,x=h.ERR_STREAM_DESTROYED,y=h.ERR_STREAM_NULL_VALUES,v=h.ERR_STREAM_WRITE_AFTER_END,b=h.ERR_UNKNOWN_ENCODING,w=c.errorOrDestroy;Cf()(k,n);function j(){}function N(le,U,R){e=e||Xv(),le=le||{},typeof R!="boolean"&&(R=U instanceof e),this.objectMode=!!le.objectMode,R&&(this.objectMode=this.objectMode||!!le.writableObjectMode),this.highWaterMark=d(this,le,"writableHighWaterMark",R),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var ee=le.decodeStrings===!1;this.decodeStrings=!ee,this.defaultEncoding=le.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(te){K(U,te)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=le.emitClose!==!1,this.autoDestroy=!!le.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}N.prototype.getBuffer=function(){for(var U=this.bufferedRequest,R=[];U;)R.push(U),U=U.next;return R},function(){try{Object.defineProperty(N.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var C;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(C=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(U){return C.call(this,U)?!0:this!==k?!1:U&&U._writableState instanceof N}})):C=function(U){return U instanceof this};function k(le){e=e||Xv();var U=this instanceof e;if(!U&&!C.call(k,this))return new k(le);this._writableState=new N(le,this,U),this.writable=!0,le&&(typeof le.write=="function"&&(this._write=le.write),typeof le.writev=="function"&&(this._writev=le.writev),typeof le.destroy=="function"&&(this._destroy=le.destroy),typeof le.final=="function"&&(this._final=le.final)),n.call(this)}k.prototype.pipe=function(){w(this,new m)};function E(le,U){var R=new v;w(le,R),$t.nextTick(U,R)}function M(le,U,R,ee){var te;return R===null?te=new y:typeof R!="string"&&!U.objectMode&&(te=new f("chunk",["string","Buffer"],R)),te?(w(le,te),$t.nextTick(ee,te),!1):!0}k.prototype.write=function(le,U,R){var ee=this._writableState,te=!1,Z=!ee.objectMode&&l(le);return Z&&!s.isBuffer(le)&&(le=o(le)),typeof U=="function"&&(R=U,U=null),Z?U="buffer":U||(U=ee.defaultEncoding),typeof R!="function"&&(R=j),ee.ending?E(this,R):(Z||M(this,ee,le,R))&&(ee.pendingcb++,te=P(this,ee,Z,le,U,R)),te},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var le=this._writableState;le.corked&&(le.corked--,!le.writing&&!le.corked&&!le.bufferProcessing&&le.bufferedRequest&&H(this,le))},k.prototype.setDefaultEncoding=function(U){if(typeof U=="string"&&(U=U.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((U+"").toLowerCase())>-1))throw new b(U);return this._writableState.defaultEncoding=U,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function z(le,U,R){return!le.objectMode&&le.decodeStrings!==!1&&typeof U=="string"&&(U=s.from(U,R)),U}Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function P(le,U,R,ee,te,Z){if(!R){var J=z(U,ee,te);ee!==J&&(R=!0,te="buffer",ee=J)}var he=U.objectMode?1:ee.length;U.length+=he;var O=U.length<U.highWaterMark;if(O||(U.needDrain=!0),U.writing||U.corked){var ie=U.lastBufferedRequest;U.lastBufferedRequest={chunk:ee,encoding:te,isBuf:R,callback:Z,next:null},ie?ie.next=U.lastBufferedRequest:U.bufferedRequest=U.lastBufferedRequest,U.bufferedRequestCount+=1}else V(le,U,!1,he,ee,te,Z);return O}function V(le,U,R,ee,te,Z,J){U.writelen=ee,U.writecb=J,U.writing=!0,U.sync=!0,U.destroyed?U.onwrite(new x("write")):R?le._writev(te,U.onwrite):le._write(te,Z,U.onwrite),U.sync=!1}function A(le,U,R,ee,te){--U.pendingcb,R?($t.nextTick(te,ee),$t.nextTick(W,le,U),le._writableState.errorEmitted=!0,w(le,ee)):(te(ee),le._writableState.errorEmitted=!0,w(le,ee),W(le,U))}function $(le){le.writing=!1,le.writecb=null,le.length-=le.writelen,le.writelen=0}function K(le,U){var R=le._writableState,ee=R.sync,te=R.writecb;if(typeof te!="function")throw new g;if($(R),U)A(le,R,ee,U,te);else{var Z=B(R)||le.destroyed;!Z&&!R.corked&&!R.bufferProcessing&&R.bufferedRequest&&H(le,R),ee?$t.nextTick(G,le,R,Z,te):G(le,R,Z,te)}}function G(le,U,R,ee){R||Y(le,U),U.pendingcb--,ee(),W(le,U)}function Y(le,U){U.length===0&&U.needDrain&&(U.needDrain=!1,le.emit("drain"))}function H(le,U){U.bufferProcessing=!0;var R=U.bufferedRequest;if(le._writev&&R&&R.next){var ee=U.bufferedRequestCount,te=new Array(ee),Z=U.corkedRequestsFree;Z.entry=R;for(var J=0,he=!0;R;)te[J]=R,R.isBuf||(he=!1),R=R.next,J+=1;te.allBuffers=he,V(le,U,!0,U.length,te,"",Z.finish),U.pendingcb++,U.lastBufferedRequest=null,Z.next?(U.corkedRequestsFree=Z.next,Z.next=null):U.corkedRequestsFree=new t(U),U.bufferedRequestCount=0}else{for(;R;){var O=R.chunk,ie=R.encoding,q=R.callback,I=U.objectMode?1:O.length;if(V(le,U,!1,I,O,ie,q),R=R.next,U.bufferedRequestCount--,U.writing)break}R===null&&(U.lastBufferedRequest=null)}U.bufferedRequest=R,U.bufferProcessing=!1}k.prototype._write=function(le,U,R){R(new p("_write()"))},k.prototype._writev=null,k.prototype.end=function(le,U,R){var ee=this._writableState;return typeof le=="function"?(R=le,le=null,U=null):typeof U=="function"&&(R=U,U=null),le!=null&&this.write(le,U),ee.corked&&(ee.corked=1,this.uncork()),ee.ending||X(this,ee,R),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function B(le){return le.ending&&le.length===0&&le.bufferedRequest===null&&!le.finished&&!le.writing}function L(le,U){le._final(function(R){U.pendingcb--,R&&w(le,R),U.prefinished=!0,le.emit("prefinish"),W(le,U)})}function F(le,U){!U.prefinished&&!U.finalCalled&&(typeof le._final=="function"&&!U.destroyed?(U.pendingcb++,U.finalCalled=!0,$t.nextTick(L,le,U)):(U.prefinished=!0,le.emit("prefinish")))}function W(le,U){var R=B(U);if(R&&(F(le,U),U.pendingcb===0&&(U.finished=!0,le.emit("finish"),U.autoDestroy))){var ee=le._readableState;(!ee||ee.autoDestroy&&ee.endEmitted)&&le.destroy()}return R}function X(le,U,R){U.ending=!0,W(le,U),R&&(U.finished?$t.nextTick(R):le.once("finish",R)),U.ended=!0,le.writable=!1}function oe(le,U,R){var ee=le.entry;for(le.entry=null;ee;){var te=ee.callback;U.pendingcb--,te(R),ee=ee.next}U.corkedRequestsFree.next=le}return Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(U){this._writableState&&(this._writableState.destroyed=U)}}),k.prototype.destroy=c.destroy,k.prototype._undestroy=c.undestroy,k.prototype._destroy=function(le,U){U(le)},kR}var TR,DY;function Xv(){if(DY)return TR;DY=1;var t=Object.keys||function(u){var d=[];for(var h in u)d.push(h);return d};TR=o;var e=Cpe(),r=Epe();Cf()(o,e);for(var n=t(r.prototype),s=0;s<n.length;s++){var i=n[s];o.prototype[i]||(o.prototype[i]=r.prototype[i])}function o(u){if(!(this instanceof o))return new o(u);e.call(this,u),r.call(this,u),this.allowHalfOpen=!0,u&&(u.readable===!1&&(this.readable=!1),u.writable===!1&&(this.writable=!1),u.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",l)))}Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||$t.nextTick(c,this)}function c(u){u.end()}return Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(d){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=d,this._writableState.destroyed=d)}}),TR}var PR={},QN={exports:{}},LY;function yht(){return LY||(LY=1,function(t,e){var r=eP(),n=r.Buffer;function s(o,l){for(var c in o)l[c]=o[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(s(r,e),e.Buffer=i);function i(o,l,c){return n(o,l,c)}s(n,i),i.from=function(o,l,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,l,c)},i.alloc=function(o,l,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var u=n(o);return l!==void 0?typeof c=="string"?u.fill(l,c):u.fill(l):u.fill(0),u},i.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},i.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}}(QN,QN.exports)),QN.exports}var FY;function R3(){if(FY)return PR;FY=1;var t=yht().Buffer,e=t.isEncoding||function(y){switch(y=""+y,y&&y.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(y){if(!y)return"utf8";for(var v;;)switch(y){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return y;default:if(v)return;y=(""+y).toLowerCase(),v=!0}}function n(y){var v=r(y);if(typeof v!="string"&&(t.isEncoding===e||!e(y)))throw new Error("Unknown encoding: "+y);return v||y}PR.StringDecoder=s;function s(y){this.encoding=n(y);var v;switch(this.encoding){case"utf16le":this.text=h,this.end=f,v=4;break;case"utf8":this.fillLast=c,v=4;break;case"base64":this.text=p,this.end=g,v=3;break;default:this.write=m,this.end=x;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(v)}s.prototype.write=function(y){if(y.length===0)return"";var v,b;if(this.lastNeed){if(v=this.fillLast(y),v===void 0)return"";b=this.lastNeed,this.lastNeed=0}else b=0;return b<y.length?v?v+this.text(y,b):this.text(y,b):v||""},s.prototype.end=d,s.prototype.text=u,s.prototype.fillLast=function(y){if(this.lastNeed<=y.length)return y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,y.length),this.lastNeed-=y.length};function i(y){return y<=127?0:y>>5===6?2:y>>4===14?3:y>>3===30?4:y>>6===2?-1:-2}function o(y,v,b){var w=v.length-1;if(w<b)return 0;var j=i(v[w]);return j>=0?(j>0&&(y.lastNeed=j-1),j):--w<b||j===-2?0:(j=i(v[w]),j>=0?(j>0&&(y.lastNeed=j-2),j):--w<b||j===-2?0:(j=i(v[w]),j>=0?(j>0&&(j===2?j=0:y.lastNeed=j-3),j):0))}function l(y,v,b){if((v[0]&192)!==128)return y.lastNeed=0,"�";if(y.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return y.lastNeed=1,"�";if(y.lastNeed>2&&v.length>2&&(v[2]&192)!==128)return y.lastNeed=2,"�"}}function c(y){var v=this.lastTotal-this.lastNeed,b=l(this,y);if(b!==void 0)return b;if(this.lastNeed<=y.length)return y.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,v,0,y.length),this.lastNeed-=y.length}function u(y,v){var b=o(this,y,v);if(!this.lastNeed)return y.toString("utf8",v);this.lastTotal=b;var w=y.length-(b-this.lastNeed);return y.copy(this.lastChar,0,w),y.toString("utf8",v,w)}function d(y){var v=y&&y.length?this.write(y):"";return this.lastNeed?v+"�":v}function h(y,v){if((y.length-v)%2===0){var b=y.toString("utf16le",v);if(b){var w=b.charCodeAt(b.length-1);if(w>=55296&&w<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1],b.slice(0,-1)}return b}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=y[y.length-1],y.toString("utf16le",v,y.length-1)}function f(y){var v=y&&y.length?this.write(y):"";if(this.lastNeed){var b=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,b)}return v}function p(y,v){var b=(y.length-v)%3;return b===0?y.toString("base64",v):(this.lastNeed=3-b,this.lastTotal=3,b===1?this.lastChar[0]=y[y.length-1]:(this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1]),y.toString("base64",v,y.length-b))}function g(y){var v=y&&y.length?this.write(y):"";return this.lastNeed?v+this.lastChar.toString("base64",0,3-this.lastNeed):v}function m(y){return y.toString(this.encoding)}function x(y){return y&&y.length?this.write(y):""}return PR}var OR,$Y;function bB(){if($Y)return OR;$Y=1;var t=Mb().codes.ERR_STREAM_PREMATURE_CLOSE;function e(i){var o=!1;return function(){if(!o){o=!0;for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];i.apply(this,c)}}}function r(){}function n(i){return i.setHeader&&typeof i.abort=="function"}function s(i,o,l){if(typeof o=="function")return s(i,null,o);o||(o={}),l=e(l||r);var c=o.readable||o.readable!==!1&&i.readable,u=o.writable||o.writable!==!1&&i.writable,d=function(){i.writable||f()},h=i._writableState&&i._writableState.finished,f=function(){u=!1,h=!0,c||l.call(i)},p=i._readableState&&i._readableState.endEmitted,g=function(){c=!1,p=!0,u||l.call(i)},m=function(b){l.call(i,b)},x=function(){var b;if(c&&!p)return(!i._readableState||!i._readableState.ended)&&(b=new t),l.call(i,b);if(u&&!h)return(!i._writableState||!i._writableState.ended)&&(b=new t),l.call(i,b)},y=function(){i.req.on("finish",f)};return n(i)?(i.on("complete",f),i.on("abort",x),i.req?y():i.on("request",y)):u&&!i._writableState&&(i.on("end",d),i.on("close",d)),i.on("end",g),i.on("finish",f),o.error!==!1&&i.on("error",m),i.on("close",x),function(){i.removeListener("complete",f),i.removeListener("abort",x),i.removeListener("request",y),i.req&&i.req.removeListener("finish",f),i.removeListener("end",d),i.removeListener("close",d),i.removeListener("finish",f),i.removeListener("end",g),i.removeListener("error",m),i.removeListener("close",x)}}return OR=s,OR}var IR,BY;function xht(){if(BY)return IR;BY=1;var t;function e(y,v,b){return v in y?Object.defineProperty(y,v,{value:b,enumerable:!0,configurable:!0,writable:!0}):y[v]=b,y}var r=bB(),n=Symbol("lastResolve"),s=Symbol("lastReject"),i=Symbol("error"),o=Symbol("ended"),l=Symbol("lastPromise"),c=Symbol("handlePromise"),u=Symbol("stream");function d(y,v){return{value:y,done:v}}function h(y){var v=y[n];if(v!==null){var b=y[u].read();b!==null&&(y[l]=null,y[n]=null,y[s]=null,v(d(b,!1)))}}function f(y){$t.nextTick(h,y)}function p(y,v){return function(b,w){y.then(function(){if(v[o]){b(d(void 0,!0));return}v[c](b,w)},w)}}var g=Object.getPrototypeOf(function(){}),m=Object.setPrototypeOf((t={get stream(){return this[u]},next:function(){var v=this,b=this[i];if(b!==null)return Promise.reject(b);if(this[o])return Promise.resolve(d(void 0,!0));if(this[u].destroyed)return new Promise(function(C,k){$t.nextTick(function(){v[i]?k(v[i]):C(d(void 0,!0))})});var w=this[l],j;if(w)j=new Promise(p(w,this));else{var N=this[u].read();if(N!==null)return Promise.resolve(d(N,!1));j=new Promise(this[c])}return this[l]=j,j}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var v=this;return new Promise(function(b,w){v[u].destroy(null,function(j){if(j){w(j);return}b(d(void 0,!0))})})}),t),g),x=function(v){var b,w=Object.create(m,(b={},e(b,u,{value:v,writable:!0}),e(b,n,{value:null,writable:!0}),e(b,s,{value:null,writable:!0}),e(b,i,{value:null,writable:!0}),e(b,o,{value:v._readableState.endEmitted,writable:!0}),e(b,c,{value:function(N,C){var k=w[u].read();k?(w[l]=null,w[n]=null,w[s]=null,N(d(k,!1))):(w[n]=N,w[s]=C)},writable:!0}),b));return w[l]=null,r(v,function(j){if(j&&j.code!=="ERR_STREAM_PREMATURE_CLOSE"){var N=w[s];N!==null&&(w[l]=null,w[n]=null,w[s]=null,N(j)),w[i]=j;return}var C=w[n];C!==null&&(w[l]=null,w[n]=null,w[s]=null,C(d(void 0,!0))),w[o]=!0}),v.on("readable",f.bind(null,w)),w};return IR=x,IR}var RR,UY;function vht(){return UY||(UY=1,RR=function(){throw new Error("Readable.from is not available in the browser")}),RR}var MR,zY;function Cpe(){if(zY)return MR;zY=1,MR=E;var t;E.ReadableState=k,gB().EventEmitter;var e=function(J,he){return J.listeners(he).length},r=ppe(),n=eP().Buffer,s=lc.Uint8Array||function(){};function i(Z){return n.from(Z)}function o(Z){return n.isBuffer(Z)||Z instanceof s}var l=Spe(),c;l&&l.debuglog?c=l.debuglog("stream"):c=function(){};var u=mht(),d=Npe(),h=Ape(),f=h.getHighWaterMark,p=Mb().codes,g=p.ERR_INVALID_ARG_TYPE,m=p.ERR_STREAM_PUSH_AFTER_EOF,x=p.ERR_METHOD_NOT_IMPLEMENTED,y=p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,b,w;Cf()(E,r);var j=d.errorOrDestroy,N=["error","close","destroy","pause","resume"];function C(Z,J,he){if(typeof Z.prependListener=="function")return Z.prependListener(J,he);!Z._events||!Z._events[J]?Z.on(J,he):Array.isArray(Z._events[J])?Z._events[J].unshift(he):Z._events[J]=[he,Z._events[J]]}function k(Z,J,he){t=t||Xv(),Z=Z||{},typeof he!="boolean"&&(he=J instanceof t),this.objectMode=!!Z.objectMode,he&&(this.objectMode=this.objectMode||!!Z.readableObjectMode),this.highWaterMark=f(this,Z,"readableHighWaterMark",he),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=Z.emitClose!==!1,this.autoDestroy=!!Z.autoDestroy,this.destroyed=!1,this.defaultEncoding=Z.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Z.encoding&&(v||(v=R3().StringDecoder),this.decoder=new v(Z.encoding),this.encoding=Z.encoding)}function E(Z){if(t=t||Xv(),!(this instanceof E))return new E(Z);var J=this instanceof t;this._readableState=new k(Z,this,J),this.readable=!0,Z&&(typeof Z.read=="function"&&(this._read=Z.read),typeof Z.destroy=="function"&&(this._destroy=Z.destroy)),r.call(this)}Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(J){this._readableState&&(this._readableState.destroyed=J)}}),E.prototype.destroy=d.destroy,E.prototype._undestroy=d.undestroy,E.prototype._destroy=function(Z,J){J(Z)},E.prototype.push=function(Z,J){var he=this._readableState,O;return he.objectMode?O=!0:typeof Z=="string"&&(J=J||he.defaultEncoding,J!==he.encoding&&(Z=n.from(Z,J),J=""),O=!0),M(this,Z,J,!1,O)},E.prototype.unshift=function(Z){return M(this,Z,null,!0,!1)};function M(Z,J,he,O,ie){c("readableAddChunk",J);var q=Z._readableState;if(J===null)q.reading=!1,K(Z,q);else{var I;if(ie||(I=P(q,J)),I)j(Z,I);else if(q.objectMode||J&&J.length>0)if(typeof J!="string"&&!q.objectMode&&Object.getPrototypeOf(J)!==n.prototype&&(J=i(J)),O)q.endEmitted?j(Z,new y):z(Z,q,J,!0);else if(q.ended)j(Z,new m);else{if(q.destroyed)return!1;q.reading=!1,q.decoder&&!he?(J=q.decoder.write(J),q.objectMode||J.length!==0?z(Z,q,J,!1):H(Z,q)):z(Z,q,J,!1)}else O||(q.reading=!1,H(Z,q))}return!q.ended&&(q.length<q.highWaterMark||q.length===0)}function z(Z,J,he,O){J.flowing&&J.length===0&&!J.sync?(J.awaitDrain=0,Z.emit("data",he)):(J.length+=J.objectMode?1:he.length,O?J.buffer.unshift(he):J.buffer.push(he),J.needReadable&&G(Z)),H(Z,J)}function P(Z,J){var he;return!o(J)&&typeof J!="string"&&J!==void 0&&!Z.objectMode&&(he=new g("chunk",["string","Buffer","Uint8Array"],J)),he}E.prototype.isPaused=function(){return this._readableState.flowing===!1},E.prototype.setEncoding=function(Z){v||(v=R3().StringDecoder);var J=new v(Z);this._readableState.decoder=J,this._readableState.encoding=this._readableState.decoder.encoding;for(var he=this._readableState.buffer.head,O="";he!==null;)O+=J.write(he.data),he=he.next;return this._readableState.buffer.clear(),O!==""&&this._readableState.buffer.push(O),this._readableState.length=O.length,this};var V=1073741824;function A(Z){return Z>=V?Z=V:(Z--,Z|=Z>>>1,Z|=Z>>>2,Z|=Z>>>4,Z|=Z>>>8,Z|=Z>>>16,Z++),Z}function $(Z,J){return Z<=0||J.length===0&&J.ended?0:J.objectMode?1:Z!==Z?J.flowing&&J.length?J.buffer.head.data.length:J.length:(Z>J.highWaterMark&&(J.highWaterMark=A(Z)),Z<=J.length?Z:J.ended?J.length:(J.needReadable=!0,0))}E.prototype.read=function(Z){c("read",Z),Z=parseInt(Z,10);var J=this._readableState,he=Z;if(Z!==0&&(J.emittedReadable=!1),Z===0&&J.needReadable&&((J.highWaterMark!==0?J.length>=J.highWaterMark:J.length>0)||J.ended))return c("read: emitReadable",J.length,J.ended),J.length===0&&J.ended?R(this):G(this),null;if(Z=$(Z,J),Z===0&&J.ended)return J.length===0&&R(this),null;var O=J.needReadable;c("need readable",O),(J.length===0||J.length-Z<J.highWaterMark)&&(O=!0,c("length less than watermark",O)),J.ended||J.reading?(O=!1,c("reading or ended",O)):O&&(c("do read"),J.reading=!0,J.sync=!0,J.length===0&&(J.needReadable=!0),this._read(J.highWaterMark),J.sync=!1,J.reading||(Z=$(he,J)));var ie;return Z>0?ie=U(Z,J):ie=null,ie===null?(J.needReadable=J.length<=J.highWaterMark,Z=0):(J.length-=Z,J.awaitDrain=0),J.length===0&&(J.ended||(J.needReadable=!0),he!==Z&&J.ended&&R(this)),ie!==null&&this.emit("data",ie),ie};function K(Z,J){if(c("onEofChunk"),!J.ended){if(J.decoder){var he=J.decoder.end();he&&he.length&&(J.buffer.push(he),J.length+=J.objectMode?1:he.length)}J.ended=!0,J.sync?G(Z):(J.needReadable=!1,J.emittedReadable||(J.emittedReadable=!0,Y(Z)))}}function G(Z){var J=Z._readableState;c("emitReadable",J.needReadable,J.emittedReadable),J.needReadable=!1,J.emittedReadable||(c("emitReadable",J.flowing),J.emittedReadable=!0,$t.nextTick(Y,Z))}function Y(Z){var J=Z._readableState;c("emitReadable_",J.destroyed,J.length,J.ended),!J.destroyed&&(J.length||J.ended)&&(Z.emit("readable"),J.emittedReadable=!1),J.needReadable=!J.flowing&&!J.ended&&J.length<=J.highWaterMark,le(Z)}function H(Z,J){J.readingMore||(J.readingMore=!0,$t.nextTick(B,Z,J))}function B(Z,J){for(;!J.reading&&!J.ended&&(J.length<J.highWaterMark||J.flowing&&J.length===0);){var he=J.length;if(c("maybeReadMore read 0"),Z.read(0),he===J.length)break}J.readingMore=!1}E.prototype._read=function(Z){j(this,new x("_read()"))},E.prototype.pipe=function(Z,J){var he=this,O=this._readableState;switch(O.pipesCount){case 0:O.pipes=Z;break;case 1:O.pipes=[O.pipes,Z];break;default:O.pipes.push(Z);break}O.pipesCount+=1,c("pipe count=%d opts=%j",O.pipesCount,J);var ie=(!J||J.end!==!1)&&Z!==$t.stdout&&Z!==$t.stderr,q=ie?T:ae;O.endEmitted?$t.nextTick(q):he.once("end",q),Z.on("unpipe",I);function I(de,ge){c("onunpipe"),de===he&&ge&&ge.hasUnpiped===!1&&(ge.hasUnpiped=!0,ue())}function T(){c("onend"),Z.end()}var D=L(he);Z.on("drain",D);var ne=!1;function ue(){c("cleanup"),Z.removeListener("close",ve),Z.removeListener("finish",xe),Z.removeListener("drain",D),Z.removeListener("error",pe),Z.removeListener("unpipe",I),he.removeListener("end",T),he.removeListener("end",ae),he.removeListener("data",re),ne=!0,O.awaitDrain&&(!Z._writableState||Z._writableState.needDrain)&&D()}he.on("data",re);function re(de){c("ondata");var ge=Z.write(de);c("dest.write",ge),ge===!1&&((O.pipesCount===1&&O.pipes===Z||O.pipesCount>1&&te(O.pipes,Z)!==-1)&&!ne&&(c("false write response, pause",O.awaitDrain),O.awaitDrain++),he.pause())}function pe(de){c("onerror",de),ae(),Z.removeListener("error",pe),e(Z,"error")===0&&j(Z,de)}C(Z,"error",pe);function ve(){Z.removeListener("finish",xe),ae()}Z.once("close",ve);function xe(){c("onfinish"),Z.removeListener("close",ve),ae()}Z.once("finish",xe);function ae(){c("unpipe"),he.unpipe(Z)}return Z.emit("pipe",he),O.flowing||(c("pipe resume"),he.resume()),Z};function L(Z){return function(){var he=Z._readableState;c("pipeOnDrain",he.awaitDrain),he.awaitDrain&&he.awaitDrain--,he.awaitDrain===0&&e(Z,"data")&&(he.flowing=!0,le(Z))}}E.prototype.unpipe=function(Z){var J=this._readableState,he={hasUnpiped:!1};if(J.pipesCount===0)return this;if(J.pipesCount===1)return Z&&Z!==J.pipes?this:(Z||(Z=J.pipes),J.pipes=null,J.pipesCount=0,J.flowing=!1,Z&&Z.emit("unpipe",this,he),this);if(!Z){var O=J.pipes,ie=J.pipesCount;J.pipes=null,J.pipesCount=0,J.flowing=!1;for(var q=0;q<ie;q++)O[q].emit("unpipe",this,{hasUnpiped:!1});return this}var I=te(J.pipes,Z);return I===-1?this:(J.pipes.splice(I,1),J.pipesCount-=1,J.pipesCount===1&&(J.pipes=J.pipes[0]),Z.emit("unpipe",this,he),this)},E.prototype.on=function(Z,J){var he=r.prototype.on.call(this,Z,J),O=this._readableState;return Z==="data"?(O.readableListening=this.listenerCount("readable")>0,O.flowing!==!1&&this.resume()):Z==="readable"&&!O.endEmitted&&!O.readableListening&&(O.readableListening=O.needReadable=!0,O.flowing=!1,O.emittedReadable=!1,c("on readable",O.length,O.reading),O.length?G(this):O.reading||$t.nextTick(W,this)),he},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(Z,J){var he=r.prototype.removeListener.call(this,Z,J);return Z==="readable"&&$t.nextTick(F,this),he},E.prototype.removeAllListeners=function(Z){var J=r.prototype.removeAllListeners.apply(this,arguments);return(Z==="readable"||Z===void 0)&&$t.nextTick(F,this),J};function F(Z){var J=Z._readableState;J.readableListening=Z.listenerCount("readable")>0,J.resumeScheduled&&!J.paused?J.flowing=!0:Z.listenerCount("data")>0&&Z.resume()}function W(Z){c("readable nexttick read 0"),Z.read(0)}E.prototype.resume=function(){var Z=this._readableState;return Z.flowing||(c("resume"),Z.flowing=!Z.readableListening,X(this,Z)),Z.paused=!1,this};function X(Z,J){J.resumeScheduled||(J.resumeScheduled=!0,$t.nextTick(oe,Z,J))}function oe(Z,J){c("resume",J.reading),J.reading||Z.read(0),J.resumeScheduled=!1,Z.emit("resume"),le(Z),J.flowing&&!J.reading&&Z.read(0)}E.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function le(Z){var J=Z._readableState;for(c("flow",J.flowing);J.flowing&&Z.read()!==null;);}E.prototype.wrap=function(Z){var J=this,he=this._readableState,O=!1;Z.on("end",function(){if(c("wrapped end"),he.decoder&&!he.ended){var I=he.decoder.end();I&&I.length&&J.push(I)}J.push(null)}),Z.on("data",function(I){if(c("wrapped data"),he.decoder&&(I=he.decoder.write(I)),!(he.objectMode&&I==null)&&!(!he.objectMode&&(!I||!I.length))){var T=J.push(I);T||(O=!0,Z.pause())}});for(var ie in Z)this[ie]===void 0&&typeof Z[ie]=="function"&&(this[ie]=function(T){return function(){return Z[T].apply(Z,arguments)}}(ie));for(var q=0;q<N.length;q++)Z.on(N[q],this.emit.bind(this,N[q]));return this._read=function(I){c("wrapped _read",I),O&&(O=!1,Z.resume())},this},typeof Symbol=="function"&&(E.prototype[Symbol.asyncIterator]=function(){return b===void 0&&(b=xht()),b(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(J){this._readableState&&(this._readableState.flowing=J)}}),E._fromList=U,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function U(Z,J){if(J.length===0)return null;var he;return J.objectMode?he=J.buffer.shift():!Z||Z>=J.length?(J.decoder?he=J.buffer.join(""):J.buffer.length===1?he=J.buffer.first():he=J.buffer.concat(J.length),J.buffer.clear()):he=J.buffer.consume(Z,J.decoder),he}function R(Z){var J=Z._readableState;c("endReadable",J.endEmitted),J.endEmitted||(J.ended=!0,$t.nextTick(ee,J,Z))}function ee(Z,J){if(c("endReadableNT",Z.endEmitted,Z.length),!Z.endEmitted&&Z.length===0&&(Z.endEmitted=!0,J.readable=!1,J.emit("end"),Z.autoDestroy)){var he=J._writableState;(!he||he.autoDestroy&&he.finished)&&J.destroy()}}typeof Symbol=="function"&&(E.from=function(Z,J){return w===void 0&&(w=vht()),w(E,Z,J)});function te(Z,J){for(var he=0,O=Z.length;he<O;he++)if(Z[he]===J)return he;return-1}return MR}var DR,HY;function kpe(){if(HY)return DR;HY=1,DR=l;var t=Mb().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,r=t.ERR_MULTIPLE_CALLBACK,n=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=t.ERR_TRANSFORM_WITH_LENGTH_0,i=Xv();Cf()(l,i);function o(d,h){var f=this._transformState;f.transforming=!1;var p=f.writecb;if(p===null)return this.emit("error",new r);f.writechunk=null,f.writecb=null,h!=null&&this.push(h),p(d);var g=this._readableState;g.reading=!1,(g.needReadable||g.length<g.highWaterMark)&&this._read(g.highWaterMark)}function l(d){if(!(this instanceof l))return new l(d);i.call(this,d),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,d&&(typeof d.transform=="function"&&(this._transform=d.transform),typeof d.flush=="function"&&(this._flush=d.flush)),this.on("prefinish",c)}function c(){var d=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(h,f){u(d,h,f)}):u(this,null,null)}l.prototype.push=function(d,h){return this._transformState.needTransform=!1,i.prototype.push.call(this,d,h)},l.prototype._transform=function(d,h,f){f(new e("_transform()"))},l.prototype._write=function(d,h,f){var p=this._transformState;if(p.writecb=f,p.writechunk=d,p.writeencoding=h,!p.transforming){var g=this._readableState;(p.needTransform||g.needReadable||g.length<g.highWaterMark)&&this._read(g.highWaterMark)}},l.prototype._read=function(d){var h=this._transformState;h.writechunk!==null&&!h.transforming?(h.transforming=!0,this._transform(h.writechunk,h.writeencoding,h.afterTransform)):h.needTransform=!0},l.prototype._destroy=function(d,h){i.prototype._destroy.call(this,d,function(f){h(f)})};function u(d,h,f){if(h)return d.emit("error",h);if(f!=null&&d.push(f),d._writableState.length)throw new s;if(d._transformState.transforming)throw new n;return d.push(null)}return DR}var LR,WY;function bht(){if(WY)return LR;WY=1,LR=e;var t=kpe();Cf()(e,t);function e(r){if(!(this instanceof e))return new e(r);t.call(this,r)}return e.prototype._transform=function(r,n,s){s(null,r)},LR}var FR,VY;function wht(){if(VY)return FR;VY=1;var t;function e(f){var p=!1;return function(){p||(p=!0,f.apply(void 0,arguments))}}var r=Mb().codes,n=r.ERR_MISSING_ARGS,s=r.ERR_STREAM_DESTROYED;function i(f){if(f)throw f}function o(f){return f.setHeader&&typeof f.abort=="function"}function l(f,p,g,m){m=e(m);var x=!1;f.on("close",function(){x=!0}),t===void 0&&(t=bB()),t(f,{readable:p,writable:g},function(v){if(v)return m(v);x=!0,m()});var y=!1;return function(v){if(!x&&!y){if(y=!0,o(f))return f.abort();if(typeof f.destroy=="function")return f.destroy();m(v||new s("pipe"))}}}function c(f){f()}function u(f,p){return f.pipe(p)}function d(f){return!f.length||typeof f[f.length-1]!="function"?i:f.pop()}function h(){for(var f=arguments.length,p=new Array(f),g=0;g<f;g++)p[g]=arguments[g];var m=d(p);if(Array.isArray(p[0])&&(p=p[0]),p.length<2)throw new n("streams");var x,y=p.map(function(v,b){var w=b<p.length-1,j=b>0;return l(v,w,j,function(N){x||(x=N),N&&y.forEach(c),!w&&(y.forEach(c),m(x))})});return p.reduce(u)}return FR=h,FR}var $R,qY;function wB(){if(qY)return $R;qY=1,$R=r;var t=gB().EventEmitter,e=Cf();e(r,t),r.Readable=Cpe(),r.Writable=Epe(),r.Duplex=Xv(),r.Transform=kpe(),r.PassThrough=bht(),r.finished=bB(),r.pipeline=wht(),r.Stream=r;function r(){t.call(this)}return r.prototype.pipe=function(n,s){var i=this;function o(p){n.writable&&n.write(p)===!1&&i.pause&&i.pause()}i.on("data",o);function l(){i.readable&&i.resume&&i.resume()}n.on("drain",l),!n._isStdio&&(!s||s.end!==!1)&&(i.on("end",u),i.on("close",d));var c=!1;function u(){c||(c=!0,n.end())}function d(){c||(c=!0,typeof n.destroy=="function"&&n.destroy())}function h(p){if(f(),t.listenerCount(this,"error")===0)throw p}i.on("error",h),n.on("error",h);function f(){i.removeListener("data",o),n.removeListener("drain",l),i.removeListener("end",u),i.removeListener("close",d),i.removeListener("error",h),n.removeListener("error",h),i.removeListener("end",f),i.removeListener("close",f),n.removeListener("close",f)}return i.on("end",f),i.on("close",f),n.on("close",f),n.emit("pipe",i),n},$R}var GY;function _ht(){return GY||(GY=1,function(t){(function(e){e.parser=function(U,R){return new n(U,R)},e.SAXParser=n,e.SAXStream=d,e.createStream=u,e.MAX_BUFFER_LENGTH=64*1024;var r=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function n(U,R){if(!(this instanceof n))return new n(U,R);var ee=this;i(ee),ee.q=ee.c="",ee.bufferCheckPosition=e.MAX_BUFFER_LENGTH,ee.opt=R||{},ee.opt.lowercase=ee.opt.lowercase||ee.opt.lowercasetags,ee.looseCase=ee.opt.lowercase?"toLowerCase":"toUpperCase",ee.tags=[],ee.closed=ee.closedRoot=ee.sawRoot=!1,ee.tag=ee.error=null,ee.strict=!!U,ee.noscript=!!(U||ee.opt.noscript),ee.state=E.BEGIN,ee.strictEntities=ee.opt.strictEntities,ee.ENTITIES=ee.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),ee.attribList=[],ee.opt.xmlns&&(ee.ns=Object.create(m)),ee.trackPosition=ee.opt.position!==!1,ee.trackPosition&&(ee.position=ee.line=ee.column=0),z(ee,"onready")}Object.create||(Object.create=function(U){function R(){}R.prototype=U;var ee=new R;return ee}),Object.keys||(Object.keys=function(U){var R=[];for(var ee in U)U.hasOwnProperty(ee)&&R.push(ee);return R});function s(U){for(var R=Math.max(e.MAX_BUFFER_LENGTH,10),ee=0,te=0,Z=r.length;te<Z;te++){var J=U[r[te]].length;if(J>R)switch(r[te]){case"textNode":V(U);break;case"cdata":P(U,"oncdata",U.cdata),U.cdata="";break;case"script":P(U,"onscript",U.script),U.script="";break;default:$(U,"Max buffer length exceeded: "+r[te])}ee=Math.max(ee,J)}var he=e.MAX_BUFFER_LENGTH-ee;U.bufferCheckPosition=he+U.position}function i(U){for(var R=0,ee=r.length;R<ee;R++)U[r[R]]=""}function o(U){V(U),U.cdata!==""&&(P(U,"oncdata",U.cdata),U.cdata=""),U.script!==""&&(P(U,"onscript",U.script),U.script="")}n.prototype={end:function(){K(this)},write:le,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){o(this)}};var l;try{l=wB().Stream}catch{l=function(){}}var c=e.EVENTS.filter(function(U){return U!=="error"&&U!=="end"});function u(U,R){return new d(U,R)}function d(U,R){if(!(this instanceof d))return new d(U,R);l.apply(this),this._parser=new n(U,R),this.writable=!0,this.readable=!0;var ee=this;this._parser.onend=function(){ee.emit("end")},this._parser.onerror=function(te){ee.emit("error",te),ee._parser.error=null},this._decoder=null,c.forEach(function(te){Object.defineProperty(ee,"on"+te,{get:function(){return ee._parser["on"+te]},set:function(Z){if(!Z)return ee.removeAllListeners(te),ee._parser["on"+te]=Z,Z;ee.on(te,Z)},enumerable:!0,configurable:!1})})}d.prototype=Object.create(l.prototype,{constructor:{value:d}}),d.prototype.write=function(U){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(U)){if(!this._decoder){var R=R3().StringDecoder;this._decoder=new R("utf8")}U=this._decoder.write(U)}return this._parser.write(U.toString()),this.emit("data",U),!0},d.prototype.end=function(U){return U&&U.length&&this.write(U),this._parser.end(),!0},d.prototype.on=function(U,R){var ee=this;return!ee._parser["on"+U]&&c.indexOf(U)!==-1&&(ee._parser["on"+U]=function(){var te=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);te.splice(0,0,U),ee.emit.apply(ee,te)}),l.prototype.on.call(ee,U,R)};var h="[CDATA[",f="DOCTYPE",p="http://www.w3.org/XML/1998/namespace",g="http://www.w3.org/2000/xmlns/",m={xml:p,xmlns:g},x=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,y=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,v=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,b=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function w(U){return U===" "||U===`
`||U==="\r"||U===" "}function j(U){return U==='"'||U==="'"}function N(U){return U===">"||w(U)}function C(U,R){return U.test(R)}function k(U,R){return!C(U,R)}var E=0;e.STATE={BEGIN:E++,BEGIN_WHITESPACE:E++,TEXT:E++,TEXT_ENTITY:E++,OPEN_WAKA:E++,SGML_DECL:E++,SGML_DECL_QUOTED:E++,DOCTYPE:E++,DOCTYPE_QUOTED:E++,DOCTYPE_DTD:E++,DOCTYPE_DTD_QUOTED:E++,COMMENT_STARTING:E++,COMMENT:E++,COMMENT_ENDING:E++,COMMENT_ENDED:E++,CDATA:E++,CDATA_ENDING:E++,CDATA_ENDING_2:E++,PROC_INST:E++,PROC_INST_BODY:E++,PROC_INST_ENDING:E++,OPEN_TAG:E++,OPEN_TAG_SLASH:E++,ATTRIB:E++,ATTRIB_NAME:E++,ATTRIB_NAME_SAW_WHITE:E++,ATTRIB_VALUE:E++,ATTRIB_VALUE_QUOTED:E++,ATTRIB_VALUE_CLOSED:E++,ATTRIB_VALUE_UNQUOTED:E++,ATTRIB_VALUE_ENTITY_Q:E++,ATTRIB_VALUE_ENTITY_U:E++,CLOSE_TAG:E++,CLOSE_TAG_SAW_WHITE:E++,SCRIPT:E++,SCRIPT_ENDING:E++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach(function(U){var R=e.ENTITIES[U],ee=typeof R=="number"?String.fromCharCode(R):R;e.ENTITIES[U]=ee});for(var M in e.STATE)e.STATE[e.STATE[M]]=M;E=e.STATE;function z(U,R,ee){U[R]&&U[R](ee)}function P(U,R,ee){U.textNode&&V(U),z(U,R,ee)}function V(U){U.textNode=A(U.opt,U.textNode),U.textNode&&z(U,"ontext",U.textNode),U.textNode=""}function A(U,R){return U.trim&&(R=R.trim()),U.normalize&&(R=R.replace(/\s+/g," ")),R}function $(U,R){return V(U),U.trackPosition&&(R+=`
Line: `+U.line+`
Column: `+U.column+`
Char: `+U.c),R=new Error(R),U.error=R,z(U,"onerror",R),U}function K(U){return U.sawRoot&&!U.closedRoot&&G(U,"Unclosed root tag"),U.state!==E.BEGIN&&U.state!==E.BEGIN_WHITESPACE&&U.state!==E.TEXT&&$(U,"Unexpected end"),V(U),U.c="",U.closed=!0,z(U,"onend"),n.call(U,U.strict,U.opt),U}function G(U,R){if(typeof U!="object"||!(U instanceof n))throw new Error("bad call to strictFail");U.strict&&$(U,R)}function Y(U){U.strict||(U.tagName=U.tagName[U.looseCase]());var R=U.tags[U.tags.length-1]||U,ee=U.tag={name:U.tagName,attributes:{}};U.opt.xmlns&&(ee.ns=R.ns),U.attribList.length=0,P(U,"onopentagstart",ee)}function H(U,R){var ee=U.indexOf(":"),te=ee<0?["",U]:U.split(":"),Z=te[0],J=te[1];return R&&U==="xmlns"&&(Z="xmlns",J=""),{prefix:Z,local:J}}function B(U){if(U.strict||(U.attribName=U.attribName[U.looseCase]()),U.attribList.indexOf(U.attribName)!==-1||U.tag.attributes.hasOwnProperty(U.attribName)){U.attribName=U.attribValue="";return}if(U.opt.xmlns){var R=H(U.attribName,!0),ee=R.prefix,te=R.local;if(ee==="xmlns")if(te==="xml"&&U.attribValue!==p)G(U,"xml: prefix must be bound to "+p+`
Actual: `+U.attribValue);else if(te==="xmlns"&&U.attribValue!==g)G(U,"xmlns: prefix must be bound to "+g+`
Actual: `+U.attribValue);else{var Z=U.tag,J=U.tags[U.tags.length-1]||U;Z.ns===J.ns&&(Z.ns=Object.create(J.ns)),Z.ns[te]=U.attribValue}U.attribList.push([U.attribName,U.attribValue])}else U.tag.attributes[U.attribName]=U.attribValue,P(U,"onattribute",{name:U.attribName,value:U.attribValue});U.attribName=U.attribValue=""}function L(U,R){if(U.opt.xmlns){var ee=U.tag,te=H(U.tagName);ee.prefix=te.prefix,ee.local=te.local,ee.uri=ee.ns[te.prefix]||"",ee.prefix&&!ee.uri&&(G(U,"Unbound namespace prefix: "+JSON.stringify(U.tagName)),ee.uri=te.prefix);var Z=U.tags[U.tags.length-1]||U;ee.ns&&Z.ns!==ee.ns&&Object.keys(ee.ns).forEach(function(re){P(U,"onopennamespace",{prefix:re,uri:ee.ns[re]})});for(var J=0,he=U.attribList.length;J<he;J++){var O=U.attribList[J],ie=O[0],q=O[1],I=H(ie,!0),T=I.prefix,D=I.local,ne=T===""?"":ee.ns[T]||"",ue={name:ie,value:q,prefix:T,local:D,uri:ne};T&&T!=="xmlns"&&!ne&&(G(U,"Unbound namespace prefix: "+JSON.stringify(T)),ue.uri=T),U.tag.attributes[ie]=ue,P(U,"onattribute",ue)}U.attribList.length=0}U.tag.isSelfClosing=!!R,U.sawRoot=!0,U.tags.push(U.tag),P(U,"onopentag",U.tag),R||(!U.noscript&&U.tagName.toLowerCase()==="script"?U.state=E.SCRIPT:U.state=E.TEXT,U.tag=null,U.tagName=""),U.attribName=U.attribValue="",U.attribList.length=0}function F(U){if(!U.tagName){G(U,"Weird empty close tag."),U.textNode+="</>",U.state=E.TEXT;return}if(U.script){if(U.tagName!=="script"){U.script+="</"+U.tagName+">",U.tagName="",U.state=E.SCRIPT;return}P(U,"onscript",U.script),U.script=""}var R=U.tags.length,ee=U.tagName;U.strict||(ee=ee[U.looseCase]());for(var te=ee;R--;){var Z=U.tags[R];if(Z.name!==te)G(U,"Unexpected close tag");else break}if(R<0){G(U,"Unmatched closing tag: "+U.tagName),U.textNode+="</"+U.tagName+">",U.state=E.TEXT;return}U.tagName=ee;for(var J=U.tags.length;J-- >R;){var he=U.tag=U.tags.pop();U.tagName=U.tag.name,P(U,"onclosetag",U.tagName);var O={};for(var ie in he.ns)O[ie]=he.ns[ie];var q=U.tags[U.tags.length-1]||U;U.opt.xmlns&&he.ns!==q.ns&&Object.keys(he.ns).forEach(function(I){var T=he.ns[I];P(U,"onclosenamespace",{prefix:I,uri:T})})}R===0&&(U.closedRoot=!0),U.tagName=U.attribValue=U.attribName="",U.attribList.length=0,U.state=E.TEXT}function W(U){var R=U.entity,ee=R.toLowerCase(),te,Z="";return U.ENTITIES[R]?U.ENTITIES[R]:U.ENTITIES[ee]?U.ENTITIES[ee]:(R=ee,R.charAt(0)==="#"&&(R.charAt(1)==="x"?(R=R.slice(2),te=parseInt(R,16),Z=te.toString(16)):(R=R.slice(1),te=parseInt(R,10),Z=te.toString(10))),R=R.replace(/^0+/,""),isNaN(te)||Z.toLowerCase()!==R?(G(U,"Invalid character entity"),"&"+U.entity+";"):String.fromCodePoint(te))}function X(U,R){R==="<"?(U.state=E.OPEN_WAKA,U.startTagPosition=U.position):w(R)||(G(U,"Non-whitespace before first tag."),U.textNode=R,U.state=E.TEXT)}function oe(U,R){var ee="";return R<U.length&&(ee=U.charAt(R)),ee}function le(U){var R=this;if(this.error)throw this.error;if(R.closed)return $(R,"Cannot write after close. Assign an onready handler.");if(U===null)return K(R);typeof U=="object"&&(U=U.toString());for(var ee=0,te="";te=oe(U,ee++),R.c=te,!!te;)switch(R.trackPosition&&(R.position++,te===`
`?(R.line++,R.column=0):R.column++),R.state){case E.BEGIN:if(R.state=E.BEGIN_WHITESPACE,te==="\uFEFF")continue;X(R,te);continue;case E.BEGIN_WHITESPACE:X(R,te);continue;case E.TEXT:if(R.sawRoot&&!R.closedRoot){for(var Z=ee-1;te&&te!=="<"&&te!=="&";)te=oe(U,ee++),te&&R.trackPosition&&(R.position++,te===`
`?(R.line++,R.column=0):R.column++);R.textNode+=U.substring(Z,ee-1)}te==="<"&&!(R.sawRoot&&R.closedRoot&&!R.strict)?(R.state=E.OPEN_WAKA,R.startTagPosition=R.position):(!w(te)&&(!R.sawRoot||R.closedRoot)&&G(R,"Text data outside of root node."),te==="&"?R.state=E.TEXT_ENTITY:R.textNode+=te);continue;case E.SCRIPT:te==="<"?R.state=E.SCRIPT_ENDING:R.script+=te;continue;case E.SCRIPT_ENDING:te==="/"?R.state=E.CLOSE_TAG:(R.script+="<"+te,R.state=E.SCRIPT);continue;case E.OPEN_WAKA:if(te==="!")R.state=E.SGML_DECL,R.sgmlDecl="";else if(!w(te))if(C(x,te))R.state=E.OPEN_TAG,R.tagName=te;else if(te==="/")R.state=E.CLOSE_TAG,R.tagName="";else if(te==="?")R.state=E.PROC_INST,R.procInstName=R.procInstBody="";else{if(G(R,"Unencoded <"),R.startTagPosition+1<R.position){var J=R.position-R.startTagPosition;te=new Array(J).join(" ")+te}R.textNode+="<"+te,R.state=E.TEXT}continue;case E.SGML_DECL:(R.sgmlDecl+te).toUpperCase()===h?(P(R,"onopencdata"),R.state=E.CDATA,R.sgmlDecl="",R.cdata=""):R.sgmlDecl+te==="--"?(R.state=E.COMMENT,R.comment="",R.sgmlDecl=""):(R.sgmlDecl+te).toUpperCase()===f?(R.state=E.DOCTYPE,(R.doctype||R.sawRoot)&&G(R,"Inappropriately located doctype declaration"),R.doctype="",R.sgmlDecl=""):te===">"?(P(R,"onsgmldeclaration",R.sgmlDecl),R.sgmlDecl="",R.state=E.TEXT):(j(te)&&(R.state=E.SGML_DECL_QUOTED),R.sgmlDecl+=te);continue;case E.SGML_DECL_QUOTED:te===R.q&&(R.state=E.SGML_DECL,R.q=""),R.sgmlDecl+=te;continue;case E.DOCTYPE:te===">"?(R.state=E.TEXT,P(R,"ondoctype",R.doctype),R.doctype=!0):(R.doctype+=te,te==="["?R.state=E.DOCTYPE_DTD:j(te)&&(R.state=E.DOCTYPE_QUOTED,R.q=te));continue;case E.DOCTYPE_QUOTED:R.doctype+=te,te===R.q&&(R.q="",R.state=E.DOCTYPE);continue;case E.DOCTYPE_DTD:R.doctype+=te,te==="]"?R.state=E.DOCTYPE:j(te)&&(R.state=E.DOCTYPE_DTD_QUOTED,R.q=te);continue;case E.DOCTYPE_DTD_QUOTED:R.doctype+=te,te===R.q&&(R.state=E.DOCTYPE_DTD,R.q="");continue;case E.COMMENT:te==="-"?R.state=E.COMMENT_ENDING:R.comment+=te;continue;case E.COMMENT_ENDING:te==="-"?(R.state=E.COMMENT_ENDED,R.comment=A(R.opt,R.comment),R.comment&&P(R,"oncomment",R.comment),R.comment=""):(R.comment+="-"+te,R.state=E.COMMENT);continue;case E.COMMENT_ENDED:te!==">"?(G(R,"Malformed comment"),R.comment+="--"+te,R.state=E.COMMENT):R.state=E.TEXT;continue;case E.CDATA:te==="]"?R.state=E.CDATA_ENDING:R.cdata+=te;continue;case E.CDATA_ENDING:te==="]"?R.state=E.CDATA_ENDING_2:(R.cdata+="]"+te,R.state=E.CDATA);continue;case E.CDATA_ENDING_2:te===">"?(R.cdata&&P(R,"oncdata",R.cdata),P(R,"onclosecdata"),R.cdata="",R.state=E.TEXT):te==="]"?R.cdata+="]":(R.cdata+="]]"+te,R.state=E.CDATA);continue;case E.PROC_INST:te==="?"?R.state=E.PROC_INST_ENDING:w(te)?R.state=E.PROC_INST_BODY:R.procInstName+=te;continue;case E.PROC_INST_BODY:if(!R.procInstBody&&w(te))continue;te==="?"?R.state=E.PROC_INST_ENDING:R.procInstBody+=te;continue;case E.PROC_INST_ENDING:te===">"?(P(R,"onprocessinginstruction",{name:R.procInstName,body:R.procInstBody}),R.procInstName=R.procInstBody="",R.state=E.TEXT):(R.procInstBody+="?"+te,R.state=E.PROC_INST_BODY);continue;case E.OPEN_TAG:C(y,te)?R.tagName+=te:(Y(R),te===">"?L(R):te==="/"?R.state=E.OPEN_TAG_SLASH:(w(te)||G(R,"Invalid character in tag name"),R.state=E.ATTRIB));continue;case E.OPEN_TAG_SLASH:te===">"?(L(R,!0),F(R)):(G(R,"Forward-slash in opening tag not followed by >"),R.state=E.ATTRIB);continue;case E.ATTRIB:if(w(te))continue;te===">"?L(R):te==="/"?R.state=E.OPEN_TAG_SLASH:C(x,te)?(R.attribName=te,R.attribValue="",R.state=E.ATTRIB_NAME):G(R,"Invalid attribute name");continue;case E.ATTRIB_NAME:te==="="?R.state=E.ATTRIB_VALUE:te===">"?(G(R,"Attribute without value"),R.attribValue=R.attribName,B(R),L(R)):w(te)?R.state=E.ATTRIB_NAME_SAW_WHITE:C(y,te)?R.attribName+=te:G(R,"Invalid attribute name");continue;case E.ATTRIB_NAME_SAW_WHITE:if(te==="=")R.state=E.ATTRIB_VALUE;else{if(w(te))continue;G(R,"Attribute without value"),R.tag.attributes[R.attribName]="",R.attribValue="",P(R,"onattribute",{name:R.attribName,value:""}),R.attribName="",te===">"?L(R):C(x,te)?(R.attribName=te,R.state=E.ATTRIB_NAME):(G(R,"Invalid attribute name"),R.state=E.ATTRIB)}continue;case E.ATTRIB_VALUE:if(w(te))continue;j(te)?(R.q=te,R.state=E.ATTRIB_VALUE_QUOTED):(G(R,"Unquoted attribute value"),R.state=E.ATTRIB_VALUE_UNQUOTED,R.attribValue=te);continue;case E.ATTRIB_VALUE_QUOTED:if(te!==R.q){te==="&"?R.state=E.ATTRIB_VALUE_ENTITY_Q:R.attribValue+=te;continue}B(R),R.q="",R.state=E.ATTRIB_VALUE_CLOSED;continue;case E.ATTRIB_VALUE_CLOSED:w(te)?R.state=E.ATTRIB:te===">"?L(R):te==="/"?R.state=E.OPEN_TAG_SLASH:C(x,te)?(G(R,"No whitespace between attributes"),R.attribName=te,R.attribValue="",R.state=E.ATTRIB_NAME):G(R,"Invalid attribute name");continue;case E.ATTRIB_VALUE_UNQUOTED:if(!N(te)){te==="&"?R.state=E.ATTRIB_VALUE_ENTITY_U:R.attribValue+=te;continue}B(R),te===">"?L(R):R.state=E.ATTRIB;continue;case E.CLOSE_TAG:if(R.tagName)te===">"?F(R):C(y,te)?R.tagName+=te:R.script?(R.script+="</"+R.tagName,R.tagName="",R.state=E.SCRIPT):(w(te)||G(R,"Invalid tagname in closing tag"),R.state=E.CLOSE_TAG_SAW_WHITE);else{if(w(te))continue;k(x,te)?R.script?(R.script+="</"+te,R.state=E.SCRIPT):G(R,"Invalid tagname in closing tag."):R.tagName=te}continue;case E.CLOSE_TAG_SAW_WHITE:if(w(te))continue;te===">"?F(R):G(R,"Invalid characters in closing tag");continue;case E.TEXT_ENTITY:case E.ATTRIB_VALUE_ENTITY_Q:case E.ATTRIB_VALUE_ENTITY_U:var he,O;switch(R.state){case E.TEXT_ENTITY:he=E.TEXT,O="textNode";break;case E.ATTRIB_VALUE_ENTITY_Q:he=E.ATTRIB_VALUE_QUOTED,O="attribValue";break;case E.ATTRIB_VALUE_ENTITY_U:he=E.ATTRIB_VALUE_UNQUOTED,O="attribValue";break}te===";"?(R[O]+=W(R),R.entity="",R.state=he):C(R.entity.length?b:v,te)?R.entity+=te:(G(R,"Invalid character in entity name"),R[O]+="&"+R.entity+te,R.entity="",R.state=he);continue;default:throw new Error(R,"Unknown state: "+R.state)}return R.position>=R.bufferCheckPosition&&s(R),R}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var U=String.fromCharCode,R=Math.floor,ee=function(){var te=16384,Z=[],J,he,O=-1,ie=arguments.length;if(!ie)return"";for(var q="";++O<ie;){var I=Number(arguments[O]);if(!isFinite(I)||I<0||I>1114111||R(I)!==I)throw RangeError("Invalid code point: "+I);I<=65535?Z.push(I):(I-=65536,J=(I>>10)+55296,he=I%1024+56320,Z.push(J,he)),(O+1===ie||Z.length>te)&&(q+=U.apply(null,Z),Z.length=0)}return q};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:ee,configurable:!0,writable:!0}):String.fromCodePoint=ee}()})(t)}(SI)),SI}var BR,KY;function _B(){return KY||(KY=1,BR={isArray:function(t){return Array.isArray?Array.isArray(t):Object.prototype.toString.call(t)==="[object Array]"}}),BR}var UR,YY;function jB(){if(YY)return UR;YY=1;var t=_B().isArray;return UR={copyOptions:function(e){var r,n={};for(r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return n},ensureFlagExists:function(e,r){(!(e in r)||typeof r[e]!="boolean")&&(r[e]=!1)},ensureSpacesExists:function(e){(!("spaces"in e)||typeof e.spaces!="number"&&typeof e.spaces!="string")&&(e.spaces=0)},ensureAlwaysArrayExists:function(e){(!("alwaysArray"in e)||typeof e.alwaysArray!="boolean"&&!t(e.alwaysArray))&&(e.alwaysArray=!1)},ensureKeyExists:function(e,r){(!(e+"Key"in r)||typeof r[e+"Key"]!="string")&&(r[e+"Key"]=r.compact?"_"+e:e)},checkFnExists:function(e,r){return e+"Fn"in r}},UR}var zR,XY;function Tpe(){if(XY)return zR;XY=1;var t=_ht(),e=jB(),r=_B().isArray,n,s;function i(y){return n=e.copyOptions(y),e.ensureFlagExists("ignoreDeclaration",n),e.ensureFlagExists("ignoreInstruction",n),e.ensureFlagExists("ignoreAttributes",n),e.ensureFlagExists("ignoreText",n),e.ensureFlagExists("ignoreComment",n),e.ensureFlagExists("ignoreCdata",n),e.ensureFlagExists("ignoreDoctype",n),e.ensureFlagExists("compact",n),e.ensureFlagExists("alwaysChildren",n),e.ensureFlagExists("addParent",n),e.ensureFlagExists("trim",n),e.ensureFlagExists("nativeType",n),e.ensureFlagExists("nativeTypeAttributes",n),e.ensureFlagExists("sanitize",n),e.ensureFlagExists("instructionHasAttributes",n),e.ensureFlagExists("captureSpacesBetweenElements",n),e.ensureAlwaysArrayExists(n),e.ensureKeyExists("declaration",n),e.ensureKeyExists("instruction",n),e.ensureKeyExists("attributes",n),e.ensureKeyExists("text",n),e.ensureKeyExists("comment",n),e.ensureKeyExists("cdata",n),e.ensureKeyExists("doctype",n),e.ensureKeyExists("type",n),e.ensureKeyExists("name",n),e.ensureKeyExists("elements",n),e.ensureKeyExists("parent",n),e.checkFnExists("doctype",n),e.checkFnExists("instruction",n),e.checkFnExists("cdata",n),e.checkFnExists("comment",n),e.checkFnExists("text",n),e.checkFnExists("instructionName",n),e.checkFnExists("elementName",n),e.checkFnExists("attributeName",n),e.checkFnExists("attributeValue",n),e.checkFnExists("attributes",n),n}function o(y){var v=Number(y);if(!isNaN(v))return v;var b=y.toLowerCase();return b==="true"?!0:b==="false"?!1:y}function l(y,v){var b;if(n.compact){if(!s[n[y+"Key"]]&&(r(n.alwaysArray)?n.alwaysArray.indexOf(n[y+"Key"])!==-1:n.alwaysArray)&&(s[n[y+"Key"]]=[]),s[n[y+"Key"]]&&!r(s[n[y+"Key"]])&&(s[n[y+"Key"]]=[s[n[y+"Key"]]]),y+"Fn"in n&&typeof v=="string"&&(v=n[y+"Fn"](v,s)),y==="instruction"&&("instructionFn"in n||"instructionNameFn"in n)){for(b in v)if(v.hasOwnProperty(b))if("instructionFn"in n)v[b]=n.instructionFn(v[b],b,s);else{var w=v[b];delete v[b],v[n.instructionNameFn(b,w,s)]=w}}r(s[n[y+"Key"]])?s[n[y+"Key"]].push(v):s[n[y+"Key"]]=v}else{s[n.elementsKey]||(s[n.elementsKey]=[]);var j={};if(j[n.typeKey]=y,y==="instruction"){for(b in v)if(v.hasOwnProperty(b))break;j[n.nameKey]="instructionNameFn"in n?n.instructionNameFn(b,v,s):b,n.instructionHasAttributes?(j[n.attributesKey]=v[b][n.attributesKey],"instructionFn"in n&&(j[n.attributesKey]=n.instructionFn(j[n.attributesKey],b,s))):("instructionFn"in n&&(v[b]=n.instructionFn(v[b],b,s)),j[n.instructionKey]=v[b])}else y+"Fn"in n&&(v=n[y+"Fn"](v,s)),j[n[y+"Key"]]=v;n.addParent&&(j[n.parentKey]=s),s[n.elementsKey].push(j)}}function c(y){if("attributesFn"in n&&y&&(y=n.attributesFn(y,s)),(n.trim||"attributeValueFn"in n||"attributeNameFn"in n||n.nativeTypeAttributes)&&y){var v;for(v in y)if(y.hasOwnProperty(v)&&(n.trim&&(y[v]=y[v].trim()),n.nativeTypeAttributes&&(y[v]=o(y[v])),"attributeValueFn"in n&&(y[v]=n.attributeValueFn(y[v],v,s)),"attributeNameFn"in n)){var b=y[v];delete y[v],y[n.attributeNameFn(v,y[v],s)]=b}}return y}function u(y){var v={};if(y.body&&(y.name.toLowerCase()==="xml"||n.instructionHasAttributes)){for(var b=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,w;(w=b.exec(y.body))!==null;)v[w[1]]=w[2]||w[3]||w[4];v=c(v)}if(y.name.toLowerCase()==="xml"){if(n.ignoreDeclaration)return;s[n.declarationKey]={},Object.keys(v).length&&(s[n.declarationKey][n.attributesKey]=v),n.addParent&&(s[n.declarationKey][n.parentKey]=s)}else{if(n.ignoreInstruction)return;n.trim&&(y.body=y.body.trim());var j={};n.instructionHasAttributes&&Object.keys(v).length?(j[y.name]={},j[y.name][n.attributesKey]=v):j[y.name]=y.body,l("instruction",j)}}function d(y,v){var b;if(typeof y=="object"&&(v=y.attributes,y=y.name),v=c(v),"elementNameFn"in n&&(y=n.elementNameFn(y,s)),n.compact){if(b={},!n.ignoreAttributes&&v&&Object.keys(v).length){b[n.attributesKey]={};var w;for(w in v)v.hasOwnProperty(w)&&(b[n.attributesKey][w]=v[w])}!(y in s)&&(r(n.alwaysArray)?n.alwaysArray.indexOf(y)!==-1:n.alwaysArray)&&(s[y]=[]),s[y]&&!r(s[y])&&(s[y]=[s[y]]),r(s[y])?s[y].push(b):s[y]=b}else s[n.elementsKey]||(s[n.elementsKey]=[]),b={},b[n.typeKey]="element",b[n.nameKey]=y,!n.ignoreAttributes&&v&&Object.keys(v).length&&(b[n.attributesKey]=v),n.alwaysChildren&&(b[n.elementsKey]=[]),s[n.elementsKey].push(b);b[n.parentKey]=s,s=b}function h(y){n.ignoreText||!y.trim()&&!n.captureSpacesBetweenElements||(n.trim&&(y=y.trim()),n.nativeType&&(y=o(y)),n.sanitize&&(y=y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")),l("text",y))}function f(y){n.ignoreComment||(n.trim&&(y=y.trim()),l("comment",y))}function p(y){var v=s[n.parentKey];n.addParent||delete s[n.parentKey],s=v}function g(y){n.ignoreCdata||(n.trim&&(y=y.trim()),l("cdata",y))}function m(y){n.ignoreDoctype||(y=y.replace(/^ /,""),n.trim&&(y=y.trim()),l("doctype",y))}function x(y){y.note=y}return zR=function(y,v){var b=t.parser(!0,{}),w={};if(s=w,n=i(v),b.opt={strictEntities:!0},b.onopentag=d,b.ontext=h,b.oncomment=f,b.onclosetag=p,b.onerror=x,b.oncdata=g,b.ondoctype=m,b.onprocessinginstruction=u,b.write(y).close(),w[n.elementsKey]){var j=w[n.elementsKey];delete w[n.elementsKey],w[n.elementsKey]=j,delete w.text}return w},zR}var HR,QY;function jht(){if(QY)return HR;QY=1;var t=jB(),e=Tpe();function r(n){var s=t.copyOptions(n);return t.ensureSpacesExists(s),s}return HR=function(n,s){var i,o,l,c;return i=r(s),o=e(n,i),c="compact"in i&&i.compact?"_parent":"parent","addParent"in i&&i.addParent?l=JSON.stringify(o,function(u,d){return u===c?"_":d},i.spaces):l=JSON.stringify(o,null,i.spaces),l.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},HR}var WR,ZY;function Ppe(){if(ZY)return WR;ZY=1;var t=jB(),e=_B().isArray,r,n;function s(b){var w=t.copyOptions(b);return t.ensureFlagExists("ignoreDeclaration",w),t.ensureFlagExists("ignoreInstruction",w),t.ensureFlagExists("ignoreAttributes",w),t.ensureFlagExists("ignoreText",w),t.ensureFlagExists("ignoreComment",w),t.ensureFlagExists("ignoreCdata",w),t.ensureFlagExists("ignoreDoctype",w),t.ensureFlagExists("compact",w),t.ensureFlagExists("indentText",w),t.ensureFlagExists("indentCdata",w),t.ensureFlagExists("indentAttributes",w),t.ensureFlagExists("indentInstruction",w),t.ensureFlagExists("fullTagEmptyElement",w),t.ensureFlagExists("noQuotesForNativeAttributes",w),t.ensureSpacesExists(w),typeof w.spaces=="number"&&(w.spaces=Array(w.spaces+1).join(" ")),t.ensureKeyExists("declaration",w),t.ensureKeyExists("instruction",w),t.ensureKeyExists("attributes",w),t.ensureKeyExists("text",w),t.ensureKeyExists("comment",w),t.ensureKeyExists("cdata",w),t.ensureKeyExists("doctype",w),t.ensureKeyExists("type",w),t.ensureKeyExists("name",w),t.ensureKeyExists("elements",w),t.checkFnExists("doctype",w),t.checkFnExists("instruction",w),t.checkFnExists("cdata",w),t.checkFnExists("comment",w),t.checkFnExists("text",w),t.checkFnExists("instructionName",w),t.checkFnExists("elementName",w),t.checkFnExists("attributeName",w),t.checkFnExists("attributeValue",w),t.checkFnExists("attributes",w),t.checkFnExists("fullTagEmptyElement",w),w}function i(b,w,j){return(!j&&b.spaces?`
`:"")+Array(w+1).join(b.spaces)}function o(b,w,j){if(w.ignoreAttributes)return"";"attributesFn"in w&&(b=w.attributesFn(b,n,r));var N,C,k,E,M=[];for(N in b)b.hasOwnProperty(N)&&b[N]!==null&&b[N]!==void 0&&(E=w.noQuotesForNativeAttributes&&typeof b[N]!="string"?"":'"',C=""+b[N],C=C.replace(/"/g,"""),k="attributeNameFn"in w?w.attributeNameFn(N,C,n,r):N,M.push(w.spaces&&w.indentAttributes?i(w,j+1,!1):" "),M.push(k+"="+E+("attributeValueFn"in w?w.attributeValueFn(C,N,n,r):C)+E));return b&&Object.keys(b).length&&w.spaces&&w.indentAttributes&&M.push(i(w,j,!1)),M.join("")}function l(b,w,j){return r=b,n="xml",w.ignoreDeclaration?"":"<?xml"+o(b[w.attributesKey],w,j)+"?>"}function c(b,w,j){if(w.ignoreInstruction)return"";var N;for(N in b)if(b.hasOwnProperty(N))break;var C="instructionNameFn"in w?w.instructionNameFn(N,b[N],n,r):N;if(typeof b[N]=="object")return r=b,n=C,"<?"+C+o(b[N][w.attributesKey],w,j)+"?>";var k=b[N]?b[N]:"";return"instructionFn"in w&&(k=w.instructionFn(k,N,n,r)),"<?"+C+(k?" "+k:"")+"?>"}function u(b,w){return w.ignoreComment?"":"<!--"+("commentFn"in w?w.commentFn(b,n,r):b)+"-->"}function d(b,w){return w.ignoreCdata?"":"<![CDATA["+("cdataFn"in w?w.cdataFn(b,n,r):b.replace("]]>","]]]]><![CDATA[>"))+"]]>"}function h(b,w){return w.ignoreDoctype?"":"<!DOCTYPE "+("doctypeFn"in w?w.doctypeFn(b,n,r):b)+">"}function f(b,w){return w.ignoreText?"":(b=""+b,b=b.replace(/&/g,"&"),b=b.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),"textFn"in w?w.textFn(b,n,r):b)}function p(b,w){var j;if(b.elements&&b.elements.length)for(j=0;j<b.elements.length;++j)switch(b.elements[j][w.typeKey]){case"text":if(w.indentText)return!0;break;case"cdata":if(w.indentCdata)return!0;break;case"instruction":if(w.indentInstruction)return!0;break;case"doctype":case"comment":case"element":return!0;default:return!0}return!1}function g(b,w,j){r=b,n=b.name;var N=[],C="elementNameFn"in w?w.elementNameFn(b.name,b):b.name;N.push("<"+C),b[w.attributesKey]&&N.push(o(b[w.attributesKey],w,j));var k=b[w.elementsKey]&&b[w.elementsKey].length||b[w.attributesKey]&&b[w.attributesKey]["xml:space"]==="preserve";return k||("fullTagEmptyElementFn"in w?k=w.fullTagEmptyElementFn(b.name,b):k=w.fullTagEmptyElement),k?(N.push(">"),b[w.elementsKey]&&b[w.elementsKey].length&&(N.push(m(b[w.elementsKey],w,j+1)),r=b,n=b.name),N.push(w.spaces&&p(b,w)?`
`+Array(j+1).join(w.spaces):""),N.push("</"+C+">")):N.push("/>"),N.join("")}function m(b,w,j,N){return b.reduce(function(C,k){var E=i(w,j,N&&!C);switch(k.type){case"element":return C+E+g(k,w,j);case"comment":return C+E+u(k[w.commentKey],w);case"doctype":return C+E+h(k[w.doctypeKey],w);case"cdata":return C+(w.indentCdata?E:"")+d(k[w.cdataKey],w);case"text":return C+(w.indentText?E:"")+f(k[w.textKey],w);case"instruction":var M={};return M[k[w.nameKey]]=k[w.attributesKey]?k:k[w.instructionKey],C+(w.indentInstruction?E:"")+c(M,w,j)}},"")}function x(b,w,j){var N;for(N in b)if(b.hasOwnProperty(N))switch(N){case w.parentKey:case w.attributesKey:break;case w.textKey:if(w.indentText||j)return!0;break;case w.cdataKey:if(w.indentCdata||j)return!0;break;case w.instructionKey:if(w.indentInstruction||j)return!0;break;case w.doctypeKey:case w.commentKey:return!0;default:return!0}return!1}function y(b,w,j,N,C){r=b,n=w;var k="elementNameFn"in j?j.elementNameFn(w,b):w;if(typeof b>"u"||b===null||b==="")return"fullTagEmptyElementFn"in j&&j.fullTagEmptyElementFn(w,b)||j.fullTagEmptyElement?"<"+k+"></"+k+">":"<"+k+"/>";var E=[];if(w){if(E.push("<"+k),typeof b!="object")return E.push(">"+f(b,j)+"</"+k+">"),E.join("");b[j.attributesKey]&&E.push(o(b[j.attributesKey],j,N));var M=x(b,j,!0)||b[j.attributesKey]&&b[j.attributesKey]["xml:space"]==="preserve";if(M||("fullTagEmptyElementFn"in j?M=j.fullTagEmptyElementFn(w,b):M=j.fullTagEmptyElement),M)E.push(">");else return E.push("/>"),E.join("")}return E.push(v(b,j,N+1,!1)),r=b,n=w,w&&E.push((C?i(j,N,!1):"")+"</"+k+">"),E.join("")}function v(b,w,j,N){var C,k,E,M=[];for(k in b)if(b.hasOwnProperty(k))for(E=e(b[k])?b[k]:[b[k]],C=0;C<E.length;++C){switch(k){case w.declarationKey:M.push(l(E[C],w,j));break;case w.instructionKey:M.push((w.indentInstruction?i(w,j,N):"")+c(E[C],w,j));break;case w.attributesKey:case w.parentKey:break;case w.textKey:M.push((w.indentText?i(w,j,N):"")+f(E[C],w));break;case w.cdataKey:M.push((w.indentCdata?i(w,j,N):"")+d(E[C],w));break;case w.doctypeKey:M.push(i(w,j,N)+h(E[C],w));break;case w.commentKey:M.push(i(w,j,N)+u(E[C],w));break;default:M.push(i(w,j,N)+y(E[C],k,w,j,x(E[C],w)))}N=N&&!M.length}return M.join("")}return WR=function(b,w){w=s(w);var j=[];return r=b,n="_root_",w.compact?j.push(v(b,w,0,!0)):(b[w.declarationKey]&&j.push(l(b[w.declarationKey],w,0)),b[w.elementsKey]&&b[w.elementsKey].length&&j.push(m(b[w.elementsKey],w,0,!j.length))),j.join("")},WR}var VR,JY;function Sht(){if(JY)return VR;JY=1;var t=Ppe();return VR=function(e,r){e instanceof Buffer&&(e=e.toString());var n=null;if(typeof e=="string")try{n=JSON.parse(e)}catch{throw new Error("The JSON structure is invalid")}else n=e;return t(n,r)},VR}var qR,eX;function Nht(){if(eX)return qR;eX=1;var t=Tpe(),e=jht(),r=Ppe(),n=Sht();return qR={xml2js:t,xml2json:e,js2xml:r,json2xml:n},qR}var Ope=Nht();const SB=t=>{switch(t.type){case void 0:case"element":const e=new Eht(t.name,t.attributes),r=t.elements||[];for(const n of r){const s=SB(n);s!==void 0&&e.push(s)}return e;case"text":return t.text;default:return}};class Aht extends At{}class Eht extends Re{static fromXmlString(e){const r=Ope.xml2js(e,{compact:!1});return SB(r)}constructor(e,r){super(e),r&&this.root.push(new Aht(r))}push(e){this.root.push(e)}}class Cht extends Re{constructor(e){super(""),this._attr=e}prepForXml(e){return{_attr:this._attr}}}class Ipe extends Re{constructor(e,r){super(e),r&&(this.root=r.root)}}const Zi=t=>{if(isNaN(t))throw new Error(`Invalid value '${t}' specified. Must be an integer.`);return Math.floor(t)},rP=t=>{const e=Zi(t);if(e<0)throw new Error(`Invalid value '${t}' specified. Must be a positive integer.`);return e},Rpe=(t,e)=>{const r=e*2;if(t.length!==r||isNaN(+`0x${t}`))throw new Error(`Invalid hex value '${t}'. Expected ${r} digit hex value`);return t},tX=t=>Rpe(t,1),Mpe=t=>{const e=t.slice(-2),r=t.substring(0,t.length-2);return`${Number(r)}${e}`},Dpe=t=>{const e=Mpe(t);if(parseFloat(e)<0)throw new Error(`Invalid value '${e}' specified. Expected a positive number.`);return e},Qv=t=>{if(t==="auto")return t;const e=t.charAt(0)==="#"?t.substring(1):t;return Rpe(e,3)},fp=t=>typeof t=="string"?Mpe(t):Zi(t),kht=t=>typeof t=="string"?Dpe(t):rP(t),rl=t=>typeof t=="string"?Dpe(t):rP(t),Tht=rP,Pht=rP,Oht=t=>t.toISOString();class De extends Re{constructor(e,r=!0){super(e),r!==!0&&this.root.push(new wn({val:r}))}}class GR extends Re{constructor(e,r){super(e),this.root.push(new wn({val:kht(r)}))}}class Lm extends Re{constructor(e,r){super(e),this.root.push(new wn({val:r}))}}const m0=(t,e)=>new Sc({name:t,attributes:{value:{key:"w:val",value:e}}});class Aw extends Re{constructor(e,r){super(e),this.root.push(new wn({val:r}))}}class Lf extends Re{constructor(e,r){super(e),this.root.push(r)}}class Sc extends Re{constructor({name:e,attributes:r,children:n}){super(e),r&&this.root.push(new J2(r)),n&&this.root.push(...n)}}const Sn={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"};class Iht extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class Rht extends Re{constructor(e){super("w:jc"),this.root.push(new Iht({val:e}))}}class dn extends Re{constructor(e,{color:r,size:n,space:s,style:i}){super(e),this.root.push(new Mht({style:i,color:r===void 0?void 0:Qv(r),size:n===void 0?void 0:Tht(n),space:s===void 0?void 0:Pht(s)}))}}class Mht extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{style:"w:val",color:"w:color",size:"w:sz",space:"w:space"})}}const NB={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"};class Dht extends Z2{constructor(e){super("w:pBdr"),e.top&&this.root.push(new dn("w:top",e.top)),e.bottom&&this.root.push(new dn("w:bottom",e.bottom)),e.left&&this.root.push(new dn("w:left",e.left)),e.right&&this.root.push(new dn("w:right",e.right))}}class Lht extends Re{constructor(){super("w:pBdr");const e=new dn("w:bottom",{color:"auto",space:1,style:NB.SINGLE,size:6});this.root.push(e)}}class Fht extends Re{constructor({start:e,end:r,left:n,right:s,hanging:i,firstLine:o}){super("w:ind"),this.root.push(new J2({start:{key:"w:start",value:e===void 0?void 0:fp(e)},end:{key:"w:end",value:r===void 0?void 0:fp(r)},left:{key:"w:left",value:n===void 0?void 0:fp(n)},right:{key:"w:right",value:s===void 0?void 0:fp(s)},hanging:{key:"w:hanging",value:i===void 0?void 0:rl(i)},firstLine:{key:"w:firstLine",value:o===void 0?void 0:rl(o)}}))}}let $ht=class extends Re{constructor(){super("w:br")}};const AB={BEGIN:"begin",END:"end",SEPARATE:"separate"};class EB extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{type:"w:fldCharType",dirty:"w:dirty"})}}class Z0 extends Re{constructor(e){super("w:fldChar"),this.root.push(new EB({type:AB.BEGIN,dirty:e}))}}class J0 extends Re{constructor(e){super("w:fldChar"),this.root.push(new EB({type:AB.SEPARATE,dirty:e}))}}class ew extends Re{constructor(e){super("w:fldChar"),this.root.push(new EB({type:AB.END,dirty:e}))}}const Bht={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH_DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH_2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULL_STOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PAREN:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_TEN_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL_2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW_1:"hebrew1",HEBREW_2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText"},rg={DEFAULT:"default",PRESERVE:"preserve"};class ng extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{space:"xml:space"})}}class Uht extends Re{constructor(){super("w:instrText"),this.root.push(new ng({space:rg.PRESERVE})),this.root.push("PAGE")}}class zht extends Re{constructor(){super("w:instrText"),this.root.push(new ng({space:rg.PRESERVE})),this.root.push("NUMPAGES")}}class Hht extends Re{constructor(){super("w:instrText"),this.root.push(new ng({space:rg.PRESERVE})),this.root.push("SECTIONPAGES")}}class Wht extends Re{constructor(){super("w:instrText"),this.root.push(new ng({space:rg.PRESERVE})),this.root.push("SECTION")}}class Vht extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{fill:"w:fill",color:"w:color",type:"w:val"})}}class Lpe extends Re{constructor({fill:e,color:r,type:n}){super("w:shd"),this.root.push(new Vht({fill:e===void 0?void 0:Qv(e),color:r===void 0?void 0:Qv(r),type:n}))}}class qht extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}}const Ght={DOT:"dot"};class Kht extends Re{constructor(e){super("w:em"),this.root.push(new wn({val:e}))}}class Yht extends Kht{constructor(e=Ght.DOT){super(e)}}class Xht extends Re{constructor(e){super("w:spacing"),this.root.push(new wn({val:fp(e)}))}}class Qht extends Re{constructor(e){super("w:color"),this.root.push(new wn({val:Qv(e)}))}}class Zht extends Re{constructor(e){super("w:highlight"),this.root.push(new wn({val:e}))}}class Jht extends Re{constructor(e){super("w:highlightCs"),this.root.push(new wn({val:e}))}}const eft=t=>new Sc({name:"w:lang",attributes:{value:{key:"w:val",value:t.value},eastAsia:{key:"w:eastAsia",value:t.eastAsia},bidirectional:{key:"w:bidi",value:t.bidirectional}}});class rX extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{ascii:"w:ascii",cs:"w:cs",eastAsia:"w:eastAsia",hAnsi:"w:hAnsi",hint:"w:hint"})}}class KR extends Re{constructor(e,r){if(super("w:rFonts"),typeof e=="string"){const n=e;this.root.push(new rX({ascii:n,cs:n,eastAsia:n,hAnsi:n,hint:r}))}else{const n=e;this.root.push(new rX(n))}}}let Fpe=class extends Re{constructor(e){super("w:vertAlign"),this.root.push(new wn({val:e}))}};class tft extends Fpe{constructor(){super("superscript")}}class rft extends Fpe{constructor(){super("subscript")}}const $pe={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"};class nft extends Re{constructor(e=$pe.SINGLE,r){super("w:u"),this.root.push(new wn({val:e,color:r===void 0?void 0:Qv(r)}))}}class vg extends Z2{constructor(e){var r,n;if(super("w:rPr"),!e)return;e.style&&this.push(new Lm("w:rStyle",e.style)),e.font&&(typeof e.font=="string"?this.push(new KR(e.font)):"name"in e.font?this.push(new KR(e.font.name,e.font.hint)):this.push(new KR(e.font))),e.bold!==void 0&&this.push(new De("w:b",e.bold)),(e.boldComplexScript===void 0&&e.bold!==void 0||e.boldComplexScript)&&this.push(new De("w:bCs",(r=e.boldComplexScript)!=null?r:e.bold)),e.italics!==void 0&&this.push(new De("w:i",e.italics)),(e.italicsComplexScript===void 0&&e.italics!==void 0||e.italicsComplexScript)&&this.push(new De("w:iCs",(n=e.italicsComplexScript)!=null?n:e.italics)),e.smallCaps!==void 0?this.push(new De("w:smallCaps",e.smallCaps)):e.allCaps!==void 0&&this.push(new De("w:caps",e.allCaps)),e.strike!==void 0&&this.push(new De("w:strike",e.strike)),e.doubleStrike!==void 0&&this.push(new De("w:dstrike",e.doubleStrike)),e.emboss!==void 0&&this.push(new De("w:emboss",e.emboss)),e.imprint!==void 0&&this.push(new De("w:imprint",e.imprint)),e.noProof!==void 0&&this.push(new De("w:noProof",e.noProof)),e.snapToGrid!==void 0&&this.push(new De("w:snapToGrid",e.snapToGrid)),e.vanish&&this.push(new De("w:vanish",e.vanish)),e.color&&this.push(new Qht(e.color)),e.characterSpacing&&this.push(new Xht(e.characterSpacing)),e.scale!==void 0&&this.push(new Aw("w:w",e.scale)),e.kern&&this.push(new GR("w:kern",e.kern)),e.position&&this.push(new Lm("w:position",e.position)),e.size!==void 0&&this.push(new GR("w:sz",e.size));const s=e.sizeComplexScript===void 0||e.sizeComplexScript===!0?e.size:e.sizeComplexScript;s&&this.push(new GR("w:szCs",s)),e.highlight&&this.push(new Zht(e.highlight));const i=e.highlightComplexScript===void 0||e.highlightComplexScript===!0?e.highlight:e.highlightComplexScript;i&&this.push(new Jht(i)),e.underline&&this.push(new nft(e.underline.type,e.underline.color)),e.effect&&this.push(new Lm("w:effect",e.effect)),e.border&&this.push(new dn("w:bdr",e.border)),e.shading&&this.push(new Lpe(e.shading)),e.subScript&&this.push(new rft),e.superScript&&this.push(new tft),e.rightToLeft!==void 0&&this.push(new De("w:rtl",e.rightToLeft)),e.emphasisMark&&this.push(new Yht(e.emphasisMark.type)),e.language&&this.push(eft(e.language)),e.specVanish&&this.push(new De("w:specVanish",e.vanish)),e.math&&this.push(new De("w:oMath",e.math)),e.revision&&this.push(new sft(e.revision))}push(e){this.root.push(e)}}class sft extends Re{constructor(e){super("w:rPrChange"),this.root.push(new qht({id:e.id,author:e.author,date:e.date})),this.addChildElement(new vg(e))}}class nX extends Re{constructor(e){var r;super("w:t"),typeof e=="string"?(this.root.push(new ng({space:rg.PRESERVE})),this.root.push(e)):(this.root.push(new ng({space:(r=e.space)!=null?r:rg.DEFAULT})),this.root.push(e.text))}}const vy={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"};class sg extends Re{constructor(e){if(super("w:r"),Pe(this,"properties"),this.properties=new vg(e),this.root.push(this.properties),e.break)for(let r=0;r<e.break;r++)this.root.push(new $ht);if(e.children)for(const r of e.children){if(typeof r=="string"){switch(r){case vy.CURRENT:this.root.push(new Z0),this.root.push(new Uht),this.root.push(new J0),this.root.push(new ew);break;case vy.TOTAL_PAGES:this.root.push(new Z0),this.root.push(new zht),this.root.push(new J0),this.root.push(new ew);break;case vy.TOTAL_PAGES_IN_SECTION:this.root.push(new Z0),this.root.push(new Hht),this.root.push(new J0),this.root.push(new ew);break;case vy.CURRENT_SECTION:this.root.push(new Z0),this.root.push(new Wht),this.root.push(new J0),this.root.push(new ew);break;default:this.root.push(new nX(r));break}continue}this.root.push(r)}else e.text!==void 0&&this.root.push(new nX(e.text))}}class Ws extends sg{constructor(e){super(typeof e=="string"?{text:e}:e)}}var YR={},xr={},XR,sX;function bS(){if(sX)return XR;sX=1,XR=t;function t(e,r){if(!e)throw new Error(r||"Assertion failed")}return t.equal=function(r,n,s){if(r!=n)throw new Error(s||"Assertion failed: "+r+" != "+n)},XR}var iX;function Oc(){if(iX)return xr;iX=1;var t=bS(),e=Cf();xr.inherits=e;function r(P,V){return(P.charCodeAt(V)&64512)!==55296||V<0||V+1>=P.length?!1:(P.charCodeAt(V+1)&64512)===56320}function n(P,V){if(Array.isArray(P))return P.slice();if(!P)return[];var A=[];if(typeof P=="string")if(V){if(V==="hex")for(P=P.replace(/[^a-z0-9]+/ig,""),P.length%2!==0&&(P="0"+P),K=0;K<P.length;K+=2)A.push(parseInt(P[K]+P[K+1],16))}else for(var $=0,K=0;K<P.length;K++){var G=P.charCodeAt(K);G<128?A[$++]=G:G<2048?(A[$++]=G>>6|192,A[$++]=G&63|128):r(P,K)?(G=65536+((G&1023)<<10)+(P.charCodeAt(++K)&1023),A[$++]=G>>18|240,A[$++]=G>>12&63|128,A[$++]=G>>6&63|128,A[$++]=G&63|128):(A[$++]=G>>12|224,A[$++]=G>>6&63|128,A[$++]=G&63|128)}else for(K=0;K<P.length;K++)A[K]=P[K]|0;return A}xr.toArray=n;function s(P){for(var V="",A=0;A<P.length;A++)V+=l(P[A].toString(16));return V}xr.toHex=s;function i(P){var V=P>>>24|P>>>8&65280|P<<8&16711680|(P&255)<<24;return V>>>0}xr.htonl=i;function o(P,V){for(var A="",$=0;$<P.length;$++){var K=P[$];V==="little"&&(K=i(K)),A+=c(K.toString(16))}return A}xr.toHex32=o;function l(P){return P.length===1?"0"+P:P}xr.zero2=l;function c(P){return P.length===7?"0"+P:P.length===6?"00"+P:P.length===5?"000"+P:P.length===4?"0000"+P:P.length===3?"00000"+P:P.length===2?"000000"+P:P.length===1?"0000000"+P:P}xr.zero8=c;function u(P,V,A,$){var K=A-V;t(K%4===0);for(var G=new Array(K/4),Y=0,H=V;Y<G.length;Y++,H+=4){var B;$==="big"?B=P[H]<<24|P[H+1]<<16|P[H+2]<<8|P[H+3]:B=P[H+3]<<24|P[H+2]<<16|P[H+1]<<8|P[H],G[Y]=B>>>0}return G}xr.join32=u;function d(P,V){for(var A=new Array(P.length*4),$=0,K=0;$<P.length;$++,K+=4){var G=P[$];V==="big"?(A[K]=G>>>24,A[K+1]=G>>>16&255,A[K+2]=G>>>8&255,A[K+3]=G&255):(A[K+3]=G>>>24,A[K+2]=G>>>16&255,A[K+1]=G>>>8&255,A[K]=G&255)}return A}xr.split32=d;function h(P,V){return P>>>V|P<<32-V}xr.rotr32=h;function f(P,V){return P<<V|P>>>32-V}xr.rotl32=f;function p(P,V){return P+V>>>0}xr.sum32=p;function g(P,V,A){return P+V+A>>>0}xr.sum32_3=g;function m(P,V,A,$){return P+V+A+$>>>0}xr.sum32_4=m;function x(P,V,A,$,K){return P+V+A+$+K>>>0}xr.sum32_5=x;function y(P,V,A,$){var K=P[V],G=P[V+1],Y=$+G>>>0,H=(Y<$?1:0)+A+K;P[V]=H>>>0,P[V+1]=Y}xr.sum64=y;function v(P,V,A,$){var K=V+$>>>0,G=(K<V?1:0)+P+A;return G>>>0}xr.sum64_hi=v;function b(P,V,A,$){var K=V+$;return K>>>0}xr.sum64_lo=b;function w(P,V,A,$,K,G,Y,H){var B=0,L=V;L=L+$>>>0,B+=L<V?1:0,L=L+G>>>0,B+=L<G?1:0,L=L+H>>>0,B+=L<H?1:0;var F=P+A+K+Y+B;return F>>>0}xr.sum64_4_hi=w;function j(P,V,A,$,K,G,Y,H){var B=V+$+G+H;return B>>>0}xr.sum64_4_lo=j;function N(P,V,A,$,K,G,Y,H,B,L){var F=0,W=V;W=W+$>>>0,F+=W<V?1:0,W=W+G>>>0,F+=W<G?1:0,W=W+H>>>0,F+=W<H?1:0,W=W+L>>>0,F+=W<L?1:0;var X=P+A+K+Y+B+F;return X>>>0}xr.sum64_5_hi=N;function C(P,V,A,$,K,G,Y,H,B,L){var F=V+$+G+H+L;return F>>>0}xr.sum64_5_lo=C;function k(P,V,A){var $=V<<32-A|P>>>A;return $>>>0}xr.rotr64_hi=k;function E(P,V,A){var $=P<<32-A|V>>>A;return $>>>0}xr.rotr64_lo=E;function M(P,V,A){return P>>>A}xr.shr64_hi=M;function z(P,V,A){var $=P<<32-A|V>>>A;return $>>>0}return xr.shr64_lo=z,xr}var QR={},aX;function wS(){if(aX)return QR;aX=1;var t=Oc(),e=bS();function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}return QR.BlockHash=r,r.prototype.update=function(s,i){if(s=t.toArray(s,i),this.pending?this.pending=this.pending.concat(s):this.pending=s,this.pendingTotal+=s.length,this.pending.length>=this._delta8){s=this.pending;var o=s.length%this._delta8;this.pending=s.slice(s.length-o,s.length),this.pending.length===0&&(this.pending=null),s=t.join32(s,0,s.length-o,this.endian);for(var l=0;l<s.length;l+=this._delta32)this._update(s,l,l+this._delta32)}return this},r.prototype.digest=function(s){return this.update(this._pad()),e(this.pending===null),this._digest(s)},r.prototype._pad=function(){var s=this.pendingTotal,i=this._delta8,o=i-(s+this.padLength)%i,l=new Array(o+this.padLength);l[0]=128;for(var c=1;c<o;c++)l[c]=0;if(s<<=3,this.endian==="big"){for(var u=8;u<this.padLength;u++)l[c++]=0;l[c++]=0,l[c++]=0,l[c++]=0,l[c++]=0,l[c++]=s>>>24&255,l[c++]=s>>>16&255,l[c++]=s>>>8&255,l[c++]=s&255}else for(l[c++]=s&255,l[c++]=s>>>8&255,l[c++]=s>>>16&255,l[c++]=s>>>24&255,l[c++]=0,l[c++]=0,l[c++]=0,l[c++]=0,u=8;u<this.padLength;u++)l[c++]=0;return l},QR}var Ff={},El={},oX;function Bpe(){if(oX)return El;oX=1;var t=Oc(),e=t.rotr32;function r(d,h,f,p){if(d===0)return n(h,f,p);if(d===1||d===3)return i(h,f,p);if(d===2)return s(h,f,p)}El.ft_1=r;function n(d,h,f){return d&h^~d&f}El.ch32=n;function s(d,h,f){return d&h^d&f^h&f}El.maj32=s;function i(d,h,f){return d^h^f}El.p32=i;function o(d){return e(d,2)^e(d,13)^e(d,22)}El.s0_256=o;function l(d){return e(d,6)^e(d,11)^e(d,25)}El.s1_256=l;function c(d){return e(d,7)^e(d,18)^d>>>3}El.g0_256=c;function u(d){return e(d,17)^e(d,19)^d>>>10}return El.g1_256=u,El}var ZR,lX;function ift(){if(lX)return ZR;lX=1;var t=Oc(),e=wS(),r=Bpe(),n=t.rotl32,s=t.sum32,i=t.sum32_5,o=r.ft_1,l=e.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function u(){if(!(this instanceof u))return new u;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return t.inherits(u,l),ZR=u,u.blockSize=512,u.outSize=160,u.hmacStrength=80,u.padLength=64,u.prototype._update=function(h,f){for(var p=this.W,g=0;g<16;g++)p[g]=h[f+g];for(;g<p.length;g++)p[g]=n(p[g-3]^p[g-8]^p[g-14]^p[g-16],1);var m=this.h[0],x=this.h[1],y=this.h[2],v=this.h[3],b=this.h[4];for(g=0;g<p.length;g++){var w=~~(g/20),j=i(n(m,5),o(w,x,y,v),b,p[g],c[w]);b=v,v=y,y=n(x,30),x=m,m=j}this.h[0]=s(this.h[0],m),this.h[1]=s(this.h[1],x),this.h[2]=s(this.h[2],y),this.h[3]=s(this.h[3],v),this.h[4]=s(this.h[4],b)},u.prototype._digest=function(h){return h==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")},ZR}var JR,cX;function Upe(){if(cX)return JR;cX=1;var t=Oc(),e=wS(),r=Bpe(),n=bS(),s=t.sum32,i=t.sum32_4,o=t.sum32_5,l=r.ch32,c=r.maj32,u=r.s0_256,d=r.s1_256,h=r.g0_256,f=r.g1_256,p=e.BlockHash,g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function m(){if(!(this instanceof m))return new m;p.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}return t.inherits(m,p),JR=m,m.blockSize=512,m.outSize=256,m.hmacStrength=192,m.padLength=64,m.prototype._update=function(y,v){for(var b=this.W,w=0;w<16;w++)b[w]=y[v+w];for(;w<b.length;w++)b[w]=i(f(b[w-2]),b[w-7],h(b[w-15]),b[w-16]);var j=this.h[0],N=this.h[1],C=this.h[2],k=this.h[3],E=this.h[4],M=this.h[5],z=this.h[6],P=this.h[7];for(n(this.k.length===b.length),w=0;w<b.length;w++){var V=o(P,d(E),l(E,M,z),this.k[w],b[w]),A=s(u(j),c(j,N,C));P=z,z=M,M=E,E=s(k,V),k=C,C=N,N=j,j=s(V,A)}this.h[0]=s(this.h[0],j),this.h[1]=s(this.h[1],N),this.h[2]=s(this.h[2],C),this.h[3]=s(this.h[3],k),this.h[4]=s(this.h[4],E),this.h[5]=s(this.h[5],M),this.h[6]=s(this.h[6],z),this.h[7]=s(this.h[7],P)},m.prototype._digest=function(y){return y==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")},JR}var eM,uX;function aft(){if(uX)return eM;uX=1;var t=Oc(),e=Upe();function r(){if(!(this instanceof r))return new r;e.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}return t.inherits(r,e),eM=r,r.blockSize=512,r.outSize=224,r.hmacStrength=192,r.padLength=64,r.prototype._digest=function(s){return s==="hex"?t.toHex32(this.h.slice(0,7),"big"):t.split32(this.h.slice(0,7),"big")},eM}var tM,dX;function zpe(){if(dX)return tM;dX=1;var t=Oc(),e=wS(),r=bS(),n=t.rotr64_hi,s=t.rotr64_lo,i=t.shr64_hi,o=t.shr64_lo,l=t.sum64,c=t.sum64_hi,u=t.sum64_lo,d=t.sum64_4_hi,h=t.sum64_4_lo,f=t.sum64_5_hi,p=t.sum64_5_lo,g=e.BlockHash,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function x(){if(!(this instanceof x))return new x;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=m,this.W=new Array(160)}t.inherits(x,g),tM=x,x.blockSize=1024,x.outSize=512,x.hmacStrength=192,x.padLength=128,x.prototype._prepareBlock=function(A,$){for(var K=this.W,G=0;G<32;G++)K[G]=A[$+G];for(;G<K.length;G+=2){var Y=z(K[G-4],K[G-3]),H=P(K[G-4],K[G-3]),B=K[G-14],L=K[G-13],F=E(K[G-30],K[G-29]),W=M(K[G-30],K[G-29]),X=K[G-32],oe=K[G-31];K[G]=d(Y,H,B,L,F,W,X,oe),K[G+1]=h(Y,H,B,L,F,W,X,oe)}},x.prototype._update=function(A,$){this._prepareBlock(A,$);var K=this.W,G=this.h[0],Y=this.h[1],H=this.h[2],B=this.h[3],L=this.h[4],F=this.h[5],W=this.h[6],X=this.h[7],oe=this.h[8],le=this.h[9],U=this.h[10],R=this.h[11],ee=this.h[12],te=this.h[13],Z=this.h[14],J=this.h[15];r(this.k.length===K.length);for(var he=0;he<K.length;he+=2){var O=Z,ie=J,q=C(oe,le),I=k(oe,le),T=y(oe,le,U,R,ee),D=v(oe,le,U,R,ee,te),ne=this.k[he],ue=this.k[he+1],re=K[he],pe=K[he+1],ve=f(O,ie,q,I,T,D,ne,ue,re,pe),xe=p(O,ie,q,I,T,D,ne,ue,re,pe);O=j(G,Y),ie=N(G,Y),q=b(G,Y,H,B,L),I=w(G,Y,H,B,L,F);var ae=c(O,ie,q,I),de=u(O,ie,q,I);Z=ee,J=te,ee=U,te=R,U=oe,R=le,oe=c(W,X,ve,xe),le=u(X,X,ve,xe),W=L,X=F,L=H,F=B,H=G,B=Y,G=c(ve,xe,ae,de),Y=u(ve,xe,ae,de)}l(this.h,0,G,Y),l(this.h,2,H,B),l(this.h,4,L,F),l(this.h,6,W,X),l(this.h,8,oe,le),l(this.h,10,U,R),l(this.h,12,ee,te),l(this.h,14,Z,J)},x.prototype._digest=function(A){return A==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")};function y(V,A,$,K,G){var Y=V&$^~V&G;return Y<0&&(Y+=4294967296),Y}function v(V,A,$,K,G,Y){var H=A&K^~A&Y;return H<0&&(H+=4294967296),H}function b(V,A,$,K,G){var Y=V&$^V&G^$&G;return Y<0&&(Y+=4294967296),Y}function w(V,A,$,K,G,Y){var H=A&K^A&Y^K&Y;return H<0&&(H+=4294967296),H}function j(V,A){var $=n(V,A,28),K=n(A,V,2),G=n(A,V,7),Y=$^K^G;return Y<0&&(Y+=4294967296),Y}function N(V,A){var $=s(V,A,28),K=s(A,V,2),G=s(A,V,7),Y=$^K^G;return Y<0&&(Y+=4294967296),Y}function C(V,A){var $=n(V,A,14),K=n(V,A,18),G=n(A,V,9),Y=$^K^G;return Y<0&&(Y+=4294967296),Y}function k(V,A){var $=s(V,A,14),K=s(V,A,18),G=s(A,V,9),Y=$^K^G;return Y<0&&(Y+=4294967296),Y}function E(V,A){var $=n(V,A,1),K=n(V,A,8),G=i(V,A,7),Y=$^K^G;return Y<0&&(Y+=4294967296),Y}function M(V,A){var $=s(V,A,1),K=s(V,A,8),G=o(V,A,7),Y=$^K^G;return Y<0&&(Y+=4294967296),Y}function z(V,A){var $=n(V,A,19),K=n(A,V,29),G=i(V,A,6),Y=$^K^G;return Y<0&&(Y+=4294967296),Y}function P(V,A){var $=s(V,A,19),K=s(A,V,29),G=o(V,A,6),Y=$^K^G;return Y<0&&(Y+=4294967296),Y}return tM}var rM,hX;function oft(){if(hX)return rM;hX=1;var t=Oc(),e=zpe();function r(){if(!(this instanceof r))return new r;e.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}return t.inherits(r,e),rM=r,r.blockSize=1024,r.outSize=384,r.hmacStrength=192,r.padLength=128,r.prototype._digest=function(s){return s==="hex"?t.toHex32(this.h.slice(0,12),"big"):t.split32(this.h.slice(0,12),"big")},rM}var fX;function lft(){return fX||(fX=1,Ff.sha1=ift(),Ff.sha224=aft(),Ff.sha256=Upe(),Ff.sha384=oft(),Ff.sha512=zpe()),Ff}var nM={},pX;function cft(){if(pX)return nM;pX=1;var t=Oc(),e=wS(),r=t.rotl32,n=t.sum32,s=t.sum32_3,i=t.sum32_4,o=e.BlockHash;function l(){if(!(this instanceof l))return new l;o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}t.inherits(l,o),nM.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(x,y){for(var v=this.h[0],b=this.h[1],w=this.h[2],j=this.h[3],N=this.h[4],C=v,k=b,E=w,M=j,z=N,P=0;P<80;P++){var V=n(r(i(v,c(P,b,w,j),x[h[P]+y],u(P)),p[P]),N);v=N,N=j,j=r(w,10),w=b,b=V,V=n(r(i(C,c(79-P,k,E,M),x[f[P]+y],d(P)),g[P]),z),C=z,z=M,M=r(E,10),E=k,k=V}V=s(this.h[1],w,M),this.h[1]=s(this.h[2],j,z),this.h[2]=s(this.h[3],N,C),this.h[3]=s(this.h[4],v,k),this.h[4]=s(this.h[0],b,E),this.h[0]=V},l.prototype._digest=function(x){return x==="hex"?t.toHex32(this.h,"little"):t.split32(this.h,"little")};function c(m,x,y,v){return m<=15?x^y^v:m<=31?x&y|~x&v:m<=47?(x|~y)^v:m<=63?x&v|y&~v:x^(y|~v)}function u(m){return m<=15?0:m<=31?1518500249:m<=47?1859775393:m<=63?2400959708:2840853838}function d(m){return m<=15?1352829926:m<=31?1548603684:m<=47?1836072691:m<=63?2053994217:0}var h=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],f=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],p=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11];return nM}var sM,mX;function uft(){if(mX)return sM;mX=1;var t=Oc(),e=bS();function r(n,s,i){if(!(this instanceof r))return new r(n,s,i);this.Hash=n,this.blockSize=n.blockSize/8,this.outSize=n.outSize/8,this.inner=null,this.outer=null,this._init(t.toArray(s,i))}return sM=r,r.prototype._init=function(s){s.length>this.blockSize&&(s=new this.Hash().update(s).digest()),e(s.length<=this.blockSize);for(var i=s.length;i<this.blockSize;i++)s.push(0);for(i=0;i<s.length;i++)s[i]^=54;for(this.inner=new this.Hash().update(s),i=0;i<s.length;i++)s[i]^=106;this.outer=new this.Hash().update(s)},r.prototype.update=function(s,i){return this.inner.update(s,i),this},r.prototype.digest=function(s){return this.outer.update(this.inner.digest()),this.outer.digest(s)},sM}var gX;function dft(){return gX||(gX=1,function(t){var e=t;e.utils=Oc(),e.common=wS(),e.sha=lft(),e.ripemd=cft(),e.hmac=uft(),e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(YR)),YR}dft();let hft="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",fft=(t,e=21)=>(r=e)=>{let n="",s=r|0;for(;s--;)n+=t[Math.random()*t.length|0];return n},pft=(t=21)=>{let e="",r=t|0;for(;r--;)e+=hft[Math.random()*64|0];return e};const Oo=t=>Math.floor(t*72*20),CB=(t=0)=>{let e=t;return()=>++e},mft=()=>CB(),gft=()=>CB(1),yft=()=>CB(),xft=()=>pft().toLowerCase(),g0=t=>fft("1234567890abcdef",t)(),vft=()=>`${g0(8)}-${g0(4)}-${g0(4)}-${g0(4)}-${g0(12)}`;class bft extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{xmlns:"xmlns"})}}class wft extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"Id",type:"Type",target:"Target",targetMode:"TargetMode"})}}const _ft={EXTERNAL:"External"};class jft extends Re{constructor(e,r,n,s){super("Relationship"),this.root.push(new wft({id:e,type:r,target:n,targetMode:s}))}}class bg extends Re{constructor(){super("Relationships"),this.root.push(new bft({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}createRelationship(e,r,n,s){const i=new jft(`rId${e}`,r,n,s);return this.root.push(i),i}get RelationshipCount(){return this.root.length-1}}class Sft extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}}class Nft extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{"xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps"})}}class Aft extends Re{constructor({id:e,initials:r,author:n,date:s=new Date,children:i}){super("w:comment"),this.root.push(new Sft({id:e,initials:r,author:n,date:s.toISOString()}));for(const o of i)this.root.push(o)}}class Eft extends Re{constructor({children:e}){super("w:comments"),Pe(this,"relationships"),this.root.push(new Nft({"xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));for(const r of e)this.root.push(new Aft(r));this.relationships=new bg}get Relationships(){return this.relationships}}const Cft={COLUMN:"column",PAGE:"page"};class kft extends Re{constructor(e){super("w:br"),this.root.push(new wn({type:e}))}}class yX extends sg{constructor(){super({}),this.root.push(new kft(Cft.PAGE))}}class Tft extends Re{constructor(){super("w:pageBreakBefore")}}const M3={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"};class Pft extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{after:"w:after",before:"w:before",line:"w:line",lineRule:"w:lineRule",beforeAutoSpacing:"w:beforeAutospacing",afterAutoSpacing:"w:afterAutospacing"})}}class Oft extends Re{constructor(e){super("w:spacing"),this.root.push(new Pft(e))}}const iM={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"};let ZN=class extends Re{constructor(e){super("w:pStyle"),this.root.push(new wn({val:e}))}};class Ift extends Re{constructor(e){super("w:tabs");for(const r of e)this.root.push(new Mft(r))}}const xX={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"};class Rft extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val",pos:"w:pos",leader:"w:leader"})}}class Mft extends Re{constructor({type:e,position:r,leader:n}){super("w:tab"),this.root.push(new Rft({val:e,pos:r,leader:n}))}}class aM extends Re{constructor(e,r){super("w:numPr"),this.root.push(new Dft(r)),this.root.push(new Lft(e))}}class Dft extends Re{constructor(e){if(super("w:ilvl"),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new wn({val:e}))}}class Lft extends Re{constructor(e){super("w:numId"),this.root.push(new wn({val:typeof e=="string"?`{${e}}`:e}))}}class Hpe extends Re{constructor(){super(...arguments),Pe(this,"fileChild",Symbol())}}class Fft extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}}class $ft extends Re{constructor(e,r,n){super("w:hyperlink"),Pe(this,"linkId"),this.linkId=r;const s={history:1,anchor:n||void 0,id:n?void 0:`rId${this.linkId}`},i=new Fft(s);this.root.push(i),e.forEach(o=>{this.root.push(o)})}}class Bft extends Re{constructor(e){super("w:externalHyperlink"),this.options=e}}class Uft extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"w:id",name:"w:name"})}}class zft extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"w:id"})}}class Hft{constructor(e){Pe(this,"bookmarkUniqueNumericId",yft()),Pe(this,"start"),Pe(this,"children"),Pe(this,"end");const r=this.bookmarkUniqueNumericId();this.start=new Wft(e.id,r),this.children=e.children,this.end=new Vft(r)}}class Wft extends Re{constructor(e,r){super("w:bookmarkStart");const n=new Uft({name:e,id:r});this.root.push(n)}}class Vft extends Re{constructor(e){super("w:bookmarkEnd");const r=new zft({id:e});this.root.push(r)}}class qft extends Re{constructor(e){super("w:outlineLvl"),this.level=e,this.root.push(new wn({val:e}))}}const Gft={TOP:"top",CENTER:"center",BOTTOM:"bottom"};Yv(Zt({},Gft),{BOTH:"both"});class Kft extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{verticalAlign:"w:val"})}}class Yft extends Re{constructor(e){super("w:vAlign"),this.root.push(new Kft({verticalAlign:e}))}}class Xft extends Re{constructor({space:e,count:r,separate:n,equalWidth:s,children:i}){super("w:cols"),this.root.push(new J2({space:{key:"w:space",value:e===void 0?void 0:rl(e)},count:{key:"w:num",value:r===void 0?void 0:Zi(r)},separate:{key:"w:sep",value:n},equalWidth:{key:"w:equalWidth",value:s}})),!s&&i&&i.forEach(o=>this.addChildElement(o))}}const Qft=({type:t,linePitch:e,charSpace:r})=>new Sc({name:"w:docGrid",attributes:{type:{key:"w:type",value:t},linePitch:{key:"w:linePitch",value:Zi(e)},charSpace:{key:"w:charSpace",value:r?Zi(r):void 0}}}),Wy={DEFAULT:"default",FIRST:"first",EVEN:"even"};class Zft extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{type:"w:type",id:"r:id"})}}const vX={HEADER:"w:headerReference",FOOTER:"w:footerReference"};class oM extends Re{constructor(e,r){super(e),this.root.push(new Zft({type:r.type||Wy.DEFAULT,id:`rId${r.id}`}))}}const Jft=({countBy:t,start:e,restart:r,distance:n})=>new Sc({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:t===void 0?void 0:Zi(t)},start:{key:"w:start",value:e===void 0?void 0:Zi(e)},restart:{key:"w:restart",value:r},distance:{key:"w:distance",value:n===void 0?void 0:rl(n)}}});class bX extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}}class ept extends Z2{constructor(e){if(super("w:pgBorders"),!e)return this;e.pageBorders?this.root.push(new bX({display:e.pageBorders.display,offsetFrom:e.pageBorders.offsetFrom,zOrder:e.pageBorders.zOrder})):this.root.push(new bX({})),e.pageBorderTop&&this.root.push(new dn("w:top",e.pageBorderTop)),e.pageBorderLeft&&this.root.push(new dn("w:left",e.pageBorderLeft)),e.pageBorderBottom&&this.root.push(new dn("w:bottom",e.pageBorderBottom)),e.pageBorderRight&&this.root.push(new dn("w:right",e.pageBorderRight))}}class tpt extends Re{constructor(e,r,n,s,i,o,l){super("w:pgMar"),this.root.push(new J2({top:{key:"w:top",value:fp(e)},right:{key:"w:right",value:rl(r)},bottom:{key:"w:bottom",value:fp(n)},left:{key:"w:left",value:rl(s)},header:{key:"w:header",value:rl(i)},footer:{key:"w:footer",value:rl(o)},gutter:{key:"w:gutter",value:rl(l)}}))}}class rpt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{start:"w:start",formatType:"w:fmt",separator:"w:chapSep"})}}class npt extends Re{constructor({start:e,formatType:r,separator:n}){super("w:pgNumType"),this.root.push(new rpt({start:e===void 0?void 0:Zi(e),formatType:r,separator:n}))}}const D3={PORTRAIT:"portrait",LANDSCAPE:"landscape"},spt=({width:t,height:e,orientation:r,code:n})=>{const s=rl(t),i=rl(e);return new Sc({name:"w:pgSz",attributes:{width:{key:"w:w",value:r===D3.LANDSCAPE?i:s},height:{key:"w:h",value:r===D3.LANDSCAPE?s:i},orientation:{key:"w:orient",value:r},code:{key:"w:code",value:n}}})};class ipt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class apt extends Re{constructor(e){super("w:textDirection"),this.root.push(new ipt({val:e}))}}class opt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class lpt extends Re{constructor(e){super("w:type"),this.root.push(new opt({val:e}))}}const $f={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},lM={WIDTH:11906,HEIGHT:16838,ORIENTATION:D3.PORTRAIT};class cpt extends Re{constructor({page:{size:{width:e=lM.WIDTH,height:r=lM.HEIGHT,orientation:n=lM.ORIENTATION}={},margin:{top:s=$f.TOP,right:i=$f.RIGHT,bottom:o=$f.BOTTOM,left:l=$f.LEFT,header:c=$f.HEADER,footer:u=$f.FOOTER,gutter:d=$f.GUTTER}={},pageNumbers:h={},borders:f,textDirection:p}={},grid:{linePitch:g=360,charSpace:m,type:x}={},headerWrapperGroup:y={},footerWrapperGroup:v={},lineNumbers:b,titlePage:w,verticalAlign:j,column:N,type:C}={}){super("w:sectPr"),this.addHeaderFooterGroup(vX.HEADER,y),this.addHeaderFooterGroup(vX.FOOTER,v),C&&this.root.push(new lpt(C)),this.root.push(spt({width:e,height:r,orientation:n})),this.root.push(new tpt(s,i,o,l,c,u,d)),f&&this.root.push(new ept(f)),b&&this.root.push(Jft(b)),this.root.push(new npt(h)),N&&this.root.push(new Xft(N)),j&&this.root.push(new Yft(j)),w!==void 0&&this.root.push(new De("w:titlePg",w)),p&&this.root.push(new apt(p)),this.root.push(Qft({linePitch:g,charSpace:m,type:x}))}addHeaderFooterGroup(e,r){r.default&&this.root.push(new oM(e,{type:Wy.DEFAULT,id:r.default.View.ReferenceId})),r.first&&this.root.push(new oM(e,{type:Wy.FIRST,id:r.first.View.ReferenceId})),r.even&&this.root.push(new oM(e,{type:Wy.EVEN,id:r.even.View.ReferenceId}))}}class upt extends Re{constructor(){super("w:body"),Pe(this,"sections",[])}addSection(e){const r=this.sections.pop();this.root.push(this.createSectionParagraph(r)),this.sections.push(new cpt(e))}prepForXml(e){return this.sections.length===1&&(this.root.splice(0,1),this.root.push(this.sections.pop())),super.prepForXml(e)}push(e){this.root.push(e)}createSectionParagraph(e){const r=new Ur({}),n=new Zv({});return n.push(e),r.addChildElement(n),r}}const wX={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"};class nP extends At{constructor(e,r){super(Zt({Ignorable:r},Object.fromEntries(e.map(n=>[n,wX[n]])))),Pe(this,"xmlKeys",Zt({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(wX).map(n=>[n,`xmlns:${n}`]))))}}class dpt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}}class hpt extends Re{constructor(e){super("w:background"),this.root.push(new dpt({color:e.color===void 0?void 0:Qv(e.color),themeColor:e.themeColor,themeShade:e.themeShade===void 0?void 0:tX(e.themeShade),themeTint:e.themeTint===void 0?void 0:tX(e.themeTint)}))}}class fpt extends Re{constructor(e){super("w:document"),Pe(this,"body"),this.root.push(new nP(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new upt,e.background&&this.root.push(new hpt(e.background)),this.root.push(this.body)}add(e){return this.body.push(e),this}get Body(){return this.body}}class Wpe{constructor(e){Pe(this,"document"),Pe(this,"relationships"),this.document=new fpt(e),this.relationships=new bg}get View(){return this.document}get Relationships(){return this.relationships}}class ppt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class mpt extends Re{constructor(){super("w:wordWrap"),this.root.push(new ppt({val:0}))}}const gpt=t=>{var e,r;return new Sc({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:t.anchorLock},dropCap:{key:"w:dropCap",value:t.dropCap},width:{key:"w:w",value:t.width},height:{key:"w:h",value:t.height},x:{key:"w:x",value:t.position?t.position.x:void 0},y:{key:"w:y",value:t.position?t.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:t.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:t.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(e=t.space)==null?void 0:e.horizontal},spaceVertical:{key:"w:vSpace",value:(r=t.space)==null?void 0:r.vertical},rule:{key:"w:hRule",value:t.rule},alignmentX:{key:"w:xAlign",value:t.alignment?t.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:t.alignment?t.alignment.y:void 0},lines:{key:"w:lines",value:t.lines},wrap:{key:"w:wrap",value:t.wrap}}})};class Zv extends Z2{constructor(e){var r,n;if(super("w:pPr"),Pe(this,"numberingReferences",[]),!e)return this;e.heading&&this.push(new ZN(e.heading)),e.bullet&&this.push(new ZN("ListParagraph")),e.numbering&&!e.style&&!e.heading&&(e.numbering.custom||this.push(new ZN("ListParagraph"))),e.style&&this.push(new ZN(e.style)),e.keepNext!==void 0&&this.push(new De("w:keepNext",e.keepNext)),e.keepLines!==void 0&&this.push(new De("w:keepLines",e.keepLines)),e.pageBreakBefore&&this.push(new Tft),e.frame&&this.push(gpt(e.frame)),e.widowControl!==void 0&&this.push(new De("w:widowControl",e.widowControl)),e.bullet&&this.push(new aM(1,e.bullet.level)),e.numbering?(this.numberingReferences.push({reference:e.numbering.reference,instance:(r=e.numbering.instance)!=null?r:0}),this.push(new aM(`${e.numbering.reference}-${(n=e.numbering.instance)!=null?n:0}`,e.numbering.level))):e.numbering===!1&&this.push(new aM(0,0)),e.border&&this.push(new Dht(e.border)),e.thematicBreak&&this.push(new Lht),e.shading&&this.push(new Lpe(e.shading)),e.wordWrap&&this.push(new mpt),e.overflowPunctuation&&this.push(new De("w:overflowPunct",e.overflowPunctuation));const s=[...e.rightTabStop!==void 0?[{type:xX.RIGHT,position:e.rightTabStop}]:[],...e.tabStops?e.tabStops:[],...e.leftTabStop!==void 0?[{type:xX.LEFT,position:e.leftTabStop}]:[]];s.length>0&&this.push(new Ift(s)),e.bidirectional!==void 0&&this.push(new De("w:bidi",e.bidirectional)),e.spacing&&this.push(new Oft(e.spacing)),e.indent&&this.push(new Fht(e.indent)),e.contextualSpacing!==void 0&&this.push(new De("w:contextualSpacing",e.contextualSpacing)),e.alignment&&this.push(new Rht(e.alignment)),e.outlineLevel!==void 0&&this.push(new qft(e.outlineLevel)),e.suppressLineNumbers!==void 0&&this.push(new De("w:suppressLineNumbers",e.suppressLineNumbers)),e.autoSpaceEastAsianText!==void 0&&this.push(new De("w:autoSpaceDN",e.autoSpaceEastAsianText)),e.run&&this.push(new vg(e.run))}push(e){this.root.push(e)}prepForXml(e){if(e.viewWrapper instanceof Wpe)for(const r of this.numberingReferences)e.file.Numbering.createConcreteNumberingInstance(r.reference,r.instance);return super.prepForXml(e)}}class Ur extends Hpe{constructor(e){if(super("w:p"),Pe(this,"properties"),typeof e=="string")return this.properties=new Zv({}),this.root.push(this.properties),this.root.push(new Ws(e)),this;if(this.properties=new Zv(e),this.root.push(this.properties),e.text&&this.root.push(new Ws(e.text)),e.children)for(const r of e.children){if(r instanceof Hft){this.root.push(r.start);for(const n of r.children)this.root.push(n);this.root.push(r.end);continue}this.root.push(r)}}prepForXml(e){for(const r of this.root)if(r instanceof Bft){const n=this.root.indexOf(r),s=new $ft(r.options.children,xft());e.viewWrapper.Relationships.createRelationship(s.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",r.options.link,_ft.EXTERNAL),this.root[n]=s}return super.prepForXml(e)}addRunToFront(e){return this.root.splice(1,0,e),this}}const Dg={style:NB.NONE,size:0,color:"auto"},Lg={style:NB.SINGLE,size:4,color:"auto"};class ypt extends Re{constructor(e){super("w:tblBorders"),e.top?this.root.push(new dn("w:top",e.top)):this.root.push(new dn("w:top",Lg)),e.left?this.root.push(new dn("w:left",e.left)):this.root.push(new dn("w:left",Lg)),e.bottom?this.root.push(new dn("w:bottom",e.bottom)):this.root.push(new dn("w:bottom",Lg)),e.right?this.root.push(new dn("w:right",e.right)):this.root.push(new dn("w:right",Lg)),e.insideHorizontal?this.root.push(new dn("w:insideH",e.insideHorizontal)):this.root.push(new dn("w:insideH",Lg)),e.insideVertical?this.root.push(new dn("w:insideV",e.insideVertical)):this.root.push(new dn("w:insideV",Lg))}}Pe(ypt,"NONE",{top:Dg,bottom:Dg,left:Dg,right:Dg,insideHorizontal:Dg,insideVertical:Dg});class xpt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}}class vpt extends Re{constructor(){super("Properties"),this.root.push(new xpt({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}}class bpt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{xmlns:"xmlns"})}}class wpt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{contentType:"ContentType",extension:"Extension"})}}class Dc extends Re{constructor(e,r){super("Default"),this.root.push(new wpt({contentType:e,extension:r}))}}class _pt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{contentType:"ContentType",partName:"PartName"})}}class Wa extends Re{constructor(e,r){super("Override"),this.root.push(new _pt({contentType:e,partName:r}))}}class jpt extends Re{constructor(){super("Types"),this.root.push(new bpt({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(new Dc("image/png","png")),this.root.push(new Dc("image/jpeg","jpeg")),this.root.push(new Dc("image/jpeg","jpg")),this.root.push(new Dc("image/bmp","bmp")),this.root.push(new Dc("image/gif","gif")),this.root.push(new Dc("image/svg+xml","svg")),this.root.push(new Dc("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(new Dc("application/xml","xml")),this.root.push(new Dc("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(new Wa("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(new Wa("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(new Wa("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(new Wa("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(new Wa("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(new Wa("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(new Wa("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(new Wa("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(new Wa("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml")),this.root.push(new Wa("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml"))}addFooter(e){this.root.push(new Wa("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${e}.xml`))}addHeader(e){this.root.push(new Wa("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${e}.xml`))}}class Spt extends Re{constructor(e){super("cp:coreProperties"),this.root.push(new nP(["cp","dc","dcterms","dcmitype","xsi"])),e.title&&this.root.push(new Lf("dc:title",e.title)),e.subject&&this.root.push(new Lf("dc:subject",e.subject)),e.creator&&this.root.push(new Lf("dc:creator",e.creator)),e.keywords&&this.root.push(new Lf("cp:keywords",e.keywords)),e.description&&this.root.push(new Lf("dc:description",e.description)),e.lastModifiedBy&&this.root.push(new Lf("cp:lastModifiedBy",e.lastModifiedBy)),e.revision&&this.root.push(new Lf("cp:revision",String(e.revision))),this.root.push(new _X("dcterms:created")),this.root.push(new _X("dcterms:modified"))}}class Npt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{type:"xsi:type"})}}class _X extends Re{constructor(e){super(e),this.root.push(new Npt({type:"dcterms:W3CDTF"})),this.root.push(Oht(new Date))}}class Apt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}}class Ept extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{fmtid:"fmtid",pid:"pid",name:"name"})}}class Cpt extends Re{constructor(e,r){super("property"),this.root.push(new Ept({fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:e.toString(),name:r.name})),this.root.push(new kpt(r.value))}}class kpt extends Re{constructor(e){super("vt:lpwstr"),this.root.push(e)}}class Tpt extends Re{constructor(e){super("Properties"),Pe(this,"nextId"),Pe(this,"properties",[]),this.root.push(new Apt({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(const r of e)this.addCustomProperty(r)}prepForXml(e){return this.properties.forEach(r=>this.root.push(r)),super.prepForXml(e)}addCustomProperty(e){this.properties.push(new Cpt(this.nextId++,e))}}const JN=({id:t,fontKey:e,subsetted:r},n)=>new Sc({name:n,attributes:Zt({id:{key:"r:id",value:t}},e?{fontKey:{key:"w:fontKey",value:`{${e}}`}}:{}),children:[...r?[new De("w:subsetted",r)]:[]]}),Ppt=({name:t,altName:e,panose1:r,charset:n,family:s,notTrueType:i,pitch:o,sig:l,embedRegular:c,embedBold:u,embedItalic:d,embedBoldItalic:h})=>new Sc({name:"w:font",attributes:{name:{key:"w:name",value:t}},children:[...e?[m0("w:altName",e)]:[],...r?[m0("w:panose1",r)]:[],...n?[m0("w:charset",n)]:[],m0("w:family",s),...i?[new De("w:notTrueType",i)]:[],m0("w:pitch",o),...l?[new Sc({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:l.usb0},usb1:{key:"w:usb1",value:l.usb1},usb2:{key:"w:usb2",value:l.usb2},usb3:{key:"w:usb3",value:l.usb3},csb0:{key:"w:csb0",value:l.csb0},csb1:{key:"w:csb1",value:l.csb1}}})]:[],...c?[JN(c,"w:embedRegular")]:[],...u?[JN(u,"w:embedBold")]:[],...d?[JN(d,"w:embedItalic")]:[],...h?[JN(h,"w:embedBoldItalic")]:[]]}),Opt=({name:t,index:e,fontKey:r,characterSet:n})=>Ppt({name:t,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:n,family:"auto",pitch:"variable",embedRegular:{fontKey:r,id:`rId${e}`}}),Ipt=t=>new Sc({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:t.map((e,r)=>Opt({name:e.name,index:r+1,fontKey:e.fontKey}))});class Rpt{constructor(e){Pe(this,"fontTable"),Pe(this,"relationships"),Pe(this,"fontOptionsWithKey",[]),this.options=e,this.fontOptionsWithKey=e.map(r=>Yv(Zt({},r),{fontKey:vft()})),this.fontTable=Ipt(this.fontOptionsWithKey),this.relationships=new bg;for(let r=0;r<e.length;r++)this.relationships.createRelationship(r+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",`fonts/${e[r].name}.odttf`)}get View(){return this.fontTable}get Relationships(){return this.relationships}}class Mpt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type"})}}let Dpt=class extends Ipe{constructor(e,r){super("w:ftr",r),Pe(this,"refId"),this.refId=e,r||this.root.push(new Mpt({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}};class Lpt{constructor(e,r,n){Pe(this,"footer"),Pe(this,"relationships"),this.media=e,this.footer=new Dpt(r,n),this.relationships=new bg}add(e){this.footer.add(e)}addChildElement(e){this.footer.addChildElement(e)}get View(){return this.footer}get Relationships(){return this.relationships}get Media(){return this.media}}class Fpt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{type:"w:type",id:"w:id"})}}class $pt extends Re{constructor(){super("w:footnoteRef")}}class Bpt extends sg{constructor(){super({style:"FootnoteReference"}),this.root.push(new $pt)}}const jX={SEPERATOR:"separator",CONTINUATION_SEPERATOR:"continuationSeparator"};class cM extends Re{constructor(e){super("w:footnote"),this.root.push(new Fpt({type:e.type,id:e.id}));for(let r=0;r<e.children.length;r++){const n=e.children[r];r===0&&n.addRunToFront(new Bpt),this.root.push(n)}}}class Upt extends Re{constructor(){super("w:continuationSeparator")}}class zpt extends sg{constructor(){super({}),this.root.push(new Upt)}}class Hpt extends Re{constructor(){super("w:separator")}}class Wpt extends sg{constructor(){super({}),this.root.push(new Hpt)}}class Vpt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}}class qpt extends Re{constructor(){super("w:footnotes"),this.root.push(new Vpt({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"}));const e=new cM({id:-1,type:jX.SEPERATOR,children:[new Ur({spacing:{after:0,line:240,lineRule:M3.AUTO},children:[new Wpt]})]});this.root.push(e);const r=new cM({id:0,type:jX.CONTINUATION_SEPERATOR,children:[new Ur({spacing:{after:0,line:240,lineRule:M3.AUTO},children:[new zpt]})]});this.root.push(r)}createFootNote(e,r){const n=new cM({id:e,children:r});this.root.push(n)}}class Gpt{constructor(){Pe(this,"footnotess"),Pe(this,"relationships"),this.footnotess=new qpt,this.relationships=new bg}get View(){return this.footnotess}get Relationships(){return this.relationships}}class Kpt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type",cx:"xmlns:cx",cx1:"xmlns:cx1",cx2:"xmlns:cx2",cx3:"xmlns:cx3",cx4:"xmlns:cx4",cx5:"xmlns:cx5",cx6:"xmlns:cx6",cx7:"xmlns:cx7",cx8:"xmlns:cx8",w16cid:"xmlns:w16cid",w16se:"xmlns:w16se"})}}let Ypt=class extends Ipe{constructor(e,r){super("w:hdr",r),Pe(this,"refId"),this.refId=e,r||this.root.push(new Kpt({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}};class Xpt{constructor(e,r,n){Pe(this,"header"),Pe(this,"relationships"),this.media=e,this.header=new Ypt(r,n),this.relationships=new bg}add(e){return this.header.add(e),this}addChildElement(e){this.header.addChildElement(e)}get View(){return this.header}get Relationships(){return this.relationships}get Media(){return this.media}}class Qpt{constructor(){Pe(this,"map"),this.map=new Map}addImage(e,r){this.map.set(e,r)}get Array(){return Array.from(this.map.values())}}const Lc={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH__DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULLSTOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PARENTHESES:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW1:"hebrew1",HEBREW2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText",CUSTOM:"custom"};class Zpt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{ilvl:"w:ilvl",tentative:"w15:tentative"})}}class Jpt extends Re{constructor(e){super("w:numFmt"),this.root.push(new wn({val:e}))}}class emt extends Re{constructor(e){super("w:lvlText"),this.root.push(new wn({val:e}))}}class tmt extends Re{constructor(e){super("w:lvlJc"),this.root.push(new wn({val:e}))}}class rmt extends Re{constructor(e){super("w:suff"),this.root.push(new wn({val:e}))}}class nmt extends Re{constructor(){super("w:isLgl")}}class smt extends Re{constructor({level:e,format:r,text:n,alignment:s=Sn.START,start:i=1,style:o,suffix:l,isLegalNumberingStyle:c}){if(super("w:lvl"),Pe(this,"paragraphProperties"),Pe(this,"runProperties"),this.root.push(new Aw("w:start",Zi(i))),r&&this.root.push(new Jpt(r)),l&&this.root.push(new rmt(l)),c&&this.root.push(new nmt),n&&this.root.push(new emt(n)),this.root.push(new tmt(s)),this.paragraphProperties=new Zv(o&&o.paragraph),this.runProperties=new vg(o&&o.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new Zpt({ilvl:Zi(e),tentative:1}))}}class imt extends smt{}class amt extends Re{constructor(e){super("w:multiLevelType"),this.root.push(new wn({val:e}))}}class omt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}}class SX extends Re{constructor(e,r){super("w:abstractNum"),Pe(this,"id"),this.root.push(new omt({abstractNumId:Zi(e),restartNumberingAfterBreak:0})),this.root.push(new amt("hybridMultilevel")),this.id=e;for(const n of r)this.root.push(new imt(n))}}class lmt extends Re{constructor(e){super("w:abstractNumId"),this.root.push(new wn({val:e}))}}class cmt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{numId:"w:numId"})}}class NX extends Re{constructor(e){if(super("w:num"),Pe(this,"numId"),Pe(this,"reference"),Pe(this,"instance"),this.numId=e.numId,this.reference=e.reference,this.instance=e.instance,this.root.push(new cmt({numId:Zi(e.numId)})),this.root.push(new lmt(Zi(e.abstractNumId))),e.overrideLevels&&e.overrideLevels.length)for(const r of e.overrideLevels)this.root.push(new dmt(r.num,r.start))}}class umt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{ilvl:"w:ilvl"})}}class dmt extends Re{constructor(e,r){super("w:lvlOverride"),this.root.push(new umt({ilvl:e})),r!==void 0&&this.root.push(new fmt(r))}}class hmt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class fmt extends Re{constructor(e){super("w:startOverride"),this.root.push(new hmt({val:e}))}}class pmt extends Re{constructor(e){super("w:numbering"),Pe(this,"abstractNumberingMap",new Map),Pe(this,"concreteNumberingMap",new Map),Pe(this,"referenceConfigMap",new Map),Pe(this,"abstractNumUniqueNumericId",mft()),Pe(this,"concreteNumUniqueNumericId",gft()),this.root.push(new nP(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));const r=new SX(this.abstractNumUniqueNumericId(),[{level:0,format:Lc.BULLET,text:"●",alignment:Sn.LEFT,style:{paragraph:{indent:{left:Oo(.5),hanging:Oo(.25)}}}},{level:1,format:Lc.BULLET,text:"○",alignment:Sn.LEFT,style:{paragraph:{indent:{left:Oo(1),hanging:Oo(.25)}}}},{level:2,format:Lc.BULLET,text:"■",alignment:Sn.LEFT,style:{paragraph:{indent:{left:2160,hanging:Oo(.25)}}}},{level:3,format:Lc.BULLET,text:"●",alignment:Sn.LEFT,style:{paragraph:{indent:{left:2880,hanging:Oo(.25)}}}},{level:4,format:Lc.BULLET,text:"○",alignment:Sn.LEFT,style:{paragraph:{indent:{left:3600,hanging:Oo(.25)}}}},{level:5,format:Lc.BULLET,text:"■",alignment:Sn.LEFT,style:{paragraph:{indent:{left:4320,hanging:Oo(.25)}}}},{level:6,format:Lc.BULLET,text:"●",alignment:Sn.LEFT,style:{paragraph:{indent:{left:5040,hanging:Oo(.25)}}}},{level:7,format:Lc.BULLET,text:"●",alignment:Sn.LEFT,style:{paragraph:{indent:{left:5760,hanging:Oo(.25)}}}},{level:8,format:Lc.BULLET,text:"●",alignment:Sn.LEFT,style:{paragraph:{indent:{left:6480,hanging:Oo(.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new NX({numId:1,abstractNumId:r.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",r);for(const n of e.config)this.abstractNumberingMap.set(n.reference,new SX(this.abstractNumUniqueNumericId(),n.levels)),this.referenceConfigMap.set(n.reference,n.levels)}prepForXml(e){for(const r of this.abstractNumberingMap.values())this.root.push(r);for(const r of this.concreteNumberingMap.values())this.root.push(r);return super.prepForXml(e)}createConcreteNumberingInstance(e,r){const n=this.abstractNumberingMap.get(e);if(!n)return;const s=`${e}-${r}`;if(this.concreteNumberingMap.has(s))return;const i=this.referenceConfigMap.get(e),o=i&&i[0].start,l={numId:this.concreteNumUniqueNumericId(),abstractNumId:n.id,reference:e,instance:r,overrideLevels:[o&&Number.isInteger(o)?{num:0,start:o}:{num:0,start:1}]};this.concreteNumberingMap.set(s,new NX(l))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}}class mmt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{version:"w:val",name:"w:name",uri:"w:uri"})}}class gmt extends Re{constructor(e){super("w:compatSetting"),this.root.push(new mmt({version:e,uri:"http://schemas.microsoft.com/office/word",name:"compatibilityMode"}))}}class ymt extends Re{constructor(e){super("w:compat"),e.version&&this.root.push(new gmt(e.version)),e.useSingleBorderforContiguousCells&&this.root.push(new De("w:useSingleBorderforContiguousCells",e.useSingleBorderforContiguousCells)),e.wordPerfectJustification&&this.root.push(new De("w:wpJustification",e.wordPerfectJustification)),e.noTabStopForHangingIndent&&this.root.push(new De("w:noTabHangInd",e.noTabStopForHangingIndent)),e.noLeading&&this.root.push(new De("w:noLeading",e.noLeading)),e.spaceForUnderline&&this.root.push(new De("w:spaceForUL",e.spaceForUnderline)),e.noColumnBalance&&this.root.push(new De("w:noColumnBalance",e.noColumnBalance)),e.balanceSingleByteDoubleByteWidth&&this.root.push(new De("w:balanceSingleByteDoubleByteWidth",e.balanceSingleByteDoubleByteWidth)),e.noExtraLineSpacing&&this.root.push(new De("w:noExtraLineSpacing",e.noExtraLineSpacing)),e.doNotLeaveBackslashAlone&&this.root.push(new De("w:doNotLeaveBackslashAlone",e.doNotLeaveBackslashAlone)),e.underlineTrailingSpaces&&this.root.push(new De("w:ulTrailSpace",e.underlineTrailingSpaces)),e.doNotExpandShiftReturn&&this.root.push(new De("w:doNotExpandShiftReturn",e.doNotExpandShiftReturn)),e.spacingInWholePoints&&this.root.push(new De("w:spacingInWholePoints",e.spacingInWholePoints)),e.lineWrapLikeWord6&&this.root.push(new De("w:lineWrapLikeWord6",e.lineWrapLikeWord6)),e.printBodyTextBeforeHeader&&this.root.push(new De("w:printBodyTextBeforeHeader",e.printBodyTextBeforeHeader)),e.printColorsBlack&&this.root.push(new De("w:printColBlack",e.printColorsBlack)),e.spaceWidth&&this.root.push(new De("w:wpSpaceWidth",e.spaceWidth)),e.showBreaksInFrames&&this.root.push(new De("w:showBreaksInFrames",e.showBreaksInFrames)),e.subFontBySize&&this.root.push(new De("w:subFontBySize",e.subFontBySize)),e.suppressBottomSpacing&&this.root.push(new De("w:suppressBottomSpacing",e.suppressBottomSpacing)),e.suppressTopSpacing&&this.root.push(new De("w:suppressTopSpacing",e.suppressTopSpacing)),e.suppressSpacingAtTopOfPage&&this.root.push(new De("w:suppressSpacingAtTopOfPage",e.suppressSpacingAtTopOfPage)),e.suppressTopSpacingWP&&this.root.push(new De("w:suppressTopSpacingWP",e.suppressTopSpacingWP)),e.suppressSpBfAfterPgBrk&&this.root.push(new De("w:suppressSpBfAfterPgBrk",e.suppressSpBfAfterPgBrk)),e.swapBordersFacingPages&&this.root.push(new De("w:swapBordersFacingPages",e.swapBordersFacingPages)),e.convertMailMergeEsc&&this.root.push(new De("w:convMailMergeEsc",e.convertMailMergeEsc)),e.truncateFontHeightsLikeWP6&&this.root.push(new De("w:truncateFontHeightsLikeWP6",e.truncateFontHeightsLikeWP6)),e.macWordSmallCaps&&this.root.push(new De("w:mwSmallCaps",e.macWordSmallCaps)),e.usePrinterMetrics&&this.root.push(new De("w:usePrinterMetrics",e.usePrinterMetrics)),e.doNotSuppressParagraphBorders&&this.root.push(new De("w:doNotSuppressParagraphBorders",e.doNotSuppressParagraphBorders)),e.wrapTrailSpaces&&this.root.push(new De("w:wrapTrailSpaces",e.wrapTrailSpaces)),e.footnoteLayoutLikeWW8&&this.root.push(new De("w:footnoteLayoutLikeWW8",e.footnoteLayoutLikeWW8)),e.shapeLayoutLikeWW8&&this.root.push(new De("w:shapeLayoutLikeWW8",e.shapeLayoutLikeWW8)),e.alignTablesRowByRow&&this.root.push(new De("w:alignTablesRowByRow",e.alignTablesRowByRow)),e.forgetLastTabAlignment&&this.root.push(new De("w:forgetLastTabAlignment",e.forgetLastTabAlignment)),e.adjustLineHeightInTable&&this.root.push(new De("w:adjustLineHeightInTable",e.adjustLineHeightInTable)),e.autoSpaceLikeWord95&&this.root.push(new De("w:autoSpaceLikeWord95",e.autoSpaceLikeWord95)),e.noSpaceRaiseLower&&this.root.push(new De("w:noSpaceRaiseLower",e.noSpaceRaiseLower)),e.doNotUseHTMLParagraphAutoSpacing&&this.root.push(new De("w:doNotUseHTMLParagraphAutoSpacing",e.doNotUseHTMLParagraphAutoSpacing)),e.layoutRawTableWidth&&this.root.push(new De("w:layoutRawTableWidth",e.layoutRawTableWidth)),e.layoutTableRowsApart&&this.root.push(new De("w:layoutTableRowsApart",e.layoutTableRowsApart)),e.useWord97LineBreakRules&&this.root.push(new De("w:useWord97LineBreakRules",e.useWord97LineBreakRules)),e.doNotBreakWrappedTables&&this.root.push(new De("w:doNotBreakWrappedTables",e.doNotBreakWrappedTables)),e.doNotSnapToGridInCell&&this.root.push(new De("w:doNotSnapToGridInCell",e.doNotSnapToGridInCell)),e.selectFieldWithFirstOrLastCharacter&&this.root.push(new De("w:selectFldWithFirstOrLastChar",e.selectFieldWithFirstOrLastCharacter)),e.applyBreakingRules&&this.root.push(new De("w:applyBreakingRules",e.applyBreakingRules)),e.doNotWrapTextWithPunctuation&&this.root.push(new De("w:doNotWrapTextWithPunct",e.doNotWrapTextWithPunctuation)),e.doNotUseEastAsianBreakRules&&this.root.push(new De("w:doNotUseEastAsianBreakRules",e.doNotUseEastAsianBreakRules)),e.useWord2002TableStyleRules&&this.root.push(new De("w:useWord2002TableStyleRules",e.useWord2002TableStyleRules)),e.growAutofit&&this.root.push(new De("w:growAutofit",e.growAutofit)),e.useFELayout&&this.root.push(new De("w:useFELayout",e.useFELayout)),e.useNormalStyleForList&&this.root.push(new De("w:useNormalStyleForList",e.useNormalStyleForList)),e.doNotUseIndentAsNumberingTabStop&&this.root.push(new De("w:doNotUseIndentAsNumberingTabStop",e.doNotUseIndentAsNumberingTabStop)),e.useAlternateEastAsianLineBreakRules&&this.root.push(new De("w:useAltKinsokuLineBreakRules",e.useAlternateEastAsianLineBreakRules)),e.allowSpaceOfSameStyleInTable&&this.root.push(new De("w:allowSpaceOfSameStyleInTable",e.allowSpaceOfSameStyleInTable)),e.doNotSuppressIndentation&&this.root.push(new De("w:doNotSuppressIndentation",e.doNotSuppressIndentation)),e.doNotAutofitConstrainedTables&&this.root.push(new De("w:doNotAutofitConstrainedTables",e.doNotAutofitConstrainedTables)),e.autofitToFirstFixedWidthCell&&this.root.push(new De("w:autofitToFirstFixedWidthCell",e.autofitToFirstFixedWidthCell)),e.underlineTabInNumberingList&&this.root.push(new De("w:underlineTabInNumList",e.underlineTabInNumberingList)),e.displayHangulFixedWidth&&this.root.push(new De("w:displayHangulFixedWidth",e.displayHangulFixedWidth)),e.splitPgBreakAndParaMark&&this.root.push(new De("w:splitPgBreakAndParaMark",e.splitPgBreakAndParaMark)),e.doNotVerticallyAlignCellWithSp&&this.root.push(new De("w:doNotVertAlignCellWithSp",e.doNotVerticallyAlignCellWithSp)),e.doNotBreakConstrainedForcedTable&&this.root.push(new De("w:doNotBreakConstrainedForcedTable",e.doNotBreakConstrainedForcedTable)),e.ignoreVerticalAlignmentInTextboxes&&this.root.push(new De("w:doNotVertAlignInTxbx",e.ignoreVerticalAlignmentInTextboxes)),e.useAnsiKerningPairs&&this.root.push(new De("w:useAnsiKerningPairs",e.useAnsiKerningPairs)),e.cachedColumnBalance&&this.root.push(new De("w:cachedColBalance",e.cachedColumnBalance))}}class xmt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}}class vmt extends Re{constructor(e){var r,n,s,i,o,l,c,u;super("w:settings"),this.root.push(new xmt({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new De("w:displayBackgroundShape",!0)),e.trackRevisions!==void 0&&this.root.push(new De("w:trackRevisions",e.trackRevisions)),e.evenAndOddHeaders!==void 0&&this.root.push(new De("w:evenAndOddHeaders",e.evenAndOddHeaders)),e.updateFields!==void 0&&this.root.push(new De("w:updateFields",e.updateFields)),e.defaultTabStop!==void 0&&this.root.push(new Aw("w:defaultTabStop",e.defaultTabStop)),((r=e.hyphenation)==null?void 0:r.autoHyphenation)!==void 0&&this.root.push(new De("w:autoHyphenation",e.hyphenation.autoHyphenation)),((n=e.hyphenation)==null?void 0:n.hyphenationZone)!==void 0&&this.root.push(new Aw("w:hyphenationZone",e.hyphenation.hyphenationZone)),((s=e.hyphenation)==null?void 0:s.consecutiveHyphenLimit)!==void 0&&this.root.push(new Aw("w:consecutiveHyphenLimit",e.hyphenation.consecutiveHyphenLimit)),((i=e.hyphenation)==null?void 0:i.doNotHyphenateCaps)!==void 0&&this.root.push(new De("w:doNotHyphenateCaps",e.hyphenation.doNotHyphenateCaps)),this.root.push(new ymt(Yv(Zt({},(o=e.compatibility)!=null?o:{}),{version:(u=(c=(l=e.compatibility)==null?void 0:l.version)!=null?c:e.compatibilityModeVersion)!=null?u:15})))}}class Vpe extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class bmt extends Re{constructor(e){super("w:name"),this.root.push(new Vpe({val:e}))}}class wmt extends Re{constructor(e){super("w:uiPriority"),this.root.push(new Vpe({val:Zi(e)}))}}class _mt extends At{constructor(){super(...arguments),Pe(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}}class qpe extends Re{constructor(e,r){super("w:style"),this.root.push(new _mt(e)),r.name&&this.root.push(new bmt(r.name)),r.basedOn&&this.root.push(new Lm("w:basedOn",r.basedOn)),r.next&&this.root.push(new Lm("w:next",r.next)),r.link&&this.root.push(new Lm("w:link",r.link)),r.uiPriority!==void 0&&this.root.push(new wmt(r.uiPriority)),r.semiHidden!==void 0&&this.root.push(new De("w:semiHidden",r.semiHidden)),r.unhideWhenUsed!==void 0&&this.root.push(new De("w:unhideWhenUsed",r.unhideWhenUsed)),r.quickFormat!==void 0&&this.root.push(new De("w:qFormat",r.quickFormat))}}class sP extends qpe{constructor(e){super({type:"paragraph",styleId:e.id},e),Pe(this,"paragraphProperties"),Pe(this,"runProperties"),this.paragraphProperties=new Zv(e.paragraph),this.runProperties=new vg(e.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}}class iP extends qpe{constructor(e){super({type:"character",styleId:e.id},Zt({uiPriority:99,unhideWhenUsed:!0},e)),Pe(this,"runProperties"),this.runProperties=new vg(e.run),this.root.push(this.runProperties)}}class kf extends sP{constructor(e){super(Zt({basedOn:"Normal",next:"Normal",quickFormat:!0},e))}}class jmt extends kf{constructor(e){super(Zt({id:"Title",name:"Title"},e))}}class Smt extends kf{constructor(e){super(Zt({id:"Heading1",name:"Heading 1"},e))}}class Nmt extends kf{constructor(e){super(Zt({id:"Heading2",name:"Heading 2"},e))}}class Amt extends kf{constructor(e){super(Zt({id:"Heading3",name:"Heading 3"},e))}}class Emt extends kf{constructor(e){super(Zt({id:"Heading4",name:"Heading 4"},e))}}class Cmt extends kf{constructor(e){super(Zt({id:"Heading5",name:"Heading 5"},e))}}class kmt extends kf{constructor(e){super(Zt({id:"Heading6",name:"Heading 6"},e))}}class Tmt extends kf{constructor(e){super(Zt({id:"Strong",name:"Strong"},e))}}class Pmt extends sP{constructor(e){super(Zt({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},e))}}class Omt extends sP{constructor(e){super(Zt({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:M3.AUTO}},run:{size:20}},e))}}class Imt extends iP{constructor(e){super(Zt({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}}class Rmt extends iP{constructor(e){super(Zt({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},e))}}class Mmt extends iP{constructor(e){super(Zt({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:$pe.SINGLE}}},e))}}class L3 extends Re{constructor(e){if(super("w:styles"),e.initialStyles&&this.root.push(e.initialStyles),e.importedStyles)for(const r of e.importedStyles)this.root.push(r);if(e.paragraphStyles)for(const r of e.paragraphStyles)this.root.push(new sP(r));if(e.characterStyles)for(const r of e.characterStyles)this.root.push(new iP(r))}}class Dmt extends Re{constructor(e){super("w:pPrDefault"),this.root.push(new Zv(e))}}class Lmt extends Re{constructor(e){super("w:rPrDefault"),this.root.push(new vg(e))}}class Fmt extends Re{constructor(e){super("w:docDefaults"),Pe(this,"runPropertiesDefaults"),Pe(this,"paragraphPropertiesDefaults"),this.runPropertiesDefaults=new Lmt(e.run),this.paragraphPropertiesDefaults=new Dmt(e.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}}class $mt{newInstance(e){const r=Ope.xml2js(e,{compact:!1});let n;for(const o of r.elements||[])o.name==="w:styles"&&(n=o);if(n===void 0)throw new Error("can not find styles element");const s=n.elements||[];return new L3({initialStyles:new Cht(n.attributes),importedStyles:s.map(o=>SB(o))})}}class AX{newInstance(e={}){var r;return{initialStyles:new nP(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new Fmt((r=e.document)!=null?r:{}),new jmt(Zt({run:{size:56}},e.title)),new Smt(Zt({run:{color:"2E74B5",size:32}},e.heading1)),new Nmt(Zt({run:{color:"2E74B5",size:26}},e.heading2)),new Amt(Zt({run:{color:"1F4D78",size:24}},e.heading3)),new Emt(Zt({run:{color:"2E74B5",italics:!0}},e.heading4)),new Cmt(Zt({run:{color:"2E74B5"}},e.heading5)),new kmt(Zt({run:{color:"1F4D78"}},e.heading6)),new Tmt(Zt({run:{bold:!0}},e.strong)),new Pmt(e.listParagraph||{}),new Mmt(e.hyperlink||{}),new Imt(e.footnoteReference||{}),new Omt(e.footnoteText||{}),new Rmt(e.footnoteTextChar||{})]}}}let Bmt=class{constructor(e){Pe(this,"currentRelationshipId",1),Pe(this,"documentWrapper"),Pe(this,"headers",[]),Pe(this,"footers",[]),Pe(this,"coreProperties"),Pe(this,"numbering"),Pe(this,"media"),Pe(this,"fileRelationships"),Pe(this,"footnotesWrapper"),Pe(this,"settings"),Pe(this,"contentTypes"),Pe(this,"customProperties"),Pe(this,"appProperties"),Pe(this,"styles"),Pe(this,"comments"),Pe(this,"fontWrapper");var r,n,s,i,o,l,c,u,d,h,f,p;if(this.coreProperties=new Spt(Yv(Zt({},e),{creator:(r=e.creator)!=null?r:"Un-named",revision:(n=e.revision)!=null?n:1,lastModifiedBy:(s=e.lastModifiedBy)!=null?s:"Un-named"})),this.numbering=new pmt(e.numbering?e.numbering:{config:[]}),this.comments=new Eft((i=e.comments)!=null?i:{children:[]}),this.fileRelationships=new bg,this.customProperties=new Tpt((o=e.customProperties)!=null?o:[]),this.appProperties=new vpt,this.footnotesWrapper=new Gpt,this.contentTypes=new jpt,this.documentWrapper=new Wpe({background:e.background}),this.settings=new vmt({compatibilityModeVersion:e.compatabilityModeVersion,compatibility:e.compatibility,evenAndOddHeaders:!!e.evenAndOddHeaderAndFooters,trackRevisions:(l=e.features)==null?void 0:l.trackRevisions,updateFields:(c=e.features)==null?void 0:c.updateFields,defaultTabStop:e.defaultTabStop,hyphenation:{autoHyphenation:(u=e.hyphenation)==null?void 0:u.autoHyphenation,hyphenationZone:(d=e.hyphenation)==null?void 0:d.hyphenationZone,consecutiveHyphenLimit:(h=e.hyphenation)==null?void 0:h.consecutiveHyphenLimit,doNotHyphenateCaps:(f=e.hyphenation)==null?void 0:f.doNotHyphenateCaps}}),this.media=new Qpt,e.externalStyles!==void 0){const g=new $mt;this.styles=g.newInstance(e.externalStyles)}else if(e.styles){const m=new AX().newInstance(e.styles.default);this.styles=new L3(Zt(Zt({},m),e.styles))}else{const g=new AX;this.styles=new L3(g.newInstance())}this.addDefaultRelationships();for(const g of e.sections)this.addSection(g);if(e.footnotes)for(const g in e.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(g),e.footnotes[g].children);this.fontWrapper=new Rpt((p=e.fonts)!=null?p:[])}addSection({headers:e={},footers:r={},children:n,properties:s}){this.documentWrapper.View.Body.addSection(Yv(Zt({},s),{headerWrapperGroup:{default:e.default?this.createHeader(e.default):void 0,first:e.first?this.createHeader(e.first):void 0,even:e.even?this.createHeader(e.even):void 0},footerWrapperGroup:{default:r.default?this.createFooter(r.default):void 0,first:r.first?this.createFooter(r.first):void 0,even:r.even?this.createFooter(r.even):void 0}}));for(const i of n)this.documentWrapper.View.add(i)}createHeader(e){const r=new Xpt(this.media,this.currentRelationshipId++);for(const n of e.options.children)r.add(n);return this.addHeaderToDocument(r),r}createFooter(e){const r=new Lpt(this.media,this.currentRelationshipId++);for(const n of e.options.children)r.add(n);return this.addFooterToDocument(r),r}addHeaderToDocument(e,r=Wy.DEFAULT){this.headers.push({header:e,type:r}),this.documentWrapper.Relationships.createRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(e,r=Wy.DEFAULT){this.footers.push({footer:e,type:r}),this.documentWrapper.Relationships.createRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){this.fileRelationships.createRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.createRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.createRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.createRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.createRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.createRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.createRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.createRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.documentWrapper.Relationships.createRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml")}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map(e=>e.header)}get Footers(){return this.footers.map(e=>e.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get FontTable(){return this.fontWrapper}};class Umt extends Re{constructor(e={}){super("w:instrText"),Pe(this,"properties"),this.properties=e,this.root.push(new ng({space:rg.PRESERVE}));let r="TOC";if(this.properties.captionLabel&&(r=`${r} \\a "${this.properties.captionLabel}"`),this.properties.entriesFromBookmark&&(r=`${r} \\b "${this.properties.entriesFromBookmark}"`),this.properties.captionLabelIncludingNumbers&&(r=`${r} \\c "${this.properties.captionLabelIncludingNumbers}"`),this.properties.sequenceAndPageNumbersSeparator&&(r=`${r} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`),this.properties.tcFieldIdentifier&&(r=`${r} \\f "${this.properties.tcFieldIdentifier}"`),this.properties.hyperlink&&(r=`${r} \\h`),this.properties.tcFieldLevelRange&&(r=`${r} \\l "${this.properties.tcFieldLevelRange}"`),this.properties.pageNumbersEntryLevelsRange&&(r=`${r} \\n "${this.properties.pageNumbersEntryLevelsRange}"`),this.properties.headingStyleRange&&(r=`${r} \\o "${this.properties.headingStyleRange}"`),this.properties.entryAndPageNumberSeparator&&(r=`${r} \\p "${this.properties.entryAndPageNumberSeparator}"`),this.properties.seqFieldIdentifierForPrefix&&(r=`${r} \\s "${this.properties.seqFieldIdentifierForPrefix}"`),this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){const n=this.properties.stylesWithLevels.map(s=>`${s.styleName},${s.level}`).join(",");r=`${r} \\t "${n}"`}this.properties.useAppliedParagraphOutlineLevel&&(r=`${r} \\u`),this.properties.preserveTabInEntries&&(r=`${r} \\w`),this.properties.preserveNewLineInEntries&&(r=`${r} \\x`),this.properties.hideTabAndPageNumbersInWebView&&(r=`${r} \\z`),this.root.push(r)}}class zmt extends Re{constructor(){super("w:sdtContent")}}class Hmt extends Re{constructor(e){super("w:sdtPr"),e&&this.root.push(new Lm("w:alias",e))}}class Wmt extends Hpe{constructor(e="Table of Contents",r){super("w:sdt"),this.root.push(new Hmt(e));const n=new zmt,s=new Ur({children:[new sg({children:[new Z0(!0),new Umt(r),new J0]})]});n.addChildElement(s);const i=new Ur({children:[new sg({children:[new ew]})]});n.addChildElement(i),this.root.push(n)}}class Vmt{constructor(e={children:[]}){Pe(this,"options"),this.options=e}}class qmt{constructor(e={children:[]}){Pe(this,"options"),this.options=e}}var Gmt=wB();function eA(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var uM={exports:{}},EX;function Kmt(){return EX||(EX=1,function(t,e){(function(r){t.exports=r()})(function(){return function r(n,s,i){function o(u,d){if(!s[u]){if(!n[u]){var h=typeof eA=="function"&&eA;if(!d&&h)return h(u,!0);if(l)return l(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=s[u]={exports:{}};n[u][0].call(p.exports,function(g){var m=n[u][1][g];return o(m||g)},p,p.exports,r,n,s,i)}return s[u].exports}for(var l=typeof eA=="function"&&eA,c=0;c<i.length;c++)o(i[c]);return o}({1:[function(r,n,s){var i=r("./utils"),o=r("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(c){for(var u,d,h,f,p,g,m,x=[],y=0,v=c.length,b=v,w=i.getTypeOf(c)!=="string";y<c.length;)b=v-y,h=w?(u=c[y++],d=y<v?c[y++]:0,y<v?c[y++]:0):(u=c.charCodeAt(y++),d=y<v?c.charCodeAt(y++):0,y<v?c.charCodeAt(y++):0),f=u>>2,p=(3&u)<<4|d>>4,g=1<b?(15&d)<<2|h>>6:64,m=2<b?63&h:64,x.push(l.charAt(f)+l.charAt(p)+l.charAt(g)+l.charAt(m));return x.join("")},s.decode=function(c){var u,d,h,f,p,g,m=0,x=0,y="data:";if(c.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var v,b=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&b--,c.charAt(c.length-2)===l.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=o.uint8array?new Uint8Array(0|b):new Array(0|b);m<c.length;)u=l.indexOf(c.charAt(m++))<<2|(f=l.indexOf(c.charAt(m++)))>>4,d=(15&f)<<4|(p=l.indexOf(c.charAt(m++)))>>2,h=(3&p)<<6|(g=l.indexOf(c.charAt(m++))),v[x++]=u,p!==64&&(v[x++]=d),g!==64&&(v[x++]=h);return v}},{"./support":30,"./utils":32}],2:[function(r,n,s){var i=r("./external"),o=r("./stream/DataWorker"),l=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(d,h,f,p,g){this.compressedSize=d,this.uncompressedSize=h,this.crc32=f,this.compression=p,this.compressedContent=g}u.prototype={getContentWorker:function(){var d=new o(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new o(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,h,f){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(h.compressWorker(f)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var i=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var i=r("./utils"),o=function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c}();n.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?function(u,d,h,f){var p=o,g=f+h;u^=-1;for(var m=f;m<g;m++)u=u>>>8^p[255&(u^d[m])];return-1^u}(0|c,l,l.length,0):function(u,d,h,f){var p=o,g=f+h;u^=-1;for(var m=f;m<g;m++)u=u>>>8^p[255&(u^d.charCodeAt(m))];return-1^u}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(r,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(r,n,s){var i=null;i=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:i}},{lie:37}],7:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=r("pako"),l=r("./utils"),c=r("./stream/GenericWorker"),u=i?"uint8array":"array";function d(h,f){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=f,this.meta={}}s.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,h.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(f){h.push({data:f,meta:h.meta})}},s.compressWorker=function(h){return new d("Deflate",h)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function i(p,g){var m,x="";for(m=0;m<g;m++)x+=String.fromCharCode(255&p),p>>>=8;return x}function o(p,g,m,x,y,v){var b,w,j=p.file,N=p.compression,C=v!==u.utf8encode,k=l.transformTo("string",v(j.name)),E=l.transformTo("string",u.utf8encode(j.name)),M=j.comment,z=l.transformTo("string",v(M)),P=l.transformTo("string",u.utf8encode(M)),V=E.length!==j.name.length,A=P.length!==M.length,$="",K="",G="",Y=j.dir,H=j.date,B={crc32:0,compressedSize:0,uncompressedSize:0};g&&!m||(B.crc32=p.crc32,B.compressedSize=p.compressedSize,B.uncompressedSize=p.uncompressedSize);var L=0;g&&(L|=8),C||!V&&!A||(L|=2048);var F=0,W=0;Y&&(F|=16),y==="UNIX"?(W=798,F|=function(oe,le){var U=oe;return oe||(U=le?16893:33204),(65535&U)<<16}(j.unixPermissions,Y)):(W=20,F|=function(oe){return 63&(oe||0)}(j.dosPermissions)),b=H.getUTCHours(),b<<=6,b|=H.getUTCMinutes(),b<<=5,b|=H.getUTCSeconds()/2,w=H.getUTCFullYear()-1980,w<<=4,w|=H.getUTCMonth()+1,w<<=5,w|=H.getUTCDate(),V&&(K=i(1,1)+i(d(k),4)+E,$+="up"+i(K.length,2)+K),A&&(G=i(1,1)+i(d(z),4)+P,$+="uc"+i(G.length,2)+G);var X="";return X+=`
\0`,X+=i(L,2),X+=N.magic,X+=i(b,2),X+=i(w,2),X+=i(B.crc32,4),X+=i(B.compressedSize,4),X+=i(B.uncompressedSize,4),X+=i(k.length,2),X+=i($.length,2),{fileRecord:h.LOCAL_FILE_HEADER+X+k+$,dirRecord:h.CENTRAL_FILE_HEADER+i(W,2)+X+i(z.length,2)+"\0\0\0\0"+i(F,4)+i(x,4)+k+$+z}}var l=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),h=r("../signature");function f(p,g,m,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=m,this.encodeFileName=x,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(f,c),f.prototype.push=function(p){var g=p.meta.percent||0,m=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(g+100*(m-x-1))/m:100}}))},f.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var g=this.streamFiles&&!p.file.dir;if(g){var m=o(p,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(p){this.accumulate=!1;var g=this.streamFiles&&!p.file.dir,m=o(p,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),g)this.push({data:function(x){return h.DATA_DESCRIPTOR+i(x.crc32,4)+i(x.compressedSize,4)+i(x.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var p=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var m=this.bytesWritten-p,x=function(y,v,b,w,j){var N=l.transformTo("string",j(w));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(y,2)+i(y,2)+i(v,4)+i(b,4)+i(N.length,2)+N}(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(p){this._sources.push(p);var g=this;return p.on("data",function(m){g.processChunk(m)}),p.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),p.on("error",function(m){g.error(m)}),this},f.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(p){var g=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var m=0;m<g.length;m++)try{g[m].error(p)}catch{}return!0},f.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,g=0;g<p.length;g++)p[g].lock()},n.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,n,s){var i=r("../compressions"),o=r("./ZipFileWorker");s.generateWorker=function(l,c,u){var d=new o(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{l.forEach(function(f,p){h++;var g=function(v,b){var w=v||b,j=i[w];if(!j)throw new Error(w+" is not a valid compression method !");return j}(p.options.compression,c.compression),m=p.options.compressionOptions||c.compressionOptions||{},x=p.dir,y=p.date;p._compressWorker(g,m).withStreamInfo("file",{name:f,dir:x,date:y,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=h}catch(f){d.error(f)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,n,s){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new i;for(var l in this)typeof this[l]!="function"&&(o[l]=this[l]);return o}}(i.prototype=r("./object")).loadAsync=r("./load"),i.support=r("./support"),i.defaults=r("./defaults"),i.version="3.10.1",i.loadAsync=function(o,l){return new i().loadAsync(o,l)},i.external=r("./external"),n.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,n,s){var i=r("./utils"),o=r("./external"),l=r("./utf8"),c=r("./zipEntries"),u=r("./stream/Crc32Probe"),d=r("./nodejsUtils");function h(f){return new o.Promise(function(p,g){var m=f.decompressed.getContentWorker().pipe(new u);m.on("error",function(x){g(x)}).on("end",function(){m.streamInfo.crc32!==f.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}n.exports=function(f,p){var g=this;return p=i.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",f,!0,p.optimizedBinaryString,p.base64).then(function(m){var x=new c(p);return x.load(m),x}).then(function(m){var x=[o.Promise.resolve(m)],y=m.files;if(p.checkCRC32)for(var v=0;v<y.length;v++)x.push(h(y[v]));return o.Promise.all(x)}).then(function(m){for(var x=m.shift(),y=x.files,v=0;v<y.length;v++){var b=y[v],w=b.fileNameStr,j=i.resolve(b.fileNameStr);g.file(j,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:p.createFolders}),b.dir||(g.file(j).unsafeOriginalName=w)}return x.zipComment.length&&(g.comment=x.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,n,s){var i=r("../utils"),o=r("../stream/GenericWorker");function l(c,u){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(l,o),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,n,s){var i=r("readable-stream").Readable;function o(l,c,u){i.call(this,c),this._helper=l;var d=this;l.on("data",function(h,f){d.push(h)||d._helper.pause(),u&&u(f)}).on("error",function(h){d.emit("error",h)}).on("end",function(){d.push(null)})}r("../utils").inherits(o,i),o.prototype._read=function(){this._helper.resume()},n.exports=o},{"../utils":32,"readable-stream":16}],14:[function(r,n,s){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,o);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,o)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var o=new Buffer(i);return o.fill(0),o},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(r,n,s){function i(j,N,C){var k,E=l.getTypeOf(N),M=l.extend(C||{},d);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(j=y(j)),M.createFolders&&(k=x(j))&&v.call(this,k,!0);var z=E==="string"&&M.binary===!1&&M.base64===!1;C&&C.binary!==void 0||(M.binary=!z),(N instanceof h&&N.uncompressedSize===0||M.dir||!N||N.length===0)&&(M.base64=!1,M.binary=!0,N="",M.compression="STORE",E="string");var P=null;P=N instanceof h||N instanceof c?N:g.isNode&&g.isStream(N)?new m(j,N):l.prepareContent(j,N,M.binary,M.optimizedBinaryString,M.base64);var V=new f(j,P,M);this.files[j]=V}var o=r("./utf8"),l=r("./utils"),c=r("./stream/GenericWorker"),u=r("./stream/StreamHelper"),d=r("./defaults"),h=r("./compressedObject"),f=r("./zipObject"),p=r("./generate"),g=r("./nodejsUtils"),m=r("./nodejs/NodejsStreamInputAdapter"),x=function(j){j.slice(-1)==="/"&&(j=j.substring(0,j.length-1));var N=j.lastIndexOf("/");return 0<N?j.substring(0,N):""},y=function(j){return j.slice(-1)!=="/"&&(j+="/"),j},v=function(j,N){return N=N!==void 0?N:d.createFolders,j=y(j),this.files[j]||i.call(this,j,null,{dir:!0,createFolders:N}),this.files[j]};function b(j){return Object.prototype.toString.call(j)==="[object RegExp]"}var w={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(j){var N,C,k;for(N in this.files)k=this.files[N],(C=N.slice(this.root.length,N.length))&&N.slice(0,this.root.length)===this.root&&j(C,k)},filter:function(j){var N=[];return this.forEach(function(C,k){j(C,k)&&N.push(k)}),N},file:function(j,N,C){if(arguments.length!==1)return j=this.root+j,i.call(this,j,N,C),this;if(b(j)){var k=j;return this.filter(function(M,z){return!z.dir&&k.test(M)})}var E=this.files[this.root+j];return E&&!E.dir?E:null},folder:function(j){if(!j)return this;if(b(j))return this.filter(function(E,M){return M.dir&&j.test(E)});var N=this.root+j,C=v.call(this,N),k=this.clone();return k.root=C.name,k},remove:function(j){j=this.root+j;var N=this.files[j];if(N||(j.slice(-1)!=="/"&&(j+="/"),N=this.files[j]),N&&!N.dir)delete this.files[j];else for(var C=this.filter(function(E,M){return M.name.slice(0,j.length)===j}),k=0;k<C.length;k++)delete this.files[C[k].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(j){var N,C={};try{if((C=l.extend(j||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");l.checkSupport(C.type),C.platform!=="darwin"&&C.platform!=="freebsd"&&C.platform!=="linux"&&C.platform!=="sunos"||(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var k=C.comment||this.comment||"";N=p.generateWorker(this,C,k)}catch(E){(N=new c("error")).error(E)}return new u(N,C.type||"string",C.mimeType)},generateAsync:function(j,N){return this.generateInternalStream(j).accumulate(N)},generateNodeStream:function(j,N){return(j=j||{}).type||(j.type="nodebuffer"),this.generateInternalStream(j).toNodejsStream(N)}};n.exports=w},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,n,s){n.exports=r("stream")},{stream:void 0}],17:[function(r,n,s){var i=r("./DataReader");function o(l){i.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data[this.zero+l]},o.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===c&&this.data[f+1]===u&&this.data[f+2]===d&&this.data[f+3]===h)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),f=this.readData(4);return c===f[0]&&u===f[1]&&d===f[2]&&h===f[3]},o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],18:[function(r,n,s){var i=r("../utils");function o(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return i.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},n.exports=o},{"../utils":32}],19:[function(r,n,s){var i=r("./Uint8ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var i=r("./DataReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},o.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},o.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var i=r("./ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var i=r("../utils"),o=r("../support"),l=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(h){var f=i.getTypeOf(h);return i.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new u(h):o.uint8array?new d(i.transformTo("uint8array",h)):new l(i.transformTo("array",h)):new c(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var i=r("./GenericWorker"),o=r("../utils");function l(c){i.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(l,i),l.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},n.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var i=r("./GenericWorker"),o=r("../crc32");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(l,i),l.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.inherits(l,o),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}o.prototype.processChunk.call(this,c)},n.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(l,o),l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function i(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,l){return this._listeners[o].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,l){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,l)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var l=this;return o.on("data",function(c){l.processChunk(c)}),o.on("end",function(){l.end()}),o.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,l){return this.extraStreamInfo[o]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},n.exports=i},{}],29:[function(r,n,s){var i=r("../utils"),o=r("./ConvertWorker"),l=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),h=null;if(u.nodestream)try{h=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(g,m){return new d.Promise(function(x,y){var v=[],b=g._internalType,w=g._outputType,j=g._mimeType;g.on("data",function(N,C){v.push(N),m&&m(C)}).on("error",function(N){v=[],y(N)}).on("end",function(){try{var N=function(C,k,E){switch(C){case"blob":return i.newBlob(i.transformTo("arraybuffer",k),E);case"base64":return c.encode(k);default:return i.transformTo(C,k)}}(w,function(C,k){var E,M=0,z=null,P=0;for(E=0;E<k.length;E++)P+=k[E].length;switch(C){case"string":return k.join("");case"array":return Array.prototype.concat.apply([],k);case"uint8array":for(z=new Uint8Array(P),E=0;E<k.length;E++)z.set(k[E],M),M+=k[E].length;return z;case"nodebuffer":return Buffer.concat(k);default:throw new Error("concat : unsupported type '"+C+"'")}}(b,v),j);x(N)}catch(C){y(C)}v=[]}).resume()})}function p(g,m,x){var y=m;switch(m){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=m,this._mimeType=x,i.checkSupport(y),this._worker=g.pipe(new o(y)),g.lock()}catch(v){this._worker=new l("error"),this._worker.error(v)}}p.prototype={accumulate:function(g){return f(this,g)},on:function(g,m){var x=this;return g==="data"?this._worker.on(g,function(y){m.call(x,y.data,y.meta)}):this._worker.on(g,function(){i.delay(m,arguments,x)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},g)}},n.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,n,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var i=new ArrayBuffer(0);try{s.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(i),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var i=r("./utils"),o=r("./support"),l=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function h(){c.call(this,"utf-8 decode"),this.leftOver=null}function f(){c.call(this,"utf-8 encode")}s.utf8encode=function(p){return o.nodebuffer?l.newBufferFrom(p,"utf-8"):function(g){var m,x,y,v,b,w=g.length,j=0;for(v=0;v<w;v++)(64512&(x=g.charCodeAt(v)))==55296&&v+1<w&&(64512&(y=g.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),v++),j+=x<128?1:x<2048?2:x<65536?3:4;for(m=o.uint8array?new Uint8Array(j):new Array(j),v=b=0;b<j;v++)(64512&(x=g.charCodeAt(v)))==55296&&v+1<w&&(64512&(y=g.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),v++),x<128?m[b++]=x:(x<2048?m[b++]=192|x>>>6:(x<65536?m[b++]=224|x>>>12:(m[b++]=240|x>>>18,m[b++]=128|x>>>12&63),m[b++]=128|x>>>6&63),m[b++]=128|63&x);return m}(p)},s.utf8decode=function(p){return o.nodebuffer?i.transformTo("nodebuffer",p).toString("utf-8"):function(g){var m,x,y,v,b=g.length,w=new Array(2*b);for(m=x=0;m<b;)if((y=g[m++])<128)w[x++]=y;else if(4<(v=u[y]))w[x++]=65533,m+=v-1;else{for(y&=v===2?31:v===3?15:7;1<v&&m<b;)y=y<<6|63&g[m++],v--;1<v?w[x++]=65533:y<65536?w[x++]=y:(y-=65536,w[x++]=55296|y>>10&1023,w[x++]=56320|1023&y)}return w.length!==x&&(w.subarray?w=w.subarray(0,x):w.length=x),i.applyFromCharCode(w)}(p=i.transformTo(o.uint8array?"uint8array":"array",p))},i.inherits(h,c),h.prototype.processChunk=function(p){var g=i.transformTo(o.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=g;(g=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),g.set(m,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var x=function(v,b){var w;for((b=b||v.length)>v.length&&(b=v.length),w=b-1;0<=w&&(192&v[w])==128;)w--;return w<0||w===0?b:w+u[v[w]]>b?w:b}(g),y=g;x!==g.length&&(o.uint8array?(y=g.subarray(0,x),this.leftOver=g.subarray(x,g.length)):(y=g.slice(0,x),this.leftOver=g.slice(x,g.length))),this.push({data:s.utf8decode(y),meta:p.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=h,i.inherits(f,c),f.prototype.processChunk=function(p){this.push({data:s.utf8encode(p.data),meta:p.meta})},s.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var i=r("./support"),o=r("./base64"),l=r("./nodejsUtils"),c=r("./external");function u(m){return m}function d(m,x){for(var y=0;y<m.length;++y)x[y]=255&m.charCodeAt(y);return x}r("setimmediate"),s.newBlob=function(m,x){s.checkSupport("blob");try{return new Blob([m],{type:x})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(m),y.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(m,x,y){var v=[],b=0,w=m.length;if(w<=y)return String.fromCharCode.apply(null,m);for(;b<w;)x==="array"||x==="nodebuffer"?v.push(String.fromCharCode.apply(null,m.slice(b,Math.min(b+y,w)))):v.push(String.fromCharCode.apply(null,m.subarray(b,Math.min(b+y,w)))),b+=y;return v.join("")},stringifyByChar:function(m){for(var x="",y=0;y<m.length;y++)x+=String.fromCharCode(m[y]);return x},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}}()}};function f(m){var x=65536,y=s.getTypeOf(m),v=!0;if(y==="uint8array"?v=h.applyCanBeUsed.uint8array:y==="nodebuffer"&&(v=h.applyCanBeUsed.nodebuffer),v)for(;1<x;)try{return h.stringifyByChunk(m,y,x)}catch{x=Math.floor(x/2)}return h.stringifyByChar(m)}function p(m,x){for(var y=0;y<m.length;y++)x[y]=m[y];return x}s.applyFromCharCode=f;var g={};g.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return g.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,l.allocBuffer(m.length))}},g.array={string:f,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(m)}},g.arraybuffer={string:function(m){return f(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:u,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(new Uint8Array(m))}},g.uint8array={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return l.newBufferFrom(m)}},g.nodebuffer={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return g.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:u},s.transformTo=function(m,x){if(x=x||"",!m)return x;s.checkSupport(m);var y=s.getTypeOf(x);return g[y][m](x)},s.resolve=function(m){for(var x=m.split("/"),y=[],v=0;v<x.length;v++){var b=x[v];b==="."||b===""&&v!==0&&v!==x.length-1||(b===".."?y.pop():y.push(b))}return y.join("/")},s.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(m)?"nodebuffer":i.uint8array&&m instanceof Uint8Array?"uint8array":i.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(m){if(!i[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(m){var x,y,v="";for(y=0;y<(m||"").length;y++)v+="\\x"+((x=m.charCodeAt(y))<16?"0":"")+x.toString(16).toUpperCase();return v},s.delay=function(m,x,y){setImmediate(function(){m.apply(y||null,x||[])})},s.inherits=function(m,x){function y(){}y.prototype=x.prototype,m.prototype=new y},s.extend=function(){var m,x,y={};for(m=0;m<arguments.length;m++)for(x in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],x)&&y[x]===void 0&&(y[x]=arguments[m][x]);return y},s.prepareContent=function(m,x,y,v,b){return c.Promise.resolve(x).then(function(w){return i.blob&&(w instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(w))!==-1)&&typeof FileReader<"u"?new c.Promise(function(j,N){var C=new FileReader;C.onload=function(k){j(k.target.result)},C.onerror=function(k){N(k.target.error)},C.readAsArrayBuffer(w)}):w}).then(function(w){var j=s.getTypeOf(w);return j?(j==="arraybuffer"?w=s.transformTo("uint8array",w):j==="string"&&(b?w=o.decode(w):y&&v!==!0&&(w=function(N){return d(N,i.uint8array?new Uint8Array(N.length):new Array(N.length))}(w))),w):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,n,s){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./signature"),c=r("./zipEntry"),u=r("./support");function d(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(h)+")")}},isSignature:function(h,f){var p=this.reader.index;this.reader.setIndex(h);var g=this.reader.readString(4)===f;return this.reader.setIndex(p),g},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var h=this.reader.readData(this.zipCommentLength),f=u.uint8array?"uint8array":"array",p=o.transformTo(f,h);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var h,f,p,g=this.zip64EndOfCentralSize-44;0<g;)h=this.reader.readInt(2),f=this.reader.readInt(4),p=this.reader.readData(f),this.zip64ExtensibleData[h]={id:h,length:f,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var h,f;for(h=0;h<this.files.length;h++)f=this.files[h],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var h=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(h);var f=h;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(h=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var g=f-p;if(0<g)this.isSignature(f,l.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(h){this.reader=i(h)},load:function(h){this.prepareReader(h),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,n,s){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./compressedObject"),c=r("./crc32"),u=r("./utf8"),d=r("./compressions"),h=r("./support");function f(p,g){this.options=p,this.loadOptions=g}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var g,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((g=function(x){for(var y in d)if(Object.prototype.hasOwnProperty.call(d,y)&&d[y].magic===x)return d[y];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,g,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var g=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(g),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=i(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var g,m,x,y=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<y;)g=p.readInt(2),m=p.readInt(2),x=p.readData(m),this.extraFields[g]={id:g,length:m,value:x};p.setIndex(y)},handleUTF8:function(){var p=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var m=o.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var y=o.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var g=i(p.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var g=i(p.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null}},n.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,n,s){function i(g,m,x){this.name=g,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=m,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var o=r("./stream/StreamHelper"),l=r("./stream/DataWorker"),c=r("./utf8"),u=r("./compressedObject"),d=r("./stream/GenericWorker");i.prototype={internalStream:function(g){var m=null,x="string";try{if(!g)throw new Error("No output type specified.");var y=(x=g.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!y&&(m=m.pipe(new c.Utf8EncodeWorker)),!v&&y&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(b){(m=new d("error")).error(b)}return new o(m,x,"")},async:function(g,m){return this.internalStream(g).accumulate(m)},nodeStream:function(g,m){return this.internalStream(g||"nodebuffer").toNodejsStream(m)},_compressWorker:function(g,m){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,g,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<h.length;p++)i.prototype[h[p]]=f;n.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,n,s){(function(i){var o,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,d=new c(g),h=i.document.createTextNode("");d.observe(h,{characterData:!0}),o=function(){h.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)o="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var m=i.document.createElement("script");m.onreadystatechange=function(){g(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},i.document.documentElement.appendChild(m)}:function(){setTimeout(g,0)};else{var f=new i.MessageChannel;f.port1.onmessage=g,o=function(){f.port2.postMessage(0)}}var p=[];function g(){var m,x;l=!0;for(var y=p.length;y;){for(x=p,p=[],m=-1;++m<y;)x[m]();y=p.length}l=!1}n.exports=function(m){p.push(m)!==1||l||o()}}).call(this,typeof lc<"u"?lc:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,n,s){var i=r("immediate");function o(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,y!==o&&m(this,y)}function f(y,v,b){this.promise=y,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function p(y,v,b){i(function(){var w;try{w=v(b)}catch(j){return l.reject(y,j)}w===y?l.reject(y,new TypeError("Cannot resolve promise with itself")):l.resolve(y,w)})}function g(y){var v=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof v=="function")return function(){v.apply(y,arguments)}}function m(y,v){var b=!1;function w(C){b||(b=!0,l.reject(y,C))}function j(C){b||(b=!0,l.resolve(y,C))}var N=x(function(){v(j,w)});N.status==="error"&&w(N.value)}function x(y,v){var b={};try{b.value=y(v),b.status="success"}catch(w){b.status="error",b.value=w}return b}(n.exports=h).prototype.finally=function(y){if(typeof y!="function")return this;var v=this.constructor;return this.then(function(b){return v.resolve(y()).then(function(){return b})},function(b){return v.resolve(y()).then(function(){throw b})})},h.prototype.catch=function(y){return this.then(null,y)},h.prototype.then=function(y,v){if(typeof y!="function"&&this.state===u||typeof v!="function"&&this.state===c)return this;var b=new this.constructor(o);return this.state!==d?p(b,this.state===u?y:v,this.outcome):this.queue.push(new f(b,y,v)),b},f.prototype.callFulfilled=function(y){l.resolve(this.promise,y)},f.prototype.otherCallFulfilled=function(y){p(this.promise,this.onFulfilled,y)},f.prototype.callRejected=function(y){l.reject(this.promise,y)},f.prototype.otherCallRejected=function(y){p(this.promise,this.onRejected,y)},l.resolve=function(y,v){var b=x(g,v);if(b.status==="error")return l.reject(y,b.value);var w=b.value;if(w)m(y,w);else{y.state=u,y.outcome=v;for(var j=-1,N=y.queue.length;++j<N;)y.queue[j].callFulfilled(v)}return y},l.reject=function(y,v){y.state=c,y.outcome=v;for(var b=-1,w=y.queue.length;++b<w;)y.queue[b].callRejected(v);return y},h.resolve=function(y){return y instanceof this?y:l.resolve(new this(o),y)},h.reject=function(y){var v=new this(o);return l.reject(v,y)},h.all=function(y){var v=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=y.length,w=!1;if(!b)return this.resolve([]);for(var j=new Array(b),N=0,C=-1,k=new this(o);++C<b;)E(y[C],C);return k;function E(M,z){v.resolve(M).then(function(P){j[z]=P,++N!==b||w||(w=!0,l.resolve(k,j))},function(P){w||(w=!0,l.reject(k,P))})}},h.race=function(y){var v=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=y.length,w=!1;if(!b)return this.resolve([]);for(var j=-1,N=new this(o);++j<b;)C=y[j],v.resolve(C).then(function(k){w||(w=!0,l.resolve(N,k))},function(k){w||(w=!0,l.reject(N,k))});var C;return N}},{immediate:36}],38:[function(r,n,s){var i={};(0,r("./lib/utils/common").assign)(i,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),n.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,n,s){var i=r("./zlib/deflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/messages"),u=r("./zlib/zstream"),d=Object.prototype.toString,h=0,f=-1,p=0,g=8;function m(y){if(!(this instanceof m))return new m(y);this.options=o.assign({level:f,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},y||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=i.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(b!==h)throw new Error(c[b]);if(v.header&&i.deflateSetHeader(this.strm,v.header),v.dictionary){var w;if(w=typeof v.dictionary=="string"?l.string2buf(v.dictionary):d.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(b=i.deflateSetDictionary(this.strm,w))!==h)throw new Error(c[b]);this._dict_set=!0}}function x(y,v){var b=new m(v);if(b.push(y,!0),b.err)throw b.msg||c[b.err];return b.result}m.prototype.push=function(y,v){var b,w,j=this.strm,N=this.options.chunkSize;if(this.ended)return!1;w=v===~~v?v:v===!0?4:0,typeof y=="string"?j.input=l.string2buf(y):d.call(y)==="[object ArrayBuffer]"?j.input=new Uint8Array(y):j.input=y,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new o.Buf8(N),j.next_out=0,j.avail_out=N),(b=i.deflate(j,w))!==1&&b!==h)return this.onEnd(b),!(this.ended=!0);j.avail_out!==0&&(j.avail_in!==0||w!==4&&w!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(o.shrinkBuf(j.output,j.next_out))):this.onData(o.shrinkBuf(j.output,j.next_out)))}while((0<j.avail_in||j.avail_out===0)&&b!==1);return w===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===h):w!==2||(this.onEnd(h),!(j.avail_out=0))},m.prototype.onData=function(y){this.chunks.push(y)},m.prototype.onEnd=function(y){y===h&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},s.Deflate=m,s.deflate=x,s.deflateRaw=function(y,v){return(v=v||{}).raw=!0,x(y,v)},s.gzip=function(y,v){return(v=v||{}).gzip=!0,x(y,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,n,s){var i=r("./zlib/inflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/constants"),u=r("./zlib/messages"),d=r("./zlib/zstream"),h=r("./zlib/gzheader"),f=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},m||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||m&&m.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&!(15&x.windowBits)&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=i.inflateInit2(this.strm,x.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new h,i.inflateGetHeader(this.strm,this.header)}function g(m,x){var y=new p(x);if(y.push(m,!0),y.err)throw y.msg||u[y.err];return y.result}p.prototype.push=function(m,x){var y,v,b,w,j,N,C=this.strm,k=this.options.chunkSize,E=this.options.dictionary,M=!1;if(this.ended)return!1;v=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?C.input=l.binstring2buf(m):f.call(m)==="[object ArrayBuffer]"?C.input=new Uint8Array(m):C.input=m,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new o.Buf8(k),C.next_out=0,C.avail_out=k),(y=i.inflate(C,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&E&&(N=typeof E=="string"?l.string2buf(E):f.call(E)==="[object ArrayBuffer]"?new Uint8Array(E):E,y=i.inflateSetDictionary(this.strm,N)),y===c.Z_BUF_ERROR&&M===!0&&(y=c.Z_OK,M=!1),y!==c.Z_STREAM_END&&y!==c.Z_OK)return this.onEnd(y),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&y!==c.Z_STREAM_END&&(C.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=l.utf8border(C.output,C.next_out),w=C.next_out-b,j=l.buf2string(C.output,b),C.next_out=w,C.avail_out=k-w,w&&o.arraySet(C.output,C.output,b,w,0),this.onData(j)):this.onData(o.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(M=!0)}while((0<C.avail_in||C.avail_out===0)&&y!==c.Z_STREAM_END);return y===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(y=i.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===c.Z_OK):v!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(C.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},s.Inflate=p,s.inflate=g,s.inflateRaw=function(m,x){return(x=x||{}).raw=!0,g(m,x)},s.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}return c},s.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var o={arraySet:function(c,u,d,h,f){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),f);else for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){var u,d,h,f,p,g;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(g=new Uint8Array(h),u=f=0,d=c.length;u<d;u++)p=c[u],g.set(p,f),f+=p.length;return g}},l={arraySet:function(c,u,d,h,f){for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};s.setTyped=function(c){c?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,o)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,l))},s.setTyped(i)},{}],42:[function(r,n,s){var i=r("./common"),o=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new i.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(h,f){if(f<65537&&(h.subarray&&l||!h.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(h,f));for(var p="",g=0;g<f;g++)p+=String.fromCharCode(h[g]);return p}c[254]=c[254]=1,s.string2buf=function(h){var f,p,g,m,x,y=h.length,v=0;for(m=0;m<y;m++)(64512&(p=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),m++),v+=p<128?1:p<2048?2:p<65536?3:4;for(f=new i.Buf8(v),m=x=0;x<v;m++)(64512&(p=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),m++),p<128?f[x++]=p:(p<2048?f[x++]=192|p>>>6:(p<65536?f[x++]=224|p>>>12:(f[x++]=240|p>>>18,f[x++]=128|p>>>12&63),f[x++]=128|p>>>6&63),f[x++]=128|63&p);return f},s.buf2binstring=function(h){return d(h,h.length)},s.binstring2buf=function(h){for(var f=new i.Buf8(h.length),p=0,g=f.length;p<g;p++)f[p]=h.charCodeAt(p);return f},s.buf2string=function(h,f){var p,g,m,x,y=f||h.length,v=new Array(2*y);for(p=g=0;p<y;)if((m=h[p++])<128)v[g++]=m;else if(4<(x=c[m]))v[g++]=65533,p+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&p<y;)m=m<<6|63&h[p++],x--;1<x?v[g++]=65533:m<65536?v[g++]=m:(m-=65536,v[g++]=55296|m>>10&1023,v[g++]=56320|1023&m)}return d(v,g)},s.utf8border=function(h,f){var p;for((f=f||h.length)>h.length&&(f=h.length),p=f-1;0<=p&&(192&h[p])==128;)p--;return p<0||p===0?f:p+c[h[p]]>f?p:f}},{"./common":41}],43:[function(r,n,s){n.exports=function(i,o,l,c){for(var u=65535&i|0,d=i>>>16&65535|0,h=0;l!==0;){for(l-=h=2e3<l?2e3:l;d=d+(u=u+o[c++]|0)|0,--h;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(r,n,s){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,n,s){var i=function(){for(var o,l=[],c=0;c<256;c++){o=c;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l}();n.exports=function(o,l,c,u){var d=i,h=u+c;o^=-1;for(var f=u;f<h;f++)o=o>>>8^d[255&(o^l[f])];return-1^o}},{}],46:[function(r,n,s){var i,o=r("../utils/common"),l=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),h=0,f=4,p=0,g=-2,m=-1,x=4,y=2,v=8,b=9,w=286,j=30,N=19,C=2*w+1,k=15,E=3,M=258,z=M+E+1,P=42,V=113,A=1,$=2,K=3,G=4;function Y(O,ie){return O.msg=d[ie],ie}function H(O){return(O<<1)-(4<O?9:0)}function B(O){for(var ie=O.length;0<=--ie;)O[ie]=0}function L(O){var ie=O.state,q=ie.pending;q>O.avail_out&&(q=O.avail_out),q!==0&&(o.arraySet(O.output,ie.pending_buf,ie.pending_out,q,O.next_out),O.next_out+=q,ie.pending_out+=q,O.total_out+=q,O.avail_out-=q,ie.pending-=q,ie.pending===0&&(ie.pending_out=0))}function F(O,ie){l._tr_flush_block(O,0<=O.block_start?O.block_start:-1,O.strstart-O.block_start,ie),O.block_start=O.strstart,L(O.strm)}function W(O,ie){O.pending_buf[O.pending++]=ie}function X(O,ie){O.pending_buf[O.pending++]=ie>>>8&255,O.pending_buf[O.pending++]=255&ie}function oe(O,ie){var q,I,T=O.max_chain_length,D=O.strstart,ne=O.prev_length,ue=O.nice_match,re=O.strstart>O.w_size-z?O.strstart-(O.w_size-z):0,pe=O.window,ve=O.w_mask,xe=O.prev,ae=O.strstart+M,de=pe[D+ne-1],ge=pe[D+ne];O.prev_length>=O.good_match&&(T>>=2),ue>O.lookahead&&(ue=O.lookahead);do if(pe[(q=ie)+ne]===ge&&pe[q+ne-1]===de&&pe[q]===pe[D]&&pe[++q]===pe[D+1]){D+=2,q++;do;while(pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&pe[++D]===pe[++q]&&D<ae);if(I=M-(ae-D),D=ae-M,ne<I){if(O.match_start=ie,ue<=(ne=I))break;de=pe[D+ne-1],ge=pe[D+ne]}}while((ie=xe[ie&ve])>re&&--T!=0);return ne<=O.lookahead?ne:O.lookahead}function le(O){var ie,q,I,T,D,ne,ue,re,pe,ve,xe=O.w_size;do{if(T=O.window_size-O.lookahead-O.strstart,O.strstart>=xe+(xe-z)){for(o.arraySet(O.window,O.window,xe,xe,0),O.match_start-=xe,O.strstart-=xe,O.block_start-=xe,ie=q=O.hash_size;I=O.head[--ie],O.head[ie]=xe<=I?I-xe:0,--q;);for(ie=q=xe;I=O.prev[--ie],O.prev[ie]=xe<=I?I-xe:0,--q;);T+=xe}if(O.strm.avail_in===0)break;if(ne=O.strm,ue=O.window,re=O.strstart+O.lookahead,pe=T,ve=void 0,ve=ne.avail_in,pe<ve&&(ve=pe),q=ve===0?0:(ne.avail_in-=ve,o.arraySet(ue,ne.input,ne.next_in,ve,re),ne.state.wrap===1?ne.adler=c(ne.adler,ue,ve,re):ne.state.wrap===2&&(ne.adler=u(ne.adler,ue,ve,re)),ne.next_in+=ve,ne.total_in+=ve,ve),O.lookahead+=q,O.lookahead+O.insert>=E)for(D=O.strstart-O.insert,O.ins_h=O.window[D],O.ins_h=(O.ins_h<<O.hash_shift^O.window[D+1])&O.hash_mask;O.insert&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[D+E-1])&O.hash_mask,O.prev[D&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=D,D++,O.insert--,!(O.lookahead+O.insert<E)););}while(O.lookahead<z&&O.strm.avail_in!==0)}function U(O,ie){for(var q,I;;){if(O.lookahead<z){if(le(O),O.lookahead<z&&ie===h)return A;if(O.lookahead===0)break}if(q=0,O.lookahead>=E&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,q=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),q!==0&&O.strstart-q<=O.w_size-z&&(O.match_length=oe(O,q)),O.match_length>=E)if(I=l._tr_tally(O,O.strstart-O.match_start,O.match_length-E),O.lookahead-=O.match_length,O.match_length<=O.max_lazy_match&&O.lookahead>=E){for(O.match_length--;O.strstart++,O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,q=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart,--O.match_length!=0;);O.strstart++}else O.strstart+=O.match_length,O.match_length=0,O.ins_h=O.window[O.strstart],O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+1])&O.hash_mask;else I=l._tr_tally(O,0,O.window[O.strstart]),O.lookahead--,O.strstart++;if(I&&(F(O,!1),O.strm.avail_out===0))return A}return O.insert=O.strstart<E-1?O.strstart:E-1,ie===f?(F(O,!0),O.strm.avail_out===0?K:G):O.last_lit&&(F(O,!1),O.strm.avail_out===0)?A:$}function R(O,ie){for(var q,I,T;;){if(O.lookahead<z){if(le(O),O.lookahead<z&&ie===h)return A;if(O.lookahead===0)break}if(q=0,O.lookahead>=E&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,q=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),O.prev_length=O.match_length,O.prev_match=O.match_start,O.match_length=E-1,q!==0&&O.prev_length<O.max_lazy_match&&O.strstart-q<=O.w_size-z&&(O.match_length=oe(O,q),O.match_length<=5&&(O.strategy===1||O.match_length===E&&4096<O.strstart-O.match_start)&&(O.match_length=E-1)),O.prev_length>=E&&O.match_length<=O.prev_length){for(T=O.strstart+O.lookahead-E,I=l._tr_tally(O,O.strstart-1-O.prev_match,O.prev_length-E),O.lookahead-=O.prev_length-1,O.prev_length-=2;++O.strstart<=T&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,q=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),--O.prev_length!=0;);if(O.match_available=0,O.match_length=E-1,O.strstart++,I&&(F(O,!1),O.strm.avail_out===0))return A}else if(O.match_available){if((I=l._tr_tally(O,0,O.window[O.strstart-1]))&&F(O,!1),O.strstart++,O.lookahead--,O.strm.avail_out===0)return A}else O.match_available=1,O.strstart++,O.lookahead--}return O.match_available&&(I=l._tr_tally(O,0,O.window[O.strstart-1]),O.match_available=0),O.insert=O.strstart<E-1?O.strstart:E-1,ie===f?(F(O,!0),O.strm.avail_out===0?K:G):O.last_lit&&(F(O,!1),O.strm.avail_out===0)?A:$}function ee(O,ie,q,I,T){this.good_length=O,this.max_lazy=ie,this.nice_length=q,this.max_chain=I,this.func=T}function te(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*C),this.dyn_dtree=new o.Buf16(2*(2*j+1)),this.bl_tree=new o.Buf16(2*(2*N+1)),B(this.dyn_ltree),B(this.dyn_dtree),B(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(k+1),this.heap=new o.Buf16(2*w+1),B(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*w+1),B(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Z(O){var ie;return O&&O.state?(O.total_in=O.total_out=0,O.data_type=y,(ie=O.state).pending=0,ie.pending_out=0,ie.wrap<0&&(ie.wrap=-ie.wrap),ie.status=ie.wrap?P:V,O.adler=ie.wrap===2?0:1,ie.last_flush=h,l._tr_init(ie),p):Y(O,g)}function J(O){var ie=Z(O);return ie===p&&function(q){q.window_size=2*q.w_size,B(q.head),q.max_lazy_match=i[q.level].max_lazy,q.good_match=i[q.level].good_length,q.nice_match=i[q.level].nice_length,q.max_chain_length=i[q.level].max_chain,q.strstart=0,q.block_start=0,q.lookahead=0,q.insert=0,q.match_length=q.prev_length=E-1,q.match_available=0,q.ins_h=0}(O.state),ie}function he(O,ie,q,I,T,D){if(!O)return g;var ne=1;if(ie===m&&(ie=6),I<0?(ne=0,I=-I):15<I&&(ne=2,I-=16),T<1||b<T||q!==v||I<8||15<I||ie<0||9<ie||D<0||x<D)return Y(O,g);I===8&&(I=9);var ue=new te;return(O.state=ue).strm=O,ue.wrap=ne,ue.gzhead=null,ue.w_bits=I,ue.w_size=1<<ue.w_bits,ue.w_mask=ue.w_size-1,ue.hash_bits=T+7,ue.hash_size=1<<ue.hash_bits,ue.hash_mask=ue.hash_size-1,ue.hash_shift=~~((ue.hash_bits+E-1)/E),ue.window=new o.Buf8(2*ue.w_size),ue.head=new o.Buf16(ue.hash_size),ue.prev=new o.Buf16(ue.w_size),ue.lit_bufsize=1<<T+6,ue.pending_buf_size=4*ue.lit_bufsize,ue.pending_buf=new o.Buf8(ue.pending_buf_size),ue.d_buf=1*ue.lit_bufsize,ue.l_buf=3*ue.lit_bufsize,ue.level=ie,ue.strategy=D,ue.method=q,J(O)}i=[new ee(0,0,0,0,function(O,ie){var q=65535;for(q>O.pending_buf_size-5&&(q=O.pending_buf_size-5);;){if(O.lookahead<=1){if(le(O),O.lookahead===0&&ie===h)return A;if(O.lookahead===0)break}O.strstart+=O.lookahead,O.lookahead=0;var I=O.block_start+q;if((O.strstart===0||O.strstart>=I)&&(O.lookahead=O.strstart-I,O.strstart=I,F(O,!1),O.strm.avail_out===0)||O.strstart-O.block_start>=O.w_size-z&&(F(O,!1),O.strm.avail_out===0))return A}return O.insert=0,ie===f?(F(O,!0),O.strm.avail_out===0?K:G):(O.strstart>O.block_start&&(F(O,!1),O.strm.avail_out),A)}),new ee(4,4,8,4,U),new ee(4,5,16,8,U),new ee(4,6,32,32,U),new ee(4,4,16,16,R),new ee(8,16,32,32,R),new ee(8,16,128,128,R),new ee(8,32,128,256,R),new ee(32,128,258,1024,R),new ee(32,258,258,4096,R)],s.deflateInit=function(O,ie){return he(O,ie,v,15,8,0)},s.deflateInit2=he,s.deflateReset=J,s.deflateResetKeep=Z,s.deflateSetHeader=function(O,ie){return O&&O.state?O.state.wrap!==2?g:(O.state.gzhead=ie,p):g},s.deflate=function(O,ie){var q,I,T,D;if(!O||!O.state||5<ie||ie<0)return O?Y(O,g):g;if(I=O.state,!O.output||!O.input&&O.avail_in!==0||I.status===666&&ie!==f)return Y(O,O.avail_out===0?-5:g);if(I.strm=O,q=I.last_flush,I.last_flush=ie,I.status===P)if(I.wrap===2)O.adler=0,W(I,31),W(I,139),W(I,8),I.gzhead?(W(I,(I.gzhead.text?1:0)+(I.gzhead.hcrc?2:0)+(I.gzhead.extra?4:0)+(I.gzhead.name?8:0)+(I.gzhead.comment?16:0)),W(I,255&I.gzhead.time),W(I,I.gzhead.time>>8&255),W(I,I.gzhead.time>>16&255),W(I,I.gzhead.time>>24&255),W(I,I.level===9?2:2<=I.strategy||I.level<2?4:0),W(I,255&I.gzhead.os),I.gzhead.extra&&I.gzhead.extra.length&&(W(I,255&I.gzhead.extra.length),W(I,I.gzhead.extra.length>>8&255)),I.gzhead.hcrc&&(O.adler=u(O.adler,I.pending_buf,I.pending,0)),I.gzindex=0,I.status=69):(W(I,0),W(I,0),W(I,0),W(I,0),W(I,0),W(I,I.level===9?2:2<=I.strategy||I.level<2?4:0),W(I,3),I.status=V);else{var ne=v+(I.w_bits-8<<4)<<8;ne|=(2<=I.strategy||I.level<2?0:I.level<6?1:I.level===6?2:3)<<6,I.strstart!==0&&(ne|=32),ne+=31-ne%31,I.status=V,X(I,ne),I.strstart!==0&&(X(I,O.adler>>>16),X(I,65535&O.adler)),O.adler=1}if(I.status===69)if(I.gzhead.extra){for(T=I.pending;I.gzindex<(65535&I.gzhead.extra.length)&&(I.pending!==I.pending_buf_size||(I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),L(O),T=I.pending,I.pending!==I.pending_buf_size));)W(I,255&I.gzhead.extra[I.gzindex]),I.gzindex++;I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),I.gzindex===I.gzhead.extra.length&&(I.gzindex=0,I.status=73)}else I.status=73;if(I.status===73)if(I.gzhead.name){T=I.pending;do{if(I.pending===I.pending_buf_size&&(I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),L(O),T=I.pending,I.pending===I.pending_buf_size)){D=1;break}D=I.gzindex<I.gzhead.name.length?255&I.gzhead.name.charCodeAt(I.gzindex++):0,W(I,D)}while(D!==0);I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),D===0&&(I.gzindex=0,I.status=91)}else I.status=91;if(I.status===91)if(I.gzhead.comment){T=I.pending;do{if(I.pending===I.pending_buf_size&&(I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),L(O),T=I.pending,I.pending===I.pending_buf_size)){D=1;break}D=I.gzindex<I.gzhead.comment.length?255&I.gzhead.comment.charCodeAt(I.gzindex++):0,W(I,D)}while(D!==0);I.gzhead.hcrc&&I.pending>T&&(O.adler=u(O.adler,I.pending_buf,I.pending-T,T)),D===0&&(I.status=103)}else I.status=103;if(I.status===103&&(I.gzhead.hcrc?(I.pending+2>I.pending_buf_size&&L(O),I.pending+2<=I.pending_buf_size&&(W(I,255&O.adler),W(I,O.adler>>8&255),O.adler=0,I.status=V)):I.status=V),I.pending!==0){if(L(O),O.avail_out===0)return I.last_flush=-1,p}else if(O.avail_in===0&&H(ie)<=H(q)&&ie!==f)return Y(O,-5);if(I.status===666&&O.avail_in!==0)return Y(O,-5);if(O.avail_in!==0||I.lookahead!==0||ie!==h&&I.status!==666){var ue=I.strategy===2?function(re,pe){for(var ve;;){if(re.lookahead===0&&(le(re),re.lookahead===0)){if(pe===h)return A;break}if(re.match_length=0,ve=l._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++,ve&&(F(re,!1),re.strm.avail_out===0))return A}return re.insert=0,pe===f?(F(re,!0),re.strm.avail_out===0?K:G):re.last_lit&&(F(re,!1),re.strm.avail_out===0)?A:$}(I,ie):I.strategy===3?function(re,pe){for(var ve,xe,ae,de,ge=re.window;;){if(re.lookahead<=M){if(le(re),re.lookahead<=M&&pe===h)return A;if(re.lookahead===0)break}if(re.match_length=0,re.lookahead>=E&&0<re.strstart&&(xe=ge[ae=re.strstart-1])===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]){de=re.strstart+M;do;while(xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&xe===ge[++ae]&&ae<de);re.match_length=M-(de-ae),re.match_length>re.lookahead&&(re.match_length=re.lookahead)}if(re.match_length>=E?(ve=l._tr_tally(re,1,re.match_length-E),re.lookahead-=re.match_length,re.strstart+=re.match_length,re.match_length=0):(ve=l._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++),ve&&(F(re,!1),re.strm.avail_out===0))return A}return re.insert=0,pe===f?(F(re,!0),re.strm.avail_out===0?K:G):re.last_lit&&(F(re,!1),re.strm.avail_out===0)?A:$}(I,ie):i[I.level].func(I,ie);if(ue!==K&&ue!==G||(I.status=666),ue===A||ue===K)return O.avail_out===0&&(I.last_flush=-1),p;if(ue===$&&(ie===1?l._tr_align(I):ie!==5&&(l._tr_stored_block(I,0,0,!1),ie===3&&(B(I.head),I.lookahead===0&&(I.strstart=0,I.block_start=0,I.insert=0))),L(O),O.avail_out===0))return I.last_flush=-1,p}return ie!==f?p:I.wrap<=0?1:(I.wrap===2?(W(I,255&O.adler),W(I,O.adler>>8&255),W(I,O.adler>>16&255),W(I,O.adler>>24&255),W(I,255&O.total_in),W(I,O.total_in>>8&255),W(I,O.total_in>>16&255),W(I,O.total_in>>24&255)):(X(I,O.adler>>>16),X(I,65535&O.adler)),L(O),0<I.wrap&&(I.wrap=-I.wrap),I.pending!==0?p:1)},s.deflateEnd=function(O){var ie;return O&&O.state?(ie=O.state.status)!==P&&ie!==69&&ie!==73&&ie!==91&&ie!==103&&ie!==V&&ie!==666?Y(O,g):(O.state=null,ie===V?Y(O,-3):p):g},s.deflateSetDictionary=function(O,ie){var q,I,T,D,ne,ue,re,pe,ve=ie.length;if(!O||!O.state||(D=(q=O.state).wrap)===2||D===1&&q.status!==P||q.lookahead)return g;for(D===1&&(O.adler=c(O.adler,ie,ve,0)),q.wrap=0,ve>=q.w_size&&(D===0&&(B(q.head),q.strstart=0,q.block_start=0,q.insert=0),pe=new o.Buf8(q.w_size),o.arraySet(pe,ie,ve-q.w_size,q.w_size,0),ie=pe,ve=q.w_size),ne=O.avail_in,ue=O.next_in,re=O.input,O.avail_in=ve,O.next_in=0,O.input=ie,le(q);q.lookahead>=E;){for(I=q.strstart,T=q.lookahead-(E-1);q.ins_h=(q.ins_h<<q.hash_shift^q.window[I+E-1])&q.hash_mask,q.prev[I&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=I,I++,--T;);q.strstart=I,q.lookahead=E-1,le(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=E-1,q.match_available=0,O.next_in=ue,O.input=re,O.avail_in=ne,q.wrap=D,p},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,n,s){n.exports=function(){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}},{}],48:[function(r,n,s){n.exports=function(i,o){var l,c,u,d,h,f,p,g,m,x,y,v,b,w,j,N,C,k,E,M,z,P,V,A,$;l=i.state,c=i.next_in,A=i.input,u=c+(i.avail_in-5),d=i.next_out,$=i.output,h=d-(o-i.avail_out),f=d+(i.avail_out-257),p=l.dmax,g=l.wsize,m=l.whave,x=l.wnext,y=l.window,v=l.hold,b=l.bits,w=l.lencode,j=l.distcode,N=(1<<l.lenbits)-1,C=(1<<l.distbits)-1;e:do{b<15&&(v+=A[c++]<<b,b+=8,v+=A[c++]<<b,b+=8),k=w[v&N];t:for(;;){if(v>>>=E=k>>>24,b-=E,(E=k>>>16&255)===0)$[d++]=65535&k;else{if(!(16&E)){if(!(64&E)){k=w[(65535&k)+(v&(1<<E)-1)];continue t}if(32&E){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}M=65535&k,(E&=15)&&(b<E&&(v+=A[c++]<<b,b+=8),M+=v&(1<<E)-1,v>>>=E,b-=E),b<15&&(v+=A[c++]<<b,b+=8,v+=A[c++]<<b,b+=8),k=j[v&C];r:for(;;){if(v>>>=E=k>>>24,b-=E,!(16&(E=k>>>16&255))){if(!(64&E)){k=j[(65535&k)+(v&(1<<E)-1)];continue r}i.msg="invalid distance code",l.mode=30;break e}if(z=65535&k,b<(E&=15)&&(v+=A[c++]<<b,(b+=8)<E&&(v+=A[c++]<<b,b+=8)),p<(z+=v&(1<<E)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(v>>>=E,b-=E,(E=d-h)<z){if(m<(E=z-E)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(V=y,(P=0)===x){if(P+=g-E,E<M){for(M-=E;$[d++]=y[P++],--E;);P=d-z,V=$}}else if(x<E){if(P+=g+x-E,(E-=x)<M){for(M-=E;$[d++]=y[P++],--E;);if(P=0,x<M){for(M-=E=x;$[d++]=y[P++],--E;);P=d-z,V=$}}}else if(P+=x-E,E<M){for(M-=E;$[d++]=y[P++],--E;);P=d-z,V=$}for(;2<M;)$[d++]=V[P++],$[d++]=V[P++],$[d++]=V[P++],M-=3;M&&($[d++]=V[P++],1<M&&($[d++]=V[P++]))}else{for(P=d-z;$[d++]=$[P++],$[d++]=$[P++],$[d++]=$[P++],2<(M-=3););M&&($[d++]=$[P++],1<M&&($[d++]=$[P++]))}break}}break}}while(c<u&&d<f);c-=M=b>>3,v&=(1<<(b-=M<<3))-1,i.next_in=c,i.next_out=d,i.avail_in=c<u?u-c+5:5-(c-u),i.avail_out=d<f?f-d+257:257-(d-f),l.hold=v,l.bits=b}},{}],49:[function(r,n,s){var i=r("../utils/common"),o=r("./adler32"),l=r("./crc32"),c=r("./inffast"),u=r("./inftrees"),d=1,h=2,f=0,p=-2,g=1,m=852,x=592;function y(P){return(P>>>24&255)+(P>>>8&65280)+((65280&P)<<8)+((255&P)<<24)}function v(){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 i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(P){var V;return P&&P.state?(V=P.state,P.total_in=P.total_out=V.total=0,P.msg="",V.wrap&&(P.adler=1&V.wrap),V.mode=g,V.last=0,V.havedict=0,V.dmax=32768,V.head=null,V.hold=0,V.bits=0,V.lencode=V.lendyn=new i.Buf32(m),V.distcode=V.distdyn=new i.Buf32(x),V.sane=1,V.back=-1,f):p}function w(P){var V;return P&&P.state?((V=P.state).wsize=0,V.whave=0,V.wnext=0,b(P)):p}function j(P,V){var A,$;return P&&P.state?($=P.state,V<0?(A=0,V=-V):(A=1+(V>>4),V<48&&(V&=15)),V&&(V<8||15<V)?p:($.window!==null&&$.wbits!==V&&($.window=null),$.wrap=A,$.wbits=V,w(P))):p}function N(P,V){var A,$;return P?($=new v,(P.state=$).window=null,(A=j(P,V))!==f&&(P.state=null),A):p}var C,k,E=!0;function M(P){if(E){var V;for(C=new i.Buf32(512),k=new i.Buf32(32),V=0;V<144;)P.lens[V++]=8;for(;V<256;)P.lens[V++]=9;for(;V<280;)P.lens[V++]=7;for(;V<288;)P.lens[V++]=8;for(u(d,P.lens,0,288,C,0,P.work,{bits:9}),V=0;V<32;)P.lens[V++]=5;u(h,P.lens,0,32,k,0,P.work,{bits:5}),E=!1}P.lencode=C,P.lenbits=9,P.distcode=k,P.distbits=5}function z(P,V,A,$){var K,G=P.state;return G.window===null&&(G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new i.Buf8(G.wsize)),$>=G.wsize?(i.arraySet(G.window,V,A-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):($<(K=G.wsize-G.wnext)&&(K=$),i.arraySet(G.window,V,A-$,K,G.wnext),($-=K)?(i.arraySet(G.window,V,A-$,$,0),G.wnext=$,G.whave=G.wsize):(G.wnext+=K,G.wnext===G.wsize&&(G.wnext=0),G.whave<G.wsize&&(G.whave+=K))),0}s.inflateReset=w,s.inflateReset2=j,s.inflateResetKeep=b,s.inflateInit=function(P){return N(P,15)},s.inflateInit2=N,s.inflate=function(P,V){var A,$,K,G,Y,H,B,L,F,W,X,oe,le,U,R,ee,te,Z,J,he,O,ie,q,I,T=0,D=new i.Buf8(4),ne=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!P||!P.state||!P.output||!P.input&&P.avail_in!==0)return p;(A=P.state).mode===12&&(A.mode=13),Y=P.next_out,K=P.output,B=P.avail_out,G=P.next_in,$=P.input,H=P.avail_in,L=A.hold,F=A.bits,W=H,X=B,ie=f;e:for(;;)switch(A.mode){case g:if(A.wrap===0){A.mode=13;break}for(;F<16;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(2&A.wrap&&L===35615){D[A.check=0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0),F=L=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&L)<<8)+(L>>8))%31){P.msg="incorrect header check",A.mode=30;break}if((15&L)!=8){P.msg="unknown compression method",A.mode=30;break}if(F-=4,O=8+(15&(L>>>=4)),A.wbits===0)A.wbits=O;else if(O>A.wbits){P.msg="invalid window size",A.mode=30;break}A.dmax=1<<O,P.adler=A.check=1,A.mode=512&L?10:12,F=L=0;break;case 2:for(;F<16;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(A.flags=L,(255&A.flags)!=8){P.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){P.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=L>>8&1),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0,A.mode=3;case 3:for(;F<32;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.head&&(A.head.time=L),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,D[2]=L>>>16&255,D[3]=L>>>24&255,A.check=l(A.check,D,4,0)),F=L=0,A.mode=4;case 4:for(;F<16;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.head&&(A.head.xflags=255&L,A.head.os=L>>8),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0,A.mode=5;case 5:if(1024&A.flags){for(;F<16;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.length=L,A.head&&(A.head.extra_len=L),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(H<(oe=A.length)&&(oe=H),oe&&(A.head&&(O=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),i.arraySet(A.head.extra,$,G,oe,O)),512&A.flags&&(A.check=l(A.check,$,oe,G)),H-=oe,G+=oe,A.length-=oe),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(H===0)break e;for(oe=0;O=$[G+oe++],A.head&&O&&A.length<65536&&(A.head.name+=String.fromCharCode(O)),O&&oe<H;);if(512&A.flags&&(A.check=l(A.check,$,oe,G)),H-=oe,G+=oe,O)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if(H===0)break e;for(oe=0;O=$[G+oe++],A.head&&O&&A.length<65536&&(A.head.comment+=String.fromCharCode(O)),O&&oe<H;);if(512&A.flags&&(A.check=l(A.check,$,oe,G)),H-=oe,G+=oe,O)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;F<16;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(L!==(65535&A.check)){P.msg="header crc mismatch",A.mode=30;break}F=L=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),P.adler=A.check=0,A.mode=12;break;case 10:for(;F<32;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}P.adler=A.check=y(L),F=L=0,A.mode=11;case 11:if(A.havedict===0)return P.next_out=Y,P.avail_out=B,P.next_in=G,P.avail_in=H,A.hold=L,A.bits=F,2;P.adler=A.check=1,A.mode=12;case 12:if(V===5||V===6)break e;case 13:if(A.last){L>>>=7&F,F-=7&F,A.mode=27;break}for(;F<3;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}switch(A.last=1&L,F-=1,3&(L>>>=1)){case 0:A.mode=14;break;case 1:if(M(A),A.mode=20,V!==6)break;L>>>=2,F-=2;break e;case 2:A.mode=17;break;case 3:P.msg="invalid block type",A.mode=30}L>>>=2,F-=2;break;case 14:for(L>>>=7&F,F-=7&F;F<32;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if((65535&L)!=(L>>>16^65535)){P.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&L,F=L=0,A.mode=15,V===6)break e;case 15:A.mode=16;case 16:if(oe=A.length){if(H<oe&&(oe=H),B<oe&&(oe=B),oe===0)break e;i.arraySet(K,$,G,oe,Y),H-=oe,G+=oe,B-=oe,Y+=oe,A.length-=oe;break}A.mode=12;break;case 17:for(;F<14;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(A.nlen=257+(31&L),L>>>=5,F-=5,A.ndist=1+(31&L),L>>>=5,F-=5,A.ncode=4+(15&L),L>>>=4,F-=4,286<A.nlen||30<A.ndist){P.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;F<3;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.lens[ne[A.have++]]=7&L,L>>>=3,F-=3}for(;A.have<19;)A.lens[ne[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,q={bits:A.lenbits},ie=u(0,A.lens,0,19,A.lencode,0,A.work,q),A.lenbits=q.bits,ie){P.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;ee=(T=A.lencode[L&(1<<A.lenbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(te<16)L>>>=R,F-=R,A.lens[A.have++]=te;else{if(te===16){for(I=R+2;F<I;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(L>>>=R,F-=R,A.have===0){P.msg="invalid bit length repeat",A.mode=30;break}O=A.lens[A.have-1],oe=3+(3&L),L>>>=2,F-=2}else if(te===17){for(I=R+3;F<I;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}F-=R,O=0,oe=3+(7&(L>>>=R)),L>>>=3,F-=3}else{for(I=R+7;F<I;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}F-=R,O=0,oe=11+(127&(L>>>=R)),L>>>=7,F-=7}if(A.have+oe>A.nlen+A.ndist){P.msg="invalid bit length repeat",A.mode=30;break}for(;oe--;)A.lens[A.have++]=O}}if(A.mode===30)break;if(A.lens[256]===0){P.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,q={bits:A.lenbits},ie=u(d,A.lens,0,A.nlen,A.lencode,0,A.work,q),A.lenbits=q.bits,ie){P.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,q={bits:A.distbits},ie=u(h,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,q),A.distbits=q.bits,ie){P.msg="invalid distances set",A.mode=30;break}if(A.mode=20,V===6)break e;case 20:A.mode=21;case 21:if(6<=H&&258<=B){P.next_out=Y,P.avail_out=B,P.next_in=G,P.avail_in=H,A.hold=L,A.bits=F,c(P,X),Y=P.next_out,K=P.output,B=P.avail_out,G=P.next_in,$=P.input,H=P.avail_in,L=A.hold,F=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;ee=(T=A.lencode[L&(1<<A.lenbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(ee&&!(240&ee)){for(Z=R,J=ee,he=te;ee=(T=A.lencode[he+((L&(1<<Z+J)-1)>>Z)])>>>16&255,te=65535&T,!(Z+(R=T>>>24)<=F);){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}L>>>=Z,F-=Z,A.back+=Z}if(L>>>=R,F-=R,A.back+=R,A.length=te,ee===0){A.mode=26;break}if(32&ee){A.back=-1,A.mode=12;break}if(64&ee){P.msg="invalid literal/length code",A.mode=30;break}A.extra=15&ee,A.mode=22;case 22:if(A.extra){for(I=A.extra;F<I;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.length+=L&(1<<A.extra)-1,L>>>=A.extra,F-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;ee=(T=A.distcode[L&(1<<A.distbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(!(240&ee)){for(Z=R,J=ee,he=te;ee=(T=A.distcode[he+((L&(1<<Z+J)-1)>>Z)])>>>16&255,te=65535&T,!(Z+(R=T>>>24)<=F);){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}L>>>=Z,F-=Z,A.back+=Z}if(L>>>=R,F-=R,A.back+=R,64&ee){P.msg="invalid distance code",A.mode=30;break}A.offset=te,A.extra=15&ee,A.mode=24;case 24:if(A.extra){for(I=A.extra;F<I;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}A.offset+=L&(1<<A.extra)-1,L>>>=A.extra,F-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){P.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(B===0)break e;if(oe=X-B,A.offset>oe){if((oe=A.offset-oe)>A.whave&&A.sane){P.msg="invalid distance too far back",A.mode=30;break}le=oe>A.wnext?(oe-=A.wnext,A.wsize-oe):A.wnext-oe,oe>A.length&&(oe=A.length),U=A.window}else U=K,le=Y-A.offset,oe=A.length;for(B<oe&&(oe=B),B-=oe,A.length-=oe;K[Y++]=U[le++],--oe;);A.length===0&&(A.mode=21);break;case 26:if(B===0)break e;K[Y++]=A.length,B--,A.mode=21;break;case 27:if(A.wrap){for(;F<32;){if(H===0)break e;H--,L|=$[G++]<<F,F+=8}if(X-=B,P.total_out+=X,A.total+=X,X&&(P.adler=A.check=A.flags?l(A.check,K,X,Y-X):o(A.check,K,X,Y-X)),X=B,(A.flags?L:y(L))!==A.check){P.msg="incorrect data check",A.mode=30;break}F=L=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;F<32;){if(H===0)break e;H--,L+=$[G++]<<F,F+=8}if(L!==(4294967295&A.total)){P.msg="incorrect length check",A.mode=30;break}F=L=0}A.mode=29;case 29:ie=1;break e;case 30:ie=-3;break e;case 31:return-4;case 32:default:return p}return P.next_out=Y,P.avail_out=B,P.next_in=G,P.avail_in=H,A.hold=L,A.bits=F,(A.wsize||X!==P.avail_out&&A.mode<30&&(A.mode<27||V!==4))&&z(P,P.output,P.next_out,X-P.avail_out)?(A.mode=31,-4):(W-=P.avail_in,X-=P.avail_out,P.total_in+=W,P.total_out+=X,A.total+=X,A.wrap&&X&&(P.adler=A.check=A.flags?l(A.check,K,X,P.next_out-X):o(A.check,K,X,P.next_out-X)),P.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(W==0&&X===0||V===4)&&ie===f&&(ie=-5),ie)},s.inflateEnd=function(P){if(!P||!P.state)return p;var V=P.state;return V.window&&(V.window=null),P.state=null,f},s.inflateGetHeader=function(P,V){var A;return P&&P.state&&2&(A=P.state).wrap?((A.head=V).done=!1,f):p},s.inflateSetDictionary=function(P,V){var A,$=V.length;return P&&P.state?(A=P.state).wrap!==0&&A.mode!==11?p:A.mode===11&&o(1,V,$,0)!==A.check?-3:z(P,V,$,$)?(A.mode=31,-4):(A.havedict=1,f):p},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,n,s){var i=r("../utils/common"),o=[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],l=[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],c=[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],u=[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];n.exports=function(d,h,f,p,g,m,x,y){var v,b,w,j,N,C,k,E,M,z=y.bits,P=0,V=0,A=0,$=0,K=0,G=0,Y=0,H=0,B=0,L=0,F=null,W=0,X=new i.Buf16(16),oe=new i.Buf16(16),le=null,U=0;for(P=0;P<=15;P++)X[P]=0;for(V=0;V<p;V++)X[h[f+V]]++;for(K=z,$=15;1<=$&&X[$]===0;$--);if($<K&&(K=$),$===0)return g[m++]=20971520,g[m++]=20971520,y.bits=1,0;for(A=1;A<$&&X[A]===0;A++);for(K<A&&(K=A),P=H=1;P<=15;P++)if(H<<=1,(H-=X[P])<0)return-1;if(0<H&&(d===0||$!==1))return-1;for(oe[1]=0,P=1;P<15;P++)oe[P+1]=oe[P]+X[P];for(V=0;V<p;V++)h[f+V]!==0&&(x[oe[h[f+V]]++]=V);if(C=d===0?(F=le=x,19):d===1?(F=o,W-=257,le=l,U-=257,256):(F=c,le=u,-1),P=A,N=m,Y=V=L=0,w=-1,j=(B=1<<(G=K))-1,d===1&&852<B||d===2&&592<B)return 1;for(;;){for(k=P-Y,M=x[V]<C?(E=0,x[V]):x[V]>C?(E=le[U+x[V]],F[W+x[V]]):(E=96,0),v=1<<P-Y,A=b=1<<G;g[N+(L>>Y)+(b-=v)]=k<<24|E<<16|M|0,b!==0;);for(v=1<<P-1;L&v;)v>>=1;if(v!==0?(L&=v-1,L+=v):L=0,V++,--X[P]==0){if(P===$)break;P=h[f+x[V]]}if(K<P&&(L&j)!==w){for(Y===0&&(Y=K),N+=A,H=1<<(G=P-Y);G+Y<$&&!((H-=X[G+Y])<=0);)G++,H<<=1;if(B+=1<<G,d===1&&852<B||d===2&&592<B)return 1;g[w=L&j]=K<<24|G<<16|N-m|0}}return L!==0&&(g[N+L]=P-Y<<24|64<<16|0),y.bits=K,0}},{"../utils/common":41}],51:[function(r,n,s){n.exports={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"}},{}],52:[function(r,n,s){var i=r("../utils/common"),o=0,l=1;function c(T){for(var D=T.length;0<=--D;)T[D]=0}var u=0,d=29,h=256,f=h+1+d,p=30,g=19,m=2*f+1,x=15,y=16,v=7,b=256,w=16,j=17,N=18,C=[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],k=[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],E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],z=new Array(2*(f+2));c(z);var P=new Array(2*p);c(P);var V=new Array(512);c(V);var A=new Array(256);c(A);var $=new Array(d);c($);var K,G,Y,H=new Array(p);function B(T,D,ne,ue,re){this.static_tree=T,this.extra_bits=D,this.extra_base=ne,this.elems=ue,this.max_length=re,this.has_stree=T&&T.length}function L(T,D){this.dyn_tree=T,this.max_code=0,this.stat_desc=D}function F(T){return T<256?V[T]:V[256+(T>>>7)]}function W(T,D){T.pending_buf[T.pending++]=255&D,T.pending_buf[T.pending++]=D>>>8&255}function X(T,D,ne){T.bi_valid>y-ne?(T.bi_buf|=D<<T.bi_valid&65535,W(T,T.bi_buf),T.bi_buf=D>>y-T.bi_valid,T.bi_valid+=ne-y):(T.bi_buf|=D<<T.bi_valid&65535,T.bi_valid+=ne)}function oe(T,D,ne){X(T,ne[2*D],ne[2*D+1])}function le(T,D){for(var ne=0;ne|=1&T,T>>>=1,ne<<=1,0<--D;);return ne>>>1}function U(T,D,ne){var ue,re,pe=new Array(x+1),ve=0;for(ue=1;ue<=x;ue++)pe[ue]=ve=ve+ne[ue-1]<<1;for(re=0;re<=D;re++){var xe=T[2*re+1];xe!==0&&(T[2*re]=le(pe[xe]++,xe))}}function R(T){var D;for(D=0;D<f;D++)T.dyn_ltree[2*D]=0;for(D=0;D<p;D++)T.dyn_dtree[2*D]=0;for(D=0;D<g;D++)T.bl_tree[2*D]=0;T.dyn_ltree[2*b]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function ee(T){8<T.bi_valid?W(T,T.bi_buf):0<T.bi_valid&&(T.pending_buf[T.pending++]=T.bi_buf),T.bi_buf=0,T.bi_valid=0}function te(T,D,ne,ue){var re=2*D,pe=2*ne;return T[re]<T[pe]||T[re]===T[pe]&&ue[D]<=ue[ne]}function Z(T,D,ne){for(var ue=T.heap[ne],re=ne<<1;re<=T.heap_len&&(re<T.heap_len&&te(D,T.heap[re+1],T.heap[re],T.depth)&&re++,!te(D,ue,T.heap[re],T.depth));)T.heap[ne]=T.heap[re],ne=re,re<<=1;T.heap[ne]=ue}function J(T,D,ne){var ue,re,pe,ve,xe=0;if(T.last_lit!==0)for(;ue=T.pending_buf[T.d_buf+2*xe]<<8|T.pending_buf[T.d_buf+2*xe+1],re=T.pending_buf[T.l_buf+xe],xe++,ue===0?oe(T,re,D):(oe(T,(pe=A[re])+h+1,D),(ve=C[pe])!==0&&X(T,re-=$[pe],ve),oe(T,pe=F(--ue),ne),(ve=k[pe])!==0&&X(T,ue-=H[pe],ve)),xe<T.last_lit;);oe(T,b,D)}function he(T,D){var ne,ue,re,pe=D.dyn_tree,ve=D.stat_desc.static_tree,xe=D.stat_desc.has_stree,ae=D.stat_desc.elems,de=-1;for(T.heap_len=0,T.heap_max=m,ne=0;ne<ae;ne++)pe[2*ne]!==0?(T.heap[++T.heap_len]=de=ne,T.depth[ne]=0):pe[2*ne+1]=0;for(;T.heap_len<2;)pe[2*(re=T.heap[++T.heap_len]=de<2?++de:0)]=1,T.depth[re]=0,T.opt_len--,xe&&(T.static_len-=ve[2*re+1]);for(D.max_code=de,ne=T.heap_len>>1;1<=ne;ne--)Z(T,pe,ne);for(re=ae;ne=T.heap[1],T.heap[1]=T.heap[T.heap_len--],Z(T,pe,1),ue=T.heap[1],T.heap[--T.heap_max]=ne,T.heap[--T.heap_max]=ue,pe[2*re]=pe[2*ne]+pe[2*ue],T.depth[re]=(T.depth[ne]>=T.depth[ue]?T.depth[ne]:T.depth[ue])+1,pe[2*ne+1]=pe[2*ue+1]=re,T.heap[1]=re++,Z(T,pe,1),2<=T.heap_len;);T.heap[--T.heap_max]=T.heap[1],function(ge,we){var je,Se,Ue,Ae,fe,Ee,Ce=we.dyn_tree,Ge=we.max_code,ht=we.stat_desc.static_tree,Ne=we.stat_desc.has_stree,Ze=we.stat_desc.extra_bits,Ke=we.stat_desc.extra_base,Xe=we.stat_desc.max_length,Ye=0;for(Ae=0;Ae<=x;Ae++)ge.bl_count[Ae]=0;for(Ce[2*ge.heap[ge.heap_max]+1]=0,je=ge.heap_max+1;je<m;je++)Xe<(Ae=Ce[2*Ce[2*(Se=ge.heap[je])+1]+1]+1)&&(Ae=Xe,Ye++),Ce[2*Se+1]=Ae,Ge<Se||(ge.bl_count[Ae]++,fe=0,Ke<=Se&&(fe=Ze[Se-Ke]),Ee=Ce[2*Se],ge.opt_len+=Ee*(Ae+fe),Ne&&(ge.static_len+=Ee*(ht[2*Se+1]+fe)));if(Ye!==0){do{for(Ae=Xe-1;ge.bl_count[Ae]===0;)Ae--;ge.bl_count[Ae]--,ge.bl_count[Ae+1]+=2,ge.bl_count[Xe]--,Ye-=2}while(0<Ye);for(Ae=Xe;Ae!==0;Ae--)for(Se=ge.bl_count[Ae];Se!==0;)Ge<(Ue=ge.heap[--je])||(Ce[2*Ue+1]!==Ae&&(ge.opt_len+=(Ae-Ce[2*Ue+1])*Ce[2*Ue],Ce[2*Ue+1]=Ae),Se--)}}(T,D),U(pe,de,T.bl_count)}function O(T,D,ne){var ue,re,pe=-1,ve=D[1],xe=0,ae=7,de=4;for(ve===0&&(ae=138,de=3),D[2*(ne+1)+1]=65535,ue=0;ue<=ne;ue++)re=ve,ve=D[2*(ue+1)+1],++xe<ae&&re===ve||(xe<de?T.bl_tree[2*re]+=xe:re!==0?(re!==pe&&T.bl_tree[2*re]++,T.bl_tree[2*w]++):xe<=10?T.bl_tree[2*j]++:T.bl_tree[2*N]++,pe=re,de=(xe=0)===ve?(ae=138,3):re===ve?(ae=6,3):(ae=7,4))}function ie(T,D,ne){var ue,re,pe=-1,ve=D[1],xe=0,ae=7,de=4;for(ve===0&&(ae=138,de=3),ue=0;ue<=ne;ue++)if(re=ve,ve=D[2*(ue+1)+1],!(++xe<ae&&re===ve)){if(xe<de)for(;oe(T,re,T.bl_tree),--xe!=0;);else re!==0?(re!==pe&&(oe(T,re,T.bl_tree),xe--),oe(T,w,T.bl_tree),X(T,xe-3,2)):xe<=10?(oe(T,j,T.bl_tree),X(T,xe-3,3)):(oe(T,N,T.bl_tree),X(T,xe-11,7));pe=re,de=(xe=0)===ve?(ae=138,3):re===ve?(ae=6,3):(ae=7,4)}}c(H);var q=!1;function I(T,D,ne,ue){X(T,(u<<1)+(ue?1:0),3),function(re,pe,ve,xe){ee(re),W(re,ve),W(re,~ve),i.arraySet(re.pending_buf,re.window,pe,ve,re.pending),re.pending+=ve}(T,D,ne)}s._tr_init=function(T){q||(function(){var D,ne,ue,re,pe,ve=new Array(x+1);for(re=ue=0;re<d-1;re++)for($[re]=ue,D=0;D<1<<C[re];D++)A[ue++]=re;for(A[ue-1]=re,re=pe=0;re<16;re++)for(H[re]=pe,D=0;D<1<<k[re];D++)V[pe++]=re;for(pe>>=7;re<p;re++)for(H[re]=pe<<7,D=0;D<1<<k[re]-7;D++)V[256+pe++]=re;for(ne=0;ne<=x;ne++)ve[ne]=0;for(D=0;D<=143;)z[2*D+1]=8,D++,ve[8]++;for(;D<=255;)z[2*D+1]=9,D++,ve[9]++;for(;D<=279;)z[2*D+1]=7,D++,ve[7]++;for(;D<=287;)z[2*D+1]=8,D++,ve[8]++;for(U(z,f+1,ve),D=0;D<p;D++)P[2*D+1]=5,P[2*D]=le(D,5);K=new B(z,C,h+1,f,x),G=new B(P,k,0,p,x),Y=new B(new Array(0),E,0,g,v)}(),q=!0),T.l_desc=new L(T.dyn_ltree,K),T.d_desc=new L(T.dyn_dtree,G),T.bl_desc=new L(T.bl_tree,Y),T.bi_buf=0,T.bi_valid=0,R(T)},s._tr_stored_block=I,s._tr_flush_block=function(T,D,ne,ue){var re,pe,ve=0;0<T.level?(T.strm.data_type===2&&(T.strm.data_type=function(xe){var ae,de=4093624447;for(ae=0;ae<=31;ae++,de>>>=1)if(1&de&&xe.dyn_ltree[2*ae]!==0)return o;if(xe.dyn_ltree[18]!==0||xe.dyn_ltree[20]!==0||xe.dyn_ltree[26]!==0)return l;for(ae=32;ae<h;ae++)if(xe.dyn_ltree[2*ae]!==0)return l;return o}(T)),he(T,T.l_desc),he(T,T.d_desc),ve=function(xe){var ae;for(O(xe,xe.dyn_ltree,xe.l_desc.max_code),O(xe,xe.dyn_dtree,xe.d_desc.max_code),he(xe,xe.bl_desc),ae=g-1;3<=ae&&xe.bl_tree[2*M[ae]+1]===0;ae--);return xe.opt_len+=3*(ae+1)+5+5+4,ae}(T),re=T.opt_len+3+7>>>3,(pe=T.static_len+3+7>>>3)<=re&&(re=pe)):re=pe=ne+5,ne+4<=re&&D!==-1?I(T,D,ne,ue):T.strategy===4||pe===re?(X(T,2+(ue?1:0),3),J(T,z,P)):(X(T,4+(ue?1:0),3),function(xe,ae,de,ge){var we;for(X(xe,ae-257,5),X(xe,de-1,5),X(xe,ge-4,4),we=0;we<ge;we++)X(xe,xe.bl_tree[2*M[we]+1],3);ie(xe,xe.dyn_ltree,ae-1),ie(xe,xe.dyn_dtree,de-1)}(T,T.l_desc.max_code+1,T.d_desc.max_code+1,ve+1),J(T,T.dyn_ltree,T.dyn_dtree)),R(T),ue&&ee(T)},s._tr_tally=function(T,D,ne){return T.pending_buf[T.d_buf+2*T.last_lit]=D>>>8&255,T.pending_buf[T.d_buf+2*T.last_lit+1]=255&D,T.pending_buf[T.l_buf+T.last_lit]=255&ne,T.last_lit++,D===0?T.dyn_ltree[2*ne]++:(T.matches++,D--,T.dyn_ltree[2*(A[ne]+h+1)]++,T.dyn_dtree[2*F(D)]++),T.last_lit===T.lit_bufsize-1},s._tr_align=function(T){X(T,2,3),oe(T,b,z),function(D){D.bi_valid===16?(W(D,D.bi_buf),D.bi_buf=0,D.bi_valid=0):8<=D.bi_valid&&(D.pending_buf[D.pending++]=255&D.bi_buf,D.bi_buf>>=8,D.bi_valid-=8)}(T)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){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}},{}],54:[function(r,n,s){(function(i){(function(o,l){if(!o.setImmediate){var c,u,d,h,f=1,p={},g=!1,m=o.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(o);x=x&&x.setTimeout?x:o,c={}.toString.call(o.process)==="[object process]"?function(w){$t.nextTick(function(){v(w)})}:function(){if(o.postMessage&&!o.importScripts){var w=!0,j=o.onmessage;return o.onmessage=function(){w=!1},o.postMessage("","*"),o.onmessage=j,w}}()?(h="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",b,!1):o.attachEvent("onmessage",b),function(w){o.postMessage(h+w,"*")}):o.MessageChannel?((d=new MessageChannel).port1.onmessage=function(w){v(w.data)},function(w){d.port2.postMessage(w)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(w){var j=m.createElement("script");j.onreadystatechange=function(){v(w),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(w){setTimeout(v,0,w)},x.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var j=new Array(arguments.length-1),N=0;N<j.length;N++)j[N]=arguments[N+1];var C={callback:w,args:j};return p[f]=C,c(f),f++},x.clearImmediate=y}function y(w){delete p[w]}function v(w){if(g)setTimeout(v,0,w);else{var j=p[w];if(j){g=!0;try{(function(N){var C=N.callback,k=N.args;switch(k.length){case 0:C();break;case 1:C(k[0]);break;case 2:C(k[0],k[1]);break;case 3:C(k[0],k[1],k[2]);break;default:C.apply(l,k)}})(j)}finally{y(w),g=!1}}}}function b(w){w.source===o&&typeof w.data=="string"&&w.data.indexOf(h)===0&&v(+w.data.slice(h.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof lc<"u"?lc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}(uM)),uM.exports}var Ymt=Kmt();const Xmt=cpe(Ymt);var y0={exports:{}},dM,CX;function Qmt(){if(CX)return dM;CX=1;var t={"&":"&",'"':""","'":"'","<":"<",">":">"};function e(r){return r&&r.replace?r.replace(/([&"<>'])/g,function(n,s){return t[s]}):r}return dM=e,dM}var kX;function Zmt(){if(kX)return y0.exports;kX=1;var t=Qmt(),e=wB().Stream,r=" ";function n(u,d){typeof d!="object"&&(d={indent:d});var h=d.stream?new e:null,f="",p=!1,g=d.indent?d.indent===!0?r:d.indent:"",m=!0;function x(j){m?$t.nextTick(j):j()}function y(j,N){if(N!==void 0&&(f+=N),j&&!p&&(h=h||new e,p=!0),j&&p){var C=f;x(function(){h.emit("data",C)}),f=""}}function v(j,N){l(y,o(j,g,g?1:0),N)}function b(){if(h){var j=f;x(function(){h.emit("data",j),h.emit("end"),h.readable=!1,h.emit("close")})}}function w(j){var N=j.encoding||"UTF-8",C={version:"1.0",encoding:N};j.standalone&&(C.standalone=j.standalone),v({"?xml":{_attr:C}}),f=f.replace("/>","?>")}return x(function(){m=!1}),d.declaration&&w(d.declaration),u&&u.forEach?u.forEach(function(j,N){var C;N+1===u.length&&(C=b),v(j,C)}):v(u,b),h?(h.readable=!0,h):f}function s(){var u=Array.prototype.slice.call(arguments),d={_elem:o(u)};return d.push=function(h){if(!this.append)throw new Error("not assigned to a parent!");var f=this,p=this._elem.indent;l(this.append,o(h,p,this._elem.icount+(p?1:0)),function(){f.append(!0)})},d.close=function(h){h!==void 0&&this.push(h),this.end&&this.end()},d}function i(u,d){return new Array(d||0).join(u||"")}function o(u,d,h){h=h||0;var f=i(d,h),p,g=u,m=!1;if(typeof u=="object"){var x=Object.keys(u);if(p=x[0],g=u[p],g&&g._elem)return g._elem.name=p,g._elem.icount=h,g._elem.indent=d,g._elem.indents=f,g._elem.interrupt=g,g._elem}var y=[],v=[],b;function w(j){var N=Object.keys(j);N.forEach(function(C){y.push(c(C,j[C]))})}switch(typeof g){case"object":if(g===null)break;g._attr&&w(g._attr),g._cdata&&v.push(("<![CDATA["+g._cdata).replace(/\]\]>/g,"]]]]><![CDATA[>")+"]]>"),g.forEach&&(b=!1,v.push(""),g.forEach(function(j){if(typeof j=="object"){var N=Object.keys(j)[0];N=="_attr"?w(j._attr):v.push(o(j,d,h+1))}else v.pop(),b=!0,v.push(t(j))}),b||v.push(""));break;default:v.push(t(g))}return{name:p,interrupt:m,attributes:y,content:v,icount:h,indents:f,indent:d}}function l(u,d,h){if(typeof d!="object")return u(!1,d);var f=d.interrupt?1:d.content.length;function p(){for(;d.content.length;){var m=d.content.shift();if(m!==void 0){if(g(m))return;l(u,m)}}u(!1,(f>1?d.indents:"")+(d.name?"</"+d.name+">":"")+(d.indent&&!h?`
`:"")),h&&h()}function g(m){return m.interrupt?(m.interrupt.append=u,m.interrupt.end=p,m.interrupt=!1,u(!0),!0):!1}if(u(!1,d.indents+(d.name?"<"+d.name:"")+(d.attributes.length?" "+d.attributes.join(" "):"")+(f?d.name?">":"":d.name?"/>":"")+(d.indent&&f>1?`
`:"")),!f)return u(!1,d.indent?`
`:"");g(d)||p()}function c(u,d){return u+'="'+t(d)+'"'}return y0.exports=n,y0.exports.element=y0.exports.Element=s,y0.exports}var Jmt=Zmt();const ln=cpe(Jmt),x0=0,hM=32,egt=32,tgt=(t,e)=>{const r=e.replace(/-/g,"");if(r.length!==egt)throw new Error(`Error: Cannot extract GUID from font filename: ${e}`);const s=r.replace(/(..)/g,"$1 ").trim().split(" ").map(c=>parseInt(c,16));s.reverse();const o=t.slice(x0,hM).map((c,u)=>c^s[u%s.length]),l=new Uint8Array(x0+o.length+Math.max(0,t.length-hM));return l.set(t.slice(0,x0)),l.set(o,x0),l.set(t.slice(hM),x0+o.length),l};class rgt{format(e,r={stack:[]}){const n=e.prepForXml(r);if(n)return n;throw Error("XMLComponent did not format correctly")}}class ngt{replace(e,r,n){let s=e;return r.forEach((i,o)=>{s=s.replace(new RegExp(`{${i.fileName}}`,"g"),(n+o).toString())}),s}getMediaData(e,r){return r.Array.filter(n=>e.search(`{${n.fileName}}`)>0)}}class sgt{replace(e,r){let n=e;for(const s of r)n=n.replace(new RegExp(`{${s.reference}-${s.instance}}`,"g"),s.numId.toString());return n}}class igt{constructor(){Pe(this,"formatter"),Pe(this,"imageReplacer"),Pe(this,"numberingReplacer"),this.formatter=new rgt,this.imageReplacer=new ngt,this.numberingReplacer=new sgt}compile(e,r,n=[]){const s=new Xmt,i=this.xmlifyFile(e,r),o=new Map(Object.entries(i));for(const[,l]of o)if(Array.isArray(l))for(const c of l)s.file(c.path,c.data);else s.file(l.path,l.data);for(const l of n)s.file(l.path,l.data);for(const l of e.Media.Array)l.type!=="svg"?s.file(`word/media/${l.fileName}`,l.data):(s.file(`word/media/${l.fileName}`,l.data),s.file(`word/media/${l.fallback.fileName}`,l.fallback.data));for(const{data:l,name:c,fontKey:u}of e.FontTable.fontOptionsWithKey){const[d]=c.split(".");s.file(`word/fonts/${d}.odttf`,tgt(l,u))}return s}xmlifyFile(e,r){const n=e.Document.Relationships.RelationshipCount+1,s=ln(this.formatter.format(e.Document.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),i=e.Comments.Relationships.RelationshipCount+1,o=ln(this.formatter.format(e.Comments,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),l=this.imageReplacer.getMediaData(s,e.Media),c=this.imageReplacer.getMediaData(o,e.Media);return{Relationships:{data:(l.forEach((u,d)=>{e.Document.Relationships.createRelationship(n+d,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${u.fileName}`)}),e.Document.Relationships.createRelationship(e.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),ln(this.formatter.format(e.Document.Relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}})),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{const u=this.imageReplacer.replace(s,l,n);return this.numberingReplacer.replace(u,e.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{const u=ln(this.formatter.format(e.Styles,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(u,e.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:ln(this.formatter.format(e.CoreProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},Numbering:{data:ln(this.formatter.format(e.Numbering,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},FileRelationships:{data:ln(this.formatter.format(e.FileRelationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:e.Headers.map((u,d)=>{const h=ln(this.formatter.format(u.View,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(h,e.Media).forEach((p,g)=>{u.Relationships.createRelationship(g,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${p.fileName}`)}),{data:ln(this.formatter.format(u.Relationships,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${d+1}.xml.rels`}}),FooterRelationships:e.Footers.map((u,d)=>{const h=ln(this.formatter.format(u.View,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(h,e.Media).forEach((p,g)=>{u.Relationships.createRelationship(g,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${p.fileName}`)}),{data:ln(this.formatter.format(u.Relationships,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${d+1}.xml.rels`}}),Headers:e.Headers.map((u,d)=>{const h=ln(this.formatter.format(u.View,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),f=this.imageReplacer.getMediaData(h,e.Media),p=this.imageReplacer.replace(h,f,0);return{data:this.numberingReplacer.replace(p,e.Numbering.ConcreteNumbering),path:`word/header${d+1}.xml`}}),Footers:e.Footers.map((u,d)=>{const h=ln(this.formatter.format(u.View,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),f=this.imageReplacer.getMediaData(h,e.Media),p=this.imageReplacer.replace(h,f,0);return{data:this.numberingReplacer.replace(p,e.Numbering.ConcreteNumbering),path:`word/footer${d+1}.xml`}}),ContentTypes:{data:ln(this.formatter.format(e.ContentTypes,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:ln(this.formatter.format(e.CustomProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:ln(this.formatter.format(e.AppProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:ln(this.formatter.format(e.FootNotes.View,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:"word/footnotes.xml"},FootNotesRelationships:{data:ln(this.formatter.format(e.FootNotes.Relationships,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:"word/_rels/footnotes.xml.rels"},Settings:{data:ln(this.formatter.format(e.Settings,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"},Comments:{data:(()=>{const u=this.imageReplacer.replace(o,c,i);return this.numberingReplacer.replace(u,e.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(c.forEach((u,d)=>{e.Comments.Relationships.createRelationship(i+d,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${u.fileName}`)}),ln(this.formatter.format(e.Comments.Relationships,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}})),path:"word/_rels/comments.xml.rels"},FontTable:{data:ln(this.formatter.format(e.FontTable.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:ln(this.formatter.format(e.FontTable.Relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"}}}}const agt={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:" "},TX=t=>t===!0?agt.WITH_2_BLANKS:t===!1?void 0:t,Gpe=class Xg{static pack(e,r,n){return Edt(this,arguments,function*(s,i,o,l=[]){return this.compiler.compile(s,TX(o),l).generateAsync({type:i,mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"})})}static toString(e,r,n=[]){return Xg.pack(e,"string",r,n)}static toBuffer(e,r,n=[]){return Xg.pack(e,"nodebuffer",r,n)}static toBase64String(e,r,n=[]){return Xg.pack(e,"base64",r,n)}static toBlob(e,r,n=[]){return Xg.pack(e,"blob",r,n)}static toArrayBuffer(e,r,n=[]){return Xg.pack(e,"arraybuffer",r,n)}static toStream(e,r,n=[]){const s=new Gmt.Stream;return this.compiler.compile(e,TX(r),n).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then(o=>{s.emit("data",o),s.emit("end")}),s}};Pe(Gpe,"compiler",new igt);let ogt=Gpe;function Kpe(t){if(!t)return[];const e=/\(([A-ZÀ-ÖØ-Þa-zà-öø-ÿ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+(?:\s(?:et\s+al\.|&\s+[A-ZÀ-ÖØ-Þ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+))?(?:,?\s*[A-ZÀ-ÖØ-Þ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+)*(?:\s*&\s*[A-ZÀ-ÖØ-Þ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+)?),\s*(\d{4})(?:,\s*(?:p\.|pp\.|S\.)\s*[\d–\-]+)?\)/g,r=[],n=new Set;let s;for(;(s=e.exec(t))!==null;){const o=s[1].trim(),l=parseInt(s[2]),c=`${o.toLowerCase()}|${l}`;n.has(c)||(n.add(c),r.push({authors:o,year:l,raw:s[0]}))}const i=new RegExp("(?<![(\\w])([A-ZÀ-ÖØ-Þ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+(?:\\s(?:et\\s+al\\.|&\\s+[A-ZÀ-ÖØ-Þ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+))?)\\s+\\((\\d{4})(?:,\\s*(?:p\\.|pp\\.|S\\.)\\s*[\\d\\u2013-]+\\.?)?\\)","g");for(;(s=i.exec(t))!==null;){const o=s[1].trim(),l=parseInt(s[2]),c=`${o.toLowerCase()}|${l}`;n.has(c)||(n.add(c),r.push({authors:o,year:l,raw:s[0]}))}return r}function lgt(t){return t.replace(/\s+et\s+al\.?/i,"").replace(/\s*&\s*.+$/,"").trim().split(/[\s,]/)[0].toLowerCase()}function cgt(t,e){if(!e||!Array.isArray(e)||e.length===0)return!1;const r=lgt(t);return r?e.some(n=>{var s,i,o;if(typeof n=="string"){if(((s=n.split(/,\s*/)[0])==null?void 0:s.trim().toLowerCase())===r)return!0;const u=n.trim().split(/\s+/);if(((i=u[u.length-1])==null?void 0:i.toLowerCase())===r)return!0}return typeof n=="object"&&n!==null&&((o=n.family)==null?void 0:o.toLowerCase())===r}):!1}function Ype(t,e){var s,i,o,l,c,u,d,h,f,p,g,m;const r=[],n=[];for(const x of t){let y=!1;for(const v of e){const b=v.bib_meta;if(!b)continue;const w=b.published_year||b.year||((s=b.crossref_data)==null?void 0:s.year)||((u=(c=(l=(o=(i=b.crossref_data)==null?void 0:i.crossref_metadata)==null?void 0:o.issued)==null?void 0:l["date-parts"])==null?void 0:c[0])==null?void 0:u[0])||((d=b.google_books_data)!=null&&d.publishedDate?parseInt(String(b.google_books_data.publishedDate).substring(0,4)):null);if(!w||parseInt(String(w))!==x.year)continue;const j=b.authors||((h=b.crossref_data)==null?void 0:h.authors)||((f=b.crossref_payload)==null?void 0:f.author)||((g=(p=b.crossref_data)==null?void 0:p.crossref_metadata)==null?void 0:g.author)||((m=b.google_books_data)==null?void 0:m.authors);if(cgt(x.authors,j)){r.push({citation:x,documentId:v.id,citationApa:v.citation_apa||`${x.authors} (${x.year}). ${v.title||"Untitled"}.`,title:v.title||void 0}),y=!0;break}}y||n.push(x)}return{matched:r,unmatched:n}}function Xpe(t){const e=new Set,r=[];for(const n of t.matched)e.has(n.citationApa)||(e.add(n.citationApa),r.push(n.citationApa));for(const n of t.unmatched){const s=`${n.authors} (${n.year}). [Source not found in library]`;e.has(s)||(e.add(s),r.push(s))}return r.sort((n,s)=>n.localeCompare(s))}function Qpe(t,e){const r=t.flatMap(s=>s.sections.map(i=>i.content)).join(`
`),n=Kpe(r);return Ype(n,e)}function ugt(t,e){const r=Kpe(t);return Ype(r,e)}const Zpe={intro:"Introduction",problem:"Problem Statement",goal:"Objectives",theory:"Theory",method:"Methodology",results:"Results",findings:"Findings",discussion:"Discussion",conclusion:"Conclusion",literature:"Literature Review",references:"References",other:"Other"};function Jpe(t){return t?t.replace(/^#{1,6}\s+/gm,"").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/_(.+?)_/g,"$1").replace(/`(.+?)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/\[(.+?)\]\((.+?)\)/g,"$1").replace(/!\[.*?\]\((.+?)\)/g,"").replace(/^>\s+/gm,"").replace(/^[-*_]{3,}$/gm,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\n{3,}/g,`
`).trim():""}function dgt(t,e){const r=[];if(r.push("=".repeat(60)),r.push(""),r.push(e.thesisTitle.toUpperCase()),r.push(""),r.push("=".repeat(60)),r.push(""),e.authorName&&r.push(`Author: ${e.authorName}`),e.institution&&r.push(`Institution: ${e.institution}`),e.degreeProgram&&r.push(`Degree: ${e.degreeProgram}`),e.supervisor&&r.push(`Supervisor: ${e.supervisor}`),e.submissionDate){const o=new Date(e.submissionDate).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});r.push(`Submission Date: ${o}`)}r.push(""),r.push("-".repeat(60)),r.push("");let n=0;const s=[...t.chapters].sort((o,l)=>o.order_index-l.order_index);if(s.forEach((o,l)=>{r.push(`${l+1}. ${o.title.toUpperCase()}`),r.push(""),o.sections&&o.sections.length>0?[...o.sections].sort((u,d)=>u.order_index-d.order_index).forEach((u,d)=>{const h=u.title||Zpe[u.type]||u.type;if(r.push(` ${l+1}.${d+1} ${h}`),r.push(""),u.content&&u.content.trim()){const p=Jpe(u.content).split(`
`).map(g=>` ${g}`).join(`
`);r.push(p),n+=u.word_count||0}else r.push(" [No content yet]");r.push("")}):(r.push(" [No sections yet]"),r.push("")),r.push("-".repeat(60)),r.push("")}),e.includeLiterature&&t.documents&&t.documents.length>0){const o=Qpe(t.chapters,t.documents),l=Xpe(o);if(l.length>0){const c=s.length+1;r.push(`${c}. REFERENCES`),r.push(""),l.forEach(u=>{r.push(` ${u}`),r.push("")}),r.push("-".repeat(60)),r.push("")}}const i=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"});return r.push(`Exported on: ${i}`),r.push(`Total words: ${n.toLocaleString()}`),r.join(`
`)}async function hgt(t,e){const r=[];if(r.push(new Ur({children:[],spacing:{after:2400}})),r.push(new Ur({children:[new Ws({text:e.thesisTitle,bold:!0,size:56})],alignment:Sn.CENTER,spacing:{after:400}})),e.degreeProgram&&r.push(new Ur({children:[new Ws({text:e.degreeProgram,size:28,italics:!0})],alignment:Sn.CENTER,spacing:{after:800}})),e.authorName&&(r.push(new Ur({children:[new Ws({text:"Submitted by",size:24})],alignment:Sn.CENTER,spacing:{after:100}})),r.push(new Ur({children:[new Ws({text:e.authorName,bold:!0,size:28})],alignment:Sn.CENTER,spacing:{after:400}}))),e.institution&&r.push(new Ur({children:[new Ws({text:e.institution,size:24})],alignment:Sn.CENTER,spacing:{after:200}})),e.supervisor&&r.push(new Ur({children:[new Ws({text:`Supervisor: ${e.supervisor}`,size:24})],alignment:Sn.CENTER,spacing:{after:200}})),e.submissionDate){const i=new Date(e.submissionDate).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});r.push(new Ur({children:[new Ws({text:i,size:24})],alignment:Sn.CENTER,spacing:{after:400}}))}r.push(new Ur({children:[new yX]})),e.includeTableOfContents&&(r.push(new Ur({children:[new Ws({text:"TABLE OF CONTENTS",bold:!0,size:28})],alignment:Sn.CENTER,spacing:{after:400}})),r.push(new Ur({children:[new Ws({text:"[Update this Table of Contents in Word: Right-click → Update Field]",italics:!0,size:20,color:"888888"})],alignment:Sn.CENTER,spacing:{after:200}})),r.push(new Wmt("Table of Contents",{hyperlink:!0,headingStyleRange:"1-3"})),r.push(new Ur({children:[new yX]})));const n=[...t.chapters].sort((i,o)=>i.order_index-o.order_index);if(n.forEach((i,o)=>{r.push(new Ur({text:`${o+1}. ${i.title}`,heading:iM.HEADING_1,spacing:{before:400,after:200}})),i.sections&&i.sections.length>0&&[...i.sections].sort((c,u)=>c.order_index-u.order_index).forEach((c,u)=>{const d=c.title||Zpe[c.type]||c.type;r.push(new Ur({text:`${o+1}.${u+1} ${d}`,heading:iM.HEADING_2,spacing:{before:300,after:150}})),c.content&&c.content.trim()?Jpe(c.content).split(`
`).forEach(p=>{p.trim()&&r.push(new Ur({children:[new Ws({text:p.trim(),size:24})],spacing:{after:200}}))}):r.push(new Ur({children:[new Ws({text:"[No content yet]",italics:!0,color:"888888",size:24})],spacing:{after:200}}))})}),e.includeLiterature&&t.documents&&t.documents.length>0){const i=Qpe(t.chapters,t.documents),o=Xpe(i);o.length>0&&(r.push(new Ur({text:`${n.length+1}. References`,heading:iM.HEADING_1,spacing:{before:400,after:200}})),o.forEach(l=>{r.push(new Ur({children:[new Ws({text:l,size:24})],spacing:{after:120},indent:{left:720,hanging:720}}))}))}const s=new Bmt({features:{updateFields:!0},styles:{paragraphStyles:[{id:"Heading1",name:"Heading 1",basedOn:"Normal",next:"Normal",quickFormat:!0,run:{size:32,bold:!0},paragraph:{spacing:{before:400,after:200}}},{id:"Heading2",name:"Heading 2",basedOn:"Normal",next:"Normal",quickFormat:!0,run:{size:28,bold:!0},paragraph:{spacing:{before:300,after:150}}}]},sections:[{properties:{page:{pageNumbers:e.includePageNumbers?{start:1,formatType:Bht.DECIMAL}:void 0}},headers:{default:new Vmt({children:[new Ur({alignment:Sn.LEFT,children:[new Ws({text:"Academly.ai",size:18,color:"666666",italics:!0})]})]})},footers:e.includePageNumbers?{default:new qmt({children:[new Ur({alignment:Sn.CENTER,children:[new Ws({children:["Page ",vy.CURRENT," of ",vy.TOTAL_PAGES],size:20})]})]})}:void 0,children:r}]});return await ogt.toBlob(s)}function eme(t,e){const r=URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}function fgt(t,e){const r="\uFEFF",n=new Blob([r+t],{type:"text/plain;charset=utf-8"});eme(n,e)}function pgt({open:t,onOpenChange:e,thesisData:r,defaultAuthorName:n="",defaultInstitution:s="",defaultDegreeProgram:i="",documents:o=[]}){const[l,c]=S.useState("docx"),[u,d]=S.useState(!1),[h,f]=S.useState(""),[p,g]=S.useState(""),[m,x]=S.useState(""),[y,v]=S.useState(""),[b,w]=S.useState(""),[j,N]=S.useState(""),[C,k]=S.useState(!0),[E,M]=S.useState(!0),[z,P]=S.useState(!0);S.useEffect(()=>{if(t&&r){f(r.thesis.title||""),g(n),x(s);const K=r.thesis.degree==="bachelor"?"Bachelor":"Master";v(i||`${K} Thesis`),r.thesis.due_date?N(r.thesis.due_date.split("T")[0]):N(new Date().toISOString().split("T")[0])}},[t,r,n,s,i]);const V=async()=>{if(r){d(!0);try{const K={format:l,thesisTitle:h,authorName:p||void 0,institution:m||void 0,degreeProgram:y||void 0,supervisor:b||void 0,submissionDate:j||void 0,includePageNumbers:C,includeTableOfContents:E,includeLiterature:z},G=z&&o.length>0?{...r,documents:o}:r,Y=h.replace(/[^a-zA-Z0-9äöüÄÖÜß\s-]/g,"_").trim(),H=new Date().toISOString().split("T")[0];switch(l){case"txt":{const B=dgt(G,K);fgt(B,`${Y}_${H}.txt`);break}case"docx":{const B=await hgt(G,K);eme(B,`${Y}_${H}.docx`);break}case"pdf":{console.warn("PDF export not yet implemented");break}}e(!1)}catch(K){console.error("Export error:",K)}finally{d(!1)}}},A=[{value:"txt",label:"TXT",icon:a.jsx(Nr,{className:"h-5 w-5"}),description:"Plain text, no formatting",disabled:!1},{value:"docx",label:"DOCX",icon:a.jsx(Hve,{className:"h-5 w-5"}),description:"Word document with styles",disabled:!1},{value:"pdf",label:"PDF",icon:a.jsx(dbe,{className:"h-5 w-5"}),description:"Coming soon",disabled:!0}],$=l==="docx"||l==="pdf";return a.jsx(qr,{open:t,onOpenChange:e,children:a.jsxs(Dr,{className:"sm:max-w-[500px] max-h-[90vh] overflow-y-auto",children:[a.jsxs(Lr,{children:[a.jsx(Fr,{children:"Export Thesis"}),a.jsx(gb,{children:"Choose export format and customize the template"})]}),a.jsxs("div",{className:"space-y-6 py-4",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(_e,{className:"text-sm font-medium",children:"Format"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:A.map(K=>a.jsxs("button",{type:"button",onClick:()=>!K.disabled&&c(K.value),disabled:K.disabled,className:Ie("flex flex-col items-center gap-2 p-4 rounded-lg border-2 transition-all",K.disabled&&"opacity-50 cursor-not-allowed",!K.disabled&&l===K.value?"border-primary bg-primary/5":K.disabled?"border-border":"border-border hover:border-primary/50"),children:[a.jsx("div",{className:Ie("p-2 rounded-full",!K.disabled&&l===K.value?"bg-primary text-primary-foreground":"bg-muted"),children:K.icon}),a.jsx("span",{className:"font-medium text-sm",children:K.label}),a.jsx("span",{className:"text-xs text-muted-foreground text-center",children:K.description})]},K.value))})]}),$&&a.jsxs(a.Fragment,{children:[a.jsx(Ps,{}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(_e,{className:"text-sm font-medium",children:"Template Settings"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"thesis-title",className:"text-xs text-muted-foreground",children:"Thesis Title"}),a.jsx(Fe,{id:"thesis-title",value:h,onChange:K=>f(K.target.value),placeholder:"Enter thesis title"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"author-name",className:"text-xs text-muted-foreground",children:"Author Name"}),a.jsx(Fe,{id:"author-name",value:p,onChange:K=>g(K.target.value),placeholder:"Your name"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"institution",className:"text-xs text-muted-foreground",children:"Institution"}),a.jsx(Fe,{id:"institution",value:m,onChange:K=>x(K.target.value),placeholder:"University name"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"degree-program",className:"text-xs text-muted-foreground",children:"Degree / Program"}),a.jsx(Fe,{id:"degree-program",value:y,onChange:K=>v(K.target.value),placeholder:"e.g., Master of Science"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"supervisor",className:"text-xs text-muted-foreground",children:"Supervisor"}),a.jsx(Fe,{id:"supervisor",value:b,onChange:K=>w(K.target.value),placeholder:"Prof. Dr. Name"})]})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"submission-date",className:"text-xs text-muted-foreground",children:"Submission Date"}),a.jsx(Fe,{id:"submission-date",type:"date",value:j,onChange:K=>N(K.target.value)})]})]})]}),a.jsx(Ps,{}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(_e,{className:"text-sm font-medium",children:"Layout Options"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(xo,{id:"page-numbers",checked:C,onCheckedChange:K=>k(K===!0)}),a.jsx(_e,{htmlFor:"page-numbers",className:"text-sm font-normal cursor-pointer",children:"Include page numbers"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(xo,{id:"toc",checked:E,onCheckedChange:K=>M(K===!0)}),a.jsx(_e,{htmlFor:"toc",className:"text-sm font-normal cursor-pointer",children:"Include table of contents"})]})]})]})]}),a.jsx(Ps,{}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(xo,{id:"literature",checked:z,onCheckedChange:K=>P(K===!0)}),a.jsx(_e,{htmlFor:"literature",className:"text-sm font-normal cursor-pointer",children:"Auto-generate Literature from citations"})]})]}),a.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[a.jsx(ye,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),a.jsx(ye,{onClick:V,disabled:u||!r,children:u?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"h-4 w-4 mr-2 animate-spin"}),"Exporting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(mo,{className:"h-4 w-4 mr-2"}),"Download"]})})]})]})})}var aP="Popover",[tme,pxt]=Bn(aP,[ff]),_S=ff(),[mgt,Tf]=tme(aP),rme=t=>{const{__scopePopover:e,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:o=!1}=t,l=_S(e),c=S.useRef(null),[u,d]=S.useState(!1),[h,f]=Ms({prop:n,defaultProp:s??!1,onChange:i,caller:aP});return a.jsx(cT,{...l,children:a.jsx(mgt,{scope:e,contentId:Yi(),triggerRef:c,open:h,onOpenChange:f,onOpenToggle:S.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:u,onCustomAnchorAdd:S.useCallback(()=>d(!0),[]),onCustomAnchorRemove:S.useCallback(()=>d(!1),[]),modal:o,children:r})})};rme.displayName=aP;var nme="PopoverAnchor",ggt=S.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=Tf(nme,r),i=_S(r),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return S.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx(Mj,{...i,...n,ref:e})});ggt.displayName=nme;var sme="PopoverTrigger",ime=S.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=Tf(sme,r),i=_S(r),o=Nt(e,s.triggerRef),l=a.jsx(et.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":ume(s.open),...n,ref:o,onClick:ze(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(Mj,{asChild:!0,...i,children:l})});ime.displayName=sme;var kB="PopoverPortal",[ygt,xgt]=tme(kB,{forceMount:void 0}),ame=t=>{const{__scopePopover:e,forceMount:r,children:n,container:s}=t,i=Tf(kB,e);return a.jsx(ygt,{scope:e,forceMount:r,children:a.jsx(es,{present:r||i.open,children:a.jsx(nb,{asChild:!0,container:s,children:n})})})};ame.displayName=kB;var Jv="PopoverContent",ome=S.forwardRef((t,e)=>{const r=xgt(Jv,t.__scopePopover),{forceMount:n=r.forceMount,...s}=t,i=Tf(Jv,t.__scopePopover);return a.jsx(es,{present:n||i.open,children:i.modal?a.jsx(bgt,{...s,ref:e}):a.jsx(wgt,{...s,ref:e})})});ome.displayName=Jv;var vgt=Qh("PopoverContent.RemoveScroll"),bgt=S.forwardRef((t,e)=>{const r=Tf(Jv,t.__scopePopover),n=S.useRef(null),s=Nt(e,n),i=S.useRef(!1);return S.useEffect(()=>{const o=n.current;if(o)return ST(o)},[]),a.jsx(zj,{as:vgt,allowPinchZoom:!0,children:a.jsx(lme,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ze(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ze(t.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:ze(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),wgt=S.forwardRef((t,e)=>{const r=Tf(Jv,t.__scopePopover),n=S.useRef(!1),s=S.useRef(!1);return a.jsx(lme,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),lme=S.forwardRef((t,e)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...h}=t,f=Tf(Jv,r),p=_S(r);return jT(),a.jsx(Bj,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(og,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:a.jsx(uT,{"data-state":ume(f.open),role:"dialog",id:f.contentId,...p,...h,ref:e,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),cme="PopoverClose",_gt=S.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=Tf(cme,r);return a.jsx(et.button,{type:"button",...n,ref:e,onClick:ze(t.onClick,()=>s.onOpenChange(!1))})});_gt.displayName=cme;var jgt="PopoverArrow",Sgt=S.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=_S(r);return a.jsx(dT,{...s,...n,ref:e})});Sgt.displayName=jgt;function ume(t){return t?"open":"closed"}var Ngt=rme,Agt=ime,Egt=ame,dme=ome;const Cgt=Ngt,kgt=Agt,hme=S.forwardRef(({className:t,align:e="center",sideOffset:r=4,...n},s)=>a.jsx(Egt,{children:a.jsx(dme,{ref:s,align:e,sideOffset:r,className:Ie("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));hme.displayName=dme.displayName;function Tgt({content:t,documents:e}){const r=S.useMemo(()=>!t||e.length===0?{matched:[],unmatched:[]}:ugt(t,e),[t,e]),n=r.matched.length+r.unmatched.length;if(n===0)return null;const i=r.unmatched.length===0?"bg-green-500":"bg-yellow-500";return a.jsxs(Cgt,{children:[a.jsx(kgt,{asChild:!0,children:a.jsxs("button",{type:"button",onClick:o=>o.stopPropagation(),className:"flex items-center gap-1 shrink-0",title:`${r.matched.length}/${n} citations matched`,children:[a.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full ${i}`}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.matched.length,"/",n]})]})}),a.jsx(hme,{className:"w-80 p-3",align:"start",onClick:o=>o.stopPropagation(),children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"Citations in this section"}),r.matched.length>0&&a.jsx("div",{className:"space-y-1",children:r.matched.map((o,l)=>a.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[a.jsx(yn,{className:"h-3.5 w-3.5 text-green-500 shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:o.citation.raw}),o.title&&a.jsx("p",{className:"text-muted-foreground truncate",children:o.title})]})]},l))}),r.unmatched.length>0&&a.jsx("div",{className:"space-y-1",children:r.unmatched.map((o,l)=>a.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[a.jsx(En,{className:"h-3.5 w-3.5 text-red-500 shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:o.raw}),a.jsx("p",{className:"text-muted-foreground",children:"Not found — add via Citation Manager"})]})]},l))})]})})]})}const PX={intro:"Introduction",problem:"Problem Statement",goal:"Objectives",theory:"Theory",method:"Methodology",results:"Results",findings:"Findings",discussion:"Discussion",conclusion:"Conclusion",literature:"Literature Review",references:"References",other:"Other"},OX={open:"secondary",in_progress:"warning",done:"success"},IX={open:"Open",in_progress:"In Progress",done:"Done"},Pgt=["Introduction","Literature Review","Methodology","Findings","Discussion","Conclusion","References"],Ogt=()=>{const{user:t,loading:e,researchProfile:r}=Pt(),n=gr(),{toast:s}=on(),[i,o]=S.useState([]),[l,c]=S.useState(""),[u,d]=S.useState(null),[h,f]=S.useState(0),[p,g]=S.useState([]),[m,x]=S.useState({}),[y,v]=S.useState([]),[b,w]=S.useState(!1),[j,N]=S.useState(!1),[C,k]=S.useState(!1),[E,M]=S.useState(!1),[z,P]=S.useState(!1),[V,A]=S.useState([]),[$,K]=S.useState({title:"",degree:"bachelor",description:"",due_date:"",target_word_count:15e3}),[G,Y]=S.useState({title:"",degree:"bachelor",description:"",due_date:"",target_word_count:15e3}),[H,B]=S.useState(""),[L,F]=S.useState(!1),[W,X]=S.useState(null),[oe,le]=S.useState([]);S.useEffect(()=>{!t&&!e&&n("/login")},[t,e,n]),S.useEffect(()=>{t&&(U(),R())},[t]),S.useEffect(()=>{if(l){ee();const ae=i.find(de=>de.id===l);d(ae||null),ae&&Y({title:ae.title,degree:ae.degree,description:ae.description||"",due_date:ae.due_date||"",target_word_count:ae.target_word_count||15e3})}},[l,i]);const U=async()=>{w(!0);try{const{data:ae,error:de}=await be.from("theses").select("id, title, degree, description, due_date, target_word_count, created_at").order("created_at",{ascending:!1});if(de)throw de;o(ae||[])}catch(ae){console.error("Error loading theses:",ae),s({title:"Error",description:"Failed to load theses.",variant:"destructive"})}finally{w(!1)}},R=async()=>{try{const{data:ae,error:de}=await be.from("documents").select("id, title, citation_apa, bib_meta").eq("user_id",t==null?void 0:t.id);if(de)throw de;le(ae||[])}catch(ae){console.error("Error loading documents for citation matching:",ae)}},ee=async()=>{if(l){N(!0);try{const{data:ae,error:de}=await be.from("v_thesis_progress").select("thesis_progress").eq("thesis_id",l).single();de&&de.code!=="PGRST116"?console.error("Error loading thesis progress:",de):f((ae==null?void 0:ae.thesis_progress)||0);const{data:ge,error:we}=await be.from("chapters").select("*").eq("thesis_id",l).is("parent_id",null).order("order_index",{ascending:!0}).order("created_at",{ascending:!0});if(we)throw we;const je=(ge==null?void 0:ge.map(Ae=>Ae.id))||[];if(je.length>0){const{data:Ae,error:fe}=await be.from("v_chapter_progress").select("chapter_id, computed_progress").in("chapter_id",je);fe&&console.error("Error loading chapter progress:",fe);const Ee=(ge==null?void 0:ge.map(Ce=>{var Ge;return{...Ce,computed_progress:((Ge=Ae==null?void 0:Ae.find(ht=>ht.chapter_id===Ce.id))==null?void 0:Ge.computed_progress)||0}}))||[];g(Ee)}else g([]);const{data:Se,error:Ue}=await be.from("progress_log").select("*").eq("thesis_id",l).order("timestamp",{ascending:!1}).limit(10);Ue?console.error("Error loading progress log:",Ue):v(Se||[])}catch(ae){console.error("Error loading thesis data:",ae),s({title:"Error",description:"Failed to load data.",variant:"destructive"})}finally{N(!1)}}},te=async ae=>{try{const{data:de,error:ge}=await be.from("sections").select("*").eq("chapter_id",ae).order("order_index",{ascending:!0}).order("created_at",{ascending:!0});if(ge)throw ge;x(we=>({...we,[ae]:de||[]}))}catch(de){console.error("Error loading sections:",de),s({title:"Error",description:"Failed to load sections.",variant:"destructive"})}},Z=async ae=>{const{data:de,error:ge}=await be.from("v_chapter_progress").select("chapter_id, computed_progress").eq("chapter_id",ae).single();!ge&&de&&g(we=>we.map(je=>je.id===ae?{...je,computed_progress:de.computed_progress}:je))},J=async()=>{if(!$.title.trim()){s({title:"Error",description:"Title is required.",variant:"destructive"});return}try{const{data:ae,error:de}=await be.from("theses").insert({user_id:t==null?void 0:t.id,title:$.title,degree:$.degree,description:$.description||null,due_date:$.due_date||null,target_word_count:$.target_word_count}).select("id").single();if(de)throw de;const{error:ge}=await be.rpc("seed_default_chapters",{p_thesis:ae.id});if(ge)throw ge;s({title:"Success",description:"Thesis created with default chapters."}),K({title:"",degree:"bachelor",description:"",due_date:"",target_word_count:15e3}),k(!1),await U(),c(ae.id)}catch(ae){console.error("Error creating thesis:",ae),s({title:"Error",description:ae.message||"Failed to create thesis.",variant:"destructive"})}},he=async()=>{if(!G.title.trim()){s({title:"Error",description:"Title is required.",variant:"destructive"});return}try{const{error:ae}=await be.from("theses").update({title:G.title,degree:G.degree,description:G.description||null,due_date:G.due_date||null,target_word_count:G.target_word_count}).eq("id",l);if(ae)throw ae;s({title:"Success",description:"Thesis updated successfully."}),M(!1),await U()}catch(ae){console.error("Error updating thesis:",ae),s({title:"Error",description:ae.message||"Failed to update thesis.",variant:"destructive"})}},O=async()=>{try{const{error:ae}=await be.from("theses").delete().eq("id",l);if(ae)throw ae;s({title:"Success",description:"Thesis deleted successfully."}),c(""),d(null),await U()}catch(ae){console.error("Error deleting thesis:",ae),s({title:"Error",description:ae.message||"Failed to delete thesis.",variant:"destructive"})}},ie=async(ae,de,ge)=>{if(l)try{const we=de?p.find(Ue=>Ue.id===de):null,je=ge??((we==null?void 0:we.computed_progress)||0);await be.from("progress_log").insert({thesis_id:l,chapter_id:de||null,completed:je,note:ae});const{data:Se}=await be.from("progress_log").select("*").eq("thesis_id",l).order("timestamp",{ascending:!1}).limit(10);Se&&v(Se)}catch(we){console.error("Error logging activity:",we)}},q=async ae=>{try{const de=p.length>0?Math.max(...p.map(we=>we.order_index)):0,{error:ge}=await be.from("chapters").insert({thesis_id:l,title:ae,order_index:de+10,status:"open"});if(ge)throw ge;s({title:"Success",description:"Chapter added successfully."}),await ie(`Chapter "${ae}" added`,void 0,0),B(""),P(!1),await ee()}catch(de){console.error("Error adding chapter:",de),s({title:"Error",description:de.message||"Failed to add chapter.",variant:"destructive"})}},I=async ae=>{const de=p.find(we=>we.id===ae),ge=(de==null?void 0:de.title)||"Chapter";try{const{error:we}=await be.from("chapters").delete().eq("id",ae);if(we)throw we;s({title:"Success",description:"Chapter deleted successfully."}),await ie(`Chapter "${ge}" removed`),await ee()}catch(we){console.error("Error deleting chapter:",we),s({title:"Error",description:we.message||"Failed to delete chapter.",variant:"destructive"})}},T=async(ae,de)=>{try{const{error:ge}=await be.from("chapters").update({title:de}).eq("id",ae);if(ge)throw ge;g(we=>we.map(je=>je.id===ae?{...je,title:de}:je))}catch(ge){console.error("Error updating chapter title:",ge),s({title:"Error",description:"Failed to update chapter title.",variant:"destructive"})}},D=async(ae,de="other")=>{const ge=p.find(je=>je.id===ae),we=(ge==null?void 0:ge.title)||"Chapter";try{const je=m[ae]||[],Se=je.length>0?Math.max(...je.map(Ae=>Ae.order_index)):0,{error:Ue}=await be.from("sections").insert({chapter_id:ae,type:de,status:"open",content:"",order_index:Se+1});if(Ue)throw Ue;s({title:"Success",description:"Section added."}),await te(ae),await Z(ae),await ie(`Section added to "${we}"`,ae)}catch(je){console.error("Error creating section:",je),s({title:"Error",description:"Failed to create section.",variant:"destructive"})}},ne=async(ae,de)=>{const ge=Object.values(m).flat().find(Ue=>Ue.id===ae),we=ge?p.find(Ue=>Ue.id===ge.chapter_id):null,je=(ge==null?void 0:ge.title)||PX[(ge==null?void 0:ge.type)||"other"],Se=(we==null?void 0:we.title)||"Chapter";try{const{error:Ue}=await be.from("sections").update(de).eq("id",ae);if(Ue)throw Ue;if(ge&&(await te(ge.chapter_id),await Z(ge.chapter_id),de.status&&de.status!==ge.status)){const Ae=de.status==="done"?"completed":de.status==="in_progress"?"in progress":"reopened";await ie(`"${je}" ${Ae} in "${Se}"`,ge.chapter_id)}}catch(Ue){console.error("Error updating section:",Ue),s({title:"Error",description:"Failed to update section.",variant:"destructive"})}},ue=async ae=>{const de=Object.values(m).flat().find(Se=>Se.id===ae);if(!de)return;const ge=p.find(Se=>Se.id===de.chapter_id),we=de.title||PX[de.type],je=(ge==null?void 0:ge.title)||"Chapter";try{const{error:Se}=await be.from("sections").delete().eq("id",ae);if(Se)throw Se;s({title:"Success",description:"Section deleted."}),await te(de.chapter_id),await Z(de.chapter_id),await ie(`"${we}" removed from "${je}"`,de.chapter_id)}catch(Se){console.error("Error deleting section:",Se),s({title:"Error",description:"Failed to delete section.",variant:"destructive"})}},re=ae=>ae+1,pe=(ae,de)=>`${ae+1}.${de+1}`,ve=()=>{const ae=p.map(de=>de.title.toLowerCase());return Pgt.filter(de=>!ae.includes(de.toLowerCase()))},xe=ae=>ae?ae.includes("completed")?a.jsx(gl,{className:"h-4 w-4 text-green-500"}):ae.includes("in progress")?a.jsx(sb,{className:"h-4 w-4 text-yellow-500"}):ae.includes("added")?a.jsx(Mve,{className:"h-4 w-4 text-blue-500"}):ae.includes("removed")||ae.includes("reopened")?a.jsx(Rve,{className:"h-4 w-4 text-red-500"}):a.jsx(gD,{className:"h-4 w-4 text-muted-foreground"}):a.jsx(gD,{className:"h-4 w-4 text-muted-foreground"});return e||b?a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsx(er,{showSidebar:!0,children:a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Thesis Builder"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Manage your thesis with structured chapters and sections."})]})}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Select or Create Thesis"})}),a.jsx(Be,{children:a.jsxs("div",{className:"flex gap-4 flex-wrap",children:[a.jsxs("div",{className:"flex-1 min-w-[200px]",children:[a.jsx(_e,{htmlFor:"thesis-select",children:"Existing Thesis"}),a.jsxs(at,{value:l,onValueChange:c,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select thesis..."})}),a.jsx(st,{children:i.map(ae=>a.jsxs(Te,{value:ae.id,children:[ae.title," (",ae.degree,")"]},ae.id))})]})]}),a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsxs(qr,{open:C,onOpenChange:k,children:[a.jsx(fl,{asChild:!0,children:a.jsxs(ye,{children:[a.jsx(sl,{className:"mr-2 h-4 w-4"}),"New Thesis"]})}),a.jsxs(Dr,{children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Create New Thesis"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"title",children:"Title *"}),a.jsx(Fe,{id:"title",value:$.title,onChange:ae=>K(de=>({...de,title:ae.target.value})),placeholder:"Thesis title"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"degree",children:"Degree"}),a.jsxs(at,{value:$.degree,onValueChange:ae=>K(de=>({...de,degree:ae})),children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"bachelor",children:"Bachelor"}),a.jsx(Te,{value:"master",children:"Master"})]})]})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"description",children:"Description (optional)"}),a.jsx(Ht,{id:"description",value:$.description,onChange:ae=>K(de=>({...de,description:ae.target.value})),placeholder:"Brief description of the thesis"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"due_date",children:"Due Date (optional)"}),a.jsx(Fe,{id:"due_date",type:"date",value:$.due_date,onChange:ae=>K(de=>({...de,due_date:ae.target.value}))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"target_word_count",children:"Target Word Count"}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Wm,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),a.jsxs(Vt,{side:"right",className:"max-w-[260px] text-xs leading-relaxed",children:[a.jsx("p",{className:"font-medium mb-1",children:"Approximate page count (A4, 12pt, 1.5 spacing):"}),a.jsxs("ul",{className:"space-y-0.5",children:[a.jsx("li",{children:"~3,000 words ≈ 10–12 pages"}),a.jsx("li",{children:"~5,000 words ≈ 18–20 pages"}),a.jsx("li",{children:"~10,000 words ≈ 35–40 pages"}),a.jsx("li",{children:"~15,000 words ≈ 55–60 pages"})]})]})]})]}),a.jsx(Fe,{id:"target_word_count",type:"number",min:"1000",step:"500",value:$.target_word_count,onChange:ae=>K(de=>({...de,target_word_count:parseInt(ae.target.value)||15e3})),placeholder:"15000"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(ye,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),a.jsx(ye,{onClick:J,children:"Create"})]})]})]})]}),l&&a.jsxs(a.Fragment,{children:[a.jsx(ye,{variant:"outline",size:"icon",onClick:async()=>{if(!u)return;const ae={...m};for(const ge of p)if(!ae[ge.id]){const{data:we}=await be.from("sections").select("*").eq("chapter_id",ge.id).order("order_index");ae[ge.id]=we||[]}const de={thesis:u,chapters:p.map(ge=>({title:ge.title,order_index:ge.order_index,status:ge.status,sections:(ae[ge.id]||[]).map(we=>({title:we.title,type:we.type,content:we.content,status:we.status,word_count:we.word_count,order_index:we.order_index}))}))};X(de),F(!0)},title:"Export Thesis",children:a.jsx(mo,{className:"h-4 w-4"})}),a.jsxs(qr,{open:E,onOpenChange:M,children:[a.jsx(fl,{asChild:!0,children:a.jsx(ye,{variant:"outline",size:"icon",children:a.jsx(ZJ,{className:"h-4 w-4"})})}),a.jsxs(Dr,{children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Edit Thesis"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"edit-title",children:"Title *"}),a.jsx(Fe,{id:"edit-title",value:G.title,onChange:ae=>Y(de=>({...de,title:ae.target.value})),placeholder:"Thesis title"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"edit-degree",children:"Degree"}),a.jsxs(at,{value:G.degree,onValueChange:ae=>Y(de=>({...de,degree:ae})),children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"bachelor",children:"Bachelor"}),a.jsx(Te,{value:"master",children:"Master"})]})]})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"edit-description",children:"Description (optional)"}),a.jsx(Ht,{id:"edit-description",value:G.description,onChange:ae=>Y(de=>({...de,description:ae.target.value})),placeholder:"Brief description of the thesis"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"edit-due_date",children:"Due Date (optional)"}),a.jsx(Fe,{id:"edit-due_date",type:"date",value:G.due_date,onChange:ae=>Y(de=>({...de,due_date:ae.target.value}))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"edit-target_word_count",children:"Target Word Count"}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Wm,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),a.jsxs(Vt,{side:"right",className:"max-w-[260px] text-xs leading-relaxed",children:[a.jsx("p",{className:"font-medium mb-1",children:"Approximate page count (A4, 12pt, 1.5 spacing):"}),a.jsxs("ul",{className:"space-y-0.5",children:[a.jsx("li",{children:"~3,000 words ≈ 10–12 pages"}),a.jsx("li",{children:"~5,000 words ≈ 18–20 pages"}),a.jsx("li",{children:"~10,000 words ≈ 35–40 pages"}),a.jsx("li",{children:"~15,000 words ≈ 55–60 pages"})]})]})]})]}),a.jsx(Fe,{id:"edit-target_word_count",type:"number",min:"1000",step:"500",value:G.target_word_count,onChange:ae=>Y(de=>({...de,target_word_count:parseInt(ae.target.value)||15e3})),placeholder:"15000"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(ye,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),a.jsx(ye,{onClick:he,children:"Save Changes"})]})]})]})]}),a.jsxs(ji,{children:[a.jsx(jo,{asChild:!0,children:a.jsx(ye,{variant:"destructive",size:"icon",children:a.jsx(Ts,{className:"h-4 w-4"})})}),a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Delete Thesis?"}),a.jsxs(si,{children:['This will permanently delete the thesis "',u==null?void 0:u.title,'" and all its chapters and sections. This action cannot be undone.']})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:O,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]})]})})]}),l&&a.jsxs(a.Fragment,{children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(ybe,{className:"h-5 w-5"}),"Overall Progress"]})}),a.jsx(Be,{children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[Math.round(h),"%"]})]}),a.jsx(nS,{value:h,className:"h-2"})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(Me,{children:[a.jsxs(qe,{className:"flex flex-row items-center justify-between",children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Js,{className:"h-5 w-5"}),"Chapters"]}),a.jsxs(zre,{children:[a.jsx(Hre,{asChild:!0,children:a.jsxs(ye,{variant:"outline",size:"sm",children:[a.jsx(sl,{className:"mr-2 h-4 w-4"}),"Add Chapter"]})}),a.jsxs(S6,{align:"end",children:[ve().map(ae=>a.jsx(Iy,{onClick:()=>q(ae),children:ae},ae)),ve().length>0&&a.jsx(N6,{}),a.jsxs(Iy,{onClick:()=>P(!0),children:[a.jsx(sl,{className:"mr-2 h-4 w-4"}),"Custom Chapter..."]})]})]})]}),a.jsx(Be,{children:j?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(St,{className:"h-6 w-6 animate-spin"})}):p.length===0?a.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No chapters yet. Add your first chapter above."}):a.jsx(lpe,{type:"multiple",value:V,onValueChange:A,className:"space-y-2",children:p.map((ae,de)=>{var ge;return a.jsxs(fB,{value:ae.id,className:"border rounded-lg px-4",children:[a.jsx(pB,{className:"hover:no-underline",onClick:()=>{m[ae.id]||te(ae.id)},children:a.jsxs("div",{className:"flex items-center justify-between w-full mr-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"text-muted-foreground font-mono text-sm",children:[re(de),"."]}),a.jsx(Fe,{value:ae.title,onChange:we=>{g(je=>je.map(Se=>Se.id===ae.id?{...Se,title:we.target.value}:Se))},onBlur:we=>T(ae.id,we.target.value),onClick:we=>we.stopPropagation(),className:"h-8 w-auto min-w-[150px] font-medium"}),a.jsx(gt,{variant:OX[ae.status],children:IX[ae.status]})]}),a.jsxs("div",{className:"flex items-center gap-2",onClick:we=>we.stopPropagation(),children:[a.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(ae.computed_progress||0),"%"]}),a.jsxs(ji,{children:[a.jsx(jo,{asChild:!0,children:a.jsx(ye,{size:"sm",variant:"ghost",children:a.jsx(Ts,{className:"h-4 w-4"})})}),a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsx(ni,{children:"Delete Chapter?"}),a.jsxs(si,{children:['This will delete "',ae.title,'" and all its sections. This action cannot be undone.']})]}),a.jsxs(ri,{children:[a.jsx(Ls,{children:"Cancel"}),a.jsx(Os,{onClick:()=>I(ae.id),className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})]})]})]})}),a.jsx(mB,{children:a.jsxs("div",{className:"space-y-4 pt-4",children:[a.jsx("div",{className:"space-y-3",children:(ge=m[ae.id])==null?void 0:ge.map((we,je)=>a.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx("span",{className:"text-muted-foreground font-mono text-sm min-w-[40px]",children:pe(de,je)}),a.jsx(Fe,{value:we.title||"",onChange:Se=>{x(Ue=>{var Ae;return{...Ue,[ae.id]:((Ae=Ue[ae.id])==null?void 0:Ae.map(fe=>fe.id===we.id?{...fe,title:Se.target.value}:fe))||[]}})},onBlur:Se=>ne(we.id,{title:Se.target.value||null}),placeholder:"Section title (optional)",className:"h-8 flex-1"}),a.jsx(Tgt,{content:we.content,documents:oe})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(gt,{variant:OX[we.status],children:IX[we.status]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[we.word_count," words"]}),a.jsx("div",{onClick:Se=>Se.stopPropagation(),children:a.jsxs(at,{value:we.status,onValueChange:Se=>ne(we.id,{status:Se}),children:[a.jsx(nt,{className:"w-32 h-8",children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"open",children:"Open"}),a.jsx(Te,{value:"in_progress",children:"In Progress"}),a.jsx(Te,{value:"done",children:"Done"})]})]})}),a.jsx(ye,{size:"sm",variant:"ghost",onClick:Se=>{Se.stopPropagation(),ue(we.id)},children:a.jsx(Ts,{className:"h-4 w-4"})})]})]}),a.jsx(Ht,{value:we.content,onChange:Se=>{const Ue=Se.target.value;x(Ae=>{var fe;return{...Ae,[ae.id]:((fe=Ae[ae.id])==null?void 0:fe.map(Ee=>Ee.id===we.id?{...Ee,content:Ue}:Ee))||[]}})},onBlur:Se=>ne(we.id,{content:Se.currentTarget.value}),placeholder:"Section content...",className:"min-h-[120px]"})]},we.id))}),a.jsxs(ye,{variant:"outline",onClick:()=>D(ae.id),className:"w-full",children:[a.jsx(sl,{className:"mr-2 h-4 w-4"}),"Add Section"]})]})})]},ae.id)})})})]})}),a.jsx("div",{children:a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Nr,{className:"h-5 w-5"}),"Recent Activities"]})}),a.jsx(Be,{children:a.jsx("div",{className:"space-y-3",children:y.length===0?a.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activities yet"}):y.map(ae=>a.jsxs("div",{className:"flex items-start gap-3 py-2",children:[xe(ae.note),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:ae.note||`${Math.round(ae.completed)}% completed`}),a.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(ae.timestamp).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})]},ae.id))})})]})})]})]}),a.jsx(qr,{open:z,onOpenChange:P,children:a.jsxs(Dr,{children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Add Custom Chapter"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"chapter-title",children:"Chapter Title *"}),a.jsx(Fe,{id:"chapter-title",value:H,onChange:ae=>B(ae.target.value),placeholder:"e.g., Appendix, Acknowledgements"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(ye,{variant:"outline",onClick:()=>{B(""),P(!1)},children:"Cancel"}),a.jsx(ye,{onClick:()=>{H.trim()&&q(H.trim())},disabled:!H.trim(),children:"Add Chapter"})]})]})]})}),a.jsx(pgt,{open:L,onOpenChange:F,thesisData:W,defaultAuthorName:(r==null?void 0:r.nickname)||"",defaultInstitution:(r==null?void 0:r.university)||"",defaultDegreeProgram:r!=null&&r.degree_type?`${r.degree_type==="bachelor"?"Bachelor":"Master"} Thesis`:"",documents:oe})]})}):null},Igt=["Explain this concept","Find related studies","Generate paragraph","Improve my writing"];function Rgt(){const{user:t,loading:e}=Pt(),r=gr(),{toast:n}=on(),[s,i]=S.useState(!0),[o,l]=S.useState(null),[c,u]=S.useState([]),[d,h]=S.useState([]),[f,p]=S.useState(null),[g,m]=S.useState(0),[x,y]=S.useState(""),[v,b]=S.useState(null),w=S.useRef({});S.useEffect(()=>{!e&&!t&&r("/login")},[e,t,r]),S.useEffect(()=>{t&&(async()=>{i(!0);const{data:V}=await be.from("theses").select("id,title,due_date,target_word_count,updated_at").eq("user_id",t.id).order("updated_at",{ascending:!1}).limit(1),A=(V==null?void 0:V[0])??null;if(l(A),A){const{data:$}=await be.from("chapters").select("id,title,order_index,progress,updated_at").eq("thesis_id",A.id).is("parent_id",null).order("order_index");u($??[]),$&&$.length&&p($[0].id);const{count:K}=await be.from("documents").select("id",{count:"exact",head:!0}).eq("user_id",t.id);m(K??0)}i(!1)})()},[t]),S.useEffect(()=>{f&&(async()=>{const{data:V}=await be.from("sections").select("id,chapter_id,title,order_index,content,word_count,updated_at").eq("chapter_id",f).order("order_index");h(V??[])})()},[f]);const j=S.useMemo(()=>c.find(V=>V.id===f)??null,[c,f]),N=S.useMemo(()=>c.findIndex(V=>V.id===f),[c,f]),C=d.reduce((V,A)=>V+(A.word_count??0),0),k=o!=null&&o.updated_at?`Last edited ${Vke(new Date(o.updated_at))} ago`:"—",E=(V,A)=>{h($=>$.map(K=>K.id===V?{...K,content:A}:K)),w.current[V]&&clearTimeout(w.current[V]),w.current[V]=setTimeout(()=>M(V,A),700)},M=async(V,A)=>{b(V),await be.from("sections").update({content:A}).eq("id",V),b(null)},z=()=>{const V=document.querySelector("textarea[data-section]");V==null||V.focus()},P=()=>{x.trim()&&n({title:"AI Copilot",description:"Connect AI Copilot to enable responses."})};return e||s?a.jsx(er,{showSidebar:!0,pageTitle:"My Thesis 2",fullWidth:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsx(St,{className:"w-6 h-6 animate-spin text-muted-foreground"})})}):o?a.jsx(er,{showSidebar:!0,pageTitle:"My Thesis 2",fullWidth:!0,children:a.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(0,1fr)_280px] gap-8 px-2 lg:px-6 py-2",children:[a.jsxs("main",{className:"min-w-0",children:[a.jsx("div",{className:"mb-8 max-w-xl",children:a.jsxs("div",{className:"relative",children:[a.jsx(ll,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),a.jsx(Fe,{placeholder:"Search in your research...",className:"pl-9 h-10 bg-card border-border"}),a.jsx("kbd",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground border border-border rounded px-1.5 py-0.5",children:"⌘K"})]})}),a.jsxs("div",{className:"mb-8",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground mb-3",children:"Current Thesis"}),a.jsxs("div",{className:"flex items-start justify-between gap-6",children:[a.jsx("h1",{className:"text-[2rem] leading-tight font-semibold tracking-tight",children:o.title}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsxs(ye,{onClick:z,className:"gap-2",children:[a.jsx(QJ,{className:"w-4 h-4"}),"Continue Writing"]}),a.jsx(ye,{variant:"outline",size:"icon",children:a.jsx(Uve,{className:"w-4 h-4"})})]})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-3 text-sm text-muted-foreground flex-wrap",children:[j&&a.jsxs("span",{children:["Chapter ",N+1,": ",j.title]}),a.jsx("span",{className:"text-border",children:"•"}),a.jsx("span",{children:k}),a.jsx("span",{className:"text-border",children:"•"}),a.jsxs("span",{children:[g," relevant sources"]})]})]}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card p-5 mb-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:a.jsx(Ji,{className:"w-4 h-4 text-primary"})}),a.jsx(Fe,{value:x,onChange:V=>y(V.target.value),onKeyDown:V=>V.key==="Enter"&&P(),placeholder:"Ask anything about your research...",className:"border-0 bg-transparent text-base focus-visible:ring-0 px-0 h-9"})]}),a.jsxs("div",{className:"flex items-center justify-between mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ye,{variant:"outline",size:"sm",className:"gap-2 rounded-lg",children:[a.jsx(zve,{className:"w-4 h-4"})," Upload PDF"]}),a.jsxs(ye,{variant:"outline",size:"sm",className:"gap-2 rounded-lg",children:[a.jsx(sl,{className:"w-4 h-4"})," Add Source"]})]}),a.jsx(ye,{size:"icon",onClick:P,children:a.jsx(UF,{className:"w-4 h-4"})})]})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-8",children:Igt.map(V=>a.jsx("button",{onClick:()=>y(V),className:"text-xs px-3 py-1.5 rounded-full border border-border bg-card hover:bg-muted/60 text-foreground/80 transition",children:V},V))}),a.jsxs("article",{className:"rounded-2xl border border-border bg-card p-8 lg:p-12",children:[a.jsxs("header",{className:"mb-8",children:[a.jsxs("div",{className:"text-xs text-muted-foreground mb-1",children:[N+1,".0"]}),a.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:(j==null?void 0:j.title)??"Chapter"})]}),d.length===0?a.jsx("div",{className:"text-sm text-muted-foreground py-12 text-center",children:"No sections yet for this chapter."}):a.jsx("div",{className:"space-y-10",children:d.map((V,A)=>a.jsxs("section",{children:[V.title&&a.jsxs("h3",{className:"text-lg font-semibold mb-3",children:[N+1,".",A+1," ",V.title]}),a.jsx(Ht,{"data-section":!0,value:V.content??"",onChange:$=>E(V.id,$.target.value),onInput:$=>{const K=$.currentTarget;K.style.height="auto",K.style.height=K.scrollHeight+"px"},ref:$=>{$&&($.style.height="auto",$.style.height=$.scrollHeight+"px")},placeholder:"Start writing this section...",className:"w-full border-0 bg-transparent px-0 resize-none text-[15px] leading-relaxed focus-visible:ring-0 placeholder:text-muted-foreground/60 overflow-hidden"})]},V.id))}),a.jsxs("footer",{className:"mt-10 pt-5 border-t border-border flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("span",{className:"tabular-nums",children:[C," words"]}),a.jsx("span",{className:"flex items-center gap-1.5",children:v?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"w-3 h-3 animate-spin"})," Saving…"]}):a.jsxs(a.Fragment,{children:[a.jsx(yn,{className:"w-3 h-3 text-emerald-500"})," All changes saved"]})})]}),a.jsxs("span",{className:"tabular-nums",children:[g," sources"]})]})]})]}),a.jsx("aside",{className:"hidden xl:block",children:a.jsxs("div",{className:"sticky top-6",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground mb-4",children:"Thesis Navigator"}),a.jsxs("div",{className:"mb-4",children:[a.jsx("div",{className:"text-sm font-medium truncate",children:o.title}),o.due_date&&a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Due ",new Date(o.due_date).toLocaleDateString()]})]}),a.jsx("nav",{className:"space-y-0.5",children:c.map((V,A)=>{const $=V.id===f;return a.jsxs("button",{onClick:()=>p(V.id),className:`w-full text-left flex items-center gap-3 px-3 py-2 rounded-md text-sm transition ${$?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"}`,children:[a.jsxs("span",{className:"text-xs tabular-nums w-5 shrink-0",children:[A+1,"."]}),a.jsx("span",{className:"truncate flex-1",children:V.title}),a.jsxs("span",{className:"text-[10px] tabular-nums text-muted-foreground/70",children:[Math.round(Number(V.progress)||0),"%"]})]},V.id)})})]})})]})}):a.jsx(er,{showSidebar:!0,pageTitle:"My Thesis 2",fullWidth:!0,children:a.jsxs("div",{className:"min-h-[60vh] flex flex-col items-center justify-center gap-4",children:[a.jsx("p",{className:"text-muted-foreground",children:"No thesis yet."}),a.jsx(ye,{onClick:()=>r("/thesis-manager"),children:"Create your first thesis"})]})})}function Mgt(){return a.jsx(BD,{to:"/topic-explorer/ideas",replace:!0})}function Dgt(){const{toast:t}=on(),e=gr(),{checkStudentPoints:r,studentPoints:n}=Pt(),[s,i]=S.useState(!1),[o,l]=S.useState("EN"),[c,u]=S.useState(""),[d,h]=S.useState(""),[f,p]=S.useState(!1),[g,m]=S.useState([]),[x,y]=S.useState(null),[v,b]=S.useState({title:"",introduction:"",problemStatement:"",objectives:""}),w=async()=>{if(!r()){i(!0);return}p(!0);try{const{data:{session:C}}=await be.auth.getSession();if(!(C!=null&&C.access_token))throw new Error("No authentication token found");const E=await(await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/topic_explorer",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C.access_token}`},body:JSON.stringify({action:"suggest",topic:c,context:d,language:o})})).json();if(E.error)throw new Error(E.error);const M=(E.suggestions||[]).map((z,P)=>{var V;return{id:((V=crypto.randomUUID)==null?void 0:V.call(crypto))||String(P),title:z.title,researchQuestions:z.research_questions??z.researchQuestions??[],method:z.method,relevance:z.relevance,sources:Array.isArray(z.sources)?z.sources:[]}});m(M)}catch(C){console.error("Error generating suggestions:",C),t({title:"Generation Error",description:"The suggestions could not be generated.",variant:"destructive"})}finally{p(!1)}},j=async C=>{y(C);try{const{data:{session:k}}=await be.auth.getSession();if(!(k!=null&&k.access_token))throw new Error("No authentication token found");const E={action:"structure",selection:C,language:o,original_topic:c,original_context:d,save:!0},z=await(await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/topic_explorer",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${k.access_token}`},body:JSON.stringify(E)})).json();if(z.error)throw new Error(z.error);const P=z.structure||z;b({title:P.title||C.title,introduction:P.introduction||"",problemStatement:P.problem||"",objectives:P.objectives||""}),z.summary_id&&t({title:"Saved",description:"Saved to My Library under My Topic Explorations."})}catch(k){console.error("Error generating structure:",k),t({title:"Structure Error",description:"The structure could not be generated.",variant:"destructive"})}},N=C=>{navigator.clipboard.writeText(C).then(()=>{t({title:"Copied!",description:"Text has been copied to clipboard."})})};return a.jsxs(er,{showSidebar:!0,pageTitle:"Topic Ideas",children:[a.jsxs("div",{className:"p-6 max-w-7xl mx-auto space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Topic Ideas"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Generate structured topic suggestions for your research"})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(hf,{className:"h-5 w-5 text-primary"}),"Generate Topic Suggestions"]}),a.jsx(mn,{children:"Enter your basic idea and receive structured suggestions"})]}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Working Title / Topic Idea"}),a.jsx(Fe,{placeholder:"e.g., AI in Education",value:c,onChange:C=>u(C.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Language"}),a.jsxs(Rb,{type:"single",value:o,onValueChange:C=>C&&l(C),children:[a.jsx(pl,{value:"DE",children:"DE"}),a.jsx(pl,{value:"EN",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Description / Context"}),a.jsx(Ht,{placeholder:"Describe program, scope, methodology, context...",value:d,onChange:C=>h(C.target.value),rows:3})]}),a.jsx(ye,{onClick:w,disabled:!c.trim()||f,className:"w-full",children:f?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating Suggestions..."]}):"Generate Suggestions"})]})]}),g.length>0&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Topic Suggestions"}),a.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:g.map(C=>a.jsxs(Me,{className:"hover:border-primary/50 transition-colors",children:[a.jsx(qe,{children:a.jsx(Je,{className:"text-lg",children:C.title})}),a.jsxs(Be,{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm text-foreground mb-1",children:"Research Questions:"}),a.jsx("ul",{className:"text-sm text-muted-foreground space-y-1",children:(C.researchQuestions||[]).map((k,E)=>a.jsxs("li",{children:["• ",k]},E))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm text-foreground mb-1",children:"Method:"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:C.method})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm text-foreground mb-1",children:"Relevance:"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:C.relevance})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm text-foreground mb-1",children:"Initial Sources:"}),a.jsx("div",{className:"space-y-1",children:(C.sources||[]).map((k,E)=>a.jsxs("div",{className:"text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:k.title}),k.doi&&a.jsxs("span",{className:"block",children:["DOI: ",k.doi]}),k.isbn&&a.jsxs("span",{className:"block",children:["ISBN: ",k.isbn]})]},E))})]}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx(ye,{size:"sm",onClick:()=>j(C),className:"flex-1",children:"Select"}),a.jsx(ye,{size:"sm",variant:"outline",onClick:()=>N(JSON.stringify(C,null,2)),children:a.jsx(bn,{className:"h-4 w-4"})})]})]})]},C.id))})]}),x&&a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Js,{className:"h-5 w-5 text-primary"}),"Basic Structure"]}),a.jsx(mn,{children:"Your topic idea has been saved to My Library under My Topic Explorations."})]}),a.jsx(Be,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs(nd,{children:[a.jsx(gl,{className:"h-4 w-4"}),a.jsx(K8,{children:"Saved successfully"}),a.jsxs(sd,{className:"flex items-center justify-between",children:[a.jsx("span",{children:"Your topic idea is available in My Library. You can continue by creating an outline."}),a.jsxs(ye,{size:"sm",variant:"outline",className:"ml-4 shrink-0",onClick:()=>e("/topic-explorer/outline"),children:["Go to Outline Generator",a.jsx(Oa,{className:"h-4 w-4 ml-1"})]})]})]}),a.jsx("div",{className:"bg-muted/30 p-6 rounded-lg",children:a.jsxs("div",{className:"space-y-4 text-foreground",children:[a.jsx("div",{children:a.jsx("h2",{className:"text-xl font-bold mb-2",children:v.title})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Introduction:"}),a.jsx("p",{className:"whitespace-pre-wrap mb-4",children:v.introduction})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Problem Statement:"}),a.jsx("p",{className:"whitespace-pre-wrap mb-4",children:v.problemStatement})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Objectives:"}),a.jsx("p",{className:"whitespace-pre-wrap",children:v.objectives})]}),(x==null?void 0:x.researchQuestions)&&x.researchQuestions.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Research Questions:"}),a.jsx("ul",{className:"space-y-1",children:x.researchQuestions.map((C,k)=>a.jsxs("li",{className:"whitespace-pre-wrap",children:["• ",C]},k))})]}),(x==null?void 0:x.method)&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Methodology:"}),a.jsx("p",{className:"whitespace-pre-wrap",children:x.method})]}),(x==null?void 0:x.sources)&&x.sources.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Literature Tips:"}),a.jsx("ol",{className:"list-decimal list-inside space-y-2",children:x.sources.map((C,k)=>a.jsxs("li",{className:"text-sm",children:[a.jsx("span",{children:C.title}),C.doi&&a.jsxs("span",{className:"block text-muted-foreground ml-5",children:["DOI: ",C.doi]}),C.isbn&&a.jsxs("span",{className:"block text-muted-foreground ml-5",children:["ISBN: ",C.isbn]})]},k))})]})]})}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ye,{variant:"outline",onClick:()=>{let C=`${v.title}
Introduction:
${v.introduction}
Problem Statement:
${v.problemStatement}
Objectives:
${v.objectives}`;x!=null&&x.researchQuestions&&x.researchQuestions.length>0&&(C+=`
Research Questions:
${x.researchQuestions.map((k,E)=>`${E+1}. ${k}`).join(`
`)}`),x!=null&&x.method&&(C+=`
Methodology:
${x.method}`),x!=null&&x.sources&&x.sources.length>0&&(C+=`
Literature Tips:
${x.sources.map((k,E)=>`${E+1}. ${k.title}${k.doi?` (DOI: ${k.doi})`:""}${k.isbn?` (ISBN: ${k.isbn})`:""}`).join(`
`)}`),N(C)},children:[a.jsx(bn,{className:"h-4 w-4 mr-2"}),"Copy"]})})]})})]})]}),a.jsx(Pc,{open:s,onClose:()=>i(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]})}const TB=Kfe,PB=aB,OB=lB;function Lgt(){const{toast:t}=on(),[e,r]=S.useState("EN"),[n,s]=S.useState(""),[i,o]=S.useState(""),[l,c]=S.useState("bachelor"),[u,d]=S.useState(""),[h,f]=S.useState(!1),[p,g]=S.useState(null),[m,x]=S.useState(""),[y,v]=S.useState(""),[b,w]=S.useState(""),[j,N]=S.useState(""),[C,k]=S.useState(!1),[E,M]=S.useState([]),[z,P]=S.useState(""),[V,A]=S.useState(!0);S.useEffect(()=>{$()},[]);const $=async()=>{try{const{data:{session:H}}=await be.auth.getSession();if(!H)return;const{data:B,error:L}=await be.from("topic_explorations").select("id, title, research_questions, introduction, problem_statement, objectives, method, created_at").eq("user_id",H.user.id).eq("feature_type","topic_ideas").order("created_at",{ascending:!1});if(L)throw L;M(B||[])}catch(H){console.error("Error loading explorations:",H)}finally{A(!1)}},K=()=>{if(!z)return;const H=E.find(B=>B.id===z);if(H){if(s(H.title||""),H.research_questions){const B=Array.isArray(H.research_questions)?H.research_questions:[];o(B.join(`
`))}H.introduction&&x(H.introduction),H.problem_statement&&v(H.problem_statement),H.objectives&&w(H.objectives),H.method&&N(H.method),(H.introduction||H.problem_statement||H.objectives||H.method)&&k(!0),t({title:"Imported",description:"Data has been imported"})}},G=async()=>{if(n.trim()){f(!0);try{const{data:{session:H}}=await be.auth.getSession();if(!(H!=null&&H.access_token))throw new Error("No authentication token found");const L=await(await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/topic_research_tools",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${H.access_token}`},body:JSON.stringify({action:"outline",title:n.trim(),research_questions:i.split(`
`).filter(F=>F.trim()),language:e,degree_type:l,target_word_count:u?parseInt(u):void 0,topic_context:{introduction:m.trim()||void 0,problem_statement:y.trim()||void 0,objectives:b.trim()||void 0,methodology:j.trim()||void 0}})})).json();if(L.error)throw new Error(L.error);g(L.outline),t({title:"Outline Generated",description:"Your outline has been saved to My Library under My Topic Explorations."})}catch(H){console.error("Error generating outline:",H),t({title:"Error",description:"The outline could not be generated.",variant:"destructive"})}finally{f(!1)}}},Y=()=>{if(!p)return;let H=`${p.title}
`;H+=`TABLE OF CONTENTS
`,p.chapters.forEach(B=>{H+=`${B.number} ${B.title}`,B.estimated_pages&&(H+=` (~${B.estimated_pages} pages)`),H+=`
`,B.subchapters&&B.subchapters.forEach(L=>{H+=` ${L.number} ${L.title}`,L.estimated_pages&&(H+=` (~${L.estimated_pages} pages)`),H+=`
`})}),H+=`
Estimated Total Pages: ~${p.total_estimated_pages}`,p.notes&&(H+=`
Notes:
${p.notes}`),navigator.clipboard.writeText(H),t({title:"Copied!",description:"Outline has been copied to clipboard."})};return a.jsx(er,{showSidebar:!0,pageTitle:"Outline Generator",children:a.jsxs("div",{className:"p-6 max-w-7xl mx-auto space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Outline Generator"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Create a detailed outline for your scientific work"})]}),a.jsx(Me,{children:a.jsx(Be,{className:"pt-6",children:a.jsxs("div",{className:"space-y-3",children:[a.jsx(_e,{className:"text-sm font-semibold",children:"Take from Topic Explorer"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(at,{value:z,onValueChange:P,children:[a.jsx(nt,{className:"flex-1",children:a.jsx(ot,{placeholder:V?"Loading...":"Select a topic..."})}),a.jsx(st,{children:E.map(H=>a.jsx(Te,{value:H.id,children:H.title},H.id))})]}),a.jsx(ye,{onClick:K,disabled:!z,variant:"secondary",children:"Import Topic"})]})]})})}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Nr,{className:"h-5 w-5 text-primary"}),"Generate Outline"]}),a.jsx(mn,{children:"Create a detailed outline for your scientific work"})]}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Title / Topic *"}),a.jsx(Fe,{placeholder:"e.g., AI in Education",value:n,onChange:H=>s(H.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Language"}),a.jsxs(Rb,{type:"single",value:e,onValueChange:H=>H&&r(H),children:[a.jsx(pl,{value:"DE",children:"DE"}),a.jsx(pl,{value:"EN",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Research Questions (optional)"}),a.jsx(Ht,{placeholder:"One question per line...",value:i,onChange:H=>o(H.target.value),rows:3})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Degree Type"}),a.jsxs(at,{value:l,onValueChange:c,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"bachelor",children:"Bachelor"}),a.jsx(Te,{value:"master",children:"Master"}),a.jsx(Te,{value:"phd",children:"PhD / Dissertation"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Target Word Count (optional)"}),a.jsx(Ai,{children:a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Wm,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),a.jsxs(Vt,{side:"top",className:"max-w-xs text-xs space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"Approximate page equivalents:"}),a.jsx("p",{children:"~3,000 words ≈ 10–12 pages"}),a.jsx("p",{children:"~5,000 words ≈ 18–20 pages"}),a.jsx("p",{children:"~10,000 words ≈ 35–40 pages"}),a.jsx("p",{children:"~15,000 words ≈ 55–60 pages"}),a.jsx("p",{className:"text-muted-foreground pt-1",children:"Based on ~275 words/page (A4, 12pt, 1.5 spacing)"})]})]})})]}),a.jsx(Fe,{type:"number",placeholder:"e.g., 15000",value:u,onChange:H=>d(H.target.value)})]})]}),a.jsxs(TB,{open:C,onOpenChange:k,children:[a.jsx(PB,{asChild:!0,children:a.jsxs(ye,{variant:"ghost",className:"w-full justify-between p-3 h-auto border border-dashed border-border hover:bg-muted/50",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ji,{className:"h-4 w-4 text-primary"}),a.jsx("span",{className:"text-sm font-medium",children:e==="DE"?"Erweiterter Kontext (optional)":"Advanced Context (optional)"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:e==="DE"?"Für bessere Ergebnisse":"For better results"}),a.jsx(vc,{className:`h-4 w-4 transition-transform ${C?"rotate-180":""}`})]})]})}),a.jsxs(OB,{className:"pt-4 space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Einleitung":"Introduction"}),a.jsx(Ht,{placeholder:e==="DE"?"Kurze Einführung in das Thema...":"Brief introduction to the topic...",value:m,onChange:H=>x(H.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Problemstellung":"Problem Statement"}),a.jsx(Ht,{placeholder:e==="DE"?"Das Forschungsproblem...":"The research problem...",value:y,onChange:H=>v(H.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Ziele (ein Ziel pro Zeile)":"Objectives (one per line)"}),a.jsx(Ht,{placeholder:e==="DE"?`Ziel 1
Ziel 2
Ziel 3`:`Objective 1
Objective 2
Objective 3`,value:b,onChange:H=>w(H.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Methodischer Ansatz":"Methodology"}),a.jsx(Ht,{placeholder:e==="DE"?"z.B. RCT, Qualitative Interviews, Systematic Review...":"e.g., RCT, Qualitative Interviews, Systematic Review...",value:j,onChange:H=>N(H.target.value),rows:2})]})]})]}),a.jsx(ye,{onClick:G,disabled:!n.trim()||h,className:"w-full",children:h?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating Outline..."]}):"Generate Outline"})]})]}),p&&a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Je,{children:p.title}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:Y,children:[a.jsx(bn,{className:"h-4 w-4 mr-2"}),"Copy"]})]}),a.jsxs(mn,{children:["Estimated pages: ~",p.total_estimated_pages]})]}),a.jsxs(Be,{children:[a.jsx(lpe,{type:"multiple",className:"w-full",children:p.chapters.map((H,B)=>a.jsxs(fB,{value:`chapter-${B}`,children:[a.jsx(pB,{className:"hover:no-underline",children:a.jsxs("div",{className:"flex items-center gap-3 text-left",children:[a.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:H.number}),a.jsx("span",{className:"font-medium",children:H.title}),H.estimated_pages&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["(~",H.estimated_pages," p.)"]})]})}),a.jsx(mB,{children:a.jsxs("div",{className:"pl-8 space-y-3",children:[H.description&&a.jsx("p",{className:"text-sm text-muted-foreground",children:H.description}),H.subchapters&&H.subchapters.length>0&&a.jsx("div",{className:"space-y-2",children:H.subchapters.map((L,F)=>a.jsxs("div",{className:"flex items-start gap-3 py-1",children:[a.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:L.number}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm font-medium",children:L.title}),L.estimated_pages&&a.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["(~",L.estimated_pages," p.)"]}),L.description&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:L.description})]})]},F))})]})})]},B))}),p.notes&&a.jsxs("div",{className:"mt-4 p-4 bg-muted/50 rounded-lg",children:[a.jsx("h4",{className:"font-medium text-sm mb-2",children:"Notes"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:p.notes})]})]})]})]})})}function Fgt(){const{toast:t}=on(),[e,r]=S.useState("EN"),[n,s]=S.useState(""),[i,o]=S.useState(""),[l,c]=S.useState(""),[u,d]=S.useState(!1),[h,f]=S.useState(null),[p,g]=S.useState(""),[m,x]=S.useState(""),[y,v]=S.useState(""),[b,w]=S.useState(""),[j,N]=S.useState(!1),[C,k]=S.useState(""),[E,M]=S.useState(!1),[z,P]=S.useState([]),[V,A]=S.useState(new Set),[$,K]=S.useState([]),[G,Y]=S.useState(""),[H,B]=S.useState(!0);S.useEffect(()=>{L()},[]);const L=async()=>{try{const{data:{session:R}}=await be.auth.getSession();if(!R)return;const{data:ee,error:te}=await be.from("topic_explorations").select("id, title, research_questions, outline_json, introduction, problem_statement, objectives, method, created_at").eq("user_id",R.user.id).eq("feature_type","topic_ideas").order("created_at",{ascending:!1});if(te)throw te;K(ee||[])}catch(R){console.error("Error loading explorations:",R)}finally{B(!1)}},F=()=>{if(!G)return;const R=$.find(ee=>ee.id===G);if(R){if(s(R.title||""),R.research_questions){const ee=Array.isArray(R.research_questions)?R.research_questions:[];o(ee.join(`
`))}if(R.outline_json){const ee=R.outline_json;if(ee.chapters){const te=ee.chapters.map(Z=>`${Z.number} ${Z.title}`).join(`
`);c(te)}}R.introduction&&g(R.introduction),R.problem_statement&&x(R.problem_statement),R.objectives&&v(R.objectives),R.method&&w(R.method),(R.introduction||R.problem_statement||R.objectives||R.method)&&N(!0),t({title:"Imported",description:"Data has been imported"})}},W=async()=>{var R,ee;if(n.trim()){d(!0);try{const{data:{session:te}}=await be.auth.getSession();if(!(te!=null&&te.access_token))throw new Error("No authentication token found");const J=await(await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/topic_research_tools",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${te.access_token}`},body:JSON.stringify({action:"keywords",title:n.trim(),research_questions:i.split(`
`).filter(he=>he.trim()),outline:l.trim()||void 0,language:e,topic_context:{introduction:p.trim()||void 0,problem_statement:m.trim()||void 0,objectives:y.trim()||void 0,methodology:b.trim()||void 0}})})).json();if(J.error)throw new Error(J.error);f(J.keywords),((ee=(R=J.keywords)==null?void 0:R.keyword_combinations)==null?void 0:ee.length)>0&&k(J.keywords.keyword_combinations[0].combination),t({title:"Keywords Generated",description:"The literature keywords have been successfully generated."})}catch(te){console.error("Error generating keywords:",te),t({title:"Error",description:"The keywords could not be generated.",variant:"destructive"})}finally{d(!1)}}},X=R=>{navigator.clipboard.writeText(R),t({title:"Copied!",description:"Text has been copied to clipboard."})},oe=()=>{if(!h)return;const R=h.keyword_combinations||[],ee=h.known_authors||[],te=h.known_works||[],Z=h.database_suggestions||[];let J=`LITERATURE KEYWORDS
`;J+=`Search Combinations:
`,R.forEach(he=>{J+=`- ${he.combination} (${he.purpose})
`}),J+=`
Known Authors:
`,ee.forEach(he=>{J+=`- ${he.name}: ${he.relevance}
`}),J+=`
Known Works:
`,te.forEach(he=>{J+=`- ${he.title}`,he.author&&(J+=` (${he.author}`),he.year&&(J+=`, ${he.year}`),he.author&&(J+=")"),J+=`
`}),J+=`
Database Suggestions:
`,J+=Z.join(", ")+`
`,J+=`Search Tips:
`,J+=h.search_tips||"",X(J)},le=async()=>{if(C.trim()){M(!0),P([]);try{const{data:{session:R}}=await be.auth.getSession();if(!(R!=null&&R.access_token))throw new Error("No authentication token found");const te=await(await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/topic_research_tools",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${R.access_token}`},body:JSON.stringify({action:"search_literature",keywords:C.trim()})})).json();if(te.error)throw new Error(te.error);P(te.results||[]),(te.results||[]).length===0&&t({title:"No results found",description:"Try different keywords."})}catch(R){console.error("Error searching literature:",R),t({title:"Error",description:"Literature search failed.",variant:"destructive"})}finally{M(!1)}}},U=R=>{A(ee=>{const te=new Set(ee);return te.has(R)?te.delete(R):te.add(R),te})};return a.jsx(er,{showSidebar:!0,pageTitle:"Literature Keywords",children:a.jsxs("div",{className:"p-6 max-w-7xl mx-auto space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Literature Keywords"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Generate search terms and find relevant literature for your topic"})]}),a.jsx(Me,{children:a.jsx(Be,{className:"pt-6",children:a.jsxs("div",{className:"space-y-3",children:[a.jsx(_e,{className:"text-sm font-semibold",children:"Take from Topic Explorer"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(at,{value:G,onValueChange:Y,children:[a.jsx(nt,{className:"flex-1",children:a.jsx(ot,{placeholder:H?"Loading...":"Select a topic..."})}),a.jsx(st,{children:$.map(R=>a.jsx(Te,{value:R.id,children:R.title},R.id))})]}),a.jsx(ye,{onClick:F,disabled:!G,variant:"secondary",children:"Import Topic"})]})]})})}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(ll,{className:"h-5 w-5 text-primary"}),"Find Literature Keywords"]}),a.jsx(mn,{children:"Generate search terms and find relevant literature for your topic"})]}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Title / Topic *"}),a.jsx(Fe,{placeholder:"e.g., AI in Education",value:n,onChange:R=>s(R.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Language"}),a.jsxs(Rb,{type:"single",value:e,onValueChange:R=>R&&r(R),children:[a.jsx(pl,{value:"DE",children:"DE"}),a.jsx(pl,{value:"EN",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Research Questions (optional)"}),a.jsx(Ht,{placeholder:"One question per line...",value:i,onChange:R=>o(R.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Outline (optional)"}),a.jsx(Ht,{placeholder:"Chapter structure or topic overview...",value:l,onChange:R=>c(R.target.value),rows:4})]}),a.jsxs(TB,{open:j,onOpenChange:N,children:[a.jsx(PB,{asChild:!0,children:a.jsxs(ye,{variant:"ghost",className:"w-full justify-between p-3 h-auto border border-dashed border-border hover:bg-muted/50",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ji,{className:"h-4 w-4 text-primary"}),a.jsx("span",{className:"text-sm font-medium",children:e==="DE"?"Erweiterter Kontext (optional)":"Advanced Context (optional)"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:e==="DE"?"Für bessere Ergebnisse":"For better results"}),a.jsx(vc,{className:`h-4 w-4 transition-transform ${j?"rotate-180":""}`})]})]})}),a.jsxs(OB,{className:"pt-4 space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Einleitung":"Introduction"}),a.jsx(Ht,{placeholder:e==="DE"?"Kurze Einführung in das Thema...":"Brief introduction to the topic...",value:p,onChange:R=>g(R.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Problemstellung":"Problem Statement"}),a.jsx(Ht,{placeholder:e==="DE"?"Das Forschungsproblem...":"The research problem...",value:m,onChange:R=>x(R.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Ziele (ein Ziel pro Zeile)":"Objectives (one per line)"}),a.jsx(Ht,{placeholder:e==="DE"?`Ziel 1
Ziel 2
Ziel 3`:`Objective 1
Objective 2
Objective 3`,value:y,onChange:R=>v(R.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Methodischer Ansatz":"Methodology"}),a.jsx(Ht,{placeholder:e==="DE"?"z.B. RCT, Qualitative Interviews, Systematic Review...":"e.g., RCT, Qualitative Interviews, Systematic Review...",value:b,onChange:R=>w(R.target.value),rows:2})]})]})]}),a.jsx(ye,{onClick:W,disabled:!n.trim()||u,className:"w-full",children:u?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating Keywords..."]}):"Generate Keywords"})]})]}),h&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"Results"}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:oe,children:[a.jsx(bn,{className:"h-4 w-4 mr-2"}),"Copy All"]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-base flex items-center gap-2",children:[a.jsx(hf,{className:"h-4 w-4"}),"Search Combinations"]})}),a.jsx(Be,{children:a.jsx("div",{className:"space-y-2",children:(h.keyword_combinations||[]).map((R,ee)=>a.jsxs("div",{className:"flex items-start justify-between gap-2 p-2 bg-muted/50 rounded-md cursor-pointer hover:bg-muted",onClick:()=>X(R.combination),children:[a.jsxs("div",{children:[a.jsx("code",{className:"text-sm font-medium",children:R.combination}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:R.purpose})]}),a.jsx(gt,{variant:"outline",className:"text-xs shrink-0",children:R.language})]},ee))})})]}),a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-base flex items-center gap-2",children:[a.jsx(Ij,{className:"h-4 w-4"}),"Known Authors"]})}),a.jsx(Be,{children:a.jsx("div",{className:"space-y-2",children:(h.known_authors||[]).map((R,ee)=>a.jsxs("div",{className:"p-2 bg-muted/50 rounded-md cursor-pointer hover:bg-muted",onClick:()=>X(R.name),children:[a.jsx("span",{className:"font-medium text-sm",children:R.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:R.relevance})]},ee))})})]}),a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-base flex items-center gap-2",children:[a.jsx(Js,{className:"h-4 w-4"}),"Known Works"]})}),a.jsx(Be,{children:a.jsx("div",{className:"space-y-2",children:(h.known_works||[]).map((R,ee)=>a.jsxs("div",{className:"p-2 bg-muted/50 rounded-md cursor-pointer hover:bg-muted",onClick:()=>X(R.title),children:[a.jsx("span",{className:"font-medium text-sm",children:R.title}),(R.author||R.year)&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[R.author,R.year&&` (${R.year})`]}),R.relevance&&a.jsx("p",{className:"text-xs text-muted-foreground italic mt-1",children:R.relevance})]},ee))})})]}),a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsx(Je,{className:"text-base",children:"Recommended Databases"})}),a.jsx(Be,{children:a.jsx("div",{className:"flex flex-wrap gap-2",children:(h.database_suggestions||[]).map((R,ee)=>a.jsx(gt,{variant:"secondary",children:R},ee))})})]})]}),h.search_tips&&a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsx(Je,{className:"text-base",children:"Search Tips"})}),a.jsx(Be,{children:a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:h.search_tips})})]})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Js,{className:"h-5 w-5 text-primary"}),"Search Real Literature"]}),a.jsx(mn,{children:"Search CrossRef and OpenAlex for real academic papers"})]}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Fe,{placeholder:"e.g., ITIL service transition challenges",value:C,onChange:R=>k(R.target.value),onKeyDown:R=>R.key==="Enter"&&le(),className:"flex-1"}),a.jsx(ye,{onClick:le,disabled:!C.trim()||E,children:E?a.jsx(St,{className:"h-4 w-4 animate-spin"}):a.jsx(ll,{className:"h-4 w-4"})})]}),z.length>0&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[z.length," results found"]}),z.map((R,ee)=>{var te;return a.jsxs("div",{className:"border border-border rounded-lg p-4 space-y-2 hover:bg-muted/30 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("h4",{className:"font-medium text-sm leading-snug flex-1",children:R.title}),a.jsxs("div",{className:"flex gap-1 shrink-0 flex-wrap justify-end",children:[R.is_open_access&&a.jsx(gt,{className:"text-xs bg-green-100 text-green-800 border-green-200",children:"Open Access"}),a.jsx(gt,{variant:"outline",className:"text-xs",children:R.source==="crossref"?"CrossRef":"OpenAlex"})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[((te=R.authors)==null?void 0:te.length)>0&&a.jsxs("span",{children:[R.authors.slice(0,3).join(", "),R.authors.length>3?" et al.":""]}),R.year&&a.jsx("span",{children:R.year}),R.journal&&a.jsx("span",{className:"italic",children:R.journal})]}),R.abstract&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:V.has(ee)?R.abstract:R.abstract.substring(0,150)+"..."}),a.jsx("button",{onClick:()=>U(ee),className:"text-xs text-primary hover:underline mt-1",children:V.has(ee)?"Show less":"Show more"})]}),a.jsxs("div",{className:"flex gap-2 pt-1 flex-wrap",children:[R.doi&&a.jsxs(ye,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>X(R.doi),children:[a.jsx(bn,{className:"h-3 w-3 mr-1"}),"Copy DOI"]}),R.url&&a.jsx(ye,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>window.open(R.url,"_blank"),children:"View"})]})]},ee)})]})]})]})]})})}var oP="Switch",[$gt,mxt]=Bn(oP),[Bgt,Ugt]=$gt(oP),fme=S.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...h}=t,[f,p]=S.useState(null),g=Nt(e,b=>p(b)),m=S.useRef(!1),x=f?d||!!f.closest("form"):!0,[y,v]=Ms({prop:s,defaultProp:i??!1,onChange:u,caller:oP});return a.jsxs(Bgt,{scope:r,checked:y,disabled:l,children:[a.jsx(et.button,{type:"button",role:"switch","aria-checked":y,"aria-required":o,"data-state":yme(y),"data-disabled":l?"":void 0,disabled:l,value:c,...h,ref:g,onClick:ze(t.onClick,b=>{v(w=>!w),x&&(m.current=b.isPropagationStopped(),m.current||b.stopPropagation())})}),x&&a.jsx(gme,{control:f,bubbles:!m.current,name:n,value:c,checked:y,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});fme.displayName=oP;var pme="SwitchThumb",mme=S.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,s=Ugt(pme,r);return a.jsx(et.span,{"data-state":yme(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:e})});mme.displayName=pme;var zgt="SwitchBubbleInput",gme=S.forwardRef(({__scopeSwitch:t,control:e,checked:r,bubbles:n=!0,...s},i)=>{const o=S.useRef(null),l=Nt(o,i),c=F8(r),u=XF(e);return S.useEffect(()=>{const d=o.current;if(!d)return;const h=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==r&&p){const g=new Event("click",{bubbles:n});p.call(d,r),d.dispatchEvent(g)}},[c,r,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gme.displayName=zgt;function yme(t){return t?"checked":"unchecked"}var xme=fme,Hgt=mme;const V1=S.forwardRef(({className:t,...e},r)=>a.jsx(xme,{className:Ie("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:r,children:a.jsx(Hgt,{className:Ie("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));V1.displayName=xme.displayName;function Wgt(t,e){if(!t.trim())return{pages:[],error:"Please enter page numbers"};const r=new Set,n=t.split(",").map(s=>s.trim()).filter(s=>s.length>0);try{for(const s of n)if(s.includes("-")){const[i,o]=s.split("-").map(l=>parseInt(l.trim()));if(isNaN(i)||isNaN(o)||i<1||o>e||i>o)return{pages:[],error:`Invalid range: ${s}`};for(let l=i;l<=o;l++)r.add(l)}else{const i=parseInt(s);if(isNaN(i)||i<1||i>e)return{pages:[],error:`Invalid page: ${s}`};r.add(i)}return{pages:Array.from(r).sort((s,i)=>s-i)}}catch{return{pages:[],error:"Invalid page format"}}}function Vgt(){const{user:t,loading:e,checkStudentPoints:r,studentPoints:n}=Pt(),[s,i]=S.useState(!1),o=gr(),[l,c]=S.useState([]),[u,d]=S.useState(!0),[h,f]=S.useState(null),[p,g]=S.useState(""),[m,x]=S.useState([]),[y,v]=S.useState(""),[b,w]=S.useState(""),[j,N]=S.useState(!0),[C,k]=S.useState(!0),[E,M]=S.useState(!1),[z,P]=S.useState(null);S.useEffect(()=>{!t&&!e&&o("/login")},[t,e,o]),S.useEffect(()=>{t&&V()},[t]),S.useEffect(()=>{if(h){const Y=Wgt(p,h.page_count||0);if(x(Y.pages||[]),v(Y.error||""),Y.pages&&Y.pages.length>0){const H=A(Y.pages);w(`${h.title} – Excerpt (${H})`)}}},[p,h]);const V=async()=>{if(t){d(!0);try{const{data:Y,error:H}=await be.from("documents").select("id, title, page_count, storage_path").eq("user_id",t.id).not("page_count","is",null).order("created_at",{ascending:!1});if(H){console.error("Error loading documents:",H),j0({title:"Error",description:"Documents could not be loaded",variant:"destructive"});return}c(Y||[])}catch(Y){console.error("Error in loadDocuments:",Y)}finally{d(!1)}}},A=Y=>{if(Y.length===0)return"";const H=[];let B=Y[0],L=Y[0];for(let F=1;F<Y.length;F++)Y[F]===L+1?L=Y[F]:(B===L?H.push(B.toString()):H.push(`${B}-${L}`),B=L=Y[F]);return B===L?H.push(B.toString()):H.push(`${B}-${L}`),H.join(", ")},$=async()=>{if(!r()){i(!0);return}if(!(!h||m.length===0||y)){M(!0),j0({title:"Extract is being generated...",description:"Please wait a moment"});try{const{data:Y,error:H}=await be.functions.invoke("pdf_slicer",{body:{document_id:h.id,pages:m,new_title:b,keep_citation:j,copy_metadata:C}});if(H)throw H;if(Y.success)j0({title:"Successfully created",description:"Your PDF extract has been successfully created"}),P(Y.document),await V();else throw new Error(Y.error||"Uknown Error")}catch(Y){console.error("Error creating excerpt:",Y),j0({title:"Fehler",description:Y.message||"Excerpt could not be created",variant:"destructive"})}finally{M(!1)}}},K=()=>{f(null),g(""),x([]),v(""),w(""),N(!0),k(!0),P(null)},G=()=>{g(""),x([]),v(""),w(""),P(null)};return e||u?a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsxs(er,{showSidebar:!0,children:[a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(tee,{className:"h-8 w-8 text-primary"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Page Selector"}),a.jsx("p",{className:"text-muted-foreground",children:"Create extracts from your PDF documents"})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Source"})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"source-document",children:"Quelldokument"}),a.jsxs(at,{value:(h==null?void 0:h.id)||"",onValueChange:Y=>{const H=l.find(B=>B.id===Y)||null;f(H),g(""),x([]),v("")},disabled:u||l.length===0,children:[a.jsx(nt,{id:"source-document",children:a.jsx(ot,{placeholder:"Select document..."})}),a.jsx(st,{children:l.map(Y=>a.jsxs(Te,{value:Y.id,children:[Y.title," (",Y.page_count||0," pages)"]},Y.id))})]})]}),h&&a.jsxs("div",{className:"text-sm text-muted-foreground",children:["pages: ",h.page_count||0," | Title: ",h.title]}),h&&a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"pages",children:"pages"}),a.jsx(Fe,{id:"pages",value:p,onChange:Y=>g(Y.target.value),placeholder:"e.G. 1-3, 5, 9-11"}),a.jsxs("div",{className:"mt-2 text-sm text-muted-foreground",children:["Examples: 3-6, 8, 10-12 → ",m.length>0&&`${m.length} pages selected`]}),y&&a.jsx("div",{className:"mt-2 text-sm text-destructive",children:y})]})]})]}),h&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Goal & Optionsn"})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"new-title",children:"New Title"}),a.jsx(Fe,{id:"new-title",value:b,onChange:Y=>w(Y.target.value)})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(V1,{id:"keep-citation",checked:j,onCheckedChange:N}),a.jsx(_e,{htmlFor:"keep-citation",children:"Retain APA citation"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(V1,{id:"copy-metadata",checked:C,onCheckedChange:k}),a.jsx(_e,{htmlFor:"copy-metadata",children:"Copy DOI/ISBN"})]})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(ye,{onClick:$,disabled:!h||m.length===0||!!y||E,className:"flex-1",children:E?"Being created...":"Create extract"}),a.jsxs(ye,{variant:"outline",onClick:K,children:[a.jsx(fbe,{className:"h-4 w-4 mr-2"}),"Reset"]})]}),z&&a.jsxs(Me,{className:"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/50",children:[a.jsx(qe,{children:a.jsxs(Je,{className:"text-green-800 dark:text-green-200",children:[a.jsx(Nr,{className:"h-5 w-5 inline mr-2"}),"Auszug erfolgreich erstellt"]})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:z.title}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[z.page_count||0," pages"]}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Saved at: ",z.storage_path]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs(ye,{onClick:()=>o("/documents"),children:[a.jsx(ib,{className:"h-4 w-4 mr-2"}),"Go to the library"]}),a.jsx(ye,{variant:"outline",onClick:G,children:"Create more"})]})]})]})]}),a.jsx(Pc,{open:s,onClose:()=>i(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]}):null}function qgt(){const t=gr(),[e]=Dj(),{toast:r}=on(),{user:n,loading:s}=Pt(),[i,o]=S.useState([]),[l,c]=S.useState(!1),[u,d]=S.useState(""),[h,f]=S.useState(!0),[p,g]=S.useState(!1),[m,x]=S.useState(!1),[y,v]=S.useState(null),[b,w]=S.useState(""),j=e.get("document");S.useEffect(()=>{if(!s&&!n){t("/login");return}n&&N()},[n,s,t]),S.useEffect(()=>{j&&i.length>0&&!u&&i.some(M=>M.id===j)&&d(j)},[j,i,u]);const N=async()=>{c(!0);try{const{data:E,error:M}=await be.from("documents").select("id, title, page_count, storage_path, created_at").order("created_at",{ascending:!1});if(M)throw M;o(E||[])}catch(E){console.error("Error loading documents:",E),r({title:"Error",description:"Failed to load documents.",variant:"destructive"})}finally{c(!1)}},C=async()=>{if(u){x(!0),w(""),v(null);try{const{data:{session:E}}=await be.auth.getSession();if(!E)throw new Error("AUTH");const M=await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/pdf_extract",{method:"POST",headers:{Authorization:`Bearer ${E.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({document_id:u,overwrite:h,also_block:p})}),z=await M.json();if(!M.ok||z.error)throw new Error(z.error||"UNKNOWN");console.log("Extract result:",z),v(z),r({title:"Sucessfully extracted",description:`${z.inserted_pages} Seiten extrahiert. page_count = ${z.page_count}.`}),await N()}catch(E){console.error("Extract error:",E);const M=E.message||"UNKNOWN";w(M);let z="Uknown Error.";switch(M){case"AUTH":z="Please Login.";break;case"DOC_NOT_FOUND":z="Document not found or permission denied.";break;case"STORAGE":z="Error accessing the file.";break;case"PDF_PARSE":z="PDF could not be processed.";break;case"DB_WRITE":z="Error saving to the database.";break}r({title:"Error",description:z,variant:"destructive"})}finally{x(!1)}}},k=i.find(E=>E.id===u);return s?a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(St,{className:"h-8 w-8 animate-spin"})})}):a.jsx(er,{showSidebar:!0,children:a.jsxs("div",{className:"container mx-auto py-8 space-y-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"text-3xl font-bold",children:"PDF-Extract"}),a.jsx("p",{className:"text-muted-foreground",children:"Extract page-by-page text from previously uploaded documents"})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsx(Je,{children:"Choose Document"}),a.jsx(mn,{children:"Extract page-by-page text from previously uploaded documents"})]}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs(at,{value:u,onValueChange:d,disabled:l||m,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Choose document..."})}),a.jsx(st,{children:i.map(E=>a.jsxs(Te,{value:E.id,children:[E.title," (",E.page_count?`${E.page_count} Pages`:"unbekannt",")"]},E.id))})]}),k&&a.jsx("div",{className:"text-sm text-muted-foreground",children:k.page_count?"Extracted pages already exist.":"No page text has been extracted yet."}),l&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(St,{className:"h-4 w-4 animate-spin"}),"Loading Document..."]})]})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsx(Je,{children:"Optionen"}),a.jsx(mn,{children:"Configure the extraction settings"})]}),a.jsxs(Be,{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(V1,{id:"overwrite",checked:h,onCheckedChange:f,disabled:m}),a.jsx(_e,{htmlFor:"overwrite",children:"Overwrite existing page text"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(V1,{id:"alsoBlock",checked:p,onCheckedChange:g,disabled:m}),a.jsx(_e,{htmlFor:"alsoBlock",children:"Additionally, save the entire Markdown block"})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:p?"Additionally, a block containing all pages is stored as Markdown.":"Only pages are stored in the `pages` directory, and `page_count` is updated."})]})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsx(Je,{children:"Execution and result"}),a.jsx(mn,{children:"Start the text extraction and view the results."})]}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs(ye,{onClick:C,disabled:!u||m,className:"w-full",size:"lg",children:[m&&a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),m?"Extract...":"Extract"]}),y&&a.jsxs("div",{className:"p-4 bg-green-50 dark:bg-green-950 rounded-lg border border-green-200 dark:border-green-800",children:[a.jsx("h4",{className:"font-semibold text-green-800 dark:text-green-200 mb-2",children:"Extraction successful"}),a.jsxs("div",{className:"space-y-1 text-sm text-green-700 dark:text-green-300",children:[a.jsxs("div",{children:["New page_count: ",a.jsx("strong",{children:y.page_count})]}),a.jsxs("div",{children:["Overwritten: ",a.jsx("strong",{children:y.overwrote?"Yes":"No"})]}),y.block_id&&a.jsxs("div",{children:["Block-ID: ",a.jsx("strong",{children:y.block_id})]})]})]}),b&&a.jsxs("div",{className:"p-4 bg-red-50 dark:bg-red-950 rounded-lg border border-red-200 dark:border-red-800",children:[a.jsx("h4",{className:"font-semibold text-red-800 dark:text-red-200 mb-2",children:"Fehler aufgetreten"}),a.jsxs("div",{className:"text-sm text-red-700 dark:text-red-300",children:["Error Code: ",b]})]}),a.jsxs(ye,{variant:"outline",onClick:N,disabled:l||m,className:"w-full",children:[l&&a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),a.jsx(eee,{className:"mr-2 h-4 w-4"}),"Update document list"]})]})]})]})})}function Ggt(t){var r,n;if(!t)return"GEN";const e=(t.type||((r=t.crossref_data)==null?void 0:r.type)||((n=t.crossref_payload)==null?void 0:n.type)||"").toLowerCase();return e.includes("journal")||e.includes("article")?"JOUR":e.includes("book")?"BOOK":e.includes("conference")||e.includes("proceeding")?"CONF":e.includes("thesis")||e.includes("dissertation")?"THES":"GEN"}function Kgt(t){var r,n,s,i,o;const e=(t==null?void 0:t.authors)||((r=t==null?void 0:t.crossref_data)==null?void 0:r.authors)||((n=t==null?void 0:t.crossref_payload)==null?void 0:n.author)||((i=(s=t==null?void 0:t.crossref_data)==null?void 0:s.crossref_metadata)==null?void 0:i.author)||((o=t==null?void 0:t.google_books_data)==null?void 0:o.authors)||[];return Array.isArray(e)?e.map(l=>typeof l=="string"?l:l!=null&&l.family?`${l.family}, ${l.given||""}`.trim():"").filter(Boolean):[]}function Ygt(t){var n,s,i,o,l,c,u,d,h,f,p,g,m,x,y;if(!t)return null;const e=t.published_year||t.year||((n=t.crossref_data)==null?void 0:n.year)||((c=(l=(o=(i=(s=t.crossref_data)==null?void 0:s.crossref_metadata)==null?void 0:i.issued)==null?void 0:o["date-parts"])==null?void 0:l[0])==null?void 0:c[0])||((f=(h=(d=(u=t.crossref_payload)==null?void 0:u.issued)==null?void 0:d["date-parts"])==null?void 0:h[0])==null?void 0:f[0])||((x=(m=(g=(p=t.crossref_payload)==null?void 0:p.published)==null?void 0:g["date-parts"])==null?void 0:m[0])==null?void 0:x[0]);if(e)return String(e);const r=(y=t.google_books_data)==null?void 0:y.publishedDate;return r?String(r).substring(0,4):null}function Xgt(t){var r,n,s,i,o,l;const e=t.bib_meta;return(e==null?void 0:e.title)||((r=e==null?void 0:e.google_books_data)==null?void 0:r.title)||((s=(n=e==null?void 0:e.crossref_payload)==null?void 0:n.title)==null?void 0:s[0])||((l=(o=(i=e==null?void 0:e.crossref_data)==null?void 0:i.crossref_metadata)==null?void 0:o.title)==null?void 0:l[0])||t.title||"Untitled"}function Qgt(t){var l,c,u,d,h,f;const e=t.bib_meta,r=e==null?void 0:e.crossref_payload,n=(l=e==null?void 0:e.crossref_data)==null?void 0:l.crossref_metadata,s=[],i=(p,g)=>{g&&s.push(`${p} - ${g}`)};i("TY",Ggt(e)),i("TI",Xgt(t));for(const p of Kgt(e))i("AU",p);i("PY",Ygt(e)),i("DO",t.doi||(e==null?void 0:e.doi)||(r==null?void 0:r.DOI)||null),i("SN",t.isbn||(e==null?void 0:e.isbn)||((c=r==null?void 0:r.ISSN)==null?void 0:c[0])||((u=n==null?void 0:n.ISSN)==null?void 0:u[0])||null),i("PB",(e==null?void 0:e.publisher)||((d=e==null?void 0:e.google_books_data)==null?void 0:d.publisher)||(r==null?void 0:r.publisher)||(n==null?void 0:n.publisher)||null),i("JO",(e==null?void 0:e.journal)||((h=r==null?void 0:r["container-title"])==null?void 0:h[0])||((f=n==null?void 0:n["container-title"])==null?void 0:f[0])||null),i("VL",(e==null?void 0:e.volume)||(r==null?void 0:r.volume)||(n==null?void 0:n.volume)||null),i("IS",(e==null?void 0:e.issue)||(r==null?void 0:r.issue)||(n==null?void 0:n.issue)||null);const o=(e==null?void 0:e.pages)||(r==null?void 0:r.page)||(n==null?void 0:n.page);if(o&&typeof o=="string"){const p=o.split(/[-–]/);p[0]&&i("SP",p[0].trim()),p[1]&&i("EP",p[1].trim())}return i("AB",(e==null?void 0:e.abstract)||(r==null?void 0:r.abstract)||null),i("UR",(e==null?void 0:e.url)||(r==null?void 0:r.URL)||null),i("LA",(r==null?void 0:r.language)||null),s.push("ER -"),s.join(`
`)}function F3(t,e="citations.ris"){const r=t.map(Qgt).join(`
`),n=new Blob([r],{type:"application/x-research-info-systems"}),s=URL.createObjectURL(n),i=document.createElement("a");i.href=s,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(s)}function Zgt(t){var n,s,i,o,l;if(!t)return null;const e=t.authors||((n=t.crossref_data)==null?void 0:n.authors)||((s=t.crossref_payload)==null?void 0:s.author)||((o=(i=t.crossref_data)==null?void 0:i.crossref_metadata)==null?void 0:o.author)||((l=t.google_books_data)==null?void 0:l.authors);if(!Array.isArray(e)||e.length===0)return null;const r=c=>typeof c=="string"?c.split(/,\s*/)[0]||c.split(/\s+/).pop()||c:c!=null&&c.family?c.family:String(c);return e.length===1?r(e[0]):e.length===2?`${r(e[0])} & ${r(e[1])}`:`${r(e[0])} et al.`}function Jgt(t){var n,s,i,o,l,c,u,d,h,f,p;if(!t)return null;const e=t.published_year||t.year||((n=t.crossref_data)==null?void 0:n.year)||((c=(l=(o=(i=(s=t.crossref_data)==null?void 0:s.crossref_metadata)==null?void 0:i.issued)==null?void 0:o["date-parts"])==null?void 0:l[0])==null?void 0:c[0])||((f=(h=(d=(u=t.crossref_payload)==null?void 0:u.issued)==null?void 0:d["date-parts"])==null?void 0:h[0])==null?void 0:f[0]);if(e)return String(e);const r=(p=t.google_books_data)==null?void 0:p.publishedDate;return r?String(r).substring(0,4):null}function fM(t){return t?!!(/\.\w{2,4}$/.test(t)||/^[\w-]+$/.test(t)&&t.length<40&&(/\d{3,}/.test(t)||/^[a-z]-\d/i.test(t))):!1}function eyt(t){var n,s,i,o,l,c,u;const e=t.bib_meta,r=[e==null?void 0:e.title,(n=e==null?void 0:e.crossref_data)==null?void 0:n.title,(i=(s=e==null?void 0:e.crossref_data)==null?void 0:s.crossref_metadata)==null?void 0:i.title,(o=e==null?void 0:e.google_books_data)==null?void 0:o.title,(c=(l=e==null?void 0:e.crossref_payload)==null?void 0:l.title)==null?void 0:c[0]];for(const d of r){if(d&&typeof d=="string"&&d.trim()&&!fM(d.trim()))return d.trim();if(Array.isArray(d)&&((u=d[0])!=null&&u.trim()))return d[0].trim()}return t.title&&!fM(t.title)?t.title:t.original_filename&&!fM(t.original_filename)?t.original_filename:t.title||t.original_filename||"Untitled"}function tyt(t){var e,r,n;return t&&(t.pages||((r=(e=t.crossref_data)==null?void 0:e.crossref_metadata)==null?void 0:r.page)||((n=t.crossref_payload)==null?void 0:n.page))||null}function ryt({doc:t,selected:e,onSelectionChange:r}){const[n,s]=S.useState(!1),i=gr(),o=t.bib_meta,l=eyt(t),c=Zgt(o),u=Jgt(o),d=tyt(o),h=t.doi||t.isbn||null,f=t.doi?"DOI":t.isbn?"ISBN":null,p=t.original_filename||null,g=p&&p!==l,m=async()=>{if(!t.citation_apa){$e.error("No APA citation available");return}await navigator.clipboard.writeText(t.citation_apa),s(!0),$e.success("APA citation copied"),setTimeout(()=>s(!1),2e3)},x=()=>{F3([t],`${l.replace(/[^a-zA-Z0-9]/g,"_").substring(0,40)}.ris`),$e.success("RIS file downloaded")};return a.jsxs(Cn,{children:[a.jsx(xt,{className:"w-8",children:a.jsx(xo,{checked:e,onCheckedChange:y=>r(t.id,!!y)})}),a.jsx(xt,{children:a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium text-sm line-clamp-2",children:l}),g&&a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1 mt-0.5",children:[a.jsx(Nr,{className:"w-3 h-3 flex-shrink-0"}),a.jsx("span",{className:"truncate",children:p})]})]})}),a.jsx(xt,{className:"text-muted-foreground text-sm",children:c||"–"}),a.jsx(xt,{className:"text-muted-foreground text-sm",children:u||"–"}),a.jsx(xt,{className:"text-muted-foreground text-sm",children:d||"–"}),a.jsx(xt,{className:"text-muted-foreground text-sm max-w-[180px]",children:h?a.jsxs("span",{className:"truncate block",title:h,children:[f,": ",h]}):"–"}),a.jsx(xt,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-1",children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0",onClick:m,disabled:!t.citation_apa,children:n?a.jsx(yn,{className:"w-4 h-4"}):a.jsx(bn,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:"Copy APA citation"})]}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0",onClick:x,children:a.jsx(mo,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:"Export RIS"})]}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0",onClick:()=>i("/reference-checker"),children:a.jsx(gl,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:"Check with Citation Manager"})]})]})})]})}const tA={title:"",authors:"",publisher:"",published_year:"",isbn:"",doi:"",edition:"",pages:"",language:"",series:"",type:"book"},nyt=()=>{const{user:t,userProfile:e,loading:r}=Pt(),n=gr(),[s]=Dj(),i=s.get("document"),[o,l]=S.useState([]),[c,u]=S.useState(!0),[d,h]=S.useState(""),[f,p]=S.useState("all"),[g,m]=S.useState("newest"),[x,y]=S.useState(new Set),[v,b]=S.useState([]),[w,j]=S.useState(""),[N,C]=S.useState(""),[k,E]=S.useState(""),[M,z]=S.useState(!1),[P,V]=S.useState(null),[A,$]=S.useState(""),[K,G]=S.useState(!1),[Y,H]=S.useState(""),[B,L]=S.useState(!1),[F,W]=S.useState(""),[X,oe]=S.useState(tA),[le,U]=S.useState("manual_entry"),[R,ee]=S.useState(!1),[te,Z]=S.useState(tA),[J,he]=S.useState(!1);S.useEffect(()=>{!t&&!r&&n("/login")},[t,r,n]),S.useEffect(()=>{t&&O()},[t]),S.useEffect(()=>{e!=null&&e.id&&ie()},[e==null?void 0:e.id]),S.useEffect(()=>{if(i&&v.length>0){const fe=v.find(Ee=>Ee.id===i);fe&&(j(i),C(fe.doi||""),E(fe.isbn||""))}},[i,v]);const O=async()=>{if(t){u(!0);try{const{data:fe,error:Ee}=await be.from("v_documents_with_status").select("*").eq("user_id",t.id).or("bib_meta.not.is.null,citation_apa.not.is.null,doi.not.is.null,isbn.not.is.null").order("created_at",{ascending:!1});if(Ee){console.error("Error fetching citations:",Ee);return}l(fe||[])}finally{u(!1)}}},ie=async()=>{try{const{data:fe,error:Ee}=await be.from("documents").select("*").eq("user_id",e==null?void 0:e.id).order("created_at",{ascending:!1});if(Ee)throw Ee;b(fe||[])}catch(fe){console.error("Error loading documents:",fe),$e.error("Error loading documents")}},q=async()=>{var fe;if(!w){$("Please select a document");return}z(!0),$(""),V(null);try{const{data:Ee,error:Ce}=await be.functions.invoke("detect_bibliography",{body:{document_id:w,force:!0,manual_doi:N.trim()||null,manual_isbn:k.trim()||null}});if(Ce)throw Ce;if(Ee!=null&&Ee.error)throw new Error(Ee.error);const{data:Ge,error:ht}=await be.from("documents").select("*").eq("id",w).single();if(ht)throw ht;const Ne=Ge;V({citation_apa:Ne.citation_apa,doi:Ne.doi,isbn:Ne.isbn,bib_meta:Ne.bib_meta,source:((fe=Ne.bib_meta)==null?void 0:fe.method)||"unknown"}),$e.success("Citation updated successfully"),b(Ze=>Ze.map(Ke=>Ke.id===w?Ne:Ke)),O()}catch(Ee){console.error("Reference check error:",Ee);const Ce=Ee.message||"Unknown error";Ce.includes("ISBN")||Ce.includes("isbn")?$("Invalid ISBN or no match found"):Ce.includes("DOI")||Ce.includes("doi")?$("Invalid DOI or no match found"):$(`Error: ${Ce}`)}finally{z(!1)}},I=async()=>{var fe,Ee;if(!Y.trim()){W("Please paste some text first");return}L(!0),W("");try{const{data:Ce,error:Ge}=await be.functions.invoke("parse_bibliography_text",{body:{rawText:Y.trim()}});if(Ge)throw Ge;if(Ce!=null&&Ce.error)throw new Error(Ce.error);const ht=Ce==null?void 0:Ce.data;ht&&(oe({title:ht.title||"",authors:((fe=ht.authors)==null?void 0:fe.join(", "))||"",publisher:ht.publisher||"",published_year:((Ee=ht.published_year)==null?void 0:Ee.toString())||"",isbn:ht.isbn||"",doi:ht.doi||"",edition:ht.edition||"",pages:ht.pages||"",language:ht.language||"",series:ht.series||"",type:ht.type||"book"}),U("parsed_paste"),$e.success("Text successfully parsed!"))}catch(Ce){console.error("Parse error:",Ce),W(Ce.message||"Failed to parse text")}finally{L(!1)}},T=async()=>{if(!w){$e.error("Please select a document first");return}if(!X.title.trim()){$e.error("Title is required");return}ee(!0);try{const fe=X.authors.split(",").map(Xe=>Xe.trim()).filter(Boolean),Ee={title:X.title,authors:fe,publisher:X.publisher||null,published_year:parseInt(X.published_year)||null,edition:X.edition||null,pages:X.pages||null,language:X.language||null,series:X.series||null,type:X.type||"book",method:le},Ce=fe.length?fe.join(", "):"Unknown Author",Ge=X.published_year?`(${X.published_year})`:"(n.d.)",ht=X.publisher?`. ${X.publisher}`:"",Ne=`${Ce} ${Ge}. ${X.title}${ht}.`,{error:Ze}=await be.from("documents").update({bib_meta:Ee,citation_apa:Ne,isbn:X.isbn||null,doi:X.doi||null,title:X.title}).eq("id",w);if(Ze)throw Ze;const{data:Ke}=await be.from("documents").select("*").eq("id",w).single();Ke&&(b(Xe=>Xe.map(Ye=>Ye.id===w?Ke:Ye)),V({citation_apa:Ne,doi:X.doi,isbn:X.isbn,bib_meta:Ee,source:le})),$e.success("Metadata applied successfully!"),oe(tA),H(""),O()}catch(fe){console.error("Apply error:",fe),$e.error("Failed to apply metadata")}finally{ee(!1)}},D=(fe,Ee)=>{oe(Ce=>({...Ce,[fe]:Ee})),U("manual_entry")},ne=(fe,Ee)=>{Z(Ce=>({...Ce,[fe]:Ee}))},ue=async()=>{if(!te.title.trim()){$e.error("Title is required");return}if(t){he(!0);try{const fe=te.authors.split(",").map(Ke=>Ke.trim()).filter(Boolean),Ee={title:te.title,authors:fe,publisher:te.publisher||null,published_year:parseInt(te.published_year)||null,edition:te.edition||null,pages:te.pages||null,language:te.language||null,series:te.series||null,type:te.type||"book",method:"manual_citation"},Ce=fe.length?fe.join(", "):"Unknown Author",Ge=te.published_year?`(${te.published_year})`:"(n.d.)",ht=te.publisher?`. ${te.publisher}`:"",Ne=`${Ce} ${Ge}. ${te.title}${ht}.`,{error:Ze}=await be.from("documents").insert({user_id:t.id,title:te.title,bib_meta:Ee,citation_apa:Ne,isbn:te.isbn||null,doi:te.doi||null,page_count:0});if(Ze)throw Ze;$e.success("Citation source created successfully!"),Z(tA),await ie(),O()}catch(fe){console.error("Error creating citation-only entry:",fe),$e.error("Failed to create citation source")}finally{he(!1)}}},re=async()=>{if(P!=null&&P.citation_apa)try{await navigator.clipboard.writeText(P.citation_apa),G(!0),$e.success("Citation copied to clipboard"),setTimeout(()=>G(!1),2e3)}catch{$e.error("Failed to copy")}},pe=v.find(fe=>fe.id===w),ve=fe=>{var Ce,Ge,ht,Ne,Ze;const Ee=(fe==null?void 0:fe.authors)||((Ce=fe==null?void 0:fe.crossref_data)==null?void 0:Ce.authors)||((Ge=fe==null?void 0:fe.crossref_payload)==null?void 0:Ge.author)||((Ne=(ht=fe==null?void 0:fe.crossref_data)==null?void 0:ht.crossref_metadata)==null?void 0:Ne.author)||((Ze=fe==null?void 0:fe.google_books_data)==null?void 0:Ze.authors)||[];return Array.isArray(Ee)?Ee.map(Ke=>typeof Ke=="string"?Ke:`${(Ke==null?void 0:Ke.family)||""} ${(Ke==null?void 0:Ke.given)||""}`.trim()).join(" "):""},xe=fe=>{var Ge,ht,Ne,Ze,Ke,Xe,Ye;const Ee=fe.bib_meta,Ce=[Ee==null?void 0:Ee.title,(Ge=Ee==null?void 0:Ee.crossref_data)==null?void 0:Ge.title,(Ne=(ht=Ee==null?void 0:Ee.crossref_data)==null?void 0:ht.crossref_metadata)==null?void 0:Ne.title,(Ze=Ee==null?void 0:Ee.google_books_data)==null?void 0:Ze.title,(Xe=(Ke=Ee==null?void 0:Ee.crossref_payload)==null?void 0:Ke.title)==null?void 0:Xe[0]];for(const Ct of Ce){if(Ct&&typeof Ct=="string"&&Ct.trim())return Ct.trim().toLowerCase();if(Array.isArray(Ct)&&((Ye=Ct[0])!=null&&Ye.trim()))return Ct[0].trim().toLowerCase()}return(fe.title||fe.original_filename||"").toLowerCase()},ae=fe=>{var Ge,ht,Ne,Ze,Ke,Xe,Ye,Ct,Ve,mt,Et;if(!fe)return null;const Ee=fe.published_year||fe.year||((Ge=fe.crossref_data)==null?void 0:Ge.year)||((Xe=(Ke=(Ze=(Ne=(ht=fe.crossref_data)==null?void 0:ht.crossref_metadata)==null?void 0:Ne.issued)==null?void 0:Ze["date-parts"])==null?void 0:Ke[0])==null?void 0:Xe[0])||((mt=(Ve=(Ct=(Ye=fe.crossref_payload)==null?void 0:Ye.issued)==null?void 0:Ct["date-parts"])==null?void 0:Ve[0])==null?void 0:mt[0]);if(Ee)return Number(Ee);const Ce=(Et=fe.google_books_data)==null?void 0:Et.publishedDate;return Ce?parseInt(String(Ce).substring(0,4)):null},de=fe=>{var Ee,Ce;return((fe==null?void 0:fe.type)||((Ee=fe==null?void 0:fe.crossref_data)==null?void 0:Ee.type)||((Ce=fe==null?void 0:fe.crossref_payload)==null?void 0:Ce.type)||"").toLowerCase().replace(/-/g," ")},ge=S.useMemo(()=>{const fe=new Set;return o.forEach(Ee=>{const Ce=de(Ee.bib_meta);Ce&&fe.add(Ce)}),Array.from(fe).sort()},[o]),we=S.useMemo(()=>{let fe=o;if(d){const Ee=d.toLowerCase();fe=fe.filter(Ce=>{const Ge=xe(Ce),ht=ve(Ce.bib_meta).toLowerCase(),Ne=(Ce.doi||"").toLowerCase(),Ze=(Ce.isbn||"").toLowerCase();return Ge.includes(Ee)||ht.includes(Ee)||Ne.includes(Ee)||Ze.includes(Ee)})}return f!=="all"&&(fe=fe.filter(Ee=>de(Ee.bib_meta)===f)),fe=[...fe].sort((Ee,Ce)=>{if(g==="newest")return new Date(Ce.created_at).getTime()-new Date(Ee.created_at).getTime();if(g==="alphabetical")return xe(Ee).localeCompare(xe(Ce));const Ge=ae(Ee.bib_meta)||0;return(ae(Ce.bib_meta)||0)-Ge}),fe},[o,d,f,g]),je=(fe,Ee)=>{y(Ce=>{const Ge=new Set(Ce);return Ee?Ge.add(fe):Ge.delete(fe),Ge})},Se=()=>{we.length!==0&&(F3(we,"all-citations.ris"),$e.success(`Exported ${we.length} citations`))},Ue=()=>{const fe=we.filter(Ee=>x.has(Ee.id));if(fe.length===0){$e.error("No citations selected");return}F3(fe,"selected-citations.ris"),$e.success(`Exported ${fe.length} citations`)};if(r||c)return a.jsx(er,{showSidebar:!0,pageTitle:"My Citations",children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})});if(!t)return null;const Ae=(fe,Ee)=>a.jsxs(at,{value:fe,onValueChange:Ee,children:[a.jsx(nt,{className:"mt-1",children:a.jsx(ot,{placeholder:"Select language..."})}),a.jsxs(st,{children:[a.jsx(Te,{value:"German",children:"German"}),a.jsx(Te,{value:"English",children:"English"}),a.jsx(Te,{value:"French",children:"French"}),a.jsx(Te,{value:"Spanish",children:"Spanish"}),a.jsx(Te,{value:"Italian",children:"Italian"}),a.jsx(Te,{value:"Other",children:"Other"})]})]});return a.jsx(er,{showSidebar:!0,pageTitle:"My Citations",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Me,{children:[a.jsxs(qe,{className:"pb-3",children:[a.jsx(Je,{children:"Citation Manager"}),a.jsx(mn,{children:"Verify, enter, or create citation entries for your documents"})]}),a.jsx(Be,{children:a.jsxs(d5,{defaultValue:"check",className:"w-full",children:[a.jsxs(ak,{className:"grid w-full grid-cols-3",children:[a.jsxs(Id,{value:"check",className:"flex items-center gap-2",children:[a.jsx(Js,{className:"w-4 h-4"}),"Document Check"]}),a.jsxs(Id,{value:"manual",className:"flex items-center gap-2",children:[a.jsx(zP,{className:"w-4 h-4"}),"Manual Entry"]}),a.jsxs(Id,{value:"physical",className:"flex items-center gap-2",children:[a.jsx(lz,{className:"w-4 h-4"}),"Add Source"]})]}),a.jsxs(Rd,{value:"check",className:"space-y-6 mt-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"document-select",children:"Document"}),a.jsxs(at,{value:w,onValueChange:j,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select a document..."})}),a.jsx(st,{children:v.map(fe=>a.jsx(Te,{value:fe.id,children:a.jsx("span",{className:"font-medium",children:fe.title||fe.original_filename||"Untitled"})},fe.id))})]})]}),pe&&(()=>{var jS,SS,NS,AS,ES,CS,kS,TS,PS,OS,IS,RS;const fe=pe.bib_meta,Ee=fe==null?void 0:fe.google_books_data,Ce=(fe==null?void 0:fe.crossref_payload)||((jS=fe==null?void 0:fe.crossref_data)==null?void 0:jS.crossref_metadata),Ge=fe==null?void 0:fe.crossref_data,ht=(fe==null?void 0:fe.title)||(Ge==null?void 0:Ge.title)||pe.title||pe.original_filename||"No title",Ne=(fe==null?void 0:fe.type)||(Ce==null?void 0:Ce.type),Ze=((SS=fe==null?void 0:fe.authors)==null?void 0:SS.join(", "))||((NS=Ge==null?void 0:Ge.authors)==null?void 0:NS.join(", "))||((AS=Ee==null?void 0:Ee.authors)==null?void 0:AS.join(", "))||((ES=Ce==null?void 0:Ce.author)==null?void 0:ES.map(jl=>`${jl.family}, ${jl.given}`).join("; ")),Ke=(fe==null?void 0:fe.publisher)||(Ge==null?void 0:Ge.publisher)||(Ee==null?void 0:Ee.publisher)||(Ce==null?void 0:Ce.publisher),Xe=(fe==null?void 0:fe.published_year)||(Ge==null?void 0:Ge.year)||((CS=Ee==null?void 0:Ee.publishedDate)==null?void 0:CS.substring(0,4))||((PS=(TS=(kS=Ce==null?void 0:Ce.issued)==null?void 0:kS["date-parts"])==null?void 0:TS[0])==null?void 0:PS[0]),Ye=fe==null?void 0:fe.edition,Ct=(fe==null?void 0:fe.pages)||(Ge==null?void 0:Ge.pages)||(Ee==null?void 0:Ee.pageCount)||(Ce==null?void 0:Ce.page),Ve=(fe==null?void 0:fe.language)||(Ee==null?void 0:Ee.language),mt=fe==null?void 0:fe.series,Et=pe.isbn||(fe==null?void 0:fe.isbn)||((IS=(OS=Ee==null?void 0:Ee.industryIdentifiers)==null?void 0:OS.find(jl=>jl.type==="ISBN_13"))==null?void 0:IS.identifier),Fs=pe.doi||(fe==null?void 0:fe.doi)||(Ge==null?void 0:Ge.doi),rs=fe==null?void 0:fe.method,ra=rs==="manual_entry"?"Manual Entry":rs==="parsed_paste"?"Parsed Paste":rs==="manual_input"?"Manual Input":rs||null,$a=(Ge==null?void 0:Ge.journal)||((RS=Ce==null?void 0:Ce["container-title"])==null?void 0:RS[0]),$s=(Ge==null?void 0:Ge.volume)||(Ce==null?void 0:Ce.volume),na=(Ge==null?void 0:Ge.issue)||(Ce==null?void 0:Ce.issue),lP=[{label:"Title",value:ht},Ne&&{label:"Type",value:Ne.charAt(0).toUpperCase()+Ne.slice(1)},Ze&&{label:"Author(s)",value:Ze},Ke&&{label:"Publisher",value:Ke},Xe&&{label:"Published",value:String(Xe)},Ye&&{label:"Edition",value:Ye},$a&&{label:"Journal",value:$a},$s&&{label:"Volume",value:`${$s}${na?` (${na})`:""}`},Ct&&{label:"Pages",value:String(Ct)},Ve&&{label:"Language",value:Ve.charAt(0).toUpperCase()+Ve.slice(1)},mt&&{label:"Series",value:mt},Et&&{label:"ISBN",value:Et},Fs&&{label:"DOI",value:Fs},ra&&{label:"Source",value:ra}].filter(Boolean);return a.jsxs("div",{className:"p-4 bg-muted/50 rounded-xl border border-border/50",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-sm font-semibold",children:"Current Status"}),a.jsx("div",{children:pe.citation_apa?a.jsxs(gt,{className:"bg-success/20 text-success hover:bg-success/30",children:[a.jsx(yn,{className:"w-3 h-3 mr-1"}),"Citation Available"]}):a.jsxs(gt,{variant:"destructive",className:"bg-destructive/20 text-destructive hover:bg-destructive/30",children:[a.jsx(En,{className:"w-3 h-3 mr-1"}),"Citation Missing"]})})]}),a.jsx("div",{className:"grid grid-cols-[auto_1fr] gap-x-6 gap-y-1.5",children:lP.map(jl=>a.jsxs("div",{className:"contents",children:[a.jsxs("span",{className:"text-xs text-muted-foreground py-0.5",children:[jl.label,":"]}),a.jsx("span",{className:"text-sm font-medium py-0.5 break-words",children:jl.value})]},jl.label))})]})})(),a.jsxs("div",{className:"pt-4 border-t border-border/50",children:[a.jsx(_e,{className:"text-sm font-medium mb-3 block",children:"Manual Override (Optional)"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"doi",className:"text-xs text-muted-foreground",children:"DOI"}),a.jsx(Fe,{id:"doi",value:N,onChange:fe=>C(fe.target.value),placeholder:"10.1000/example",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"isbn",className:"text-xs text-muted-foreground",children:"ISBN"}),a.jsx(Fe,{id:"isbn",value:k,onChange:fe=>E(fe.target.value),placeholder:"978-3-16-148410-0",className:"mt-1"})]})]})]}),a.jsx(ye,{onClick:q,disabled:M||!w,className:"w-full",size:"lg",children:M?a.jsxs(a.Fragment,{children:[a.jsx(Xs,{className:"w-4 h-4 mr-2 animate-spin"}),"Checking document..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ll,{className:"w-4 h-4 mr-2"}),"Check Document"]})}),A&&a.jsxs("div",{className:"flex items-center gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg",children:[a.jsx(Ww,{className:"w-4 h-4 text-destructive shrink-0"}),a.jsx("span",{className:"text-sm text-destructive",children:A})]})]}),a.jsxs(Rd,{value:"manual",className:"space-y-4 mt-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"manual-document-select",children:"Target Document"}),a.jsxs(at,{value:w,onValueChange:j,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select a document to apply data..."})}),a.jsx(st,{children:v.map(fe=>a.jsx(Te,{value:fe.id,children:a.jsx("span",{className:"font-medium",children:fe.title||fe.original_filename||"Untitled"})},fe.id))})]}),!w&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Select a document to apply bibliographic data"})]}),a.jsxs(d5,{defaultValue:"quick-paste",className:"w-full",children:[a.jsxs(ak,{className:"grid w-full grid-cols-2",children:[a.jsxs(Id,{value:"quick-paste",className:"flex items-center gap-2",children:[a.jsx(zP,{className:"w-4 h-4"}),"Quick Paste"]}),a.jsxs(Id,{value:"manual-fields",className:"flex items-center gap-2",children:[a.jsx(hbe,{className:"w-4 h-4"}),"Manual Fields"]})]}),a.jsxs(Rd,{value:"quick-paste",className:"space-y-4 mt-4",children:[a.jsxs("div",{children:[a.jsx(_e,{children:"Paste Raw Text"}),a.jsx(Ht,{value:Y,onChange:fe=>H(fe.target.value),placeholder:"Paste bibliographic data from Amazon, Google Books, library catalogs, etc...",className:"min-h-[120px] mt-1"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Example: ISBN978-3-411-87151-3VerlagDuden..."})]}),a.jsx(ye,{onClick:I,disabled:B||!Y.trim(),className:"w-full",children:B?a.jsxs(a.Fragment,{children:[a.jsx(Xs,{className:"w-4 h-4 mr-2 animate-spin"}),"Parsing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(zP,{className:"w-4 h-4 mr-2"}),"Parse Text"]})}),F&&a.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-lg",children:[a.jsx(Ww,{className:"w-4 h-4 text-destructive shrink-0"}),a.jsx("span",{className:"text-sm text-destructive",children:F})]}),(X.title||X.authors||X.publisher)&&a.jsxs("div",{className:"p-4 bg-muted/50 rounded-xl border border-border/50 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(yn,{className:"w-4 h-4 text-success"}),a.jsx("span",{className:"text-sm font-medium",children:"Parsed Result (editable)"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Title *"}),a.jsx(Fe,{value:X.title,onChange:fe=>D("title",fe.target.value),placeholder:"Enter title...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Authors (comma-separated)"}),a.jsx(Fe,{value:X.authors,onChange:fe=>D("authors",fe.target.value),placeholder:"Author 1, Author 2...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Publisher"}),a.jsx(Fe,{value:X.publisher,onChange:fe=>D("publisher",fe.target.value),className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Year"}),a.jsx(Fe,{value:X.published_year,onChange:fe=>D("published_year",fe.target.value),placeholder:"2023",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"ISBN"}),a.jsx(Fe,{value:X.isbn,onChange:fe=>D("isbn",fe.target.value),className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"DOI"}),a.jsx(Fe,{value:X.doi,onChange:fe=>D("doi",fe.target.value),className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Edition"}),a.jsx(Fe,{value:X.edition,onChange:fe=>D("edition",fe.target.value),className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Pages"}),a.jsx(Fe,{value:X.pages,onChange:fe=>D("pages",fe.target.value),className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Language"}),Ae(X.language,fe=>D("language",fe))]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Series"}),a.jsx(Fe,{value:X.series,onChange:fe=>D("series",fe.target.value),className:"mt-1"})]})]}),a.jsx(ye,{onClick:T,disabled:R||!w||!X.title.trim(),className:"w-full mt-4",children:R?a.jsxs(a.Fragment,{children:[a.jsx(Xs,{className:"w-4 h-4 mr-2 animate-spin"}),"Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx(yn,{className:"w-4 h-4 mr-2"}),"Apply to Document"]})})]})]}),a.jsxs(Rd,{value:"manual-fields",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(_e,{children:"Title *"}),a.jsx(Fe,{value:X.title,onChange:fe=>D("title",fe.target.value),placeholder:"Book or article title...",className:"mt-1"})]}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(_e,{children:"Authors (comma-separated)"}),a.jsx(Fe,{value:X.authors,onChange:fe=>D("authors",fe.target.value),placeholder:"Last, First; Last, First...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Publisher"}),a.jsx(Fe,{value:X.publisher,onChange:fe=>D("publisher",fe.target.value),placeholder:"Publisher name...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Year"}),a.jsx(Fe,{value:X.published_year,onChange:fe=>D("published_year",fe.target.value),placeholder:"2023",type:"number",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"ISBN"}),a.jsx(Fe,{value:X.isbn,onChange:fe=>D("isbn",fe.target.value),placeholder:"978-3-16-148410-0",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"DOI"}),a.jsx(Fe,{value:X.doi,onChange:fe=>D("doi",fe.target.value),placeholder:"10.1000/example",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Edition"}),a.jsx(Fe,{value:X.edition,onChange:fe=>D("edition",fe.target.value),placeholder:"4th edition",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Pages"}),a.jsx(Fe,{value:X.pages,onChange:fe=>D("pages",fe.target.value),placeholder:"136",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Language"}),Ae(X.language,fe=>D("language",fe))]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Series"}),a.jsx(Fe,{value:X.series,onChange:fe=>D("series",fe.target.value),placeholder:"Book series name...",className:"mt-1"})]})]}),a.jsx(ye,{onClick:T,disabled:R||!w||!X.title.trim(),className:"w-full",size:"lg",children:R?a.jsxs(a.Fragment,{children:[a.jsx(Xs,{className:"w-4 h-4 mr-2 animate-spin"}),"Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx(yn,{className:"w-4 h-4 mr-2"}),"Apply to Document"]})})]})]})]}),a.jsxs(Rd,{value:"physical",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(_e,{children:"Title *"}),a.jsx(Fe,{value:te.title,onChange:fe=>ne("title",fe.target.value),placeholder:"Book or article title...",className:"mt-1"})]}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(_e,{children:"Authors (comma-separated)"}),a.jsx(Fe,{value:te.authors,onChange:fe=>ne("authors",fe.target.value),placeholder:"Last, First; Last, First...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Publisher"}),a.jsx(Fe,{value:te.publisher,onChange:fe=>ne("publisher",fe.target.value),placeholder:"Publisher name...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Year"}),a.jsx(Fe,{value:te.published_year,onChange:fe=>ne("published_year",fe.target.value),placeholder:"2023",type:"number",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"ISBN"}),a.jsx(Fe,{value:te.isbn,onChange:fe=>ne("isbn",fe.target.value),placeholder:"978-3-16-148410-0",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"DOI"}),a.jsx(Fe,{value:te.doi,onChange:fe=>ne("doi",fe.target.value),placeholder:"10.1000/example",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Edition"}),a.jsx(Fe,{value:te.edition,onChange:fe=>ne("edition",fe.target.value),placeholder:"4th edition",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Pages"}),a.jsx(Fe,{value:te.pages,onChange:fe=>ne("pages",fe.target.value),placeholder:"136",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Language"}),Ae(te.language,fe=>ne("language",fe))]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Series"}),a.jsx(Fe,{value:te.series,onChange:fe=>ne("series",fe.target.value),placeholder:"Book series name...",className:"mt-1"})]})]}),a.jsx(ye,{onClick:ue,disabled:J||!te.title.trim(),className:"w-full",size:"lg",children:J?a.jsxs(a.Fragment,{children:[a.jsx(Xs,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(lz,{className:"w-4 h-4 mr-2"}),"Create Source Entry"]})})]})]})})]}),P&&a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(yn,{className:"w-5 h-5 text-success"}),"Result"]}),a.jsx(mn,{children:"Citation has been successfully updated"})]}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(_e,{className:"text-base font-semibold",children:"APA Citation"}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:re,disabled:!P.citation_apa,children:[a.jsx(bn,{className:"w-4 h-4 mr-2"}),K?"Copied!":"Copy"]})]}),a.jsx("div",{className:"p-4 bg-muted rounded-lg",children:a.jsx("p",{className:"text-sm leading-relaxed font-medium",children:P.citation_apa||"No citation available"})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"text-sm",children:"Source"}),a.jsx("div",{className:"mt-1",children:a.jsx(gt,{variant:"secondary",children:P.source==="pdf_metadata_and_text_analysis"?"PDF Analysis":P.source==="google_books"?"Google Books":P.source==="open_library"?"Open Library":P.source==="crossref"?"CrossRef":P.source==="parsed_paste"?"Parsed Paste":P.source==="manual_entry"?"Manual Entry":P.source||"Unknown"})})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-sm",children:"DOI"}),a.jsx("p",{className:"text-sm mt-1",children:P.doi||"–"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-sm",children:"ISBN"}),a.jsx("p",{className:"text-sm mt-1",children:P.isbn||"–"})]})]}),P.bib_meta&&a.jsxs(TB,{children:[a.jsx(PB,{asChild:!0,children:a.jsxs(ye,{variant:"ghost",size:"sm",className:"w-full justify-between",children:[a.jsx("span",{children:"Show Raw JSON Metadata"}),a.jsx(vc,{className:"w-4 h-4"})]})}),a.jsx(OB,{children:a.jsx("div",{className:"mt-2 p-4 bg-muted rounded-lg",children:a.jsx("pre",{className:"text-xs overflow-auto max-h-64",children:JSON.stringify(P.bib_meta,null,2)})})})]})]})]}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"My Citations"}),a.jsx("p",{className:"text-muted-foreground",children:"Manage bibliographic data from your library documents"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row flex-wrap gap-3",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(ll,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),a.jsx(Fe,{placeholder:"Search title, author, DOI, ISBN…",value:d,onChange:fe=>h(fe.target.value),className:"pl-9"})]}),a.jsxs(at,{value:f,onValueChange:p,children:[a.jsx(nt,{className:"w-[160px]",children:a.jsx(ot,{placeholder:"All types"})}),a.jsxs(st,{children:[a.jsx(Te,{value:"all",children:"All types"}),ge.map(fe=>a.jsx(Te,{value:fe,className:"capitalize",children:fe},fe))]})]}),a.jsxs(at,{value:g,onValueChange:fe=>m(fe),children:[a.jsx(nt,{className:"w-[150px]",children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"newest",children:"Newest first"}),a.jsx(Te,{value:"alphabetical",children:"A → Z"}),a.jsx(Te,{value:"year",children:"Year (desc)"})]})]}),a.jsxs("div",{className:"flex gap-2 ml-auto",children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsxs(ye,{variant:"outline",size:"sm",onClick:Se,disabled:we.length===0,children:[a.jsx(mo,{className:"w-4 h-4 mr-1"}),"Export all"]})}),a.jsxs(Vt,{className:"flex items-start gap-1.5 max-w-[220px]",children:[a.jsx(Wm,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),a.jsx("span",{children:"In Zotero: File → Import → select the .ris file"})]})]}),a.jsxs(ye,{variant:"outline",size:"sm",onClick:Ue,disabled:x.size===0,children:[a.jsx(mo,{className:"w-4 h-4 mr-1"}),"Export selected (",x.size,")"]})]})]}),we.length===0?a.jsxs("div",{className:"min-h-[40vh] flex flex-col items-center justify-center text-center",children:[a.jsx(Nr,{className:"w-12 h-12 text-muted-foreground/40 mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-foreground mb-1",children:"No citations yet"}),a.jsx("p",{className:"text-muted-foreground text-sm max-w-md",children:"Upload documents to your library first. Bibliographic metadata will be extracted automatically."})]}):a.jsxs(vl,{children:[a.jsx(bl,{children:a.jsxs(Cn,{children:[a.jsx(yt,{className:"w-8"}),a.jsx(yt,{children:"Title"}),a.jsx(yt,{children:"Author(s)"}),a.jsx(yt,{children:"Year"}),a.jsx(yt,{children:"Pages"}),a.jsx(yt,{children:"DOI / ISBN"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(wl,{children:we.map(fe=>a.jsx(ryt,{doc:fe,selected:x.has(fe.id),onSelectionChange:je},fe.id))})]})]})})};function rA({isLoading:t=!1,size:e=40}){return a.jsxs("div",{className:"relative flex-shrink-0",style:{width:e,height:e},children:[t&&a.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-transparent border-t-purple-500 animate-spin",style:{width:e,height:e}}),a.jsx("img",{src:"https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/Logo_ST_small_supervisor.png",alt:"Thesis Supervisor",className:"rounded-full object-cover",style:{width:e,height:e}})]})}const syt=P6,iyt=O6,ayt=I6,vme=S.forwardRef(({className:t,...e},r)=>a.jsx(Vj,{className:Ie("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:r}));vme.displayName=Vj.displayName;const oyt=od("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),bme=S.forwardRef(({side:t="right",className:e,children:r,...n},s)=>a.jsxs(ayt,{children:[a.jsx(vme,{}),a.jsxs(qj,{ref:s,className:Ie(oyt({side:t}),e),...n,children:[r,a.jsxs(IT,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[a.jsx(En,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));bme.displayName=qj.displayName;const wme=S.forwardRef(({className:t,...e},r)=>a.jsx(Gj,{ref:r,className:Ie("text-lg font-semibold text-foreground",t),...e}));wme.displayName=Gj.displayName;const lyt=S.forwardRef(({className:t,...e},r)=>a.jsx(Kj,{ref:r,className:Ie("text-sm text-muted-foreground",t),...e}));lyt.displayName=Kj.displayName;const pM=768;function cyt(){const[t,e]=S.useState(void 0);return S.useEffect(()=>{const r=window.matchMedia(`(max-width: ${pM-1}px)`),n=()=>{e(window.innerWidth<pM)};return r.addEventListener("change",n),e(window.innerWidth<pM),()=>r.removeEventListener("change",n)},[]),!!t}const uyt=["How well am I answering my research questions?","What is still missing in my thesis?","Can you review my discussion?"];function dyt(){var V;const{user:t}=Pt(),e=cyt(),[r,n]=S.useState([]),[s,i]=S.useState(""),[o,l]=S.useState([]),[c,u]=S.useState(null),[d,h]=S.useState([]),[f,p]=S.useState(""),[g,m]=S.useState(!1),[x,y]=S.useState(!1),v=S.useRef(null),[b,w]=S.useState(null),j=S.useRef(null);S.useEffect(()=>{if(!t)return;(async()=>{const{data:$}=await be.from("theses").select("id, title").order("created_at",{ascending:!1});$&&$.length>0&&(n($),i($[0].id))})()},[t]),S.useEffect(()=>{if(!s)return;(async()=>{const{data:$}=await be.from("supervisor_chats").select("id, title, messages, created_at, updated_at").eq("thesis_id",s).order("updated_at",{ascending:!1});l($||[]),u(null),h([])})()},[s]),S.useEffect(()=>{var A;(A=v.current)==null||A.scrollIntoView({behavior:"smooth"})},[d]);const N=A=>{u(A.id),h(A.messages||[]),y(!1)},C=()=>{u(null),h([]),p(""),y(!1)},k=S.useCallback(async A=>{if(!A.trim()||!s||!t||g)return;const $={role:"user",content:A.trim(),timestamp:new Date().toISOString()},K=[...d,$];h(K),p(""),m(!0);try{const{data:G,error:Y}=await be.functions.invoke("supervisor_chat",{body:{thesis_id:s,message:$.content,chat_history:d.map(L=>({role:L.role,content:L.content})),language:"en",attachment:b??null}});if(Y)throw Y;w(null);const H={role:"assistant",content:(G==null?void 0:G.message)||"Keine Antwort erhalten.",timestamp:new Date().toISOString()},B=[...K,H];if(h(B),c)await be.from("supervisor_chats").update({messages:B,updated_at:new Date().toISOString()}).eq("id",c),l(L=>L.map(F=>F.id===c?{...F,messages:B,updated_at:new Date().toISOString()}:F));else{const L=$.content.substring(0,50),{data:F}=await be.from("supervisor_chats").insert({user_id:t.id,thesis_id:s,title:L,messages:B}).select("id").single();F&&(u(F.id),l(W=>[{id:F.id,title:L,messages:B,created_at:new Date().toISOString(),updated_at:new Date().toISOString()},...W]))}}catch(G){$e.error("Fehler: "+(G.message||"Unbekannter Fehler"))}finally{m(!1)}},[d,s,t,g,c]),E=A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),k(f))},M=async A=>{var G;const $=(G=A.target.files)==null?void 0:G[0];if(!$)return;if($.size>10*1024*1024){$e.error("Datei zu groß – maximum 10MB");return}const K=new FileReader;K.onload=()=>{const Y=K.result.split(",")[1];w({name:$.name,base64:Y,type:$.type}),$e.success(`${$.name} attached`)},K.readAsDataURL($)},z=a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-muted-foreground mb-1.5 block",children:"Thesis"}),a.jsxs(at,{value:s,onValueChange:i,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select thesis…"})}),a.jsx(st,{children:r.map(A=>a.jsx(Te,{value:A.id,children:A.title},A.id))})]})]}),a.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[a.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Vergangene Chats"}),a.jsx(Yj,{className:"flex-1",children:a.jsxs("div",{className:"space-y-1",children:[o.map(A=>a.jsxs("button",{onClick:()=>N(A),className:`w-full text-left px-3 py-2 rounded-lg text-sm transition-colors flex items-center gap-2 ${c===A.id?"bg-primary/10 text-primary":"hover:bg-muted text-foreground"}`,children:[a.jsx(Vm,{className:"w-3.5 h-3.5 flex-shrink-0 opacity-50"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-xs font-medium leading-tight",children:A.title||"Untitled"}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:t1(new Date(A.updated_at),"dd.MM. HH:mm")})]})]},A.id)),o.length===0&&s&&a.jsx("p",{className:"text-sm text-muted-foreground px-3 py-4",children:"Noch keine Chats."})]})})]}),a.jsxs(ye,{variant:"outline",className:"w-full",onClick:C,children:[a.jsx(sl,{className:"w-4 h-4 mr-2"})," New Chat"]})]}),P=A=>{if(!(A.includes("✓")||A.includes("✗")||A.includes("→")))return a.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none
[&>*:first-child]:mt-0 [&>*:last-child]:mb-0
[&>p]:mb-3 [&>p]:leading-relaxed
[&>p>strong]:block [&>p>strong]:mt-4 [&>p>strong]:mb-1 [&>p>strong]:text-sm
[&>ul]:mt-1 [&>ul]:mb-3 [&>ul]:space-y-1.5
[&>li]:leading-relaxed`,children:a.jsx(fc,{components:{p:({children:F,...W})=>{var le;const X=Array.isArray(F)?F:[F];return X.length===1&&typeof X[0]=="object"&&((le=X[0])==null?void 0:le.type)==="strong"?a.jsx("p",{className:"font-semibold text-sm mt-5 mb-1.5",...W,children:F}):a.jsx("p",{className:"mb-2.5 leading-relaxed",...W,children:F})},a:({href:F,children:W})=>a.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-80 transition-opacity",children:W}),hr:()=>null},children:A})});const K=[],G=A.split(`
`);let Y={type:"",lines:[]};const H=[];let B=!1;for(const F of G)F.startsWith("✓")||F.includes("Was gut ist")?(Y.lines.length&&K.push(Y),Y={type:"good",lines:[F.replace(/^✓\s*\*?\*?Was gut ist\*?\*?:?\s*/i,"").replace(/^✓\s*/,"")]},B=!0):F.startsWith("✗")||F.includes("Was verbessert")?(Y.lines.length&&K.push(Y),Y={type:"improve",lines:[F.replace(/^✗\s*\*?\*?Was verbessert werden muss\*?\*?:?\s*/i,"").replace(/^✗\s*/,"")]},B=!0):F.startsWith("→")||F.includes("Nächster")?(Y.lines.length&&K.push(Y),Y={type:"next",lines:[F.replace(/^→\s*\*?\*?Nächster konkreter Schritt\*?\*?:?\s*/i,"").replace(/^→\s*/,"")]},B=!0):B?Y.lines.push(F):H.push(F);Y.lines.length&&K.push(Y);const L={good:{label:"What is good",icon:"✓",bg:"bg-emerald-50 dark:bg-emerald-950/30",border:"border-emerald-200 dark:border-emerald-800",iconColor:"text-emerald-600 dark:text-emerald-400",labelColor:"text-emerald-700 dark:text-emerald-300"},improve:{label:"What needs to be improved",icon:"✗",bg:"bg-red-50 dark:bg-red-950/30",border:"border-red-200 dark:border-red-800",iconColor:"text-red-500 dark:text-red-400",labelColor:"text-red-700 dark:text-red-300"},next:{label:"Next concrete step",icon:"→",bg:"bg-blue-50 dark:bg-blue-950/30",border:"border-blue-200 dark:border-blue-800",iconColor:"text-blue-500 dark:text-blue-400",labelColor:"text-blue-700 dark:text-blue-300"}};return a.jsxs("div",{className:"space-y-1",children:[H.join(`
`).trim()&&a.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none mb-3 [&>p]:mb-2 [&>p]:leading-relaxed",children:a.jsx(fc,{children:H.join(`
`)})}),K.map((F,W)=>{const X=L[F.type];return X?a.jsxs("div",{className:`rounded-xl border px-4 py-3 ${X.bg} ${X.border}`,children:[a.jsxs("div",{className:`flex items-center gap-1.5 font-semibold text-xs mb-2 ${X.labelColor}`,children:[a.jsx("span",{className:X.iconColor,children:X.icon}),X.label]}),a.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&>p]:mb-2 [&>p]:leading-relaxed [&>p]:text-foreground [&>ul]:space-y-1 [&>li]:leading-relaxed [&>li]:text-foreground",children:a.jsx(fc,{children:F.lines.join(`
`).trim()})})]},W):null})]})};return a.jsx(er,{showSidebar:!0,pageTitle:"Supervisor",fullWidth:!0,hidePlatformAssistant:!0,children:a.jsxs("div",{className:"flex h-[calc(100vh-4rem)] -m-4 md:-m-6 xl:-m-8",children:[a.jsx("div",{className:"hidden md:flex w-[280px] flex-shrink-0 flex-col gap-4 border-r border-border px-4 pt-6 pb-4",children:z}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0 px-4 md:px-6 pt-4 md:pt-6",children:[a.jsxs("div",{className:"flex items-center gap-3 pb-4 border-b border-border mb-4",children:[e&&a.jsxs(syt,{open:x,onOpenChange:y,children:[a.jsx(iyt,{asChild:!0,children:a.jsx(ye,{variant:"ghost",size:"icon",className:"flex-shrink-0",children:a.jsx(BF,{className:"w-5 h-5"})})}),a.jsxs(bme,{side:"left",className:"w-[280px] p-4 flex flex-col gap-4",children:[a.jsx(wme,{className:"sr-only",children:"Chat History"}),z]})]}),a.jsx(rA,{isLoading:!1}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Thesis Supervisor"}),a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:e&&s?((V=r.find(A=>A.id===s))==null?void 0:V.title)||"AI-powered feedback":"AI-powered feedback on your work"})]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 pb-4",children:[d.length===0&&!g&&a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-6",children:[a.jsx(rA,{size:64}),a.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:"Ask me questions about your thesis — I'll give you feedback like a supervisor.."}),a.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:uyt.map(A=>a.jsx("button",{onClick:()=>k(A),className:"px-4 py-2 rounded-full border border-border text-sm text-foreground hover:bg-muted transition-colors",children:A},A))})]}),d.map((A,$)=>a.jsxs("div",{className:`flex gap-3 ${A.role==="user"?"justify-end":"justify-start"}`,children:[A.role==="assistant"&&a.jsx(rA,{size:32}),a.jsx("div",{className:`max-w-[85%] md:max-w-[75%] rounded-2xl px-4 text-sm ${A.role==="user"?"bg-purple-600 text-white rounded-br-md py-3":"bg-muted text-foreground rounded-bl-md shadow-sm py-4"}`,children:A.role==="assistant"?P(A.content):a.jsx("p",{className:"whitespace-pre-wrap",children:A.content})})]},$)),g&&a.jsxs("div",{className:"flex gap-3 justify-start",children:[a.jsx(rA,{size:32,isLoading:!0}),a.jsx("div",{className:"bg-muted rounded-2xl rounded-bl-md px-4 py-3",children:a.jsxs("div",{className:"flex gap-1",children:[a.jsx("span",{className:"w-2 h-2 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:0ms]"}),a.jsx("span",{className:"w-2 h-2 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:150ms]"}),a.jsx("span",{className:"w-2 h-2 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:300ms]"})]})})]}),a.jsx("div",{ref:v})]}),a.jsxs("div",{className:"border-t border-border pt-4 pb-4 flex flex-col gap-2",children:[b&&a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted rounded-lg text-xs text-muted-foreground w-fit",children:[a.jsxs("span",{children:["📎 ",b.name]}),a.jsx("button",{onClick:()=>w(null),className:"hover:text-foreground",children:"✕"})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("input",{ref:j,type:"file",accept:".pdf,.txt,.docx",className:"hidden",onChange:M}),a.jsx(ye,{variant:"outline",size:"icon",className:"h-[60px] w-[60px] flex-shrink-0",onClick:()=>{var A;return(A=j.current)==null?void 0:A.click()},disabled:g,children:a.jsx(ube,{className:"w-5 h-5"})}),a.jsx(Ht,{value:f,onChange:A=>p(A.target.value),onKeyDown:E,placeholder:e?"Ask a question...":"Ask a question… (Enter to send, Shift+Enter for new line)",className:"min-h-[60px] max-h-[160px] resize-none",disabled:g||!s}),a.jsx(ye,{onClick:()=>k(f),disabled:g||!f.trim()||!s,size:"icon",className:"h-[60px] w-[60px] flex-shrink-0",children:a.jsx(UF,{className:"w-5 h-5"})})]})]})]})]})})}function hyt(){return a.jsx(er,{showSidebar:!0,children:a.jsx("div",{className:"container mx-auto p-6 max-w-7xl",children:a.jsx(V_e,{})})})}function fyt(){const{user:t,checkStudentPoints:e,studentPoints:r}=Pt(),[n,s]=S.useState(!1),{toast:i}=on(),[o,l]=S.useState(""),[c,u]=S.useState(""),[d,h]=S.useState(""),[f,p]=S.useState("bachelor"),[g,m]=S.useState(""),[x,y]=S.useState("de"),[v,b]=S.useState(null),[w,j]=S.useState(!1),[N,C]=S.useState("both"),[k,E]=S.useState([]),[M,z]=S.useState("");S.useEffect(()=>{(async()=>{if(!(t!=null&&t.id))return;const{data:K,error:G}=await be.from("summaries").select("id, summary_text").eq("user_id",t.id).eq("summary_mode","topic_explorer").order("created_at",{ascending:!1});if(G){console.error("Error loading topic explorer entries:",G);return}const Y=(K||[]).map(H=>{try{const B=JSON.parse(H.summary_text||"{}");return{id:H.id,title:B.title||"Unbenannt",data:B}}catch(B){return console.error("Failed to parse topic explorer entry:",B),null}}).filter(Boolean);E(Y)})()},[t==null?void 0:t.id]);const P=()=>{var Y;const $=k.find(H=>H.id===M);if(!$)return;const{data:K}=$;l(K.title||""),u(K.objectives||"");const G=((Y=K.original_selection)==null?void 0:Y.researchQuestions)||[];h(G.join(`
`)),i({title:"Topic adopted",description:"Working title, objectives, and research questions have been completed"})},V=async()=>{if(!e()){s(!0);return}if(!o.trim()){i({title:"Enter Work Title",variant:"destructive"});return}j(!0);try{const $=d.split(`
`).filter(Y=>Y.trim()),{data:K,error:G}=await be.functions.invoke("research_setup_builder",{body:{title:o.trim(),aim:c.trim(),questions:$,degree:f,discipline:g.trim(),language:x}});if(G)throw G;b(K),i({title:"Research setup successfully generated",description:K.summary_id?"Saved to library":void 0})}catch($){console.error("Research setup error:",$),i({title:"Error during transfer",variant:"destructive"})}j(!1)},A=async $=>{if(!v)return;const K=v.codebook,G=v.meta??{};if(!K||!K.categories||!K.categories.length){i({title:"No coding sheet generated",variant:"destructive"});return}let Y=K.categories;if($!=="both"&&(Y=Y.filter(H=>H.source===$)),!Y.length){i({title:`No categories found for source "${$}"`,variant:"destructive"});return}try{const{data:H,error:B}=await be.from("codebooks").insert({title:G.title?`Coding sheet – ${G.title}`:"Coding sheet",description:G.aim??null,degree:G.degree??null,discipline:G.discipline??null,language:G.language??null,user_id:t==null?void 0:t.id}).select().single();if(B)throw B;const L=Y.map((W,X)=>({codebook_id:H.id,name:W.name||"Category",definition:W.definition||"",coding_rule:W.coding_rule||"",anchor_example:W.anchor_example||"",order_index:Number.isFinite(W.order_index)?W.order_index:X})),{error:F}=await be.from("codebook_categories").insert(L);if(F)throw F;i({title:`Coding sheet (${$}) adopted`})}catch(H){console.error(H),i({title:"Error during transfer",variant:"destructive"})}};return a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Research Design Setup"})}),a.jsxs(Be,{className:"space-y-4",children:[k.length>0&&a.jsxs("div",{className:"p-4 border rounded-lg space-y-3 bg-inherit",children:[a.jsx(_e,{className:"text-sm font-semibold",children:"Take from Topic Explorer"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(at,{value:M,onValueChange:z,children:[a.jsx(nt,{className:"flex-1",children:a.jsx(ot,{placeholder:"Select a topic..."})}),a.jsx(st,{children:k.map($=>a.jsx(Te,{value:$.id,children:$.title},$.id))})]}),a.jsx(ye,{onClick:P,disabled:!M,variant:"secondary",children:"Import topic"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"title",children:"Working title"}),a.jsx(Fe,{id:"title",value:o,onChange:$=>l($.target.value),placeholder:"Title of the research paper"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"discipline",children:"Discipline"}),a.jsx(Fe,{id:"discipline",value:g,onChange:$=>m($.target.value),placeholder:"e.g., Sociology, Psychology"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Degree"}),a.jsxs(at,{value:f,onValueChange:p,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"bachelor",children:"Bachelor"}),a.jsx(Te,{value:"master",children:"Master"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(at,{value:x,onValueChange:y,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"de",children:"Deutsch"}),a.jsx(Te,{value:"en",children:"English"})]})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"aim",children:"Objectives"}),a.jsx(Ht,{id:"aim",value:c,onChange:$=>u($.target.value),rows:3,placeholder:"Description of research objectives"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"questions",children:"Existing research questions (one per line)"}),a.jsx(Ht,{id:"questions",value:d,onChange:$=>h($.target.value),rows:4,placeholder:"Research Question 1 Research Question 2 ... "})]}),a.jsx("div",{className:"flex gap-4",children:a.jsxs(ye,{onClick:V,disabled:w,children:[w&&a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Generate Research Setup"]})}),v&&a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Add as Codebook"})}),a.jsxs(Be,{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Source"}),a.jsxs(at,{value:N,onValueChange:$=>C($),children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"participant",children:"Participant Interviews"}),a.jsx(Te,{value:"expert",children:"Expert Interviews"}),a.jsx(Te,{value:"both",children:"Both (merged)"})]})]})]}),a.jsxs(ye,{onClick:()=>A(N),variant:"outline",children:["Add as Codebook (",N,")"]})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Forschungskontext"})}),a.jsxs(Be,{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Titel"}),a.jsx("p",{className:"text-sm",children:v.meta.title})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Zielsetzung"}),a.jsx("p",{className:"text-sm",children:v.meta.aim})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Derived Research Questions"}),a.jsx("ul",{className:"list-disc list-inside text-sm space-y-1",children:v.meta.derived_research_questions.map(($,K)=>a.jsx("li",{children:$},K))})]})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Teilnehmer-Interview"})}),a.jsxs(Be,{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Introduction"}),a.jsx("p",{className:"text-sm whitespace-pre-line",children:v.participant_interview.intro})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Fragen"}),a.jsx("div",{className:"space-y-3 mt-2",children:v.participant_interview.questions.map(($,K)=>a.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[a.jsx("p",{className:"font-medium text-sm",children:$.question}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["→ ",$.maps_to_rq]}),$.probes.length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx(_e,{className:"text-xs",children:"Nachfragen:"}),a.jsx("ul",{className:"list-disc list-inside text-xs space-y-1 ml-2",children:$.probes.map((G,Y)=>a.jsx("li",{children:G},Y))})]})]},K))})]})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Experten-Interview"})}),a.jsxs(Be,{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Introduction"}),a.jsx("p",{className:"text-sm whitespace-pre-line",children:v.expert_interview.intro})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Fragen"}),a.jsx("div",{className:"space-y-3 mt-2",children:v.expert_interview.questions.map(($,K)=>a.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[a.jsx("p",{className:"font-medium text-sm",children:$.question}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["→ ",$.maps_to_rq]}),$.probes.length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx(_e,{className:"text-xs",children:"Nachfragen:"}),a.jsx("ul",{className:"list-disc list-inside text-xs space-y-1 ml-2",children:$.probes.map((G,Y)=>a.jsx("li",{children:G},Y))})]})]},K))})]})]})]})]})]})]}),a.jsx(Pc,{open:n,onClose:()=>s(!1),remainingPoints:(r==null?void 0:r.remaining)??0})]})}function pyt(){const{user:t}=Pt(),{toast:e}=on(),[r,n]=S.useState([]),[s,i]=S.useState(""),[o,l]=S.useState([]),[c,u]=S.useState(!1),[d,h]=S.useState("");S.useEffect(()=>{t&&f()},[t]),S.useEffect(()=>{s&&p()},[s]);const f=async()=>{const{data:C,error:k}=await be.from("codebooks").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});k?e({title:"Error loading codebooks",variant:"destructive"}):n(C||[])},p=async()=>{if(!s)return;const{data:C,error:k}=await be.from("codebook_categories").select("*").eq("codebook_id",s).order("order_index",{ascending:!0});k?e({title:"Error loading categories",variant:"destructive"}):l(C||[])},g=async()=>{const C=d.trim();if(!C){e({title:"Please enter title",variant:"destructive"});return}if(!(t!=null&&t.id)){e({title:"Not signed in",variant:"destructive"});return}const k={title:C,user_id:t.id},{data:E,error:M}=await be.from("codebooks").insert(k).select().single();if(M){e({title:"Error creating",variant:"destructive"});return}h(""),await f(),i(E.id),e({title:"Codebook created"})},m=async()=>{if(!s){e({title:"No codebook selected",variant:"destructive"});return}try{const{error:C}=await be.from("codebooks").delete().eq("id",s);if(C)throw C;e({title:"Codebook deleted successfully"}),i(""),l([]),await f()}catch(C){console.error("Delete error:",C),e({title:"Error deleting",variant:"destructive"})}},x=()=>{l([...o,{id:`new-${Date.now()}`,codebook_id:s,name:"",definition:"",coding_rule:"",anchor_example:"",order_index:o.length}])},y=(C,k,E)=>{l(o.map(M=>M.id===C?{...M,[k]:E}:M))},v=async C=>{if(String(C).startsWith("new-")){l(o.filter(k=>k.id!==C));return}try{const{error:k}=await be.from("codebook_categories").delete().eq("id",C);if(k)throw k;l(o.filter(E=>E.id!==C)),e({title:"Category deleted successfully"})}catch{e({title:"Error deleting",variant:"destructive"})}},b=async()=>{if(s){u(!0);try{const C=o.filter(E=>!E.id.startsWith("new-")),k=o.filter(E=>E.id.startsWith("new-")).map(E=>({codebook_id:s,name:E.name,definition:E.definition,coding_rule:E.coding_rule,anchor_example:E.anchor_example,order_index:E.order_index}));if(C.length>0)for(const E of C){const{error:M}=await be.from("codebook_categories").update({name:E.name,definition:E.definition,coding_rule:E.coding_rule,anchor_example:E.anchor_example,order_index:E.order_index}).eq("id",E.id);if(M)throw M}if(k.length>0){const{error:E}=await be.from("codebook_categories").insert(k);if(E)throw E}e({title:"Categories saved successfully"}),p()}catch{e({title:"Error saving",variant:"destructive"})}u(!1)}},w=()=>{if(!s){e({title:"Select codebook",variant:"destructive"});return}const C=[["Category","Definition","Coding Rule","Anchor Example"]];for(const V of o)C.push([(V.name??"").replace(/\r?\n/g," ").trim(),(V.definition??"").replace(/\r?\n/g," ").trim(),(V.coding_rule??"").replace(/\r?\n/g," ").trim(),(V.anchor_example??"").replace(/\r?\n/g," ").trim()]);const k=W1.unparse(C,{delimiter:",",quotes:!0,newline:`\r
`}),E="\uFEFF",M=new Blob([E+k],{type:"text/csv;charset=utf-8"}),z=URL.createObjectURL(M),P=document.createElement("a");P.href=z,P.download=`codebook_${s}.csv`,P.click(),URL.revokeObjectURL(z)},j=async C=>{if(!s){e({title:"Select codebook",variant:"destructive"});return}try{const k=(z,P)=>new Promise((V,A)=>{const $=new FileReader;$.onload=()=>V($.result),$.onerror=A,$.readAsText(z,P)});let E;try{E=await k(C,"UTF-8"),E.includes("�")&&(E=await k(C,"Windows-1252"))}catch{E=await k(C,"Windows-1252")}const M=E.charCodeAt(0)===65279?E.slice(1):E;if(!M.trim()){e({title:"Error",description:"CSV file is empty",variant:"destructive"});return}W1.parse(M,{header:!0,skipEmptyLines:!0,encoding:"UTF-8",delimiter:"",transformHeader:z=>(z||"").trim(),complete:async z=>{var P;try{if(!((P=z.data)!=null&&P.length)){e({title:"Error",description:"CSV contains no data",variant:"destructive"});return}const V=z.data[0];if(!(V&&V.hasOwnProperty("Category")&&V.hasOwnProperty("Definition")&&V.hasOwnProperty("Coding Rule")&&V.hasOwnProperty("Anchor Example"))){e({title:"Error",description:"CSV must contain headers 'Category', 'Definition', 'Coding Rule', 'Anchor Example'",variant:"destructive"});return}const $=z.data.map(Y=>({name:(Y.Category||"").trim(),definition:(Y.Definition||"").trim(),coding_rule:(Y["Coding Rule"]||"").trim(),anchor_example:(Y["Anchor Example"]||"").trim()})).filter(Y=>Y.name);if($.length===0){e({title:"No valid rows found",description:"No rows with category names",variant:"destructive"});return}let K=0,G=0;for(const Y of $)try{const{data:H,error:B}=await be.from("codebook_categories").select("id").eq("codebook_id",s).eq("name",Y.name).maybeSingle();if(B){console.error("Query error:",B);continue}if(H&&H.id){const{error:L}=await be.from("codebook_categories").update({definition:Y.definition,coding_rule:Y.coding_rule,anchor_example:Y.anchor_example}).eq("id",H.id);L||K++}else{const{error:L}=await be.from("codebook_categories").insert({...Y,codebook_id:s,order_index:$.indexOf(Y)});L||G++}}catch(H){console.error("Error processing category:",Y.name,H)}e({title:"Import complete",description:`${K} updated, ${G} newly added`}),await p()}catch(V){console.error("Import processing error:",V),e({title:"Error processing data",variant:"destructive"})}},error:z=>{console.error("CSV parsing error:",z),e({title:"Could not read CSV",description:"Please check file format",variant:"destructive"})}})}catch(k){console.error("File reading error:",k),e({title:"Could not read file",variant:"destructive"})}},N=async C=>{try{const{error:k}=await be.from("codebook_categories").update({name:C.name,definition:C.definition,coding_rule:C.coding_rule,anchor_example:C.anchor_example,order_index:C.order_index}).eq("id",C.id);if(k)throw k;e({title:"Category saved"})}catch(k){console.error(k),e({title:"Error saving",variant:"destructive"})}};return a.jsx("div",{className:"space-y-6",children:a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Edit Codebook"})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsx("div",{className:"mb-4 p-3 border rounded-md",children:a.jsxs("div",{className:"flex items-end gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(_e,{children:"Create New Codebook"}),a.jsx(Fe,{value:d,onChange:C=>h(C.target.value),placeholder:"e.g. Codebook – ITIL Challenges"})]}),a.jsxs(ye,{onClick:g,children:[a.jsx(sl,{className:"h-4 w-4 mr-2"}),"Create"]})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Codebook"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(at,{value:s,onValueChange:i,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:r.length?"Select codebook...":"No codebook available yet"})}),a.jsx(st,{children:r.map(C=>a.jsx(Te,{value:C.id,children:C.title},C.id))})]}),s&&a.jsx(ye,{variant:"destructive",size:"icon",onClick:m,title:"Delete codebook",children:a.jsx(Ts,{className:"h-4 w-4"})})]})]}),!r.length&&a.jsx("p",{className:"text-sm text-muted-foreground",children:'Create a codebook above or go to "Research Setup" and adopt a generated one.'}),s&&a.jsxs(a.Fragment,{children:[a.jsx(Ps,{}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ye,{variant:"outline",onClick:w,children:"Export CSV"}),a.jsxs("div",{children:[a.jsx("input",{id:"csv-import",type:"file",accept:".csv,text/csv",className:"hidden",onChange:C=>{var E;const k=(E=C.target.files)==null?void 0:E[0];k&&j(k),C.currentTarget.value=""}}),a.jsx(_e,{htmlFor:"csv-import",className:"cursor-pointer px-4 py-2 border rounded-md hover:bg-muted text-sm",children:"Import CSV"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ye,{onClick:x,size:"sm",children:[a.jsx(sl,{className:"h-4 w-4 mr-2"}),"Add Category"]}),a.jsxs(ye,{onClick:b,disabled:c,variant:"default",size:"sm",children:[c&&a.jsx(St,{className:"h-4 w-4 mr-2 animate-spin"}),a.jsx(yD,{className:"h-4 w-4 mr-2"}),"Save All"]})]})]}),a.jsx("div",{className:"space-y-4",children:o.map((C,k)=>a.jsx(Me,{children:a.jsx(Be,{className:"pt-4",children:a.jsxs("div",{className:"grid grid-cols-12 gap-4 items-start",children:[a.jsxs("div",{className:"col-span-3",children:[a.jsx(_e,{children:"Name"}),a.jsx(Fe,{value:C.name,onChange:E=>y(C.id,"name",E.target.value),placeholder:"Category name"})]}),a.jsxs("div",{className:"col-span-3",children:[a.jsx(_e,{children:"Definition"}),a.jsx(Ht,{value:C.definition||"",onChange:E=>y(C.id,"definition",E.target.value),placeholder:"Category definition",rows:2})]}),a.jsxs("div",{className:"col-span-3",children:[a.jsx(_e,{children:"Coding Rule"}),a.jsx(Ht,{value:C.coding_rule||"",onChange:E=>y(C.id,"coding_rule",E.target.value),placeholder:"Rules for coding",rows:2})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx(_e,{children:"Anchor Example"}),a.jsx(Ht,{value:C.anchor_example||"",onChange:E=>y(C.id,"anchor_example",E.target.value),placeholder:'e.g. "As an IT Service Manager I am..."',rows:2})]}),a.jsxs("div",{className:"col-span-1 flex flex-col gap-2 pt-6",children:[a.jsx(ye,{onClick:()=>N(C),size:"sm",variant:"outline",disabled:String(C.id).startsWith("new-"),title:String(C.id).startsWith("new-")?"Click 'Save All' above first":"Save this category",children:a.jsx(yD,{className:"h-4 w-4"})}),a.jsx(ye,{onClick:()=>v(C.id),size:"sm",variant:"destructive",children:a.jsx(Ts,{className:"h-4 w-4"})})]})]})})},C.id))})]})]})]})})}function myt({open:t,onOpenChange:e,categoryId:r,categoryName:n,interviewId:s,interviewTitle:i,codebookId:o,onSuccess:l}){const[c,u]=S.useState([]),[d,h]=S.useState(!1),[f,p]=S.useState(!1),{toast:g}=on();S.useEffect(()=>{t&&r&&s&&m()},[t,r,s]);const m=async()=>{h(!0);try{const{data:w,error:j}=await be.from("coded_segments").select("id, snippet").eq("category_id",r).eq("interview_id",s).order("created_at",{ascending:!0});if(j)throw j;w&&w.length>0?u(w.map(N=>({id:N.id,snippet:N.snippet}))):u([{id:crypto.randomUUID(),snippet:"",isNew:!0}])}catch(w){g({title:"Error loading snippets",description:w.message,variant:"destructive"}),u([{id:crypto.randomUUID(),snippet:"",isNew:!0}])}finally{h(!1)}},x=()=>{u([...c,{id:crypto.randomUUID(),snippet:"",isNew:!0}])},y=w=>{if(c.length===1){g({title:"Cannot delete",description:"At least one snippet must remain",variant:"destructive"});return}u(c.filter(j=>j.id!==w))},v=(w,j)=>{u(c.map(N=>N.id===w?{...N,snippet:j}:N))},b=async()=>{p(!0);try{const{data:{user:w}}=await be.auth.getUser();if(!w)throw new Error("Not authenticated");const j=c.filter(z=>!z.isNew),N=c.filter(z=>z.isNew),{data:C}=await be.from("coded_segments").select("id").eq("category_id",r).eq("interview_id",s),k=(C==null?void 0:C.map(z=>z.id))||[],E=j.map(z=>z.id),M=k.filter(z=>!E.includes(z));if(M.length>0){const{error:z}=await be.from("coded_segments").delete().in("id",M);if(z)throw z}for(const z of j){const{error:P}=await be.from("coded_segments").update({snippet:z.snippet}).eq("id",z.id);if(P)throw P}if(N.length>0){const{error:z}=await be.from("coded_segments").insert(N.map(P=>({user_id:w.id,interview_id:s,codebook_id:o,category_id:r,snippet:P.snippet,start_char:0,end_char:P.snippet.length})));if(z)throw z}g({title:"Success",description:"Snippets saved successfully"}),l(),e(!1)}catch(w){g({title:"Error saving snippets",description:w.message,variant:"destructive"})}finally{p(!1)}};return a.jsx(qr,{open:t,onOpenChange:e,children:a.jsxs(Dr,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[a.jsx(Lr,{children:a.jsxs(Fr,{children:["Edit Snippets: ",n," - ",i]})}),d?a.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"Loading..."}):a.jsxs("div",{className:"space-y-4",children:[c.map((w,j)=>a.jsxs("div",{className:"space-y-2 p-4 border border-border rounded-lg",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(_e,{htmlFor:`snippet-${w.id}`,children:["Snippet ",j+1]}),a.jsx(ye,{type:"button",variant:"ghost",size:"sm",onClick:()=>y(w.id),disabled:c.length===1,children:a.jsx(Ts,{className:"h-4 w-4"})})]}),a.jsx(Ht,{id:`snippet-${w.id}`,value:w.snippet,onChange:N=>v(w.id,N.target.value),placeholder:"Enter snippet text...",className:"min-h-[100px]"})]},w.id)),a.jsxs(ye,{type:"button",variant:"outline",onClick:x,className:"w-full",children:[a.jsx(sl,{className:"h-4 w-4 mr-2"}),"Add Snippet"]})]}),a.jsxs(yf,{children:[a.jsx(ye,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:f,children:"Cancel"}),a.jsx(ye,{type:"button",onClick:b,disabled:f||d,children:f?"Saving...":"Save Changes"})]})]})})}function gyt(){const[t,e]=S.useState([]),[r,n]=S.useState(""),[s,i]=S.useState([]),[o,l]=S.useState([]),[c,u]=S.useState({}),[d,h]=S.useState(!1),[f,p]=S.useState(!0),[g,m]=S.useState(""),[x,y]=S.useState(null),[v,b]=S.useState(!1),[w,j]=S.useState(null),N=S.useRef(null),[C,k]=S.useState(!1),[E,M]=S.useState("error"),[z,P]=S.useState(""),[V,A]=S.useState(""),[$,K]=S.useState([]),[G,Y]=S.useState(null),[H,B]=S.useState(!1),{toast:L}=on(),F=async()=>{p(!0);try{const{data:ie,error:q}=await be.from("codebooks").select("id, title").order("created_at",{ascending:!1});if(q)throw q;ie&&ie.length>0&&(e(ie),n(ie[0].id))}catch(ie){L({title:"Error loading codebooks",description:ie.message,variant:"destructive"})}finally{p(!1)}},W=async ie=>{if(!ie){i([]),l([]);return}h(!0);try{const{data:q,error:I}=await be.from("v_category_interview_matrix").select("*").eq("codebook_id",ie);if(I)throw I;const T={},D=new Set,ne={};q==null||q.forEach(re=>{var pe;T[re.category_id]||(T[re.category_id]={category_id:re.category_id,category_name:re.category_name,order_index:re.order_index||0,definition:re.definition,coding_rule:re.coding_rule,anchor_example:re.anchor_example},ne[re.category_id]={}),re.interview_title&&(D.add(re.interview_title),T[re.category_id][re.interview_title]=((pe=re.snippets)==null?void 0:pe.join(`
— `))||"",ne[re.category_id][re.interview_title]={interview_id:re.interview_id,snippets:re.snippets||[]})});const ue=Object.values(T).sort((re,pe)=>re.order_index-pe.order_index);i(ue),l(Array.from(D)),u(ne)}catch(q){L({title:"Error loading data",description:q.message,variant:"destructive"})}finally{h(!1)}};S.useEffect(()=>{F()},[]),S.useEffect(()=>{r&&W(r)},[r]);const X=async(ie,q,I)=>{try{const T={};q==="definition"&&(T.definition=I),q==="coding_rule"&&(T.coding_rule=I),q==="anchor_example"&&(T.anchor_example=I);const{error:D}=await be.from("codebook_categories").update(T).eq("id",ie);if(D)throw D;L({title:"Success",description:"Category updated successfully"}),r&&await W(r)}catch(T){L({title:"Error updating category",description:T.message,variant:"destructive"})}},oe=(ie,q,I)=>{var D;const T=(D=c[ie])==null?void 0:D[I];if(!T){L({title:"Error",description:"Interview data not found",variant:"destructive"});return}j({categoryId:ie,categoryName:q,interviewId:T.interview_id,interviewTitle:I}),b(!0)},le=()=>{r&&W(r)},U=()=>{const ie=[["Category","Definition","Coding Rule","Anchor Example",...o]];O.forEach(ue=>{ie.push([(ue.category_name??"").toString().replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(ue.definition??"").toString().replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(ue.coding_rule??"").toString().replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(ue.anchor_example??"").toString().replace(/\r?\n/g," ").replace(/"/g,'""').trim(),...o.map(re=>{const pe=ue[re];return(typeof pe=="string"?pe:(pe??"").toString()).replace(/"/g,'""').replace(/\r?\n/g," ").trim()})])});const q=W1.unparse(ie,{delimiter:";",quotes:!0,escapeFormulae:!0,newline:`\r
`}),I="\uFEFF",T=new Blob([I+q],{type:"text/csv;charset=utf-8"}),D=URL.createObjectURL(T),ne=document.createElement("a");ne.href=D,ne.download="codebook_grid.csv",ne.click(),URL.revokeObjectURL(D)},R=()=>{var ie;(ie=N.current)==null||ie.click()},ee=async ie=>{var I;const q=(I=ie.target.files)==null?void 0:I[0];if(q){if(ie.target.value="",!r){L({title:"Error",description:"Please select a codebook first",variant:"destructive"});return}B(!0),W1.parse(q,{delimiter:";",header:!0,skipEmptyLines:!0,encoding:"UTF-8",complete:async T=>{try{await te(T.data)}catch(D){L({title:"Import-Error",description:D.message,variant:"destructive"})}finally{B(!1)}},error:T=>{B(!1),L({title:"Error reading CSV file",description:T.message,variant:"destructive"})}})}},te=async ie=>{var we;if(!ie||ie.length===0)throw new Error("CSV file is empty");const q=ie[0],I=["Category","Definition","Coding Rule","Anchor Example"],T=I.filter(je=>!(je in q));if(T.length>0)throw new Error(`Missing columns: ${T.join(", ")}`);const D=Object.keys(q).filter(je=>!I.includes(je)),{data:ne,error:ue}=await be.from("codebook_categories").select("id, name").eq("codebook_id",r);if(ue)throw ue;const re=new Map((ne==null?void 0:ne.map(je=>[je.name,je.id]))||[]),ve=ie.map(je=>je.Category).filter(Boolean).filter(je=>!re.has(je));if(ve.length>0){M("error"),P("Missing Categories"),A(`The following categories do not exist in the codebook. :
${ve.join(`
`)}
Please add these categories to the codebook first.`),k(!0);return}const{data:xe,error:ae}=await be.from("interviews").select("id, title").eq("user_id",(we=(await be.auth.getUser()).data.user)==null?void 0:we.id);if(ae)throw ae;const de=new Map((xe==null?void 0:xe.map(je=>[je.title,je.id]))||[]),ge=D.filter(je=>!de.has(je));if(ge.length>0){M("warning"),P("Missing Interviews"),A(`The following interviews do not exist:
${ge.join(`
`)}
How would you like to proceed??`),K(ge),Y({csvData:ie,categoryMap:re,interviewMap:de,csvInterviewColumns:D}),k(!0);return}Z(ie,re,de,D)},Z=(ie,q,I,T)=>{const D=new Set(ie.map(ue=>ue.Category)).size,ne=T.filter(ue=>I.has(ue)).length;M("confirm"),P("Confirm Import"),A(`You are about to overwrite the codebook:
• ${D} categories will be updated
• ${ne} interviews will be overwritten
• Existing codings will be replaced
Do you want to continue?`),Y({csvData:ie,categoryMap:q,interviewMap:I,csvInterviewColumns:T}),k(!0)},J=async(ie=!1)=>{var ue;if(!G)return;const{csvData:q,categoryMap:I,interviewMap:T,csvInterviewColumns:D}=G,ne=(ue=(await be.auth.getUser()).data.user)==null?void 0:ue.id;if(!ne){L({title:"Error",description:"User not authenticated",variant:"destructive"});return}B(!0),k(!1);try{let re=new Map(T);if(ie&&$.length>0)for(const ve of $){const{data:xe,error:ae}=await be.from("interviews").insert({user_id:ne,title:ve,raw_text:"[Placeholder - Please add interview text]",source:"CSV Import"}).select("id").single();if(ae)throw ae;re.set(ve,xe.id)}let pe=0;for(const ve of q){const xe=ve.Category,ae=I.get(xe);if(ae)for(const de of D){const ge=re.get(de);if(!ge)continue;const we=ve[de]||"",{error:je}=await be.from("coded_segments").delete().eq("category_id",ae).eq("interview_id",ge).eq("codebook_id",r);if(je)throw je;if(we.trim()){const Ue=we.split(/\s*\|\s*/).filter(Ae=>Ae.trim()).map(Ae=>({user_id:ne,interview_id:ge,codebook_id:r,category_id:ae,snippet:Ae.trim(),start_char:-1,end_char:-1}));if(Ue.length>0){const{error:Ae}=await be.from("coded_segments").insert(Ue);if(Ae)throw Ae;pe+=Ue.length}}}}L({title:"✅ Import successful",description:`${q.length} categories updated, ${pe} snippets imported`}),await W(r)}catch(re){L({title:"Import failed",description:re.message,variant:"destructive"})}finally{B(!1),Y(null),K([])}},he=ie=>{if(k(!1),ie==="cancel"){Y(null),K([]);return}if(ie==="skip"&&G){const{csvData:q,categoryMap:I,interviewMap:T}=G,D=Object.keys(q[0]).filter(ne=>!["Category","Definition","Coding Rule","Anchor Example"].includes(ne)&&T.has(ne));Z(q,I,T,D);return}if(ie==="placeholder"&&G){const{csvData:q,categoryMap:I,interviewMap:T,csvInterviewColumns:D}=G;Z(q,I,T,D);return}ie==="confirm"&&J($.length>0)},O=s.filter(ie=>ie.category_name.toLowerCase().includes(g.toLowerCase()));return f?a.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:a.jsx(St,{className:"h-8 w-8 animate-spin text-primary"})}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Codingbook (Grid)"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Excel-like view of your entire codebook with all interviews"})]}),a.jsxs(Me,{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"codebook-select",className:"text-sm font-medium mb-2 block",children:"Select Coding Book"}),a.jsxs(at,{value:r,onValueChange:n,children:[a.jsx(nt,{id:"codebook-select",className:"w-full max-w-md",children:a.jsx(ot,{placeholder:"Please select a codebook"})}),a.jsx(st,{children:t.map(ie=>a.jsx(Te,{value:ie.id,children:ie.title},ie.id))})]})]}),r&&a.jsxs("div",{className:"flex gap-4 items-center justify-between",children:[a.jsxs("div",{className:"relative flex-1 max-w-sm",children:[a.jsx(ll,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Fe,{placeholder:"Search categories...",value:g,onChange:ie=>m(ie.target.value),className:"pl-9"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{ref:N,type:"file",accept:".csv",onChange:ee,className:"hidden"}),a.jsxs(ye,{onClick:R,variant:"outline",disabled:H,children:[H?a.jsx(St,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(Ku,{className:"h-4 w-4 mr-2"}),"Import CSV"]}),a.jsxs(ye,{onClick:U,variant:"outline",children:[a.jsx(mo,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})]})]}),r?d?a.jsx(Me,{className:"p-12",children:a.jsx("div",{className:"flex items-center justify-center",children:a.jsx(St,{className:"h-8 w-8 animate-spin text-primary"})})}):a.jsxs(Me,{className:"overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse",children:[a.jsx("thead",{className:"sticky top-0 bg-muted z-10",children:a.jsxs("tr",{children:[a.jsx("th",{className:"border border-border p-3 text-left font-semibold text-sm min-w-[150px]",children:"Category"}),a.jsx("th",{className:"border border-border p-3 text-left font-semibold text-sm min-w-[200px]",children:"Definition"}),a.jsx("th",{className:"border border-border p-3 text-left font-semibold text-sm min-w-[200px]",children:"Coding Rule"}),a.jsx("th",{className:"border border-border p-3 text-left font-semibold text-sm min-w-[200px]",children:"Anchor Example"}),o.map(ie=>a.jsx("th",{className:"border border-border p-3 text-left font-semibold text-sm min-w-[250px]",children:ie},ie))]})}),a.jsx("tbody",{children:O.map(ie=>a.jsxs("tr",{className:"hover:bg-muted/50 transition-colors",children:[a.jsx("td",{className:"border border-border p-3 text-sm font-medium",children:ie.category_name}),a.jsx("td",{className:"border border-border p-3 text-sm cursor-pointer hover:bg-accent/10",onClick:()=>y({rowId:ie.category_id,field:"definition"}),children:(x==null?void 0:x.rowId)===ie.category_id&&(x==null?void 0:x.field)==="definition"?a.jsx("textarea",{autoFocus:!0,defaultValue:ie.definition||"",onBlur:q=>{X(ie.category_id,"definition",q.target.value),y(null)},onKeyDown:q=>{q.key==="Escape"&&y(null),q.key==="Enter"&&q.ctrlKey&&(X(ie.category_id,"definition",q.currentTarget.value),y(null))},className:"w-full p-2 border-2 border-primary rounded bg-yellow-50 dark:bg-yellow-950/20 text-sm resize-none min-h-[80px] focus:outline-none focus:ring-2 focus:ring-primary"}):a.jsx("div",{className:"whitespace-pre-wrap",children:ie.definition||"—"})}),a.jsx("td",{className:"border border-border p-3 text-sm cursor-pointer hover:bg-accent/10",onClick:()=>y({rowId:ie.category_id,field:"coding_rule"}),children:(x==null?void 0:x.rowId)===ie.category_id&&(x==null?void 0:x.field)==="coding_rule"?a.jsx("textarea",{autoFocus:!0,defaultValue:ie.coding_rule||"",onBlur:q=>{X(ie.category_id,"coding_rule",q.target.value),y(null)},onKeyDown:q=>{q.key==="Escape"&&y(null),q.key==="Enter"&&q.ctrlKey&&(X(ie.category_id,"coding_rule",q.currentTarget.value),y(null))},className:"w-full p-2 border-2 border-primary rounded bg-yellow-50 dark:bg-yellow-950/20 text-sm resize-none min-h-[80px] focus:outline-none focus:ring-2 focus:ring-primary"}):a.jsx("div",{className:"whitespace-pre-wrap",children:ie.coding_rule||"—"})}),a.jsx("td",{className:"border border-border p-3 text-sm cursor-pointer hover:bg-accent/10",onClick:()=>y({rowId:ie.category_id,field:"anchor_example"}),children:(x==null?void 0:x.rowId)===ie.category_id&&(x==null?void 0:x.field)==="anchor_example"?a.jsx("textarea",{autoFocus:!0,defaultValue:ie.anchor_example||"",onBlur:q=>{X(ie.category_id,"anchor_example",q.target.value),y(null)},onKeyDown:q=>{q.key==="Escape"&&y(null),q.key==="Enter"&&q.ctrlKey&&(X(ie.category_id,"anchor_example",q.currentTarget.value),y(null))},className:"w-full p-2 border-2 border-primary rounded bg-yellow-50 dark:bg-yellow-950/20 text-sm resize-none min-h-[80px] focus:outline-none focus:ring-2 focus:ring-primary"}):a.jsx("div",{className:"whitespace-pre-wrap",children:ie.anchor_example||"—"})}),o.map(q=>a.jsx("td",{className:"border border-border p-3 text-sm align-top cursor-pointer hover:bg-accent/10",onClick:()=>oe(ie.category_id,ie.category_name,q),children:a.jsx("div",{className:"whitespace-pre-wrap text-muted-foreground",children:ie[q]||"—"})},q))]},ie.category_id))})]})}),O.length===0&&a.jsx("div",{className:"text-center py-12 text-muted-foreground",children:a.jsx("p",{children:"No categories found"})})]}):a.jsx(Me,{className:"p-12",children:a.jsx("div",{className:"text-center text-muted-foreground",children:a.jsx("p",{className:"text-lg",children:"Please select a codebook to view the data."})})}),v&&w&&r&&a.jsx(myt,{open:v,onOpenChange:b,categoryId:w.categoryId,categoryName:w.categoryName,interviewId:w.interviewId,interviewTitle:w.interviewTitle,codebookId:r,onSuccess:le}),a.jsx(ji,{open:C,onOpenChange:k,children:a.jsxs(ei,{children:[a.jsxs(ti,{children:[a.jsxs(ni,{className:"flex items-center gap-2",children:[E==="error"&&a.jsx(Ww,{className:"h-5 w-5 text-destructive"}),z]}),a.jsx(si,{className:"whitespace-pre-line",children:V})]}),a.jsxs(ri,{children:[E==="error"&&a.jsx(Os,{onClick:()=>he("cancel"),children:"OK"}),E==="warning"&&a.jsxs(a.Fragment,{children:[a.jsx(Ls,{onClick:()=>he("cancel"),children:"Abbrechen"}),a.jsx(ye,{onClick:()=>he("skip"),variant:"outline",children:"Nur existierende importieren"}),a.jsx(Os,{onClick:()=>he("placeholder"),children:"Mit Platzhaltern fortfahren"})]}),E==="confirm"&&a.jsxs(a.Fragment,{children:[a.jsx(Ls,{onClick:()=>he("cancel"),children:"Abbrechen"}),a.jsx(Os,{onClick:()=>he("confirm"),children:"Import durchführen"})]})]})]})})]})}function yyt(){const{user:t}=Pt(),{toast:e}=on(),[r,n]=S.useState([]),[s,i]=S.useState({title:"",source:"",raw_text:""}),[o,l]=S.useState(null),[c,u]=S.useState(null),[d,h]=S.useState({title:"",source:"",raw_text:""}),[f,p]=S.useState(!1);S.useEffect(()=>{t&&g()},[t]);const g=async()=>{const{data:v,error:b}=await be.from("interviews").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});b?e({title:"Error loading interviews",variant:"destructive"}):n(v||[])},m=async()=>{if(!s.title.trim()||!s.raw_text.trim()){e({title:"Title and text are required",variant:"destructive"});return}try{const{error:v}=await be.from("interviews").insert({title:s.title.trim(),source:s.source.trim(),raw_text:s.raw_text.trim(),user_id:t==null?void 0:t.id});if(v)throw v;e({title:"Interview added successfully"}),i({title:"",source:"",raw_text:""}),g()}catch{e({title:"Error adding",variant:"destructive"})}},x=v=>{u(v),h({title:v.title,source:v.source||"",raw_text:v.raw_text})},y=async()=>{if(!c||!d.title.trim()||!d.raw_text.trim()){e({title:"Title and text are required",variant:"destructive"});return}p(!0);try{const{error:v}=await be.from("interviews").update({title:d.title.trim(),source:d.source.trim(),raw_text:d.raw_text.trim()}).eq("id",c.id);if(v)throw v;e({title:"Interview updated successfully"}),u(null),g()}catch{e({title:"Error updating interview",variant:"destructive"})}finally{p(!1)}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Manage Interviews"})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Title"}),a.jsx(Fe,{value:s.title,onChange:v=>i({...s,title:v.target.value}),placeholder:"Interview Title"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Source (optional)"}),a.jsx(Fe,{value:s.source,onChange:v=>i({...s,source:v.target.value}),placeholder:"e.g. Person A, Document XYZ"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Interview Text"}),a.jsx(Ht,{value:s.raw_text,onChange:v=>i({...s,raw_text:v.target.value}),placeholder:"Complete interview text...",rows:8})]}),a.jsxs(ye,{onClick:m,children:[a.jsx(sl,{className:"h-4 w-4 mr-2"}),"Add Interview"]}),a.jsx(Ps,{}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("h3",{className:"font-medium",children:["Existing Interviews (",r.length,")"]}),r.map(v=>a.jsx(Me,{children:a.jsxs(Be,{className:"pt-4",children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:v.title}),v.source&&a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Source: ",v.source]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(v.created_at).toLocaleDateString()})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ye,{onClick:()=>l(o===v.id?null:v.id),size:"sm",variant:"outline",children:[a.jsx(Qi,{className:"h-4 w-4 mr-2"}),o===v.id?"Close":"View Text"]}),a.jsxs(ye,{onClick:()=>x(v),size:"sm",variant:"outline",children:[a.jsx(JJ,{className:"h-4 w-4 mr-2"}),"Edit Interview"]})]})]}),o===v.id&&a.jsx("div",{className:"mt-4 p-4 bg-muted rounded max-h-60 overflow-y-auto",children:a.jsx("pre",{className:"whitespace-pre-wrap text-sm",children:v.raw_text})})]})},v.id))]})]})]}),a.jsx(qr,{open:!!c,onOpenChange:v=>!v&&u(null),children:a.jsxs(Dr,{className:"max-w-2xl",children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Edit Interview"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Title"}),a.jsx(Fe,{value:d.title,onChange:v=>h({...d,title:v.target.value}),placeholder:"Interview Title"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Source (optional)"}),a.jsx(Fe,{value:d.source,onChange:v=>h({...d,source:v.target.value}),placeholder:"e.g. Person A, Document XYZ"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Interview Text"}),a.jsx(Ht,{value:d.raw_text,onChange:v=>h({...d,raw_text:v.target.value}),placeholder:"Complete interview text...",rows:12})]})]}),a.jsxs(yf,{children:[a.jsx(ye,{variant:"outline",onClick:()=>u(null),children:"Cancel"}),a.jsx(ye,{onClick:y,disabled:f,children:f?"Saving...":"Save Changes"})]})]})})]})}function xyt({selectedCodebook:t,selectedInterviews:e,categories:r,interviews:n,userId:s,onCodingComplete:i}){const{toast:o}=on(),[l,c]=S.useState([]),[u,d]=S.useState(!1),[h,f]=S.useState(!1),[p,g]=S.useState(new Set),[m,x]=S.useState(new Set);S.useEffect(()=>{t&&e.length>0?y():c([])},[t,e]);const y=async()=>{d(!0);try{const{data:k,error:E}=await be.from("coded_segments").select("*").eq("user_id",s).eq("codebook_id",t).in("interview_id",e).order("created_at",{ascending:!1});if(E)throw E;c(k||[])}catch(k){console.error("Error loading segments:",k),o({title:"Error loading segments",variant:"destructive"})}finally{d(!1)}},v=async(k,E)=>{f(!0);try{const M={codebook_id:t,interview_id:k};E&&(M.overwrite_existing=!0);const{data:z,error:P}=await be.functions.invoke("codebooks_apply",{body:M});if(P)throw P;o({title:`${z.created_segments} Segmente erstellt`,description:E?"Existing ones overwritten":"New added"}),await y(),i==null||i()}catch(M){console.error("Recode error:",M),o({title:"Encoding errors",variant:"destructive"})}finally{f(!1)}},b=()=>{const k={};return l.forEach(E=>{k[E.interview_id]||(k[E.interview_id]={}),k[E.interview_id][E.category_id]||(k[E.interview_id][E.category_id]=[]),k[E.interview_id][E.category_id].push(E)}),k},w=k=>{const E=new Set(p);E.has(k)?E.delete(k):E.add(k),g(E)},j=k=>{const E=new Set(m);E.has(k)?E.delete(k):E.add(k),x(E)},N=(k,E=220)=>k.length<=E?{truncated:k,isTruncated:!1}:{truncated:k.substring(0,E)+"...",isTruncated:!0};if(!t||e.length===0)return null;const C=b();return u?a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Latest encodings"})}),a.jsx(Be,{className:"flex justify-center items-center py-8",children:a.jsx(St,{className:"h-8 w-8 animate-spin"})})]}):l.length===0?a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Latest encodings"})}),a.jsx(Be,{children:a.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[a.jsx("p",{children:"No codes are available yet."}),a.jsx("p",{className:"text-sm mt-2",children:"First, perform an automatic encoding."})]})})]}):a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsxs(Je,{children:["Latest encodings (",l.length," Segmente)"]})}),a.jsx(Be,{className:"space-y-6",children:e.map(k=>{const E=n.find(P=>P.id===k),M=C[k];if(!E||!M)return null;const z=Object.values(M).reduce((P,V)=>P+V.length,0);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-lg",children:E.title}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[z," Segmente"]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ye,{onClick:()=>v(k,!0),disabled:h,variant:"outline",size:"sm",children:[h&&a.jsx(St,{className:"mr-2 h-3 w-3 animate-spin"}),"Overwrite"]}),a.jsxs(ye,{onClick:()=>v(k,!1),disabled:h,variant:"outline",size:"sm",children:[h&&a.jsx(St,{className:"mr-2 h-3 w-3 animate-spin"}),"Attach"]})]})]}),a.jsx("div",{className:"space-y-3",children:Object.entries(M).map(([P,V])=>{const A=r.find(H=>H.id===P),$=`${k}-${P}`,K=p.has($),G=K?V:V.slice(0,3),Y=V.length>3;return a.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:(A==null?void 0:A.name)||"Unknown category"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[V.length," ",V.length===1?"Segment":"Segmente"]})]}),Y&&a.jsx(ye,{onClick:()=>w($),variant:"ghost",size:"sm",children:K?a.jsxs(a.Fragment,{children:[a.jsx(WJ,{className:"h-4 w-4 mr-1"}),"Fewer"]}):a.jsxs(a.Fragment,{children:[a.jsx(vc,{className:"h-4 w-4 mr-1"}),"Show all"]})})]}),a.jsx("div",{className:"space-y-2",children:G.map(H=>{var X;const{truncated:B,isTruncated:L}=N(H.snippet),F=m.has(H.id),W=F?H.snippet:B;return a.jsxs("div",{className:"bg-muted/50 rounded p-3 space-y-2",children:[a.jsx("p",{className:"text-sm whitespace-pre-wrap",children:W}),L&&a.jsx(ye,{onClick:()=>j(H.id),variant:"ghost",size:"sm",className:"h-6 text-xs",children:F?"Show less":"Show full text"}),a.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground pt-2 border-t",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Confidence:"})," ",((X=H.confidence)==null?void 0:X.toFixed(2))||"N/A"]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Position:"})," ",H.start_char,"–",H.end_char]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Created:"})," ",new Date(H.created_at).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]},H.id)})})]},$)})})]},k)})})]})}function vyt(){const{user:t,checkStudentPoints:e,studentPoints:r}=Pt(),[n,s]=S.useState(!1),{toast:i}=on(),[o,l]=S.useState([]),[c,u]=S.useState(""),[d,h]=S.useState([]),[f,p]=S.useState([]),[g,m]=S.useState([]),[x,y]=S.useState([]),[v,b]=S.useState(!1),[w,j]=S.useState("all");S.useEffect(()=>{t&&(N(),k())},[t]),S.useEffect(()=>{c&&C()},[c]),S.useEffect(()=>{c&&g.length>0&&M()},[c,g]);const N=async()=>{const{data:P,error:V}=await be.from("codebooks").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});V?i({title:"Error loading codebooks",variant:"destructive"}):l(P||[])},C=async()=>{if(!c)return;const{data:P,error:V}=await be.from("codebook_categories").select("*").eq("codebook_id",c).order("order_index",{ascending:!0});V?i({title:"Error loading categories",variant:"destructive"}):h(P||[])},k=async()=>{const{data:P,error:V}=await be.from("interviews").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});V?i({title:"Error loading interviews",variant:"destructive"}):p(P||[])},E=async()=>{if(!e()){s(!0);return}if(!c||g.length===0){i({title:"Select codebook and interviews",variant:"destructive"});return}b(!0);try{for(const P of g){const{data:V,error:A}=await be.functions.invoke("codebooks_apply",{body:{codebook_id:c,interview_id:P}});if(A)throw A;i({title:`${V.created_segments} Segments created for interview`})}M()}catch{i({title:"Error during automatic coding",variant:"destructive"})}b(!1)},M=async()=>{if(!c||g.length===0)return;const{data:P,error:V}=await be.from("coded_segments").select("*").eq("user_id",t==null?void 0:t.id).eq("codebook_id",c).in("interview_id",g).order("created_at",{ascending:!1});V?i({title:"Error loading coded segments",variant:"destructive"}):y(P||[])},z=w==="all"?x:x.filter(P=>P.category_id===w);return a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Automatic coding"})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Coding sheet"}),a.jsxs(at,{value:c,onValueChange:u,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select codebook..."})}),a.jsx(st,{children:o.map(P=>a.jsx(Te,{value:P.id,children:P.title},P.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Interviews"}),a.jsxs(at,{value:g.join(","),onValueChange:P=>m(P?[P]:[]),children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select interview..."})}),a.jsx(st,{children:f.map(P=>a.jsx(Te,{value:P.id,children:P.title},P.id))})]})]})]}),a.jsxs(ye,{onClick:E,disabled:v,children:[v&&a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Automatic encoding"]}),c&&g.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Ps,{}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("h3",{className:"font-medium",children:["Coded segments (",z.length,")"]}),a.jsxs(at,{value:w,onValueChange:j,children:[a.jsx(nt,{className:"w-48",children:a.jsx(ot,{placeholder:"Filter by category..."})}),a.jsxs(st,{children:[a.jsx(Te,{value:"all",children:"All categories"}),d.map(P=>a.jsx(Te,{value:P.id,children:P.name},P.id))]})]})]}),a.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:z.map(P=>{var A;const V=d.find($=>$.id===P.category_id);return a.jsx(Me,{children:a.jsx(Be,{className:"pt-4",children:a.jsxs("div",{className:"grid grid-cols-12 gap-4 items-start",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx(_e,{className:"text-xs",children:"category"}),a.jsx("p",{className:"text-sm font-medium",children:(V==null?void 0:V.name)||"Unknown"})]}),a.jsxs("div",{className:"col-span-5",children:[a.jsx(_e,{className:"text-xs",children:"Snippet"}),a.jsx("p",{className:"text-sm",children:P.snippet})]}),a.jsxs("div",{className:"col-span-3",children:[a.jsx(_e,{className:"text-xs",children:"Memo"}),a.jsx(Ht,{value:P.memo||"",placeholder:"Add memo...",rows:2,className:"text-xs"})]}),a.jsxs("div",{className:"col-span-1",children:[a.jsx(_e,{className:"text-xs",children:"Confidence"}),a.jsx("p",{className:"text-sm",children:((A=P.confidence)==null?void 0:A.toFixed(2))||"N/A"})]}),a.jsxs("div",{className:"col-span-1",children:[a.jsx(_e,{className:"text-xs",children:"Position"}),a.jsxs("p",{className:"text-xs",children:[P.start_char,"-",P.end_char]})]})]})})},P.id)})})]})]})]}),a.jsx(xyt,{selectedCodebook:c,selectedInterviews:g,categories:d,interviews:f,userId:t==null?void 0:t.id,onCodingComplete:M}),a.jsx(Pc,{open:n,onClose:()=>s(!1),remainingPoints:(r==null?void 0:r.remaining)??0})]})}const RX={small:{wordMin:150,wordMax:300,overheadTokens:600},medium:{wordMin:300,wordMax:600,overheadTokens:700},big:{wordMin:500,wordMax:900,overheadTokens:800}},byt=t=>Math.round(t*1.4),wyt=t=>Math.round(t/4);function _yt(){const{user:t,checkStudentPoints:e,studentPoints:r}=Pt(),[n,s]=S.useState(!1),{toast:i}=on(),[o,l]=S.useState([]),[c,u]=S.useState(""),[d,h]=S.useState([]),[f,p]=S.useState(""),[g,m]=S.useState("medium"),[x,y]=S.useState("de"),[v,b]=S.useState(null),[w,j]=S.useState(!1),[N,C]=S.useState([]),[k,E]=S.useState(""),[M,z]=S.useState([]),[P,V]=S.useState(""),[A,$]=S.useState({prompt:0,completion:0,total:0}),[K,G]=S.useState(null),[Y,H]=S.useState([]),[B,L]=S.useState(!1),[F,W]=S.useState(""),[X,oe]=S.useState(""),[le,U]=S.useState(!1);S.useEffect(()=>{t&&(te(),J())},[t]),S.useEffect(()=>{c&&Z()},[c]),S.useEffect(()=>{k?(he(),R()):(z([]),V(""),H([]),W(""))},[k]);const R=async()=>{const{data:T}=await be.from("chapters").select("id, title, order_index").eq("thesis_id",k).order("order_index");H(T||[])},ee=async()=>{if(!(!F||!v)){U(!0);try{const{data:T}=await be.from("sections").select("order_index").eq("chapter_id",F).order("order_index",{ascending:!1}).limit(1),D=T!=null&&T.length?T[0].order_index+1:0,ne=v.category_conclusion?`
Fazit Kategorie: ${v.title}
${v.category_conclusion}`:"",ue=v.summary_text+ne;await be.from("sections").insert({chapter_id:F,content:ue,title:X.trim()||null,type:"other",order_index:D,status:"open"}),i({title:"Successfully imported",description:"Saved as section in chapter."}),L(!1),oe(""),W("")}catch{i({title:"Fehler beim Import",variant:"destructive"})}finally{U(!1)}}};S.useEffect(()=>{ie()},[f,P,c,d,M,g]);const te=async()=>{const{data:T,error:D}=await be.from("codebooks").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});D?i({title:"Error loading codebooks",variant:"destructive"}):l(T||[])},Z=async()=>{if(!c)return;const{data:T,error:D}=await be.from("codebook_categories").select("*").eq("codebook_id",c).order("order_index",{ascending:!0});D?i({title:"Error loading categories",variant:"destructive"}):h(T||[])},J=async()=>{const{data:T,error:D}=await be.from("theses").select("id, title, description").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});D?i({title:"Error loading the theses",variant:"destructive"}):C(T||[])},he=async()=>{const{data:T,error:D}=await be.from("sections").select(`
id,
title,
content,
order_index,
chapters!inner(title, thesis_id, order_index)
`).eq("chapters.thesis_id",k);if(D)console.error("Section load error:",D),i({title:"Error loading the Section",description:D.message,variant:"destructive"});else{const ne=(T||[]).sort((ue,re)=>{var pe,ve;return(((pe=ue.chapters)==null?void 0:pe.order_index)||0)-(((ve=re.chapters)==null?void 0:ve.order_index)||0)});z(ne)}},O=T=>T?T.trim().split(/\s+/).slice(0,8).join(" ")+(T.split(/\s+/).length>8?"...":""):"",ie=async()=>{var ae,de,ge,we;if(!c||!f){$({prompt:0,completion:0,total:0});return}const T=RX[g]??RX.medium,D=byt((T.wordMin+T.wordMax)/2);let ne=0;const ue=d.find(je=>je.id===f);ue&&(ne+=((ae=ue.name)==null?void 0:ae.length)||0,ne+=((de=ue.definition)==null?void 0:de.length)||0,ne+=((ge=ue.anchor_example)==null?void 0:ge.length)||0,ne+=((we=ue.coding_rule)==null?void 0:we.length)||0);const re=M.find(je=>je.id===P);if(re!=null&&re.content&&(ne+=re.content.length),f&&c)try{const{data:je}=await be.from("coded_segments").select("snippet, interviews!inner(title)").eq("category_id",f).eq("codebook_id",c);if(je&&je.length>0){je.forEach(Ue=>{var Ae,fe,Ee;ne+=((Ae=Ue.snippet)==null?void 0:Ae.length)||0,ne+=((Ee=(fe=Ue.interviews)==null?void 0:fe.title)==null?void 0:Ee.length)||0});const Se=[...new Set(je.map(Ue=>{var Ae;return((Ae=Ue.interviews)==null?void 0:Ae.title)||""}))];ne+=Se.join(", ").length}}catch(je){console.error("Error loading snippets for estimation:",je)}const ve=T.overheadTokens+200+wyt(ne),xe=ve+D;$({prompt:ve,completion:D,total:xe})},q=async()=>{var T,D,ne;if(!e()){s(!0);return}if(!c||!f){i({title:"Select coding sheet and category",variant:"destructive"});return}j(!0),G(null);try{const{data:ue}=await be.from("codebook_categories").select("name, definition, anchor_example, coding_rule").eq("id",f).single(),{data:re}=await be.from("coded_segments").select(`
snippet,
interviews!inner(title)
`).eq("category_id",f).eq("codebook_id",c),pe=[...new Set((re==null?void 0:re.map(ge=>ge.interviews.title))||[])],ve=(re==null?void 0:re.map(ge=>({snippet:ge.snippet,interview_title:ge.interviews.title})))||[];let xe="";if(P){const{data:ge}=await be.from("sections").select("content").eq("id",P).single();xe=(ge==null?void 0:ge.content)||""}const{data:ae,error:de}=await be.functions.invoke("analysis_results",{body:{codebook_id:c,category_id:f,mode:g,language:x,thesis_id:k||null,section_id:P||null,category_metadata:{category_title:(ue==null?void 0:ue.name)||"",definition:(ue==null?void 0:ue.definition)||"",coding_rule:(ue==null?void 0:ue.coding_rule)||"",anchor_example:(ue==null?void 0:ue.anchor_example)||"",interviewer_names:pe,snippet_count:ve.length,all_snippets:ve},section_content:xe}});if(de)throw de;b(ae),G({prompt:(T=ae==null?void 0:ae.usage)==null?void 0:T.prompt_tokens,completion:(D=ae==null?void 0:ae.usage)==null?void 0:D.completion_tokens,total:(ne=ae==null?void 0:ae.usage)==null?void 0:ne.total_tokens}),i({title:"Analysis generated successfully!"})}catch(ue){console.error("Error:",ue),i({title:"Error during generation",description:ue.message,variant:"destructive"})}finally{j(!1)}},I=async()=>{if(!(!v||!c))try{const{error:T}=await be.from("qualitative_summaries").insert({codebook_id:c,category_id:f||null,title:v.title,summary_text:v.summary_text,proof_json:v.proof_json});if(T)throw T;i({title:"Summary saved to library"})}catch{i({title:"Error saving",variant:"destructive"})}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Analysis configuration"})}),a.jsxs(Be,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Coding sheet *"}),a.jsxs(at,{value:c,onValueChange:u,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select coding sheet..."})}),a.jsx(st,{children:o.map(T=>a.jsx(Te,{value:T.id,children:T.title},T.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Kategorie *"}),a.jsxs(at,{value:f,onValueChange:p,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select category..."})}),a.jsx(st,{children:d.map(T=>a.jsx(Te,{value:T.id,children:T.name},T.id))})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Mode"}),a.jsxs(at,{value:g,onValueChange:m,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"small",children:"Short"}),a.jsx(Te,{value:"medium",children:"Middle"}),a.jsx(Te,{value:"big",children:"Large"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(at,{value:x,onValueChange:y,children:[a.jsx(nt,{children:a.jsx(ot,{})}),a.jsxs(st,{children:[a.jsx(Te,{value:"de",children:"German"}),a.jsx(Te,{value:"en",children:"English"})]})]})]})]}),a.jsxs("div",{className:"border-t pt-4 mt-4",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:"Thesis-Kontext"}),N.length===0&&a.jsxs(nd,{className:"mb-4",children:[a.jsx(Ww,{className:"h-4 w-4"}),a.jsx(K8,{children:"No thesis available"}),a.jsxs(sd,{children:["Please write a thesis first in"," ",a.jsx(tt,{to:"/thesis-builder",className:"underline font-medium",children:"Thesis Builder"}),", before you can perform an analysis."]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Thesis *"}),a.jsxs(at,{value:k,onValueChange:T=>{E(T),V("")},children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Choose Thesis"})}),a.jsx(st,{children:N.map(T=>a.jsx(Te,{value:T.id,children:T.title},T.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Theory-Section"}),a.jsxs(at,{value:P,onValueChange:V,disabled:!k,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:k?"Select section (optional)":"Select thesis first"})}),a.jsx(st,{children:M.map(T=>a.jsx(Te,{value:T.id,children:T.title?`${T.title} (${T.chapters.title})`:`${T.chapters.title} – ${O(T.content)}`},T.id))})]})]})]})]}),a.jsxs(ye,{onClick:q,disabled:w||!c||!f||!k,className:"w-full",children:[w&&a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Start analysis"]})]})]}),v&&a.jsxs(a.Fragment,{children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsxs(Je,{className:"flex justify-between items-center flex-wrap gap-2",children:[v.title,a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ye,{onClick:()=>L(!0),variant:"outline",size:"sm",disabled:!v||!k,children:[a.jsx(Oj,{className:"mr-2 h-4 w-4"}),"Import to Chapter"]}),a.jsx(ye,{onClick:I,variant:"outline",size:"sm",children:"Save to library"})]})]})}),a.jsxs(Be,{className:"space-y-0",children:[a.jsx("div",{className:"prose max-w-none whitespace-pre-wrap",children:v.summary_text}),v.category_conclusion&&a.jsxs(a.Fragment,{children:[a.jsx("hr",{className:"my-6 border-border"}),a.jsxs("div",{className:"prose max-w-none",children:[a.jsxs("p",{className:"font-bold underline mb-2",children:["Conclusion Category: ",v.title]}),a.jsx("p",{className:"whitespace-pre-wrap",children:v.category_conclusion})]})]})]})]}),v.proof_json&&v.proof_json.length>0&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{className:"text-base",children:"Supporting material"})}),a.jsx(Be,{className:"space-y-3",children:v.proof_json.map((T,D)=>a.jsxs("div",{className:"p-4 bg-muted rounded-md",children:[a.jsxs("blockquote",{className:"italic text-sm mb-2",children:['"',T.quote,'"']}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["(",T.interview_title,", Cell XY)"]})]},D))})]})]}),a.jsx(qr,{open:B,onOpenChange:L,children:a.jsxs(Dr,{children:[a.jsx(Lr,{children:a.jsx(Fr,{children:"Import as Section"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Target Chapter"}),a.jsxs(at,{value:F,onValueChange:W,children:[a.jsx(nt,{children:a.jsx(ot,{placeholder:"Select chapter..."})}),a.jsx(st,{children:Y.map(T=>a.jsx(Te,{value:T.id,children:T.title},T.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Section-Title (optional)"}),a.jsx(Fe,{value:X,onChange:T=>oe(T.target.value),placeholder:"e.g. Interview Analysis"})]})]}),a.jsxs(yf,{children:[a.jsx(ye,{variant:"outline",onClick:()=>L(!1),children:"Cancel"}),a.jsx(ye,{onClick:ee,disabled:!F||le,children:le?a.jsxs(a.Fragment,{children:[a.jsx(St,{className:"mr-2 h-4 w-4 animate-spin"}),"Import..."]}):a.jsxs(a.Fragment,{children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"Import"]})})]})]})}),a.jsx(Pc,{open:n,onClose:()=>s(!1),remainingPoints:(r==null?void 0:r.remaining)??0})]})}const jyt=()=>{const t=mf();return S.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]),a.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:[a.jsx(ai,{title:"Page Not Found | Academly.ai",description:"Private page on Academly.ai.",canonical:"https://academly.ai/404",noIndex:!0}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-4xl font-bold mb-4",children:"404"}),a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Oops! Page not found"}),a.jsx("a",{href:"/",className:"text-blue-500 hover:text-blue-700 underline",children:"Return to Home"})]})]})},Syt=new F1e;function Nyt(){return a.jsx(H1e,{client:Syt,children:a.jsxs(Ai,{children:[a.jsx(i0e,{}),a.jsx(L0e,{}),a.jsx(tje,{children:a.jsxs(G_e,{children:[a.jsx(wt,{path:"/",element:a.jsx(Xit,{})}),a.jsx(wt,{path:"/pricing",element:a.jsx(rat,{})}),a.jsx(wt,{path:"/subscription/success",element:a.jsx(sat,{})}),a.jsx(wt,{path:"/subscription/cancel",element:a.jsx(iat,{})}),a.jsx(wt,{path:"/how-it-works",element:a.jsx(cat,{})}),a.jsx(wt,{path:"/topic-ideas",element:a.jsx(yat,{})}),a.jsx(wt,{path:"/literature-search",element:a.jsx(vat,{})}),a.jsx(wt,{path:"/team",element:a.jsx(_at,{})}),a.jsx(wt,{path:"/waitlist",element:a.jsx(Mot,{})}),a.jsx(wt,{path:"/legal",element:a.jsx($ot,{})}),a.jsx(wt,{path:"/login",element:a.jsx(Hot,{})}),a.jsx(wt,{path:"/reset-password",element:a.jsx(Wot,{})}),a.jsx(wt,{path:"/vs/chatgpt",element:a.jsx(YG,{})}),a.jsx(wt,{path:"/vs/jenni-ai",element:a.jsx(QG,{})}),a.jsx(wt,{path:"/vs/chatgpt",element:a.jsx(YG,{})}),a.jsx(wt,{path:"/vs/jenni-ai",element:a.jsx(QG,{})}),a.jsx(wt,{path:"/vs/perplexity",element:a.jsx(Kot,{})}),a.jsx(wt,{path:"/vs/claude",element:a.jsx(Xot,{})}),a.jsx(wt,{path:"/blog",element:a.jsx(Zot,{})}),a.jsx(wt,{path:"/dashboard",element:a.jsx(yit,{})}),a.jsx(wt,{path:"/documents",element:a.jsx(Aut,{})}),a.jsx(wt,{path:"/summary",element:a.jsx(kut,{})}),a.jsx(wt,{path:"/pdf-extract",element:a.jsx(qgt,{})}),a.jsx(wt,{path:"/pdf-slicer",element:a.jsx(Vgt,{})}),a.jsx(wt,{path:"/topic-explorer",element:a.jsx(Mgt,{})}),a.jsx(wt,{path:"/topic-explorer/ideas",element:a.jsx(Dgt,{})}),a.jsx(wt,{path:"/topic-explorer/outline",element:a.jsx(Lgt,{})}),a.jsx(wt,{path:"/topic-explorer/keywords",element:a.jsx(Fgt,{})}),a.jsx(wt,{path:"/thesis-builder",element:a.jsx(Jut,{})}),a.jsx(wt,{path:"/methods-approach",element:a.jsx(edt,{})}),a.jsx(wt,{path:"/discussion",element:a.jsx(rdt,{})}),a.jsx(wt,{path:"/conclusion",element:a.jsx(sdt,{})}),a.jsx(wt,{path:"/thesis-manager",element:a.jsx(Ogt,{})}),a.jsx(wt,{path:"/my-thesis-2",element:a.jsx(Rgt,{})}),a.jsxs(wt,{path:"/qualitative",element:a.jsx(hyt,{}),children:[a.jsx(wt,{index:!0,element:a.jsx(BD,{to:"/qualitative/research-setup",replace:!0})}),a.jsx(wt,{path:"research-setup",element:a.jsx(fyt,{})}),a.jsx(wt,{path:"kodierbogen",element:a.jsx(pyt,{})}),a.jsx(wt,{path:"kodierbogen-grid",element:a.jsx(gyt,{})}),a.jsx(wt,{path:"interviews",element:a.jsx(yyt,{})}),a.jsx(wt,{path:"kodieren",element:a.jsx(vyt,{})}),a.jsx(wt,{path:"auswertung",element:a.jsx(_yt,{})})]}),a.jsx(wt,{path:"/reference-checker",element:a.jsx(nyt,{})}),a.jsx(wt,{path:"/supervisor",element:a.jsx(dyt,{})}),a.jsx(wt,{path:"/citations",element:a.jsx(BD,{to:"/reference-checker",replace:!0})}),a.jsx(wt,{path:"/history",element:a.jsx(Tut,{})}),a.jsx(wt,{path:"/account",element:a.jsx(Zut,{})}),a.jsx(wt,{path:"*",element:a.jsx(jyt,{})})]})})]})})}aJ(document.getElementById("root")).render(a.jsx(fJ,{children:a.jsx(tCe,{children:a.jsx(_Ne,{children:a.jsx(Nyt,{})})})}));