tokmon 0.20.3 → 0.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{bootstrap-ink-F3JFQ3ON.js → bootstrap-ink-3VQODLRG.js} +82 -41
- package/dist/{chunk-M3RGQIOW.js → chunk-F7RJIR3Z.js} +33 -13
- package/dist/{chunk-ANCKHLJV.js → chunk-HSUYWU4V.js} +333 -277
- package/dist/cli.js +4 -4
- package/dist/{daemon-BUYFTSED.js → daemon-O3R6R2R6.js} +2 -2
- package/dist/{daemon-handle-ZHECQZ6Q.js → daemon-handle-HLSKLMWU.js} +1 -1
- package/dist/{server-R6Z6W4CN.js → server-6DGQI25X.js} +2 -2
- package/dist/web/assets/{breakdown-Dhq6Rqnu.js → breakdown-DFnPYZtA.js} +1 -1
- package/dist/web/assets/{chart-CDwPcOeB.js → chart-C8J22kR3.js} +1 -1
- package/dist/web/assets/index-B9eW55YB.js +105 -0
- package/dist/web/assets/{timeline-D0GFoRzM.js → timeline-BjoaOdbh.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-Bqe9b8BZ.js +0 -105
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./timeline-BjoaOdbh.js","./chart-C8J22kR3.js","./breakdown-DFnPYZtA.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var YE=Object.defineProperty;var XE=(e,t,n)=>t in e?YE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var L=(e,t,n)=>XE(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var z5=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ZE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fh={exports:{}},Sa={},Lh={exports:{}},Pe={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react.production.min.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var xv;function eP(){if(xv)return Pe;xv=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.iterator;function x(M){return M===null||typeof M!="object"?null:(M=p&&M[p]||M["@@iterator"],typeof M=="function"?M:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,k={};function b(M,J,pe){this.props=M,this.context=J,this.refs=k,this.updater=pe||v}b.prototype.isReactComponent={},b.prototype.setState=function(M,J){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,J,"setState")},b.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function _(){}_.prototype=b.prototype;function E(M,J,pe){this.props=M,this.context=J,this.refs=k,this.updater=pe||v}var j=E.prototype=new _;j.constructor=E,w(j,b.prototype),j.isPureReactComponent=!0;var R=Array.isArray,T=Object.prototype.hasOwnProperty,O={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function U(M,J,pe){var he,ce={},be=null,$e=null;if(J!=null)for(he in J.ref!==void 0&&($e=J.ref),J.key!==void 0&&(be=""+J.key),J)T.call(J,he)&&!$.hasOwnProperty(he)&&(ce[he]=J[he]);var Ce=arguments.length-2;if(Ce===1)ce.children=pe;else if(1<Ce){for(var Ee=Array(Ce),lt=0;lt<Ce;lt++)Ee[lt]=arguments[lt+2];ce.children=Ee}if(M&&M.defaultProps)for(he in Ce=M.defaultProps,Ce)ce[he]===void 0&&(ce[he]=Ce[he]);return{$$typeof:e,type:M,key:be,ref:$e,props:ce,_owner:O.current}}function V(M,J){return{$$typeof:e,type:M.type,key:J,ref:M.ref,props:M.props,_owner:M._owner}}function Z(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function te(M){var J={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(pe){return J[pe]})}var ae=/\/+/g;function P(M,J){return typeof M=="object"&&M!==null&&M.key!=null?te(""+M.key):J.toString(36)}function H(M,J,pe,he,ce){var be=typeof M;(be==="undefined"||be==="boolean")&&(M=null);var $e=!1;if(M===null)$e=!0;else switch(be){case"string":case"number":$e=!0;break;case"object":switch(M.$$typeof){case e:case t:$e=!0}}if($e)return $e=M,ce=ce($e),M=he===""?"."+P($e,0):he,R(ce)?(pe="",M!=null&&(pe=M.replace(ae,"$&/")+"/"),H(ce,J,pe,"",function(lt){return lt})):ce!=null&&(Z(ce)&&(ce=V(ce,pe+(!ce.key||$e&&$e.key===ce.key?"":(""+ce.key).replace(ae,"$&/")+"/")+M)),J.push(ce)),1;if($e=0,he=he===""?".":he+":",R(M))for(var Ce=0;Ce<M.length;Ce++){be=M[Ce];var Ee=he+P(be,Ce);$e+=H(be,J,pe,Ee,ce)}else if(Ee=x(M),typeof Ee=="function")for(M=Ee.call(M),Ce=0;!(be=M.next()).done;)be=be.value,Ee=he+P(be,Ce++),$e+=H(be,J,pe,Ee,ce);else if(be==="object")throw J=String(M),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.");return $e}function X(M,J,pe){if(M==null)return M;var he=[],ce=0;return H(M,he,"","",function(be){return J.call(pe,be,ce++)}),he}function K(M){if(M._status===-1){var J=M._result;J=J(),J.then(function(pe){(M._status===0||M._status===-1)&&(M._status=1,M._result=pe)},function(pe){(M._status===0||M._status===-1)&&(M._status=2,M._result=pe)}),M._status===-1&&(M._status=0,M._result=J)}if(M._status===1)return M._result.default;throw M._result}var q={current:null},Y={transition:null},se={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:Y,ReactCurrentOwner:O};function ee(){throw Error("act(...) is not supported in production builds of React.")}return Pe.Children={map:X,forEach:function(M,J,pe){X(M,function(){J.apply(this,arguments)},pe)},count:function(M){var J=0;return X(M,function(){J++}),J},toArray:function(M){return X(M,function(J){return J})||[]},only:function(M){if(!Z(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},Pe.Component=b,Pe.Fragment=n,Pe.Profiler=i,Pe.PureComponent=E,Pe.StrictMode=s,Pe.Suspense=d,Pe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=se,Pe.act=ee,Pe.cloneElement=function(M,J,pe){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var he=w({},M.props),ce=M.key,be=M.ref,$e=M._owner;if(J!=null){if(J.ref!==void 0&&(be=J.ref,$e=O.current),J.key!==void 0&&(ce=""+J.key),M.type&&M.type.defaultProps)var Ce=M.type.defaultProps;for(Ee in J)T.call(J,Ee)&&!$.hasOwnProperty(Ee)&&(he[Ee]=J[Ee]===void 0&&Ce!==void 0?Ce[Ee]:J[Ee])}var Ee=arguments.length-2;if(Ee===1)he.children=pe;else if(1<Ee){Ce=Array(Ee);for(var lt=0;lt<Ee;lt++)Ce[lt]=arguments[lt+2];he.children=Ce}return{$$typeof:e,type:M.type,key:ce,ref:be,props:he,_owner:$e}},Pe.createContext=function(M){return M={$$typeof:u,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:a,_context:M},M.Consumer=M},Pe.createElement=U,Pe.createFactory=function(M){var J=U.bind(null,M);return J.type=M,J},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(M){return{$$typeof:f,render:M}},Pe.isValidElement=Z,Pe.lazy=function(M){return{$$typeof:m,_payload:{_status:-1,_result:M},_init:K}},Pe.memo=function(M,J){return{$$typeof:h,type:M,compare:J===void 0?null:J}},Pe.startTransition=function(M){var J=Y.transition;Y.transition={};try{M()}finally{Y.transition=J}},Pe.unstable_act=ee,Pe.useCallback=function(M,J){return q.current.useCallback(M,J)},Pe.useContext=function(M){return q.current.useContext(M)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(M){return q.current.useDeferredValue(M)},Pe.useEffect=function(M,J){return q.current.useEffect(M,J)},Pe.useId=function(){return q.current.useId()},Pe.useImperativeHandle=function(M,J,pe){return q.current.useImperativeHandle(M,J,pe)},Pe.useInsertionEffect=function(M,J){return q.current.useInsertionEffect(M,J)},Pe.useLayoutEffect=function(M,J){return q.current.useLayoutEffect(M,J)},Pe.useMemo=function(M,J){return q.current.useMemo(M,J)},Pe.useReducer=function(M,J,pe){return q.current.useReducer(M,J,pe)},Pe.useRef=function(M){return q.current.useRef(M)},Pe.useState=function(M){return q.current.useState(M)},Pe.useSyncExternalStore=function(M,J,pe){return q.current.useSyncExternalStore(M,J,pe)},Pe.useTransition=function(){return q.current.useTransition()},Pe.version="18.3.1",Pe}var vv;function xl(){return vv||(vv=1,Lh.exports=eP()),Lh.exports}/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-jsx-runtime.production.min.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var Sv;function tP(){if(Sv)return Sa;Sv=1;var e=xl(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(f,d,h){var m,p={},x=null,v=null;h!==void 0&&(x=""+h),d.key!==void 0&&(x=""+d.key),d.ref!==void 0&&(v=d.ref);for(m in d)s.call(d,m)&&!a.hasOwnProperty(m)&&(p[m]=d[m]);if(f&&f.defaultProps)for(m in d=f.defaultProps,d)p[m]===void 0&&(p[m]=d[m]);return{$$typeof:t,type:f,key:x,ref:v,props:p,_owner:i.current}}return Sa.Fragment=n,Sa.jsx=u,Sa.jsxs=u,Sa}var wv;function nP(){return wv||(wv=1,Fh.exports=tP()),Fh.exports}var y=nP(),z=xl();const Ka=ZE(z);var Ku={},Oh={exports:{}},sn={},Ah={exports:{}},Dh={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.min.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var kv;function rP(){return kv||(kv=1,(function(e){function t(Y,se){var ee=Y.length;Y.push(se);e:for(;0<ee;){var M=ee-1>>>1,J=Y[M];if(0<i(J,se))Y[M]=se,Y[ee]=J,ee=M;else break e}}function n(Y){return Y.length===0?null:Y[0]}function s(Y){if(Y.length===0)return null;var se=Y[0],ee=Y.pop();if(ee!==se){Y[0]=ee;e:for(var M=0,J=Y.length,pe=J>>>1;M<pe;){var he=2*(M+1)-1,ce=Y[he],be=he+1,$e=Y[be];if(0>i(ce,ee))be<J&&0>i($e,ce)?(Y[M]=$e,Y[be]=ee,M=be):(Y[M]=ce,Y[he]=ee,M=he);else if(be<J&&0>i($e,ee))Y[M]=$e,Y[be]=ee,M=be;else break e}}return se}function i(Y,se){var ee=Y.sortIndex-se.sortIndex;return ee!==0?ee:Y.id-se.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var d=[],h=[],m=1,p=null,x=3,v=!1,w=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(Y){for(var se=n(h);se!==null;){if(se.callback===null)s(h);else if(se.startTime<=Y)s(h),se.sortIndex=se.expirationTime,t(d,se);else break;se=n(h)}}function R(Y){if(k=!1,j(Y),!w)if(n(d)!==null)w=!0,K(T);else{var se=n(h);se!==null&&q(R,se.startTime-Y)}}function T(Y,se){w=!1,k&&(k=!1,_(U),U=-1),v=!0;var ee=x;try{for(j(se),p=n(d);p!==null&&(!(p.expirationTime>se)||Y&&!te());){var M=p.callback;if(typeof M=="function"){p.callback=null,x=p.priorityLevel;var J=M(p.expirationTime<=se);se=e.unstable_now(),typeof J=="function"?p.callback=J:p===n(d)&&s(d),j(se)}else s(d);p=n(d)}if(p!==null)var pe=!0;else{var he=n(h);he!==null&&q(R,he.startTime-se),pe=!1}return pe}finally{p=null,x=ee,v=!1}}var O=!1,$=null,U=-1,V=5,Z=-1;function te(){return!(e.unstable_now()-Z<V)}function ae(){if($!==null){var Y=e.unstable_now();Z=Y;var se=!0;try{se=$(!0,Y)}finally{se?P():(O=!1,$=null)}}else O=!1}var P;if(typeof E=="function")P=function(){E(ae)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,X=H.port2;H.port1.onmessage=ae,P=function(){X.postMessage(null)}}else P=function(){b(ae,0)};function K(Y){$=Y,O||(O=!0,P())}function q(Y,se){U=b(function(){Y(e.unstable_now())},se)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Y){Y.callback=null},e.unstable_continueExecution=function(){w||v||(w=!0,K(T))},e.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"):V=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(Y){switch(x){case 1:case 2:case 3:var se=3;break;default:se=x}var ee=x;x=se;try{return Y()}finally{x=ee}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Y,se){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var ee=x;x=Y;try{return se()}finally{x=ee}},e.unstable_scheduleCallback=function(Y,se,ee){var M=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?M+ee:M):ee=M,Y){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=ee+J,Y={id:m++,callback:se,priorityLevel:Y,startTime:ee,expirationTime:J,sortIndex:-1},ee>M?(Y.sortIndex=ee,t(h,Y),n(d)===null&&Y===n(h)&&(k?(_(U),U=-1):k=!0,q(R,ee-M))):(Y.sortIndex=J,t(d,Y),w||v||(w=!0,K(T))),Y},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(Y){var se=x;return function(){var ee=x;x=se;try{return Y.apply(this,arguments)}finally{x=ee}}}})(Dh)),Dh}var Cv;function sP(){return Cv||(Cv=1,Ah.exports=rP()),Ah.exports}/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.min.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var bv;function oP(){if(bv)return sn;bv=1;var e=xl(),t=sP();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,l=1;l<arguments.length;l++)o+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function a(r,o){u(r,o),u(r+"Capture",o)}function u(r,o){for(i[r]=o,r=0;r<o.length;r++)s.add(o[r])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,h=/^[: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]*$/,m={},p={};function x(r){return d.call(p,r)?!0:d.call(m,r)?!1:h.test(r)?p[r]=!0:(m[r]=!0,!1)}function v(r,o,l,c){if(l!==null&&l.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return c?!1:l!==null?!l.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function w(r,o,l,c){if(o===null||typeof o>"u"||v(r,o,l,c))return!0;if(c)return!1;if(l!==null)switch(l.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function k(r,o,l,c,g,S,C){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=c,this.attributeNamespace=g,this.mustUseProperty=l,this.propertyName=r,this.type=o,this.sanitizeURL=S,this.removeEmptyString=C}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){b[r]=new k(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];b[o]=new k(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){b[r]=new k(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){b[r]=new k(r,2,!1,r,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(r){b[r]=new k(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){b[r]=new k(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){b[r]=new k(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){b[r]=new k(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){b[r]=new k(r,5,!1,r.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function E(r){return r[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(r){var o=r.replace(_,E);b[o]=new k(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(_,E);b[o]=new k(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(_,E);b[o]=new k(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){b[r]=new k(r,1,!1,r.toLowerCase(),null,!1,!1)}),b.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){b[r]=new k(r,1,!1,r.toLowerCase(),null,!0,!0)});function j(r,o,l,c){var g=b.hasOwnProperty(o)?b[o]:null;(g!==null?g.type!==0:c||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(w(o,l,g,c)&&(l=null),c||g===null?x(o)&&(l===null?r.removeAttribute(o):r.setAttribute(o,""+l)):g.mustUseProperty?r[g.propertyName]=l===null?g.type===3?!1:"":l:(o=g.attributeName,c=g.attributeNamespace,l===null?r.removeAttribute(o):(g=g.type,l=g===3||g===4&&l===!0?"":""+l,c?r.setAttributeNS(c,o,l):r.setAttribute(o,l))))}var R=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),O=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),Z=Symbol.for("react.provider"),te=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),q=Symbol.for("react.offscreen"),Y=Symbol.iterator;function se(r){return r===null||typeof r!="object"?null:(r=Y&&r[Y]||r["@@iterator"],typeof r=="function"?r:null)}var ee=Object.assign,M;function J(r){if(M===void 0)try{throw Error()}catch(l){var o=l.stack.trim().match(/\n( *(at )?)/);M=o&&o[1]||""}return`
|
|
35
|
+
`+M+r}var pe=!1;function he(r,o){if(!r||pe)return"";pe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(Q){var c=Q}Reflect.construct(r,[],o)}else{try{o.call()}catch(Q){c=Q}r.call(o.prototype)}else{try{throw Error()}catch(Q){c=Q}r()}}catch(Q){if(Q&&c&&typeof Q.stack=="string"){for(var g=Q.stack.split(`
|
|
36
|
+
`),S=c.stack.split(`
|
|
37
|
+
`),C=g.length-1,I=S.length-1;1<=C&&0<=I&&g[C]!==S[I];)I--;for(;1<=C&&0<=I;C--,I--)if(g[C]!==S[I]){if(C!==1||I!==1)do if(C--,I--,0>I||g[C]!==S[I]){var N=`
|
|
38
|
+
`+g[C].replace(" at new "," at ");return r.displayName&&N.includes("<anonymous>")&&(N=N.replace("<anonymous>",r.displayName)),N}while(1<=C&&0<=I);break}}}finally{pe=!1,Error.prepareStackTrace=l}return(r=r?r.displayName||r.name:"")?J(r):""}function ce(r){switch(r.tag){case 5:return J(r.type);case 16:return J("Lazy");case 13:return J("Suspense");case 19:return J("SuspenseList");case 0:case 2:case 15:return r=he(r.type,!1),r;case 11:return r=he(r.type.render,!1),r;case 1:return r=he(r.type,!0),r;default:return""}}function be(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case $:return"Fragment";case O:return"Portal";case V:return"Profiler";case U:return"StrictMode";case P:return"Suspense";case H:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case te:return(r.displayName||"Context")+".Consumer";case Z:return(r._context.displayName||"Context")+".Provider";case ae:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case X:return o=r.displayName||null,o!==null?o:be(r.type)||"Memo";case K:o=r._payload,r=r._init;try{return be(r(o))}catch{}}return null}function $e(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return be(o);case 8:return o===U?"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 o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function Ce(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Ee(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function lt(r){var o=Ee(r)?"checked":"value",l=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),c=""+r[o];if(!r.hasOwnProperty(o)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var g=l.get,S=l.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return g.call(this)},set:function(C){c=""+C,S.call(this,C)}}),Object.defineProperty(r,o,{enumerable:l.enumerable}),{getValue:function(){return c},setValue:function(C){c=""+C},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Sr(r){r._valueTracker||(r._valueTracker=lt(r))}function Ns(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var l=o.getValue(),c="";return r&&(c=Ee(r)?r.checked?"true":"false":r.value),r=c,r!==l?(o.setValue(r),!0):!1}function Ms(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Eo(r,o){var l=o.checked;return ee({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??r._wrapperState.initialChecked})}function Dl(r,o){var l=o.defaultValue==null?"":o.defaultValue,c=o.checked!=null?o.checked:o.defaultChecked;l=Ce(o.value!=null?o.value:l),r._wrapperState={initialChecked:c,initialValue:l,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function $i(r,o){o=o.checked,o!=null&&j(r,"checked",o,!1)}function Po(r,o){$i(r,o);var l=Ce(o.value),c=o.type;if(l!=null)c==="number"?(l===0&&r.value===""||r.value!=l)&&(r.value=""+l):r.value!==""+l&&(r.value=""+l);else if(c==="submit"||c==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ts(r,o.type,l):o.hasOwnProperty("defaultValue")&&Ts(r,o.type,Ce(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function wr(r,o,l){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var c=o.type;if(!(c!=="submit"&&c!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,l||o===r.value||(r.value=o),r.defaultValue=o}l=r.name,l!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,l!==""&&(r.name=l)}function Ts(r,o,l){(o!=="number"||Ms(r.ownerDocument)!==r)&&(l==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+l&&(r.defaultValue=""+l))}var hn=Array.isArray;function zr(r,o,l,c){if(r=r.options,o){o={};for(var g=0;g<l.length;g++)o["$"+l[g]]=!0;for(l=0;l<r.length;l++)g=o.hasOwnProperty("$"+r[l].value),r[l].selected!==g&&(r[l].selected=g),g&&c&&(r[l].defaultSelected=!0)}else{for(l=""+Ce(l),o=null,g=0;g<r.length;g++){if(r[g].value===l){r[g].selected=!0,c&&(r[g].defaultSelected=!0);return}o!==null||r[g].disabled||(o=r[g])}o!==null&&(o.selected=!0)}}function Io(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return ee({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function zl(r,o){var l=o.value;if(l==null){if(l=o.children,o=o.defaultValue,l!=null){if(o!=null)throw Error(n(92));if(hn(l)){if(1<l.length)throw Error(n(93));l=l[0]}o=l}o==null&&(o=""),l=o}r._wrapperState={initialValue:Ce(l)}}function Fi(r,o){var l=Ce(o.value),c=Ce(o.defaultValue);l!=null&&(l=""+l,l!==r.value&&(r.value=l),o.defaultValue==null&&r.defaultValue!==l&&(r.defaultValue=l)),c!=null&&(r.defaultValue=""+c)}function Oe(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Mt(r){switch(r){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 Bn(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Mt(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var jo,M0=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,l,c,g){MSApp.execUnsafeLocalFunction(function(){return r(o,l,c,g)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(jo=jo||document.createElement("div"),jo.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=jo.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function Li(r,o){if(o){var l=r.firstChild;if(l&&l===r.lastChild&&l.nodeType===3){l.nodeValue=o;return}}r.textContent=o}var Oi={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},tR=["Webkit","ms","Moz","O"];Object.keys(Oi).forEach(function(r){tR.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Oi[o]=Oi[r]})});function T0(r,o,l){return o==null||typeof o=="boolean"||o===""?"":l||typeof o!="number"||o===0||Oi.hasOwnProperty(r)&&Oi[r]?(""+o).trim():o+"px"}function $0(r,o){r=r.style;for(var l in o)if(o.hasOwnProperty(l)){var c=l.indexOf("--")===0,g=T0(l,o[l],c);l==="float"&&(l="cssFloat"),c?r.setProperty(l,g):r[l]=g}}var nR=ee({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 Gf(r,o){if(o){if(nR[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function Kf(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){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 Qf=null;function Jf(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Yf=null,No=null,Mo=null;function F0(r){if(r=oa(r)){if(typeof Yf!="function")throw Error(n(280));var o=r.stateNode;o&&(o=uu(o),Yf(r.stateNode,r.type,o))}}function L0(r){No?Mo?Mo.push(r):Mo=[r]:No=r}function O0(){if(No){var r=No,o=Mo;if(Mo=No=null,F0(r),o)for(r=0;r<o.length;r++)F0(o[r])}}function A0(r,o){return r(o)}function D0(){}var Xf=!1;function z0(r,o,l){if(Xf)return r(o,l);Xf=!0;try{return A0(r,o,l)}finally{Xf=!1,(No!==null||Mo!==null)&&(D0(),O0())}}function Ai(r,o){var l=r.stateNode;if(l===null)return null;var c=uu(l);if(c===null)return null;l=c[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(r=r.type,c=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!c;break e;default:r=!1}if(r)return null;if(l&&typeof l!="function")throw Error(n(231,o,typeof l));return l}var Zf=!1;if(f)try{var Di={};Object.defineProperty(Di,"passive",{get:function(){Zf=!0}}),window.addEventListener("test",Di,Di),window.removeEventListener("test",Di,Di)}catch{Zf=!1}function rR(r,o,l,c,g,S,C,I,N){var Q=Array.prototype.slice.call(arguments,3);try{o.apply(l,Q)}catch(oe){this.onError(oe)}}var zi=!1,Ul=null,Vl=!1,ed=null,sR={onError:function(r){zi=!0,Ul=r}};function oR(r,o,l,c,g,S,C,I,N){zi=!1,Ul=null,rR.apply(sR,arguments)}function iR(r,o,l,c,g,S,C,I,N){if(oR.apply(this,arguments),zi){if(zi){var Q=Ul;zi=!1,Ul=null}else throw Error(n(198));Vl||(Vl=!0,ed=Q)}}function $s(r){var o=r,l=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(l=o.return),r=o.return;while(r)}return o.tag===3?l:null}function U0(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function V0(r){if($s(r)!==r)throw Error(n(188))}function aR(r){var o=r.alternate;if(!o){if(o=$s(r),o===null)throw Error(n(188));return o!==r?null:r}for(var l=r,c=o;;){var g=l.return;if(g===null)break;var S=g.alternate;if(S===null){if(c=g.return,c!==null){l=c;continue}break}if(g.child===S.child){for(S=g.child;S;){if(S===l)return V0(g),r;if(S===c)return V0(g),o;S=S.sibling}throw Error(n(188))}if(l.return!==c.return)l=g,c=S;else{for(var C=!1,I=g.child;I;){if(I===l){C=!0,l=g,c=S;break}if(I===c){C=!0,c=g,l=S;break}I=I.sibling}if(!C){for(I=S.child;I;){if(I===l){C=!0,l=S,c=g;break}if(I===c){C=!0,c=S,l=g;break}I=I.sibling}if(!C)throw Error(n(189))}}if(l.alternate!==c)throw Error(n(190))}if(l.tag!==3)throw Error(n(188));return l.stateNode.current===l?r:o}function B0(r){return r=aR(r),r!==null?q0(r):null}function q0(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=q0(r);if(o!==null)return o;r=r.sibling}return null}var H0=t.unstable_scheduleCallback,W0=t.unstable_cancelCallback,lR=t.unstable_shouldYield,uR=t.unstable_requestPaint,ut=t.unstable_now,cR=t.unstable_getCurrentPriorityLevel,td=t.unstable_ImmediatePriority,G0=t.unstable_UserBlockingPriority,Bl=t.unstable_NormalPriority,fR=t.unstable_LowPriority,K0=t.unstable_IdlePriority,ql=null,ar=null;function dR(r){if(ar&&typeof ar.onCommitFiberRoot=="function")try{ar.onCommitFiberRoot(ql,r,void 0,(r.current.flags&128)===128)}catch{}}var qn=Math.clz32?Math.clz32:pR,hR=Math.log,gR=Math.LN2;function pR(r){return r>>>=0,r===0?32:31-(hR(r)/gR|0)|0}var Hl=64,Wl=4194304;function Ui(r){switch(r&-r){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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function Gl(r,o){var l=r.pendingLanes;if(l===0)return 0;var c=0,g=r.suspendedLanes,S=r.pingedLanes,C=l&268435455;if(C!==0){var I=C&~g;I!==0?c=Ui(I):(S&=C,S!==0&&(c=Ui(S)))}else C=l&~g,C!==0?c=Ui(C):S!==0&&(c=Ui(S));if(c===0)return 0;if(o!==0&&o!==c&&(o&g)===0&&(g=c&-c,S=o&-o,g>=S||g===16&&(S&4194240)!==0))return o;if((c&4)!==0&&(c|=l&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=c;0<o;)l=31-qn(o),g=1<<l,c|=r[l],o&=~g;return c}function mR(r,o){switch(r){case 1:case 2:case 4:return o+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 o+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 yR(r,o){for(var l=r.suspendedLanes,c=r.pingedLanes,g=r.expirationTimes,S=r.pendingLanes;0<S;){var C=31-qn(S),I=1<<C,N=g[C];N===-1?((I&l)===0||(I&c)!==0)&&(g[C]=mR(I,o)):N<=o&&(r.expiredLanes|=I),S&=~I}}function nd(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Q0(){var r=Hl;return Hl<<=1,(Hl&4194240)===0&&(Hl=64),r}function rd(r){for(var o=[],l=0;31>l;l++)o.push(r);return o}function Vi(r,o,l){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-qn(o),r[o]=l}function xR(r,o){var l=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var c=r.eventTimes;for(r=r.expirationTimes;0<l;){var g=31-qn(l),S=1<<g;o[g]=0,c[g]=-1,r[g]=-1,l&=~S}}function sd(r,o){var l=r.entangledLanes|=o;for(r=r.entanglements;l;){var c=31-qn(l),g=1<<c;g&o|r[c]&o&&(r[c]|=o),l&=~g}}var Ae=0;function J0(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Y0,od,X0,Z0,ey,id=!1,Kl=[],Ur=null,Vr=null,Br=null,Bi=new Map,qi=new Map,qr=[],vR="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 ty(r,o){switch(r){case"focusin":case"focusout":Ur=null;break;case"dragenter":case"dragleave":Vr=null;break;case"mouseover":case"mouseout":Br=null;break;case"pointerover":case"pointerout":Bi.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":qi.delete(o.pointerId)}}function Hi(r,o,l,c,g,S){return r===null||r.nativeEvent!==S?(r={blockedOn:o,domEventName:l,eventSystemFlags:c,nativeEvent:S,targetContainers:[g]},o!==null&&(o=oa(o),o!==null&&od(o)),r):(r.eventSystemFlags|=c,o=r.targetContainers,g!==null&&o.indexOf(g)===-1&&o.push(g),r)}function SR(r,o,l,c,g){switch(o){case"focusin":return Ur=Hi(Ur,r,o,l,c,g),!0;case"dragenter":return Vr=Hi(Vr,r,o,l,c,g),!0;case"mouseover":return Br=Hi(Br,r,o,l,c,g),!0;case"pointerover":var S=g.pointerId;return Bi.set(S,Hi(Bi.get(S)||null,r,o,l,c,g)),!0;case"gotpointercapture":return S=g.pointerId,qi.set(S,Hi(qi.get(S)||null,r,o,l,c,g)),!0}return!1}function ny(r){var o=Fs(r.target);if(o!==null){var l=$s(o);if(l!==null){if(o=l.tag,o===13){if(o=U0(l),o!==null){r.blockedOn=o,ey(r.priority,function(){X0(l)});return}}else if(o===3&&l.stateNode.current.memoizedState.isDehydrated){r.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Ql(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var l=ld(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(l===null){l=r.nativeEvent;var c=new l.constructor(l.type,l);Qf=c,l.target.dispatchEvent(c),Qf=null}else return o=oa(l),o!==null&&od(o),r.blockedOn=l,!1;o.shift()}return!0}function ry(r,o,l){Ql(r)&&l.delete(o)}function wR(){id=!1,Ur!==null&&Ql(Ur)&&(Ur=null),Vr!==null&&Ql(Vr)&&(Vr=null),Br!==null&&Ql(Br)&&(Br=null),Bi.forEach(ry),qi.forEach(ry)}function Wi(r,o){r.blockedOn===o&&(r.blockedOn=null,id||(id=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,wR)))}function Gi(r){function o(g){return Wi(g,r)}if(0<Kl.length){Wi(Kl[0],r);for(var l=1;l<Kl.length;l++){var c=Kl[l];c.blockedOn===r&&(c.blockedOn=null)}}for(Ur!==null&&Wi(Ur,r),Vr!==null&&Wi(Vr,r),Br!==null&&Wi(Br,r),Bi.forEach(o),qi.forEach(o),l=0;l<qr.length;l++)c=qr[l],c.blockedOn===r&&(c.blockedOn=null);for(;0<qr.length&&(l=qr[0],l.blockedOn===null);)ny(l),l.blockedOn===null&&qr.shift()}var To=R.ReactCurrentBatchConfig,Jl=!0;function kR(r,o,l,c){var g=Ae,S=To.transition;To.transition=null;try{Ae=1,ad(r,o,l,c)}finally{Ae=g,To.transition=S}}function CR(r,o,l,c){var g=Ae,S=To.transition;To.transition=null;try{Ae=4,ad(r,o,l,c)}finally{Ae=g,To.transition=S}}function ad(r,o,l,c){if(Jl){var g=ld(r,o,l,c);if(g===null)_d(r,o,c,Yl,l),ty(r,c);else if(SR(g,r,o,l,c))c.stopPropagation();else if(ty(r,c),o&4&&-1<vR.indexOf(r)){for(;g!==null;){var S=oa(g);if(S!==null&&Y0(S),S=ld(r,o,l,c),S===null&&_d(r,o,c,Yl,l),S===g)break;g=S}g!==null&&c.stopPropagation()}else _d(r,o,c,null,l)}}var Yl=null;function ld(r,o,l,c){if(Yl=null,r=Jf(c),r=Fs(r),r!==null)if(o=$s(r),o===null)r=null;else if(l=o.tag,l===13){if(r=U0(o),r!==null)return r;r=null}else if(l===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Yl=r,null}function sy(r){switch(r){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(cR()){case td:return 1;case G0:return 4;case Bl:case fR:return 16;case K0:return 536870912;default:return 16}default:return 16}}var Hr=null,ud=null,Xl=null;function oy(){if(Xl)return Xl;var r,o=ud,l=o.length,c,g="value"in Hr?Hr.value:Hr.textContent,S=g.length;for(r=0;r<l&&o[r]===g[r];r++);var C=l-r;for(c=1;c<=C&&o[l-c]===g[S-c];c++);return Xl=g.slice(r,1<c?1-c:void 0)}function Zl(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function eu(){return!0}function iy(){return!1}function gn(r){function o(l,c,g,S,C){this._reactName=l,this._targetInst=g,this.type=c,this.nativeEvent=S,this.target=C,this.currentTarget=null;for(var I in r)r.hasOwnProperty(I)&&(l=r[I],this[I]=l?l(S):S[I]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?eu:iy,this.isPropagationStopped=iy,this}return ee(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=eu)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=eu)},persist:function(){},isPersistent:eu}),o}var $o={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cd=gn($o),Ki=ee({},$o,{view:0,detail:0}),bR=gn(Ki),fd,dd,Qi,tu=ee({},Ki,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gd,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Qi&&(Qi&&r.type==="mousemove"?(fd=r.screenX-Qi.screenX,dd=r.screenY-Qi.screenY):dd=fd=0,Qi=r),fd)},movementY:function(r){return"movementY"in r?r.movementY:dd}}),ay=gn(tu),_R=ee({},tu,{dataTransfer:0}),RR=gn(_R),ER=ee({},Ki,{relatedTarget:0}),hd=gn(ER),PR=ee({},$o,{animationName:0,elapsedTime:0,pseudoElement:0}),IR=gn(PR),jR=ee({},$o,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),NR=gn(jR),MR=ee({},$o,{data:0}),ly=gn(MR),TR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$R={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"},FR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function LR(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=FR[r])?!!o[r]:!1}function gd(){return LR}var OR=ee({},Ki,{key:function(r){if(r.key){var o=TR[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Zl(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?$R[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gd,charCode:function(r){return r.type==="keypress"?Zl(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Zl(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),AR=gn(OR),DR=ee({},tu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),uy=gn(DR),zR=ee({},Ki,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gd}),UR=gn(zR),VR=ee({},$o,{propertyName:0,elapsedTime:0,pseudoElement:0}),BR=gn(VR),qR=ee({},tu,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),HR=gn(qR),WR=[9,13,27,32],pd=f&&"CompositionEvent"in window,Ji=null;f&&"documentMode"in document&&(Ji=document.documentMode);var GR=f&&"TextEvent"in window&&!Ji,cy=f&&(!pd||Ji&&8<Ji&&11>=Ji),fy=" ",dy=!1;function hy(r,o){switch(r){case"keyup":return WR.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gy(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Fo=!1;function KR(r,o){switch(r){case"compositionend":return gy(o);case"keypress":return o.which!==32?null:(dy=!0,fy);case"textInput":return r=o.data,r===fy&&dy?null:r;default:return null}}function QR(r,o){if(Fo)return r==="compositionend"||!pd&&hy(r,o)?(r=oy(),Xl=ud=Hr=null,Fo=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return cy&&o.locale!=="ko"?null:o.data;default:return null}}var JR={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 py(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!JR[r.type]:o==="textarea"}function my(r,o,l,c){L0(c),o=iu(o,"onChange"),0<o.length&&(l=new cd("onChange","change",null,l,c),r.push({event:l,listeners:o}))}var Yi=null,Xi=null;function YR(r){$y(r,0)}function nu(r){var o=zo(r);if(Ns(o))return r}function XR(r,o){if(r==="change")return o}var yy=!1;if(f){var md;if(f){var yd="oninput"in document;if(!yd){var xy=document.createElement("div");xy.setAttribute("oninput","return;"),yd=typeof xy.oninput=="function"}md=yd}else md=!1;yy=md&&(!document.documentMode||9<document.documentMode)}function vy(){Yi&&(Yi.detachEvent("onpropertychange",Sy),Xi=Yi=null)}function Sy(r){if(r.propertyName==="value"&&nu(Xi)){var o=[];my(o,Xi,r,Jf(r)),z0(YR,o)}}function ZR(r,o,l){r==="focusin"?(vy(),Yi=o,Xi=l,Yi.attachEvent("onpropertychange",Sy)):r==="focusout"&&vy()}function eE(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return nu(Xi)}function tE(r,o){if(r==="click")return nu(o)}function nE(r,o){if(r==="input"||r==="change")return nu(o)}function rE(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Hn=typeof Object.is=="function"?Object.is:rE;function Zi(r,o){if(Hn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var l=Object.keys(r),c=Object.keys(o);if(l.length!==c.length)return!1;for(c=0;c<l.length;c++){var g=l[c];if(!d.call(o,g)||!Hn(r[g],o[g]))return!1}return!0}function wy(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function ky(r,o){var l=wy(r);r=0;for(var c;l;){if(l.nodeType===3){if(c=r+l.textContent.length,r<=o&&c>=o)return{node:l,offset:o-r};r=c}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=wy(l)}}function Cy(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Cy(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function by(){for(var r=window,o=Ms();o instanceof r.HTMLIFrameElement;){try{var l=typeof o.contentWindow.location.href=="string"}catch{l=!1}if(l)r=o.contentWindow;else break;o=Ms(r.document)}return o}function xd(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function sE(r){var o=by(),l=r.focusedElem,c=r.selectionRange;if(o!==l&&l&&l.ownerDocument&&Cy(l.ownerDocument.documentElement,l)){if(c!==null&&xd(l)){if(o=c.start,r=c.end,r===void 0&&(r=o),"selectionStart"in l)l.selectionStart=o,l.selectionEnd=Math.min(r,l.value.length);else if(r=(o=l.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var g=l.textContent.length,S=Math.min(c.start,g);c=c.end===void 0?S:Math.min(c.end,g),!r.extend&&S>c&&(g=c,c=S,S=g),g=ky(l,S);var C=ky(l,c);g&&C&&(r.rangeCount!==1||r.anchorNode!==g.node||r.anchorOffset!==g.offset||r.focusNode!==C.node||r.focusOffset!==C.offset)&&(o=o.createRange(),o.setStart(g.node,g.offset),r.removeAllRanges(),S>c?(r.addRange(o),r.extend(C.node,C.offset)):(o.setEnd(C.node,C.offset),r.addRange(o)))}}for(o=[],r=l;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<o.length;l++)r=o[l],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var oE=f&&"documentMode"in document&&11>=document.documentMode,Lo=null,vd=null,ea=null,Sd=!1;function _y(r,o,l){var c=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Sd||Lo==null||Lo!==Ms(c)||(c=Lo,"selectionStart"in c&&xd(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),ea&&Zi(ea,c)||(ea=c,c=iu(vd,"onSelect"),0<c.length&&(o=new cd("onSelect","select",null,o,l),r.push({event:o,listeners:c}),o.target=Lo)))}function ru(r,o){var l={};return l[r.toLowerCase()]=o.toLowerCase(),l["Webkit"+r]="webkit"+o,l["Moz"+r]="moz"+o,l}var Oo={animationend:ru("Animation","AnimationEnd"),animationiteration:ru("Animation","AnimationIteration"),animationstart:ru("Animation","AnimationStart"),transitionend:ru("Transition","TransitionEnd")},wd={},Ry={};f&&(Ry=document.createElement("div").style,"AnimationEvent"in window||(delete Oo.animationend.animation,delete Oo.animationiteration.animation,delete Oo.animationstart.animation),"TransitionEvent"in window||delete Oo.transitionend.transition);function su(r){if(wd[r])return wd[r];if(!Oo[r])return r;var o=Oo[r],l;for(l in o)if(o.hasOwnProperty(l)&&l in Ry)return wd[r]=o[l];return r}var Ey=su("animationend"),Py=su("animationiteration"),Iy=su("animationstart"),jy=su("transitionend"),Ny=new Map,My="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 Wr(r,o){Ny.set(r,o),a(o,[r])}for(var kd=0;kd<My.length;kd++){var Cd=My[kd],iE=Cd.toLowerCase(),aE=Cd[0].toUpperCase()+Cd.slice(1);Wr(iE,"on"+aE)}Wr(Ey,"onAnimationEnd"),Wr(Py,"onAnimationIteration"),Wr(Iy,"onAnimationStart"),Wr("dblclick","onDoubleClick"),Wr("focusin","onFocus"),Wr("focusout","onBlur"),Wr(jy,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ta="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(" "),lE=new Set("cancel close invalid load scroll toggle".split(" ").concat(ta));function Ty(r,o,l){var c=r.type||"unknown-event";r.currentTarget=l,iR(c,o,void 0,r),r.currentTarget=null}function $y(r,o){o=(o&4)!==0;for(var l=0;l<r.length;l++){var c=r[l],g=c.event;c=c.listeners;e:{var S=void 0;if(o)for(var C=c.length-1;0<=C;C--){var I=c[C],N=I.instance,Q=I.currentTarget;if(I=I.listener,N!==S&&g.isPropagationStopped())break e;Ty(g,I,Q),S=N}else for(C=0;C<c.length;C++){if(I=c[C],N=I.instance,Q=I.currentTarget,I=I.listener,N!==S&&g.isPropagationStopped())break e;Ty(g,I,Q),S=N}}}if(Vl)throw r=ed,Vl=!1,ed=null,r}function We(r,o){var l=o[Nd];l===void 0&&(l=o[Nd]=new Set);var c=r+"__bubble";l.has(c)||(Fy(o,r,2,!1),l.add(c))}function bd(r,o,l){var c=0;o&&(c|=4),Fy(l,r,c,o)}var ou="_reactListening"+Math.random().toString(36).slice(2);function na(r){if(!r[ou]){r[ou]=!0,s.forEach(function(l){l!=="selectionchange"&&(lE.has(l)||bd(l,!1,r),bd(l,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[ou]||(o[ou]=!0,bd("selectionchange",!1,o))}}function Fy(r,o,l,c){switch(sy(o)){case 1:var g=kR;break;case 4:g=CR;break;default:g=ad}l=g.bind(null,o,l,r),g=void 0,!Zf||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(g=!0),c?g!==void 0?r.addEventListener(o,l,{capture:!0,passive:g}):r.addEventListener(o,l,!0):g!==void 0?r.addEventListener(o,l,{passive:g}):r.addEventListener(o,l,!1)}function _d(r,o,l,c,g){var S=c;if((o&1)===0&&(o&2)===0&&c!==null)e:for(;;){if(c===null)return;var C=c.tag;if(C===3||C===4){var I=c.stateNode.containerInfo;if(I===g||I.nodeType===8&&I.parentNode===g)break;if(C===4)for(C=c.return;C!==null;){var N=C.tag;if((N===3||N===4)&&(N=C.stateNode.containerInfo,N===g||N.nodeType===8&&N.parentNode===g))return;C=C.return}for(;I!==null;){if(C=Fs(I),C===null)return;if(N=C.tag,N===5||N===6){c=S=C;continue e}I=I.parentNode}}c=c.return}z0(function(){var Q=S,oe=Jf(l),ie=[];e:{var ne=Ny.get(r);if(ne!==void 0){var fe=cd,ge=r;switch(r){case"keypress":if(Zl(l)===0)break e;case"keydown":case"keyup":fe=AR;break;case"focusin":ge="focus",fe=hd;break;case"focusout":ge="blur",fe=hd;break;case"beforeblur":case"afterblur":fe=hd;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=ay;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=RR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=UR;break;case Ey:case Py:case Iy:fe=IR;break;case jy:fe=BR;break;case"scroll":fe=bR;break;case"wheel":fe=HR;break;case"copy":case"cut":case"paste":fe=NR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=uy}var me=(o&4)!==0,ct=!me&&r==="scroll",B=me?ne!==null?ne+"Capture":null:ne;me=[];for(var F=Q,W;F!==null;){W=F;var le=W.stateNode;if(W.tag===5&&le!==null&&(W=le,B!==null&&(le=Ai(F,B),le!=null&&me.push(ra(F,le,W)))),ct)break;F=F.return}0<me.length&&(ne=new fe(ne,ge,null,l,oe),ie.push({event:ne,listeners:me}))}}if((o&7)===0){e:{if(ne=r==="mouseover"||r==="pointerover",fe=r==="mouseout"||r==="pointerout",ne&&l!==Qf&&(ge=l.relatedTarget||l.fromElement)&&(Fs(ge)||ge[kr]))break e;if((fe||ne)&&(ne=oe.window===oe?oe:(ne=oe.ownerDocument)?ne.defaultView||ne.parentWindow:window,fe?(ge=l.relatedTarget||l.toElement,fe=Q,ge=ge?Fs(ge):null,ge!==null&&(ct=$s(ge),ge!==ct||ge.tag!==5&&ge.tag!==6)&&(ge=null)):(fe=null,ge=Q),fe!==ge)){if(me=ay,le="onMouseLeave",B="onMouseEnter",F="mouse",(r==="pointerout"||r==="pointerover")&&(me=uy,le="onPointerLeave",B="onPointerEnter",F="pointer"),ct=fe==null?ne:zo(fe),W=ge==null?ne:zo(ge),ne=new me(le,F+"leave",fe,l,oe),ne.target=ct,ne.relatedTarget=W,le=null,Fs(oe)===Q&&(me=new me(B,F+"enter",ge,l,oe),me.target=W,me.relatedTarget=ct,le=me),ct=le,fe&&ge)t:{for(me=fe,B=ge,F=0,W=me;W;W=Ao(W))F++;for(W=0,le=B;le;le=Ao(le))W++;for(;0<F-W;)me=Ao(me),F--;for(;0<W-F;)B=Ao(B),W--;for(;F--;){if(me===B||B!==null&&me===B.alternate)break t;me=Ao(me),B=Ao(B)}me=null}else me=null;fe!==null&&Ly(ie,ne,fe,me,!1),ge!==null&&ct!==null&&Ly(ie,ct,ge,me,!0)}}e:{if(ne=Q?zo(Q):window,fe=ne.nodeName&&ne.nodeName.toLowerCase(),fe==="select"||fe==="input"&&ne.type==="file")var ye=XR;else if(py(ne))if(yy)ye=nE;else{ye=eE;var xe=ZR}else(fe=ne.nodeName)&&fe.toLowerCase()==="input"&&(ne.type==="checkbox"||ne.type==="radio")&&(ye=tE);if(ye&&(ye=ye(r,Q))){my(ie,ye,l,oe);break e}xe&&xe(r,ne,Q),r==="focusout"&&(xe=ne._wrapperState)&&xe.controlled&&ne.type==="number"&&Ts(ne,"number",ne.value)}switch(xe=Q?zo(Q):window,r){case"focusin":(py(xe)||xe.contentEditable==="true")&&(Lo=xe,vd=Q,ea=null);break;case"focusout":ea=vd=Lo=null;break;case"mousedown":Sd=!0;break;case"contextmenu":case"mouseup":case"dragend":Sd=!1,_y(ie,l,oe);break;case"selectionchange":if(oE)break;case"keydown":case"keyup":_y(ie,l,oe)}var ve;if(pd)e:{switch(r){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else Fo?hy(r,l)&&(ke="onCompositionEnd"):r==="keydown"&&l.keyCode===229&&(ke="onCompositionStart");ke&&(cy&&l.locale!=="ko"&&(Fo||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&Fo&&(ve=oy()):(Hr=oe,ud="value"in Hr?Hr.value:Hr.textContent,Fo=!0)),xe=iu(Q,ke),0<xe.length&&(ke=new ly(ke,r,null,l,oe),ie.push({event:ke,listeners:xe}),ve?ke.data=ve:(ve=gy(l),ve!==null&&(ke.data=ve)))),(ve=GR?KR(r,l):QR(r,l))&&(Q=iu(Q,"onBeforeInput"),0<Q.length&&(oe=new ly("onBeforeInput","beforeinput",null,l,oe),ie.push({event:oe,listeners:Q}),oe.data=ve))}$y(ie,o)})}function ra(r,o,l){return{instance:r,listener:o,currentTarget:l}}function iu(r,o){for(var l=o+"Capture",c=[];r!==null;){var g=r,S=g.stateNode;g.tag===5&&S!==null&&(g=S,S=Ai(r,l),S!=null&&c.unshift(ra(r,S,g)),S=Ai(r,o),S!=null&&c.push(ra(r,S,g))),r=r.return}return c}function Ao(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function Ly(r,o,l,c,g){for(var S=o._reactName,C=[];l!==null&&l!==c;){var I=l,N=I.alternate,Q=I.stateNode;if(N!==null&&N===c)break;I.tag===5&&Q!==null&&(I=Q,g?(N=Ai(l,S),N!=null&&C.unshift(ra(l,N,I))):g||(N=Ai(l,S),N!=null&&C.push(ra(l,N,I)))),l=l.return}C.length!==0&&r.push({event:o,listeners:C})}var uE=/\r\n?/g,cE=/\u0000|\uFFFD/g;function Oy(r){return(typeof r=="string"?r:""+r).replace(uE,`
|
|
39
|
+
`).replace(cE,"")}function au(r,o,l){if(o=Oy(o),Oy(r)!==o&&l)throw Error(n(425))}function lu(){}var Rd=null,Ed=null;function Pd(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Id=typeof setTimeout=="function"?setTimeout:void 0,fE=typeof clearTimeout=="function"?clearTimeout:void 0,Ay=typeof Promise=="function"?Promise:void 0,dE=typeof queueMicrotask=="function"?queueMicrotask:typeof Ay<"u"?function(r){return Ay.resolve(null).then(r).catch(hE)}:Id;function hE(r){setTimeout(function(){throw r})}function jd(r,o){var l=o,c=0;do{var g=l.nextSibling;if(r.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"){if(c===0){r.removeChild(g),Gi(o);return}c--}else l!=="$"&&l!=="$?"&&l!=="$!"||c++;l=g}while(l);Gi(o)}function Gr(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function Dy(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var l=r.data;if(l==="$"||l==="$!"||l==="$?"){if(o===0)return r;o--}else l==="/$"&&o++}r=r.previousSibling}return null}var Do=Math.random().toString(36).slice(2),lr="__reactFiber$"+Do,sa="__reactProps$"+Do,kr="__reactContainer$"+Do,Nd="__reactEvents$"+Do,gE="__reactListeners$"+Do,pE="__reactHandles$"+Do;function Fs(r){var o=r[lr];if(o)return o;for(var l=r.parentNode;l;){if(o=l[kr]||l[lr]){if(l=o.alternate,o.child!==null||l!==null&&l.child!==null)for(r=Dy(r);r!==null;){if(l=r[lr])return l;r=Dy(r)}return o}r=l,l=r.parentNode}return null}function oa(r){return r=r[lr]||r[kr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function zo(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function uu(r){return r[sa]||null}var Md=[],Uo=-1;function Kr(r){return{current:r}}function Ge(r){0>Uo||(r.current=Md[Uo],Md[Uo]=null,Uo--)}function qe(r,o){Uo++,Md[Uo]=r.current,r.current=o}var Qr={},Ot=Kr(Qr),Zt=Kr(!1),Ls=Qr;function Vo(r,o){var l=r.type.contextTypes;if(!l)return Qr;var c=r.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===o)return c.__reactInternalMemoizedMaskedChildContext;var g={},S;for(S in l)g[S]=o[S];return c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=g),g}function en(r){return r=r.childContextTypes,r!=null}function cu(){Ge(Zt),Ge(Ot)}function zy(r,o,l){if(Ot.current!==Qr)throw Error(n(168));qe(Ot,o),qe(Zt,l)}function Uy(r,o,l){var c=r.stateNode;if(o=o.childContextTypes,typeof c.getChildContext!="function")return l;c=c.getChildContext();for(var g in c)if(!(g in o))throw Error(n(108,$e(r)||"Unknown",g));return ee({},l,c)}function fu(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Qr,Ls=Ot.current,qe(Ot,r),qe(Zt,Zt.current),!0}function Vy(r,o,l){var c=r.stateNode;if(!c)throw Error(n(169));l?(r=Uy(r,o,Ls),c.__reactInternalMemoizedMergedChildContext=r,Ge(Zt),Ge(Ot),qe(Ot,r)):Ge(Zt),qe(Zt,l)}var Cr=null,du=!1,Td=!1;function By(r){Cr===null?Cr=[r]:Cr.push(r)}function mE(r){du=!0,By(r)}function Jr(){if(!Td&&Cr!==null){Td=!0;var r=0,o=Ae;try{var l=Cr;for(Ae=1;r<l.length;r++){var c=l[r];do c=c(!0);while(c!==null)}Cr=null,du=!1}catch(g){throw Cr!==null&&(Cr=Cr.slice(r+1)),H0(td,Jr),g}finally{Ae=o,Td=!1}}return null}var Bo=[],qo=0,hu=null,gu=0,Pn=[],In=0,Os=null,br=1,_r="";function As(r,o){Bo[qo++]=gu,Bo[qo++]=hu,hu=r,gu=o}function qy(r,o,l){Pn[In++]=br,Pn[In++]=_r,Pn[In++]=Os,Os=r;var c=br;r=_r;var g=32-qn(c)-1;c&=~(1<<g),l+=1;var S=32-qn(o)+g;if(30<S){var C=g-g%5;S=(c&(1<<C)-1).toString(32),c>>=C,g-=C,br=1<<32-qn(o)+g|l<<g|c,_r=S+r}else br=1<<S|l<<g|c,_r=r}function $d(r){r.return!==null&&(As(r,1),qy(r,1,0))}function Fd(r){for(;r===hu;)hu=Bo[--qo],Bo[qo]=null,gu=Bo[--qo],Bo[qo]=null;for(;r===Os;)Os=Pn[--In],Pn[In]=null,_r=Pn[--In],Pn[In]=null,br=Pn[--In],Pn[In]=null}var pn=null,mn=null,Qe=!1,Wn=null;function Hy(r,o){var l=Tn(5,null,null,0);l.elementType="DELETED",l.stateNode=o,l.return=r,o=r.deletions,o===null?(r.deletions=[l],r.flags|=16):o.push(l)}function Wy(r,o){switch(r.tag){case 5:var l=r.type;return o=o.nodeType!==1||l.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,pn=r,mn=Gr(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,pn=r,mn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(l=Os!==null?{id:br,overflow:_r}:null,r.memoizedState={dehydrated:o,treeContext:l,retryLane:1073741824},l=Tn(18,null,null,0),l.stateNode=o,l.return=r,r.child=l,pn=r,mn=null,!0):!1;default:return!1}}function Ld(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Od(r){if(Qe){var o=mn;if(o){var l=o;if(!Wy(r,o)){if(Ld(r))throw Error(n(418));o=Gr(l.nextSibling);var c=pn;o&&Wy(r,o)?Hy(c,l):(r.flags=r.flags&-4097|2,Qe=!1,pn=r)}}else{if(Ld(r))throw Error(n(418));r.flags=r.flags&-4097|2,Qe=!1,pn=r}}}function Gy(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;pn=r}function pu(r){if(r!==pn)return!1;if(!Qe)return Gy(r),Qe=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Pd(r.type,r.memoizedProps)),o&&(o=mn)){if(Ld(r))throw Ky(),Error(n(418));for(;o;)Hy(r,o),o=Gr(o.nextSibling)}if(Gy(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var l=r.data;if(l==="/$"){if(o===0){mn=Gr(r.nextSibling);break e}o--}else l!=="$"&&l!=="$!"&&l!=="$?"||o++}r=r.nextSibling}mn=null}}else mn=pn?Gr(r.stateNode.nextSibling):null;return!0}function Ky(){for(var r=mn;r;)r=Gr(r.nextSibling)}function Ho(){mn=pn=null,Qe=!1}function Ad(r){Wn===null?Wn=[r]:Wn.push(r)}var yE=R.ReactCurrentBatchConfig;function ia(r,o,l){if(r=l.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(n(309));var c=l.stateNode}if(!c)throw Error(n(147,r));var g=c,S=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===S?o.ref:(o=function(C){var I=g.refs;C===null?delete I[S]:I[S]=C},o._stringRef=S,o)}if(typeof r!="string")throw Error(n(284));if(!l._owner)throw Error(n(290,r))}return r}function mu(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function Qy(r){var o=r._init;return o(r._payload)}function Jy(r){function o(B,F){if(r){var W=B.deletions;W===null?(B.deletions=[F],B.flags|=16):W.push(F)}}function l(B,F){if(!r)return null;for(;F!==null;)o(B,F),F=F.sibling;return null}function c(B,F){for(B=new Map;F!==null;)F.key!==null?B.set(F.key,F):B.set(F.index,F),F=F.sibling;return B}function g(B,F){return B=ss(B,F),B.index=0,B.sibling=null,B}function S(B,F,W){return B.index=W,r?(W=B.alternate,W!==null?(W=W.index,W<F?(B.flags|=2,F):W):(B.flags|=2,F)):(B.flags|=1048576,F)}function C(B){return r&&B.alternate===null&&(B.flags|=2),B}function I(B,F,W,le){return F===null||F.tag!==6?(F=Ih(W,B.mode,le),F.return=B,F):(F=g(F,W),F.return=B,F)}function N(B,F,W,le){var ye=W.type;return ye===$?oe(B,F,W.props.children,le,W.key):F!==null&&(F.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===K&&Qy(ye)===F.type)?(le=g(F,W.props),le.ref=ia(B,F,W),le.return=B,le):(le=zu(W.type,W.key,W.props,null,B.mode,le),le.ref=ia(B,F,W),le.return=B,le)}function Q(B,F,W,le){return F===null||F.tag!==4||F.stateNode.containerInfo!==W.containerInfo||F.stateNode.implementation!==W.implementation?(F=jh(W,B.mode,le),F.return=B,F):(F=g(F,W.children||[]),F.return=B,F)}function oe(B,F,W,le,ye){return F===null||F.tag!==7?(F=Ws(W,B.mode,le,ye),F.return=B,F):(F=g(F,W),F.return=B,F)}function ie(B,F,W){if(typeof F=="string"&&F!==""||typeof F=="number")return F=Ih(""+F,B.mode,W),F.return=B,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case T:return W=zu(F.type,F.key,F.props,null,B.mode,W),W.ref=ia(B,null,F),W.return=B,W;case O:return F=jh(F,B.mode,W),F.return=B,F;case K:var le=F._init;return ie(B,le(F._payload),W)}if(hn(F)||se(F))return F=Ws(F,B.mode,W,null),F.return=B,F;mu(B,F)}return null}function ne(B,F,W,le){var ye=F!==null?F.key:null;if(typeof W=="string"&&W!==""||typeof W=="number")return ye!==null?null:I(B,F,""+W,le);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case T:return W.key===ye?N(B,F,W,le):null;case O:return W.key===ye?Q(B,F,W,le):null;case K:return ye=W._init,ne(B,F,ye(W._payload),le)}if(hn(W)||se(W))return ye!==null?null:oe(B,F,W,le,null);mu(B,W)}return null}function fe(B,F,W,le,ye){if(typeof le=="string"&&le!==""||typeof le=="number")return B=B.get(W)||null,I(F,B,""+le,ye);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case T:return B=B.get(le.key===null?W:le.key)||null,N(F,B,le,ye);case O:return B=B.get(le.key===null?W:le.key)||null,Q(F,B,le,ye);case K:var xe=le._init;return fe(B,F,W,xe(le._payload),ye)}if(hn(le)||se(le))return B=B.get(W)||null,oe(F,B,le,ye,null);mu(F,le)}return null}function ge(B,F,W,le){for(var ye=null,xe=null,ve=F,ke=F=0,Ct=null;ve!==null&&ke<W.length;ke++){ve.index>ke?(Ct=ve,ve=null):Ct=ve.sibling;var Fe=ne(B,ve,W[ke],le);if(Fe===null){ve===null&&(ve=Ct);break}r&&ve&&Fe.alternate===null&&o(B,ve),F=S(Fe,F,ke),xe===null?ye=Fe:xe.sibling=Fe,xe=Fe,ve=Ct}if(ke===W.length)return l(B,ve),Qe&&As(B,ke),ye;if(ve===null){for(;ke<W.length;ke++)ve=ie(B,W[ke],le),ve!==null&&(F=S(ve,F,ke),xe===null?ye=ve:xe.sibling=ve,xe=ve);return Qe&&As(B,ke),ye}for(ve=c(B,ve);ke<W.length;ke++)Ct=fe(ve,B,ke,W[ke],le),Ct!==null&&(r&&Ct.alternate!==null&&ve.delete(Ct.key===null?ke:Ct.key),F=S(Ct,F,ke),xe===null?ye=Ct:xe.sibling=Ct,xe=Ct);return r&&ve.forEach(function(os){return o(B,os)}),Qe&&As(B,ke),ye}function me(B,F,W,le){var ye=se(W);if(typeof ye!="function")throw Error(n(150));if(W=ye.call(W),W==null)throw Error(n(151));for(var xe=ye=null,ve=F,ke=F=0,Ct=null,Fe=W.next();ve!==null&&!Fe.done;ke++,Fe=W.next()){ve.index>ke?(Ct=ve,ve=null):Ct=ve.sibling;var os=ne(B,ve,Fe.value,le);if(os===null){ve===null&&(ve=Ct);break}r&&ve&&os.alternate===null&&o(B,ve),F=S(os,F,ke),xe===null?ye=os:xe.sibling=os,xe=os,ve=Ct}if(Fe.done)return l(B,ve),Qe&&As(B,ke),ye;if(ve===null){for(;!Fe.done;ke++,Fe=W.next())Fe=ie(B,Fe.value,le),Fe!==null&&(F=S(Fe,F,ke),xe===null?ye=Fe:xe.sibling=Fe,xe=Fe);return Qe&&As(B,ke),ye}for(ve=c(B,ve);!Fe.done;ke++,Fe=W.next())Fe=fe(ve,B,ke,Fe.value,le),Fe!==null&&(r&&Fe.alternate!==null&&ve.delete(Fe.key===null?ke:Fe.key),F=S(Fe,F,ke),xe===null?ye=Fe:xe.sibling=Fe,xe=Fe);return r&&ve.forEach(function(JE){return o(B,JE)}),Qe&&As(B,ke),ye}function ct(B,F,W,le){if(typeof W=="object"&&W!==null&&W.type===$&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case T:e:{for(var ye=W.key,xe=F;xe!==null;){if(xe.key===ye){if(ye=W.type,ye===$){if(xe.tag===7){l(B,xe.sibling),F=g(xe,W.props.children),F.return=B,B=F;break e}}else if(xe.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===K&&Qy(ye)===xe.type){l(B,xe.sibling),F=g(xe,W.props),F.ref=ia(B,xe,W),F.return=B,B=F;break e}l(B,xe);break}else o(B,xe);xe=xe.sibling}W.type===$?(F=Ws(W.props.children,B.mode,le,W.key),F.return=B,B=F):(le=zu(W.type,W.key,W.props,null,B.mode,le),le.ref=ia(B,F,W),le.return=B,B=le)}return C(B);case O:e:{for(xe=W.key;F!==null;){if(F.key===xe)if(F.tag===4&&F.stateNode.containerInfo===W.containerInfo&&F.stateNode.implementation===W.implementation){l(B,F.sibling),F=g(F,W.children||[]),F.return=B,B=F;break e}else{l(B,F);break}else o(B,F);F=F.sibling}F=jh(W,B.mode,le),F.return=B,B=F}return C(B);case K:return xe=W._init,ct(B,F,xe(W._payload),le)}if(hn(W))return ge(B,F,W,le);if(se(W))return me(B,F,W,le);mu(B,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,F!==null&&F.tag===6?(l(B,F.sibling),F=g(F,W),F.return=B,B=F):(l(B,F),F=Ih(W,B.mode,le),F.return=B,B=F),C(B)):l(B,F)}return ct}var Wo=Jy(!0),Yy=Jy(!1),yu=Kr(null),xu=null,Go=null,Dd=null;function zd(){Dd=Go=xu=null}function Ud(r){var o=yu.current;Ge(yu),r._currentValue=o}function Vd(r,o,l){for(;r!==null;){var c=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,c!==null&&(c.childLanes|=o)):c!==null&&(c.childLanes&o)!==o&&(c.childLanes|=o),r===l)break;r=r.return}}function Ko(r,o){xu=r,Dd=Go=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(tn=!0),r.firstContext=null)}function jn(r){var o=r._currentValue;if(Dd!==r)if(r={context:r,memoizedValue:o,next:null},Go===null){if(xu===null)throw Error(n(308));Go=r,xu.dependencies={lanes:0,firstContext:r}}else Go=Go.next=r;return o}var Ds=null;function Bd(r){Ds===null?Ds=[r]:Ds.push(r)}function Xy(r,o,l,c){var g=o.interleaved;return g===null?(l.next=l,Bd(o)):(l.next=g.next,g.next=l),o.interleaved=l,Rr(r,c)}function Rr(r,o){r.lanes|=o;var l=r.alternate;for(l!==null&&(l.lanes|=o),l=r,r=r.return;r!==null;)r.childLanes|=o,l=r.alternate,l!==null&&(l.childLanes|=o),l=r,r=r.return;return l.tag===3?l.stateNode:null}var Yr=!1;function qd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Zy(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function Er(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Xr(r,o,l){var c=r.updateQueue;if(c===null)return null;if(c=c.shared,(Te&2)!==0){var g=c.pending;return g===null?o.next=o:(o.next=g.next,g.next=o),c.pending=o,Rr(r,l)}return g=c.interleaved,g===null?(o.next=o,Bd(c)):(o.next=g.next,g.next=o),c.interleaved=o,Rr(r,l)}function vu(r,o,l){if(o=o.updateQueue,o!==null&&(o=o.shared,(l&4194240)!==0)){var c=o.lanes;c&=r.pendingLanes,l|=c,o.lanes=l,sd(r,l)}}function ex(r,o){var l=r.updateQueue,c=r.alternate;if(c!==null&&(c=c.updateQueue,l===c)){var g=null,S=null;if(l=l.firstBaseUpdate,l!==null){do{var C={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};S===null?g=S=C:S=S.next=C,l=l.next}while(l!==null);S===null?g=S=o:S=S.next=o}else g=S=o;l={baseState:c.baseState,firstBaseUpdate:g,lastBaseUpdate:S,shared:c.shared,effects:c.effects},r.updateQueue=l;return}r=l.lastBaseUpdate,r===null?l.firstBaseUpdate=o:r.next=o,l.lastBaseUpdate=o}function Su(r,o,l,c){var g=r.updateQueue;Yr=!1;var S=g.firstBaseUpdate,C=g.lastBaseUpdate,I=g.shared.pending;if(I!==null){g.shared.pending=null;var N=I,Q=N.next;N.next=null,C===null?S=Q:C.next=Q,C=N;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,I=oe.lastBaseUpdate,I!==C&&(I===null?oe.firstBaseUpdate=Q:I.next=Q,oe.lastBaseUpdate=N))}if(S!==null){var ie=g.baseState;C=0,oe=Q=N=null,I=S;do{var ne=I.lane,fe=I.eventTime;if((c&ne)===ne){oe!==null&&(oe=oe.next={eventTime:fe,lane:0,tag:I.tag,payload:I.payload,callback:I.callback,next:null});e:{var ge=r,me=I;switch(ne=o,fe=l,me.tag){case 1:if(ge=me.payload,typeof ge=="function"){ie=ge.call(fe,ie,ne);break e}ie=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=me.payload,ne=typeof ge=="function"?ge.call(fe,ie,ne):ge,ne==null)break e;ie=ee({},ie,ne);break e;case 2:Yr=!0}}I.callback!==null&&I.lane!==0&&(r.flags|=64,ne=g.effects,ne===null?g.effects=[I]:ne.push(I))}else fe={eventTime:fe,lane:ne,tag:I.tag,payload:I.payload,callback:I.callback,next:null},oe===null?(Q=oe=fe,N=ie):oe=oe.next=fe,C|=ne;if(I=I.next,I===null){if(I=g.shared.pending,I===null)break;ne=I,I=ne.next,ne.next=null,g.lastBaseUpdate=ne,g.shared.pending=null}}while(!0);if(oe===null&&(N=ie),g.baseState=N,g.firstBaseUpdate=Q,g.lastBaseUpdate=oe,o=g.shared.interleaved,o!==null){g=o;do C|=g.lane,g=g.next;while(g!==o)}else S===null&&(g.shared.lanes=0);Vs|=C,r.lanes=C,r.memoizedState=ie}}function tx(r,o,l){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var c=r[o],g=c.callback;if(g!==null){if(c.callback=null,c=l,typeof g!="function")throw Error(n(191,g));g.call(c)}}}var aa={},ur=Kr(aa),la=Kr(aa),ua=Kr(aa);function zs(r){if(r===aa)throw Error(n(174));return r}function Hd(r,o){switch(qe(ua,o),qe(la,r),qe(ur,aa),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Bn(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Bn(o,r)}Ge(ur),qe(ur,o)}function Qo(){Ge(ur),Ge(la),Ge(ua)}function nx(r){zs(ua.current);var o=zs(ur.current),l=Bn(o,r.type);o!==l&&(qe(la,r),qe(ur,l))}function Wd(r){la.current===r&&(Ge(ur),Ge(la))}var Ze=Kr(0);function wu(r){for(var o=r;o!==null;){if(o.tag===13){var l=o.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Gd=[];function Kd(){for(var r=0;r<Gd.length;r++)Gd[r]._workInProgressVersionPrimary=null;Gd.length=0}var ku=R.ReactCurrentDispatcher,Qd=R.ReactCurrentBatchConfig,Us=0,et=null,pt=null,wt=null,Cu=!1,ca=!1,fa=0,xE=0;function At(){throw Error(n(321))}function Jd(r,o){if(o===null)return!1;for(var l=0;l<o.length&&l<r.length;l++)if(!Hn(r[l],o[l]))return!1;return!0}function Yd(r,o,l,c,g,S){if(Us=S,et=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,ku.current=r===null||r.memoizedState===null?kE:CE,r=l(c,g),ca){S=0;do{if(ca=!1,fa=0,25<=S)throw Error(n(301));S+=1,wt=pt=null,o.updateQueue=null,ku.current=bE,r=l(c,g)}while(ca)}if(ku.current=Ru,o=pt!==null&&pt.next!==null,Us=0,wt=pt=et=null,Cu=!1,o)throw Error(n(300));return r}function Xd(){var r=fa!==0;return fa=0,r}function cr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?et.memoizedState=wt=r:wt=wt.next=r,wt}function Nn(){if(pt===null){var r=et.alternate;r=r!==null?r.memoizedState:null}else r=pt.next;var o=wt===null?et.memoizedState:wt.next;if(o!==null)wt=o,pt=r;else{if(r===null)throw Error(n(310));pt=r,r={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},wt===null?et.memoizedState=wt=r:wt=wt.next=r}return wt}function da(r,o){return typeof o=="function"?o(r):o}function Zd(r){var o=Nn(),l=o.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=r;var c=pt,g=c.baseQueue,S=l.pending;if(S!==null){if(g!==null){var C=g.next;g.next=S.next,S.next=C}c.baseQueue=g=S,l.pending=null}if(g!==null){S=g.next,c=c.baseState;var I=C=null,N=null,Q=S;do{var oe=Q.lane;if((Us&oe)===oe)N!==null&&(N=N.next={lane:0,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null}),c=Q.hasEagerState?Q.eagerState:r(c,Q.action);else{var ie={lane:oe,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null};N===null?(I=N=ie,C=c):N=N.next=ie,et.lanes|=oe,Vs|=oe}Q=Q.next}while(Q!==null&&Q!==S);N===null?C=c:N.next=I,Hn(c,o.memoizedState)||(tn=!0),o.memoizedState=c,o.baseState=C,o.baseQueue=N,l.lastRenderedState=c}if(r=l.interleaved,r!==null){g=r;do S=g.lane,et.lanes|=S,Vs|=S,g=g.next;while(g!==r)}else g===null&&(l.lanes=0);return[o.memoizedState,l.dispatch]}function eh(r){var o=Nn(),l=o.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=r;var c=l.dispatch,g=l.pending,S=o.memoizedState;if(g!==null){l.pending=null;var C=g=g.next;do S=r(S,C.action),C=C.next;while(C!==g);Hn(S,o.memoizedState)||(tn=!0),o.memoizedState=S,o.baseQueue===null&&(o.baseState=S),l.lastRenderedState=S}return[S,c]}function rx(){}function sx(r,o){var l=et,c=Nn(),g=o(),S=!Hn(c.memoizedState,g);if(S&&(c.memoizedState=g,tn=!0),c=c.queue,th(ax.bind(null,l,c,r),[r]),c.getSnapshot!==o||S||wt!==null&&wt.memoizedState.tag&1){if(l.flags|=2048,ha(9,ix.bind(null,l,c,g,o),void 0,null),kt===null)throw Error(n(349));(Us&30)!==0||ox(l,o,g)}return g}function ox(r,o,l){r.flags|=16384,r={getSnapshot:o,value:l},o=et.updateQueue,o===null?(o={lastEffect:null,stores:null},et.updateQueue=o,o.stores=[r]):(l=o.stores,l===null?o.stores=[r]:l.push(r))}function ix(r,o,l,c){o.value=l,o.getSnapshot=c,lx(o)&&ux(r)}function ax(r,o,l){return l(function(){lx(o)&&ux(r)})}function lx(r){var o=r.getSnapshot;r=r.value;try{var l=o();return!Hn(r,l)}catch{return!0}}function ux(r){var o=Rr(r,1);o!==null&&Jn(o,r,1,-1)}function cx(r){var o=cr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:da,lastRenderedState:r},o.queue=r,r=r.dispatch=wE.bind(null,et,r),[o.memoizedState,r]}function ha(r,o,l,c){return r={tag:r,create:o,destroy:l,deps:c,next:null},o=et.updateQueue,o===null?(o={lastEffect:null,stores:null},et.updateQueue=o,o.lastEffect=r.next=r):(l=o.lastEffect,l===null?o.lastEffect=r.next=r:(c=l.next,l.next=r,r.next=c,o.lastEffect=r)),r}function fx(){return Nn().memoizedState}function bu(r,o,l,c){var g=cr();et.flags|=r,g.memoizedState=ha(1|o,l,void 0,c===void 0?null:c)}function _u(r,o,l,c){var g=Nn();c=c===void 0?null:c;var S=void 0;if(pt!==null){var C=pt.memoizedState;if(S=C.destroy,c!==null&&Jd(c,C.deps)){g.memoizedState=ha(o,l,S,c);return}}et.flags|=r,g.memoizedState=ha(1|o,l,S,c)}function dx(r,o){return bu(8390656,8,r,o)}function th(r,o){return _u(2048,8,r,o)}function hx(r,o){return _u(4,2,r,o)}function gx(r,o){return _u(4,4,r,o)}function px(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function mx(r,o,l){return l=l!=null?l.concat([r]):null,_u(4,4,px.bind(null,o,r),l)}function nh(){}function yx(r,o){var l=Nn();o=o===void 0?null:o;var c=l.memoizedState;return c!==null&&o!==null&&Jd(o,c[1])?c[0]:(l.memoizedState=[r,o],r)}function xx(r,o){var l=Nn();o=o===void 0?null:o;var c=l.memoizedState;return c!==null&&o!==null&&Jd(o,c[1])?c[0]:(r=r(),l.memoizedState=[r,o],r)}function vx(r,o,l){return(Us&21)===0?(r.baseState&&(r.baseState=!1,tn=!0),r.memoizedState=l):(Hn(l,o)||(l=Q0(),et.lanes|=l,Vs|=l,r.baseState=!0),o)}function vE(r,o){var l=Ae;Ae=l!==0&&4>l?l:4,r(!0);var c=Qd.transition;Qd.transition={};try{r(!1),o()}finally{Ae=l,Qd.transition=c}}function Sx(){return Nn().memoizedState}function SE(r,o,l){var c=ns(r);if(l={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null},wx(r))kx(o,l);else if(l=Xy(r,o,l,c),l!==null){var g=Kt();Jn(l,r,c,g),Cx(l,o,c)}}function wE(r,o,l){var c=ns(r),g={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null};if(wx(r))kx(o,g);else{var S=r.alternate;if(r.lanes===0&&(S===null||S.lanes===0)&&(S=o.lastRenderedReducer,S!==null))try{var C=o.lastRenderedState,I=S(C,l);if(g.hasEagerState=!0,g.eagerState=I,Hn(I,C)){var N=o.interleaved;N===null?(g.next=g,Bd(o)):(g.next=N.next,N.next=g),o.interleaved=g;return}}catch{}finally{}l=Xy(r,o,g,c),l!==null&&(g=Kt(),Jn(l,r,c,g),Cx(l,o,c))}}function wx(r){var o=r.alternate;return r===et||o!==null&&o===et}function kx(r,o){ca=Cu=!0;var l=r.pending;l===null?o.next=o:(o.next=l.next,l.next=o),r.pending=o}function Cx(r,o,l){if((l&4194240)!==0){var c=o.lanes;c&=r.pendingLanes,l|=c,o.lanes=l,sd(r,l)}}var Ru={readContext:jn,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useInsertionEffect:At,useLayoutEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useMutableSource:At,useSyncExternalStore:At,useId:At,unstable_isNewReconciler:!1},kE={readContext:jn,useCallback:function(r,o){return cr().memoizedState=[r,o===void 0?null:o],r},useContext:jn,useEffect:dx,useImperativeHandle:function(r,o,l){return l=l!=null?l.concat([r]):null,bu(4194308,4,px.bind(null,o,r),l)},useLayoutEffect:function(r,o){return bu(4194308,4,r,o)},useInsertionEffect:function(r,o){return bu(4,2,r,o)},useMemo:function(r,o){var l=cr();return o=o===void 0?null:o,r=r(),l.memoizedState=[r,o],r},useReducer:function(r,o,l){var c=cr();return o=l!==void 0?l(o):o,c.memoizedState=c.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},c.queue=r,r=r.dispatch=SE.bind(null,et,r),[c.memoizedState,r]},useRef:function(r){var o=cr();return r={current:r},o.memoizedState=r},useState:cx,useDebugValue:nh,useDeferredValue:function(r){return cr().memoizedState=r},useTransition:function(){var r=cx(!1),o=r[0];return r=vE.bind(null,r[1]),cr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,l){var c=et,g=cr();if(Qe){if(l===void 0)throw Error(n(407));l=l()}else{if(l=o(),kt===null)throw Error(n(349));(Us&30)!==0||ox(c,o,l)}g.memoizedState=l;var S={value:l,getSnapshot:o};return g.queue=S,dx(ax.bind(null,c,S,r),[r]),c.flags|=2048,ha(9,ix.bind(null,c,S,l,o),void 0,null),l},useId:function(){var r=cr(),o=kt.identifierPrefix;if(Qe){var l=_r,c=br;l=(c&~(1<<32-qn(c)-1)).toString(32)+l,o=":"+o+"R"+l,l=fa++,0<l&&(o+="H"+l.toString(32)),o+=":"}else l=xE++,o=":"+o+"r"+l.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},CE={readContext:jn,useCallback:yx,useContext:jn,useEffect:th,useImperativeHandle:mx,useInsertionEffect:hx,useLayoutEffect:gx,useMemo:xx,useReducer:Zd,useRef:fx,useState:function(){return Zd(da)},useDebugValue:nh,useDeferredValue:function(r){var o=Nn();return vx(o,pt.memoizedState,r)},useTransition:function(){var r=Zd(da)[0],o=Nn().memoizedState;return[r,o]},useMutableSource:rx,useSyncExternalStore:sx,useId:Sx,unstable_isNewReconciler:!1},bE={readContext:jn,useCallback:yx,useContext:jn,useEffect:th,useImperativeHandle:mx,useInsertionEffect:hx,useLayoutEffect:gx,useMemo:xx,useReducer:eh,useRef:fx,useState:function(){return eh(da)},useDebugValue:nh,useDeferredValue:function(r){var o=Nn();return pt===null?o.memoizedState=r:vx(o,pt.memoizedState,r)},useTransition:function(){var r=eh(da)[0],o=Nn().memoizedState;return[r,o]},useMutableSource:rx,useSyncExternalStore:sx,useId:Sx,unstable_isNewReconciler:!1};function Gn(r,o){if(r&&r.defaultProps){o=ee({},o),r=r.defaultProps;for(var l in r)o[l]===void 0&&(o[l]=r[l]);return o}return o}function rh(r,o,l,c){o=r.memoizedState,l=l(c,o),l=l==null?o:ee({},o,l),r.memoizedState=l,r.lanes===0&&(r.updateQueue.baseState=l)}var Eu={isMounted:function(r){return(r=r._reactInternals)?$s(r)===r:!1},enqueueSetState:function(r,o,l){r=r._reactInternals;var c=Kt(),g=ns(r),S=Er(c,g);S.payload=o,l!=null&&(S.callback=l),o=Xr(r,S,g),o!==null&&(Jn(o,r,g,c),vu(o,r,g))},enqueueReplaceState:function(r,o,l){r=r._reactInternals;var c=Kt(),g=ns(r),S=Er(c,g);S.tag=1,S.payload=o,l!=null&&(S.callback=l),o=Xr(r,S,g),o!==null&&(Jn(o,r,g,c),vu(o,r,g))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var l=Kt(),c=ns(r),g=Er(l,c);g.tag=2,o!=null&&(g.callback=o),o=Xr(r,g,c),o!==null&&(Jn(o,r,c,l),vu(o,r,c))}};function bx(r,o,l,c,g,S,C){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(c,S,C):o.prototype&&o.prototype.isPureReactComponent?!Zi(l,c)||!Zi(g,S):!0}function _x(r,o,l){var c=!1,g=Qr,S=o.contextType;return typeof S=="object"&&S!==null?S=jn(S):(g=en(o)?Ls:Ot.current,c=o.contextTypes,S=(c=c!=null)?Vo(r,g):Qr),o=new o(l,S),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Eu,r.stateNode=o,o._reactInternals=r,c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=g,r.__reactInternalMemoizedMaskedChildContext=S),o}function Rx(r,o,l,c){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(l,c),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(l,c),o.state!==r&&Eu.enqueueReplaceState(o,o.state,null)}function sh(r,o,l,c){var g=r.stateNode;g.props=l,g.state=r.memoizedState,g.refs={},qd(r);var S=o.contextType;typeof S=="object"&&S!==null?g.context=jn(S):(S=en(o)?Ls:Ot.current,g.context=Vo(r,S)),g.state=r.memoizedState,S=o.getDerivedStateFromProps,typeof S=="function"&&(rh(r,o,S,l),g.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(o=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),o!==g.state&&Eu.enqueueReplaceState(g,g.state,null),Su(r,l,g,c),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308)}function Jo(r,o){try{var l="",c=o;do l+=ce(c),c=c.return;while(c);var g=l}catch(S){g=`
|
|
40
|
+
Error generating stack: `+S.message+`
|
|
41
|
+
`+S.stack}return{value:r,source:o,stack:g,digest:null}}function oh(r,o,l){return{value:r,source:null,stack:l??null,digest:o??null}}function ih(r,o){try{console.error(o.value)}catch(l){setTimeout(function(){throw l})}}var _E=typeof WeakMap=="function"?WeakMap:Map;function Ex(r,o,l){l=Er(-1,l),l.tag=3,l.payload={element:null};var c=o.value;return l.callback=function(){$u||($u=!0,wh=c),ih(r,o)},l}function Px(r,o,l){l=Er(-1,l),l.tag=3;var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var g=o.value;l.payload=function(){return c(g)},l.callback=function(){ih(r,o)}}var S=r.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(l.callback=function(){ih(r,o),typeof c!="function"&&(es===null?es=new Set([this]):es.add(this));var C=o.stack;this.componentDidCatch(o.value,{componentStack:C!==null?C:""})}),l}function Ix(r,o,l){var c=r.pingCache;if(c===null){c=r.pingCache=new _E;var g=new Set;c.set(o,g)}else g=c.get(o),g===void 0&&(g=new Set,c.set(o,g));g.has(l)||(g.add(l),r=DE.bind(null,r,o,l),o.then(r,r))}function jx(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function Nx(r,o,l,c,g){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(o=Er(-1,1),o.tag=2,Xr(l,o,1))),l.lanes|=1),r):(r.flags|=65536,r.lanes=g,r)}var RE=R.ReactCurrentOwner,tn=!1;function Gt(r,o,l,c){o.child=r===null?Yy(o,null,l,c):Wo(o,r.child,l,c)}function Mx(r,o,l,c,g){l=l.render;var S=o.ref;return Ko(o,g),c=Yd(r,o,l,c,S,g),l=Xd(),r!==null&&!tn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~g,Pr(r,o,g)):(Qe&&l&&$d(o),o.flags|=1,Gt(r,o,c,g),o.child)}function Tx(r,o,l,c,g){if(r===null){var S=l.type;return typeof S=="function"&&!Ph(S)&&S.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(o.tag=15,o.type=S,$x(r,o,S,c,g)):(r=zu(l.type,null,c,o,o.mode,g),r.ref=o.ref,r.return=o,o.child=r)}if(S=r.child,(r.lanes&g)===0){var C=S.memoizedProps;if(l=l.compare,l=l!==null?l:Zi,l(C,c)&&r.ref===o.ref)return Pr(r,o,g)}return o.flags|=1,r=ss(S,c),r.ref=o.ref,r.return=o,o.child=r}function $x(r,o,l,c,g){if(r!==null){var S=r.memoizedProps;if(Zi(S,c)&&r.ref===o.ref)if(tn=!1,o.pendingProps=c=S,(r.lanes&g)!==0)(r.flags&131072)!==0&&(tn=!0);else return o.lanes=r.lanes,Pr(r,o,g)}return ah(r,o,l,c,g)}function Fx(r,o,l){var c=o.pendingProps,g=c.children,S=r!==null?r.memoizedState:null;if(c.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},qe(Xo,yn),yn|=l;else{if((l&1073741824)===0)return r=S!==null?S.baseLanes|l:l,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,qe(Xo,yn),yn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=S!==null?S.baseLanes:l,qe(Xo,yn),yn|=c}else S!==null?(c=S.baseLanes|l,o.memoizedState=null):c=l,qe(Xo,yn),yn|=c;return Gt(r,o,g,l),o.child}function Lx(r,o){var l=o.ref;(r===null&&l!==null||r!==null&&r.ref!==l)&&(o.flags|=512,o.flags|=2097152)}function ah(r,o,l,c,g){var S=en(l)?Ls:Ot.current;return S=Vo(o,S),Ko(o,g),l=Yd(r,o,l,c,S,g),c=Xd(),r!==null&&!tn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~g,Pr(r,o,g)):(Qe&&c&&$d(o),o.flags|=1,Gt(r,o,l,g),o.child)}function Ox(r,o,l,c,g){if(en(l)){var S=!0;fu(o)}else S=!1;if(Ko(o,g),o.stateNode===null)Iu(r,o),_x(o,l,c),sh(o,l,c,g),c=!0;else if(r===null){var C=o.stateNode,I=o.memoizedProps;C.props=I;var N=C.context,Q=l.contextType;typeof Q=="object"&&Q!==null?Q=jn(Q):(Q=en(l)?Ls:Ot.current,Q=Vo(o,Q));var oe=l.getDerivedStateFromProps,ie=typeof oe=="function"||typeof C.getSnapshotBeforeUpdate=="function";ie||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(I!==c||N!==Q)&&Rx(o,C,c,Q),Yr=!1;var ne=o.memoizedState;C.state=ne,Su(o,c,C,g),N=o.memoizedState,I!==c||ne!==N||Zt.current||Yr?(typeof oe=="function"&&(rh(o,l,oe,c),N=o.memoizedState),(I=Yr||bx(o,l,I,c,ne,N,Q))?(ie||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(o.flags|=4194308)):(typeof C.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=c,o.memoizedState=N),C.props=c,C.state=N,C.context=Q,c=I):(typeof C.componentDidMount=="function"&&(o.flags|=4194308),c=!1)}else{C=o.stateNode,Zy(r,o),I=o.memoizedProps,Q=o.type===o.elementType?I:Gn(o.type,I),C.props=Q,ie=o.pendingProps,ne=C.context,N=l.contextType,typeof N=="object"&&N!==null?N=jn(N):(N=en(l)?Ls:Ot.current,N=Vo(o,N));var fe=l.getDerivedStateFromProps;(oe=typeof fe=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(I!==ie||ne!==N)&&Rx(o,C,c,N),Yr=!1,ne=o.memoizedState,C.state=ne,Su(o,c,C,g);var ge=o.memoizedState;I!==ie||ne!==ge||Zt.current||Yr?(typeof fe=="function"&&(rh(o,l,fe,c),ge=o.memoizedState),(Q=Yr||bx(o,l,Q,c,ne,ge,N)||!1)?(oe||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(c,ge,N),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(c,ge,N)),typeof C.componentDidUpdate=="function"&&(o.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof C.componentDidUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=1024),o.memoizedProps=c,o.memoizedState=ge),C.props=c,C.state=ge,C.context=N,c=Q):(typeof C.componentDidUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=1024),c=!1)}return lh(r,o,l,c,S,g)}function lh(r,o,l,c,g,S){Lx(r,o);var C=(o.flags&128)!==0;if(!c&&!C)return g&&Vy(o,l,!1),Pr(r,o,S);c=o.stateNode,RE.current=o;var I=C&&typeof l.getDerivedStateFromError!="function"?null:c.render();return o.flags|=1,r!==null&&C?(o.child=Wo(o,r.child,null,S),o.child=Wo(o,null,I,S)):Gt(r,o,I,S),o.memoizedState=c.state,g&&Vy(o,l,!0),o.child}function Ax(r){var o=r.stateNode;o.pendingContext?zy(r,o.pendingContext,o.pendingContext!==o.context):o.context&&zy(r,o.context,!1),Hd(r,o.containerInfo)}function Dx(r,o,l,c,g){return Ho(),Ad(g),o.flags|=256,Gt(r,o,l,c),o.child}var uh={dehydrated:null,treeContext:null,retryLane:0};function ch(r){return{baseLanes:r,cachePool:null,transitions:null}}function zx(r,o,l){var c=o.pendingProps,g=Ze.current,S=!1,C=(o.flags&128)!==0,I;if((I=C)||(I=r!==null&&r.memoizedState===null?!1:(g&2)!==0),I?(S=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(g|=1),qe(Ze,g&1),r===null)return Od(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(C=c.children,r=c.fallback,S?(c=o.mode,S=o.child,C={mode:"hidden",children:C},(c&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=C):S=Uu(C,c,0,null),r=Ws(r,c,l,null),S.return=o,r.return=o,S.sibling=r,o.child=S,o.child.memoizedState=ch(l),o.memoizedState=uh,r):fh(o,C));if(g=r.memoizedState,g!==null&&(I=g.dehydrated,I!==null))return EE(r,o,C,c,I,g,l);if(S){S=c.fallback,C=o.mode,g=r.child,I=g.sibling;var N={mode:"hidden",children:c.children};return(C&1)===0&&o.child!==g?(c=o.child,c.childLanes=0,c.pendingProps=N,o.deletions=null):(c=ss(g,N),c.subtreeFlags=g.subtreeFlags&14680064),I!==null?S=ss(I,S):(S=Ws(S,C,l,null),S.flags|=2),S.return=o,c.return=o,c.sibling=S,o.child=c,c=S,S=o.child,C=r.child.memoizedState,C=C===null?ch(l):{baseLanes:C.baseLanes|l,cachePool:null,transitions:C.transitions},S.memoizedState=C,S.childLanes=r.childLanes&~l,o.memoizedState=uh,c}return S=r.child,r=S.sibling,c=ss(S,{mode:"visible",children:c.children}),(o.mode&1)===0&&(c.lanes=l),c.return=o,c.sibling=null,r!==null&&(l=o.deletions,l===null?(o.deletions=[r],o.flags|=16):l.push(r)),o.child=c,o.memoizedState=null,c}function fh(r,o){return o=Uu({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Pu(r,o,l,c){return c!==null&&Ad(c),Wo(o,r.child,null,l),r=fh(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function EE(r,o,l,c,g,S,C){if(l)return o.flags&256?(o.flags&=-257,c=oh(Error(n(422))),Pu(r,o,C,c)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(S=c.fallback,g=o.mode,c=Uu({mode:"visible",children:c.children},g,0,null),S=Ws(S,g,C,null),S.flags|=2,c.return=o,S.return=o,c.sibling=S,o.child=c,(o.mode&1)!==0&&Wo(o,r.child,null,C),o.child.memoizedState=ch(C),o.memoizedState=uh,S);if((o.mode&1)===0)return Pu(r,o,C,null);if(g.data==="$!"){if(c=g.nextSibling&&g.nextSibling.dataset,c)var I=c.dgst;return c=I,S=Error(n(419)),c=oh(S,c,void 0),Pu(r,o,C,c)}if(I=(C&r.childLanes)!==0,tn||I){if(c=kt,c!==null){switch(C&-C){case 4:g=2;break;case 16:g=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:g=32;break;case 536870912:g=268435456;break;default:g=0}g=(g&(c.suspendedLanes|C))!==0?0:g,g!==0&&g!==S.retryLane&&(S.retryLane=g,Rr(r,g),Jn(c,r,g,-1))}return Eh(),c=oh(Error(n(421))),Pu(r,o,C,c)}return g.data==="$?"?(o.flags|=128,o.child=r.child,o=zE.bind(null,r),g._reactRetry=o,null):(r=S.treeContext,mn=Gr(g.nextSibling),pn=o,Qe=!0,Wn=null,r!==null&&(Pn[In++]=br,Pn[In++]=_r,Pn[In++]=Os,br=r.id,_r=r.overflow,Os=o),o=fh(o,c.children),o.flags|=4096,o)}function Ux(r,o,l){r.lanes|=o;var c=r.alternate;c!==null&&(c.lanes|=o),Vd(r.return,o,l)}function dh(r,o,l,c,g){var S=r.memoizedState;S===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:c,tail:l,tailMode:g}:(S.isBackwards=o,S.rendering=null,S.renderingStartTime=0,S.last=c,S.tail=l,S.tailMode=g)}function Vx(r,o,l){var c=o.pendingProps,g=c.revealOrder,S=c.tail;if(Gt(r,o,c.children,l),c=Ze.current,(c&2)!==0)c=c&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Ux(r,l,o);else if(r.tag===19)Ux(r,l,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}c&=1}if(qe(Ze,c),(o.mode&1)===0)o.memoizedState=null;else switch(g){case"forwards":for(l=o.child,g=null;l!==null;)r=l.alternate,r!==null&&wu(r)===null&&(g=l),l=l.sibling;l=g,l===null?(g=o.child,o.child=null):(g=l.sibling,l.sibling=null),dh(o,!1,g,l,S);break;case"backwards":for(l=null,g=o.child,o.child=null;g!==null;){if(r=g.alternate,r!==null&&wu(r)===null){o.child=g;break}r=g.sibling,g.sibling=l,l=g,g=r}dh(o,!0,l,null,S);break;case"together":dh(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Iu(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Pr(r,o,l){if(r!==null&&(o.dependencies=r.dependencies),Vs|=o.lanes,(l&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,l=ss(r,r.pendingProps),o.child=l,l.return=o;r.sibling!==null;)r=r.sibling,l=l.sibling=ss(r,r.pendingProps),l.return=o;l.sibling=null}return o.child}function PE(r,o,l){switch(o.tag){case 3:Ax(o),Ho();break;case 5:nx(o);break;case 1:en(o.type)&&fu(o);break;case 4:Hd(o,o.stateNode.containerInfo);break;case 10:var c=o.type._context,g=o.memoizedProps.value;qe(yu,c._currentValue),c._currentValue=g;break;case 13:if(c=o.memoizedState,c!==null)return c.dehydrated!==null?(qe(Ze,Ze.current&1),o.flags|=128,null):(l&o.child.childLanes)!==0?zx(r,o,l):(qe(Ze,Ze.current&1),r=Pr(r,o,l),r!==null?r.sibling:null);qe(Ze,Ze.current&1);break;case 19:if(c=(l&o.childLanes)!==0,(r.flags&128)!==0){if(c)return Vx(r,o,l);o.flags|=128}if(g=o.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),qe(Ze,Ze.current),c)break;return null;case 22:case 23:return o.lanes=0,Fx(r,o,l)}return Pr(r,o,l)}var Bx,hh,qx,Hx;Bx=function(r,o){for(var l=o.child;l!==null;){if(l.tag===5||l.tag===6)r.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},hh=function(){},qx=function(r,o,l,c){var g=r.memoizedProps;if(g!==c){r=o.stateNode,zs(ur.current);var S=null;switch(l){case"input":g=Eo(r,g),c=Eo(r,c),S=[];break;case"select":g=ee({},g,{value:void 0}),c=ee({},c,{value:void 0}),S=[];break;case"textarea":g=Io(r,g),c=Io(r,c),S=[];break;default:typeof g.onClick!="function"&&typeof c.onClick=="function"&&(r.onclick=lu)}Gf(l,c);var C;l=null;for(Q in g)if(!c.hasOwnProperty(Q)&&g.hasOwnProperty(Q)&&g[Q]!=null)if(Q==="style"){var I=g[Q];for(C in I)I.hasOwnProperty(C)&&(l||(l={}),l[C]="")}else Q!=="dangerouslySetInnerHTML"&&Q!=="children"&&Q!=="suppressContentEditableWarning"&&Q!=="suppressHydrationWarning"&&Q!=="autoFocus"&&(i.hasOwnProperty(Q)?S||(S=[]):(S=S||[]).push(Q,null));for(Q in c){var N=c[Q];if(I=g!=null?g[Q]:void 0,c.hasOwnProperty(Q)&&N!==I&&(N!=null||I!=null))if(Q==="style")if(I){for(C in I)!I.hasOwnProperty(C)||N&&N.hasOwnProperty(C)||(l||(l={}),l[C]="");for(C in N)N.hasOwnProperty(C)&&I[C]!==N[C]&&(l||(l={}),l[C]=N[C])}else l||(S||(S=[]),S.push(Q,l)),l=N;else Q==="dangerouslySetInnerHTML"?(N=N?N.__html:void 0,I=I?I.__html:void 0,N!=null&&I!==N&&(S=S||[]).push(Q,N)):Q==="children"?typeof N!="string"&&typeof N!="number"||(S=S||[]).push(Q,""+N):Q!=="suppressContentEditableWarning"&&Q!=="suppressHydrationWarning"&&(i.hasOwnProperty(Q)?(N!=null&&Q==="onScroll"&&We("scroll",r),S||I===N||(S=[])):(S=S||[]).push(Q,N))}l&&(S=S||[]).push("style",l);var Q=S;(o.updateQueue=Q)&&(o.flags|=4)}},Hx=function(r,o,l,c){l!==c&&(o.flags|=4)};function ga(r,o){if(!Qe)switch(r.tailMode){case"hidden":o=r.tail;for(var l=null;o!==null;)o.alternate!==null&&(l=o),o=o.sibling;l===null?r.tail=null:l.sibling=null;break;case"collapsed":l=r.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:c.sibling=null}}function Dt(r){var o=r.alternate!==null&&r.alternate.child===r.child,l=0,c=0;if(o)for(var g=r.child;g!==null;)l|=g.lanes|g.childLanes,c|=g.subtreeFlags&14680064,c|=g.flags&14680064,g.return=r,g=g.sibling;else for(g=r.child;g!==null;)l|=g.lanes|g.childLanes,c|=g.subtreeFlags,c|=g.flags,g.return=r,g=g.sibling;return r.subtreeFlags|=c,r.childLanes=l,o}function IE(r,o,l){var c=o.pendingProps;switch(Fd(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(o),null;case 1:return en(o.type)&&cu(),Dt(o),null;case 3:return c=o.stateNode,Qo(),Ge(Zt),Ge(Ot),Kd(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(pu(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Wn!==null&&(bh(Wn),Wn=null))),hh(r,o),Dt(o),null;case 5:Wd(o);var g=zs(ua.current);if(l=o.type,r!==null&&o.stateNode!=null)qx(r,o,l,c,g),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!c){if(o.stateNode===null)throw Error(n(166));return Dt(o),null}if(r=zs(ur.current),pu(o)){c=o.stateNode,l=o.type;var S=o.memoizedProps;switch(c[lr]=o,c[sa]=S,r=(o.mode&1)!==0,l){case"dialog":We("cancel",c),We("close",c);break;case"iframe":case"object":case"embed":We("load",c);break;case"video":case"audio":for(g=0;g<ta.length;g++)We(ta[g],c);break;case"source":We("error",c);break;case"img":case"image":case"link":We("error",c),We("load",c);break;case"details":We("toggle",c);break;case"input":Dl(c,S),We("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!S.multiple},We("invalid",c);break;case"textarea":zl(c,S),We("invalid",c)}Gf(l,S),g=null;for(var C in S)if(S.hasOwnProperty(C)){var I=S[C];C==="children"?typeof I=="string"?c.textContent!==I&&(S.suppressHydrationWarning!==!0&&au(c.textContent,I,r),g=["children",I]):typeof I=="number"&&c.textContent!==""+I&&(S.suppressHydrationWarning!==!0&&au(c.textContent,I,r),g=["children",""+I]):i.hasOwnProperty(C)&&I!=null&&C==="onScroll"&&We("scroll",c)}switch(l){case"input":Sr(c),wr(c,S,!0);break;case"textarea":Sr(c),Oe(c);break;case"select":case"option":break;default:typeof S.onClick=="function"&&(c.onclick=lu)}c=g,o.updateQueue=c,c!==null&&(o.flags|=4)}else{C=g.nodeType===9?g:g.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Mt(l)),r==="http://www.w3.org/1999/xhtml"?l==="script"?(r=C.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof c.is=="string"?r=C.createElement(l,{is:c.is}):(r=C.createElement(l),l==="select"&&(C=r,c.multiple?C.multiple=!0:c.size&&(C.size=c.size))):r=C.createElementNS(r,l),r[lr]=o,r[sa]=c,Bx(r,o,!1,!1),o.stateNode=r;e:{switch(C=Kf(l,c),l){case"dialog":We("cancel",r),We("close",r),g=c;break;case"iframe":case"object":case"embed":We("load",r),g=c;break;case"video":case"audio":for(g=0;g<ta.length;g++)We(ta[g],r);g=c;break;case"source":We("error",r),g=c;break;case"img":case"image":case"link":We("error",r),We("load",r),g=c;break;case"details":We("toggle",r),g=c;break;case"input":Dl(r,c),g=Eo(r,c),We("invalid",r);break;case"option":g=c;break;case"select":r._wrapperState={wasMultiple:!!c.multiple},g=ee({},c,{value:void 0}),We("invalid",r);break;case"textarea":zl(r,c),g=Io(r,c),We("invalid",r);break;default:g=c}Gf(l,g),I=g;for(S in I)if(I.hasOwnProperty(S)){var N=I[S];S==="style"?$0(r,N):S==="dangerouslySetInnerHTML"?(N=N?N.__html:void 0,N!=null&&M0(r,N)):S==="children"?typeof N=="string"?(l!=="textarea"||N!=="")&&Li(r,N):typeof N=="number"&&Li(r,""+N):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&(i.hasOwnProperty(S)?N!=null&&S==="onScroll"&&We("scroll",r):N!=null&&j(r,S,N,C))}switch(l){case"input":Sr(r),wr(r,c,!1);break;case"textarea":Sr(r),Oe(r);break;case"option":c.value!=null&&r.setAttribute("value",""+Ce(c.value));break;case"select":r.multiple=!!c.multiple,S=c.value,S!=null?zr(r,!!c.multiple,S,!1):c.defaultValue!=null&&zr(r,!!c.multiple,c.defaultValue,!0);break;default:typeof g.onClick=="function"&&(r.onclick=lu)}switch(l){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Dt(o),null;case 6:if(r&&o.stateNode!=null)Hx(r,o,r.memoizedProps,c);else{if(typeof c!="string"&&o.stateNode===null)throw Error(n(166));if(l=zs(ua.current),zs(ur.current),pu(o)){if(c=o.stateNode,l=o.memoizedProps,c[lr]=o,(S=c.nodeValue!==l)&&(r=pn,r!==null))switch(r.tag){case 3:au(c.nodeValue,l,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&au(c.nodeValue,l,(r.mode&1)!==0)}S&&(o.flags|=4)}else c=(l.nodeType===9?l:l.ownerDocument).createTextNode(c),c[lr]=o,o.stateNode=c}return Dt(o),null;case 13:if(Ge(Ze),c=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Qe&&mn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)Ky(),Ho(),o.flags|=98560,S=!1;else if(S=pu(o),c!==null&&c.dehydrated!==null){if(r===null){if(!S)throw Error(n(318));if(S=o.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(n(317));S[lr]=o}else Ho(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Dt(o),S=!1}else Wn!==null&&(bh(Wn),Wn=null),S=!0;if(!S)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=l,o):(c=c!==null,c!==(r!==null&&r.memoizedState!==null)&&c&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(Ze.current&1)!==0?mt===0&&(mt=3):Eh())),o.updateQueue!==null&&(o.flags|=4),Dt(o),null);case 4:return Qo(),hh(r,o),r===null&&na(o.stateNode.containerInfo),Dt(o),null;case 10:return Ud(o.type._context),Dt(o),null;case 17:return en(o.type)&&cu(),Dt(o),null;case 19:if(Ge(Ze),S=o.memoizedState,S===null)return Dt(o),null;if(c=(o.flags&128)!==0,C=S.rendering,C===null)if(c)ga(S,!1);else{if(mt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(C=wu(r),C!==null){for(o.flags|=128,ga(S,!1),c=C.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),o.subtreeFlags=0,c=l,l=o.child;l!==null;)S=l,r=c,S.flags&=14680066,C=S.alternate,C===null?(S.childLanes=0,S.lanes=r,S.child=null,S.subtreeFlags=0,S.memoizedProps=null,S.memoizedState=null,S.updateQueue=null,S.dependencies=null,S.stateNode=null):(S.childLanes=C.childLanes,S.lanes=C.lanes,S.child=C.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=C.memoizedProps,S.memoizedState=C.memoizedState,S.updateQueue=C.updateQueue,S.type=C.type,r=C.dependencies,S.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),l=l.sibling;return qe(Ze,Ze.current&1|2),o.child}r=r.sibling}S.tail!==null&&ut()>Zo&&(o.flags|=128,c=!0,ga(S,!1),o.lanes=4194304)}else{if(!c)if(r=wu(C),r!==null){if(o.flags|=128,c=!0,l=r.updateQueue,l!==null&&(o.updateQueue=l,o.flags|=4),ga(S,!0),S.tail===null&&S.tailMode==="hidden"&&!C.alternate&&!Qe)return Dt(o),null}else 2*ut()-S.renderingStartTime>Zo&&l!==1073741824&&(o.flags|=128,c=!0,ga(S,!1),o.lanes=4194304);S.isBackwards?(C.sibling=o.child,o.child=C):(l=S.last,l!==null?l.sibling=C:o.child=C,S.last=C)}return S.tail!==null?(o=S.tail,S.rendering=o,S.tail=o.sibling,S.renderingStartTime=ut(),o.sibling=null,l=Ze.current,qe(Ze,c?l&1|2:l&1),o):(Dt(o),null);case 22:case 23:return Rh(),c=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==c&&(o.flags|=8192),c&&(o.mode&1)!==0?(yn&1073741824)!==0&&(Dt(o),o.subtreeFlags&6&&(o.flags|=8192)):Dt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function jE(r,o){switch(Fd(o),o.tag){case 1:return en(o.type)&&cu(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return Qo(),Ge(Zt),Ge(Ot),Kd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Wd(o),null;case 13:if(Ge(Ze),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));Ho()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return Ge(Ze),null;case 4:return Qo(),null;case 10:return Ud(o.type._context),null;case 22:case 23:return Rh(),null;case 24:return null;default:return null}}var ju=!1,zt=!1,NE=typeof WeakSet=="function"?WeakSet:Set,de=null;function Yo(r,o){var l=r.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(c){nt(r,o,c)}else l.current=null}function gh(r,o,l){try{l()}catch(c){nt(r,o,c)}}var Wx=!1;function ME(r,o){if(Rd=Jl,r=by(),xd(r)){if("selectionStart"in r)var l={start:r.selectionStart,end:r.selectionEnd};else e:{l=(l=r.ownerDocument)&&l.defaultView||window;var c=l.getSelection&&l.getSelection();if(c&&c.rangeCount!==0){l=c.anchorNode;var g=c.anchorOffset,S=c.focusNode;c=c.focusOffset;try{l.nodeType,S.nodeType}catch{l=null;break e}var C=0,I=-1,N=-1,Q=0,oe=0,ie=r,ne=null;t:for(;;){for(var fe;ie!==l||g!==0&&ie.nodeType!==3||(I=C+g),ie!==S||c!==0&&ie.nodeType!==3||(N=C+c),ie.nodeType===3&&(C+=ie.nodeValue.length),(fe=ie.firstChild)!==null;)ne=ie,ie=fe;for(;;){if(ie===r)break t;if(ne===l&&++Q===g&&(I=C),ne===S&&++oe===c&&(N=C),(fe=ie.nextSibling)!==null)break;ie=ne,ne=ie.parentNode}ie=fe}l=I===-1||N===-1?null:{start:I,end:N}}else l=null}l=l||{start:0,end:0}}else l=null;for(Ed={focusedElem:r,selectionRange:l},Jl=!1,de=o;de!==null;)if(o=de,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,de=r;else for(;de!==null;){o=de;try{var ge=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(ge!==null){var me=ge.memoizedProps,ct=ge.memoizedState,B=o.stateNode,F=B.getSnapshotBeforeUpdate(o.elementType===o.type?me:Gn(o.type,me),ct);B.__reactInternalSnapshotBeforeUpdate=F}break;case 3:var W=o.stateNode.containerInfo;W.nodeType===1?W.textContent="":W.nodeType===9&&W.documentElement&&W.removeChild(W.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(le){nt(o,o.return,le)}if(r=o.sibling,r!==null){r.return=o.return,de=r;break}de=o.return}return ge=Wx,Wx=!1,ge}function pa(r,o,l){var c=o.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var g=c=c.next;do{if((g.tag&r)===r){var S=g.destroy;g.destroy=void 0,S!==void 0&&gh(o,l,S)}g=g.next}while(g!==c)}}function Nu(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var l=o=o.next;do{if((l.tag&r)===r){var c=l.create;l.destroy=c()}l=l.next}while(l!==o)}}function ph(r){var o=r.ref;if(o!==null){var l=r.stateNode;switch(r.tag){case 5:r=l;break;default:r=l}typeof o=="function"?o(r):o.current=r}}function Gx(r){var o=r.alternate;o!==null&&(r.alternate=null,Gx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[lr],delete o[sa],delete o[Nd],delete o[gE],delete o[pE])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Kx(r){return r.tag===5||r.tag===3||r.tag===4}function Qx(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Kx(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function mh(r,o,l){var c=r.tag;if(c===5||c===6)r=r.stateNode,o?l.nodeType===8?l.parentNode.insertBefore(r,o):l.insertBefore(r,o):(l.nodeType===8?(o=l.parentNode,o.insertBefore(r,l)):(o=l,o.appendChild(r)),l=l._reactRootContainer,l!=null||o.onclick!==null||(o.onclick=lu));else if(c!==4&&(r=r.child,r!==null))for(mh(r,o,l),r=r.sibling;r!==null;)mh(r,o,l),r=r.sibling}function yh(r,o,l){var c=r.tag;if(c===5||c===6)r=r.stateNode,o?l.insertBefore(r,o):l.appendChild(r);else if(c!==4&&(r=r.child,r!==null))for(yh(r,o,l),r=r.sibling;r!==null;)yh(r,o,l),r=r.sibling}var Tt=null,Kn=!1;function Zr(r,o,l){for(l=l.child;l!==null;)Jx(r,o,l),l=l.sibling}function Jx(r,o,l){if(ar&&typeof ar.onCommitFiberUnmount=="function")try{ar.onCommitFiberUnmount(ql,l)}catch{}switch(l.tag){case 5:zt||Yo(l,o);case 6:var c=Tt,g=Kn;Tt=null,Zr(r,o,l),Tt=c,Kn=g,Tt!==null&&(Kn?(r=Tt,l=l.stateNode,r.nodeType===8?r.parentNode.removeChild(l):r.removeChild(l)):Tt.removeChild(l.stateNode));break;case 18:Tt!==null&&(Kn?(r=Tt,l=l.stateNode,r.nodeType===8?jd(r.parentNode,l):r.nodeType===1&&jd(r,l),Gi(r)):jd(Tt,l.stateNode));break;case 4:c=Tt,g=Kn,Tt=l.stateNode.containerInfo,Kn=!0,Zr(r,o,l),Tt=c,Kn=g;break;case 0:case 11:case 14:case 15:if(!zt&&(c=l.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){g=c=c.next;do{var S=g,C=S.destroy;S=S.tag,C!==void 0&&((S&2)!==0||(S&4)!==0)&&gh(l,o,C),g=g.next}while(g!==c)}Zr(r,o,l);break;case 1:if(!zt&&(Yo(l,o),c=l.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=l.memoizedProps,c.state=l.memoizedState,c.componentWillUnmount()}catch(I){nt(l,o,I)}Zr(r,o,l);break;case 21:Zr(r,o,l);break;case 22:l.mode&1?(zt=(c=zt)||l.memoizedState!==null,Zr(r,o,l),zt=c):Zr(r,o,l);break;default:Zr(r,o,l)}}function Yx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var l=r.stateNode;l===null&&(l=r.stateNode=new NE),o.forEach(function(c){var g=UE.bind(null,r,c);l.has(c)||(l.add(c),c.then(g,g))})}}function Qn(r,o){var l=o.deletions;if(l!==null)for(var c=0;c<l.length;c++){var g=l[c];try{var S=r,C=o,I=C;e:for(;I!==null;){switch(I.tag){case 5:Tt=I.stateNode,Kn=!1;break e;case 3:Tt=I.stateNode.containerInfo,Kn=!0;break e;case 4:Tt=I.stateNode.containerInfo,Kn=!0;break e}I=I.return}if(Tt===null)throw Error(n(160));Jx(S,C,g),Tt=null,Kn=!1;var N=g.alternate;N!==null&&(N.return=null),g.return=null}catch(Q){nt(g,o,Q)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Xx(o,r),o=o.sibling}function Xx(r,o){var l=r.alternate,c=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Qn(o,r),fr(r),c&4){try{pa(3,r,r.return),Nu(3,r)}catch(me){nt(r,r.return,me)}try{pa(5,r,r.return)}catch(me){nt(r,r.return,me)}}break;case 1:Qn(o,r),fr(r),c&512&&l!==null&&Yo(l,l.return);break;case 5:if(Qn(o,r),fr(r),c&512&&l!==null&&Yo(l,l.return),r.flags&32){var g=r.stateNode;try{Li(g,"")}catch(me){nt(r,r.return,me)}}if(c&4&&(g=r.stateNode,g!=null)){var S=r.memoizedProps,C=l!==null?l.memoizedProps:S,I=r.type,N=r.updateQueue;if(r.updateQueue=null,N!==null)try{I==="input"&&S.type==="radio"&&S.name!=null&&$i(g,S),Kf(I,C);var Q=Kf(I,S);for(C=0;C<N.length;C+=2){var oe=N[C],ie=N[C+1];oe==="style"?$0(g,ie):oe==="dangerouslySetInnerHTML"?M0(g,ie):oe==="children"?Li(g,ie):j(g,oe,ie,Q)}switch(I){case"input":Po(g,S);break;case"textarea":Fi(g,S);break;case"select":var ne=g._wrapperState.wasMultiple;g._wrapperState.wasMultiple=!!S.multiple;var fe=S.value;fe!=null?zr(g,!!S.multiple,fe,!1):ne!==!!S.multiple&&(S.defaultValue!=null?zr(g,!!S.multiple,S.defaultValue,!0):zr(g,!!S.multiple,S.multiple?[]:"",!1))}g[sa]=S}catch(me){nt(r,r.return,me)}}break;case 6:if(Qn(o,r),fr(r),c&4){if(r.stateNode===null)throw Error(n(162));g=r.stateNode,S=r.memoizedProps;try{g.nodeValue=S}catch(me){nt(r,r.return,me)}}break;case 3:if(Qn(o,r),fr(r),c&4&&l!==null&&l.memoizedState.isDehydrated)try{Gi(o.containerInfo)}catch(me){nt(r,r.return,me)}break;case 4:Qn(o,r),fr(r);break;case 13:Qn(o,r),fr(r),g=r.child,g.flags&8192&&(S=g.memoizedState!==null,g.stateNode.isHidden=S,!S||g.alternate!==null&&g.alternate.memoizedState!==null||(Sh=ut())),c&4&&Yx(r);break;case 22:if(oe=l!==null&&l.memoizedState!==null,r.mode&1?(zt=(Q=zt)||oe,Qn(o,r),zt=Q):Qn(o,r),fr(r),c&8192){if(Q=r.memoizedState!==null,(r.stateNode.isHidden=Q)&&!oe&&(r.mode&1)!==0)for(de=r,oe=r.child;oe!==null;){for(ie=de=oe;de!==null;){switch(ne=de,fe=ne.child,ne.tag){case 0:case 11:case 14:case 15:pa(4,ne,ne.return);break;case 1:Yo(ne,ne.return);var ge=ne.stateNode;if(typeof ge.componentWillUnmount=="function"){c=ne,l=ne.return;try{o=c,ge.props=o.memoizedProps,ge.state=o.memoizedState,ge.componentWillUnmount()}catch(me){nt(c,l,me)}}break;case 5:Yo(ne,ne.return);break;case 22:if(ne.memoizedState!==null){tv(ie);continue}}fe!==null?(fe.return=ne,de=fe):tv(ie)}oe=oe.sibling}e:for(oe=null,ie=r;;){if(ie.tag===5){if(oe===null){oe=ie;try{g=ie.stateNode,Q?(S=g.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none"):(I=ie.stateNode,N=ie.memoizedProps.style,C=N!=null&&N.hasOwnProperty("display")?N.display:null,I.style.display=T0("display",C))}catch(me){nt(r,r.return,me)}}}else if(ie.tag===6){if(oe===null)try{ie.stateNode.nodeValue=Q?"":ie.memoizedProps}catch(me){nt(r,r.return,me)}}else if((ie.tag!==22&&ie.tag!==23||ie.memoizedState===null||ie===r)&&ie.child!==null){ie.child.return=ie,ie=ie.child;continue}if(ie===r)break e;for(;ie.sibling===null;){if(ie.return===null||ie.return===r)break e;oe===ie&&(oe=null),ie=ie.return}oe===ie&&(oe=null),ie.sibling.return=ie.return,ie=ie.sibling}}break;case 19:Qn(o,r),fr(r),c&4&&Yx(r);break;case 21:break;default:Qn(o,r),fr(r)}}function fr(r){var o=r.flags;if(o&2){try{e:{for(var l=r.return;l!==null;){if(Kx(l)){var c=l;break e}l=l.return}throw Error(n(160))}switch(c.tag){case 5:var g=c.stateNode;c.flags&32&&(Li(g,""),c.flags&=-33);var S=Qx(r);yh(r,S,g);break;case 3:case 4:var C=c.stateNode.containerInfo,I=Qx(r);mh(r,I,C);break;default:throw Error(n(161))}}catch(N){nt(r,r.return,N)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function TE(r,o,l){de=r,Zx(r)}function Zx(r,o,l){for(var c=(r.mode&1)!==0;de!==null;){var g=de,S=g.child;if(g.tag===22&&c){var C=g.memoizedState!==null||ju;if(!C){var I=g.alternate,N=I!==null&&I.memoizedState!==null||zt;I=ju;var Q=zt;if(ju=C,(zt=N)&&!Q)for(de=g;de!==null;)C=de,N=C.child,C.tag===22&&C.memoizedState!==null?nv(g):N!==null?(N.return=C,de=N):nv(g);for(;S!==null;)de=S,Zx(S),S=S.sibling;de=g,ju=I,zt=Q}ev(r)}else(g.subtreeFlags&8772)!==0&&S!==null?(S.return=g,de=S):ev(r)}}function ev(r){for(;de!==null;){var o=de;if((o.flags&8772)!==0){var l=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:zt||Nu(5,o);break;case 1:var c=o.stateNode;if(o.flags&4&&!zt)if(l===null)c.componentDidMount();else{var g=o.elementType===o.type?l.memoizedProps:Gn(o.type,l.memoizedProps);c.componentDidUpdate(g,l.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var S=o.updateQueue;S!==null&&tx(o,S,c);break;case 3:var C=o.updateQueue;if(C!==null){if(l=null,o.child!==null)switch(o.child.tag){case 5:l=o.child.stateNode;break;case 1:l=o.child.stateNode}tx(o,C,l)}break;case 5:var I=o.stateNode;if(l===null&&o.flags&4){l=I;var N=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":N.autoFocus&&l.focus();break;case"img":N.src&&(l.src=N.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var Q=o.alternate;if(Q!==null){var oe=Q.memoizedState;if(oe!==null){var ie=oe.dehydrated;ie!==null&&Gi(ie)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}zt||o.flags&512&&ph(o)}catch(ne){nt(o,o.return,ne)}}if(o===r){de=null;break}if(l=o.sibling,l!==null){l.return=o.return,de=l;break}de=o.return}}function tv(r){for(;de!==null;){var o=de;if(o===r){de=null;break}var l=o.sibling;if(l!==null){l.return=o.return,de=l;break}de=o.return}}function nv(r){for(;de!==null;){var o=de;try{switch(o.tag){case 0:case 11:case 15:var l=o.return;try{Nu(4,o)}catch(N){nt(o,l,N)}break;case 1:var c=o.stateNode;if(typeof c.componentDidMount=="function"){var g=o.return;try{c.componentDidMount()}catch(N){nt(o,g,N)}}var S=o.return;try{ph(o)}catch(N){nt(o,S,N)}break;case 5:var C=o.return;try{ph(o)}catch(N){nt(o,C,N)}}}catch(N){nt(o,o.return,N)}if(o===r){de=null;break}var I=o.sibling;if(I!==null){I.return=o.return,de=I;break}de=o.return}}var $E=Math.ceil,Mu=R.ReactCurrentDispatcher,xh=R.ReactCurrentOwner,Mn=R.ReactCurrentBatchConfig,Te=0,kt=null,ht=null,$t=0,yn=0,Xo=Kr(0),mt=0,ma=null,Vs=0,Tu=0,vh=0,ya=null,nn=null,Sh=0,Zo=1/0,Ir=null,$u=!1,wh=null,es=null,Fu=!1,ts=null,Lu=0,xa=0,kh=null,Ou=-1,Au=0;function Kt(){return(Te&6)!==0?ut():Ou!==-1?Ou:Ou=ut()}function ns(r){return(r.mode&1)===0?1:(Te&2)!==0&&$t!==0?$t&-$t:yE.transition!==null?(Au===0&&(Au=Q0()),Au):(r=Ae,r!==0||(r=window.event,r=r===void 0?16:sy(r.type)),r)}function Jn(r,o,l,c){if(50<xa)throw xa=0,kh=null,Error(n(185));Vi(r,l,c),((Te&2)===0||r!==kt)&&(r===kt&&((Te&2)===0&&(Tu|=l),mt===4&&rs(r,$t)),rn(r,c),l===1&&Te===0&&(o.mode&1)===0&&(Zo=ut()+500,du&&Jr()))}function rn(r,o){var l=r.callbackNode;yR(r,o);var c=Gl(r,r===kt?$t:0);if(c===0)l!==null&&W0(l),r.callbackNode=null,r.callbackPriority=0;else if(o=c&-c,r.callbackPriority!==o){if(l!=null&&W0(l),o===1)r.tag===0?mE(sv.bind(null,r)):By(sv.bind(null,r)),dE(function(){(Te&6)===0&&Jr()}),l=null;else{switch(J0(c)){case 1:l=td;break;case 4:l=G0;break;case 16:l=Bl;break;case 536870912:l=K0;break;default:l=Bl}l=dv(l,rv.bind(null,r))}r.callbackPriority=o,r.callbackNode=l}}function rv(r,o){if(Ou=-1,Au=0,(Te&6)!==0)throw Error(n(327));var l=r.callbackNode;if(ei()&&r.callbackNode!==l)return null;var c=Gl(r,r===kt?$t:0);if(c===0)return null;if((c&30)!==0||(c&r.expiredLanes)!==0||o)o=Du(r,c);else{o=c;var g=Te;Te|=2;var S=iv();(kt!==r||$t!==o)&&(Ir=null,Zo=ut()+500,qs(r,o));do try{OE();break}catch(I){ov(r,I)}while(!0);zd(),Mu.current=S,Te=g,ht!==null?o=0:(kt=null,$t=0,o=mt)}if(o!==0){if(o===2&&(g=nd(r),g!==0&&(c=g,o=Ch(r,g))),o===1)throw l=ma,qs(r,0),rs(r,c),rn(r,ut()),l;if(o===6)rs(r,c);else{if(g=r.current.alternate,(c&30)===0&&!FE(g)&&(o=Du(r,c),o===2&&(S=nd(r),S!==0&&(c=S,o=Ch(r,S))),o===1))throw l=ma,qs(r,0),rs(r,c),rn(r,ut()),l;switch(r.finishedWork=g,r.finishedLanes=c,o){case 0:case 1:throw Error(n(345));case 2:Hs(r,nn,Ir);break;case 3:if(rs(r,c),(c&130023424)===c&&(o=Sh+500-ut(),10<o)){if(Gl(r,0)!==0)break;if(g=r.suspendedLanes,(g&c)!==c){Kt(),r.pingedLanes|=r.suspendedLanes&g;break}r.timeoutHandle=Id(Hs.bind(null,r,nn,Ir),o);break}Hs(r,nn,Ir);break;case 4:if(rs(r,c),(c&4194240)===c)break;for(o=r.eventTimes,g=-1;0<c;){var C=31-qn(c);S=1<<C,C=o[C],C>g&&(g=C),c&=~S}if(c=g,c=ut()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*$E(c/1960))-c,10<c){r.timeoutHandle=Id(Hs.bind(null,r,nn,Ir),c);break}Hs(r,nn,Ir);break;case 5:Hs(r,nn,Ir);break;default:throw Error(n(329))}}}return rn(r,ut()),r.callbackNode===l?rv.bind(null,r):null}function Ch(r,o){var l=ya;return r.current.memoizedState.isDehydrated&&(qs(r,o).flags|=256),r=Du(r,o),r!==2&&(o=nn,nn=l,o!==null&&bh(o)),r}function bh(r){nn===null?nn=r:nn.push.apply(nn,r)}function FE(r){for(var o=r;;){if(o.flags&16384){var l=o.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var c=0;c<l.length;c++){var g=l[c],S=g.getSnapshot;g=g.value;try{if(!Hn(S(),g))return!1}catch{return!1}}}if(l=o.child,o.subtreeFlags&16384&&l!==null)l.return=o,o=l;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function rs(r,o){for(o&=~vh,o&=~Tu,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var l=31-qn(o),c=1<<l;r[l]=-1,o&=~c}}function sv(r){if((Te&6)!==0)throw Error(n(327));ei();var o=Gl(r,0);if((o&1)===0)return rn(r,ut()),null;var l=Du(r,o);if(r.tag!==0&&l===2){var c=nd(r);c!==0&&(o=c,l=Ch(r,c))}if(l===1)throw l=ma,qs(r,0),rs(r,o),rn(r,ut()),l;if(l===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,Hs(r,nn,Ir),rn(r,ut()),null}function _h(r,o){var l=Te;Te|=1;try{return r(o)}finally{Te=l,Te===0&&(Zo=ut()+500,du&&Jr())}}function Bs(r){ts!==null&&ts.tag===0&&(Te&6)===0&&ei();var o=Te;Te|=1;var l=Mn.transition,c=Ae;try{if(Mn.transition=null,Ae=1,r)return r()}finally{Ae=c,Mn.transition=l,Te=o,(Te&6)===0&&Jr()}}function Rh(){yn=Xo.current,Ge(Xo)}function qs(r,o){r.finishedWork=null,r.finishedLanes=0;var l=r.timeoutHandle;if(l!==-1&&(r.timeoutHandle=-1,fE(l)),ht!==null)for(l=ht.return;l!==null;){var c=l;switch(Fd(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&cu();break;case 3:Qo(),Ge(Zt),Ge(Ot),Kd();break;case 5:Wd(c);break;case 4:Qo();break;case 13:Ge(Ze);break;case 19:Ge(Ze);break;case 10:Ud(c.type._context);break;case 22:case 23:Rh()}l=l.return}if(kt=r,ht=r=ss(r.current,null),$t=yn=o,mt=0,ma=null,vh=Tu=Vs=0,nn=ya=null,Ds!==null){for(o=0;o<Ds.length;o++)if(l=Ds[o],c=l.interleaved,c!==null){l.interleaved=null;var g=c.next,S=l.pending;if(S!==null){var C=S.next;S.next=g,c.next=C}l.pending=c}Ds=null}return r}function ov(r,o){do{var l=ht;try{if(zd(),ku.current=Ru,Cu){for(var c=et.memoizedState;c!==null;){var g=c.queue;g!==null&&(g.pending=null),c=c.next}Cu=!1}if(Us=0,wt=pt=et=null,ca=!1,fa=0,xh.current=null,l===null||l.return===null){mt=1,ma=o,ht=null;break}e:{var S=r,C=l.return,I=l,N=o;if(o=$t,I.flags|=32768,N!==null&&typeof N=="object"&&typeof N.then=="function"){var Q=N,oe=I,ie=oe.tag;if((oe.mode&1)===0&&(ie===0||ie===11||ie===15)){var ne=oe.alternate;ne?(oe.updateQueue=ne.updateQueue,oe.memoizedState=ne.memoizedState,oe.lanes=ne.lanes):(oe.updateQueue=null,oe.memoizedState=null)}var fe=jx(C);if(fe!==null){fe.flags&=-257,Nx(fe,C,I,S,o),fe.mode&1&&Ix(S,Q,o),o=fe,N=Q;var ge=o.updateQueue;if(ge===null){var me=new Set;me.add(N),o.updateQueue=me}else ge.add(N);break e}else{if((o&1)===0){Ix(S,Q,o),Eh();break e}N=Error(n(426))}}else if(Qe&&I.mode&1){var ct=jx(C);if(ct!==null){(ct.flags&65536)===0&&(ct.flags|=256),Nx(ct,C,I,S,o),Ad(Jo(N,I));break e}}S=N=Jo(N,I),mt!==4&&(mt=2),ya===null?ya=[S]:ya.push(S),S=C;do{switch(S.tag){case 3:S.flags|=65536,o&=-o,S.lanes|=o;var B=Ex(S,N,o);ex(S,B);break e;case 1:I=N;var F=S.type,W=S.stateNode;if((S.flags&128)===0&&(typeof F.getDerivedStateFromError=="function"||W!==null&&typeof W.componentDidCatch=="function"&&(es===null||!es.has(W)))){S.flags|=65536,o&=-o,S.lanes|=o;var le=Px(S,I,o);ex(S,le);break e}}S=S.return}while(S!==null)}lv(l)}catch(ye){o=ye,ht===l&&l!==null&&(ht=l=l.return);continue}break}while(!0)}function iv(){var r=Mu.current;return Mu.current=Ru,r===null?Ru:r}function Eh(){(mt===0||mt===3||mt===2)&&(mt=4),kt===null||(Vs&268435455)===0&&(Tu&268435455)===0||rs(kt,$t)}function Du(r,o){var l=Te;Te|=2;var c=iv();(kt!==r||$t!==o)&&(Ir=null,qs(r,o));do try{LE();break}catch(g){ov(r,g)}while(!0);if(zd(),Te=l,Mu.current=c,ht!==null)throw Error(n(261));return kt=null,$t=0,mt}function LE(){for(;ht!==null;)av(ht)}function OE(){for(;ht!==null&&!lR();)av(ht)}function av(r){var o=fv(r.alternate,r,yn);r.memoizedProps=r.pendingProps,o===null?lv(r):ht=o,xh.current=null}function lv(r){var o=r;do{var l=o.alternate;if(r=o.return,(o.flags&32768)===0){if(l=IE(l,o,yn),l!==null){ht=l;return}}else{if(l=jE(l,o),l!==null){l.flags&=32767,ht=l;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{mt=6,ht=null;return}}if(o=o.sibling,o!==null){ht=o;return}ht=o=r}while(o!==null);mt===0&&(mt=5)}function Hs(r,o,l){var c=Ae,g=Mn.transition;try{Mn.transition=null,Ae=1,AE(r,o,l,c)}finally{Mn.transition=g,Ae=c}return null}function AE(r,o,l,c){do ei();while(ts!==null);if((Te&6)!==0)throw Error(n(327));l=r.finishedWork;var g=r.finishedLanes;if(l===null)return null;if(r.finishedWork=null,r.finishedLanes=0,l===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var S=l.lanes|l.childLanes;if(xR(r,S),r===kt&&(ht=kt=null,$t=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Fu||(Fu=!0,dv(Bl,function(){return ei(),null})),S=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||S){S=Mn.transition,Mn.transition=null;var C=Ae;Ae=1;var I=Te;Te|=4,xh.current=null,ME(r,l),Xx(l,r),sE(Ed),Jl=!!Rd,Ed=Rd=null,r.current=l,TE(l),uR(),Te=I,Ae=C,Mn.transition=S}else r.current=l;if(Fu&&(Fu=!1,ts=r,Lu=g),S=r.pendingLanes,S===0&&(es=null),dR(l.stateNode),rn(r,ut()),o!==null)for(c=r.onRecoverableError,l=0;l<o.length;l++)g=o[l],c(g.value,{componentStack:g.stack,digest:g.digest});if($u)throw $u=!1,r=wh,wh=null,r;return(Lu&1)!==0&&r.tag!==0&&ei(),S=r.pendingLanes,(S&1)!==0?r===kh?xa++:(xa=0,kh=r):xa=0,Jr(),null}function ei(){if(ts!==null){var r=J0(Lu),o=Mn.transition,l=Ae;try{if(Mn.transition=null,Ae=16>r?16:r,ts===null)var c=!1;else{if(r=ts,ts=null,Lu=0,(Te&6)!==0)throw Error(n(331));var g=Te;for(Te|=4,de=r.current;de!==null;){var S=de,C=S.child;if((de.flags&16)!==0){var I=S.deletions;if(I!==null){for(var N=0;N<I.length;N++){var Q=I[N];for(de=Q;de!==null;){var oe=de;switch(oe.tag){case 0:case 11:case 15:pa(8,oe,S)}var ie=oe.child;if(ie!==null)ie.return=oe,de=ie;else for(;de!==null;){oe=de;var ne=oe.sibling,fe=oe.return;if(Gx(oe),oe===Q){de=null;break}if(ne!==null){ne.return=fe,de=ne;break}de=fe}}}var ge=S.alternate;if(ge!==null){var me=ge.child;if(me!==null){ge.child=null;do{var ct=me.sibling;me.sibling=null,me=ct}while(me!==null)}}de=S}}if((S.subtreeFlags&2064)!==0&&C!==null)C.return=S,de=C;else e:for(;de!==null;){if(S=de,(S.flags&2048)!==0)switch(S.tag){case 0:case 11:case 15:pa(9,S,S.return)}var B=S.sibling;if(B!==null){B.return=S.return,de=B;break e}de=S.return}}var F=r.current;for(de=F;de!==null;){C=de;var W=C.child;if((C.subtreeFlags&2064)!==0&&W!==null)W.return=C,de=W;else e:for(C=F;de!==null;){if(I=de,(I.flags&2048)!==0)try{switch(I.tag){case 0:case 11:case 15:Nu(9,I)}}catch(ye){nt(I,I.return,ye)}if(I===C){de=null;break e}var le=I.sibling;if(le!==null){le.return=I.return,de=le;break e}de=I.return}}if(Te=g,Jr(),ar&&typeof ar.onPostCommitFiberRoot=="function")try{ar.onPostCommitFiberRoot(ql,r)}catch{}c=!0}return c}finally{Ae=l,Mn.transition=o}}return!1}function uv(r,o,l){o=Jo(l,o),o=Ex(r,o,1),r=Xr(r,o,1),o=Kt(),r!==null&&(Vi(r,1,o),rn(r,o))}function nt(r,o,l){if(r.tag===3)uv(r,r,l);else for(;o!==null;){if(o.tag===3){uv(o,r,l);break}else if(o.tag===1){var c=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(es===null||!es.has(c))){r=Jo(l,r),r=Px(o,r,1),o=Xr(o,r,1),r=Kt(),o!==null&&(Vi(o,1,r),rn(o,r));break}}o=o.return}}function DE(r,o,l){var c=r.pingCache;c!==null&&c.delete(o),o=Kt(),r.pingedLanes|=r.suspendedLanes&l,kt===r&&($t&l)===l&&(mt===4||mt===3&&($t&130023424)===$t&&500>ut()-Sh?qs(r,0):vh|=l),rn(r,o)}function cv(r,o){o===0&&((r.mode&1)===0?o=1:(o=Wl,Wl<<=1,(Wl&130023424)===0&&(Wl=4194304)));var l=Kt();r=Rr(r,o),r!==null&&(Vi(r,o,l),rn(r,l))}function zE(r){var o=r.memoizedState,l=0;o!==null&&(l=o.retryLane),cv(r,l)}function UE(r,o){var l=0;switch(r.tag){case 13:var c=r.stateNode,g=r.memoizedState;g!==null&&(l=g.retryLane);break;case 19:c=r.stateNode;break;default:throw Error(n(314))}c!==null&&c.delete(o),cv(r,l)}var fv;fv=function(r,o,l){if(r!==null)if(r.memoizedProps!==o.pendingProps||Zt.current)tn=!0;else{if((r.lanes&l)===0&&(o.flags&128)===0)return tn=!1,PE(r,o,l);tn=(r.flags&131072)!==0}else tn=!1,Qe&&(o.flags&1048576)!==0&&qy(o,gu,o.index);switch(o.lanes=0,o.tag){case 2:var c=o.type;Iu(r,o),r=o.pendingProps;var g=Vo(o,Ot.current);Ko(o,l),g=Yd(null,o,c,r,g,l);var S=Xd();return o.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,en(c)?(S=!0,fu(o)):S=!1,o.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,qd(o),g.updater=Eu,o.stateNode=g,g._reactInternals=o,sh(o,c,r,l),o=lh(null,o,c,!0,S,l)):(o.tag=0,Qe&&S&&$d(o),Gt(null,o,g,l),o=o.child),o;case 16:c=o.elementType;e:{switch(Iu(r,o),r=o.pendingProps,g=c._init,c=g(c._payload),o.type=c,g=o.tag=BE(c),r=Gn(c,r),g){case 0:o=ah(null,o,c,r,l);break e;case 1:o=Ox(null,o,c,r,l);break e;case 11:o=Mx(null,o,c,r,l);break e;case 14:o=Tx(null,o,c,Gn(c.type,r),l);break e}throw Error(n(306,c,""))}return o;case 0:return c=o.type,g=o.pendingProps,g=o.elementType===c?g:Gn(c,g),ah(r,o,c,g,l);case 1:return c=o.type,g=o.pendingProps,g=o.elementType===c?g:Gn(c,g),Ox(r,o,c,g,l);case 3:e:{if(Ax(o),r===null)throw Error(n(387));c=o.pendingProps,S=o.memoizedState,g=S.element,Zy(r,o),Su(o,c,null,l);var C=o.memoizedState;if(c=C.element,S.isDehydrated)if(S={element:c,isDehydrated:!1,cache:C.cache,pendingSuspenseBoundaries:C.pendingSuspenseBoundaries,transitions:C.transitions},o.updateQueue.baseState=S,o.memoizedState=S,o.flags&256){g=Jo(Error(n(423)),o),o=Dx(r,o,c,l,g);break e}else if(c!==g){g=Jo(Error(n(424)),o),o=Dx(r,o,c,l,g);break e}else for(mn=Gr(o.stateNode.containerInfo.firstChild),pn=o,Qe=!0,Wn=null,l=Yy(o,null,c,l),o.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Ho(),c===g){o=Pr(r,o,l);break e}Gt(r,o,c,l)}o=o.child}return o;case 5:return nx(o),r===null&&Od(o),c=o.type,g=o.pendingProps,S=r!==null?r.memoizedProps:null,C=g.children,Pd(c,g)?C=null:S!==null&&Pd(c,S)&&(o.flags|=32),Lx(r,o),Gt(r,o,C,l),o.child;case 6:return r===null&&Od(o),null;case 13:return zx(r,o,l);case 4:return Hd(o,o.stateNode.containerInfo),c=o.pendingProps,r===null?o.child=Wo(o,null,c,l):Gt(r,o,c,l),o.child;case 11:return c=o.type,g=o.pendingProps,g=o.elementType===c?g:Gn(c,g),Mx(r,o,c,g,l);case 7:return Gt(r,o,o.pendingProps,l),o.child;case 8:return Gt(r,o,o.pendingProps.children,l),o.child;case 12:return Gt(r,o,o.pendingProps.children,l),o.child;case 10:e:{if(c=o.type._context,g=o.pendingProps,S=o.memoizedProps,C=g.value,qe(yu,c._currentValue),c._currentValue=C,S!==null)if(Hn(S.value,C)){if(S.children===g.children&&!Zt.current){o=Pr(r,o,l);break e}}else for(S=o.child,S!==null&&(S.return=o);S!==null;){var I=S.dependencies;if(I!==null){C=S.child;for(var N=I.firstContext;N!==null;){if(N.context===c){if(S.tag===1){N=Er(-1,l&-l),N.tag=2;var Q=S.updateQueue;if(Q!==null){Q=Q.shared;var oe=Q.pending;oe===null?N.next=N:(N.next=oe.next,oe.next=N),Q.pending=N}}S.lanes|=l,N=S.alternate,N!==null&&(N.lanes|=l),Vd(S.return,l,o),I.lanes|=l;break}N=N.next}}else if(S.tag===10)C=S.type===o.type?null:S.child;else if(S.tag===18){if(C=S.return,C===null)throw Error(n(341));C.lanes|=l,I=C.alternate,I!==null&&(I.lanes|=l),Vd(C,l,o),C=S.sibling}else C=S.child;if(C!==null)C.return=S;else for(C=S;C!==null;){if(C===o){C=null;break}if(S=C.sibling,S!==null){S.return=C.return,C=S;break}C=C.return}S=C}Gt(r,o,g.children,l),o=o.child}return o;case 9:return g=o.type,c=o.pendingProps.children,Ko(o,l),g=jn(g),c=c(g),o.flags|=1,Gt(r,o,c,l),o.child;case 14:return c=o.type,g=Gn(c,o.pendingProps),g=Gn(c.type,g),Tx(r,o,c,g,l);case 15:return $x(r,o,o.type,o.pendingProps,l);case 17:return c=o.type,g=o.pendingProps,g=o.elementType===c?g:Gn(c,g),Iu(r,o),o.tag=1,en(c)?(r=!0,fu(o)):r=!1,Ko(o,l),_x(o,c,g),sh(o,c,g,l),lh(null,o,c,!0,r,l);case 19:return Vx(r,o,l);case 22:return Fx(r,o,l)}throw Error(n(156,o.tag))};function dv(r,o){return H0(r,o)}function VE(r,o,l,c){this.tag=r,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tn(r,o,l,c){return new VE(r,o,l,c)}function Ph(r){return r=r.prototype,!(!r||!r.isReactComponent)}function BE(r){if(typeof r=="function")return Ph(r)?1:0;if(r!=null){if(r=r.$$typeof,r===ae)return 11;if(r===X)return 14}return 2}function ss(r,o){var l=r.alternate;return l===null?(l=Tn(r.tag,o,r.key,r.mode),l.elementType=r.elementType,l.type=r.type,l.stateNode=r.stateNode,l.alternate=r,r.alternate=l):(l.pendingProps=o,l.type=r.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=r.flags&14680064,l.childLanes=r.childLanes,l.lanes=r.lanes,l.child=r.child,l.memoizedProps=r.memoizedProps,l.memoizedState=r.memoizedState,l.updateQueue=r.updateQueue,o=r.dependencies,l.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},l.sibling=r.sibling,l.index=r.index,l.ref=r.ref,l}function zu(r,o,l,c,g,S){var C=2;if(c=r,typeof r=="function")Ph(r)&&(C=1);else if(typeof r=="string")C=5;else e:switch(r){case $:return Ws(l.children,g,S,o);case U:C=8,g|=8;break;case V:return r=Tn(12,l,o,g|2),r.elementType=V,r.lanes=S,r;case P:return r=Tn(13,l,o,g),r.elementType=P,r.lanes=S,r;case H:return r=Tn(19,l,o,g),r.elementType=H,r.lanes=S,r;case q:return Uu(l,g,S,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Z:C=10;break e;case te:C=9;break e;case ae:C=11;break e;case X:C=14;break e;case K:C=16,c=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Tn(C,l,o,g),o.elementType=r,o.type=c,o.lanes=S,o}function Ws(r,o,l,c){return r=Tn(7,r,c,o),r.lanes=l,r}function Uu(r,o,l,c){return r=Tn(22,r,c,o),r.elementType=q,r.lanes=l,r.stateNode={isHidden:!1},r}function Ih(r,o,l){return r=Tn(6,r,null,o),r.lanes=l,r}function jh(r,o,l){return o=Tn(4,r.children!==null?r.children:[],r.key,o),o.lanes=l,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function qE(r,o,l,c,g){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=rd(0),this.expirationTimes=rd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rd(0),this.identifierPrefix=c,this.onRecoverableError=g,this.mutableSourceEagerHydrationData=null}function Nh(r,o,l,c,g,S,C,I,N){return r=new qE(r,o,l,I,N),o===1?(o=1,S===!0&&(o|=8)):o=0,S=Tn(3,null,null,o),r.current=S,S.stateNode=r,S.memoizedState={element:c,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},qd(S),r}function HE(r,o,l){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:c==null?null:""+c,children:r,containerInfo:o,implementation:l}}function hv(r){if(!r)return Qr;r=r._reactInternals;e:{if($s(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(en(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var l=r.type;if(en(l))return Uy(r,l,o)}return o}function gv(r,o,l,c,g,S,C,I,N){return r=Nh(l,c,!0,r,g,S,C,I,N),r.context=hv(null),l=r.current,c=Kt(),g=ns(l),S=Er(c,g),S.callback=o??null,Xr(l,S,g),r.current.lanes=g,Vi(r,g,c),rn(r,c),r}function Vu(r,o,l,c){var g=o.current,S=Kt(),C=ns(g);return l=hv(l),o.context===null?o.context=l:o.pendingContext=l,o=Er(S,C),o.payload={element:r},c=c===void 0?null:c,c!==null&&(o.callback=c),r=Xr(g,o,C),r!==null&&(Jn(r,g,C,S),vu(r,g,C)),C}function Bu(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function pv(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var l=r.retryLane;r.retryLane=l!==0&&l<o?l:o}}function Mh(r,o){pv(r,o),(r=r.alternate)&&pv(r,o)}function WE(){return null}var mv=typeof reportError=="function"?reportError:function(r){console.error(r)};function Th(r){this._internalRoot=r}qu.prototype.render=Th.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Vu(r,o,null,null)},qu.prototype.unmount=Th.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;Bs(function(){Vu(null,r,null,null)}),o[kr]=null}};function qu(r){this._internalRoot=r}qu.prototype.unstable_scheduleHydration=function(r){if(r){var o=Z0();r={blockedOn:null,target:r,priority:o};for(var l=0;l<qr.length&&o!==0&&o<qr[l].priority;l++);qr.splice(l,0,r),l===0&&ny(r)}};function $h(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Hu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function yv(){}function GE(r,o,l,c,g){if(g){if(typeof c=="function"){var S=c;c=function(){var Q=Bu(C);S.call(Q)}}var C=gv(o,c,r,0,null,!1,!1,"",yv);return r._reactRootContainer=C,r[kr]=C.current,na(r.nodeType===8?r.parentNode:r),Bs(),C}for(;g=r.lastChild;)r.removeChild(g);if(typeof c=="function"){var I=c;c=function(){var Q=Bu(N);I.call(Q)}}var N=Nh(r,0,!1,null,null,!1,!1,"",yv);return r._reactRootContainer=N,r[kr]=N.current,na(r.nodeType===8?r.parentNode:r),Bs(function(){Vu(o,N,l,c)}),N}function Wu(r,o,l,c,g){var S=l._reactRootContainer;if(S){var C=S;if(typeof g=="function"){var I=g;g=function(){var N=Bu(C);I.call(N)}}Vu(o,C,r,g)}else C=GE(l,o,r,g,c);return Bu(C)}Y0=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var l=Ui(o.pendingLanes);l!==0&&(sd(o,l|1),rn(o,ut()),(Te&6)===0&&(Zo=ut()+500,Jr()))}break;case 13:Bs(function(){var c=Rr(r,1);if(c!==null){var g=Kt();Jn(c,r,1,g)}}),Mh(r,1)}},od=function(r){if(r.tag===13){var o=Rr(r,134217728);if(o!==null){var l=Kt();Jn(o,r,134217728,l)}Mh(r,134217728)}},X0=function(r){if(r.tag===13){var o=ns(r),l=Rr(r,o);if(l!==null){var c=Kt();Jn(l,r,o,c)}Mh(r,o)}},Z0=function(){return Ae},ey=function(r,o){var l=Ae;try{return Ae=r,o()}finally{Ae=l}},Yf=function(r,o,l){switch(o){case"input":if(Po(r,l),o=l.name,l.type==="radio"&&o!=null){for(l=r;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<l.length;o++){var c=l[o];if(c!==r&&c.form===r.form){var g=uu(c);if(!g)throw Error(n(90));Ns(c),Po(c,g)}}}break;case"textarea":Fi(r,l);break;case"select":o=l.value,o!=null&&zr(r,!!l.multiple,o,!1)}},A0=_h,D0=Bs;var KE={usingClientEntryPoint:!1,Events:[oa,zo,uu,L0,O0,_h]},va={findFiberByHostInstance:Fs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},QE={bundleType:va.bundleType,version:va.version,rendererPackageName:va.rendererPackageName,rendererConfig:va.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:R.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=B0(r),r===null?null:r.stateNode},findFiberByHostInstance:va.findFiberByHostInstance||WE,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 Gu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gu.isDisabled&&Gu.supportsFiber)try{ql=Gu.inject(QE),ar=Gu}catch{}}return sn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=KE,sn.createPortal=function(r,o){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!$h(o))throw Error(n(200));return HE(r,o,null,l)},sn.createRoot=function(r,o){if(!$h(r))throw Error(n(299));var l=!1,c="",g=mv;return o!=null&&(o.unstable_strictMode===!0&&(l=!0),o.identifierPrefix!==void 0&&(c=o.identifierPrefix),o.onRecoverableError!==void 0&&(g=o.onRecoverableError)),o=Nh(r,1,!1,null,null,l,!1,c,g),r[kr]=o.current,na(r.nodeType===8?r.parentNode:r),new Th(o)},sn.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=B0(o),r=r===null?null:r.stateNode,r},sn.flushSync=function(r){return Bs(r)},sn.hydrate=function(r,o,l){if(!Hu(o))throw Error(n(200));return Wu(null,r,o,!0,l)},sn.hydrateRoot=function(r,o,l){if(!$h(r))throw Error(n(405));var c=l!=null&&l.hydratedSources||null,g=!1,S="",C=mv;if(l!=null&&(l.unstable_strictMode===!0&&(g=!0),l.identifierPrefix!==void 0&&(S=l.identifierPrefix),l.onRecoverableError!==void 0&&(C=l.onRecoverableError)),o=gv(o,null,r,1,l??null,g,!1,S,C),r[kr]=o.current,na(r),c)for(r=0;r<c.length;r++)l=c[r],g=l._getVersion,g=g(l._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[l,g]:o.mutableSourceEagerHydrationData.push(l,g);return new qu(o)},sn.render=function(r,o,l){if(!Hu(o))throw Error(n(200));return Wu(null,r,o,!1,l)},sn.unmountComponentAtNode=function(r){if(!Hu(r))throw Error(n(40));return r._reactRootContainer?(Bs(function(){Wu(null,null,r,!1,function(){r._reactRootContainer=null,r[kr]=null})}),!0):!1},sn.unstable_batchedUpdates=_h,sn.unstable_renderSubtreeIntoContainer=function(r,o,l,c){if(!Hu(l))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Wu(r,o,l,!1,c)},sn.version="18.3.1-next-f1338f8080-20240426",sn}var _v;function p1(){if(_v)return Oh.exports;_v=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Oh.exports=oP(),Oh.exports}var Rv;function iP(){if(Rv)return Ku;Rv=1;var e=p1();return Ku.createRoot=e.createRoot,Ku.hydrateRoot=e.hydrateRoot,Ku}var aP=iP(),lP={};const qp=fP();function Ye(e,...t){if(!qp)return;const n=cP(e,...t);performance.mark(n);try{console.log(e,...t)}catch{console.log(n)}}function uP(e,...t){qp&&console.warn(e,...t)}function cP(e,...t){return e.replace(/%[sfdO]/g,n=>{const s=t.shift();return n==="%O"&&s?JSON.stringify(s).replace(/"([^"]+)":/g,"$1:"):String(s)})}function fP(){if(typeof window>"u")return(lP.DEBUG||"").includes("nuqs");try{const e="nuqs-localStorage-test";if(typeof localStorage>"u")return!1;localStorage.setItem(e,e);const t=localStorage.getItem(e)===e;return localStorage.removeItem(e),t&&(localStorage.getItem("debug")||"").includes("nuqs")}catch{return!1}}const dP={303:"Multiple adapter contexts detected. This might happen in monorepos.",404:"nuqs requires an adapter to work with your framework.",409:"Multiple versions of the library are loaded. This may lead to unexpected behavior. Currently using `%s`, but `%s` (via the %s adapter) was about to load on top.",414:"Max safe URL length exceeded. Some browsers may not be able to accept this URL. Consider limiting the amount of state stored in the URL.",422:"Invalid options combination: `limitUrlUpdates: debounce` should be used in SSR scenarios, with `shallow: false`",429:"URL update rate-limited by the browser. Consider increasing `throttleMs` for key(s) `%s`. %O",500:"Empty search params cache. Search params can't be accessed in Layouts.",501:"Search params cache already populated. Have you called `parse` twice?"};function vl(e){return`[nuqs] ${dP[e]}
|
|
42
|
+
See https://nuqs.dev/NUQS-${e}`}function hP(e){if(e.size===0)return"";const t=[];for(const[s,i]of e.entries()){const a=s.replace(/#/g,"%23").replace(/&/g,"%26").replace(/\+/g,"%2B").replace(/=/g,"%3D").replace(/\?/g,"%3F");t.push(`${a}=${gP(i)}`)}return"?"+t.join("&")}function gP(e){return e.replace(/%/g,"%25").replace(/\+/g,"%2B").replace(/ /g,"+").replace(/#/g,"%23").replace(/&/g,"%26").replace(/"/g,"%22").replace(/'/g,"%27").replace(/`/g,"%60").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/[\x00-\x1F]/g,t=>encodeURIComponent(t))}const fo=z.createContext({useAdapter(){throw new Error(vl(404))}});fo.displayName="NuqsAdapterContext";qp&&typeof window<"u"&&(window.__NuqsAdapterContext&&window.__NuqsAdapterContext!==fo&&console.error(vl(303)),window.__NuqsAdapterContext=fo);function pP(e){return({children:t,defaultOptions:n,processUrlSearchParams:s,...i})=>z.createElement(fo.Provider,{...i,value:{useAdapter:e,defaultOptions:n,processUrlSearchParams:s}},t)}function mP(e){const t=z.useContext(fo);if(!("useAdapter"in t))throw new Error(vl(404));return t.useAdapter(e)}const yP=()=>z.useContext(fo).defaultOptions,xP=()=>z.useContext(fo).processUrlSearchParams;function vP(){var e;if(typeof window>"u"||!window.GestureEvent)return 50;try{const t=(e=navigator.userAgent)==null?void 0:e.match(/version\/([\d\.]+) safari/i);return parseFloat(t[1])>=17?120:320}catch{return 320}}function SP(e){return{method:"throttle",timeMs:e}}const Da=SP(vP());function wP(e){return e===null||Array.isArray(e)&&e.length===0}function kP(e,t,n){if(typeof e=="string")n.set(t,e);else{n.delete(t);for(const s of e)n.append(t,s);n.has(t)||n.set(t,"")}return n}function Hp(){const e=new Map;return{on(t,n){const s=e.get(t)||[];return s.push(n),e.set(t,s),()=>this.off(t,n)},off(t,n){const s=e.get(t);s&&e.set(t,s.filter(i=>i!==n))},emit(t,n){var s;(s=e.get(t))==null||s.forEach(i=>i(n))}}}function Ag(e,t,n){function s(){e(),n.removeEventListener("abort",a)}const i=setTimeout(s,t);function a(){clearTimeout(i),n.removeEventListener("abort",a)}n.addEventListener("abort",a)}function Dg(){const e=Promise;if(Promise.hasOwnProperty("withResolvers"))return Promise.withResolvers();let t=()=>{},n=()=>{};return{promise:new e((s,i)=>{t=s,n=i}),resolve:t,reject:n}}function CP(e,t){let n=t;for(let s=e.length-1;s>=0;s--){const i=e[s];if(!i)continue;const a=n;n=()=>i(a)}n()}function zg(){return new URLSearchParams(location.search)}var m1=class{constructor(){L(this,"updateMap",new Map);L(this,"options",{history:"replace",scroll:!1,shallow:!0});L(this,"timeMs",Da.timeMs);L(this,"transitions",new Set);L(this,"resolvers",null);L(this,"controller",null);L(this,"lastFlushedAt",0);L(this,"resetQueueOnNextPush",!1)}push({key:e,query:t,options:n},s=Da.timeMs){this.resetQueueOnNextPush&&(this.reset(),this.resetQueueOnNextPush=!1),Ye("[nuqs gtq] Enqueueing %s=%s %O",e,t,n),this.updateMap.set(e,t),n.history==="push"&&(this.options.history="push"),n.scroll&&(this.options.scroll=!0),n.shallow===!1&&(this.options.shallow=!1),n.startTransition&&this.transitions.add(n.startTransition),(!Number.isFinite(this.timeMs)||s>this.timeMs)&&(this.timeMs=s)}getQueuedQuery(e){return this.updateMap.get(e)}getPendingPromise({getSearchParamsSnapshot:e=zg}){var t;return((t=this.resolvers)==null?void 0:t.promise)??Promise.resolve(e())}flush({getSearchParamsSnapshot:e=zg,rateLimitFactor:t=1,...n},s){if(this.controller??(this.controller=new AbortController),!Number.isFinite(this.timeMs))return Ye("[nuqs gtq] Skipping flush due to throttleMs=Infinity"),Promise.resolve(e());if(this.resolvers)return this.resolvers.promise;this.resolvers=Dg();const i=()=>{this.lastFlushedAt=performance.now();const[u,f]=this.applyPendingUpdates({...n,autoResetQueueOnUpdate:n.autoResetQueueOnUpdate??!0,getSearchParamsSnapshot:e},s);f===null?(this.resolvers.resolve(u),this.resetQueueOnNextPush=!0):this.resolvers.reject(u),this.resolvers=null};return Ag(()=>{const u=performance.now()-this.lastFlushedAt,f=this.timeMs,d=t*Math.max(0,f-u);Ye("[nuqs gtq] Scheduling flush in %f ms. Throttled at %f ms (x%f)",d,f,t),d===0?i():Ag(i,d,this.controller.signal)},0,this.controller.signal),this.resolvers.promise}abort(){var e,t;return(e=this.controller)==null||e.abort(),this.controller=new AbortController,(t=this.resolvers)==null||t.resolve(new URLSearchParams),this.resolvers=null,this.reset()}reset(){const e=Array.from(this.updateMap.keys());return Ye("[nuqs gtq] Resetting queue %s",JSON.stringify(Object.fromEntries(this.updateMap))),this.updateMap.clear(),this.transitions.clear(),this.options={history:"replace",scroll:!1,shallow:!0},this.timeMs=Da.timeMs,e}applyPendingUpdates(e,t){const{updateUrl:n,getSearchParamsSnapshot:s}=e;let i=s();if(Ye("[nuqs gtq] Applying %d pending update(s) on top of %s",this.updateMap.size,i.toString()),this.updateMap.size===0)return[i,null];const a=Array.from(this.updateMap.entries()),u={...this.options},f=Array.from(this.transitions);e.autoResetQueueOnUpdate&&this.reset(),Ye("[nuqs gtq] Flushing queue %O with options %O",a,u);for(const[d,h]of a)h===null?i.delete(d):i=kP(h,d,i);t&&(i=t(i));try{return CP(f,()=>{n(i,u)}),[i,null]}catch(d){return console.error(vl(429),a.map(([h])=>h).join(),d),[i,d]}}};const dc=new m1;function bP(e,t,n){const s=z.useCallback(()=>{const a=Object.fromEntries(e.map(u=>[u,n(u)]));return[JSON.stringify(a),a]},[e.join(","),n]),i=z.useRef(null);return i.current===null&&(i.current=s()),z.useSyncExternalStore(z.useCallback(a=>{const u=e.map(f=>t(f,a));return()=>u.forEach(f=>f())},[e.join(","),t]),()=>{const[a,u]=s();return i.current[0]===a?i.current[1]:(i.current=[a,u],u)},()=>i.current[1])}var _P=class{constructor(e){L(this,"callback");L(this,"resolvers",Dg());L(this,"controller",new AbortController);L(this,"queuedValue");this.callback=e}abort(){this.controller.abort(),this.queuedValue=void 0}push(e,t){return this.queuedValue=e,this.controller.abort(),this.controller=new AbortController,Ag(()=>{const n=this.resolvers;try{Ye("[nuqs dq] Flushing debounce queue",e);const s=this.callback(e);Ye("[nuqs dq] Reset debounce queue %O",this.queuedValue),this.queuedValue=void 0,this.resolvers=Dg(),s.then(i=>n.resolve(i)).catch(i=>n.reject(i))}catch(s){this.queuedValue=void 0,n.reject(s)}},t,this.controller.signal),this.resolvers.promise}},RP=class{constructor(e=new m1){L(this,"throttleQueue");L(this,"queues",new Map);L(this,"queuedQuerySync",Hp());this.throttleQueue=e}useQueuedQueries(e){return bP(e,(t,n)=>this.queuedQuerySync.on(t,n),t=>this.getQueuedQuery(t))}push(e,t,n,s){if(!Number.isFinite(t)){const u=n.getSearchParamsSnapshot??zg;return Promise.resolve(u())}const i=e.key;if(!this.queues.has(i)){Ye("[nuqs dqc] Creating debounce queue for `%s`",i);const u=new _P(f=>(this.throttleQueue.push(f),this.throttleQueue.flush(n,s).finally(()=>{var d;((d=this.queues.get(f.key))==null?void 0:d.queuedValue)===void 0&&(Ye("[nuqs dqc] Cleaning up empty queue for `%s`",f.key),this.queues.delete(f.key)),this.queuedQuerySync.emit(f.key)})));this.queues.set(i,u)}Ye("[nuqs dqc] Enqueueing debounce update %O",e);const a=this.queues.get(i).push(e,t);return this.queuedQuerySync.emit(i),a}abort(e){var n;const t=this.queues.get(e);return t?(Ye("[nuqs dqc] Aborting debounce queue %s=%s",e,(n=t.queuedValue)==null?void 0:n.query),this.queues.delete(e),t.abort(),this.queuedQuerySync.emit(e),s=>(s.then(t.resolvers.resolve,t.resolvers.reject),s)):s=>s}abortAll(){var e;for(const[t,n]of this.queues.entries())Ye("[nuqs dqc] Aborting debounce queue %s=%s",t,(e=n.queuedValue)==null?void 0:e.query),n.abort(),n.resolvers.resolve(new URLSearchParams),this.queuedQuerySync.emit(t);this.queues.clear()}getQueuedQuery(e){var n,s;const t=(s=(n=this.queues.get(e))==null?void 0:n.queuedValue)==null?void 0:s.query;return t!==void 0?t:this.throttleQueue.getQueuedQuery(e)}};const zh=new RP(dc);function y1(e,t){return e===t?!0:e===null||t===null||typeof e=="string"||typeof t=="string"||e.length!==t.length?!1:e.every((n,s)=>n===t[s])}function Ev(e,t,n){return s=>{if(!(t.length===0||t.some(a=>!y1(s.getAll(a),e.getAll(a)))))return Ye("[nuqs `%s`] no change, returning previous",t.join(","),s),s;const i=x1(e,t,n);return Ye("[nuqs `%s`] subbed search params change\n from %O\n to %O",t.join(","),s,i),i}}function x1(e,t,n){if(t.length===0)return e;const s=n?new URLSearchParams(e):e;for(const i of e.keys())t.includes(i)||s.delete(i);return s}const EP="__nuqs__",Ug=Hp();function PP(e){return function(n,s){const i=new URL(location.href);i.search=hP(n),Ye("[nuqs react] Updating url: %s",i),e&&s.shallow===!1?(s.history==="push"?location.assign:location.replace).call(location,i):(s.history==="push"?history.pushState:history.replaceState).call(history,history.state,EP,i),Ug.emit("update",n),s.scroll===!0&&window.scrollTo({top:0})}}const v1=z.createContext({fullPageNavigationOnShallowFalseUpdates:!1});function IP(e){const{fullPageNavigationOnShallowFalseUpdates:t}=z.useContext(v1),[n,s]=z.useState(()=>typeof location>"u"?new URLSearchParams:x1(new URLSearchParams(location.search),e,!1));return z.useEffect(()=>{const i=()=>{s(Ev(new URLSearchParams(location.search),e,!1))},a=u=>{s(Ev(u,e,!0))};return Ug.on("update",a),window.addEventListener("popstate",i),()=>{Ug.off("update",a),window.removeEventListener("popstate",i)}},[e.join("&")]),{searchParams:n,updateUrl:z.useMemo(()=>PP(t),[t])}}const jP=pP(IP);function NP({children:e,fullPageNavigationOnShallowFalseUpdates:t=!1,...n}){return z.createElement(v1.Provider,{value:{fullPageNavigationOnShallowFalseUpdates:t}},z.createElement(jP,{...n,children:e}))}var Ma=typeof window<"u"?z.useLayoutEffect:z.useEffect;function Uh(e){const t=z.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function MP(e,t,n={},s={}){z.useEffect(()=>{if(!e.current||s.disabled||typeof IntersectionObserver!="function")return;const i=new IntersectionObserver(([a])=>{t(a)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,s.disabled,e])}function TP(e){const t=z.useRef(null);return z.useImperativeHandle(e,()=>t.current,[]),t}const S1=!1;function Qa(e){return e[e.length-1]}function $P(e){return typeof e=="function"}function Xs(e,t){return $P(e)?e(t):e}const w1=Object.prototype.hasOwnProperty,Pv=Object.prototype.propertyIsEnumerable;function k1(e){for(const t in e)if(w1.call(e,t))return!0;return!1}const FP=()=>Object.create(null),Gs=(e,t)=>Zs(e,t,FP);function Zs(e,t,n=()=>({}),s=0){if(e===t)return e;if(s>500)return t;const i=t,a=Nv(e)&&Nv(i);if(!a&&!(Ec(e)&&Ec(i)))return i;const u=a?e:Iv(e);if(!u)return i;const f=a?i:Iv(i);if(!f)return i;const d=u.length,h=f.length,m=a?new Array(h):n();let p=0;for(let x=0;x<h;x++){const v=a?x:f[x],w=e[v],k=i[v];if(w===k){m[v]=w,(a?x<d:w1.call(e,v))&&p++;continue}if(w===null||k===null||typeof w!="object"||typeof k!="object"){m[v]=k;continue}const b=Zs(w,k,n,s+1);m[v]=b,b===w&&p++}return d===h&&p===d?e:m}function Iv(e){const t=Object.getOwnPropertyNames(e);for(const i of t)if(!Pv.call(e,i))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const s=t;for(const i of n){if(!Pv.call(e,i))return!1;s.push(i)}return s}function Ec(e){if(!jv(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!jv(n)||!n.hasOwnProperty("isPrototypeOf"))}function jv(e){return Object.prototype.toString.call(e)==="[object Object]"}function Nv(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function to(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let s=0,i=e.length;s<i;s++)if(!to(e[s],t[s],n))return!1;return!0}if(Ec(e)&&Ec(t)){const s=(n==null?void 0:n.ignoreUndefined)??!0;if(n!=null&&n.partial){for(const u in t)if((!s||t[u]!==void 0)&&!to(e[u],t[u],n))return!1;return!0}let i=0;if(!s)i=Object.keys(e).length;else for(const u in e)e[u]!==void 0&&i++;let a=0;for(const u in t)if((!s||t[u]!==void 0)&&(a++,a>i||!to(e[u],t[u],n)))return!1;return i===a}return!1}function mi(e){let t,n;const s=new Promise((i,a)=>{t=i,n=a});return s.status="pending",s.resolve=i=>{s.status="resolved",s.value=i,t(i),e==null||e(i)},s.reject=i=>{s.status="rejected",n(i)},s}function Ja(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function LP(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function Mv(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return LP(t)}const OP=["http:","https:","mailto:","tel:"];function Pc(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function wa(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,s="",i;for(;(i=t.exec(e))!==null;)s+=Mv(e.slice(n,i.index))+i[0],n=t.lastIndex;s=s+Mv(n?e.slice(n):e);let a=!1;return s.startsWith("//")&&(a=!0,s="/"+s.replace(/^\/+/,"")),{path:s,handledProtocolRelativeURL:a}}function AP(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function DP(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Tr(){throw new Error("Invariant failed")}function Ya(e){const t=new Map;let n,s;const i=a=>{a.next&&(a.prev?(a.prev.next=a.next,a.next.prev=a.prev,a.next=void 0,s&&(s.next=a,a.prev=s)):(a.next.prev=void 0,n=a.next,a.next=void 0,s&&(a.prev=s,s.next=a)),s=a)};return{get(a){const u=t.get(a);if(u)return i(u),u.value},set(a,u){if(t.size>=e&&n){const d=n;t.delete(d.key),d.next&&(n=d.next,d.next.prev=void 0),d===s&&(s=void 0)}const f=t.get(a);if(f)f.value=u,i(f);else{const d={key:a,value:u,prev:s};s&&(s.next=d),s=d,n||(n=d),t.set(a,d)}},clear(){t.clear(),n=void 0,s=void 0}}}const cs=4,C1=5;function zP(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function b1(e,t,n=new Uint16Array(6)){const s=e.indexOf("/",t),i=s===-1?e.length:s,a=e.substring(t,i);if(!a||!a.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a==="$"){const f=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=f,n[4]=f,n[5]=f,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;const u=zP(a);if(u){const[f,d]=u,h=a.charCodeAt(f+1);if(h===45){if(f+2<a.length&&a.charCodeAt(f+2)===36){const m=f+3,p=d;if(m<p)return n[0]=3,n[1]=t+f,n[2]=t+m,n[3]=t+p,n[4]=t+d+1,n[5]=i,n}}else if(h===36){const m=f+1,p=f+2;return p===d?(n[0]=2,n[1]=t+f,n[2]=t+m,n[3]=t+p,n[4]=t+d+1,n[5]=e.length,n):(n[0]=1,n[1]=t+f,n[2]=t+p,n[3]=t+d,n[4]=t+d+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function of(e,t,n,s,i,a,u){var d,h,m,p,x,v,w,k,b,_;u==null||u(n);let f=s;{const E=n.fullPath??n.from,j=E.length,R=((d=n.options)==null?void 0:d.caseSensitive)??e,T=((m=(h=n.options)==null?void 0:h.params)==null?void 0:m.parse)??((p=n.options)==null?void 0:p.parseParams);for(;f<j;){const $=b1(E,f,t);let U;const V=f,Z=$[5];switch(f=Z+1,a++,$[0]){case 0:{const te=E.substring($[2],$[3]);if(R){const ae=(x=i.static)==null?void 0:x.get(te);if(ae)U=ae;else{i.static??(i.static=new Map);const P=eo(n.fullPath??n.from);P.parent=i,P.depth=a,U=P,i.static.set(te,P)}}else{const ae=te.toLowerCase(),P=(v=i.staticInsensitive)==null?void 0:v.get(ae);if(P)U=P;else{i.staticInsensitive??(i.staticInsensitive=new Map);const H=eo(n.fullPath??n.from);H.parent=i,H.depth=a,U=H,i.staticInsensitive.set(ae,H)}}break}case 1:{const te=E.substring(V,$[1]),ae=E.substring($[4],Z),P=R&&!!(te||ae),H=te?P?te:te.toLowerCase():void 0,X=ae?P?ae:ae.toLowerCase():void 0,K=!T&&((w=i.dynamic)==null?void 0:w.find(q=>!q.parse&&q.caseSensitive===P&&q.prefix===H&&q.suffix===X));if(K)U=K;else{const q=Bh(1,n.fullPath??n.from,P,H,X);U=q,q.depth=a,q.parent=i,i.dynamic??(i.dynamic=[]),i.dynamic.push(q)}break}case 3:{const te=E.substring(V,$[1]),ae=E.substring($[4],Z),P=R&&!!(te||ae),H=te?P?te:te.toLowerCase():void 0,X=ae?P?ae:ae.toLowerCase():void 0,K=!T&&((k=i.optional)==null?void 0:k.find(q=>!q.parse&&q.caseSensitive===P&&q.prefix===H&&q.suffix===X));if(K)U=K;else{const q=Bh(3,n.fullPath??n.from,P,H,X);U=q,q.parent=i,q.depth=a,i.optional??(i.optional=[]),i.optional.push(q)}break}case 2:{const te=E.substring(V,$[1]),ae=E.substring($[4],Z),P=R&&!!(te||ae),H=te?P?te:te.toLowerCase():void 0,X=ae?P?ae:ae.toLowerCase():void 0,K=Bh(2,n.fullPath??n.from,P,H,X);U=K,K.parent=i,K.depth=a,i.wildcard??(i.wildcard=[]),i.wildcard.push(K)}}i=U}if(T&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const $=eo(n.fullPath??n.from);$.kind=C1,$.parent=i,a++,$.depth=a,i.pathless??(i.pathless=[]),i.pathless.push($),i=$}const O=(n.path||!n.children)&&!n.isRoot;if(O&&E.endsWith("/")){const $=eo(n.fullPath??n.from);$.kind=cs,$.parent=i,a++,$.depth=a,i.index=$,i=$}i.parse=T??null,i.priority=((_=(b=n.options)==null?void 0:b.params)==null?void 0:_.priority)??0,O&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(const E of n.children)of(e,t,E,f,i,a,u)}function Vh(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function ls(e){var t,n,s;if(e.pathless)for(const i of e.pathless)ls(i);if(e.static)for(const i of e.static.values())ls(i);if(e.staticInsensitive)for(const i of e.staticInsensitive.values())ls(i);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort(Vh);for(const i of e.dynamic)ls(i)}if((n=e.optional)!=null&&n.length){e.optional.sort(Vh);for(const i of e.optional)ls(i)}if((s=e.wildcard)!=null&&s.length){e.wildcard.sort(Vh);for(const i of e.wildcard)ls(i)}}function eo(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Bh(e,t,n,s,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:s,suffix:i}}function UP(e,t){const n=eo("/"),s=new Uint16Array(6);for(const i of e)of(!1,s,i,1,n,0);ls(n),t.masksTree=n,t.flatCache=Ya(1e3)}function VP(e,t){e||(e="/");const n=t.flatCache.get(e);if(n)return n;const s=Wp(e,t.masksTree);return t.flatCache.set(e,s),s}function BP(e,t,n,s,i){e||(e="/"),s||(s="/");const a=t?`case\0${e}`:e;let u=i.singleCache.get(a);return u||(u=eo("/"),of(t,new Uint16Array(6),{from:e},1,u,0),i.singleCache.set(a,u)),Wp(s,u,n)}function qP(e,t,n=!1){const s=n?e:`nofuzz\0${e}`,i=t.matchCache.get(s);if(i!==void 0)return i;e||(e="/");let a;try{a=Wp(e,t.segmentTree,n)}catch(u){if(u instanceof URIError)a=null;else throw u}return a&&(a.branch=R1(a.route)),t.matchCache.set(s,a),a}function HP(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function WP(e,t=!1,n){const s=eo(e.fullPath),i=new Uint16Array(6),a={},u={};let f=0;return of(t,i,e,1,s,0,d=>{if(n==null||n(d,f),d.id in a&&Tr(),a[d.id]=d,f!==0&&d.path){const h=HP(d.fullPath);(!u[h]||d.fullPath.endsWith("/"))&&(u[h]=d)}f++}),ls(s),{processedTree:{segmentTree:s,singleCache:Ya(1e3),matchCache:Ya(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:u}}function Wp(e,t,n=!1){const s=e.split("/"),i=KP(e,s,t,n);if(!i)return null;const[a]=_1(e,s,i);return{route:i.node.route,rawParams:a}}function _1(e,t,n){var m,p,x,v,w,k,b,_,E,j;const s=GP(n.node);let i=null;const a=Object.create(null);let u=((m=n.extract)==null?void 0:m.part)??0,f=((p=n.extract)==null?void 0:p.node)??0,d=((x=n.extract)==null?void 0:x.path)??0,h=((v=n.extract)==null?void 0:v.segment)??0;for(;f<s.length;u++,f++,d++,h++){const R=s[f];if(R.kind===cs)break;if(R.kind===C1){h--,u--,d--;continue}const T=t[u],O=d;if(T&&(d+=T.length),R.kind===1){i??(i=n.node.fullPath.split("/"));const $=i[h],U=((w=R.prefix)==null?void 0:w.length)??0;if($.charCodeAt(U)===123){const V=((k=R.suffix)==null?void 0:k.length)??0,Z=$.substring(U+2,$.length-V-1),te=T.substring(U,T.length-V);a[Z]=decodeURIComponent(te)}else{const V=$.substring(1);a[V]=decodeURIComponent(T)}}else if(R.kind===3){if(n.skipped&1<<f){u--,d=O-1;continue}i??(i=n.node.fullPath.split("/"));const $=i[h],U=((b=R.prefix)==null?void 0:b.length)??0,V=((_=R.suffix)==null?void 0:_.length)??0,Z=$.substring(U+3,$.length-V-1),te=R.suffix||R.prefix?T.substring(U,T.length-V):T;te&&(a[Z]=decodeURIComponent(te))}else if(R.kind===2){const $=R,U=e.substring(O+(((E=$.prefix)==null?void 0:E.length)??0),e.length-(((j=$.suffix)==null?void 0:j.length)??0)),V=decodeURIComponent(U);a["*"]=V,a._splat=V;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:u,node:f,path:d,segment:h}]}function R1(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function GP(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function KP(e,t,n,s){if(e==="/"&&n.index)return{node:n.index,skipped:0};const i=!Qa(t),a=i&&e!=="/",u=t.length-(i?1:0),f=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let d=null,h=null;for(;f.length;){const m=f.pop(),{node:p,index:x,skipped:v,depth:w,statics:k,dynamics:b,optionals:_}=m;let{extract:E,rawParams:j}=m;if(p.kind===2&&p.route&&!Ju(h,m))continue;if(p.parse){if(!Tv(e,t,m))continue;j=m.rawParams,E=m.extract}s&&p.route&&p.kind!==cs&&Ju(d,m)&&(d=m);const R=x===u;if(R&&(p.route&&(!a||p.kind===cs||p.kind===2)&&Ju(h,m)&&(h=m),!p.optional&&!p.wildcard&&!p.index&&!p.pathless))continue;const T=R?void 0:t[x];let O;if(R&&p.index){const $={node:p.index,index:x,skipped:v,depth:w+1,statics:k,dynamics:b,optionals:_,extract:E,rawParams:j};let U=!0;if(p.index.parse&&(Tv(e,t,$)||(U=!1)),U){if(!b&&!_&&!v&&QP(k,u))return $;Ju(h,$)&&(h=$)}}if(p.wildcard)for(let $=p.wildcard.length-1;$>=0;$--){const U=p.wildcard[$],{prefix:V,suffix:Z}=U;if(!(V&&(R||!(U.caseSensitive?T:O??(O=T.toLowerCase())).startsWith(V)))){if(Z){if(R)continue;const te=t.slice(x).join("/").slice(-Z.length);if((U.caseSensitive?te:te.toLowerCase())!==Z)continue}f.push({node:U,index:u,skipped:v,depth:w+1,statics:k,dynamics:b,optionals:_,extract:E,rawParams:j})}}if(p.optional){const $=v|1<<w,U=w+1;for(let V=p.optional.length-1;V>=0;V--){const Z=p.optional[V];f.push({node:Z,index:x,skipped:$,depth:U,statics:k,dynamics:b,optionals:_,extract:E,rawParams:j})}if(!R)for(let V=p.optional.length-1;V>=0;V--){const Z=p.optional[V],{prefix:te,suffix:ae}=Z;if(te||ae){const P=Z.caseSensitive?T:O??(O=T.toLowerCase());if(te&&!P.startsWith(te)||ae&&!P.endsWith(ae))continue}f.push({node:Z,index:x+1,skipped:v,depth:U,statics:k,dynamics:b,optionals:_+Qu(u,x),extract:E,rawParams:j})}}if(!R&&p.dynamic&&T)for(let $=p.dynamic.length-1;$>=0;$--){const U=p.dynamic[$],{prefix:V,suffix:Z}=U;if(V||Z){const te=U.caseSensitive?T:O??(O=T.toLowerCase());if(V&&!te.startsWith(V)||Z&&!te.endsWith(Z))continue}f.push({node:U,index:x+1,skipped:v,depth:w+1,statics:k,dynamics:b+Qu(u,x),optionals:_,extract:E,rawParams:j})}if(!R&&p.staticInsensitive){const $=p.staticInsensitive.get(O??(O=T.toLowerCase()));$&&f.push({node:$,index:x+1,skipped:v,depth:w+1,statics:k+Qu(u,x),dynamics:b,optionals:_,extract:E,rawParams:j})}if(!R&&p.static){const $=p.static.get(T);$&&f.push({node:$,index:x+1,skipped:v,depth:w+1,statics:k+Qu(u,x),dynamics:b,optionals:_,extract:E,rawParams:j})}if(p.pathless){const $=w+1;for(let U=p.pathless.length-1;U>=0;U--){const V=p.pathless[U];f.push({node:V,index:x,skipped:v,depth:$,statics:k,dynamics:b,optionals:_,extract:E,rawParams:j})}}}if(h)return h;if(s&&d){let m=d.index;for(let x=0;x<d.index;x++)m+=t[x].length;const p=m===e.length?"/":e.slice(m);return d.rawParams??(d.rawParams=Object.create(null)),d.rawParams["**"]=decodeURIComponent(p),d}return null}function Qu(e,t){return 2**(e-t-1)}function QP(e,t){return e===2**(t-1)-1}function Tv(e,t,n){let s,i;try{[s,i]=_1(e,t,n)}catch{return null}if(n.rawParams=s,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(s)===!1)return null}catch{}return!0}function Ju(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===cs)>(e.node.kind===cs)||t.node.kind===cs==(e.node.kind===cs)&&t.depth>e.depth))):!0}function hc(e){return Gp(e.filter(t=>t!==void 0).join("/"))}function Gp(e){return e.replace(/\/{2,}/g,"/")}function E1(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Mr(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function P1(e){return Mr(E1(e))}function Ic(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function JP(e,t,n){return Ic(e,n)===Ic(t,n)}function YP({base:e,to:t,trailingSlash:n="never",cache:s}){const i=t.startsWith("/"),a=!i&&t===".";let u;if(s){u=i?t:a?e:e+"\0"+t;const h=s.get(u);if(h)return h}let f;if(a)f=e.split("/");else if(i)f=t.split("/");else{for(f=e.split("/");f.length>1&&Qa(f)==="";)f.pop();const h=t.split("/");for(let m=0,p=h.length;m<p;m++){const x=h[m];x===""?m?m===p-1&&f.push(x):f=[x]:x===".."?f.pop():x==="."||f.push(x)}}f.length>1&&(Qa(f)===""?n==="never"&&f.pop():n==="always"&&f.push(""));const d=Gp(f.join("/"))||"/";return u&&s&&s.set(u,d),d}function XP(e){const t=new Map(e.map(i=>[encodeURIComponent(i),i])),n=Array.from(t.keys()).map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),s=new RegExp(n,"g");return i=>i.replace(s,a=>t.get(a)??a)}function qh(e,t,n){const s=t[e];return typeof s!="string"?s:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(s)?s:s.split("/").map(i=>Fv(i,n)).join("/"):Fv(s,n)}function $v({path:e,params:t,decoder:n,...s}){let i=!1;const a=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:a,isMissingParams:i};if(!e.includes("$"))return{interpolatedPath:e,usedParams:a,isMissingParams:i};const u=e.length;let f=0,d,h="";for(;f<u;){const m=f;d=b1(e,m,d);const p=d[5];if(f=p+1,m===p)continue;const x=d[0];if(x===0){h+="/"+e.substring(m,p);continue}if(x===2){const v=t._splat;a._splat=v,a["*"]=v;const w=e.substring(m,d[1]),k=e.substring(d[4],p);if(!v){i=!0,(w||k)&&(h+="/"+w+k);continue}const b=qh("_splat",t,n);h+="/"+w+b+k;continue}if(x===1){const v=e.substring(d[2],d[3]);!i&&!(v in t)&&(i=!0),a[v]=t[v];const w=e.substring(m,d[1]),k=e.substring(d[4],p),b=qh(v,t,n)??"undefined";h+="/"+w+b+k;continue}if(x===3){const v=e.substring(d[2],d[3]),w=t[v];if(w==null)continue;a[v]=w;const k=e.substring(m,d[1]),b=e.substring(d[4],p),_=qh(v,t,n)??"";h+="/"+k+_+b;continue}}return e.endsWith("/")&&(h+="/"),{usedParams:a,interpolatedPath:h||"/",isMissingParams:i}}function Fv(e,t){const n=encodeURIComponent(e);return(t==null?void 0:t(n))??n}function Bt(e){return(e==null?void 0:e.isNotFound)===!0}function ZP(e,t=String){const n=new URLSearchParams;for(const s in e){const i=e[s];i!==void 0&&n.set(s,t(i))}return n.toString()}function Hh(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function eI(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[s,i]of t.entries()){const a=n[s];a==null?n[s]=Hh(i):Array.isArray(a)?a.push(Hh(i)):n[s]=[a,Hh(i)]}return n}const tI=rI(JSON.parse),nI=sI(JSON.stringify,JSON.parse);function rI(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=eI(t);for(const s in n){const i=n[s];if(typeof i=="string")try{n[s]=e(i)}catch{}}return n}}function sI(e,t){const n=typeof t=="function";function s(i){if(typeof i=="object"&&i!==null)try{return e(i)}catch{}else if(n&&typeof i=="string")try{return t(i),e(i)}catch{}return i}return i=>{const a=ZP(i,s);return a?`?${a}`:""}}const no="__root__";function oI(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function on(e){return e instanceof Response&&!!e.options}const Vg=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},iI=e=>e.stores.matchesId.get().some(t=>{var n;return(n=e.stores.matchStores.get(t))==null?void 0:n.get()._forcePending}),af=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),ro=(e,t,n=!0)=>{const s={...e.router.options.context??{}},i=n?t:t-1;for(let a=0;a<=i;a++){const u=e.matches[a];if(!u)continue;const f=e.router.getMatch(u.id);f&&Object.assign(s,f.__routeContext,f.__beforeLoadContext)}return s},Lv=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,s=e.matches.findIndex(u=>u.routeId===e.router.routeTree.id),i=s>=0?s:0;let a=n?e.matches.findIndex(u=>u.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let u=a;u>=0;u--){const f=e.matches[u];if(e.router.looseRoutesById[f.routeId].options.notFoundComponent)return u}return n?a:i},fs=(e,t,n)=>{var s,i,a;if(!(!on(n)&&!Bt(n)))throw on(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&((s=t._nonReactive.beforeLoadPromise)==null||s.resolve(),(i=t._nonReactive.loaderPromise)==null||i.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,u=>({...u,status:on(n)?"redirected":Bt(n)?"notFound":u.status==="pending"?"success":u.status,context:ro(e,t.index),isFetching:!1,error:n})),Bt(n)&&!n.routeId&&(n.routeId=t.routeId),(a=t._nonReactive.loadPromise)==null||a.resolve()),on(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},I1=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Ov=(e,t,n)=>{const s=ro(e,n);e.updateMatch(t,i=>({...i,context:s}))},ka=(e,t,n)=>{var u,f;const{id:s,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??(e.firstBadMatchIndex=t),fs(e,e.router.getMatch(s),n);try{(f=(u=a.options).onError)==null||f.call(u,n)}catch(d){n=d,fs(e,e.router.getMatch(s),n)}e.updateMatch(s,d=>{var h,m;return(h=d._nonReactive.beforeLoadPromise)==null||h.resolve(),d._nonReactive.beforeLoadPromise=void 0,(m=d._nonReactive.loadPromise)==null||m.resolve(),{...d,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!e.preload&&!on(n)&&!Bt(n)&&(e.serialError??(e.serialError=n))},j1=(e,t,n,s)=>{var a;if(s._nonReactive.pendingTimeout!==void 0)return;const i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!af(e,t)&&(n.options.loader||n.options.beforeLoad||M1(n))&&typeof i=="number"&&i!==1/0&&(n.options.pendingComponent??((a=e.router.options)==null?void 0:a.defaultPendingComponent))){const u=setTimeout(()=>{Vg(e)},i);s._nonReactive.pendingTimeout=u}},aI=(e,t,n)=>{const s=e.router.getMatch(t);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;j1(e,t,n,s);const i=()=>{const a=e.router.getMatch(t);a.preload&&(a.status==="redirected"||a.status==="notFound")&&fs(e,a,a.error)};return s._nonReactive.beforeLoadPromise?s._nonReactive.beforeLoadPromise.then(i):i()},lI=(e,t,n,s)=>{const i=e.router.getMatch(t);let a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=mi(()=>{a==null||a.resolve(),a=void 0});const{paramsError:u,searchError:f}=i;u&&ka(e,n,u),f&&ka(e,n,f),j1(e,t,s,i);const d=new AbortController;let h=!1;const m=()=>{h||(h=!0,e.updateMatch(t,R=>({...R,isFetching:"beforeLoad",fetchCount:R.fetchCount+1,abortController:d})))},p=()=>{var R;(R=i._nonReactive.beforeLoadPromise)==null||R.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,T=>({...T,isFetching:!1}))};if(!s.options.beforeLoad){e.router.batch(()=>{m(),p()});return}i._nonReactive.beforeLoadPromise=mi();const x={...ro(e,n,!1),...i.__routeContext},{search:v,params:w,cause:k}=i,b=af(e,t),_={search:v,abortController:d,params:w,preload:b,context:x,location:e.location,navigate:R=>e.router.navigate({...R,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:b?"preload":k,matches:e.matches,routeId:s.id,...e.router.options.additionalContext},E=R=>{if(R===void 0){e.router.batch(()=>{m(),p()});return}(on(R)||Bt(R))&&(m(),ka(e,n,R)),e.router.batch(()=>{m(),e.updateMatch(t,T=>({...T,__beforeLoadContext:R})),p()})};let j;try{if(j=s.options.beforeLoad(_),Ja(j))return m(),j.catch(R=>{ka(e,n,R)}).then(E)}catch(R){m(),ka(e,n,R)}E(j)},uI=(e,t)=>{const{id:n,routeId:s}=e.matches[t],i=e.router.looseRoutesById[s],a=()=>f(),u=()=>lI(e,n,t,i),f=()=>{if(I1(e,n))return;const d=aI(e,n,i);return Ja(d)?d.then(u):u()};return a()},cI=(e,t,n)=>{var a,u,f,d,h,m;const s=e.router.getMatch(t);if(!s||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const i={ssr:e.router.options.ssr,matches:e.matches,match:s,params:s.params,loaderData:s.loaderData};return Promise.all([(u=(a=n.options).head)==null?void 0:u.call(a,i),(d=(f=n.options).scripts)==null?void 0:d.call(f,i),(m=(h=n.options).headers)==null?void 0:m.call(h,i)]).then(([p,x,v])=>({meta:p==null?void 0:p.meta,links:p==null?void 0:p.links,headScripts:p==null?void 0:p.scripts,headers:v,scripts:x,styles:p==null?void 0:p.styles}))},N1=(e,t,n,s,i)=>{const a=t[s-1],{params:u,loaderDeps:f,abortController:d,cause:h}=e.router.getMatch(n),m=ro(e,s),p=af(e,n);return{params:u,deps:f,preload:!!p,parentMatchPromise:a,abortController:d,context:m,location:e.location,navigate:x=>e.router.navigate({...x,_fromLocation:e.location}),cause:p?"preload":h,route:i,...e.router.options.additionalContext}},Av=async(e,t,n,s,i)=>{var a,u,f,d,h;try{const m=e.router.getMatch(n);try{(!(S1??e.router.isServer)||m.ssr===!0)&&Xa(i);const p=i.options.loader,x=typeof p=="function"?p:p==null?void 0:p.handler,v=x==null?void 0:x(N1(e,t,n,s,i)),w=!!x&&Ja(v);if((w||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||m._nonReactive.minPendingPromise)&&e.updateMatch(n,b=>({...b,isFetching:"loader"})),x){const b=w?await v:v;fs(e,e.router.getMatch(n),b),b!==void 0&&e.updateMatch(n,_=>({..._,loaderData:b}))}i._lazyPromise&&await i._lazyPromise;const k=m._nonReactive.minPendingPromise;k&&await k,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,b=>({...b,error:void 0,context:ro(e,s),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(p){let x=p;if((x==null?void 0:x.name)==="AbortError"){if(m.abortController.signal.aborted){(a=m._nonReactive.loaderPromise)==null||a.resolve(),m._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,w=>({...w,status:w.status==="pending"?"success":w.status,isFetching:!1,context:ro(e,s)}));return}const v=m._nonReactive.minPendingPromise;v&&await v,Bt(p)&&await((f=(u=i.options.notFoundComponent)==null?void 0:u.preload)==null?void 0:f.call(u)),fs(e,e.router.getMatch(n),p);try{(h=(d=i.options).onError)==null||h.call(d,p)}catch(w){x=w,fs(e,e.router.getMatch(n),w)}!on(x)&&!Bt(x)&&await Xa(i,["errorComponent"]),e.updateMatch(n,w=>({...w,error:x,context:ro(e,s),status:"error",isFetching:!1}))}}catch(m){const p=e.router.getMatch(n);p&&(p._nonReactive.loaderPromise=void 0),fs(e,p,m)}},fI=async(e,t,n)=>{var v,w,k,b;async function s(_,E,j,R,T){const O=Date.now()-E.updatedAt,$=_?T.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:T.options.staleTime??e.router.options.defaultStaleTime??0,U=T.options.shouldReload,V=typeof U=="function"?U(N1(e,t,i,n,T)):U,{status:Z,invalid:te}=R,ae=O>=$&&(!!e.forceStaleReload||R.cause==="enter"||j!==void 0&&j!==R.id);u=Z==="success"&&(te||(V??ae)),_&&T.options.preload===!1||(u&&!e.sync&&m?(f=!0,(async()=>{var P,H;try{await Av(e,t,i,n,T);const X=e.router.getMatch(i);(P=X._nonReactive.loaderPromise)==null||P.resolve(),(H=X._nonReactive.loadPromise)==null||H.resolve(),X._nonReactive.loaderPromise=void 0,X._nonReactive.loadPromise=void 0}catch(X){on(X)&&await e.router.navigate(X.options)}})()):Z!=="success"||u?await Av(e,t,i,n,T):Ov(e,i,n))}const{id:i,routeId:a}=e.matches[n];let u=!1,f=!1;const d=e.router.looseRoutesById[a],h=d.options.loader,m=((typeof h=="function"||h==null?void 0:h.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(I1(e,i)){if(!e.router.getMatch(i))return e.matches[n];Ov(e,i,n)}else{const _=e.router.getMatch(i),E=e.router.stores.matchesId.get()[n],j=((v=E&&e.router.stores.matchStores.get(E)||null)==null?void 0:v.routeId)===a?E:(w=e.router.stores.matches.get().find(T=>T.routeId===a))==null?void 0:w.id,R=af(e,i);if(_._nonReactive.loaderPromise){if(_.status==="success"&&!e.sync&&!_.preload&&m)return _;await _._nonReactive.loaderPromise;const T=e.router.getMatch(i),O=T._nonReactive.error||T.error;O&&fs(e,T,O),T.status==="pending"&&await s(R,_,j,T,d)}else{const T=R&&!e.router.stores.matchStores.has(i),O=e.router.getMatch(i);O._nonReactive.loaderPromise=mi(),T!==O.preload&&e.updateMatch(i,$=>({...$,preload:T})),await s(R,_,j,O,d)}}const p=e.router.getMatch(i);f||((k=p._nonReactive.loaderPromise)==null||k.resolve(),(b=p._nonReactive.loadPromise)==null||b.resolve(),p._nonReactive.loadPromise=void 0),clearTimeout(p._nonReactive.pendingTimeout),p._nonReactive.pendingTimeout=void 0,f||(p._nonReactive.loaderPromise=void 0),p._nonReactive.dehydrated=void 0;const x=f?p.isFetching:!1;return x!==p.isFetching||p.invalid!==!1?(e.updateMatch(i,_=>({..._,isFetching:x,invalid:!1})),e.router.getMatch(i)):p};async function Dv(e){var x,v;const t=e,n=[];iI(t.router)&&Vg(t);let s;for(let w=0;w<t.matches.length;w++){try{const k=uI(t,w);Ja(k)&&await k}catch(k){if(on(k))throw k;if(Bt(k))s=k;else if(!t.preload)throw k;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const i=t.firstBadMatchIndex??t.matches.length,a=s&&!t.preload?Lv(t,s):void 0,u=s&&t.preload?0:a!==void 0?Math.min(a+1,i):i;let f,d;for(let w=0;w<u;w++)n.push(fI(t,n,w));try{await Promise.all(n)}catch{const w=await Promise.allSettled(n);for(const k of w){if(k.status!=="rejected")continue;const b=k.reason;if(on(b))throw b;Bt(b)?f??(f=b):d??(d=b)}if(d!==void 0)throw d}const h=f??(s&&!t.preload?s:void 0);let m=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!h&&s&&t.preload)return t.matches;if(h){const w=Lv(t,h);w===void 0&&Tr();const k=t.matches[w],b=t.router.looseRoutesById[k.routeId],_=(x=t.router.options)==null?void 0:x.defaultNotFoundComponent;!b.options.notFoundComponent&&_&&(b.options.notFoundComponent=_),h.routeId=k.routeId;const E=k.routeId===t.router.routeTree.id;t.updateMatch(k.id,j=>({...j,...E?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:h},isFetching:!1})),m=w,await Xa(b,["notFoundComponent"])}else if(!t.preload){const w=t.matches[0];w.globalNotFound||(v=t.router.getMatch(w.id))!=null&&v.globalNotFound&&t.updateMatch(w.id,k=>({...k,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const w=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await Xa(w,["errorComponent"])}for(let w=0;w<=m;w++){const{id:k,routeId:b}=t.matches[w],_=t.router.looseRoutesById[b];try{const E=cI(t,k,_);if(E){const j=await E;t.updateMatch(k,R=>({...R,...j}))}}catch(E){console.error(`Error executing head for route ${b}:`,E)}}const p=Vg(t);if(Ja(p)&&await p,h)throw h;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function zv(e,t){const n=t.map(s=>{var i,a;return(a=(i=e.options[s])==null?void 0:i.preload)==null?void 0:a.call(i)}).filter(Boolean);if(n.length!==0)return Promise.all(n)}function Xa(e,t=gc){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(s=>{const{id:i,...a}=s.options;Object.assign(e.options,a),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===gc?(()=>{if(e._componentsPromise===void 0){const s=zv(e,gc);s?e._componentsPromise=s.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():zv(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function M1(e){var t;for(const n of gc)if((t=e.options[n])!=null&&t.preload)return!0;return!1}const gc=["component","errorComponent","pendingComponent","notFoundComponent"];function dI(e){return{input:({url:t})=>{for(const n of e)t=Bg(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=T1(e[n],t);return t}}}function hI(e){const t=P1(e.basepath),n=`/${t}`,s=e.caseSensitive?n:n.toLowerCase(),i=`${s}/`;return{input:({url:a})=>{const u=e.caseSensitive?a.pathname:a.pathname.toLowerCase();return u===s?a.pathname="/":u.startsWith(i)&&(a.pathname=a.pathname.slice(n.length)),a},output:({url:a})=>(a.pathname=hc(["/",t,a.pathname]),a)}}function Bg(e,t){var s;const n=(s=e==null?void 0:e.input)==null?void 0:s.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function T1(e,t){var s;const n=(s=e==null?void 0:e.output)==null?void 0:s.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function gI(e,t){const{createMutableStore:n,createReadonlyStore:s,batch:i,init:a}=t,u=new Map,f=new Map,d=new Map,h=n(e.status),m=n(e.loadedAt),p=n(e.isLoading),x=n(e.isTransitioning),v=n(e.location),w=n(e.resolvedLocation),k=n(e.statusCode),b=n(e.redirect),_=n([]),E=n([]),j=n([]),R=s(()=>Wh(u,_.get())),T=s(()=>Wh(f,E.get())),O=s(()=>Wh(d,j.get())),$=s(()=>_.get()[0]),U=s(()=>_.get().some(q=>{var Y;return((Y=u.get(q))==null?void 0:Y.get().status)==="pending"})),V=s(()=>{var q;return{locationHref:v.get().href,resolvedLocationHref:(q=w.get())==null?void 0:q.href,status:h.get()}}),Z=s(()=>({status:h.get(),loadedAt:m.get(),isLoading:p.get(),isTransitioning:x.get(),matches:R.get(),location:v.get(),resolvedLocation:w.get(),statusCode:k.get(),redirect:b.get()})),te=Ya(64);function ae(q){let Y=te.get(q);return Y||(Y=s(()=>{const se=_.get();for(const ee of se){const M=u.get(ee);if(M&&M.routeId===q)return M.get()}}),te.set(q,Y)),Y}const P={status:h,loadedAt:m,isLoading:p,isTransitioning:x,location:v,resolvedLocation:w,statusCode:k,redirect:b,matchesId:_,pendingIds:E,cachedIds:j,matches:R,pendingMatches:T,cachedMatches:O,firstId:$,hasPending:U,matchRouteDeps:V,matchStores:u,pendingMatchStores:f,cachedMatchStores:d,__store:Z,getRouteMatchStore:ae,setMatches:H,setPending:X,setCached:K};H(e.matches),a==null||a(P);function H(q){Gh(q,u,_,n,i)}function X(q){Gh(q,f,E,n,i)}function K(q){Gh(q,d,j,n,i)}return P}function Wh(e,t){const n=[];for(const s of t){const i=e.get(s);i&&n.push(i.get())}return n}function Gh(e,t,n,s,i){const a=e.map(f=>f.id),u=new Set(a);i(()=>{for(const f of t.keys())u.has(f)||t.delete(f);for(const f of e){const d=t.get(f.id);if(!d){const h=s(f);h.routeId=f.routeId,t.set(f.id,h);continue}d.routeId=f.routeId,d.get()!==f&&d.set(f)}DP(n.get(),a)||n.set(a)})}var ps="__TSR_index",Uv="popstate",Vv="beforeunload";function pI(e){let t=e.getLocation();const n=new Set,s=u=>{t=e.getLocation(),n.forEach(f=>f({location:t,action:u}))},i=u=>{e.notifyOnIndexChange??!0?s(u):t=e.getLocation()},a=async({task:u,navigateOpts:f,...d})=>{var p,x;if((f==null?void 0:f.ignoreBlocker)??!1){u();return}const h=((p=e.getBlockers)==null?void 0:p.call(e))??[],m=d.type==="PUSH"||d.type==="REPLACE";if(typeof document<"u"&&h.length&&m)for(const v of h){const w=Za(d.path,d.state);if(await v.blockerFn({currentLocation:t,nextLocation:w,action:d.type})){(x=e.onBlocked)==null||x.call(e);return}}u()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:u=>(n.add(u),()=>{n.delete(u)}),push:(u,f,d)=>{const h=t.state[ps];f=Bv(h+1,f),a({task:()=>{e.pushState(u,f),s({type:"PUSH"})},navigateOpts:d,type:"PUSH",path:u,state:f})},replace:(u,f,d)=>{const h=t.state[ps];f=Bv(h,f),a({task:()=>{e.replaceState(u,f),s({type:"REPLACE"})},navigateOpts:d,type:"REPLACE",path:u,state:f})},go:(u,f)=>{a({task:()=>{e.go(u),i({type:"GO",index:u})},navigateOpts:f,type:"GO"})},back:u=>{a({task:()=>{e.back((u==null?void 0:u.ignoreBlocker)??!1),i({type:"BACK"})},navigateOpts:u,type:"BACK"})},forward:u=>{a({task:()=>{e.forward((u==null?void 0:u.ignoreBlocker)??!1),i({type:"FORWARD"})},navigateOpts:u,type:"FORWARD"})},canGoBack:()=>t.state[ps]!==0,createHref:u=>e.createHref(u),block:u=>{var d;if(!e.setBlockers)return()=>{};const f=((d=e.getBlockers)==null?void 0:d.call(e))??[];return e.setBlockers([...f,u]),()=>{var m,p;const h=((m=e.getBlockers)==null?void 0:m.call(e))??[];(p=e.setBlockers)==null||p.call(e,h.filter(x=>x!==u))}},flush:()=>{var u;return(u=e.flush)==null?void 0:u.call(e)},destroy:()=>{var u;return(u=e.destroy)==null?void 0:u.call(e)},notify:s}}function Bv(e,t){t||(t={});const n=Kp();return{...t,key:n,__TSR_key:n,[ps]:e}}function $1(e){var U,V;const t=(e==null?void 0:e.window)??(typeof document<"u"?window:void 0),n=t.history.pushState,s=t.history.replaceState;let i=[];const a=()=>i,u=Z=>i=Z,f=(e==null?void 0:e.createHref)??(Z=>Z),d=(e==null?void 0:e.parseLocation)??(()=>Za(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((U=t.history.state)!=null&&U.__TSR_key)&&!((V=t.history.state)!=null&&V.key)){const Z=Kp();t.history.replaceState({[ps]:0,key:Z,__TSR_key:Z},"")}let h=d(),m,p=!1,x=!1,v=!1,w=!1;const k=()=>h;let b,_;const E=()=>{b&&($._ignoreSubscribers=!0,(b.isPush?t.history.pushState:t.history.replaceState)(b.state,"",b.href),$._ignoreSubscribers=!1,b=void 0,_=void 0,m=void 0)},j=(Z,te,ae)=>{const P=f(te);_||(m=h),h=Za(te,ae),b={href:P,state:ae,isPush:(b==null?void 0:b.isPush)||Z==="push"},_||(_=Promise.resolve().then(()=>E()))},R=Z=>{h=d(),$.notify({type:Z})},T=async()=>{if(x){x=!1;return}const Z=d(),te=Z.state[ps]-h.state[ps],ae=te===1,P=te===-1,H=!ae&&!P||p;p=!1;const X=H?"GO":P?"BACK":"FORWARD",K=H?{type:"GO",index:te}:{type:P?"BACK":"FORWARD"};if(v)v=!1;else{const q=a();if(typeof document<"u"&&q.length){for(const Y of q)if(await Y.blockerFn({currentLocation:h,nextLocation:Z,action:X})){x=!0,t.history.go(1),$.notify(K);return}}}h=d(),$.notify(K)},O=Z=>{if(w){w=!1;return}let te=!1;const ae=a();if(typeof document<"u"&&ae.length)for(const P of ae){const H=P.enableBeforeUnload??!0;if(H===!0){te=!0;break}if(typeof H=="function"&&H()===!0){te=!0;break}}if(te)return Z.preventDefault(),Z.returnValue=""},$=pI({getLocation:k,getLength:()=>t.history.length,pushState:(Z,te)=>j("push",Z,te),replaceState:(Z,te)=>j("replace",Z,te),back:Z=>(Z&&(v=!0),w=!0,t.history.back()),forward:Z=>{Z&&(v=!0),w=!0,t.history.forward()},go:Z=>{p=!0,t.history.go(Z)},createHref:Z=>f(Z),flush:E,destroy:()=>{t.history.pushState=n,t.history.replaceState=s,t.removeEventListener(Vv,O,{capture:!0}),t.removeEventListener(Uv,T)},onBlocked:()=>{m&&h!==m&&(h=m)},getBlockers:a,setBlockers:u,notifyOnIndexChange:!1});return t.addEventListener(Vv,O,{capture:!0}),t.addEventListener(Uv,T),t.history.pushState=function(...Z){const te=n.apply(t.history,Z);return $._ignoreSubscribers||R("PUSH"),te},t.history.replaceState=function(...Z){const te=s.apply(t.history,Z);return $._ignoreSubscribers||R("REPLACE"),te},$}function mI(e){const t=typeof document<"u"?window:void 0;return $1({window:t,parseLocation:()=>{const n=t.location.hash.split("#").slice(1),s=n[0]??"/",i=t.location.search,a=n.slice(1);return Za(`${s}${i}${a.length===0?"":`#${a.join("#")}`}`,t.history.state)},createHref:n=>`${t.location.pathname}${t.location.search}#${n}`})}function yI(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Za(e,t){const n=yI(e),s=n.indexOf("#"),i=n.indexOf("?"),a=Kp();return{href:n,pathname:n.substring(0,s>0?i>0?Math.min(s,i):s:i>0?i:n.length),hash:s>-1?n.substring(s):"",search:i>-1?n.slice(i,s===-1?void 0:s):"",state:t||{[ps]:0,key:a,__TSR_key:a}}}function Kp(){return(Math.random()+1).toString(36).substring(7)}function fi(e,t){const n=t,s=e;return{fromLocation:n,toLocation:s,pathChanged:(n==null?void 0:n.pathname)!==s.pathname,hrefChanged:(n==null?void 0:n.href)!==s.href,hashChanged:(n==null?void 0:n.hash)!==s.hash}}const qg=new WeakMap;var xI=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.startTransition=n=>n(),this.update=n=>{var m;const s=this.options,i=this.basepath??(s==null?void 0:s.basepath)??"/",a=this.basepath===void 0,u=s==null?void 0:s.rewrite;if(this.options={...s,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=XP(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=$1()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let p;this.resolvePathCache=Ya(1e3),p=this.buildRouteTree(),this.setRoutes(p)}if(!this.stores&&this.latestLocation){const p=this.getStoreConfig(this);this.batch=p.batch,this.stores=gI(SI(this.latestLocation),p),NI(this)}let f=!1;const d=this.options.basepath??"/",h=this.options.rewrite;if(a||i!==d||u!==h){this.basepath=d;const p=[],x=P1(d);x&&x!=="/"&&p.push(hI({basepath:d})),h&&p.push(h),this.rewrite=p.length===0?void 0:p.length===1?p[0]:dI(p),this.history&&this.updateLatestLocation(),f=!0}f&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof((m=window.CSS)==null?void 0:m.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a))"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=WP(this.routeTree,this.options.caseSensitive,(s,i)=>{s.init({originalIndex:i})});return this.options.routeMasks&&UP(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,s)=>{const i={eventType:n,fn:s};return this.subscribers.add(i),()=>{this.subscribers.delete(i)}},this.emit=n=>{this.subscribers.forEach(s=>{s.eventType===n.type&&s.fn(n)})},this.parseLocation=(n,s)=>{const i=({pathname:d,search:h,hash:m,href:p,state:x})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(d)){const _=this.options.parseSearch(h),E=this.options.stringifySearch(_);return{href:d+E+m,publicHref:d+E+m,pathname:wa(d).path,external:!1,searchStr:E,search:Gs(s==null?void 0:s.search,_),hash:wa(m.slice(1)).path,state:Zs(s==null?void 0:s.state,x)}}const v=new URL(p,this.origin),w=Bg(this.rewrite,v),k=this.options.parseSearch(w.search),b=this.options.stringifySearch(k);return w.search=b,{href:w.href.replace(w.origin,""),publicHref:p,pathname:wa(w.pathname).path,external:!!this.rewrite&&w.origin!==this.origin,searchStr:b,search:Gs(s==null?void 0:s.search,k),hash:wa(w.hash.slice(1)).path,state:Zs(s==null?void 0:s.state,x)}},a=i(n),{__tempLocation:u,__tempKey:f}=a.state;if(u&&(!f||f===this.tempLocationKey)){const d=i(u);return d.state.key=a.state.key,d.state.__TSR_key=a.state.__TSR_key,delete d.state.__tempLocation,{...d,maskedLocation:a}}return a},this.resolvePathWithBase=(n,s)=>YP({base:n,to:s.includes("//")?Gp(s):s,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,s,i)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:s},i):this.matchRoutesInternal(n,s),this.getMatchedRoutes=n=>wI({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const s=this.getMatch(n);s&&(s.abortController.abort(),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(n=>{this.cancelMatch(n)}),this.stores.matchesId.get().forEach(n=>{var i;if(this.stores.pendingMatchStores.has(n))return;const s=(i=this.stores.matchStores.get(n))==null?void 0:i.get();s&&(s.status==="pending"||s.isFetching==="loader")&&this.cancelMatch(n)})},this.buildLocation=n=>{const s=(a={})=>{var te,ae;const u=a._fromLocation||this.pendingBuiltLocation||this.latestLocation,f=this.matchRoutesLightweight(u);a.from;const d=a.unsafeRelative==="path"?u.pathname:a.from??f.fullPath,h=a.to?`${a.to}`:void 0,m=f.search,p=Object.assign(Object.create(null),f.params),x=(h==null?void 0:h.charCodeAt(0))===47?"/":this.resolvePathWithBase(d,"."),v=h?this.resolvePathWithBase(x,h):x,w=a.params===!1||a.params===null?Object.create(null):(a.params??!0)===!0?p:Object.assign(p,Xs(a.params,p)),k=this.routesByPath[Mr(v)];let b;if(k)b=this.getRouteBranch(k);else if(v.includes("$"))b=[];else{const P=this.getMatchedRoutes(v);b=P.matchedRoutes,this.options.notFoundRoute&&(!P.foundRoute||P.foundRoute.path!=="/"&&P.routeParams["**"])&&(b=[...b,this.options.notFoundRoute])}if(b.length&&k1(w))for(const P of b){const H=((te=P.options.params)==null?void 0:te.stringify)??P.options.stringifyParams;if(H)try{Object.assign(w,H(w))}catch{}}const _=n.leaveParams?v:wa($v({path:v,params:w,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let E=m;if(n._includeValidateSearch&&((ae=this.options.search)!=null&&ae.strict)){const P={};b.forEach(H=>{if(H.options.validateSearch)try{Object.assign(P,pc(H.options.validateSearch,{...P,...E}))}catch{}}),E=P}E=kI({search:E,dest:a,destRoutes:b,_includeValidateSearch:n._includeValidateSearch}),E=Gs(m,E);const j=this.options.stringifySearch(E),R=a.hash===!0?u.hash:a.hash?Xs(a.hash,u.hash):void 0,T=R?`#${R}`:"";let O=a.state===!0?u.state:a.state?Xs(a.state,u.state):{};O=Zs(u.state,O);const $=`${_}${j}${T}`;let U,V,Z=!1;if(this.rewrite){const P=new URL($,this.origin),H=T1(this.rewrite,P);U=P.href.replace(P.origin,""),H.origin!==this.origin?(V=H.href,Z=!0):V=H.pathname+H.search+H.hash}else U=AP($),V=U;return{publicHref:V,href:U,pathname:_,search:E,searchStr:j,state:O,hash:R??"",external:Z,unmaskOnReload:a.unmaskOnReload}},i=(a={},u)=>{const f=s(a);let d=u?s(u):void 0;if(!d){const h=Object.create(null);if(this.options.routeMasks){const m=VP(f.pathname,this.processedTree);if(m){Object.assign(h,m.rawParams);const{from:p,params:x,...v}=m.route,w=x===!1||x===null?Object.create(null):(x??!0)===!0?h:Object.assign(h,Xs(x,h));u={from:n.from,...v,params:w},d=s(u)}}}return d&&(f.maskedLocation=d),f};return n.mask?i(n,{from:n.from,...n.mask}):i(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:s,...i})=>{let a;const u=()=>{const h=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];h.forEach(p=>{i.state[p]=this.latestLocation.state[p]});const m=to(i.state,this.latestLocation.state);return h.forEach(p=>{delete i.state[p]}),m},f=Mr(this.latestLocation.href)===Mr(i.href);let d=this.commitLocationPromise;if(this.commitLocationPromise=mi(()=>{d==null||d.resolve(),d=void 0}),f&&u())this.load();else{let{maskedLocation:h,hashScrollIntoView:m,...p}=i;h&&(p={...h,state:{...h.state,__tempKey:void 0,__tempLocation:{...p,search:p.searchStr,state:{...p.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(p.unmaskOnReload??this.options.unmaskOnReload??!1)&&(p.state.__tempKey=this.tempLocationKey)),p.state.__hashScrollIntoViewOptions=m??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,a=i.replace?"REPLACE":"PUSH",this.history[a==="REPLACE"?"replace":"push"](p.publicHref,p.state,{ignoreBlocker:s})}return this._scroll.next=i.resetScroll??!0,this.history.subscribers.size||this.load(a?{action:{type:a}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:s,hashScrollIntoView:i,viewTransition:a,ignoreBlocker:u,href:f,...d}={})=>{if(f){const p=this.history.location.state.__TSR_index,x=Za(f,{__TSR_index:n?p:p+1}),v=new URL(x.pathname,this.origin);d.to=Bg(this.rewrite,v).pathname,d.search=this.options.parseSearch(x.search),d.hash=x.hash.slice(1)}const h=this.buildLocation({...d,_includeValidateSearch:!0});this.pendingBuiltLocation=h;const m=this.commitLocation({...h,viewTransition:a,replace:n,resetScroll:s,hashScrollIntoView:i,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===h&&(this.pendingBuiltLocation=void 0)}),m},this.navigate=async({to:n,reloadDocument:s,href:i,publicHref:a,...u})=>{var d,h;let f=!1;if(i)try{new URL(`${i}`),f=!0}catch{}if(f&&!s&&(s=!0),s){if(n!==void 0||!i){const p=this.buildLocation({to:n,...u});i=i??p.publicHref,a=a??p.publicHref}const m=!f&&a?a:i;if(Pc(m,this.protocolAllowlist))return Promise.resolve();if(!u.ignoreBlocker){const p=((h=(d=this.history).getBlockers)==null?void 0:h.call(d))??[];for(const x of p)if(x!=null&&x.blockerFn&&await x.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return u.replace?window.location.replace(m):window.location.href=m,Promise.resolve()}return this.buildAndCommitLocation({...u,href:i,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation),s=this.stores.cachedMatches.get().filter(i=>!n.some(a=>a.id===i.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(n),this.stores.setCached(s)})},this.load=async n=>{var h;const s=(h=n==null?void 0:n.action)==null?void 0:h.type;let i,a,u;const f=this.stores.resolvedLocation.get()??this.stores.location.get();for(u=new Promise(m=>{this.startTransition(async()=>{var p;try{this.beforeLoad(),s?qg.set(this.latestLocation,s):qg.delete(this.latestLocation);const x=this.latestLocation,v=fi(x,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...v}),this.emit({type:"onBeforeLoad",...v}),await Dv({router:this,sync:n==null?void 0:n.sync,forceStaleReload:f.href===x.href,matches:this.stores.pendingMatches.get(),location:x,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{var E,j;let w=null,k=null,b=null,_=null;this.batch(()=>{const R=this.stores.pendingMatches.get(),T=R.length,O=this.stores.matches.get();w=T?O.filter(V=>!this.stores.pendingMatchStores.has(V.id)):null;const $=new Set;for(const V of this.stores.pendingMatchStores.values())V.routeId&&$.add(V.routeId);const U=new Set;for(const V of this.stores.matchStores.values())V.routeId&&U.add(V.routeId);k=T?O.filter(V=>!$.has(V.routeId)):null,b=T?R.filter(V=>!U.has(V.routeId)):null,_=T?R.filter(V=>U.has(V.routeId)):O,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),T&&(this.stores.setMatches(R),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...w.filter(V=>V.status!=="error"&&V.status!=="notFound"&&V.status!=="redirected")]),this.clearExpiredCache())});for(const[R,T]of[[k,"onLeave"],[b,"onEnter"],[_,"onStay"]])if(R)for(const O of R)(j=(E=this.looseRoutesById[O.routeId].options)[T])==null||j.call(E,O)})})}})}catch(x){on(x)?(i=x,this.navigate({...i.options,replace:!0,ignoreBlocker:!0})):Bt(x)&&(a=x);const v=i?i.status:a?404:this.stores.matches.get().some(w=>w.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(v),this.stores.redirect.set(i)})}this.latestLoadPromise===u&&((p=this.commitLocationPromise)==null||p.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),m()})}),this.latestLoadPromise=u,await u;this.latestLoadPromise&&u!==this.latestLoadPromise;)await this.latestLoadPromise;let d;this.hasNotFoundMatch()?d=404:this.stores.matches.get().some(m=>m.status==="error")&&(d=500),d!==void 0&&this.stores.statusCode.set(d)},this.startViewTransition=n=>{const s=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,s&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let i;if(typeof s=="object"&&this.isViewTransitionTypesSupported){const a=this.latestLocation,u=this.stores.resolvedLocation.get(),f=typeof s.types=="function"?s.types(fi(a,u)):s.types;if(f===!1){n();return}i={update:n,types:f}}else i=n;document.startViewTransition(i)}else n()},this.updateMatch=(n,s)=>{this.startTransition(()=>{const i=this.stores.pendingMatchStores.get(n);if(i){i.set(s);return}const a=this.stores.matchStores.get(n);if(a){a.set(s);return}const u=this.stores.cachedMatchStores.get(n);if(u){const f=s(u.get());f.status==="redirected"?this.stores.cachedMatchStores.delete(n)&&this.stores.cachedIds.set(d=>d.filter(h=>h!==n)):u.set(f)}})},this.getMatch=n=>{var s,i,a;return((s=this.stores.cachedMatchStores.get(n))==null?void 0:s.get())??((i=this.stores.pendingMatchStores.get(n))==null?void 0:i.get())??((a=this.stores.matchStores.get(n))==null?void 0:a.get())},this.invalidate=n=>{const s=i=>{var a;return((a=n==null?void 0:n.filter)==null?void 0:a.call(n,i))??!0?{...i,invalid:!0,...n!=null&&n.forcePending||i.status==="error"||i.status==="notFound"?{status:"pending",error:void 0}:void 0}:i};return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(s)),this.stores.setCached(this.stores.cachedMatches.get().map(s)),this.stores.setPending(this.stores.pendingMatches.get().map(s))}),this.shouldViewTransition=!1,this.load({sync:n==null?void 0:n.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const s=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const i=n.options._builtLocation??this.buildLocation(n.options),a=this.getParsedLocationHref(i);n.options.href=a,n.headers.set("Location",a)}else if(s)try{const i=new URL(s);if(this.origin&&i.origin===this.origin){const a=i.pathname+i.search+i.hash;n.options.href=a,n.headers.set("Location",a)}}catch{}if(n.options.href&&!n.options._builtLocation&&Pc(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const s=n==null?void 0:n.filter;s!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(i=>!s(i))):this.stores.setCached([])},this.clearExpiredCache=()=>{const n=Date.now(),s=i=>{const a=this.looseRoutesById[i.routeId];if(!a.options.loader)return!0;const u=(i.preload?a.options.preloadGcTime??this.options.defaultPreloadGcTime:a.options.gcTime??this.options.defaultGcTime)??300*1e3;return i.status==="error"?!0:n-i.updatedAt>=u};this.clearCache({filter:s})},this.loadRouteChunk=Xa,this.preloadRoute=async n=>{const s=n._builtLocation??this.buildLocation(n);let i=this.matchRoutes(s,{throwOnError:!0,preload:!0,dest:n});const a=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),u=new Set([...a,...this.stores.cachedIds.get()]),f=i.filter(d=>!u.has(d.id));if(f.length){const d=this.stores.cachedMatches.get();this.stores.setCached([...d,...f])}try{return i=await Dv({router:this,matches:i,location:s,preload:!0,updateMatch:(d,h)=>{a.has(d)?i=i.map(m=>m.id===d?h(m):m):this.updateMatch(d,h)}}),i}catch(d){if(on(d))return d.options.reloadDocument?void 0:await this.preloadRoute({...d.options,_fromLocation:s});Bt(d)||console.error(d);return}},this.matchRoute=(n,s)=>{const i={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},a=this.buildLocation(i);if(s!=null&&s.pending&&this.stores.status.get()!=="pending")return!1;const u=((s==null?void 0:s.pending)===void 0?!this.stores.isLoading.get():s.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),f=BP(a.pathname,(s==null?void 0:s.caseSensitive)??!1,(s==null?void 0:s.fuzzy)??!1,u.pathname,this.processedTree);return!f||n.params&&!to(f.rawParams,n.params,{partial:!0})?!1:(s==null?void 0:s.includeSearch)??!0?to(u.search,a.search,{partial:!0})?f.rawParams:!1:f.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(n=>n.status==="notFound"||n.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??nI,parseSearch:e.parseSearch??tI,protocolAllowlist:e.protocolAllowlist??OP}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=R1(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e!=null&&e.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){var m,p;const n=this.getMatchedRoutes(e.pathname),{foundRoute:s,routeParams:i}=n;let{matchedRoutes:a}=n,u=!1;(s?s.path!=="/"&&i["**"]:Mr(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:u=!0);const f=u?bI(this.options.notFoundMode,a):void 0,d=new Array(a.length),h=new Map;for(const x of this.stores.matchStores.values())x.routeId&&h.set(x.routeId,x.get());for(let x=0;x<a.length;x++){const v=a[x],w=d[x-1];let k,b,_;{const H=(w==null?void 0:w.search)??e.search,X=(w==null?void 0:w._strictSearch)??void 0;try{const K=pc(v.options.validateSearch,{...H})??void 0;k={...H,...K},b={...X,...K},_=void 0}catch(K){let q=K;if(K instanceof jc||(q=new jc(K.message,{cause:K})),t!=null&&t.throwOnError)throw q;k=H,b={},_=q}}const E=((p=(m=v.options).loaderDeps)==null?void 0:p.call(m,{search:k}))??"",j=E?JSON.stringify(E):"",{interpolatedPath:R,usedParams:T}=$v({path:v.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),O=v.id+R+j,$=this.getMatch(O),U=h.get(v.id),V=($==null?void 0:$._strictParams)??T;let Z;if(!$)try{qv(v,V)}catch(H){if(Bt(H)||on(H)?Z=H:Z=new vI(H.message,{cause:H}),t!=null&&t.throwOnError)throw Z}Object.assign(i,V);const te=U?"stay":"enter";let ae;if($)ae={...$,cause:te,params:(U==null?void 0:U.params)??i,_strictParams:V,search:Gs(U?U.search:$.search,k),_strictSearch:b};else{const H=v.options.loader||v.options.beforeLoad||v.lazyFn||M1(v)?"pending":"success";ae={id:O,ssr:v.options.ssr,index:x,routeId:v.id,params:(U==null?void 0:U.params)??i,_strictParams:V,pathname:R,updatedAt:Date.now(),search:U?Gs(U.search,k):k,_strictSearch:b,searchError:void 0,status:H,isFetching:!1,error:void 0,paramsError:Z,__routeContext:void 0,_nonReactive:{loadPromise:mi()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:te,loaderDeps:U?Zs(U.loaderDeps,E):E,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:v.options.staticData||{},fullPath:v.fullPath}}t!=null&&t.preload||(ae.globalNotFound=f===v.id),ae.searchError=_;const P=this.getParentContext(w);ae.context={...P,...ae.__routeContext,...ae.__beforeLoadContext},d[x]=ae}for(let x=0;x<d.length;x++){const v=d[x],w=this.looseRoutesById[v.routeId],k=this.getMatch(v.id),b=h.get(v.routeId);if(v.params=b?Gs(b.params,i):i,!k){const _=d[x-1],E=this.getParentContext(_);if(w.options.context){const j={deps:v.loaderDeps,params:v.params,context:E??{},location:e,navigate:R=>this.navigate({...R,_fromLocation:e}),buildLocation:this.buildLocation,cause:v.cause,abortController:v.abortController,preload:!!v.preload,matches:d,routeId:w.id};v.__routeContext=w.options.context(j)??void 0}v.context={...E,...v.__routeContext,...v.__beforeLoadContext}}}return d}matchRoutesLightweight(e){var h;const{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),s=Qa(t),i={...e.search};for(const m of t)try{Object.assign(i,pc(m.options.validateSearch,i))}catch{}const a=Qa(this.stores.matchesId.get()),u=a&&((h=this.stores.matchStores.get(a))==null?void 0:h.get()),f=u&&u.routeId===s.id&&u.pathname===e.pathname;let d;if(f)d=u.params;else{const m=Object.assign(Object.create(null),n);for(const p of t)try{qv(p,m)}catch{}d=m}return{matchedRoutes:t,fullPath:s.fullPath,search:i,params:d}}},jc=class extends Error{},vI=class extends Error{};function SI(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function pc(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new jc("Async validation not supported");if(n.issues)throw new jc(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function wI({pathname:e,routesById:t,processedTree:n}){const s=Object.create(null),i=Mr(e);let a;const u=qP(i,n,!0);return u&&(a=u.route,Object.assign(s,u.rawParams)),{matchedRoutes:(u==null?void 0:u.branch)||[t.__root__],routeParams:s,foundRoute:a}}function kI({search:e,dest:t,destRoutes:n,_includeValidateSearch:s}){return CI(n)(e,t,s??!1)}function CI(e){var a;let t,n;const s=[];for(const u of e){const f=u.options;if("search"in f)(a=f.search)!=null&&a.middlewares&&s.push(...f.search.middlewares);else if(f.preSearchFilters||f.postSearchFilters){const h=({search:m,next:p})=>{const x=p(f.preSearchFilters?f.preSearchFilters.reduce((v,w)=>w(v),m):m);return f.postSearchFilters?f.postSearchFilters.reduce((v,w)=>w(v),x):x};s.push(h)}const d=f.validateSearch;if(d){const h=({search:m,next:p,meta:x})=>{const v=p(m);if(n)try{const w=pc(d,v);if(x&&w)for(const k in w)k in v||(x.defaulted||(x.defaulted=new Map)).set(k,w[k]);return{...v,...w}}catch{}return v};s.push(h)}}const i=(u,f,d)=>{if(u>=s.length){if(!t.search)return{};if(t.search===!0)return f;const m=Xs(t.search,f);return d&&(d.explicit=m),m}const h=(m,p)=>{if(p){const x=d||{};return{search:i(u+1,m,x),meta:x}}return i(u+1,m,d)};return s[u]({search:f,next:h,meta:d})};return function(f,d,h){return t=d,n=h,i(0,f)}}function bI(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const s=t[n];if(s.children)return s.id}return no}function qv(e,t){var s;const n=((s=e.options.params)==null?void 0:s.parse)??e.options.parseParams;if(n){const i=n(t);if(i===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,i)}}function _I(){try{return sessionStorage}catch{return}}const RI="tsr-scroll-restoration-v1_3",di=_I();function EI(){try{return JSON.parse((di==null?void 0:di.getItem("tsr-scroll-restoration-v1_3"))||"{}")}catch{return{}}}function PI(){try{di==null||di.setItem(RI,JSON.stringify(is))}catch{}}const is=EI(),Hv="data-scroll-restoration-id",II=e=>e.state.__TSR_key||e.href;function jI(e){const t=e.getAttribute(Hv);if(t)return`[${Hv}="${t}"]`;let n="",s=e,i;for(;i=s.parentNode;){let a=1,u=s;for(;u=u.previousElementSibling;)a++;const f=`${s.localName}:nth-child(${a})`;n=n?`${f} > ${n}`:f,s=i}return n}let Yu=!1;const ai="window";function Hg(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function Wv(e){const t=[];for(const n of e){if(n===ai)continue;const s=Hg(n);s&&t.push(s)}return t}function NI(e,t){const n=e.options.scrollRestoration,s=e._scroll;n&&(s.restoring=!0);const i=e.options.getScrollRestorationKey||II,a=new Map,u=(h,m,p)=>{const x=a.get(h)||{};x.scrollX=m,x.scrollY=p,a.set(h,x)},f=h=>{if(!(Yu||!s.restoring))if(h.target===document)u(ai,scrollX,scrollY);else{const m=h.target;u(m,m.scrollLeft,m.scrollTop)}},d=h=>{if(!s.restoring)return;const m=is[h]||(is[h]={});for(const[p,x]of a)p===ai?m[ai]=x:p.isConnected&&(m[jI(p)]=x)};n&&!s.restoration&&(s.restoration=!0,Yu=!1,history.scrollRestoration="manual",document.addEventListener("scroll",f,!0),e.subscribe("onBeforeLoad",h=>{h.fromLocation&&d(i(h.fromLocation)),a.clear()}),addEventListener("pagehide",()=>{d(i(e.stores.resolvedLocation.get()??e.stores.location.get())),PI()})),!s.reset&&(s.reset=!0,e.subscribe("onRendered",h=>{var b;const m=e.options.scrollRestorationBehavior,p=e.options.scrollToTopSelectors,x=s.next;let v;if(a.clear(),x||(s.next=!0),typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const w=i(h.toLocation),k=h.fromLocation&&i(h.fromLocation);if(s.restoring&&k&&k!==w){const _=is[k];if(_){let E=is[w];for(const j in _){if(j===ai){if(x)continue}else{const R=Hg(j);if(!R||x&&p&&(v??(v=Wv(p)),v.includes(R)))continue}E||(E=is[w]={}),E[j]??(E[j]=_[j])}}}Yu=!0;try{const _=h.toLocation.hash,E=h.toLocation.state.__hashScrollIntoViewOptions??!0;let j=!1;if(x){const R=qg.get(h.toLocation),T=_&&E&&(R==="PUSH"||R==="REPLACE"),O=s.restoring?is[w]:void 0;if(O)for(const $ in O){const{scrollX:U,scrollY:V}=O[$];if($===ai){if(T)continue;scrollTo({top:V,left:U,behavior:m}),j=!0}else{const Z=Hg($);Z&&(Z.scrollLeft=U,Z.scrollTop=V)}}if(!j&&!_){const $={top:0,left:0,behavior:m};if(scrollTo($),p){v??(v=Wv(p));for(const U of v)U.scrollTo($)}}}!j&&_&&E&&((b=document.getElementById(_))==null||b.scrollIntoView(E))}finally{Yu=!1}}))}const MI="Error preloading route! ☝️";var F1=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{var d,h;this.originalIndex=t.originalIndex;const n=this.options,s=!(n!=null&&n.path)&&!(n!=null&&n.id);this.parentRoute=(h=(d=this.options).getParentRoute)==null?void 0:h.call(d),s?this._path=no:this.parentRoute||Tr();let i=s?no:n==null?void 0:n.path;i&&i!=="/"&&(i=E1(i));const a=(n==null?void 0:n.id)||i;let u=s?no:hc([this.parentRoute.id==="__root__"?"":this.parentRoute.id,a]);i==="__root__"&&(i="/"),u!=="__root__"&&(u=hc(["/",u]));const f=u==="__root__"?"/":hc([this.parentRoute.fullPath,i]);this._path=i,this._id=u,this._fullPath=f,this._to=Mr(f)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>oI({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!(e!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},TI=class extends F1{constructor(e){super(e)}};function Qp(e){const t=e.errorComponent??Jp;return y.jsx($I,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:s})=>n?z.createElement(t,{error:n,reset:s}):e.children})}var $I=class extends z.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function Jp({error:e}){const[t,n]=z.useState(!1);return y.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[y.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),y.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(s=>!s),children:t?"Hide Error":"Show Error"})]}),y.jsx("div",{style:{height:".25rem"}}),t?y.jsx("div",{children:y.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?y.jsx("code",{children:e.message}):null})}):null]})}function FI({children:e,fallback:t=null}){return L1()?y.jsx(Ka.Fragment,{children:e}):y.jsx(Ka.Fragment,{children:t})}function L1(){return Ka.useSyncExternalStore(LI,()=>!0,()=>!1)}function LI(){return()=>{}}var O1=z.createContext(null);function En(e){return z.useContext(O1)}var lf=z.createContext(void 0),OI=z.createContext(void 0),Je=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(Je||{});function AI({update:e,notify:t,unwatched:n}){return{link:s,unlink:i,propagate:a,checkDirty:u,shallowPropagate:f};function s(h,m,p){const x=m.depsTail;if(x!==void 0&&x.dep===h)return;const v=x!==void 0?x.nextDep:m.deps;if(v!==void 0&&v.dep===h){v.version=p,m.depsTail=v;return}const w=h.subsTail;if(w!==void 0&&w.version===p&&w.sub===m)return;const k=m.depsTail=h.subsTail={version:p,dep:h,sub:m,prevDep:x,nextDep:v,prevSub:w,nextSub:void 0};v!==void 0&&(v.prevDep=k),x!==void 0?x.nextDep=k:m.deps=k,w!==void 0?w.nextSub=k:h.subs=k}function i(h,m=h.sub){const p=h.dep,x=h.prevDep,v=h.nextDep,w=h.nextSub,k=h.prevSub;return v!==void 0?v.prevDep=x:m.depsTail=x,x!==void 0?x.nextDep=v:m.deps=v,w!==void 0?w.prevSub=k:p.subsTail=k,k!==void 0?k.nextSub=w:(p.subs=w)===void 0&&n(p),v}function a(h){let m=h.nextSub,p;e:do{const x=h.sub;let v=x.flags;if(v&60?v&12?v&4?!(v&48)&&d(h,x)?(x.flags=v|40,v&=1):v=0:x.flags=v&-9|32:v=0:x.flags=v|32,v&2&&t(x),v&1){const w=x.subs;if(w!==void 0){const k=(h=w).nextSub;k!==void 0&&(p={value:m,prev:p},m=k);continue}}if((h=m)!==void 0){m=h.nextSub;continue}for(;p!==void 0;)if(h=p.value,p=p.prev,h!==void 0){m=h.nextSub;continue e}break}while(!0)}function u(h,m){let p,x=0,v=!1;e:do{const w=h.dep,k=w.flags;if(m.flags&16)v=!0;else if((k&17)===17){if(e(w)){const b=w.subs;b.nextSub!==void 0&&f(b),v=!0}}else if((k&33)===33){(h.nextSub!==void 0||h.prevSub!==void 0)&&(p={value:h,prev:p}),h=w.deps,m=w,++x;continue}if(!v){const b=h.nextDep;if(b!==void 0){h=b;continue}}for(;x--;){const b=m.subs,_=b.nextSub!==void 0;if(_?(h=p.value,p=p.prev):h=b,v){if(e(m)){_&&f(b),m=h.sub;continue}v=!1}else m.flags&=-33;m=h.sub;const E=h.nextDep;if(E!==void 0){h=E;continue e}}return v}while(!0)}function f(h){do{const m=h.sub,p=m.flags;(p&48)===32&&(m.flags=p|16,(p&6)===2&&t(m))}while((h=h.nextSub)!==void 0)}function d(h,m){let p=m.depsTail;for(;p!==void 0;){if(p===h)return!0;p=p.prevDep}return!1}}function DI(e,t,n){var a,u,f;const s=typeof e=="object",i=s?e:void 0;return{next:(a=s?e.next:e)==null?void 0:a.bind(i),error:(u=s?e.error:t)==null?void 0:u.bind(i),complete:(f=s?e.complete:n)==null?void 0:f.bind(i)}}const Wg=[];let mc=0;const{link:Gv,unlink:zI,propagate:UI,checkDirty:A1,shallowPropagate:Kv}=AI({update(e){return e._update()},notify(e){Wg[Gg++]=e,e.flags&=~Je.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Je.Mutable|Je.Dirty,Nc(e))}});let Xu=0,Gg=0,dr,Kg=0;function D1(e){try{++Kg,e()}finally{--Kg||z1()}}function Nc(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=zI(n,e)}function z1(){if(!(Kg>0)){for(;Xu<Gg;){const e=Wg[Xu];Wg[Xu++]=void 0,e.notify()}Xu=0,Gg=0}}function Qv(e,t){const n=typeof e=="function",s=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?Je.None:Je.Mutable,get(){return dr!==void 0&&Gv(i,dr,mc),i._snapshot},subscribe(a){const u=DI(a),f={current:!1},d=VI(()=>{var h;i.get(),f.current?(h=u.next)==null||h.call(u,i._snapshot):f.current=!0});return{unsubscribe:()=>{d.stop()}}},_update(a){const u=dr,f=(t==null?void 0:t.compare)??Object.is;if(n)dr=i,++mc,i.depsTail=void 0;else if(a===void 0)return!1;n&&(i.flags=Je.Mutable|Je.RecursedCheck);try{const d=i._snapshot,h=typeof a=="function"?a(d):a===void 0&&n?s(d):a;return d===void 0||!f(d,h)?(i._snapshot=h,!0):!1}finally{dr=u,n&&(i.flags&=~Je.RecursedCheck),Nc(i)}}};return n?(i.flags=Je.Mutable|Je.Dirty,i.get=function(){const a=i.flags;if(a&Je.Dirty||a&Je.Pending&&A1(i.deps,i)){if(i._update()){const u=i.subs;u!==void 0&&Kv(u)}}else a&Je.Pending&&(i.flags=a&~Je.Pending);return dr!==void 0&&Gv(i,dr,mc),i._snapshot}):i.set=function(a){if(i._update(a)){const u=i.subs;u!==void 0&&(UI(u),Kv(u),z1())}},i}function VI(e){const t=()=>{const s=dr;dr=n,++mc,n.depsTail=void 0,n.flags=Je.Watching|Je.RecursedCheck;try{return e()}finally{dr=s,n.flags&=~Je.RecursedCheck,Nc(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Je.Watching|Je.RecursedCheck,notify(){const s=this.flags;s&Je.Dirty||s&Je.Pending&&A1(this.deps,this)?t():this.flags=Je.Watching},stop(){this.flags=Je.None,this.depsTail=void 0,Nc(this)}};return t(),n}var Kh={exports:{}},Qh={},Jh={exports:{}},Yh={};/**
|
|
43
|
+
* @license React
|
|
44
|
+
* use-sync-external-store-shim.production.js
|
|
45
|
+
*
|
|
46
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
47
|
+
*
|
|
48
|
+
* This source code is licensed under the MIT license found in the
|
|
49
|
+
* LICENSE file in the root directory of this source tree.
|
|
50
|
+
*/var Jv;function BI(){if(Jv)return Yh;Jv=1;var e=xl();function t(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,u=e.useDebugValue;function f(p,x){var v=x(),w=s({inst:{value:v,getSnapshot:x}}),k=w[0].inst,b=w[1];return a(function(){k.value=v,k.getSnapshot=x,d(k)&&b({inst:k})},[p,v,x]),i(function(){return d(k)&&b({inst:k}),p(function(){d(k)&&b({inst:k})})},[p]),u(v),v}function d(p){var x=p.getSnapshot;p=p.value;try{var v=x();return!n(p,v)}catch{return!0}}function h(p,x){return x()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return Yh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Yh}var Yv;function qI(){return Yv||(Yv=1,Jh.exports=BI()),Jh.exports}/**
|
|
51
|
+
* @license React
|
|
52
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
53
|
+
*
|
|
54
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
55
|
+
*
|
|
56
|
+
* This source code is licensed under the MIT license found in the
|
|
57
|
+
* LICENSE file in the root directory of this source tree.
|
|
58
|
+
*/var Xv;function HI(){if(Xv)return Qh;Xv=1;var e=xl(),t=qI();function n(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var s=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,a=e.useRef,u=e.useEffect,f=e.useMemo,d=e.useDebugValue;return Qh.useSyncExternalStoreWithSelector=function(h,m,p,x,v){var w=a(null);if(w.current===null){var k={hasValue:!1,value:null};w.current=k}else k=w.current;w=f(function(){function _(O){if(!E){if(E=!0,j=O,O=x(O),v!==void 0&&k.hasValue){var $=k.value;if(v($,O))return R=$}return R=O}if($=R,s(j,O))return $;var U=x(O);return v!==void 0&&v($,U)?(j=O,$):(j=O,R=U)}var E=!1,j,R,T=p===void 0?null:p;return[function(){return _(m())},T===null?void 0:function(){return _(T())}]},[m,p,x,v]);var b=i(h,w[0],w[1]);return u(function(){k.hasValue=!0,k.value=b},[b]),d(b),b},Qh}var Zv;function WI(){return Zv||(Zv=1,Kh.exports=HI()),Kh.exports}var GI=WI();function KI(e,t){return e===t}function Qt(e,t,n=KI){const s=z.useCallback(u=>{if(!e)return()=>{};const{unsubscribe:f}=e.subscribe(u);return f},[e]),i=z.useCallback(()=>e==null?void 0:e.get(),[e]);return GI.useSyncExternalStoreWithSelector(s,i,i,t,n)}var Xh={get(){},subscribe(){return{unsubscribe(){}}}};function U1(e,t){const n=z.useRef();return s=>{const i=e!=null&&e.select?e.select(s):s;return(e==null?void 0:e.structuralSharing)??t.options.defaultStructuralSharing?n.current=Zs(n.current,i):i}}function xo(e){const t=En(),n=z.useContext(e.from?OI:lf),s=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),i=U1(e,t),a=Qt(s??Xh,u=>u?i(u):Xh);if(a!==Xh)return a;(e.shouldThrow??!0)&&Tr()}function V1(e){return xo({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function B1(e){const{select:t,...n}=e;return xo({...n,select:s=>t?t(s.loaderDeps):s.loaderDeps})}function q1(e){return xo({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function H1(e){return xo({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function W1(e){const t=En();return z.useCallback(n=>t.navigate({...n,from:n.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function G1(e){return xo({...e,select:t=>e.select?e.select(t.context):t.context})}var QI=p1();function JI(e,t){const n=En(),s=TP(t),{activeProps:i,inactiveProps:a,activeOptions:u,to:f,preload:d,preloadDelay:h,preloadIntentProximity:m,hashScrollIntoView:p,replace:x,startTransition:v,resetScroll:w,viewTransition:k,children:b,target:_,disabled:E,style:j,className:R,onClick:T,onBlur:O,onFocus:$,onMouseEnter:U,onMouseLeave:V,onTouchStart:Z,ignoreBlocker:te,params:ae,search:P,hash:H,state:X,mask:K,reloadDocument:q,unsafeRelative:Y,from:se,_fromLocation:ee,...M}=e,J=L1(),pe=z.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),he=Qt(n.stores.location,Oe=>Oe,(Oe,Mt)=>Oe.href===Mt.href),ce=z.useMemo(()=>{const Oe={_fromLocation:he,...pe};return n.buildLocation(Oe)},[n,he,pe]),be=ce.maskedLocation?ce.maskedLocation.publicHref:ce.publicHref,$e=ce.maskedLocation?ce.maskedLocation.external:ce.external,Ce=z.useMemo(()=>nj(be,$e,n.history,E),[E,$e,be,n.history]),Ee=z.useMemo(()=>{if(Ce!=null&&Ce.external)return Pc(Ce.href,n.protocolAllowlist)?void 0:Ce.href;if(!rj(f)&&!(typeof f!="string"||f.indexOf(":")===-1))try{return new URL(f),Pc(f,n.protocolAllowlist)?void 0:f}catch{}},[f,Ce,n.protocolAllowlist]),lt=z.useMemo(()=>{if(Ee)return!1;if(u!=null&&u.exact){if(!JP(he.pathname,ce.pathname,n.basepath))return!1}else{const Oe=Ic(he.pathname,n.basepath),Mt=Ic(ce.pathname,n.basepath);if(!(Oe.startsWith(Mt)&&(Oe.length===Mt.length||Oe[Mt.length]==="/")))return!1}return((u==null?void 0:u.includeSearch)??!0)&&!to(he.search,ce.search,{partial:!(u!=null&&u.exact),ignoreUndefined:!(u!=null&&u.explicitUndefined)})?!1:u!=null&&u.includeHash?J&&he.hash===ce.hash:!0},[u==null?void 0:u.exact,u==null?void 0:u.explicitUndefined,u==null?void 0:u.includeHash,u==null?void 0:u.includeSearch,he,Ee,J,ce.hash,ce.pathname,ce.search,n.basepath]),Sr=lt?Xs(i,{})??YI:Zh,Ns=lt?Zh:Xs(a,{})??Zh,Ms=[R,Sr.className,Ns.className].filter(Boolean).join(" "),Eo=(j||Sr.style||Ns.style)&&{...j,...Sr.style,...Ns.style},[Dl,$i]=z.useState(!1),Po=z.useRef(!1),wr=e.reloadDocument||Ee?!1:d??n.options.defaultPreload,Ts=h??n.options.defaultPreloadDelay??0,hn=z.useCallback(()=>{n.preloadRoute({...pe,_builtLocation:ce}).catch(Oe=>{console.warn(Oe),console.warn(MI)})},[n,pe,ce]);MP(s,z.useCallback(Oe=>{Oe!=null&&Oe.isIntersecting&&hn()},[hn]),tj,{disabled:!!E||wr!=="viewport"}),z.useEffect(()=>{Po.current||!E&&wr==="render"&&(hn(),Po.current=!0)},[E,hn,wr]);const zr=Oe=>{const Mt=Oe.currentTarget.getAttribute("target"),Bn=_!==void 0?_:Mt;if(!E&&!sj(Oe)&&!Oe.defaultPrevented&&(!Bn||Bn==="_self")&&Oe.button===0){Oe.preventDefault(),QI.flushSync(()=>{$i(!0)});const jo=n.subscribe("onResolved",()=>{jo(),$i(!1)});n.navigate({...pe,replace:x,resetScroll:w,hashScrollIntoView:p,startTransition:v,viewTransition:k,ignoreBlocker:te})}};if(Ee)return{...M,ref:s,href:Ee,...b&&{children:b},..._&&{target:_},...E&&{disabled:E},...j&&{style:j},...R&&{className:R},...T&&{onClick:T},...O&&{onBlur:O},...$&&{onFocus:$},...U&&{onMouseEnter:U},...V&&{onMouseLeave:V},...Z&&{onTouchStart:Z}};const Io=Oe=>{if(E||wr!=="intent")return;if(!Ts){hn();return}const Mt=Oe.currentTarget;if(Ca.has(Mt))return;const Bn=setTimeout(()=>{Ca.delete(Mt),hn()},Ts);Ca.set(Mt,Bn)},zl=Oe=>{E||wr!=="intent"||hn()},Fi=Oe=>{if(E||!wr||!Ts)return;const Mt=Oe.currentTarget,Bn=Ca.get(Mt);Bn&&(clearTimeout(Bn),Ca.delete(Mt))};return{...M,...Sr,...Ns,href:Ce==null?void 0:Ce.href,ref:s,onClick:ti([T,zr]),onBlur:ti([O,Fi]),onFocus:ti([$,Io]),onMouseEnter:ti([U,Io]),onMouseLeave:ti([V,Fi]),onTouchStart:ti([Z,zl]),disabled:!!E,target:_,...Eo&&{style:Eo},...Ms&&{className:Ms},...E&&XI,...lt&&ZI,...J&&Dl&&ej}}var Zh={},YI={className:"active"},XI={role:"link","aria-disabled":!0},ZI={"data-status":"active","aria-current":"page"},ej={"data-transitioning":"transitioning"},Ca=new WeakMap,tj={rootMargin:"100px"},ti=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function nj(e,t,n,s){if(!s)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function rj(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Yp=z.forwardRef((e,t)=>{const{_asChild:n,...s}=e,{type:i,...a}=JI(s,t),u=typeof s.children=="function"?s.children({isActive:a["data-status"]==="active"}):s.children;if(!n){const{disabled:f,...d}=a;return z.createElement("a",d,u)}return z.createElement(n,a,u)});function sj(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var oj=class extends F1{constructor(e){super(e),this.useMatch=t=>xo({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>G1({...t,from:this.id}),this.useSearch=t=>H1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>q1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>B1({...t,from:this.id}),this.useLoaderData=t=>V1({...t,from:this.id}),this.useNavigate=()=>W1({from:this.fullPath}),this.Link=Ka.forwardRef((t,n)=>y.jsx(Yp,{ref:n,from:this.fullPath,...t}))}};function K1(e){return new oj(e)}var ij=class extends TI{constructor(e){super(e),this.useMatch=t=>xo({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>G1({...t,from:this.id}),this.useSearch=t=>H1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>q1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>B1({...t,from:this.id}),this.useLoaderData=t=>V1({...t,from:this.id}),this.useNavigate=()=>W1({from:this.fullPath}),this.Link=Ka.forwardRef((t,n)=>y.jsx(Yp,{ref:n,from:this.fullPath,...t}))}};function aj(e){return new ij(e)}function lj(e){const t=En(),n=`not-found-${Qt(t.stores.location,s=>s.pathname)}-${Qt(t.stores.status,s=>s)}`;return y.jsx(Qp,{getResetKey:()=>n,onCatch:(s,i)=>{var a;if(Bt(s))(a=e.onCatch)==null||a.call(e,s,i);else throw s},errorComponent:({error:s})=>{var i;if(Bt(s))return(i=e.fallback)==null?void 0:i.call(e,s);throw s},children:e.children})}function uj(){return y.jsx("p",{children:"Not Found"})}function li(e){return y.jsx(y.Fragment,{children:e.children})}function Q1(e,t,n){return t.options.notFoundComponent?y.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?y.jsx(e.options.defaultNotFoundComponent,{...n}):y.jsx(uj,{})}function cj(e){return null}function fj(){return cj(En()),null}var dj=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,hj=(e,t)=>e[0]===t[0]&&e[1]===t[1],J1=z.memo(function({matchId:t}){const n=En(),s=n.stores.matchStores.get(t);s||Tr();const i=Qt(n.stores.loadedAt,u=>u),a=Qt(s,u=>u,dj);return y.jsx(gj,{router:n,matchId:t,resetKey:i,matchState:z.useMemo(()=>{var d;const u=a.routeId,f=(d=n.routesById[u].parentRoute)==null?void 0:d.id;return{routeId:u,ssr:a.ssr,_displayPending:a._displayPending,parentRouteId:f}},[a._displayPending,a.routeId,a.ssr,n.routesById])})});function gj({router:e,matchId:t,resetKey:n,matchState:s}){var w,k;const i=e.routesById[s.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,u=a?y.jsx(a,{}):null,f=i.options.errorComponent??e.options.defaultErrorComponent,d=i.options.onCatch??e.options.defaultOnCatch,h=i.isRoot?i.options.notFoundComponent??((w=e.options.notFoundRoute)==null?void 0:w.options.component):i.options.notFoundComponent,m=s.ssr===!1||s.ssr==="data-only",p=(!i.isRoot||i.options.wrapInSuspense||m)&&(i.options.wrapInSuspense??a??(((k=i.options.errorComponent)==null?void 0:k.preload)||m))?z.Suspense:li,x=f?Qp:li,v=h?lj:li;return y.jsxs(i.isRoot?i.options.shellComponent??li:li,{children:[y.jsx(lf.Provider,{value:t,children:y.jsx(p,{fallback:u,children:y.jsx(x,{getResetKey:()=>n,errorComponent:f||Jp,onCatch:(b,_)=>{if(Bt(b))throw b.routeId??(b.routeId=s.routeId),b;d==null||d(b,_)},children:y.jsx(v,{fallback:b=>{if(b.routeId??(b.routeId=s.routeId),!h||b.routeId&&b.routeId!==s.routeId||!b.routeId&&!i.isRoot)throw b;return z.createElement(h,b)},children:m||s._displayPending?y.jsx(FI,{fallback:u,children:y.jsx(eS,{matchId:t})}):y.jsx(eS,{matchId:t})})})})}),s.parentRouteId===no?y.jsxs(y.Fragment,{children:[y.jsx(pj,{}),e.options.scrollRestoration&&S1?y.jsx(fj,{}):null]}):null]})}function pj(){const e=En(),t=z.useRef();return Ma(()=>{const n=e.stores.resolvedLocation.get(),s=t.current;n&&(!s||s.href!==n.href)&&e.emit({type:"onRendered",...fi(e.stores.location.get(),s??n)}),t.current=n},[Qt(e.stores.resolvedLocation,n=>n==null?void 0:n.state.__TSR_key),e]),null}var eS=z.memo(function({matchId:t}){const n=En(),s=(m,p)=>{var x;return((x=n.getMatch(m.id))==null?void 0:x._nonReactive[p])??m._nonReactive[p]},i=n.stores.matchStores.get(t);i||Tr();const a=Qt(i,m=>m),u=a.routeId,f=n.routesById[u],d=z.useMemo(()=>{var p;const m=(p=n.routesById[u].options.remountDeps??n.options.defaultRemountDeps)==null?void 0:p({routeId:u,loaderDeps:a.loaderDeps,params:a._strictParams,search:a._strictSearch});return m?JSON.stringify(m):void 0},[u,a.loaderDeps,a._strictParams,a._strictSearch,n.options.defaultRemountDeps,n.routesById]),h=z.useMemo(()=>{const m=f.options.component??n.options.defaultComponent;return m?y.jsx(m,{},d):y.jsx(Y1,{})},[d,f.options.component,n.options.defaultComponent]);if(a._displayPending)throw s(a,"displayPendingPromise");if(a._forcePending)throw s(a,"minPendingPromise");if(a.status==="pending"){const m=f.options.pendingMinMs??n.options.defaultPendingMinMs;if(m){const p=n.getMatch(a.id);if(p&&!p._nonReactive.minPendingPromise){const x=mi();p._nonReactive.minPendingPromise=x,setTimeout(()=>{x.resolve(),p._nonReactive.minPendingPromise=void 0},m)}}throw s(a,"loadPromise")}if(a.status==="notFound")return Bt(a.error)||Tr(),Q1(n,f,a.error);if(a.status==="redirected")throw on(a.error)||Tr(),s(a,"loadPromise");if(a.status==="error")throw a.error;return h}),Y1=z.memo(function(){const t=En(),n=z.useContext(lf);let s,i=!1,a;{const h=n?t.stores.matchStores.get(n):void 0;[s,i]=Qt(h,m=>[m==null?void 0:m.routeId,(m==null?void 0:m.globalNotFound)??!1],hj),a=Qt(t.stores.matchesId,m=>m[m.findIndex(p=>p===n)+1])}const u=s?t.routesById[s]:void 0,f=t.options.defaultPendingComponent?y.jsx(t.options.defaultPendingComponent,{}):null;if(i)return u||Tr(),Q1(t,u,void 0);if(!a)return null;const d=y.jsx(J1,{matchId:a});return s===no?y.jsx(z.Suspense,{fallback:f,children:d}):d});function mj(){const e=En(),t=z.useRef({router:e,mounted:!1}),[n,s]=z.useState(!1),i=Qt(e.stores.isLoading,p=>p),a=Qt(e.stores.hasPending,p=>p),u=Uh(i),f=i||n||a,d=Uh(f),h=i||a,m=Uh(h);return e.startTransition=p=>{s(!0),z.startTransition(()=>{p(),s(!1)})},z.useEffect(()=>{const p=e.history.subscribe(e.load),x=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Mr(e.latestLocation.publicHref)!==Mr(x.publicHref)&&e.commitLocation({...x,replace:!0}),()=>{p()}},[e,e.history]),Ma(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(x){console.error(x)}})()},[e]),Ma(()=>{u&&!i&&e.emit({type:"onLoad",...fi(e.stores.location.get(),e.stores.resolvedLocation.get())})},[u,e,i]),Ma(()=>{m&&!h&&e.emit({type:"onBeforeRouteMount",...fi(e.stores.location.get(),e.stores.resolvedLocation.get())})},[h,m,e]),Ma(()=>{if(d&&!f){const p=fi(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...p}),D1(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[f,d,e]),null}function yj(){const e=En(),t=e.routesById[no].options.pendingComponent??e.options.defaultPendingComponent,n=t?y.jsx(t,{}):null,s=y.jsxs(typeof document<"u"&&e.ssr?li:z.Suspense,{fallback:n,children:[y.jsx(mj,{}),y.jsx(xj,{})]});return e.options.InnerWrap?y.jsx(e.options.InnerWrap,{children:s}):s}function xj(){const e=En(),t=Qt(e.stores.firstId,i=>i),n=Qt(e.stores.loadedAt,i=>i),s=t?y.jsx(J1,{matchId:t}):null;return y.jsx(lf.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?s:y.jsx(Qp,{getResetKey:()=>n,errorComponent:Jp,onCatch:void 0,children:s})})}var vj=e=>({createMutableStore:Qv,createReadonlyStore:Qv,batch:D1}),Sj=e=>new wj(e),wj=class extends xI{constructor(e){super(e,vj)}};function kj({router:e,children:t,...n}){k1(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const s=y.jsx(O1.Provider,{value:e,children:t});return e.options.Wrap?y.jsx(e.options.Wrap,{children:s}):s}function Cj({router:e,...t}){return y.jsx(kj,{router:e,...t,children:y.jsx(yj,{})})}function bj(e){const t=En({warn:(e==null?void 0:e.router)===void 0}),n=(e==null?void 0:e.router)||t;return Qt(n.stores.__store,U1(e,n))}const el="#8d9090",vn={green:"#6caa71",greenBright:"#79be7e",cyan:"#7ccbcd",cyanBright:"#84dde0",blue:"#6d96b4",blueBright:"#67b5ed",magenta:"#bd7bcd",magentaBright:"#d389e5",yellow:"#c4ac62",yellowBright:"#d9c074",red:"#b45648",redBright:"#cf6a5a",white:"#dee5eb",whiteBright:"#f3f5f5",gray:el,grey:el},_j={claude:vn.green,codex:vn.cyan,cursor:vn.magenta,copilot:vn.white,pi:vn.blue,opencode:vn.yellow,antigravity:vn.red,gemini:vn.greenBright};function Rj(e){return e?e.startsWith("#")?e:vn[e]??el:el}const so=Rj;function Ej(e){return _j[e]??el}const tS=["#00d7ff","#00d787","#e6b450","#d75f87","#5f87ff","#af87ff","#5fd7a7","#ff8787","#d7af5f","#87d7ff","#d787d7","#9ee493","#ffb454","#7aa2f7","#bb9af7"],nS=new Map;function Xp(e){const t=nS.get(e);if(t)return t;let n=0;for(let i=0;i<e.length;i++)n=n*31+e.charCodeAt(i)>>>0;const s=tS[n%tS.length];return nS.set(e,s),s}const U5={input:vn.blue,output:vn.green,cacheCreate:vn.yellow,cacheRead:vn.cyan};function Or(e){return e.replace(/^claude-/,"").replace(/^gpt-/,"gpt-").replace(/-\d{8}$/,"").replace(/-latest$/,"")}const rS=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(e,t={}){if(!Number.isFinite(e))return"$0.00";const n=t.sign&&e>0?"+":"",s=Math.abs(e);return s>=1e5?`${n}$${(e/1e3).toFixed(0)}k`:s>=1e4?`${n}$${(e/1e3).toFixed(1)}k`:s>=1?`${n}$${e.toFixed(2)}`:s>=.01?`${n}$${e.toFixed(3)}`:s===0?"$0.00":`${n}$${e.toFixed(4)}`}function V5(e){if(!Number.isFinite(e))return"$0";const t=Math.abs(e);return t>=1e6?`$${(e/1e6).toFixed(1).replace(/\.0$/,"")}M`:t>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:t>=1?`$${Math.round(e)}`:t===0?"$0":`$${e.toFixed(2)}`}function wn(e){if(!Number.isFinite(e)||e===0)return"0";const t=Math.abs(e);return t>=1e9?`${(e/1e9).toFixed(2)}B`:t>=1e6?`${(e/1e6).toFixed(2)}M`:t>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function bs(e){return Number.isFinite(e)?Math.round(e).toLocaleString("en-US"):"0"}function X1(e){if(!Number.isFinite(e))return"0";const t=Math.abs(e);return t>=1e6?`${(e/1e6).toFixed(1)}M`:t>=1e4?`${Math.round(e/1e3)}k`:Math.round(e).toLocaleString("en-US")}function Z1(e,t=0){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:"0%"}function Pj(e,t){const n=Math.max(0,Math.round((t-e)/1e3));if(n<2)return"just now";if(n<60)return`${n}s ago`;const s=Math.round(n/60);if(s<60)return`${s}m ago`;const i=Math.round(s/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function tl(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(t)return`${rS[Number(t[2])-1]} ${Number(t[3])}`;const n=/^(\d{4})-(\d{2})$/.exec(e);return n?`${rS[Number(n[2])-1]} ${n[1]}`:e}function nl(e){return e.input+e.output+e.cacheCreate+e.cacheRead}const ds=864e5,Ij=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],$r=e=>{const[t,n,s]=e.split("-").map(Number);return Date.UTC(t,(n||1)-1,s||1)},Sl=e=>new Date(e).toISOString().slice(0,10),rl=e=>(new Date(e).getUTCDay()+6)%7,jj=e=>{const t=$r(e);return Sl(t-rl(t)*ds)},Nj={period:"all"},ek=[{key:"7d",label:"7 days"},{key:"30d",label:"30 days"},{key:"90d",label:"90 days"},{key:"mtd",label:"month"},{key:"all",label:"all time"}];function tk(e,t){if(!t.providers.length)return null;const n=new Set(e.accounts.filter(i=>i.hasUsage).map(i=>i.providerId)),s=t.providers.filter(i=>n.has(i));return s.length?new Set(s):null}function nk(e,t){const n=tk(e,t);return e.accounts.filter(s=>!(!s.hasUsage||t.account!=="all"&&s.id!==t.account||n&&!n.has(s.providerId)))}function Qg(e){var t,n,s,i,a,u,f,d,h;return!!(e.hasBilling&&((n=(t=e.billing)==null?void 0:t.metrics)!=null&&n.length||(s=e.billing)!=null&&s.plan||(i=e.billing)!=null&&i.error||(f=(u=(a=e.billing)==null?void 0:a.activity)==null?void 0:u.series)!=null&&f.length||(h=(d=e.billing)==null?void 0:d.modelSpend)!=null&&h.length))}function Mj(e,t){const n=tk(e,t);return e.accounts.filter(s=>!(!s.hasUsage&&!Qg(s)||t.account!=="all"&&s.id!==t.account||n&&!n.has(s.providerId)))}function rk(e){var n;let t=null;for(const s of e)for(const i of((n=s.table)==null?void 0:n.daily)??[])(!t||i.label>t)&&(t=i.label);return t}function sk(e,t){if(!t||e==="all")return null;if(e==="mtd")return new Date().toISOString().slice(0,7)+"-01";const n=e==="7d"?7:e==="90d"?90:30;return Sl($r(t)-(n-1)*ds)}function Tj(e,t,n){if(!n||e==="all")return null;const s=sk(e,n);if(t==="daily")return s;const i=t==="monthly"?365:84,a=Sl($r(n)-(i-1)*ds);return s&&s<a?s:a}function $j(e){return e.reduce((t,n)=>(t.input+=n.input,t.output+=n.output,t.cacheCreate+=n.cacheCreate,t.cacheRead+=n.cacheRead,t.cacheSavings+=n.cacheSavings,t.cost+=n.cost,t.count+=n.count,t),{input:0,output:0,cacheCreate:0,cacheRead:0,cacheSavings:0,cost:0,count:0})}function Fj(e,t,n){var h;if(!e)return[];const s=nk(e,t),i=rk(s),a=Tj(t.period,n,i),u=a?n==="monthly"?a.slice(0,7):n==="weekly"?jj(a):a:null,f=t.models.length?new Set(t.models):null,d=new Map;for(const m of s)for(const p of((h=m.table)==null?void 0:h[n])??[]){if(u&&p.label<u)continue;const x=f?p.breakdown.filter(k=>f.has(k.name)):p.breakdown;if(f&&x.length===0)continue;const v=d.get(p.label),w=$j(x);if(!v)d.set(p.label,{label:p.label,models:x.map(k=>k.name).sort(),...w,total:nl(w),breakdown:x.map(k=>({...k}))});else{v.input+=w.input,v.output+=w.output,v.cacheCreate+=w.cacheCreate,v.cacheRead+=w.cacheRead,v.cacheSavings+=w.cacheSavings,v.total+=nl(w),v.cost+=w.cost,v.count+=w.count;const k=new Map(v.breakdown.map(b=>[b.name,b]));for(const b of x){const _=k.get(b.name);_?(_.input+=b.input,_.output+=b.output,_.cacheCreate+=b.cacheCreate,_.cacheRead+=b.cacheRead,_.cacheSavings+=b.cacheSavings,_.cost+=b.cost,_.count+=b.count):k.set(b.name,{...b})}v.breakdown=[...k.values()].sort((b,_)=>_.cost-b.cost),v.models=v.breakdown.map(b=>b.name)}}return[...d.values()]}const Ta=()=>({cost:0,tokens:0,cacheSavings:0,calls:0});function eg(e,t){var s;const n=(s=e.dashboard)==null?void 0:s[t];return n?{cost:n.cost,tokens:n.tokens,cacheSavings:n.cacheSavings,calls:0}:Ta()}const yc=(e,t,n,s,i)=>{e.cost+=t,e.tokens+=n,e.cacheSavings+=s,e.calls+=i};function Lj(){return{totals:Ta(),today:Ta(),week:Ta(),month:Ta(),burnRate:0,timelineMap:new Map,cacheByDay:new Map,provAgg:new Map,modelAgg:new Map,modelTrend:new Map,modelOptionSet:new Set,tokenComposition:{input:0,output:0,cacheCreate:0,cacheRead:0}}}function Oj(e,t){var s;const n=i=>[i.cost,i.tokens,i.cacheSavings,i.calls];yc(e.today,...n(eg(t,"today"))),yc(e.week,...n(eg(t,"week"))),yc(e.month,...n(eg(t,"month"))),e.burnRate+=((s=t.dashboard)==null?void 0:s.burnRate)??0}function Aj(e,t,n,s,i){let a=0,u=0,f=0,d=0;for(const p of t.breakdown){if(e.modelOptionSet.add(p.name),i&&!i.has(p.name))continue;const x=nl(p);a+=p.cost,u+=x,f+=p.cacheSavings,d+=p.count,e.tokenComposition.input+=p.input,e.tokenComposition.output+=p.output,e.tokenComposition.cacheCreate+=p.cacheCreate,e.tokenComposition.cacheRead+=p.cacheRead;const v=e.modelAgg.get(p.name)??{cost:0,tokens:0,cacheSavings:0,calls:0};v.cost+=p.cost,v.tokens+=x,v.cacheSavings+=p.cacheSavings,v.calls+=p.count,e.modelAgg.set(p.name,v);let w=e.modelTrend.get(p.name);w||(w=new Map,e.modelTrend.set(p.name,w)),w.set(t.label,(w.get(t.label)??0)+p.cost)}if(i&&d===0&&a===0)return;yc(e.totals,a,u,f,d);const h=e.timelineMap.get(t.label)??{date:t.label,total:0,tokens:0,byProvider:{}};h.total+=a,h.tokens+=u,h.byProvider[n]=(h.byProvider[n]??0)+a,e.timelineMap.set(t.label,h),e.cacheByDay.set(t.label,(e.cacheByDay.get(t.label)??0)+f);const m=e.provAgg.get(n)??{id:n,name:n,color:s,cost:0,tokens:0,calls:0};m.cost+=a,m.tokens+=u,m.calls+=d,e.provAgg.set(n,m)}function Dj(e){return[...e.timelineMap.values()].sort((t,n)=>t.date.localeCompare(n.date))}function zj(e,t,n){const s=t.map(i=>i.date);return[...e.modelAgg.entries()].map(([i,a])=>{const u=e.modelTrend.get(i);return{model:i,color:Xp(i),cost:a.cost,tokens:a.tokens,cacheSavings:a.cacheSavings,calls:a.calls,share:n>0?a.cost/n:0,tokenShare:e.totals.tokens>0?a.tokens/e.totals.tokens:0,callShare:e.totals.calls>0?a.calls/e.totals.calls:0,trend:s.map(f=>(u==null?void 0:u.get(f))??0)}}).sort((i,a)=>a.cost-i.cost)}function Uj(e,t){var E,j;const n=e?nk(e,t):[],s=rk(n),i=sk(t.period,s),a=t.models.length?new Set(t.models):null,u=new Map,f=new Map;for(const R of(e==null?void 0:e.providers)??[])u.set(R.id,R.color),f.set(R.id,R.name);const d=Lj(),h=R=>!i||R>=i;for(const R of n){Oj(d,R);const T=R.providerId,O=u.get(T)??R.color;for(const $ of((E=R.table)==null?void 0:E.daily)??[])h($.label)&&Aj(d,$,T,O,a)}for(const R of d.provAgg.values()){const T=f.get(R.id);T&&(R.name=T)}const m=Dj(d);let p=0;const x=m.map(R=>(p+=R.total,{date:R.date,total:p})),v=m.map(R=>({date:R.date,value:d.cacheByDay.get(R.date)??0})),w=new Map;for(const R of n)for(const T of((j=R.table)==null?void 0:j.daily)??[]){if(!h(T.label))continue;const O=a?T.breakdown.filter(U=>a.has(U.name)):T.breakdown;if(a&&O.length===0)continue;let $=w.get(T.label);$||($={tokens:0,calls:0,cacheSavings:0,models:new Map},w.set(T.label,$));for(const U of O)$.tokens+=nl(U),$.calls+=U.count,$.cacheSavings+=U.cacheSavings,$.models.set(U.name,($.models.get(U.name)??0)+U.cost)}const k=m.map(R=>{const T=w.get(R.date);return{date:R.date,cost:R.total,tokens:(T==null?void 0:T.tokens)??0,calls:(T==null?void 0:T.calls)??0,cacheSavings:(T==null?void 0:T.cacheSavings)??0,models:T?[...T.models.entries()].map(([O,$])=>({name:O,cost:$})).sort((O,$)=>$.cost-O.cost):[]}}),b=[...d.provAgg.values()].sort((R,T)=>T.cost-R.cost),_=zj(d,m,d.totals.cost);return{filteredAccounts:n,totals:d.totals,today:d.today,week:d.week,month:d.month,burnRate:d.burnRate,timeline:m,cumulative:x,cacheSavingsSeries:v,calendar:k,cardAccounts:e?Mj(e,t):[],byProvider:b,byModel:_,tokenComposition:d.tokenComposition,modelOptions:[...d.modelOptionSet].sort(),latestDay:s,rangeStart:i}}function Wt({children:e,className:t="size-4",...n}){return y.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round",className:t,"aria-hidden":!0,...n,children:e})}const Vj=e=>y.jsxs(Wt,{...e,children:[y.jsx("path",{d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"}),y.jsx("circle",{cx:"12",cy:"13",r:"4"})]}),yi=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"M20 6 9 17l-5-5"})}),Bj=e=>y.jsxs(Wt,{...e,children:[y.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),y.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),qj=e=>y.jsxs(Wt,{...e,children:[y.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),y.jsx("path",{d:"m7 10 5 5 5-5"}),y.jsx("path",{d:"M12 15V3"})]}),tg=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"M3 6.5A2.5 2.5 0 0 1 5.5 4H9l2 2h7.5A2.5 2.5 0 0 1 21 8.5v8A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5z"})}),Hj=e=>y.jsxs(Wt,{...e,children:[y.jsx("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}),y.jsx("path",{d:"m16 6-4-4-4 4"}),y.jsx("path",{d:"M12 2v13"})]}),Zp=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"m6 9 6 6 6-6"})}),Wj=e=>y.jsxs(Wt,{...e,children:[y.jsx("circle",{cx:"11",cy:"11",r:"8"}),y.jsx("path",{d:"m21 21-4.3-4.3"})]}),xi=e=>y.jsxs(Wt,{...e,children:[y.jsx("path",{d:"M18 6 6 18"}),y.jsx("path",{d:"m6 6 12 12"})]}),Gj=e=>y.jsxs(Wt,{...e,children:[y.jsx("circle",{cx:"12",cy:"12",r:"4"}),y.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),Kj=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"})}),Qj=e=>y.jsxs(Wt,{...e,children:[y.jsx("circle",{cx:"12",cy:"12",r:"3"}),y.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),Jj=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"M12 5v14M5 12h14"})}),Yj=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"})}),sS=e=>y.jsxs(Wt,{...e,children:[y.jsx("path",{d:"M12 20h9"}),y.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4z"})]}),ok=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"m18 15-6-6-6 6"})}),em="focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent";function Sn({options:e,value:t,onChange:n,size:s="sm",btnClassName:i,containerClassName:a,ariaLabel:u}){const f="flex items-center overflow-hidden rounded border border-line",d=s==="xs"?"px-1.5 py-0.5 text-[10px] transition max-sm:py-1.5":"px-2 py-1 text-xs transition max-sm:py-2",h=s==="xs"?"bg-bg-3 text-accent":"bg-bg-2 text-accent",m=s==="xs"?"text-fg-faint hover:text-fg":"text-fg-dim hover:text-fg";return y.jsx("div",{className:a??f,role:"group","aria-label":u,children:e.map(p=>y.jsx("button",{type:"button","aria-pressed":t===p.value,onClick:()=>n(p.value),className:`${i??d} ${em} ${t===p.value?h:m}`,children:p.label},String(p.value)))})}function oS({label:e,value:t,children:n}){const[s,i]=z.useState(!1),a=z.useRef(null);return z.useEffect(()=>{if(!s)return;const u=d=>{a.current&&!a.current.contains(d.target)&&i(!1)},f=d=>{d.key==="Escape"&&i(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f)}},[s]),y.jsxs("div",{ref:a,className:"relative",children:[y.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,onClick:()=>i(u=>!u),className:`flex items-center gap-1.5 rounded border border-line bg-bg-1 px-2 py-1 text-xs text-fg-dim transition hover:border-line-2 hover:text-fg max-sm:py-2 ${em}`,children:[y.jsxs("span",{className:"text-fg-faint",children:[e,":"]}),y.jsx("span",{className:"text-fg",children:t}),y.jsx(Zp,{className:`size-3 transition ${s?"rotate-180":""}`})]}),s&&y.jsx("div",{role:"menu",className:"absolute right-0 z-50 mt-1 min-w-44 max-w-[calc(100vw-2.5rem)] rounded-md border border-line-2 bg-bg-2 p-1 shadow-xl",children:n(()=>i(!1))})]})}function iS({children:e}){return y.jsx("div",{className:"flex flex-col",children:e})}function Zu({active:e,onClick:t,children:n}){return y.jsx("button",{type:"button",role:"menuitem",onClick:t,className:`flex min-w-0 items-center gap-2 rounded px-2 py-1 text-left text-xs transition ${em} ${e?"bg-bg-3 text-fg-bright":"text-fg-dim hover:bg-bg-3 hover:text-fg"}`,children:n})}function Xj({snapshot:e,derived:t,filters:n,setFilters:s}){const i=(e==null?void 0:e.providers)??[],u=((e==null?void 0:e.accounts)??[]).filter(_=>_.hasUsage),f=new Set(u.map(_=>_.providerId)),d=i.filter(_=>f.has(_.id)),h=new Set(t.cardAccounts.map(_=>_.providerId)),m=i.filter(_=>!f.has(_.id)&&h.has(_.id)),p=n.providers.length?u.filter(_=>n.providers.includes(_.providerId)):u,x=_=>{var E;return((E=i.find(j=>j.id===_))==null?void 0:E.name)??_},v=_=>_.name&&_.name!==x(_.providerId)?`${x(_.providerId)} · ${_.name}`:x(_.providerId),w=u.find(_=>_.id===n.account),k=_=>s(E=>{const j=E.providers.includes(_);return{...E,providers:j?E.providers.filter(R=>R!==_):[...E.providers,_]}}),b=n.providers.length>0||n.models.length>0||n.account!=="all";return y.jsx("div",{className:"border-t border-line bg-bg-0/70",children:y.jsxs("div",{className:"mx-auto flex max-w-[1600px] flex-wrap items-center gap-x-4 gap-y-2 px-5 py-2.5 2xl:max-w-[1920px]",children:[y.jsx("span",{className:"hidden text-xs text-fg-faint sm:inline",children:"filter:"}),y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[d.map(_=>{const E=n.providers.includes(_.id),j=n.providers.length>0&&!E;return y.jsxs("button",{type:"button","aria-pressed":E,onClick:()=>k(_.id),className:"flex items-center gap-1.5 rounded border px-2 py-0.5 text-xs transition focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent max-sm:py-1.5",style:{borderColor:E?_.color:"var(--color-line)",color:j?"var(--color-fg-faint)":E?_.color:"var(--color-fg-dim)",background:E?"var(--color-bg-2)":"transparent"},title:E?`hide ${_.name}`:n.providers.length?`add ${_.name}`:`show only ${_.name}`,children:[y.jsx("span",{style:{color:_.color,opacity:j?.4:1},"aria-hidden":!0,children:E?"●":"○"}),_.name]},_.id)}),m.length>0&&y.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-fg-faint",title:"Billing-only providers — shown as cards with plan & quota; no usage timeline to filter",children:[d.length>0&&y.jsx("span",{className:"text-line-2",children:"|"}),y.jsx("span",{children:"billing-only:"}),m.map(_=>y.jsxs("span",{className:"flex items-center gap-1 text-fg-dim",children:[y.jsx("span",{style:{color:_.color,opacity:.55},"aria-hidden":!0,children:"·"}),_.name]},_.id))]})]}),y.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2 md:ml-auto md:w-auto",children:[p.length>1?y.jsx(oS,{label:"account",value:n.account==="all"?"all":w?v(w):"all",children:_=>y.jsxs(iS,{children:[y.jsx(Zu,{active:n.account==="all",onClick:()=>{s(E=>({...E,account:"all"})),_()},children:"All accounts"}),y.jsx("div",{className:"my-1 h-px bg-line"}),y.jsx("div",{className:"max-h-64 overflow-y-auto",children:p.map(E=>y.jsxs(Zu,{active:n.account===E.id,onClick:()=>{s(j=>({...j,account:E.id})),_()},children:[y.jsx("span",{style:{color:E.color},"aria-hidden":!0,children:"●"})," ",y.jsx("span",{className:"truncate",children:v(E)})]},E.id))})]})}):p.length===1?y.jsxs("span",{className:"rounded border border-line bg-bg-1 px-2 py-1 text-xs text-fg-dim",children:["account: ",y.jsx("span",{className:"text-fg",children:v(p[0])})]}):null,y.jsx(oS,{label:"model",value:n.models.length===0?"all":n.models.length===1?Or(n.models[0]):`${n.models.length} models`,children:()=>y.jsxs(iS,{children:[y.jsx(Zu,{active:n.models.length===0,onClick:()=>s(_=>({..._,models:[]})),children:"All models"}),y.jsx("div",{className:"my-1 h-px bg-line"}),y.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[t.modelOptions.length===0&&y.jsx("div",{className:"px-2 py-1 text-xs text-fg-faint",children:"no models in range"}),t.modelOptions.map(_=>{const E=n.models.includes(_);return y.jsxs(Zu,{active:E,onClick:()=>s(j=>({...j,models:E?j.models.filter(R=>R!==_):[...j.models,_]})),children:[y.jsx("span",{className:E?"text-accent":"text-fg-faint","aria-hidden":!0,children:E?"◉":"○"})," ",Or(_)]},_)})]})]})}),y.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[y.jsx("span",{className:"text-xs text-fg-faint",children:"range:"}),y.jsx(Sn,{options:ek.map(_=>({value:_.key,label:_.key==="mtd"?"MTD":_.key==="all"?"ALL":_.key})),value:n.period,onChange:_=>s(E=>({...E,period:_})),size:"sm",ariaLabel:"time range"})]}),b&&y.jsxs("button",{type:"button",onClick:()=>s(_=>({..._,providers:[],models:[],account:"all"})),className:"flex items-center gap-1 rounded border border-line bg-bg-1 px-2 py-1 text-xs text-fg-faint transition hover:border-warning/60 hover:text-warning focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",title:"Clear provider, model & account filters","aria-label":"Clear provider, model and account filters",children:[y.jsx(xi,{className:"size-3","aria-hidden":!0})," clear"]})]})]})})}function Zj(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),s=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(s),n.body.appendChild(i),t&&(s.href=t),i.href=e,i.href}const e2=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function ms(e){const t=[];for(let n=0,s=e.length;n<s;n++)t.push(e[n]);return t}let ni=null;function ik(e={}){return ni||(e.includeStyleProperties?(ni=e.includeStyleProperties,ni):(ni=ms(window.getComputedStyle(document.documentElement)),ni))}function Mc(e,t){const s=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return s?parseFloat(s.replace("px","")):0}function t2(e){const t=Mc(e,"border-left-width"),n=Mc(e,"border-right-width");return e.clientWidth+t+n}function n2(e){const t=Mc(e,"border-top-width"),n=Mc(e,"border-bottom-width");return e.clientHeight+t+n}function ak(e,t={}){const n=t.width||t2(e),s=t.height||n2(e);return{width:n,height:s}}function r2(){let e,t;try{t=process}catch{}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const xn=16384;function s2(e){(e.width>xn||e.height>xn)&&(e.width>xn&&e.height>xn?e.width>e.height?(e.height*=xn/e.width,e.width=xn):(e.width*=xn/e.height,e.height=xn):e.width>xn?(e.height*=xn/e.width,e.width=xn):(e.width*=xn/e.height,e.height=xn))}function o2(e,t={}){return e.toBlob?new Promise(n=>{e.toBlob(n,t.type?t.type:"image/png",t.quality?t.quality:1)}):new Promise(n=>{const s=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),i=s.length,a=new Uint8Array(i);for(let u=0;u<i;u+=1)a[u]=s.charCodeAt(u);n(new Blob([a],{type:t.type?t.type:"image/png"}))})}function Tc(e){return new Promise((t,n)=>{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>t(s))})},s.onerror=n,s.crossOrigin="anonymous",s.decoding="async",s.src=e})}async function i2(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function a2(e,t,n){const s="http://www.w3.org/2000/svg",i=document.createElementNS(s,"svg"),a=document.createElementNS(s,"foreignObject");return i.setAttribute("width",`${t}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${t} ${n}`),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),i.appendChild(a),a.appendChild(e),i2(i)}const an=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||an(n,t)};function l2(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function u2(e,t){return ik(t).map(n=>{const s=e.getPropertyValue(n),i=e.getPropertyPriority(n);return`${n}: ${s}${i?" !important":""};`}).join(" ")}function c2(e,t,n,s){const i=`.${e}:${t}`,a=n.cssText?l2(n):u2(n,s);return document.createTextNode(`${i}{${a}}`)}function aS(e,t,n,s){const i=window.getComputedStyle(e,n),a=i.getPropertyValue("content");if(a===""||a==="none")return;const u=e2();try{t.className=`${t.className} ${u}`}catch{return}const f=document.createElement("style");f.appendChild(c2(u,n,i,s)),t.appendChild(f)}function f2(e,t,n){aS(e,t,":before",n),aS(e,t,":after",n)}const lS="application/font-woff",uS="image/jpeg",d2={woff:lS,woff2:lS,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:uS,jpeg:uS,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function h2(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function tm(e){const t=h2(e).toLowerCase();return d2[t]||""}function g2(e){return e.split(/,/)[1]}function Jg(e){return e.search(/^(data:)/)!==-1}function p2(e,t){return`data:${t};base64,${e}`}async function lk(e,t,n){const s=await fetch(e,t);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const i=await s.blob();return new Promise((a,u)=>{const f=new FileReader;f.onerror=u,f.onloadend=()=>{try{a(n({res:s,result:f.result}))}catch(d){u(d)}},f.readAsDataURL(i)})}const ng={};function m2(e,t,n){let s=e.replace(/\?.*/,"");return n&&(s=e),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),t?`[${t}]${s}`:s}async function nm(e,t,n){const s=m2(e,t,n.includeQueryParams);if(ng[s]!=null)return ng[s];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let i;try{const a=await lk(e,n.fetchRequestInit,({res:u,result:f})=>(t||(t=u.headers.get("Content-Type")||""),g2(f)));i=p2(a,t)}catch(a){i=n.imagePlaceholder||"";let u=`Failed to fetch resource: ${e}`;a&&(u=typeof a=="string"?a:a.message),u&&console.warn(u)}return ng[s]=i,i}async function y2(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):Tc(t)}async function x2(e,t){if(e.currentSrc){const a=document.createElement("canvas"),u=a.getContext("2d");a.width=e.clientWidth,a.height=e.clientHeight,u==null||u.drawImage(e,0,0,a.width,a.height);const f=a.toDataURL();return Tc(f)}const n=e.poster,s=tm(n),i=await nm(n,s,t);return Tc(i)}async function v2(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await uf(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function S2(e,t){return an(e,HTMLCanvasElement)?y2(e):an(e,HTMLVideoElement)?x2(e,t):an(e,HTMLIFrameElement)?v2(e,t):e.cloneNode(uk(e))}const w2=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",uk=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function k2(e,t,n){var s,i;if(uk(t))return t;let a=[];return w2(e)&&e.assignedNodes?a=ms(e.assignedNodes()):an(e,HTMLIFrameElement)&&(!((s=e.contentDocument)===null||s===void 0)&&s.body)?a=ms(e.contentDocument.body.childNodes):a=ms(((i=e.shadowRoot)!==null&&i!==void 0?i:e).childNodes),a.length===0||an(e,HTMLVideoElement)||await a.reduce((u,f)=>u.then(()=>uf(f,n)).then(d=>{d&&t.appendChild(d)}),Promise.resolve()),t}function C2(e,t,n){const s=t.style;if(!s)return;const i=window.getComputedStyle(e);i.cssText?(s.cssText=i.cssText,s.transformOrigin=i.transformOrigin):ik(n).forEach(a=>{let u=i.getPropertyValue(a);a==="font-size"&&u.endsWith("px")&&(u=`${Math.floor(parseFloat(u.substring(0,u.length-2)))-.1}px`),an(e,HTMLIFrameElement)&&a==="display"&&u==="inline"&&(u="block"),a==="d"&&t.getAttribute("d")&&(u=`path(${t.getAttribute("d")})`),s.setProperty(a,u,i.getPropertyPriority(a))})}function b2(e,t){an(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),an(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function _2(e,t){if(an(e,HTMLSelectElement)){const s=Array.from(t.children).find(i=>e.value===i.getAttribute("value"));s&&s.setAttribute("selected","")}}function R2(e,t,n){return an(t,Element)&&(C2(e,t,n),f2(e,t,n),b2(e,t),_2(e,t)),t}async function E2(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const s={};for(let a=0;a<n.length;a++){const f=n[a].getAttribute("xlink:href");if(f){const d=e.querySelector(f),h=document.querySelector(f);!d&&h&&!s[f]&&(s[f]=await uf(h,t,!0))}}const i=Object.values(s);if(i.length){const a="http://www.w3.org/1999/xhtml",u=document.createElementNS(a,"svg");u.setAttribute("xmlns",a),u.style.position="absolute",u.style.width="0",u.style.height="0",u.style.overflow="hidden",u.style.display="none";const f=document.createElementNS(a,"defs");u.appendChild(f);for(let d=0;d<i.length;d++)f.appendChild(i[d]);e.appendChild(u)}return e}async function uf(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(s=>S2(s,t)).then(s=>k2(e,s,t)).then(s=>R2(e,s,t)).then(s=>E2(s,t))}const ck=/url\((['"]?)([^'"]+?)\1\)/g,P2=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,I2=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function j2(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function N2(e){const t=[];return e.replace(ck,(n,s,i)=>(t.push(i),n)),t.filter(n=>!Jg(n))}async function M2(e,t,n,s,i){try{const a=n?Zj(t,n):t,u=tm(t);let f;return i||(f=await nm(a,u,s)),e.replace(j2(t),`$1${f}$3`)}catch{}return e}function T2(e,{preferredFontFormat:t}){return t?e.replace(I2,n=>{for(;;){const[s,,i]=P2.exec(n)||[];if(!i)return"";if(i===t)return`src: ${s};`}}):e}function fk(e){return e.search(ck)!==-1}async function dk(e,t,n){if(!fk(e))return e;const s=T2(e,n);return N2(s).reduce((a,u)=>a.then(f=>M2(f,u,t,n)),Promise.resolve(s))}async function ri(e,t,n){var s;const i=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(e);if(i){const a=await dk(i,null,n);return t.style.setProperty(e,a,t.style.getPropertyPriority(e)),!0}return!1}async function $2(e,t){await ri("background",e,t)||await ri("background-image",e,t),await ri("mask",e,t)||await ri("-webkit-mask",e,t)||await ri("mask-image",e,t)||await ri("-webkit-mask-image",e,t)}async function F2(e,t){const n=an(e,HTMLImageElement);if(!(n&&!Jg(e.src))&&!(an(e,SVGImageElement)&&!Jg(e.href.baseVal)))return;const s=n?e.src:e.href.baseVal,i=await nm(s,tm(s),t);await new Promise((a,u)=>{e.onload=a,e.onerror=t.onImageErrorHandler?(...d)=>{try{a(t.onImageErrorHandler(...d))}catch(h){u(h)}}:u;const f=e;f.decode&&(f.decode=a),f.loading==="lazy"&&(f.loading="eager"),n?(e.srcset="",e.src=i):e.href.baseVal=i})}async function L2(e,t){const s=ms(e.childNodes).map(i=>hk(i,t));await Promise.all(s).then(()=>e)}async function hk(e,t){an(e,Element)&&(await $2(e,t),await F2(e,t),await L2(e,t))}function O2(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const s=t.style;return s!=null&&Object.keys(s).forEach(i=>{n[i]=s[i]}),e}const cS={};async function fS(e){let t=cS[e];if(t!=null)return t;const s=await(await fetch(e)).text();return t={url:e,cssText:s},cS[e]=t,t}async function dS(e,t){let n=e.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,a=(n.match(/url\([^)]+\)/g)||[]).map(async u=>{let f=u.replace(s,"$1");return f.startsWith("https://")||(f=new URL(f,e.url).href),lk(f,t.fetchRequestInit,({result:d})=>(n=n.replace(u,`url(${d})`),[u,d]))});return Promise.all(a).then(()=>n)}function hS(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let s=e.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const d=i.exec(s);if(d===null)break;t.push(d[0])}s=s.replace(i,"");const a=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,u="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",f=new RegExp(u,"gi");for(;;){let d=a.exec(s);if(d===null){if(d=f.exec(s),d===null)break;a.lastIndex=f.lastIndex}else f.lastIndex=a.lastIndex;t.push(d[0])}return t}async function A2(e,t){const n=[],s=[];return e.forEach(i=>{if("cssRules"in i)try{ms(i.cssRules||[]).forEach((a,u)=>{if(a.type===CSSRule.IMPORT_RULE){let f=u+1;const d=a.href,h=fS(d).then(m=>dS(m,t)).then(m=>hS(m).forEach(p=>{try{i.insertRule(p,p.startsWith("@import")?f+=1:i.cssRules.length)}catch(x){console.error("Error inserting rule from remote css",{rule:p,error:x})}})).catch(m=>{console.error("Error loading remote css",m.toString())});s.push(h)}})}catch(a){const u=e.find(f=>f.href==null)||document.styleSheets[0];i.href!=null&&s.push(fS(i.href).then(f=>dS(f,t)).then(f=>hS(f).forEach(d=>{u.insertRule(d,u.cssRules.length)})).catch(f=>{console.error("Error loading remote stylesheet",f)})),console.error("Error inlining remote css file",a)}}),Promise.all(s).then(()=>(e.forEach(i=>{if("cssRules"in i)try{ms(i.cssRules||[]).forEach(a=>{n.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${i.href}`,a)}}),n))}function D2(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>fk(t.style.getPropertyValue("src")))}async function z2(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=ms(e.ownerDocument.styleSheets),s=await A2(n,t);return D2(s)}function gk(e){return e.trim().replace(/["']/g,"")}function U2(e){const t=new Set;function n(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(a=>{t.add(gk(a))}),Array.from(s.children).forEach(a=>{a instanceof HTMLElement&&n(a)})}return n(e),t}async function V2(e,t){const n=await z2(e,t),s=U2(e);return(await Promise.all(n.filter(a=>s.has(gk(a.style.fontFamily))).map(a=>{const u=a.parentStyleSheet?a.parentStyleSheet.href:null;return dk(a.cssText,u,t)}))).join(`
|
|
59
|
+
`)}async function B2(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await V2(e,t);if(n){const s=document.createElement("style"),i=document.createTextNode(n);s.appendChild(i),e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}}async function q2(e,t={}){const{width:n,height:s}=ak(e,t),i=await uf(e,t,!0);return await B2(i,t),await hk(i,t),O2(i,t),await a2(i,n,s)}async function pk(e,t={}){const{width:n,height:s}=ak(e,t),i=await q2(e,t),a=await Tc(i),u=document.createElement("canvas"),f=u.getContext("2d"),d=t.pixelRatio||r2(),h=t.canvasWidth||n,m=t.canvasHeight||s;return u.width=h*d,u.height=m*d,t.skipAutoScale||s2(u),u.style.width=`${h}`,u.style.height=`${m}`,t.backgroundColor&&(f.fillStyle=t.backgroundColor,f.fillRect(0,0,u.width,u.height)),f.drawImage(a,0,0,u.width,u.height),u}async function H2(e,t={}){return(await pk(e,t)).toDataURL()}async function W2(e,t={}){const n=await pk(e,t);return await o2(n)}const mk="#0a0a0a";async function yk(){try{await document.fonts.ready}catch{}await new Promise(e=>requestAnimationFrame(()=>e(null)))}async function G2(e,t={}){return await yk(),H2(e,{pixelRatio:t.pixelRatio??2,backgroundColor:t.backgroundColor??mk,cacheBust:!0,skipFonts:!1})}function K2(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}async function Q2(e,t,n){K2(await G2(e,n),t)}async function J2(e,t){try{await yk();const n=await W2(e,{pixelRatio:(t==null?void 0:t.pixelRatio)??2,backgroundColor:(t==null?void 0:t.backgroundColor)??mk,cacheBust:!0});return!n||!navigator.clipboard||typeof ClipboardItem>"u"?!1:(await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),!0)}catch{return!1}}function Y2(e){const t=new Date,n=s=>String(s).padStart(2,"0");return`tokmon-${e}-${t.getFullYear()}${n(t.getMonth()+1)}${n(t.getDate())}-${n(t.getHours())}${n(t.getMinutes())}.png`}const rg=["▁","▂","▃","▄","▅","▆","▇","█"];function sl({data:e,color:t="var(--color-accent)",className:n=""}){const s=rg.length-1,i=Math.max(...e,0),a=Math.min(...e,0),u=i>0&&a===i;return y.jsx("span",{className:`font-mono leading-none ${n}`,style:{color:t},"aria-hidden":!0,children:e.length===0?"·":u?rg[Math.floor(s/2)].repeat(e.length):e.map(f=>rg[i<=0?0:Math.max(0,Math.min(s,Math.floor(f/i*(s+.999))))]).join("")})}function ec({label:e,value:t,sub:n,valueClass:s="text-fg-bright"}){return y.jsxs("div",{children:[y.jsx("div",{className:"font-display text-[10px] uppercase tracking-wide text-fg-faint",children:e}),y.jsx("div",{className:`tnum mt-1 text-xl ${s}`,children:t}),n!=null&&y.jsx("div",{className:"mt-0.5 text-xs text-fg-dim",children:n})]})}function X2({children:e}){return y.jsx("div",{className:"flex h-full min-h-24 items-center justify-center text-center text-xs text-fg-faint",children:e})}function $c({variant:e="footer",version:t}){return e==="corner"?y.jsxs("div",{className:"pointer-events-none absolute bottom-3 right-3 z-10 flex items-center gap-1.5 rounded bg-bg-0/60 px-2 py-1 font-display text-[11px] tracking-wide text-fg-faint backdrop-blur-sm",children:[y.jsx("span",{className:"text-accent",children:"●"})," tokmon"]}):y.jsxs("div",{className:"flex items-center gap-2 font-display text-sm tracking-wide",children:[y.jsx("span",{className:"text-accent",children:"●"}),y.jsx("span",{className:"text-fg-bright",children:"tokmon"}),y.jsxs("span",{className:"text-xs tracking-normal text-fg-faint",children:["github.com/DavidIlie/tokmon",t?` · v${t}`:""]})]})}const gS=e=>e==="all time"?"all time":`last ${e}`,Z2=z.forwardRef(function({derived:t,periodLabel:n,tz:s,version:i,opts:a},u){const f=t.byModel.slice(0,5),d=t.totals.cost>0,h=m=>d?m.share:m.tokenShare;return y.jsxs("div",{ref:u,className:"relative flex flex-col",style:{width:1040,height:540,background:"var(--color-bg-0)",backgroundImage:a.glow?"radial-gradient(circle at 50% -10%, color-mix(in oklab, var(--color-accent) 16%, transparent), transparent 55%), radial-gradient(var(--color-line-faint) 1px, transparent 1px)":"radial-gradient(var(--color-line-faint) 1px, transparent 1px)",backgroundSize:a.glow?"100% 100%, 24px 24px":"24px 24px",fontFamily:"var(--font-mono)",color:"var(--color-fg)"},children:[y.jsxs("div",{className:"flex items-baseline gap-2 border-b border-line px-6 py-3.5",children:[y.jsx("span",{className:"font-display text-sm tracking-wide text-accent",children:"tokmon"}),y.jsxs("span",{className:"text-sm text-fg-dim",children:["usage · ",gS(n)]}),y.jsx("span",{className:"ml-auto text-xs text-fg-faint",children:s})]}),y.jsxs("div",{className:"flex flex-1 gap-9 px-9 py-7",children:[y.jsxs("div",{className:"flex w-[300px] shrink-0 flex-col",children:[y.jsx("div",{className:"font-display text-xs uppercase tracking-widest text-fg-faint",children:d?"total spend":"total tokens"}),y.jsx("div",{className:"tnum mt-1 text-cost",style:{fontSize:64,lineHeight:1},children:d?Ue(t.totals.cost):wn(t.totals.tokens)}),y.jsxs("div",{className:"mt-auto flex flex-col gap-3",children:[d?y.jsx(tc,{label:"tokens",value:wn(t.totals.tokens)}):y.jsx(tc,{label:"spend",value:Ue(t.totals.cost)}),y.jsx(tc,{label:"cache saved",value:Ue(t.totals.cacheSavings),className:"text-positive"}),y.jsx(tc,{label:"calls",value:bs(t.totals.calls)})]})]}),y.jsxs("div",{className:"flex flex-1 flex-col gap-2 border-l border-line pl-9",children:[y.jsxs("div",{className:"font-display text-xs uppercase tracking-widest text-fg-faint",children:["top models · ",gS(n)]}),f.length===0?y.jsx("div",{className:"flex flex-1 items-center text-sm text-fg-faint",children:"no model usage in range"}):f.map(m=>y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("span",{className:"size-2 shrink-0 rounded-[2px]",style:{background:m.color}}),y.jsx("span",{className:"w-28 shrink-0 truncate text-sm text-fg",children:Or(m.model)}),y.jsx("span",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-bg-3",children:y.jsx("span",{className:"block h-full rounded-full",style:{width:`${Math.min(100,h(m)*100)}%`,minWidth:2,background:m.color}})}),y.jsx("span",{className:"tnum w-10 shrink-0 text-right text-xs text-fg-faint",children:Z1(h(m))}),y.jsx("span",{className:"tnum w-20 shrink-0 text-right text-sm text-cost",children:d?Ue(m.cost):wn(m.tokens)})]},m.model))]})]}),y.jsx("div",{className:"border-t border-line px-9 pt-3",children:y.jsx(sl,{data:t.timeline.map(m=>m.total),color:"var(--color-accent)",className:"text-2xl tracking-tight"})}),y.jsxs("div",{className:"flex items-center justify-between border-t border-line px-9 py-3.5",children:[a.wmPos==="footer"?y.jsx($c,{variant:"footer",version:i}):y.jsx("span",{className:"text-xs text-fg-faint",children:"tokmon"}),y.jsx("span",{className:"text-xs text-fg-faint",children:n})]}),a.wmPos==="corner"&&y.jsx($c,{variant:"corner"})]})});function tc({label:e,value:t,className:n="text-fg-bright"}){return y.jsxs("div",{children:[y.jsx("div",{className:"text-[11px] uppercase tracking-wide text-fg-faint",children:e}),y.jsx("div",{className:`tnum mt-1 truncate text-xl ${n}`,children:t})]})}const eN=z.forwardRef(function({node:t,title:n,framed:s,wmPos:i},a){const u=z.useRef(null);return z.useEffect(()=>{const f=u.current;if(!f)return;f.innerHTML="";const d=t.cloneNode(!0);return d.querySelectorAll("[data-chrome]").forEach(h=>h.remove()),d.style.width=`${Math.round(t.getBoundingClientRect().width)}px`,d.classList.remove("hover:border-line-2"),f.appendChild(d),()=>{f.innerHTML=""}},[t]),y.jsxs("div",{ref:a,className:"relative",style:{background:"var(--color-bg-0)",backgroundImage:"radial-gradient(var(--color-line-faint) 1px, transparent 1px)",backgroundSize:"24px 24px",padding:s?28:16,fontFamily:"var(--font-mono)"},children:[s&&y.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[y.jsx("span",{className:"font-display text-xs tracking-wide text-accent",children:"tokmon"}),y.jsxs("span",{className:"font-display text-xs uppercase tracking-wider text-fg-dim",children:["/ ",n]})]}),y.jsx("div",{ref:u}),i==="footer"?y.jsx("div",{className:"mt-3 flex justify-end",children:y.jsx($c,{variant:"footer"})}):y.jsx($c,{variant:"corner"})]})}),tN=600,pS=360,nN=e=>e==="light"?"#f4f5f5":"#0a0a0a";function rN({source:e,onClose:t}){const n=e.kind==="summary",s=z.useRef(null),i=z.useRef(null),a=z.useRef(null),u=z.useRef(),[f,d]=z.useState(()=>document.documentElement.classList.contains("light")?"light":"dark"),[h,m]=z.useState(n?"footer":"corner"),[p,x]=z.useState("2"),[v,w]=z.useState(!0),[k,b]=z.useState(!0),[_,E]=z.useState({w:n?1040:700,h:n?540:360}),[j,R]=z.useState(null);z.useEffect(()=>{var P;const te=document.activeElement;(P=i.current)==null||P.focus();const ae=H=>{if(H.key==="Escape"){t();return}if(H.key!=="Tab"||!a.current)return;const X=a.current.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])');if(X.length===0)return;const K=X[0],q=X[X.length-1];H.shiftKey&&document.activeElement===K?(H.preventDefault(),q.focus()):!H.shiftKey&&document.activeElement===q&&(H.preventDefault(),K.focus())};return document.addEventListener("keydown",ae),()=>{var H;document.removeEventListener("keydown",ae),(H=te==null?void 0:te.focus)==null||H.call(te)}},[t]),z.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const T=te=>{R(te),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>R(null),1600)};z.useEffect(()=>{const te=s.current;if(!te)return;const ae=()=>E({w:te.offsetWidth||_.w,h:te.offsetHeight||_.h});ae();const P=new ResizeObserver(ae);P.observe(te);const H=setTimeout(ae,80);return()=>{P.disconnect(),clearTimeout(H)}},[e,k,h,f,v]);const O=Math.min(tN/_.w,pS/_.h,1),$={pixelRatio:Number(p),backgroundColor:nN(f)},U=Y2(n?"summary":e.captureName),V=async()=>{s.current&&(await Q2(s.current,U,$),T("dl"))},Z=async()=>{s.current&&T(await J2(s.current,$)?"copy":"fail")};return y.jsx("div",{className:"dialog-fade fixed inset-0 z-[60] flex items-center justify-center bg-bg-0/70 p-4 backdrop-blur-sm",onMouseDown:te=>{te.target===te.currentTarget&&t()},role:"dialog","aria-modal":"true","aria-label":"Share",children:y.jsxs("div",{ref:a,className:"dialog-pop relative flex max-h-[88vh] w-full max-w-[720px] flex-col overflow-hidden rounded-md border border-line-2 bg-bg-1",children:[y.jsx("div",{className:"pointer-events-none absolute left-3 top-2 font-display text-[11px] uppercase tracking-wider text-fg-dim",children:"share"}),y.jsx("button",{type:"button",onClick:t,"aria-label":"Close",className:"absolute right-2 top-2 z-10 rounded p-1 text-fg-faint transition hover:text-fg focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",children:y.jsx(xi,{className:"size-4"})}),y.jsx("div",{className:"flex items-center justify-center bg-bg-0 px-6 pb-5 pt-9",style:{minHeight:pS+24},children:y.jsx("div",{className:"overflow-hidden rounded",style:{width:_.w*O,height:_.h*O},children:y.jsx("div",{style:{width:_.w,height:_.h,transform:`scale(${O})`,transformOrigin:"top left"},children:y.jsx("div",{className:f==="light"?"light":"dark",children:n?y.jsx(Z2,{ref:s,derived:e.derived,periodLabel:e.periodLabel,tz:e.tz,version:e.version,opts:{glow:v,wmPos:h}}):y.jsx(eN,{ref:s,node:e.node,title:e.captureName,framed:k,wmPos:h})})})})}),y.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-line px-4 py-3 text-[11px]",children:[y.jsx(_a,{label:"theme",children:y.jsx(Sn,{size:"xs",containerClassName:ba,ariaLabel:"export theme",options:[{value:"dark",label:"dark"},{value:"light",label:"light"}],value:f,onChange:d})}),y.jsx(_a,{label:"mark",children:y.jsx(Sn,{size:"xs",containerClassName:ba,ariaLabel:"watermark position",options:[{value:"footer",label:"footer"},{value:"corner",label:"corner"}],value:h,onChange:m})}),n?y.jsx(_a,{label:"glow",children:y.jsx(Sn,{size:"xs",containerClassName:ba,ariaLabel:"accent glow",options:[{value:"on",label:"on"},{value:"off",label:"off"}],value:v?"on":"off",onChange:te=>w(te==="on")})}):y.jsx(_a,{label:"frame",children:y.jsx(Sn,{size:"xs",containerClassName:ba,ariaLabel:"frame",options:[{value:"framed",label:"framed"},{value:"bare",label:"bare"}],value:k?"framed":"bare",onChange:te=>b(te==="framed")})}),y.jsx(_a,{label:"scale",children:y.jsx(Sn,{size:"xs",containerClassName:ba,ariaLabel:"export scale",options:[{value:"1",label:"1x"},{value:"2",label:"2x"},{value:"3",label:"3x"}],value:p,onChange:x})}),y.jsxs("span",{className:"ml-auto tnum text-fg-faint",children:[_.w," × ",_.h," · ",p,"x"]})]}),y.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-line px-4 py-3",children:[y.jsxs("button",{type:"button",onClick:Z,className:"flex items-center gap-1.5 rounded border border-line bg-bg-1 px-3 py-1.5 text-xs text-fg-dim transition hover:border-line-2 hover:text-fg active:scale-[0.97] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",children:[j==="copy"?y.jsx(yi,{className:"size-3.5 text-positive"}):j==="fail"?y.jsx(xi,{className:"size-3.5 text-warning"}):y.jsx(Bj,{className:"size-3.5"})," ",j==="copy"?"copied":j==="fail"?"copy failed":"copy"]}),y.jsxs("button",{type:"button",ref:i,onClick:V,className:"flex items-center gap-1.5 rounded border border-accent/60 bg-bg-1 px-3 py-1.5 text-xs text-accent transition hover:bg-bg-2 active:scale-[0.97] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",children:[j==="dl"?y.jsx(yi,{className:"size-3.5 text-positive"}):y.jsx(qj,{className:"size-3.5"})," download PNG"]})]})]})})}const ba="flex items-center overflow-hidden rounded border border-line text-[10px]";function _a({label:e,children:t}){return y.jsxs("span",{className:"flex items-center gap-1.5",children:[y.jsx("span",{className:"text-fg-faint",children:e}),t]})}const xk=z.createContext(()=>{}),vk=()=>z.useContext(xk);function sN({children:e}){const[t,n]=z.useState(null);return y.jsxs(xk.Provider,{value:n,children:[e,t&&y.jsx(rN,{source:t,onClose:()=>n(null)})]})}function oN({derived:e,periodLabel:t,tz:n,version:s}){const i=vk();return y.jsxs("button",{type:"button",onClick:()=>i({kind:"summary",derived:e,periodLabel:t,tz:n,version:s}),className:"flex items-center gap-1.5 rounded border border-line bg-bg-1 px-2.5 py-1 text-xs text-fg-dim transition hover:border-accent/60 hover:text-accent active:scale-[0.97] max-sm:py-2",title:"Create a shareable image",children:[y.jsx(Hj,{className:"size-3.5"}),y.jsx("span",{children:"share"})]})}const za=["claude","codex","cursor","copilot","pi","opencode","antigravity","gemini"],Ra={interval:2,billingInterval:5,clearScreen:!0,timezone:null,accounts:[],activeAccountId:null,disabledProviders:[],onboarded:!1,dashboardLayout:"grid",defaultFocus:"all",ascii:"auto",knownProviders:[]},iN=["claude","codex","cursor"],sg=["cyan","magenta","green","yellow","blue","red"],ol=[...za],aN=["cyan","magenta","green","yellow","blue","red","cyanBright","magentaBright","greenBright"],oo={claude:{name:"Claude",color:"green"},codex:{name:"Codex",color:"cyan"},cursor:{name:"Cursor",color:"magenta"},copilot:{name:"Copilot",color:"white"},pi:{name:"Pi",color:"blue"},opencode:{name:"opencode",color:"yellow"},antigravity:{name:"Antigravity",color:"red"},gemini:{name:"Gemini",color:"greenBright"}};function lN(e,t=ol.filter(s=>!e.disabledProviders.includes(s)),n){const s=new Set(t),i=new Set,a=new Set,u=new Set,f=new Set,d=[],h=(p,x)=>`${p}:${x&&x!=="~"?x:"~"}`,m=p=>{u.add(p.id),f.add(h(p.providerId,p.homeDir)),d.push(p)};if(e.accounts.forEach((p,x)=>{const v=oo[p.providerId];i.add(p.id),a.add(h(p.providerId,p.homeDir)),m({id:p.id,providerId:p.providerId,name:p.name,homeDir:p.homeDir||"~",color:p.color||v.color,source:"configured",explicitId:p.id,explicitIndex:x})}),n)for(const p of n){if(e.disabledProviders.includes(p.providerId))continue;const x=h(p.providerId,p.homeDir);if(i.has(p.id)||a.has(x)||u.has(p.id)||f.has(x))continue;const v=oo[p.providerId];m({id:p.id,providerId:p.providerId,name:p.name,homeDir:p.homeDir||"~",color:p.color||v.color,source:"auto"})}for(const p of ol){if(e.disabledProviders.includes(p)||!s.has(p))continue;const x=h(p,"~");if(i.has(p)||a.has(x)||u.has(p)||f.has(x))continue;const v=oo[p];m({id:p,providerId:p,name:v.name,homeDir:"~",color:v.color,source:"auto"})}return d}function mS(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=n?e:t}function Sk(e){try{return new Intl.DateTimeFormat("en-CA",{timeZone:e}),!0}catch{return!1}}function rm(e){try{const t=(Array.isArray(e.accounts)?e.accounts:[]).map(n=>({...n,providerId:n.providerId??"claude"})).filter(n=>typeof(n==null?void 0:n.id)=="string"&&typeof(n==null?void 0:n.name)=="string"&&za.includes(n.providerId));return{...Ra,interval:mS(e.interval,Ra.interval,1),billingInterval:mS(e.billingInterval,Ra.billingInterval,1),clearScreen:typeof e.clearScreen=="boolean"?e.clearScreen:Ra.clearScreen,timezone:typeof e.timezone=="string"&&e.timezone.trim()&&Sk(e.timezone.trim())?e.timezone:null,accounts:t,activeAccountId:typeof e.activeAccountId=="string"?e.activeAccountId:null,disabledProviders:(Array.isArray(e.disabledProviders)?e.disabledProviders:[]).filter(n=>za.includes(n)),onboarded:e.onboarded===!0,dashboardLayout:e.dashboardLayout==="single"?"single":"grid",defaultFocus:e.defaultFocus==="last"?"last":"all",ascii:e.ascii==="on"?"on":e.ascii==="off"?"off":"auto",knownProviders:Array.isArray(e.knownProviders)?e.knownProviders.filter(n=>za.includes(n)):e.onboarded===!0?[...iN]:[]}}catch{return{...Ra}}}function uN(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,48)}function wk(e,t){const n=uN(e)||"account",s=new Set(t.map(i=>i.id));if(!s.has(n))return n;for(let i=2;i<1e3;i++){const a=`${n}_${i}`;if(!s.has(a))return a}return`${n}_${Date.now()}`}function cN(e){const t=new Set(e.map(n=>n.color).filter(Boolean));for(const n of sg)if(!t.has(n))return n;return sg[e.length%sg.length]}function sm(e){return e?e.replace(/\x1b\][\s\S]*?(?:\x07|\x1b\\)/g,"").replace(/\x1b\[[0-?]*[ -/]*[@-~]/g,"").replace(/\x1bO./g,"").replace(/\x1b/g,"").replace(/[\x00-\x1f\x7f-\x9f]/g,"").replace(/\[20[01]~/g,""):""}const Lt=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let s=0,i=t.length;s<i;s++)n=t[s](n);return n}}},fN={pipe(){return Lt(this,arguments)}},cf=(function(){function e(){}return e.prototype=fN,e})(),re=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):n=>t(n,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(n,s){return arguments.length>=2?t(n,s):function(i){return t(i,n)}};case 3:return function(n,s,i){return arguments.length>=3?t(n,s,i):function(a){return t(a,n,s)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);const n=arguments;return function(s){return t(s,...n)}}}},_e=e=>e,_s=e=>()=>e,om=_s(!0),kk=_s(!1),ff=_s(void 0),wl=ff;function Ck(e,t,n,s,i,a,u,f,d){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return s(n(t(e.apply(this,arguments))))};case 5:return function(){return i(s(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(s(n(t(e.apply(this,arguments))))))};case 7:return function(){return u(a(i(s(n(t(e.apply(this,arguments)))))))};case 8:return function(){return f(u(a(i(s(n(t(e.apply(this,arguments))))))))};case 9:return function(){return d(f(u(a(i(s(n(t(e.apply(this,arguments)))))))))}}}function Rs(e){const t=new WeakMap;return n=>{if(t.has(n))return t.get(n);const s=e(n);return t.set(n,s),s}}const Yg=e=>{const t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete("stack");const n=Object.getPrototypeOf(e);let s=n;for(;s!==null&&s!==Object.prototype;){const i=Reflect.ownKeys(s);for(let a=0;a<i.length;a++)t.add(i[a]);s=Object.getPrototypeOf(s)}return t.has("constructor")&&typeof e.constructor=="function"&&n===e.constructor.prototype&&t.delete("constructor"),t},Xg=new WeakSet;function im(e){return typeof e=="string"}function bk(e){return typeof e=="number"}function dN(e){return typeof e=="boolean"}function df(e){return typeof e=="function"}function hN(e){return e!==void 0}function gN(e){return e!=null}function pN(e){return!1}function _k(e){return!0}function mN(e){return typeof e=="object"&&e!==null||df(e)}const De=re(2,(e,t)=>mN(e)&&t in e);function yN(e){return De(e,Symbol.iterator)||im(e)}const Yt="~effect/interfaces/Hash",dt=e=>{switch(typeof e){case"number":return am(e);case"bigint":return _t(e.toString(10));case"boolean":return _t(String(e));case"symbol":return _t(String(e));case"string":return _t(e);case"undefined":return _t("undefined");case"function":case"object":{if(e===null)return _t("null");if(e instanceof Date)return _t(e.toISOString());if(e instanceof RegExp)return _t(e.toString());{if(Xg.has(e))return Zg(e);if(ig.has(e))return ig.get(e);const t=kN(e,()=>xN(e)?e[Yt]():typeof e=="function"?Zg(e):Array.isArray(e)||ArrayBuffer.isView(e)?Rk(e):e instanceof Map?SN(e):e instanceof Set?wN(e):lm(e));return ig.set(e,t),t}}default:throw new Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Zg=e=>(og.has(e)||og.set(e,am(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),og.get(e)),Xn=re(2,(e,t)=>e*53^t),hf=e=>e&3221225471|e>>>1&1073741824,xN=e=>De(e,Yt),am=e=>{if(e!==e)return _t("NaN");if(e===1/0)return _t("Infinity");if(e===-1/0)return _t("-Infinity");let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return hf(t)},_t=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return hf(t)},vN=(e,t)=>{let n=12289;for(const s of t)n^=Xn(dt(s),dt(e[s]));return hf(n)},lm=e=>vN(e,Yg(e)),um=(e,t)=>n=>{let s=e;for(const i of n)s^=t(i);return hf(s)},Rk=um(6151,dt),SN=um(_t("Map"),([e,t])=>Xn(dt(e),dt(t))),wN=um(_t("Set"),dt),og=new WeakMap,ig=new WeakMap,ag=new WeakSet;function kN(e,t){if(ag.has(e))return _t("[Circular]");ag.add(e);const n=t();return ag.delete(e),n}const Xt="~effect/interfaces/Equal";function kn(){return arguments.length===1?e=>ho(e,arguments[0]):ho(arguments[0],arguments[1])}function ho(e,t){if(e===t)return!0;if(e==null||t==null)return!1;const n=typeof e;return n!==typeof t?!1:n==="number"&&e!==e&&t!==t?!0:n!=="object"&&n!=="function"||Xg.has(e)||Xg.has(t)?!1:_N(e,t,bN)}function CN(e,t,n){const s=lg.has(e),i=ug.has(t);if(s&&i)return!0;if(s||i)return!1;lg.add(e),ug.add(t);const a=n();return lg.delete(e),ug.delete(t),a}const lg=new WeakSet,ug=new WeakSet;function bN(e,t){if(dt(e)!==dt(t))return!1;if(e instanceof Date)return t instanceof Date?e.toISOString()===t.toISOString():!1;if(e instanceof RegExp)return t instanceof RegExp?e.toString()===t.toString():!1;const n=yS(e),s=yS(t);if(n!==s)return!1;const i=n&&s;return typeof e=="function"&&!i?!1:CN(e,t,()=>i?e[Xt](t):Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:RN(e,t):ArrayBuffer.isView(e)?!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength?!1:EN(e,t):e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:jN(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:MN(e,t):PN(e,t))}function _N(e,t,n){let s=nc.get(e);if(!s)s=new WeakMap,nc.set(e,s);else if(s.has(t))return s.get(t);const i=n(e,t);s.set(t,i);let a=nc.get(t);return a||(a=new WeakMap,nc.set(t,a)),a.set(e,i),i}const nc=new WeakMap;function RN(e,t){for(let n=0;n<e.length;n++)if(!ho(e[n],t[n]))return!1;return!0}function EN(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function PN(e,t){const n=Yg(e),s=Yg(t);if(n.size!==s.size)return!1;for(const i of n)if(!s.has(i)||!ho(e[i],t[i]))return!1;return!0}function IN(e,t){return function(s,i){for(const[a,u]of s){let f=!1;for(const[d,h]of i)if(e(a,d)&&t(u,h)){f=!0;break}if(!f)return!1}return!0}}const jN=IN(ho,ho);function NN(e){return function(n,s){for(const i of n){let a=!1;for(const u of s)if(e(i,u)){a=!0;break}if(!a)return!1}return!0}}const MN=NN(ho),yS=e=>De(e,Xt),TN=()=>kn,$N=e=>(t,n)=>t===n||e(t,n),FN=(e,t)=>e===t,LN=()=>FN;function ON(e){return $N((t,n)=>{if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++)if(!e(t[s],n[s]))return!1;return!0})}const Ek=e=>e.length>0,gf=Symbol.for("~effect/Redactable"),AN=e=>De(e,gf);function pf(e){return AN(e)?Pk(e):e}function Pk(e){var t;return e[gf](((t=globalThis[Ua])==null?void 0:t.context)??DN)}const Ua="~effect/Fiber/currentFiber",DN={"~effect/Context":{},mapUnsafe:new Map,pipe(){return Lt(this,arguments)}};function vt(e,t){const n=(t==null?void 0:t.space)??0,s=new WeakSet,i=n?typeof n=="number"?" ".repeat(n):n:"",a=h=>i.repeat(h),u=(h,m)=>{const p=h==null?void 0:h.constructor;return p&&p!==Object.prototype.constructor&&p.name?`${p.name}(${m})`:m},f=h=>{try{return Reflect.ownKeys(h)}catch{return["[ownKeys threw]"]}};function d(h,m=0){if(Array.isArray(h)){if(s.has(h))return xS;if(s.add(h),!i||h.length<=1)return`[${h.map(x=>d(x,m)).join(",")}]`;const p=h.map(x=>d(x,m+1)).join(`,
|
|
60
|
+
`+a(m+1));return`[
|
|
61
|
+
${a(m+1)}${p}
|
|
62
|
+
${a(m)}]`}if(h instanceof Date)return UN(h);if(!(t!=null&&t.ignoreToString)&&De(h,"toString")&&typeof h.toString=="function"&&h.toString!==Object.prototype.toString&&h.toString!==Array.prototype.toString){const p=VN(h);return h instanceof Error&&h.cause?`${p} (cause: ${d(h.cause,m)})`:p}if(typeof h=="string")return JSON.stringify(h);if(typeof h=="number"||h==null||typeof h=="boolean"||typeof h=="symbol")return String(h);if(typeof h=="bigint")return String(h)+"n";if(typeof h=="object"||typeof h=="function"){if(s.has(h))return xS;if(s.add(h),gf in h)return vt(Pk(h));if(Symbol.iterator in h)return`${h.constructor.name}(${d(Array.from(h),m)})`;const p=f(h);if(!i||p.length<=1){const v=`{${p.map(w=>`${Fc(w)}:${d(h[w],m)}`).join(",")}}`;return u(h,v)}const x=`{
|
|
63
|
+
${p.map(v=>`${a(m+1)}${Fc(v)}: ${d(h[v],m+1)}`).join(`,
|
|
64
|
+
`)}
|
|
65
|
+
${a(m)}}`;return u(h,x)}return String(h)}return d(e,0)}const xS="[Circular]";function Fc(e){return typeof e=="string"?JSON.stringify(e):String(e)}function zN(e){return e.map(t=>`[${Fc(t)}]`).join("")}function UN(e){try{return e.toISOString()}catch{return"Invalid Date"}}function VN(e){try{const t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function Ik(e,t){let n=[];const s=JSON.stringify(e,(i,a)=>typeof a=="object"&&a!==null?n.includes(a)?void 0:n.push(a)&&pf(a):a,t==null?void 0:t.space);return n=void 0,s}const go=Symbol.for("nodejs.util.inspect.custom"),kl=e=>{try{if(De(e,"toJSON")&&df(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(kl)}catch{return"[toJSON threw]"}return pf(e)},BN=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?qN(e,t):String(e)}catch{return String(e)}},qN=(e,t)=>{let n=[];const s=JSON.stringify(e,(i,a)=>typeof a=="object"&&a!==null?n.includes(a)?void 0:n.push(a)&&pf(a):a,t);return n=void 0,s},vS={toJSON(){return kl(this)},[go](){return this.toJSON()},toString(){return vt(this.toJSON())}};class mf{constructor(t){L(this,"called",!1);L(this,"self");this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new mf(this.self)}}const vi="~effect/Utils/internal",jk={[vi]:e=>e()},HN={[vi]:e=>{try{return e()}finally{}}};var Yw;const WN=((Yw=jk[vi](()=>new Error().stack))==null?void 0:Yw.includes(vi))===!0,Jt=WN?jk[vi]:HN[vi],Es="~effect/Effect",il="~effect/Exit",GN={_A:_e,_E:_e,_R:_e},Nk=`${Es}/identifier`,Ie=`${Es}/args`,It=`${Es}/evaluate`,Cn=`${Es}/successCont`,gr=`${Es}/failureCont`,po=`${Es}/ensureCont`,Js=Symbol.for("effect/Effect/Yield"),Ps={pipe(){return Lt(this,arguments)},toJSON(){return{...this}},toString(){return vt(this.toJSON(),{ignoreToString:!0,space:2})},[go](){return this.toJSON()}},yf={[Symbol.iterator](){return new mf(this)}},KN={...yf,pipe(){return Lt(this,arguments)}},QN={[Es]:GN,...Ps,[Symbol.iterator](){return new mf(this)},asEffect(){return this},toJSON(){return{_id:"Effect",op:this[Nk],...Ie in this?{args:this[Ie]}:void 0}}},Ht=e=>De(e,Es),Mk=e=>De(e,il),xc="~effect/Cause",vc="~effect/Cause/Reason",xf=e=>De(e,xc),JN=e=>De(e,vc);var Xw;class vo{constructor(t){L(this,Xw);L(this,"reasons");this[xc]=xc,this.reasons=t}pipe(){return Lt(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${vt(this.reasons)})`}[(Xw=xc,go)](){return this.toJSON()}[Xt](t){return xf(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((n,s)=>kn(n,t.reasons[s]))}[Yt](){return Rk(this.reasons)}}const SS=new WeakMap;var Zw;class cm{constructor(t,n,s){L(this,Zw);L(this,"annotations");L(this,"_tag");if(this[vc]=vc,this._tag=t,n!==vf&&typeof s=="object"&&s!==null&&n.size>0){const i=SS.get(s);i&&(n=new Map([...i,...n])),SS.set(s,n)}this.annotations=n}annotate(t,n){if(t.mapUnsafe.size===0)return this;const s=new Map(this.annotations);t.mapUnsafe.forEach((a,u)=>{(n==null?void 0:n.overwrite)!==!0&&s.has(u)||s.set(u,a)});const i=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return i.annotations=s,i}pipe(){return Lt(this,arguments)}toString(){return vt(this)}[(Zw=vc,go)](){return this.toString()}}const vf=new Map;class Tk extends cm{constructor(n,s=vf){super("Fail",s,n);L(this,"error");this.error=n}toString(){return`Fail(${vt(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[Xt](n){return fm(n)&&kn(this.error,n.error)&&kn(this.annotations,n.annotations)}[Yt](){return Xn(_t(this._tag))(Xn(dt(this.error))(dt(this.annotations)))}}const al=e=>new vo(e),YN=new vo([]),$k=e=>new vo([new Tk(e)]);class Fk extends cm{constructor(n,s=vf){super("Die",s,n);L(this,"defect");this.defect=n}toString(){return`Die(${vt(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[Xt](n){return ZN(n)&&kn(this.defect,n.defect)&&kn(this.annotations,n.annotations)}[Yt](){return Xn(_t(this._tag))(Xn(dt(this.defect))(dt(this.annotations)))}}const XN=e=>new vo([new Fk(e)]),ep=re(e=>xf(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new vo(e.reasons.map(s=>s.annotate(t,n)))),fm=e=>e._tag==="Fail",ZN=e=>e._tag==="Die",dm=e=>e._tag==="Interrupt";function eM(e){return Si("Effect.evaluate: Not implemented")}const Cl=e=>({...QN,[Nk]:e.op,[It]:e[It]??eM,[Cn]:e[Cn],[gr]:e[gr],[po]:e[po]}),rr=e=>{const t=Cl(e);return function(){const n=Object.create(t);return n[Ie]=e.single===!1?arguments:arguments[0],n}},Lk=e=>{const t={...Cl(e),[il]:il,_tag:e.op,get[e.prop](){return this[Ie]},toString(){return`${e.op}(${vt(this[Ie])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[Ie]}},[Xt](n){return Mk(n)&&n._tag===this._tag&&kn(this[Ie],n[Ie])},[Yt](){return Xn(_t(e.op),dt(this[Ie]))}};return function(n){const s=Object.create(t);return s[Ie]=n,s}},it=Lk({op:"Success",prop:"value",[It](e){const t=e.getCont(Cn);return t?t[Cn](this[Ie],e,this):e.yieldWith(this)}}),Sf={key:"effect/Cause/StackTrace"},tM={key:"effect/Cause/InterruptorStackTrace"},On=Lk({op:"Failure",prop:"cause",[It](e){let t=this[Ie],n=!1;e.currentStackFrame&&(t=ep(t,{mapUnsafe:new Map([[Sf.key,e.currentStackFrame]])}),n=!0);let s=e.getCont(gr);for(;e.interruptible&&e._interruptedCause&&s;)s=e.getCont(gr);return s?s[gr](t,e,n?void 0:this):e.yieldWith(n?this:On(t))}}),yr=e=>On($k(e)),Si=e=>On(XN(e)),Ve=rr({op:"WithFiber",[It](e){return this[Ie](e)}}),nM=(function(){class e extends globalThis.Error{asEffect(){return yr(this)}}return Object.assign(e.prototype,KN),e})(),Ok=(function(){const e=Symbol.for("effect/Data/Error/plainArgs");return class extends nM{constructor(n){super(n==null?void 0:n.message,n!=null&&n.cause?{cause:n.cause}:void 0),n&&(Object.assign(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),hm=e=>{class t extends Ok{constructor(){super(...arguments);L(this,"_tag",e)}}return t.prototype.name=e,t},wS="~effect/Cause/NoSuchElementError";var e1,t1;class rM extends(t1=hm("NoSuchElementError"),e1=wS,t1){constructor(n){super({message:n});L(this,e1,wS)}}const ll="~effect/Cause/Done",sM=e=>De(e,ll),Ak={[ll]:ll,_tag:"Done",value:void 0},gm=e=>e===void 0?Ak:{[ll]:ll,_tag:"Done",value:e},oM=yr(Ak),iM=e=>e===void 0?oM:yr(gm(e)),Dk="~effect/data/Option",zk={[Dk]:{_A:e=>e},...Ps,...yf},Uk=Object.assign(Object.create(zk),{_tag:"Some",_op:"Some",[Xt](e){return Vk(e)&&qk(e)&&kn(this.value,e.value)},[Yt](){return Xn(dt(this._tag))(dt(this.value))},toString(){return`some(${vt(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:kl(this.value)}},asEffect(){return it(this.value)}});Object.defineProperty(Uk,"valueOrUndefined",{get(){return this.value}});const aM=dt("None"),lM=Object.assign(Object.create(zk),{_tag:"None",_op:"None",valueOrUndefined:void 0,[Xt](e){return Vk(e)&&Bk(e)},[Yt](){return aM},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}},asEffect(){return yr(new rM)}}),Vk=e=>De(e,Dk),Bk=e=>e._tag==="None",qk=e=>e._tag==="Some",uM=Object.create(lM),cM=e=>{const t=Object.create(Uk);return t.value=e,t},Hk="~effect/data/Result",Wk={[Hk]:{_A:e=>e,_E:e=>e},...Ps,...yf},fM=Object.assign(Object.create(Wk),{_tag:"Success",_op:"Success",[Xt](e){return Gk(e)&&Qk(e)&&kn(this.success,e.success)},[Yt](){return Xn(dt(this._tag))(dt(this.success))},toString(){return`success(${vt(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:kl(this.success)}},asEffect(){return it(this.success)}}),dM=Object.assign(Object.create(Wk),{_tag:"Failure",_op:"Failure",[Xt](e){return Gk(e)&&Kk(e)&&kn(this.failure,e.failure)},[Yt](){return Xn(dt(this._tag))(dt(this.failure))},toString(){return`failure(${vt(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:kl(this.failure)}},asEffect(){return yr(this.failure)}}),Gk=e=>De(e,Hk),Kk=e=>e._tag==="Failure",Qk=e=>e._tag==="Success",hM=e=>{const t=Object.create(dM);return t.failure=e,t},gM=e=>{const t=Object.create(fM);return t.success=e,t};function pm(e){return(t,n)=>t===n?0:e(t,n)}const pM=pm((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),mM=re(2,(e,t)=>pm((n,s)=>e(t(n),t(s)))),yM=e=>re(2,(t,n)=>e(t,n)===1),xM=e=>re(2,(t,n)=>t===n||e(t,n)<1?t:n),vM=e=>re(2,(t,n)=>t===n||e(t,n)>-1?t:n),An=()=>uM,Me=cM,So=Bk,ks=qk,SM=re(2,(e,t)=>So(e)?t():e.value),Jk=SM(ff),mm=re(2,(e,t)=>So(e)?An():Me(t(e.value))),wM=re(2,(e,t)=>So(e)?An():t(e.value)?Me(e.value):An()),Dr=gM,Zn=hM,jt=Kk,kM=Qk,CM={[Symbol.iterator](){return bM}},bM={next(){return{done:!0,value:void 0}}},_M=()=>CM,RM=re(2,(e,t)=>Object.hasOwn(e,t)),EM=e=>Object.keys(e),PM=e=>re(2,(t,n)=>{for(const s of EM(t))if(!RM(n,s)||!e(t[s],n[s]))return!1;return!0}),IM=e=>{const t=PM(e);return(n,s)=>t(n,s)&&t(s,n)},kS=globalThis.Array,mr=e=>kS.isArray(e)?e:kS.from(e),Yk=re(2,(e,t)=>[...e,t]),jM=re(2,(e,t)=>mr(e).concat(mr(t))),CS=Ek,Lc=Ek;function NM(e,t){return e<0||e>=t.length}const MM=re(2,(e,t)=>{const n=Math.floor(t);if(NM(n,e))throw new Error(`Index out of bounds: ${n}`);return e[n]}),TM=MM(0),$M=e=>e.slice(1),FM=re(3,(e,t,n)=>{const s=mr(e),i=mr(t);return Lc(s)?Lc(i)?DM(n)(jM(s,i)):s:i}),LM=re(2,(e,t)=>FM(e,t,TN())),OM=()=>[],AM=re(2,(e,t)=>e.map(t)),DM=re(2,(e,t)=>{const n=mr(e);if(Lc(n)){const s=[TM(n)],i=$M(n);for(const a of i)s.every(u=>!t(a,u))&&s.push(a);return s}return[]}),bS="~effect/Context/Service",Un=function(){var i;const e=Error.stackTraceLimit;Error.stackTraceLimit=2;const t=new Error;Error.stackTraceLimit=e;function n(){}const s=n;return Object.setPrototypeOf(s,zM),Object.defineProperty(s,"stack",{get(){return t.stack}}),arguments.length>0?(s.key=arguments[0],(i=arguments[1])!=null&&i.defaultValue&&(s[Oc]=Oc,s.defaultValue=arguments[1].defaultValue),s):function(a,u){return s.key=a,u!=null&&u.make&&(s.make=u.make),s}},zM={[bS]:bS,...Ps,...yf,toJSON(){return{_id:"Service",key:this.key,stack:this.stack}},asEffect(){return(this.asEffect=_s(Ve(t=>it(io(t.context,this)))))()},of(e){return e},context(e){return wi(this,e)},use(e){return Ve(t=>e(io(t.context,this)))},useSync(e){return Ve(t=>it(e(io(t.context,this))))}},Oc="~effect/Context/Reference",Xk="~effect/Context",ys=e=>{const t=Object.create(UM);return t.mapUnsafe=e,t.mutable=!1,t},UM={...Ps,[Xk]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Xt](e){if(!Zk(e)||this.mapUnsafe.size!==e.mapUnsafe.size)return!1;for(const t of this.mapUnsafe.keys())if(!e.mapUnsafe.has(t)||!kn(this.mapUnsafe.get(t),e.mapUnsafe.get(t)))return!1;return!0},[Yt](){return am(this.mapUnsafe.size)}},Zk=e=>De(e,Xk),eC=e=>De(e,Oc),er=()=>VM,VM=ys(new Map),wi=(e,t)=>ys(new Map([[e.key,t]])),Is=re(3,(e,t,n)=>tC(e,s=>{s.set(t.key,n)})),BM=re(3,(e,t,n)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):eC(t)?kf(t):n()),wf=re(2,(e,t)=>{if(!e.mapUnsafe.has(t.key)){if(Oc in t)return kf(t);throw HM(t)}return e.mapUnsafe.get(t.key)}),io=wf,qM=(e,t)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):kf(t),cg="~effect/Context/defaultValue",kf=e=>cg in e?e[cg]:e[cg]=e.defaultValue(),HM=e=>{const t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(e.stack){const n=e.stack.split(`
|
|
66
|
+
`);if(n.length>2){const s=n[2].match(/at (.*)/);s&&(t.message=t.message+` (defined at ${s[1]})`)}}if(t.stack){const n=t.stack.split(`
|
|
67
|
+
`);n.splice(1,3),t.stack=n.join(`
|
|
68
|
+
`)}return t},WM=re(2,(e,t)=>e.mapUnsafe.has(t.key)?Me(e.mapUnsafe.get(t.key)):eC(t)?Me(kf(t)):An()),ki=re(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:tC(e,n=>{t.mapUnsafe.forEach((s,i)=>n.set(i,s))})),GM=(...e)=>{const t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((s,i)=>{t.set(i,s)});return ys(t)},tC=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;const n=new Map(e.mapUnsafe);return t(n),ys(n)},Xe=Un,Ac="~effect/time/Duration",KM=BigInt(0),nC=BigInt(1e3),QM=BigInt(1e6),JM=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,ym=e=>{switch(typeof e){case"number":return ul(e);case"bigint":return ES(e);case"string":{const t=JM.exec(e);if(!t)break;const[n,s,i]=t,a=Number(s);switch(i){case"nano":case"nanos":return ES(BigInt(s));case"micro":case"micros":return rT(BigInt(s));case"milli":case"millis":return ul(a);case"second":case"seconds":return sT(a);case"minute":case"minutes":return oT(a);case"hour":case"hours":return iT(a);case"day":case"days":return aT(a);case"week":case"weeks":return lT(a)}break}case"object":{if(e===null)break;if(Ac in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(bk)?_S(e):Number.isNaN(e[0])||Number.isNaN(e[1])?xm:e[0]===-1/0||e[1]===-1/0?nT:e[0]===1/0||e[1]===1/0?tT:ln(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));const t=e;let n=0;if(t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds)return ln(n);let s=BigInt(n)*QM;return t.microseconds&&(s+=BigInt(t.microseconds)*nC),t.nanoseconds&&(s+=BigInt(t.nanoseconds)),ln(s)}}return _S(e)},_S=e=>{throw new Error(`Invalid Input: ${e}`)},RS={_tag:"Millis",millis:0},YM={_tag:"Infinity"},XM={_tag:"NegativeInfinity"},ZM={[Ac]:Ac,[Yt](){return lm(this.value)},[Xt](e){return eT(e)&&hT(this,e)},toString(){switch(this.value._tag){case"Infinity":return"Infinity";case"NegativeInfinity":return"-Infinity";case"Nanos":return`${this.value.nanos} nanos`;case"Millis":return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",nanos:String(this.value.nanos)};case"Infinity":return{_id:"Duration",_tag:"Infinity"};case"NegativeInfinity":return{_id:"Duration",_tag:"NegativeInfinity"}}},[go](){return this.toJSON()},pipe(){return Lt(this,arguments)}},ln=e=>{const t=Object.create(ZM);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=RS:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:BigInt(Math.round(e*1e6))}:t.value=e>0?YM:XM:e===KM?t.value=RS:t.value={_tag:"Nanos",nanos:e},t},eT=e=>De(e,Ac),xm=ln(0),tT=ln(1/0),nT=ln(-1/0),ES=e=>ln(e),rT=e=>ln(e*nC),ul=e=>ln(e),sT=e=>ln(e*1e3),oT=e=>ln(e*6e4),iT=e=>ln(e*36e5),aT=e=>ln(e*864e5),lT=e=>ln(e*6048e5),rC=e=>uT(e,{onMillis:_e,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),PS=e=>{switch(e.value._tag){case"Infinity":case"NegativeInfinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return e.value.nanos;case"Millis":return BigInt(Math.round(e.value.millis*1e6))}},uT=re(2,(e,t)=>{switch(e.value._tag){case"Millis":return t.onMillis(e.value.millis);case"Nanos":return t.onNanos(e.value.nanos);case"Infinity":return t.onInfinity();case"NegativeInfinity":return(t.onNegativeInfinity??t.onInfinity)()}}),sC=re(3,(e,t,n)=>e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity"?n.onInfinity(e,t):e.value._tag==="Millis"?t.value._tag==="Millis"?n.onMillis(e.value.millis,t.value.millis):n.onNanos(PS(e),t.value.nanos):n.onNanos(e.value.nanos,PS(t))),oC=pm((e,t)=>sC(e,t,{onMillis:(n,s)=>n<s?-1:n>s?1:0,onNanos:(n,s)=>n<s?-1:n>s?1:0,onInfinity:(n,s)=>n.value._tag===s.value._tag?0:n.value._tag==="Infinity"?1:n.value._tag==="NegativeInfinity"||s.value._tag==="Infinity"?-1:1})),cT=(e,t)=>sC(e,t,{onMillis:(n,s)=>n===s,onNanos:(n,s)=>n===s,onInfinity:(n,s)=>n.value._tag===s.value._tag}),fT=xM(oC),dT=vM(oC),hT=re(2,(e,t)=>cT(e,t)),gT=e=>t=>!jt(e(t)),pT=e=>t=>t.has(e)?Dr(t):Zn(t),mT=re(2,(e,t)=>n=>{const s=e(n);return jt(s)?s:t(s.success)}),iC=re(2,(e,t)=>n=>{const s=e(n);if(jt(s))return Zn(n);const i=t(s.success);return jt(i)?Zn(n):i}),aC=Xe("effect/Scheduler",{defaultValue:()=>new uC}),lC="setImmediate"in globalThis?e=>{const t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{const t=setTimeout(e,0);return()=>clearTimeout(t)};class yT{constructor(){L(this,"buckets",[])}scheduleTask(t,n){const s=this.buckets,i=s.length;let a,u=0;for(;u<i&&!(s[u][0]>n);u++)a=s[u];a&&a[0]===n?a[1].push(t):u===i?s.push([n,[t]]):s.splice(u,0,[n,[t]])}drain(){const t=this.buckets;return this.buckets=[],t}}class uC{constructor(t="async",n=lC){L(this,"executionMode");L(this,"setImmediate");this.executionMode=t,this.setImmediate=n}shouldYield(t){return t.currentOpCount>=t.maxOpsBeforeYield}makeDispatcher(){return new xT(this.setImmediate)}}class xT{constructor(t=lC){L(this,"tasks",new yT);L(this,"running");L(this,"setImmediate");L(this,"afterScheduled",()=>{this.running=void 0,this.runTasks()});this.setImmediate=t}scheduleTask(t,n){this.tasks.scheduleTask(t,n),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}runTasks(){const t=this.tasks.drain();for(let n=0;n<t.length;n++){const s=t[n][1];for(let i=0;i<s.length;i++)s[i]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}}const vT=Xe("effect/Scheduler/MaxOpsBeforeYield",{defaultValue:()=>2048}),ST=Xe("effect/Scheduler/PreventSchedulerYield",{defaultValue:()=>!1}),cC="effect/Tracer/ParentSpan";class wT extends Un()(cC){}const kT=e=>e,tp=Xe("effect/Tracer/DisablePropagation",{defaultValue:kk}),CT=Xe("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),bT=Xe("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),fC="effect/Tracer",_T=Xe(fC,{defaultValue:()=>kT({span:e=>new RT(e)})});class RT{constructor(t){L(this,"_tag","Span");L(this,"spanId");L(this,"traceId","native");L(this,"sampled");L(this,"name");L(this,"parent");L(this,"annotations");L(this,"links");L(this,"startTime");L(this,"kind");L(this,"status");L(this,"attributes");L(this,"events",[]);var n;this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.startTime=t.startTime,this.kind=t.kind,this.sampled=t.sampled,this.status={_tag:"Started",startTime:t.startTime},this.attributes=new Map,this.traceId=((n=Jk(t.parent))==null?void 0:n.traceId)??IS(32),this.spanId=IS(16)}end(t,n){this.status={_tag:"Ended",endTime:t,exit:n,startTime:this.status.startTime}}attribute(t,n){this.attributes.set(t,n)}event(t,n,s){this.events.push([t,n,s??{}])}addLinks(t){this.links.push(...t)}}const IS=(function(){const e="abcdef0123456789",t=e.length;return function(n){let s="";for(let i=0;i<n;i++)s+=e.charAt(Math.floor(Math.random()*t));return s}})(),ET="effect/observability/Metric/FiberRuntimeMetricsKey",PT=Xe("effect/References/CurrentConcurrency",{defaultValue:()=>"unbounded"}),dC=Xe("effect/References/CurrentStackFrame",{defaultValue:ff}),IT=Xe("effect/References/TracerEnabled",{defaultValue:om}),hC=Xe("effect/References/TracerTimingEnabled",{defaultValue:om}),jT=Xe("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),NT=Xe("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),vm=Xe("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),MT=Xe("effect/References/CurrentLogLevel",{defaultValue:()=>"Info"}),TT=Xe("effect/References/MinimumLogLevel",{defaultValue:()=>"Info"}),$T=Xe("effect/References/CurrentLogSpans",{defaultValue:()=>[]}),FT=e=>{if((e==null?void 0:e.captureStackTrace)===!1)return e;if((e==null?void 0:e.captureStackTrace)!==void 0&&typeof e.captureStackTrace!="boolean")return e;const t=Error.stackTraceLimit;Error.stackTraceLimit=3;const n=new Error;return Error.stackTraceLimit=t,{...e,captureStackTrace:OT(()=>n.stack)}},LT=e=>t=>{let n;return()=>{if(n!==void 0)return n;const s=t();if(!s)return;const i=s.split(`
|
|
69
|
+
`);if(i[e]!==void 0)return n=i[e].trim(),n}},OT=LT(3),AT="dev";class gC extends cm{constructor(n,s=vf){super("Interrupt",s,"Interrupted");L(this,"fiberId");this.fiberId=n}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[Xt](n){return dm(n)&&this.fiberId===n.fiberId&&this.annotations===n.annotations}[Yt](){return Xn(_t(`${this._tag}:${this.fiberId}`))(Zg(this.annotations))}}const DT=e=>new gC(e),Sm=e=>new vo([new gC(e)]),zT=e=>{const t=e.reasons.find(fm);return t?Dr(t):Zn(e)},wo=e=>{for(let t=0;t<e.reasons.length;t++){const n=e.reasons[t];if(n._tag==="Fail")return Dr(n.error)}return Zn(e)},UT=e=>e.reasons.some(dm),wm=e=>{let t;for(let n=0;n<e.reasons.length;n++){const s=e.reasons[n];s._tag==="Interrupt"&&(t??(t=new Set),s.fiberId!==void 0&&t.add(s.fiberId))}return t?Dr(t):Zn(e)},VT=e=>{const t=wm(e);return jt(t)?BT:t.success},BT=new Set,qT=e=>e.reasons.length>0&&e.reasons.every(dm),HT=re(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;const n=new vo(LM(e.reasons,t.reasons));return kn(e,n)?e:n}),WT=e=>{const t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},km=e=>{const t=WT(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error("All fibers interrupted without error"):new globalThis.Error("Empty cause")},GT=e=>{const t=[],n=[];if(e.reasons.length===0)return t;const s=Error.stackTraceLimit;Error.stackTraceLimit=1;for(const i of e.reasons){if(i._tag==="Interrupt"){n.push(i);continue}t.push(np(i._tag==="Die"?i.defect:i.error,i.annotations))}if(t.length===0){const i=new Error("The fiber was interrupted by:");i.name="InterruptCause",i.stack=YT(i,n);const a=new globalThis.Error("All fibers interrupted without error",{cause:i});a.name="InterruptError",a.stack=`${a.name}: ${a.message}`,t.push(np(a,n[0].annotations))}return Error.stackTraceLimit=s,t},np=(e,t)=>{const n=typeof e;let s;if(e&&n==="object"){if(s=new globalThis.Error(KT(e),{cause:e.cause?np(e.cause):void 0}),typeof e.name=="string"&&(s.name=e.name),typeof e.stack=="string")s.stack=JT(e.stack,s,t);else{const i=`${s.name}: ${s.message}`;s.stack=t?pC(i,t):i}for(const i of Object.keys(e))i in s||(s[i]=e[i])}else s=new globalThis.Error(e?n==="string"?e:Ik(e):`Unknown error: ${e}`);return s},KT=e=>{if(typeof e.message=="string")return e.message;if(typeof e.toString=="function"&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Ik(e)},QT=/\((.*)\)/g,JT=(e,t,n)=>{const s=`${t.name}: ${t.message}`,i=(e.startsWith(s)?e.slice(s.length):e).split(`
|
|
70
|
+
`),a=[s];for(let u=1;u<i.length&&!/(?:Generator\.next|~effect\/Effect)/.test(i[u]);u++)a.push(i[u]);return n?pC(a.join(`
|
|
71
|
+
`),n):a.join(`
|
|
72
|
+
`)},pC=(e,t)=>{const n=t==null?void 0:t.get(Sf.key);return n&&(e=`${e}
|
|
73
|
+
${mC(n)}`),e},YT=(e,t)=>{const n=[`${e.name}: ${e.message}`];for(const s of t){const i=s.fiberId!==void 0?`#${s.fiberId}`:"unknown",a=s.annotations.get(tM.key);n.push(` at fiber (${i})`),a&&n.push(mC(a))}return n.join(`
|
|
74
|
+
`)},mC=e=>{const t=[];let n=e,s=0;for(;n&&s<10;){const i=n.stack();if(i){const a=i.matchAll(QT);let u=!1;for(const[,f]of a)u=!0,t.push(` at ${n.name} (${f})`);u||t.push(` at ${n.name} (${i.replace(/^at /,"")})`)}else t.push(` at ${n.name}`);n=n.parent,s++}return t.join(`
|
|
75
|
+
`)},yC=e=>GT(e).map(t=>t.cause?`${t.stack} {
|
|
76
|
+
${xC(t.cause," ")}
|
|
77
|
+
}`:t.stack).join(`
|
|
78
|
+
`),xC=(e,t)=>{const n=e.stack.split(`
|
|
79
|
+
`);let s=`${t}[cause]: ${n[0]}`;for(let i=1,a=n.length;i<a;i++)s+=`
|
|
80
|
+
${t}${n[i]}`;return e.cause&&(s+=` {
|
|
81
|
+
${xC(e.cause,`${t} `)}
|
|
82
|
+
${t}}`),s},rp=`~effect/Fiber/${AT}`,XT={_A:_e,_E:_e},ZT={id:0},Cm=()=>globalThis[Ua];var n1;n1=rp;class vC{constructor(t,n=!0){L(this,n1);L(this,"id");L(this,"interruptible");L(this,"currentOpCount");L(this,"currentLoopCount");L(this,"_stack");L(this,"_observers");L(this,"_exit");L(this,"_currentExit");L(this,"_children");L(this,"_interruptedCause");L(this,"_yielded");L(this,"context");L(this,"currentScheduler");L(this,"currentTracerContext");L(this,"currentSpan");L(this,"currentLogLevel");L(this,"minimumLogLevel");L(this,"currentStackFrame");L(this,"runtimeMetrics");L(this,"maxOpsBeforeYield");L(this,"currentPreventYield");L(this,"_dispatcher");this[rp]=XT,this.setContext(t),this.id=++ZT.id,this.currentOpCount=0,this.currentLoopCount=0,this.interruptible=n,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0}get currentDispatcher(){return this._dispatcher??(this._dispatcher=this.currentScheduler.makeDispatcher())}getRef(t){return qM(this.context,t)}addObserver(t){return this._exit?(t(this._exit),wl):(this._observers.push(t),()=>{const n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}interruptUnsafe(t,n){if(this._exit)return;let s=Sm(t);this.currentStackFrame&&(s=ep(s,wi(Sf,this.currentStackFrame))),n&&(s=ep(s,n)),this._interruptedCause=this._interruptedCause?HT(this._interruptedCause,s):s,this.interruptible&&this.evaluate(Ft(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(t){var s,i;if((s=this.runtimeMetrics)==null||s.recordFiberStart(this.context),this._exit)return;if(this._yielded!==void 0){const a=this._yielded;this._yielded=void 0,a()}const n=this.runLoop(t);if(n!==Js){this._exit=n,(i=this.runtimeMetrics)==null||i.recordFiberEnd(this.context,this._exit);for(let a=0;a<this._observers.length;a++)this._observers[a](n);this._observers.length=0}}runLoop(t){const n=globalThis[Ua];globalThis[Ua]=this;let s=!1,i=t;this.currentOpCount=0;const a=++this.currentLoopCount;try{for(;;){if(this.currentOpCount++,!s&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){s=!0;const u=i;i=Le(_m,()=>u)}if(i=this.currentTracerContext?this.currentTracerContext(i,this):i[It](this),a!==this.currentLoopCount)return Js;if(i===Js){const u=this._yielded;return il in u?(this._yielded=void 0,u):Js}}}catch(u){return De(i,It)?this.runLoop(Si(u)):Si(`Fiber.runLoop: Not a valid effect: ${String(i)}`)}finally{globalThis[Ua]=n}}getCont(t){for(;;){const n=this._stack.pop();if(!n)return;const s=n[po]&&n[po](this);if(s)return s[t]=s,s;if(n[t])return n}}yieldWith(t){return this._yielded=t,Js}children(){return this._children??(this._children=new Set)}pipe(){return Lt(this,arguments)}setContext(t){this.context=t;const n=this.getRef(aC);n!==this.currentScheduler&&(this.currentScheduler=n,this._dispatcher=void 0),this.currentSpan=t.mapUnsafe.get(cC),this.currentLogLevel=this.getRef(MT),this.minimumLogLevel=this.getRef(TT),this.currentStackFrame=t.mapUnsafe.get(dC.key),this.maxOpsBeforeYield=this.getRef(vT),this.currentPreventYield=this.getRef(ST),this.runtimeMetrics=t.mapUnsafe.get(ET);const s=t.mapUnsafe.get(fC);this.currentTracerContext=s?s.context:void 0}get currentSpanLocal(){var t;return((t=this.currentSpan)==null?void 0:t._tag)==="Span"?this.currentSpan:void 0}}const Cf=e=>{if(!e.currentStackFrame)return;const t=new Map;return t.set(Sf.key,e.currentStackFrame),ys(t)},SC=e=>{const t=e;return t._exit?Re(t._exit):sr(n=>t._exit?n(Re(t._exit)):yt(e.addObserver(s=>n(Re(s)))))},wC=e=>sr(t=>{const n=e[Symbol.iterator](),s=[];let i;function a(){let u=n.next();for(;!u.done;){if(u.value._exit){s.push(u.value._exit),u=n.next();continue}i=u.value.addObserver(f=>{s.push(f),a()});return}t(Re(s))}return a(),yt(()=>i==null?void 0:i())}),bm=e=>Ve(t=>e$(e,t.id)),e$=re(e=>De(e[0],rp),(e,t,n)=>Ve(s=>{let i=Cf(s);return i=i&&n?ki(i,n):i??n,e.interruptUnsafe(t,i),EC(SC(e))})),Dc=e=>Ve(t=>{const n=Cf(t);for(const s of e)s.interruptUnsafe(t.id,n);return EC(wC(e))}),Re=it,Ft=On,bf=yr,yt=rr({op:"Sync",[It](e){const t=this[Ie](),n=e.getCont(Cn);return n?n[Cn](t,e):e.yieldWith(it(t))}}),St=rr({op:"Suspend",[It](e){return this[Ie]()}}),t$=rr({op:"Yield",[It](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Dn)},this[Ie]??0),e.yieldWith(()=>{t=!0})}}),_m=t$(0),n$=e=>Re(Me(e)),r$=Re(An()),_f=e=>Si(e),kC=e=>St(()=>bf(Jt(e))),ot=Re(void 0),s$=e=>CC(function(t,n){Jt(()=>e(n)).then(s=>t(Re(s)),s=>t(_f(s)))},e.length!==0),o$=e=>Ve(t=>e(t.id)),CC=rr({op:"Async",single:!1,[It](e){const t=Jt(()=>this[Ie][0].bind(e.currentScheduler));let n=!1,s=!1;const i=this[Ie][1]?new AbortController:void 0,a=t(u=>{n||(n=!0,s?e.evaluate(u):s=u)},i==null?void 0:i.signal);return s!==!1?s:(s=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(i$(()=>(n=!0,i==null||i.abort(),a??Dn))),Js)}}),i$=rr({op:"AsyncFinalizer",[po](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Nf))},[gr](e,t){return UT(e)?Le(this[Ie](),()=>Ft(e)):Ft(e)}}),sr=e=>CC(e,e.length>=2),a$=sr(wl),l$=(...e)=>St(()=>cl(e.length===1?e[0]():e[1].call(e[0].self))),bC=(e,...t)=>{const n=t.length===0?function(){return St(()=>cl(e.apply(this,arguments)))}:function(){let s=St(()=>cl(e.apply(this,arguments)));for(let i=0;i<t.length;i++)s=t[i](s,...arguments);return s};return _C(e.length,n)},_C=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),u$=(e,...t)=>_C(e.length,t.length===0?function(){return jS(()=>e.apply(this,arguments))}:function(){let n=jS(()=>e.apply(this,arguments));for(const s of t)n=s(n);return n}),jS=e=>{try{const t=e();let n;for(;;){const s=t.next(n);if(s.done)return Re(s.value);const a=s.value.asEffect(),u=a;if(u&&u._tag==="Success"){n=u.value;continue}else{if(u&&u._tag==="Failure")return a;{let f=!0;return St(()=>f?(f=!1,Le(a,d=>cl(t,d))):St(()=>cl(e())))}}}}catch(t){return _f(t)}},cl=rr({op:"Iterator",single:!1,[Cn](e,t){const n=this[Ie][0];for(;;){const s=n.next(e);if(s.done)return Re(s.value);const i=s.value.asEffect();if(bn(i)){if(i._tag==="Failure")return i}else return t._stack.push(this),i;e=i.value}},[It](e){return this[Cn](this[Ie][1],e)}}),ji=re(2,(e,t)=>{const n=Re(t);return Le(e,s=>n)}),bl=re(2,(e,t)=>Le(e,n=>Ht(t)?t:Jt(()=>t(n)))),RC=re(2,(e,t)=>Le(e,n=>ji(Ht(t)?t:Jt(()=>t(n)),n))),EC=e=>Le(e,t=>Dn),c$=(e,t)=>Ve(n=>sr(s=>{let i=!1;const a=new Set,u=d=>{i=!0,s(a.size===0?d:Le(DC(Dc(a)),()=>d))};let f=0;for(const d of e){if(i)break;const h=f++,m=Tf(n,d,!0,!0,!1);a.add(m),m.addObserver(p=>{a.delete(m);const x=!i;u(p),x&&(t!=null&&t.onWinner)&&t.onWinner({fiber:m,index:h,parentFiber:n})})}return Dc(a)})),PC=re(e=>Ht(e[1]),(e,t,n)=>c$([e,t],n)),Le=re(2,(e,t)=>{const n=Object.create(f$);return n[Ie]=e,n[Cn]=t.length!==1?s=>t(s):t,n}),f$=Cl({op:"OnSuccess",[It](e){return e._stack.push(this),this[Ie]}}),bn=e=>il in e,d$=re(2,(e,t)=>bn(e)?e._tag==="Success"?t(e.value):e:Le(e,t)),h$=e=>Le(e,_e),xt=re(2,(e,t)=>Le(e,n=>Re(Jt(()=>t(n))))),g$=re(2,(e,t)=>bn(e)?w$(e,t):xt(e,t)),p$=re(2,(e,t)=>bn(e)?k$(e,t):F$(e,t)),m$=re(2,(e,t)=>bn(e)?C$(e,t):L$(e,t)),y$=re(2,(e,t)=>{if(bn(e)){if(e._tag==="Success")return e;const n=wo(e.cause);return jt(n)?e:t(n.success)}return Ef(e,t)}),x$=e=>On(Sm(e)),Rm=e=>e._tag==="Success",v$=e=>e._tag==="Failure",S$=e=>e._tag==="Failure"?Dr(e.cause):Zn(e),Dn=it(void 0),w$=re(2,(e,t)=>e._tag==="Success"?it(t(e.value)):e),k$=re(2,(e,t)=>{if(e._tag==="Success")return e;const n=wo(e.cause);return jt(n)?e:yr(t(n.success))}),C$=re(2,(e,t)=>{if(e._tag==="Success")return it(t.onSuccess(e.value));const n=wo(e.cause);return jt(n)?e:yr(t.onFailure(n.success))}),b$=re(2,(e,t)=>Rm(e)?t:e),_$=e=>{const t=[];for(const n of e)n._tag==="Failure"&&t.push(...n.cause.reasons);return t.length===0?Dn:On(al(t))},R$=e=>Rm(e)?Me(e.value):An(),E$=e=>Ve(t=>Re(WM(t.context,e))),Rf=re(2,(e,t)=>Ve(n=>{const s=n.context,i=t(s);return s===i?e:(n.setContext(i),AC(e,()=>{n.setContext(s)}))})),IC=re(3,(e,t,n)=>Rf(e,s=>{const i=wf(s,t),a=n(i);return i===a?s:Is(s,t,a)})),P$=()=>I$,I$=Ve(e=>Re(e.context)),jC=e=>Ve(t=>e(t.context)),_l=re(2,(e,t)=>bn(e)?e:Rf(e,ki(t))),Rl=function(){return arguments.length===1?re(2,(e,t)=>NS(e,arguments[0],t)):re(3,(e,t,n)=>NS(e,t,n)).apply(this,arguments)},NS=(e,t,n)=>Rf(e,s=>s.mapUnsafe.get(t.key)===n?s:Is(s,t,n)),NC=re(e=>Ht(e[1]),(e,t,n)=>j$(e,t,(s,i)=>[s,i],n)),j$=re(e=>Ht(e[1]),(e,t,n,s)=>s!=null&&s.concurrent?xt(sF([e,t],{concurrency:2}),([i,a])=>Jt(()=>n(i,a))):Le(e,i=>xt(t,a=>Jt(()=>n(i,a))))),N$=re(e=>Ht(e[0]),(e,t)=>jm({while:om,body:_s(t!=null&&t.disableYield?e:Le(e,n=>_m)),step:wl})),El=re(2,(e,t)=>{const n=Object.create(M$);return n[Ie]=e,n[gr]=t.length!==1?s=>t(s):t,n}),M$=Cl({op:"OnFailure",[It](e){return e._stack.push(this),this[Ie]}}),MC=re(3,(e,t,n)=>El(e,s=>{const i=t(s);return jt(i)?Ft(i.failure):Jt(()=>n(i.success,s))})),Ef=re(2,(e,t)=>MC(e,wo,n=>t(n))),T$=re(2,(e,t)=>El(e,n=>bl(Jt(()=>t(n)),Ft(n)))),$$=re(e=>Ht(e[0]),(e,t,n,s)=>El(e,i=>{const a=wo(i);if(jt(a))return Ft(a.failure);const u=t(a.success);return jt(u)?s?Jt(()=>s(u.failure)):Ft(i):Jt(()=>n(u.success))})),F$=re(2,(e,t)=>Ef(e,n=>kC(()=>t(n)))),L$=re(2,(e,t)=>Em(e,{onFailure:n=>kC(()=>t.onFailure(n)),onSuccess:n=>yt(()=>t.onSuccess(n))})),O$=e=>Ef(e,_f),A$=re(e=>Ht(e[0]),(e,t)=>{if(!(t!=null&&t.log))return Em(e,{onFailure:s=>ot,onSuccess:s=>ot});const n=ZC(t.log===!0?void 0:t.log);return Pf(e,{onFailure(s){const i=zT(s);return jt(i)?Ft(i.failure):t.message===void 0?n(s):n(t.message,s)},onSuccess:s=>ot})}),fg=e=>U$(e,{onFailure:Zn,onSuccess:Dr}),Pf=re(2,(e,t)=>{const n=Object.create(D$);return n[Ie]=e,n[Cn]=t.onSuccess.length!==1?s=>t.onSuccess(s):t.onSuccess,n[gr]=t.onFailure.length!==1?s=>t.onFailure(s):t.onFailure,n}),D$=Cl({op:"OnSuccessAndFailure",[It](e){return e._stack.push(this),this[Ie]}}),Em=re(2,(e,t)=>Pf(e,{onFailure:n=>{const s=n.reasons.find(fm);return s?Jt(()=>t.onFailure(s.error)):Ft(n)},onSuccess:t.onSuccess})),z$=re(2,(e,t)=>Em(e,{onFailure:n=>yt(()=>t.onFailure(n)),onSuccess:n=>yt(()=>t.onSuccess(n))})),U$=re(2,(e,t)=>{if(bn(e)){if(e._tag==="Success")return it(t.onSuccess(e.value));const n=wo(e.cause);return jt(n)?e:it(t.onFailure(n.success))}return z$(e,t)}),If=e=>bn(e)?it(e):V$(e),V$=rr({op:"Exit",[It](e){return e._stack.push(this),this[Ie]},[Cn](e,t,n){return Re(n??it(e))},[gr](e,t,n){return Re(n??On(e))}}),B$=re(2,(e,t)=>bl(Tm(t),e)),TC=re(2,(e,t)=>PC(e,Le(Tm(t.duration),t.orElse))),q$=re(2,(e,t)=>TC(e,{duration:t,orElse:()=>bf(new EF)})),MS="~effect/Scope",TS="~effect/Scope/Closeable",jf=Un("effect/Scope"),$C=(e,t)=>St(()=>FC(e,t)??ot),FC=(e,t)=>{if(e.state._tag==="Closed")return;const n={_tag:"Closed",exit:t};if(e.state._tag==="Empty"){e.state=n;return}const{finalizers:s}=e.state;if(e.state=n,s.size!==0)return s.size===1?s.values().next().value(t):H$(e,s,t)},H$=bC(function*(e,t,n){let s=[];const i=[],a=Array.from(t.values()),u=Cm();for(let f=a.length-1;f>=0;f--){const d=a[f];e.strategy==="sequential"?s.push(yield*If(d(n))):i.push(Tf(u,d(n),!0,!0,"inherit"))}return i.length>0&&(s=yield*wC(i)),yield*_$(s)}),W$=(e,t)=>{const n=Im(t);if(e.state._tag==="Closed")return n.state=e.state,n;const s={};return fl(e,s,i=>$C(n,i)),fl(n,s,i=>yt(()=>Pm(e,s))),n},Ci=(e,t)=>St(()=>e.state._tag==="Closed"?t(e.state.exit):(fl(e,{},t),ot)),G$=(e,t)=>Ci(e,_s(t)),fl=(e,t,n)=>{e.state._tag==="Empty"?e.state={_tag:"Open",finalizers:new Map([[t,n]])}:e.state._tag==="Open"&&e.state.finalizers.set(t,n)},Pm=(e,t)=>{e.state._tag==="Open"&&e.state.finalizers.delete(t)},Im=(e="sequential")=>({[TS]:TS,[MS]:MS,strategy:e,state:K$}),K$={_tag:"Empty"},LC=jf.asEffect(),Q$=Rl(jf),OC=e=>St(()=>{const t=Im();return js(e(t),n=>St(()=>FC(t,n)??ot))}),J$=(e,t,n)=>jC(s=>VC(i=>Le(LC,a=>RC(n!=null&&n.interruptible?i(e):e,u=>Ci(a,f=>_l(t(u,f),s)))))),AC=rr({op:"OnExit",single:!1,[It](e){return e._stack.push(this),this[Ie][0]},[po](e){e.interruptible&&this[Ie][2]!==!0&&(e._stack.push(Nf),e.interruptible=!1)},[Cn](e,t,n){n??(n=it(e));const s=this[Ie][1](n);return s?Le(s,i=>n):n},[gr](e,t,n){n??(n=On(e));const s=this[Ie][1](n);return s?Le(s,i=>n):n}}),js=re(2,AC),Y$=re(2,(e,t)=>js(e,n=>t)),X$=re(3,(e,t,n)=>js(e,s=>{const i=t(s);return jt(i)?ot:n(i.success,s)})),Z$=re(2,(e,t)=>X$(e,S$,t)),eF=re(3,(e,t,n)=>js(e,s=>{if(s._tag!=="Failure")return ot;const i=t(s.cause);return jt(i)?ot:n(i.success,s.cause)})),tF=re(2,(e,t)=>eF(wm,t)(e)),nF=Ve(e=>Ft(Sm(e.id))),DC=e=>Ve(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(Nf)),e)),zC=rr({op:"SetInterruptible",[po](e){if(e.interruptible=this[Ie],e._interruptedCause&&e.interruptible)return()=>Ft(e._interruptedCause)}}),Nf=zC(!0),rF=zC(!1),UC=e=>Ve(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(rF),t._interruptedCause?Ft(t._interruptedCause):e)),VC=e=>Ve(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Nf),e(UC)):e(_e)),sF=(e,t)=>yN(e)?(t==null?void 0:t.mode)==="result"?Ys(e,fg,t):Ys(e,_e,t):t!=null&&t.discard?t.mode==="result"?Ys(Object.values(e),fg,t):Ys(Object.values(e),_e,t):St(()=>{const n={};return ji(Ys(Object.entries(e),([s,i])=>xt((t==null?void 0:t.mode)==="result"?fg(i):i,a=>{n[s]=a}),{discard:!0,concurrency:t==null?void 0:t.concurrency}),n)}),jm=rr({op:"While",[Cn](e,t){return this[Ie].step(e),this[Ie].while()?(t._stack.push(this),this[Ie].body()):Dn},[It](e){return this[Ie].while()?(e._stack.push(this),this[Ie].body()):Dn}}),Ys=re(e=>typeof e[1]=="function",(e,t,n)=>Ve(s=>{const i=(n==null?void 0:n.concurrency)==="inherit"?s.getRef(PT):(n==null?void 0:n.concurrency)??1,a=i==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,i);if(a===1)return oF(e,t,n);const u=mr(e);let f=u.length;if(f===0)return n!=null&&n.discard?ot:Re([]);const d=n!=null&&n.discard?void 0:new Array(f),h=iF({f:t,out:d},u,{concurrency:a});return h?ji(h,d):Re(d)})),oF=(e,t,n)=>St(()=>{const s=n!=null&&n.discard?void 0:[],i=e[Symbol.iterator]();let a=i.next(),u=0;return ji(jm({while:()=>!a.done,body:()=>t(a.value,u++),step:f=>{s&&s.push(f),a=i.next()}}),s)}),BC=e=>{const t=e.onItem,n=e.step;return(s,i,a)=>{let u=(a==null?void 0:a.start)??0;const f=(a==null?void 0:a.end)??i.length,d=(a==null?void 0:a.concurrency)??1;let h=!1,m,p,x,v=!1,w,k;const b=()=>{let _=!1;for(;!w&&u<f;u++){const E=i[u],j=k??t(s,E,u);if(bn(j)){if(w=n(s,E,j,u),w)break}else{if(d===1)return Le(If(j),R=>(w=n(s,E,R,u),u++,w??b()??ot));if(m){k=void 0;const R=Tf(m,j,!0,!0,"inherit");if(R._exit){if(w=n(s,E,R._exit,u),w)break;continue}p?p.add(R):p=new Set([R]);const T=u;if(R.addObserver(O=>{if(p.delete(R),w){if(!v&&O._tag==="Failure")for(const $ of O.cause.reasons)$._tag!=="Interrupt"&&(w._tag==="Failure"?w.cause.reasons.push($):w=On(al([$])))}else{const $=n(s,E,O,T);$&&(w=$._tag==="Failure"?On(al($.cause.reasons.slice())):$,b())}if(_){const $=b();$&&x($)}else h&&p.size===0&&x(w??ot)}),p.size<d)continue;_=!0,u++;return}else return sr(R=>{m=Cm(),k=j,x=R;const T=b();return T?R(T):St(()=>(w=Dn,v=!0,p?Dc(p):ot))})}}if(h=!0,w){if(p&&p.size>0){const E=Cf(m);p.forEach(j=>j.interruptUnsafe(m.id,E));return}if(x||w._tag==="Failure")return w}else if(x)if(p)p.size===0&&x(ot);else return Dn};return b()}},Mf=()=>BC,iF=BC({onItem(e,t,n){return e.f(t,n)},step(e,t,n,s){if(n._tag==="Failure")return n;e.out&&(e.out[s]=n.value)}}),Tf=(e,t,n=!1,s=!1,i=!1)=>{const a=i==="inherit"?e.interruptible:!i,u=new vC(e.context,a);return n?u.evaluate(t):e.currentDispatcher.scheduleTask(()=>u.evaluate(t),0),!s&&!u._exit&&(e.children().add(u),u.addObserver(()=>e._children.delete(u))),u},qC=re(e=>Ht(e[0]),(e,t,n)=>Ve(s=>{const i=Tf(s,e,n==null?void 0:n.startImmediately,!0,n==null?void 0:n.uninterruptible);if(!i._exit)if(t.state._tag!=="Closed"){const a={};fl(t,a,()=>o$(f=>f===i.id?ot:bm(i))),i.addObserver(()=>Pm(t,a))}else i.interruptUnsafe(s.id,Cf(s));return Re(i)})),aF=re(e=>Ht(e[0]),(e,t)=>Le(LC,n=>qC(e,n,t))),Pl=e=>(t,n)=>{const s=new vC(n!=null&&n.scheduler?Is(e,aC,n.scheduler):e,(n==null?void 0:n.uninterruptible)!==!0);if(s.evaluate(t),s._exit)return s;if(n!=null&&n.signal)if(n.signal.aborted)s.interruptUnsafe();else{const i=()=>s.interruptUnsafe();n.signal.addEventListener("abort",i,{once:!0}),s.addObserver(()=>n.signal.removeEventListener("abort",i))}return n!=null&&n.onFiberStart&&n.onFiberStart(s),s},lF=re(2,(e,t)=>{if(e._exit)return e;if(t.state._tag==="Closed")return e.interruptUnsafe(e.id),e;const n={};return fl(t,n,()=>bm(e)),e.addObserver(()=>Pm(t,n)),e}),uF=Pl(er()),HC=e=>{const t=Pl(e);return(n,s)=>{const i=t(n,s);return s!=null&&s.onExit&&i.addObserver(s.onExit),a=>i.interruptUnsafe(a)}},cF=HC(er()),Nm=e=>{const t=Pl(e);return(n,s)=>{const i=t(n,s);return new Promise(a=>{i.addObserver(u=>a(u))})}},fF=Nm(er()),WC=e=>{const t=Nm(e);return(n,s)=>t(n,s).then(i=>{if(i._tag==="Failure")throw km(i.cause);return i.value})},dF=WC(er()),Mm=e=>{const t=Pl(e);return n=>{var a;if(bn(n))return n;const s=new uC("sync"),i=t(n,{scheduler:s});return(a=i.currentDispatcher)==null||a.flush(),i._exit??Si(new PF(i))}},hF=Mm(er()),GC=e=>{const t=Mm(e);return n=>{const s=t(n);if(s._tag==="Failure")throw km(s.cause);return s.value}},gF=GC(er()),$S=Re(!0),FS=Re(!1);class pF{constructor(t){L(this,"waiters",[]);L(this,"scheduled",!1);L(this,"isOpen");L(this,"flushWaiters",()=>{this.scheduled=!1;const t=this.waiters;this.waiters=[];for(let n=0;n<t.length;n++)t[n](Dn)});L(this,"open",Ve(t=>this.isOpen?FS:(this.isOpen=!0,this.scheduleUnsafe(t))));L(this,"release",Ve(t=>this.isOpen?FS:this.scheduleUnsafe(t)));L(this,"await",sr(t=>this.isOpen?t(ot):(this.waiters.push(t),yt(()=>{const n=this.waiters.indexOf(t);n!==-1&&this.waiters.splice(n,1)}))));L(this,"close",yt(()=>this.closeUnsafe()));L(this,"whenOpen",t=>Le(this.await,()=>t));this.isOpen=t}scheduleUnsafe(t){return this.scheduled||this.waiters.length===0||(this.scheduled=!0,t.currentDispatcher.scheduleTask(this.flushWaiters,0)),$S}openUnsafe(){return this.isOpen?!1:(this.isOpen=!0,this.flushWaiters(),!0)}closeUnsafe(){return this.isOpen?(this.isOpen=!1,!0):!1}}const mF=e=>new pF(e??!1),sp=BigInt(0),yF={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:sp,endTime:sp,exit:Dn},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},xF=e=>Object.assign(Object.create(yF),e),KC=e=>e?io(e.annotations,tp)?e._tag==="Span"?KC(Jk(e.parent)):An():Me(e):An(),QC=(e,t,n)=>{const s=!e.getRef(IT)||(n==null?void 0:n.annotations)&&io(n.annotations,tp),i=(n==null?void 0:n.parent)!==void 0?Me(n.parent):n!=null&&n.root?An():KC(e.currentSpan);let a;if(s)a=xF({name:t,parent:i,annotations:Is((n==null?void 0:n.annotations)??er(),tp,!0)});else{const u=e.getRef(_T),f=e.getRef(Ni),d=e.getRef(hC),h=e.getRef(jT),m=e.getRef(NT),p=(n==null?void 0:n.level)??e.getRef(CT),x=(n==null?void 0:n.links)!==void 0?[...m,...n.links]:m.slice();a=u.span({name:t,parent:i,annotations:(n==null?void 0:n.annotations)??er(),links:x,startTime:d?f.currentTimeNanosUnsafe():BigInt(0),kind:(n==null?void 0:n.kind)??"internal",root:(n==null?void 0:n.root)??So(i),sampled:(n==null?void 0:n.sampled)??(ks(i)&&i.value.sampled===!1?!1:!YC(e.getRef(bT),p))});for(const[v,w]of Object.entries(h))a.attribute(v,w);if((n==null?void 0:n.attributes)!==void 0)for(const[v,w]of Object.entries(n.attributes))a.attribute(v,w)}return a},vF=(e,t)=>DC(Ve(n=>{const s=wf(n.context,jf),i=QC(n,e,t??{}),a=n.getRef(Ni),u=n.getRef(hC);return ji(Ci(s,f=>wF(i,f,a,u)),i)})),SF=(e,t)=>(t=typeof t=="function"?t:ff,IC(dC,n=>({name:e,stack:t,parent:n}))),wF=(e,t,n,s)=>yt(()=>{e.status._tag!=="Ended"&&e.end(s?n.currentTimeNanosUnsafe():sp,t)}),kF=(e,...t)=>{const n=t.length===1?void 0:t[0],s=t[t.length-1];return Ve(i=>{const a=QC(i,e,n),u=i.getRef(Ni);return js(Jt(()=>s(a)),f=>yt(()=>{a.status._tag!=="Ended"&&a.end(u.currentTimeNanosUnsafe(),f)}))})},LS=Rl(wT),CF=function(){const e=Ht(arguments[0]),t=e?arguments[1]:arguments[0];let n=e?arguments[2]:arguments[1],s=_e;return t._tag==="Span"&&(n=FT(n),s=SF(t.name,n==null?void 0:n.captureStackTrace)),e?LS(s(arguments[0]),t):i=>LS(s(i),t)},Ni=Xe("effect/Clock",{defaultValue:()=>new _F}),bF=2**31-1;class _F{constructor(){L(this,"currentTimeMillis",yt(()=>this.currentTimeMillisUnsafe()));L(this,"currentTimeNanos",yt(()=>this.currentTimeNanosUnsafe()))}currentTimeMillisUnsafe(){return Date.now()}currentTimeNanosUnsafe(){return RF()}sleep(t){const n=rC(t);return n<=0?_m:sr(s=>{if(n>bF)return;const i=setTimeout(()=>s(ot),n);return yt(()=>clearTimeout(i))})}}const OS=(function(){const e=BigInt(1e6);if(typeof performance>"u"||typeof performance.now>"u")return()=>BigInt(Date.now())*e;if(typeof performance.timeOrigin=="number"&&performance.timeOrigin===0)return()=>BigInt(Math.round(performance.now()*1e6));const t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6));return()=>t+BigInt(Math.round(performance.now()*1e6))})(),RF=(function(){const e=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!e)return OS;const t=OS()-e.bigint();return()=>t+e.bigint()})(),JC=e=>Ve(t=>e(t.getRef(Ni))),Tm=e=>JC(t=>t.sleep(ym(e))),AS="~effect/Cause/TimeoutError";var r1,s1;class EF extends(s1=hm("TimeoutError"),r1=AS,s1){constructor(n){super({message:n});L(this,r1,AS)}}const DS="~effect/Cause/AsyncFiberError";var o1,i1;class PF extends(i1=hm("AsyncFiberError"),o1=DS,i1){constructor(n){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:n});L(this,o1,DS)}}const IF=Xe("effect/Console/CurrentConsole",{defaultValue:()=>globalThis.console}),jF=e=>{switch(e){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 5e4;case"Error":return 4e4;case"Warn":return 3e4;case"Info":return 2e4;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},NF=mM(pM,jF),YC=yM(NF),MF=Xe("effect/Loggers/CurrentLoggers",{defaultValue:()=>new Set([zF,UF])}),TF=Xe("effect/Logger/LogToStderr",{defaultValue:kk}),$F="~effect/Logger",FF={[$F]:{_Message:_e,_Output:_e},pipe(){return Lt(this,arguments)}},XC=e=>{const t=Object.create(FF);return t.log=e,t},LF=e=>e.replace(/[\s="]/g,"_"),OF=(e,t)=>`${LF(e[0])}=${t-e[1]}ms`,ZC=e=>(...t)=>{let n;for(let s=0,i=t.length;s<i;s++){const a=t[s];xf(a)&&(n?t.splice(s,1):t=t.slice(0,s).concat(t.slice(s+1)),n=n?al(n.reasons.concat(a.reasons)):a,s--)}return n===void 0&&(n=YN),Ve(s=>{const i=e??s.currentLogLevel;if(YC(s.minimumLogLevel,i))return ot;const a=s.getRef(Ni),u=s.getRef(MF);if(u.size>0){const f=new Date(a.currentTimeMillisUnsafe());for(const d of u)d.log({cause:n,fiber:s,date:f,logLevel:i,message:t})}return ot})},AF=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`,DF=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null;DF&&process.stdout.isTTY;const zF=XC(({cause:e,date:t,fiber:n,logLevel:s,message:i})=>{const a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(yC(e));const u=t.getTime(),f=n.getRef($T);let d="";for(const x of f)d+=` ${OF(x,u)}`;const h=n.getRef(vm);Object.keys(h).length>0&&a.push(h);const m=n.getRef(IF);(n.getRef(TF)?m.error:m.log)(`[${AF(t)}] ${s.toUpperCase()} (#${n.id})${d}:`,...a)}),UF=XC(({cause:e,fiber:t,logLevel:n,message:s})=>{const i=t.getRef(Ni),a=t.getRef(vm),u=t.currentSpan;if(u===void 0||u._tag==="ExternalSpan")return;const f={};for(const[d,h]of Object.entries(a))f[d]=h;f["effect.fiberId"]=t.id,f["effect.logLevel"]=n.toUpperCase(),e.reasons.length>0&&(f["effect.cause"]=yC(e)),u.event(BN(Array.isArray(s)&&s.length===1?s[0]:s),i.currentTimeNanosUnsafe(),f)}),VF=xf,BF=JN,op=al,ip=e=>new Tk(e),ap=e=>new Fk(e),lp=DT,qF=qT,eb=km,Il=wo,HF=VT,WF=wm,$m=sM,ao=iM,GF=Mk,dg=it,Va=On,jl=yr,KF=Si,QF=x$,tb=Dn,JF=Rm,nb=v$,YF=R$,XF="~effect/Deferred",ZF={[XF]:{_A:_e,_E:_e},pipe(){return Lt(this,arguments)}},Fm=()=>{const e=Object.create(ZF);return e.resumes=void 0,e.effect=void 0,e},Lm=e=>sr(t=>e.effect?t(e.effect):(e.resumes??(e.resumes=[]),e.resumes.push(t),yt(()=>{const n=e.resumes.indexOf(t);e.resumes.splice(n,1)}))),eL=re(2,(e,t)=>yt(()=>Ba(e,t))),rb=eL,Ba=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){for(let n=0;n<e.resumes.length;n++)e.resumes[n](t);e.resumes=void 0}return!0},tL=re(2,(e,t)=>VC(n=>Le(If(n(e)),s=>rb(t,s)))),nL=vm,zS=jf,Om=Im,zc=Q$,rL=Ci,sL=G$,Uc=W$,$f=$C,oL="~effect/Layer",US="~effect/Layer/MemoMap",iL={[oL]:{_ROut:_e,_E:_e,_RIn:_e},pipe(){return Lt(this,arguments)}},sb=e=>{const t=Object.create(iL);return t.build=e,t},Am=e=>sb((t,n)=>{const s=Uc(n);return js(e(t,s),i=>i._tag==="Failure"?$f(s,i):ot)}),aL=e=>{const t=Am((n,s)=>n.getOrElseMemoize(t,s,e));return t};class lL{constructor(){L(this,"map",new Map)}get[US](){return US}getOrElseMemoize(t,n,s){if(this.map.has(t)){const f=this.map.get(t);return f.observers++,bl(Ci(n,d=>f.finalizer(d)),f.effect)}const i=Om(),a=Fm(),u={observers:1,effect:Lm(a),finalizer:f=>St(()=>(u.observers--,u.observers===0?(this.map.delete(t),$f(i,f)):ot))};return this.map.set(t,u),Ci(n,u.finalizer).pipe(Le(()=>s(this,i)),js(f=>(u.effect=f,rb(a,f))))}}const Dm=()=>new lL,rf=class rf extends Un()("effect/Layer/CurrentMemoMap"){};L(rf,"getOrCreate",BM(rf,Dm));let dl=rf;const zm=re(3,(e,t,n)=>Rl(xt(e.build(t,n),Is(dl,t)),dl,t)),uL=re(2,(e,t)=>Ve(n=>zm(e,dl.getOrCreate(n.context),t))),Um=function(){return arguments.length===1?e=>VS(wi(arguments[0],e)):VS(wi(arguments[0],arguments[1]))},VS=e=>sb(_s(Re(e))),up=function(){return arguments.length===1?e=>BS(arguments[0],e):BS(arguments[0],arguments[1])},BS=(e,t)=>cp(xt(t,n=>wi(e,n))),cp=e=>aL((t,n)=>zc(e,n)),ob=(e,t,n)=>{const s=Uc(n,"parallel");return Ys(e,i=>i.build(t,Uc(s,"sequential")),{concurrency:e.length}).pipe(xt(i=>GM(...i)))},ib=(...e)=>Am((t,n)=>ob(e,t,n)),cL=(e,t,n)=>Am((s,i)=>Le(Array.isArray(t)?ob(t,s,i):t.build(s,i),a=>e.build(s,i).pipe(_l(a),xt(u=>n(u,a))))),fp=re(2,(e,t)=>cL(e,t,_e)),fL=class extends cf{constructor(t){super(),t&&Object.assign(this,t)}},bi=re(2,(e,t)=>MC(e,gL,n=>t(n))),qS=e=>e.reasons.some(dL),dL=e=>e._tag==="Fail"&&$m(e.error),hL=iC(Il,e=>$m(e)?Dr(e):Zn(e)),gL=iC(Il,e=>$m(e)?Dr(e.value):Zn(e)),Vm=re(2,(e,t)=>Pf(e,{onSuccess:t.onSuccess,onFailure:n=>{const s=hL(n);return jt(s)?t.onFailure(s.failure):t.onDone(s.success.value)}})),ab="~effect/Schedule",HS=Xe("effect/Schedule/CurrentMetadata",{defaultValue:_s({input:void 0,output:void 0,duration:xm,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),pL={[ab]:{_Out:_e,_In:_e,_Env:_e},pipe(){return Lt(this,arguments)}},mL=e=>De(e,ab),Nl=e=>{const t=Object.create(pL);return t.step=e,t},Bm=()=>{let e=0,t,n;return(s,i)=>{n===void 0&&(n=s);const a=s-n,u=t===void 0?0:s-t;return t=s,{input:i,attempt:++e,start:n,now:s,elapsed:a,elapsedSincePrevious:u}}},lb=e=>Nl(xt(e,t=>{const n=Bm();return(s,i)=>t(n(s,i))})),mo=e=>El(e.step,t=>Re(()=>Ft(t))),yL=e=>JC(t=>xt(mo(e),n=>{const s=Bm();return i=>St(()=>{const a=t.currentTimeMillisUnsafe();return Le(n(a,i),([u,f])=>{const d=s(a,i);return d.output=u,d.duration=f,ji(Tm(f),d)})})})),xL=re(2,(e,t)=>vL(e,t,(n,s)=>[n,s])),vL=re(3,(e,t,n)=>Nl(xt(NC(mo(e),mo(t)),([s,i])=>(a,u)=>Vm(s(a,u),{onSuccess:f=>i(a,u).pipe(xt(d=>[n(f[0],d[0]),dT(f[1],d[1])]),bi(d=>ao(n(f[0],d)))),onDone:f=>i(a,u).pipe(Le(d=>ao(n(f,d[0]))),bi(d=>ao(n(f,d)))),onFailure:Ft})))),ub=re(2,(e,t)=>SL(e,t,(n,s)=>[n,s])),SL=re(3,(e,t,n)=>Nl(xt(NC(mo(e),mo(t)),([s,i])=>(a,u)=>Vm(s(a,u),{onSuccess:f=>i(a,u).pipe(xt(d=>[n(f[0],d[0]),fT(f[1],d[1])]),bi(d=>Re([n(f[0],d),f[1]]))),onFailure:Ft,onDone:f=>i(a,u).pipe(xt(d=>[n(f,d[0]),d[1]]),bi(d=>ao(n(f,d))))})))),cb=(e,t=2)=>{const n=rC(ym(e));return lb(Re(s=>{const i=ul(n*Math.pow(t,s.attempt-1));return Re([i,i])}))},fb=e=>Nl(xt(mo(e),t=>(n,s)=>Vm(t(n,s),{onSuccess:i=>Re([s,i[1]]),onFailure:Ft,onDone:()=>ao(s)}))),wL=e=>Sc(db,({attempt:t})=>Re(t<=e)),qm=e=>{const t=ym(e);return lb(Re(n=>Re([n.attempt-1,t])))},Sc=re(2,(e,t)=>Nl(xt(mo(e),n=>{const s=Bm();return(i,a)=>Le(n(i,a),u=>{const[f,d]=u,h=t({...s(i,a),output:f,duration:d});return Le(Ht(h)?h:Re(h),m=>m?Re(u):ao(f))})}))),db=qm(xm),kL=(e,t,n)=>OC(s=>Le(n!=null&&n.local?zm(t,Dm(),s):uL(t,s),i=>_l(e,i))),CL=re(e=>Ht(e[0]),(e,t,n)=>Zk(t)?_l(e,t):kL(e,Array.isArray(t)?ib(...t):t,n)),bL=re(3,(e,t,n)=>Le(yL(t),s=>{let i=HS.defaultValue(),a;const u=Ef(St(()=>Rl(e,HS,i)),f=>(a=f,Le(s(f),d=>(i=d,u))));return bi(u,f=>Jt(()=>n(a,f)))})),_L=re(2,(e,t)=>{const n=typeof t=="function"?t(_e):mL(t)?t:EL(t);return bL(e,n,bf)}),RL=fb(db),EL=e=>{let t=e.schedule?fb(e.schedule):RL;return e.while&&(t=Sc(t,({input:n})=>{const s=e.while(n);return Ht(s)?s:Re(s)})),e.until&&(t=Sc(t,({input:n})=>{const s=e.until(n);return Ht(s)?xt(s,i=>!i):Re(!s)})),e.times!==void 0&&(t=Sc(t,({attempt:n})=>Re(n<=e.times))),t},hi=Ht,hb=Ys,gb=jm,PL=s$,at=Re,Hm=r$,IL=n$,Ar=St,Ln=yt,rt=ot,WS=sr,jL=a$,dp=l$,Ke=bf,NL=Ft,ML=_f,Vc=Ve,zn=Le,TL=h$,$L=bl,FL=RC,GS=If,ko=xt,hl=El,LL=$$,wc=O$,OL=T$,AL=_L,DL=A$,zL=q$,UL=TC,VL=B$,pb=PC,BL=Pf,Bc=P$,mb=jC,qL=CL,lo=_l,HL=E$,WL=Rf,GL=Rl,KL=OC,yb=J$,xb=Y$,QL=Z$,vb=js,hp=nF,Wm=UC,JL=tF,Sb=N$,YL=vF,XL=kF,KS=CF,ZL=qC,Gm=aF,gp=uF,qc=Pl,eO=HC,tO=cF,qa=dF,nO=WC,rO=fF,sO=Nm,Km=gF,oO=GC,wb=hF,iO=Mm,uo=bC,aO=ZC("Error"),lO=re(e=>hi(e[0]),(e,...t)=>IC(e,nL,n=>{const s={...n};return t.length===1?Object.assign(s,t[0]):s[t[0]]=t[1],s})),kb=g$,Co=p$,gl=m$,ci=d$,uO=y$,pp=u$;function $a(e,t,n){return t==="__proto__"?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n,e}function Cb(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function cO(e){return t=>{var n;return(n=Cb(t))==null?void 0:n[e]}}const fO=cO("identifier"),Qm=Rs(e=>{const t=fO(e);return typeof t=="string"?t:e.getExpected(Qm)}),dO=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"),kc=new WeakMap,bb="~effect/data/Redacted",hO=e=>De(e,bb),QS=(e,t)=>{const n=Object.create(gO);return kc.set(n,e),n},gO={[bb]:{_A:e=>e},label:void 0,...Ps,toJSON(){return this.toString()},toString(){return`<redacted${im(this.label)?":"+this.label:""}>`},[Yt](){return dt(kc.get(this))},[Xt](e){return hO(e)&&kn(kc.get(this),kc.get(e))}},mp="~effect/SchemaIssue/Issue";function pO(e){return De(e,mp)}var a1;let xr=(a1=mp,class{constructor(){L(this,a1,mp)}toString(){return bO(this)}}),mO=class extends xr{constructor(n,s,i){super();L(this,"_tag","Filter");L(this,"actual");L(this,"filter");L(this,"issue");this.actual=n,this.filter=s,this.issue=i}};class yO extends xr{constructor(n,s,i){super();L(this,"_tag","Encoding");L(this,"ast");L(this,"actual");L(this,"issue");this.ast=n,this.actual=s,this.issue=i}}class tr extends xr{constructor(n,s){super();L(this,"_tag","Pointer");L(this,"path");L(this,"issue");this.path=n,this.issue=s}}class _b extends xr{constructor(n){super();L(this,"_tag","MissingKey");L(this,"annotations");this.annotations=n}}class Rb extends xr{constructor(n,s){super();L(this,"_tag","UnexpectedKey");L(this,"ast");L(this,"actual");this.ast=n,this.actual=s}}class qt extends xr{constructor(n,s,i){super();L(this,"_tag","Composite");L(this,"ast");L(this,"actual");L(this,"issues");this.ast=n,this.actual=s,this.issues=i}}class vr extends xr{constructor(n,s){super();L(this,"_tag","InvalidType");L(this,"ast");L(this,"actual");this.ast=n,this.actual=s}}class Hc extends xr{constructor(n,s){super();L(this,"_tag","InvalidValue");L(this,"actual");L(this,"annotations");this.actual=n,this.annotations=s}}class JS extends xr{constructor(n,s,i){super();L(this,"_tag","AnyOf");L(this,"ast");L(this,"actual");L(this,"issues");this.ast=n,this.actual=s,this.issues=i}}class xO extends xr{constructor(n,s,i){super();L(this,"_tag","OneOf");L(this,"ast");L(this,"actual");L(this,"successes");this.ast=n,this.actual=s,this.successes=i}}function yp(e,t){if(pO(t))return t;if(typeof t=="string")return new Hc(Me(e),{message:t});const n=typeof t.issue=="string"?new Hc(Me(e),{message:t.issue}):t.issue;return new tr(t.path,n)}function vO(e,t){if(t!==void 0)return typeof t=="boolean"?t?void 0:new Hc(Me(e)):yp(e,t)}function SO(e,t,n){return Array.isArray(n)?Lc(n)?n.length===1?yp(e,n[0]):new qt(t,Me(e),AM(n,s=>yp(e,s))):void 0:vO(e,n)}const wO=e=>{const t=pl(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return xp(Qm(e.ast),YS(e.actual));case"InvalidValue":return`Invalid data ${YS(e.actual)}`;case"MissingKey":return"Missing key";case"UnexpectedKey":return`Unexpected key with value ${vt(e.actual)}`;case"Forbidden":return"Forbidden operation";case"OneOf":return`Expected exactly one member to match the input ${vt(e.actual)}`}},kO=e=>pl(e.issue)??pl(e);function xp(e,t){return`Expected ${e}, got ${t}`}function ui(e,t,n,s){switch(e._tag){case"Filter":{const i=s(e);if(i!==void 0)return[{path:t,message:i}];switch(e.issue._tag){case"InvalidValue":return[{path:t,message:xp(Eb(e.filter),vt(e.actual))}];default:return ui(e.issue,t,n,s)}}case"Encoding":return ui(e.issue,t,n,s);case"Pointer":return ui(e.issue,[...t,...e.path],n,s);case"Composite":return e.issues.flatMap(i=>ui(i,t,n,s));case"AnyOf":{const i=pl(e);if(e.issues.length===0){if(i!==void 0)return[{path:t,message:i}];const a=xp(Qm(e.ast),vt(e.actual));return[{path:t,message:a}]}return e.issues.flatMap(a=>ui(a,t,n,s))}default:return[{path:t,message:n(e)}]}}function Eb(e){var n;const t=(n=e.annotations)==null?void 0:n.expected;if(typeof t=="string")return t;switch(e._tag){case"Filter":return"<filter>";case"FilterGroup":return e.checks.map(s=>Eb(s)).join(" & ")}}function CO(){return e=>ui(e,[],wO,kO).map(_O).join(`
|
|
83
|
+
`)}const bO=CO();function _O(e){let t=e.message;if(e.path&&e.path.length>0){const n=zN(e.path);t+=`
|
|
84
|
+
at ${n}`}return t}function pl(e){switch(e._tag){case"InvalidType":case"OneOf":case"Composite":case"AnyOf":return Ea(e.ast.annotations);case"InvalidValue":case"Forbidden":return Ea(e.annotations);case"MissingKey":return Ea(e.annotations,"messageMissingKey");case"UnexpectedKey":return Ea(e.ast.annotations,"messageUnexpectedKey");case"Filter":return Ea(e.filter.annotations);case"Encoding":return pl(e.issue)}}function Ea(e,t="message"){const n=e==null?void 0:e[t];if(typeof n=="string")return n}function YS(e){return So(e)?"no value provided":vt(e.value)}class _i extends cf{constructor(n){super();L(this,"run");this.run=n}map(n){return new _i((s,i)=>this.run(s,i).pipe(kb(mm(n))))}compose(n){return XS(this)?n:XS(n)?this:new _i((s,i)=>this.run(s,i).pipe(ci(a=>n.run(a,i))))}}const Pb=new _i(at);function XS(e){return e.run===Pb.run}function Ri(){return Pb}function un(e){return RO(mm(e))}function RO(e){return new _i(t=>at(e(t)))}function EO(e){return new _i(t=>{const n=wM(t,hN);return ks(n)?at(n):ko(e,Me)})}function PO(){return un(globalThis.String)}function Ib(){return un(globalThis.Number)}const vp="~effect/SchemaTransformation/Transformation";var l1;l1=vp;const sf=class sf{constructor(t,n){L(this,l1,vp);L(this,"_tag","Transformation");L(this,"decode");L(this,"encode");this.decode=t,this.encode=n}flip(){return new sf(this.encode,this.decode)}compose(t){return new sf(this.decode.compose(t.decode),t.encode.compose(this.encode))}};let _n=sf;function IO(e){return De(e,vp)}const jb=e=>IO(e)?e:new _n(e.decode,e.encode);function Ff(e){return new _n(un(e.decode),un(e.encode))}const jO=new _n(Ri(),Ri());function Jm(){return jO}const Nb=new _n(Ib(),PO()),Mb=e=>Ff({decode:t=>{const n=new Error(t.message);return typeof t.name=="string"&&t.name!=="Error"&&(n.name=t.name),typeof t.stack=="string"&&(n.stack=t.stack),n},encode:t=>{const n={name:t.name,message:t.message};return e!=null&&e.includeStack&&typeof t.stack=="string"&&(n.stack=t.stack),n}});function bo(e){return t=>t._tag===e}const Tb=bo("Declaration"),NO=bo("Never"),Wc=bo("Literal"),MO=bo("UniqueSymbol"),TO=bo("Arrays"),$O=bo("Objects"),FO=bo("Union");class Nt{constructor(t,n){L(this,"to");L(this,"transformation");this.to=t,this.transformation=n}}const LO={};class Ei{constructor(t,n,s=void 0,i=void 0){L(this,"isOptional");L(this,"isMutable");L(this,"defaultValue");L(this,"annotations");this.isOptional=t,this.isMutable=n,this.defaultValue=s,this.annotations=i}}const ZS="~effect/Schema";var u1;u1=ZS;class fn{constructor(t=void 0,n=void 0,s=void 0,i=void 0){L(this,u1,ZS);L(this,"annotations");L(this,"checks");L(this,"encoding");L(this,"context");this.annotations=t,this.checks=n,this.encoding=s,this.context=i}toString(){return`<${this._tag}>`}}class Ml extends fn{constructor(n,s,i,a,u,f){super(i,a,u,f);L(this,"_tag","Declaration");L(this,"typeParameters");L(this,"run");this.typeParameters=n,this.run=s}getParser(){const n=this.run(this.typeParameters);return(s,i)=>So(s)?Hm:kb(n(s.value,this,i),Me)}recur(n){const s=Pi(this.typeParameters,n);return s===this.typeParameters?this:new Ml(s,this.run,this.annotations,this.checks,void 0,this.context)}getExpected(){var s;const n=(s=this.annotations)==null?void 0:s.expected;return typeof n=="string"?n:"<Declaration>"}}let OO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Null")}getParser(){return Of(this,null)}getExpected(){return"null"}};const Ym=new OO;let AO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Undefined")}getParser(){return Of(this,void 0)}toCodecJson(){return Et(this,[$b])}getExpected(){return"undefined"}};const $b=new Nt(Ym,new _n(un(()=>{}),un(()=>null))),DO=new AO;let zO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Void")}getParser(){return Of(this,void 0)}toCodecJson(){return Et(this,[$b])}getExpected(){return"void"}};const UO=new zO;let VO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Never")}getParser(){return _o(this,pN)}getExpected(){return"never"}};const BO=new VO;let qO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Any")}getParser(){return _o(this,_k)}getExpected(){return"any"}};const HO=new qO;let WO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Unknown")}getParser(){return _o(this,_k)}getExpected(){return"unknown"}};const Xm=new WO;let Ha=class extends fn{constructor(n,s,i,a,u){super(s,i,a,u);L(this,"_tag","Literal");L(this,"literal");if(typeof n=="number"&&!globalThis.Number.isFinite(n))throw new Error(`A numeric literal must be finite, got ${vt(n)}`);this.literal=n}getParser(){return Of(this,this.literal)}toCodecJson(){return typeof this.literal=="bigint"?ew(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:ew(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function ew(e){const t=globalThis.String(e.literal);return Et(e,[new Nt(new Ha(t),new _n(un(()=>e.literal),un(()=>t)))])}let GO=class extends fn{constructor(){super(...arguments);L(this,"_tag","String")}getParser(){return _o(this,im)}getExpected(){return"string"}};const Fb=new GO;let KO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Number")}getParser(){return _o(this,bk)}toCodecJson(){return this.checks&&(Fa(this.checks,"isFinite")||Fa(this.checks,"isInt"))?this:Et(this,[o3])}toCodecStringTree(){return this.checks&&(Fa(this.checks,"isFinite")||Fa(this.checks,"isInt"))?Et(this,[m3]):Et(this,[y3])}getExpected(){return"number"}};function Fa(e,t){return e.some(n=>{var s,i;switch(n._tag){case"Filter":return((i=(s=n.annotations)==null?void 0:s.meta)==null?void 0:i._tag)===t;case"FilterGroup":return Fa(n.checks,t)}})}const Lb=new KO;let QO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Boolean")}getParser(){return _o(this,dN)}getExpected(){return"boolean"}};const JO=new QO;class Tl extends fn{constructor(n,s,i,a,u,f,d){super(a,u,f,d);L(this,"_tag","Arrays");L(this,"isMutable");L(this,"elements");L(this,"rest");this.isMutable=n,this.elements=s,this.rest=i;const h=s.findIndex(Fr);if(h!==-1&&(s.slice(h+1).some(m=>!Fr(m))||i.length>1))throw new Error("A required element cannot follow an optional element. ts(1257)");if(i.length>1&&i.slice(1).some(Fr))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(n){const s=this,i=s.elements.map(p=>({ast:p,parser:n(p)})),a=s.rest.map(p=>({ast:p,parser:n(p)})),u=i.length,[f,...d]=a,h=d.length;function m(p,x){return x<u?i[x]:x>=p?d[x-p]:f}return pp(function*(p,x){if(p._tag==="None")return p;const v=p.value;if(!Array.isArray(v))return yield*Ke(new vr(s,p));const w=v.length,k={ast:s,getParser:m,oinput:p,len:w,tailThreshold:XO(w,u,h),output:new globalThis.Array(w),issues:void 0,options:x},b=Zm(x==null?void 0:x.concurrency),_=YO(k,v,{concurrency:b==null?void 0:b.concurrency,end:s.rest.length===0?u:Math.max(w,u+h)});if(_&&(yield*_),s.rest.length===0&&w>u)for(let E=u;E<=w-1;E++){const j=new tr([E],new Rb(s,v[E]));if(x.errors==="all")k.issues?k.issues.push(j):k.issues=[j];else return yield*Ke(new qt(s,p,[j]))}return k.issues?yield*Ke(new qt(s,p,k.issues)):Me(k.output)})}recur(n){const s=Pi(this.elements,n),i=Pi(this.rest,n);return s===this.elements&&i===this.rest?this:new Tl(this.isMutable,s,i,this.annotations,this.checks,void 0,this.context)}getExpected(){return"array"}}const YO=Mf()({onItem(e,t,n){const s=n<e.len?Me(t):An();return e.getParser(e.tailThreshold,n).parser(s,e.options)},step(e,t,n,s){var i;if(n._tag==="Failure")return Gc(e,e.ast,s,n);if(n.value._tag==="Some")e.output[s]=n.value.value;else{const a=e.getParser(e.tailThreshold,s);if(Fr(a.ast))return;const u=new tr([s],new _b((i=a.ast.context)==null?void 0:i.annotations));if(e.options.errors==="all")e.issues?e.issues.push(u):e.issues=[u];else return jl(new qt(e.ast,e.oinput,[u]))}}});function XO(e,t,n){return Math.max(t,e-n)}const Zm=e=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),Gc=(e,t,n,s)=>{const i=Il(s.cause);if(jt(i))return s;const a=new tr([n],i.success);if(e.options.errors==="all")e.issues?e.issues.push(a):e.issues=[a];else return jl(new qt(t,e.oinput,[a]))},e0="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",ZO=new globalThis.RegExp(`(?:${e0}|Infinity|-Infinity|NaN)`);function Ob(e,t){const n=xs(t);switch(n._tag){case"String":return Object.keys(e);case"TemplateLiteral":{const s=d3(n);return Object.keys(e).filter(i=>s.test(i))}case"Symbol":return Object.getOwnPropertySymbols(e);case"Number":return Object.keys(e).filter(s=>ZO.test(s));case"Union":return[...new Set(n.types.flatMap(s=>Ob(e,s)))];default:return[]}}class Ab{constructor(t,n){L(this,"name");L(this,"type");this.name=t,this.type=n}}class e3{constructor(t,n,s){L(this,"parameter");L(this,"type");L(this,"merge");if(this.parameter=t,this.type=n,this.merge=s,Fr(n)&&!Jb(n))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}}class t0 extends fn{constructor(n,s,i,a,u,f){super(i,a,u,f);L(this,"_tag","Objects");L(this,"propertySignatures");L(this,"indexSignatures");this.propertySignatures=n,this.indexSignatures=s;const d=n.map(h=>h.name).filter((h,m,p)=>p.indexOf(h)!==m);if(d.length>0)throw new Error(`Duplicate identifiers: ${JSON.stringify(d)}. ts(2300)`)}getParser(n){const s=this,i=[],a=new Set,u=[];for(const h of s.propertySignatures)i.push(h.name),a.add(h.name),u.push({ps:h,parser:n(h.type),name:h.name,type:h.type});const f=s.indexSignatures.length;if(s.propertySignatures.length===0&&s.indexSignatures.length===0)return _o(s,gN);const d=f>0?Mf()({onItem:pp(function*(h,[m,p]){const v=n(e_(p.parameter))(Me(m),h.options),w=bn(v)?v:yield*GS(v);if(w._tag==="Failure"){const j=Gc(h,s,m,w);j&&(yield*j);return}const k=Me(h.input[m]),_=n(p.type)(k,h.options),E=bn(_)?_:yield*GS(_);if(E._tag==="Failure"){const j=Gc(h,s,m,E);j&&(yield*j);return}else if(w.value._tag==="Some"&&E.value._tag==="Some"){const j=w.value.value,R=E.value.value;if(p.merge&&p.merge.decode&&Object.hasOwn(h.out,j)){const[T,O]=p.merge.decode.combine([j,h.out[j]],[j,R]);$a(h.out,T,O)}else $a(h.out,j,R)}}),step:(h,m,p)=>p._tag==="Failure"?p:void 0}):void 0;return pp(function*(h,m){if(h._tag==="None")return h;const p=h.value;if(!(typeof p=="object"&&p!==null&&!Array.isArray(p)))return yield*Ke(new vr(s,h));const x={},v={ast:s,oinput:h,input:p,out:x,issues:void 0,options:m},w=m.errors==="all",k=m.onExcessProperty==="error",b=m.onExcessProperty==="preserve";let _;if(s.indexSignatures.length===0&&(k||b)){_=Reflect.ownKeys(p);for(let R=0;R<_.length;R++){const T=_[R];if(!a.has(T))if(k){const O=new tr([T],new Rb(s,p[T]));if(w){v.issues?v.issues.push(O):v.issues=[O];continue}else return yield*Ke(new qt(s,h,[O]))}else $a(x,T,p[T])}}const E=Zm(m==null?void 0:m.concurrency),j=t3(v,u,E);if(j&&(yield*j),d){const R=OM();for(let O=0;O<f;O++){const $=s.indexSignatures[O],U=Ob(p,$.parameter);for(let V=0;V<U.length;V++){const Z=U[V];R.push([Z,$])}}const T=d(v,R,E);T&&(yield*T)}if(v.issues)return yield*Ke(new qt(s,h,v.issues));if(m.propertyOrder==="original"){const R=(_??Reflect.ownKeys(p)).concat(i),T={};for(const O of R)Object.hasOwn(x,O)&&$a(T,O,x[O]);return Me(T)}return Me(x)})}rebuild(n,s){const i=Pi(this.propertySignatures,u=>{const f=n(u.type);return f===u.type?u:new Ab(u.name,f)}),a=Pi(this.indexSignatures,u=>{var m;const f=n(u.parameter),d=n(u.type),h=s?(m=u.merge)==null?void 0:m.flip():u.merge;return f===u.parameter&&d===u.type&&h===u.merge?u:new e3(f,d,h)});return i===this.propertySignatures&&a===this.indexSignatures?this:new t0(i,a,this.annotations,this.checks,void 0,this.context)}flip(n){return this.rebuild(n,!0)}recur(n){return this.rebuild(n,!1)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}}const t3=Mf()({onItem(e,t){const n=Object.hasOwn(e.input,t.name)?Me(e.input[t.name]):An();return t.parser(n,e.options)},step(e,t,n){var s;if(n._tag==="Failure")return Gc(e,e.ast,t.name,n);if(n.value._tag==="Some")$a(e.out,t.name,n.value.value);else if(!Fr(t.type)){const i=new tr([t.name],new _b((s=t.type.context)==null?void 0:s.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(i):e.issues=[i];return}else return jl(new qt(e.ast,e.oinput,[i]))}}});function n0(e,t,n){return new t0(Reflect.ownKeys(e).map(s=>new Ab(s,e[s].ast)),[],n,t)}function Db(e){return e.ast}function r0(e,t,n){return new $l(e.map(Db),t,void 0,n)}function zb(e){switch(e._tag){case"Null":return["null"];case"Undefined":case"Void":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["object","array"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap(zb)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function s0(e){var t;switch(e._tag){default:return[];case"Declaration":{const n=(t=e.annotations)==null?void 0:t["~sentinels"];return Array.isArray(n)?n:[]}case"Objects":return e.propertySignatures.flatMap(n=>{const s=n.type;if(!Fr(s)){if(Wc(s))return[{key:n.name,literal:s.literal}];if(MO(s))return[{key:n.name,literal:s.symbol}]}return[]});case"Arrays":return e.elements.flatMap((n,s)=>Wc(n)&&!Fr(n)?[{key:s,literal:n.literal}]:[]);case"Suspend":return s0(e.thunk())}}const tw=new WeakMap;function n3(e){var n,s;let t=tw.get(e);if(t)return t;t={};for(const i of e){const a=xs(i);if(NO(a))continue;const u=zb(a),f=s0(a);t.byType??(t.byType={});for(const d of u)((n=t.byType)[d]??(n[d]=[])).push(i);if(f.length>0){t.bySentinel??(t.bySentinel=new Map);for(const{key:d,literal:h}of f){let m=t.bySentinel.get(d);m||t.bySentinel.set(d,m=new Map);let p=m.get(h);p||m.set(h,p=[]),p.push(i)}}else{t.otherwise??(t.otherwise={});for(const d of u)((s=t.otherwise)[d]??(s[d]=[])).push(i)}}return tw.set(e,t),t}function nw(e){return t=>{const n=xs(t);return n._tag==="Literal"?n.literal===e:n._tag==="UniqueSymbol"?n.symbol===e:!0}}function r3(e,t){var i,a;const n=n3(t),s=e===null?"null":Array.isArray(e)?"array":typeof e;if(n.bySentinel){const u=((i=n.otherwise)==null?void 0:i[s])??[];if(s==="object"||s==="array"){for(const[f,d]of n.bySentinel)if(Object.hasOwn(e,f)){const h=d.get(e[f]);if(h)return[...h,...u].filter(nw(e))}}return u}return(((a=n.byType)==null?void 0:a[s])??[]).filter(nw(e))}let $l=class Ub extends fn{constructor(n,s,i,a,u,f){super(i,a,u,f);L(this,"_tag","Union");L(this,"types");L(this,"mode");this.types=n,this.mode=s}getParser(n){const s=this;return(i,a)=>{if(i._tag==="None")return at(i);const u=i.value,f=r3(u,s.types),d={ast:s,recur:n,oinput:i,input:u,out:void 0,successes:[],issues:void 0,options:a},h=Zm(a==null?void 0:a.concurrency),m=s3(d,f,h);return m?zn(m,p=>d.out?at(d.out):Ke(new JS(s,u,d.issues??[]))):d.out?at(d.out):Ke(new JS(s,u,d.issues??[]))}}recur(n){const s=Pi(this.types,n);return s===this.types?this:new Ub(s,this.mode,this.annotations,this.checks,void 0,this.context)}getExpected(n){var a;const s=(a=this.annotations)==null?void 0:a.expected;if(typeof s=="string")return s;if(this.types.length===0)return"never";const i=this.types.map(u=>{const f=xs(u);switch(f._tag){case"Arrays":{const d=f.elements.filter(Wc);if(d.length>0)return`${rw(f.isMutable)}[ ${d.map(h=>{var m;return n(h)+sw((m=h.context)==null?void 0:m.isOptional)}).join(", ")}, ... ]`;break}case"Objects":{const d=f.propertySignatures.filter(h=>Wc(h.type));if(d.length>0)return`{ ${d.map(h=>{var m,p;return`${rw((m=h.type.context)==null?void 0:m.isMutable)}${Fc(h.name)}${sw((p=h.type.context)==null?void 0:p.isOptional)}: ${n(h.type)}`}).join(", ")}, ... }`;break}}return n(f)});return Array.from(new Set(i)).join(" | ")}};const s3=Mf()({onItem(e,t){return e.recur(t)(e.oinput,e.options)},step(e,t,n){if(n._tag==="Failure"){const s=Il(n.cause);if(jt(s))return n;e.issues?e.issues.push(s.success):e.issues=[s.success]}else{if(e.out&&e.ast.mode==="oneOf")return e.successes.push(t),jl(new xO(e.ast,e.input,e.successes));if(e.out=n.value,e.successes.push(t),e.ast.mode==="anyOf")return tb}}}),Vb=new $l([new Ha("Infinity"),new Ha("-Infinity"),new Ha("NaN")],"anyOf"),o3=new Nt(new $l([Lb,Vb],"anyOf"),new _n(Ib(),un(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function rw(e){return e?"":"readonly "}function sw(e){return e?"?":""}class Kc extends cf{constructor(n,s=void 0,i=!1){super();L(this,"_tag","Filter");L(this,"run");L(this,"annotations");L(this,"aborted");this.run=n,this.annotations=s,this.aborted=i}annotate(n){return new Kc(this.run,{...this.annotations,...n},this.aborted)}abort(){return new Kc(this.run,this.annotations,!0)}and(n,s){return new Qc([this,n],s)}}class Qc extends cf{constructor(n,s=void 0){super();L(this,"_tag","FilterGroup");L(this,"checks");L(this,"annotations");this.checks=n,this.annotations=s}annotate(n){return new Qc(this.checks,{...this.annotations,...n})}and(n,s){return new Qc([this,n],s)}}function Bb(e,t,n=!1){return new Kc((s,i,a)=>SO(s,i,e(s,i,a)),t,n)}function i3(e,t){const n=e.source;return Bb(s=>e.test(s),{expected:`a string matching the RegExp ${n}`,meta:{_tag:"isPattern",regExp:e},toArbitraryConstraint:{string:{patterns:[e.source]}},...t})}function Lf(e,t){const n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function Et(e,t){return e.encoding===t?e:Lf(e,n=>{n.encoding.value=t})}function o0(e,t){return e.context===t?e:Lf(e,n=>{n.context.value=t})}function qb(e,t){if(e.checks){const n=e.checks[e.checks.length-1];return Hb(e,Yk(e.checks.slice(0,-1),n.annotate(t)))}return Lf(e,n=>{n.annotations.value={...n.annotations.value,...t}})}function Hb(e,t){return e.checks===t?e:Lf(e,n=>{n.checks.value=t})}function i0(e,t){return Hb(e,e.checks?[...e.checks,...t]:t)}function Wb(e,t){const n=e,s=n[n.length-1],i=t(s.to);return i!==s.to?Yk(e.slice(0,e.length-1),new Nt(i,s.transformation)):e}function a3(e){return t=>t.encoding?Et(t,Wb(t.encoding,e)):t}function l3(e,t,n){const s=new Nt(e,t);return Et(n,n.encoding?[...n.encoding,s]:[s])}function Pi(e,t){let n=!1;const s=new Array(e.length);for(let i=0;i<e.length;i++){const a=e[i],u=t(a);u!==a&&(n=!0),s[i]=u}return n?s:e}function Gb(e,t){const n=e.context?new Ei(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new Ei(!1,!1,void 0,t);return o0(e,n)}const Kb=a3(Qb);function Qb(e){const t=e.context?e.context.isOptional===!1?new Ei(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new Ei(!0,!1);return Kb(o0(e,t))}function u3(e,t){const n=new _n(EO(t),Ri()),s=[new Nt(Xm,n)],i=e.context?new Ei(e.context.isOptional,e.context.isMutable,s,e.context.annotations):new Ei(!1,!1,s);return o0(e,i)}function c3(e,t,n){return l3(e,n,t)}function Fr(e){var t;return((t=e.context)==null?void 0:t.isOptional)??!1}const Jc=Rs(e=>{var n;if(e.encoding)return Jc(Et(e,void 0));const t=e;return((n=t.recur)==null?void 0:n.call(t,Jc))??t}),xs=Rs(e=>Jc(co(e)));function f3(e,t){const n=t,s=n.length,i=n[s-1],a=[new Nt(co(Et(e,void 0)),n[0].transformation.flip())];for(let f=1;f<s;f++)a.unshift(new Nt(co(n[f-1].to),n[f].transformation.flip()));const u=co(i.to);return u.encoding?Et(u,[...u.encoding,...a]):Et(u,a)}const co=Rs(e=>{var n,s;if(e.encoding)return f3(e,e.encoding);const t=e;return((n=t.flip)==null?void 0:n.call(t,co))??((s=t.recur)==null?void 0:s.call(t,co))??t});function Jb(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Jb);default:return!1}}function Yb(e,t){return e.encodedParts.map(n=>h3(n,Xb(n),t)).join("")}const d3=Rs(e=>new globalThis.RegExp(`^${Yb(e,!0)}$`));function Xb(e){switch(e._tag){case"Literal":return dO(globalThis.String(e.literal));case"String":return g3;case"Number":return e0;case"BigInt":return x3;case"TemplateLiteral":return Yb(e,!1);case"Union":return e.types.map(Xb).join("|")}}function h3(e,t,n){if(FO(e)){if(!n)return`(?:${t})`}else if(!n)return t;return`(${t})`}function Of(e,t){const n=IL(t);return s=>s._tag==="None"?Hm:s.value===t?n:Ke(new vr(e,s))}function _o(e,t){return n=>n._tag==="None"?Hm:t(n.value)?at(n):Ke(new vr(e,n))}function Zb(e){function t(n){return n.encoding?Et(n,Wb(n.encoding,t)):e(n)}return Rs(t)}const e_=Zb(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(e_)}}),g3="[\\s\\S]*?",ow=new globalThis.RegExp(`^${e0}$`);function p3(e){return i3(ow,{expected:"a string representing a finite number",meta:{_tag:"isStringFinite",regExp:ow},...e})}const t_=i0(Fb,[p3()]),m3=new Nt(t_,Nb),y3=new Nt(new $l([t_,Vb],"anyOf"),Nb),x3="-?\\d+";function Sp(e,t,n,s,i){for(let a=0;a<e.length;a++){const u=e[a];if(u._tag==="FilterGroup")Sp(u.checks,t,n,s,i);else{const f=u.run(t,s,i);if(f&&(n.push(new mO(t,u,f)),u.aborted||(i==null?void 0:i.errors)!=="all"))return}}}const n_="~effect/Schema/Class",v3="~structural";function S3(e){const t=new Set,n=new Set;return s(e);function s(i){if(i===null||typeof i=="string"||typeof i=="boolean")return!0;if(typeof i=="number")return globalThis.Number.isFinite(i);if(typeof i!="object"||i===void 0||t.has(i))return!1;if(n.has(i))return!0;t.add(i);const a=Array.isArray(i)?i.every(s):Object.keys(i).every(u=>s(i[u]));return t.delete(i),a&&n.add(i),a}}const w3=new Ml([],()=>(e,t)=>S3(e)?at(e):Ke(new vr(t,Me(e))),{typeConstructor:{_tag:"effect/Json"},generation:{runtime:"Schema.Json",Type:"Schema.Json"},expected:"JSON value",toCodecJson:()=>new Nt(Xm,Jm())}),k3=new Nt(Ym,new _n(Ri(),un(()=>null))),C3=new Nt(w3,Jm()),b3=SC,La=bm,_3=Dc,wp=Cm,R3=lF,r_=mF,E3=Symbol.for("effect/MutableList/Empty"),P3=()=>({head:void 0,tail:void 0,length:0}),iw=()=>({array:[],mutable:!0,offset:0,next:void 0}),kp=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=iw(),e.tail=e.tail.next):e.head=e.tail=iw(),e.tail.array.push(t),e.length++},I3=(e,t)=>j3(e,mr(t),!Array.isArray(t)),j3=(e,t,n=!1)=>{if(t.length===0)return 0;const s={array:t,mutable:n,offset:0,next:void 0};return e.head?e.tail=e.tail.next=s:e.head=e.tail=s,e.length+=t.length,t.length},Cc=e=>{e.head=e.tail=void 0,e.length=0},s_=(e,t)=>{var a;if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&((a=e.head)==null?void 0:a.offset)===0&&!e.head.next){const u=e.head.array;return Cc(e),u}const n=new Array(t);let s=0,i=e.head;for(;i;){for(;i.offset<i.array.length;)if(n[s++]=i.array[i.offset],i.mutable&&(i.array[i.offset]=void 0),i.offset++,s===t)return e.head=i,e.length-=t,e.length===0&&Cc(e),n;i=i.next}return Cc(e),n},N3=e=>{if(!e.head)return E3;const t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length&&(e.head.next?e.head=e.head.next:Cc(e)),t},M3="~effect/Queue",T3="~effect/Queue/Enqueue",$3="~effect/Queue/Dequeue",hg={_A:_e,_E:_e},F3={[M3]:hg,[T3]:hg,[$3]:hg,...Ps,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:V3(this)}}},L3=e=>Ve(t=>{const n=Object.create(F3);return n.dispatcher=t.currentDispatcher,n.capacity=(e==null?void 0:e.capacity)??Number.POSITIVE_INFINITY,n.strategy=(e==null?void 0:e.strategy)??"suspend",n.messages=P3(),n.scheduleRunning=!1,n.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},Re(n)}),O3=e=>L3({capacity:e}),A3=(e,t)=>St(()=>{if(e.state._tag!=="Open")return Re(mr(t));const n=D3(e,t);return n.length===0?it([]):e.strategy==="dropping"?Re(n):G3(e,n)}),D3=(e,t)=>{if(e.state._tag!=="Open")return mr(t);if(e.capacity===Number.POSITIVE_INFINITY||e.strategy==="sliding")return I3(e.messages,t),e.strategy==="sliding"&&s_(e.messages,e.messages.length-e.capacity),lw(e),[];const n=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(n===0)return mr(t);const s=[];let i=0;for(const a of t)i<n?kp(e.messages,a):s.push(a),i++;return lw(e),s},Oa=re(2,(e,t)=>yt(()=>z3(e,t))),z3=(e,t)=>{if(e.state._tag!=="Open")return!1;const n=On(t),s=b$(n,q3);return e.state.offers.size===0&&e.messages.length===0?(i_(e,s),!0):(e.state={...e.state,_tag:"Closing",exit:s},!0)},aw=e=>Oa(e,$k(gm())),U3=e=>o_(e,1,Number.POSITIVE_INFINITY),o_=(e,t,n)=>St(()=>W3(e,t,n)??bl(K3(e),o_(e,1,n))),V3=e=>e.state._tag==="Done"?0:e.messages.length,B3=it(!0),q3=yr(gm()),H3=e=>{if(e.scheduleRunning=!1,!(e.state._tag==="Done"||e.state.takers.size===0)){for(const t of e.state.takers)if(e.state.takers.delete(t),t(Dn),e.messages.length===0)break}},lw=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>H3(e),0))},W3=(e,t,n)=>{if(e.state._tag==="Done")return e.state.exit;if(n<=0||t<=0)return it([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,gg(e),e.capacity=0;const s=[N3(e.messages)];return gg(e),it(s)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){const s=s_(e.messages,n);return gg(e),it(s)}},G3=(e,t)=>sr(n=>{if(e.state._tag!=="Open")return n(it(t));const s={_tag:"Array",remaining:t,offset:0,resume:n};return e.state.offers.add(s),yt(()=>{e.state._tag==="Open"&&e.state.offers.delete(s)})}),gg=e=>{if(e.state._tag==="Done")return qS(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(i_(e,e.state.exit),qS(e.state.exit.cause)):!1;let t=e.capacity-e.messages.length;for(const n of e.state.offers){if(t===0)break;if(n._tag==="Single")kp(e.messages,n.message),t--,n.resume(B3),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;kp(e.messages,n.remaining[n.offset]),t--}n.resume(it([])),e.state.offers.delete(n)}}return!1},K3=e=>sr(t=>e.state._tag==="Done"?t(e.state.exit):(e.state.takers.add(t),yt(()=>{e.state._tag!=="Done"&&e.state.takers.delete(t)}))),i_=(e,t)=>{if(e.state._tag==="Done")return;const n=e.state;e.state={_tag:"Done",exit:t};for(const s of n.takers)s(t);n.takers.clear();for(const s of n.awaiters)s(t);n.awaiters.clear()},Q3="~effect/Channel",J3={[Q3]:{_Env:_e,_InErr:_e,_InElem:_e,_OutErr:_e,_OutElem:_e},pipe(){return Lt(this,arguments)}},a0=e=>{const t=Object.create(J3);return t.transform=(n,s)=>hl(e(n,s),i=>at(NL(i))),t},Y3=e=>a0((t,n)=>e),l0=e=>e.transform,X3=e=>Y3(at(U3(e))),Z3=e=>a0((t,n)=>{let s;return at(Ar(()=>s||e.pipe(zc(n),zn(i=>l0(i)(t,n)),zn(i=>s=i))))}),eA=(e,t,n)=>Ar(()=>{const s=Om(),i=l0(e)(ao(),s);return bi(zn(i,t),at).pipe(vb(a=>$f(s,a)))}),tA=re(2,(e,t)=>a0((n,s)=>ko(lo(l0(e)(n,s),t),lo(t)))),nA=re(2,(e,t)=>eA(e,n=>Sb(zn(n,t),{disableYield:!0}))),Ro=e=>e,Aa=Rs(e=>{var t;switch(e._tag){case"Declaration":{const n=(t=e.annotations)==null?void 0:t[n_];if(df(n)){const s=n(e.typeParameters),i=Aa(s.to);return Et(e,i===s.to?[s]:[new Nt(i,s.transformation)])}return e}case"Objects":case"Arrays":return e.recur(n=>{var i;const s=(i=n.context)==null?void 0:i.defaultValue;return s?Et(Aa(n),s):Aa(n)});case"Suspend":return e.recur(Aa);default:return e}});function Af(e){const t=Aa(Jc(e.ast)),n=u0(t);return(s,i)=>n(s,i!=null&&i.disableChecks?i!=null&&i.parseOptions?{...i.parseOptions,disableChecks:!0}:{disableChecks:!0}:i==null?void 0:i.parseOptions)}function a_(e){const t=Af(e);return(n,s)=>YF(wb(t(n,s)))}function rA(e){const t=Af(e);return(n,s)=>Km(Co(t(n,s),i=>new Error(i.toString(),{cause:i})))}function yo(e){return u0(e.ast)}function sA(e){return aA(yo(e))}const oA=sA;function iA(e){return u0(co(e.ast))}function u0(e){const t=bc(e);return(n,s)=>ci(t(Me(n),s??LO),i=>i._tag==="None"?Ke(new Hc(i)):at(i.value))}function aA(e){return(t,n)=>Km(Co(e(t,n),s=>new Error(s.toString(),{cause:s})))}const bc=Rs(e=>{var i;let t;const n=(i=Cb(e))==null?void 0:i.parseOptions;if(!e.context&&!e.encoding&&!e.checks)return(a,u)=>(t??(t=e.getParser(bc)),n&&(u={...u,...n}),t(a,u));const s=TO(e)||$O(e)||Tb(e)&&e.typeParameters.length>0;return(a,u)=>{n&&(u={...u,...n});const f=e.encoding;let d;if(f){const m=f,p=m.length;for(let x=p-1;x>=0;x--){const v=m[x],w=v.to,k=bc(w);if(d=d?ci(d,b=>k(b,u)):k(a,u),v.transformation._tag==="Transformation"){const b=v.transformation.decode;d=ci(d,_=>b.run(_,u))}else d=v.transformation.decode(d,u)}d=Co(d,x=>new yO(e,a,x))}t??(t=e.getParser(bc));let h=d?ci(d,m=>t(m,u)):t(a,u);if(e.checks&&!(u!=null&&u.disableChecks)){const m=e.checks;(u==null?void 0:u.errors)==="all"&&s&&ks(a)&&(h=uO(h,p=>{const x=[];Sp(m.filter(w=>{var k;return(k=w.annotations)==null?void 0:k[v3]}),a.value,x,e,u);const v=CS(x)?p._tag==="Composite"&&p.ast===e?new qt(e,p.actual,[...p.issues,...x]):new qt(e,a,[p,...x]):p;return Ke(v)})),h=ci(h,p=>{if(ks(p)){const x=p.value,v=[];if(Sp(m,x,v,e,u),CS(v))return Ke(new qt(e,p,v))}return at(p)})}return h}}),Cp="~effect/Schema/Schema",lA={[Cp]:Cp,pipe(){return Lt(this,arguments)},annotate(e){return this.rebuild(qb(this.ast,e))},annotateKey(e){return this.rebuild(Gb(this.ast,e))},check(...e){return this.rebuild(i0(this.ast,e))}};function c0(e,t){const n=Object.create(lA);return t&&Object.assign(n,t),n.ast=e,n.rebuild=s=>c0(s,t),n.makeEffect=Ck(Af(n),Co(s=>new Df(s))),n.make=rA(n),n.makeOption=a_(n),n}const uw="~effect/Schema/SchemaError";var c1;c1=uw;class Df{constructor(t){L(this,c1,uw);L(this,"_tag","SchemaError");L(this,"name","SchemaError");L(this,"issue");this.issue=t}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}}const uA=fA(cA);function cA(e){switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}}function fA(e){return t=>{const n=new Map;for(let a=0;a<t.length;a++)n.set(xs(t[a]),a);const s=[...t].sort((a,u)=>{a=xs(a),u=xs(u);const f=e(a),d=e(u);return f!==d?f-d:n.get(a)-n.get(u)});return s.some((a,u)=>a!==t[u])?s:t}}const Wa=Cp;function zf(){return(e,t,n)=>Be(new Ml(e.map(Db),s=>t(s.map(i=>Be(i))),n))}function l_(e,t){return zf()([],()=>(n,s)=>e(n)?at(n):Ke(new vr(s,Me(n))),t)}function cw(e){const t=yo(e);return(n,s)=>Co(t(n,s),i=>new Df(i))}const dA=oA;function hA(e){const t=iA(e);return(n,s)=>Co(t(n,s),i=>new Df(i))}const gA=hA,Be=c0;function f0(e){return De(e,Wa)&&e[Wa]===Wa}const Yc=Ro(e=>Be(Qb(e.ast),{schema:e})),Mi=Ro(e=>Yc(f_(e)));function vs(e){const t=Be(new Ha(e),{literal:e,transform(n){return t.pipe(ef(vs(n),{decode:un(()=>n),encode:un(()=>e)}))}});return t}const fw=Be(BO),dw=Be(HO),u_=Be(Xm),pA=Be(Ym),mA=Be(DO),gt=Be(Fb),Xc=Be(Lb),bp=Be(JO),Zc=Be(UO);function d0(e,t){return Be(e,{fields:t,mapFields(n,s){const i=n(this.fields);return d0(n0(i,s!=null&&s.unsafePreserveChecks?this.ast.checks:void 0),i)}})}function Pt(e){return d0(n0(e,void 0),e)}const gi=Ro(e=>Be(new Tl(!1,[],[e.ast]),{schema:e})),yA=Ro(e=>Be(new Tl(!1,[e.ast],[e.ast]),{schema:e})),pg=Ro(e=>Be(new Tl(!0,e.ast.elements,e.ast.rest),{schema:e}));function c_(e,t){return Be(e,{members:t,mapMembers(n,s){const i=n(this.members);return c_(r0(i,this.ast.mode,s!=null&&s.unsafePreserveChecks?this.ast.checks:void 0),i)}})}function nr(e,t){return c_(r0(e,"anyOf",void 0),e)}function Ss(e){const t=e.map(vs);return Be(r0(t,"anyOf",void 0),{literals:e,members:t,mapMembers(n){return nr(n(this.members))},pick(n){return Ss(n)},transform(n){return nr(t.map((s,i)=>s.transform(n[i])))}})}const _p=Ro(e=>nr([e,pA])),f_=Ro(e=>nr([e,mA]));function ef(e,t){return n=>Be(c3(n.ast,e.ast,t?jb(t):Jm()),{from:n,to:e})}function xA(e){return t=>Be(u3(t.ast,e),{schema:t})}function dn(e){return vs(e).pipe(xA(at(e)))}function vA(e,t){return Pt({_tag:dn(e),...t})}function SA(e,t){return l_(n=>n instanceof e,t)}function Fl(){return(e,t)=>new Nt(e.ast,jb(t))}const wA=Bb;function kA(e){return wA(t=>globalThis.Number.isFinite(t),{expected:"a finite number",meta:{_tag:"isFinite"},toArbitraryConstraint:{number:{noDefaultInfinity:!0,noNaN:!0}},...e})}function hw(e,t){const n=zf()([e,t],([s,i])=>(a,u,f)=>{if(!BF(a))return Ke(new vr(u,Me(a)));switch(a._tag){case"Fail":return gl(yo(s)(a.error,f),{onSuccess:ip,onFailure:d=>new qt(u,Me(a),[new tr(["error"],d)])});case"Die":return gl(yo(i)(a.defect,f),{onSuccess:ap,onFailure:d=>new qt(u,Me(a),[new tr(["defect"],d)])});case"Interrupt":return at(a)}},{typeConstructor:{_tag:"effect/Cause/Failure"},generation:{runtime:"Schema.CauseReason(?, ?)",Type:"Cause.Failure<?, ?>",importDeclaration:'import * as Cause from "effect/Cause"'},expected:"Cause.Failure",toCodec:([s,i])=>Fl()(nr([Pt({_tag:vs("Fail"),error:s}),Pt({_tag:vs("Die"),defect:i}),Pt({_tag:vs("Interrupt"),fiberId:f_(_A)})]),Ff({decode:a=>{switch(a._tag){case"Fail":return ip(a.error);case"Die":return ap(a.defect);case"Interrupt":return lp(a.fiberId)}},encode:_e})),toArbitrary:([s,i])=>d_(s,i),toEquivalence:([s,i])=>h_(s,i),toFormatter:([s,i])=>g_(s,i)});return Be(n.ast,{error:e,defect:t})}function d_(e,t){return(n,s)=>n.oneof(s!=null&&s.isSuspend?{maxDepth:2,depthIdentifier:"Cause.Failure"}:{},n.constant(lp()),n.integer({min:1}).map(lp),e.map(i=>ip(i)),t.map(i=>ap(i)))}function h_(e,t){return(n,s)=>{if(n._tag!==s._tag)return!1;switch(n._tag){case"Fail":return e(n.error,s.error);case"Die":return t(n.defect,s.defect);case"Interrupt":return n.fiberId===s.fiberId}}}function g_(e,t){return n=>{switch(n._tag){case"Fail":return`Fail(${e(n.error)})`;case"Die":return`Die(${t(n.defect)})`;case"Interrupt":return"Interrupt"}}}function gw(e,t){const n=zf()([e,t],([s,i])=>{const a=gi(hw(s,i));return(u,f,d)=>VF(u)?gl(yo(a)(u.reasons,d),{onSuccess:op,onFailure:h=>new qt(f,Me(u),[new tr(["failures"],h)])}):Ke(new vr(f,Me(u)))},{typeConstructor:{_tag:"effect/Cause"},generation:{runtime:"Schema.Cause(?, ?)",Type:"Cause.Cause<?, ?>",importDeclaration:'import * as Cause from "effect/Cause"'},expected:"Cause",toCodec:([s,i])=>Fl()(gi(hw(s,i)),Ff({decode:op,encode:({reasons:a})=>a})),toArbitrary:([s,i])=>p_(s,i),toEquivalence:([s,i])=>m_(s,i),toFormatter:([s,i])=>y_(s,i)});return Be(n.ast,{error:e,defect:t})}function p_(e,t){return(n,s)=>n.array(d_(e,t)(n,s)).map(op)}function m_(e,t){const n=ON(h_(e,t));return(s,i)=>n(s.reasons,i.reasons)}function y_(e,t){const n=g_(e,t);return s=>`Cause([${s.reasons.map(n).join(", ")}])`}const x_=Pt({message:gt,name:Yc(gt),stack:Yc(gt)}),CA=SA(globalThis.Error,{typeConstructor:{_tag:"Error"},generation:{runtime:"Schema.Error",Type:"globalThis.Error"},expected:"Error",toCodecJson:()=>Fl()(x_,Mb()),toArbitrary:()=>e=>e.string().map(t=>new globalThis.Error(t))}),pw=new _n(Ri(),un(e=>{try{return JSON.parse(JSON.stringify(e))}catch{return vt(e)}})),or=nr([x_.pipe(ef(CA,Mb())),dw.pipe(ef(u_.annotate({toCodecJson:()=>Fl()(dw,pw),toArbitrary:()=>e=>e.json()}),pw))]);function bA(e,t,n){const s=zf()([e,t,n],([i,a,u])=>{const f=gw(a,u);return(d,h,m)=>{if(!GF(d))return Ke(new vr(h,Me(d)));switch(d._tag){case"Success":return gl(yo(i)(d.value,m),{onSuccess:dg,onFailure:p=>new qt(h,Me(d),[new tr(["value"],p)])});case"Failure":return gl(yo(f)(d.cause,m),{onSuccess:Va,onFailure:p=>new qt(h,Me(d),[new tr(["cause"],p)])})}}},{typeConstructor:{_tag:"effect/Exit"},generation:{runtime:"Schema.Exit(?, ?, ?)",Type:"Exit.Exit<?, ?, ?>",importDeclaration:'import * as Exit from "effect/Exit"'},expected:"Exit",toCodec:([i,a,u])=>Fl()(nr([Pt({_tag:vs("Success"),value:i}),Pt({_tag:vs("Failure"),cause:gw(a,u)})]),Ff({decode:f=>f._tag==="Success"?dg(f.value):Va(f.cause),encode:f=>JF(f)?{_tag:"Success",value:f.value}:{_tag:"Failure",cause:f.cause}})),toArbitrary:([i,a,u])=>(f,d)=>f.oneof(d!=null&&d.isSuspend?{maxDepth:2,depthIdentifier:"Exit"}:{},i.map(h=>dg(h)),p_(a,u)(f,d).map(h=>Va(h))),toEquivalence:([i,a,u])=>{const f=m_(a,u);return(d,h)=>{if(d._tag!==h._tag)return!1;switch(d._tag){case"Success":return i(d.value,h.value);case"Failure":return f(d.cause,h.cause)}}},toFormatter:([i,a,u])=>{const f=y_(a,u);return d=>{switch(d._tag){case"Success":return`Exit.Success(${i(d.value)})`;case"Failure":return`Exit.Failure(${f(d.cause)})`}}}});return Be(s.ast,{value:e,error:t,defect:n})}const _A=Xc.check(kA()),RA=globalThis.Symbol.for("immer-draftable");function h0(e,t,n,s,i){var d,h,m,p;const a=PA(n,t,s),u=v_(t),f=(p=class extends e{constructor(...[x,v]){x=x??{};const w=n.make(x,v);super({...x,...w},{...v,disableChecks:!0})}get[(m=Wa,h=u,d=RA,h)](){return u}static get ast(){return a(this).ast}static pipe(){return Lt(this,arguments)}static rebuild(x){return a(this).rebuild(x)}static make(x,v){return new this(x,v)}static makeOption(x,v){return a_(a(this))(x??{},v)}static makeEffect(x,v){return Co(Af(a(this))(x??{},v),w=>new Df(w))}static annotate(x){return this.rebuild(qb(this.ast,x))}static annotateKey(x){return this.rebuild(Gb(this.ast,x))}static check(...x){return this.rebuild(i0(this.ast,x))}static extend(x){return(v,w)=>{const k={...n.fields,...v};return h0(this,x,d0(n0(k,n.ast.checks,{identifier:x}),k),w,i)}}static mapFields(x,v){return n.mapFields(x,v)}},L(p,m,Wa),L(p,d,!0),L(p,"identifier",t),L(p,"fields",n.fields),p);return i!==void 0&&Object.assign(f.prototype,i(t)),f}function EA(e){return new _n(un(t=>new e(t)),Ri())}function v_(e){return`~effect/Schema/Class/${e}`}function PA(e,t,n){let s;return i=>{if(s===void 0){const a=EA(i),u=Be(new Ml([e.ast],()=>(f,d)=>f instanceof i||De(f,v_(t))?at(f):Ke(new vr(d,Me(f))),{identifier:t,[n_]:([f])=>new Nt(f,a),toCodec:([f])=>new Nt(f.ast,a),toArbitrary:([f])=>()=>f.map(d=>new i(d)),toFormatter:([f])=>d=>`${i.identifier}(${f(d)})`,"~sentinels":s0(e.ast),...n}));s=e.pipe(ef(u,a))}return s}}function g0(e){return f0(e)}const IA=e=>(t,n)=>{const s=g0(t)?t:Pt(t);return h0(fL,e,s,n,i=>({toString(){return`${i}(${vt({...this})})`}}))},Vn=e=>(t,n)=>{const s=g0(t)?t:Pt(t);return h0(Ok,e,s,n,a=>({name:a}))},jA=e=>(t,n,s)=>Vn(e)(g0(n)?n.mapFields(i=>({_tag:dn(t),...i}),{unsafePreserveChecks:!0}):vA(t,n),s);function mg(e){return Be(S_(e.ast))}const S_=Zb(e=>{const t=NA(e,S_);return t!==e&&Fr(e)?Kb(t):t});function NA(e,t){var n,s;switch(e._tag){case"Declaration":{const i=((n=e.annotations)==null?void 0:n.toCodecJson)??((s=e.annotations)==null?void 0:s.toCodec);if(df(i)){const a=Tb(e)?e.typeParameters.map(d=>c0(xs(d))):[],u=i(a),f=t(u.to);return Et(e,f===u.to?[u]:[new Nt(f,u.transformation)])}return Et(e,[k3])}case"Unknown":case"ObjectKeyword":return Et(e,[C3]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":{if(e.propertySignatures.some(i=>typeof i.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e});return e.recur(t)}case"Union":{const i=uA(e.types);return i!==e.types?new $l(i,e.mode,e.annotations,e.checks,e.encoding,e.context).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}const MA="~effect/Stream",TA={_R:_e,_E:_e,_A:_e},$A={[MA]:TA,pipe(){return Lt(this,arguments)}},FA=e=>{const t=Object.create($A);return t.channel=e,t},LA="~effect/Stream",OA=e=>De(e,LA),p0=FA,AA=e=>e.channel,DA=e=>p0(X3(e)),zA=e=>p0(Z3(ko(e,AA))),UA=re(2,(e,t)=>p0(tA(e.channel,t))),VA=re(2,(e,t)=>nA(e.channel,n=>{let s=0;return gb({while:()=>s<n.length,body:()=>t(n[s++]),step:wl})})),Rp="~effect/FiberSet",BA=e=>De(e,Rp),qA={[Rp]:Rp,[Symbol.iterator](){return this.state._tag==="Closed"?_M():this.state.backing[Symbol.iterator]()},...Ps,toJSON(){return{_id:"FiberMap",state:this.state}}},HA=(e,t)=>{const n=Object.create(qA);return n.state={_tag:"Open",backing:e},n.deferred=t,n},WA=()=>yb(Ln(()=>HA(new Set,Fm())),e=>Ar(()=>{const t=e.state;if(t._tag==="Closed")return rt;e.state={_tag:"Closed"};const n=t.backing;return _3(n).pipe(tL(e.deferred))})),w_=-1,GA=gT(mT(WF,pT(w_))),KA=re(e=>BA(e[0]),(e,t,n)=>{if(e.state._tag==="Closed"){t.interruptUnsafe(w_);return}else if(e.state.backing.has(t))return;e.state.backing.add(t),t.addObserver(s=>{e.state._tag!=="Closed"&&(e.state.backing.delete(t),nb(s)&&((n==null?void 0:n.propagateInterruption)===!0?!GA(s.cause):!qF(s.cause))&&Ba(e.deferred,s))})}),QA=(function(){let e;return()=>(e===void 0&&(e=gp(hp)),e)})(),JA=e=>()=>ko(Bc(),t=>{const n=qc(t);return(s,i)=>{if(e.state._tag==="Closed")return QA();const a=n(s,i);return KA(e,a),a}}),mw=e=>Lm(e.deferred),YA="~effect/interfaces/PrimaryKey",yw="~effect/ManagedRuntime",XA=(e,t)=>{const n=(t==null?void 0:t.memoMap)??Dm(),s=Om("parallel"),i=Uc(s,"sequential"),a={onFiberStart:R3(s)},u=m=>m?{...m,onFiberStart:m.onFiberStart?p=>{a.onFiberStart(p),m.onFiberStart(p)}:a.onFiberStart}:a;let f;const d=Vc(m=>(f||(f=gp(FL(zm(e,n,i),p=>Ln(()=>{h.cachedContext=p})),{...a,scheduler:m.currentScheduler})),TL(b3(f)))),h={[yw]:yw,memoMap:n,scope:s,contextEffect:d,cachedContext:void 0,context(){return h.cachedContext===void 0?qa(h.contextEffect):Promise.resolve(h.cachedContext)},dispose(){return qa(h.disposeEffect)},disposeEffect:Ar(()=>(h.contextEffect=ML("ManagedRuntime disposed"),h.cachedContext=void 0,$f(h.scope,tb))),runFork(m,p){return h.cachedContext===void 0?gp(si(h,m),u(p)):qc(h.cachedContext)(m,u(p))},runCallback(m,p){return h.cachedContext===void 0?tO(si(h,m),u(p)):eO(h.cachedContext)(m,u(p))},runSyncExit(m){return h.cachedContext===void 0?wb(si(h,m)):iO(h.cachedContext)(m)},runSync(m){return h.cachedContext===void 0?Km(si(h,m)):oO(h.cachedContext)(m)},runPromiseExit(m,p){return h.cachedContext===void 0?rO(si(h,m),u(p)):sO(h.cachedContext)(m,u(p))},runPromise(m,p){return h.cachedContext===void 0?qa(si(h,m),u(p)):nO(h.cachedContext)(m,u(p))}};return h};function si(e,t){return zn(e.contextEffect,n=>lo(t,n))}const Ep="~effect/rpc/RpcSchema/StreamSchema";function k_(e){return De(e,Ep)}function C_(e){return k_(e)?Me({success:e.success,error:e.error}):An()}const ZA=l_(OA);function eD(e,t){return Be(ZA.ast,{[Ep]:Ep,success:e,error:t})}const xw="~effect/rpc/Rpc",tD={[xw]:xw,pipe(){return Lt(this,arguments)},setSuccess(e){return as({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return as({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return as({_tag:this._tag,payloadSchema:f0(e)?e:Pt(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return as({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,e])})},prefix(e){return as({_tag:`${e}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(e,t){return as({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Is(this.annotations,e,t)})},annotateMerge(e){return as({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:ki(this.annotations,e)})}},as=e=>{function t(){}return Object.setPrototypeOf(t,tD),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},Ti=(e,t)=>{const n=(t==null?void 0:t.success)??Zc,s=(t==null?void 0:t.error)??fw,i=(t==null?void 0:t.defect)??or;let a;return t!=null&&t.primaryKey?a=class extends IA(`effect/rpc/Rpc/${e}`)(t.payload){[YA](){return t.primaryKey(this)}}:a=f0(t==null?void 0:t.payload)?t==null?void 0:t.payload:t!=null&&t.payload?Pt(t==null?void 0:t.payload):Zc,as({_tag:e,payloadSchema:a,successSchema:t!=null&&t.stream?eD(n,s):n,errorSchema:t!=null&&t.stream?fw:s,defectSchema:i,annotations:er(),middlewares:new Set})},yg=new WeakMap,nD=e=>{if(yg.has(e))return yg.get(e);const t=e,n=new Set([t.errorSchema]),s=C_(t.successSchema);ks(s)&&n.add(s.value.error);for(const a of t.middlewares)n.add(a.error);const i=bA(ks(s)?Zc:t.successSchema,nr([...n]),t.defectSchema);return yg.set(e,i),i},rD="~effect/rpc/Rpc/Wrapper",sD=e=>rD in e,vw=Symbol.for("~effect/http/Headers"),ml=Object.create(null);Object.defineProperties(ml,{[vw]:{value:vw},[gf]:{value(e){return lD(this,io(e,uD))}},toJSON:{value(){return pf(this)}},[Xt]:{value(e){return iD(this,e)}},[Yt]:{value(){return lm(this)}},toString:{value:vS.toString},[go]:{value:vS[go]}});const oD=e=>Object.assign(Object.create(ml),e),iD=IM(LN()),m0=Object.create(ml),aD=e=>{if(e===void 0)return m0;if(Symbol.iterator in e){const n=Object.create(ml);for(const[s,i]of e)n[s.toLowerCase()]=i;return n}const t=Object.create(ml);for(const[n,s]of Object.entries(e))Array.isArray(s)?t[n.toLowerCase()]=s.join(", "):s!==void 0&&(t[n.toLowerCase()]=s);return t},Sw=re(2,(e,t)=>{const n=oD(e);return Object.assign(n,t),n}),lD=re(2,(e,t)=>{const n={...e},s=i=>{if(typeof i=="string"){const a=i.toLowerCase();a in e&&(n[a]=QS(e[a]))}else for(const a in e)i.test(a)&&(n[a]=QS(e[a]))};if(Array.isArray(t))for(let i=0;i<t.length;i++)s(t[i]);else s(t);return n}),uD=Xe("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key"]}),cD="~effect/http/HttpClientError";class y0 extends Vn(cD)({_tag:dn("HttpError"),kind:Ss(["EncodeError","DecodeError","TransportError","InvalidUrlError","StatusCodeError","EmptyBodyError"]),cause:Mi(or)}){static fromHttpClientError(t){return new y0({_tag:"HttpError",kind:t.reason._tag,cause:t.reason})}}const ww="~effect/socket/Socket",x0=Un("effect/socket/Socket"),fD=e=>x0.of({[ww]:ww,runRaw:e.runRaw,run:e.run??((t,n)=>e.runRaw(s=>typeof s=="string"?t(dD.encode(s)):s instanceof Uint8Array?t(s):t(new Uint8Array(s)),n)),runString:e.runString??(e.run?(t,n)=>e.run(s=>t(xg.decode(s)),n):(t,n)=>e.runRaw(s=>typeof s=="string"?t(s):s instanceof Uint8Array?t(xg.decode(s)):t(xg.decode(new Uint8Array(s))),n)),writer:e.writer}),dD=new TextEncoder,xg=new TextDecoder,hD="~effect/socket/Socket/CloseEvent",gD=e=>De(e,hD),_c="~effect/socket/Socket/SocketError",pD=e=>De(e,_c);class b_ extends Vn("effect/socket/Socket/SocketReadError")({_tag:dn("SocketReadError"),cause:or}){constructor(){super(...arguments);L(this,"message","An error occurred during Read")}}class mD extends Vn("effect/socket/Socket/SocketWriteError")({_tag:dn("SocketWriteError"),cause:or}){constructor(){super(...arguments);L(this,"message","An error occurred during Write")}}class tf extends Vn("effect/socket/Socket/SocketOpenError")({_tag:dn("SocketOpenError"),kind:Ss(["Unknown","Timeout"]),cause:or}){get message(){return this.kind==="Timeout"?'timeout waiting for "open"':"An error occurred during Open"}}class nf extends Vn("effect/socket/Socket/SocketCloseError")({_tag:dn("SocketCloseError"),code:Xc,closeReason:Mi(gt)}){static filterClean(t){return function(n){return pi.is(n)&&n.reason._tag==="SocketCloseError"&&t(n.reason.code)?Dr(n.reason):Zn(n)}}get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}}const __=nr([b_,mD,tf,nf]);var f1,d1;class pi extends(d1=jA(_c)("SocketError",{_tag:dn("SocketError"),reason:__}),f1=_c,d1){constructor(n){var t=(...xU)=>(super(...xU),L(this,f1,_c),L(this,"message",this.reason.message),this);"cause"in n.reason?t({...n,cause:n.reason.cause}):t(n)}static is(n){return pD(n)}}const yD=e=>!0;class xD extends Un()("~effect/socket/Socket/WebSocket"){}class R_ extends Un()("@effect/platform/Socket/WebSocketConstructor"){}const vD=Um(R_)((e,t)=>new globalThis.WebSocket(e,t)),SD=(e,t)=>R_.use(n=>wD(yb((typeof e=="string"?at(e):e).pipe(ko(s=>n(s,t==null?void 0:t.protocols))),s=>Ln(()=>s.close(1e3))),t)),wD=(e,t)=>Vc(n=>{let s;const i=r_(!1),a=n.context,u=(t==null?void 0:t.closeCodeIsError)??yD,f=(m,p)=>KL(uo(function*(x){const v=yield*WA().pipe(zc(x)),w=yield*zc(e,x),k=yield*GL(JA(v)(),xD,w);let b=!1;function _(R){if(R.data instanceof Blob){const O=zn(PL(()=>R.data.arrayBuffer()),$=>{const U=m(new Uint8Array($));return hi(U)?U:rt});return k(O)}const T=m(R.data);hi(T)&&k(T)}function E(R){w.removeEventListener("message",_),w.removeEventListener("close",j),Ba(v.deferred,Ke(new pi({reason:b?new b_({cause:R}):new tf({kind:"Unknown",cause:R})})))}function j(R){const T=typeof R.code=="number"?R.code:1001;w.removeEventListener("message",_),w.removeEventListener("error",E),Ba(v.deferred,Ke(new pi({reason:new nf({code:T,closeReason:R.reason})})))}if(w.addEventListener("close",j,{once:!0}),w.addEventListener("error",E,{once:!0}),w.addEventListener("message",_),w.readyState!==1){const R=Fm();w.addEventListener("open",()=>{b=!0,Ba(R,rt)},{once:!0}),yield*Lm(R).pipe(UL({duration:(t==null?void 0:t.openTimeout)??1e4,orElse:()=>Ke(new pi({reason:new tf({kind:"Timeout",cause:new Error('timeout waiting for "open"')})}))}),pb(mw(v)))}return b=!0,s=w,i.openUnsafe(),p!=null&&p.onOpen&&(yield*p.onOpen),yield*LL(mw(v),nf.filterClean(R=>!u(R)),()=>rt)})).pipe(WL(x=>ki(a,x)),xb(Ln(()=>{i.closeUnsafe(),s=void 0}))),h=at(m=>i.whenOpen(Ln(()=>{const p=s;gD(m)?p.close(m.code,m.reason):p.send(m)})));return at(fD({runRaw:f,writer:h}))}),kD=Ck(SD,up(x0));class E_ extends Un()("effect/workers/Transferable/Collector"){}const CD=()=>{let e=[];const t=i=>{e.push(...i)},n=()=>e,s=()=>{const i=e;return e=[],i};return E_.of({addAllUnsafe:t,addAll:i=>Ln(()=>t(i)),readUnsafe:n,read:Ln(n),clearUnsafe:s,clear:Ln(s)})};class bD extends Vn("effect/workers/WorkerError/WorkerSpawnError")({_tag:dn("WorkerSpawnError"),message:gt,cause:Mi(or)}){}class _D extends Vn("effect/workers/WorkerError/WorkerSendError")({_tag:dn("WorkerSendError"),message:gt,cause:Mi(or)}){}class RD extends Vn("effect/workers/WorkerError/WorkerReceiveError")({_tag:dn("WorkerReceiveError"),message:gt,cause:Mi(or)}){}class ED extends Vn("effect/workers/WorkerError/WorkerUnknownError")({_tag:dn("WorkerUnknownError"),message:gt,cause:Mi(or)}){}const PD=nr([bD,_D,RD,ED]),vg="~effect/rpc/RpcClientError";class Pp extends Vn("effect/rpc/RpcClientError/RpcClientDefect")({_tag:dn("RpcClientDefect"),message:gt,cause:or}){}var h1,g1;class kw extends(g1=Vn(vg)({_tag:dn("RpcClientError"),reason:nr([PD,__,y0,Pp])}),h1=vg,g1){constructor(){super(...arguments);L(this,h1,vg)}get message(){return`${this.reason._tag}: ${this.reason.message}`}}const rc=e=>typeof e=="bigint"?e:BigInt(e),ID={_tag:"Ping"};var Ip;try{Ip=new TextDecoder}catch{}var ue,pr,A=0,He={},Ne,hs,$n=0,hr=0,Rt,Lr,cn=[],je,Cw={useRecords:!1,mapsAsObjects:!0};class P_{}const I_=new P_;I_.name="MessagePack 0xC1";var ws=!1,bw=2,jD;class yl{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,n){if(ue)return F_(()=>(Np(),this?this.unpack(t,n):yl.prototype.unpack.call(Cw,t,n)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof n=="object"?(pr=n.end||t.length,A=n.start||0):(A=0,pr=n>-1?n:t.length),hr=0,hs=null,Rt=null,ue=t;try{je=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(s){throw ue=null,t instanceof Uint8Array?s:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof yl){if(He=this,this.structures)return Ne=this.structures,sc(n);(!Ne||Ne.length>0)&&(Ne=[])}else He=Cw,(!Ne||Ne.length>0)&&(Ne=[]);return sc(n)}unpackMultiple(t,n){let s,i=0;try{ws=!0;let a=t.length,u=this?this.unpack(t,a):Uf.unpack(t,a);if(n){if(n(u,i,A)===!1)return;for(;A<a;)if(i=A,n(sc(),i,A)===!1)return}else{for(s=[u];A<a;)i=A,s.push(sc());return s}}catch(a){throw a.lastPosition=i,a.values=s,a}finally{ws=!1,Np()}}_mergeStructures(t,n){t=t||[],Object.isFrozen(t)&&(t=t.map(s=>s.slice(0)));for(let s=0,i=t.length;s<i;s++){let a=t[s];a&&(a.isShared=!0,s>=32&&(a.highByte=s-32>>5))}t.sharedLength=t.length;for(let s in n||[])if(s>=0){let i=t[s],a=n[s];a&&(i&&((t.restoreStructures||(t.restoreStructures=[]))[s]=i),t[s]=a)}return this.structures=t}decode(t,n){return this.unpack(t,n)}}function sc(e){try{if(!He.trusted&&!ws){let n=Ne.sharedLength||0;n<Ne.length&&(Ne.length=n)}let t;if(He.randomAccessStructure&&ue[A]<64&&ue[A]>=32&&jD||(t=ft()),Rt&&(A=Rt.postBundlePosition,Rt=null),ws&&(Ne.restoreStructures=null),A==pr)Ne&&Ne.restoreStructures&&_w(),Ne=null,ue=null,Lr&&(Lr=null);else{if(A>pr)throw new Error("Unexpected end of MessagePack data");if(!ws){let n;try{n=JSON.stringify(t,(s,i)=>typeof i=="bigint"?`${i}n`:i).slice(0,100)}catch(s){n="(JSON view not available "+s+")"}throw new Error("Data read, but end of buffer not reached "+n)}}return t}catch(t){throw Ne&&Ne.restoreStructures&&_w(),Np(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||A>pr)&&(t.incomplete=!0),t}}function _w(){for(let e in Ne.restoreStructures)Ne[e]=Ne.restoreStructures[e];Ne.restoreStructures=null}function ft(){let e=ue[A++];if(e<160)if(e<128){if(e<64)return e;{let t=Ne[e&63]||He.getStructures&&j_()[e&63];return t?(t.read||(t.read=v0(t,e&63)),t.read()):e}}else if(e<144)if(e-=128,He.mapsAsObjects){let t={};for(let n=0;n<e;n++){let s=M_();s==="__proto__"&&(s="__proto_"),t[s]=ft()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(ft(),ft());return t}else{e-=144;let t=new Array(e);for(let n=0;n<e;n++)t[n]=ft();return He.freezeData?Object.freeze(t):t}else if(e<192){let t=e-160;if(hr>=A)return hs.slice(A-$n,(A+=t)-$n);if(hr==0&&pr<140){let n=t<16?S0(t):N_(t);if(n!=null)return n}return jp(t)}else{let t;switch(e){case 192:return null;case 193:return Rt?(t=ft(),t>0?Rt[1].slice(Rt.position1,Rt.position1+=t):Rt[0].slice(Rt.position0,Rt.position0-=t)):I_;case 194:return!1;case 195:return!0;case 196:if(t=ue[A++],t===void 0)throw new Error("Unexpected end of buffer");return Sg(t);case 197:return t=je.getUint16(A),A+=2,Sg(t);case 198:return t=je.getUint32(A),A+=4,Sg(t);case 199:return Ks(ue[A++]);case 200:return t=je.getUint16(A),A+=2,Ks(t);case 201:return t=je.getUint32(A),A+=4,Ks(t);case 202:if(t=je.getFloat32(A),He.useFloat32>2){let n=w0[(ue[A]&127)<<1|ue[A+1]>>7];return A+=4,(n*t+(t>0?.5:-.5)>>0)/n}return A+=4,t;case 203:return t=je.getFloat64(A),A+=8,t;case 204:return ue[A++];case 205:return t=je.getUint16(A),A+=2,t;case 206:return t=je.getUint32(A),A+=4,t;case 207:return He.int64AsType==="number"?(t=je.getUint32(A)*4294967296,t+=je.getUint32(A+4)):He.int64AsType==="string"?t=je.getBigUint64(A).toString():He.int64AsType==="auto"?(t=je.getBigUint64(A),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=je.getBigUint64(A),A+=8,t;case 208:return je.getInt8(A++);case 209:return t=je.getInt16(A),A+=2,t;case 210:return t=je.getInt32(A),A+=4,t;case 211:return He.int64AsType==="number"?(t=je.getInt32(A)*4294967296,t+=je.getUint32(A+4)):He.int64AsType==="string"?t=je.getBigInt64(A).toString():He.int64AsType==="auto"?(t=je.getBigInt64(A),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=je.getBigInt64(A),A+=8,t;case 212:if(t=ue[A++],t==114)return Nw(ue[A++]&63);{let n=cn[t];if(n)return n.read?(A++,n.read(ft())):n.noBuffer?(A++,n()):n(ue.subarray(A,++A));throw new Error("Unknown extension "+t)}case 213:return t=ue[A],t==114?(A++,Nw(ue[A++]&63,ue[A++])):Ks(2);case 214:return Ks(4);case 215:return Ks(8);case 216:return Ks(16);case 217:return t=ue[A++],hr>=A?hs.slice(A-$n,(A+=t)-$n):MD(t);case 218:return t=je.getUint16(A),A+=2,hr>=A?hs.slice(A-$n,(A+=t)-$n):TD(t);case 219:return t=je.getUint32(A),A+=4,hr>=A?hs.slice(A-$n,(A+=t)-$n):$D(t);case 220:return t=je.getUint16(A),A+=2,Ew(t);case 221:return t=je.getUint32(A),A+=4,Ew(t);case 222:return t=je.getUint16(A),A+=2,Pw(t);case 223:return t=je.getUint32(A),A+=4,Pw(t);default:if(e>=224)return e-256;if(e===void 0){let n=new Error("Unexpected end of MessagePack data");throw n.incomplete=!0,n}throw new Error("Unknown MessagePack token "+e)}}}const ND=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function v0(e,t){function n(){if(n.count++>bw){let i;try{i=e.read=new Function("r","return function(){return "+(He.freezeData?"Object.freeze":"")+"({"+e.map(a=>a==="__proto__"?"__proto_:r()":ND.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(ft)}catch{return bw=1/0,n()}return e.read0=i,e.highByte===0&&(e.read=Rw(t,e.read)),i()}let s={};for(let i=0,a=e.length;i<a;i++){let u=e[i];u==="__proto__"&&(u="__proto_"),s[u]=ft()}return He.freezeData?Object.freeze(s):s}return n.count=0,e.read0=n,e.highByte===0?Rw(t,n):n}const Rw=(e,t)=>function(){let n=ue[A++];if(n===0)return t();let s=e<32?-(e+(n<<5)):e+(n<<5),i=Ne[s]||j_()[s];if(!i)throw new Error("Record id is not defined for "+s);return i.read||(i.read=v0(i,e)),i.read()};function j_(){let e=F_(()=>(ue=null,He.getStructures()));return Ne=He._mergeStructures(e,Ne)}var jp=Ll,MD=Ll,TD=Ll,$D=Ll;function Ll(e){let t;if(e<16&&(t=S0(e)))return t;if(e>64&&Ip)return Ip.decode(ue.subarray(A,A+=e));const n=A+e,s=[];for(t="";A<n;){const i=ue[A++];if((i&128)===0)s.push(i);else if((i&224)===192){const a=ue[A++]&63,u=(i&31)<<6|a;u<128?s.push(65533):s.push(u)}else if((i&240)===224){const a=ue[A++]&63,u=ue[A++]&63,f=(i&31)<<12|a<<6|u;f<2048||f>=55296&&f<=57343?s.push(65533):s.push(f)}else if((i&248)===240){const a=ue[A++]&63,u=ue[A++]&63,f=ue[A++]&63;let d=(i&7)<<18|a<<12|u<<6|f;d<65536||d>1114111?s.push(65533):(d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d))}else s.push(65533);s.length>=4096&&(t+=bt.apply(String,s),s.length=0)}return s.length>0&&(t+=bt.apply(String,s)),t}function Ew(e){let t=new Array(e);for(let n=0;n<e;n++)t[n]=ft();return He.freezeData?Object.freeze(t):t}function Pw(e){if(He.mapsAsObjects){let t={};for(let n=0;n<e;n++){let s=M_();s==="__proto__"&&(s="__proto_"),t[s]=ft()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(ft(),ft());return t}}var bt=String.fromCharCode;function N_(e){let t=A,n=new Array(e);for(let s=0;s<e;s++){const i=ue[A++];if((i&128)>0){A=t;return}n[s]=i}return bt.apply(String,n)}function S0(e){if(e<4)if(e<2){if(e===0)return"";{let t=ue[A++];if((t&128)>1){A-=1;return}return bt(t)}}else{let t=ue[A++],n=ue[A++];if((t&128)>0||(n&128)>0){A-=2;return}if(e<3)return bt(t,n);let s=ue[A++];if((s&128)>0){A-=3;return}return bt(t,n,s)}else{let t=ue[A++],n=ue[A++],s=ue[A++],i=ue[A++];if((t&128)>0||(n&128)>0||(s&128)>0||(i&128)>0){A-=4;return}if(e<6){if(e===4)return bt(t,n,s,i);{let a=ue[A++];if((a&128)>0){A-=5;return}return bt(t,n,s,i,a)}}else if(e<8){let a=ue[A++],u=ue[A++];if((a&128)>0||(u&128)>0){A-=6;return}if(e<7)return bt(t,n,s,i,a,u);let f=ue[A++];if((f&128)>0){A-=7;return}return bt(t,n,s,i,a,u,f)}else{let a=ue[A++],u=ue[A++],f=ue[A++],d=ue[A++];if((a&128)>0||(u&128)>0||(f&128)>0||(d&128)>0){A-=8;return}if(e<10){if(e===8)return bt(t,n,s,i,a,u,f,d);{let h=ue[A++];if((h&128)>0){A-=9;return}return bt(t,n,s,i,a,u,f,d,h)}}else if(e<12){let h=ue[A++],m=ue[A++];if((h&128)>0||(m&128)>0){A-=10;return}if(e<11)return bt(t,n,s,i,a,u,f,d,h,m);let p=ue[A++];if((p&128)>0){A-=11;return}return bt(t,n,s,i,a,u,f,d,h,m,p)}else{let h=ue[A++],m=ue[A++],p=ue[A++],x=ue[A++];if((h&128)>0||(m&128)>0||(p&128)>0||(x&128)>0){A-=12;return}if(e<14){if(e===12)return bt(t,n,s,i,a,u,f,d,h,m,p,x);{let v=ue[A++];if((v&128)>0){A-=13;return}return bt(t,n,s,i,a,u,f,d,h,m,p,x,v)}}else{let v=ue[A++],w=ue[A++];if((v&128)>0||(w&128)>0){A-=14;return}if(e<15)return bt(t,n,s,i,a,u,f,d,h,m,p,x,v,w);let k=ue[A++];if((k&128)>0){A-=15;return}return bt(t,n,s,i,a,u,f,d,h,m,p,x,v,w,k)}}}}}function Iw(){let e=ue[A++],t;if(e<192)t=e-160;else switch(e){case 217:t=ue[A++];break;case 218:t=je.getUint16(A),A+=2;break;case 219:t=je.getUint32(A),A+=4;break;default:throw new Error("Expected string")}return Ll(t)}function Sg(e){return He.copyBuffers?Uint8Array.prototype.slice.call(ue,A,A+=e):ue.subarray(A,A+=e)}function Ks(e){let t=ue[A++];if(cn[t]){let n;return cn[t](ue.subarray(A,n=A+=e),s=>{A=s;try{return ft()}finally{A=n}})}else throw new Error("Unknown extension type "+t)}var jw=new Array(4096);function M_(){let e=ue[A++];if(e>=160&&e<192){if(e=e-160,hr>=A)return hs.slice(A-$n,(A+=e)-$n);if(!(hr==0&&pr<180))return jp(e)}else return A--,T_(ft());let t=(e<<5^(e>1?je.getUint16(A):e>0?ue[A]:0))&4095,n=jw[t],s=A,i=A+e-3,a,u=0;if(n&&n.bytes==e){for(;s<i;){if(a=je.getUint32(s),a!=n[u++]){s=1879048192;break}s+=4}for(i+=3;s<i;)if(a=ue[s++],a!=n[u++]){s=1879048192;break}if(s===i)return A=s,n.string;i-=3,s=A}for(n=[],jw[t]=n,n.bytes=e;s<i;)a=je.getUint32(s),n.push(a),s+=4;for(i+=3;s<i;)a=ue[s++],n.push(a);let f=e<16?S0(e):N_(e);return f!=null?n.string=f:n.string=jp(e)}function T_(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return e.toString();if(e==null)return e+"";if(He.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return e.flat().toString();throw new Error(`Invalid property type for record: ${typeof e}`)}const Nw=(e,t)=>{let n=ft().map(T_),s=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let i=Ne[e];return i&&(i.isShared||ws)&&((Ne.restoreStructures||(Ne.restoreStructures=[]))[e]=i),Ne[e]=n,n.read=v0(n,s),(n.read0||n.read)()};cn[0]=()=>{};cn[0].noBuffer=!0;cn[66]=e=>{let t=e.byteLength%8||8,n=BigInt(e[0]&128?e[0]-256:e[0]);for(let s=1;s<t;s++)n<<=BigInt(8),n+=BigInt(e[s]);if(e.byteLength!==t){let s=new DataView(e.buffer,e.byteOffset,e.byteLength),i=(a,u)=>{let f=u-a;if(f<=40){let p=s.getBigUint64(a);for(let x=a+8;x<u;x+=8)p<<=BigInt(64),p|=s.getBigUint64(x);return p}let d=a+(f>>4<<3),h=i(a,d),m=i(d,u);return h<<BigInt((u-d)*8)|m};n=n<<BigInt((s.byteLength-t)*8)|i(t,s.byteLength)}return n};let Mw={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};cn[101]=()=>{let e=ft();if(!Mw[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return Mw[e[0]](e[1],{cause:e[2]})};cn[105]=e=>{if(He.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=je.getUint32(A-4);Lr||(Lr=new Map);let n=ue[A],s;n>=144&&n<160||n==220||n==221?s=[]:n>=128&&n<144||n==222||n==223?s=new Map:(n>=199&&n<=201||n>=212&&n<=216)&&ue[A+1]===115?s=new Set:s={};let i={target:s};Lr.set(t,i);let a=ft();if(i.used)Object.assign(s,a);else return i.target=a;if(s instanceof Map)for(let[u,f]of a.entries())s.set(u,f);if(s instanceof Set)for(let u of Array.from(a))s.add(u);return s};cn[112]=e=>{if(He.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=je.getUint32(A-4),n=Lr.get(t);return n.used=!0,n.target};cn[115]=()=>new Set(ft());const $_=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");let FD=typeof globalThis=="object"?globalThis:window;cn[116]=e=>{let t=e[0],n=Uint8Array.prototype.slice.call(e,1).buffer,s=$_[t];if(!s){if(t===16)return n;if(t===17)return new DataView(n);throw new Error("Could not find typed array for code "+t)}return new FD[s](n)};cn[120]=()=>{let e=ft();return new RegExp(e[0],e[1])};const LD=[];cn[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=A;return A+=t-e.length,Rt=LD,Rt=[Iw(),Iw()],Rt.position0=0,Rt.position1=0,Rt.postBundlePosition=A,A=n,ft()};cn[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date("invalid");function F_(e){let t=pr,n=A,s=$n,i=hr,a=hs,u=Lr,f=Rt,d=new Uint8Array(ue.slice(0,pr)),h=Ne,m=Ne.slice(0,Ne.length),p=He,x=ws,v=e();return pr=t,A=n,$n=s,hr=i,hs=a,Lr=u,Rt=f,ue=d,ws=x,Ne=h,Ne.splice(0,Ne.length,...m),He=p,je=new DataView(ue.buffer,ue.byteOffset,ue.byteLength),v}function Np(){ue=null,Lr=null,Ne=null}const w0=new Array(147);for(let e=0;e<256;e++)w0[e]=+("1e"+Math.floor(45.15-e*.30103));var Uf=new yl({useRecords:!1});Uf.unpack;Uf.unpackMultiple;Uf.unpack;let OD=new Float32Array(1);new Uint8Array(OD.buffer,0,4);let Rc;try{Rc=new TextEncoder}catch{}let Mp,Tp;const Ii=typeof Buffer<"u",oc=Ii?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,L_=Ii?Buffer:Uint8Array,Tw=Ii?4294967296:2144337920;let G,Pa,ze,D=0,Ut,tt=null,AD;const DD=21760,zD=/[\u0080-\uFFFF]/,oi=Symbol("record-id");class UD extends yl{constructor(t){super(t),this.offset=0;let n,s,i,a,u=L_.prototype.utf8Write?function(P,H){return G.utf8Write(P,H,G.byteLength-H)}:Rc&&Rc.encodeInto?function(P,H){return Rc.encodeInto(P,G.subarray(H)).written}:!1,f=this;t||(t={});let d=t&&t.sequential,h=t.structures||t.saveStructures,m=t.maxSharedStructures;if(m==null&&(m=h?32:0),m>8160)throw new Error("Maximum maxSharedStructure is 8160");t.structuredClone&&t.moreTypes==null&&(this.moreTypes=!0);let p=t.maxOwnStructures;p==null&&(p=h?32:64),!this.structures&&t.useRecords!=!1&&(this.structures=[]);let x=m>32||p+m>64,v=m+64,w=m+p+64;if(w>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let k=[],b=0,_=0;this.pack=this.encode=function(P,H){if(G||(G=new oc(8192),ze=G.dataView||(G.dataView=new DataView(G.buffer,0,8192)),D=0),Ut=G.length-10,Ut-D<2048?(G=new oc(G.length),ze=G.dataView||(G.dataView=new DataView(G.buffer,0,G.length)),Ut=G.length-10,D=0):D=D+7&2147483640,n=D,H&WD&&(D+=H&255),a=f.structuredClone?new Map:null,f.bundleStrings&&typeof P!="string"?(tt=[],tt.size=1/0):tt=null,i=f.structures,i){i.uninitialized&&(i=f._mergeStructures(f.getStructures()));let K=i.sharedLength||0;if(K>m)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+i.sharedLength);if(!i.transitions){i.transitions=Object.create(null);for(let q=0;q<K;q++){let Y=i[q];if(!Y)continue;let se,ee=i.transitions;for(let M=0,J=Y.length;M<J;M++){let pe=Y[M];se=ee[pe],se||(se=ee[pe]=Object.create(null)),ee=se}ee[oi]=q+64}this.lastNamedStructuresLength=K}d||(i.nextId=K+64)}s&&(s=!1);let X;try{f.randomAccessStructure&&!f.readOnlyStructures&&P&&typeof P=="object"?P.constructor===Object?ae(P):P.constructor!==Map&&!Array.isArray(P)&&!Tp.some(q=>P instanceof q)?ae(P.toJSON?P.toJSON():P):R(P):R(P);let K=tt;if(tt&&Fw(n,R,0),a&&a.idsToInsert){let q=a.idsToInsert.sort((M,J)=>M.offset>J.offset?1:-1),Y=q.length,se=-1;for(;K&&Y>0;){let M=q[--Y].offset+n;M<K.stringsPosition+n&&se===-1&&(se=0),M>K.position+n?se>=0&&(se+=6):(se>=0&&(ze.setUint32(K.position+n,ze.getUint32(K.position+n)+se),se=-1),K=K.previous,Y++)}se>=0&&K&&ze.setUint32(K.position+n,ze.getUint32(K.position+n)+se),D+=q.length*6,D>Ut&&V(D),f.offset=D;let ee=VD(G.subarray(n,D),q);return a=null,ee}return f.offset=D,H&qD?(G.start=n,G.end=D,G):G.subarray(n,D)}catch(K){throw X=K,K}finally{if(i&&(E(),s&&f.saveStructures)){let K=i.sharedLength||0,q=G.subarray(n,D),Y=BD(i,f);if(!X)return f.saveStructures(Y,Y.isCompatible)===!1?(i.uninitialized=!0,f.pack(P,H)):(f.lastNamedStructuresLength=K,G.length>1073741824&&(G=null),q)}G.length>1073741824&&(G=null),H&HD&&(D=n)}};const E=()=>{_<10&&_++;let P=i.sharedLength||0;if(i.length>P&&!d&&(i.length=P),b>1e4)i.transitions=null,_=0,b=0,k.length>0&&(k=[]);else if(k.length>0&&!d){for(let H=0,X=k.length;H<X;H++)k[H][oi]=0;k=[]}},j=P=>{var H=P.length;H<16?G[D++]=144|H:H<65536?(G[D++]=220,G[D++]=H>>8,G[D++]=H&255):(G[D++]=221,ze.setUint32(D,H),D+=4);for(let X=0;X<H;X++)R(P[X])},R=P=>{D>Ut&&(G=V(D));var H=typeof P,X;if(H==="string"){let K=P.length;if(tt&&K>=4&&K<4096){if((tt.size+=K)>DD){let ee,M=(tt[0]?tt[0].length*3+tt[1].length:0)+10;D+M>Ut&&(G=V(D+M));let J;tt.position?(J=tt,G[D]=200,D+=3,G[D++]=98,ee=D-n,D+=4,Fw(n,R,0),ze.setUint16(ee+n-3,D-n-ee)):(G[D++]=214,G[D++]=98,ee=D-n,D+=4),tt=["",""],tt.previous=J,tt.size=0,tt.position=ee}let se=zD.test(P);tt[se?0:1]+=P,G[D++]=193,R(se?-K:K);return}let q;K<32?q=1:K<256?q=2:K<65536?q=3:q=5;let Y=K*3;if(D+Y>Ut&&(G=V(D+Y)),K<64||!u){let se,ee,M,J=D+q;for(se=0;se<K;se++)ee=P.charCodeAt(se),ee<128?G[J++]=ee:ee<2048?(G[J++]=ee>>6|192,G[J++]=ee&63|128):(ee&64512)===55296&&((M=P.charCodeAt(se+1))&64512)===56320?(ee=65536+((ee&1023)<<10)+(M&1023),se++,G[J++]=ee>>18|240,G[J++]=ee>>12&63|128,G[J++]=ee>>6&63|128,G[J++]=ee&63|128):(G[J++]=ee>>12|224,G[J++]=ee>>6&63|128,G[J++]=ee&63|128);X=J-D-q}else X=u(P,D+q);X<32?G[D++]=160|X:X<256?(q<2&&G.copyWithin(D+2,D+1,D+1+X),G[D++]=217,G[D++]=X):X<65536?(q<3&&G.copyWithin(D+3,D+2,D+2+X),G[D++]=218,G[D++]=X>>8,G[D++]=X&255):(q<5&&G.copyWithin(D+5,D+3,D+3+X),G[D++]=219,ze.setUint32(D,X),D+=4),D+=X}else if(H==="number")if(P>>>0===P)P<32||P<128&&this.useRecords===!1||P<64&&!this.randomAccessStructure?G[D++]=P:P<256?(G[D++]=204,G[D++]=P):P<65536?(G[D++]=205,G[D++]=P>>8,G[D++]=P&255):(G[D++]=206,ze.setUint32(D,P),D+=4);else if(P>>0===P)P>=-32?G[D++]=256+P:P>=-128?(G[D++]=208,G[D++]=P+256):P>=-32768?(G[D++]=209,ze.setInt16(D,P),D+=2):(G[D++]=210,ze.setInt32(D,P),D+=4);else{let K;if((K=this.useFloat32)>0&&P<4294967296&&P>=-2147483648){G[D++]=202,ze.setFloat32(D,P);let q;if(K<4||(q=P*w0[(G[D]&127)<<1|G[D+1]>>7])>>0===q){D+=4;return}else D--}G[D++]=203,ze.setFloat64(D,P),D+=8}else if(H==="object"||H==="function")if(!P)G[D++]=192;else{if(a){let q=a.get(P);if(q){if(!q.id){let Y=a.idsToInsert||(a.idsToInsert=[]);q.id=Y.push(q)}G[D++]=214,G[D++]=112,ze.setUint32(D,q.id),D+=4;return}else a.set(P,{offset:D-n})}let K=P.constructor;if(K===Object)U(P);else if(K===Array)j(P);else if(K===Map)if(this.mapAsEmptyObject)G[D++]=128;else{X=P.size,X<16?G[D++]=128|X:X<65536?(G[D++]=222,G[D++]=X>>8,G[D++]=X&255):(G[D++]=223,ze.setUint32(D,X),D+=4);for(let[q,Y]of P)R(q),R(Y)}else{for(let q=0,Y=Mp.length;q<Y;q++){let se=Tp[q];if(P instanceof se){let ee=Mp[q];if(ee.write){ee.type&&(G[D++]=212,G[D++]=ee.type,G[D++]=0);let ce=ee.write.call(this,P);ce===P?Array.isArray(P)?j(P):U(P):R(ce);return}let M=G,J=ze,pe=D;G=null;let he;try{he=ee.pack.call(this,P,ce=>(G=M,M=null,D+=ce,D>Ut&&V(D),{target:G,targetView:ze,position:D-ce}),R)}finally{M&&(G=M,ze=J,D=pe,Ut=G.length-10)}he&&(he.length+D>Ut&&V(he.length+D),D=$w(he,G,D,ee.type));return}}if(Array.isArray(P))j(P);else{if(P.toJSON){const q=P.toJSON();if(q!==P)return R(q)}if(H==="function")return R(this.writeFunction&&this.writeFunction(P));U(P)}}}else if(H==="boolean")G[D++]=P?195:194;else if(H==="bigint"){if(P<9223372036854776e3&&P>=-9223372036854776e3)G[D++]=211,ze.setBigInt64(D,P);else if(P<18446744073709552e3&&P>0)G[D++]=207,ze.setBigUint64(D,P);else if(this.largeBigIntToFloat)G[D++]=203,ze.setFloat64(D,Number(P));else{if(this.largeBigIntToString)return R(P.toString());if(this.useBigIntExtension||this.moreTypes){let K=P<0?BigInt(-1):BigInt(0),q;if(P>>BigInt(65536)===K){let Y=BigInt(18446744073709552e3)-BigInt(1),se=[];for(;se.push(P&Y),P>>BigInt(63)!==K;)P>>=BigInt(64);q=new Uint8Array(new BigUint64Array(se).buffer),q.reverse()}else{let Y=P<0,se=(Y?~P:P).toString(16);if(se.length%2?se="0"+se:parseInt(se.charAt(0),16)>=8&&(se="00"+se),Ii)q=Buffer.from(se,"hex");else{q=new Uint8Array(se.length/2);for(let ee=0;ee<q.length;ee++)q[ee]=parseInt(se.slice(ee*2,ee*2+2),16)}if(Y)for(let ee=0;ee<q.length;ee++)q[ee]=~q[ee]}q.length+D>Ut&&V(q.length+D),D=$w(q,G,D,66);return}else throw new RangeError(P+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string")}D+=8}else if(H==="undefined")this.encodeUndefinedAsNil?G[D++]=192:(G[D++]=212,G[D++]=0,G[D++]=0);else throw new Error("Unknown type: "+H)},T=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?P=>{let H;if(this.skipValues){H=[];for(let q in P)(typeof P.hasOwnProperty!="function"||P.hasOwnProperty(q))&&!this.skipValues.includes(P[q])&&H.push(q)}else H=Object.keys(P);let X=H.length;X<16?G[D++]=128|X:X<65536?(G[D++]=222,G[D++]=X>>8,G[D++]=X&255):(G[D++]=223,ze.setUint32(D,X),D+=4);let K;if(this.coercibleKeyAsNumber)for(let q=0;q<X;q++){K=H[q];let Y=Number(K);R(isNaN(Y)?K:Y),R(P[K])}else for(let q=0;q<X;q++)R(K=H[q]),R(P[K])}:P=>{G[D++]=222;let H=D-n;D+=2;let X=0;for(let K in P)(typeof P.hasOwnProperty!="function"||P.hasOwnProperty(K))&&(R(K),R(P[K]),X++);if(X>65535)throw new Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');G[H+++n]=X>>8,G[H+n]=X&255},O=this.useRecords===!1?T:t.progressiveRecords&&!x?P=>{let H,X=i.transitions||(i.transitions=Object.create(null)),K=D++-n,q;for(let Y in P)if(typeof P.hasOwnProperty!="function"||P.hasOwnProperty(Y)){if(H=X[Y],H)X=H;else{let se=Object.keys(P),ee=X;X=i.transitions;let M=0;for(let J=0,pe=se.length;J<pe;J++){let he=se[J];H=X[he],H||(H=X[he]=Object.create(null),M++),X=H}K+n+1==D?(D--,Z(X,se,M)):te(X,se,K,M),q=!0,X=ee[Y]}R(P[Y])}if(!q){let Y=X[oi];Y?G[K+n]=Y:te(X,Object.keys(P),K,0)}}:P=>{let H,X=i.transitions||(i.transitions=Object.create(null)),K=0;for(let Y in P)(typeof P.hasOwnProperty!="function"||P.hasOwnProperty(Y))&&(H=X[Y],H||(H=X[Y]=Object.create(null),K++),X=H);let q=X[oi];q?q>=96&&x?(G[D++]=((q-=96)&31)+96,G[D++]=q>>5):G[D++]=q:Z(X,X.__keys__||Object.keys(P),K);for(let Y in P)(typeof P.hasOwnProperty!="function"||P.hasOwnProperty(Y))&&R(P[Y])},$=typeof this.useRecords=="function"&&this.useRecords,U=$?P=>{$(P)?O(P):T(P)}:O,V=P=>{let H;if(P>16777216){if(P-n>Tw)throw new Error("Packed buffer would be larger than maximum buffer size");H=Math.min(Tw,Math.round(Math.max((P-n)*(P>67108864?1.25:2),4194304)/4096)*4096)}else H=(Math.max(P-n<<2,G.length-1)>>12)+1<<12;let X=new oc(H);return ze=X.dataView||(X.dataView=new DataView(X.buffer,0,H)),P=Math.min(P,G.length),G.copy?G.copy(X,0,n,P):X.set(G.slice(n,P)),D-=n,n=0,Ut=X.length-10,G=X},Z=(P,H,X)=>{let K=i.nextId;K||(K=64),K<v&&this.shouldShareStructure&&!this.shouldShareStructure(H)?(K=i.nextOwnId,K<w||(K=v),i.nextOwnId=K+1):(K>=w&&(K=v),i.nextId=K+1);let q=H.highByte=K>=96&&x?K-96>>5:-1;P[oi]=K,P.__keys__=H,i[K-64]=H,K<v?(H.isShared=!0,i.sharedLength=K-63,s=!0,q>=0?(G[D++]=(K&31)+96,G[D++]=q):G[D++]=K):(q>=0?(G[D++]=213,G[D++]=114,G[D++]=(K&31)+96,G[D++]=q):(G[D++]=212,G[D++]=114,G[D++]=K),X&&(b+=_*X),k.length>=p&&(k.shift()[oi]=0),k.push(P),R(H))},te=(P,H,X,K)=>{let q=G,Y=D,se=Ut,ee=n;G=Pa,D=0,n=0,G||(Pa=G=new oc(8192)),Ut=G.length-10,Z(P,H,K),Pa=G;let M=D;if(G=q,D=Y,Ut=se,n=ee,M>1){let J=D+M-1;J>Ut&&V(J);let pe=X+n;G.copyWithin(pe+M,pe+1,D),G.set(Pa.slice(0,M),pe),D=J}else G[X+n]=Pa[0]},ae=P=>{let H=AD(P,G,n,D,i,V,(X,K,q)=>{if(q)return s=!0;D=K;let Y=G;return R(X),E(),Y!==G?{position:D,targetView:ze,target:G}:D},this);if(H===0)return U(P);D=H}}useBuffer(t){G=t,G.dataView||(G.dataView=new DataView(G.buffer,G.byteOffset,G.byteLength)),ze=G.dataView,D=0}set position(t){D=t}get position(){return D}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}Tp=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,P_];Mp=[{pack(e,t,n){let s=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&s>=0&&s<4294967296){let{target:i,targetView:a,position:u}=t(6);i[u++]=214,i[u++]=255,a.setUint32(u,s)}else if(s>0&&s<4294967296){let{target:i,targetView:a,position:u}=t(10);i[u++]=215,i[u++]=255,a.setUint32(u,e.getMilliseconds()*4e6+(s/1e3/4294967296>>0)),a.setUint32(u+4,s)}else if(isNaN(s)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:i,targetView:a,position:u}=t(3);i[u++]=212,i[u++]=255,i[u++]=255}else{let{target:i,targetView:a,position:u}=t(15);i[u++]=199,i[u++]=12,i[u++]=255,a.setUint32(u,e.getMilliseconds()*1e6),a.setBigInt64(u+4,BigInt(Math.floor(s)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let s=Array.from(e),{target:i,position:a}=t(this.moreTypes?3:0);this.moreTypes&&(i[a++]=212,i[a++]=115,i[a++]=0),n(s)}},{pack(e,t,n){let{target:s,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(s[i++]=212,s[i++]=101,s[i++]=0),n([e.name,e.message,e.cause])}},{pack(e,t,n){let{target:s,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(s[i++]=212,s[i++]=120,s[i++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?wg(e,16,t):kg(Ii?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==L_&&this.moreTypes?wg(e,$_.indexOf(n.name),t):kg(e,t)}},{pack(e,t){this.moreTypes?wg(e,17,t):kg(Ii?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:n,position:s}=t(1);n[s]=193}}];function wg(e,t,n,s){let i=e.byteLength;if(i+1<256){var{target:a,position:u}=n(4+i);a[u++]=199,a[u++]=i+1}else if(i+1<65536){var{target:a,position:u}=n(5+i);a[u++]=200,a[u++]=i+1>>8,a[u++]=i+1&255}else{var{target:a,position:u,targetView:f}=n(7+i);a[u++]=201,f.setUint32(u,i+1),u+=4}a[u++]=116,a[u++]=t,e.buffer||(e=new Uint8Array(e)),a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),u)}function kg(e,t){let n=e.byteLength;var s,i;if(n<256){var{target:s,position:i}=t(n+2);s[i++]=196,s[i++]=n}else if(n<65536){var{target:s,position:i}=t(n+3);s[i++]=197,s[i++]=n>>8,s[i++]=n&255}else{var{target:s,position:i,targetView:a}=t(n+5);s[i++]=198,a.setUint32(i,n),i+=4}s.set(e,i)}function $w(e,t,n,s){let i=e.length;switch(i){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:i<256?(t[n++]=199,t[n++]=i):i<65536?(t[n++]=200,t[n++]=i>>8,t[n++]=i&255):(t[n++]=201,t[n++]=i>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=i&255)}return t[n++]=s,t.set(e,n),n+=i,n}function VD(e,t){let n,s=t.length*6,i=e.length-s;for(;n=t.pop();){let a=n.offset,u=n.id;e.copyWithin(a+s,a,i),s-=6;let f=a+s;e[f++]=214,e[f++]=105,e[f++]=u>>24,e[f++]=u>>16&255,e[f++]=u>>8&255,e[f++]=u&255,i=a}return e}function Fw(e,t,n){if(tt.length>0){ze.setUint32(tt.position+e,D+n-tt.position-e),tt.stringsPosition=D-e;let s=tt;tt=null,t(s[0]),t(s[1])}}function BD(e,t){return e.isCompatible=n=>{let s=!n||(t.lastNamedStructuresLength||0)===n.length;return s||t._mergeStructures(n),s},e}let O_=new UD({useRecords:!1});O_.pack;O_.pack;const qD=512,HD=1024,WD=2048;class k0 extends Un()("effect/rpc/RpcSerialization"){}const GD=k0.of({contentType:"application/json",includesFraming:!1,makeUnsafe:()=>{const e=new TextDecoder;return{decode:t=>{const n=JSON.parse(typeof t=="string"?t:e.decode(t));return Array.isArray(n)?n:[n]},encode:t=>JSON.stringify(t)}}}),KD=Um(k0)(GD),QD=e=>Ar(()=>{const t=new Set,n=new Map,s=new Map;let i=(a,u)=>mb(f=>{let d=n.get(a);return d||(d=[],n.set(a,d)),d.push([u,f]),rt});return ko(e((a,u)=>{const f=s.get(a);return f?f(u):i(a,u)},t),a=>({...a,run(u,f){return dp(function*(){t.add(u),s.set(u,f);const d=n.get(u);if(d){n.delete(u);for(const[h,m]of d)yield*lo(Ar(()=>f(h)),m)}return yield*vb(jL,()=>(t.delete(u),s.delete(u),rt))})}}))});let JD=BigInt(0);const YD=uo(function*(e,t){const n=(t==null?void 0:t.spanPrefix)??"RpcClient",s=(t==null?void 0:t.supportsAck)??!0,i=(t==null?void 0:t.disableTracing)??!1,a=(t==null?void 0:t.generateRequestId)??(()=>JD++),u=yield*Bc(),f=io(u,zS),d=new Map;let h=!1;yield*sL(f,Vc(E=>(h=!0,m(QF(E.id)))));const m=uo(function*(E){for(const[j,R]of d)d.delete(j),R._tag==="Queue"?yield*E._tag==="Success"?aw(R.queue):Oa(R.queue,E.cause):R.resume(E)}),p=E=>{const j=k_(E.successSchema),R=w(E);return(T,O)=>{const $=O!=null&&O.headers?aD(O.headers):m0,U=(O==null?void 0:O.context)??er();if(!j){const Z=te=>x(E,R,te,E.payloadSchema.make(T),$,U,(O==null?void 0:O.discard)??!1);return i?Z(void 0):XL(`${n}.${E._tag}`,{attributes:t.spanAttributes},Z)}const V=v(E,R,E.payloadSchema.make(T),$,(O==null?void 0:O.streamBufferSize)??16,U);return O!=null&&O.asQueue?V:zA(ko(V,DA))}},x=(E,j,R,T,O,$,U)=>Vc(V=>{if(h)return hp;const Z=a(),te=j(P=>t.onFromClient({message:P,context:$,discard:U}),{_tag:"Request",id:Z,tag:E._tag,payload:T,...R?{traceId:R.traceId,spanId:R.spanId,sampled:R.sampled}:{},headers:Sw(V.getRef(Ow),O)});if(U)return te;let ae;return JL(WS(P=>{const H={_tag:"Effect",rpc:E,context:$,resume(X){P(X),ae&&!ae.pollUnsafe()&&V.currentDispatcher.scheduleTask(()=>{ae.interruptUnsafe(V.id)},0)}};d.set(Z,H),ae=te.pipe(R?KS(R,{captureStackTrace:!1}):_e,qc(V.context)),ae.addObserver(X=>{if(X._tag==="Failure")return P(X)})}),P=>(d.delete(Z),$L(La(ae),k(Z,Array.from(P),$))))}),v=uo(function*(E,j,R,T,O,$){if(h)return yield*hp;const U=i?void 0:yield*YL(`${n}.${E._tag}`,{attributes:t.spanAttributes}),V=wp(),Z=a(),te=wf(V.context,zS);yield*rL(te,P=>d.has(Z)?(d.delete(Z),k(Z,nb(P)?Array.from(HF(P.cause)):[],$)):rt);const ae=yield*O3(O);return d.set(Z,{_tag:"Queue",rpc:E,queue:ae,scope:te,context:$}),yield*j(P=>t.onFromClient({message:P,context:$,discard:!1}),{_tag:"Request",id:Z,tag:E._tag,payload:R,...U?{traceId:U.traceId,spanId:U.spanId,sampled:U.sampled}:{},headers:Sw(V.getRef(Ow),T)}).pipe(U?KS(U,{captureStackTrace:!1}):_e,hl(P=>Oa(ae,P)),Wm,ZL(te,{startImmediately:!0})),ae}),w=E=>{const j=[];for(const R of E.middlewares.values()){const T=u.mapUnsafe.get(`${R.key}/Client`);T&&j.push(T)}return j.length===0?(R,T)=>R(T):function R(T,O,$=j.length-1){return $===-1?T(O):j[$]({rpc:E,request:O,next(U){return R(T,U,$-1)}})}},k=(E,j,R)=>WS(T=>{const O=wp();t.onFromClient({message:{_tag:"Interrupt",requestId:E,interruptors:j},context:R,discard:!1}).pipe(zL(1e3),qc(O.context)).addObserver(()=>{T(rt)})}),b=E=>{switch(E._tag){case"Chunk":{const j=E.requestId,R=d.get(j);return!R||R._tag!=="Queue"?rt:A3(R.queue,E.values).pipe(s?zn(()=>t.onFromClient({message:{_tag:"Ack",requestId:E.requestId},context:R.context,discard:!1})):_e,hl(T=>Oa(R.queue,T)))}case"Exit":{const j=E.requestId,R=d.get(j);return R?(d.delete(j),R._tag==="Effect"?(R.resume(E.exit),rt):E.exit._tag==="Success"?aw(R.queue):Oa(R.queue,E.exit.cause)):rt}case"Defect":return m(KF(E.defect));case"ClientEnd":return rt}};let _;if(t.flatten){const E=new Map;_=function(R,T,O){let $=E.get(R);return $||($=p(e.requests.get(R)),E.set(R,$)),$(T,O)}}else _={},e.requests.forEach(E=>{_[E._tag]=p(E)});return{client:_,write:b}});let XD=0;const ZD=uo(function*(e,t){const n=XD++,{run:s,send:i,supportsAck:a,supportsTransferables:u}=yield*Vf,f=new Map,{client:d,write:h}=yield*YD(e,{...t,supportsAck:a,onFromClient({message:m}){switch(m._tag){case"Request":{const p=e.requests.get(m.tag),x=u?CD():void 0,v=wp(),w={rpc:p,context:x?Is(v.context,E_,x):v.context,schemas:e4(p)};return f.set(m.id,w),w.schemas.encodePayload(m.payload).pipe(lo(w.context),wc,zn(k=>i(n,{...m,id:String(m.id),payload:k,headers:Object.entries(m.headers)},x&&x.readUnsafe())))}case"Ack":return f.get(m.requestId)?i(n,{_tag:"Ack",requestId:String(m.requestId)}):rt;case"Interrupt":return f.get(m.requestId)?(f.delete(m.requestId),i(n,{_tag:"Interrupt",requestId:String(m.requestId)})):rt;case"Eof":return rt}}});return yield*s(n,m=>{switch(m._tag){case"Chunk":{const p=rc(m.requestId),x=f.get(p);return!x||So(x.schemas.decodeChunk)?rt:x.schemas.decodeChunk.value(m.values).pipe(lo(x.context),wc,zn(v=>h({_tag:"Chunk",clientId:0,requestId:rc(m.requestId),values:v})),QL(v=>h({_tag:"Exit",clientId:0,requestId:rc(m.requestId),exit:Va(v)})))}case"Exit":{const p=rc(m.requestId),x=f.get(p);return x?(f.delete(p),x.schemas.decodeExit(m.exit).pipe(lo(x.context),wc,BL({onSuccess:v=>h({_tag:"Exit",clientId:0,requestId:p,exit:v}),onFailure:v=>h({_tag:"Exit",clientId:0,requestId:p,exit:Va(v)})}))):rt}case"Defect":return h({_tag:"Defect",clientId:0,defect:s4(m.defect)});case"ClientProtocolError":{const p=jl(m.error);return hb(f.keys(),x=>h({_tag:"Exit",clientId:0,requestId:x,exit:p}))}default:return rt}}).pipe(hl(aO),Wm,Gm),d}),Lw=new WeakMap,e4=e=>{let t=Lw.get(e);if(t!==void 0)return t;const n=C_(e.successSchema);return t={decodeChunk:mm(n,s=>cw(mg(yA(s.success)))),encodePayload:gA(mg(e.payloadSchema)),decodeExit:cw(mg(nD(e)))},Lw.set(e,t),t},Ow=Xe("effect/rpc/RpcClient/CurrentHeaders",{defaultValue:()=>m0});class Vf extends Un()("effect/rpc/RpcClient/Protocol"){}L(Vf,"make",QD);const t4=e=>Vf.make(uo(function*(t,n){const s=yield*x0,i=yield*k0,a=yield*HL($p),u=new Map,f=yield*s.writer;let d=i.makeUnsafe();const h=yield*r4(f(d.encode(ID)));let m;const p=Ar(()=>(m=void 0,ks(a)?a.value.onConnect:rt)),x=v=>hb(n,w=>t(w,v));return yield*Ar(()=>(d=i.makeUnsafe(),h.reset(),s.runRaw(v=>{try{const w=d.decode(v);if(w.length===0)return;let k=0;return gb({while:()=>k<w.length,body:()=>{const b=w[k++];if(b._tag==="Pong")return h.onPong(),rt;if("requestId"in b){const _=u.get(b.requestId);if(_!==void 0)return b._tag==="Exit"&&u.delete(b.requestId),t(_,b)}return x(b)},step:wl})}catch(w){return x({_tag:"ClientProtocolError",error:new kw({reason:new Pp({message:"Error decoding message",cause:w})})})}},{onOpen:p}).pipe(pb(zn(h.timeout,()=>Ke(new pi({reason:new tf({kind:"Timeout",cause:new Error("ping timeout")})}))))))).pipe(zn(()=>Ke(new pi({reason:new nf({code:1e3})}))),ks(a)?xb(a.value.onDisconnect):_e,OL(v=>{const w=Il(v),k=kM(w);return k&&w.success.reason._tag==="SocketOpenError"?rt:(m=new kw({reason:k?w.success.reason:new Pp({message:"Unknown socket error",cause:eb(v)})}),x({_tag:"ClientProtocolError",error:m}))}),AL((e==null?void 0:e.retryPolicy)??n4),lO({module:"RpcClient",method:"makeProtocolSocket"}),Gm),{send(v,w){if(m)return Ke(m);w._tag==="Request"&&u.set(w.id,v);const k=d.encode(w);return k===void 0?rt:wc(f(k))},supportsAck:!0,supportsTransferables:!1}})),n4=cb(500,1.5).pipe(ub(qm(5e3))),r4=uo(function*(e){let t=!0;const n=r_(),s=()=>{t=!0,n.closeUnsafe()},i=()=>{t=!0};return yield*Ar(()=>t?(t=!1,e):n.open).pipe(VL("5 seconds"),DL,Sb,Wm,Gm),{timeout:n.await,reset:s,onPong:i}});class $p extends Un()("effect/rpc/RpcClient/ConnectionHooks"){}const s4=dA(or),o4={add(...e){const t=new Map(this.requests);for(const n of e)t.set(n._tag,n);return jr({requests:t,annotations:this.annotations})},merge(...e){const t=new Map(this.requests),n=new Map(this.annotations.mapUnsafe);for(const s of e){for(const[i,a]of s.requests)t.set(i,a);for(const[i,a]of s.annotations.mapUnsafe)n.set(i,a)}return jr({requests:t,annotations:ys(n)})},omit(...e){const t=new Map(this.requests);for(const n of e)t.delete(n);return jr({requests:t,annotations:this.annotations})},middleware(e){const t=new Map;for(const[n,s]of this.requests)t.set(n,s.middleware(e));return jr({requests:t,annotations:this.annotations})},toHandlers(e){const t=this;return dp(function*(){const n=yield*Bc(),s=hi(e)?yield*e:e,i=new Map;for(const[a,u]of Object.entries(s)){const f=t.requests.get(a);i.set(f.key,{tag:f._tag,handler:u,context:n})}return ys(i)})},prefix(e){const t=new Map;for(const n of this.requests.values()){const s=n.prefix(e);t.set(s._tag,s)}return jr({requests:t,annotations:this.annotations})},toLayer(e){return cp(this.toHandlers(e))},of:_e,toLayerHandler(e,t){const n=this;return cp(dp(function*(){const s=yield*Bc(),i=hi(t)?yield*t:t,a=new Map,u=n.requests.get(e);return a.set(u.key,{handler:i,context:s}),ys(a)}))},accessHandler(e){return mb(t=>{const n=this.requests.get(e),{handler:s,context:i}=t.mapUnsafe.get(n.key);return at((a,u)=>{u.rpc=n;const f=s(a,u),d=sD(f)?f.value:f;return hi(d)?qL(d,i):UA(d,i)})})},annotate(e,t){return jr({requests:this.requests,annotations:Is(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(wi(e,t))},annotateMerge(e){return jr({requests:this.requests,annotations:ki(this.annotations,e)})},annotateRpcsMerge(e){const t=new Map;for(const[n,s]of this.requests)t.set(n,s.annotateMerge(ki(e,s.annotations)));return jr({requests:t,annotations:this.annotations})}},jr=e=>Object.assign(function(){},o4,{requests:e.requests,annotations:e.annotations}),i4=(...e)=>jr({requests:new Map(e.map(t=>[t._tag,t])),annotations:er()}),a4="/ws",Fn={getConfig:"tokmon.getConfig",setConfig:"tokmon.setConfig",refresh:"tokmon.refresh",browseFs:"tokmon.browseFs",snapshot:"tokmon.snapshot",config:"tokmon.config"},l4=Ss(["all","summary","table","billing","peak"]),Fp=Ss(za),u4=Pt({id:gt,providerId:Fp,name:gt,homeDir:gt,color:Yc(gt)}),A_=()=>u_,c4=Pt({interval:Xc,billingInterval:Xc,clearScreen:bp,timezone:_p(gt),accounts:pg(gi(u4)),activeAccountId:_p(gt),disabledProviders:pg(gi(Fp)),onboarded:bp,dashboardLayout:Ss(["grid","single"]),defaultFocus:Ss(["all","last"]),ascii:Ss(["auto","on","off"]),knownProviders:pg(gi(Fp))}),C0=A_(),f4=Pt({name:gt,path:gt,dir:bp}),d4=Pt({path:gt,parent:_p(gt),entries:gi(f4)}),h4=A_(),b0=Pt({}),g4=Ti(Fn.getConfig,{payload:b0,success:C0}),p4=Ti(Fn.setConfig,{payload:c4,success:C0}),m4=Ti(Fn.refresh,{payload:Pt({scope:l4}),success:Zc}),y4=Ti(Fn.browseFs,{payload:Pt({path:gt}),success:d4}),x4=Ti(Fn.snapshot,{payload:b0,success:h4,stream:!0}),v4=Ti(Fn.config,{payload:b0,success:C0,stream:!0}),S4=i4(g4,p4,m4,y4,x4,v4);class ic extends Un()("tokmon/client/DaemonRpcClient/TokmonRpcClient"){}const w4=new Function("specifier","return import(specifier)");function k4(e,t){const n=typeof window>"u"?void 0:window.location.origin,s=new URL(e,n);if(s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),s.protocol!=="ws:"&&s.protocol!=="wss:")throw new Error(`unsupported daemon RPC protocol: ${s.protocol}`);return s.pathname=a4,t&&s.searchParams.set("wsToken",t),s.toString()}function C4(e){return e==="node"?!0:e==="browser"?!1:typeof window>"u"}async function b4(e,t){return C4(t)?(await w4("@effect/platform-node/NodeSocket")).layerWebSocket(e):kD(e).pipe(fp(vD))}function _4(e){const t=e.reconnectBaseDelayMs??250,n=cb(ul(t),1.5).pipe(ub(qm(ul(2500))));return typeof e.reconnectAttempts=="number"?n.pipe(xL(wL(e.reconnectAttempts))):n}function R4(e,t={}){const n=k4(e,t.wsToken),s=new Set;let i=null,a=null,u=!1;const f=(v,w)=>{var k;(k=t.onConn)==null||k.call(t,v,w)},d=v=>{const w=v??i;(v===void 0||v===i)&&(i=null),a=null,w&&w.runtime.dispose().catch(()=>{})},h=async()=>{const v=await b4(n,t.transport),w=Um($p,$p.of({onConnect:Ln(()=>{f("live")}),onDisconnect:Ln(()=>{u||(f("reconnecting"),d())})}));return up(Vf,t4({retryPolicy:_4(t)})).pipe(fp(ib(v,KD,w)))},m=async()=>{if(u)throw new Error("daemon RPC client is closed");return i||a||(f("connecting"),a=(async()=>{let v;try{const w=await h(),k=up(ic,ZD(S4)).pipe(fp(w));if(v=XA(k),await v.runPromise(ic.asEffect()),u)throw await v.dispose(),new Error("daemon RPC client is closed");return i={runtime:v},i}catch(w){throw a=null,await(v==null?void 0:v.dispose().catch(()=>{})),u||f("error",w),w}})(),a)},p=async v=>{const w=await m();try{return await w.runtime.runPromise(ic.use(k=>v(k)))}catch(k){throw u||(d(w),f("error",k)),k}},x=(v,w)=>{if(u)return()=>{};let k=null,b=!1,_=null;const E=()=>{if(!k)return;const T=k;k=null,s.delete(T),((i==null?void 0:i.runtime.runPromise(La(T)))??qa(La(T))).catch(()=>{})},j=()=>{var T;u||b||_||(_=setTimeout(()=>{_=null,R()},t.reconnectBaseDelayMs??250),(T=_.unref)==null||T.call(_))},R=()=>{(async()=>{try{const T=await m();if(u||b)return;k=T.runtime.runFork(ic.use(O=>v(O).pipe(VA($=>Ln(()=>{try{w($)}catch{}})))).pipe(hl(O=>Ln(()=>{!u&&!b&&(d(T),f("error",eb(O)),j())})))),s.add(k),k.addObserver(()=>{k&&s.delete(k)})}catch(T){!u&&!b&&(d(),f("error",T),j())}})()};return R(),()=>{b=!0,_&&(clearTimeout(_),_=null),E()}};return{getConfig:()=>p(v=>v[Fn.getConfig]({})),setConfig:v=>p(w=>w[Fn.setConfig](v)),refresh:(v="all")=>p(w=>w[Fn.refresh]({scope:v})),browseFs:v=>p(w=>w[Fn.browseFs]({path:v})),subscribeSnapshot:v=>x(w=>w[Fn.snapshot]({}),v),subscribeConfig:v=>x(w=>w[Fn.config]({}),v),async close(){if(u)return;u=!0,f("closed");const v=[...s];s.clear();const w=i??await(a==null?void 0:a.catch(()=>null))??null;await Promise.all(v.map(k=>((w==null?void 0:w.runtime.runPromise(La(k)))??qa(La(k))).catch(()=>{}))),i=null,a=null,w&&await w.runtime.dispose().catch(()=>{})}}}let Cg=null;const Lp=new Set;function E4(e){if(e!=="closed")for(const t of Lp)t(e)}function Ol(){return Cg||(Cg=R4(window.location.origin,{transport:"browser",onConn:E4})),Cg}function P4(e){return Lp.add(e),()=>{Lp.delete(e)}}async function I4(){return rm(await Ol().getConfig())}async function j4(e){return rm(await Ol().setConfig(e))}async function N4(e){return Ol().browseFs(e)}function M4(e){return Ol().subscribeConfig(t=>{e(rm(t))})}const st="focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",Aw='button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])';function D_(e,{active:t,onEscape:n,initialFocusRef:s}){z.useEffect(()=>{var d,h;if(!t)return;const i=document.activeElement,a=e.current,u=a==null?void 0:a.querySelector(Aw);(h=(d=(s==null?void 0:s.current)??u??a)==null?void 0:d.focus)==null||h.call(d);const f=m=>{if(m.key==="Escape"){m.stopPropagation(),n();return}if(m.key!=="Tab"||!e.current)return;const p=e.current.querySelectorAll(Aw),x=Array.from(p).filter(k=>k.offsetParent!==null||k===document.activeElement);if(x.length===0)return;const v=x[0],w=x[x.length-1];m.shiftKey&&document.activeElement===v?(m.preventDefault(),w.focus()):!m.shiftKey&&document.activeElement===w&&(m.preventDefault(),v.focus())};return document.addEventListener("keydown",f),()=>{var m;document.removeEventListener("keydown",f),(m=i==null?void 0:i.focus)==null||m.call(i)}},[t])}function Dw(e,t={}){return{mode:"add",editingId:null,providerId:t.providerId??ol[0],name:t.name??"",homeDir:t.homeDir??"~",color:t.color??cN(e.accounts)}}function T4(e){return{mode:"edit",editingId:e.id,providerId:e.providerId,name:e.name,homeDir:e.homeDir,color:e.color||oo[e.providerId].color}}function $4(e,t){const n=e.mode==="edit"?t.filter(s=>s.id!==e.editingId):t;return e.mode==="edit"?e.editingId??"":wk(e.name.trim()||"account",n)}function F4(e,t){const n=e.name.trim(),s=e.homeDir.trim()||"~";return n?e.mode==="add"?{ok:!0,account:{id:wk(n,t),providerId:e.providerId,name:n,homeDir:s,color:e.color},mode:"add",editingId:null}:{ok:!0,account:{id:e.editingId,providerId:e.providerId,name:n,homeDir:s,color:e.color},mode:"edit",editingId:e.editingId}:{ok:!1,error:"Name required"}}function _0({title:e,right:t,children:n}){return y.jsxs("section",{className:"mb-6 last:mb-0",children:[y.jsxs("div",{className:"mb-2.5 flex items-center gap-2 border-b border-line pb-1.5",children:[y.jsx("h3",{className:"font-display text-[11px] uppercase tracking-wider text-fg-dim",children:e}),t&&y.jsx("div",{className:"ml-auto",children:t})]}),n]})}function Qs({label:e,hint:t,children:n}){return y.jsxs("div",{className:"flex items-center gap-3 py-1.5",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("div",{className:"text-sm text-fg",children:e}),t&&y.jsx("div",{className:"text-[11px] text-fg-faint",children:t})]}),y.jsx("div",{className:"shrink-0",children:n})]})}function ac({label:e,hint:t,children:n}){return y.jsxs("div",{children:[y.jsx("div",{className:"mb-1.5 text-xs font-medium text-fg",children:e}),n,t&&y.jsx("div",{className:"mt-1 text-[11px] text-fg-faint",children:t})]})}function zw({value:e,min:t,unit:n,onChange:s}){const i=d=>s(Math.max(t,Math.round(d))),[a,u]=z.useState(null),f=()=>{if(a===null)return;const d=Number(a);i(Number.isFinite(d)&&a.trim()!==""?d:t),u(null)};return y.jsxs("div",{className:"flex items-center overflow-hidden rounded border border-line",children:[y.jsx("button",{type:"button","aria-label":"decrease",onClick:()=>i(e-1),className:`px-2 py-1 text-xs text-fg-dim transition hover:bg-bg-3 hover:text-fg ${st}`,children:"−"}),y.jsx("input",{type:"number",inputMode:"numeric",min:t,value:a??e,onChange:d=>{const h=d.target.value;u(h);const m=Number(h);h.trim()!==""&&Number.isFinite(m)&&m>=t&&i(m)},onBlur:f,"aria-label":`value (${n})`,className:`tnum w-12 border-x border-line bg-bg-2 px-1 py-1 text-center text-xs text-fg ${st} [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none`}),y.jsx("span",{className:"px-1.5 text-[10px] text-fg-faint",children:n}),y.jsx("button",{type:"button","aria-label":"increase",onClick:()=>i(e+1),className:`px-2 py-1 text-xs text-fg-dim transition hover:bg-bg-3 hover:text-fg ${st}`,children:"+"})]})}function Ia({label:e,onClick:t,disabled:n,danger:s,children:i}){return y.jsx("button",{type:"button","aria-label":e,title:e,disabled:n,onClick:t,className:`rounded p-1 text-fg-faint transition disabled:opacity-30 ${st} ${s?"hover:bg-warning/15 hover:text-warning":"hover:bg-bg-3 hover:text-fg"} disabled:hover:bg-transparent disabled:hover:text-fg-faint`,children:i})}function L4({draft:e,patch:t}){return y.jsxs(_0,{title:"General",children:[y.jsx(Qs,{label:"Refresh interval",hint:"dashboard poll, seconds",children:y.jsx(zw,{value:e.interval,min:1,unit:"s",onChange:n=>t(s=>({...s,interval:n}))})}),y.jsx(Qs,{label:"Billing poll",hint:"billing refresh, minutes",children:y.jsx(zw,{value:e.billingInterval,min:1,unit:"m",onChange:n=>t(s=>({...s,billingInterval:n}))})}),y.jsx(Qs,{label:"Clear screen",hint:"redraw on each refresh",children:y.jsx(Sn,{size:"xs",ariaLabel:"clear screen",options:[{value:"on",label:"on"},{value:"off",label:"off"}],value:e.clearScreen?"on":"off",onChange:n=>t(s=>({...s,clearScreen:n==="on"}))})}),y.jsx(Qs,{label:"Timezone",hint:"IANA name · empty = System",children:y.jsx(O4,{value:e.timezone,onChange:n=>t(s=>({...s,timezone:n}))})}),y.jsx(Qs,{label:"Dashboard",hint:"grid shows all · single cycles",children:y.jsx(Sn,{size:"xs",ariaLabel:"dashboard layout",options:[{value:"grid",label:"grid"},{value:"single",label:"single"}],value:e.dashboardLayout,onChange:n=>t(s=>({...s,dashboardLayout:n}))})}),y.jsx(Qs,{label:"Default focus",hint:"on open",children:y.jsx(Sn,{size:"xs",ariaLabel:"default focus",options:[{value:"all",label:"all"},{value:"last",label:"last"}],value:e.defaultFocus,onChange:n=>t(s=>({...s,defaultFocus:n}))})}),y.jsx(Qs,{label:"ASCII mode",hint:"glyph fallback",children:y.jsx(Sn,{size:"xs",ariaLabel:"ascii mode",options:[{value:"auto",label:"auto"},{value:"on",label:"on"},{value:"off",label:"off"}],value:e.ascii,onChange:n=>t(s=>({...s,ascii:n}))})})]})}function O4({value:e,onChange:t}){const[n,s]=z.useState(e??""),[i,a]=z.useState(!1);z.useEffect(()=>{s(e??""),a(!1)},[e]);const u=f=>{const d=sm(f);s(d);const h=d.trim();if(!h){a(!1),t(null);return}Sk(h)?(a(!1),t(h)):a(!0)};return y.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[y.jsx("input",{type:"text",value:n,placeholder:"System",spellCheck:!1,"aria-invalid":i,onChange:f=>u(f.target.value),className:`w-44 rounded border bg-bg-2 px-2 py-1 text-xs text-fg ${st} ${i?"border-warning":"border-line"}`}),i&&y.jsx("span",{className:"text-[10px] text-warning",children:"invalid timezone"})]})}function A4({draft:e,patch:t}){const n=(s,i)=>t(a=>({...a,disabledProviders:i?a.disabledProviders.filter(u=>u!==s):Array.from(new Set([...a.disabledProviders,s]))}));return y.jsx(_0,{title:"Providers",children:y.jsx("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2",children:ol.map(s=>{const i=!e.disabledProviders.includes(s),a=oo[s];return y.jsxs("button",{type:"button",role:"switch","aria-checked":i,onClick:()=>n(s,!i),className:`flex items-center gap-2.5 rounded border px-3 py-2 text-left text-xs transition ${st} ${i?"border-line-2 bg-bg-2 text-fg":"border-line bg-bg-1 text-fg-faint hover:border-line-2"}`,children:[y.jsx("span",{className:"inline-flex size-4 shrink-0 items-center justify-center rounded-sm border",style:{borderColor:i?so(a.color):"var(--color-line-2)",background:i?so(a.color):"transparent"},children:i&&y.jsx(yi,{className:"size-3 text-bg-0"})}),y.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{background:so(a.color)},"aria-hidden":!0}),y.jsx("span",{className:`font-medium ${i?"text-fg":"text-fg-faint"}`,children:a.name}),y.jsx("span",{className:"ml-auto text-[10px] uppercase tracking-wide text-fg-faint",children:i?"tracking":"off"})]},s)})})})}function D4(e,t){return t?t.accounts.find(n=>n.id===e.id)??null:null}function z4({draft:e,patch:t,snapshot:n,onEdit:s,onConfigure:i,onAdd:a}){const u=lN(e,void 0,(n==null?void 0:n.accounts)??void 0),f=m=>t(p=>({...p,activeAccountId:m})),d=m=>t(p=>({...p,accounts:p.accounts.filter(x=>x.id!==m),activeAccountId:p.activeAccountId===m?null:p.activeAccountId})),h=(m,p)=>t(x=>{const v=[...x.accounts],w=m+p;return w<0||w>=v.length?x:([v[m],v[w]]=[v[w],v[m]],{...x,accounts:v})});return y.jsx(_0,{title:"Accounts",right:y.jsxs("button",{type:"button",onClick:a,className:`flex items-center gap-1 rounded border border-accent/60 bg-bg-1 px-2 py-1 text-[11px] text-accent transition hover:bg-bg-2 ${st}`,children:[y.jsx(Jj,{className:"size-3"})," Add account"]}),children:u.length===0?y.jsx("p",{className:"rounded border border-line bg-bg-2/50 px-3 py-3 text-xs text-fg-faint",children:"None configured — enabled providers track automatically."}):y.jsx("ul",{className:"flex flex-col gap-1.5",role:"radiogroup","aria-label":"Active account",children:u.map(m=>{var E;const p=oo[m.providerId],x=D4(m,n),v=(x==null?void 0:x.email)||(x==null?void 0:x.displayName)||m.name||p.name,w=(x==null?void 0:x.plan)??((E=x==null?void 0:x.billing)==null?void 0:E.plan)??null,k=so(m.color||p.color),b=m.id===e.activeAccountId,_=m.source==="configured";return y.jsxs("li",{className:"flex items-center gap-2.5 rounded border border-line bg-bg-2/60 px-2.5 py-2",children:[y.jsx("button",{type:"button",role:"radio","aria-checked":b,"aria-label":`Set ${m.name} active`,title:b?"Active account (click to clear)":"Set active",onClick:()=>f(b?null:m.id),className:`relative inline-flex size-4 shrink-0 items-center justify-center rounded-full border transition ${st}`,style:{borderColor:k},children:b&&y.jsx("span",{className:"size-2 rounded-full",style:{background:k}})}),y.jsx("span",{className:"size-2.5 shrink-0 rounded-full",style:{background:k},"aria-hidden":!0}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"truncate text-sm text-fg-bright",children:v}),y.jsx("span",{className:"shrink-0 rounded bg-bg-3 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-fg-dim",children:p.name}),w&&y.jsx("span",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 text-[10px] text-fg-dim",children:w}),y.jsx("span",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-fg-faint",children:m.source==="auto"?"auto":"configured"})]}),y.jsx("div",{className:"truncate font-mono text-[11px] text-fg-faint",children:m.homeDir})]}),y.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:_&&m.explicitIndex!==void 0?y.jsxs(y.Fragment,{children:[y.jsx(Ia,{label:"Move up",disabled:m.explicitIndex===0,onClick:()=>h(m.explicitIndex,-1),children:y.jsx(ok,{className:"size-3.5"})}),y.jsx(Ia,{label:"Move down",disabled:m.explicitIndex===e.accounts.length-1,onClick:()=>h(m.explicitIndex,1),children:y.jsx(Zp,{className:"size-3.5"})}),y.jsx(Ia,{label:"Edit account",onClick:()=>s(m),children:y.jsx(sS,{className:"size-3.5"})}),y.jsx(Ia,{label:"Delete account",danger:!0,onClick:()=>d(m.id),children:y.jsx(Yj,{className:"size-3.5"})})]}):y.jsx(Ia,{label:"Configure account",onClick:()=>i(m),children:y.jsx(sS,{className:"size-3.5"})})})]},`${m.source}:${m.id}`)})})})}function U4(e){const t=(e??"").trim();return t.length>0?t:"~"}function bg(e){const t=(e??"").trim();return t.length>0?t:"~"}function V4(e){const t=[];e.parent!==null&&t.push({kind:"parent",key:"..",label:"..",path:e.parent});for(const n of[...e.entries].filter(s=>s.dir).sort((s,i)=>s.name.localeCompare(i.name)))t.push({kind:"entry",key:n.path,label:n.name,path:n.path});return t}function B4({editor:e,accounts:t,onChange:n,onCancel:s,onSubmit:i}){const a=z.useRef(null),u=z.useRef(null),[f,d]=z.useState(null),h=so(e.color);D_(a,{active:!0,onEscape:s,initialFocusRef:u});const m=$4(e,t),p=()=>{const x=F4(e,t);if(!x.ok){d(x.error);return}i(x.account,x.mode,x.editingId)};return y.jsx("div",{className:"dialog-fade fixed inset-0 z-[70] flex items-start justify-center overflow-y-auto bg-bg-0/60 p-4 backdrop-blur-sm",onMouseDown:x=>{x.target===x.currentTarget&&s()},role:"dialog","aria-modal":"true","aria-label":e.mode==="add"?"New account":"Edit account",children:y.jsxs("div",{ref:a,tabIndex:-1,className:"dialog-pop my-8 w-full max-w-[460px] overflow-hidden rounded-md border-l-2 border border-line-2 bg-bg-1 focus:outline-none",style:{borderLeftColor:h},children:[y.jsxs("div",{className:"flex items-center gap-2 border-b border-line px-4 py-3",children:[y.jsx("span",{className:"size-2.5 rounded-full",style:{background:h},"aria-hidden":!0}),y.jsx("span",{className:"font-display text-xs uppercase tracking-wider text-fg-bright",children:e.mode==="add"?"New account":"Edit account"})]}),y.jsxs("div",{className:"flex flex-col gap-4 px-4 py-4",children:[y.jsx(ac,{label:"Provider",hint:"which tool this account tracks",children:y.jsx("div",{className:"flex flex-wrap gap-1.5",children:ol.map(x=>{const v=x===e.providerId,w=oo[x];return y.jsxs("button",{type:"button",onClick:()=>n({...e,providerId:x}),"aria-pressed":v,className:`flex items-center gap-1.5 rounded border px-2 py-1 text-xs transition ${st} ${v?"border-line-2 bg-bg-3 text-fg-bright":"border-line text-fg-dim hover:text-fg"}`,children:[y.jsx("span",{className:"size-2 rounded-full",style:{background:so(w.color)},"aria-hidden":!0}),w.name]},x)})})}),y.jsx(ac,{label:"Name",hint:"display name for this account",children:y.jsx("input",{ref:u,type:"text",value:e.name,placeholder:"e.g. Work, Personal",spellCheck:!1,onChange:x=>{d(null),n({...e,name:sm(x.target.value)})},onKeyDown:x=>{x.key==="Enter"&&p()},className:`w-full rounded border border-line bg-bg-2 px-2.5 py-1.5 text-sm text-fg ${st}`})}),y.jsx(ac,{label:"Home directory",hint:"path containing the tool's data dir · ~ for default",children:y.jsx(q4,{value:e.homeDir,onChange:x=>n({...e,homeDir:x}),onEnter:p})}),y.jsx(ac,{label:"Accent color",hint:"shows on dashboard, account strip, borders",children:y.jsx("div",{className:"flex flex-wrap gap-1.5",children:aN.map(x=>{const v=x===e.color;return y.jsx("button",{type:"button","aria-label":x,"aria-pressed":v,title:x,onClick:()=>n({...e,color:x}),className:`size-6 rounded-full border-2 transition ${st} ${v?"scale-110":"border-transparent hover:scale-105"}`,style:{background:so(x),borderColor:v?"var(--color-fg-bright)":"transparent"}},x)})})}),y.jsxs("div",{className:"flex items-center gap-2 rounded border border-line bg-bg-2/50 px-2.5 py-1.5 text-xs",children:[y.jsx("span",{className:"text-fg-faint",children:"id"}),y.jsx("span",{className:"font-mono text-fg",style:{color:h},children:m||"account"}),y.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:e.mode==="add"?"auto-generated from name":"fixed"})]}),f&&y.jsx("p",{className:"text-xs text-warning",children:f})]}),y.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-line px-4 py-3",children:[y.jsx("button",{type:"button",onClick:s,className:`rounded border border-line bg-bg-1 px-3 py-1.5 text-xs text-fg-dim transition hover:border-line-2 hover:text-fg ${st}`,children:"cancel"}),y.jsxs("button",{type:"button",onClick:p,className:`flex items-center gap-1.5 rounded border border-accent/60 bg-bg-1 px-3 py-1.5 text-xs text-accent transition hover:bg-bg-2 active:scale-[0.97] ${st}`,children:[y.jsx(yi,{className:"size-3.5"})," ",e.mode==="add"?"Add account":"Save account"]})]})]})})}function q4({value:e,onChange:t,onEnter:n}){const[s,i]=z.useState(!1),[a,u]=z.useState(null),[f,d]=z.useState("~"),[h,m]=z.useState(!1),[p,x]=z.useState(null),v=z.useRef(0),w=z.useCallback(async O=>{const $=++v.current,U=U4(O);d(U),m(!0),x(null);try{const V=await N4(U);if($!==v.current)return;u(V)}catch(V){if($!==v.current)return;u(null),x(V instanceof Error?V.message:"cannot read folder")}finally{$===v.current&&m(!1)}},[]);z.useEffect(()=>()=>{v.current++},[]);const k=()=>{i(!0),w(e)},b=()=>{v.current++,i(!1),m(!1),x(null)},_=O=>{h||w(O)},E=()=>{!a||h||(t(bg(a.path)),b())},j=a?V4(a):[],R=j.filter(O=>O.kind==="entry"),T=bg((a==null?void 0:a.path)??f);return y.jsxs("div",{className:"relative",children:[y.jsxs("div",{className:"flex overflow-hidden rounded border border-line bg-bg-2",children:[y.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2.5",children:[y.jsx(tg,{className:"size-4 shrink-0 text-fg-faint"}),y.jsx("input",{type:"text",value:e,placeholder:"~",spellCheck:!1,onChange:O=>{b(),t(sm(O.target.value))},onKeyDown:O=>{O.key==="Enter"&&n()},className:`min-w-0 flex-1 bg-transparent py-1.5 font-mono text-sm text-fg ${st}`})]}),y.jsxs("button",{type:"button",onClick:k,disabled:h,className:`flex shrink-0 items-center gap-1 border-l border-line bg-bg-1 px-2.5 py-1.5 text-xs text-fg-dim transition hover:bg-bg-3 hover:text-fg disabled:opacity-50 ${st}`,children:[y.jsx(Zp,{className:"size-3.5"})," Browse"]})]}),s&&y.jsxs("div",{className:"mt-2 overflow-hidden rounded border border-line-2 bg-bg-1 shadow-[0_18px_60px_rgba(0,0,0,0.35)]",children:[y.jsxs("div",{className:"flex items-center gap-2 border-b border-line bg-bg-2 px-2.5 py-2",children:[y.jsx(tg,{className:"size-4 shrink-0 text-accent"}),y.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-xs text-fg-bright",title:T,children:T}),h&&y.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-fg-faint",children:"loading"}),y.jsx("button",{type:"button",onClick:b,"aria-label":"Close folder picker",className:`rounded p-1 text-fg-faint transition hover:text-fg ${st}`,children:y.jsx(xi,{className:"size-3.5"})})]}),p?y.jsxs("div",{className:"px-2.5 py-3",children:[y.jsxs("div",{className:"text-xs text-warning",children:["can't read ",bg(f)]}),y.jsx("button",{type:"button",onClick:()=>{h||w(f)},disabled:h,className:`mt-2 rounded border border-line bg-bg-2 px-2 py-1 text-[11px] text-fg-dim transition hover:border-line-2 hover:text-fg disabled:opacity-50 ${st}`,children:"retry"})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"max-h-56 overflow-y-auto py-1",children:[j.map(O=>y.jsxs("button",{type:"button",onClick:()=>_(O.path),disabled:h,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-xs transition hover:bg-bg-3 hover:text-fg disabled:opacity-50 ${st} ${O.kind==="parent"?"text-fg-dim":"text-fg"}`,children:[O.kind==="parent"?y.jsx(ok,{className:"size-3.5 shrink-0"}):y.jsx(tg,{className:"size-3.5 shrink-0 text-fg-faint"}),y.jsx("span",{className:"min-w-0 truncate font-mono",children:O.label})]},O.key)),!h&&R.length===0&&y.jsx("div",{className:"px-2.5 py-3 text-xs text-fg-faint",children:"no subdirectories"}),h&&!a&&y.jsx("div",{className:"px-2.5 py-3 text-xs text-fg-faint",children:"loading folders..."})]}),y.jsx("div",{className:"flex items-center justify-end gap-2 border-t border-line px-2.5 py-2",children:y.jsxs("button",{type:"button",onClick:E,disabled:!a||h,className:`flex items-center gap-1.5 rounded border border-accent/60 bg-bg-1 px-2.5 py-1.5 text-xs text-accent transition hover:bg-bg-2 active:scale-[0.97] disabled:opacity-50 ${st}`,children:[y.jsx(yi,{className:"size-3.5"})," Select this folder"]})})]})]})]})}const H4=[{value:"general",label:"General"},{value:"providers",label:"Providers"},{value:"accounts",label:"Accounts"}];function W4({onClose:e,snapshot:t}){const n=z.useRef(null),[s,i]=z.useState(null),[a,u]=z.useState(null),[f,d]=z.useState(!1),[h,m]=z.useState(null),[p,x]=z.useState(!1),[v,w]=z.useState(null),[k,b]=z.useState("general");z.useEffect(()=>{let j=!0;return I4().then(R=>{j&&i(R)}).catch(R=>{j&&u(R instanceof Error?R.message:"load failed")}),()=>{j=!1}},[]),z.useEffect(()=>{if(!p)return M4(j=>{p||i(j)})},[p]),D_(n,{active:!v,onEscape:e}),z.useEffect(()=>{const j=n.current;j&&(v?j.setAttribute("inert",""):j.removeAttribute("inert"))},[v]);const _=j=>{x(!0),m(null),i(R=>R&&j(R))},E=async()=>{if(s){d(!0),m(null);try{const j=await j4(s);i(j),x(!1),e()}catch(j){m(j instanceof Error?j.message:"save failed")}finally{d(!1)}}};return y.jsxs("div",{className:"dialog-fade fixed inset-0 z-[60] flex items-start justify-center overflow-y-auto bg-bg-0/70 p-4 backdrop-blur-sm",onMouseDown:j=>{j.target===j.currentTarget&&!v&&e()},role:"dialog","aria-modal":"true","aria-label":"Settings",children:[y.jsxs("div",{ref:n,tabIndex:-1,className:"dialog-pop relative my-6 flex w-full max-w-[720px] flex-col overflow-hidden rounded-md border border-line-2 bg-bg-1 focus:outline-none",children:[y.jsx("div",{className:"pointer-events-none absolute left-3 top-2 font-display text-[11px] uppercase tracking-wider text-fg-dim",children:"settings"}),y.jsx("button",{type:"button",onClick:e,"aria-label":"Close",className:`absolute right-2 top-2 z-10 rounded p-1 text-fg-faint transition hover:text-fg ${st}`,children:y.jsx(xi,{className:"size-4"})}),y.jsx("div",{className:"max-h-[78vh] overflow-y-auto px-5 pb-4 pt-9",children:a?y.jsx("div",{className:"rounded border border-warning/50 bg-bg-2 p-4 text-sm text-warning",children:a}):s?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"mb-4 flex items-center justify-between gap-3 border-b border-line pb-3",children:y.jsx(Sn,{size:"xs",ariaLabel:"settings section",options:H4,value:k,onChange:b,containerClassName:"flex items-center overflow-hidden rounded border border-line bg-bg-1",btnClassName:"px-3 py-1.5 text-[11px] transition"})}),k==="general"&&y.jsx(L4,{draft:s,patch:_}),k==="providers"&&y.jsx(A4,{draft:s,patch:_}),k==="accounts"&&y.jsx(z4,{draft:s,patch:_,snapshot:t,onEdit:j=>w(T4(j)),onConfigure:j=>w(Dw(s,{providerId:j.providerId,name:j.name,homeDir:j.homeDir,color:j.color})),onAdd:()=>w(Dw(s))})]}):y.jsx("div",{className:"py-10 text-center text-sm text-fg-dim",children:"loading config…"})}),y.jsxs("div",{className:"flex items-center justify-end gap-3 border-t border-line px-5 py-3",children:[h&&y.jsx("span",{className:"mr-auto text-xs text-warning",children:h}),p&&!h&&y.jsx("span",{className:"mr-auto text-xs text-fg-faint",children:"unsaved changes"}),y.jsx("button",{type:"button",onClick:e,className:`rounded border border-line bg-bg-1 px-3 py-1.5 text-xs text-fg-dim transition hover:border-line-2 hover:text-fg ${st}`,children:"cancel"}),y.jsxs("button",{type:"button",onClick:E,disabled:!s||f||!p,className:`flex items-center gap-1.5 rounded border border-accent/60 bg-bg-1 px-3 py-1.5 text-xs text-accent transition hover:bg-bg-2 active:scale-[0.97] disabled:opacity-50 ${st}`,children:[y.jsx(yi,{className:"size-3.5"})," ",f?"saving…":"save"]})]})]}),v&&s&&y.jsx(B4,{editor:v,accounts:s.accounts,onChange:w,onCancel:()=>w(null),onSubmit:(j,R,T)=>{_(O=>R==="add"?{...O,accounts:[...O.accounts,j]}:{...O,accounts:O.accounts.map($=>$.id===T?j:$)}),w(null)}})]})}const G4="modulepreload",K4=function(e,t){return new URL(e,t).href},Uw={},z_=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let u=function(m){return Promise.all(m.map(p=>Promise.resolve(p).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const f=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),h=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=u(n.map(m=>{if(m=K4(m,s),m in Uw)return;Uw[m]=!0;const p=m.endsWith(".css"),x=p?'[rel="stylesheet"]':"";if(!!s)for(let k=f.length-1;k>=0;k--){const b=f[k];if(b.href===m&&(!p||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${x}`))return;const w=document.createElement("link");if(w.rel=p?"stylesheet":G4,p||(w.as="script"),w.crossOrigin="",w.href=m,h&&w.setAttribute("nonce",h),document.head.appendChild(w),p)return new Promise((k,b)=>{w.addEventListener("load",k),w.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${m}`)))})}))}function a(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return i.then(u=>{for(const f of u||[])f.status==="rejected"&&a(f.reason);return t().catch(a)})};function Bf({title:e,titleTag:t,right:n,captureName:s,children:i,className:a="",bodyClassName:u=""}){const f=z.useRef(null);return y.jsxs("section",{ref:f,className:`group relative rounded-md border border-line bg-bg-1/80 transition-colors hover:border-line-2 ${a}`,children:[e&&y.jsxs("div",{className:"pointer-events-none absolute -top-[7px] left-3 flex items-center gap-2 bg-bg-1 px-1.5",children:[y.jsx("span",{className:"font-display text-[11px] uppercase tracking-wider text-fg-dim",children:e}),t!=null&&y.jsx("span",{className:"text-[10px] normal-case tracking-normal text-fg-faint",children:t})]}),n&&y.jsx("div",{"data-chrome":!0,className:"absolute right-2 top-2 z-20 flex items-center gap-1.5 rounded bg-bg-1 px-0.5",children:n}),s&&y.jsx("div",{"data-chrome":!0,className:"absolute -top-[11px] right-3 z-20",children:y.jsx(Q4,{getNode:()=>f.current,name:s})}),y.jsx("div",{className:`p-4 ${u}`,children:i})]})}function Q4({getNode:e,name:t}){const n=vk();return y.jsx("button",{type:"button",title:"Share this panel","aria-label":"Share this panel as an image",onClick:()=>{const s=e();s&&n({kind:"panel",node:s,captureName:t})},className:"rounded border border-transparent bg-bg-1 p-1 text-fg-faint opacity-0 transition hover:border-line hover:text-accent group-hover:opacity-100 focus-visible:opacity-100",children:y.jsx(Vj,{className:"size-3.5"})})}function J4({derived:e,periodLabel:t}){const n=e.totals,s=e.timeline.map(u=>u.total).slice(-30),i=e.timeline.map(u=>u.tokens).slice(-30),a=e.cacheSavingsSeries.map(u=>u.value).slice(-30);return y.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(150px,1fr))] gap-3",children:[y.jsx(ja,{label:`spend · ${t}`,value:Ue(n.cost),accent:"text-cost",spark:s,sparkColor:"var(--color-cost)"}),y.jsx(ja,{label:"tokens",value:wn(n.tokens),spark:i,sparkColor:"var(--color-fg-dim)"}),y.jsx(ja,{label:"cache saved",value:Ue(n.cacheSavings),accent:"text-positive",spark:a,sparkColor:"var(--color-positive)"}),y.jsx(ja,{label:"calls",value:bs(n.calls)}),y.jsx(ja,{label:"burn · today",value:`${Ue(e.burnRate)}/hr`,accent:"text-warning"})]})}function ja({label:e,value:t,accent:n="text-fg-bright",spark:s,sparkColor:i}){return y.jsxs("div",{className:"rise flex min-w-0 flex-col rounded-md border border-line bg-bg-1/80 p-3.5 transition-colors hover:border-line-2",children:[y.jsx("div",{className:"font-display text-[10px] uppercase tracking-wide text-fg-faint",children:e}),y.jsx("div",{className:`tnum mt-1.5 text-xl sm:text-2xl ${n}`,children:t}),s&&s.length>1&&y.jsx("div",{className:"mt-auto overflow-hidden pt-2 text-right",children:y.jsx(sl,{data:s,color:i??"currentColor",className:"text-sm opacity-70"})})]})}function Y4({accounts:e,nameOf:t}){return e.length===0?y.jsx(Bf,{title:"accounts",children:y.jsx("div",{className:"py-6 text-center text-xs text-fg-faint",children:"no accounts match the current filter"})}):y.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-[repeat(auto-fit,minmax(min(340px,100%),1fr))]",children:e.map((n,s)=>y.jsx(X4,{account:n,index:s,providerName:t(n.providerId)},n.id))})}function X4({account:e,index:t,providerName:n}){var h,m,p,x,v,w;const s=e.dashboard,i=((h=e.billing)==null?void 0:h.metrics)??[],a=((m=e.billing)==null?void 0:m.modelSpend)??[],u=(p=e.billing)==null?void 0:p.activity,f=Ej(e.providerId),d=e.name&&e.name!==n;return y.jsxs("div",{className:"rise group relative overflow-hidden rounded-md border bg-bg-1/50 p-4 transition-colors",style:{animationDelay:`${t*40}ms`,borderColor:`color-mix(in oklab, ${f} 50%, var(--color-line))`},children:[y.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[y.jsx("span",{style:{color:f},children:"●"}),y.jsx("span",{className:"font-display text-sm tracking-wide text-fg-bright",children:n}),d&&y.jsxs("span",{className:"truncate text-xs text-fg-faint",children:["· ",e.name]})]}),((x=e.billing)==null?void 0:x.plan)&&y.jsx("span",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 text-[10px] text-fg-dim",children:e.billing.plan})]}),s&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-2",children:[y.jsx(_g,{label:"today",cost:s.today.cost,tokens:s.today.tokens}),y.jsx(_g,{label:"week",cost:s.week.cost,tokens:s.week.tokens}),y.jsx(_g,{label:"month",cost:s.month.cost,tokens:s.month.tokens})]}),y.jsxs("div",{className:"mt-3 flex items-center justify-between border-t border-line-faint pt-3 text-xs",children:[y.jsxs("span",{className:"text-fg-dim",children:["burn ",y.jsxs("span",{className:"tnum text-warning",children:[Ue(s.burnRate),"/hr"]})]}),y.jsxs("span",{className:"text-fg-dim",children:["saved ",y.jsx("span",{className:"tnum text-positive",children:Ue(s.month.cacheSavings)})]})]})]}),i.length>0&&y.jsx("div",{className:`flex flex-col gap-2 ${s?"mt-3 border-t border-line-faint pt-3":"mt-4"}`,children:i.slice(0,8).map(k=>y.jsx(ez,{metric:k},k.label))}),a.length>0&&y.jsxs("div",{className:"mt-3 flex flex-col gap-1 border-t border-line-faint pt-3",children:[y.jsx("div",{className:"text-[10px] uppercase tracking-wide text-fg-faint",children:"spend by model"}),a.slice(0,4).map(k=>y.jsxs("div",{className:"flex items-center justify-between gap-2 text-[11px]",children:[y.jsx("span",{className:"min-w-0 truncate text-fg-dim",children:Or(k.name)}),y.jsxs("span",{className:"tnum shrink-0 text-cost",children:[Ue(k.usd),y.jsxs("span",{className:"ml-1.5 text-fg-faint",children:[bs(k.requests)," req"]})]})]},k.name))]}),s&&s.series.length>0&&y.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-line-faint pt-3",children:[y.jsx(sl,{data:s.series,color:f,className:"text-sm"}),y.jsxs("span",{className:"ml-auto text-[10px] text-fg-faint",children:[s.series.length,"d"]})]}),!s&&u&&u.series.length>0&&y.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-line-faint pt-3",children:[y.jsx(sl,{data:u.series,color:f,className:"text-sm"}),y.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:u.summary})]}),i.length===0&&((v=e.billing)==null?void 0:v.error)&&y.jsxs("div",{className:`flex items-start gap-1.5 text-xs text-warning ${s?"mt-3 border-t border-line-faint pt-3":"mt-4"}`,children:[y.jsx("span",{"aria-hidden":!0,children:"⚠"}),y.jsx("span",{children:e.billing.error})]}),!s&&i.length===0&&!((w=e.billing)!=null&&w.error)&&a.length===0&&!(u&&u.series.length)&&y.jsx("div",{className:"py-6 text-center text-xs text-fg-faint",children:e.hasUsage?"no usage data":"billing-only · no live metrics"})]})}function _g({label:e,cost:t,tokens:n}){const s=t>0||n===0;return y.jsxs("div",{children:[y.jsx("div",{className:"text-[10px] uppercase text-fg-faint",children:e}),y.jsx("div",{className:`tnum text-sm ${s?"text-cost":"text-fg-bright"}`,children:s?Ue(t):wn(n)}),y.jsx("div",{className:"tnum text-[10px] text-fg-faint",children:s?wn(n):Ue(t)})]})}function Z4(e){return e.format.kind==="dollars"?Ue(e.used):e.format.kind==="count"?`${bs(e.used)}${e.format.suffix?" "+e.format.suffix:""}`:`${Math.round(e.used)}%`}function ez({metric:e}){const t=e.format.kind==="percent"?Math.min(1,Math.max(0,e.used/100)):e.limit!=null&&e.limit>0?Math.min(1,Math.max(0,e.used/e.limit)):null,n=t==null?"var(--color-accent)":t>=.9?"var(--color-warning)":t>=.7?"var(--color-cost)":"var(--color-positive)";return y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[y.jsx("span",{className:"truncate text-fg-dim",children:e.label}),y.jsxs("span",{className:"tnum text-fg",children:[Z4(e),e.format.kind!=="percent"&&e.limit!=null&&y.jsxs("span",{className:"text-fg-faint",children:[" / ",e.format.kind==="dollars"?Ue(e.limit):bs(e.limit)]}),e.resetsAt&&y.jsxs("span",{className:"ml-1.5 text-fg-faint",children:["· ",e.resetsAt]})]})]}),t!=null&&y.jsx("div",{className:"mt-1 h-1.5 w-full overflow-hidden rounded-full bg-bg-3",role:"progressbar","aria-label":e.label,"aria-valuenow":Math.round(t*100),"aria-valuemin":0,"aria-valuemax":100,children:y.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${t*100}%`,background:n}})})]})}const tz=[0,.32,.55,.78,1],Vw=e=>e===0?"var(--color-bg-2)":`color-mix(in oklab, var(--color-cost) ${tz[e]*100}%, var(--color-bg-2))`,U_=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function nz(e,t){const n=e,s=n.filter(m=>t(m)>0);if(s.length===0)return null;const i=n.reduce((m,p)=>m+t(p),0),a=s.reduce((m,p)=>t(p)>t(m)?p:m),u=new Array(7).fill(0);for(const m of n)u[rl($r(m.date))]+=t(m);const f=u.indexOf(Math.max(...u)),d=new Set(s.map(m=>m.date));let h=0;for(let m=$r(s[s.length-1].date);d.has(Sl(m));m-=ds)h++;return{active:s.length,total:i,top:a,avg:i/s.length,busiest:f,streak:h,costed:e.some(m=>m.cost>0)}}function rz(e,t,n){const s=new Map(e.map(k=>[k.date,n(k)]));if(e.length===0)return null;const i=e[e.length-1].date,a=e[0].date;let u=$r(i),f=$r(a);(u-f)/(ds*7)>t&&(f=u-t*7*ds),f-=rl(f)*ds;const d=Math.max(...e.map(n),0),h=k=>{if(k<=0||d<=0)return 0;const b=k/d;return b>.66?4:b>.4?3:b>.15?2:1},m=[];let p=new Array(7).fill(null);const x=[];let v=-1,w=0;for(let k=f;k<=u;k+=ds){const b=Sl(k),_=rl(k);_===0&&p.some(Boolean)&&(m.push(p),p=new Array(7).fill(null),w++);const E=new Date(k).getUTCMonth();E!==v&&_===0&&(x.push({col:w,text:Ij[E]}),v=E);const j=k>=$r(a);p[_]=j?{date:b,cost:s.get(b)??0,level:h(s.get(b)??0)}:null}return p.some(Boolean)&&m.push(p),{weeks:m,monthLabels:x}}function sz({derived:e,maxWeeks:t=26,periodLabel:n}){const[s,i]=z.useState(null),[a,u]=z.useState(null),f=s??a,d=z.useMemo(()=>new Map(e.calendar.map(k=>[k.date,k])),[e.calendar]),h=z.useMemo(()=>e.calendar.some(k=>k.cost>0),[e.calendar]),m=k=>h?k.cost:k.tokens,p=z.useMemo(()=>nz(e.calendar,m),[e,h]),x=z.useMemo(()=>rz(e.calendar,t,m),[e,t]),v=x?`repeat(${x.weeks.length}, minmax(0,1fr))`:void 0,w=x?x.weeks.length*25:void 0;return y.jsx(y.Fragment,{children:y.jsx(Bf,{title:"daily spend",titleTag:n,captureName:"calendar",children:!x||!p?y.jsx("div",{className:"py-6 text-center text-xs text-fg-faint",children:"no usage yet"}):y.jsxs("div",{className:"grid gap-x-8 gap-y-5 pt-1 md:grid-cols-[minmax(0,1fr)_210px] md:items-start",children:[y.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[y.jsx("div",{className:"pl-6",children:y.jsx("div",{className:"grid gap-[3px] text-[9px] text-fg-faint",style:{gridTemplateColumns:v,maxWidth:w},children:x.weeks.map((k,b)=>{const _=x.monthLabels.find(E=>E.col===b);return y.jsx("div",{className:"truncate",children:(_==null?void 0:_.text)??""},b)})})}),y.jsxs("div",{className:"flex gap-[3px]",children:[y.jsx("div",{className:"flex w-5 shrink-0 flex-col gap-[3px] text-[9px] text-fg-faint",children:["M","","W","","F","",""].map((k,b)=>y.jsx("div",{className:"flex flex-1 items-center",children:k},b))}),y.jsx("div",{className:"grid min-w-0 flex-1 gap-[3px]",style:{gridTemplateColumns:v,maxWidth:w},onMouseLeave:()=>i(null),children:x.weeks.map((k,b)=>y.jsx("div",{className:"flex flex-col gap-[3px]",children:k.map((_,E)=>_===null?y.jsx("div",{className:"aspect-square"},E):y.jsx("button",{type:"button","aria-label":`${tl(_.date)} — click to pin`,"aria-pressed":(a==null?void 0:a.date)===_.date,className:`aspect-square block rounded-[3px] p-0 transition duration-150 hover:scale-[1.18] hover:ring-1 hover:ring-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent ${(a==null?void 0:a.date)===_.date?"ring-1 ring-fg-bright":""}`,style:{background:Vw(_.level)},onMouseEnter:()=>i(d.get(_.date)??null),onFocus:()=>i(d.get(_.date)??null),onClick:()=>u(j=>(j==null?void 0:j.date)===_.date?null:d.get(_.date)??null)},E))},b))})]}),y.jsxs("div",{className:"flex items-center gap-1.5 pl-6 pt-1 text-[9px] text-fg-faint",children:["less",[0,1,2,3,4].map(k=>y.jsx("span",{className:"size-[11px] rounded-[2px]",style:{background:Vw(k)}},k)),"more"]})]}),y.jsxs("div",{className:"relative border-line-faint md:border-l md:pl-6",children:[y.jsxs("div",{className:`grid grid-cols-2 gap-x-6 gap-y-4 transition-opacity duration-200 md:grid-cols-1 ${f?"opacity-0":"opacity-100"}`,children:[y.jsx(ec,{label:"busiest day",value:p.costed?Ue(p.top.cost):wn(p.top.tokens),sub:tl(p.top.date),valueClass:"text-cost"}),y.jsx(ec,{label:"daily average",value:p.costed?Ue(p.avg):wn(p.avg),sub:`across ${p.active} active days`}),y.jsx(ec,{label:"top weekday",value:U_[p.busiest],valueClass:"text-fg-bright"}),y.jsx(ec,{label:"current streak",value:`${p.streak}d`,sub:p.streak>0?"in a row":"idle today",valueClass:"text-positive"})]}),f&&y.jsx("div",{className:"dialog-fade absolute inset-0 md:pl-6",children:y.jsx(oz,{day:f,pinned:!s&&f===a})})]})]})})})}function oz({day:e,pinned:t=!1}){return y.jsxs("div",{className:"font-mono text-[11px]",children:[y.jsxs("div",{className:"flex items-baseline justify-between gap-3 border-b border-line-faint pb-2",children:[y.jsxs("span",{className:"text-fg-dim",children:[U_[rl($r(e.date))]," · ",tl(e.date),t&&y.jsx("span",{className:"ml-1.5 text-[9px] uppercase tracking-wide text-accent",children:"pinned"})]}),y.jsx("span",{className:"tnum text-cost",children:e.cost>0?Ue(e.cost):"—"})]}),e.cost>0?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"grid grid-cols-3 gap-2 py-2 text-[10px]",children:[y.jsxs("div",{children:[y.jsx("div",{className:"text-fg-faint",children:"calls"}),y.jsx("div",{className:"tnum text-fg",children:bs(e.calls)})]}),y.jsxs("div",{children:[y.jsx("div",{className:"text-fg-faint",children:"tokens"}),y.jsx("div",{className:"tnum text-fg",children:wn(e.tokens)})]}),y.jsxs("div",{children:[y.jsx("div",{className:"text-fg-faint",children:"saved"}),y.jsx("div",{className:"tnum text-positive",children:Ue(e.cacheSavings)})]})]}),y.jsxs("div",{className:"flex flex-col gap-1 border-t border-line-faint pt-2",children:[e.models.slice(0,5).map(n=>y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"size-1.5 shrink-0 rounded-full",style:{background:Xp(n.name)}}),y.jsx("span",{className:"min-w-0 flex-1 truncate text-fg-dim",children:Or(n.name)}),y.jsx("span",{className:"tnum w-16 shrink-0 text-right text-fg",children:Ue(n.cost)})]},n.name)),e.models.length>5&&y.jsxs("div",{className:"pt-0.5 text-fg-faint",children:["+",e.models.length-5," more"]})]})]}):y.jsx("div",{className:"pt-2 text-fg-faint",children:"no spend this day"})]})}const iz=[{value:"cost",label:"cost"},{value:"tokens",label:"tokens"},{value:"calls",label:"calls"}],Bw="1.75rem minmax(6rem,12rem) minmax(3.5rem,1fr) 3rem 5.5rem 5rem auto auto auto";function az({derived:e,limit:t,periodLabel:n}){const[s,i]=z.useState(e.totals.cost>0?"cost":"tokens"),a=[...e.byModel].sort((m,p)=>p[s]-m[s]),u=t?a.slice(0,t):a,f=s==="tokens"?"tokenShare":s==="calls"?"callShare":"share",d=s==="tokens"?"block":"hidden md:block",h=s==="calls"?"block":"hidden lg:block";return y.jsx(Bf,{title:"model leaderboard",titleTag:n,captureName:"models",right:y.jsx(Sn,{options:iz,value:s,onChange:i,size:"xs",ariaLabel:"sort models by",containerClassName:"flex items-center gap-0.5",btnClassName:"rounded px-1.5 py-0.5 text-[11px] transition"}),children:u.length===0?y.jsx(X2,{children:"no models in period"}):y.jsxs("div",{className:"mt-6 flex flex-col overflow-x-auto",children:[y.jsxs("div",{className:"grid items-center gap-x-3 border-b border-line px-2 pb-1.5 font-display text-[10px] uppercase tracking-wide text-fg-faint",style:{gridTemplateColumns:Bw},children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{children:"share"}),y.jsx("span",{className:"text-right",children:"%"}),y.jsx("span",{className:"text-right text-cost/70",children:"cost"}),y.jsx("span",{className:"text-right",children:"trend"}),y.jsx("span",{className:"hidden text-right lg:block",children:"$/call"}),y.jsx("span",{className:`text-right ${d}`,children:"tokens"}),y.jsx("span",{className:`text-right ${h}`,children:"calls"})]}),u.map((m,p)=>y.jsxs("div",{className:"grid items-center gap-x-3 rounded border-b border-line-faint px-2 py-2 transition-colors last:border-0 hover:bg-bg-2/40",style:{gridTemplateColumns:Bw},children:[y.jsxs("span",{className:`tnum text-xs ${p===0?"font-medium text-accent":p<3?"text-fg-dim":"text-fg-faint"}`,children:["#",p+1]}),y.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[y.jsx("span",{className:"size-2 shrink-0 rounded-[2px]",style:{background:m.color}}),y.jsx("span",{className:"truncate text-fg",title:m.model,children:Or(m.model)})]}),y.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-bg-3",children:y.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(100,m[f]*100)}%`,minWidth:m[f]>0?"2px":0,background:m.color}})}),y.jsx("span",{className:"tnum text-right text-[11px] text-fg-dim",children:Z1(m[f],m[f]>0&&m[f]<.01?1:0)}),y.jsx("span",{className:"tnum text-right text-xs text-cost",children:Ue(m.cost)}),y.jsx("span",{className:"overflow-hidden text-right",children:y.jsx(sl,{data:m.trend.slice(-30),color:m.color,className:"text-sm"})}),y.jsx("span",{className:"tnum hidden text-right text-xs text-fg-dim lg:block",children:Ue(m.calls?m.cost/m.calls:0)}),y.jsx("span",{className:`tnum text-right text-xs text-fg-dim ${d}`,children:m.tokens>0?wn(m.tokens):y.jsx("span",{className:"text-fg-faint",children:"—"})}),y.jsx("span",{className:`tnum text-right text-xs text-fg-faint ${h}`,children:bs(m.calls)})]},m.model))]})})}/**
|
|
85
|
+
* table-core
|
|
86
|
+
*
|
|
87
|
+
* Copyright (c) TanStack
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the MIT license found in the
|
|
90
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
91
|
+
*
|
|
92
|
+
* @license MIT
|
|
93
|
+
*/function lz(){return{accessor:(e,t)=>typeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function gs(e,t){return typeof e=="function"?e(t):e}function Rn(e,t){return n=>{t.setState(s=>({...s,[e]:gs(n,s[e])}))}}function qf(e){return e instanceof Function}function uz(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function cz(e,t){const n=[],s=i=>{i.forEach(a=>{n.push(a);const u=t(a);u!=null&&u.length&&s(u)})};return s(e),n}function Se(e,t,n){let s=[],i;return a=>{let u;n.key&&n.debug&&(u=Date.now());const f=e(a);if(!(f.length!==s.length||f.some((m,p)=>s[p]!==m)))return i;s=f;let h;if(n.key&&n.debug&&(h=Date.now()),i=t(...f),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const m=Math.round((Date.now()-u)*100)/100,p=Math.round((Date.now()-h)*100)/100,x=p/16,v=(w,k)=>{for(w=String(w);w.length<k;)w=" "+w;return w};console.info(`%c⏱ ${v(p,5)} /${v(m,5)} ms`,`
|
|
94
|
+
font-size: .6rem;
|
|
95
|
+
font-weight: bold;
|
|
96
|
+
color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,n==null?void 0:n.key)}return i}}function we(e,t,n,s){return{debug:()=>{var i;return(i=e==null?void 0:e.debugAll)!=null?i:e[t]},key:!1,onChange:s}}function fz(e,t,n,s){const i=()=>{var u;return(u=a.getValue())!=null?u:e.options.renderFallbackValue},a={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(s),renderValue:i,getContext:Se(()=>[e,n,t,a],(u,f,d,h)=>({table:u,column:f,row:d,cell:h,getValue:h.getValue,renderValue:h.renderValue}),we(e.options,"debugCells"))};return e._features.forEach(u=>{u.createCell==null||u.createCell(a,n,t,e)},{}),a}function dz(e,t,n,s){var i,a;const f={...e._getDefaultColumnDef(),...t},d=f.accessorKey;let h=(i=(a=f.id)!=null?a:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?i:typeof f.header=="string"?f.header:void 0,m;if(f.accessorFn?m=f.accessorFn:d&&(d.includes(".")?m=x=>{let v=x;for(const k of d.split(".")){var w;v=(w=v)==null?void 0:w[k]}return v}:m=x=>x[f.accessorKey]),!h)throw new Error;let p={id:`${String(h)}`,accessorFn:m,parent:s,depth:n,columnDef:f,columns:[],getFlatColumns:Se(()=>[!0],()=>{var x;return[p,...(x=p.columns)==null?void 0:x.flatMap(v=>v.getFlatColumns())]},we(e.options,"debugColumns")),getLeafColumns:Se(()=>[e._getOrderColumnsFn()],x=>{var v;if((v=p.columns)!=null&&v.length){let w=p.columns.flatMap(k=>k.getLeafColumns());return x(w)}return[p]},we(e.options,"debugColumns"))};for(const x of e._features)x.createColumn==null||x.createColumn(p,e);return p}const Vt="debugHeaders";function qw(e,t,n){var s;let a={id:(s=n.id)!=null?s:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const u=[],f=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(f),u.push(d)};return f(a),u},getContext:()=>({table:e,header:a,column:t})};return e._features.forEach(u=>{u.createHeader==null||u.createHeader(a,e)}),a}const hz={createTable:e=>{e.getHeaderGroups=Se(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s,i)=>{var a,u;const f=(a=s==null?void 0:s.map(p=>n.find(x=>x.id===p)).filter(Boolean))!=null?a:[],d=(u=i==null?void 0:i.map(p=>n.find(x=>x.id===p)).filter(Boolean))!=null?u:[],h=n.filter(p=>!(s!=null&&s.includes(p.id))&&!(i!=null&&i.includes(p.id)));return lc(t,[...f,...h,...d],e)},we(e.options,Vt)),e.getCenterHeaderGroups=Se(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s,i)=>(n=n.filter(a=>!(s!=null&&s.includes(a.id))&&!(i!=null&&i.includes(a.id))),lc(t,n,e,"center")),we(e.options,Vt)),e.getLeftHeaderGroups=Se(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,s)=>{var i;const a=(i=s==null?void 0:s.map(u=>n.find(f=>f.id===u)).filter(Boolean))!=null?i:[];return lc(t,a,e,"left")},we(e.options,Vt)),e.getRightHeaderGroups=Se(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,s)=>{var i;const a=(i=s==null?void 0:s.map(u=>n.find(f=>f.id===u)).filter(Boolean))!=null?i:[];return lc(t,a,e,"right")},we(e.options,Vt)),e.getFooterGroups=Se(()=>[e.getHeaderGroups()],t=>[...t].reverse(),we(e.options,Vt)),e.getLeftFooterGroups=Se(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),we(e.options,Vt)),e.getCenterFooterGroups=Se(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),we(e.options,Vt)),e.getRightFooterGroups=Se(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),we(e.options,Vt)),e.getFlatHeaders=Se(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Vt)),e.getLeftFlatHeaders=Se(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Vt)),e.getCenterFlatHeaders=Se(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Vt)),e.getRightFlatHeaders=Se(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Vt)),e.getCenterLeafHeaders=Se(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),we(e.options,Vt)),e.getLeftLeafHeaders=Se(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),we(e.options,Vt)),e.getRightLeafHeaders=Se(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),we(e.options,Vt)),e.getLeafHeaders=Se(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,s)=>{var i,a,u,f,d,h;return[...(i=(a=t[0])==null?void 0:a.headers)!=null?i:[],...(u=(f=n[0])==null?void 0:f.headers)!=null?u:[],...(d=(h=s[0])==null?void 0:h.headers)!=null?d:[]].map(m=>m.getLeafHeaders()).flat()},we(e.options,Vt))}};function lc(e,t,n,s){var i,a;let u=0;const f=function(x,v){v===void 0&&(v=1),u=Math.max(u,v),x.filter(w=>w.getIsVisible()).forEach(w=>{var k;(k=w.columns)!=null&&k.length&&f(w.columns,v+1)},0)};f(e);let d=[];const h=(x,v)=>{const w={depth:v,id:[s,`${v}`].filter(Boolean).join("_"),headers:[]},k=[];x.forEach(b=>{const _=[...k].reverse()[0],E=b.column.depth===w.depth;let j,R=!1;if(E&&b.column.parent?j=b.column.parent:(j=b.column,R=!0),_&&(_==null?void 0:_.column)===j)_.subHeaders.push(b);else{const T=qw(n,j,{id:[s,v,j.id,b==null?void 0:b.id].filter(Boolean).join("_"),isPlaceholder:R,placeholderId:R?`${k.filter(O=>O.column===j).length}`:void 0,depth:v,index:k.length});T.subHeaders.push(b),k.push(T)}w.headers.push(b),b.headerGroup=w}),d.push(w),v>0&&h(k,v-1)},m=t.map((x,v)=>qw(n,x,{depth:u,index:v}));h(m,u-1),d.reverse();const p=x=>x.filter(w=>w.column.getIsVisible()).map(w=>{let k=0,b=0,_=[0];w.subHeaders&&w.subHeaders.length?(_=[],p(w.subHeaders).forEach(j=>{let{colSpan:R,rowSpan:T}=j;k+=R,_.push(T)})):k=1;const E=Math.min(..._);return b=b+E,w.colSpan=k,w.rowSpan=b,{colSpan:k,rowSpan:b}});return p((i=(a=d[0])==null?void 0:a.headers)!=null?i:[]),d}const R0=(e,t,n,s,i,a,u)=>{let f={id:t,index:s,original:n,depth:i,parentId:u,_valuesCache:{},_uniqueValuesCache:{},getValue:d=>{if(f._valuesCache.hasOwnProperty(d))return f._valuesCache[d];const h=e.getColumn(d);if(h!=null&&h.accessorFn)return f._valuesCache[d]=h.accessorFn(f.original,s),f._valuesCache[d]},getUniqueValues:d=>{if(f._uniqueValuesCache.hasOwnProperty(d))return f._uniqueValuesCache[d];const h=e.getColumn(d);if(h!=null&&h.accessorFn)return h.columnDef.getUniqueValues?(f._uniqueValuesCache[d]=h.columnDef.getUniqueValues(f.original,s),f._uniqueValuesCache[d]):(f._uniqueValuesCache[d]=[f.getValue(d)],f._uniqueValuesCache[d])},renderValue:d=>{var h;return(h=f.getValue(d))!=null?h:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>cz(f.subRows,d=>d.subRows),getParentRow:()=>f.parentId?e.getRow(f.parentId,!0):void 0,getParentRows:()=>{let d=[],h=f;for(;;){const m=h.getParentRow();if(!m)break;d.push(m),h=m}return d.reverse()},getAllCells:Se(()=>[e.getAllLeafColumns()],d=>d.map(h=>fz(e,f,h,h.id)),we(e.options,"debugRows")),_getAllCellsByColumnId:Se(()=>[f.getAllCells()],d=>d.reduce((h,m)=>(h[m.column.id]=m,h),{}),we(e.options,"debugRows"))};for(let d=0;d<e._features.length;d++){const h=e._features[d];h==null||h.createRow==null||h.createRow(f,e)}return f},gz={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},V_=(e,t,n)=>{var s,i;const a=n==null||(s=n.toString())==null?void 0:s.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(a))};V_.autoRemove=e=>Yn(e);const B_=(e,t,n)=>{var s;return!!(!((s=e.getValue(t))==null||(s=s.toString())==null)&&s.includes(n))};B_.autoRemove=e=>Yn(e);const q_=(e,t,n)=>{var s;return((s=e.getValue(t))==null||(s=s.toString())==null?void 0:s.toLowerCase())===(n==null?void 0:n.toLowerCase())};q_.autoRemove=e=>Yn(e);const H_=(e,t,n)=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(n)};H_.autoRemove=e=>Yn(e);const W_=(e,t,n)=>!n.some(s=>{var i;return!((i=e.getValue(t))!=null&&i.includes(s))});W_.autoRemove=e=>Yn(e)||!(e!=null&&e.length);const G_=(e,t,n)=>n.some(s=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(s)});G_.autoRemove=e=>Yn(e)||!(e!=null&&e.length);const K_=(e,t,n)=>e.getValue(t)===n;K_.autoRemove=e=>Yn(e);const Q_=(e,t,n)=>e.getValue(t)==n;Q_.autoRemove=e=>Yn(e);const E0=(e,t,n)=>{let[s,i]=n;const a=e.getValue(t);return a>=s&&a<=i};E0.resolveFilterValue=e=>{let[t,n]=e,s=typeof t!="number"?parseFloat(t):t,i=typeof n!="number"?parseFloat(n):n,a=t===null||Number.isNaN(s)?-1/0:s,u=n===null||Number.isNaN(i)?1/0:i;if(a>u){const f=a;a=u,u=f}return[a,u]};E0.autoRemove=e=>Yn(e)||Yn(e[0])&&Yn(e[1]);const Nr={includesString:V_,includesStringSensitive:B_,equalsString:q_,arrIncludes:H_,arrIncludesAll:W_,arrIncludesSome:G_,equals:K_,weakEquals:Q_,inNumberRange:E0};function Yn(e){return e==null||e===""}const pz={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Rn("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],s=n==null?void 0:n.getValue(e.id);return typeof s=="string"?Nr.includesString:typeof s=="number"?Nr.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?Nr.equals:Array.isArray(s)?Nr.arrIncludes:Nr.weakEquals},e.getFilterFn=()=>{var n,s;return qf(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(s=t.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?n:Nr[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,s,i;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((s=t.options.enableColumnFilters)!=null?s:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(s=>s.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,s;return(n=(s=t.getState().columnFilters)==null?void 0:s.findIndex(i=>i.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(s=>{const i=e.getFilterFn(),a=s==null?void 0:s.find(m=>m.id===e.id),u=gs(n,a?a.value:void 0);if(Hw(i,u,e)){var f;return(f=s==null?void 0:s.filter(m=>m.id!==e.id))!=null?f:[]}const d={id:e.id,value:u};if(a){var h;return(h=s==null?void 0:s.map(m=>m.id===e.id?d:m))!=null?h:[]}return s!=null&&s.length?[...s,d]:[d]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),s=i=>{var a;return(a=gs(t,i))==null?void 0:a.filter(u=>{const f=n.find(d=>d.id===u.id);if(f){const d=f.getFilterFn();if(Hw(d,u.value,f))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=t=>{var n,s;e.setColumnFilters(t?[]:(n=(s=e.initialState)==null?void 0:s.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Hw(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const mz=(e,t,n)=>n.reduce((s,i)=>{const a=i.getValue(e);return s+(typeof a=="number"?a:0)},0),yz=(e,t,n)=>{let s;return n.forEach(i=>{const a=i.getValue(e);a!=null&&(s>a||s===void 0&&a>=a)&&(s=a)}),s},xz=(e,t,n)=>{let s;return n.forEach(i=>{const a=i.getValue(e);a!=null&&(s<a||s===void 0&&a>=a)&&(s=a)}),s},vz=(e,t,n)=>{let s,i;return n.forEach(a=>{const u=a.getValue(e);u!=null&&(s===void 0?u>=u&&(s=i=u):(s>u&&(s=u),i<u&&(i=u)))}),[s,i]},Sz=(e,t)=>{let n=0,s=0;if(t.forEach(i=>{let a=i.getValue(e);a!=null&&(a=+a)>=a&&(++n,s+=a)}),n)return s/n},wz=(e,t)=>{if(!t.length)return;const n=t.map(a=>a.getValue(e));if(!uz(n))return;if(n.length===1)return n[0];const s=Math.floor(n.length/2),i=n.sort((a,u)=>a-u);return n.length%2!==0?i[s]:(i[s-1]+i[s])/2},kz=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),Cz=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,bz=(e,t)=>t.length,Rg={sum:mz,min:yz,max:xz,extent:vz,mean:Sz,median:wz,unique:kz,uniqueCount:Cz,count:bz},_z={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Rn("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(s=>s!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,s;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((s=t.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],s=n==null?void 0:n.getValue(e.id);if(typeof s=="number")return Rg.sum;if(Object.prototype.toString.call(s)==="[object Date]")return Rg.extent},e.getAggregationFn=()=>{var n,s;if(!e)throw new Error;return qf(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(s=t.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?n:Rg[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,s;e.setGrouping(t?[]:(n=(s=e.initialState)==null?void 0:s.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const s=t.getColumn(n);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[n]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,s)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function Rz(e,t,n){if(!(t!=null&&t.length)||!n)return e;const s=e.filter(a=>!t.includes(a.id));return n==="remove"?s:[...t.map(a=>e.find(u=>u.id===a)).filter(Boolean),...s]}const Ez={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Rn("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Se(n=>[Ga(t,n)],n=>n.findIndex(s=>s.id===e.id),we(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var s;return((s=Ga(t,n)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=n=>{var s;const i=Ga(t,n);return((s=i[i.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=Se(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,s)=>i=>{let a=[];if(!(t!=null&&t.length))a=i;else{const u=[...t],f=[...i];for(;f.length&&u.length;){const d=u.shift(),h=f.findIndex(m=>m.id===d);h>-1&&a.push(f.splice(h,1)[0])}a=[...a,...f]}return Rz(a,n,s)},we(e.options,"debugTable"))}},Eg=()=>({left:[],right:[]}),Pz={getInitialState:e=>({columnPinning:Eg(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Rn("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const s=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var a,u;if(n==="right"){var f,d;return{left:((f=i==null?void 0:i.left)!=null?f:[]).filter(p=>!(s!=null&&s.includes(p))),right:[...((d=i==null?void 0:i.right)!=null?d:[]).filter(p=>!(s!=null&&s.includes(p))),...s]}}if(n==="left"){var h,m;return{left:[...((h=i==null?void 0:i.left)!=null?h:[]).filter(p=>!(s!=null&&s.includes(p))),...s],right:((m=i==null?void 0:i.right)!=null?m:[]).filter(p=>!(s!=null&&s.includes(p)))}}return{left:((a=i==null?void 0:i.left)!=null?a:[]).filter(p=>!(s!=null&&s.includes(p))),right:((u=i==null?void 0:i.right)!=null?u:[]).filter(p=>!(s!=null&&s.includes(p)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var i,a,u;return((i=s.columnDef.enablePinning)!=null?i:!0)&&((a=(u=t.options.enableColumnPinning)!=null?u:t.options.enablePinning)!=null?a:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(f=>f.id),{left:s,right:i}=t.getState().columnPinning,a=n.some(f=>s==null?void 0:s.includes(f)),u=n.some(f=>i==null?void 0:i.includes(f));return a?"left":u?"right":!1},e.getPinnedIndex=()=>{var n,s;const i=e.getIsPinned();return i?(n=(s=t.getState().columnPinning)==null||(s=s[i])==null?void 0:s.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Se(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,s,i)=>{const a=[...s??[],...i??[]];return n.filter(u=>!a.includes(u.column.id))},we(t.options,"debugRows")),e.getLeftVisibleCells=Se(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,s)=>(s??[]).map(a=>n.find(u=>u.column.id===a)).filter(Boolean).map(a=>({...a,position:"left"})),we(t.options,"debugRows")),e.getRightVisibleCells=Se(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,s)=>(s??[]).map(a=>n.find(u=>u.column.id===a)).filter(Boolean).map(a=>({...a,position:"right"})),we(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,s;return e.setColumnPinning(t?Eg():(n=(s=e.initialState)==null?void 0:s.columnPinning)!=null?n:Eg())},e.getIsSomeColumnsPinned=t=>{var n;const s=e.getState().columnPinning;if(!t){var i,a;return!!((i=s.left)!=null&&i.length||(a=s.right)!=null&&a.length)}return!!((n=s[t])!=null&&n.length)},e.getLeftLeafColumns=Se(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(s=>t.find(i=>i.id===s)).filter(Boolean),we(e.options,"debugColumns")),e.getRightLeafColumns=Se(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(s=>t.find(i=>i.id===s)).filter(Boolean),we(e.options,"debugColumns")),e.getCenterLeafColumns=Se(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s)=>{const i=[...n??[],...s??[]];return t.filter(a=>!i.includes(a.id))},we(e.options,"debugColumns"))}};function Iz(e){return e||(typeof document<"u"?document:null)}const uc={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Pg=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),jz={getDefaultColumnDef:()=>uc,getInitialState:e=>({columnSizing:{},columnSizingInfo:Pg(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Rn("columnSizing",e),onColumnSizingInfoChange:Rn("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,s,i;const a=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:uc.minSize,(s=a??e.columnDef.size)!=null?s:uc.size),(i=e.columnDef.maxSize)!=null?i:uc.maxSize)},e.getStart=Se(n=>[n,Ga(t,n),t.getState().columnSizing],(n,s)=>s.slice(0,e.getIndex(n)).reduce((i,a)=>i+a.getSize(),0),we(t.options,"debugColumns")),e.getAfter=Se(n=>[n,Ga(t,n),t.getState().columnSizing],(n,s)=>s.slice(e.getIndex(n)+1).reduce((i,a)=>i+a.getSize(),0),we(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:s,...i}=n;return i})},e.getCanResize=()=>{var n,s;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((s=t.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const s=i=>{if(i.subHeaders.length)i.subHeaders.forEach(s);else{var a;n+=(a=i.column.getSize())!=null?a:0}};return s(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const s=t.getColumn(e.column.id),i=s==null?void 0:s.getCanResize();return a=>{if(!s||!i||(a.persist==null||a.persist(),Ig(a)&&a.touches&&a.touches.length>1))return;const u=e.getSize(),f=e?e.getLeafHeaders().map(_=>[_.column.id,_.column.getSize()]):[[s.id,s.getSize()]],d=Ig(a)?Math.round(a.touches[0].clientX):a.clientX,h={},m=(_,E)=>{typeof E=="number"&&(t.setColumnSizingInfo(j=>{var R,T;const O=t.options.columnResizeDirection==="rtl"?-1:1,$=(E-((R=j==null?void 0:j.startOffset)!=null?R:0))*O,U=Math.max($/((T=j==null?void 0:j.startSize)!=null?T:0),-.999999);return j.columnSizingStart.forEach(V=>{let[Z,te]=V;h[Z]=Math.round(Math.max(te+te*U,0)*100)/100}),{...j,deltaOffset:$,deltaPercentage:U}}),(t.options.columnResizeMode==="onChange"||_==="end")&&t.setColumnSizing(j=>({...j,...h})))},p=_=>m("move",_),x=_=>{m("end",_),t.setColumnSizingInfo(E=>({...E,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},v=Iz(n),w={moveHandler:_=>p(_.clientX),upHandler:_=>{v==null||v.removeEventListener("mousemove",w.moveHandler),v==null||v.removeEventListener("mouseup",w.upHandler),x(_.clientX)}},k={moveHandler:_=>(_.cancelable&&(_.preventDefault(),_.stopPropagation()),p(_.touches[0].clientX),!1),upHandler:_=>{var E;v==null||v.removeEventListener("touchmove",k.moveHandler),v==null||v.removeEventListener("touchend",k.upHandler),_.cancelable&&(_.preventDefault(),_.stopPropagation()),x((E=_.touches[0])==null?void 0:E.clientX)}},b=Nz()?{passive:!1}:!1;Ig(a)?(v==null||v.addEventListener("touchmove",k.moveHandler,b),v==null||v.addEventListener("touchend",k.upHandler,b)):(v==null||v.addEventListener("mousemove",w.moveHandler,b),v==null||v.addEventListener("mouseup",w.upHandler,b)),t.setColumnSizingInfo(_=>({..._,startOffset:d,startSize:u,deltaOffset:0,deltaPercentage:0,columnSizingStart:f,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?Pg():(n=e.initialState.columnSizingInfo)!=null?n:Pg())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((s,i)=>s+i.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((s,i)=>s+i.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((s,i)=>s+i.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((s,i)=>s+i.getSize(),0))!=null?t:0}}};let cc=null;function Nz(){if(typeof cc=="boolean")return cc;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return cc=e,cc}function Ig(e){return e.type==="touchstart"}const Mz={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Rn("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(s=>({...s,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,s;const i=e.columns;return(n=i.length?i.some(a=>a.getIsVisible()):(s=t.getState().columnVisibility)==null?void 0:s[e.id])!=null?n:!0},e.getCanHide=()=>{var n,s;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((s=t.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Se(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(s=>s.column.getIsVisible()),we(t.options,"debugRows")),e.getVisibleCells=Se(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,s,i)=>[...n,...s,...i],we(t.options,"debugRows"))},createTable:e=>{const t=(n,s)=>Se(()=>[s(),s().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(a=>a.getIsVisible==null?void 0:a.getIsVisible()),we(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var s;e.setColumnVisibility(n?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=n=>{var s;n=(s=n)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,a)=>({...i,[a.id]:n||!(a.getCanHide!=null&&a.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var s;e.toggleAllColumnsVisible((s=n.target)==null?void 0:s.checked)}}};function Ga(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Tz={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},$z={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Rn("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const s=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,s,i,a;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((s=t.options.enableGlobalFilter)!=null?s:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((a=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?a:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Nr.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:s}=e.options;return qf(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[s])!=null?t:Nr[s]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},Fz={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Rn("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var s,i;if(!t){e._queue(()=>{t=!0});return}if((s=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var i,a;e.setExpanded(s?{}:(i=(a=e.initialState)==null?void 0:a.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(a=>{const u=a.split(".");s=Math.max(s,u.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(s=>{var i;const a=s===!0?!0:!!(s!=null&&s[e.id]);let u={};if(s===!0?Object.keys(t.getRowModel().rowsById).forEach(f=>{u[f]=!0}):u=s,n=(i=n)!=null?i:!a,!a&&n)return{...u,[e.id]:!0};if(a&&!n){const{[e.id]:f,...d}=u;return d}return s})},e.getIsExpanded=()=>{var n;const s=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:s===!0||s!=null&&s[e.id])},e.getCanExpand=()=>{var n,s,i;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((s=t.options.enableExpanding)!=null?s:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,s=e;for(;n&&s.parentId;)s=t.getRow(s.parentId,!0),n=s.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},Op=0,Ap=10,jg=()=>({pageIndex:Op,pageSize:Ap}),Lz={getInitialState:e=>({...e,pagination:{...jg(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Rn("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var s,i;if(!t){e._queue(()=>{t=!0});return}if((s=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=s=>{const i=a=>gs(s,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=s=>{var i;e.setPagination(s?jg():(i=e.initialState.pagination)!=null?i:jg())},e.setPageIndex=s=>{e.setPagination(i=>{let a=gs(s,i.pageIndex);const u=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return a=Math.max(0,Math.min(a,u)),{...i,pageIndex:a}})},e.resetPageIndex=s=>{var i,a;e.setPageIndex(s?Op:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageIndex)!=null?i:Op)},e.resetPageSize=s=>{var i,a;e.setPageSize(s?Ap:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageSize)!=null?i:Ap)},e.setPageSize=s=>{e.setPagination(i=>{const a=Math.max(1,gs(s,i.pageSize)),u=i.pageSize*i.pageIndex,f=Math.floor(u/a);return{...i,pageIndex:f,pageSize:a}})},e.setPageCount=s=>e.setPagination(i=>{var a;let u=gs(s,(a=e.options.pageCount)!=null?a:-1);return typeof u=="number"&&(u=Math.max(-1,u)),{...i,pageCount:u}}),e.getPageOptions=Se(()=>[e.getPageCount()],s=>{let i=[];return s&&s>0&&(i=[...new Array(s)].fill(null).map((a,u)=>u)),i},we(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:s<i-1},e.previousPage=()=>e.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},Ng=()=>({top:[],bottom:[]}),Oz={getInitialState:e=>({rowPinning:Ng(),...e}),getDefaultOptions:e=>({onRowPinningChange:Rn("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,s,i)=>{const a=s?e.getLeafRows().map(d=>{let{id:h}=d;return h}):[],u=i?e.getParentRows().map(d=>{let{id:h}=d;return h}):[],f=new Set([...u,e.id,...a]);t.setRowPinning(d=>{var h,m;if(n==="bottom"){var p,x;return{top:((p=d==null?void 0:d.top)!=null?p:[]).filter(k=>!(f!=null&&f.has(k))),bottom:[...((x=d==null?void 0:d.bottom)!=null?x:[]).filter(k=>!(f!=null&&f.has(k))),...Array.from(f)]}}if(n==="top"){var v,w;return{top:[...((v=d==null?void 0:d.top)!=null?v:[]).filter(k=>!(f!=null&&f.has(k))),...Array.from(f)],bottom:((w=d==null?void 0:d.bottom)!=null?w:[]).filter(k=>!(f!=null&&f.has(k)))}}return{top:((h=d==null?void 0:d.top)!=null?h:[]).filter(k=>!(f!=null&&f.has(k))),bottom:((m=d==null?void 0:d.bottom)!=null?m:[]).filter(k=>!(f!=null&&f.has(k)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:s,enablePinning:i}=t.options;return typeof s=="function"?s(e):(n=s??i)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:s,bottom:i}=t.getState().rowPinning,a=n.some(f=>s==null?void 0:s.includes(f)),u=n.some(f=>i==null?void 0:i.includes(f));return a?"top":u?"bottom":!1},e.getPinnedIndex=()=>{var n,s;const i=e.getIsPinned();if(!i)return-1;const a=(n=i==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(u=>{let{id:f}=u;return f});return(s=a==null?void 0:a.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,s;return e.setRowPinning(t?Ng():(n=(s=e.initialState)==null?void 0:s.rowPinning)!=null?n:Ng())},e.getIsSomeRowsPinned=t=>{var n;const s=e.getState().rowPinning;if(!t){var i,a;return!!((i=s.top)!=null&&i.length||(a=s.bottom)!=null&&a.length)}return!!((n=s[t])!=null&&n.length)},e._getPinnedRows=(t,n,s)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(n??[]).map(u=>{const f=e.getRow(u,!0);return f.getIsAllParentsExpanded()?f:null}):(n??[]).map(u=>t.find(f=>f.id===u))).filter(Boolean).map(u=>({...u,position:s}))},e.getTopRows=Se(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),we(e.options,"debugRows")),e.getBottomRows=Se(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),we(e.options,"debugRows")),e.getCenterRows=Se(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,s)=>{const i=new Set([...n??[],...s??[]]);return t.filter(a=>!i.has(a.id))},we(e.options,"debugRows"))}},Az={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Rn("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const s={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(a=>{a.getCanSelect()&&(s[a.id]=!0)}):i.forEach(a=>{delete s[a.id]}),s})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const s=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(a=>{Dp(i,a.id,s,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Se(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Mg(e,n):{rows:[],flatRows:[],rowsById:{}},we(e.options,"debugTable")),e.getFilteredSelectedRowModel=Se(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Mg(e,n):{rows:[],flatRows:[],rowsById:{}},we(e.options,"debugTable")),e.getGroupedSelectedRowModel=Se(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Mg(e,n):{rows:[],flatRows:[],rowsById:{}},we(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let s=!!(t.length&&Object.keys(n).length);return s&&t.some(i=>i.getCanSelect()&&!n[i.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=e.getState();let s=!!t.length;return s&&t.some(i=>!n[i.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,s)=>{const i=e.getIsSelected();t.setRowSelection(a=>{var u;if(n=typeof n<"u"?n:!i,e.getCanSelect()&&i===n)return a;const f={...a};return Dp(f,e.id,n,(u=s==null?void 0:s.selectChildren)!=null?u:!0,t),f})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return P0(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return zp(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return zp(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return s=>{var i;n&&e.toggleSelected((i=s.target)==null?void 0:i.checked)}}}},Dp=(e,t,n,s,i)=>{var a;const u=i.getRow(t,!0);n?(u.getCanMultiSelect()||Object.keys(e).forEach(f=>delete e[f]),u.getCanSelect()&&(e[t]=!0)):delete e[t],s&&(a=u.subRows)!=null&&a.length&&u.getCanSelectSubRows()&&u.subRows.forEach(f=>Dp(e,f.id,n,s,i))};function Mg(e,t){const n=e.getState().rowSelection,s=[],i={},a=function(u,f){return u.map(d=>{var h;const m=P0(d,n);if(m&&(s.push(d),i[d.id]=d),(h=d.subRows)!=null&&h.length&&(d={...d,subRows:a(d.subRows)}),m)return d}).filter(Boolean)};return{rows:a(t.rows),flatRows:s,rowsById:i}}function P0(e,t){var n;return(n=t[e.id])!=null?n:!1}function zp(e,t,n){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let i=!0,a=!1;return e.subRows.forEach(u=>{if(!(a&&!i)&&(u.getCanSelect()&&(P0(u,t)?a=!0:i=!1),u.subRows&&u.subRows.length)){const f=zp(u,t);f==="all"?a=!0:(f==="some"&&(a=!0),i=!1)}}),i?"all":a?"some":!1}const Up=/([0-9]+)/gm,Dz=(e,t,n)=>J_(Cs(e.getValue(n)).toLowerCase(),Cs(t.getValue(n)).toLowerCase()),zz=(e,t,n)=>J_(Cs(e.getValue(n)),Cs(t.getValue(n))),Uz=(e,t,n)=>I0(Cs(e.getValue(n)).toLowerCase(),Cs(t.getValue(n)).toLowerCase()),Vz=(e,t,n)=>I0(Cs(e.getValue(n)),Cs(t.getValue(n))),Bz=(e,t,n)=>{const s=e.getValue(n),i=t.getValue(n);return s>i?1:s<i?-1:0},qz=(e,t,n)=>I0(e.getValue(n),t.getValue(n));function I0(e,t){return e===t?0:e>t?1:-1}function Cs(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function J_(e,t){const n=e.split(Up).filter(Boolean),s=t.split(Up).filter(Boolean);for(;n.length&&s.length;){const i=n.shift(),a=s.shift(),u=parseInt(i,10),f=parseInt(a,10),d=[u,f].sort();if(isNaN(d[0])){if(i>a)return 1;if(a>i)return-1;continue}if(isNaN(d[1]))return isNaN(u)?-1:1;if(u>f)return 1;if(f>u)return-1}return n.length-s.length}const Na={alphanumeric:Dz,alphanumericCaseSensitive:zz,text:Uz,textCaseSensitive:Vz,datetime:Bz,basic:qz},Hz={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Rn("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const i of n){const a=i==null?void 0:i.getValue(e.id);if(Object.prototype.toString.call(a)==="[object Date]")return Na.datetime;if(typeof a=="string"&&(s=!0,a.split(Up).length>1))return Na.alphanumeric}return s?Na.text:Na.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,s;if(!e)throw new Error;return qf(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(s=t.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?n:Na[e.columnDef.sortingFn]},e.toggleSorting=(n,s)=>{const i=e.getNextSortingOrder(),a=typeof n<"u"&&n!==null;t.setSorting(u=>{const f=u==null?void 0:u.find(v=>v.id===e.id),d=u==null?void 0:u.findIndex(v=>v.id===e.id);let h=[],m,p=a?n:i==="desc";if(u!=null&&u.length&&e.getCanMultiSort()&&s?f?m="toggle":m="add":u!=null&&u.length&&d!==u.length-1?m="replace":f?m="toggle":m="replace",m==="toggle"&&(a||i||(m="remove")),m==="add"){var x;h=[...u,{id:e.id,desc:p}],h.splice(0,h.length-((x=t.options.maxMultiSortColCount)!=null?x:Number.MAX_SAFE_INTEGER))}else m==="toggle"?h=u.map(v=>v.id===e.id?{...v,desc:p}:v):m==="remove"?h=u.filter(v=>v.id!==e.id):h=[{id:e.id,desc:p}];return h})},e.getFirstSortDir=()=>{var n,s;return((n=(s=e.columnDef.sortDescFirst)!=null?s:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var s,i;const a=e.getFirstSortDir(),u=e.getIsSorted();return u?u!==a&&((s=t.options.enableSortingRemoval)==null||s)&&(!(n&&(i=t.options.enableMultiRemove)!=null)||i)?!1:u==="desc"?"asc":"desc":a},e.getCanSort=()=>{var n,s;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((s=t.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,s;return(n=(s=e.columnDef.enableMultiSort)!=null?s:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const s=(n=t.getState().sorting)==null?void 0:n.find(i=>i.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,s;return(n=(s=t.getState().sorting)==null?void 0:s.findIndex(i=>i.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return s=>{n&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,s;e.setSorting(t?[]:(n=(s=e.initialState)==null?void 0:s.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Wz=[hz,Mz,Ez,Pz,gz,pz,Tz,$z,Hz,_z,Fz,Lz,Oz,Az,jz];function Gz(e){var t,n;const s=[...Wz,...(t=e._features)!=null?t:[]];let i={_features:s};const a=i._features.reduce((x,v)=>Object.assign(x,v.getDefaultOptions==null?void 0:v.getDefaultOptions(i)),{}),u=x=>i.options.mergeOptions?i.options.mergeOptions(a,x):{...a,...x};let d={...{},...(n=e.initialState)!=null?n:{}};i._features.forEach(x=>{var v;d=(v=x.getInitialState==null?void 0:x.getInitialState(d))!=null?v:d});const h=[];let m=!1;const p={_features:s,options:{...a,...e},initialState:d,_queue:x=>{h.push(x),m||(m=!0,Promise.resolve().then(()=>{for(;h.length;)h.shift()();m=!1}).catch(v=>setTimeout(()=>{throw v})))},reset:()=>{i.setState(i.initialState)},setOptions:x=>{const v=gs(x,i.options);i.options=u(v)},getState:()=>i.options.state,setState:x=>{i.options.onStateChange==null||i.options.onStateChange(x)},_getRowId:(x,v,w)=>{var k;return(k=i.options.getRowId==null?void 0:i.options.getRowId(x,v,w))!=null?k:`${w?[w.id,v].join("."):v}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(x,v)=>{let w=(v?i.getPrePaginationRowModel():i.getRowModel()).rowsById[x];if(!w&&(w=i.getCoreRowModel().rowsById[x],!w))throw new Error;return w},_getDefaultColumnDef:Se(()=>[i.options.defaultColumn],x=>{var v;return x=(v=x)!=null?v:{},{header:w=>{const k=w.header.column.columnDef;return k.accessorKey?k.accessorKey:k.accessorFn?k.id:null},cell:w=>{var k,b;return(k=(b=w.renderValue())==null||b.toString==null?void 0:b.toString())!=null?k:null},...i._features.reduce((w,k)=>Object.assign(w,k.getDefaultColumnDef==null?void 0:k.getDefaultColumnDef()),{}),...x}},we(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:Se(()=>[i._getColumnDefs()],x=>{const v=function(w,k,b){return b===void 0&&(b=0),w.map(_=>{const E=dz(i,_,b,k),j=_;return E.columns=j.columns?v(j.columns,E,b+1):[],E})};return v(x)},we(e,"debugColumns")),getAllFlatColumns:Se(()=>[i.getAllColumns()],x=>x.flatMap(v=>v.getFlatColumns()),we(e,"debugColumns")),_getAllFlatColumnsById:Se(()=>[i.getAllFlatColumns()],x=>x.reduce((v,w)=>(v[w.id]=w,v),{}),we(e,"debugColumns")),getAllLeafColumns:Se(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(x,v)=>{let w=x.flatMap(k=>k.getLeafColumns());return v(w)},we(e,"debugColumns")),getColumn:x=>i._getAllFlatColumnsById()[x]};Object.assign(i,p);for(let x=0;x<i._features.length;x++){const v=i._features[x];v==null||v.createTable==null||v.createTable(i)}return i}function Kz(){return e=>Se(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},s=function(i,a,u){a===void 0&&(a=0);const f=[];for(let h=0;h<i.length;h++){const m=R0(e,e._getRowId(i[h],h,u),i[h],h,a,void 0,u==null?void 0:u.id);if(n.flatRows.push(m),n.rowsById[m.id]=m,f.push(m),e.options.getSubRows){var d;m.originalSubRows=e.options.getSubRows(i[h],h),(d=m.originalSubRows)!=null&&d.length&&(m.subRows=s(m.originalSubRows,a+1,m))}}return f};return n.rows=s(t),n},we(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Qz(){return e=>Se(()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows],(t,n,s)=>!n.rows.length||t!==!0&&!Object.keys(t??{}).length||!s?n:Jz(n),we(e.options,"debugTable"))}function Jz(e){const t=[],n=s=>{var i;t.push(s),(i=s.subRows)!=null&&i.length&&s.getIsExpanded()&&s.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Yz(e,t,n){return n.options.filterFromLeafRows?Xz(e,t,n):Zz(e,t,n)}function Xz(e,t,n){var s;const i=[],a={},u=(s=n.options.maxLeafRowFilterDepth)!=null?s:100,f=function(d,h){h===void 0&&(h=0);const m=[];for(let x=0;x<d.length;x++){var p;let v=d[x];const w=R0(n,v.id,v.original,v.index,v.depth,void 0,v.parentId);if(w.columnFilters=v.columnFilters,(p=v.subRows)!=null&&p.length&&h<u){if(w.subRows=f(v.subRows,h+1),v=w,t(v)&&!w.subRows.length){m.push(v),a[v.id]=v,i.push(v);continue}if(t(v)||w.subRows.length){m.push(v),a[v.id]=v,i.push(v);continue}}else v=w,t(v)&&(m.push(v),a[v.id]=v,i.push(v))}return m};return{rows:f(e),flatRows:i,rowsById:a}}function Zz(e,t,n){var s;const i=[],a={},u=(s=n.options.maxLeafRowFilterDepth)!=null?s:100,f=function(d,h){h===void 0&&(h=0);const m=[];for(let x=0;x<d.length;x++){let v=d[x];if(t(v)){var p;if((p=v.subRows)!=null&&p.length&&h<u){const k=R0(n,v.id,v.original,v.index,v.depth,void 0,v.parentId);k.subRows=f(v.subRows,h+1),v=k}m.push(v),i.push(v),a[v.id]=v}}return m};return{rows:f(e),flatRows:i,rowsById:a}}function e5(){return e=>Se(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,s)=>{if(!t.rows.length||!(n!=null&&n.length)&&!s){for(let x=0;x<t.flatRows.length;x++)t.flatRows[x].columnFilters={},t.flatRows[x].columnFiltersMeta={};return t}const i=[],a=[];(n??[]).forEach(x=>{var v;const w=e.getColumn(x.id);if(!w)return;const k=w.getFilterFn();k&&i.push({id:x.id,filterFn:k,resolvedValue:(v=k.resolveFilterValue==null?void 0:k.resolveFilterValue(x.value))!=null?v:x.value})});const u=(n??[]).map(x=>x.id),f=e.getGlobalFilterFn(),d=e.getAllLeafColumns().filter(x=>x.getCanGlobalFilter());s&&f&&d.length&&(u.push("__global__"),d.forEach(x=>{var v;a.push({id:x.id,filterFn:f,resolvedValue:(v=f.resolveFilterValue==null?void 0:f.resolveFilterValue(s))!=null?v:s})}));let h,m;for(let x=0;x<t.flatRows.length;x++){const v=t.flatRows[x];if(v.columnFilters={},i.length)for(let w=0;w<i.length;w++){h=i[w];const k=h.id;v.columnFilters[k]=h.filterFn(v,k,h.resolvedValue,b=>{v.columnFiltersMeta[k]=b})}if(a.length){for(let w=0;w<a.length;w++){m=a[w];const k=m.id;if(m.filterFn(v,k,m.resolvedValue,b=>{v.columnFiltersMeta[k]=b})){v.columnFilters.__global__=!0;break}}v.columnFilters.__global__!==!0&&(v.columnFilters.__global__=!1)}}const p=x=>{for(let v=0;v<u.length;v++)if(x.columnFilters[u[v]]===!1)return!1;return!0};return Yz(t.rows,p,e)},we(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function t5(){return e=>Se(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const s=e.getState().sorting,i=[],a=s.filter(d=>{var h;return(h=e.getColumn(d.id))==null?void 0:h.getCanSort()}),u={};a.forEach(d=>{const h=e.getColumn(d.id);h&&(u[d.id]={sortUndefined:h.columnDef.sortUndefined,invertSorting:h.columnDef.invertSorting,sortingFn:h.getSortingFn()})});const f=d=>{const h=d.map(m=>({...m}));return h.sort((m,p)=>{for(let v=0;v<a.length;v+=1){var x;const w=a[v],k=u[w.id],b=k.sortUndefined,_=(x=w==null?void 0:w.desc)!=null?x:!1;let E=0;if(b){const j=m.getValue(w.id),R=p.getValue(w.id),T=j===void 0,O=R===void 0;if(T||O){if(b==="first")return T?-1:1;if(b==="last")return T?1:-1;E=T&&O?0:T?b:-b}}if(E===0&&(E=k.sortingFn(m,p,w.id)),E!==0)return _&&(E*=-1),k.invertSorting&&(E*=-1),E}return m.index-p.index}),h.forEach(m=>{var p;i.push(m),(p=m.subRows)!=null&&p.length&&(m.subRows=f(m.subRows))}),h};return{rows:f(n.rows),flatRows:i,rowsById:n.rowsById}},we(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
|
|
97
|
+
* react-table
|
|
98
|
+
*
|
|
99
|
+
* Copyright (c) TanStack
|
|
100
|
+
*
|
|
101
|
+
* This source code is licensed under the MIT license found in the
|
|
102
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
103
|
+
*
|
|
104
|
+
* @license MIT
|
|
105
|
+
*/function Tg(e,t){return e?n5(e)?z.createElement(e,t):e:null}function n5(e){return r5(e)||typeof e=="function"||s5(e)}function r5(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function s5(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function o5(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=z.useState(()=>({current:Gz(t)})),[s,i]=z.useState(()=>n.current.initialState);return n.current.setOptions(a=>({...a,...e,state:{...s,...e.state},onStateChange:u=>{i(u),e.onStateChange==null||e.onStateChange(u)}})),n.current}const ii=lz(),Y_=y.jsx("span",{className:"text-fg-faint",children:"—"}),i5=e=>`${tl(e.label)} ${e.label} ${e.models.map(Or).join(" ")} ${e.models.join(" ")}`.toLowerCase();function a5(e){return z.useMemo(()=>[ii.accessor("label",{header:e,cell:t=>y.jsxs("button",{type:"button","aria-expanded":t.row.getIsExpanded(),onClick:n=>{n.stopPropagation(),t.row.toggleExpanded()},className:"flex items-center gap-1 rounded text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",children:[y.jsx("span",{"aria-hidden":!0,className:t.row.getIsExpanded()?"text-accent":"text-fg-faint",children:t.row.getIsExpanded()?"▾":"▸"}),y.jsx("span",{className:"text-fg",children:tl(t.getValue())})]})}),ii.display({id:"models",header:"models",cell:t=>y.jsx("span",{className:"line-clamp-1 text-fg-dim",children:t.row.original.models.map(Or).join(", ")})}),ii.accessor("total",{header:"tokens",meta:{align:"right"},cell:t=>t.getValue()>0?y.jsx("span",{className:"text-fg",children:wn(t.getValue())}):Y_}),ii.accessor("cacheSavings",{header:"saved",meta:{align:"right",hiddenSm:!0},cell:t=>y.jsx("span",{className:"text-positive",children:Ue(t.getValue())})}),ii.accessor("count",{header:"calls",meta:{align:"right",hiddenSm:!0},cell:t=>y.jsx("span",{className:"text-fg-dim",children:X1(t.getValue())})}),ii.accessor("cost",{header:"cost",meta:{align:"right"},cell:t=>y.jsx("span",{className:"text-cost",children:Ue(t.getValue())})})],[e])}const l5=e=>`py-2 pr-3${(e==null?void 0:e.align)==="right"?" text-right":""}${e!=null&&e.hiddenSm?" hidden sm:table-cell":""}`;function u5({rows:e,granLabel:t,q:n}){const[s,i]=z.useState([{id:"label",desc:!0}]),[a,u]=z.useState({}),d=a5(t==="monthly"?"month":t==="weekly"?"week":"date"),h=o5({data:e,columns:d,state:{sorting:s,expanded:a,globalFilter:n},onSortingChange:i,onExpandedChange:u,getRowCanExpand:()=>!0,globalFilterFn:(x,v,w)=>!String(w).trim()||i5(x.original).includes(String(w).trim().toLowerCase()),getCoreRowModel:Kz(),getSortedRowModel:t5(),getFilteredRowModel:e5(),getExpandedRowModel:Qz()}),m=h.getRowModel().rows,p=z.useMemo(()=>m.reduce((x,v)=>({total:x.total+v.original.total,cost:x.cost+v.original.cost,cacheSavings:x.cacheSavings+v.original.cacheSavings,count:x.count+v.original.count}),{total:0,cost:0,cacheSavings:0,count:0}),[m]);return y.jsx(Bf,{title:`explore · ${t}`,captureName:"explore",children:y.jsx("div",{className:"max-h-[calc(100vh-240px)] overflow-auto",children:y.jsxs("table",{className:"w-full border-collapse text-xs",children:[y.jsxs("colgroup",{children:[y.jsx("col",{}),y.jsx("col",{style:{width:"34%"}}),y.jsx("col",{style:{width:"13%"}}),y.jsx("col",{style:{width:"12%"}}),y.jsx("col",{style:{width:"11%"}}),y.jsx("col",{style:{width:"13%"}})]}),y.jsx("thead",{children:y.jsx("tr",{className:"sticky top-0 z-10 bg-bg-1 text-[11px] shadow-[inset_0_-1px_0_var(--color-line)]",children:h.getHeaderGroups()[0].headers.map(x=>{const v=x.column.columnDef.meta,w=x.column.getIsSorted();return y.jsx("th",{className:`py-2 pr-3 font-normal ${(v==null?void 0:v.align)==="right"?"text-right":"text-left"}${v!=null&&v.hiddenSm?" hidden sm:table-cell":""}`,children:x.column.getCanSort()?y.jsxs("button",{type:"button",onClick:x.column.getToggleSortingHandler(),className:`flex w-full items-center gap-1 text-fg-faint transition hover:text-fg ${(v==null?void 0:v.align)==="right"?"justify-end":""}`,children:[Tg(x.column.columnDef.header,x.getContext()),w&&y.jsx("span",{className:"text-accent",children:w==="asc"?"▲":"▼"})]}):y.jsx("span",{className:"text-fg-faint",children:Tg(x.column.columnDef.header,x.getContext())})},x.id)})})}),y.jsxs("tbody",{children:[m.length===0&&y.jsx("tr",{children:y.jsx("td",{colSpan:6,className:"py-8 text-center text-fg-faint",children:n.trim()?`no rows match “${n.trim()}”`:"no usage in this range"})}),m.map(x=>y.jsxs(z.Fragment,{children:[y.jsx("tr",{className:"cursor-pointer border-b border-line-faint transition hover:bg-bg-2/60",onClick:()=>x.toggleExpanded(),children:x.getVisibleCells().map(v=>y.jsx("td",{className:`${l5(v.column.columnDef.meta)}${v.column.id==="label"?" whitespace-nowrap":""} tnum`,children:Tg(v.column.columnDef.cell,v.getContext())},v.id))}),x.getIsExpanded()&&x.original.breakdown.map(v=>{const w=nl(v);return y.jsxs("tr",{className:"border-b border-line-faint bg-bg-0/40 text-[11px]",children:[y.jsxs("td",{className:"py-1.5 pr-3 pl-5 text-fg-dim",colSpan:2,children:[y.jsx("span",{className:"mr-1.5 inline-block size-1.5 rounded-full align-middle",style:{background:Xp(v.name)}}),Or(v.name)]}),y.jsx("td",{className:"tnum py-1.5 pr-3 text-right text-fg-dim",children:w>0?wn(w):Y_}),y.jsx("td",{className:"tnum hidden py-1.5 pr-3 text-right text-positive/80 sm:table-cell",children:Ue(v.cacheSavings)}),y.jsx("td",{className:"tnum hidden py-1.5 pr-3 text-right text-fg-faint sm:table-cell",children:bs(v.count)}),y.jsx("td",{className:"tnum py-1.5 text-right text-cost/90",children:Ue(v.cost)})]},v.name)})]},x.id))]}),m.length>0&&y.jsx("tfoot",{children:y.jsxs("tr",{className:"sticky bottom-0 z-10 bg-bg-1 text-fg shadow-[inset_0_1px_0_var(--color-line)]",children:[y.jsxs("td",{className:"py-2 pr-3 font-display text-[11px] uppercase text-fg-dim",colSpan:2,children:["total · ",m.length]}),y.jsx("td",{className:"tnum py-2 pr-3 text-right",children:wn(p.total)}),y.jsx("td",{className:"tnum hidden py-2 pr-3 text-right text-positive sm:table-cell",children:Ue(p.cacheSavings)}),y.jsx("td",{className:"tnum hidden py-2 pr-3 text-right sm:table-cell",children:X1(p.count)}),y.jsx("td",{className:"tnum py-2 text-right text-cost",children:Ue(p.cost)})]})})]})})})}const Hf=()=>z_(()=>import("./timeline-BjoaOdbh.js"),__vite__mapDeps([0,1]),import.meta.url),Al=()=>z_(()=>import("./breakdown-DFnPYZtA.js"),__vite__mapDeps([2,1]),import.meta.url);Hf();Al();const c5=z.lazy(()=>Hf().then(e=>({default:e.CostTimeline}))),f5=z.lazy(()=>Hf().then(e=>({default:e.CumulativeSpend}))),d5=z.lazy(()=>Hf().then(e=>({default:e.CacheSavings}))),X_=z.lazy(()=>Al().then(e=>({default:e.CostByModel}))),Z_=z.lazy(()=>Al().then(e=>({default:e.ProviderDonut}))),Ww=z.lazy(()=>Al().then(e=>({default:e.TokenComposition}))),h5=z.lazy(()=>Al().then(e=>({default:e.CacheByModel}))),g5=({className:e})=>y.jsx("div",{className:e,"aria-hidden":!0}),us=({children:e})=>y.jsx(z.Suspense,{fallback:null,children:e}),Gw=[{key:"overview",label:"overview"},{key:"analytics",label:"analytics"},{key:"models",label:"models"},{key:"explore",label:"explore"}],p5=[{value:"daily",label:"daily"},{value:"weekly",label:"weekly"},{value:"monthly",label:"monthly"}];function m5({derived:e,periodLabel:t,scopeLabel:n,providers:s}){const i=a=>{var u;return((u=s.find(f=>f.id===a))==null?void 0:u.name)??a};return y.jsxs("div",{className:"flex flex-col gap-4",children:[y.jsx(J4,{derived:e,periodLabel:t}),y.jsx(z.Suspense,{fallback:y.jsx(g5,{className:"h-[clamp(320px,42vh,560px)]"}),children:y.jsx(c5,{derived:e,periodLabel:n,heightClass:"h-[clamp(320px,42vh,560px)]"})}),y.jsx(Y4,{accounts:e.cardAccounts,nameOf:i})]})}function y5({derived:e,scopeLabel:t}){const n=e.byProvider.length>1;return y.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[y.jsx("div",{className:"md:col-span-2",children:y.jsx(sz,{derived:e,periodLabel:t})}),y.jsx(us,{children:y.jsx(X_,{derived:e,periodLabel:t})}),y.jsx(us,{children:n?y.jsx(Z_,{derived:e,periodLabel:t}):y.jsx(Ww,{derived:e,periodLabel:t})}),n&&y.jsx(us,{children:y.jsx(Ww,{derived:e,periodLabel:t})}),y.jsx("div",{className:n?void 0:"md:col-span-2",children:y.jsx(us,{children:y.jsx(d5,{derived:e,periodLabel:t})})}),y.jsx("div",{className:"md:col-span-2",children:y.jsx(us,{children:y.jsx(f5,{derived:e,height:300,periodLabel:t})})})]})}function x5({derived:e,scopeLabel:t}){const n=e.byProvider.length>1;return y.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[y.jsx("div",{className:"md:col-span-2",children:y.jsx(az,{derived:e,periodLabel:t})}),y.jsx("div",{className:n?void 0:"md:col-span-2",children:y.jsx(us,{children:y.jsx(X_,{derived:e,metric:"tokens",limit:12,periodLabel:t})})}),n&&y.jsx(us,{children:y.jsx(Z_,{derived:e,periodLabel:t})}),y.jsx("div",{className:"md:col-span-2",children:y.jsx(us,{children:y.jsx(h5,{derived:e,periodLabel:t})})})]})}function v5({snapshot:e,filters:t,periodLabel:n}){const[s,i]=z.useState(""),[a,u]=z.useState("daily"),f=z.useMemo(()=>Fj(e,t,a),[e,t,a]),d=a!=="daily"?`showing up to ${a==="monthly"?"12 months":"12 weeks"}`:t.period!=="all"?`scoped to ${n}`:null;return y.jsxs("div",{className:"flex flex-col gap-3",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-xs text-fg-faint",children:"granularity:"}),y.jsx(Sn,{options:p5,value:a,onChange:u,size:"sm",ariaLabel:"row granularity",btnClassName:"px-3 py-1 text-xs capitalize transition"})]}),d&&y.jsx("span",{className:"text-xs text-fg-faint",children:d}),y.jsxs("div",{className:"ml-auto flex items-center gap-1.5 rounded border border-line bg-bg-1 px-2 py-1 text-xs focus-within:border-line-2",children:[y.jsx(Wj,{className:"size-3 text-fg-faint"}),y.jsx("input",{type:"search",value:s,onChange:h=>i(h.target.value),onKeyDown:h=>{h.key==="Escape"&&i("")},placeholder:"filter rows…","aria-label":"Filter rows by date or model",autoComplete:"off",spellCheck:!1,className:"w-32 bg-transparent text-fg outline-none placeholder:text-fg-faint [&::-webkit-search-cancel-button]:appearance-none"}),s&&y.jsx("button",{type:"button",onClick:()=>i(""),"aria-label":"Clear filter",children:y.jsx(xi,{className:"size-3 text-fg-faint hover:text-fg","aria-hidden":!0})})]})]}),y.jsx(u5,{rows:f,granLabel:a,q:s})]})}function j0(e,t,n){try{return e(t)}catch(s){return uP("[nuqs] Error while parsing value `%s`: %O"+(n?" (for key `%s`)":""),t,s,n),null}}function ir(e){function t(n){if(typeof n>"u")return null;let s="";if(Array.isArray(n)){if(n[0]===void 0)return null;s=n[0]}return typeof n=="string"&&(s=n),j0(e.parse,s)}return{type:"single",eq:(n,s)=>n===s,...e,parseServerSide:t,withDefault(n){return{...this,defaultValue:n,parseServerSide(s){return t(s)??n}}},withOptions(n){return{...this,...n}}}}const $g=ir({parse:e=>e,serialize:String});ir({parse:e=>{const t=parseInt(e);return t==t?t:null},serialize:e=>""+Math.round(e)});ir({parse:e=>{const t=parseInt(e);return t==t?t-1:null},serialize:e=>""+Math.round(e+1)});ir({parse:e=>{const t=parseInt(e,16);return t==t?t:null},serialize:e=>{const t=Math.round(e).toString(16);return(t.length&1?"0":"")+t}});ir({parse:e=>{const t=parseFloat(e);return t==t?t:null},serialize:String});ir({parse:e=>e.toLowerCase()==="true",serialize:String});function N0(e,t){return e.valueOf()===t.valueOf()}ir({parse:e=>{const t=parseInt(e);return t==t?new Date(t):null},serialize:e=>""+e.valueOf(),eq:N0});ir({parse:e=>{const t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:N0});ir({parse:e=>{const t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:N0});function S5(e){return w5(e)}function w5(e){return ir({parse:t=>{const n=t;return e.includes(n)?n:null},serialize:String})}function Kw(e,t=","){const n=e.eq??((i,a)=>i===a),s=encodeURIComponent(t);return ir({parse:i=>i===""?[]:i.split(t).map((a,u)=>j0(e.parse,a.replaceAll(s,t),`[${u}]`)).filter(a=>a!=null),serialize:i=>i.map(a=>(e.serialize?e.serialize(a):String(a)).replaceAll(t,s)).join(t),eq(i,a){return i===a?!0:i.length!==a.length?!1:i.every((u,f)=>n(u,a[f]))}})}const Fg=Hp(),k5={};function C5(e,t={}){const n=z.useId(),s=yP(),i=xP(),{history:a="replace",scroll:u=(s==null?void 0:s.scroll)??!1,shallow:f=(s==null?void 0:s.shallow)??!0,throttleMs:d=Da.timeMs,limitUrlUpdates:h=s==null?void 0:s.limitUrlUpdates,clearOnDefault:m=(s==null?void 0:s.clearOnDefault)??!0,startTransition:p,urlKeys:x=k5}=t,v=Object.keys(e).join(","),w=z.useMemo(()=>Object.fromEntries(Object.keys(e).map(U=>[U,x[U]??U])),[v,JSON.stringify(x)]),k=mP(Object.values(w)),b=k.searchParams,_=z.useRef({}),E=z.useMemo(()=>Object.fromEntries(Object.keys(e).map(U=>[U,e[U].defaultValue??null])),[Object.values(e).map(({defaultValue:U})=>U).join(",")]),j=zh.useQueuedQueries(Object.values(w)),[R,T]=z.useState(()=>Lg(e,x,b??new URLSearchParams,j).state),O=z.useRef(R);if(Ye("[nuq+ %s `%s`] render - state: %O, iSP: %s",n,v,R,b),Object.keys(_.current).join("&")!==Object.values(w).join("&")){const{state:U,hasChanged:V}=Lg(e,x,b,j,_.current,O.current);V&&(Ye("[nuq+ %s `%s`] State changed: %O",n,v,{state:U,initialSearchParams:b,queuedQueries:j,queryRef:_.current,stateRef:O.current}),O.current=U,T(U)),_.current=Object.fromEntries(Object.entries(w).map(([Z,te])=>{var ae;return[te,((ae=e[Z])==null?void 0:ae.type)==="multi"?b==null?void 0:b.getAll(te):(b==null?void 0:b.get(te))??null]}))}z.useEffect(()=>{const{state:U,hasChanged:V}=Lg(e,x,b,j,_.current,O.current);V&&(Ye("[nuq+ %s `%s`] State changed: %O",n,v,{state:U,initialSearchParams:b,queuedQueries:j,queryRef:_.current,stateRef:O.current}),O.current=U,T(U))},[Object.values(w).map(U=>`${U}=${b==null?void 0:b.getAll(U)}`).join("&"),JSON.stringify(j)]),z.useEffect(()=>{const U=Object.keys(e).reduce((V,Z)=>(V[Z]=({state:te,query:ae})=>{T(P=>{const{defaultValue:H}=e[Z],X=w[Z],K=te??H??null,q=P[Z]??H??null;return Object.is(q,K)?(Ye("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",n,v,X,te,H,O.current),P):(O.current={...O.current,[Z]:K},_.current[X]=ae,Ye("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",n,v,X,te,H,O.current),O.current)})},V),{});for(const V of Object.keys(e)){const Z=w[V];Ye("[nuq+ %s `%s`] Subscribing to sync for `%s`",n,Z,v),Fg.on(Z,U[V])}return()=>{for(const V of Object.keys(e)){const Z=w[V];Ye("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",n,Z,v),Fg.off(Z,U[V])}}},[v,w]);const $=z.useCallback((U,V={})=>{var q,Y,se,ee,M,J;const Z=Object.fromEntries(Object.keys(e).map(pe=>[pe,null])),te=typeof U=="function"?U(Qw(O.current,E))??Z:U??Z;Ye("[nuq+ %s `%s`] setState: %O",n,v,te);let ae,P=0,H=!1;const X=[];for(let[pe,he]of Object.entries(te)){const ce=e[pe],be=w[pe];if(!ce||he===void 0)continue;(V.clearOnDefault??ce.clearOnDefault??m)&&he!==null&&ce.defaultValue!==void 0&&(ce.eq??((Ee,lt)=>Ee===lt))(he,ce.defaultValue)&&(he=null);const $e=he===null?null:(ce.serialize??String)(he);Fg.emit(be,{state:he,query:$e});const Ce={key:be,query:$e,options:{history:V.history??ce.history??a,shallow:V.shallow??ce.shallow??f,scroll:V.scroll??ce.scroll??u,startTransition:V.startTransition??ce.startTransition??p}};if(((q=V==null?void 0:V.limitUrlUpdates)==null?void 0:q.method)==="debounce"||(h==null?void 0:h.method)==="debounce"||((Y=ce.limitUrlUpdates)==null?void 0:Y.method)==="debounce"){Ce.options.shallow===!0&&console.warn(vl(422));const Ee=((se=V==null?void 0:V.limitUrlUpdates)==null?void 0:se.timeMs)??(h==null?void 0:h.timeMs)??((ee=ce.limitUrlUpdates)==null?void 0:ee.timeMs)??Da.timeMs,lt=zh.push(Ce,Ee,k,i);P<Ee&&(ae=lt,P=Ee)}else{const Ee=((M=V==null?void 0:V.limitUrlUpdates)==null?void 0:M.timeMs)??((J=ce==null?void 0:ce.limitUrlUpdates)==null?void 0:J.timeMs)??(h==null?void 0:h.timeMs)??V.throttleMs??ce.throttleMs??d;X.push(zh.abort(be)),dc.push(Ce,Ee),H=!0}}const K=X.reduce((pe,he)=>he(pe),H?dc.flush(k,i):dc.getPendingPromise(k));return ae??K},[v,a,f,u,d,h==null?void 0:h.method,h==null?void 0:h.timeMs,p,w,k.updateUrl,k.getSearchParamsSnapshot,k.rateLimitFactor,i,E]);return[z.useMemo(()=>Qw(R,E),[R,E]),$]}function Lg(e,t,n,s,i,a){let u=!1;const f=Object.entries(e).reduce((d,[h,m])=>{const p=(t==null?void 0:t[h])??h,x=s[p],v=m.type==="multi"?[]:null,w=x===void 0?(m.type==="multi"?n==null?void 0:n.getAll(p):n==null?void 0:n.get(p))??v:x;return i&&a&&y1(i[p]??v,w)?(d[h]=a[h]??null,d):(u=!0,d[h]=(wP(w)?null:j0(m.parse,w,p))??null,i&&(i[p]=w),d)},{});if(!u){const d=Object.keys(e),h=Object.keys(a??{});u=d.length!==h.length||d.some(m=>!h.includes(m))}return{state:f,hasChanged:u}}function Qw(e,t){return Object.fromEntries(Object.keys(e).map(n=>[n,e[n]??t[n]??null]))}const b5=["7d","30d","90d","mtd","all"];function _5(){const[e,t]=C5({p:Kw($g).withDefault([]),m:Kw($g).withDefault([]),a:$g.withDefault("all"),period:S5(b5).withDefault(Nj.period)},{history:"replace"}),n=z.useMemo(()=>({providers:e.p,models:e.m,account:e.a,period:e.period}),[e.p,e.m,e.a,e.period]),s=z.useCallback(i=>{t(a=>{const u={providers:a.p,models:a.m,account:a.a,period:a.period},f=typeof i=="function"?i(u):i;return{p:f.providers,m:f.models,a:f.account,period:f.period}})},[t]);return[n,s]}function R5(){const[e,t]=z.useState(null),[n,s]=z.useState("connecting"),i=z.useRef(null);return z.useEffect(()=>{let a=!1;const u=Ol(),f=P4(h=>{a||s(h)}),d=u.subscribeSnapshot(h=>{a||(t(h),s("live"))});return i.current=d,()=>{var h;a=!0,f(),(h=i.current)==null||h.call(i),i.current=null}},[]),{snapshot:e,conn:n}}const Vp=e=>`/${e}`,eR=z.createContext(null),Wf=()=>{const e=z.useContext(eR);if(!e)throw new Error("useDashboard outside provider");return e};function E5(e=1e3){const[t,n]=z.useState(()=>Date.now());return z.useEffect(()=>{const s=setInterval(()=>n(Date.now()),e);return()=>clearInterval(s)},[e]),t}function P5(){const[e,t]=z.useState(()=>document.documentElement.classList.contains("light")?"light":"dark");return z.useEffect(()=>{document.documentElement.classList.toggle("light",e==="light")},[e]),[e,()=>{const s=e==="dark"?"light":"dark";try{localStorage.setItem("tokmon-theme",s)}catch{}t(s)}]}function I5({theme:e,onToggle:t}){return y.jsx("button",{type:"button",onClick:t,title:e==="dark"?"Switch to light":"Switch to dark","aria-label":"Toggle theme",className:"rounded border border-line bg-bg-1 p-1.5 text-fg-dim transition hover:border-line-2 hover:text-fg max-sm:p-2.5",children:e==="dark"?y.jsx(Gj,{className:"size-3.5"}):y.jsx(Kj,{className:"size-3.5"})})}function j5({conn:e,freshAt:t}){const n=E5(),s=e==="live"?"var(--color-positive)":e==="error"?"var(--color-warning)":"var(--color-cost)",i=t?Pj(t,n):null,a=e==="live"?i??"live":e==="connecting"?"connecting…":e==="reconnecting"?i?`reconnecting · ${i}`:"reconnecting…":i?`offline · ${i}`:"offline";return y.jsxs("span",{className:"flex items-center gap-1.5 text-xs",role:"status","aria-label":e==="live"?"live":e,children:[y.jsxs("span",{className:"relative flex size-2",children:[e==="live"&&y.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full opacity-60",style:{background:s}}),y.jsx("span",{className:"relative inline-flex size-2 rounded-full",style:{background:s}})]}),y.jsx("span",{className:"inline-block truncate text-fg-dim max-sm:max-w-[7rem]","aria-hidden":!0,children:a})]})}function Og({label:e}){return y.jsxs("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-2 text-sm text-fg-dim",children:[y.jsxs("span",{className:"font-display text-lg text-fg-dim",children:["tokmon",y.jsx("span",{className:"cursor-blink text-accent",children:"▋"})]}),y.jsx("span",{className:"text-fg-faint",children:e})]})}function N5({onOpen:e}){return y.jsx("button",{type:"button",onClick:e,title:"Settings","aria-label":"Open settings",className:"rounded border border-line bg-bg-1 p-1.5 text-fg-dim transition hover:border-line-2 hover:text-fg max-sm:p-2.5",children:y.jsx(Qj,{className:"size-3.5"})})}function M5(){var $,U;const{snapshot:e,conn:t}=R5(),[n,s]=_5(),[i,a]=P5(),[u,f]=z.useState(!1),d=z.useMemo(()=>Uj(e,n),[e,n]),h=(($=ek.find(V=>V.key===n.period))==null?void 0:$.label)??n.period,m=n.period==="all"?void 0:h,p=bj({select:V=>V.location.pathname}),x=((U=Gw.find(V=>Vp(V.key)===p))==null?void 0:U.key)??"overview";z.useEffect(()=>{var X;if(!e)return;const V=new Set(e.providers.map(K=>K.id)),Z=new Set(e.accounts.map(K=>K.id)),te=n.providers.filter(K=>V.has(K)),ae=n.account==="all"||Z.has(n.account)?n.account:"all",P=new Set;for(const K of e.accounts)for(const q of((X=K.table)==null?void 0:X.monthly)??[])for(const Y of q.breakdown)P.add(Y.name);const H=P.size>0?n.models.filter(K=>P.has(K)):n.models;(te.length!==n.providers.length||ae!==n.account||H.length!==n.models.length)&&s(K=>({...K,providers:te,account:ae,models:H}))},[e,n,s]);const v=(e==null?void 0:e.accounts.filter(V=>V.hasUsage))??[],w=v.length>0,k=((e==null?void 0:e.accounts)??[]).some(Qg),b=((e==null?void 0:e.accounts)??[]).some(V=>V.hasBilling&&!Qg(V)),_=w&&v.every(V=>V.table!=null),E=z.useRef(!1);z.useEffect(()=>{_&&(E.current=!0)},[_]);const[j,R]=z.useState(!1);z.useEffect(()=>{const V=setTimeout(()=>R(!0),12e3);return()=>clearTimeout(V)},[]);const T=!w||_||E.current||j,O=z.useMemo(()=>e?{snapshot:e,filters:n,derived:d,periodLabel:h,scopeLabel:m}:null,[e,n,d,h,m]);return y.jsxs("div",{className:"min-h-screen",children:[y.jsxs("header",{className:"relative z-30 border-b border-line bg-bg-0/80 backdrop-blur",children:[y.jsxs("div",{className:"mx-auto max-w-[1600px] px-5 2xl:max-w-[1920px]",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 py-3.5",children:[y.jsx("span",{className:"font-display text-2xl text-fg-bright",children:"TOKMON"}),y.jsxs("span",{className:"hidden text-sm text-fg-faint sm:inline",children:["~/usage ",y.jsx("span",{className:"text-prompt",children:"$"})," ",y.jsx("span",{className:"text-fg-dim",children:x}),y.jsx("span",{className:"cursor-blink text-accent",children:"▋"})]}),y.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-3",children:[y.jsx(j5,{conn:t,freshAt:(e==null?void 0:e.generatedAt)??null}),y.jsx(N5,{onOpen:()=>f(!0)}),y.jsx(I5,{theme:i,onToggle:a}),T&&(w||k)&&y.jsx(oN,{derived:d,periodLabel:h,tz:(e==null?void 0:e.tz)??"",version:(e==null?void 0:e.version)??""})]})]}),y.jsx("nav",{className:"-mb-px flex items-center gap-1 overflow-x-auto",children:Gw.map(V=>y.jsx(Yp,{to:Vp(V.key),className:`relative shrink-0 border-b-2 px-3 py-2 font-display text-xs uppercase tracking-wider transition ${x===V.key?"border-accent text-fg-bright":"border-transparent text-fg-faint hover:text-fg-dim"}`,children:V.label},V.key))})]}),y.jsx(Xj,{snapshot:e,derived:d,filters:n,setFilters:s})]}),y.jsx("main",{className:"mx-auto max-w-[1600px] px-5 2xl:max-w-[1920px] py-5",children:e?!w&&!k?b&&!j&&t!=="error"?y.jsx(Og,{label:"reading billing…"}):y.jsx("div",{className:"rounded-md border border-line bg-bg-1 p-8 text-center text-sm text-fg-dim",children:"No providers detected. Open tokmon, enable a provider, then refresh."}):!T||!O?y.jsx(Og,{label:t==="error"?"connection lost — retrying…":"reading usage history…"}):y.jsx(eR.Provider,{value:O,children:y.jsx(Y1,{})}):y.jsx(Og,{label:t==="error"?"connection lost — retrying…":"reading usage…"})}),y.jsxs("footer",{className:"mx-auto max-w-[1600px] px-5 2xl:max-w-[1920px] py-6 text-center text-[11px] text-fg-faint",children:["tokmon",e!=null&&e.version?` v${e.version}`:""," · by David Ilie · live LLM usage dashboard"]}),u&&y.jsx(W4,{snapshot:e,onClose:()=>f(!1)})]})}function Jw(){const{derived:e,periodLabel:t,scopeLabel:n,snapshot:s}=Wf();return y.jsx("div",{children:y.jsx(m5,{derived:e,periodLabel:t,scopeLabel:n,providers:s.providers})})}function T5(){const{derived:e,scopeLabel:t}=Wf();return y.jsx("div",{children:y.jsx(y5,{derived:e,scopeLabel:t})})}function $5(){const{derived:e,scopeLabel:t}=Wf();return y.jsx("div",{children:y.jsx(x5,{derived:e,scopeLabel:t})})}function F5(){const{snapshot:e,filters:t,periodLabel:n}=Wf();return y.jsx("div",{children:y.jsx(v5,{snapshot:e,filters:t,periodLabel:n})})}const Bp=aj({component:M5}),fc=(e,t)=>K1({getParentRoute:()=>Bp,path:Vp(e),component:t}),L5=Bp.addChildren([K1({getParentRoute:()=>Bp,path:"/",component:Jw}),fc("overview",Jw),fc("analytics",T5),fc("models",$5),fc("explore",F5)]),O5=Sj({routeTree:L5,history:mI(),defaultViewTransition:!0});function A5(){return y.jsx(Cj,{router:O5})}aP.createRoot(document.getElementById("root")).render(y.jsx(z.StrictMode,{children:y.jsx(NP,{children:y.jsx(sN,{children:y.jsx(A5,{})})})}));export{X2 as E,Bf as P,Ka as R,Sn as S,U5 as T,V5 as a,Ue as b,wn as c,Z1 as d,nl as e,tl as f,ZE as g,z5 as h,y as j,z as r,Or as s};
|